Recent Posts

Pages: 1 2 3 4 5 [6] 7 8 9 10
51
Using Code::Blocks / Re: Hiccups while typing (continuation)
« Last post by Pecan on February 05, 2025, 06:37:57 am »


Code
#include "..\parsemanager.h"

My guess is the above line will fail under Linux.

Tim S.

Thanks
52
Using Code::Blocks / Re: Hiccups while typing (continuation)
« Last post by stahta01 on February 05, 2025, 04:48:06 am »
@ ollydbg

Would you try the following CC patch. It works well for me.

It simply remembers the project that applied an options change.
At WriteOptions() it only lets that project update the CC Options and .conf and makes the other projects refresh their cached options.

Patch is also attached to this msg.

Code
Index: ccoptionsdlg.cpp
===================================================================
--- ccoptionsdlg.cpp (revision 13609)
+++ ccoptionsdlg.cpp (working copy)
@@ -183,6 +183,10 @@
 
 void CCOptionsDlg::OnApply()
 {
+    //(ph 2025/02/04) // Set the project that changed the .conf data //(ph 2025/02/04)
+    cbProject* pProject = Manager::Get()->GetProjectManager()->GetActiveProject();
+    m_ParseManager->SetOptsChangerProject(pProject);
+
     ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("code_completion"));
 
     // -----------------------------------------------------------------------
Index: parsemanager.h
===================================================================
--- parsemanager.h (revision 13609)
+++ parsemanager.h (working copy)
@@ -258,6 +258,9 @@
     void SetSymbolsWindowHasFocus(bool trueOrFalse){ m_SymbolsWindowHasFocus = trueOrFalse;}
     bool GetSymbolsWindowHasFocus(){return m_SymbolsWindowHasFocus;}
 
