Code::Blocks  SVN r11506
batchbuild.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
3  * http://www.gnu.org/licenses/gpl-3.0.html
4  */
5 
6 #include <scrollingdialog.h>
7 #include <manager.h>
8 #include <configmanager.h>
9 #include <pluginmanager.h>
10 #include <cbplugin.h>
11 #include <globals.h>
12 
13 // Custom window to shutdown the app when closed.
14 // used for batch builds only.
16 {
17  public:
18  BatchLogWindow(wxWindow *parent, const wxString &title)
20  {
21  wxSize size;
22  size.SetWidth(Manager::Get()->GetConfigManager(_T("message_manager"))->ReadInt(_T("/batch_build_log/width"), wxDefaultSize.GetWidth()));
23  size.SetHeight(Manager::Get()->GetConfigManager(_T("message_manager"))->ReadInt(_T("/batch_build_log/height"), wxDefaultSize.GetHeight()));
24  SetSize(size);
25  }
26  void EndModal(int retCode)
27  {
28  // allowed to close?
29  // find compiler plugin
30  bool hasRunning = cbHasRunningCompilers(Manager::Get()->GetPluginManager());
31  if (hasRunning)
32  {
33  if (cbMessageBox(_("The build is in progress. Are you sure you want to abort it?"),
34  _("Abort build?"),
35  wxICON_QUESTION | wxYES_NO, this) == wxID_YES)
36  {
37  cbStopRunningCompilers(Manager::Get()->GetPluginManager());
38  return;
39  }
40  }
41 
42  Manager::Get()->GetConfigManager(_T("message_manager"))->Write(_T("/batch_build_log/width"), (int)GetSize().GetWidth());
43  Manager::Get()->GetConfigManager(_T("message_manager"))->Write(_T("/batch_build_log/height"), (int)GetSize().GetHeight());
45  }
46 };
void EndModal(int retCode)
Definition: sc_dialog.cpp:112
#define wxMAXIMIZE_BOX
#define wxICON_QUESTION
ConfigManager * GetConfigManager(const wxString &name_space) const
Definition: manager.cpp:474
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
int GetWidth() const
int GetHeight() const
#define _T(string)
BatchLogWindow(wxWindow *parent, const wxString &title)
Definition: batchbuild.h:18
#define wxYES_NO
void SetHeight(int height)
DLLIMPORT bool cbHasRunningCompilers(const PluginManager *manager)
void Write(const wxString &name, const wxString &value, bool ignoreEmpty=false)
const wxSize wxDefaultSize
const wxPoint wxDefaultPosition
#define wxDEFAULT_DIALOG_STYLE
const wxString & _(const wxString &string)
void SetWidth(int width)
void EndModal(int retCode)
Definition: batchbuild.h:26
#define wxMINIMIZE_BOX
#define wxRESIZE_BORDER
DLLIMPORT int cbMessageBox(const wxString &message, const wxString &caption=wxEmptyString, int style=wxOK, wxWindow *parent=NULL, int x=-1, int y=-1)
wxMessageBox wrapper.
Definition: globals.cpp:1395
DLLIMPORT void cbStopRunningCompilers(PluginManager *manager)