GME  13
MainFrm.h
Go to the documentation of this file.
00001 // MainFrm.h : interface of the CMainFrame class
00002 //
00004 
00005 #if !defined(AFX_MAINFRM_H__BD235B4F_BD3F_11D3_91E2_00104B98EAD9__INCLUDED_)
00006 #define AFX_MAINFRM_H__BD235B4F_BD3F_11D3_91E2_00104B98EAD9__INCLUDED_
00007 
00008 #if _MSC_VER > 1000
00009 #pragma once
00010 #endif // _MSC_VER > 1000
00011 
00012 #include "GMEPartBrowser.h"
00013 #include "GMEBrowser.h"
00014 #include "GMEObjectInspector.h"
00015 #include "GMEConsole.h"
00016 #include "GMESearch.h"
00017 #include "GMEPanningWindow.h"
00018 #include "GMEOLEApp.h"
00019 
00020 struct CGMEMFCTabCtrl : public CMFCTabCtrl
00021 {
00022         virtual CWnd* GetLastVisibleTab(int& iTabNum)
00023         {
00024                 if (m_bActivateLastActiveTab)
00025                 {
00026                         iTabNum = m_iActiveTab;
00027                         return GetTabWnd(m_iActiveTab);
00028                 }
00029                 // this is a hack to fix the tab behavior when you close the current tab
00030                 // Activate the next tab (same tab index), except if the last tab was closed. In that case, activate the new last tab (index - 1)
00031                 EnableActivateLastVisible(TRUE);
00032                 if (GetTabsNum() == m_iActiveTab)
00033                 {
00034                         m_iActiveTab--;
00035                 }
00036                 iTabNum = m_iActiveTab;
00037                 return GetTabWnd(m_iActiveTab);
00038         }
00039 
00040         void _SetLastActiveTab()
00041         {
00042                 m_iLastActiveTab = m_iActiveTab;
00043         }
00044 
00045         void EnableActivateLastVisible(BOOL enable)
00046         {
00047                 m_bActivateLastVisibleTab = enable;
00048         }
00049 };
00050 
00051 // Tooltip helper for components
00052 class CComponentBar : public CMFCToolBar {
00053         DECLARE_DYNCREATE(CComponentBar)
00054         afx_msg BOOL OnTT(UINT, NMHDR * pNMHDR, LRESULT * );
00055         DECLARE_MESSAGE_MAP()
00056 };
00057 
00058 class CMainFrame : public CMDIFrameWndEx
00059 {
00060         friend void CGMEApp::UpdateComponentLists(bool restart_addons);
00061         friend class CGMEOLEApp;
00062         DECLARE_DYNAMIC(CMainFrame)
00063 public:
00064         CMainFrame();
00065 
00066 // Attributes
00067 public:
00068         static CMainFrame *theInstance;
00069 
00070         int timePaneNo;
00071         int paradigmPaneNo;
00072         int modePaneNo;
00073         int zoomPaneNo;
00074 
00075 // Operations
00076 public:
00077         void ActivateView(CView *view);
00078         void CreateNewView(CView *view, CComPtr<IMgaModel>& model);
00079         void DestroyView(CView *view);
00080         void WriteStatusZoom(int zoomPct);
00081         void WriteStatusParadigm(const CString& txt);
00082         void WriteStatusMode(const CString& txt);
00083         void WriteStatusText(int pane, const CString& txt);
00084         void UpdateTitle(LPCTSTR title);
00085         void SetPartBrowserMetaModel(CGuiMetaModel* meta)       { m_partBrowser.SetMetaModel(meta); }
00086         void SetPartBrowserBg(COLORREF bgColor)                         { m_partBrowser.SetBgColor(bgColor); m_partBrowser.RePaint(); }
00087         void RePaintPartBrowser()                                                       { m_partBrowser.RePaint(); }
00088         void ChangePartBrowserAspect(int ind)                           { m_partBrowser.ChangeAspect(ind); }
00089         void CyclePartBrowserAspect()                                           { m_partBrowser.CycleAspect(); }
00090         void SetGMEViewMetaModel(CGuiMetaModel* meta);
00091         void ChangeGMEViewAspect(int ind);
00092         void CycleGMEViewAspect();
00093         void GMEViewInvalidate();
00094         BOOL VerifyBarState(LPCTSTR lpszProfileName);
00095         void ShowObjectInspector();
00096         void ShowFindDlg();
00097         void HideFindDlg();
00098 
00099         void StartAutosaveTimer(int secs);
00100         void StopAutosaveTimer();
00101 
00102 // Overrides
00103         // ClassWizard generated virtual function overrides
00104         //{{AFX_VIRTUAL(CMainFrame)
00105         public:
00106         virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00107         virtual BOOL DestroyWindow();
00108         virtual BOOL PreTranslateMessage(MSG* pMsg);
00109         //}}AFX_VIRTUAL
00110 
00111 // Implementation
00112 public:
00113         virtual ~CMainFrame();
00114 
00115         void setGmeOleApp( CGMEOLEApp * the_ole_app);
00116         void setMgaProj();
00117         void clearGmeOleApp();
00118         void clearMgaProj();
00119         CGMEOLEApp *       mGmeOleApp;
00120 
00121 #ifdef _DEBUG
00122         virtual void AssertValid() const;
00123         virtual void Dump(CDumpContext& dc) const;
00124 #endif
00125         CGMEPanningWindow       m_panningWindow;
00126         CGMEConsole                     m_console;
00127 
00128         CComponentBar           m_wndComponentBar;
00129 protected:  // control bar embedded members
00130         CMFCStatusBar           m_wndStatusBar;
00131         CMFCToolBar                     m_wndToolBarMain;
00132         CMFCToolBar                     m_wndToolBarModeling;
00133         CMFCToolBar                     m_wndToolBarWins;
00134         CMFCMenuBar                     m_wndMenuBar;
00135 
00136         CMFCToolBar                     m_wndModeBar;
00137         CMFCToolBar                     m_wndNaviBar;
00138 
00139 
00140 
00141 
00142 //      CDialogBar                      m_wndDlgBar;
00143         CGMEPartBrowser         m_partBrowser;
00144         CGMEBrowser                     m_browser;
00145         CGMEObjectInspector     m_objectInspector;
00146         CGMESearch                      m_search;
00147 
00148         UINT_PTR                        m_autosaveTimerID;
00149 
00150 // Generated message map functions
00151 protected:
00152         afx_msg void OnUpdateTime(CCmdUI* pCmdUI);
00153         //{{AFX_MSG(CMainFrame)
00154         afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00155 
00156         afx_msg void OnViewFullScreen();
00157         afx_msg void OnEditSearch();
00158         afx_msg void OnUpdateEditSearch(CCmdUI* pCmdUI);
00159         afx_msg void OnTimer(UINT_PTR nIDEvent);
00160         afx_msg void OnDestroy();
00161         afx_msg void OnViewMultiUserRefreshSourceControl();
00162         afx_msg void OnUpdateViewMultiUserRefreshSourceControl(CCmdUI* pCmdUI);
00163         afx_msg void OnViewMultiUserActiveUsers();
00164         afx_msg void OnUpdateViewMultiUserActiveUsers(CCmdUI* pCmdUI);
00165         afx_msg void OnUpdateViewMultiUserSubversion(CCmdUI* pCmdUI);
00166         afx_msg void OnViewClearConsole();
00167         afx_msg void OnUpdateViewClearConsole( CCmdUI* pCmdUI);
00168 
00169         template<class paneclass, typename paneclass CMainFrame::* const m_pane> afx_msg void OnViewPane() 
00170         {
00171                 (this->*m_pane).ShowPane(!(this->*m_pane).IsVisible(), FALSE, FALSE);
00172         }
00173         template<class paneclass, typename paneclass CMainFrame::* const m_pane> afx_msg void OnUpdateViewPane(CCmdUI* pCmdUI) 
00174         {
00175                 pCmdUI->Enable();
00176                 pCmdUI->SetCheck((this->*m_pane).IsVisible());
00177         }
00178 
00179         afx_msg void OnUpdateWindowNew(CCmdUI* pCmdUI);
00180         afx_msg void OnClose();
00181 public:
00182         afx_msg void OnDropFiles(HDROP p_hDropInfo);
00183 protected:
00184         afx_msg void OnUpdateApplicationLook(CCmdUI* pCmdUI);
00185 
00186         afx_msg void OnBtnBack();
00187         afx_msg void OnBtnHome();
00188         afx_msg void OnUpdateBtnBack(CCmdUI* pCmdUI);
00189         afx_msg void OnUpdateBtnHome(CCmdUI* pCmdUI);
00190 
00191         afx_msg void OnWindowManager();
00192         afx_msg void OnViewCustomize();
00193 
00194         afx_msg void OnMdiMoveToNextGroup();
00195         afx_msg void OnMdiMoveToPrevGroup();
00196         afx_msg void OnMdiNewHorzTabGroup();
00197         afx_msg void OnMdiNewVertGroup();
00198         LRESULT OnToolbarCreateNew(WPARAM wp,LPARAM lp);
00199         afx_msg BOOL OnBarCheck(UINT nID);
00200         afx_msg void OnUpdateControlBarMenus(CCmdUI* pCmdUI);
00201         afx_msg void OnWindowNewhorizontaltabgroup();
00202         afx_msg void OnWindowNewverticaltabgroup();
00203         afx_msg void OnWindowMovetoprevioustabgroup();
00204         afx_msg void OnWindowMovetonexttabgroup();
00205         afx_msg void OnUpdateWindowNewhorizontaltabgroup(CCmdUI* pCmdUI);
00206         afx_msg void OnUpdateWindowNewverticaltabgroup(CCmdUI* pCmdUI);
00207         afx_msg void OnUpdateWindowMovetoprevioustabgroup(CCmdUI* pCmdUI);
00208         afx_msg void OnUpdateWindowMovetonexttabgroup(CCmdUI* pCmdUI);
00209         afx_msg LRESULT OnGetTabTooltip(WPARAM wp, LPARAM lp);
00210 
00211         //}}AFX_MSG
00212         DECLARE_MESSAGE_MAP()
00213 private:
00214         BOOL InitStatusBar(UINT *pIndicators, int nSize, int nSeconds);
00215         int CreateToolBars();
00216         void OnApplicationLook(UINT id);
00217 //      IMgaObject*     modelFindByPath(IMgaModel *model,  const wstring& strPath);
00218 //      IMgaObject*     folderFindByPath(IMgaFolder* folder, const wstring& strPath);
00219 
00220 public:
00221         void ShowNavigationAndModeToolbars(bool isVisible);
00222 
00223         void EnableActivateLastActive(BOOL enable)
00224         {
00225                 m_wndClientArea.GetMDITabs().EnableActivateLastActive(enable);
00226         }
00227 
00228         void CheckForOffscreenPanes();
00229 };
00230 
00232 
00233 //{{AFX_INSERT_LOCATION}}
00234 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00235 
00236 #endif // !defined(AFX_MAINFRM_H__BD235B4F_BD3F_11D3_91E2_00104B98EAD9__INCLUDED_)