Recent Posts

Pages: [1] 2 3 4 5 6 ... 10
1
Using Code::Blocks / Re: Hiccups while typing (continuation)
« Last post by Pecan on Yesterday at 09:43:47 pm »
@ ollydbg

Please evaluate this patch.
I've tested it with single and mult-project workspaces, Single file workspace and empty ones as well.

I think I've followed your outline (previous msg) to guard against stowing any stale global status while always allowing ClassBrowser status to be updated.


Code
Index: ccoptionsdlg.cpp
===================================================================
--- ccoptionsdlg.cpp (revision 13610)
+++ ccoptionsdlg.cpp (working copy)
@@ -183,6 +183,12 @@
 
 void CCOptionsDlg::OnApply()
 {
+    cbProject* pProject = Manager::Get()->GetProjectManager()->GetActiveProject();
+     // Remember the project that changed the .conf data //(ph 2025/02/04)
+    m_ParseManager->SetOptsChangedByProject(pProject);
+    // Renember the Parser that changed the .conf data //(ph 2025/02/04)
+    m_ParseManager->SetOptsChangedByParser(&(m_ParseManager->GetParser())); //(ph 2025/02/07)
+
     ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("code_completion"));
 
     // -----------------------------------------------------------------------
Index: parsemanager.h
===================================================================
--- parsemanager.h (revision 13610)
+++ parsemanager.h (working copy)
@@ -9,8 +9,8 @@
 #include "parsemanager_base.h"
 #include "parser/parser.h"
 
-#include <queue>
-#include <map>
+//unused #include <queue>
+// unused #include <map>
 #include <memory>
 #include <unordered_map>
 
@@ -258,6 +258,14 @@
     void SetSymbolsWindowHasFocus(bool trueOrFalse){ m_SymbolsWindowHasFocus = trueOrFalse;}
     bool GetSymbolsWindowHasFocus(){return m_SymbolsWindowHasFocus;}
 
+    // Set or return Project that changed "Global setting" in workspace
+    cbProject* GetOptsChangedByProject(){ return m_pOptsChangedProject;}
+    void SetOptsChangedByProject(cbProject* pProject){m_pOptsChangedProject = pProject;}
+    // Set or return Parser that changed "Global setting" in Single File workspace
+    ParserBase* GetTempParser(){return m_TempParser;}
+    ParserBase* GetOptsChangedByParser(){ return m_pOptsChangedParser;}
+    void SetOptsChangedByParser(ParserBase* pParserBase){m_pOptsChangedParser = &(GetParser());}
+
 protected:
     /** When a Parser is created, we need a full parsing stage including:
      * 1, parse the priority header files firstly.
@@ -474,11 +482,12 @@
      */
     bool RemoveProjectFromParser(cbProject* project);
 
+
 private:
     typedef std::pair<cbProject*, ParserBase*> ProjectParserPair;
     typedef std::list<ProjectParserPair>       ParserList;
 
-    /** a list holing all the cbp->parser pairs, if in one parser per project mode, there are many
+    /** a list holding all the cbp->parser pairs, if in one parser per project mode, there are many
      * many pairs in this list. In one parser per workspace mode, there is only one pair, and the
      * m_ParserList.begin()->second is the common parser for all the projects in workspace.
      */
@@ -527,6 +536,11 @@
     bool m_ClassBrowserViewIsStale = true;
     bool m_SymbolsWindowHasFocus = false;
 
+    //The latest project to change the .conf file //(ph 2025/02/04)
+    cbProject* m_pOptsChangedProject = nullptr;
+    //The latest parser to change the .conf file //(ph 2025/02/04)
+    ParserBase* m_pOptsChangedParser = nullptr;
+
 };
 
 #endif // PARSEMANAGER_H
Index: parser/parser.cpp
===================================================================
--- parser/parser.cpp (revision 13610)
+++ parser/parser.cpp (working copy)
@@ -32,9 +32,10 @@
 
 #include "parser.h"
 #include "parserthreadedtask.h"
+#include "../parsemanager.h" //(ph 2025/02/04)
 
 #include "../classbrowser.h"
-#include "../classbrowserbuilderthread.h"
+//unused - #include "../classbrowserbuilderthread.h"
 
 
 #ifndef CB_PRECOMP
@@ -921,19 +922,59 @@
 
 void Parser::WriteOptions()
 {
+     //(ph 2025/02/06)
+    // Assemble status to determine if a Parser or Project changed a global setting.
+    ProjectManager* pPrjMgr = Manager::Get()->GetProjectManager();
+    cbProject*      pActiveProject = pPrjMgr->GetActiveProject();
+    ParseManager*   pParseMgr = (ParseManager*)m_Parent;
+    ParserBase*     pParser = &(pParseMgr->GetParser());
+    ParserBase*     pTempParser = pParseMgr->GetTempParser();
+    cbProject*      pOptsChangerProject = pParseMgr->GetOptsChangedByProject();
+
+    int  projectsCount = pPrjMgr->GetProjects()->size();
+    bool isTempParser  = (pParser == pTempParser);
+    bool globalOptionChanged = pParseMgr->GetOptsChangedByParser() or pParseMgr->GetOptsChangedByProject();
+
     ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("code_completion"));
 
