Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: LETARTARE on January 16, 2025, 07:01:48 pm

Title: Restart 'Code::Block'
Post by: LETARTARE on January 16, 2025, 07:01:48 pm
I found in 'cb13604' several configuration options that require a reboot.
These are
1- 'Settings->Environment...->General settings' : 2   
   - 'Allow only one running instance (will take place after restart)' 
   - 'Interprocess communication (will take place after restart)'

2- 'Settings->Environment...->View' : 1   
   - 'Internationalization (will take place after restart)'

3 'Settings->Scripting...' : any change

4- in the 'ToDo' plugin from 'settings.xrc'
     - 'Include the Todo list in the messages pane (will take place after restart)'

It would then be useful to automatically restart after user approval

My first concern was to create a 'Files->Quit (Ctrl-Q)' type menu button: 'Files->Restart (Ctrl-R)'.
To do this, modify 'src|resources|main_menu.xrc' by adding the following after the 'Quit' button

Then set up the various elements to execute the methode :
Code
'void MainFrame::OnFileRestart(cb_unused wxCommandEvent& event)' 
which will close the application and restart it.

Here's a first patch to make it happen

I'll provide the automatic restart soon.
Title: Re: Restart 'Code::Block'
Post by: ollydbg on January 17, 2025, 05:30:13 am
When restart the C::B, I think you need to "remember" the environment or the command line options.

For example, when you start C::B by the "CbLauncher.exe", is has some special command line options, and the codeblocks.exe is a child process of the cblauncher.exe process.

I'm not sure how to handle those.
Title: Re: Restart 'Code::Block'
Post by: LETARTARE on January 17, 2025, 09:02:43 am
@ollydbg : thanks
Yes, you're right. I've never used this launch.
So I'm waiting for other opinions that can explain.

The proposed solution is based on a traditional launch with or without console mode ('CB' option on construction):
- by command without argument
- from a system-generated icon or manually
Title: Re: Restart 'Code::Block'
Post by: LETARTARE on January 18, 2025, 06:58:41 pm
@ollydbg
Can you tell me how to launch 'code::blocks' with 'cblauncher' ?
If we use a launch script, this could solve the problem. In any case, the script would have to be rerun ...

Title: Re: Restart 'Code::Block'
Post by: stahta01 on January 18, 2025, 08:47:08 pm
Link found using search and wiki https://forums.codeblocks.org/index.php/topic,10360.0.html (https://forums.codeblocks.org/index.php/topic,10360.0.html)
I have never used the util.
Title: Re: Restart 'Code::Block'
Post by: LETARTARE on January 19, 2025, 02:00:00 am
@stahta01
Thanks, i'm going to analyze the information.