/*---------------------------------------------------------------------------*/ void wxSQLEditorBase::Init() { m_FontName = _T("Courier New"); m_FontSize = 10; SetWrapMode(wxSTC_WRAP_NONE); // wxSTC_WRAP_WORD wxSTC_WRAP_NONE SetLexer(wxSTC_LEX_SQL); SetTabWidth(2); SetUseTabs(false); SetTabIndents (true); SetBackSpaceUnIndents (true); SetIndent(2); SetViewEOL(false); SetIndentationGuides(true); SetEOLMode(wxSTC_EOL_LF); SetEdgeColumn(200); SetEdgeMode(wxSTC_EDGE_LINE); // wxSTC_EDGE_NONE wxSTC_EDGE_LINE SetViewWhiteSpace(wxSTC_WS_INVISIBLE); // wxSTC_WS_VISIBLEALWAYS SetMarginType(1, wxSTC_MARGIN_SYMBOL); SetMarginWidth(1, 0); SetKeyWords(0, SQLWordlist1); SetKeyWords(1, SQLWordlist2); SetKeyWords(4, SQLWordlist3); SetKeyWords(5, SQLWordlist4); ReInitAllStyle(); }
void FB_STC::LoadSettings ( ) { FB_Config * Prefs = m_Ide->GetConfig(); Style_STC_FB * Style = &Prefs->Style_FB; // Clear all styles there might be defined StyleClearAll( ); SetLexer( 0 ); // Tab and indenting SetTabWidth ( Prefs->TabSize ); SetUseTabs ( false ); SetTabIndents ( true ); SetBackSpaceUnIndents ( true ); SetIndent ( Prefs->TabSize ); SetIndentationGuides ( Prefs->IndentGuide ); // Right margin SetEdgeMode ( Prefs->RightMargin ? wxSTC_EDGE_LINE: wxSTC_EDGE_NONE ); SetEdgeColumn ( Prefs->EdgeColumn ); // Line and line ending SetEOLMode ( 0 ); SetViewEOL ( Prefs->DisplayEOL ); SetViewWhiteSpace ( Prefs->WhiteSpace ? wxSTC_WS_VISIBLEALWAYS: wxSTC_WS_INVISIBLE ); // Misc CmdKeyClear (wxSTC_KEY_TAB, 0); #define _STYLE(nr) Style->Style[nr] wxFont font ( _STYLE(0).Size, wxMODERN, wxNORMAL, wxNORMAL, false, _STYLE(0).Font ); StyleSetForeground (wxSTC_STYLE_DEFAULT, Prefs->GetClr(_STYLE(0).Face)); StyleSetBackground (wxSTC_STYLE_DEFAULT, Prefs->GetClr(_STYLE(0).Back)); StyleSetFont( wxSTC_STYLE_DEFAULT, font ); StyleSetForeground (0, Prefs->GetClr(_STYLE(0).Face)); StyleSetBackground (0, Prefs->GetClr(_STYLE(0).Back)); StyleSetFont( 0, font ); StyleSetForeground (wxSTC_STYLE_LINENUMBER, Prefs->GetClr(Style->LineNumberFace)); StyleSetBackground (wxSTC_STYLE_LINENUMBER, Prefs->GetClr(Style->LineNumberBack)); StyleSetFont( wxSTC_STYLE_LINENUMBER, font ); SetCaretForeground (Prefs->GetClr(Style->CaretFace)); SetSelForeground(true, Prefs->GetClr(Style->SelectFace)); SetSelBackground(true, Prefs->GetClr(Style->SelectBack)); #undef STYLE int LineNrMargin = TextWidth(wxSTC_STYLE_LINENUMBER, _T("0001")); SetMarginWidth (0, Prefs->LineNumber ? LineNrMargin : 0); SetMarginWidth (1,0); if ( Prefs->CurrentLine ) { SetCaretLineVisible( true ); SetCaretLineBack( Prefs->GetClr( Style->CaretLine ) ); } }
void Edit::OnConvertEOL (wxCommandEvent &event) { int eolMode = GetEOLMode(); switch (event.GetId()) { case myID_CONVERTCR: { eolMode = wxSTC_EOL_CR; break;} case myID_CONVERTCRLF: { eolMode = wxSTC_EOL_CRLF; break;} case myID_CONVERTLF: { eolMode = wxSTC_EOL_LF; break;} } ConvertEOLs (eolMode); SetEOLMode (eolMode); }
void CodeEditor::OnConvertEOL(wxCommandEvent &event) { int eolMode = GetEOLMode(); const int id = event.GetId(); if(id == ID_CONVERTCR) eolMode = wxSCI_EOL_CR; else if(id == ID_CONVERTCRLF) eolMode = wxSCI_EOL_CRLF; else if(id == ID_CONVERTLF) eolMode = wxSCI_EOL_LF; ConvertEOLs(eolMode); SetEOLMode(eolMode); }
void ctlSQLBox::Create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style) { wxStyledTextCtrl::Create(parent, id , pos, size, style); // Clear all styles StyleClearAll(); // Font extern sysSettings *settings; wxFont fntSQLBox = settings->GetSQLFont(); wxColour bgColor = settings->GetSQLBoxColourBackground(); if (settings->GetSQLBoxUseSystemBackground()) { bgColor = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); } wxColour frColor = settings->GetSQLBoxColourForeground(); if (settings->GetSQLBoxUseSystemForeground()) { frColor = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); } StyleSetBackground(wxSTC_STYLE_DEFAULT, bgColor); StyleSetForeground(wxSTC_STYLE_DEFAULT, frColor); StyleSetFont(wxSTC_STYLE_DEFAULT, fntSQLBox); SetSelBackground(true, wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)); SetSelForeground(true, wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT)); SetCaretForeground(settings->GetSQLColourCaret()); SetMarginWidth(1, 0); SetTabWidth(settings->GetIndentSpaces()); SetUseTabs(!settings->GetSpacesForTabs()); // Setup the different highlight colurs for (int i = 0; i < 34; ++ i ) { if (i > 0 && i < 12) StyleSetForeground(i, settings->GetSQLBoxColour(i)); else StyleSetForeground(i, frColor); StyleSetBackground(i, bgColor); StyleSetFont(i, fntSQLBox); } // Keywords in uppercase? if (settings->GetSQLKeywordsInUppercase()) StyleSetCase(5, wxSTC_CASE_UPPER); // Margin style StyleSetBackground(wxSTC_STYLE_LINENUMBER, settings->GetSQLMarginBackgroundColour()); // Brace maching styles StyleSetBackground(34, wxColour(0x99, 0xF9, 0xFF)); StyleSetBackground(35, wxColour(0xFF, 0xCF, 0x27)); StyleSetFont(34, fntSQLBox); StyleSetFont(35, fntSQLBox); // SQL Lexer and keywords. if (sqlKeywords.IsEmpty()) FillKeywords(sqlKeywords); SetLexer(wxSTC_LEX_SQL); SetKeyWords(0, sqlKeywords + plpgsqlKeywords + ftsKeywords + pgscriptKeywords); // Enable folding SetMarginSensitive(2, true); SetMarginType(2, wxSTC_MARGIN_SYMBOL); // margin 2 for symbols SetMarginMask(2, wxSTC_MASK_FOLDERS); // set up mask for folding symbols SetMarginSensitive(2, true); // this one needs to be mouse-aware SetMarginWidth(2, 16); // set margin 2 16 px wide MarkerDefine(wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_BOXPLUSCONNECTED, *wxWHITE, *wxBLACK); MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_BOXMINUSCONNECTED, *wxWHITE, *wxBLACK); MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNER, *wxWHITE, *wxBLACK); MarkerDefine(wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_LCORNER, *wxWHITE, *wxBLACK); MarkerDefine(wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_VLINE, *wxWHITE, *wxBLACK); MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUS, *wxWHITE, *wxBLACK); MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_BOXMINUS, *wxWHITE, *wxBLACK); SetProperty(wxT("fold"), wxT("1")); SetFoldFlags(16); // Setup accelerators wxAcceleratorEntry entries[2]; entries[0].Set(wxACCEL_CTRL, (int)'F', MNU_FIND); entries[1].Set(wxACCEL_CTRL, (int)' ', MNU_AUTOCOMPLETE); wxAcceleratorTable accel(2, entries); SetAcceleratorTable(accel); // Autocompletion configuration AutoCompSetSeparator('\t'); AutoCompSetChooseSingle(true); AutoCompSetIgnoreCase(true); AutoCompSetFillUps(wxT(" \t")); AutoCompSetDropRestOfWord(true); SetEOLMode(settings->GetLineEndingType()); }