-    // Page "Code Completion"
-    cfg->Write(_T("/use_SmartSense"),                m_Options.useSmartSense);
-    cfg->Write(_T("/while_typing"),                  m_Options.whileTyping);
+    // **Debugging** use this global to verify logic
+    // bool parseWhileTypingStatus = m_Options.whileTyping;
 
-    // Page "C / C++ parser"
-    cfg->Write(_T("/parser_follow_local_includes"),  m_Options.followLocalIncludes);
-    cfg->Write(_T("/parser_follow_global_includes"), m_Options.followGlobalIncludes);
-    cfg->Write(_T("/want_preprocessor"),             m_Options.wantPreprocessor);
-    cfg->Write(_T("/parse_complex_macros"),          m_Options.parseComplexMacros);
-    cfg->Write(_T("/platform_check"),                m_Options.platformCheck);
+    // Do not allow stale parser settings to change the global settings
+    bool allowGlobalUpdate = false;
+    if ( (projectsCount == 0) and globalOptionChanged)
+        allowGlobalUpdate = true;   //Single file settings changes
+    if (projectsCount and (pOptsChangerProject == pActiveProject) )
+        allowGlobalUpdate = true;   // changes made by a project
+    if ( (projectsCount==0) and isTempParser and globalOptionChanged)
+        allowGlobalUpdate = false; // TempParser has stale settings on Close()
+    if (not globalOptionChanged)
+        allowGlobalUpdate = false; // no global settings have changed
 
+    if (allowGlobalUpdate)
+    {
+        // Page "Code Completion"
+        cfg->Write(_T("/use_SmartSense"),                m_Options.useSmartSense);
+        cfg->Write(_T("/while_typing"),                  m_Options.whileTyping);
+
+        // Page "C / C++ parser"
+        cfg->Write(_T("/parser_follow_local_includes"),  m_Options.followLocalIncludes);
+        cfg->Write(_T("/parser_follow_global_includes"), m_Options.followGlobalIncludes);
+        cfg->Write(_T("/want_preprocessor"),             m_Options.wantPreprocessor);
+        cfg->Write(_T("/parse_complex_macros"),          m_Options.parseComplexMacros);
+        cfg->Write(_T("/platform_check"),                m_Options.platformCheck);
+    }
+    if ((projectsCount == 0) and isTempParser and globalOptionChanged)
+    {
+        // When no projects exists but the CB main settings have been changed,
+        // force the TempParser to reread settings/options else stale ones
+        // will be displayed on the next use of MenuBar/Settings/Editor/CodeCompletion dialog
+        ReadOptions();
+        // The global settings changed status can now be reset
+        pParseMgr->SetOptsChangedByParser(nullptr);
+        pParseMgr->SetOptsChangedByProject(nullptr);
+    }
+
     // Page "Symbol browser"
     cfg->Write(_T("/browser_show_inheritance"),      m_BrowserOptions.showInheritance);
     cfg->Write(_T("/browser_expand_ns"),             m_BrowserOptions.expandNS);
Index: resources/manifest.xml
===================================================================
--- resources/manifest.xml (revision 13610)
+++ 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 25/02/7" />
         <Value description="This plugin provides a symbols browser for your projects and code-completion inside the editor.
 
 

2
Using Code::Blocks / Re: I gave for granted CB (Windows) was portable but...
« Last post by everSome on Yesterday at 07:03:06 pm »
While I do not have any experience is using Code::Blocks on non-Windows 10 platforms, configuration data can be some what confusing. I ran into a problem a year or so ago in starting up Code::Blocks. At the time I had more than one nightly full version with all its contributed plugins on my computer at the same time. Obviously with each version contained within a different Windows folder. All of  sudden the SpellChecker.dll failled to initialize on bootup because it could not find its .svg file. It turned out that in stepping through code I had inadvertently invoked the SpellChecker. Doing so had caused Code::Blocks to save what it deamed as appropriate into some files within my C:\Users\YOURNAME\AppData\Roaming\CodeBlocks folder. It turned out it was trying to find that .svg file in an old Code::Blocks folder that predated the switch over to using .svg images and had finally deleted it! I can understand maybe copying dictionary and thesaurus data into AppData, but not the location of where to find SpellChecker's .svg file during Code::Blocks initialization. Good luck.
3
Using Code::Blocks / Re: I gave for granted CB (Windows) was portable but...
« Last post by everSome on Yesterday at 06:07:49 pm »
On my Window 10 usage of nightly versions of Code::Blocks via MSYS2's UCRT64 environment, by default configuration data ends up in your AppData\Roaming\CodeBlocks folder. To keep that from happening, I just copy a hand constructed generic version default.conf into my output32_64 or devel32_64 folder before using it for the first time.
4
Help / Re: Trying to install graphics.h but getting "cannot find -lbgi" error
« Last post by Evan on Yesterday at 03:42:16 pm »
I'm not using Window anymore, but here is my notes for w7 and it still works fine for me:

