/** * 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)); }
///////////////////////////////////// // @mfunc init the view with reasonable defaults // @rvalue void | not used // void CScintillaWnd::Init(void) { // clear all text styles SendMessage(SCI_CLEARDOCUMENTSTYLE, 0, 0); // set the number of styling bits to 7 - the asp/html views need a lot of styling - default is 5 // If you leave the default you will see twiggle lines instead of ASP code SendMessage(SCI_SETSTYLEBITS, 7, 0); // set the display for indentation guides to on - this displays virtical dotted lines from the beginning of // a code block to the end of the block SendMessage(SCI_SETINDENTATIONGUIDES, true, 0); // set tabwidth to 3 SendMessage(SCI_SETTABWIDTH,3,0); // set indention to 3 SendMessage(SCI_SETINDENT,3,0); // set the caret blinking time to 400 milliseconds SendMessage(SCI_SETCARETPERIOD,400,0); // source folding section // tell the lexer that we want folding information - the lexer supplies "folding levels" SendMessage(SCI_SETPROPERTY, (WPARAM)_T("fold"), (LPARAM)_T("1")); SendMessage(SCI_SETPROPERTY, (WPARAM)_T("fold.html"), (LPARAM)_T("1")); SendMessage(SCI_SETPROPERTY, (WPARAM)_T("fold.html.preprocessor"), (LPARAM)_T("1")); SendMessage(SCI_SETPROPERTY, (WPARAM)_T("fold.comment"), (LPARAM)_T("1")); SendMessage(SCI_SETPROPERTY, (WPARAM)_T("fold.at.else"), (LPARAM)_T("1")); SendMessage(SCI_SETPROPERTY, (WPARAM)_T("fold.flags"), (LPARAM)_T("1")); SendMessage(SCI_SETPROPERTY, (WPARAM)_T("fold.preprocessor"), (LPARAM)_T("1")); SendMessage(SCI_SETPROPERTY, (WPARAM)_T("styling.within.preprocessor"), (LPARAM)_T("1")); SendMessage(SCI_SETPROPERTY, (WPARAM)_T("asp.default.language"), (LPARAM)_T("1")); // Tell scintilla to draw folding lines UNDER the folded line SendMessage(SCI_SETFOLDFLAGS, 16,0); // Set margin 2 = folding margin to display folding symbols SendMessage(SCI_SETMARGINMASKN, 2, SC_MASK_FOLDERS); // allow notifications for folding actions SendMessage(SCI_SETMODEVENTMASK, SC_MOD_INSERTTEXT|SC_MOD_DELETETEXT, 0); //SendMessage(SCI_SETMODEVENTMASK, SC_MOD_CHANGEFOLD|SC_MOD_INSERTTEXT|SC_MOD_DELETETEXT, 0); // make the folding margin sensitive to folding events = if you click into the margin you get a notification event SendMessage(SCI_SETMARGINSENSITIVEN, 2, true); // define a set of markers to display folding symbols SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPEN, SC_MARK_MINUS); SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDER, SC_MARK_PLUS); SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDERSUB, SC_MARK_EMPTY); SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDERTAIL, SC_MARK_EMPTY); SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDEREND, SC_MARK_EMPTY); SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPENMID, SC_MARK_EMPTY); SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_EMPTY); // set the forground color for some styles SendMessage(SCI_STYLESETFORE, 0, RGB(0,0,0)); SendMessage(SCI_STYLESETFORE, 2, RGB(0,64,0)); SendMessage(SCI_STYLESETFORE, 5, RGB(0,0,255)); SendMessage(SCI_STYLESETFORE, 6, RGB(200,20,0)); SendMessage(SCI_STYLESETFORE, 9, RGB(0,0,255)); SendMessage(SCI_STYLESETFORE, 10, RGB(255,0,64)); SendMessage(SCI_STYLESETFORE, 11, RGB(0,0,0)); // set the backgroundcolor of brace highlights SendMessage(SCI_STYLESETBACK, STYLE_BRACELIGHT, RGB(0,255,0)); // set end of line mode to CRLF SendMessage(SCI_CONVERTEOLS, 2, 0); SendMessage(SCI_SETEOLMODE, 2, 0); //SendMessage(SCI_SETVIEWEOL, true, 0); // set markersymbol for marker type 0 - bookmark SendMessage(SCI_MARKERDEFINE, 0, SC_MARK_CIRCLE); // display all margins SetDisplayLinenumbers(true); SetDisplayFolding(true); SetDisplaySelection(true); }