News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Is Manager::GetCmdLineParser() needed and does it work?

Started by stahta01, January 12, 2009, 12:02:25 AM

Previous topic - Next topic

stahta01

FYI:

Using the debug build of wxWidgets, I get messages/warnings on this method Manager::GetCmdLineParser().

Can anyone verify this method stills works with wxWidgets 2.8?

If it does not work, I suggest removing it.

From wxWidgets 2.9 docs. But, it seems to exist in  wxWidgets 2.8 docs also.
Quote
You can also use wxApp's default command line processing just overriding wxAppConsole::OnInitCmdLine() and wxAppConsole::OnCmdLineParsed().

Below is the patch I am using to do wxWidgets debug builds of Code::Blocks.


Index: src/sdk/manager.cpp
===================================================================
--- src/sdk/manager.cpp (revision 5394)
+++ src/sdk/manager.cpp (working copy)
@@ -402,11 +402,6 @@
     }
}

-wxCmdLineParser* Manager::GetCmdLineParser()
-{
- return &m_CmdLineParser;
-}
-
void Manager::RegisterEventSink(wxEventType eventType, IEventFunctorBase<CodeBlocksEvent>* functor)
{
m_EventSinks[eventType].push_back(functor);
@@ -505,4 +500,3 @@
bool Manager::appShuttingDown = false;
bool Manager::blockYields = false;
bool Manager::isBatch = false;
-wxCmdLineParser Manager::m_CmdLineParser;
Index: src/include/manager.h
===================================================================
--- src/include/manager.h (revision 5394)
+++ src/include/manager.h (working copy)
@@ -46,7 +46,6 @@
     static bool appShuttingDown;
     static bool blockYields;
     static bool isBatch;
-    static wxCmdLineParser m_CmdLineParser;

     Manager();
     ~Manager();
@@ -135,8 +134,6 @@
     static void AddonToolBar(wxToolBar* toolBar,wxString resid);
     static bool isToolBar16x16(wxToolBar* toolBar);

-    static wxCmdLineParser* GetCmdLineParser();
-
// event sinks
void RegisterEventSink(wxEventType eventType, IEventFunctorBase<CodeBlocksEvent>* functor);
void RegisterEventSink(wxEventType eventType, IEventFunctorBase<CodeBlocksDockEvent>* functor);
Index: src/src/app.cpp
===================================================================
--- src/src/app.cpp (revision 5394)
+++ src/src/app.cpp (working copy)
@@ -986,7 +986,7 @@
     bool filesInCmdLine = false;

#if wxUSE_CMDLINE_PARSER
-    wxCmdLineParser& parser = *Manager::GetCmdLineParser();
+    wxCmdLineParser& parser = *(new wxCmdLineParser()); //*Manager::GetCmdLineParser();
     parser.SetDesc(cmdLineDesc);
     parser.SetCmdLine(argc, argv);
     // wxApp::argc is a wxChar**

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]