/* TextEditor::setup * Sets up text editor properties depending on cvars and the current * text styleset/style *******************************************************************/ void TextEditor::setup() { // General settings SetBufferedDraw(true); SetUseAntiAliasing(true); SetMouseDwellTime(500); AutoCompSetIgnoreCase(true); SetIndentationGuides(txed_indent_guides); StyleSetBackground(wxSTC_STYLE_INDENTGUIDE, WXCOL(col_edge_line)); // Right margin line SetEdgeColour(WXCOL(col_edge_line)); SetEdgeColumn(txed_edge_column); if (txed_edge_column == 0) SetEdgeMode(wxSTC_EDGE_NONE); else SetEdgeMode(wxSTC_EDGE_LINE); // Apply default style StyleSet::applyCurrent(this); CallTipUseStyle(10); StyleSetChangeable(wxSTC_STYLE_CALLTIP, true); wxFont font_ct(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); StyleSetFont(wxSTC_STYLE_CALLTIP, font_ct); CallTipSetForegroundHighlight(WXCOL(StyleSet::currentSet()->getStyle("calltip_hl")->getForeground())); // Set lexer if (txed_syntax_hilight) SetLexer(wxSTC_LEX_CPPNOCASE); else SetLexer(wxSTC_LEX_NULL); // Re-colour text Colourise(0, GetTextLength()); }
void Doc_Stc::LoadStyle (const wxString & regPath) { SetKeyWords (0, _T("asm print locate end sleep goto function sub color select case if then else elseif")); SetLexer (SCLEX_FB); StyleInfo defStyle; { StyleInfo info(defStyle); SetStyle(wxSTC_STYLE_DEFAULT, info); SetStyle(SCE_FB_DEFAULT, info); SetStyle(SCE_FB_ASM_DEFAULT, info); SetStyle(SCE_FB_IDENTIFIER, info); } { StyleInfo info(defStyle); info.SetFG(_T("RGB(0, 0, 255)")); SetStyle(SCE_FB_STRING, info); info.SetBold(true); SetStyle(SCE_FB_OPENSTRING, info); } { StyleInfo info(defStyle); info.SetFG(_T("RGB(200, 0, 200)")); SetStyle(SCE_FB_NUMBER, info); SetStyle(SCE_FB_HEXNUMBER, info); SetStyle(SCE_FB_BINNUMBER, info); SetStyle(SCE_FB_OCTNUMBER, info); info.SetBold(true); info.SetFG(_T("RGB(255, 0, 0)")); SetStyle(SCE_FB_BADNUMBER, info); } { StyleInfo info(defStyle); info.SetFG(_T("RGB(128, 128, 128)")); SetStyle(SCE_FB_SLCOMMENT, info); SetStyle(SCE_FB_MLCOMMENT, info); } { StyleInfo info(defStyle); info.SetFG(_T("RGB(0, 128, 128)")); SetStyle(SCE_FB_LABEL, info); } { StyleInfo info(defStyle); info.SetFG(_T("RGB(255, 0, 0)")); SetStyle(SCE_FB_OPERATOR, info); } { StyleInfo info(defStyle); info.SetBold(true); SetStyle(SCE_FB_KEYWORD1, info); } }
/*---------------------------------------------------------------------------*/ 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 GLSLEditor::initialize() { StyleClearAll(); SetLexer(wxSCI_LEX_CPP); // Load keywords wxString path = wxT("../lexers/glsl/keywords"); loadKeywords(path); // Load call tips path = wxT("../lexers/glsl/calltips"); getCallTipManager().load(path); wxChar trigger('('); getCallTipManager().addTrigger(trigger); // Set styles StyleSetForeground(wxSCI_C_COMMENT, wxColour(0, 128, 0)); StyleSetFontAttr(wxSCI_C_COMMENT, 10, "Courier New", false, false, false); StyleSetForeground(wxSCI_C_COMMENTLINE, wxColour(0, 128, 0)); StyleSetFontAttr(wxSCI_C_COMMENTLINE, 10, "Courier New", false, false, false); StyleSetForeground(wxSCI_C_NUMBER, wxColour(0, 0, 128)); StyleSetFontAttr(wxSCI_C_NUMBER, 10, "Courier New", false, false, false); StyleSetForeground(wxSCI_C_STRING, wxColour(200, 200, 200)); StyleSetFontAttr(wxSCI_C_STRING, 10, "Courier New", false, false, false); StyleSetForeground(wxSCI_C_WORD, wxColour(0, 0, 255)); StyleSetFontAttr(wxSCI_C_WORD, 10, "Courier New", false, false, false); StyleSetForeground(wxSCI_C_WORD2, wxColour(136, 0, 0)); StyleSetFontAttr(wxSCI_C_WORD2, 10, "Courier New", false, false, false); }
void MaterialScriptEditor::initialize() { //StyleClearAll(); SetLexer(wxSCI_LEX_OMS); // Load keywords wxString path = wxT("../lexers/oms/keywords"); loadKeywords(path); // Load call tips path = wxT("../lexers/oms/calltips"); getCallTipManager().load(path); wxChar trigger(' '); getCallTipManager().addTrigger(trigger); // Load docs path = wxT("../lexers/oms/docs"); getDocManager().load(path); // Set styles StyleSetForeground(wxSCI_OMS_DEFAULT, wxColour(0, 0, 0)); StyleSetFontAttr(wxSCI_OMS_DEFAULT, 10, "Courier New", false, false, false); StyleSetForeground(wxSCI_OMS_COMMENT, wxColour(0, 128, 0)); StyleSetFontAttr(wxSCI_OMS_COMMENT, 10, "Courier New", false, false, false); StyleSetForeground(wxSCI_OMS_PRIMARY, wxColour(0, 0, 255)); StyleSetFontAttr(wxSCI_OMS_PRIMARY, 10, "Courier New", true, false, false); StyleSetForeground(wxSCI_OMS_ATTRIBUTE, wxColour(136, 0, 0)); StyleSetFontAttr(wxSCI_OMS_ATTRIBUTE, 10, "Courier New", true, false, false); StyleSetForeground(wxSCI_OMS_VALUE, wxColour(160, 0, 160)); StyleSetFontAttr(wxSCI_OMS_VALUE, 10, "Courier New", false, false, false); StyleSetForeground(wxSCI_OMS_NUMBER, wxColour(0, 0, 128)); StyleSetFontAttr(wxSCI_OMS_NUMBER, 10, "Courier New", false, false, false); }
void SourceView::setPlainMode() { SetLexer (wxSTC_LEX_NULL); SetMarginWidth (0, 0); SetMarginWidth (1, 0); }
void CodeEdit::SetDefaultLexer() { SetLexer(wxSTC_LEX_NULL); SetKeyWords(1, ""); // Set the caret width to match MSVC. SetCaretWidth(2); // Set the marker bitmaps. MarkerDefineBitmap(Marker_Breakpoint, wxMEMORY_BITMAP(Breakpoint_png) ); MarkerDefineBitmap(Marker_CurrentLine, wxMEMORY_BITMAP(Currentline_png) ); MarkerDefineBitmap(Marker_BreakLine, wxMEMORY_BITMAP(Breakline_png) ); // Setup the dwell time before a tooltip is displayed. SetMouseDwellTime(300); SetMarginSensitive(1, true); SetMarginType(1, wxSTC_MARGIN_SYMBOL); // Set the autocomplete icons. wxColour maskColor(0xFF, 0x9B, 0x77); wxBitmap functionIcon(functionicon, wxBITMAP_TYPE_XPM); functionIcon.SetMask(new wxMask(functionicon, maskColor)); RegisterImage(AutoCompleteManager::Type_Function, functionIcon); wxBitmap classIcon(classicon, wxBITMAP_TYPE_XPM); classIcon.SetMask(new wxMask(classicon, maskColor)); RegisterImage(AutoCompleteManager::Type_Class, classIcon); }
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 ) ); } }
/* TextEditor::setLanguage * Sets the text editor language *******************************************************************/ bool TextEditor::setLanguage(TextLanguage* lang) { // Check language was given if (!lang) { // Clear keywords SetKeyWords(0, ""); SetKeyWords(1, ""); SetKeyWords(2, ""); SetKeyWords(3, ""); // Clear autocompletion list autocomp_list.Clear(); } // Setup syntax hilighting if needed else { // Load word lists SetKeyWords(0, lang->getKeywordsList().Lower()); SetKeyWords(1, lang->getFunctionsList().Lower()); SetKeyWords(2, lang->getConstantsList().Lower()); SetKeyWords(3, lang->getConstantsList().Lower()); // Load autocompletion list autocomp_list = lang->getAutocompletionList(); } // Set lexer if (txed_syntax_hilight) SetLexer(wxSTC_LEX_CPPNOCASE); else SetLexer(wxSTC_LEX_NULL); // Update variables SetWordChars("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-.$"); this->language = lang; // Re-colour text Colourise(0, GetTextLength()); return true; }
fbtTextFile::fbtTextFile(fbtMainFrame* parent, fbtText* fp, int id) : wxStyledTextCtrl(parent, FBT_WINDOW_TXT), m_file(fp), m_parent(parent) { SetViewEOL(false); SetIndentationGuides(false); SetEdgeMode(wxSTC_EDGE_NONE); SetViewWhiteSpace(wxSTC_WS_INVISIBLE); SetReadOnly(false); SetTabWidth(4); SetWrapMode(wxSTC_WRAP_NONE); wxFont font (10, wxMODERN, wxNORMAL, wxNORMAL); StyleSetFont(wxSTC_STYLE_DEFAULT, font); StyleSetForeground(wxSTC_STYLE_DEFAULT, *wxBLACK); StyleSetBackground(wxSTC_STYLE_DEFAULT, *wxWHITE); StyleSetForeground(wxSTC_STYLE_LINENUMBER, wxColour (wxT("DARK GREY"))); StyleSetBackground(wxSTC_STYLE_LINENUMBER, *wxWHITE); StyleSetForeground(wxSTC_STYLE_INDENTGUIDE, wxColour (wxT("DARK GREY"))); SetMarginType(0, wxSTC_MARGIN_NUMBER); SetMarginWidth(0, TextWidth (wxSTC_STYLE_LINENUMBER, wxT("_99999"))); SetVisiblePolicy(wxSTC_VISIBLE_STRICT | wxSTC_VISIBLE_SLOP, 1); SetXCaretPolicy(wxSTC_CARET_EVEN | wxSTC_VISIBLE_STRICT | wxSTC_CARET_SLOP, 1); SetYCaretPolicy(wxSTC_CARET_EVEN | wxSTC_VISIBLE_STRICT | wxSTC_CARET_SLOP, 1); SetLexer(wxSTC_LEX_CPP); StyleSetForeground(wxSTC_C_COMMENT, COMMENT_COLOR); StyleSetForeground(wxSTC_C_COMMENTLINEDOC, COMMENT_COLOR); StyleSetForeground(wxSTC_C_COMMENTLINE, COMMENT_COLOR); StyleSetForeground(wxSTC_C_COMMENTDOC, COMMENT_COLOR); StyleSetForeground(wxSTC_C_NUMBER, NUMBER_COLOR); StyleSetForeground(wxSTC_C_OPERATOR, OPERATOR_COLOR); StyleSetForeground(wxSTC_C_WORD, WORD_COLOR); StyleSetForeground(wxSTC_C_PREPROCESSOR, WORD_COLOR); SetKeyWords(0, WORDS); SetSelBackground(true, wxColor(51, 94, 168)); SetSelForeground(true, wxColor(255, 255, 255)); m_file->m_textFile = this; m_file->m_flag |= fbtText::FILE_IS_OPEN; }
void CodeEdit::SetLuaLexer() { SetDefaultLexer(); SetLexer(wxSTC_LEX_LUA); const char* keywords = "and break do else elseif " "end false for function if " "in local nil not or " "repeat return then true until while "; SetKeyWords(1, keywords); }
/** * Init some default values */ void CScintillaBibWnd::Init() { CScintillaWnd::Init(); SetDisplayFolding(TRUE); SetDisplayLinenumbers(TRUE); SetDisplaySelection(FALSE); // BibTeX LoadLexerLib(LEXBIB_LIB); SetLexer(LEXBIB_NAME); SetWrap(SC_WRAP_WORD); // Setup some BibTeX styles SetForeground(SCE_L_COMMAND, RGB(0, 0, 160)); SetForeground(SCE_L_MATH, RGB(150, 150, 40)); SetForeground(SCE_L_COMMENT, RGB(0, 128, 0)); SetForeground(SCE_L_TAG, RGB(0, 0, 255)); SetItalic(SCE_L_COMMENT, TRUE); SetBold(SCE_BIB_ITEM, TRUE); SetBold(SCE_BIB_END, TRUE); SetForeground(SCE_BIB_END, RGB(255, 0, 0)); SetBold(SCE_BIB_START, TRUE); SetForeground(SCE_BIB_START, RGB(255, 0, 0)); SetForeground(SCE_BIB_FIELD, RGB(140, 0, 70)); SetForeground(SCE_BIB_KEY, RGB(140, 0, 0)); SetBold(SCE_BIB_KEY, TRUE); // We also need HTML SetBold(SCE_H_ATTRIBUTEUNKNOWN, FALSE); SetBold(SCE_H_ATTRIBUTE, FALSE); SetBold(SCE_H_SINGLESTRING, FALSE); SetBold(SCE_H_DOUBLESTRING, FALSE); SetBold(SCE_H_TAG, TRUE); SetBold(SCE_H_TAGUNKNOWN, TRUE); SetForeground(SCE_H_TAGUNKNOWN, RGB(255, 0, 0)); // SetItalic(SCE_H_COMMENT, TRUE); // Marker DefineMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_MINUS, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0xFF)); DefineMarker(SC_MARKNUM_FOLDER, SC_MARK_PLUS, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0)); DefineMarker(SC_MARKNUM_FOLDERSUB, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0)); DefineMarker(SC_MARKNUM_FOLDERTAIL, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0)); DefineMarker(SC_MARKNUM_FOLDEREND, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0)); DefineMarker(SC_MARKNUM_FOLDEROPENMID, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0)); DefineMarker(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0)); }
void AsmEditor::InitializePrefs() { SetMarginWidth (MARGIN_LINE_NUMBERS, 40); StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour (75, 75, 75) ); StyleSetBackground (wxSTC_STYLE_LINENUMBER, wxColour (220, 220, 220)); SetMarginType (MARGIN_LINE_NUMBERS, wxSTC_MARGIN_NUMBER); SetWrapMode (wxSTC_WRAP_NONE); //wxSTC_WRAP_WORD); // other choice is wxSCI_WRAP_NONE StyleClearAll(); SetLexer(wxSTC_LEX_CPP); // we want to use CPP format -- not ASM wxFont f(10, wxFONTFAMILY_DEFAULT, wxNORMAL, wxFONTWEIGHT_NORMAL, false, wxT("Consolas")); for( int i=0; i < wxSTC_STYLE_LASTPREDEFINED; ++i ) StyleSetFont( i, f ); StyleSetForeground( mySTC_C_DEFAULT, wxColour(0,0,0) ); StyleSetForeground( mySTC_C_COMMENT, wxColour(0,0,0) ); // /* */ comment StyleSetForeground( mySTC_C_COMMENTLINE, wxColour(0,128,0) ); // // comment StyleSetForeground( mySTC_C_COMMENTDOC, wxColour(0,0,0) ); // /** */ comment StyleSetForeground( mySTC_C_NUMBER, wxColour(90,90,90) ); StyleSetForeground( mySTC_C_WORD, wxColour(40,86,165) ); // custom 0 StyleSetForeground( mySTC_C_STRING, wxColour(163,21,21) ); StyleSetForeground( mySTC_C_CHARACTER, wxColour(163,21,21) ); StyleSetForeground( mySTC_C_UUID, wxColour(0,0,0) ); // needs color StyleSetForeground( mySTC_C_PREPROCESSOR, wxColour(0,0,0) ); // needs color StyleSetForeground( mySTC_C_OPERATOR, wxColour(150,0,0) ); StyleSetForeground( mySTC_C_IDENTIFIER, wxColour(0,0,0) ); StyleSetForeground( mySTC_C_STRINGEOL, wxColour(0,0,0) ); // needs color StyleSetForeground( mySTC_C_VERBATIM, wxColour(0,0,0) ); // needs color StyleSetForeground( mySTC_C_REGEX, wxColour(0,0,0) ); // needs color StyleSetForeground( mySTC_C_COMMENTLINEDOC, wxColour(0,128,0) ); StyleSetForeground( mySTC_C_WORD2, wxColour(150,0,150) ); // custom 1 StyleSetForeground( mySTC_C_COMMENTDOCKEYWORD, wxColour(0,0,0) ); // needs color StyleSetForeground( mySTC_C_COMMENTDOCKEYWORDERROR, wxColour(0,0,0) ); StyleSetForeground( mySTC_C_GLOBALCLASS, wxColour(0,0,0) ); // custom 3 StyleSetBold( mySTC_C_NUMBER, true ); StyleSetBold( mySTC_C_WORD2, true ); StyleSetBold( mySTC_C_WORD, true ); StyleSetFont( mySTC_C_COMMENT, f ); StyleSetFont( mySTC_C_COMMENTDOC, f ); }
void SourceView::setCppMode() { SetLexer (wxSTC_LEX_CPP); SetKeyWords (0, keywords.Get()); StyleClearAll (); SetMarginType (0, wxSTC_MARGIN_NUMBER); SetMarginWidth (0, 40); StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour( 32, 32, 32)); StyleSetBackground (wxSTC_STYLE_LINENUMBER, wxColour(192,192,192)); SetMarginType (1, wxSTC_MARGIN_RTEXT); SetMarginWidth (1, 50); StyleSetForeground (MARGIN_TEXT_STYLE, wxColour(255, 0, 0)); StyleSetBackground (MARGIN_TEXT_STYLE, wxColour(192,192,192)); StyleSetForeground (wxSTC_C_DEFAULT, wxColour(0,0,0) ); StyleSetForeground (wxSTC_C_STRING, wxColour(163,21,21)); StyleSetForeground (wxSTC_C_PREPROCESSOR, wxColour(0,0,255)); StyleSetForeground (wxSTC_C_IDENTIFIER, wxColour(0,0,0)); StyleSetForeground (wxSTC_C_WORD, wxColour(0,0,255)); StyleSetForeground (wxSTC_C_WORD2, wxColour(0,0,255)); StyleSetForeground (wxSTC_C_NUMBER, wxColour(0,0,0)); StyleSetForeground (wxSTC_C_CHARACTER, wxColour(0,0,0)); StyleSetForeground (wxSTC_C_COMMENT, wxColour(0,128,0)); StyleSetForeground (wxSTC_C_COMMENTLINE, wxColour(0,128,0)); StyleSetForeground (wxSTC_C_COMMENTDOC, wxColour(0,128,0)); StyleSetForeground (wxSTC_C_COMMENTDOCKEYWORD, wxColour(0,128,0)); StyleSetForeground (wxSTC_C_COMMENTDOCKEYWORDERROR, wxColour(0,128,0)); StyleSetBold(wxSTC_C_WORD, true); StyleSetBold(wxSTC_C_WORD2, true); StyleSetBold(wxSTC_C_COMMENTDOCKEYWORD, true); for (int i = wxSTC_C_DEFAULT; i<=wxSTC_C_PREPROCESSORCOMMENT; ++i) StyleSetFont(i, wxFont( wxFontInfo(10).FaceName("Consolas") ) ); }
ScriptEditor::ScriptEditor(wxWindow *parent, wxWindowID id, ScriptEditorPane *owner) : wxStyledTextCtrl(parent, id), owner(owner) { SetLexer(wxSTC_LEX_SQL); #if wxUSE_UNICODE SetCodePage(wxSTC_CP_UTF8); #endif SetKeyWords(0, WordList_keywords); SetKeyWords(1, WordList_database_objects); SetKeyWords(3, WordList_sqlplus); SetKeyWords(4, WordList_user1); SetKeyWords(5, WordList_user2); SetKeyWords(6, WordList_user3); SetKeyWords(7, WordList_user4); StyleClearAll(); // taken from sql.properties in scite StyleSetSpec(wxSTC_SQL_DEFAULT, _T("fore:#808080")); StyleSetSpec(wxSTC_SQL_COMMENT, _T("fore:#007f00")); // + font.comment StyleSetSpec(wxSTC_SQL_COMMENTLINE, _T("fore:#007f00")); // + font.comment StyleSetSpec(wxSTC_SQL_COMMENTDOC, _T("fore:#7f7f7f")); StyleSetSpec(wxSTC_SQL_NUMBER, _T("fore:#007f7f")); StyleSetSpec(wxSTC_SQL_WORD, _T("fore:#00007F,bold")); StyleSetSpec(wxSTC_SQL_STRING, _T("fore:#7f007f")); // + font.monospace StyleSetSpec(wxSTC_SQL_CHARACTER, _T("fore:#7f007f")); // + font.monospace StyleSetSpec(wxSTC_SQL_SQLPLUS, _T("fore:#7F7F00")); // colour.preproc StyleSetSpec(wxSTC_SQL_SQLPLUS_PROMPT, _T("fore:#007F00,back:#E0FFE0,eolfilled")); // + font.monospace StyleSetSpec(wxSTC_SQL_OPERATOR, _T("bold")); StyleSetSpec(wxSTC_SQL_IDENTIFIER, _T("")); StyleSetSpec(wxSTC_SQL_COMMENTLINEDOC, _T("fore:#007f00")); // + font.comment StyleSetSpec(wxSTC_SQL_WORD2, _T("fore:#b00040")); StyleSetSpec(wxSTC_SQL_COMMENTDOCKEYWORD, _T("fore:#3060a0")); // + font.code.comment.doc StyleSetSpec(wxSTC_SQL_COMMENTDOCKEYWORDERROR, _T("fore:#804020")); // + font.code.comment.doc StyleSetSpec(wxSTC_SQL_USER1, _T("fore:#4b0082")); StyleSetSpec(wxSTC_SQL_USER2, _T("fore:#b00040")); StyleSetSpec(wxSTC_SQL_USER3, _T("fore:#8b0000")); StyleSetSpec(wxSTC_SQL_USER4, _T("fore:#800080")); }
void LuaScriptEditorView::SetupSourceEditor() { StyleSetFont(STYLE_DEFAULT, "Courier New"); StyleSetSize(STYLE_DEFAULT, 11); SetEdgeColumn(100); SetEdgeMode(EDGE_LINE); SetMarginWidthN(0, 50); // margin 0 displays line numbers, but has default width 0 StyleSetFore(0, RGB(0x80, 0x80, 0x80)); StyleSetFore(1, RGB(0x00, 0x7f, 0x00)); StyleSetFore(2, RGB(0x00, 0x7f, 0x00)); StyleSetFore(3, RGB(0x7f, 0x7f, 0x7f)); StyleSetFore(4, RGB(0x00, 0x7f, 0x7f)); StyleSetFore(5, RGB(0x00, 0x00, 0x7f)); StyleSetFore(6, RGB(0x7f, 0x00, 0x7f)); StyleSetFore(7, RGB(0x7f, 0x00, 0x7f)); StyleSetFore(8, RGB(0x00, 0x7f, 0x7f)); StyleSetFore(9, RGB(0x7f, 0x7f, 0x7f)); StyleSetFore(10, RGB(0x00, 0x00, 0x00)); StyleSetFore(11, RGB(0x00, 0x00, 0x00)); StyleSetBold(5, true); StyleSetBold(10, true); SetLexer(SCLEX_LUA); // set Lua keywords and add RemotePhotoTool specific classes SetKeyWords(0, "and break do else elseif end for function if in " "local nil not or repeat return then until while " "App Sys Constants RemoteReleaseControl SourceDevice " "ImageProperty DeviceProperty ShootingMode Viewfinder " "BulbReleaseControl"); SetTabWidth(3); SetUseTabs(true); // only notify about text edits in SCEN_CHANGE messages SetModEventMask(SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT); }
void HLSLEditor::initialize() { StyleClearAll(); SetLexer(wxSCI_LEX_OMS); // Load keywords std::string path = "res/lexers/hlsl/keywords"; loadKeywords(path); // Set styles StyleSetForeground(wxSCI_OMS_DEFAULT, wxColour(0, 0, 0)); StyleSetFontAttr(wxSCI_OMS_DEFAULT, 10, wxT("Courier New"), false, false, false); StyleSetForeground(wxSCI_OMS_COMMENT, wxColour(0, 128, 0)); StyleSetFontAttr(wxSCI_OMS_COMMENT, 10, wxT("Courier New"), false, false, false); StyleSetForeground(wxSCI_OMS_PRIMARY, wxColour(0, 0, 255)); StyleSetFontAttr(wxSCI_OMS_PRIMARY, 10, wxT("Courier New"), true, false, false); StyleSetForeground(wxSCI_OMS_ATTRIBUTE, wxColour(136, 0, 0)); StyleSetFontAttr(wxSCI_OMS_ATTRIBUTE, 10, wxT("Courier New"), true, false, false); StyleSetForeground(wxSCI_OMS_VALUE, wxColour(160, 0, 160)); StyleSetFontAttr(wxSCI_OMS_VALUE, 10, wxT("Courier New"), false, false, false); StyleSetForeground(wxSCI_OMS_NUMBER, wxColour(0, 0, 128)); StyleSetFontAttr(wxSCI_OMS_NUMBER, 10, wxT("Courier New"), false, false, false); }
/** * create */ FbEditor::FbEditor(wxWindow *parent, wxWindowID id) : wxStyledTextCtrl(parent, id) { // the source context m_srcCtx = std::make_shared<SourceContext>(); // use container styling SetLexer(wxSTC_LEX_CONTAINER); // ingore case AutoCompSetIgnoreCase(true); // default setStyle(TokenStyle::Default, "black"); setStyle(TokenStyle::Identifier, "black"); setStyle(TokenStyle::Number, "blue"); setStyle(TokenStyle::Keyword, "purple", true); setStyle(TokenStyle::String, "red"); setStyle(TokenStyle::Operator, "brown", true); setStyle(TokenStyle::Comment, "gray", false, true); // error IndicatorSetStyle(ErrorIndicator, wxSTC_INDIC_SQUIGGLEPIXMAP); IndicatorSetForeground(ErrorIndicator, wxColour("red")); }
bool Edit::InitializePrefs (const wxString &name) { // initialize styles StyleClearAll(); LanguageInfo const* curInfo = NULL; // determine language bool found = false; int languageNr; for (languageNr = 0; languageNr < g_LanguagePrefsSize; languageNr++) { curInfo = &g_LanguagePrefs [languageNr]; if (curInfo->name == name) { found = true; break; } } if (!found) return false; // set lexer and language SetLexer (curInfo->lexer); m_language = curInfo; // set margin for line numbers SetMarginType (m_LineNrID, wxSTC_MARGIN_NUMBER); StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour (wxT("DARK GREY"))); StyleSetBackground (wxSTC_STYLE_LINENUMBER, *wxWHITE); SetMarginWidth (m_LineNrID, 0); // start out not visible // annotations style StyleSetBackground(ANNOTATION_STYLE, wxColour(244, 220, 220)); StyleSetForeground(ANNOTATION_STYLE, *wxBLACK); StyleSetSizeFractional(ANNOTATION_STYLE, (StyleGetSizeFractional(wxSTC_STYLE_DEFAULT)*4)/5); // default fonts for all styles! int Nr; for (Nr = 0; Nr < wxSTC_STYLE_LASTPREDEFINED; Nr++) { wxFont font(wxFontInfo(10).Family(wxFONTFAMILY_MODERN)); StyleSetFont (Nr, font); } // set common styles StyleSetForeground (wxSTC_STYLE_DEFAULT, wxColour (wxT("DARK GREY"))); StyleSetForeground (wxSTC_STYLE_INDENTGUIDE, wxColour (wxT("DARK GREY"))); // initialize settings if (g_CommonPrefs.syntaxEnable) { int keywordnr = 0; for (Nr = 0; Nr < STYLE_TYPES_COUNT; Nr++) { if (curInfo->styles[Nr].type == -1) continue; const StyleInfo &curType = g_StylePrefs [curInfo->styles[Nr].type]; wxFont font(wxFontInfo(curType.fontsize) .Family(wxFONTFAMILY_MODERN) .FaceName(curType.fontname)); StyleSetFont (Nr, font); if (curType.foreground) { StyleSetForeground (Nr, wxColour (curType.foreground)); } if (curType.background) { StyleSetBackground (Nr, wxColour (curType.background)); } StyleSetBold (Nr, (curType.fontstyle & mySTC_STYLE_BOLD) > 0); StyleSetItalic (Nr, (curType.fontstyle & mySTC_STYLE_ITALIC) > 0); StyleSetUnderline (Nr, (curType.fontstyle & mySTC_STYLE_UNDERL) > 0); StyleSetVisible (Nr, (curType.fontstyle & mySTC_STYLE_HIDDEN) == 0); StyleSetCase (Nr, curType.lettercase); const char *pwords = curInfo->styles[Nr].words; if (pwords) { SetKeyWords (keywordnr, pwords); keywordnr += 1; } } } // set margin as unused SetMarginType (m_DividerID, wxSTC_MARGIN_SYMBOL); SetMarginWidth (m_DividerID, 0); SetMarginSensitive (m_DividerID, false); // folding SetMarginType (m_FoldingID, wxSTC_MARGIN_SYMBOL); SetMarginMask (m_FoldingID, wxSTC_MASK_FOLDERS); StyleSetBackground (m_FoldingID, *wxWHITE); SetMarginWidth (m_FoldingID, 0); SetMarginSensitive (m_FoldingID, false); if (g_CommonPrefs.foldEnable) { SetMarginWidth (m_FoldingID, curInfo->folds != 0? m_FoldingMargin: 0); SetMarginSensitive (m_FoldingID, curInfo->folds != 0); SetProperty (wxT("fold"), curInfo->folds != 0? wxT("1"): wxT("0")); SetProperty (wxT("fold.comment"), (curInfo->folds & mySTC_FOLD_COMMENT) > 0? wxT("1"): wxT("0")); SetProperty (wxT("fold.compact"), (curInfo->folds & mySTC_FOLD_COMPACT) > 0? wxT("1"): wxT("0")); SetProperty (wxT("fold.preprocessor"), (curInfo->folds & mySTC_FOLD_PREPROC) > 0? wxT("1"): wxT("0")); SetProperty (wxT("fold.html"), (curInfo->folds & mySTC_FOLD_HTML) > 0? wxT("1"): wxT("0")); SetProperty (wxT("fold.html.preprocessor"), (curInfo->folds & mySTC_FOLD_HTMLPREP) > 0? wxT("1"): wxT("0")); SetProperty (wxT("fold.comment.python"), (curInfo->folds & mySTC_FOLD_COMMENTPY) > 0? wxT("1"): wxT("0")); SetProperty (wxT("fold.quotes.python"), (curInfo->folds & mySTC_FOLD_QUOTESPY) > 0? wxT("1"): wxT("0")); } SetFoldFlags (wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED | wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED); // set spaces and indentation SetTabWidth (4); SetUseTabs (false); SetTabIndents (true); SetBackSpaceUnIndents (true); SetIndent (g_CommonPrefs.indentEnable? 4: 0); // others SetViewEOL (g_CommonPrefs.displayEOLEnable); SetIndentationGuides (g_CommonPrefs.indentGuideEnable); SetEdgeColumn (80); SetEdgeMode (g_CommonPrefs.longLineOnEnable? wxSTC_EDGE_LINE: wxSTC_EDGE_NONE); SetViewWhiteSpace (g_CommonPrefs.whiteSpaceEnable? wxSTC_WS_VISIBLEALWAYS: wxSTC_WS_INVISIBLE); SetOvertype (g_CommonPrefs.overTypeInitial); SetReadOnly (g_CommonPrefs.readOnlyInitial); SetWrapMode (g_CommonPrefs.wrapModeInitial? wxSTC_WRAP_WORD: wxSTC_WRAP_NONE); return true; }
void IWnd_stc::UpdateStyle() { bool flag=param.nlang==tempp.nlang && (param.flags.get(FLAG_FOLD)==tempp.flags.get(FLAG_FOLD)) && (param.flags.get(FLAG_SYNTAX)==tempp.flags.get(FLAG_SYNTAX)) && param.nsize==tempp.nsize; param=tempp; if(flag) { _DoUpdateStyle(); return; } BitFlags& flags(param.flags); StcLangInfo& lf(StcManager::current().langs[param.nlang]); wxFont fontNr (param.nsize, wxMODERN, wxNORMAL, wxNORMAL,false,str2wx(param.sface)); for (int Nr = 0; Nr < wxSTC_STYLE_LASTPREDEFINED; Nr++) { StyleSetFont (Nr, fontNr); } if(!flags.get(FLAG_FOLD)) { ClearDocumentStyle(); } StyleClearAll(); SetLexer (lf.lexer); SetMarginType (StcManager::LINE_NR_ID, wxSTC_MARGIN_NUMBER); StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour (wxT("DARK GREY"))); StyleSetBackground (wxSTC_STYLE_LINENUMBER, *wxWHITE); SetMarginWidth (StcManager::LINE_NR_ID, 0); // set common styles StyleSetForeground (wxSTC_STYLE_DEFAULT, wxColour (wxT("DARK GREY"))); StyleSetForeground (wxSTC_STYLE_INDENTGUIDE, wxColour (wxT("DARK GREY"))); SetMarginType(StcManager::DIVIDER_ID, wxSTC_MARGIN_SYMBOL); SetMarginMask(StcManager::DIVIDER_ID, wxSTC_MASK_FOLDERS); SetMarginWidth (StcManager::DIVIDER_ID, 0); SetMarginSensitive (StcManager::DIVIDER_ID, false); // folding SetMarginType (StcManager::FOLDING_ID, wxSTC_MARGIN_SYMBOL); SetMarginMask (StcManager::FOLDING_ID, wxSTC_MASK_FOLDERS); StyleSetBackground (StcManager::FOLDING_ID, *wxWHITE); SetMarginWidth (StcManager::FOLDING_ID, 0); SetMarginSensitive (StcManager::FOLDING_ID, false); if (flags.get(FLAG_FOLD)) { SetMarginWidth (StcManager::FOLDING_ID,StcManager::FOLDING_MARGIN); SetMarginSensitive (StcManager::FOLDING_ID, true); SetPropertyEx ("fold", true); SetPropertyEx ("fold.comment",true); SetPropertyEx ("fold.compact",true); SetPropertyEx ("fold.preprocessor",true); SetPropertyEx ("fold.html", true); SetPropertyEx ("fold.html.preprocessor",true); SetPropertyEx ("fold.comment.python", true); SetPropertyEx ("fold.quotes.python", true); } else { SetMarginWidth (StcManager::DIVIDER_ID, StcManager::FOLDING_MARGIN); } SetFoldFlags (wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED| wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED); if (flags.get(FLAG_SYNTAX)) { int keywordnr = 0; for(StcLangInfo::map_type::iterator it=lf.mapStyles.begin();it!=lf.mapStyles.end();++it) { int Nr=(*it).first; StcLangInfo::StyleWords& s((*it).second); StcStyleInfo& curType(StcManager::current().style[s.id]); wxFont font (param.nsize, wxMODERN, wxNORMAL, wxNORMAL, false,str2wx(curType.fontname)); StyleSetFont (Nr, font); if (curType.foreground!=wxEmptyString) { StyleSetForeground (Nr, wxColour (curType.foreground.c_str())); } if (curType.background!=wxEmptyString) { StyleSetBackground (Nr, wxColour (curType.background.c_str())); } StyleSetBold (Nr, curType.fontstyle.get(StcManager::STYLE_BOLD)); StyleSetItalic (Nr, curType.fontstyle.get(StcManager::STYLE_ITALIC)); StyleSetUnderline (Nr, curType.fontstyle.get(StcManager::STYLE_UNDERL)); StyleSetVisible (Nr, !curType.fontstyle.get(StcManager::STYLE_HIDDEN)); //StyleSetCase (Nr, curType.lettercase); if (s.words!="") { SetKeyWords (keywordnr, str2wx(s.words)); keywordnr += 1; } } } _DoUpdateStyle(); Colourise(0,this->GetLastPosition()); }
OutputCtrl::OutputCtrl( wxWindow* parent, wxWindowID id, const wxString& name, const wxPoint& pos, const wxSize& size, long style ) : wxStyledTextCtrl(), m_Selected( -1 ) { wxStyledTextCtrl::Create( parent, id, wxDefaultPosition, wxDefaultSize, wxVSCROLL | wxSTATIC_BORDER ); UsePopUp(false); // initialize styles StyleClearAll(); // Set the lexer language SetLexer( wxSTC_LEX_TEX ); // Clear the zoom keys and mouse mapping. CmdKeyClear( wxSTC_KEY_ADD, wxSTC_SCMOD_CTRL ); CmdKeyClear( wxSTC_KEY_SUBTRACT, wxSTC_SCMOD_CTRL ); CmdKeyClear( wxSTC_KEY_DIVIDE, wxSTC_SCMOD_CTRL ); StyleClearAll(); // TODO: Make the font style a configuration option or use some OS default! wxFont* font = wxTheFontList->FindOrCreateFont( 8, wxDEFAULT, wxNORMAL, wxNORMAL, false, "Courier New" ); for ( int i = 0; i < wxSTC_STYLE_LASTPREDEFINED; i++ ) StyleSetFont( i, *font ); StyleSetBackground( 1, wxColour( 255, 0, 0 ) ); StyleSetForeground( 1, wxColour( 255, 255, 255 ) ); StyleSetBackground( 2, wxColour( 255, 255, 255 ) ); StyleSetForeground( 2, wxColour( 255, 0, 0 ) ); /* StyleSetBackground( wxSTC_STYLE_DEFAULT, tsGetPrefs().GetBgColor() ); SetCaretForeground( tsGetPrefs().GetDefaultColor() ); StyleSetForeground( wxSTC_TCS_DEFAULT, tsGetPrefs().GetDefaultColor() ); StyleSetBackground( wxSTC_TCS_DEFAULT, tsGetPrefs().GetBgColor() ); SetSelBackground( 1, tsGetPrefs().GetSelBgColor() ); SetSelForeground( 1, tsGetPrefs().GetSelColor() ); */ IndicatorSetForeground( 0, wxColour( 255, 0, 0 ) ); //SetTabWidth( tsGetPrefs().GetTabWidth() ); // setup the caret. SetCaretWidth( 2 ); SetVisiblePolicy( wxSTC_VISIBLE_STRICT | wxSTC_VISIBLE_SLOP, 1 ); SetXCaretPolicy( wxSTC_CARET_EVEN | wxSTC_VISIBLE_STRICT | wxSTC_CARET_SLOP, 1 ); SetYCaretPolicy( wxSTC_CARET_EVEN | wxSTC_VISIBLE_STRICT | wxSTC_CARET_SLOP, 1 ); // Set the margin. SetMarginLeft( 0 ); SetMarginType( 0, wxSTC_MARGIN_SYMBOL ); SetMarginWidth( 0, 12 ); SetMarginWidth( 1, 0 ); SetMarginWidth( 2, 0 ); SetMarginSensitive( 0, false ); //StyleSetBackground( wxSTC_STYLE_LINENUMBER, tsGetPrefs().GetBgColor() ); SetWrapMode( wxSTC_WRAP_NONE ); SetLayoutCache( wxSTC_CACHE_PAGE ); SetReadOnly( true ); UpdatePrefs(); // Create the regular expression here once. // TODO: This possibly needs fixing for non Win32 platforms. m_ErrorExpr.Compile( "([^*?:<>|]*)[ \t]Line:[ \t]([0-9]*)[ \t]-[ \t](.*)", wxRE_ADVANCED | wxRE_ICASE ); wxASSERT( m_ErrorExpr.IsValid() ); m_WarnExpr.Compile( "([^*?:<>|]*)[ \t][(]([0-9]*)[)]:[ \t](.*)", wxRE_ADVANCED | wxRE_ICASE ); wxASSERT( m_WarnExpr.IsValid() ); }
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()); }
void ScriptEditCtrl::Impl::PreSubclassWindow() { self_->m_hWnd = m_hWnd; // expose HWND SetupDirectAccess(); // If we are running as Unicode, then use the UTF8 codepage #ifdef _UNICODE SetCodePage(SC_CP_UTF8); #endif SetLexer(SCLEX_LUA); StyleSetFont(STYLE_DEFAULT, "Lucida Console"); StyleSetSize(STYLE_DEFAULT, 10); SetKeyWords(0, LuaKeywords); SetKeyWords(1, LuaFunctions); if (enable_input_attribs_) SetKeyWords(2, LuaUser); SetKeyWords(3, ConcatAttributes().c_str()); COLORREF comment= RGB(0,128,128); COLORREF string= RGB(128,128,0); StyleSetFore(SCE_LUA_COMMENT, comment); StyleSetFore(SCE_LUA_COMMENTLINE, comment); StyleSetFore(SCE_LUA_COMMENTDOC, comment); StyleSetFore(SCE_LUA_NUMBER, RGB(0,0,255)); StyleSetFore(SCE_LUA_WORD, RGB(34,78,160)); // keywords StyleSetFore(SCE_LUA_STRING, string); StyleSetFore(SCE_LUA_CHARACTER, string); StyleSetFore(SCE_LUA_LITERALSTRING, string); StyleSetFore(SCE_LUA_WORD2, RGB(53,113,202)); // functions StyleSetFore(SCE_LUA_WORD3, RGB(124,37,203)); // test & number StyleSetBack(SCE_LUA_WORD3, CalcColor(::GetSysColor(COLOR_WINDOW), RGB(0,0,255), 0.95f)); StyleSetFore(SCE_LUA_WORD4, RGB(164,97,49)); // todo: attributes StyleSetFont(SCE_LUA_WORD, "Lucida Console"); StyleSetSize(SCE_LUA_WORD, 10); StyleSetBold(SCE_LUA_WORD, true); //#define SCE_LUA_PREPROCESSOR 9 //#define SCE_LUA_OPERATOR 10 //#define SCE_LUA_IDENTIFIER 11 //#define SCE_LUA_STRINGEOL 12 //#define SCE_LUA_WORD2 13 //#define SCE_LUA_WORD3 14 //#define SCE_LUA_WORD4 15 //#define SCE_LUA_WORD5 16 //#define SCE_LUA_WORD6 17 //#define SCE_LUA_WORD7 18 //#define SCE_LUA_WORD8 19 Colorize(0, -1); //MarkerDefine(MARKER_POINTER, SC_MARK_ARROW); //MarkerSetBack(MARKER_POINTER, RGB(255,255,0)); //MarkerDefine(MARKER_BREAKPOINT, SC_MARK_ROUNDRECT); //MarkerSetBack(MARKER_BREAKPOINT, RGB(0,0,255)); //MarkerDefine(MARKER_ERROR, SC_MARK_ARROW); //MarkerSetBack(MARKER_ERROR, RGB(255,0,0)); int width= 0; SetMarginWidthN(1, width); SetScrollWidthTracking(true); SetScrollWidth(1); SetWrapMode(SC_WRAP_WORD); SetWrapVisualFlags(SC_WRAPVISUALFLAG_END); SetSelBack(true, CalcShade(::GetSysColor(COLOR_HIGHLIGHT), 50.0f)); SetTabWidth(4); SetIndent(4); DWORD pixels= 1; ::SystemParametersInfo(SPI_GETCARETWIDTH, 0, &pixels, 0); SetCaretWidth(pixels); // hwnd is attached, but message processing is not working yet, we are not yet subclassed, // so postpone this WM_NCCALCSIZE call: PostMessage(WM_APP+1234); }
wxExSTCShell::wxExSTCShell( wxWindow* parent, const wxString& prompt, const wxString& command_end, bool echo, int commands_save_in_config, const wxString& lexer, long menu_flags, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) : wxExSTC( parent, wxEmptyString, STC_WIN_NO_INDICATOR, wxEmptyString, // title menu_flags, id, pos, size, style) , m_Command(wxEmptyString) , m_CommandEnd((command_end == wxEmptyString ? GetEOL(): command_end)) , m_CommandStartPosition(0) , m_Echo(echo) // take a char that is not likely to appear inside commands , m_CommandsInConfigDelimiter(wxUniChar(0x03)) , m_CommandsSaveInConfig(commands_save_in_config) , m_Prompt(prompt) , m_Handler(parent) , m_Enabled(true) { // Override defaults from config. SetEdgeMode(wxSTC_EDGE_NONE); ResetMargins(false); // do not reset divider margin SetName("SHELL"); // Start with a prompt. Prompt(); if (m_CommandsSaveInConfig > 0) { // Get all previous commands. wxStringTokenizer tkz(wxConfigBase::Get()->Read("Shell"), m_CommandsInConfigDelimiter); while (tkz.HasMoreTokens()) { const wxString val = tkz.GetNextToken(); m_Commands.push_front(val); } } // Take care that m_CommandsIterator is valid. m_CommandsIterator = m_Commands.end(); EnableShell(true); SetLexer(lexer); }