1 #ifndef FILEZILLA_INTERFACE_MAINFRM_HEADER 2 #define FILEZILLA_INTERFACE_MAINFRM_HEADER 3 4 #include "statusbar.h" 5 #include "../include/engine_context.h" 6 #include "../include/notification.h" 7 #include "serverdata.h" 8 9 #include <wx/timer.h> 10 11 #ifndef __WXMAC__ 12 #include <wx/taskbar.h> 13 #endif 14 15 #include "../commonui/updater.h" 16 17 #include <list> 18 19 class CAsyncRequestQueue; 20 class CContextControl; 21 class CertStore; 22 class CMainFrameStateEventHandler; 23 class CMenuBar; 24 class CQueue; 25 class CQueueView; 26 class CQuickconnectBar; 27 class Site; 28 class CSplitterWindowEx; 29 class CStatusView; 30 class CState; 31 class CToolBar; 32 class CWindowStateManager; 33 34 class CMainFrame final : public wxNavigationEnabled<wxFrame>, public COptionChangeEventHandler 35 #if FZ_MANUALUPDATECHECK 36 , protected CUpdateHandler 37 #endif 38 { 39 friend class CMainFrameStateEventHandler; 40 public: 41 CMainFrame(); 42 virtual ~CMainFrame(); 43 GetStatusView()44 CStatusView* GetStatusView() { return m_pStatusView; } GetQueue()45 CQueueView* GetQueue() { return m_pQueueView; } GetQuickconnectBar()46 CQuickconnectBar* GetQuickconnectBar() { return m_pQuickconnectBar; } 47 48 // Window size and position as well as pane sizes 49 void RememberSplitterPositions(); 50 bool RestoreSplitterPositions(); 51 void SetDefaultSplitterPositions(); 52 53 void CheckChangedSettings(); 54 55 void ConnectNavigationHandler(wxEvtHandler* handler); 56 GetStatusBar()57 wxStatusBar* GetStatusBar() const { return m_pStatusBar; } 58 59 void ProcessCommandLine(); 60 61 void PostInitialize(); 62 GetContextControl()63 CContextControl* GetContextControl() { return m_pContextControl; } 64 65 bool ConnectToSite(Site & data, Bookmark const& bookmark, CState* pState = 0); 66 GetEngineContext()67 CFileZillaEngineContext& GetEngineContext() { return m_engineContext; } 68 void OnEngineEvent(CFileZillaEngine* engine); 69 70 private: 71 void UpdateLayout(); 72 void FixTabOrder(); 73 74 bool CloseDialogsAndQuit(wxCloseEvent &event); 75 bool CreateMenus(); 76 void CreateQuickconnectBar(); 77 bool CreateMainToolBar(); 78 void OpenSiteManager(Site const* site = 0); 79 80 void FocusNextEnabled(std::list<wxWindow*>& windowOrder, std::list<wxWindow*>::iterator iter, bool skipFirst, bool forward); 81 82 CFileZillaEngineContext m_engineContext; 83 84 CStatusBar* m_pStatusBar{}; 85 CMenuBar* m_pMenuBar{}; 86 CToolBar* m_pToolBar{}; 87 CQuickconnectBar* m_pQuickconnectBar{}; 88 89 CSplitterWindowEx* m_pTopSplitter{}; // If log position is 0, splits message log from rest of panes 90 CSplitterWindowEx* m_pBottomSplitter{}; // Top contains view splitter, bottom queue (or queuelog splitter if in position 1) 91 CSplitterWindowEx* m_pQueueLogSplitter{}; 92 93 CContextControl* m_pContextControl{}; 94 95 CStatusView* m_pStatusView{}; 96 CQueueView* m_pQueueView{}; 97 98 #if FZ_MANUALUPDATECHECK 99 CUpdater* m_pUpdater{}; 100 virtual void UpdaterStateChanged( UpdaterState s, build const& v ); 101 void TriggerUpdateDialog(); 102 wxTimer update_dialog_timer_; 103 #endif 104 105 void ShowDirectoryTree(bool local, bool show); 106 107 void ShowDropdownMenu(wxMenu* pMenu, wxToolBar* pToolBar, wxCommandEvent& event); 108 109 #ifdef __WXMSW__ 110 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); 111 #endif 112 113 void HandleResize(); 114 115 void SetupKeyboardAccelerators(); 116 117 void OnOptionsChanged(watched_options const& options); 118 119 // Event handlers 120 DECLARE_EVENT_TABLE() 121 void OnSize(wxSizeEvent& event); 122 void OnMenuHandler(wxCommandEvent& event); 123 void OnDisconnect(wxCommandEvent&); 124 void OnCancel(wxCommandEvent&); 125 void OnClose(wxCloseEvent& event); 126 void OnReconnect(wxCommandEvent&); 127 void OnRefresh(wxCommandEvent&); 128 void OnTimer(wxTimerEvent& event); 129 void OnSiteManager(wxCommandEvent&); 130 void OnProcessQueue(wxCommandEvent& event); 131 void OnMenuEditSettings(wxCommandEvent&); 132 void OnToggleToolBar(wxCommandEvent& event); 133 void OnToggleLogView(wxCommandEvent&); 134 void OnToggleDirectoryTreeView(wxCommandEvent& event); 135 void OnToggleQueueView(wxCommandEvent& event); 136 void OnMenuHelpAbout(wxCommandEvent&); 137 void OnFilter(wxCommandEvent& event); 138 void OnFilterRightclicked(wxCommandEvent& event); 139 #if FZ_MANUALUPDATECHECK 140 void OnCheckForUpdates(wxCommandEvent& event); 141 #endif //FZ_MANUALUPDATECHECK 142 void OnSitemanagerDropdown(wxCommandEvent& event); 143 void OnNavigationKeyEvent(wxNavigationKeyEvent& event); 144 void OnChar(wxKeyEvent& event); 145 void OnActivate(wxActivateEvent& event); 146 void OnToolbarComparison(wxCommandEvent& event); 147 void OnToolbarComparisonDropdown(wxCommandEvent& event); 148 void OnDropdownComparisonMode(wxCommandEvent& event); 149 void OnDropdownComparisonHide(wxCommandEvent& event); 150 void OnSyncBrowse(wxCommandEvent& event); 151 #ifdef __WXMAC__ 152 void OnChildFocused(wxChildFocusEvent& event); 153 #else 154 void OnIconize(wxIconizeEvent& event); 155 void OnTaskBarClick(wxTaskBarIconEvent&); 156 #endif 157 #ifdef __WXGTK__ 158 void OnTaskBarClick_Delayed(wxCommandEvent& event); 159 #endif 160 void OnSearch(wxCommandEvent& event); 161 void OnMenuNewTab(wxCommandEvent& event); 162 void OnMenuCloseTab(wxCommandEvent& event); 163 164 bool m_bInitDone{}; 165 bool m_bQuit{}; 166 wxEventType m_closeEvent{}; 167 wxTimer m_closeEventTimer; 168 169 std::unique_ptr<CertStore> cert_store_; 170 std::unique_ptr<CAsyncRequestQueue> async_request_queue_; 171 CMainFrameStateEventHandler* m_pStateEventHandler{}; 172 173 CWindowStateManager* m_pWindowStateManager{}; 174 175 CQueue* m_pQueuePane{}; 176 177 #ifndef __WXMAC__ 178 wxTaskBarIcon* m_taskBarIcon{}; 179 #endif 180 #ifdef __WXGTK__ 181 // There is a bug in KDE, causing the window to toggle iconized state 182 // several times a second after uniconizing it from taskbar icon. 183 // Set m_taskbar_is_uniconizing in OnTaskBarClick and unset the 184 // next time the pending event processing runs and calls OnTaskBarClick_Delayed. 185 // While set, ignore iconize events. 186 bool m_taskbar_is_uniconizing{}; 187 #endif 188 189 int m_comparisonToggleAcceleratorId{}; 190 191 #ifdef __WXMAC__ 192 int m_lastFocusedChild{-1}; 193 #endif 194 }; 195 196 #endif 197