Code::Blocks  SVN r11506
environmentsettingsdlg.cpp
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  * $Revision: 11359 $
6  * $Id: environmentsettingsdlg.cpp 11359 2018-04-01 17:11:54Z fuscated $
7  * $HeadURL: https://svn.code.sf.net/p/codeblocks/code/trunk/src/src/environmentsettingsdlg.cpp $
8  */
9 
10 #include <sdk.h>
11 
12 #ifndef CB_PRECOMP
13  #include <wx/button.h>
14  #include <wx/menu.h>
15  #include <wx/radiobut.h>
16  #include <wx/xrc/xmlres.h>
17  #include <wx/intl.h>
18  #include <wx/listctrl.h>
19  #include <wx/combobox.h>
20  #include <wx/choice.h>
21  #include <wx/checkbox.h>
22  #include <wx/checklst.h>
23  #include <wx/radiobox.h>
24  #include <wx/spinctrl.h>
25  #include <wx/colordlg.h>
26  #include <wx/msgdlg.h>
27  #include <wx/imaglist.h>
28  #include <wx/settings.h>
29  #include <wx/stattext.h>
30 
31  #include <manager.h>
32  #include <configmanager.h>
33  #include <editormanager.h>
34  #include <pluginmanager.h>
35  #include <logmanager.h>
36  #include "appglobals.h"
37  #include "globals.h"
38  #include "associations.h"
39  #include "cbauibook.h"
40 #endif
41 
42 #include <wx/aui/aui.h>
43 #include <wx/listbook.h>
44 
45 #include "annoyingdialog.h"
46 #include "configurationpanel.h"
47 #include "environmentsettingsdlg.h"
48 #include "cbcolourmanager.h"
49 
50 #ifdef __WXMSW__
51  #include "associations.h"
52 #endif
53 
54 #ifndef CB_PRECOMP
55  #include <wx/dir.h>
56  #include "cbplugin.h" // cgCompiler...
57 #endif
58 
59 // images by order of pages
60 const wxString base_imgs[] =
61 {
62  _T("general-prefs"),
63  _T("view"),
64  _T("notebook-appearance"),
65  _T("colours"),
66  _T("colours"),
67  _T("dialogs"),
68  _T("net")
69 };
70 const int IMAGES_COUNT = sizeof(base_imgs) / sizeof(wxString);
71 
72 BEGIN_EVENT_TABLE(EnvironmentSettingsDlg, wxScrollingDialog)
73  EVT_BUTTON(XRCID("btnSetAssocs"), EnvironmentSettingsDlg::OnSetAssocs)
74  EVT_BUTTON(XRCID("btnManageAssocs"), EnvironmentSettingsDlg::OnManageAssocs)
75  EVT_BUTTON(XRCID("btnAuiCaptionColour"), EnvironmentSettingsDlg::OnChooseColour)
76  EVT_BUTTON(XRCID("btnAuiCaptionTextColour"), EnvironmentSettingsDlg::OnChooseColour)
77  EVT_BUTTON(XRCID("btnAuiActiveCaptionColour"), EnvironmentSettingsDlg::OnChooseColour)
78  EVT_BUTTON(XRCID("btnAuiActiveCaptionGradientColour"), EnvironmentSettingsDlg::OnChooseColour)
79  EVT_BUTTON(XRCID("btnAuiActiveCaptionTextColour"), EnvironmentSettingsDlg::OnChooseColour)
80  EVT_BUTTON(XRCID("btnAuiInactiveCaptionColour"), EnvironmentSettingsDlg::OnChooseColour)
81  EVT_BUTTON(XRCID("btnAuiInactiveCaptionGradientColour"), EnvironmentSettingsDlg::OnChooseColour)
82  EVT_BUTTON(XRCID("btnAuiInactiveCaptionTextColour"), EnvironmentSettingsDlg::OnChooseColour)
83  EVT_BUTTON(XRCID("btnResetDefaultColours"), EnvironmentSettingsDlg::OnResetDefaultColours)
84  EVT_CHECKBOX(XRCID("chkUseIPC"), EnvironmentSettingsDlg::OnUseIpcCheck)
85  EVT_CHECKBOX(XRCID("chkDoPlace"), EnvironmentSettingsDlg::OnPlaceCheck)
86  EVT_CHECKBOX(XRCID("chkPlaceHead"), EnvironmentSettingsDlg::OnHeadCheck)
87  EVT_CHECKBOX(XRCID("chkAutoHideMessages"), EnvironmentSettingsDlg::OnAutoHide)
88  EVT_CHECKBOX(XRCID("chkI18N"), EnvironmentSettingsDlg::OnI18NCheck)
89  EVT_RADIOBOX(XRCID("rbSettingsIconsSize"), EnvironmentSettingsDlg::OnSettingsIconsSize)
90  EVT_CHECKBOX(XRCID("chkDblClkMaximizes"), EnvironmentSettingsDlg::OnDblClickMaximizes)
91  EVT_CHECKBOX(XRCID("chkNBUseMousewheel"), EnvironmentSettingsDlg::OnUseTabMousewheel)
92 
93  EVT_CHOICE(XRCID("chCategory"), EnvironmentSettingsDlg::OnChooseAppColourCategory)
94  EVT_LISTBOX(XRCID("lstColours"), EnvironmentSettingsDlg::OnChooseAppColourItem)
95  EVT_BUTTON(XRCID("btnColour"), EnvironmentSettingsDlg::OnClickAppColour)
96  EVT_BUTTON(XRCID("btnDefaultColour"), EnvironmentSettingsDlg::OnClickAppColour)
97 END_EVENT_TABLE()
98 
100  : m_pArt(art),
101  m_pImageList(nullptr)
102 {
103  ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("app"));
104  ConfigManager *pcfg = Manager::Get()->GetConfigManager(_T("project_manager"));
105  ConfigManager *mcfg = Manager::Get()->GetConfigManager(_T("message_manager"));
106  ConfigManager *acfg = Manager::Get()->GetConfigManager(_T("an_dlg"));
107 
108  wxXmlResource::Get()->LoadObject(this, parent, _T("dlgEnvironmentSettings"),_T("wxScrollingDialog"));
109  XRCCTRL(*this, "wxID_OK", wxButton)->SetDefault();
110 
111  LoadListbookImages();
112 
113  Connect(XRCID("nbMain"),wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING,wxListbookEventHandler(EnvironmentSettingsDlg::OnPageChanging));
114  Connect(XRCID("nbMain"),wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, wxListbookEventHandler(EnvironmentSettingsDlg::OnPageChanged ));
115 
116  // tab "General"
117  XRCCTRL(*this, "chkShowSplash", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/show_splash"), true));
118  XRCCTRL(*this, "chkSingleInstance", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/single_instance"), true));
119 #ifdef __WXMSW__
120  static_cast<wxStaticBoxSizer*>(XRCCTRL(*this, "chkUseIPC", wxCheckBox)->GetContainingSizer())->GetStaticBox()->SetLabel(_("Dynamic Data Exchange (will take place after restart)"));
121 #endif
122  bool useIpc = cfg->ReadBool(_T("/environment/use_ipc"), true);
123  XRCCTRL(*this, "chkUseIPC", wxCheckBox)->SetValue(useIpc);
124  XRCCTRL(*this, "chkRaiseViaIPC", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/raise_via_ipc"), true));
125  XRCCTRL(*this, "chkRaiseViaIPC", wxCheckBox)->Enable(useIpc);
126 
127  XRCCTRL(*this, "chkAssociations", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/check_associations"), true));
128  XRCCTRL(*this, "chkModifiedFiles", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/check_modified_files"), true));
129  XRCCTRL(*this, "chkInvalidTargets", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/ignore_invalid_targets"), true));
130  XRCCTRL(*this, "rbAppStart", wxRadioBox)->SetSelection(cfg->ReadBool(_T("/environment/blank_workspace"), true) ? 1 : 0);
131  XRCCTRL(*this, "chkProjectLayout", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/enable_project_layout"), true));
132  XRCCTRL(*this, "chkEditorLayout", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/enable_editor_layout"), false));
133 
134  wxTextCtrl* txt = XRCCTRL(*this, "txtConsoleShell", wxTextCtrl);
135  txt->SetValue(cfg->Read(_T("/console_shell"), DEFAULT_CONSOLE_SHELL));
136 #ifdef __WXMSW__
137  // under win32, this option is not needed, so disable it
138  txt->Enable(false);
139 #endif
140 
141  wxComboBox *combo = XRCCTRL(*this, "cbConsoleTerm", wxComboBox);
142  combo->Append(DEFAULT_CONSOLE_TERM);
143 
144  if (platform::windows)
145  combo->Enable(false);
146  else
147  {
148  if (!platform::macosx && !platform::darwin)
149  {
150  combo->Append(wxT("gnome-terminal -t $TITLE -x "));
151  combo->Append(wxT("konsole -e "));
152  combo->Append(wxT("xfce4-terminal -T $TITLE -x "));
153  combo->Append(wxT("terminology -M -T $TITLE -e "));
154  }
155  wxString terminal = cfg->Read(wxT("/console_terminal"), DEFAULT_CONSOLE_TERM);
156  if (!combo->SetStringSelection(terminal))
157  {
158  combo->Insert(terminal, 0);
159  combo->SetStringSelection(terminal);
160  }
161  }
162 
163  const wxString &openFolderCommand = cfg->Read(_T("/open_containing_folder"), cbDEFAULT_OPEN_FOLDER_CMD);
164  XRCCTRL(*this, "txtOpenFolder", wxTextCtrl)->SetValue(openFolderCommand);
165 
166  // tab "View"
167  bool do_place = cfg->ReadBool(_T("/dialog_placement/do_place"), false);
168  XRCCTRL(*this, "chkDoPlace", wxCheckBox)->SetValue(do_place);
169  XRCCTRL(*this, "chkPlaceHead", wxCheckBox)->SetValue(cfg->ReadInt(_T("/dialog_placement/dialog_position"), 0) == pdlHead ? 1 : 0);
170  XRCCTRL(*this, "chkPlaceHead", wxCheckBox)->Enable(do_place);
171 
172  XRCCTRL(*this, "rbProjectOpen", wxRadioBox)->SetSelection(pcfg->ReadInt(_T("/open_files"), 1));
173  XRCCTRL(*this, "rbToolbarSize", wxRadioBox)->SetSelection(cfg->ReadBool(_T("/environment/toolbar_size"), true) ? 1 : 0);
174  XRCCTRL(*this, "rbSettingsIconsSize", wxRadioBox)->SetSelection(cfg->ReadInt(_T("/environment/settings_size"), 0));
175  XRCCTRL(*this, "chkShowStartPage", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/start_here_page"), true));
176  XRCCTRL(*this, "spnLogFontSize", wxSpinCtrl)->SetValue(mcfg->ReadInt(_T("/log_font_size"), 8));
177 
178  bool en = mcfg->ReadBool(_T("/auto_hide"), false);
179  XRCCTRL(*this, "chkAutoHideMessages", wxCheckBox)->SetValue(en);
180  XRCCTRL(*this, "chkAutoShowMessagesOnSearch", wxCheckBox)->SetValue(mcfg->ReadBool(_T("/auto_show_search"), true));
181  XRCCTRL(*this, "chkAutoShowMessagesOnWarn", wxCheckBox)->SetValue(mcfg->ReadBool(_T("/auto_show_build_warnings"), true));
182  XRCCTRL(*this, "chkAutoShowMessagesOnErr", wxCheckBox)->SetValue(mcfg->ReadBool(_T("/auto_show_build_errors"), true));
183  XRCCTRL(*this, "chkAutoShowMessagesOnSearch", wxCheckBox)->Enable(en);
184  XRCCTRL(*this, "chkAutoShowMessagesOnWarn", wxCheckBox)->Enable(en);
185  XRCCTRL(*this, "chkAutoShowMessagesOnErr", wxCheckBox)->Enable(en);
186 
187  XRCCTRL(*this, "chkAutoFocusMessagesOnErr", wxCheckBox)->SetValue(mcfg->ReadBool(_T("/auto_focus_build_errors"), true));
188  XRCCTRL(*this, "chkSaveSelectionChangeInMP", wxCheckBox)->SetValue(mcfg->ReadBool(_T("/save_selection_change_in_mp"), true));
189 
190  en = cfg->ReadBool(_T("/environment/view/dbl_clk_maximize"), true);
191  XRCCTRL(*this, "chkDblClkMaximizes", wxCheckBox)->SetValue(en);
192  int idx = Manager::Get()->GetAppFrame()->GetMenuBar()->FindMenu(_("&View"));
193  if (idx != wxNOT_FOUND)
194  {
195  wxMenu* menuView = Manager::Get()->GetAppFrame()->GetMenuBar()->GetMenu(idx);
196  int sub_idx = menuView->FindItem(_("Perspectives"));
197  if (sub_idx != wxNOT_FOUND)
198  {
199  wxMenu* menuLayouts = menuView->FindItem(sub_idx)->GetSubMenu();
200  if (menuLayouts)
201  {
202  wxMenuItemList& items = menuLayouts->GetMenuItems();
203  for (size_t i = 0; i < items.GetCount() && ! items[i]->IsSeparator() ; ++i)
204  {
205  XRCCTRL(*this, "choLayoutToToggle", wxChoice)->Append(items[i]->GetLabelText(items[i]->GetItemLabelText()));
206  }
207  }
208  }
209  }
210 
211  int sel = XRCCTRL(*this, "choLayoutToToggle", wxChoice)->FindString( cfg->Read(_T("/environment/view/layout_to_toggle"),cfg->Read(_T("/main_frame/layout/default"))));
212  XRCCTRL(*this, "choLayoutToToggle", wxChoice)->SetSelection(sel != wxNOT_FOUND ? sel : 0);
213  XRCCTRL(*this, "choLayoutToToggle", wxChoice)->Enable(en);
214 
215  bool i18n = cfg->ReadBool(_T("/locale/enable"), false);
216  XRCCTRL(*this, "chkI18N", wxCheckBox)->SetValue(i18n);
217 
218  wxString locPath = ConfigManager::GetDataFolder() + _T("/locale");
219  if ( wxDirExists(locPath) )
220  {
221  wxString locFName;
222  wxDir locDir(locPath);
223  if ( locDir.IsOpened() && locDir.GetFirst(&locFName/*, wxEmptyString, wxDIR_DIRS*/) )
224  {
225  do
226  {
227  const wxLanguageInfo* info = wxLocale::FindLanguageInfo(locFName);
228  if (info)
229  XRCCTRL(*this, "cbxLanguage", wxComboBox)->Append(info->Description);
230  } while ( locDir.GetNext(&locFName) );
231  }
232  }
233 
234  XRCCTRL(*this, "cbxLanguage", wxComboBox)->Enable(i18n);
235 
236  const wxLanguageInfo* info = wxLocale::FindLanguageInfo(cfg->Read(_T("/locale/language")));
237  if (info)
238  XRCCTRL(*this, "cbxLanguage", wxComboBox)->SetStringSelection(info->Description);
239 
240 
241  // tab "Notebook"
242  XRCCTRL(*this, "cmbEditorTabs", wxChoice)->SetSelection(cfg->ReadInt(_T("/environment/tabs_style"), 0));
243  XRCCTRL(*this, "cmbTabCloseStyle", wxChoice)->SetSelection(cfg->ReadInt(_T("/environment/tabs_closestyle"), 0));
244  XRCCTRL(*this, "chkListTabs", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/tabs_list"), 0));
245  XRCCTRL(*this, "chkStackedBasedTabSwitching", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/tabs_stacked_based_switching"), 0));
246  bool enableTabMousewheel = cfg->ReadBool(_T("/environment/tabs_use_mousewheel"),true);
247  bool modToAdvance = cfg->ReadBool(_T("/environment/tabs_mousewheel_advance"),false);
248  XRCCTRL(*this, "chkNBUseMousewheel", wxCheckBox)->SetValue(enableTabMousewheel);
249  XRCCTRL(*this, "rbNBModToAdvance", wxRadioButton)->SetValue(modToAdvance);
250  XRCCTRL(*this, "rbNBModToMove", wxRadioButton)->SetValue(!modToAdvance);
251  XRCCTRL(*this, "chkNBInvertAdvance", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/tabs_invert_advance"),false));
252  XRCCTRL(*this, "chkNBInvertMove", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/tabs_invert_move"),false));
253  XRCCTRL(*this, "txtMousewheelModifier", wxTextCtrl)->SetValue(cfg->Read(_T("/environment/tabs_mousewheel_modifier"),_T("Ctrl")));
254  XRCCTRL(*this, "txtMousewheelModifier", wxTextCtrl)->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(EnvironmentSettingsDlg::OnMousewheelModifier));
255  XRCCTRL(*this, "rbNBModToAdvance", wxRadioButton)->Enable(enableTabMousewheel);
256  XRCCTRL(*this, "rbNBModToMove", wxRadioButton)->Enable(enableTabMousewheel);
257  XRCCTRL(*this, "chkNBInvertAdvance", wxCheckBox)->Enable(enableTabMousewheel);
258  XRCCTRL(*this, "chkNBInvertMove", wxCheckBox)->Enable(enableTabMousewheel);
259  XRCCTRL(*this, "txtMousewheelModifier", wxTextCtrl)->Enable(enableTabMousewheel);
260 
261  // tab "Docking"
262  XRCCTRL(*this, "spnAuiBorder", wxSpinCtrl)->SetValue(cfg->ReadInt(_T("/environment/aui/border_size"), m_pArt->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE)));
263  XRCCTRL(*this, "spnAuiSash", wxSpinCtrl)->SetValue(cfg->ReadInt(_T("/environment/aui/sash_size"), m_pArt->GetMetric(wxAUI_DOCKART_SASH_SIZE)));
264  XRCCTRL(*this, "spnAuiCaption", wxSpinCtrl)->SetValue(cfg->ReadInt(_T("/environment/aui/caption_size"), m_pArt->GetMetric(wxAUI_DOCKART_CAPTION_SIZE)));
265  XRCCTRL(*this, "btnAuiActiveCaptionColour", wxButton)->SetBackgroundColour(cfg->ReadColour(_T("/environment/aui/active_caption_colour"), m_pArt->GetColour(wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR)));
266  XRCCTRL(*this, "btnAuiActiveCaptionGradientColour", wxButton)->SetBackgroundColour(cfg->ReadColour(_T("/environment/aui/active_caption_gradient_colour"), m_pArt->GetColour(wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR)));
267  XRCCTRL(*this, "btnAuiActiveCaptionTextColour", wxButton)->SetBackgroundColour(cfg->ReadColour(_T("/environment/aui/active_caption_text_colour"), m_pArt->GetColour(wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR)));
268  XRCCTRL(*this, "btnAuiInactiveCaptionColour", wxButton)->SetBackgroundColour(cfg->ReadColour(_T("/environment/aui/inactive_caption_colour"), m_pArt->GetColour(wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR)));
269  XRCCTRL(*this, "btnAuiInactiveCaptionGradientColour", wxButton)->SetBackgroundColour(cfg->ReadColour(_T("/environment/aui/inactive_caption_gradient_colour"), m_pArt->GetColour(wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR)));
270  XRCCTRL(*this, "btnAuiInactiveCaptionTextColour", wxButton)->SetBackgroundColour(cfg->ReadColour(_T("/environment/aui/inactive_caption_text_colour"), m_pArt->GetColour(wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR)));
271 
272  // tab "Dialogs"
273  wxCheckListBox* clb = XRCCTRL(*this, "chkDialogs", wxCheckListBox);
274  clb->Clear();
275 
276  m_AnnoyingDlgReturnMap[F(wxT("%d"), AnnoyingDialog::rtOK)] = _("OK");
277  m_AnnoyingDlgReturnMap[F(wxT("%d"), AnnoyingDialog::rtCANCEL)] = _("Cancel");
278  m_AnnoyingDlgReturnMap[F(wxT("%d"), AnnoyingDialog::rtYES)] = _("Yes");
279  m_AnnoyingDlgReturnMap[F(wxT("%d"), AnnoyingDialog::rtNO)] = _("No");
281  if (acfg->Exists(wxT("/disabled_ret")))
282  {
283  // new config style
284  dialogs = acfg->ReadSSet(wxT("/disabled_ret"));
285  }
286  else
287  {
288  // if the new config key does not exist, read from the old one
289  dialogs = acfg->ReadSSet(wxT("/disabled"));
290  // and copy it to the new one
291  acfg->Write(wxT("/disabled_ret"), dialogs);
292  // we do not do an in place upgrade of the format to maintain
293  // compatibility with previous versions
294  }
295  for (ConfigManagerContainer::StringSet::iterator i = dialogs.begin(); i != dialogs.end(); ++i)
296  clb->Append(AnnoyingDlgReturnToString(*i));
297 
298  // tab "Network"
299  XRCCTRL(*this, "txtProxy", wxTextCtrl)->SetValue(cfg->Read(_T("/network_proxy")));
300 
301  FillApplicationColours();
302 
303  // disable some windows-only settings, in other platforms
304 #ifndef __WXMSW__
305  XRCCTRL(*this, "chkAssociations", wxCheckBox)->Enable(false);
306  XRCCTRL(*this, "btnSetAssocs", wxButton)->Enable(false);
307  XRCCTRL(*this, "btnManageAssocs", wxButton)->Enable(false);
308 #endif
309 
310  // add all plugins configuration panels
311  AddPluginPanels();
312 
313  // make sure everything is laid out properly
314  GetSizer()->SetSizeHints(this);
315  CentreOnParent();
316  Layout();
317 }
318 
320 {
321  //dtor
322  delete m_pImageList;
323 }
324 
326 {
327  const wxString base = _T("images/settings/");
328  // for plugins who do not supply icons, use common generic icons
329  const wxString noimg = _T("images/settings/generic-plugin");
330 
331  wxListbook* lb = XRCCTRL(*this, "nbMain", wxListbook);
332  // get all configuration panels which are *not* about compiler and editor.
334 
335  for (size_t i = 0; i < m_PluginPanels.GetCount(); ++i)
336  {
338  panel->SetParentDialog(this);
339  lb->AddPage(panel, panel->GetTitle());
340 
341  wxString onFile = ConfigManager::LocateDataFile(base + panel->GetBitmapBaseName() + _T(".png"), sdDataGlobal | sdDataUser);
342  if (onFile.IsEmpty())
343  onFile = ConfigManager::LocateDataFile(noimg + _T(".png"), sdDataGlobal | sdDataUser);
344  wxString offFile = ConfigManager::LocateDataFile(base + panel->GetBitmapBaseName() + _T("-off.png"), sdDataGlobal | sdDataUser);
345  if (offFile.IsEmpty())
346  offFile = ConfigManager::LocateDataFile(noimg + _T("-off.png"), sdDataGlobal | sdDataUser);
347 
348  m_pImageList->Add(cbLoadBitmap(onFile));
349  m_pImageList->Add(cbLoadBitmap(offFile));
350  lb->SetPageImage(lb->GetPageCount() - 1, m_pImageList->GetImageCount() - 2);
351  }
353 }
354 
356 {
357  const wxString base = ConfigManager::GetDataFolder() + _T("/images/settings/");
358 
359  m_pImageList = new wxImageList(80, 80);
360  wxBitmap bmp;
361  for (int i = 0; i < IMAGES_COUNT; ++i)
362  {
363  bmp = cbLoadBitmap(base + base_imgs[i] + _T(".png"));
364  m_pImageList->Add(bmp);
365  bmp = cbLoadBitmap(base + base_imgs[i] + _T("-off.png"));
366  m_pImageList->Add(bmp);
367  }
368 }
369 
371 {
372  wxListbook* lb = XRCCTRL(*this, "nbMain", wxListbook);
373  int sel = lb->GetSelection();
374 
375  if (SettingsIconsStyle(XRCCTRL(*this, "rbSettingsIconsSize", wxRadioBox)->GetSelection()) == sisNoIcons)
376  {
378  lb->SetImageList(nullptr);
379  }
380  else
381  {
382  lb->SetImageList(m_pImageList);
383  // set page images according to their on/off status
384  for (size_t i = 0; i < IMAGES_COUNT + m_PluginPanels.GetCount(); ++i)
385  lb->SetPageImage(i, (i * 2) + (sel == (int)i ? 0 : 1));
387  }
388 
389  // update the page title
390  wxString label = lb->GetPageText(sel);
391  // replace any stray & with && because label makes it an underscore
392  while (label.Replace(_T(" & "), _T(" && ")))
393  ;
394  XRCCTRL(*this, "lblBigTitle", wxStaticText)->SetLabel(label);
395  XRCCTRL(*this, "pnlTitleInfo", wxPanel)->Layout();
396 }
397 
398 void EnvironmentSettingsDlg::OnPageChanging(cb_unused wxListbookEvent& event)
399 {
400 }
401 
402 void EnvironmentSettingsDlg::OnPageChanged(wxListbookEvent& event)
403 {
404  // update only on real change, not on dialog creation
405  if (event.GetOldSelection() != -1 && event.GetSelection() != -1)
407  Layout();
408 }
409 
411 {
412 #ifdef __WXMSW__
414  //cbMessageBox(_("Code::Blocks associated with C/C++ files."), _("Information"), wxICON_INFORMATION, this);
415 #endif
416 }
417 
419 {
420 #ifdef __WXMSW__
421  ManageAssocsDialog dlg(this);
422  PlaceWindow(&dlg);
423  dlg.ShowModal();
424 #endif
425 }
426 
428 {
429  wxColourData data;
430  wxWindow* sender = FindWindowById(event.GetId());
431  data.SetColour(sender->GetBackgroundColour());
432 
433  wxColourDialog dlg(this, &data);
434  PlaceWindow(&dlg);
435  if (dlg.ShowModal() == wxID_OK)
436  {
437  wxColour colour = dlg.GetColourData().GetColour();
438  sender->SetBackgroundColour(colour);
439  }
440 }
441 
443 {
444  wxAuiDockArt* art = new wxAuiDefaultDockArt;
445 
446  XRCCTRL(*this, "spnAuiBorder", wxSpinCtrl)->SetValue(art->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE));
447  XRCCTRL(*this, "spnAuiSash", wxSpinCtrl)->SetValue(art->GetMetric(wxAUI_DOCKART_SASH_SIZE));
448  XRCCTRL(*this, "spnAuiCaption", wxSpinCtrl)->SetValue(art->GetMetric(wxAUI_DOCKART_CAPTION_SIZE));
449  XRCCTRL(*this, "btnAuiActiveCaptionColour", wxButton)->SetBackgroundColour(art->GetColour(wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR));
450  XRCCTRL(*this, "btnAuiActiveCaptionGradientColour", wxButton)->SetBackgroundColour(art->GetColour(wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR));
451  XRCCTRL(*this, "btnAuiActiveCaptionTextColour", wxButton)->SetBackgroundColour(art->GetColour(wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR));
452  XRCCTRL(*this, "btnAuiInactiveCaptionColour", wxButton)->SetBackgroundColour(art->GetColour(wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR));
453  XRCCTRL(*this, "btnAuiInactiveCaptionGradientColour", wxButton)->SetBackgroundColour(art->GetColour(wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR));
454  XRCCTRL(*this, "btnAuiInactiveCaptionTextColour", wxButton)->SetBackgroundColour(art->GetColour(wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR));
455 
456  delete art;
457 }
458 
460 {
461  bool en = XRCCTRL(*this, "chkAutoHideMessages", wxCheckBox)->GetValue();
462  XRCCTRL(*this, "chkAutoShowMessagesOnSearch", wxCheckBox)->Enable(en);
463  XRCCTRL(*this, "chkAutoShowMessagesOnWarn", wxCheckBox)->Enable(en);
464  XRCCTRL(*this, "chkAutoShowMessagesOnErr", wxCheckBox)->Enable(en);
465 }
466 
468 {
469  XRCCTRL(*this, "chkRaiseViaIPC", wxCheckBox)->Enable(event.IsChecked());
470 }
471 
473 {
474  XRCCTRL(*this, "choLayoutToToggle", wxChoice)->Enable(event.IsChecked());
475 }
476 
478 {
479  wxString keys;
480 
482  keys += keys.IsEmpty()?wxT("Shift"):wxT("+Shift");
483 
485  keys += keys.IsEmpty()?wxT("Ctrl"):wxT("+Ctrl");
486 
487 #if defined(__WXMAC__) || defined(__WXCOCOA__)
489  keys += keys.IsEmpty()?wxT("XCtrl"):wxT("+XCtrl");
490 #endif
491 
492  if (wxGetKeyState(WXK_ALT))
493  keys += keys.IsEmpty()?wxT("Alt"):wxT("+Alt");
494 
495  if (!keys.IsEmpty())
496  XRCCTRL(*this, "txtMousewheelModifier", wxTextCtrl)->SetValue(keys);
497 }
498 
500 {
501  bool en = (bool)XRCCTRL(*this, "chkNBUseMousewheel",wxCheckBox)->GetValue();
502  XRCCTRL(*this, "rbNBModToAdvance", wxRadioButton)->Enable(en);
503  XRCCTRL(*this, "rbNBModToMove", wxRadioButton)->Enable(en);
504  XRCCTRL(*this, "chkNBInvertAdvance", wxCheckBox)->Enable(en);
505  XRCCTRL(*this, "chkNBInvertMove", wxCheckBox)->Enable(en);
506 }
507 
509 {
510  XRCCTRL(*this, "chkPlaceHead", wxCheckBox)->Enable(event.IsChecked());
511 }
512 
514 {
515  PlaceWindow(this, event.IsChecked() ? pdlHead : pdlCentre, true);
516 }
517 
519 {
520  XRCCTRL(*this, "cbxLanguage", wxComboBox)->Enable(event.IsChecked());
521 }
522 
524 {
526  Layout();
527 }
528 
530 {
531  if (retCode == wxID_OK)
532  {
533  ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("app"));
534  ConfigManager *pcfg = Manager::Get()->GetConfigManager(_T("project_manager"));
535  ConfigManager *mcfg = Manager::Get()->GetConfigManager(_T("message_manager"));
536  ConfigManager *acfg = Manager::Get()->GetConfigManager(_T("an_dlg"));
537 
538  // tab "General"
539  cfg->Write(_T("/environment/show_splash"), (bool) XRCCTRL(*this, "chkShowSplash", wxCheckBox)->GetValue());
540  cfg->Write(_T("/environment/single_instance"), (bool) XRCCTRL(*this, "chkSingleInstance", wxCheckBox)->GetValue());
541  cfg->Write(_T("/environment/use_ipc"), (bool) XRCCTRL(*this, "chkUseIPC", wxCheckBox)->GetValue());
542  cfg->Write(_T("/environment/raise_via_ipc"), (bool) XRCCTRL(*this, "chkRaiseViaIPC", wxCheckBox)->GetValue());
543  cfg->Write(_T("/environment/check_associations"), (bool) XRCCTRL(*this, "chkAssociations", wxCheckBox)->GetValue());
544  cfg->Write(_T("/environment/check_modified_files"), (bool) XRCCTRL(*this, "chkModifiedFiles", wxCheckBox)->GetValue());
545  cfg->Write(_T("/environment/ignore_invalid_targets"), (bool) XRCCTRL(*this, "chkInvalidTargets", wxCheckBox)->GetValue());
546  cfg->Write(_T("/console_shell"), XRCCTRL(*this, "txtConsoleShell", wxTextCtrl)->GetValue());
547  cfg->Write(_T("/console_terminal"), XRCCTRL(*this, "cbConsoleTerm", wxComboBox)->GetValue());
548  cfg->Write(_T("/open_containing_folder"), XRCCTRL(*this, "txtOpenFolder", wxTextCtrl)->GetValue());
549 
550  // tab "View"
551  cfg->Write(_T("/environment/blank_workspace"), (bool) XRCCTRL(*this, "rbAppStart", wxRadioBox)->GetSelection() ? true : false);
552  cfg->Write(_T("/environment/enable_project_layout"), (bool) XRCCTRL(*this, "chkProjectLayout", wxCheckBox)->GetValue());
553  cfg->Write(_T("/environment/enable_editor_layout"), (bool) XRCCTRL(*this, "chkEditorLayout", wxCheckBox)->GetValue());
554  pcfg->Write(_T("/open_files"), (int) XRCCTRL(*this, "rbProjectOpen", wxRadioBox)->GetSelection());
555  cfg->Write(_T("/environment/toolbar_size"), (bool) XRCCTRL(*this, "rbToolbarSize", wxRadioBox)->GetSelection() == 1);
556  cfg->Write(_T("/environment/settings_size"), (int) XRCCTRL(*this, "rbSettingsIconsSize", wxRadioBox)->GetSelection());
557  mcfg->Write(_T("/auto_hide"), (bool) XRCCTRL(*this, "chkAutoHideMessages", wxCheckBox)->GetValue());
558  mcfg->Write(_T("/auto_show_search"), (bool) XRCCTRL(*this, "chkAutoShowMessagesOnSearch", wxCheckBox)->GetValue());
559  mcfg->Write(_T("/auto_show_build_warnings"), (bool) XRCCTRL(*this, "chkAutoShowMessagesOnWarn", wxCheckBox)->GetValue());
560  mcfg->Write(_T("/auto_show_build_errors"), (bool) XRCCTRL(*this, "chkAutoShowMessagesOnErr", wxCheckBox)->GetValue());
561  mcfg->Write(_T("/auto_focus_build_errors"), (bool) XRCCTRL(*this, "chkAutoFocusMessagesOnErr", wxCheckBox)->GetValue());
562  mcfg->Write(_T("/save_selection_change_in_mp"), (bool) XRCCTRL(*this, "chkSaveSelectionChangeInMP", wxCheckBox)->GetValue());
563 
564  cfg->Write(_T("/environment/start_here_page"), (bool) XRCCTRL(*this, "chkShowStartPage", wxCheckBox)->GetValue());
565 
566  cfg->Write(_T("/environment/view/dbl_clk_maximize"), (bool)XRCCTRL(*this, "chkDblClkMaximizes", wxCheckBox)->GetValue());
567  cfg->Write(_T("/environment/view/layout_to_toggle"), XRCCTRL(*this, "choLayoutToToggle", wxChoice)->GetStringSelection());
568 
569  cfg->Write(_T("/locale/enable"), (bool) XRCCTRL(*this, "chkI18N", wxCheckBox)->GetValue());
570  const wxLanguageInfo *info = wxLocale::FindLanguageInfo(XRCCTRL(*this, "cbxLanguage", wxComboBox)->GetStringSelection());
571  if (info)
572  cfg->Write(_T("/locale/language"), info->CanonicalName);
573  else
574  cfg->Write(_T("/locale/language"), wxEmptyString);
575 
576  mcfg->Write(_T("/log_font_size"), (int) XRCCTRL(*this, "spnLogFontSize", wxSpinCtrl)->GetValue());
577 
578  cfg->Write(_T("/dialog_placement/do_place"), (bool) XRCCTRL(*this, "chkDoPlace", wxCheckBox)->GetValue());
579  cfg->Write(_T("/dialog_placement/dialog_position"), (int) XRCCTRL(*this, "chkPlaceHead", wxCheckBox)->GetValue() ? pdlHead : pdlCentre);
580 
581  // tab "Appearence"
582  cfg->Write(_T("/environment/tabs_style"), (int) XRCCTRL(*this, "cmbEditorTabs", wxChoice)->GetSelection());
583  cfg->Write(_T("/environment/tabs_closestyle"), (int) XRCCTRL(*this, "cmbTabCloseStyle", wxChoice)->GetSelection());
584  cfg->Write(_T("/environment/tabs_list"), (bool) XRCCTRL(*this, "chkListTabs", wxCheckBox)->GetValue());
585  bool tab_switcher_mode = (bool) XRCCTRL(*this, "chkStackedBasedTabSwitching", wxCheckBox)->GetValue();
586  if (Manager::Get()->GetConfigManager(_T("app"))->ReadBool(_T("/environment/tabs_stacked_based_switching")) != tab_switcher_mode)
587  {
588  if (tab_switcher_mode)
590  else
592  }
593  cfg->Write(_T("/environment/tabs_stacked_based_switching"), tab_switcher_mode);
594 
595  bool enableMousewheel = (bool) XRCCTRL(*this, "chkNBUseMousewheel",wxCheckBox)->GetValue();
596  cfg->Write(_T("/environment/tabs_use_mousewheel"), enableMousewheel);
597  wxString key = XRCCTRL(*this, "txtMousewheelModifier", wxTextCtrl)->GetValue();
598  cfg->Write(_T("/environment/tabs_mousewheel_modifier"), key.IsEmpty()?_T("Ctrl"):key);
599  cfg->Write(_T("/environment/tabs_mousewheel_advance"), (bool) XRCCTRL(*this, "rbNBModToAdvance", wxRadioButton)->GetValue());
600  cfg->Write(_T("/environment/tabs_invert_advance"), (bool) XRCCTRL(*this, "chkNBInvertAdvance", wxCheckBox)->GetValue());
601  cfg->Write(_T("/environment/tabs_invert_move"), (bool) XRCCTRL(*this, "chkNBInvertMove", wxCheckBox)->GetValue());
602  cbAuiNotebook::AllowScrolling(enableMousewheel);
603 
604  cbAuiNotebook::SetModKeys(cfg->Read(_T("/environment/tabs_mousewheel_modifier"),_T("Ctrl")));
605  cbAuiNotebook::UseModToAdvance(cfg->ReadBool(_T("/environment/tabs_mousewheel_advance"),false));
606  cbAuiNotebook::InvertAdvanceDirection(cfg->ReadBool(_T("/environment/tabs_invert_advance"),false));
607  cbAuiNotebook::InvertMoveDirection(cfg->ReadBool(_T("/environment/tabs_invert_move"),false));
608 
609  cfg->Write(_T("/environment/aui/border_size"), (int) XRCCTRL(*this, "spnAuiBorder", wxSpinCtrl)->GetValue());
610  cfg->Write(_T("/environment/aui/sash_size"), (int) XRCCTRL(*this, "spnAuiSash", wxSpinCtrl)->GetValue());
611  cfg->Write(_T("/environment/aui/caption_size"), (int) XRCCTRL(*this, "spnAuiCaption", wxSpinCtrl)->GetValue());
612  cfg->Write(_T("/environment/aui/active_caption_colour"), XRCCTRL(*this, "btnAuiActiveCaptionColour", wxButton)->GetBackgroundColour());
613  cfg->Write(_T("/environment/aui/active_caption_gradient_colour"), XRCCTRL(*this, "btnAuiActiveCaptionGradientColour", wxButton)->GetBackgroundColour());
614  cfg->Write(_T("/environment/aui/active_caption_text_colour"), XRCCTRL(*this, "btnAuiActiveCaptionTextColour", wxButton)->GetBackgroundColour());
615  cfg->Write(_T("/environment/aui/inactive_caption_colour"), XRCCTRL(*this, "btnAuiInactiveCaptionColour", wxButton)->GetBackgroundColour());
616  cfg->Write(_T("/environment/aui/inactive_caption_gradient_colour"), XRCCTRL(*this, "btnAuiInactiveCaptionGradientColour", wxButton)->GetBackgroundColour());
617  cfg->Write(_T("/environment/aui/inactive_caption_text_colour"), XRCCTRL(*this, "btnAuiInactiveCaptionTextColour", wxButton)->GetBackgroundColour());
618 
619  m_pArt->SetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE, XRCCTRL(*this, "spnAuiBorder", wxSpinCtrl)->GetValue());
620  m_pArt->SetMetric(wxAUI_DOCKART_SASH_SIZE, XRCCTRL(*this, "spnAuiSash", wxSpinCtrl)->GetValue());
621  m_pArt->SetMetric(wxAUI_DOCKART_CAPTION_SIZE, XRCCTRL(*this, "spnAuiCaption", wxSpinCtrl)->GetValue());
622  m_pArt->SetColour(wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR, XRCCTRL(*this, "btnAuiActiveCaptionColour", wxButton)->GetBackgroundColour());
623  m_pArt->SetColour(wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR, XRCCTRL(*this, "btnAuiActiveCaptionGradientColour", wxButton)->GetBackgroundColour());
624  m_pArt->SetColour(wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR, XRCCTRL(*this, "btnAuiActiveCaptionTextColour", wxButton)->GetBackgroundColour());
625  m_pArt->SetColour(wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR, XRCCTRL(*this, "btnAuiInactiveCaptionColour", wxButton)->GetBackgroundColour());
626  m_pArt->SetColour(wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR,XRCCTRL(*this, "btnAuiInactiveCaptionGradientColour", wxButton)->GetBackgroundColour());
627  m_pArt->SetColour(wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR, XRCCTRL(*this, "btnAuiInactiveCaptionTextColour", wxButton)->GetBackgroundColour());
628 
629  // tab "Dialogs"
630  wxCheckListBox* lb = XRCCTRL(*this, "chkDialogs", wxCheckListBox);
631 
632  ConfigManagerContainer::StringSet dialogs = acfg->ReadSSet(_T("/disabled_ret"));
633 
634  for (size_t i = 0; i < lb->GetCount(); ++i)
635  {
636  if (lb->IsChecked(i))
637  dialogs.erase(StringToAnnoyingDlgReturn(lb->GetString(i)));
638  }
639 
640  acfg->Write(_T("/disabled_ret"), dialogs);
641 
642  // tab "Network"
643  cfg->Write(_T("/network_proxy"), XRCCTRL(*this, "txtProxy", wxTextCtrl)->GetValue());
644 
646 
647  // finally, apply settings in all plugins' panels
648  for (size_t i = 0; i < m_PluginPanels.GetCount(); ++i)
649  {
651  panel->OnApply();
652  }
653 
654  // save the colours manager here, just in case there are duplicate colour controls
656  }
657  else
658  {
659  // finally, cancel settings in all plugins' panels
660  for (size_t i = 0; i < m_PluginPanels.GetCount(); ++i)
661  {
663  panel->OnCancel();
664  }
665  }
666 
668 }
669 
670 namespace
671 {
672 struct AppColoursClientData : wxClientData
673 {
674  AppColoursClientData(const wxString &id_) : id(id_) {}
675 
676  wxString id;
677 };
678 
679 } // anonymous namespace
680 
682 {
683  wxListBox *list = XRCCTRL(*this, "lstColours", wxListBox);
684  wxChoice *categories = XRCCTRL(*this, "chCategory", wxChoice);
685 
686  bool fillCategories = (categories->GetCount() == 0);
687  std::set<wxString> setCategories;
688 
689  wxString category = categories->GetStringSelection();
690  if (categories->GetSelection() == 0)
691  category = wxEmptyString;
692 
693  list->Clear();
695  for (ColourManager::ColourDefMap::const_iterator it = colours.begin(); it != colours.end(); ++it)
696  {
697  if (!it->second.IsValid())
698  continue;
699  if (category.empty())
700  list->Append(it->second.category + wxT(" : ") + it->second.name, new AppColoursClientData(it->first));
701  else if (category == it->second.category)
702  list->Append(it->second.name, new AppColoursClientData(it->first));
703  if (fillCategories)
704  setCategories.insert(it->second.category);
705  }
706 
707  if (fillCategories)
708  {
709  categories->Append(_("All"));
710  categories->Select(0);
711  for (std::set<wxString>::const_iterator it = setCategories.begin(); it != setCategories.end(); ++it)
712  categories->Append(*it);
713  }
714 
715  wxCommandEvent tempEvent;
716  OnChooseAppColourItem(tempEvent);
717 }
718 
720 {
722 }
723 
725 {
726  wxButton *btnColour = XRCCTRL(*this, "btnColour", wxButton);
727  wxButton *btnDefault = XRCCTRL(*this, "btnDefaultColour", wxButton);
728 
729  const AppColoursClientData *data = static_cast<AppColoursClientData*>(event.GetClientObject());
730  if (!data)
731  {
732  btnColour->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
733  btnDefault->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
734  btnColour->Enable(false);
735  btnDefault->Enable(false);
736  return;
737  }
738 
740  const ColourManager::ColourDefMap::const_iterator it = colours.find(data->id);
741  if (it != colours.end())
742  {
743  std::map<wxString, wxColour>::const_iterator colourIt = m_ChangedAppColours.find(data->id);
744  if (colourIt != m_ChangedAppColours.end())
745  btnColour->SetBackgroundColour(colourIt->second);
746  else
747  btnColour->SetBackgroundColour(it->second.value);
748 
749  btnDefault->SetBackgroundColour(it->second.defaultValue);
750  btnColour->Enable(true);
751  btnDefault->Enable(true);
752  }
753  else
754  {
755  btnColour->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
756  btnDefault->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
757  btnColour->Enable(false);
758  btnDefault->Enable(false);
759  }
760 }
761 
763 {
764  wxListBox *list = XRCCTRL(*this, "lstColours", wxListBox);
765  if (list->GetSelection() == wxNOT_FOUND)
766  return;
767  const AppColoursClientData *data;
768  data = static_cast<AppColoursClientData*>(list->GetClientObject(list->GetSelection()));
769  if (!data)
770  return;
771 
773  const ColourManager::ColourDefMap::const_iterator it = colours.find(data->id);
774  if (it == colours.end())
775  return;
776  wxColour oldColour = it->second.value;
777  std::map<wxString, wxColour>::iterator changedIt = m_ChangedAppColours.find(data->id);
778  if (changedIt != m_ChangedAppColours.end())
779  oldColour = changedIt->second;
780 
781  wxButton *btnColour = XRCCTRL(*this, "btnColour", wxButton);
782 
783  if (event.GetId() == XRCID("btnColour"))
784  {
785  wxColourData colour;
786  colour.SetColour(oldColour);
787  wxColourDialog dlg(this, &colour);
788  if (dlg.ShowModal() == wxID_OK)
789  {
790  m_ChangedAppColours[data->id] = dlg.GetColourData().GetColour();
791  btnColour->SetBackgroundColour(dlg.GetColourData().GetColour());
792  }
793  }
794  else if (event.GetId() == XRCID("btnDefaultColour"))
795  {
796  m_ChangedAppColours[data->id] = it->second.defaultValue;
797  btnColour->SetBackgroundColour(it->second.defaultValue);
798  }
799 }
800 
802 {
803  if (m_ChangedAppColours.empty())
804  return;
805 
807  for (std::map<wxString, wxColour>::const_iterator it = m_ChangedAppColours.begin();
808  it != m_ChangedAppColours.end();
809  ++it)
810  {
811  manager->SetColour(it->first, it->second);
812  }
813 }
814 
815 /*
816  AnnoyingDialog captions are in the form of
817  "Question xyz?:4"
818  where '4' corresponds to an AnnoyingDialog::dReturnType enum value
819  The following two methods translate to and from the human readable form of
820  "Question xyz?:Yes
821  */
822 
824 {
825  std::map<wxString, wxString>::const_iterator it = m_AnnoyingDlgReturnMap.find(caption.AfterLast(wxT(':')));
826  if (it != m_AnnoyingDlgReturnMap.end())
827  return caption.BeforeLast(wxT(':')) + wxT(':') + it->second;
828  return caption;
829 }
830 
832 {
833  for (std::map<wxString, wxString>::const_iterator it = m_AnnoyingDlgReturnMap.begin();
834  it != m_AnnoyingDlgReturnMap.end(); ++it)
835  {
836  if (caption.AfterLast(wxT(':')) == it->second)
837  return caption.BeforeLast(wxT(':')) + wxT(':') + it->first;
838  }
839  return caption;
840 }
wxString AfterLast(wxUniChar ch) const
wxString F(const wxChar *msg,...)
sprintf-like function
Definition: logmanager.h:20
void OnPageChanged(wxListbookEvent &event)
void EndModal(int retCode)
Definition: sc_dialog.cpp:112
virtual bool AddPage(wxWindow *page, const wxString &text, bool select=false, int imageId=NO_IMAGE)
void OnResetDefaultColours(wxCommandEvent &event)
PluginManager * GetPluginManager() const
Definition: manager.cpp:444
virtual bool SetPageImage(size_t page, int image)=0
virtual int GetSelection() const=0
Data folder in user&#39;s dir.
Definition: configmanager.h:75
Large icons (default)
Definition: globals.h:299
ConfigurationPanelsArray m_PluginPanels
ConfigManager * GetConfigManager(const wxString &name_space) const
Definition: manager.cpp:474
int ReadInt(const wxString &name, int defaultVal=0)
void OnSettingsIconsSize(wxCommandEvent &event)
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
SettingsIconsStyle
Icons styles for settings dialogs.
Definition: globals.h:297
bool IsOpened() const
virtual void SetColour(int id, const wxColour &colour)=0
DLLIMPORT const wxString DEFAULT_CONSOLE_TERM
Definition: globals.cpp:59
DLLIMPORT const wxString cbDEFAULT_OPEN_FOLDER_CMD
Definition: globals.cpp:66
void OnPageChanging(wxListbookEvent &event)
virtual int GetSelection() const
virtual wxString GetString(unsigned int n) const
bool GetFirst(wxString *filename, const wxString &filespec=wxEmptyString, int flags=wxDIR_DEFAULT) const
DLLIMPORT wxBitmap cbLoadBitmap(const wxString &filename, wxBitmapType bitmapType=wxBITMAP_TYPE_PNG)
This function loads a bitmap from disk.
Definition: globals.cpp:1102
void GetConfigurationPanels(int group, wxWindow *parent, ConfigurationPanelsArray &arrayToFill)
wxColour & GetColour()
void RebuildNotebookStack()
bool ReadBool(const wxString &name, bool defaultVal=false)
static const int cgCompiler
Compiler related.
Definition: cbplugin.h:68
virtual wxString GetTitle() const =0
wxColour ReadColour(const wxString &name, const wxColour &defaultVal= *wxBLACK)
void OnManageAssocs(wxCommandEvent &event)
bool wxDirExists(const wxString &dirname)
virtual size_t GetPageCount() const
virtual void OnApply()=0
Called when the user chooses to apply the configuration.
#define _T(string)
void OnClickAppColour(wxCommandEvent &event)
virtual void OnCancel()=0
Called when the user chooses to cancel the configuration.
wxString BeforeLast(wxUniChar ch, wxString *rest=NULL) const
void OnDblClickMaximizes(wxCommandEvent &event)
wxString AnnoyingDlgReturnToString(const wxString &caption)
std::map< wxString, wxColour > m_ChangedAppColours
static const int cgEditor
Editor related.
Definition: cbplugin.h:69
bool IsChecked(unsigned int item) const
virtual unsigned int GetCount() const
#define wxT(string)
virtual void SetMetric(int id, int new_val)=0
void OnAutoHide(wxCommandEvent &event)
#define wxNOT_FOUND
bool empty() const
static const wxLanguageInfo * FindLanguageInfo(const wxString &locale)
static wxString LocateDataFile(const wxString &filename, int search_dirs=sdAllKnown)
Locate a file in an installation- and platform-independent way.
EditorManager * GetEditorManager() const
Definition: manager.cpp:434
No icons, just text.
Definition: globals.h:300
wxString CanonicalName
void OnSetAssocs(wxCommandEvent &event)
void Write(const wxString &name, const wxString &value, bool ignoreEmpty=false)
virtual int GetImageCount() const
const wxString base_imgs[]
DLLIMPORT const wxString DEFAULT_CONSOLE_SHELL
Definition: globals.cpp:63
bool Exists(const wxString &name)
wxFrame * GetAppFrame() const
Definition: manager.cpp:419
virtual void EndModal(int retCode)
virtual wxColour GetColour(int id)=0
void OnHeadCheck(wxCommandEvent &event)
static void InvertMoveDirection(bool invert=false)
Change direction of tab-moving with mousewheel.
Definition: cbauibook.cpp:1134
virtual int ShowModal()
std::map< wxString, wxString > m_AnnoyingDlgReturnMap
static wxColour GetColour(wxSystemColour index)
wxString Read(const wxString &key, const wxString &defaultVal=wxEmptyString)
void OnChooseAppColourCategory(wxCommandEvent &event)
virtual int ShowModal()
static void UseModToAdvance(bool use=false)
Use modkey to advance through tabs with mousewheel.
Definition: cbauibook.cpp:1124
void OnChooseColour(wxCommandEvent &event)
wxString wxEmptyString
std::set< wxString > StringSet
Definition: configmanager.h:56
const wxString & _(const wxString &string)
Base class for plugin configuration panels.
void OnMousewheelModifier(wxKeyEvent &event)
wxEventType wxEVT_KEY_DOWN
virtual int GetMetric(int id)=0
void OnPlaceCheck(wxCommandEvent &event)
virtual wxString GetBitmapBaseName() const =0
static void AllowScrolling(bool allow=true)
Enable or disable tab-scrolling with mousewheel.
Definition: cbauibook.cpp:1109
static wxString GetDataFolder(bool global=true)
ColourManager * GetColourManager() const
Definition: manager.cpp:489
static void SetModKeys(wxString keys=_T("Strg"))
Sets the modifier keys for scrolling.
Definition: cbauibook.cpp:1119
virtual int FindItem(const wxString &itemString) const
bool GetNext(wxString *filename) const
bool IsEmpty() const
DLLIMPORT void PlaceWindow(wxTopLevelWindow *w, cbPlaceDialogMode mode=pdlBest, bool enforce=false)
Definition: globals.cpp:1177
const ColourDefMap & GetColourDefinitions() const
void OnChooseAppColourItem(wxCommandEvent &event)
wxString Description
void OnUseTabMousewheel(wxCommandEvent &event)
DLLIMPORT void SetSettingsIconsStyle(wxListCtrl *lc, SettingsIconsStyle style)
Set the icons style for the supplied list control.
Definition: globals.cpp:1125
wxString StringToAnnoyingDlgReturn(const wxString &caption)
std::map< wxString, ColourDef > ColourDefMap
int Add(const wxBitmap &bitmap, const wxBitmap &mask=wxNullBitmap)
virtual wxString GetPageText(size_t nPage) const=0
void OnI18NCheck(wxCommandEvent &event)
void SetColour(const wxString &id, const wxColour &colour)
static wxXmlResource * Get()
ConfigManagerContainer::StringSet ReadSSet(const wxString &name)
Data folder in base dir.
Definition: configmanager.h:81
wxColourData & GetColourData()
const int IMAGES_COUNT
wxMenuItemList & GetMenuItems()
void SetColour(const wxColour &colour)
void DeleteNotebookStack()
void SetParentDialog(wxWindow *dialog)
Sets the panel&#39;s parent dialog.
wxListView * GetListView() const
bool wxGetKeyState(wxKeyCode key)
wxObject * LoadObject(wxWindow *parent, const wxString &name, const wxString &classname)
virtual unsigned int GetCount() const
static void InvertAdvanceDirection(bool invert=false)
Change direction of tab-advancing with mousewheel.
Definition: cbauibook.cpp:1129
void OnUseIpcCheck(wxCommandEvent &event)