Author Topic: How to set a global variable configuration set as the active one at C::B start  (Read 320 times)

Offline gd_on

  • Lives here!
  • ****
  • Posts: 799
I have several global variable configuration set, for example : default, set_1, set_2, ...
When I open codeblocks, look at Global Variables... I see, for example that set_1 is Active, the one selected in the scroll-down menu.
I do some work with that set_1, then choose the set_2, clic on the Save button at the bottom, do some work with set_2, always inside codeblocks. Then I close codeblocks.
When I reopen codeblocks, and look at the global variable config, I see it's still set_1 which is selected.
How to make codeblocks to keep my set_2 config as the active set after a restart. I can modify default.conf manually, of course.
I thought that the Save button at the bottom of the global variable configuration display box was for that purpose, but it's not the case apparently.
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.5 (tests with 3.3), Msys2 Compilers 14.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1580
Looks like swapping these two lines from uservardlgs.cpp:473 should do the trick
Code
    m_UserVarMgr->Save();
    m_UserVarMgr->SetActiveSetName(m_CurrentSetName);
but I cannot check right now

Offline gd_on

  • Lives here!
  • ****
  • Posts: 799
Effectively, with this line switch, it works as I thought it should...
Nevertheless, there is another Save() at line 471, a more global one I suppose. What does it save ?
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.5 (tests with 3.3), Msys2 Compilers 14.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1580
Fixed in r13524, thank you for testing.

The other Save() just collects the members of the current variable, removing the empty ones.