EditorSettingsTerminal::EditorSettingsTerminal( wxWindow* parent ) : EditorSettingsTerminalBase( parent ) , TreeBookNode<EditorSettingsTerminal>() { OptionsConfigPtr options = EditorConfigST::Get()->GetOptions(); m_textCtrlProgramConsoleCmd->SetValue(options->GetProgramConsoleCommand()); }
int PluginManager::GetToolbarIconSize() { // for now return 24 by default OptionsConfigPtr options = EditorConfigST::Get()->GetOptions(); if(options) { return options->GetIconsSize(); } return 24; }
EditorSettingsTerminal::EditorSettingsTerminal( wxWindow* parent ) : EditorSettingsTerminalBase( parent ) , TreeBookNode<EditorSettingsTerminal>() { OptionsConfigPtr options = EditorConfigST::Get()->GetOptions(); m_textCtrlProgramConsoleCmd->SetValue(options->GetProgramConsoleCommand()); m_checkBoxUseCodeLiteTerminal->SetValue( options->HasOption( OptionsConfig::Opt_Use_CodeLite_Terminal) ); }
void QuickFindBar::DoToggleReplacebar() { OptionsConfigPtr options = EditorConfigST::Get()->GetOptions(); bool show = !options->GetShowReplaceBar(); options->SetShowReplaceBar(show); EditorConfigST::Get()->SetOptions(options); ShowReplacebar(show); }
OptionsConfigPtr EditorConfig::GetOptions() const { wxXmlNode* node = XmlUtils::FindFirstByTagName(m_doc->GetRoot(), wxT("Options")); // node can be null ... OptionsConfigPtr opts = new OptionsConfig(node); // import legacy tab-width setting into opts long tabWidth = const_cast<EditorConfig*>(this)->GetInteger(wxT("EditorTabWidth"), -1); if(tabWidth != -1) { opts->SetTabWidth(tabWidth); } return opts; }
void BookmarkManager::OnEditorSettingsChanged(wxCommandEvent& e) { e.Skip(); DoPopulateDefaultLabels(); OptionsConfigPtr options = EditorConfigST::Get()->GetOptions(); for(int i = smt_FIRST_BMK_TYPE; i <= smt_LAST_BMK_TYPE; ++i) { wxString new_label = options->GetBookmarkLabel(i - smt_FIRST_BMK_TYPE); new_label.Trim().Trim(false); if(!new_label.IsEmpty()) { m_markerLabels.erase(i); m_markerLabels.insert(std::make_pair(i, new_label)); } } }
int CodeFormatter::DoGetGlobalEOL() const { OptionsConfigPtr options = m_mgr->GetEditorSettings(); if(options->GetEolMode() == wxT("Unix (LF)")) { return 2; } else if(options->GetEolMode() == wxT("Mac (CR)")) { return 1; } else if(options->GetEolMode() == wxT("Windows (CRLF)")) { return 0; } else { // set the EOL by the hosting OS #if defined(__WXMAC__) return 2; #elif defined(__WXGTK__) return 2; #else return 0; #endif } }
void EditorConfig::SetOptions(OptionsConfigPtr opts) { // locate the current node wxXmlNode *node = XmlUtils::FindFirstByTagName(m_doc->GetRoot(), wxT("Options")); if( node ){ m_doc->GetRoot()->RemoveChild(node); delete node; } m_doc->GetRoot()->AddChild(opts->ToXml()); m_doc->Save(m_fileName.GetFullPath()); }
EditorSettingsFolding::EditorSettingsFolding( wxWindow* parent ) : EditorSettingsFoldingBase( parent ) , TreeBookNode<EditorSettingsFolding>() { OptionsConfigPtr options = EditorConfigST::Get()->GetOptions(); m_displayMargin->SetValue(options->GetDisplayFoldMargin()); m_underlineFolded->SetValue(options->GetUnderlineFoldLine()); m_foldPreprocessors->SetValue(options->GetFoldPreprocessor()); m_foldCompact->SetValue(options->GetFoldCompact()); m_foldElse->SetValue(options->GetFoldAtElse()); const wxString FoldStyles[] = { wxTRANSLATE("Simple"), wxTRANSLATE("Arrows"), wxTRANSLATE("Flatten Tree Square Headers"), wxTRANSLATE("Flatten Tree Circular Headers") }; m_stringManager.AddStrings(sizeof(FoldStyles)/sizeof(wxString), FoldStyles, options->GetFoldStyle(), m_foldStyle); }
void EditorConfig::SetOptions(OptionsConfigPtr opts) { // remove legacy tab-width setting wxXmlNode* child = XmlUtils::FindNodeByName(m_doc->GetRoot(), wxT("ArchiveObject"), wxT("EditorTabWidth")); if(child) { m_doc->GetRoot()->RemoveChild(child); delete child; } // locate the current node wxString nodeName = wxT("Options"); wxXmlNode* node = XmlUtils::FindFirstByTagName(m_doc->GetRoot(), nodeName); if(node) { m_doc->GetRoot()->RemoveChild(node); delete node; } m_doc->GetRoot()->AddChild(opts->ToXml()); DoSave(); wxCommandEvent evt(wxEVT_EDITOR_CONFIG_CHANGED); evt.SetString(nodeName); EventNotifier::Get()->AddPendingEvent(evt); }
void EditorSettingsFolding::Save(OptionsConfigPtr options) { options->SetDisplayFoldMargin(m_displayMargin->GetValue()); options->SetUnderlineFoldLine(m_underlineFolded->GetValue()); options->SetFoldPreprocessor(m_foldPreprocessors->GetValue()); options->SetFoldCompact(m_foldCompact->GetValue()); options->SetFoldAtElse(m_foldElse->GetValue()); // Get the foldstyle selection, unlocalised wxString foldStyle = m_stringManager.GetStringSelection(); // thses 2 styles no longer exists... if(foldStyle == _("Arrows with Background Colour") || foldStyle == _("Simple with Background Colour")) foldStyle.Clear(); if (foldStyle.IsEmpty()) { foldStyle = wxT("Arrows"); } options->SetFoldStyle(foldStyle); }
void EditorConfig::SetPaneStickiness(const wxString& caption, bool stickiness) { OptionsConfigPtr options = GetOptions(); if(caption == _("Build")) { options->SetHideOutputPaneNotIfBuild(stickiness); } else if(caption == _("Search")) { options->SetHideOutputPaneNotIfSearch(stickiness); } else if(caption == _("Replace")) { options->SetHideOutputPaneNotIfReplace(stickiness); } else if(caption == _("References")) { options->SetHideOutputPaneNotIfReferences(stickiness); } else if(caption == _("Output")) { options->SetHideOutputPaneNotIfOutput(stickiness); } else if(caption == _("Debug")) { options->SetHideOutputPaneNotIfDebug(stickiness); } else if(caption == _("Trace")) { options->SetHideOutputPaneNotIfTrace(stickiness); } else if(caption == _("Tasks")) { options->SetHideOutputPaneNotIfTasks(stickiness); } else if(caption == _("BuildQ")) { options->SetHideOutputPaneNotIfBuildQ(stickiness); } else if(caption == _("CppCheck")) { options->SetHideOutputPaneNotIfCppCheck(stickiness); } else if(caption == _("Subversion")) { options->SetHideOutputPaneNotIfSvn(stickiness); } else if(caption == _("Cscope")) { options->SetHideOutputPaneNotIfCscope(stickiness); } else if(caption == _("Git")) { options->SetHideOutputPaneNotIfGit(stickiness); } else if(caption == _("MemCheck")) { options->SetHideOutputPaneNotIfMemCheck(stickiness); } else { return; } SetOptions(options); Save(); }
void EditorOptionsGeneralGuidesPanel::Save(OptionsConfigPtr options) { options->SetDisplayLineNumbers(m_displayLineNumbers->IsChecked()); options->SetHighlightMatchedBraces(m_checkBoxMatchBraces->IsChecked()); options->SetShowIndentationGuidelines(m_showIndentationGuideLines->IsChecked()); options->SetHighlightCaretLine(m_highlightCaretLine->IsChecked()); options->SetCaretLineColour(m_caretLineColourPicker->GetColour()); options->SetEolMode(m_EOLstringManager.GetStringSelection()); options->SetHideChangeMarkerMargin(m_checkBoxHideChangeMarkerMargin->IsChecked()); options->SetDisableSemicolonShift(m_checkBoxDisableSemicolonShift->IsChecked()); options->SetDebuggerMarkerLine(m_colourPickerDbgLine->GetColour()); options->EnableOption(OptionsConfig::Opt_Mark_Debugger_Line, m_checkBoxMarkdebuggerLine->IsChecked()); // save the whitespace visibility wxString Whitespace = m_WSstringManager.GetStringSelection(); int style(wxSTC_WS_INVISIBLE); // invisible if(Whitespace == wxT("Visible always")) { style = wxSTC_WS_VISIBLEALWAYS; } else if(Whitespace == wxT("Visible after indentation")) { style = wxSTC_WS_VISIBLEAFTERINDENT; } else if(Whitespace == wxT("Indentation only")) { style = wxSTC_WS_VISIBLEAFTERINDENT; } options->SetShowWhitspaces(style); }
void EditorSettingsLocal::DisplayHigherValues( const OptionsConfigPtr options ) { // There should be 'global' (or workspace if this will be a project setting) values for each setting // Insert them all, but leave the enabling checkboxes ticked, so the items will be disabled m_indentsUsesTabs->SetValue(options->GetIndentUsesTabs()); m_indentWidth->SetValue(options->GetIndentWidth()); m_tabWidth->SetValue(options->GetTabWidth()); m_displayLineNumbers->SetValue(options->GetDisplayLineNumbers()); m_showIndentationGuideLines->SetValue(options->GetShowIndentationGuidelines()); m_highlightCaretLine->SetValue(options->GetHighlightCaretLine()); m_checkBoxTrimLine->SetValue(options->GetTrimLine()); m_checkBoxAppendLF->SetValue(options->GetAppendLF()); m_checkBoxHideChangeMarkerMargin->SetValue( options->GetHideChangeMarkerMargin() ); m_checkBoxDisplayFoldMargin->SetValue( options->GetDisplayFoldMargin() ); m_displayBookmarkMargin->SetValue( options->GetDisplayBookmarkMargin() ); const wxString WhitespaceStyle[] = { wxTRANSLATE("Invisible"), wxTRANSLATE("Visible always"), wxTRANSLATE("Visible after indentation"), wxTRANSLATE("Indentation only") }; wxString currentWhitespace; switch (options->GetShowWhitspaces()) { case wxSTC_WS_VISIBLEALWAYS: currentWhitespace = wxT("Visible always"); break; case wxSTC_WS_VISIBLEAFTERINDENT: currentWhitespace = wxT("Visible after indentation"); break; default: currentWhitespace = wxT("Invisible"); break; } m_WSstringManager.AddStrings(sizeof(WhitespaceStyle)/sizeof(wxString), WhitespaceStyle, currentWhitespace, m_whitespaceStyle); const wxString EOLChoices[] = { wxTRANSLATE("Default"), wxT("Mac (CR)"), wxT("Windows (CRLF)"), wxT("Unix (LF)") }; m_EOLstringManager.AddStrings(sizeof(EOLChoices)/sizeof(wxString), EOLChoices, options->GetEolMode(), m_choiceEOL); wxArrayString astrEncodings; wxFontEncoding fontEnc; int iCurrSelId = 0; size_t iEncCnt = wxFontMapper::GetSupportedEncodingsCount(); for (size_t i = 0; i < iEncCnt; i++) { fontEnc = wxFontMapper::GetEncoding(i); if (wxFONTENCODING_SYSTEM == fontEnc) { // skip system, it is changed to UTF-8 in optionsconfig continue; } astrEncodings.Add(wxFontMapper::GetEncodingName(fontEnc)); if (fontEnc == options->GetFileFontEncoding()) { iCurrSelId = i; } } m_fileEncoding->Append(astrEncodings); m_fileEncoding->SetSelection(iCurrSelId); }
LocalOptionsConfig::LocalOptionsConfig(OptionsConfigPtr opts, wxXmlNode* node) { // Used for reading local values, which are merged into the passed OptionsConfigPtr only if valid if(node) { bool answer; wxString str; long l; if(XmlUtils::ReadBoolIfExists(node, wxT("DisplayFoldMargin"), answer)) { opts->SetDisplayFoldMargin(answer); } if(XmlUtils::ReadBoolIfExists(node, wxT("DisplayBookmarkMargin"), answer)) { opts->SetDisplayBookmarkMargin(answer); } if(XmlUtils::ReadBoolIfExists(node, wxT("HighlightCaretLine"), answer)) { opts->SetHighlightCaretLine(answer); } if(XmlUtils::ReadBoolIfExists(node, wxT("EditorTrimEmptyLines"), answer)) { opts->SetTrimLine(answer); } if(XmlUtils::ReadBoolIfExists(node, wxT("EditorAppendLf"), answer)) { opts->SetAppendLF(answer); } if(XmlUtils::ReadBoolIfExists(node, wxT("ShowLineNumber"), answer)) { opts->SetDisplayLineNumbers(answer); } if(XmlUtils::ReadBoolIfExists(node, wxT("IndentationGuides"), answer)) { opts->SetShowIndentationGuidelines(answer); } if(XmlUtils::ReadBoolIfExists(node, wxT("IndentUsesTabs"), answer)) { opts->SetIndentUsesTabs(answer); } if(XmlUtils::ReadBoolIfExists(node, wxT("HideChangeMarkerMargin"), answer)) { opts->SetHideChangeMarkerMargin(answer); } if(XmlUtils::ReadLongIfExists(node, wxT("IndentWidth"), l)) { opts->SetIndentWidth(l); } if(XmlUtils::ReadLongIfExists(node, wxT("TabWidth"), l)) { opts->SetTabWidth(l); } if(XmlUtils::ReadLongIfExists(node, wxT("ShowWhitespaces"), l)) { opts->SetShowWhitspaces(l); } if(XmlUtils::ReadStringIfExists(node, wxT("EOLMode"), str)) { opts->SetEolMode(str); } if(XmlUtils::ReadStringIfExists(node, wxT("FileFontEncoding"), str)) { opts->SetFileFontEncoding(str); } } }
void EditorSettingsMiscPanel::Save(OptionsConfigPtr options) { if(m_showSplashScreen->IsChecked()) { clMainFrame::Get()->SetFrameFlag(true, CL_SHOW_SPLASH); } else { clMainFrame::Get()->SetFrameFlag(false, CL_SHOW_SPLASH); } // Set the theme support. // This option requires a restart of codelite options->SetMswTheme(m_checkBoxEnableMSWTheme->IsChecked()); if(m_oldMswUseTheme != m_checkBoxEnableMSWTheme->IsChecked()) { m_restartRequired = true; } clConfig::Get().Write(kConfigSingleInstance, m_singleAppInstance->IsChecked()); clConfig::Get().Write(kConfigCheckForNewVersion, m_versionCheckOnStartup->IsChecked()); clConfig::Get().Write(kConfigMaxItemsInFindReplaceDialog, ::wxStringToInt(m_maxItemsFindReplace->GetValue(), 15)); clConfig::Get().Write(kConfigMaxOpenedTabs, ::wxStringToInt(m_spinCtrlMaxOpenTabs->GetValue(), 15)); clConfig::Get().Write(kConfigRestoreLastSession, m_checkBoxRestoreSession->IsChecked()); clConfig::Get().Write(kConfigFrameTitlePattern, m_textCtrlPattern->GetValue()); bool oldUseSingleToolbar = !PluginManager::Get()->AllowToolbar(); EditorConfigST::Get()->SetInteger(wxT("UseSingleToolbar"), m_useSingleToolbar->IsChecked() ? 1 : 0); // check to see of the icon size was modified int oldIconSize(24); OptionsConfigPtr oldOptions = EditorConfigST::Get()->GetOptions(); if(oldOptions) { oldIconSize = oldOptions->GetIconsSize(); } int iconSize(24); if(m_toolbarIconSize->GetSelection() == 0) { iconSize = 16; } options->SetIconsSize(iconSize); bool setlocale = m_SetLocale->IsChecked(); options->SetUseLocale(setlocale); wxString newLocaleString = m_AvailableLocales->GetStringSelection(); // I don't think we should check if newLocaleString is empty; that's still useful information newLocaleString = newLocaleString.BeforeFirst(wxT(':')); // Store it as "fr_FR", not "fr_FR: French" options->SetPreferredLocale(newLocaleString); if((setlocale != m_oldSetLocale) || (newLocaleString != m_oldpreferredLocale)) { m_restartRequired = true; } // save file font encoding options->SetFileFontEncoding(m_fileEncoding->GetStringSelection()); TagsManagerST::Get()->SetEncoding(options->GetFileFontEncoding()); if(oldIconSize != iconSize || oldUseSingleToolbar != m_useSingleToolbar->IsChecked()) { EditorConfigST::Get()->SetInteger(wxT("LoadSavedPrespective"), 0); // notify the user m_restartRequired = true; } else { EditorConfigST::Get()->SetInteger(wxT("LoadSavedPrespective"), 1); } size_t flags = options->GetOptions(); size_t oldFlags = oldOptions->GetOptions(); // Keep the old icon-set flags, this is done for deciding whether we should // prompt the user for possible restart size_t oldIconFlags(0); size_t newIconFlags(0); if(oldFlags & OptionsConfig::Opt_IconSet_Classic) oldIconFlags |= OptionsConfig::Opt_IconSet_Classic; if(oldFlags & OptionsConfig::Opt_IconSet_FreshFarm) oldIconFlags |= OptionsConfig::Opt_IconSet_FreshFarm; if(oldFlags & OptionsConfig::Opt_IconSet_Classic_Dark) oldIconFlags |= OptionsConfig::Opt_IconSet_Classic_Dark; if(oldIconFlags == 0) oldIconFlags = OptionsConfig::Opt_IconSet_Classic; // Clear old settings flags &= ~(OptionsConfig::Opt_IconSet_Classic); flags &= ~(OptionsConfig::Opt_IconSet_FreshFarm); flags &= ~(OptionsConfig::Opt_IconSet_Classic_Dark); if(m_choiceIconSet->GetSelection() == 0) { newIconFlags |= OptionsConfig::Opt_IconSet_Classic; flags |= OptionsConfig::Opt_IconSet_Classic; } else if(m_choiceIconSet->GetSelection() == 2) { newIconFlags |= OptionsConfig::Opt_IconSet_Classic_Dark; flags |= OptionsConfig::Opt_IconSet_Classic_Dark; } else { // 1 newIconFlags |= OptionsConfig::Opt_IconSet_FreshFarm; flags |= OptionsConfig::Opt_IconSet_FreshFarm; } clConfig::Get().Write("RedirectLogOutput", m_redirectLogOutput->IsChecked()); clConfig::Get().Write("PromptForNewReleaseOnly", m_checkBoxPromptReleaseOnly->IsChecked()); options->SetOptions(flags); m_restartRequired = ((oldIconFlags != newIconFlags) || m_restartRequired); }
wxPanel *OptionsDlg::CreateGeneralPage() { OptionsConfigPtr options = EditorConfigST::Get()->GetOptions(); m_general = new wxPanel( m_book, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* vSz1; vSz1 = new wxBoxSizer( wxVERTICAL ); wxStaticBoxSizer* sbSizer1; sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_general, -1, wxT("Folding:") ), wxVERTICAL ); m_checkBoxDisplayFoldMargin = new wxCheckBox( m_general, wxID_ANY, wxT("Display Folding Margin"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBoxDisplayFoldMargin->SetValue(options->GetDisplayFoldMargin()); sbSizer1->Add( m_checkBoxDisplayFoldMargin, 0, wxALL, 5 ); m_checkBoxMarkFoldedLine = new wxCheckBox( m_general, wxID_ANY, wxT("Underline Folded Line"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBoxMarkFoldedLine->SetValue(options->GetUnderlineFoldLine()); sbSizer1->Add( m_checkBoxMarkFoldedLine, 0, wxALL, 5 ); m_staticText1 = new wxStaticText( m_general, wxID_ANY, wxT("Fold Style:"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizer1->Add( m_staticText1, 0, wxALL, 5 ); wxString m_foldStyleChoiceChoices[] = { wxT("Simple"), wxT("Arrows"), wxT("Flatten Tree Square Headers"), wxT("Flatten Tree Circular Headers") }; int m_foldStyleChoiceNChoices = sizeof( m_foldStyleChoiceChoices ) / sizeof( wxString ); m_foldStyleChoice = new wxChoice( m_general, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_foldStyleChoiceNChoices, m_foldStyleChoiceChoices, 0 ); sbSizer1->Add( m_foldStyleChoice, 0, wxALL|wxEXPAND, 5 ); m_foldStyleChoice->SetStringSelection( options->GetFoldStyle() ); vSz1->Add( sbSizer1, 0, wxEXPAND, 5 ); wxStaticBoxSizer* sbSizer3; sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_general, -1, wxT("Bookmarks:") ), wxVERTICAL ); m_displayBookmarkMargin = new wxCheckBox( m_general, wxID_ANY, wxT("Display Selection / Bookmark margin"), wxDefaultPosition, wxDefaultSize, 0 ); m_displayBookmarkMargin->SetValue(options->GetDisplayBookmarkMargin()); sbSizer3->Add( m_displayBookmarkMargin, 0, wxALL, 5 ); m_staticText6 = new wxStaticText( m_general, wxID_ANY, wxT("Bookmark Shape:"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizer3->Add( m_staticText6, 0, wxALL, 5 ); wxString m_bookmarkShapeChoices[] = { wxT("Small Rectangle"), wxT("Rounded Rectangle"), wxT("Circle"), wxT("Small Arrow") }; int m_bookmarkShapeNChoices = sizeof( m_bookmarkShapeChoices ) / sizeof( wxString ); m_bookmarkShape = new wxChoice( m_general, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_bookmarkShapeNChoices, m_bookmarkShapeChoices, 0 ); sbSizer3->Add( m_bookmarkShape, 0, wxALL|wxEXPAND, 5 ); m_bookmarkShape->SetStringSelection(options->GetBookmarkShape()); wxGridSizer* gSizer1; gSizer1 = new wxGridSizer( 2, 2, 0, 0 ); m_staticText4 = new wxStaticText( m_general, wxID_ANY, wxT("Select the bookmark background colour:"), wxDefaultPosition, wxDefaultSize, 0 ); gSizer1->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_bgColourPicker = new wxColourPickerCtrl(m_general, wxID_ANY, options->GetBookmarkBgColour(), wxDefaultPosition, wxDefaultSize, wxCLRP_SHOW_LABEL); gSizer1->Add( m_bgColourPicker, 0, wxALIGN_RIGHT|wxALL, 5 ); m_staticText5 = new wxStaticText( m_general, wxID_ANY, wxT("Select the bookmark forground colour:"), wxDefaultPosition, wxDefaultSize, 0 ); gSizer1->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_fgColourPicker = new wxColourPickerCtrl( m_general, wxID_ANY, options->GetBookmarkFgColour(), wxDefaultPosition, wxDefaultSize, wxCLRP_SHOW_LABEL); gSizer1->Add( m_fgColourPicker, 0, wxALIGN_RIGHT|wxALL, 5 ); sbSizer3->Add( gSizer1, 1, wxEXPAND, 5 ); vSz1->Add( sbSizer3, 0, wxEXPAND, 5 ); wxStaticBoxSizer* sbSizer4; sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_general, -1, wxT("General:") ), wxVERTICAL ); wxFlexGridSizer* fgSizer; fgSizer = new wxFlexGridSizer( 3, 2, 0, 0 ); m_highlighyCaretLine = new wxCheckBox( m_general, wxID_ANY, wxT("Highlight Caret Line"), wxDefaultPosition, wxDefaultSize, 0 ); m_highlighyCaretLine->SetValue(options->GetHighlightCaretLine()); fgSizer->Add( m_highlighyCaretLine, 0, wxALL, 5 ); m_displayLineNumbers = new wxCheckBox( m_general, wxID_ANY, wxT("Dsiplay Line Numbers"), wxDefaultPosition, wxDefaultSize, 0 ); m_displayLineNumbers->SetValue(options->GetDisplayLineNumbers()); fgSizer->Add( m_displayLineNumbers, 0, wxALL, 5 ); m_showIndentationGuideLines = new wxCheckBox( m_general, wxID_ANY, wxT("Show Indentation Guidelines"), wxDefaultPosition, wxDefaultSize, 0 ); m_showIndentationGuideLines->SetValue(options->GetShowIndentationGuidelines()); fgSizer->Add( m_showIndentationGuideLines, 0, wxALL, 5 ); sbSizer4->Add( fgSizer, 1, wxEXPAND, 5 ); vSz1->Add( sbSizer4, 0, wxEXPAND, 5 ); m_general->SetSizer( vSz1 ); m_general->Layout(); vSz1->Fit( m_general ); return m_general; }
//------------------------------------ // Handle copy events //------------------------------------ void EditHandler::ProcessCommandEvent(wxWindow* owner, wxCommandEvent& event) { wxUnusedVar(event); clEditor* editor = (clEditor*)owner; OptionsConfigPtr options = editor->GetOptions(); switch(event.GetId()) { case wxID_ZOOM_IN: editor->ZoomIn(); return; case wxID_ZOOM_OUT: editor->ZoomOut(); return; case wxID_ZOOM_FIT: editor->SetZoom(0); return; case wxID_COPY: if(options->GetCopyLineEmptySelection()) { editor->CopyAllowLine(); } else { editor->Copy(); } return; case wxID_CUT: editor->Cut(); return; case wxID_PASTE: editor->Paste(); return; case wxID_SELECTALL: editor->SelectAll(); return; case wxID_DUPLICATE: editor->SelectionDuplicate(); return; case wxID_DELETE: editor->DeleteBack(); return; default: break; } if(event.GetId() == wxID_UNDO) { if(editor->GetCommandsProcessor().CanUndo()) { editor->Undo(); editor->GetCommandsProcessor().CloseSciUndoAction(); editor->GetCommandsProcessor().DecrementCurrentCommand(); } } else if(event.GetId() == wxID_REDO) { if(editor->GetCommandsProcessor().CanRedo()) { editor->Redo(); editor->GetCommandsProcessor().CloseSciUndoAction(); // Is this necessary? At least it does no harm editor->GetCommandsProcessor().IncrementCurrentCommand(); } } else if(event.GetId() == XRCID("label_current_state")) { wxString label = wxGetTextFromUser("What would you like to call the current state?", "Label current state", "", editor); if(!label.empty()) { editor->GetCommandsProcessor().SetUserLabel(label); } } else if(event.GetId() == XRCID("delete_line_end")) { editor->DelLineRight(); } else if(event.GetId() == XRCID("delete_line_start")) { editor->DelLineLeft(); } else if(event.GetId() == XRCID("delete_line")) { editor->LineDelete(); } else if(event.GetId() == XRCID("copy_line")) { editor->LineCopy(); } else if(event.GetId() == XRCID("cut_line")) { editor->LineCut(); } else if(event.GetId() == XRCID("trim_trailing")) { editor->TrimText(true, false); } else if(event.GetId() == XRCID("to_lower")) { editor->ChangeCase(true); } else if(event.GetId() == XRCID("to_upper")) { editor->ChangeCase(false); } else if(event.GetId() == XRCID("transpose_lines")) { editor->LineTranspose(); } else if(event.GetId() == XRCID("move_line_down")) { int curline = editor->GetCurrentLine(); int lastline = editor->LineFromPosition(editor->GetLength() - 1); if(editor->GetSelection().empty() || (editor->LineFromPos(editor->GetSelectionStart() == editor->LineFromPos(editor->GetSelectionEnd())))) { // No selection (or only a trivial 1-line one) if(curline != lastline) { editor->LineDown(); editor->LineTranspose(); } } else { editor->MoveSelectedLinesDown(); // There is a selection, so we can move it direct } } else if(event.GetId() == XRCID("move_line_up")) { if(editor->GetSelection().empty() || (editor->LineFromPos(editor->GetSelectionStart() == editor->LineFromPos(editor->GetSelectionEnd())))) { // No selection (or only a trivial 1-line one) editor->LineTranspose(); editor->LineUp(); } else { editor->MoveSelectedLinesUp(); // There is a selection, so we can move it direct } } else if(event.GetId() == XRCID("center_line_roll")) { int here = editor->GetCurrentLine(); int top = editor->GetFirstVisibleLine(); int count = editor->LinesOnScreen(); int center = top + (count / 2); if(here < center) { for(int lnIterator = 0; lnIterator < center - here; lnIterator++) editor->LineScrollUp(); // roll up until we get to center } else if(here > center) { for(int lnIterator = 0; lnIterator < here - center; lnIterator++) editor->LineScrollDown(); // roll down until we get to center } } else if(event.GetId() == XRCID("convert_indent_to_spaces")) { editor->ConvertIndentToSpaces(); } else if(event.GetId() == XRCID("convert_indent_to_tabs")) { editor->ConvertIndentToTabs(); } }
void FindResultsTab::SetStyles(wxStyledTextCtrl* sci) { LexerConf::Ptr_t lexer = ColoursAndFontsManager::Get().GetLexer("c++"); if(!lexer) { lexer = ColoursAndFontsManager::Get().GetLexer("text"); } const StyleProperty& defaultStyle = lexer->GetProperty(0); wxFont defaultFont = lexer->GetFontForSyle(0); for(size_t i = 0; i < wxSTC_STYLE_MAX; ++i) { sci->StyleSetForeground(i, defaultStyle.GetFgColour()); sci->StyleSetBackground(i, defaultStyle.GetBgColour()); sci->StyleSetFont(i, defaultFont); } // Show/hide whitespace sci->SetViewWhiteSpace(EditorConfigST::Get()->GetOptions()->GetShowWhitspaces()); StyleProperty::Map_t& props = lexer->GetLexerProperties(); // Set the whitespace colours sci->SetWhitespaceForeground(true, props[WHITE_SPACE_ATTR_ID].GetFgColour()); sci->StyleSetForeground(LEX_FIF_HEADER, props[11].GetFgColour()); sci->StyleSetBackground(LEX_FIF_HEADER, props[11].GetBgColour()); // 33 is the style for line numbers sci->StyleSetForeground(LEX_FIF_LINE_NUMBER, props[33].GetFgColour()); // 11 is the style number for "identifier" sci->StyleSetForeground(LEX_FIF_MATCH, props[11].GetFgColour()); // 16 is the stule for colouring classes sci->StyleSetForeground(LEX_FIF_SCOPE, props[16].GetFgColour()); sci->StyleSetForeground(LEX_FIF_MATCH_COMMENT, props[wxSTC_C_COMMENTLINE].GetFgColour()); sci->StyleSetForeground(LEX_FIF_FILE, props[wxSTC_C_WORD].GetFgColour()); sci->StyleSetEOLFilled(LEX_FIF_FILE, true); sci->StyleSetForeground(LEX_FIF_DEFAULT, props[11].GetFgColour()); sci->StyleSetBackground(LEX_FIF_DEFAULT, props[11].GetBgColour()); sci->StyleSetHotSpot(LEX_FIF_MATCH, true); sci->StyleSetHotSpot(LEX_FIF_FILE, true); sci->StyleSetHotSpot(LEX_FIF_MATCH_COMMENT, true); sci->SetHotspotActiveForeground(true, lexer->IsDark() ? "WHITE" : "BLACK"); sci->SetHotspotActiveUnderline(false); sci->MarkerDefine(7, wxSTC_MARK_ARROW); #if wxVERSION_NUMBER < 3100 // On GTK we dont have the wxSTC_INDIC_TEXTFORE symbol yet (old wx version) sci->MarkerDefine(7, wxSTC_MARK_ARROW); sci->MarkerSetBackground(7, lexer->IsDark() ? "CYAN" : "ORANGE"); sci->MarkerSetForeground(7, lexer->IsDark() ? "CYAN" : "ORANGE"); sci->IndicatorSetForeground(1, lexer->IsDark() ? "CYAN" : "ORANGE"); sci->IndicatorSetStyle(1, wxSTC_INDIC_ROUNDBOX); #else sci->MarkerDefine(7, wxSTC_MARK_ARROW); sci->MarkerSetBackground(7, lexer->IsDark() ? "#FFD700" : "#FF4500"); sci->MarkerSetForeground(7, lexer->IsDark() ? "#FFD700" : "#FF4500"); sci->IndicatorSetForeground(1, lexer->IsDark() ? "#FFD700" : "#FF4500"); sci->IndicatorSetStyle(1, wxSTC_INDIC_TEXTFORE); #endif sci->IndicatorSetUnder(1, true); sci->SetMarginWidth(0, 0); sci->SetMarginWidth(1, 16); sci->SetMarginWidth(2, 0); sci->SetMarginWidth(3, 0); sci->SetMarginWidth(4, 0); sci->SetMarginSensitive(1, true); sci->HideSelection(true); // Indentation OptionsConfigPtr options = EditorConfigST::Get()->GetOptions(); sci->SetUseTabs(options->GetIndentUsesTabs()); sci->SetTabWidth(options->GetIndentWidth()); sci->SetIndent(options->GetIndentWidth()); sci->Refresh(); }
void EditorSettingsDockingWindows::Save(OptionsConfigPtr options) { options->SetHideOutpuPaneOnUserClick(m_checkBoxHideOutputPaneOnClick->IsChecked()); options->SetHideOutputPaneNotIfBuild(m_checkBoxHideOutputPaneNotIfBuild->IsChecked()); options->SetHideOutputPaneNotIfSearch(m_checkBoxHideOutputPaneNotIfSearch->IsChecked()); options->SetHideOutputPaneNotIfReplace(m_checkBoxHideOutputPaneNotIfReplace->IsChecked()); options->SetHideOutputPaneNotIfReferences(m_checkBoxHideOutputPaneNotIfReferences->IsChecked()); options->SetHideOutputPaneNotIfOutput(m_checkBoxHideOutputPaneNotIfOutput->IsChecked()); options->SetHideOutputPaneNotIfTrace(m_checkBoxHideOutputPaneNotIfTrace->IsChecked()); options->SetHideOutputPaneNotIfTasks(m_checkBoxHideOutputPaneNotIfTasks->IsChecked()); options->SetHideOutputPaneNotIfBuildQ(m_checkBoxHideOutputPaneNotIfBuildQ->IsChecked()); options->SetHideOutputPaneNotIfCppCheck(m_checkBoxHideOutputPaneNotIfCppCheck->IsChecked()); options->SetHideOutputPaneNotIfSvn(m_checkBoxHideOutputPaneNotIfSvn->IsChecked()); options->SetHideOutputPaneNotIfCscope(m_checkBoxHideOutputPaneNotIfCscope->IsChecked()); options->SetHideOutputPaneNotIfGit(m_checkBoxHideOutputPaneNotIfGit->IsChecked()); options->SetHideOutputPaneNotIfDebug(m_checkBoxHideOutputPaneNotIfDebug->IsChecked()); options->SetHideOutputPaneNotIfMemCheck(m_checkBoxHideOutputPaneNotIfMemCheck->IsChecked()); options->SetFindBarAtBottom(m_checkBoxFindBarAtBottom->IsChecked()); options->SetShowReplaceBar(m_checkBoxShowReplaceBar->IsChecked()); options->SetDontAutoFoldResults(m_checkBoxDontFoldSearchResults->IsChecked()); options->SetShowDebugOnRun(m_checkBoxShowDebugOnRun->IsChecked()); options->SetDockingStyle(m_radioBoxHint->GetSelection()); options->SetShowDockingWindowCaption(!m_checkBoxHideCaptions->IsChecked()); options->SetEnsureCaptionsVisible(m_checkBoxEnsureCaptionsVisible->IsChecked()); options->SetTabColourMatchesTheme(m_checkBoxEditorTabsFollowsTheme->IsChecked()); options->SetTabHasXButton(m_checkBoxShowXButton->IsChecked()); switch(m_choiceOutputTabsOrientation->GetSelection()) { case 0: options->SetOutputTabsDirection(wxTOP); break; case 1: options->SetOutputTabsDirection(wxBOTTOM); break; default: break; } switch(m_choiceWorkspaceTabsOrientation->GetSelection()) { case 0: options->SetWorkspaceTabsDirection(wxLEFT); break; case 1: options->SetWorkspaceTabsDirection(wxRIGHT); break; case 2: options->SetWorkspaceTabsDirection(wxTOP); break; case 3: options->SetWorkspaceTabsDirection(wxBOTTOM); break; default: break; } // Keep the quickreplacebar in sync clMainFrame::Get()->GetMainBook()->ShowQuickReplaceBar(m_checkBoxShowReplaceBar->IsChecked()); }
EditorSettingsDockingWindows::EditorSettingsDockingWindows(wxWindow* parent) : EditorSettingsDockingWindowsBase(parent) { OptionsConfigPtr options = EditorConfigST::Get()->GetOptions(); m_checkBoxHideOutputPaneOnClick->SetValue(options->GetHideOutpuPaneOnUserClick()); m_checkBoxHideOutputPaneNotIfBuild->SetValue(options->GetHideOutputPaneNotIfBuild()); m_checkBoxHideOutputPaneNotIfSearch->SetValue(options->GetHideOutputPaneNotIfSearch()); m_checkBoxHideOutputPaneNotIfReplace->SetValue(options->GetHideOutputPaneNotIfReplace()); m_checkBoxHideOutputPaneNotIfReferences->SetValue(options->GetHideOutputPaneNotIfReferences()); m_checkBoxHideOutputPaneNotIfOutput->SetValue(options->GetHideOutputPaneNotIfOutput()); m_checkBoxHideOutputPaneNotIfTrace->SetValue(options->GetHideOutputPaneNotIfTrace()); m_checkBoxHideOutputPaneNotIfTasks->SetValue(options->GetHideOutputPaneNotIfTasks()); m_checkBoxHideOutputPaneNotIfBuildQ->SetValue(options->GetHideOutputPaneNotIfBuildQ()); m_checkBoxHideOutputPaneNotIfCppCheck->SetValue(options->GetHideOutputPaneNotIfCppCheck()); m_checkBoxHideOutputPaneNotIfSvn->SetValue(options->GetHideOutputPaneNotIfSvn()); m_checkBoxHideOutputPaneNotIfCscope->SetValue(options->GetHideOutputPaneNotIfCscope()); m_checkBoxHideOutputPaneNotIfGit->SetValue(options->GetHideOutputPaneNotIfGit()); m_checkBoxHideOutputPaneNotIfDebug->SetValue(options->GetHideOutputPaneNotIfDebug()); m_checkBoxHideOutputPaneNotIfMemCheck->SetValue(options->GetHideOutputPaneNotIfMemCheck()); m_checkBoxFindBarAtBottom->SetValue(options->GetFindBarAtBottom()); m_checkBoxShowReplaceBar->SetValue(options->GetShowReplaceBar()); m_checkBoxDontFoldSearchResults->SetValue(options->GetDontAutoFoldResults()); m_checkBoxShowDebugOnRun->SetValue(options->GetShowDebugOnRun()); m_radioBoxHint->SetSelection(options->GetDockingStyle()); m_checkBoxHideCaptions->SetValue(!options->IsShowDockingWindowCaption()); m_checkBoxEnsureCaptionsVisible->SetValue(options->IsEnsureCaptionsVisible()); m_checkBoxEditorTabsFollowsTheme->SetValue(options->IsTabColourMatchesTheme()); m_checkBoxShowXButton->SetValue(options->IsTabHasXButton()); switch(options->GetOutputTabsDirection()) { case wxTOP: m_choiceOutputTabsOrientation->SetSelection(0); break; case wxBOTTOM: m_choiceOutputTabsOrientation->SetSelection(1); break; default: break; } switch(options->GetWorkspaceTabsDirection()) { case wxLEFT: m_choiceWorkspaceTabsOrientation->SetSelection(0); break; case wxRIGHT: m_choiceWorkspaceTabsOrientation->SetSelection(1); break; case wxTOP: m_choiceWorkspaceTabsOrientation->SetSelection(2); break; case wxBOTTOM: m_choiceWorkspaceTabsOrientation->SetSelection(3); break; default: break; } m_checkBoxHideOutputPaneNotIfDebug->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler(EditorSettingsDockingWindows::OnHideOutputPaneNotIfDebugUI), NULL, this); }
void EditorSettingsDockingWindows::Save(OptionsConfigPtr options) { options->SetHideOutpuPaneOnUserClick(m_checkBoxHideOutputPaneOnClick->IsChecked()); options->SetHideOutputPaneNotIfBuild(m_checkBoxHideOutputPaneNotIfBuild->IsChecked()); options->SetHideOutputPaneNotIfSearch(m_checkBoxHideOutputPaneNotIfSearch->IsChecked()); options->SetHideOutputPaneNotIfReplace(m_checkBoxHideOutputPaneNotIfReplace->IsChecked()); options->SetHideOutputPaneNotIfReferences(m_checkBoxHideOutputPaneNotIfReferences->IsChecked()); options->SetHideOutputPaneNotIfOutput(m_checkBoxHideOutputPaneNotIfOutput->IsChecked()); options->SetHideOutputPaneNotIfTrace(m_checkBoxHideOutputPaneNotIfTrace->IsChecked()); options->SetHideOutputPaneNotIfTasks(m_checkBoxHideOutputPaneNotIfTasks->IsChecked()); options->SetHideOutputPaneNotIfBuildQ(m_checkBoxHideOutputPaneNotIfBuildQ->IsChecked()); options->SetHideOutputPaneNotIfCppCheck(m_checkBoxHideOutputPaneNotIfCppCheck->IsChecked()); options->SetHideOutputPaneNotIfSvn(m_checkBoxHideOutputPaneNotIfSvn->IsChecked()); options->SetHideOutputPaneNotIfCscope(m_checkBoxHideOutputPaneNotIfCscope->IsChecked()); options->SetHideOutputPaneNotIfGit(m_checkBoxHideOutputPaneNotIfGit->IsChecked()); options->SetHideOutputPaneNotIfDebug(m_checkBoxHideOutputPaneNotIfDebug->IsChecked()); options->SetHideOutputPaneNotIfMemCheck(m_checkBoxHideOutputPaneNotIfMemCheck->IsChecked()); options->SetFindBarAtBottom(m_checkBoxFindBarAtBottom->IsChecked()); options->SetShowReplaceBar(m_checkBoxShowReplaceBar->IsChecked()); options->SetDontAutoFoldResults(m_checkBoxDontFoldSearchResults->IsChecked()); options->SetShowDebugOnRun(m_checkBoxShowDebugOnRun->IsChecked()); options->SetDockingStyle(m_radioBoxHint->GetSelection()); options->SetShowDockingWindowCaption(!m_checkBoxHideCaptions->IsChecked()); options->SetEnsureCaptionsVisible(m_checkBoxEnsureCaptionsVisible->IsChecked()); options->SetTabColourMatchesTheme(m_checkBoxEditorTabsFollowsTheme->IsChecked()); options->SetTabHasXButton(m_checkBoxShowXButton->IsChecked()); options->SetNonEditorTabsAtTop(!m_checkBoxPanesTabsAtBottom->IsChecked()); // Keep the quickreplacebar in sync clMainFrame::Get()->GetMainBook()->ShowQuickReplaceBar(m_checkBoxShowReplaceBar->IsChecked()); }
EditorSettingsDockingWindows::EditorSettingsDockingWindows(wxWindow* parent) : EditorSettingsDockingWindowsBase(parent) { OptionsConfigPtr options = EditorConfigST::Get()->GetOptions(); m_checkBoxHideOutputPaneOnClick->SetValue(options->GetHideOutpuPaneOnUserClick()); m_checkBoxHideOutputPaneNotIfBuild->SetValue(options->GetHideOutputPaneNotIfBuild()); m_checkBoxHideOutputPaneNotIfSearch->SetValue(options->GetHideOutputPaneNotIfSearch()); m_checkBoxHideOutputPaneNotIfReplace->SetValue(options->GetHideOutputPaneNotIfReplace()); m_checkBoxHideOutputPaneNotIfReferences->SetValue(options->GetHideOutputPaneNotIfReferences()); m_checkBoxHideOutputPaneNotIfOutput->SetValue(options->GetHideOutputPaneNotIfOutput()); m_checkBoxHideOutputPaneNotIfTrace->SetValue(options->GetHideOutputPaneNotIfTrace()); m_checkBoxHideOutputPaneNotIfTasks->SetValue(options->GetHideOutputPaneNotIfTasks()); m_checkBoxHideOutputPaneNotIfBuildQ->SetValue(options->GetHideOutputPaneNotIfBuildQ()); m_checkBoxHideOutputPaneNotIfCppCheck->SetValue(options->GetHideOutputPaneNotIfCppCheck()); m_checkBoxHideOutputPaneNotIfSvn->SetValue(options->GetHideOutputPaneNotIfSvn()); m_checkBoxHideOutputPaneNotIfCscope->SetValue(options->GetHideOutputPaneNotIfCscope()); m_checkBoxHideOutputPaneNotIfGit->SetValue(options->GetHideOutputPaneNotIfGit()); m_checkBoxHideOutputPaneNotIfDebug->SetValue(options->GetHideOutputPaneNotIfDebug()); m_checkBoxHideOutputPaneNotIfMemCheck->SetValue(options->GetHideOutputPaneNotIfMemCheck()); m_checkBoxFindBarAtBottom->SetValue(options->GetFindBarAtBottom()); m_checkBoxShowReplaceBar->SetValue(options->GetShowReplaceBar()); m_checkBoxDontFoldSearchResults->SetValue(options->GetDontAutoFoldResults()); m_checkBoxShowDebugOnRun->SetValue(options->GetShowDebugOnRun()); m_radioBoxHint->SetSelection(options->GetDockingStyle()); m_checkBoxHideCaptions->SetValue(!options->IsShowDockingWindowCaption()); m_checkBoxEnsureCaptionsVisible->SetValue(options->IsEnsureCaptionsVisible()); int tabStyle(0); // Glossy m_startingFlags = OptionsConfig::TabGlossy; if(options->GetOptions() & OptionsConfig::TabCurved) { tabStyle = 1; m_startingFlags = OptionsConfig::TabCurved; } m_endFlags = m_startingFlags; m_radioBoxTabControlStyle->SetSelection(tabStyle); #if CL_USE_NATIVEBOOK m_radioBoxTabControlStyle->Enable(false); #endif m_checkBoxHideOutputPaneNotIfDebug->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler(EditorSettingsDockingWindows::OnHideOutputPaneNotIfDebugUI), NULL, this); }
//------------------------------------ // Handle copy events //------------------------------------ void EditHandler::ProcessCommandEvent(wxWindow *owner, wxCommandEvent &event) { wxUnusedVar(event); LEditor *editor = (LEditor*)owner; OptionsConfigPtr options = editor->GetOptions(); // hide completion box editor->HideCompletionBox(); bool isSelectionEmpty = editor->GetSelectedText().IsEmpty(); if (event.GetId() == wxID_COPY) { // reset the 'full line' copy/cut flag editor->SetFullLineCopyCut(false); if ( isSelectionEmpty && options->HasOption( OptionsConfig::Opt_CopyNothing) ) { // do nothing } else if ( isSelectionEmpty && options->HasOption( OptionsConfig::Opt_CopyLineIfLineNotEmpty ) ) { // Copy the line content only when the caret line is not empty int lineNumber = editor->GetCurrentLine(); wxString lineContent = editor->GetLine(lineNumber); if ( !lineContent.Trim().Trim(false).IsEmpty() ) { editor->CopyAllowLine(); editor->SetFullLineCopyCut(true); } } else if ( isSelectionEmpty ) { // default behavior editor->CopyAllowLine(); editor->SetFullLineCopyCut(true); } else { editor->Copy(); } } else if (event.GetId() == wxID_CUT) { // reset the 'full line' copy/cut flag editor->SetFullLineCopyCut(false); if ( isSelectionEmpty && options->HasOption( OptionsConfig::Opt_CopyNothing) ) { // do nothing } else if ( isSelectionEmpty && options->HasOption( OptionsConfig::Opt_CopyLineIfLineNotEmpty ) ) { // Copy the line content only when the caret line is not empty int lineNumber = editor->GetCurrentLine(); wxString lineContent = editor->GetLine(lineNumber); if ( !lineContent.Trim().Trim(false).IsEmpty() ) { editor->CopyAllowLine(); editor->LineDelete(); editor->SetFullLineCopyCut(true); } } else if ( isSelectionEmpty ) { // default behavior editor->CopyAllowLine(); editor->LineDelete(); editor->SetFullLineCopyCut(true); } else { editor->Cut(); } } else if (event.GetId() == wxID_PASTE) { if ( editor->IsFullLineCopyCut() ) { // paste one line above the caret editor->PasteLineAbove(); } else { // paste at caret position editor->Paste(); } } else if (event.GetId() == wxID_UNDO) { if (editor->GetCommandsProcessor().CanUndo()) { editor->Undo(); editor->GetCommandsProcessor().DecrementCurrentCommand(); } } else if (event.GetId() == wxID_REDO) { if (editor->GetCommandsProcessor().CanRedo()) { editor->Redo(); editor->GetCommandsProcessor().IncrementCurrentCommand(); } } else if (event.GetId() == XRCID("label_current_state")) { wxString label = wxGetTextFromUser("What would you like to call the current state?", "Label current state", "", editor); if (!label.empty()) { editor->GetCommandsProcessor().SetUserLabel(label); } } else if (event.GetId() == wxID_SELECTALL) { editor->SelectAll(); } else if (event.GetId() == wxID_DUPLICATE) { editor->SelectionDuplicate(); } else if (event.GetId() == XRCID("delete_line_end")) { editor->DelLineRight(); } else if (event.GetId() == XRCID("delete_line_start")) { editor->DelLineLeft(); } else if (event.GetId() == XRCID("delete_line")) { editor->LineDelete(); } else if (event.GetId() == XRCID("trim_trailing")) { editor->TrimText(true, false); } else if (event.GetId() == XRCID("to_lower")) { editor->ChangeCase(true); } else if (event.GetId() == XRCID("to_upper")) { editor->ChangeCase(false); } else if (event.GetId() == XRCID("transpose_lines")) { editor->LineTranspose(); } else if (event.GetId() == wxID_DELETE) { editor->DeleteBack(); } else if (event.GetId() == XRCID("move_line_down")) { int curline = editor->GetCurrentLine(); int lastline = editor->LineFromPosition(editor->GetLength()-1); if (editor->GetSelection().empty() || (editor->LineFromPos(editor->GetSelectionStart() == editor->LineFromPos(editor->GetSelectionEnd())))) { // No selection (or only a trivial 1-line one) if (curline != lastline) { editor->LineDown(); editor->LineTranspose(); } } else { editor->MoveSelectedLinesDown(); // There is a selection, so we can move it direct } } else if (event.GetId() == XRCID("move_line_up")) { if (editor->GetSelection().empty() || (editor->LineFromPos(editor->GetSelectionStart() == editor->LineFromPos(editor->GetSelectionEnd())))) { // No selection (or only a trivial 1-line one) editor->LineTranspose(); editor->LineUp(); } else { editor->MoveSelectedLinesUp(); // There is a selection, so we can move it direct } } else if (event.GetId() == XRCID("center_line")) { //editor->VerticalCentreCaret(); } else if (event.GetId() == XRCID("center_line_roll")) { int here = editor->GetCurrentLine(); int top = editor->GetFirstVisibleLine(); int count = editor->LinesOnScreen(); int center = top + (count / 2); if (here < center) { for (int lnIterator = 0; lnIterator < center - here; lnIterator++) editor->LineScrollUp(); //roll up until we get to center } else if (here > center) { for (int lnIterator = 0; lnIterator < here - center; lnIterator++) editor->LineScrollDown(); //roll down until we get to center } } }
void EditorSettingsDockingWindows::Save(OptionsConfigPtr options) { options->SetHideOutpuPaneOnUserClick(m_checkBoxHideOutputPaneOnClick->IsChecked()); options->SetHideOutputPaneNotIfBuild(m_checkBoxHideOutputPaneNotIfBuild->IsChecked()); options->SetHideOutputPaneNotIfSearch(m_checkBoxHideOutputPaneNotIfSearch->IsChecked()); options->SetHideOutputPaneNotIfReplace(m_checkBoxHideOutputPaneNotIfReplace->IsChecked()); options->SetHideOutputPaneNotIfReferences(m_checkBoxHideOutputPaneNotIfReferences->IsChecked()); options->SetHideOutputPaneNotIfOutput(m_checkBoxHideOutputPaneNotIfOutput->IsChecked()); options->SetHideOutputPaneNotIfTrace(m_checkBoxHideOutputPaneNotIfTrace->IsChecked()); options->SetHideOutputPaneNotIfTasks(m_checkBoxHideOutputPaneNotIfTasks->IsChecked()); options->SetHideOutputPaneNotIfBuildQ(m_checkBoxHideOutputPaneNotIfBuildQ->IsChecked()); options->SetHideOutputPaneNotIfCppCheck(m_checkBoxHideOutputPaneNotIfCppCheck->IsChecked()); options->SetHideOutputPaneNotIfSvn(m_checkBoxHideOutputPaneNotIfSvn->IsChecked()); options->SetHideOutputPaneNotIfCscope(m_checkBoxHideOutputPaneNotIfCscope->IsChecked()); options->SetHideOutputPaneNotIfGit(m_checkBoxHideOutputPaneNotIfGit->IsChecked()); options->SetHideOutputPaneNotIfDebug(m_checkBoxHideOutputPaneNotIfDebug->IsChecked()); options->SetHideOutputPaneNotIfMemCheck(m_checkBoxHideOutputPaneNotIfMemCheck->IsChecked()); options->SetFindBarAtBottom(m_checkBoxFindBarAtBottom->IsChecked()); options->SetShowReplaceBar(m_checkBoxShowReplaceBar->IsChecked()); options->SetDontAutoFoldResults(m_checkBoxDontFoldSearchResults->IsChecked()); options->SetShowDebugOnRun(m_checkBoxShowDebugOnRun->IsChecked()); options->SetDockingStyle(m_radioBoxHint->GetSelection()); options->SetShowDockingWindowCaption(!m_checkBoxHideCaptions->IsChecked()); options->SetEnsureCaptionsVisible(m_checkBoxEnsureCaptionsVisible->IsChecked()); // Keep the quickreplacebar in sync clMainFrame::Get()->GetMainBook()->ShowQuickReplaceBar(m_checkBoxShowReplaceBar->IsChecked()); size_t flags(options->GetOptions()); // set the tab control options: //////////////////////////////////// // Clear the current tab control style flags &= ~OptionsConfig::TabAll; switch(m_radioBoxTabControlStyle->GetSelection()) { case 0: // glossy flags |= OptionsConfig::TabGlossy; m_endFlags |= OptionsConfig::TabGlossy; break; case 1: // curved default: flags |= OptionsConfig::TabCurved; m_endFlags |= OptionsConfig::TabCurved; break; } options->SetOptions(flags); }
EditorSettingsDockingWindows::EditorSettingsDockingWindows(wxWindow* parent) : EditorSettingsDockingWindowsBase(parent) { OptionsConfigPtr options = EditorConfigST::Get()->GetOptions(); m_checkBoxHideOutputPaneOnClick->SetValue(options->GetHideOutpuPaneOnUserClick()); m_checkBoxHideOutputPaneNotIfBuild->SetValue(options->GetHideOutputPaneNotIfBuild()); m_checkBoxHideOutputPaneNotIfSearch->SetValue(options->GetHideOutputPaneNotIfSearch()); m_checkBoxHideOutputPaneNotIfReplace->SetValue(options->GetHideOutputPaneNotIfReplace()); m_checkBoxHideOutputPaneNotIfReferences->SetValue(options->GetHideOutputPaneNotIfReferences()); m_checkBoxHideOutputPaneNotIfOutput->SetValue(options->GetHideOutputPaneNotIfOutput()); m_checkBoxHideOutputPaneNotIfTrace->SetValue(options->GetHideOutputPaneNotIfTrace()); m_checkBoxHideOutputPaneNotIfTasks->SetValue(options->GetHideOutputPaneNotIfTasks()); m_checkBoxHideOutputPaneNotIfBuildQ->SetValue(options->GetHideOutputPaneNotIfBuildQ()); m_checkBoxHideOutputPaneNotIfCppCheck->SetValue(options->GetHideOutputPaneNotIfCppCheck()); m_checkBoxHideOutputPaneNotIfSvn->SetValue(options->GetHideOutputPaneNotIfSvn()); m_checkBoxHideOutputPaneNotIfCscope->SetValue(options->GetHideOutputPaneNotIfCscope()); m_checkBoxHideOutputPaneNotIfGit->SetValue(options->GetHideOutputPaneNotIfGit()); m_checkBoxHideOutputPaneNotIfDebug->SetValue(options->GetHideOutputPaneNotIfDebug()); m_checkBoxHideOutputPaneNotIfMemCheck->SetValue(options->GetHideOutputPaneNotIfMemCheck()); m_checkBoxFindBarAtBottom->SetValue(options->GetFindBarAtBottom()); m_checkBoxDontFoldSearchResults->SetValue(options->GetDontAutoFoldResults()); m_checkBoxShowDebugOnRun->SetValue(options->GetShowDebugOnRun()); m_radioBoxHint->SetSelection(options->GetDockingStyle()); m_checkBoxHideCaptions->SetValue(!options->IsShowDockingWindowCaption()); m_checkBoxEnsureCaptionsVisible->SetValue(options->IsEnsureCaptionsVisible()); m_checkBoxEditorTabsFollowsTheme->SetValue(options->IsTabColourMatchesTheme()); m_checkBoxUseDarkTabTheme->SetValue(options->IsTabColourDark()); m_checkBoxShowXButton->SetValue(options->IsTabHasXButton()); m_checkBoxMouseScrollSwitchTabs->SetValue(options->IsMouseScrollSwitchTabs()); // DEFAULT 0 // MINIMAL 1 // TRAPEZOID 2 if(options->GetOptions() & OptionsConfig::Opt_TabStyleTRAPEZOID) { m_choiceTabStyle->SetSelection(2); } else if(options->GetOptions() & OptionsConfig::Opt_TabStyleMinimal) { m_choiceTabStyle->SetSelection(1); } else { // default m_choiceTabStyle->SetSelection(0); } int sel(0); switch(options->GetNotebookTabHeight()) { case OptionsConfig::nbTabHt_Tiny: sel = 3; break; case OptionsConfig::nbTabHt_Short: sel = 2; break; case OptionsConfig::nbTabHt_Medium: sel = 1; break; default: sel = 0; } m_choiceTabHeight->SetSelection(sel); #if 0 { wxArrayString tabOptionsArr; tabOptionsArr.Add(wxT("TOP")); tabOptionsArr.Add(wxT("BOTTOM")); m_choiceWorkspaceTabsOrientation->Clear(); m_choiceWorkspaceTabsOrientation->Append(tabOptionsArr); } #endif switch(options->GetOutputTabsDirection()) { case wxTOP: m_choiceOutputTabsOrientation->SetSelection(0); break; case wxBOTTOM: m_choiceOutputTabsOrientation->SetSelection(1); break; default: break; } #if 0 // On OSX we dont support left-right (due to blurred images) switch(options->GetWorkspaceTabsDirection()) { case wxLEFT: case wxTOP: m_choiceWorkspaceTabsOrientation->SetSelection(0); break; case wxRIGHT: case wxBOTTOM: m_choiceWorkspaceTabsOrientation->SetSelection(1); break; default: break; } #else switch(options->GetWorkspaceTabsDirection()) { case wxLEFT: m_choiceWorkspaceTabsOrientation->SetSelection(0); break; case wxRIGHT: m_choiceWorkspaceTabsOrientation->SetSelection(1); break; case wxTOP: m_choiceWorkspaceTabsOrientation->SetSelection(2); break; case wxBOTTOM: m_choiceWorkspaceTabsOrientation->SetSelection(3); break; default: break; } #endif m_checkBoxHideOutputPaneNotIfDebug->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(EditorSettingsDockingWindows::OnHideOutputPaneNotIfDebugUI), NULL, this); }
EditorOptionsGeneralGuidesPanel::EditorOptionsGeneralGuidesPanel(wxWindow* parent) : EditorOptionsGeneralGuidesPanelBase(parent) , TreeBookNode<EditorOptionsGeneralGuidesPanel>() { OptionsConfigPtr options = EditorConfigST::Get()->GetOptions(); m_displayLineNumbers->SetValue(options->GetDisplayLineNumbers()); m_checkBoxMatchBraces->SetValue(options->GetHighlightMatchedBraces()); m_showIndentationGuideLines->SetValue(options->GetShowIndentationGuidelines()); m_highlightCaretLine->SetValue(options->GetHighlightCaretLine()); m_caretLineColourPicker->SetColour(options->GetCaretLineColour()); const wxString EOLChoices[] = { wxTRANSLATE("Default"), wxT("Mac (CR)"), wxT("Windows (CRLF)"), wxT("Unix (LF)") }; m_EOLstringManager.AddStrings( sizeof(EOLChoices) / sizeof(wxString), EOLChoices, options->GetEolMode(), m_choiceEOL); m_checkBoxHideChangeMarkerMargin->SetValue(options->GetHideChangeMarkerMargin()); m_checkBoxDisableSemicolonShift->SetValue(options->GetDisableSemicolonShift()); m_checkBoxMarkdebuggerLine->SetValue(options->HasOption(OptionsConfig::Opt_Mark_Debugger_Line)); m_colourPickerDbgLine->SetColour(options->GetDebuggerMarkerLine()); const wxString WhitespaceStyle[] = { wxTRANSLATE("Invisible"), wxTRANSLATE("Visible always"), wxTRANSLATE("Visible after indentation") }; wxString currentWhitespace; switch(options->GetShowWhitspaces()) { case wxSTC_WS_VISIBLEALWAYS: currentWhitespace = wxT("Visible always"); break; case wxSTC_WS_VISIBLEAFTERINDENT: currentWhitespace = wxT("Visible after indentation"); break; default: currentWhitespace = wxT("Invisible"); break; } m_WSstringManager.AddStrings( sizeof(WhitespaceStyle) / sizeof(wxString), WhitespaceStyle, currentWhitespace, m_whitespaceStyle); }
void EditorSettingsDockingWindows::Save(OptionsConfigPtr options) { options->SetHideOutpuPaneOnUserClick(m_checkBoxHideOutputPaneOnClick->IsChecked()); options->SetHideOutputPaneNotIfBuild(m_checkBoxHideOutputPaneNotIfBuild->IsChecked()); options->SetHideOutputPaneNotIfSearch(m_checkBoxHideOutputPaneNotIfSearch->IsChecked()); options->SetHideOutputPaneNotIfReplace(m_checkBoxHideOutputPaneNotIfReplace->IsChecked()); options->SetHideOutputPaneNotIfReferences(m_checkBoxHideOutputPaneNotIfReferences->IsChecked()); options->SetHideOutputPaneNotIfOutput(m_checkBoxHideOutputPaneNotIfOutput->IsChecked()); options->SetHideOutputPaneNotIfTrace(m_checkBoxHideOutputPaneNotIfTrace->IsChecked()); options->SetHideOutputPaneNotIfTasks(m_checkBoxHideOutputPaneNotIfTasks->IsChecked()); options->SetHideOutputPaneNotIfBuildQ(m_checkBoxHideOutputPaneNotIfBuildQ->IsChecked()); options->SetHideOutputPaneNotIfCppCheck(m_checkBoxHideOutputPaneNotIfCppCheck->IsChecked()); options->SetHideOutputPaneNotIfSvn(m_checkBoxHideOutputPaneNotIfSvn->IsChecked()); options->SetHideOutputPaneNotIfCscope(m_checkBoxHideOutputPaneNotIfCscope->IsChecked()); options->SetHideOutputPaneNotIfGit(m_checkBoxHideOutputPaneNotIfGit->IsChecked()); options->SetHideOutputPaneNotIfDebug(m_checkBoxHideOutputPaneNotIfDebug->IsChecked()); options->SetHideOutputPaneNotIfMemCheck(m_checkBoxHideOutputPaneNotIfMemCheck->IsChecked()); options->SetFindBarAtBottom(m_checkBoxFindBarAtBottom->IsChecked()); options->SetDontAutoFoldResults(m_checkBoxDontFoldSearchResults->IsChecked()); options->SetShowDebugOnRun(m_checkBoxShowDebugOnRun->IsChecked()); options->SetDockingStyle(m_radioBoxHint->GetSelection()); options->SetShowDockingWindowCaption(!m_checkBoxHideCaptions->IsChecked()); options->SetEnsureCaptionsVisible(m_checkBoxEnsureCaptionsVisible->IsChecked()); options->SetTabColourMatchesTheme(m_checkBoxEditorTabsFollowsTheme->IsChecked()); options->SetTabColourDark(m_checkBoxUseDarkTabTheme->IsChecked()); options->SetTabHasXButton(m_checkBoxShowXButton->IsChecked()); options->SetMouseScrollSwitchTabs(m_checkBoxMouseScrollSwitchTabs->IsChecked()); // Set the tab style: // DEFAULT 0 // MINIMAL 1 // TRAPEZOID 2 int tabStyleSelection = m_choiceTabStyle->GetSelection(); options->EnableOption(OptionsConfig::Opt_TabStyleMinimal, (tabStyleSelection == 1)); options->EnableOption(OptionsConfig::Opt_TabStyleTRAPEZOID, (tabStyleSelection == 2)); int ht(0); switch(m_choiceTabHeight->GetSelection()) { case 3: ht = OptionsConfig::nbTabHt_Tiny; break; case 2: ht = OptionsConfig::nbTabHt_Short; break; case 1: ht = OptionsConfig::nbTabHt_Medium; break; default: ht = OptionsConfig::nbTabHt_Tall; } options->SetNotebookTabHeight(ht); switch(m_choiceOutputTabsOrientation->GetSelection()) { case 0: options->SetOutputTabsDirection(wxTOP); break; case 1: options->SetOutputTabsDirection(wxBOTTOM); break; default: break; } switch(m_choiceWorkspaceTabsOrientation->GetSelection()) { case 0: options->SetWorkspaceTabsDirection(wxLEFT); break; case 1: options->SetWorkspaceTabsDirection(wxRIGHT); break; case 2: options->SetWorkspaceTabsDirection(wxTOP); break; case 3: options->SetWorkspaceTabsDirection(wxBOTTOM); break; default: break; } }
EditorSettingsMiscPanel::EditorSettingsMiscPanel(wxWindow* parent) : EditorSettingsMiscBasePanel(parent) , TreeBookNode<EditorSettingsMiscPanel>() , m_restartRequired(false) { GeneralInfo info = clMainFrame::Get()->GetFrameGeneralInfo(); OptionsConfigPtr options = EditorConfigST::Get()->GetOptions(); if(options->GetIconsSize() == 16) { m_toolbarIconSize->SetSelection(0); } else { m_toolbarIconSize->SetSelection(1); } if(options->GetOptions() & OptionsConfig::Opt_IconSet_FreshFarm) m_choiceIconSet->SetSelection(1); else if(options->GetOptions() & OptionsConfig::Opt_IconSet_Classic_Dark) m_choiceIconSet->SetSelection(2); else m_choiceIconSet->SetSelection(0); // Default m_checkBoxEnableMSWTheme->SetValue(options->GetMswTheme()); m_useSingleToolbar->SetValue(!PluginManager::Get()->AllowToolbar()); m_oldSetLocale = options->GetUseLocale(); m_SetLocale->SetValue(m_oldSetLocale); m_oldpreferredLocale = options->GetPreferredLocale(); // Load the available locales and feed them to the wxchoice int select = FindAvailableLocales(); if(select != wxNOT_FOUND) { m_AvailableLocales->SetSelection(select); } wxArrayString astrEncodings; wxFontEncoding fontEnc; int iCurrSelId = 0; size_t iEncCnt = wxFontMapper::GetSupportedEncodingsCount(); for(size_t i = 0; i < iEncCnt; i++) { fontEnc = wxFontMapper::GetEncoding(i); if(wxFONTENCODING_SYSTEM == fontEnc) { // skip system, it is changed to UTF-8 in optionsconfig continue; } astrEncodings.Add(wxFontMapper::GetEncodingName(fontEnc)); if(fontEnc == options->GetFileFontEncoding()) { iCurrSelId = i; } } m_fileEncoding->Append(astrEncodings); m_fileEncoding->SetSelection(iCurrSelId); m_singleAppInstance->SetValue(clConfig::Get().Read(kConfigSingleInstance, false)); m_versionCheckOnStartup->SetValue(clConfig::Get().Read(kConfigCheckForNewVersion, true)); m_maxItemsFindReplace->ChangeValue(::wxIntToString(clConfig::Get().Read(kConfigMaxItemsInFindReplaceDialog, 15))); m_spinCtrlMaxOpenTabs->ChangeValue(::wxIntToString(clConfig::Get().Read(kConfigMaxOpenedTabs, 15))); m_choice4->SetStringSelection( FileLogger::GetVerbosityAsString(clConfig::Get().Read(kConfigLogVerbosity, FileLogger::Error))); m_checkBoxRestoreSession->SetValue(clConfig::Get().Read(kConfigRestoreLastSession, true)); m_textCtrlPattern->ChangeValue(clConfig::Get().Read(kConfigFrameTitlePattern, wxString("$workspace $fullpath"))); bool showSplash = info.GetFlags() & CL_SHOW_SPLASH ? true : false; m_showSplashScreen->SetValue(showSplash); m_oldMswUseTheme = m_checkBoxEnableMSWTheme->IsChecked(); m_redirectLogOutput->SetValue(clConfig::Get().Read(kConfigRedirectLogOutput, true)); m_checkBoxPromptReleaseOnly->SetValue(clConfig::Get().Read("PromptForNewReleaseOnly", false)); }
void EditorSettingsTerminal::Save(OptionsConfigPtr options) { options->SetProgramConsoleCommand (m_textCtrlProgramConsoleCmd->GetValue()); options->EnableOption( OptionsConfig::Opt_Use_CodeLite_Terminal, m_checkBoxUseCodeLiteTerminal->IsChecked() ); }