graphics.h
Global compiler settings/Toolchain executables:

Compiler's installation directory:
C:\TDM-GCC-32

Program Files:
C compiler:        : g++.exe
C++ compiler       : g++.exe
Linker dynamic libs: g++.exe
linker static libs : ar.exe
Debugger           : GDC/CDB debugger: Default
Resource compiler  : windres.exe
Make program       : mingw32-make.exe

Compiler's installation directory:
C:\TDM-GCC-32

Linker settings:
//-lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32
C:\TDM-GCC-32\lib\libbgi.a
C:\TDM-GCC-32\lib\libgdi32.a
C:\TDM-GCC-32\lib\libcomdlg32.a
C:\TDM-GCC-32\lib\libuuid.a
C:\TDM-GCC-32\lib\liboleaut32.a
C:\TDM-GCC-32\lib\libole32.a

Debugger:
C:\TDM-GCC-32\gdb32\bin\gdb32.exe



#include <graphics.h>

int main() {
    initwindow(640, 480, "Graphics test", 0, 300);

    int x1 = 100, y1 = 200, x2 = 500, y2 = 400;

    moveto(x1, y1);
    lineto(x1, y2);
    lineto(x2, y2);
    lineto(x2, y1);
    lineto(x1, y1);

    getchar();

    return 0;
}
5
Help / Re: Trying to install graphics.h but getting "cannot find -lbgi" error
« Last post by nenin on Yesterday at 08:01:39 am »
Umm, i didn't understand what you meant. Could you explain a little bit? What 64 bit library should i install?
This library is too old in all meanings.
If you want to use it you have to find sources and rebuild it with you version of the wingw compiler. It may not works, or requires some additional efforts, if  it was coded in low standard levels.
There is another version: https://openbgi.sourceforge.net/ - also very old.
Please note that actually it is from 80th.  https://en.wikipedia.org/wiki/Borland_Graphics_Interface 
It is too old for practical usage or for the learning.

PS. https://github.com/ahmedshakill/WinBGIm-64  - 64b version, should be more or less fresh.
6
Is there any way to manually provide lbgi to solve the error? if not, what should i do now?
7
Help / Re: Trying to install graphics.h but getting "cannot find -lbgi" error
« Last post by nenin on Yesterday at 07:51:44 am »
Install an 64 bit library to use with your 64 bit toolchain or install an 32 toolchain to use with your 32 bit library.

Tim S.
Very likely it not help, because "Library built with MingW 5.0.3 and GCC 3.4.5" (c)
8
Umm, i didn't understand what you meant. Could you explain a little bit? What 64 bit library should i install?
9
Install an 64 bit library to use with your 64 bit toolchain or install an 32 toolchain to use with your 32 bit library.

Tim S.
10
Help / Trying to install graphics.h but getting "cannot find -lbgi" error
« Last post by imranif on Yesterday at 07:35:25 am »
I need to install graphics.h for doing graphics programming in C. however, even after following the steps mentioned here: https://stackoverflow.com/questions/20313534/how-to-use-graphics-h-in-codeblocks/20321173#20321173
I am not able to build and run programs because it shows
Code
||=== Build file: "no target" in "no project" (compiler: unknown) ===|
ld.exe||cannot find -lbgi|
||error: ld returned 1 exit status|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
How do i solve the issue of cannot finding lbgi? I already have added -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32 in Other Linker options while assigned the directory C:\Program Files\CodeBlocks\MinGW\lib\libbgi.a for Link libraries.

This is the build message i am getting:
Code
gcc.exe   -c C:\Users\imran\OneDrive\Documents\Codeblocks\practice.c -o C:\Users\imran\OneDrive\Documents\Codeblocks\practice.o
gcc.exe  -o C:\Users\imran\OneDrive\Documents\Codeblocks\practice.exe C:\Users\imran\OneDrive\Documents\Codeblocks\practice.o  -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32  "C:\Program Files\CodeBlocks\MinGW\lib\libbgi.a"
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libbgi.a when searching for -lbgi
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib\libbgi.a when searching for -lbgi
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib/libbgi.a when searching for -lbgi
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib\libbgi.a when searching for -lbgi
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/libbgi.a when searching for -lbgi
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib\libbgi.a when searching for -lbgi
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../libbgi.a when searching for -lbgi
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../..\libbgi.a when searching for -lbgi
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libbgi.a when searching for -lbgi
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib/libbgi.a when searching for -lbgi
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/libbgi.a when searching for -lbgi
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../libbgi.a when searching for -lbgi
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lbgi
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 1 second(s))
2 error(s), 0 warning(s) (0 minute(s), 1 second(s))

Will be grateful for some assistance
Pages: [1] 2 3 4 5 6 ... 10