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
As usual while waiting for the next release - don't forget to check the nightly builds in the forum.
Code#include "..\parsemanager.h"
My guess is the above line will fail under Linux.
Tim S.
@ 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.CodeIndex: 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.
#include "..\parsemanager.h"
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.
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'.
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).
@ 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?
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.