1 /* 2 FXiTe - The Free eXtensIble Text Editor 3 Copyright (c) 2009-2012 Jeffrey Pohlmeyer <yetanothergeek@gmail.com> 4 5 This program is free software; you can redistribute it and/or modify it 6 under the terms of the GNU General Public License version 3 as 7 published by the Free Software Foundation. 8 9 This software is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, write to the Free Software 16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 19 20 #ifndef APPWIN_BASE_H 21 #define APPWIN_BASE_H 22 23 #include "histbox.h" 24 25 class SciDoc; 26 class DocTab; 27 class DocTabs; 28 class SearchDialogs; 29 class FileDialogs; 30 class SettingsBase; 31 class Settings; 32 class PrefsDialog; 33 class UserMenu; 34 class MacroRunner; 35 class MacroRecorder; 36 class BackupMgr; 37 class ToolsDialog; 38 class ToolBarFrame; 39 class OutputList; 40 class StatusBar; 41 class MainMenu; 42 class AutoCompleter; 43 class CommandUtils; 44 45 class TopWindowBase: public MainWinWithClipBrd { FXDECLARE(TopWindowBase)46 FXDECLARE(TopWindowBase) 47 protected: 48 TopWindowBase(){} 49 SciDoc* recording; 50 FXToolTip* tips; 51 FXVerticalFrame* outerbox; 52 FXVerticalFrame* innerbox; 53 MainMenu* menubar; 54 StatusBar* statusbar; 55 DocTabs* tabbook; 56 FXSplitter* hsplit; 57 OutputList* outlist; 58 ToolBarFrame* toolbar; 59 SearchDialogs* srchdlgs; 60 FileDialogs* filedlgs; 61 AutoCompleter* completions; 62 SettingsBase* prefs; 63 MacroRecorder* recorder; 64 BackupMgr* backups; 65 CommandUtils* cmdutils; 66 FXint stale_ticks; 67 FXint save_ticks; 68 FXString session_data; 69 FXID active_widget; 70 bool destroying; 71 bool close_all_confirmed; 72 bool kill_commands_confirmed; 73 bool command_timeout; 74 FXint need_status; 75 FXString save_hook; 76 FXString bookmarked_file; 77 DocTab* bookmarked_tab; 78 long bookmarked_pos; 79 bool skipfocus; 80 void Closing(bool is_closing); 81 void SetTabDirty(SciDoc* sci, bool dirty); 82 void SetTabLocked(SciDoc* sci, bool locked); 83 void RescanUserMenu(); 84 void ClosedDialog(); 85 bool ShowSaveAsDlg(SciDoc* sci); 86 void ShowInsertFileDlg(); 87 void ShowFilterDialog(bool is_filter); 88 void ShowCommandDialog(); 89 void ShowToolManagerDialog(); 90 void ShowPrefsDialog(); 91 void ToggleRecorder(); 92 bool FilterSelection(SciDoc* sci, const FXString &cmd, const FXString &input); 93 bool RunCommand(SciDoc* sci, const FXString &cmd); 94 bool RunMacro(const FXString &script, bool isfilename); 95 bool RunHookScript(const char* hookname); 96 void FileSaved(SciDoc* saved); 97 void AskReload(); 98 bool SaveAll(bool break_on_fail); 99 bool CloseAll(bool close_last); 100 const FXString &SessionFile(); 101 bool SetLanguage(FXMenuRadio* mnu); 102 void SetBookmark(); 103 void EnableUserFilters(bool enabled); 104 void OpenSelected(); 105 bool NewFile(bool hooked); 106 void ChangeCase(bool to_upper); 107 void FindTag(); 108 void GoToBookmark(); 109 void UpdateToolbar(); 110 void UpdateTitle(long line, long col); 111 void InvertColors(bool inverted); 112 public: 113 TopWindowBase(FXApp* a); 114 virtual ~TopWindowBase(); 115 static TopWindowBase* instance(); 116 virtual void create(); 117 virtual FXbool close(FXbool notify=false); 118 void ParseCommands(FXString &commands); 119 bool Closing(); 120 bool IsMacroCancelled(); 121 static const FXString& ConfigDir(); 122 static const FXString& Connector(); Prefs()123 Settings* Prefs() { return (Settings*)prefs; } 124 SciDoc* ControlDoc(); 125 SciDoc* FocusedDoc(); 126 bool OpenFile(const char* caption, const char* rowcol, bool readonly, bool hooked); 127 bool CloseFile(bool close_last, bool hooked); 128 int IsFileOpen(const FXString &filename, bool activate); 129 FXString* NamedFiles() const; 130 void Cut(); 131 void Copy(); 132 void Paste(); Tabs()133 DocTabs* Tabs() {return tabbook; } FileDlgs()134 FileDialogs* FileDlgs() { return filedlgs; } 135 FXMenuCaption* TagFiles(); 136 void AddFileToTagsMenu(const FXString &filename); 137 bool RemoveFileFromTagsMenu(const FXString &filename); 138 bool SetLanguage(const FXString &name); 139 void SetKillCommandAccelKey(FXHotKey acckey); 140 void RemoveTBarBtnData(void* p); 141 bool SetReadOnly(SciDoc* sci, bool rdonly); 142 void AddOutput(const FXString&line); 143 void ClearOutput(); 144 UserMenu** UserMenus() const; 145 void FindText(const char* searchstring, FXuint searchmode, bool forward); 146 void FindAndReplace(const char*searchfor, const char*replacewith, FXuint searchmode, bool forward); 147 void ReplaceAllInSelection(const char*searchfor, const char*replacewith, FXuint searchmode); 148 void ReplaceAllInDocument(const char*searchfor, const char*replacewith, FXuint searchmode); 149 void AdjustIndent(SciDoc* sci,char ch); 150 bool FoundBookmarkedTab(DocTab* tab); Destroying()151 bool Destroying() { return destroying; } ActiveWidget(FXID aw)152 void ActiveWidget(FXID aw) { active_widget=aw; } 153 void SetWordWrap(SciDoc* sci, bool wrapped); 154 void ShowLineNumbers(bool showit); 155 void ShowStatusBar(bool showit); 156 void ShowOutputPane(bool showit); 157 void ShowWhiteSpace(bool showit); 158 void ShowToolbar(bool showit); 159 void ShowMargin(bool showit); 160 void ShowIndent(bool showit); 161 void ShowCaretLine(bool showit); 162 long onTimer( FXObject* o, FXSelector sel, void* p ); 163 long onCloseWait( FXObject* o, FXSelector sel, void* p ); 164 long CheckStale( FXObject* o, FXSelector sel, void* p ); 165 long CheckStyle( FXObject* o, FXSelector sel, void* p ); 166 long onFocusIn( FXObject* o, FXSelector sel, void* p ); 167 long onFocusDoc( FXObject* o, FXSelector sel, void* p ); 168 long onFocusSci( FXObject* o, FXSelector sel, void* p ); 169 enum { 170 ID_TIMER = MainWinWithClipBrd::ID_LAST, 171 ID_CLOSEWAIT, 172 ID_CHECK_STALE, 173 ID_CHECK_STYLE, 174 ID_FOCUS_DOC, 175 ID_SCINTILLA, 176 ID_LAST 177 }; 178 }; 179 180 #endif 181 182