Code::Blocks  SVN r11506
manager.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
3  * http://www.gnu.org/licenses/lgpl-3.0.html
4  *
5  * $Revision: 11222 $
6  * $Id: manager.cpp 11222 2017-10-31 07:56:18Z fuscated $
7  * $HeadURL: https://svn.code.sf.net/p/codeblocks/code/trunk/src/sdk/manager.cpp $
8  */
9 
10 #include "sdk_precomp.h"
11 
12 #ifndef CB_PRECOMP
13  #include <wx/xrc/xmlres.h>
14  #include <wx/fs_zip.h>
15  #include <wx/menu.h>
16 
17  #include "manager.h" // class's header file
18  #include "sdk_events.h"
19  #include "cbexception.h"
20  #include "projectmanager.h"
21  #include "editormanager.h"
22  #include "logmanager.h"
23  #include "pluginmanager.h"
24  #include "toolsmanager.h"
25  #include "macrosmanager.h"
26  #include "configmanager.h"
27  #include "scriptingmanager.h"
28  #include "templatemanager.h"
29  #include "personalitymanager.h"
30  #include "uservarmanager.h"
31  #include "filemanager.h"
32  #include "globals.h"
33  #include "xtra_res.h" // our new ToolBarAddOn handler
34 #endif
35 
36 #include <wx/app.h> // wxTheApp
37 #include <wx/toolbar.h>
38 #include <wx/fs_mem.h>
39 
40 
41 #ifdef PPRCESS_EVENT_PERFORMANCE_MEASURE
42  // this preprocessor directive can be defined in cbfunctor.h to enable performance measure
43  #include <cxxabi.h> // demangle C++ names
44  #include <cstdlib> // free the memory created by abi::__cxa_demangle
45 #endif // PPRCESS_EVENT_PERFORMANCE_MEASURE
46 
47 #include "cbcolourmanager.h"
48 #include "ccmanager.h"
49 #include "debuggermanager.h"
50 
51 static Manager* s_ManagerInstance = nullptr;
52 
53 
54 #ifdef PPRCESS_EVENT_PERFORMANCE_MEASURE
55 static wxString GetCodeblocksEventName(wxEventType type)
56 {
57  wxString name;
58  if (type==cbEVT_APP_STARTUP_DONE) name = _T("cbEVT_APP_STARTUP_DONE");
59  else if (type==cbEVT_APP_START_SHUTDOWN) name = _T("cbEVT_APP_START_SHUTDOWN");
60  else if (type==cbEVT_APP_ACTIVATED) name = _T("cbEVT_APP_ACTIVATED");
61  else if (type==cbEVT_APP_DEACTIVATED) name = _T("cbEVT_APP_DEACTIVATED");
62  else if (type==cbEVT_PLUGIN_ATTACHED) name = _T("cbEVT_PLUGIN_ATTACHED");
63  else if (type==cbEVT_PLUGIN_RELEASED) name = _T("cbEVT_PLUGIN_RELEASED");
64  else if (type==cbEVT_PLUGIN_INSTALLED) name = _T("cbEVT_PLUGIN_INSTALLED");
65  else if (type==cbEVT_PLUGIN_UNINSTALLED) name = _T("cbEVT_PLUGIN_UNINSTALLED");
66  else if (type==cbEVT_PLUGIN_LOADING_COMPLETE) name = _T("cbEVT_PLUGIN_LOADING_COMPLETE");
67  else if (type==cbEVT_EDITOR_CLOSE) name = _T("cbEVT_EDITOR_CLOSE");
68  else if (type==cbEVT_EDITOR_OPEN) name = _T("cbEVT_EDITOR_OPEN");
69  else if (type==cbEVT_EDITOR_SWITCHED) name = _T("cbEVT_EDITOR_SWITCHED");
70  else if (type==cbEVT_EDITOR_ACTIVATED) name = _T("cbEVT_EDITOR_ACTIVATED");
71  else if (type==cbEVT_EDITOR_DEACTIVATED) name = _T("cbEVT_EDITOR_DEACTIVATED");
72  else if (type==cbEVT_EDITOR_BEFORE_SAVE) name = _T("cbEVT_EDITOR_BEFORE_SAVE");
73  else if (type==cbEVT_EDITOR_SAVE) name = _T("cbEVT_EDITOR_SAVE");
74  else if (type==cbEVT_EDITOR_MODIFIED) name = _T("cbEVT_EDITOR_MODIFIED");
75  else if (type==cbEVT_EDITOR_TOOLTIP) name = _T("cbEVT_EDITOR_TOOLTIP");
76  else if (type==cbEVT_EDITOR_TOOLTIP_CANCEL) name = _T("cbEVT_EDITOR_TOOLTIP_CANCEL");
77  else if (type==cbEVT_EDITOR_SPLIT) name = _T("cbEVT_EDITOR_SPLIT");
78  else if (type==cbEVT_EDITOR_UNSPLIT) name = _T("cbEVT_EDITOR_UNSPLIT");
79  else if (type==cbEVT_EDITOR_UPDATE_UI) name = _T("cbEVT_EDITOR_UPDATE_UI");
80  else if (type==cbEVT_PROJECT_NEW) name = _T("cbEVT_PROJECT_NEW");
81  else if (type==cbEVT_PROJECT_CLOSE) name = _T("cbEVT_PROJECT_CLOSE");
82  else if (type==cbEVT_PROJECT_OPEN) name = _T("cbEVT_PROJECT_OPEN");
83  else if (type==cbEVT_PROJECT_SAVE) name = _T("cbEVT_PROJECT_SAVE");
84  else if (type==cbEVT_PROJECT_ACTIVATE) name = _T("cbEVT_PROJECT_ACTIVATE");
85  else if (type==cbEVT_PROJECT_BEGIN_ADD_FILES) name = _T("cbEVT_PROJECT_BEGIN_ADD_FILES");
86  else if (type==cbEVT_PROJECT_END_ADD_FILES) name = _T("cbEVT_PROJECT_END_ADD_FILES");
87  else if (type==cbEVT_PROJECT_BEGIN_REMOVE_FILES) name = _T("cbEVT_PROJECT_BEGIN_REMOVE_FILES");
88  else if (type==cbEVT_PROJECT_END_REMOVE_FILES) name = _T("cbEVT_PROJECT_END_REMOVE_FILES");
89  else if (type==cbEVT_PROJECT_FILE_ADDED) name = _T("cbEVT_PROJECT_FILE_ADDED");
90  else if (type==cbEVT_PROJECT_FILE_REMOVED) name = _T("cbEVT_PROJECT_FILE_REMOVED");
91  else if (type==cbEVT_PROJECT_POPUP_MENU) name = _T("cbEVT_PROJECT_POPUP_MENU");
92  else if (type==cbEVT_PROJECT_TARGETS_MODIFIED) name = _T("cbEVT_PROJECT_TARGETS_MODIFIED");
93  else if (type==cbEVT_PROJECT_RENAMED) name = _T("cbEVT_PROJECT_RENAMED");
94  else if (type==cbEVT_WORKSPACE_CHANGED) name = _T("cbEVT_WORKSPACE_CHANGED");
95  else if (type==cbEVT_BUILDTARGET_ADDED) name = _T("cbEVT_BUILDTARGET_ADDED");
96  else if (type==cbEVT_BUILDTARGET_REMOVED) name = _T("cbEVT_BUILDTARGET_REMOVED");
97  else if (type==cbEVT_BUILDTARGET_RENAMED) name = _T("cbEVT_BUILDTARGET_RENAMED");
98  else if (type==cbEVT_BUILDTARGET_SELECTED) name = _T("cbEVT_BUILDTARGET_SELECTED");
99  else if (type==cbEVT_PIPEDPROCESS_STDOUT) name = _T("cbEVT_PIPEDPROCESS_STDOUT");
100  else if (type==cbEVT_PIPEDPROCESS_STDERR) name = _T("cbEVT_PIPEDPROCESS_STDERR");
101  else if (type==cbEVT_PIPEDPROCESS_TERMINATED) name = _T("cbEVT_PIPEDPROCESS_TERMINATED");
102  else if (type==cbEVT_THREADTASK_STARTED) name = _T("cbEVT_THREADTASK_STARTED");
103  else if (type==cbEVT_THREADTASK_ENDED) name = _T("cbEVT_THREADTASK_ENDED");
104  else if (type==cbEVT_THREADTASK_ALLDONE) name = _T("cbEVT_THREADTASK_ALLDONE");
105  else if (type==cbEVT_MENUBAR_CREATE_BEGIN) name = _T("cbEVT_MENUBAR_CREATE_BEGIN");
106  else if (type==cbEVT_MENUBAR_CREATE_END) name = _T("cbEVT_MENUBAR_CREATE_END");
107  else if (type==cbEVT_COMPILER_STARTED) name = _T("cbEVT_COMPILER_STARTED");
108  else if (type==cbEVT_COMPILER_FINISHED) name = _T("cbEVT_COMPILER_FINISHED");
109  else if (type==cbEVT_COMPILER_SET_BUILD_OPTIONS) name = _T("cbEVT_COMPILER_SET_BUILD_OPTIONS");
110  else if (type==cbEVT_CLEAN_PROJECT_STARTED) name = _T("cbEVT_CLEAN_PROJECT_STARTED");
111  else if (type==cbEVT_CLEAN_WORKSPACE_STARTED) name = _T("cbEVT_CLEAN_WORKSPACE_STARTED");
112  else if (type==cbEVT_DEBUGGER_STARTED) name = _T("cbEVT_DEBUGGER_STARTED");
113  else if (type==cbEVT_DEBUGGER_PAUSED) name = _T("cbEVT_DEBUGGER_PAUSED");
114  else if (type==cbEVT_DEBUGGER_FINISHED) name = _T("cbEVT_DEBUGGER_FINISHED");
115  else name = _("unknown CodeBlocksEvent");
116 
117  return name;
118 }
119 #endif // PPRCESS_EVENT_PERFORMANCE_MEASURE
120 
121 Manager::Manager() : m_pAppWindow(nullptr), m_SearchResultLog(nullptr)
122 {
123 }
124 
126 {
127  // remove all event sinks
128  for (EventSinksMap::iterator mit = m_EventSinks.begin(); mit != m_EventSinks.end(); ++mit)
129  {
130  while (mit->second.size())
131  {
132  delete (*(mit->second.begin()));
133  mit->second.erase(mit->second.begin());
134  }
135  }
136 
137  for (DockEventSinksMap::iterator mit = m_DockEventSinks.begin(); mit != m_DockEventSinks.end(); ++mit)
138  {
139  while (mit->second.size())
140  {
141  delete (*(mit->second.begin()));
142  mit->second.erase(mit->second.begin());
143  }
144  }
145 
146  for (LayoutEventSinksMap::iterator mit = m_LayoutEventSinks.begin(); mit != m_LayoutEventSinks.end(); ++mit)
147  {
148  while (mit->second.size())
149  {
150  delete (*(mit->second.begin()));
151  mit->second.erase(mit->second.begin());
152  }
153  }
154 
155  for (LogEventSinksMap::iterator mit = m_LogEventSinks.begin(); mit != m_LogEventSinks.end(); ++mit)
156  {
157  while (mit->second.size())
158  {
159  delete (*(mit->second.begin()));
160  mit->second.erase(mit->second.begin());
161  }
162  }
163 }
164 
165 
167 {
168  if (appWindow)
169  {
170  if (Get()->m_pAppWindow)
171  cbThrow(_T("Illegal argument to Manager::Get()"));
172  else
173  {
174  Get()->m_pAppWindow = appWindow;
175  LoadResource(_T("manager_resources.zip"));
176  Get()->GetLogManager()->Log(_("Manager initialized"));
177  }
178  }
179  return Get();
180 }
181 
183 {
184  if (!s_ManagerInstance)
185  s_ManagerInstance = new Manager;
186  return s_ManagerInstance;
187 }
188 
190 {
191  delete s_ManagerInstance;
192  s_ManagerInstance = nullptr;
193 }
194 
195 void Manager::SetAppStartedUp(bool app_started_up)
196 {
197  m_AppStartedUp = app_started_up;
198 }
199 
200 void Manager::SetAppShuttingDown(bool app_shutting_down)
201 {
202  m_AppShuttingDown = app_shutting_down;
203 }
204 
205 void Manager::SetBatchBuild(bool is_batch)
206 {
207  m_IsBatch = is_batch;
208 }
209 
210 void Manager::BlockYields(bool block)
211 {
212  m_BlockYields = block;
213 }
214 
216 {
219 }
220 
222 {
224  wxTheApp->Yield(true);
225 }
226 
228 {
229  m_AppShuttingDown = true;
230 
233  CCManager::Free();
244 }
245 
247 {
248  if (IsAppShuttingDown())
249  return false;
250 
251  EventSinksMap::iterator mit = m_EventSinks.find(event.GetEventType());
252  if (mit != m_EventSinks.end())
253  {
254  for (EventSinksArray::iterator it = mit->second.begin(); it != mit->second.end(); ++it)
255  {
256 #ifdef PPRCESS_EVENT_PERFORMANCE_MEASURE
257  wxStopWatch sw;
258 #endif // PPRCESS_EVENT_PERFORMANCE_MEASURE
259 
260  (*it)->Call(event);
261 
262 #ifdef PPRCESS_EVENT_PERFORMANCE_MEASURE
263  if(sw.Time() > 10) // only print a handler run longer than 10 ms
264  {
265  // get a mangled C++ name of the function
266  const char *p = (*it)->GetTypeName();
267  int status;
268  char *realname;
269  realname = abi::__cxa_demangle(p, 0, 0, &status);
270  wxString msg;
271 
272  // if the demangled C++ function name success, then realname is not NULL
273  if (realname != 0)
274  {
275  msg = wxString::FromUTF8(realname);
276  free(realname);
277  }
278  else
279  msg = wxString::FromUTF8(p);
280 
281  wxEventType type=event.GetEventType();
282  msg << GetCodeblocksEventName(type);
283  Manager::Get()->GetLogManager()->DebugLog(F(_("%s take %ld ms"), msg.wx_str(), sw.Time()));
284  }
285 #endif // PPRCESS_EVENT_PERFORMANCE_MEASURE
286  }
287  }
288  return true;
289 }
290 
292 {
293  if (IsAppShuttingDown())
294  return false;
295 
296  DockEventSinksMap::iterator mit = m_DockEventSinks.find(event.GetEventType());
297  if (mit != m_DockEventSinks.end())
298  {
299  for (DockEventSinksArray::iterator it = mit->second.begin(); it != mit->second.end(); ++it)
300  (*it)->Call(event);
301  }
302  return true;
303 }
304 
306 {
307  if (IsAppShuttingDown())
308  return false;
309 
310  LayoutEventSinksMap::iterator mit = m_LayoutEventSinks.find(event.GetEventType());
311  if (mit != m_LayoutEventSinks.end())
312  {
313  for (LayoutEventSinksArray::iterator it = mit->second.begin(); it != mit->second.end(); ++it)
314  (*it)->Call(event);
315  }
316  return true;
317 }
318 
320 {
321  if (IsAppShuttingDown())
322  return false;
323 
324  LogEventSinksMap::iterator mit = m_LogEventSinks.find(event.GetEventType());
325  if (mit != m_LogEventSinks.end())
326  {
327  for (LogEventSinksArray::iterator it = mit->second.begin(); it != mit->second.end(); ++it)
328  (*it)->Call(event);
329  }
330  return true;
331 }
332 
334 {
335  return m_AppShuttingDown;
336 }
337 
339 {
340  return m_AppStartedUp;
341 }
342 
343 void Manager::InitXRC(bool force)
344 {
345  static bool xrcok = false;
346  if (!xrcok || force)
347  {
351 
352  xrcok = true;
353  }
354 }
355 
357 {
358  LoadResource(relpath);
359 }
360 
361 wxMenuBar *Manager::LoadMenuBar(wxString resid,bool createonfailure)
362 {
364  if (!m && createonfailure) m = new wxMenuBar();
365  return m;
366 }
367 
368 wxMenu *Manager::LoadMenu(wxString menu_id,bool createonfailure)
369 {
370  wxMenu *m = wxXmlResource::Get()->LoadMenu(menu_id);
371  if (!m && createonfailure) m = new wxMenu(_T(""));
372  return m;
373 }
374 
375 wxToolBar *Manager::LoadToolBar(wxFrame *parent,wxString resid,bool defaultsmall)
376 {
377  if (!parent)
378  return nullptr;
379  wxToolBar *tb = wxXmlResource::Get()->LoadToolBar(parent,resid);
380  if (!tb)
381  {
382  int flags = wxTB_HORIZONTAL;
383 
385  flags |= wxTB_FLAT;
386 
387  tb = parent->CreateToolBar(flags, wxID_ANY);
388  tb->SetToolBitmapSize(defaultsmall ? wxSize(16, 16) : wxSize(22, 22));
389  }
390 
391  return tb;
392 }
393 
395 {
396  bool smallToolBar = Manager::Get()->GetConfigManager(_T("app"))->ReadBool(_T("/environment/toolbar_size"), true);
397 
398  wxSize size = smallToolBar ? wxSize(16, 16) : (platform::macosx ? wxSize(32, 32) : wxSize(22, 22));
400  toolbar->SetToolBitmapSize(size);
401 
402  return toolbar;
403 }
404 
406 {
407  if (!toolBar)
408  return;
409  wxXmlResource::Get()->LoadObject(toolBar,nullptr,resid,_T("wxToolBarAddOn"));
410 }
411 
413 {
414  if (!toolBar) return true; // Small by default
415  wxSize mysize=toolBar->GetToolBitmapSize();
416  return (mysize.GetWidth()<=16 && mysize.GetHeight()<=16);
417 }
418 
420 {
421  return m_pAppWindow;
422 }
423 
425 {
426  return (wxWindow*)m_pAppWindow;
427 }
428 
430 {
431  return ProjectManager::Get();
432 }
433 
435 {
436  return EditorManager::Get();
437 }
438 
440 {
441  return LogManager::Get();
442 }
443 
445 {
446  return PluginManager::Get();
447 }
448 
450 {
451  return ToolsManager::Get();
452 }
453 
455 {
456  return MacrosManager::Get();
457 }
458 
460 {
461  return PersonalityManager::Get();
462 }
463 
465 {
466  return UserVariableManager::Get();
467 }
468 
470 {
471  return ScriptingManager::Get();
472 }
473 
475 {
476  return CfgMgrBldr::GetConfigManager(name_space);
477 }
478 
480 {
481  return FileManager::Get();
482 }
483 
485 {
486  return DebuggerManager::Get();
487 }
488 
490 {
491  return ColourManager::Get();
492 }
493 
495 {
496  return CCManager::Get();
497 }
498 
500 {
502  wxString memoryFile = _T("memory:") + file;
503 
504  if (wxFile::Access(resourceFile, wxFile::read) == false)
505  {
506  Get()->GetLogManager()->LogError(_("Manager failed to access XRC resource '") + resourceFile + _("'."));
507  return false;
508  }
509 
510  // The code below forces a reload of the resource
511  // Currently unused...
512 
513 // {
514 // wxMemoryFSHandler::RemoveFile(file);
515 // }
516 //#if wxABI_VERSION > 20601
517 // // unload old resources with the same name
518 // wxXmlResource::Get()->Unload(memoryFile);
519 //#endif
520 
521  wxFile f(resourceFile, wxFile::read);
522  char *buf = nullptr;
523 
524  try
525  {
526  size_t len = f.Length();
527  buf = new char[len];
528  f.Read(buf, len);
529  {
530  wxMemoryFSHandler::AddFile(file, buf, len);
531  }
532  if ( !wxXmlResource::Get()->Load(memoryFile) )
533  Get()->GetLogManager()->LogError(_("Manager failed to load XRC resource '") + resourceFile + _("'."));
534  delete[] buf;
535  return true;
536  }
537  catch (...)
538  {
539  delete[] buf;
540  Get()->GetLogManager()->LogError(_("Manager hardly failed to load XRC resource '") + resourceFile + _("'."));
541  return false;
542  }
543 }
544 
546 {
547  return &m_CmdLineParser;
548 }
549 
551 {
552  m_EventSinks[eventType].push_back(functor);
553 }
554 
556 {
557  m_DockEventSinks[eventType].push_back(functor);
558 }
559 
561 {
562  m_LayoutEventSinks[eventType].push_back(functor);
563 }
564 
566 {
567  m_LogEventSinks[eventType].push_back(functor);
568 }
569 
571 {
572  for (EventSinksMap::iterator mit = m_EventSinks.begin(); mit != m_EventSinks.end(); ++mit)
573  {
574  EventSinksArray::iterator it = mit->second.begin();
575  bool endIsInvalid = false;
576  while (!endIsInvalid && it != mit->second.end())
577  {
578  if ((*it) && (*it)->GetThis() == owner)
579  {
580  EventSinksArray::iterator it2 = it++;
581  endIsInvalid = it == mit->second.end();
582  delete (*it2);
583  mit->second.erase(it2);
584  }
585  else
586  ++it;
587  }
588  }
589 
590  for (DockEventSinksMap::iterator mit = m_DockEventSinks.begin(); mit != m_DockEventSinks.end(); ++mit)
591  {
592  DockEventSinksArray::iterator it = mit->second.begin();
593  bool endIsInvalid = false;
594  while (!endIsInvalid && it != mit->second.end())
595  {
596  if ((*it) && (*it)->GetThis() == owner)
597  {
598  DockEventSinksArray::iterator it2 = it++;
599  endIsInvalid = it == mit->second.end();
600  delete (*it2);
601  mit->second.erase(it2);
602  }
603  else
604  ++it;
605  }
606  }
607 
608  for (LayoutEventSinksMap::iterator mit = m_LayoutEventSinks.begin(); mit != m_LayoutEventSinks.end(); ++mit)
609  {
610  LayoutEventSinksArray::iterator it = mit->second.begin();
611  bool endIsInvalid = false;
612  while (!endIsInvalid && it != mit->second.end())
613  {
614  if ((*it) && (*it)->GetThis() == owner)
615  {
616  LayoutEventSinksArray::iterator it2 = it++;
617  endIsInvalid = it == mit->second.end();
618  delete (*it2);
619  mit->second.erase(it2);
620  }
621  else
622  ++it;
623  }
624  }
625 
626  for (LogEventSinksMap::iterator mit = m_LogEventSinks.begin(); mit != m_LogEventSinks.end(); ++mit)
627  {
628  LogEventSinksArray::iterator it = mit->second.begin();
629  bool endIsInvalid = false;
630  while (!endIsInvalid && it != mit->second.end())
631  {
632  if ((*it) && (*it)->GetThis() == owner)
633  {
634  LogEventSinksArray::iterator it2 = it++;
635  endIsInvalid = it == mit->second.end();
636  delete (*it2);
637  mit->second.erase(it2);
638  }
639  else
640  ++it;
641  }
642  }
643 }
644 
645 bool Manager::m_AppShuttingDown = false;
646 bool Manager::m_AppStartedUp = false;
647 bool Manager::m_BlockYields = false;
648 bool Manager::m_IsBatch = false;
wxString F(const wxChar *msg,...)
sprintf-like function
Definition: logmanager.h:20
EVTIMPORT const wxEventType cbEVT_EDITOR_TOOLTIP
Definition: sdk_events.cpp:88
virtual wxSize GetToolBitmapSize() const
wxApp * wxTheApp
EVTIMPORT const wxEventType cbEVT_BUILDTARGET_RENAMED
Definition: sdk_events.cpp:118
EVTIMPORT const wxEventType cbEVT_PROJECT_FILE_ADDED
Definition: sdk_events.cpp:104
virtual void ProcessPendingEvents()
EVTIMPORT const wxEventType cbEVT_PROJECT_END_ADD_FILES
Definition: sdk_events.cpp:101
EVTIMPORT const wxEventType cbEVT_PROJECT_RENAMED
Definition: sdk_events.cpp:109
EVTIMPORT const wxEventType cbEVT_PROJECT_NEW
Definition: sdk_events.cpp:95
PluginManager * GetPluginManager() const
Definition: manager.cpp:444
Data folder in user&#39;s dir.
Definition: configmanager.h:75
EVTIMPORT const wxEventType cbEVT_APP_START_SHUTDOWN
Definition: sdk_events.cpp:69
static void ProcessPendingEvents()
Definition: manager.cpp:215
static bool LoadResource(const wxString &file)
Definition: manager.cpp:499
static bool IsAppStartedUp()
Definition: manager.cpp:338
ConfigManager * GetConfigManager(const wxString &name_space) const
Definition: manager.cpp:474
UserVariableManager * GetUserVariableManager() const
Definition: manager.cpp:464
static void Free()
Never, EVER, call this function! It is the last function called on shutdown....
Definition: manager.cpp:189
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
Definition: manager.cpp:182
DLLIMPORT windows_version_t WindowsVersion()
Definition: globals.cpp:1338
EVTIMPORT const wxEventType cbEVT_COMPILER_FINISHED
Definition: sdk_events.cpp:149
static void SetAppShuttingDown(bool app_shutting_down)
Definition: manager.cpp:200
wxToolBar * LoadToolBar(wxWindow *parent, const wxString &name)
EVTIMPORT const wxEventType cbEVT_CLEAN_PROJECT_STARTED
Definition: sdk_events.cpp:151
wxFileOffset Length() const
static bool IsAppShuttingDown()
Definition: manager.cpp:333
static bool m_AppShuttingDown
Definition: manager.h:51
static void SetBatchBuild(bool is_batch)
Definition: manager.cpp:205
EVTIMPORT const wxEventType cbEVT_PLUGIN_ATTACHED
Definition: sdk_events.cpp:74
int GetWidth() const
int GetHeight() const
PersonalityManager * GetPersonalityManager() const
Definition: manager.cpp:459
EVTIMPORT const wxEventType cbEVT_PIPEDPROCESS_STDOUT
Definition: sdk_events.cpp:121
~Manager()
Definition: manager.cpp:125
Manage different personalities.
bool ReadBool(const wxString &name, bool defaultVal=false)
EVTIMPORT const wxEventType cbEVT_BUILDTARGET_SELECTED
Definition: sdk_events.cpp:119
wxMenu * LoadMenu(const wxString &name)
EVTIMPORT const wxEventType cbEVT_PLUGIN_RELEASED
Definition: sdk_events.cpp:75
EVTIMPORT const wxEventType cbEVT_PROJECT_ACTIVATE
Definition: sdk_events.cpp:99
FileManager * GetFileManager() const
Definition: manager.cpp:479
Event used to request from the main app to add a log.
Definition: sdk_events.h:182
Event used to request from the main app to add a window to the docking system.
Definition: sdk_events.h:83
static void AddonToolBar(wxToolBar *toolBar, wxString resid)
Definition: manager.cpp:405
virtual void SetToolBitmapSize(const wxSize &size)
long Time() const
static void LoadXRC(wxString relpath)
Loads XRC file(s) using data_path.
Definition: manager.cpp:356
static ProjectManager * Get()
Definition: manager.h:199
#define _T(string)
EVTIMPORT const wxEventType cbEVT_DEBUGGER_STARTED
Definition: sdk_events.cpp:157
EVTIMPORT const wxEventType cbEVT_PROJECT_BEGIN_ADD_FILES
Definition: sdk_events.cpp:100
static void BlockYields(bool block)
Blocks/unblocks Manager::Yield(). Be careful when using it. Actually, do not use it ;) ...
Definition: manager.cpp:210
static wxMenu * LoadMenu(wxString menu_id, bool createonfailure=false)
Loads Menu from XRC.
Definition: manager.cpp:368
static ConfigManager * GetConfigManager(const wxString &name_space)
EVTIMPORT const wxEventType cbEVT_EDITOR_TOOLTIP_CANCEL
Definition: sdk_events.cpp:89
EVTIMPORT const wxEventType cbEVT_PROJECT_SAVE
Definition: sdk_events.cpp:98
EVTIMPORT const wxEventType cbEVT_EDITOR_SPLIT
Definition: sdk_events.cpp:90
static bool isToolBar16x16(wxToolBar *toolBar)
Definition: manager.cpp:412
EVTIMPORT const wxEventType cbEVT_PIPEDPROCESS_TERMINATED
Definition: sdk_events.cpp:123
EVTIMPORT const wxEventType cbEVT_THREADTASK_ALLDONE
Definition: sdk_events.cpp:127
wxMenuBar * LoadMenuBar(wxWindow *parent, const wxString &name)
static bool m_AppStartedUp
Definition: manager.h:52
EVTIMPORT const wxEventType cbEVT_COMPILER_SET_BUILD_OPTIONS
Definition: sdk_events.cpp:150
EVTIMPORT const wxEventType cbEVT_CLEAN_WORKSPACE_STARTED
Definition: sdk_events.cpp:152
static bool m_IsBatch
Definition: manager.h:54
A generic Code::Blocks event.
Definition: sdk_events.h:20
static wxString LocateDataFile(const wxString &filename, int search_dirs=sdAllKnown)
Locate a file in an installation- and platform-independent way.
wxWindow * GetAppWindow() const
Definition: manager.cpp:424
wxFrame * m_pAppWindow
Definition: manager.h:50
EditorManager * GetEditorManager() const
Definition: manager.cpp:434
void LogError(const wxString &msg, int i=app_log)
Definition: logmanager.h:142
static void Shutdown()
Definition: manager.cpp:227
ProjectManager * GetProjectManager() const
Functions returning pointers to the respective sub-manager instances.
Definition: manager.cpp:429
PluginManager manages plugins.
Definition: pluginmanager.h:76
DebuggerManager * GetDebuggerManager() const
Definition: manager.cpp:484
static bool m_BlockYields
Definition: manager.h:53
EVTIMPORT const wxEventType cbEVT_EDITOR_CLOSE
Definition: sdk_events.cpp:80
LayoutEventSinksMap m_LayoutEventSinks
Definition: manager.h:178
LogEventSinksMap m_LogEventSinks
Definition: manager.h:179
static wxMenuBar * LoadMenuBar(wxString resid, bool createonfailure=false)
Loads Menubar from XRC.
Definition: manager.cpp:361
null_pointer_t nullptr
Definition: nullptr.cpp:16
static void InitXRC(bool force=false)
XML Resource functions /////// Inits XML Resource system.
Definition: manager.cpp:343
Base abstract event functor class.
Definition: cbfunctor.h:30
EVTIMPORT const wxEventType cbEVT_PLUGIN_LOADING_COMPLETE
Definition: sdk_events.cpp:78
DockEventSinksMap m_DockEventSinks
Definition: manager.h:177
static wxCmdLineParser * GetCmdLineParser()
Definition: manager.cpp:545
EVTIMPORT const wxEventType cbEVT_PROJECT_BEGIN_REMOVE_FILES
Definition: sdk_events.cpp:102
static wxString FromUTF8(const char *s)
ToolsManager * GetToolsManager() const
Definition: manager.cpp:449
EVTIMPORT const wxEventType cbEVT_EDITOR_SWITCHED
Definition: sdk_events.cpp:82
EVTIMPORT const wxEventType cbEVT_APP_DEACTIVATED
Definition: sdk_events.cpp:71
wxFrame * GetAppFrame() const
Definition: manager.cpp:419
CCManager * GetCCManager() const
Definition: manager.cpp:494
EVTIMPORT const wxEventType cbEVT_DEBUGGER_PAUSED
Definition: sdk_events.cpp:158
EVTIMPORT const wxEventType cbEVT_APP_ACTIVATED
Definition: sdk_events.cpp:70
const wxPoint wxDefaultPosition
void RemoveAllEventSinksFor(void *owner)
Definition: manager.cpp:570
LogManager * GetLogManager() const
Definition: manager.cpp:439
EVTIMPORT const wxEventType cbEVT_EDITOR_UPDATE_UI
Definition: sdk_events.cpp:92
EVTIMPORT const wxEventType cbEVT_BUILDTARGET_REMOVED
Definition: sdk_events.cpp:117
static void AddHandler(wxFileSystemHandler *handler)
const wxStringCharType * wx_str() const
static void AddFile(const wxString &filename, wxImage &image, wxBitmapType type)
EVTIMPORT const wxEventType cbEVT_THREADTASK_ENDED
Definition: sdk_events.cpp:126
EVTIMPORT const wxEventType cbEVT_EDITOR_DEACTIVATED
Definition: sdk_events.cpp:84
EVTIMPORT const wxEventType cbEVT_DEBUGGER_FINISHED
Definition: sdk_events.cpp:159
EVTIMPORT const wxEventType cbEVT_PROJECT_TARGETS_MODIFIED
Definition: sdk_events.cpp:108
MacrosManager * GetMacrosManager() const
Definition: manager.cpp:454
static bool Access(const wxString &name, wxFile::OpenMode mode)
const wxString & _(const wxString &string)
Code Completion Plugin Manager.
Definition: ccmanager.h:47
EVTIMPORT const wxEventType cbEVT_THREADTASK_STARTED
Definition: sdk_events.cpp:125
static void Yield()
Whenever you need to call wxYield(), call Manager::Yield(). It&#39;s safer.
Definition: manager.cpp:221
EVTIMPORT const wxEventType cbEVT_PROJECT_END_REMOVE_FILES
Definition: sdk_events.cpp:103
#define cbThrow(message)
Definition: cbexception.h:42
static void Free()
Definition: manager.h:211
ssize_t Read(void *buffer, size_t count)
EVTIMPORT const wxEventType cbEVT_APP_STARTUP_DONE
Definition: sdk_events.cpp:68
ColourManager * GetColourManager() const
Definition: manager.cpp:489
EVTIMPORT const wxEventType cbEVT_MENUBAR_CREATE_END
Definition: sdk_events.cpp:146
EVTIMPORT const wxEventType cbEVT_PLUGIN_UNINSTALLED
Definition: sdk_events.cpp:77
EVTIMPORT const wxEventType cbEVT_EDITOR_ACTIVATED
Definition: sdk_events.cpp:83
EVTIMPORT const wxEventType cbEVT_COMPILER_STARTED
Definition: sdk_events.cpp:148
The entry point singleton for working with projects.
static wxToolBar * LoadToolBar(wxFrame *parent, wxString resid, bool defaultsmall=true)
Loads ToolBar from XRC.
Definition: manager.cpp:375
Provides scripting in Code::Blocks.
void Log(const wxString &msg, int i=app_log, Logger::level lv=Logger::info)
Definition: logmanager.h:140
EventSinksMap m_EventSinks
Definition: manager.h:176
EVTIMPORT const wxEventType cbEVT_PROJECT_POPUP_MENU
Definition: sdk_events.cpp:107
EVTIMPORT const wxEventType cbEVT_EDITOR_BEFORE_SAVE
Definition: sdk_events.cpp:85
void DebugLog(const wxString &msg, Logger::level lv=Logger::info)
Definition: logmanager.h:146
static void SetAppStartedUp(bool app_started_up)
Definition: manager.cpp:195
bool ProcessEvent(CodeBlocksEvent &event)
Definition: manager.cpp:246
EVTIMPORT const wxEventType cbEVT_WORKSPACE_CHANGED
Definition: sdk_events.cpp:111
EVTIMPORT const wxEventType cbEVT_PROJECT_OPEN
Definition: sdk_events.cpp:97
void RegisterEventSink(wxEventType eventType, IEventFunctorBase< CodeBlocksEvent > *functor)
Definition: manager.cpp:550
Manager()
Definition: manager.cpp:121
void InsertHandler(wxXmlResourceHandler *handler)
EVTIMPORT const wxEventType cbEVT_PROJECT_CLOSE
Definition: sdk_events.cpp:96
EVTIMPORT const wxEventType cbEVT_MENUBAR_CREATE_BEGIN
Definition: sdk_events.cpp:144
EVTIMPORT const wxEventType cbEVT_EDITOR_OPEN
Definition: sdk_events.cpp:81
int wxEventType
static wxXmlResource * Get()
void InitAllHandlers()
EVTIMPORT const wxEventType cbEVT_PROJECT_FILE_REMOVED
Definition: sdk_events.cpp:105
ScriptingManager * GetScriptingManager() const
Definition: manager.cpp:469
EVTIMPORT const wxEventType cbEVT_BUILDTARGET_ADDED
Definition: sdk_events.cpp:116
bool Yield(bool onlyIfNeeded=false)
Data folder in base dir.
Definition: configmanager.h:81
EVTIMPORT const wxEventType cbEVT_EDITOR_UNSPLIT
Definition: sdk_events.cpp:91
EVTIMPORT const wxEventType cbEVT_EDITOR_SAVE
Definition: sdk_events.cpp:86
EVTIMPORT const wxEventType cbEVT_PLUGIN_INSTALLED
Definition: sdk_events.cpp:76
static wxCmdLineParser m_CmdLineParser
Definition: manager.h:55
wxToolBar * CreateEmptyToolbar()
Definition: manager.cpp:394
static Manager * s_ManagerInstance
Definition: manager.cpp:51
wxObject * LoadObject(wxWindow *parent, const wxString &name, const wxString &classname)
EVTIMPORT const wxEventType cbEVT_PIPEDPROCESS_STDERR
Definition: sdk_events.cpp:122
EVTIMPORT const wxEventType cbEVT_EDITOR_MODIFIED
Definition: sdk_events.cpp:87
Event used to request from the main app to manage the view layouts.
Definition: sdk_events.h:158