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

对话框与窗口

开发平台:

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 "PaneActions.h"
  22. #include "MainFrm.h"
  23. #include "PaneActionsDoc.h"
  24. #include "PaneActionsView.h"
  25. #ifdef _DEBUG
  26. #define new DEBUG_NEW
  27. #undef THIS_FILE
  28. static char THIS_FILE[] = __FILE__;
  29. #endif
  30. /////////////////////////////////////////////////////////////////////////////
  31. // CMainFrame
  32. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  33. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  34. //{{AFX_MSG_MAP(CMainFrame)
  35. ON_WM_CREATE()
  36. ON_COMMAND_RANGE(ID_ACTIONS_CLASSVIEW_CANCEL_ACTIONFLOATING, ID_ACTIONS_CLASSVIEW_CANCEL_ACTIONUNPINNING, OnActionsClassviewCancel)
  37. ON_UPDATE_COMMAND_UI_RANGE(ID_ACTIONS_CLASSVIEW_CANCEL_ACTIONFLOATING, ID_ACTIONS_CLASSVIEW_CANCEL_ACTIONUNPINNING, OnUpdateActionsClassviewCancel)
  38. ON_COMMAND_RANGE(ID_ACTIONS_CLASSVIEW_FLAGS_NOCLOSEABLE, ID_ACTIONS_CLASSVIEW_FLAGS_NOFLOATABLE, OnActionsClassviewFlags)
  39. ON_UPDATE_COMMAND_UI_RANGE(ID_ACTIONS_CLASSVIEW_FLAGS_NOCLOSEABLE, ID_ACTIONS_CLASSVIEW_FLAGS_NOFLOATABLE, OnUpdateActionsClassviewFlags)
  40. ON_COMMAND_RANGE(ID_ACTIONS_RESOURCEVIEW_CANCEL_ACTIONFLOATING, ID_ACTIONS_RESOURCEVIEW_CANCEL_ACTIONUNPINNING, OnActionsResourceviewCancel)
  41. ON_UPDATE_COMMAND_UI_RANGE(ID_ACTIONS_RESOURCEVIEW_CANCEL_ACTIONFLOATING, ID_ACTIONS_RESOURCEVIEW_CANCEL_ACTIONUNPINNING, OnUpdateActionsResourceviewCancel)
  42. ON_COMMAND_RANGE(ID_ACTIONS_RESOURCEVIEW_FLAGS_NOCLOSEABLE, ID_ACTIONS_RESOURCEVIEW_FLAGS_NOFLOATABLE, OnActionsResourceviewFlags)
  43. ON_UPDATE_COMMAND_UI_RANGE(ID_ACTIONS_RESOURCEVIEW_FLAGS_NOCLOSEABLE, ID_ACTIONS_RESOURCEVIEW_FLAGS_NOFLOATABLE, OnUpdateActionsResourceviewFlags)
  44. ON_COMMAND_RANGE(ID_ACTIONS_FILEVIEW_CANCEL_ACTIONFLOATING, ID_ACTIONS_FILEVIEW_CANCEL_ACTIONUNPINNING, OnActionsFileviewCancel)
  45. ON_UPDATE_COMMAND_UI_RANGE(ID_ACTIONS_FILEVIEW_CANCEL_ACTIONFLOATING, ID_ACTIONS_FILEVIEW_CANCEL_ACTIONUNPINNING, OnUpdateActionsFileviewCancel)
  46. ON_COMMAND_RANGE(ID_ACTIONS_FILEVIEW_FLAGS_NOCLOSEABLE, ID_ACTIONS_FILEVIEW_FLAGS_NOFLOATABLE, OnActionsFileviewFlags)
  47. ON_UPDATE_COMMAND_UI_RANGE(ID_ACTIONS_FILEVIEW_FLAGS_NOCLOSEABLE, ID_ACTIONS_FILEVIEW_FLAGS_NOFLOATABLE, OnUpdateActionsFileviewFlags)
  48. ON_COMMAND_RANGE(ID_ACTIONS_INFOVIEW_CANCEL_ACTIONFLOATING, ID_ACTIONS_INFOVIEW_CANCEL_ACTIONUNPINNING, OnActionsInfoviewCancel)
  49. ON_UPDATE_COMMAND_UI_RANGE(ID_ACTIONS_INFOVIEW_CANCEL_ACTIONFLOATING, ID_ACTIONS_INFOVIEW_CANCEL_ACTIONUNPINNING, OnUpdateActionsInfoviewCancel)
  50. ON_COMMAND_RANGE(ID_ACTIONS_INFOVIEW_FLAGS_NOCLOSEABLE, ID_ACTIONS_INFOVIEW_FLAGS_NOFLOATABLE, OnActionsInfoviewFlags)
  51. ON_UPDATE_COMMAND_UI_RANGE(ID_ACTIONS_INFOVIEW_FLAGS_NOCLOSEABLE, ID_ACTIONS_INFOVIEW_FLAGS_NOFLOATABLE, OnUpdateActionsInfoviewFlags)
  52. ON_COMMAND_RANGE(ID_ACTIONS_ALL_CANCEL_ACTIONFLOATING, ID_ACTIONS_ALL_CANCEL_ACTIONUNPINNING, OnActionsAllCancel)
  53. ON_UPDATE_COMMAND_UI_RANGE(ID_ACTIONS_ALL_CANCEL_ACTIONFLOATING, ID_ACTIONS_ALL_CANCEL_ACTIONUNPINNING, OnUpdateActionsAllCancel)
  54. ON_COMMAND_RANGE(ID_ACTIONS_ALL_FLAGS_NOCLOSEABLE, ID_ACTIONS_ALL_FLAGS_NOFLOATABLE, OnActionsAllFlags)
  55. ON_UPDATE_COMMAND_UI_RANGE(ID_ACTIONS_ALL_FLAGS_NOCLOSEABLE, ID_ACTIONS_ALL_FLAGS_NOFLOATABLE, OnUpdateActionsAllFlags)
  56. //}}AFX_MSG_MAP
  57. ON_MESSAGE(XTPWM_DOCKINGPANE_NOTIFY, OnDockingPaneNotify)
  58. ON_COMMAND(XTP_ID_CUSTOMIZE, OnCustomize)
  59. ON_WM_CLOSE()
  60. END_MESSAGE_MAP()
  61. static UINT indicators[] =
  62. {
  63. ID_SEPARATOR,           // status line indicator
  64. ID_INDICATOR_CAPS,
  65. ID_INDICATOR_NUM,
  66. ID_INDICATOR_SCRL,
  67. };
  68. /////////////////////////////////////////////////////////////////////////////
  69. // CMainFrame construction/destruction
  70. CMainFrame::CMainFrame()
  71. {
  72. ZeroMemory(&m_bCancelAction, sizeof(m_bCancelAction));
  73. }
  74. CMainFrame::~CMainFrame()
  75. {
  76. }
  77. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  78. {
  79. if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  80. return -1;
  81. if (!m_wndStatusBar.Create(this) ||
  82. !m_wndStatusBar.SetIndicators(indicators,
  83.   sizeof(indicators)/sizeof(UINT)))
  84. {
  85. TRACE0("Failed to create status barn");
  86. return -1;      // fail to create
  87. }
  88. if (!InitCommandBars())
  89. return -1;
  90. XTPPaintManager()->SetTheme(xtpThemeWhidbey);
  91. CXTPCommandBars* pCommandBars = GetCommandBars();
  92. CXTPCommandBar* pMenuBar = pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAINFRAME);
  93. pMenuBar->SetFlags(xtpFlagAddMDISysPopup);
  94. CXTPToolBar* pCommandBar = (CXTPToolBar*)pCommandBars->Add(_T("Standard"), xtpBarTop);
  95. if (!pCommandBar ||
  96. !pCommandBar->LoadToolBar(IDR_MAINFRAME))
  97. {
  98. TRACE0("Failed to create toolbarn");
  99. return -1;
  100. }
  101. // Load the previous state for toolbars and menus.
  102. LoadCommandBars(_T("CommandBars"));
  103. m_paneManager.InstallDockingPanes(this);
  104. m_paneManager.SetTheme(xtpPaneThemeWhidbey);
  105. // Create docking panes.
  106. CXTPDockingPane* pPaneClassView = m_paneManager.CreatePane(
  107. IDR_PANE_CLASSVIEW, CRect(0, 0,250, 120), xtpPaneDockLeft);
  108. CXTPDockingPane* pPaneResourceView = m_paneManager.CreatePane(
  109. IDR_PANE_RESOURCEVIEW, CRect(0, 0,200, 120), xtpPaneDockBottom, pPaneClassView);
  110. CXTPDockingPane* pPaneFileView = m_paneManager.CreatePane(
  111. IDR_PANE_FILEVIEW, CRect(0, 0,200, 120), xtpPaneDockBottom, pPaneClassView);
  112. CXTPDockingPane* pPaneInfoView = m_paneManager.CreatePane(
  113. IDR_PANE_INFOVIEW, CRect(0, 0,200, 120), xtpPaneDockBottom, pPaneClassView);
  114. m_paneManager.AttachPane(pPaneResourceView, pPaneClassView);
  115. m_paneManager.AttachPane(pPaneFileView, pPaneClassView);
  116. m_paneManager.AttachPane(pPaneInfoView, pPaneClassView);
  117. pPaneClassView->Select();
  118. // Set the icons for the docking pane tabs.
  119. int nIDs[] = {IDR_PANE_CLASSVIEW, IDR_PANE_RESOURCEVIEW, IDR_PANE_FILEVIEW, IDR_PANE_INFOVIEW};
  120. m_paneManager.SetIcons(IDB_PANEICONS, nIDs, 4, RGB(128, 0, 128));
  121. m_paneManager.GetPaintManager()->GetTabPaintManager()->m_clientFrame = xtpTabFrameBorder;
  122. m_paneManager.GetPaintManager()->GetTabPaintManager()->m_rcControlMargin.SetRect(3, 3, 3, 3);
  123. m_paneManager.SetThemedFloatingFrames(TRUE);
  124. return 0;
  125. }
  126. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  127. {
  128. if( !CFrameWnd::PreCreateWindow(cs) )
  129. return FALSE;
  130. cs.lpszClass = _T("XTPMainFrame");
  131. CXTPDrawHelpers::RegisterWndClass(AfxGetInstanceHandle(), cs.lpszClass, 
  132. CS_DBLCLKS, AfxGetApp()->LoadIcon(IDR_MAINFRAME));
  133. cs.style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
  134. return TRUE;
  135. }
  136. /////////////////////////////////////////////////////////////////////////////
  137. // CMainFrame diagnostics
  138. #ifdef _DEBUG
  139. void CMainFrame::AssertValid() const
  140. {
  141. CFrameWnd::AssertValid();
  142. }
  143. void CMainFrame::Dump(CDumpContext& dc) const
  144. {
  145. CFrameWnd::Dump(dc);
  146. }
  147. #endif //_DEBUG
  148. /////////////////////////////////////////////////////////////////////////////
  149. // CMainFrame message handlers
  150. LRESULT CMainFrame::OnDockingPaneNotify(WPARAM wParam, LPARAM lParam)
  151. {
  152. if (wParam == XTP_DPN_CONTEXTMENU)
  153. {
  154. return FALSE;
  155. }
  156. if (wParam == XTP_DPN_SHOWWINDOW)
  157. {
  158. // get a pointer to the docking pane being shown.
  159. CXTPDockingPane* pPane = (CXTPDockingPane*)lParam;
  160. if (!pPane->IsValid())
  161. {
  162. int nIndex = pPane->GetID() - IDR_PANE_CLASSVIEW;
  163. ASSERT(nIndex >=0 &&  nIndex < sizeof(m_wndPanes) / sizeof(m_wndPanes[0]));
  164. // create and attach the edit control for this pane.
  165. if (!::IsWindow(m_wndPanes[nIndex].m_hWnd))
  166. {
  167. if (!m_wndPanes[nIndex].CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), _T(""),
  168. WS_CHILD|ES_AUTOVSCROLL|ES_MULTILINE, CRect(0, 0,200, 120), this, 0))
  169. {
  170. TRACE0( "Error creating pane edit control.n" );
  171. }
  172. }
  173. pPane->Attach(&m_wndPanes[nIndex]);
  174. }
  175. return TRUE;
  176. }
  177. if (wParam == XTP_DPN_ACTION)
  178. {
  179. XTP_DOCKINGPANE_ACTION* pAction = (XTP_DOCKINGPANE_ACTION*)lParam;
  180. int nIndex = pAction->pPane->GetID() - IDR_PANE_CLASSVIEW;
  181. ASSERT(pAction->action < _countof(lpszActions));
  182. if (m_bCancelAction[nIndex][pAction->action])
  183. {
  184. pAction->bCancel = TRUE;
  185. }
  186. /*
  187. if (pAction->action == xtpPaneActionDocking)
  188. {
  189. if (pAction->pDockContainer->GetType() != xtpPaneTypeTabbedContainer && (pAction->dockDirection != xtpPaneDockLeft && pAction->dockDirection != xtpPaneDockRight))
  190. {
  191. pAction->bCancel = TRUE;
  192. }
  193. }*/
  194. ((CPaneActionsView*)GetActiveView())->AddAction(pAction);
  195. return TRUE;
  196. }
  197. return FALSE;
  198. }
  199. //////////////////////////////////////////////////////////////////////////
  200. void CMainFrame::OnActionsClassviewCancel(UINT nID)
  201. {
  202. int nIndex = nID - ID_ACTIONS_CLASSVIEW_CANCEL_ACTIONFLOATING;
  203. m_bCancelAction[0][nIndex] = !m_bCancelAction[0][nIndex];
  204. }
  205. void CMainFrame::OnUpdateActionsClassviewCancel(CCmdUI* pCmdUI)
  206. {
  207. int nIndex = pCmdUI->m_nID - ID_ACTIONS_CLASSVIEW_CANCEL_ACTIONFLOATING;
  208. pCmdUI->SetCheck(m_bCancelAction[0][nIndex]? TRUE: FALSE);
  209. }
  210. void CMainFrame::OnActionsClassviewFlags(UINT nID)
  211. {
  212. int nFlag = nID == ID_ACTIONS_CLASSVIEW_FLAGS_NOCLOSEABLE? xtpPaneNoCloseable:
  213. nID == ID_ACTIONS_CLASSVIEW_FLAGS_NOHIDEABLE? xtpPaneNoHideable: xtpPaneNoFloatable;
  214. CXTPDockingPane* pPane = m_paneManager.FindPane(IDR_PANE_CLASSVIEW);
  215. DWORD dwOptions = pPane->GetOptions();
  216. if (dwOptions & nFlag) dwOptions &= ~ dwOptions; else dwOptions |= nFlag;
  217. pPane->SetOptions(dwOptions);
  218. m_paneManager.RedrawPanes();
  219. }
  220. void CMainFrame::OnUpdateActionsClassviewFlags(CCmdUI* pCmdUI)
  221. {
  222. UINT nID = pCmdUI->m_nID;
  223. int nFlag = nID == ID_ACTIONS_CLASSVIEW_FLAGS_NOCLOSEABLE? xtpPaneNoCloseable:
  224. nID == ID_ACTIONS_CLASSVIEW_FLAGS_NOHIDEABLE? xtpPaneNoHideable: xtpPaneNoFloatable;
  225. pCmdUI->SetCheck(m_paneManager.FindPane(IDR_PANE_CLASSVIEW)->GetOptions() & nFlag? TRUE: FALSE);
  226. }
  227. //////////////////////////////////////////////////////////////////////////
  228. void CMainFrame::OnActionsResourceviewCancel(UINT nID)
  229. {
  230. int nIndex = nID - ID_ACTIONS_RESOURCEVIEW_CANCEL_ACTIONFLOATING;
  231. m_bCancelAction[1][nIndex] = !m_bCancelAction[1][nIndex];
  232. }
  233. void CMainFrame::OnUpdateActionsResourceviewCancel(CCmdUI* pCmdUI)
  234. {
  235. int nIndex = pCmdUI->m_nID - ID_ACTIONS_RESOURCEVIEW_CANCEL_ACTIONFLOATING;
  236. pCmdUI->SetCheck(m_bCancelAction[1][nIndex]? TRUE: FALSE);
  237. }
  238. void CMainFrame::OnActionsResourceviewFlags(UINT nID)
  239. {
  240. int nFlag = nID == ID_ACTIONS_RESOURCEVIEW_FLAGS_NOCLOSEABLE? xtpPaneNoCloseable:
  241. nID == ID_ACTIONS_RESOURCEVIEW_FLAGS_NOHIDEABLE? xtpPaneNoHideable: xtpPaneNoFloatable;
  242. CXTPDockingPane* pPane = m_paneManager.FindPane(IDR_PANE_RESOURCEVIEW);
  243. DWORD dwOptions = pPane->GetOptions();
  244. if (dwOptions & nFlag) dwOptions &= ~ dwOptions; else dwOptions |= nFlag;
  245. pPane->SetOptions(dwOptions);
  246. m_paneManager.RedrawPanes();
  247. }
  248. void CMainFrame::OnUpdateActionsResourceviewFlags(CCmdUI* pCmdUI)
  249. {
  250. UINT nID = pCmdUI->m_nID;
  251. int nFlag = nID == ID_ACTIONS_RESOURCEVIEW_FLAGS_NOCLOSEABLE? xtpPaneNoCloseable:
  252. nID == ID_ACTIONS_RESOURCEVIEW_FLAGS_NOHIDEABLE? xtpPaneNoHideable: xtpPaneNoFloatable;
  253. pCmdUI->SetCheck(m_paneManager.FindPane(IDR_PANE_RESOURCEVIEW)->GetOptions() & nFlag? TRUE: FALSE);
  254. }
  255. //////////////////////////////////////////////////////////////////////////
  256. void CMainFrame::OnActionsFileviewCancel(UINT nID)
  257. {
  258. int nIndex = nID - ID_ACTIONS_FILEVIEW_CANCEL_ACTIONFLOATING;
  259. m_bCancelAction[2][nIndex] = !m_bCancelAction[2][nIndex];
  260. }
  261. void CMainFrame::OnUpdateActionsFileviewCancel(CCmdUI* pCmdUI)
  262. {
  263. int nIndex = pCmdUI->m_nID - ID_ACTIONS_FILEVIEW_CANCEL_ACTIONFLOATING;
  264. pCmdUI->SetCheck(m_bCancelAction[2][nIndex]? TRUE: FALSE);
  265. }
  266. void CMainFrame::OnActionsFileviewFlags(UINT nID)
  267. {
  268. int nFlag = nID == ID_ACTIONS_FILEVIEW_FLAGS_NOCLOSEABLE? xtpPaneNoCloseable:
  269. nID == ID_ACTIONS_FILEVIEW_FLAGS_NOHIDEABLE? xtpPaneNoHideable: xtpPaneNoFloatable;
  270. CXTPDockingPane* pPane = m_paneManager.FindPane(IDR_PANE_FILEVIEW);
  271. DWORD dwOptions = pPane->GetOptions();
  272. if (dwOptions & nFlag) dwOptions &= ~ dwOptions; else dwOptions |= nFlag;
  273. pPane->SetOptions(dwOptions);
  274. m_paneManager.RedrawPanes();
  275. }
  276. void CMainFrame::OnUpdateActionsFileviewFlags(CCmdUI* pCmdUI)
  277. {
  278. UINT nID = pCmdUI->m_nID;
  279. int nFlag = nID == ID_ACTIONS_FILEVIEW_FLAGS_NOCLOSEABLE? xtpPaneNoCloseable:
  280. nID == ID_ACTIONS_FILEVIEW_FLAGS_NOHIDEABLE? xtpPaneNoHideable: xtpPaneNoFloatable;
  281. pCmdUI->SetCheck(m_paneManager.FindPane(IDR_PANE_FILEVIEW)->GetOptions() & nFlag? TRUE: FALSE);
  282. }
  283. //////////////////////////////////////////////////////////////////////////
  284. void CMainFrame::OnActionsInfoviewCancel(UINT nID)
  285. {
  286. int nIndex = nID - ID_ACTIONS_INFOVIEW_CANCEL_ACTIONFLOATING;
  287. m_bCancelAction[3][nIndex] = !m_bCancelAction[3][nIndex];
  288. }
  289. void CMainFrame::OnUpdateActionsInfoviewCancel(CCmdUI* pCmdUI)
  290. {
  291. int nIndex = pCmdUI->m_nID - ID_ACTIONS_INFOVIEW_CANCEL_ACTIONFLOATING;
  292. pCmdUI->SetCheck(m_bCancelAction[3][nIndex]? TRUE: FALSE);
  293. }
  294. void CMainFrame::OnActionsInfoviewFlags(UINT nID)
  295. {
  296. int nFlag = nID == ID_ACTIONS_INFOVIEW_FLAGS_NOCLOSEABLE? xtpPaneNoCloseable:
  297. nID == ID_ACTIONS_INFOVIEW_FLAGS_NOHIDEABLE? xtpPaneNoHideable: xtpPaneNoFloatable;
  298. CXTPDockingPane* pPane = m_paneManager.FindPane(IDR_PANE_INFOVIEW);
  299. DWORD dwOptions = pPane->GetOptions();
  300. if (dwOptions & nFlag) dwOptions &= ~ nFlag; else dwOptions |= nFlag;
  301. pPane->SetOptions(dwOptions);
  302. m_paneManager.RedrawPanes();
  303. }
  304. void CMainFrame::OnUpdateActionsInfoviewFlags(CCmdUI* pCmdUI)
  305. {
  306. UINT nID = pCmdUI->m_nID;
  307. int nFlag = nID == ID_ACTIONS_INFOVIEW_FLAGS_NOCLOSEABLE? xtpPaneNoCloseable:
  308. nID == ID_ACTIONS_INFOVIEW_FLAGS_NOHIDEABLE? xtpPaneNoHideable: xtpPaneNoFloatable;
  309. pCmdUI->SetCheck(m_paneManager.FindPane(IDR_PANE_INFOVIEW)->GetOptions() & nFlag? TRUE: FALSE);
  310. }
  311. //////////////////////////////////////////////////////////////////////////
  312. void CMainFrame::OnActionsAllCancel(UINT nID)
  313. {
  314. int nIndex = nID - ID_ACTIONS_ALL_CANCEL_ACTIONFLOATING;
  315. BOOL bCancel = m_bCancelAction[0][nIndex];
  316. m_bCancelAction[0][nIndex] = !bCancel;
  317. m_bCancelAction[1][nIndex] = !bCancel;
  318. m_bCancelAction[2][nIndex] = !bCancel;
  319. m_bCancelAction[3][nIndex] = !bCancel;
  320. }
  321. void CMainFrame::OnUpdateActionsAllCancel(CCmdUI* pCmdUI)
  322. {
  323. int nIndex = pCmdUI->m_nID - ID_ACTIONS_ALL_CANCEL_ACTIONFLOATING;
  324. pCmdUI->SetCheck(m_bCancelAction[0][nIndex] && m_bCancelAction[1][nIndex]
  325. && m_bCancelAction[2][nIndex] && m_bCancelAction[3][nIndex]? TRUE: FALSE);
  326. }
  327. void CMainFrame::OnActionsAllFlags(UINT nID)
  328. {
  329. int nFlag = nID == ID_ACTIONS_ALL_FLAGS_NOCLOSEABLE? xtpPaneNoCloseable:
  330. nID == ID_ACTIONS_ALL_FLAGS_NOHIDEABLE? xtpPaneNoHideable: xtpPaneNoFloatable;
  331. BOOL bSet = TRUE;
  332. POSITION pos = m_paneManager.GetPaneList().GetHeadPosition();
  333. while (pos)
  334. {
  335. if ((m_paneManager.GetPaneList().GetNext(pos)->GetOptions() & nFlag) == 0)
  336. bSet = FALSE;
  337. }
  338. pos = m_paneManager.GetPaneList().GetHeadPosition();
  339. while (pos)
  340. {
  341. CXTPDockingPane* pPane = m_paneManager.GetPaneList().GetNext(pos);
  342. DWORD dwOptions = pPane->GetOptions();
  343. if (bSet) dwOptions &= ~ nFlag; else dwOptions |= nFlag;
  344. pPane->SetOptions(dwOptions);
  345. }
  346. m_paneManager.RedrawPanes();
  347. }
  348. void CMainFrame::OnUpdateActionsAllFlags(CCmdUI* pCmdUI)
  349. {
  350. UINT nID = pCmdUI->m_nID;
  351. int nFlag = nID == ID_ACTIONS_ALL_FLAGS_NOCLOSEABLE? xtpPaneNoCloseable:
  352. nID == ID_ACTIONS_ALL_FLAGS_NOHIDEABLE? xtpPaneNoHideable: xtpPaneNoFloatable;
  353. BOOL bSet = TRUE;
  354. POSITION pos = m_paneManager.GetPaneList().GetHeadPosition();
  355. while (pos)
  356. {
  357. if ((m_paneManager.GetPaneList().GetNext(pos)->GetOptions() & nFlag) == 0)
  358. bSet = FALSE;
  359. }
  360. pCmdUI->SetCheck(bSet);
  361. }
  362. void CMainFrame::OnCustomize()
  363. {
  364. // Get a pointer to the command bars object.
  365. CXTPCommandBars* pCommandBars = GetCommandBars();
  366. if(pCommandBars != NULL)
  367. {
  368. // Instanciate the customize dialog object.
  369. CXTPCustomizeSheet dlg(pCommandBars);
  370. // Add the options page to the customize dialog.
  371. CXTPCustomizeOptionsPage pageOptions(&dlg);
  372. dlg.AddPage(&pageOptions);
  373. // Add the commands page to the customize dialog.
  374. CXTPCustomizeCommandsPage* pCommands = dlg.GetCommandsPage();
  375. pCommands->AddCategories(IDR_MAINFRAME);
  376. // Use the command bar manager to initialize the
  377. // customize dialog.
  378. pCommands->InsertAllCommandsCategory();
  379. pCommands->InsertBuiltInMenus(IDR_MAINFRAME);
  380. pCommands->InsertNewMenuCategory();
  381. // Dispaly the dialog.
  382. dlg.DoModal();
  383. }
  384. }
  385. void CMainFrame::OnClose()
  386. {
  387. // Save the current state for toolbars and menus.
  388. SaveCommandBars(_T("CommandBars"));
  389. CFrameWnd::OnClose();
  390. }