NO

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

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
"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.
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

Offline John Z

  • Member
  • *
  • Posts: 790
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: 2091
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: 2266
    • 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: 2096
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...  :)
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • 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: 2096
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...)
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

Offline John Z

  • Member
  • *
  • Posts: 790
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: 790
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: 790
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: 2096
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.
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

Offline John Z

  • Member
  • *
  • Posts: 790
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.

Add-in moved to the Add-Ins topic  at https://forum.pellesc.de/index.php?topic=10590.0 
« Last Edit: October 05, 2022, 11:09:30 AM by John Z »