bool Edit::LoadFile (const wxString &filename) { // load file in edit and clear undo if (!filename.empty()) m_filename = filename; // wxFile file (m_filename); // if (!file.IsOpened()) return false; ClearAll (); // long lng = file.Length (); // if (lng > 0) { // wxString buf; // wxChar *buff = buf.GetWriteBuf (lng); // file.Read (buff, lng); // buf.UngetWriteBuf (); // InsertText (0, buf); // } // file.Close(); wxStyledTextCtrl::LoadFile(m_filename); EmptyUndoBuffer(); // determine lexer language wxFileName fname (m_filename); InitializePrefs (DeterminePrefs (fname.GetFullName())); return true; }
Edit::Edit (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style) : wxStyledTextCtrl (parent, id, pos, size, style) { m_filename = wxEmptyString; m_LineNrID = 0; m_DividerID = 1; m_FoldingID = 2; // initialize language m_language = NULL; // default font for all styles SetViewEOL (g_CommonPrefs.displayEOLEnable); SetIndentationGuides (g_CommonPrefs.indentGuideEnable); 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); wxFont font(wxFontInfo(10).Family(wxFONTFAMILY_MODERN)); 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"))); InitializePrefs (DEFAULT_LANGUAGE); // set visibility 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); // markers MarkerDefine (wxSTC_MARKNUM_FOLDER, wxSTC_MARK_DOTDOTDOT, wxT("BLACK"), wxT("BLACK")); MarkerDefine (wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_ARROWDOWN, wxT("BLACK"), wxT("BLACK")); MarkerDefine (wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_EMPTY, wxT("BLACK"), wxT("BLACK")); MarkerDefine (wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_DOTDOTDOT, wxT("BLACK"), wxT("WHITE")); MarkerDefine (wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_ARROWDOWN, wxT("BLACK"), wxT("WHITE")); MarkerDefine (wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_EMPTY, wxT("BLACK"), wxT("BLACK")); MarkerDefine (wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_EMPTY, wxT("BLACK"), wxT("BLACK")); // annotations AnnotationSetVisible(wxSTC_ANNOTATION_BOXED); // miscellaneous m_LineNrMargin = TextWidth (wxSTC_STYLE_LINENUMBER, wxT("_999999")); m_FoldingMargin = 16; CmdKeyClear (wxSTC_KEY_TAB, 0); // this is done by the menu accelerator key SetLayoutCache (wxSTC_CACHE_PAGE); UsePopUp(wxSTC_POPUP_ALL); }
bool Edit::LoadFile (const wxString &filename) { // load file in edit and clear undo if (!filename.empty()) m_filename = filename; wxStyledTextCtrl::LoadFile(m_filename); EmptyUndoBuffer(); // determine lexer language wxFileName fname (m_filename); InitializePrefs (DeterminePrefs (fname.GetFullName())); return true; }
NS_IMETHODIMP sbIPDLibrary::SetSyncSettings(sbIDeviceLibrarySyncSettings * aSyncSettings) { NS_ENSURE_ARG_POINTER(aSyncSettings); nsresult rv; rv = InitializePrefs(); NS_ENSURE_SUCCESS(rv, rv); rv = sbDeviceLibrary::SetSyncSettings(aSyncSettings); NS_ENSURE_SUCCESS(rv, rv); return NS_OK; }
AsmEditor::AsmEditor( wxWindow *parent, wxWindowID id/*=wxID_ANY*/, const wxPoint &pos/*=wxDefaultPosition*/, const wxSize &size/*=wxDefaultSize*/, long style/*=0*/, const wxString &name/*=wxSTCNameStr*/ ) : wxStyledTextCtrl(parent, id, pos, size, style, name) { InitializePrefs(); SetKeyWords( 0, wordList1 ); SetKeyWords( 1, wordList2 ); SetTabWidth(4); SetUseTabs(false); Connect(wxEVT_STC_MARGINCLICK, wxStyledTextEventHandler(AsmEditor::OnMarginClick), NULL, this); Connect(wxEVT_MOUSEWHEEL,(wxObjectEventFunction)&AsmEditor::OnMouseWheel,NULL,this); }
NS_IMETHODIMP sbIPDLibrary::GetSyncFolderListByType(PRUint32 aContentType, nsIArray ** aFolderList) { NS_ENSURE_ARG_POINTER(aFolderList); nsresult rv; rv = InitializePrefs(); NS_ENSURE_SUCCESS(rv, rv); rv = sbDeviceLibrary::GetSyncFolderListByType(aContentType, aFolderList); NS_ENSURE_SUCCESS(rv, rv); return NS_OK; }
void Edit::OnHighlightLang (wxCommandEvent &event) { InitializePrefs (g_LanguagePrefs [event.GetId() - myID_HIGHLIGHTFIRST].name); }
Edit::Edit (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style) : wxStyledTextCtrl (parent, id, pos, size, style) { m_filename = wxEmptyString; m_LineNrID = 0; m_DividerID = 1; m_FoldingID = 2; m_dlgFind = NULL; m_dlgReplace = NULL; // initialize language m_language = NULL; // Use all the bits in the style byte as styles, not indicators. SetStyleBits(8); // default font for all styles SetViewEOL (g_CommonPrefs.displayEOLEnable); SetIndentationGuides (g_CommonPrefs.indentGuideEnable); 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); 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"))); InitializePrefs (_("Objeck")); // set visibility 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); // markers MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUS, wxT("WHITE"), wxT("LIGHT GREY")); MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_BOXMINUS, wxT("WHITE"), wxT("LIGHT GREY")); MarkerDefine(wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_VLINE, wxT("WHITE"), wxT("LIGHT BLUE")); MarkerDefine(wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_BOXPLUSCONNECTED, wxT("WHITE"), wxT("LIGHT GREY")); MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_BOXMINUSCONNECTED, wxT("WHITE"), wxT("LIGHT GREY")); MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNER, wxT("WHITE"), wxT("LIGHT BLUE")); MarkerDefine(wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_LCORNER, wxT("WHITE"), wxT("LIGHT BLUE")); // miscellaneous m_LineNrMargin = TextWidth (wxSTC_STYLE_LINENUMBER, wxT("_999999")); m_FoldingMargin = 16; CmdKeyClear (wxSTC_KEY_TAB, 0); // this is done by the menu accelerator key SetLayoutCache(wxSTC_CACHE_PAGE); }
Edit::Edit (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style) : wxStyledTextCtrl (parent, id, pos, size, style) { m_findReplace = NULL; m_filename = wxEmptyString; m_LineNrID = 0; m_DividerID = 1; m_FoldingID = 2; // initialize language m_language = NULL; // Use all the bits in the style byte as styles, not indicators. SetStyleBits(8); #ifdef __WXOSX_COCOA__ SetZoom(4); #endif m_modified = false; SetModEventMask(wxSTC_MOD_INSERTTEXT | wxSTC_MOD_DELETETEXT); // setup unicode support SetKeysUnicode(true); SetCodePage(wxSTC_CP_UTF8); wxConvCurrent = &wxConvUTF8; // default font for all styles SetViewEOL (g_CommonPrefs.displayEOLEnable); SetIndentationGuides (g_CommonPrefs.indentGuideEnable); 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); 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"))); InitializePrefs (DEFAULT_LANGUAGE); // set visibility 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); // markers // ---- Enable code folding SetMarginType(MARGIN_FOLD, wxSTC_MARGIN_SYMBOL); SetMarginWidth(MARGIN_FOLD, 15); SetMarginMask(MARGIN_FOLD, wxSTC_MASK_FOLDERS); SetMarginSensitive(MARGIN_FOLD, true); // Properties found from http://www.scintilla.org/SciTEDoc.html SetProperty(wxT("fold"), wxT("1")); SetProperty(wxT("fold.comment"), wxT("1")); SetProperty(wxT("fold.compact"), wxT("1")); SetProperty(wxT("fold"), wxT("1")); SetProperty(wxT("fold.comment"), wxT("1")); SetProperty(wxT("fold.compact"), wxT("1")); SetProperty(wxT("fold.preprocessor"), wxT("1")); MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUS, wxT("WHITE"), wxT("GREY")); MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_BOXMINUS, wxT("WHITE"), wxT("GREY")); MarkerDefine(wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_VLINE, wxT("WHITE"), wxT("GREY")); MarkerDefine(wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_BOXPLUSCONNECTED, wxT("WHITE"), wxT("GREY")); MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_BOXMINUSCONNECTED, wxT("WHITE"), wxT("GREY")); MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNER, wxT("WHITE"), wxT("GREY")); MarkerDefine(wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_LCORNER, wxT("WHITE"), wxT("GREY")); SetFoldFlags(wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED | wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED); // miscellaneous m_LineNrMargin = TextWidth (wxSTC_STYLE_LINENUMBER, wxT("_999999")); m_FoldingMargin = 16; SetLayoutCache (wxSTC_CACHE_PAGE); }