本文整理汇总了C++中ConfigManager::ReadBool方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigManager::ReadBool方法的具体用法?C++ ConfigManager::ReadBool怎么用?C++ ConfigManager::ReadBool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigManager
的用法示例。
在下文中一共展示了ConfigManager::ReadBool方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdatePreview
bool ThreadSearchView::UpdatePreview(const wxString& file, long line)
{
bool success(true);
if ( line > 0 )
{
// Line display begins at 1 but line index at 0
line--;
}
// Disable read only
m_pSearchPreview->Enable(false);
m_pSearchPreview->SetReadOnly(false);
// Loads file if different from current loaded
wxFileName filename(file);
if ( (m_PreviewFilePath != file) || (m_PreviewFileDate != filename.GetModificationTime()) )
{
ConfigManager* mgr = Manager::Get()->GetConfigManager(_T("editor"));
// Remember current file path and modification time
m_PreviewFilePath = file;
m_PreviewFileDate = filename.GetModificationTime();
EncodingDetector enc(m_PreviewFilePath, false);
success = enc.IsOK();
m_pSearchPreview->SetText(enc.GetWxStr());
// Colorize
cbEditor::ApplyStyles(m_pSearchPreview);
EditorColourSet EdColSet;
EdColSet.Apply(EdColSet.GetLanguageForFilename(m_PreviewFilePath), m_pSearchPreview, false,
true);
SetFoldingIndicator(mgr->ReadInt(_T("/folding/indicator"), 2));
UnderlineFoldedLines(mgr->ReadBool(_T("/folding/underline_folded_line"), true));
}
if ( success == true )
{
// Display the selected line
int onScreen = m_pSearchPreview->LinesOnScreen() >> 1;
m_pSearchPreview->GotoLine(line - onScreen);
m_pSearchPreview->GotoLine(line + onScreen);
m_pSearchPreview->GotoLine(line);
m_pSearchPreview->EnsureVisible(line);
int startPos = m_pSearchPreview->PositionFromLine(line);
int endPos = m_pSearchPreview->GetLineEndPosition(line);
m_pSearchPreview->SetSelectionVoid(endPos, startPos);
}
示例2: LoadSettings
void AutosaveConfigDlg::LoadSettings()
{
ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("autosave"));
bool doProjects = cfg->ReadBool(_T("do_project"));
bool doSources = cfg->ReadBool(_T("do_sources"));
XRCCTRL(*this, "do_project", wxCheckBox)->SetValue(doProjects);
XRCCTRL(*this, "do_sources", wxCheckBox)->SetValue(doSources);
XRCCTRL(*this, "do_workspace", wxCheckBox)->SetValue(cfg->ReadBool(_T("do_workspace"), true));
XRCCTRL(*this, "all_projects", wxCheckBox)->SetValue(cfg->ReadBool(_T("all_projects"), true));
int minsProjects = std::max(cfg->ReadInt(_T("project_mins"), 1), 1);
int minsSources = std::max(cfg->ReadInt(_T("source_mins"), 1), 1);
XRCCTRL(*this, "project_mins", wxTextCtrl)->SetValue(wxString::Format(_T("%d"), minsProjects));
XRCCTRL(*this, "source_mins", wxTextCtrl)->SetValue(wxString::Format(_T("%d"), minsSources));
XRCCTRL(*this, "do_workspace", wxCheckBox)->Enable(doProjects);
XRCCTRL(*this, "all_projects", wxCheckBox)->Enable(doProjects);
XRCCTRL(*this, "project_mins", wxTextCtrl)->Enable(doProjects);
XRCCTRL(*this, "source_mins", wxTextCtrl)->Enable(doSources);
XRCCTRL(*this, "method", wxChoice)->SetSelection(cfg->ReadInt(_T("method"), 2));
}
示例3: dummyBtn
SearchInPanel::SearchInPanel(wxWindow* parent, int id, const wxPoint& pos, const wxSize& size, long WXUNUSED(style)):
wxPanel(parent, id, pos, size, wxTAB_TRAVERSAL)
{
//{ Getting the imagesize for the buttons (16x16 or 22x22) and the appropriate path
ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("app"));
bool toolbar_size = cfg->ReadBool(_T("/environment/toolbar_size"),true);
wxString prefix = ConfigManager::GetDataFolder() + _T("/images/ThreadSearch/") + (toolbar_size?_T("16x16/"):_T("22x22/"));
// create a dummy button to get the standard button-size,
// wxCustomButton does not do that properly
// we have to force this size as MinSize to make it work
wxBitmapButton dummyBtn(this, wxID_ANY, wxBitmap(prefix + wxT("openfiles.png"), wxBITMAP_TYPE_PNG));
wxSize dummySize = dummyBtn.GetSize();
m_pBtnSearchOpenFiles = new wxCustomButton(this, controlIDs.Get(ControlIDs::idBtnSearchOpenFiles),
wxBitmap(prefix + wxT("openfiles.png"), wxBITMAP_TYPE_PNG),
wxDefaultPosition, dummySize);
m_pBtnSearchOpenFiles->SetBitmapDisabled(wxBitmap(prefix + wxT("openfilesdisabled.png"), wxBITMAP_TYPE_PNG));
m_pBtnSearchOpenFiles->SetBitmapSelected(wxBitmap(prefix + wxT("openfilesselected.png"), wxBITMAP_TYPE_PNG));
m_pBtnSearchOpenFiles->SetMinSize(dummySize);
m_pBtnSearchTargetFiles = new wxCustomButton(this, controlIDs.Get(ControlIDs::idBtnSearchTargetFiles),
wxBitmap(prefix + wxT("target.png"), wxBITMAP_TYPE_PNG),
wxDefaultPosition, dummySize);
m_pBtnSearchTargetFiles->SetBitmapDisabled(wxBitmap(prefix + wxT("targetdisabled.png"), wxBITMAP_TYPE_PNG));
m_pBtnSearchTargetFiles->SetBitmapSelected(wxBitmap(prefix + wxT("targetselected.png"), wxBITMAP_TYPE_PNG));
m_pBtnSearchTargetFiles->SetMinSize(dummySize);
m_pBtnSearchProjectFiles = new wxCustomButton(this, controlIDs.Get(ControlIDs::idBtnSearchProjectFiles),
wxBitmap(prefix + wxT("project.png"), wxBITMAP_TYPE_PNG),
wxDefaultPosition, dummySize);
m_pBtnSearchProjectFiles->SetBitmapDisabled(wxBitmap(prefix + wxT("projectdisabled.png"), wxBITMAP_TYPE_PNG));
m_pBtnSearchProjectFiles->SetBitmapSelected(wxBitmap(prefix + wxT("projectselected.png"), wxBITMAP_TYPE_PNG));
m_pBtnSearchProjectFiles->SetMinSize(dummySize);
m_pBtnSearchWorkspaceFiles = new wxCustomButton(this, controlIDs.Get(ControlIDs::idBtnSearchWorkspaceFiles),
wxBitmap(prefix + wxT("workspace.png"), wxBITMAP_TYPE_PNG),
wxDefaultPosition, dummySize);
m_pBtnSearchWorkspaceFiles->SetBitmapDisabled(wxBitmap(prefix + wxT("workspacedisabled.png"), wxBITMAP_TYPE_PNG));
m_pBtnSearchWorkspaceFiles->SetBitmapSelected(wxBitmap(prefix + wxT("workspaceselected.png"), wxBITMAP_TYPE_PNG));
m_pBtnSearchWorkspaceFiles->SetMinSize(dummySize);
m_pBtnSearchDir = new wxCustomButton(this, controlIDs.Get(ControlIDs::idBtnSearchDirectoryFiles),
wxBitmap(prefix + wxT("folder.png"), wxBITMAP_TYPE_PNG),
wxDefaultPosition, dummySize);
m_pBtnSearchDir->SetBitmapDisabled(wxBitmap(prefix + wxT("folderdisabled.png"), wxBITMAP_TYPE_PNG));
m_pBtnSearchDir->SetBitmapSelected(wxBitmap(prefix + wxT("folderselected.png"), wxBITMAP_TYPE_PNG));
m_pBtnSearchDir->SetMinSize(dummySize);
set_properties();
do_layout();
// end wxGlade
}
示例4: SaveSettings
void ReopenEditorConfDLg::SaveSettings()
{
ReopenEditor* plugin = (ReopenEditor*)Manager::Get()->GetPluginManager()->FindPluginByName(_T("ReopenEditor"));
ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("editor"));
bool wasManaged = cfg->ReadBool(_T("/reopen_editor/managed"),true);
bool isManaged = XRCCTRL(*this, "rbReopenDockOrNot", wxRadioBox)->GetSelection() == 1;
if(wasManaged != isManaged)
{
cfg->Write(_T("/reopen_editor/managed"),isManaged);
plugin->SetManaged(isManaged);
plugin->ShowList();
}
}
示例5: PlaceWindow
void PlaceWindow(wxTopLevelWindow *w, cbPlaceDialogMode mode, bool enforce)
// TODO (thomas#1#): The non-Windows implementation is *pathetic*.
// However, I don't know how to do it well under GTK / X / Xinerama / whatever.
// Anyone?
{
int the_mode;
wxWindow* referenceWindow = Manager::Get()->GetAppWindow();
if(!referenceWindow) // let's not crash on shutdown
return;
if(!w)
cbThrow(_T("Passed NULL pointer to PlaceWindow."));
ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("app"));
if(!enforce && cfg->ReadBool(_T("/dialog_placement/do_place")) == false)
return;
if(mode == pdlBest)
the_mode = cfg->ReadInt(_T("/dialog_placement/dialog_position"), (int) pdlCentre);
else
the_mode = (int) mode;
if(the_mode == pdlCentre || the_mode == pdlHead)
{
w->CentreOnScreen();
return;
}
else
{
wxRect windowRect = w->GetRect();
wxRect parentRect = referenceWindow->GetRect(); // poo again!
int x1 = windowRect.x;
int x2 = windowRect.x + windowRect.width;
int y1 = windowRect.y;
int y2 = windowRect.y + windowRect.height;
x1 = std::max(x1, parentRect.x);
x2 = std::min(x2, parentRect.GetRight());
y1 = std::max(y1, parentRect.y);
y2 = std::min(y2, parentRect.GetBottom());
w->SetSize(x1, y1, x2-x1, y2-y1, wxSIZE_ALLOW_MINUS_ONE);
}
}
示例6: InitLocale
void CodeBlocksApp::InitLocale()
{
ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("app"));
wxString path(ConfigManager::GetDataFolder() + _T("/locale"));
if (cfg->ReadBool(_T("/locale/enable"), false) == false)
return;
wxString lang(cfg->Read(_T("/locale/language")));
wxLocale::AddCatalogLookupPathPrefix(path);
const wxLanguageInfo *info;
if (!lang.IsEmpty()) // Note: You can also write this line of code as !(!lang) from wx-2.9 onwards
info = wxLocale::FindLanguageInfo(lang);
else
info = wxLocale::GetLanguageInfo(wxLANGUAGE_DEFAULT);
if (info == nullptr) // should never happen, but who knows...
return;
m_locale.Init(info->Language);
path.Alloc(path.length() + 10);
path.Append(_T('/'));
path.Append(info->CanonicalName);
if ( !wxDirExists(path) )
return;
wxDir dir(path);
if (!dir.IsOpened())
return;
wxString moName;
if (dir.GetFirst(&moName, _T("*.mo"), wxDIR_FILES))
{
do
{
m_locale.AddCatalog(moName);
} while (dir.GetNext(&moName));
}
}
示例7: BuildToolBar
bool ThreadSearch::BuildToolBar(wxToolBar* toolBar)
{
if ( !IsAttached() || !toolBar )
return false;
m_pToolbar = toolBar;
m_pThreadSearchView->SetToolBar(toolBar);
const wxString &prefix = m_pThreadSearchView->GetImagePrefix();
ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("app"));
if (cfg->ReadBool(_T("/environment/toolbar_size"),true))
m_pToolbar->SetToolBitmapSize(wxSize(16,16));
else
m_pToolbar->SetToolBitmapSize(wxSize(22,22));
m_pCboSearchExpr = new wxComboBox(toolBar, controlIDs.Get(ControlIDs::idCboSearchExpr),
wxEmptyString, wxDefaultPosition, wxSize(130, -1), 0, NULL, wxCB_DROPDOWN);
m_pCboSearchExpr->SetToolTip(_("Text to search"));
toolBar->AddControl(m_pCboSearchExpr);
toolBar->AddTool(controlIDs.Get(ControlIDs::idBtnSearch), _(""),
wxBitmap(prefix + wxT("findf.png"), wxBITMAP_TYPE_PNG),
wxBitmap(prefix + wxT("findfdisabled.png"), wxBITMAP_TYPE_PNG),
wxITEM_NORMAL, _("Run search"));
toolBar->AddTool(controlIDs.Get(ControlIDs::idBtnOptions), _(""),
wxBitmap(prefix + wxT("options.png"), wxBITMAP_TYPE_PNG),
wxBitmap(prefix + wxT("optionsdisabled.png"), wxBITMAP_TYPE_PNG),
wxITEM_NORMAL, _("Show options window"));
m_pThreadSearchView->UpdateOptionsButtonImage(m_FindData);
m_pCboSearchExpr->Append(m_pThreadSearchView->GetSearchHistory());
if ( m_pCboSearchExpr->GetCount() > 0 )
{
m_pCboSearchExpr->SetSelection(0);
}
toolBar->Realize();
#if wxCHECK_VERSION(2, 8, 0)
toolBar->SetInitialSize();
#else
toolBar->SetBestFittingSize();
#endif
return true;
}
示例8: ReadOptions
void ParserBase::ReadOptions()
{
ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("code_completion"));
// one-time default settings change: upgrade everyone
bool force_all_on = !cfg->ReadBool(_T("/parser_defaults_changed"), false);
if (force_all_on)
{
cfg->Write(_T("/parser_defaults_changed"), true);
cfg->Write(_T("/parser_follow_local_includes"), true);
cfg->Write(_T("/parser_follow_global_includes"), true);
cfg->Write(_T("/want_preprocessor"), true);
cfg->Write(_T("/parse_complex_macros"), true);
}
// Page "Code Completion"
m_Options.useSmartSense = cfg->ReadBool(_T("/use_SmartSense"), true);
m_Options.whileTyping = cfg->ReadBool(_T("/while_typing"), true);
m_Options.caseSensitive = cfg->ReadBool(_T("/case_sensitive"), false);
// Page "C / C++ parser"
m_Options.followLocalIncludes = cfg->ReadBool(_T("/parser_follow_local_includes"), true);
m_Options.followGlobalIncludes = cfg->ReadBool(_T("/parser_follow_global_includes"), true);
m_Options.wantPreprocessor = cfg->ReadBool(_T("/want_preprocessor"), true);
m_Options.parseComplexMacros = cfg->ReadBool(_T("/parse_complex_macros"), true);
// Page "Symbol browser"
m_BrowserOptions.showInheritance = cfg->ReadBool(_T("/browser_show_inheritance"), false);
m_BrowserOptions.expandNS = cfg->ReadBool(_T("/browser_expand_ns"), false);
m_BrowserOptions.treeMembers = cfg->ReadBool(_T("/browser_tree_members"), true);
// Token tree
m_BrowserOptions.displayFilter = (BrowserDisplayFilter)cfg->ReadInt(_T("/browser_display_filter"), bdfFile);
m_BrowserOptions.sortType = (BrowserSortType)cfg->ReadInt(_T("/browser_sort_type"), bstKind);
// Page "Documentation:
m_Options.storeDocumentation = cfg->ReadBool(_T("/use_documentation_helper"), false);
// force e-read of file types
ParserCommon::EFileType ft_dummy = ParserCommon::FileType(wxEmptyString, true);
wxUnusedVar(ft_dummy);
}
示例9: OnAttach
void EditorTweaks::OnAttach()
{
// do whatever initialization you need for your plugin
// NOTE: after this function, the inherited member variable
// m_IsAttached will be TRUE...
// You should check for it in other functions, because if it
// is FALSE, it means that the application did *not* "load"
// (see: does not need) this plugin...
Manager* pm = Manager::Get();
pm->RegisterEventSink(cbEVT_EDITOR_OPEN, new cbEventFunctor<EditorTweaks, CodeBlocksEvent>(this, &EditorTweaks::OnEditorOpen));
m_tweakmenu=NULL;
EditorManager* em = Manager::Get()->GetEditorManager();
for (int i=0;i<em->GetEditorsCount();i++)
{
cbEditor* ed=em->GetBuiltinEditor(i);
if (ed && ed->GetControl())
{
ed->GetControl()->SetOvertype(false);
ed->GetControl()->Connect(wxEVT_KEY_DOWN,(wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction)&EditorTweaks::OnKeyPress,NULL,this);
ed->GetControl()->Connect(wxEVT_CHAR,(wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction)&EditorTweaks::OnChar,NULL,this);
}
}
AlignerMenuEntry e;
ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("EditorTweaks"));
for (int i = 0 ; i < cfg->ReadInt(_T("/aligner/saved_entries"),defaultStoredAlignerEntries) ; ++i)
{
e.MenuName = cfg->Read(wxString::Format(_T("/aligner/first_name_%d"),i),defaultNames[i]);
e.ArgumentString = cfg->Read(wxString::Format(_T("/aligner/first_argument_string_%d"),i) ,defaultStrings[i]);
e.UsageCount = 0;
e.id = wxNewId();
AlignerMenuEntries.push_back(e);
Connect(e.id, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(EditorTweaks::OnAlign) );
}
m_suppress_insert = cfg->ReadBool(wxT("/suppress_insert_key"), false);
m_convert_braces = cfg->ReadBool(wxT("/convert_braces"), false);
m_buffer_caret = -1;
}
示例10: EnvVarsDebugLog
void nsEnvVars::EnvVarsDebugLog(const wxChar* msg, ...)
{
// load and apply configuration (to application only)
ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("envvars"));
if (!cfg)
return;
// get whether to print debug message to debug log or not
bool debug_log = cfg->ReadBool(_T("/debug_log"));
if (!debug_log)
return;
wxString log_msg;
va_list arg_list;
va_start(arg_list, msg);
log_msg = wxString::FormatV(msg, arg_list);
va_end(arg_list);
Manager::Get()->GetLogManager()->DebugLog(log_msg);
}// EnvVarsDebugLog
示例11: highlightColour
MiniStyledTextCtrl::MiniStyledTextCtrl(wxWindow* pParent, int id, const wxPoint& pos, const wxSize& size, long style):
cbStyledTextCtrl(pParent, id, pos, size, style)
{
Init();
ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("editor"));
if (cfg->ReadBool(_T("/highlight_occurrence/enabled"), true))
{
const int theIndicator = 10;
wxColour highlightColour(Manager::Get()->GetColourManager()->GetColour(wxT("editor_highlight_occurrence")));
IndicatorSetStyle(theIndicator, wxSCI_INDIC_HIGHLIGHT);
IndicatorSetForeground(theIndicator, highlightColour );
#ifndef wxHAVE_RAW_BITMAP
IndicatorSetUnder(theIndicator,true);
#endif
}
const int thePermIndicator = 12;
IndicatorSetStyle(thePermIndicator, wxSCI_INDIC_HIGHLIGHT);
IndicatorSetForeground(thePermIndicator, wxColour(Manager::Get()->GetColourManager()->GetColour(wxT("editor_highlight_occurrence_permanently"))) );
#ifndef wxHAVE_RAW_BITMAP
IndicatorSetUnder(thePermIndicator,true);
#endif
const int theFindFoudIndicator = 21;
IndicatorSetStyle(theFindFoudIndicator, wxSCI_INDIC_HIGHLIGHT);
IndicatorSetForeground(theFindFoudIndicator, wxColour(cfg->ReadColour(_T("/incremental_search/text_found_colour"), wxColour(160, 32, 240))) );
#ifndef wxHAVE_RAW_BITMAP
IndicatorSetUnder(theFindFoudIndicator,true);
#endif
const int theFindHighlightIndicator = 22;
IndicatorSetStyle(theFindHighlightIndicator, wxSCI_INDIC_HIGHLIGHT);
IndicatorSetForeground(theFindHighlightIndicator, wxColour(cfg->ReadColour(_T("/incremental_search/highlight_colour"), wxColour(255, 165, 0))) );
#ifndef wxHAVE_RAW_BITMAP
IndicatorSetUnder(theFindHighlightIndicator,true);
#endif
}
示例12: SetMarker
void MiniStyledTextCtrl::SetMarker()
{
ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("editor"));
bool inverse = cfg->ReadBool(_T("/mini_doc/inverse_designator"), false);
Freeze();
wxColor color = Manager::Get()->GetColourManager()->GetColour(wxT("minidoc_background"));
MarkerDeleteAll(GetOurMarkerNumber());
MarkerSetBackground(GetOurMarkerNumber(), color);
if (inverse)
{
for (int l = visibleFrom; l < visibleFrom+visibleLength ; ++l)
MarkerAdd(l, GetOurMarkerNumber());
}
else
{
for (int l = 0; l < visibleFrom ; ++l)
MarkerAdd(l, GetOurMarkerNumber());
for (int l = visibleFrom+visibleLength; l < GetLineCount() ; ++l)
MarkerAdd(l, GetOurMarkerNumber());
}
Thaw();
}
示例13: GetFlag
bool cbDebuggerCommonConfig::GetFlag(Flags flag)
{
ConfigManager *c = Manager::Get()->GetConfigManager(wxT("debugger_common"));
switch (flag)
{
case AutoBuild:
return c->ReadBool(wxT("/common/auto_build"), true);
case AutoSwitchFrame:
return c->ReadBool(wxT("/common/auto_switch_frame"), true);
case ShowDebuggersLog:
return c->ReadBool(wxT("/common/debug_log"), false);
case JumpOnDoubleClick:
return c->ReadBool(wxT("/common/jump_on_double_click"), false);
case RequireCtrlForTooltips:
return c->ReadBool(wxT("/common/require_ctrl_for_tooltips"), false);
case ShowTemporaryBreakpoints:
return c->ReadBool(wxT("/common/show_temporary_breakpoints"), false);
default:
return false;
}
}
示例14: LoadSettings
void Execution::LoadSettings()
{
ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("HeaderFixup"));
if (!cfg)
return;
if (m_Scope)
m_Scope->SetSelection(cfg->ReadInt(_T("/scope"), 0));
if (m_Options)
m_Options->SetSelection(cfg->ReadInt(_T("/options"), 1));
if (m_Ignore)
m_Ignore->SetValue(cfg->ReadBool(_T("/ignore")));
if (m_FwdDecl)
m_FwdDecl->SetValue(cfg->ReadBool(_T("/fwd_decl")));
if (m_ObsoleteLog)
m_ObsoleteLog->SetValue(cfg->ReadBool(_T("/obsolete_log")));
if (m_FileType)
m_FileType->SetSelection(cfg->ReadInt(_T("/file_type"), 2));
if (m_Protocol)
m_Protocol->SetValue(cfg->ReadBool(_T("/protocol")));
if (m_Simulation)
m_Simulation->SetValue(cfg->ReadBool(_T("/simulation")));
if (m_Sets)
{
for (size_t i=0; i<m_Sets->GetCount(); i++)
{
wxString Sel; Sel.Printf(_T("/selection%lu"), static_cast<unsigned long>(i));
m_Sets->Check(i, cfg->ReadBool(Sel, true));
}
}
}// LoadSettings
示例15: locDir
EnvironmentSettingsDlg::EnvironmentSettingsDlg(wxWindow* parent, wxAuiDockArt* art)
: m_pArt(art)
{
ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("app"));
ConfigManager *pcfg = Manager::Get()->GetConfigManager(_T("project_manager"));
ConfigManager *mcfg = Manager::Get()->GetConfigManager(_T("message_manager"));
ConfigManager *acfg = Manager::Get()->GetConfigManager(_T("an_dlg"));
wxXmlResource::Get()->LoadObject(this, parent, _T("dlgEnvironmentSettings"),_T("wxScrollingDialog"));
int sel = cfg->ReadInt(_T("/environment/settings_size"), 0);
wxListbook* lb = XRCCTRL(*this, "nbMain", wxListbook);
SetSettingsIconsStyle(lb->GetListView(), (SettingsIconsStyle)sel);
LoadListbookImages();
// this setting is not available under wxGTK
#ifndef __WXMSW__
XRCCTRL(*this, "rbSettingsIconsSize", wxRadioBox)->Enable(false);
#endif
// tab "General"
XRCCTRL(*this, "chkSingleInstance", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/single_instance"), true));
#ifdef __WXMSW__
static_cast<wxStaticBoxSizer*>(XRCCTRL(*this, "chkUseIPC", wxCheckBox)->GetContainingSizer())->GetStaticBox()->SetLabel(_("Dynamic Data Exchange (will take place after restart)"));
#endif
bool useIpc = cfg->ReadBool(_T("/environment/use_ipc"), true);
XRCCTRL(*this, "chkUseIPC", wxCheckBox)->SetValue(useIpc);
XRCCTRL(*this, "chkRaiseViaIPC", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/raise_via_ipc"), true));
XRCCTRL(*this, "chkRaiseViaIPC", wxCheckBox)->Enable(useIpc);
XRCCTRL(*this, "chkAssociations", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/check_associations"), true));
XRCCTRL(*this, "chkModifiedFiles", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/check_modified_files"), true));
XRCCTRL(*this, "chkInvalidTargets", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/ignore_invalid_targets"), true));
XRCCTRL(*this, "rbAppStart", wxRadioBox)->SetSelection(cfg->ReadBool(_T("/environment/blank_workspace"), true) ? 1 : 0);
wxTextCtrl* txt = XRCCTRL(*this, "txtConsoleTerm", wxTextCtrl);
txt->SetValue(cfg->Read(_T("/console_terminal"), DEFAULT_CONSOLE_TERM));
#ifdef __WXMSW__
// under win32, this option is not needed, so disable it
txt->Enable(false);
#endif
txt = XRCCTRL(*this, "txtConsoleShell", wxTextCtrl);
txt->SetValue(cfg->Read(_T("/console_shell"), DEFAULT_CONSOLE_SHELL));
#ifdef __WXMSW__
// under win32, this option is not needed, so disable it
txt->Enable(false);
#endif
#if defined __WXMSW__
const wxString openFolderCmds = _T("explorer.exe /select,");
#elif defined __WXMAC__
const wxString openFolderCmds = _T("open -R");
#else
const wxString openFolderCmds = _T("xdg-open");
#endif
XRCCTRL(*this, "txtOpenFolder", wxTextCtrl)->SetValue(cfg->Read(_T("/open_containing_folder"), openFolderCmds));
// tab "View"
bool do_place = cfg->ReadBool(_T("/dialog_placement/do_place"), false);
XRCCTRL(*this, "chkDoPlace", wxCheckBox)->SetValue(do_place);
XRCCTRL(*this, "chkPlaceHead", wxCheckBox)->SetValue(cfg->ReadInt(_T("/dialog_placement/dialog_position"), 0) == pdlHead ? 1 : 0);
XRCCTRL(*this, "chkPlaceHead", wxCheckBox)->Enable(do_place);
XRCCTRL(*this, "rbProjectOpen", wxRadioBox)->SetSelection(pcfg->ReadInt(_T("/open_files"), 1));
XRCCTRL(*this, "rbSettingsIconsSize", wxRadioBox)->SetSelection(cfg->ReadInt(_T("/environment/settings_size"), 0));
XRCCTRL(*this, "spnLogFontSize", wxSpinCtrl)->SetValue(mcfg->ReadInt(_T("/log_font_size"), 8));
bool en = mcfg->ReadBool(_T("/auto_hide"), false);
XRCCTRL(*this, "chkAutoHideMessages", wxCheckBox)->SetValue(en);
XRCCTRL(*this, "chkAutoShowMessagesOnSearch", wxCheckBox)->SetValue(mcfg->ReadBool(_T("/auto_show_search"), true));
XRCCTRL(*this, "chkAutoShowMessagesOnWarn", wxCheckBox)->SetValue(mcfg->ReadBool(_T("/auto_show_build_warnings"), true));
XRCCTRL(*this, "chkAutoShowMessagesOnErr", wxCheckBox)->SetValue(mcfg->ReadBool(_T("/auto_show_build_errors"), true));
XRCCTRL(*this, "chkAutoShowMessagesOnSearch", wxCheckBox)->Enable(en);
XRCCTRL(*this, "chkAutoShowMessagesOnWarn", wxCheckBox)->Enable(en);
XRCCTRL(*this, "chkAutoShowMessagesOnErr", wxCheckBox)->Enable(en);
XRCCTRL(*this, "chkSaveSelectionChangeInMP", wxCheckBox)->SetValue(mcfg->ReadBool(_T("/save_selection_change_in_mp"), true));
en = cfg->ReadBool(_T("/environment/view/dbl_clk_maximize"), true);
XRCCTRL(*this, "chkDblClkMaximizes", wxCheckBox)->SetValue(en);
int idx = Manager::Get()->GetAppFrame()->GetMenuBar()->FindMenu(_("&View"));
if (idx != wxNOT_FOUND)
{
wxMenu* menuView = Manager::Get()->GetAppFrame()->GetMenuBar()->GetMenu(idx);
int sub_idx = menuView->FindItem(_("Perspectives"));
if (sub_idx != wxNOT_FOUND)
{
wxMenu* menuLayouts = menuView->FindItem(sub_idx)->GetSubMenu();
if (menuLayouts)
{
wxMenuItemList& items = menuLayouts->GetMenuItems();
for (size_t i = 0; i < items.GetCount() && ! items[i]->IsSeparator() ; ++i)
{
#if wxCHECK_VERSION(2,8,5)
XRCCTRL(*this, "choLayoutToToggle", wxChoice)->Append(items[i]->GetLabelText(items[i]->GetItemLabelText()));
#else
XRCCTRL(*this, "choLayoutToToggle", wxChoice)->Append(items[i]->GetLabelFromText(items[i]->GetLabel()));
#endif
}
}
}
//.........这里部分代码省略.........