+    cbProject* GetOptsChangerProject(){ return m_pOptsChangerProject;} //(ph 2025/02/04)
+    void SetOptsChangerProject(cbProject* pProject){m_pOptsChangerProject = pProject;} //(ph 2025/02/04)
+
 protected:
     /** When a Parser is created, we need a full parsing stage including:
      * 1, parse the priority header files firstly.
@@ -527,6 +530,9 @@
     bool m_ClassBrowserViewIsStale = true;
     bool m_SymbolsWindowHasFocus = false;
 
+    //The last project to change the .conf file //(ph 2025/02/04)
+    cbProject* m_pOptsChangerProject = nullptr;
+
 };
 
 #endif // PARSEMANAGER_H
Index: parser/parser.cpp
===================================================================
--- parser/parser.cpp (revision 13609)
+++ parser/parser.cpp (working copy)
@@ -29,6 +29,7 @@
 
 #include <wx/tokenzr.h>
 #include <cbstyledtextctrl.h>
+#include "..\parsemanager.h" //(ph 2025/02/04)
 
 #include "parser.h"
 #include "parserthreadedtask.h"
@@ -921,6 +922,16 @@
 
 void Parser::WriteOptions()
 {
+    // If this project didn't change the options, then don't let it overwrite them. //(ph 2025/02/04)
+    cbProject* pActiveProject = Manager::Get()->GetProjectManager()->GetActiveProject();
+    ParseManager* pParseMgr = (ParseManager*)m_Parent;
+    cbProject* pOptsChangerProject = pParseMgr->GetOptsChangerProject();
+    if ( pActiveProject != pOptsChangerProject )
+    {
+        ReadOptions();  // force projects that did not change options to re-read them.
+        return;
+    }
+
     ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("code_completion"));
 
     // Page "Code Completion"
Index: resources/manifest.xml
===================================================================
--- resources/manifest.xml (revision 13609)
+++ resources/manifest.xml (working copy)
@@ -3,7 +3,7 @@
     <SdkVersion major="1" minor="10" release="0" />
     <Plugin name="CodeCompletion">
         <Value title="Code completion" />
-        <Value version="1.0.5 24/01/29" />
+        <Value version="1.0.6(ph) 25/02/04" />
         <Value description="This plugin provides a symbols browser for your projects and code-completion inside the editor.
 
 


Code
#include "..\parsemanager.h"

My guess is the above line will fail under Linux.

Tim S.
53
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.
54
Using Code::Blocks / Re: Hiccups while typing (continuation)
« Last post by Pecan on February 05, 2025, 04:38:09 am »
@ ollydbg

Would you try the following CC patch. It works well for me.

It simply remembers the project that applied an options change.
At WriteOptions() it only lets that project update the CC Options and .conf and makes the other projects refresh their cached options.

Patch is also attached to this msg.

Code
Index: ccoptionsdlg.cpp
===================================================================
--- ccoptionsdlg.cpp (revision 13609)
+++ ccoptionsdlg.cpp (working copy)
@@ -183,6 +183,10 @@
 
 void CCOptionsDlg::OnApply()
 {
+    //(ph 2025/02/04) // Set the project that changed the .conf data //(ph 2025/02/04)
+    cbProject* pProject = Manager::Get()->GetProjectManager()->GetActiveProject();
+    m_ParseManager->SetOptsChangerProject(pProject);
+
     ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("code_completion"));
 
     // -----------------------------------------------------------------------
Index: parsemanager.h
===================================================================
--- parsemanager.h (revision 13609)
+++ parsemanager.h (working copy)
@@ -258,6 +258,9 @@
     void SetSymbolsWindowHasFocus(bool trueOrFalse){ m_SymbolsWindowHasFocus = trueOrFalse;}
     bool GetSymbolsWindowHasFocus(){return m_SymbolsWindowHasFocus;}
 
+    cbProject* GetOptsChangerProject(){ return m_pOptsChangerProject;} //(ph 2025/02/04)
+    void SetOptsChangerProject(cbProject* pProject){m_pOptsChangerProject = pProject;} //(ph 2025/02/04)
+
 protected:
     /** When a Parser is created, we need a full parsing stage including:
      * 1, parse the priority header files firstly.
@@ -527,6 +530,9 @@
     bool m_ClassBrowserViewIsStale = true;
     bool m_SymbolsWindowHasFocus = false;
 
+    //The last project to change the .conf file //(ph 2025/02/04)
+    cbProject* m_pOptsChangerProject = nullptr;
+
 };
 
 #endif // PARSEMANAGER_H
Index: parser/parser.cpp
===================================================================
--- parser/parser.cpp (revision 13609)
+++ parser/parser.cpp (working copy)
@@ -29,6 +29,7 @@
 
 #include <wx/tokenzr.h>
 #include <cbstyledtextctrl.h>
+#include "..\parsemanager.h" //(ph 2025/02/04)
 
 #include "parser.h"
 #include "parserthreadedtask.h"
@@ -921,6 +922,16 @@
 
 void Parser::WriteOptions()
 {
+    // If this project didn't change the options, then don't let it overwrite them. //(ph 2025/02/04)
+    cbProject* pActiveProject = Manager::Get()->GetProjectManager()->GetActiveProject();
+    ParseManager* pParseMgr = (ParseManager*)m_Parent;
+    cbProject* pOptsChangerProject = pParseMgr->GetOptsChangerProject();
+    if ( pActiveProject != pOptsChangerProject )
+    {
+        ReadOptions();  // force projects that did not change options to re-read them.
+        return;
+    }
+
     ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("code_completion"));
 
     // Page "Code Completion"
Index: resources/manifest.xml
===================================================================
--- resources/manifest.xml (revision 13609)
+++ resources/manifest.xml (working copy)
@@ -3,7 +3,7 @@
     <SdkVersion major="1" minor="10" release="0" />
     <Plugin name="CodeCompletion">
         <Value title="Code completion" />
-        <Value version="1.0.5 24/01/29" />
+        <Value version="1.0.6(ph) 25/02/04" />
         <Value description="This plugin provides a symbols browser for your projects and code-completion inside the editor.
 
 

55
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.

56
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.
57
Using Code::Blocks / Re: Hiccups while typing (continuation)
« Last post by ollydbg on February 05, 2025, 02:41:07 am »
@ ollydbg

How about this idea.

The ccoptionsdlg can always record, in a global var, the address of the active parser that last updated the settings.

When the workspace is closed, if that var contains an address, that parser will be the only parser that is allows to update the .conf settings.

That way, any number of projects can be in the workspace, but only the last parser to update the settings can finally store them to the .conf .

Wouldn't that work for only one parser and also for multiple parsers?

If the global var is nullptr, ccoptionsdlg never got called to change any option, then we don't care about which parser updates the .conf .

ccoptionsdlg would only set the active parsers address in the global var, if the user clicked OK to dismiss the dialog.
I'm assuming that the dismiss dialog action (OK or Cancel) can be caught.
Else we'd have to find another way to determine that the user changed any option.

Edit: 10:35am
Got It. void CCOptionsDlg::OnApply() is only called when user clicks OK. I'm thinking that's the only place we need to set the global var with the active parser address.

Is all this true?

Some concerns from my mind.

The CC options includes the options from the ccoptionsdlg, but it also includes the options from the classbrowser's GUI.

So, when I see inside the SetParser() function call, it will also save the active classbrowser's GUI setting to the configure file.

Also, if a Parser instance is deleted, the global var (pointer) still point to the deleted memory?

58
Using Code::Blocks / Re: Hiccups while typing (continuation)
« Last post by ollydbg on February 05, 2025, 02:23:01 am »
Another thought might be to issue a shared event to tell all parsers to re-read (update its parser.options) if a user clicks OK in the CodeCompletion settings dialog.

I don't mean to create a new global event, but I know that an event using an XRCID("mySharedEventId") is possible if both sender and receiver use the same XRCID.

I can't understand the logic here. But generally, I think this should be done inside the code completion plugin or its base plugin class.

I think the current logic is:

1, When a parser instance becomes "active", its options will be also get active, and "saved to the configure file".
2, When there is NO cbp files opened, a dummy parser(temp parser) will active, it also has its own options.

Case 1:
When you open C::B, the dummy parser is active, when you modify the CC's option, it was modifying the dummy parser's option. When you close C::B, the last active Parser is the dummy parser, so it setting is in the configure file.

Case 2:
You have one cbp(projectA) file opened, and the active parser is the opened cbp. So, when you tweak its CC setting, the option of this parser changed and saved to the configure file. Now, you click the "close button" to close C::B, it just "close the workspace" first. And if all the cbp files get closed, the dummy project parser will set active. You see that when a parser is set active, its option will be saved to the configure file. So, projectA's CC option will be overwritten by the dummy project parser's option to the configure file.


I think the logic here is that every Parser instance could have different options.

EDIT:

I only debugged the above 2 Cases, and I don't debugged other cases, and I can't say much about other cases.
59
Using Code::Blocks / Re: Hiccups while typing (continuation)
« Last post by Pecan on February 04, 2025, 07:09:03 pm »
@ ollydbg

How about this idea.

The ccoptionsdlg can always record, in a global var, the address of the active parser that last updated the settings.

When the workspace is closed, if that var contains an address, that parser will be the only parser that is allows to update the .conf settings.

That way, any number of projects can be in the workspace, but only the last parser to update the settings can finally store them to the .conf .

Wouldn't that work for only one parser and also for multiple parsers?

If the global var is nullptr, ccoptionsdlg never got called to change any option, then we don't care about which parser updates the .conf .

ccoptionsdlg would only set the active parsers address in the global var, if the user clicked OK to dismiss the dialog.
I'm assuming that the dismiss dialog action (OK or Cancel) can be caught.
Else we'd have to find another way to determine that the user changed any option.

Edit: 10:35am
Got It. void CCOptionsDlg::OnApply() is only called when user clicks OK. I'm thinking that's the only place we need to set the global var with the active parser address.



Is all this true?
60
Using Code::Blocks / Re: Hiccups while typing (continuation)
« Last post by Pecan on February 04, 2025, 06:23:41 pm »
@ ollydbg

I'll test out your suggestions today. Thanks.

I'll test with NO project, then one, then multiple projects and see if checking for the dummy (first) parser works.

Another thought might be to issue a shared event to tell all parsers to re-read (update its parser.options) if a user clicks OK in the CodeCompletion settings dialog.

I don't mean to create a new global event, but I know that an event using an XRCID("mySharedEventId") is possible if both sender and receiver use the same XRCID.
Pages: 1 2 3 4 5 [6] 7 8 9 10