MainFrm.cpp
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:34k
源码类别:

对话框与窗口

开发平台:

Visual C++

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3. // This file is a part of the XTREME TOOLKIT PRO MFC class library.
  4. // (c)1998-2008 Codejock Software, All Rights Reserved.
  5. //
  6. // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
  7. // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
  8. // CONSENT OF CODEJOCK SOFTWARE.
  9. //
  10. // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
  11. // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
  12. // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
  13. // SINGLE COMPUTER.
  14. //
  15. // CONTACT INFORMATION:
  16. // support@codejock.com
  17. // http://www.codejock.com
  18. //
  19. /////////////////////////////////////////////////////////////////////////////
  20. #include "stdafx.h"
  21. #include "Pane.h"
  22. #include "MainFrm.h"
  23. //#define VISIO_EDIT_BACKGROUND
  24. //#define VISIO_OFFICE2003_THEME
  25. BOOL m_bMinMaxSample = FALSE;
  26. #ifdef _DEBUG
  27. #define new DEBUG_NEW
  28. #endif
  29. using namespace XTPDockingPanePaintThemes;
  30. class CCustomTheme :  public CXTPDockingPaneGripperedTheme
  31. {
  32. virtual void DrawCaption(CDC* pDC, CXTPDockingPaneTabbedContainer* pPane, CRect rc)
  33. {
  34. CRect rcCaption(0, 2, rc.right, m_nTitleHeight + 1);
  35. // Drawing Frame
  36. pDC->FillSolidRect(rcCaption, GetSysColor(COLOR_3DFACE));
  37. pDC->Draw3dRect(1, rc.top + 1, rc.Width() -1, rcCaption.bottom + 1, GetSysColor(COLOR_WINDOW), GetSysColor(COLOR_WINDOW));
  38. pDC->Draw3dRect(0, rc.top, rc.Width() - 1 , rcCaption.bottom + 2, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DSHADOW));
  39. COLORREF clrText = GetSysColor(COLOR_BTNTEXT);
  40. rcCaption.right -= 3;
  41. DrawCaptionButtons(pDC, pPane->GetCaptionButtons(), rcCaption, clrText, 14, 2, FALSE);
  42. // Drawing Title
  43. if (pPane->GetSelected())
  44. {
  45. CRect rcText(rcCaption.left + 4, rcCaption.top + 1, rcCaption.right, rcCaption.bottom);
  46. pDC->SetTextColor(clrText);
  47. CXTPFontDC font(pDC, &m_fntTitle);
  48. pDC->DrawText(pPane->GetSelected()->GetTitle(), rcText, DT_SINGLELINE|DT_END_ELLIPSIS|DT_VCENTER);
  49. }
  50. }
  51. };
  52. // CMainFrame
  53. IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
  54. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  55. ON_WM_CREATE()
  56. ON_COMMAND_RANGE(IDR_PANE1, IDR_PANE10, OnShowPane)
  57. ON_COMMAND(ID_THEME_DEFAULT, OnThemeDefault)
  58. ON_COMMAND(ID_THEME_OFFICE, OnThemeOffice)
  59. ON_COMMAND(ID_THEME_OFFICE2003, OnThemeOffice2003)
  60. ON_COMMAND(ID_THEME_WINXP, OnThemeWinXP)
  61. ON_COMMAND(ID_THEME_GRIPPERED, OnThemeGrippered)
  62. ON_COMMAND(ID_THEME_WHIDBEY, OnThemeWhidbey)
  63. ON_COMMAND(ID_THEME_SHORTCUTBAR2003, OnThemeShortcutBar2003)
  64. ON_COMMAND(ID_THEME_EXPLORER, OnThemeExplorer)
  65. ON_COMMAND(ID_THEME_OFFICE2007, OnThemeOffice2007)
  66. ON_COMMAND(ID_THEME_WORD2007, OnThemeWord2007)
  67. ON_UPDATE_COMMAND_UI_RANGE(ID_THEME_DEFAULT, ID_THEME_CUSTOM4, OnUpdateTheme)
  68. ON_MESSAGE(XTPWM_DOCKINGPANE_NOTIFY, OnDockingPaneNotify)
  69. ON_COMMAND(ID_LAYOUT_EDITOR, OnLayoutEditor)
  70. ON_UPDATE_COMMAND_UI(ID_LAYOUT_EDITOR, OnUpdateLayoutEditor)
  71. ON_COMMAND(ID_LAYOUT_RUN, OnLayoutRun)
  72. ON_UPDATE_COMMAND_UI(ID_LAYOUT_RUN, OnUpdateLayoutRun)
  73. ON_WM_DESTROY()
  74. ON_COMMAND(ID_THEME_VISIO_OFFICE2000, OnThemeVisio2000)
  75. ON_COMMAND(ID_THEME_VISIO, OnThemeVisio)
  76. ON_COMMAND(ID_THEME_VISIO_OFFICE2003, OnThemeVisio2003)
  77. ON_COMMAND(ID_THEME_CUSTOM, OnThemeCustom)
  78. ON_COMMAND(ID_THEME_CUSTOM2, OnThemeCustom2)
  79. ON_COMMAND(ID_THEME_CUSTOM3, OnThemeCustom3)
  80. ON_COMMAND(ID_THEME_CUSTOM4, OnThemeCustom4)
  81. ON_COMMAND(ID_LAYOUT_LOADFROMFILE, OnLoadFromFile)
  82. ON_COMMAND(ID_LAYOUT_SAVETOFILE, OnSaveToFile)
  83. ON_COMMAND(ID_LAYOUT_LOADFROMRESOURCE, OnLoadFromResource)
  84. ON_COMMAND(ID_DOCKINGPANE_HIDECLIENT, OnHideClient)
  85. ON_UPDATE_COMMAND_UI(ID_DOCKINGPANE_HIDECLIENT, OnUpdateHideClient)
  86. ON_COMMAND(ID_DOCKINGPANE_USESPLITTERTRACKER, OnUseSplitterTracker)
  87. ON_UPDATE_COMMAND_UI(ID_DOCKINGPANE_USESPLITTERTRACKER, OnUpdateUseSplitterTracker)
  88. ON_COMMAND(ID_DOCKINGPANE_THEMEDFLOATINGFRAMES, OnThemedFloatingFrames)
  89. ON_UPDATE_COMMAND_UI(ID_DOCKINGPANE_THEMEDFLOATINGFRAMES, OnUpdateThemedFloatingFrames)
  90. ON_COMMAND(ID_DOCKINGCONTEXT_ALPHACONTEXT, OnAlphaContext)
  91. ON_UPDATE_COMMAND_UI(ID_DOCKINGCONTEXT_ALPHACONTEXT, OnUpdateAlphaContext)
  92. ON_COMMAND(ID_DOCKINGCONTEXT_DOCKINGSTICKERS, OnDockingStickers)
  93. ON_UPDATE_COMMAND_UI(ID_DOCKINGCONTEXT_DOCKINGSTICKERS, OnUpdateDockingStickers)
  94. ON_COMMAND(ID_DOCKINGPANE_MINMAXSAMPLE, OnMinMaxSamlpe)
  95. ON_UPDATE_COMMAND_UI(ID_DOCKINGPANE_MINMAXSAMPLE, OnUpdateMinMaxSamlpe)
  96. ON_WM_GETMINMAXINFO()
  97. ON_COMMAND(ID_DOCKINGPANE_CAPTIONBUTTONS_CLOSEBUTTON, OnCaptionButtonClose)
  98. ON_UPDATE_COMMAND_UI(ID_DOCKINGPANE_CAPTIONBUTTONS_CLOSEBUTTON, OnUpdateCaptionButtonClose)
  99. ON_COMMAND(ID_DOCKINGPANE_CAPTIONBUTTONS_AUTOHIDEBUTTON, OnCaptionButtonAutoHide)
  100. ON_UPDATE_COMMAND_UI(ID_DOCKINGPANE_CAPTIONBUTTONS_AUTOHIDEBUTTON, OnUpdateCaptionButtonAutoHide)
  101. ON_COMMAND(ID_DOCKINGPANE_CAPTIONBUTTONS_MENUBUTTON, OnCaptionButtonMenu)
  102. ON_UPDATE_COMMAND_UI(ID_DOCKINGPANE_CAPTIONBUTTONS_MENUBUTTON, OnUpdateCaptionButtonMenu)
  103. ON_COMMAND(ID_DOCKINGPANE_CAPTIONBUTTONS_MAXIMIZERESTOREBUTTON, OnCaptionButtonMaximize)
  104. ON_UPDATE_COMMAND_UI(ID_DOCKINGPANE_CAPTIONBUTTONS_MAXIMIZERESTOREBUTTON, OnUpdateCaptionButtonMaximize)
  105. ON_COMMAND(ID_DOCKINGPANE_CAPTIONS_VISIBLE, OnCaptionVisible)
  106. ON_COMMAND(ID_DOCKINGPANE_CAPTIONS_HORIZONTAL, OnCaptionHorizontal)
  107. ON_COMMAND(ID_DOCKINGPANE_CAPTIONS_VERTICAL, OnCaptionVertical)
  108. ON_COMMAND(ID_DOCKINGPANE_CAPTIONS_AUTOBYSIZE, OnCaptionAutoBySize)
  109. ON_COMMAND(ID_DOCKINGPANE_CAPTIONS_AUTOBYPOSITION, OnCaptionAutoByPosition)
  110. ON_UPDATE_COMMAND_UI(ID_DOCKINGPANE_CAPTIONS_VISIBLE, OnUpdateCaptionVisible)
  111. ON_UPDATE_COMMAND_UI(ID_DOCKINGPANE_CAPTIONS_HORIZONTAL, OnUpdateCaptionHorizontal)
  112. ON_UPDATE_COMMAND_UI(ID_DOCKINGPANE_CAPTIONS_VERTICAL, OnUpdateCaptionVertical)
  113. ON_UPDATE_COMMAND_UI(ID_DOCKINGPANE_CAPTIONS_AUTOBYSIZE, OnUpdateCaptionAutoBySize)
  114. ON_UPDATE_COMMAND_UI(ID_DOCKINGPANE_CAPTIONS_AUTOBYPOSITION, OnUpdateCaptionAutoByPosition)
  115. ON_COMMAND(ID_DOCKINGPANE_CLOSEBUTTONAFFECTS, OnCloseButtonAffects)
  116. ON_COMMAND(ID_DOCKINGPANE_AUTOHIDEBUTTONAFFECTS, OnAutoHideButtonAffects)
  117. ON_UPDATE_COMMAND_UI(ID_DOCKINGPANE_CLOSEBUTTONAFFECTS, OnUpdateCloseButtonAffects)
  118. ON_UPDATE_COMMAND_UI(ID_DOCKINGPANE_AUTOHIDEBUTTONAFFECTS, OnUpdateAutoHideButtonAffects)
  119. ON_COMMAND(ID_DOCKINGCONTEXT_SHOWWHILEDRAGGING, OnShowContentsWhileDragging)
  120. ON_UPDATE_COMMAND_UI(ID_DOCKINGCONTEXT_SHOWWHILEDRAGGING, OnUpdateShowContentsWhileDragging)
  121. ON_COMMAND(ID_DOCKINGPANE_STICKYFLOATINGFRAMES, OnStickyFloatingFrames)
  122. ON_UPDATE_COMMAND_UI(ID_DOCKINGPANE_STICKYFLOATINGFRAMES, OnUpdateStickyFloatingFrames)
  123. ON_COMMAND(ID_DOCKINGPANE_TRANSPARENTFLOATINGFRAMES, OnTransparentFloatingFrames)
  124. ON_UPDATE_COMMAND_UI(ID_DOCKINGPANE_TRANSPARENTFLOATINGFRAMES, OnUpdateTransparentFloatingFrames)
  125. ON_COMMAND(ID_DOCKINGCONTEXT_ENABLESIDEDOCKING, OnEnableSideDocking)
  126. ON_UPDATE_COMMAND_UI(ID_DOCKINGCONTEXT_ENABLESIDEDOCKING, OnUpdateEnableSideDocking)
  127. ON_COMMAND(XTP_ID_CUSTOMIZE, OnCustomize)
  128. ON_WM_CLOSE()
  129. END_MESSAGE_MAP()
  130. static UINT indicators[] =
  131. {
  132. ID_SEPARATOR,           // status line indicator
  133. ID_INDICATOR_CAPS,
  134. ID_INDICATOR_NUM,
  135. ID_INDICATOR_SCRL,
  136. };
  137. // CMainFrame construction/destruction
  138. CMainFrame::CMainFrame()
  139. : m_pEditorLayout(NULL)
  140. , m_pRunLayout(NULL)
  141. {
  142. }
  143. CMainFrame::~CMainFrame()
  144. {
  145. }
  146. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  147. {
  148. if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  149. return -1;
  150. LOGFONT lfIcon;
  151. VERIFY( ::SystemParametersInfo( SPI_GETICONTITLELOGFONT, sizeof( lfIcon ), &lfIcon, 0 ) );
  152. m_fntEdit.CreateFontIndirect(&lfIcon);
  153. if (!m_wndStatusBar.Create(this) ||
  154. !m_wndStatusBar.SetIndicators(indicators,
  155.   sizeof(indicators)/sizeof(UINT)))
  156. {
  157. TRACE0("Failed to create status barn");
  158. return -1;      // fail to create
  159. }
  160. if (!InitCommandBars())
  161. return -1;
  162. XTPPaintManager()->SetTheme(xtpThemeOfficeXP);
  163. CXTPCommandBars* pCommandBars = GetCommandBars();
  164. CXTPCommandBar* pMenuBar = pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAINFRAME);
  165. pMenuBar->SetFlags(xtpFlagAddMDISysPopup);
  166. CXTPToolBar* pCommandBar = (CXTPToolBar*)pCommandBars->Add(_T("Standard"), xtpBarTop);
  167. if (!pCommandBar ||
  168. !pCommandBar->LoadToolBar(IDR_MAINFRAME))
  169. {
  170. TRACE0("Failed to create toolbarn");
  171. return -1;
  172. }
  173. // Load the previous state for toolbars and menus.
  174. LoadCommandBars(_T("CommandBars"));
  175. // Initialize the docking pane manager and set the
  176. // initial them for the docking panes.  Do this only after all
  177. // control bars objects have been created and docked.
  178. m_paneManager.InstallDockingPanes(this);
  179. SetDockingPaneTheme(xtpPaneThemeOffice2003);
  180. m_paneManager.SetFloatingFrameCaption(_T("Panes"));
  181. m_paneManager.SetStickyFloatingFrames(TRUE);
  182. m_paneManager.SetThemedFloatingFrames(TRUE);
  183. m_paneManager.SetSideDockingMargin(CRect(2, 2, 2, 2));
  184. m_paneManager.EnableSideDocking();
  185. m_paneManager.EnableKeyboardNavigate();
  186. // Create docking panes.
  187. CXTPDockingPane* pwndPane1 = m_paneManager.CreatePane(
  188. IDR_PANE1, CRect(0, 0,200, 120), xtpPaneDockTop);
  189. m_paneManager.CreatePane(
  190. IDR_PANE2, CRect(0, 0,200, 120), xtpPaneDockLeft, pwndPane1);
  191. CXTPDockingPane* pwndPane3 = m_paneManager.CreatePane(
  192. IDR_PANE3, CRect(0, 0,200, 120), xtpPaneDockLeft);
  193. CXTPDockingPane* pwndPane4 = m_paneManager.CreatePane(
  194. IDR_PANE4, CRect(0, 0,200, 120), xtpPaneDockTop, pwndPane3);
  195. CXTPDockingPane* pwndPane5 = m_paneManager.CreatePane(
  196. IDR_PANE5, CRect(0, 0,200, 120), xtpPaneDockLeft, pwndPane4);
  197. CXTPDockingPane* pwndPane6 = m_paneManager.CreatePane(
  198. IDR_PANE6, CRect(0, 0,200, 120), xtpPaneDockTop, pwndPane5);
  199. CXTPDockingPane* pwndPane7 = m_paneManager.CreatePane(
  200. IDR_PANE7, CRect(0, 0,200, 120), xtpPaneDockTop, pwndPane6);
  201. CXTPDockingPane* pwndPane8 = m_paneManager.CreatePane(
  202. IDR_PANE8, CRect(0, 0,200, 120), xtpPaneDockRight);
  203. CXTPDockingPane* pwndPane9 = m_paneManager.CreatePane(
  204. IDR_PANE9, CRect(0, 0,200, 120), xtpPaneDockBottom, pwndPane8);
  205. CXTPDockingPane* pwndPane10 = m_paneManager.CreatePane(
  206. IDR_PANE10, CRect(0, 0,200, 120), xtpPaneDockBottom, pwndPane9);
  207. // Create the layout manager for run mode.  Layouts define how
  208. // the panes will appear when docked, you can define multiple
  209. // layouts.
  210. // If "RunLayout" layout does not exist, save the current configuration
  211. // as "RunLayout", otherwise load previous state.
  212. m_pRunLayout = m_paneManager.CreateLayout();
  213. if (!m_pRunLayout->Load(_T("RunLayout"))) {
  214. m_paneManager.GetLayout(m_pRunLayout);
  215. }
  216. // Initialize the default layout for "EditorLayout".
  217. m_paneManager.AttachPane(
  218. pwndPane9, pwndPane8);
  219. m_paneManager.AttachPane(
  220. pwndPane6, pwndPane1);
  221. m_paneManager.AttachPane(
  222. pwndPane4, pwndPane7);
  223. m_paneManager.HidePane(
  224. pwndPane7);
  225. CXTPDockingPaneSidePanel* pPanel = m_paneManager.DockSidePane(pwndPane10, xtpPaneDockRight, CRect(0, 100, 120, 300));
  226. pPanel->Collapse();
  227. // If "EditorLayout" layout does not exist, save the current configuration
  228. // as "EditorLayout", otherwise load previous state and set it as the active
  229. // layout.
  230. m_pEditorLayout = m_paneManager.CreateLayout();
  231. if (m_pEditorLayout->Load(_T("EditorLayout"))) {
  232. m_paneManager.SetLayout(m_pEditorLayout);
  233. }
  234. else {
  235. m_paneManager.GetLayout(m_pEditorLayout);
  236. }
  237. // Get a pointer to IDR_PANE1 and set the title.
  238. CXTPDockingPane* pPane = m_paneManager.FindPane(IDR_PANE1);
  239. ASSERT(pPane);
  240. if (pPane) {
  241. pPane->SetTitle(_T("Pane 1 - Long TitlenPane 1"));
  242. }
  243. // Get a pointer to IDR_PANE2 and set the title.
  244. pPane = m_paneManager.FindPane(IDR_PANE2);
  245. ASSERT(pPane);
  246. if (pPane) {
  247. pPane->SetTitle(_T("Pane 2 - No CloseablenPane 2"));
  248. pPane->SetOptions(xtpPaneNoCloseable);
  249. }
  250. // Get a pointer to IDR_PANE3 and set the title.
  251. pPane = m_paneManager.FindPane(IDR_PANE3);
  252. ASSERT(pPane);
  253. if (pPane) {
  254. pPane->SetTitle(_T("Pane 3 - No HideablenPane 3"));
  255. pPane->SetOptions(xtpPaneNoHideable);
  256. }
  257. m_bEditor = TRUE;
  258. // Set the icons for the docking pane tabs.
  259. int nIDs1[] = {IDR_PANE1, IDR_PANE2, IDR_PANE3, IDR_PANE4, IDR_PANE5};
  260. m_paneManager.SetIcons(IDB_BITMAP1, nIDs1, 5, RGB(0, 255, 0));
  261. int nIDs2[] = {IDR_PANE6, IDR_PANE7, IDR_PANE8, IDR_PANE9, IDR_PANE10};
  262. m_paneManager.SetIcons(IDB_BITMAP2, nIDs2, 5, RGB(0, 255, 0));
  263. if (XTPOffice2007Images()->IsValid())
  264. {
  265. OnThemeOffice2007();
  266. }
  267. else
  268. {
  269. OnThemeOffice2003();
  270. }
  271. return 0;
  272. }
  273. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  274. {
  275. if( !CMDIFrameWnd::PreCreateWindow(cs) )
  276. return FALSE;
  277. cs.lpszClass = _T("XTPMainFrame");
  278. CXTPDrawHelpers::RegisterWndClass(AfxGetInstanceHandle(), cs.lpszClass, 
  279. CS_DBLCLKS, AfxGetApp()->LoadIcon(IDR_MAINFRAME));
  280. return TRUE;
  281. }
  282. // CMainFrame diagnostics
  283. #ifdef _DEBUG
  284. void CMainFrame::AssertValid() const
  285. {
  286. CMDIFrameWnd::AssertValid();
  287. }
  288. void CMainFrame::Dump(CDumpContext& dc) const
  289. {
  290. CMDIFrameWnd::Dump(dc);
  291. }
  292. #endif //_DEBUG
  293. LRESULT CMainFrame::OnDockingPaneNotify(WPARAM wParam, LPARAM lParam)
  294. {
  295. if (wParam == XTP_DPN_SHOWWINDOW)
  296. {
  297. // get a pointer to the docking pane being shown.
  298. CXTPDockingPane* pPane = (CXTPDockingPane*)lParam;
  299. if (!pPane->IsValid())
  300. {
  301. int nIndex = pPane->GetID() - IDR_PANE1;
  302. ASSERT(nIndex >=0 &&  nIndex < sizeof(m_wndPanes) / sizeof(m_wndPanes[0]));
  303. CEditPane& wndEdit = m_wndPanes[nIndex];
  304. // create and attach the edit control for this pane.
  305. if (!::IsWindow(wndEdit.m_hWnd))
  306. {
  307. if (!wndEdit.CreateEx(WS_EX_STATICEDGE, _T("EDIT"), _T(""),
  308. WS_CHILD|ES_AUTOVSCROLL|ES_MULTILINE, CRect(0, 0,200, 120), this, pPane->GetID()))
  309. {
  310. TRACE0( "Error creating pane edit control.n" );
  311. }
  312. wndEdit.SetFont(&m_fntEdit);
  313. AdjustStyle(m_paneManager.GetCurrentTheme());
  314. }
  315. pPane->Attach(&wndEdit);
  316. }
  317. return TRUE; // handled
  318. }
  319. if (wParam == XTP_DPN_CONTEXTMENU)
  320. {
  321. XTP_DOCKINGPANE_CLICK* pClick = (XTP_DOCKINGPANE_CLICK*)lParam;
  322. CMenu menu;
  323. VERIFY(menu.LoadMenu(IDR_POPUP_PANES));
  324. CMenu* pPopup = menu.GetSubMenu(0);
  325. TrackPopupMenu(pPopup->GetSafeHmenu(), TPM_RIGHTBUTTON, pClick->pt.x, pClick->pt.y, 0, AfxGetMainWnd()->GetSafeHwnd(), 0);
  326. return TRUE;
  327. }
  328. return FALSE;
  329. }
  330. void CMainFrame::AdjustStyle(XTPDockingPanePaintTheme theme)
  331. {
  332. BOOL bBorder = FALSE, bStaticEdge = FALSE, bClientEdge = FALSE;
  333. switch(theme)
  334. {
  335. case xtpPaneThemeOffice: bStaticEdge = TRUE;    break;
  336. case xtpPaneThemeDefault: bBorder = TRUE; break;
  337. case xtpPaneThemeGrippered: bClientEdge = TRUE; break;
  338. }
  339. for (int i = 0; i < sizeof(m_wndPanes) / sizeof(m_wndPanes[0]); i++)
  340. {
  341. if (!m_wndPanes[i].m_hWnd)
  342. {
  343. if (!m_wndPanes[i].CreateEx(WS_EX_STATICEDGE, _T("EDIT"), _T(""),
  344. WS_CHILD|ES_AUTOVSCROLL|ES_MULTILINE, CRect(0, 0,0, 0), this, IDR_PANE1 + i))
  345. {
  346. TRACE0( "Error creating pane edit control.n" );
  347. }
  348. m_wndPanes[i].SetFont(&m_fntEdit);
  349. }
  350. m_wndPanes[i].ModifyStyle(bBorder? 0: WS_BORDER, bBorder? WS_BORDER: 0, SWP_FRAMECHANGED|SWP_DRAWFRAME);
  351. m_wndPanes[i].ModifyStyleEx(bStaticEdge? 0: WS_EX_STATICEDGE, bStaticEdge? WS_EX_STATICEDGE: 0, SWP_FRAMECHANGED|SWP_DRAWFRAME );
  352. m_wndPanes[i].ModifyStyleEx(bClientEdge? 0: WS_EX_CLIENTEDGE, bClientEdge? WS_EX_CLIENTEDGE: 0, SWP_FRAMECHANGED|SWP_DRAWFRAME );
  353. }
  354. }
  355. // CMainFrame message handlers
  356. void CMainFrame::OnShowPane(UINT nID)
  357. {
  358. m_paneManager.ShowPane(nID);
  359. }
  360. void CMainFrame::SwitchLayout()
  361. {
  362. if (m_bMinMaxSample)
  363. OnMinMaxSamlpe();
  364. if (m_bEditor)
  365. {
  366. m_paneManager.GetLayout(m_pEditorLayout);
  367. m_paneManager.SetLayout(m_pRunLayout);
  368. } else
  369. {
  370. m_paneManager.GetLayout(m_pRunLayout);
  371. m_paneManager.SetLayout(m_pEditorLayout);
  372. }
  373. m_bEditor = !m_bEditor;
  374. }
  375. void CMainFrame::OnLayoutEditor()
  376. {
  377. if (!m_bEditor) SwitchLayout();
  378. }
  379. void CMainFrame::OnLayoutRun()
  380. {
  381. if (m_bEditor) SwitchLayout();
  382. }
  383. void CMainFrame::OnUpdateLayoutEditor(CCmdUI *pCmdUI)
  384. {
  385. pCmdUI->SetCheck(m_bEditor);
  386. }
  387. void CMainFrame::OnUpdateLayoutRun(CCmdUI *pCmdUI)
  388. {
  389. pCmdUI->SetCheck(!m_bEditor);
  390. }
  391. void CMainFrame::OnDestroy()
  392. {
  393. if (m_bMinMaxSample)
  394. {
  395. OnMinMaxSamlpe();
  396. }
  397. CMDIFrameWnd::OnDestroy();
  398. m_paneManager.GetLayout(m_bEditor? m_pEditorLayout: m_pRunLayout);
  399. m_pEditorLayout->Save(_T("EditorLayout"));
  400. m_pRunLayout->Save(_T("RunLayout"));
  401. delete m_pEditorLayout;
  402. delete m_pRunLayout;
  403. }
  404. void CMainFrame::OnThemeDefault()
  405. {
  406. AdjustStyle(xtpPaneThemeDefault);
  407. SetDockingPaneTheme(xtpPaneThemeDefault);
  408. m_nSelectedTheme = ID_THEME_DEFAULT;
  409. SetCommandBarsTheme(xtpThemeOffice2000);
  410. }
  411. void CMainFrame::OnThemeOffice()
  412. {
  413. AdjustStyle(xtpPaneThemeOffice);
  414. SetDockingPaneTheme(xtpPaneThemeOffice);
  415. m_nSelectedTheme = ID_THEME_OFFICE;
  416. SetCommandBarsTheme(xtpThemeOfficeXP);
  417. }
  418. void CMainFrame::OnThemeWhidbey()
  419. {
  420. AdjustStyle(xtpPaneThemeOffice);
  421. SetDockingPaneTheme(xtpPaneThemeVisualStudio2005);
  422. m_nSelectedTheme = ID_THEME_WHIDBEY;
  423. SetCommandBarsTheme(xtpThemeWhidbey);
  424. }
  425. void CMainFrame::OnThemeExplorer()
  426. {
  427. AdjustStyle(xtpPaneThemeGrippered);
  428. SetDockingPaneTheme(xtpPaneThemeExplorer);
  429. m_nSelectedTheme = ID_THEME_EXPLORER;
  430. SetCommandBarsTheme(xtpThemeNativeWinXP);
  431. }
  432. void CMainFrame::SetCommandBarsTheme(XTPPaintTheme paintTheme)
  433. {
  434. CXTPPaintManager::SetTheme(paintTheme);
  435. EnableOffice2007Frame(paintTheme == xtpThemeRibbon ? GetCommandBars() : NULL);
  436. GetCommandBars()->RedrawCommandBars();
  437. }
  438. void CMainFrame::OnThemeOffice2007()
  439. {
  440. AdjustStyle(xtpPaneThemeOffice);
  441. SetDockingPaneTheme(xtpPaneThemeOffice2007);
  442. m_nSelectedTheme = ID_THEME_OFFICE2007;
  443. SetCommandBarsTheme(xtpThemeRibbon);
  444. }
  445. void CMainFrame::OnThemeWord2007()
  446. {
  447. AdjustStyle(xtpPaneThemeOffice);
  448. SetDockingPaneTheme(xtpPaneThemeWord2007);
  449. m_nSelectedTheme = ID_THEME_WORD2007;
  450. SetCommandBarsTheme(xtpThemeRibbon);
  451. }
  452. void CMainFrame::OnThemeOffice2003()
  453. {
  454. AdjustStyle(xtpPaneThemeOffice);
  455. SetDockingPaneTheme(xtpPaneThemeOffice2003);
  456. m_nSelectedTheme = ID_THEME_OFFICE2003;
  457. SetCommandBarsTheme(xtpThemeOffice2003);
  458. }
  459. void CMainFrame::SetDockingPaneTheme(XTPDockingPanePaintTheme theme)
  460. {
  461. m_paneManager.SetClientMargin(theme == xtpPaneThemeOffice2007 ? 3 : 0);
  462. m_paneManager.SetTheme(theme);
  463. }
  464. void CMainFrame::OnThemeShortcutBar2003()
  465. {
  466. AdjustStyle(xtpPaneThemeOffice);
  467. SetDockingPaneTheme(xtpPaneThemeShortcutBar2003);
  468. m_nSelectedTheme = ID_THEME_SHORTCUTBAR2003;
  469. SetCommandBarsTheme(xtpThemeOffice2003);
  470. }
  471. void CMainFrame::OnThemeWinXP()
  472. {
  473. AdjustStyle(xtpPaneThemeGrippered);
  474. SetDockingPaneTheme(xtpPaneThemeNativeWinXP);
  475. m_nSelectedTheme = ID_THEME_WINXP;
  476. SetCommandBarsTheme(xtpThemeNativeWinXP);
  477. }
  478. void CMainFrame::OnThemeGrippered()
  479. {
  480. AdjustStyle(xtpPaneThemeGrippered);
  481. SetDockingPaneTheme(xtpPaneThemeGrippered);
  482. m_nSelectedTheme = ID_THEME_GRIPPERED;
  483. m_paneManager.GetPaintManager()->GetTabPaintManager()->m_clientFrame = xtpTabFrameBorder;
  484. SetCommandBarsTheme(xtpThemeOffice2000);
  485. }
  486. void CMainFrame::OnThemeVisio()
  487. {
  488. AdjustStyle(xtpPaneThemeVisio);
  489. SetDockingPaneTheme(xtpPaneThemeVisio);
  490. m_nSelectedTheme = ID_THEME_VISIO;
  491. SetCommandBarsTheme(xtpThemeOfficeXP);
  492. }
  493. void CMainFrame::OnThemeVisio2003()
  494. {
  495. AdjustStyle(xtpPaneThemeVisio);
  496. SetDockingPaneTheme(xtpPaneThemeOffice2003);
  497. m_nSelectedTheme = ID_THEME_VISIO_OFFICE2003;
  498. m_paneManager.GetPaintManager()->GetTabPaintManager()->SetAppearance(xtpTabAppearanceVisio);
  499. m_paneManager.GetPaintManager()->GetTabPaintManager()->SetColor(xtpTabColorOffice2003);
  500. m_paneManager.GetPaintManager()->GetTabPaintManager()->m_bHotTracking = TRUE;
  501. m_paneManager.GetPaintManager()->GetPanelPaintManager()->SetColor(xtpTabColorOffice2003);
  502. SetCommandBarsTheme(xtpThemeOffice2003);
  503. }
  504. void CMainFrame::OnThemeVisio2000()
  505. {
  506. AdjustStyle(xtpPaneThemeVisio);
  507. SetDockingPaneTheme(xtpPaneThemeDefault);
  508. m_nSelectedTheme = ID_THEME_VISIO_OFFICE2000;
  509. m_paneManager.GetPaintManager()->GetTabPaintManager()->SetAppearance(xtpTabAppearanceVisio);
  510. SetCommandBarsTheme(xtpThemeOffice2000);
  511. }
  512. void CMainFrame::OnThemeCustom()
  513. {
  514. AdjustStyle(xtpPaneThemeCustom);
  515. m_paneManager.SetCustomTheme(new CCustomTheme());
  516. m_nSelectedTheme = ID_THEME_CUSTOM;
  517. SetCommandBarsTheme(xtpThemeOfficeXP);
  518. }
  519. void CMainFrame::OnThemeCustom2()
  520. {
  521. AdjustStyle(xtpPaneThemeGrippered);
  522. m_paneManager.SetCustomTheme(new CXTPDockingPaneDefaultTheme());
  523. m_nSelectedTheme = ID_THEME_CUSTOM2;
  524. CXTPTabPaintManager* pTabPaintManager = m_paneManager.GetPaintManager()->GetTabPaintManager();
  525. pTabPaintManager->SetPosition(xtpTabPositionTop);
  526. pTabPaintManager->m_clientFrame = xtpTabFrameBorder;
  527. SetCommandBarsTheme(xtpThemeOffice2000);
  528. }
  529. void CMainFrame::OnThemeCustom3()
  530. {
  531. AdjustStyle(xtpPaneThemeOffice);
  532. m_nSelectedTheme = ID_THEME_CUSTOM3;
  533. m_paneManager.SetCustomTheme(new CXTPDockingPaneOfficeTheme());
  534. m_paneManager.GetPaintManager()->GetTabPaintManager()->SetAppearance(xtpTabAppearanceStateButtons);
  535. m_paneManager.GetPaintManager()->GetPanelPaintManager()->SetAppearance(xtpTabAppearanceStateButtons);
  536. SetCommandBarsTheme(xtpThemeOfficeXP);
  537. }
  538. void CMainFrame::OnThemeCustom4()
  539. {
  540. AdjustStyle(xtpPaneThemeVisio);
  541. m_nSelectedTheme = ID_THEME_CUSTOM4;
  542. m_paneManager.SetCustomTheme(new CXTPDockingPaneOfficeTheme());
  543. CXTPTabPaintManager* pTabPaintManager = m_paneManager.GetPaintManager()->GetTabPaintManager();
  544. pTabPaintManager->SetAppearance(xtpTabAppearanceExcel);
  545. pTabPaintManager->m_clientFrame = xtpTabFrameBorder;
  546. pTabPaintManager = m_paneManager.GetPaintManager()->GetPanelPaintManager();
  547. pTabPaintManager->SetAppearance(xtpTabAppearanceExcel);
  548. SetCommandBarsTheme(xtpThemeOfficeXP);
  549. }
  550. void CMainFrame::OnUpdateTheme(CCmdUI *pCmdUI)
  551. {
  552. pCmdUI->SetCheck(m_nSelectedTheme == pCmdUI->m_nID);
  553. }
  554. void CMainFrame::OnHideClient()
  555. {
  556. m_paneManager.HideClient(!m_paneManager.IsClientHidden());
  557. }
  558. void CMainFrame::OnUpdateHideClient(CCmdUI *pCmdUI)
  559. {
  560. pCmdUI->SetCheck(m_paneManager.IsClientHidden()? TRUE: FALSE);
  561. }
  562. void CMainFrame::OnUseSplitterTracker()
  563. {
  564. m_paneManager.UseSplitterTracker(!m_paneManager.IsSplitterTrackerUsed());
  565. }
  566. void CMainFrame::OnUpdateUseSplitterTracker(CCmdUI *pCmdUI)
  567. {
  568. pCmdUI->SetCheck(m_paneManager.IsSplitterTrackerUsed()? TRUE: FALSE);
  569. }
  570. void CMainFrame::OnThemedFloatingFrames()
  571. {
  572. m_paneManager.SetThemedFloatingFrames(!m_paneManager.IsThemedFloatingFrames());
  573. }
  574. void CMainFrame::OnUpdateThemedFloatingFrames(CCmdUI *pCmdUI)
  575. {
  576. pCmdUI->SetCheck(m_paneManager.IsThemedFloatingFrames()? TRUE: FALSE);
  577. }
  578. void CMainFrame::OnAlphaContext()
  579. {
  580. m_paneManager.SetAlphaDockingContext(!m_paneManager.IsAlphaDockingContext());
  581. }
  582. void CMainFrame::OnUpdateAlphaContext(CCmdUI *pCmdUI)
  583. {
  584. pCmdUI->SetCheck(m_paneManager.IsAlphaDockingContext()? TRUE: FALSE);
  585. }
  586. void CMainFrame::OnDockingStickers()
  587. {
  588. m_paneManager.SetShowDockingContextStickers(!m_paneManager.IsShowDockingContextStickers());
  589. }
  590. void CMainFrame::OnUpdateDockingStickers(CCmdUI *pCmdUI)
  591. {
  592. if (m_paneManager.IsAlphaDockingContext())
  593. {
  594. pCmdUI->SetCheck(m_paneManager.IsShowDockingContextStickers()? TRUE: FALSE);
  595. }
  596. else
  597. {
  598. pCmdUI->Enable(FALSE);
  599. }
  600. }
  601. void CMainFrame::OnMinMaxSamlpe()
  602. {
  603. m_bMinMaxSample = !m_bMinMaxSample;
  604. if (m_bMinMaxSample)
  605. {
  606. CXTPDockingPane* pPane = m_paneManager.FindPane(IDR_PANE1);
  607. ASSERT(pPane);
  608. pPane->SetMinTrackSize(CSize(100, 100));
  609. pPane->SetMaxTrackSize(CSize(150, 150));
  610. pPane = m_paneManager.FindPane(IDR_PANE2);
  611. ASSERT(pPane);
  612. pPane->SetMinTrackSize(CSize(130, 130));
  613. pPane->SetMaxTrackSize(CSize(130, 130));
  614. }
  615. else
  616. {
  617. CXTPDockingPane* pPane = m_paneManager.FindPane(IDR_PANE1);
  618. ASSERT(pPane);
  619. pPane->SetMinTrackSize(CSize(0, 0));
  620. pPane->SetMaxTrackSize(CSize(32000, 32000));
  621. pPane = m_paneManager.FindPane(IDR_PANE2);
  622. ASSERT(pPane);
  623. pPane->SetMinTrackSize(CSize(0, 0));
  624. pPane->SetMaxTrackSize(CSize(32000, 32000));
  625. }
  626. for (int i = 0; i < sizeof(m_wndPanes) / sizeof(m_wndPanes[0]); i++)
  627. {
  628. if (m_wndPanes[i].m_hWnd)
  629. {
  630. m_wndPanes[i].OnSize(0, 0, 0);
  631. m_wndPanes[i].RedrawWindow();
  632. }
  633. }
  634. m_paneManager.RedrawPanes();
  635. }
  636. void CMainFrame::OnUpdateMinMaxSamlpe(CCmdUI *pCmdUI)
  637. {
  638. pCmdUI->SetCheck(m_bMinMaxSample);
  639. }
  640. void CMainFrame::OnLoadFromFile()
  641. {
  642. CXTPDockingPaneLayout* pLayout = m_bEditor? m_pEditorLayout: m_pRunLayout;
  643. CString strFilter = _T("XML Document(*.xml)|*.xml|All files (*.*)|*.*||");
  644. CFileDialog fd(TRUE, _T("xml"), NULL, OFN_HIDEREADONLY|OFN_FILEMUSTEXIST, strFilter);
  645. if (fd.DoModal() == IDOK)
  646. {
  647. #ifndef _XTP_EXCLUDE_XML
  648. if (pLayout->LoadFromFile(fd.GetPathName(), _T("Common")))
  649. {
  650. m_paneManager.SetLayout(pLayout);
  651. }
  652. #else
  653. CFile file(fd.GetPathName(), CFile::modeRead);
  654. CArchive ar(&file, CArchive::load);
  655. pLayout->Serialize(ar);
  656. if (pLayout->IsValid())
  657. {
  658. m_paneManager.SetLayout(pLayout);
  659. }
  660. #endif
  661. }
  662. }
  663. void CMainFrame::OnSaveToFile()
  664. {
  665. CXTPDockingPaneLayout* pLayout = m_bEditor? m_pEditorLayout: m_pRunLayout;
  666. CString strFilter = _T("XML Document(*.xml)|*.xml|All files (*.*)|*.*||");
  667. CFileDialog fd(FALSE, _T("xml"), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, strFilter);
  668. if (fd.DoModal() == IDOK)
  669. {
  670. #ifndef _XTP_EXCLUDE_XML
  671. m_paneManager.GetLayout(pLayout);
  672. pLayout->SaveToFile(fd.GetPathName(), _T("Common"));
  673. #else
  674. m_paneManager.GetLayout(pLayout);
  675. CFile file(fd.GetPathName(), CFile::modeCreate|CFile::modeWrite);
  676. CArchive ar(&file, CArchive::store);
  677. pLayout->Serialize(ar);
  678. #endif
  679. }
  680. }
  681. void CMainFrame::OnLoadFromResource()
  682. {
  683. #ifndef _XTP_EXCLUDE_XML
  684. LPCTSTR lpszResourceName = MAKEINTRESOURCE(IDR_SPIRAL);
  685. CXTPPropExchangeXMLNode px(TRUE, NULL, _T("DockingPaneLayouts"));
  686. if (px.LoadFromResource(AfxGetInstanceHandle(), lpszResourceName, RT_HTML))
  687. {
  688. CXTPDockingPaneLayout* pLayout = m_bEditor? m_pEditorLayout: m_pRunLayout;
  689. CXTPPropExchangeSection pxCommon(px.GetSection(_T("Common")));
  690. if (pLayout->DoPropExchange(&pxCommon))
  691. {
  692. m_paneManager.SetLayout(pLayout);
  693. }
  694. }
  695. #endif
  696. }
  697. void CMainFrame::OnCustomize()
  698. {
  699. // Get a pointer to the command bars object.
  700. CXTPCommandBars* pCommandBars = GetCommandBars();
  701. if(pCommandBars != NULL)
  702. {
  703. // Instanciate the customize dialog object.
  704. CXTPCustomizeSheet dlg(pCommandBars);
  705. // Add the options page to the customize dialog.
  706. CXTPCustomizeOptionsPage pageOptions(&dlg);
  707. dlg.AddPage(&pageOptions);
  708. // Add the commands page to the customize dialog.
  709. CXTPCustomizeCommandsPage* pCommands = dlg.GetCommandsPage();
  710. pCommands->AddCategories(IDR_PaneTYPE);
  711. // Use the command bar manager to initialize the
  712. // customize dialog.
  713. pCommands->InsertAllCommandsCategory();
  714. pCommands->InsertBuiltInMenus(IDR_PaneTYPE);
  715. pCommands->InsertNewMenuCategory();
  716. // Dispaly the dialog.
  717. dlg.DoModal();
  718. }
  719. }
  720. void CMainFrame::OnClose()
  721. {
  722. // Save the current state for toolbars and menus.
  723. SaveCommandBars(_T("CommandBars"));
  724. CMDIFrameWnd::OnClose();
  725. }
  726. void CMainFrame::OnGetMinMaxInfo(LPMINMAXINFO pMinMaxInfo)
  727. {
  728. CMDIFrameWnd::OnGetMinMaxInfo(pMinMaxInfo);
  729. if (m_bMinMaxSample)
  730. {
  731. CXTPWindowRect rcWindow(this);
  732. CRect rcTopPane= m_paneManager.GetTopPane()->GetPaneWindowRect();
  733. CSize szBorder = rcWindow.Size() - rcTopPane.Size();
  734. MINMAXINFO mmi;
  735. m_paneManager.GetTopPane()->GetMinMaxInfo(&mmi);
  736. pMinMaxInfo->ptMinTrackSize = CPoint(mmi.ptMinTrackSize) + szBorder;
  737. }
  738. }
  739. //////////////////////////////////////////////////////////////////////////
  740. // CEditPane
  741. CEditPane::CEditPane()
  742. {
  743. }
  744. LRESULT CEditPane::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
  745. {
  746. if (message == WM_NCPAINT && GetExStyle() & WS_EX_STATICEDGE)
  747. {
  748. CRect rc;
  749. GetWindowRect(&rc);
  750. CWindowDC dc(this);
  751. rc.OffsetRect(-rc.TopLeft());
  752. COLORREF clrFrame = ((CMainFrame*)AfxGetMainWnd())->m_paneManager.GetPaintManager()->GetXtremeColor(XPCOLOR_FRAME);
  753. dc.Draw3dRect(rc, clrFrame, clrFrame);
  754. return TRUE;
  755. }
  756. return CXTPEdit::WindowProc(message, wParam, lParam);
  757. }
  758. BEGIN_MESSAGE_MAP(CEditPane, CXTPEdit)
  759. ON_WM_CTLCOLOR_REFLECT()
  760. ON_WM_SIZE()
  761. END_MESSAGE_MAP()
  762. HBRUSH CEditPane::CtlColor(CDC* pDC, UINT /*nCtlColor*/)
  763. {
  764. static CBrush brush(RGB(0xFF, 230, 191));
  765. pDC->SetBkMode(TRANSPARENT);
  766. if (!m_bMinMaxSample)
  767. return GetSysColorBrush(COLOR_WINDOW);
  768. CXTPDockingPaneManager& paneManager = ((CMainFrame*)AfxGetMainWnd())->m_paneManager;
  769. CXTPDockingPane* pPane = paneManager.FindPane(GetDlgCtrlID());
  770. if (pPane)
  771. {
  772. MINMAXINFO mmi;
  773. pPane->GetMinMaxInfo(&mmi);
  774. if (mmi.ptMinTrackSize.x > 0)
  775. {
  776. return brush;
  777. }
  778. }
  779. return GetSysColorBrush(COLOR_WINDOW);
  780. }
  781. void CEditPane::OnSize(UINT nType, int cx, int cy)
  782. {
  783. CEdit::OnSize(nType, cx, cy);
  784. if (!m_bMinMaxSample || (cx == 0 && cy == 0))
  785. return;
  786. CXTPDockingPaneManager& paneManager = ((CMainFrame*)AfxGetMainWnd())->m_paneManager;
  787. CXTPDockingPane* pPane = paneManager.FindPane(GetDlgCtrlID());
  788. if (pPane)
  789. {
  790. MINMAXINFO mmi;
  791. pPane->GetMinMaxInfo(&mmi);
  792. CString strInfo;
  793. if (mmi.ptMinTrackSize.x > 0)
  794. {
  795. CXTPWindowRect rc(this);
  796. strInfo.Format(_T("Tracking Size:rnMin (%i, %i)rnMax (%i, %i)rnCurrent (%i, %i)"),
  797. mmi.ptMinTrackSize.x, mmi.ptMinTrackSize.y, mmi.ptMaxTrackSize.x, mmi.ptMaxTrackSize.y, rc.Width(), rc.Height());
  798. }
  799. SetWindowText(strInfo);
  800. }
  801. }
  802. void CMainFrame::OnSetPreviewMode(BOOL bPreview, CPrintPreviewState* pState)
  803. {
  804. // Toggle CommandBars
  805. GetCommandBars()->OnSetPreviewMode(bPreview);
  806. // Toggle Docking Panes.
  807. m_paneManager.OnSetPreviewMode(bPreview);
  808. CMDIFrameWnd::OnSetPreviewMode(bPreview, pState);
  809. }
  810. void CMainFrame::SwitchDefaultPaneOptions(XTPDockingPaneOptions dwOption)
  811. {
  812. DWORD dwOptions = m_paneManager.GetDefaultPaneOptions();
  813. m_paneManager.SetDefaultPaneOptions(dwOptions & dwOption? dwOptions & ~dwOption: dwOptions | dwOption);
  814. m_paneManager.RecalcFramesLayout();
  815. }
  816. void CMainFrame::OnCaptionButtonClose()
  817. {
  818. SwitchDefaultPaneOptions(xtpPaneNoCloseable);
  819. }
  820. void CMainFrame::OnUpdateCaptionButtonClose(CCmdUI* pCmdUI)
  821. {
  822. pCmdUI->SetCheck(m_paneManager.GetDefaultPaneOptions() & xtpPaneNoCloseable? FALSE: TRUE);
  823. }
  824. void CMainFrame::OnCaptionButtonAutoHide()
  825. {
  826. SwitchDefaultPaneOptions(xtpPaneNoHideable);
  827. }
  828. void CMainFrame::OnUpdateCaptionButtonAutoHide(CCmdUI* pCmdUI)
  829. {
  830. pCmdUI->SetCheck(m_paneManager.GetDefaultPaneOptions() & xtpPaneNoHideable? FALSE: TRUE);
  831. }
  832. void CMainFrame::OnCaptionButtonMenu()
  833. {
  834. SwitchDefaultPaneOptions(xtpPaneHasMenuButton);
  835. }
  836. void CMainFrame::OnUpdateCaptionButtonMenu(CCmdUI* pCmdUI)
  837. {
  838. pCmdUI->SetCheck(m_paneManager.GetDefaultPaneOptions() & xtpPaneHasMenuButton? TRUE: FALSE);
  839. }
  840. void CMainFrame::OnCaptionButtonMaximize()
  841. {
  842. m_paneManager.ShowCaptionMaximizeButton(!m_paneManager.IsCaptionMaximizeButtonsVisible());
  843. }
  844. void CMainFrame::OnUpdateCaptionButtonMaximize(CCmdUI* pCmdUI)
  845. {
  846. pCmdUI->SetCheck(m_paneManager.IsCaptionMaximizeButtonsVisible()? TRUE: FALSE);
  847. }
  848. void CMainFrame::OnCaptionVisible()
  849. {
  850. m_paneManager.GetPaintManager()->m_bShowCaption = !m_paneManager.GetPaintManager()->m_bShowCaption;
  851. m_paneManager.RedrawPanes();
  852. }
  853. void CMainFrame::OnCaptionHorizontal()
  854. {
  855. m_paneManager.SetCaptionDirection(xtpPaneCaptionHorizontal);
  856. }
  857. void CMainFrame::OnCaptionVertical()
  858. {
  859. m_paneManager.SetCaptionDirection(xtpPaneCaptionVertical);
  860. }
  861. void CMainFrame::OnCaptionAutoBySize()
  862. {
  863. m_paneManager.SetCaptionDirection(xtpPaneCaptionAutoBySize);
  864. }
  865. void CMainFrame::OnCaptionAutoByPosition()
  866. {
  867. m_paneManager.SetCaptionDirection(xtpPaneCaptionAutoByPosition);
  868. }
  869. void CMainFrame::OnUpdateCaptionVisible(CCmdUI* pCmdUI)
  870. {
  871. pCmdUI->SetCheck(m_paneManager.GetPaintManager()->m_bShowCaption? TRUE: FALSE);
  872. }
  873. void CMainFrame::OnUpdateCaptionHorizontal(CCmdUI* pCmdUI)
  874. {
  875. pCmdUI->SetCheck(m_paneManager.GetCaptionDirection() == xtpPaneCaptionHorizontal? TRUE: FALSE);
  876. }
  877. void CMainFrame::OnUpdateCaptionVertical(CCmdUI* pCmdUI)
  878. {
  879. pCmdUI->SetCheck(m_paneManager.GetCaptionDirection() == xtpPaneCaptionVertical? TRUE: FALSE);
  880. }
  881. void CMainFrame::OnUpdateCaptionAutoBySize(CCmdUI* pCmdUI)
  882. {
  883. pCmdUI->SetCheck(m_paneManager.GetCaptionDirection() == xtpPaneCaptionAutoBySize? TRUE: FALSE);
  884. }
  885. void CMainFrame::OnUpdateCaptionAutoByPosition(CCmdUI* pCmdUI)
  886. {
  887. pCmdUI->SetCheck(m_paneManager.GetCaptionDirection() == xtpPaneCaptionAutoByPosition? TRUE: FALSE);
  888. }
  889. void CMainFrame::OnCloseButtonAffects()
  890. {
  891. m_paneManager.m_bCloseGroupOnButtonClick = !m_paneManager.m_bCloseGroupOnButtonClick;
  892. }
  893. void CMainFrame::OnAutoHideButtonAffects()
  894. {
  895. m_paneManager.m_bHideGroupOnButtonClick = !m_paneManager.m_bHideGroupOnButtonClick;
  896. }
  897. void CMainFrame::OnUpdateCloseButtonAffects(CCmdUI* pCmdUI)
  898. {
  899. pCmdUI->SetCheck(m_paneManager.m_bCloseGroupOnButtonClick? FALSE: TRUE);
  900. }
  901. void CMainFrame::OnUpdateAutoHideButtonAffects(CCmdUI* pCmdUI)
  902. {
  903. pCmdUI->SetCheck(m_paneManager.m_bHideGroupOnButtonClick? FALSE: TRUE);
  904. }
  905. void CMainFrame::OnUpdateShowContentsWhileDragging(CCmdUI* pCmdUI)
  906. {
  907. pCmdUI->SetCheck(m_paneManager.GetShowContentsWhileDragging()? TRUE: FALSE);
  908. }
  909. void CMainFrame::OnShowContentsWhileDragging()
  910. {
  911. m_paneManager.SetShowContentsWhileDragging(!m_paneManager.GetShowContentsWhileDragging());
  912. }
  913. void CMainFrame::OnStickyFloatingFrames()
  914. {
  915. m_paneManager.SetStickyFloatingFrames(!m_paneManager.IsStickyFloatingFrames());
  916. }
  917. void CMainFrame::OnUpdateStickyFloatingFrames(CCmdUI* pCmdUI)
  918. {
  919. pCmdUI->SetCheck(m_paneManager.IsStickyFloatingFrames() ? TRUE: FALSE);
  920. }
  921. void CMainFrame::OnTransparentFloatingFrames()
  922. {
  923. m_paneManager.SetFloatingFramesOpacity(m_paneManager.GetFloatingFramesOpacity() != 255 ? 255 : 200);
  924. }
  925. void CMainFrame::OnUpdateTransparentFloatingFrames(CCmdUI* pCmdUI)
  926. {
  927. pCmdUI->SetCheck(m_paneManager.GetFloatingFramesOpacity() != 255);
  928. }
  929. void CMainFrame::OnEnableSideDocking()
  930. {
  931. m_paneManager.EnableSideDocking(!m_paneManager.IsSideDockingEnabled());
  932. }
  933. void CMainFrame::OnUpdateEnableSideDocking(CCmdUI* pCmdUI)
  934. {
  935. pCmdUI->SetCheck(m_paneManager.IsSideDockingEnabled());
  936. }