NO

Author Topic: "Copy from" option on "project modes..." dialog.  (Read 1904 times)

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1929
"Copy from" option on "project modes..." dialog.
« on: August 20, 2021, 11:38:51 am »
When creating a new mode, or just moving from 'Release' to 'debug', the IDE uses always a standard empty configuration.
On more complex projects this lead to tedious and error prone rewriting of all settings for compiler options, folders, libraries, etc.
It would be very effective and efficient to have the possibility to copy the whole settings from one mode to another, so you can then change only few settings.
Thank you Pelle.

Offline John Z

  • Member
  • *
  • Posts: 490
Re: "Copy from" option on "project modes..." dialog.
« Reply #1 on: August 20, 2021, 03:07:02 pm »
Good Idea.

As a temp workaround to avoid tedious mistakes one could create the new mode then exit the IDE and edit the ppj file directly, copy and paste from your mode of choice into the new mode.  Then restart the IDE and make only the changes needed for the new mode.  :) Not as easy as making it an intrinsic feature but might be less error prone and tedious than starting from scratch.

Yes the ppj says "don't dare edit this file"  but I've been able to .... make backup first use a UTF8 capable editor.

Alternatively I wonder if an add-in could do what you are suggesting....

John Z

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1996
Re: "Copy from" option on "project modes..." dialog.
« Reply #2 on: August 21, 2021, 09:02:41 pm »
Perhaps it's time to check options for making an Add-In, if it allows to do that.
I don't like mess with project file, even i have done that.

https://forum.pellesc.de/index.php?topic=4467.msg16682#msg16682
May the source be with you

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2181
    • http://www.smorgasbordet.com
Re: "Copy from" option on "project modes..." dialog.
« Reply #3 on: September 26, 2021, 04:48:15 pm »
Maybe. If you have a more ambitious dialog session with add/rename/delete, it could get a little confusing which mode is referred to.
/Pelle

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1929
Re: "Copy from" option on "project modes..." dialog.
« Reply #4 on: September 26, 2021, 06:23:42 pm »
Maybe a simple 'duplicate' function or a 'use template' where to select the origin.
Thanks

P.S. I hope you had good vacation...  :)

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2181
    • http://www.smorgasbordet.com
Re: "Copy from" option on "project modes..." dialog.
« Reply #5 on: September 26, 2021, 08:24:30 pm »
Maybe a simple 'duplicate' function or a 'use template' where to select the origin.
Nothing really happens until the main dialog is accepted, so it's more of a phrasing problem (all the original modes are there to be copied from). Should be doable.

P.S. I hope you had good vacation...  :)
It worked. The weather not so much...  :(
/Pelle

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1929
Re: "Copy from" option on "project modes..." dialog.
« Reply #6 on: September 26, 2021, 10:04:49 pm »
P.S. I hope you had good vacation...  :)
It worked. The weather not so much...  :(
Don't worry, if things go on this way next Christmas should be possible to have beach holydays again  ;D ;D (no, you can't ski, too sunny...)

Offline John Z

  • Member
  • *
  • Posts: 490
Re: "Copy from" option on "project modes..." dialog.
« Reply #7 on: September 21, 2022, 04:34:28 pm »
Here is a beta version of an Add-in to copy a mode to a new mode name.
Not ready to post the code yet and hope to figure out one bug with retrieving the current project.ppj name when the add-in has been disabled then re-enabled.  https://forum.pellesc.de/index.php?topic=10583.msg36822

As long as the add-in is enabled when Pelles IDE is starting there is no issue.

If the add-in is disabled on IDE start-up, or disabled then re-enabled in an existing session, 'project'.ppj files from unopened projects can be selected by the file manager and edited correctly as well.  More info in the readme.txt file.
Alternatively just change the project Mode before you use the add-in it will then get the current ppj file name correctly.

BETA !  However backups are made first so the original .ppj file is always preserved  :)  twice  :) :) and each time run incrementing a backup number.

John Z

When run you will get a list (1st 10) of available Project Modes that can be copied to a new mode.  Click on the one to copy and enter the new name into the edit box.  New name must be >3 characters and not the same as any existing name. Click OK.  Done!

removed readme and the dll old versions to save upload space.  Get from next post
« Last Edit: September 23, 2022, 03:59:09 pm by John Z »

Offline John Z

  • Member
  • *
  • Posts: 490
Re: "Copy from" option on "project modes..." dialog.
« Reply #8 on: September 23, 2022, 03:57:11 pm »
Modified to alert on failure of AddIn_GetActiveProject and how to fix it.
Removed File - Open for editing unopened 'project'.ppj files.  Could be put back later but not as an appropriate response to the failure of AddIn_GetActiveProject.

Updated readme.txt

John Z

Update: Removed attachments to save space, new version is attached to the next message.
« Last Edit: September 25, 2022, 01:42:29 pm by John Z »

Offline John Z

  • Member
  • *
  • Posts: 490
Re: "Copy from" option on "project modes..." dialog.
« Reply #9 on: September 25, 2022, 01:41:09 pm »
Here is a new Beta version of the CopyMode Add-In.  The issue with retrieving the project.ppj name is resolved with the help of TimoVJL. 

I hope to get feedback from those that were interested in being able to create new project modes based on existing project modes before I finalize the DLL and post it to the ADD-INS section.
The DLL can easily enable the option of editing off-line/inactive project.ppj files as well, if that is useful.

John Z

in case not interested in reading the readme.txt, the new menu item is under 'Project' menu near the bottom.  :)

Update: Removed attachments as entire project is posted below.
« Last Edit: September 28, 2022, 04:49:50 pm by John Z »

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1929
Re: "Copy from" option on "project modes..." dialog.
« Reply #10 on: September 26, 2022, 02:43:03 pm »
Hi John I appreciate your effort, I'll wait for the sources.   :)
Just one point to consider, this addin will work until PellesC project format doesn't change, as often happens between releases. This is why I would have liked a solution from Pelle, that hopefully could have remained consistent between format changes.

Offline John Z

  • Member
  • *
  • Posts: 490
Re: "Copy from" option on "project modes..." dialog.
« Reply #11 on: September 26, 2022, 04:03:00 pm »
Hi Frankie,

Understand wanting to see sources.  I think the method I used will be robust. However, of course as you say, making the ability intrinsic might be preferable and after all it has only been a year.  :)

The method I used only depends on the $(POC_PROJECT_MODE) statements and the final !else statement. 
The number of lines between the statements and what they contain do not matter.

Cleaning up my code.  Did I mention that the first thing done is create a backup of the .ppj file ?

Appreciate your inputs,

John Z

Attached project zip created by the IDE.

« Last Edit: September 26, 2022, 04:53:55 pm by John Z »