Author Topic: How to globally set the "custom variables" in the cbp files under a workspace  (Read 2117 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6070
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Hi, when I try to build the whole C::B workspace against the "debug version of the wxWidgets", I need to change the "custom variable" named "WX_SUFFIX" from "u" to "ud".

This is simple if I only need to change this value in a single "cbp" file, but if I want to change them in all the cbps under the workspace, how to do that? I don't want to open the build option dialog for each cbp files.

Thanks.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Wkerry

  • Multiple posting newcomer
  • *
  • Posts: 77
Have a look at https://github.com/gerard-durand/codeblocks_gd_cbps as an example of how to do it for Windows only. This may save you some time.

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 539
  • L'ami de l'homme.The friend of man.
    • LETARTARE
It seems to me that using the 'Plugin->Project options manipulator' extension should solve your workspace problem.
CB-13609, plugins-sdk-2.25.0 : Collector-2.4.0, AddOnForQt-4.0.0
1- Win7 Business Pack1 64bits : wx-3.2.6, gcc-14.2.0,
2- OpenSuse::Leap-15.6-64bits : wx-3.2.6;gtk3, gcc-13.3.0,
=> !! The messages are translated by 'Deepl'

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6070
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Hi, @LETARTARE thanks. This is my first time to use this project options manipulator plugin, this plugin works. I can change all the "u" to "ud" for the "WX_SUFFIX" custom variable, great!

@Wkerry thanks, I see the gd's cbp file is a unified version for all windows versions and wx versions, this is also a great work! Why not put them to our SVN code base? Any devs opinion?  :)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1673
IMHO, now wxWidgets 3.3 is near we can try gd_on's files, keeping current 3.0 (Linux only), 3.1 and 3.2 projects (just in case).

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6070
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
IMHO, now wxWidgets 3.3 is near we can try gd_on's files, keeping current 3.0 (Linux only), 3.1 and 3.2 projects (just in case).

OK, I agree.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6070
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
I found that the project manipulate plugin does not work well.
Here is my setting, see the attachment image.

And the result is:

Code
Project 'Code::Blocks wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'tinyXML': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'AutoRevision': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'ConsoleRunner': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'Squirrel': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'scintilla': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'sdk': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'src': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'Abbreviations': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'AStyle': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'Autosave': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'Compiler depslib': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'Compiler': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'Debugger': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'Code-completion': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'Class wizard': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'Default MIME handler': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'Occurrences Highlighting': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'Open files list': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'Projects-workspaces importer': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'Scripted wizard': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'To-do': Replaced custom var 'u'.
Project 'Code::Blocks wx3.2.x (64 bit)', target 'XP look & feel': Replaced custom var 'u'.
Project 'Addr2LineUI wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'Addr2LineUI wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'Code::Blocks Share Config wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'Code::Blocks Share Config wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'CbLauncher wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'CbLauncher wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'cbp2make wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'cbp2make wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'cbp2make wx3.2.x (64 bit)', target 'Doxygen': Replaced custom var 'u'.
Project 'CC Test wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'CC Test wx3.2.x (64 bit)', target 'cctest': Replaced custom var 'u'.
Project 'wxWidgets - Contrib Items wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'wxWidgets - Contrib Items wx3.2.x (64 bit)', target 'wxFlatNoteBook': Replaced custom var 'u'.
Project 'wxWidgets - Contrib Items wx3.2.x (64 bit)', target 'wxChartCtrl': Replaced custom var 'u'.
Project 'wxWidgets - Contrib Items wx3.2.x (64 bit)', target 'wxCustomButton': Replaced custom var 'u'.
Project 'wxWidgets - Contrib Items wx3.2.x (64 bit)', target 'wxImagePanel': Replaced custom var 'u'.
Project 'wxWidgets - Contrib Items wx3.2.x (64 bit)', target 'wxSpeedButton': Replaced custom var 'u'.
Project 'wxWidgets - Contrib Items wx3.2.x (64 bit)', target 'wxKWIC': Replaced custom var 'u'.
Project 'wxWidgets - Contrib Items wx3.2.x (64 bit)', target 'wxLED': Replaced custom var 'u'.
Project 'wxWidgets - Contrib Items wx3.2.x (64 bit)', target 'wxMathPlot': Replaced custom var 'u'.
Project 'wxSmith wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'wxSmith wx3.2.x (64 bit)', target 'wxSmithLib': Replaced custom var 'u'.
Project 'wxSmith wx3.2.x (64 bit)', target 'wxSmith': Replaced custom var 'u'.
Project 'wxSmith - Contrib Items wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'wxSmith - Contrib Items wx3.2.x (64 bit)', target 'wxSmithContribItems': Replaced custom var 'u'.
Project 'wxSmith - wxAUI wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'wxSmith - wxAUI wx3.2.x (64 bit)', target 'Default': Replaced custom var 'u'.
Project 'headerguard wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'headerguard wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'LogHacker wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'LogHacker wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'ModPoller wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'ModPoller wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'tidycmt wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'tidycmt wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'AutoVersioning wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'AutoVersioning wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'BrowseTracker wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'BrowseTracker wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'Games wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'Games wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'Koders Query wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'Koders Query wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'Cccc wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'Cccc wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'Code Snippets wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'Code Snippets wx3.2.x (64 bit)', target 'Plugin - Win32': Replaced custom var 'u'.
Project 'Code Stat wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'Code Stat wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'CopyStrings wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'CopyStrings wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'CppCheck/Vera++ wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'CppCheck/Vera++ wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'Cscope wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'Cscope wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'DevPak wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'DevPak wx3.2.x (64 bit)', target 'libbz2': Replaced custom var 'u'.
Project 'DevPak wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'DoxyBlocks wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'DoxyBlocks wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'DragScroll wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'DragScroll wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'EditorConfig wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'EditorConfig wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'EditorTweaks wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'EditorTweaks wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'EnvVars wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'EnvVars wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'EnvVars wx3.2.x (64 bit)', target 'no_pch': Replaced custom var 'u'.
Project 'FileManager Plugin wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'FileManager Plugin wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'HeaderFixup wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'HeaderFixup wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'Help wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'Help wx3.2.x (64 bit)', target 'bzip2': Replaced custom var 'u'.
Project 'Help wx3.2.x (64 bit)', target 'zlib': Replaced custom var 'u'.
Project 'Help wx3.2.x (64 bit)', target 'help_plugin': Replaced custom var 'u'.
Project 'HexEditor wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'HexEditor wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'IncrementalSearch wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'IncrementalSearch wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'KeyBinder wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'KeyBinder wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'Library finder wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'Library finder wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'MouseSap wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'MouseSap wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'Profiler wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'Profiler wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'ProjectOptionsManipulator wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'ProjectOptionsManipulator wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'RegExTestbed wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'RegExTestbed wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'ReopenEditor wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'ReopenEditor wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'rndgen wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'rndgen wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'Clangd_Client wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'Clangd_Client wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'SmartIndent wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'SmartIndent wx3.2.x (64 bit)', target 'SmartIndentCpp': Replaced custom var 'u'.
Project 'SmartIndent wx3.2.x (64 bit)', target 'SmartIndentHDL': Replaced custom var 'u'.
Project 'SmartIndent wx3.2.x (64 bit)', target 'SmartIndentPascal': Replaced custom var 'u'.
Project 'SmartIndent wx3.2.x (64 bit)', target 'SmartIndentPython': Replaced custom var 'u'.
Project 'SmartIndent wx3.2.x (64 bit)', target 'SmartIndentLua': Replaced custom var 'u'.
Project 'SmartIndent wx3.2.x (64 bit)', target 'SmartIndentFortran': Replaced custom var 'u'.
Project 'SmartIndent wx3.2.x (64 bit)', target 'SmartIndentXML': Replaced custom var 'u'.
Project 'Exporter wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'Exporter wx3.2.x (64 bit)', target 'wxPdfDocument': Replaced custom var 'u'.
Project 'Exporter wx3.2.x (64 bit)', target 'makefont': Replaced custom var 'u'.
Project 'Exporter wx3.2.x (64 bit)', target 'minimal': Replaced custom var 'u'.
Project 'Exporter wx3.2.x (64 bit)', target 'pdfdc': Replaced custom var 'u'.
Project 'Exporter wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'SpellChecker wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'SpellChecker wx3.2.x (64 bit)', target 'hunspell': Replaced custom var 'u'.
Project 'SpellChecker wx3.2.x (64 bit)', target 'wxSpellChecker': Replaced custom var 'u'.
Project 'SpellChecker wx3.2.x (64 bit)', target 'plugin': Replaced custom var 'u'.
Project 'SymTab wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'SymTab wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'ThreadSearch wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'ThreadSearch wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.
Project 'Tools Plus Plugin wx3.2.x (64 bit)': Replaced custom var 'u'.
Project 'Tools Plus Plugin wx3.2.x (64 bit)', target 'default': Replaced custom var 'u'.

Also, it is prompted that I need to save all the project files, so I press YES button.

But I see that the WX_SUFFIX value are still "u".

 :(

EDIT

If I check on the "replace only search pattern", the issue still exists.

« Last Edit: February 05, 2025, 04:01:08 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6070
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
OK, I finally found the solution by debugging the source code of this plugin.

I have to do like below (see attachment)

The text control pointed by blue arrow could be empty.

The right red arrow points to the new value of the custom var, and the left red arrow points to the var name.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Wkerry

  • Multiple posting newcomer
  • *
  • Posts: 77
@Wkerry thanks, I see the gd's cbp file is a unified version for all windows versions and wx versions, this is also a great work! Why not put them to our SVN code base? Any devs opinion?  :)

GD's repo started a long time ago and there was a post in 2024. It makes life allot easier as you have indicated. See https://sourceforge.net/p/codeblocks/tickets/1332/ for an old patch that seems to have not been looked at.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6070
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
@Wkerry thanks, I see the gd's cbp file is a unified version for all windows versions and wx versions, this is also a great work! Why not put them to our SVN code base? Any devs opinion?  :)

GD's repo started a long time ago and there was a post in 2024. It makes life allot easier as you have indicated. See https://sourceforge.net/p/codeblocks/tickets/1332/ for an old patch that seems to have not been looked at.

That's great, thanks for the info, I think the devs should take some time to add his patch to the svn repo.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.