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

对话框与窗口

开发平台:

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 "StatusBar.h"
  22. #include "MainFrm.h"
  23. #ifdef _DEBUG
  24. #define new DEBUG_NEW
  25. #undef THIS_FILE
  26. static char THIS_FILE[] = __FILE__;
  27. #endif
  28. #define INT2THEME(i) (XTPPaintTheme)(i)
  29. AFX_STATIC XTPPaintTheme ThemeFromCommand(UINT nID)
  30. {
  31. switch (nID)
  32. {
  33. case ID_VIEW_THEME_OFFICE2000: return xtpThemeOffice2000;
  34. case ID_VIEW_THEME_OFFICEXP:   return xtpThemeOfficeXP;
  35. case ID_VIEW_THEME_OFFICE2003: return xtpThemeOffice2003;
  36. case ID_VIEW_THEME_OFFICE2007: return xtpThemeRibbon;
  37. }
  38. return xtpThemeOffice2000;
  39. }
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CMainFrame
  42. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  43. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  44. //{{AFX_MSG_MAP(CMainFrame)
  45. ON_WM_CREATE()
  46. ON_WM_CLOSE()
  47. ON_COMMAND(ID_STATUSBAR_SHOWBUTTONS, OnStatusBarShowButtons)
  48. ON_UPDATE_COMMAND_UI(ID_STATUSBAR_SHOWBUTTONS, OnUpdateStatusBarShowButtons)
  49. ON_COMMAND(ID_STATUSBAR_SHOWAVIANIMATION, OnStatusBarShowAviAnimation)
  50. ON_UPDATE_COMMAND_UI(ID_STATUSBAR_SHOWAVIANIMATION, OnUpdateStatusBarShowAviAnimation)
  51. ON_COMMAND(ID_STATUSBAR_SHOWPROGRESSBAR, OnStatusBarShowProgressBar)
  52. ON_UPDATE_COMMAND_UI(ID_STATUSBAR_SHOWPROGRESSBAR, OnUpdateStatusBarShowProgressBar)
  53. ON_COMMAND(ID_STATUSBAR_SHOWEDITCONTROL, OnStatusBarShowEditControl)
  54. ON_UPDATE_COMMAND_UI(ID_STATUSBAR_SHOWEDITCONTROL, OnUpdateStatusBarShowEditControl)
  55. ON_COMMAND(ID_STATUSBAR_SHOWCOMPANYLOGO, OnStatusBarShowCompanyLogo)
  56. ON_UPDATE_COMMAND_UI(ID_STATUSBAR_SHOWCOMPANYLOGO, OnUpdateStatusBarShowCompanyLogo)
  57. ON_COMMAND(ID_STATUSBAR_PLAYANIMATION, OnStatusBarPlayAnimation)
  58. ON_UPDATE_COMMAND_UI(ID_STATUSBAR_PLAYANIMATION, OnUpdateStatusBarPlayAnimation)
  59. ON_COMMAND(ID_STATUSBAR_TESTPROGRESS, OnStatusBarTestProgress)
  60. ON_UPDATE_COMMAND_UI(ID_STATUSBAR_TESTPROGRESS, OnUpdateStatusBarTestProgress)
  61. //}}AFX_MSG_MAP
  62. ON_XTP_CREATECONTROL()
  63. ON_XTP_EXECUTE(ID_VIEW_OFFICE_THEME, OnOfficeThemeChanged)
  64. ON_COMMAND(XTP_ID_CUSTOMIZE, OnCustomize)
  65. ON_COMMAND_RANGE(ID_VIEW_THEME_OFFICE2000, ID_VIEW_THEME_OFFICE2007, OnViewTheme)
  66. ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_THEME_OFFICE2000, ID_VIEW_THEME_OFFICE2007, OnUpdateViewTheme)
  67. ON_COMMAND_RANGE(ID_INDICATOR_PRINT, ID_INDICATOR_DRAFT, OnIndicatorButton)
  68. ON_UPDATE_COMMAND_UI_RANGE(ID_INDICATOR_PRINT, ID_INDICATOR_DRAFT, OnUpdateIndicatorButton)
  69. END_MESSAGE_MAP()
  70. static UINT indicators[] =
  71. {
  72. ID_SEPARATOR,           // status line indicator
  73. };
  74. /////////////////////////////////////////////////////////////////////////////
  75. // CMainFrame construction/destruction
  76. CMainFrame::CMainFrame()
  77. : m_bPlayAnimation(FALSE)
  78. {
  79. m_eOfficeTheme = INT2THEME(AfxGetApp()->GetProfileInt(
  80. _T("Settings"), _T("OfficeTheme"), xtpThemeOffice2007));
  81. m_nPaneID = 0;
  82. }
  83. CMainFrame::~CMainFrame()
  84. {
  85. AfxGetApp()->WriteProfileInt(
  86. _T("Settings"), _T("OfficeTheme"), m_eOfficeTheme);
  87. }
  88. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  89. {
  90. if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  91. return -1;
  92. if (!m_wndStatusBar.Create(this) ||
  93. !m_wndStatusBar.SetIndicators(indicators,
  94.   sizeof(indicators)/sizeof(UINT)))
  95. {
  96. TRACE0("Failed to create status barn");
  97. return -1;      // fail to create
  98. }
  99. if (!InitCommandBars())
  100. return -1;
  101. CXTPCommandBars* pCommandBars = GetCommandBars();
  102. pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAINFRAME);
  103. CXTPToolBar* pCommandBar = (CXTPToolBar*)pCommandBars->Add(_T("Standard"), xtpBarTop);
  104. if (!pCommandBar ||
  105. !pCommandBar->LoadToolBar(IDR_MAINFRAME))
  106. {
  107. TRACE0("Failed to create toolbarn");
  108. return -1;
  109. }
  110. pCommandBars->GetImageManager()->SetIcons(IDR_MAINFRAME, IDR_TOOLBAR_ALPHA);
  111. pCommandBars->GetShortcutManager()->SetAccelerators(IDR_MAINFRAME);
  112. m_wndStatusBar.GetPane(0)->SetBeginGroup(FALSE);
  113. AddLogo();
  114. m_wndStatusBar.SetRibbonDividerIndex(m_wndStatusBar.GetPaneCount() - 1);
  115. AddEdit();
  116. AddProgress();
  117. AddAnimation();
  118. AddSwitchButtons();
  119. AddZoomButton();
  120. AddZoomSlider();
  121. m_wndStatusBar.EnableCustomization();
  122. // Load the previous state for command bars.
  123. LoadCommandBars(_T("CommandBars"));
  124. SetOfficeTheme(xtpThemeRibbon);
  125. return 0;
  126. }
  127. int CMainFrame::OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl)
  128. {
  129. if (lpCreateControl->nID == ID_VIEW_OFFICE_THEME)
  130. {
  131. CXTPControlComboBox* pComboTheme = (CXTPControlComboBox*)CXTPControlComboBox::CreateObject();
  132. if (pComboTheme != NULL)
  133. {
  134. pComboTheme->SetWidth(200);
  135. pComboTheme->SetCaption(_T("Theme:"));
  136. pComboTheme->SetStyle(xtpComboLabel);
  137. pComboTheme->SetFlags(xtpFlagManualUpdate);
  138. pComboTheme->SetItemData(pComboTheme->AddString(_T("Office 2007")), xtpThemeRibbon);
  139. pComboTheme->SetItemData(pComboTheme->AddString(_T("Office 2003")), xtpThemeOffice2003);
  140. pComboTheme->SetItemData(pComboTheme->AddString(_T("Office XP")),   xtpThemeOfficeXP);
  141. pComboTheme->SetItemData(pComboTheme->AddString(_T("Office 2000")), xtpThemeOffice2000);
  142. lpCreateControl->pControl = pComboTheme;
  143. UpdateThemeCombo(xtpThemeRibbon, pComboTheme);
  144. return TRUE;
  145. }
  146. }
  147. return FALSE;
  148. }
  149. BOOL CMainFrame::UpdateThemeCombo(XTPPaintTheme eOfficeTheme, CXTPControlComboBox* pComboTheme /*=NULL*/)
  150. {
  151. if (pComboTheme == NULL)
  152. {
  153. CXTPCommandBars* pCommandBars = GetCommandBars();
  154. if (pCommandBars)
  155. {
  156. pComboTheme = (CXTPControlComboBox*)pCommandBars->FindControl(
  157. xtpControlComboBox, ID_VIEW_OFFICE_THEME, TRUE, FALSE);
  158. }
  159. if (pComboTheme == NULL)
  160. return FALSE;
  161. }
  162. switch (eOfficeTheme)
  163. {
  164. case xtpThemeOffice2000: pComboTheme->SetCurSel(3); break;
  165. case xtpThemeOfficeXP:   pComboTheme->SetCurSel(2); break;
  166. case xtpThemeOffice2003: pComboTheme->SetCurSel(1); break;
  167. case xtpThemeRibbon:     pComboTheme->SetCurSel(0); break;
  168. }
  169. return TRUE;
  170. }
  171. void CMainFrame::OnOfficeThemeChanged(NMHDR* pNMHDR, LRESULT* pResult)
  172. {
  173. NMXTPCONTROL* tagNMCONTROL = (NMXTPCONTROL*)pNMHDR;
  174. CXTPControlComboBox* pControl = (CXTPControlComboBox*)tagNMCONTROL->pControl;
  175. ASSERT(pControl->GetType() == xtpControlComboBox);
  176. if (pControl->GetType() != xtpControlComboBox)
  177. {
  178. ASSERT(FALSE);
  179. return;
  180. }
  181. int nCurSel = pControl->GetCurSel();
  182. if (nCurSel < 0 || nCurSel >= pControl->GetCount())
  183. {
  184. ASSERT(FALSE);
  185. return;
  186. }
  187. SetOfficeTheme(INT2THEME(pControl->GetItemData(nCurSel)));
  188. *pResult = 1;
  189. }
  190. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  191. {
  192. if( !CFrameWnd::PreCreateWindow(cs) )
  193. return FALSE;
  194. cs.lpszClass = _T("XTPMainFrame");
  195. CXTPDrawHelpers::RegisterWndClass(AfxGetInstanceHandle(), cs.lpszClass, 
  196. CS_DBLCLKS, AfxGetApp()->LoadIcon(IDR_MAINFRAME));
  197. return TRUE;
  198. }
  199. /////////////////////////////////////////////////////////////////////////////
  200. // CMainFrame diagnostics
  201. #ifdef _DEBUG
  202. void CMainFrame::AssertValid() const
  203. {
  204. CFrameWnd::AssertValid();
  205. }
  206. void CMainFrame::Dump(CDumpContext& dc) const
  207. {
  208. CFrameWnd::Dump(dc);
  209. }
  210. #endif //_DEBUG
  211. /////////////////////////////////////////////////////////////////////////////
  212. // CMainFrame message handlers
  213. void CMainFrame::AddAnimation()
  214. {
  215. if (!m_wndAnimCtrl.Create(WS_CHILD|WS_VISIBLE|ACS_CENTER,
  216. CRect(0,0,0,0), &m_wndStatusBar, 0))
  217. {
  218. TRACE0("Failed to create avi control.n");
  219. return;
  220. }
  221. m_wndAnimCtrl.Open(IDR_HEARTBEAT);
  222. // add the indicator to the status bar.
  223. CXTPStatusBarPane* pPane = m_wndStatusBar.AddIndicator(ID_INDICATOR_ANIM);
  224. // Initialize the pane info and add the control.
  225. int nIndex = m_wndStatusBar.CommandToIndex(ID_INDICATOR_ANIM);
  226. ASSERT (nIndex != -1);
  227. m_wndStatusBar.SetPaneWidth(nIndex, 14);
  228. m_wndStatusBar.SetPaneStyle(nIndex, m_wndStatusBar.GetPaneStyle(nIndex) | SBPS_POPOUT);
  229. m_wndStatusBar.AddControl(&m_wndAnimCtrl, ID_INDICATOR_ANIM, FALSE);
  230. pPane->SetCustomizationVisible(FALSE);
  231. }
  232. void CMainFrame::AddZoomButton()
  233. {
  234. CXTPStatusBarPane* pPane = m_wndStatusBar.AddIndicator(ID_INDICATOR_ZOOM);
  235. pPane->SetText(_T("100%"));
  236. pPane->SetWidth(pPane->GetBestFit());
  237. pPane->SetButton();
  238. pPane->SetTextAlignment(DT_CENTER);
  239. pPane->SetTooltip(_T("Zoom level. Click to open the Zoom dialog box."));
  240. pPane->SetBeginGroup(FALSE);
  241. pPane->SetCaption(_T("&Zoom"));
  242. }
  243. void CMainFrame::AddZoomSlider()
  244. {
  245. CXTPStatusBarSliderPane* pZoomPane = (CXTPStatusBarSliderPane*)m_wndStatusBar.AddIndicator(new CXTPStatusBarSliderPane(), ID_INDICATOR_ZOOMSLIDER);
  246. pZoomPane->SetWidth(130);
  247. pZoomPane->SetPos(100);
  248. pZoomPane->SetRange(0, 200);
  249. pZoomPane->SetStyle(SBPS_NOBORDERS);
  250. pZoomPane->SetBeginGroup(FALSE);
  251. pZoomPane->SetCaption(_T("&Zoom Slider"));
  252. pZoomPane->SetTooltip(_T("Zoom"));
  253. }
  254. void CMainFrame::AddSwitchButtons()
  255. {
  256. static UINT switches[] =
  257. {
  258. ID_INDICATOR_PRINT,
  259. ID_INDICATOR_FULLSCREEN,
  260. ID_INDICATOR_WEB,
  261. ID_INDICATOR_OUTLINE,
  262. ID_INDICATOR_DRAFT,
  263. };
  264. CXTPStatusBarSwitchPane* pSwitchPane = (CXTPStatusBarSwitchPane*)m_wndStatusBar.AddIndicator(new CXTPStatusBarSwitchPane(), ID_INDICATOR_VIEW);
  265. pSwitchPane->SetSwitches(switches, sizeof(switches)/sizeof(UINT));
  266. pSwitchPane->SetChecked(ID_INDICATOR_PRINT);
  267. for (int i = 0; i < sizeof(switches)/sizeof(UINT); i++)
  268. {
  269. m_wndStatusBar.GetImageManager()->SetIcon(switches[i], switches[i]);
  270. }
  271. pSwitchPane->BestFit();
  272. m_wndStatusBar.UpdateAllPanes(TRUE, FALSE);
  273. m_strMessage.LoadString(ID_INDICATOR_PRINT);
  274. }
  275. void CMainFrame::AddEdit()
  276. {
  277. // Create the edit control and add it to the status bar
  278. if (!m_wndEditCtrl.CreateEx(WS_EX_STATICEDGE, _T("edit"), _T("Hello World"),
  279. WS_CHILD|WS_VISIBLE, CRect(0,0,0,0), &m_wndStatusBar, 0))
  280. {
  281. TRACE0("Failed to create edit control.n");
  282. return;
  283. }
  284. m_wndEditCtrl.SetFont(m_wndStatusBar.GetFont());
  285. // add the indicator to the status bar.
  286. CXTPStatusBarPane* pPane = m_wndStatusBar.AddIndicator(ID_INDICATOR_EDIT);
  287. // Initialize the pane info and add the control.
  288. int nIndex = m_wndStatusBar.CommandToIndex(ID_INDICATOR_EDIT);
  289. ASSERT (nIndex != -1);
  290. m_wndStatusBar.SetPaneWidth(nIndex, 75);
  291. m_wndStatusBar.SetPaneStyle(nIndex, m_wndStatusBar.GetPaneStyle(nIndex) | SBPS_NOBORDERS);
  292. m_wndStatusBar.AddControl(&m_wndEditCtrl, ID_INDICATOR_EDIT, FALSE);
  293. pPane->SetCustomizationVisible(FALSE);
  294. }
  295. void CMainFrame::AddLogo()
  296. {
  297. #if 0 // Obsolete 
  298. if (!m_wndLogoPane.Create(_T("Codejock Software"), &m_wndStatusBar))
  299. {
  300. TRACE0("Failed to create logo control.n");
  301. return;
  302. }
  303. int nWidth = m_wndLogoPane.GetTextSize().cx;
  304. // add the indicator to the status bar.
  305. m_wndStatusBar.AddIndicator(ID_INDICATOR_LOGO, 0);
  306. // Initialize the pane info and add the control.
  307. int nIndex = m_wndStatusBar.CommandToIndex(ID_INDICATOR_LOGO);
  308. ASSERT (nIndex != -1);
  309. m_wndStatusBar.SetPaneWidth(nIndex, nWidth);
  310. m_wndStatusBar.SetPaneStyle(nIndex, m_wndStatusBar.GetPaneStyle(nIndex) | SBPS_POPOUT);
  311. m_wndStatusBar.AddControl(&m_wndLogoPane, ID_INDICATOR_LOGO, FALSE);
  312. #else
  313. CXTPStatusBarPane* pPane = m_wndStatusBar.AddIndicator(ID_INDICATOR_LOGO, 0);
  314. #ifndef _XTP_INCLUDE_MARKUP
  315. pPane->SetText(_T("Codejock Software"));
  316. pPane->SetTextColor(0x915f36);
  317. CXTPPaintManager::CNonClientMetrics ncm;
  318. ncm.lfMenuFont.lfWeight = FW_BOLD;
  319. pPane->SetTextFont(&ncm.lfMenuFont);
  320. #else
  321. m_wndStatusBar.EnableMarkup(TRUE);
  322. pPane->SetText(_T("<TextBlock VerticalAlignment='Center'><Bold><Run Foreground='#365f91'>Codejock</Run> <Run Foreground='Black'>Software</Run></Bold></TextBlock>"));
  323. #endif
  324. pPane->SetCaption(_T("Application Logo"));
  325. pPane->SetStyle(pPane->GetStyle() | SBPS_POPOUT);
  326. #endif
  327. }
  328. void CMainFrame::AddProgress()
  329. {
  330. // Create the edit control and add it to the status bar
  331. if (!m_wndProgCtrl.Create(WS_CHILD|WS_VISIBLE|PBS_SMOOTH,
  332. CRect(0,0,0,0), &m_wndStatusBar, 0))
  333. {
  334. TRACE0("Failed to create edit control.n");
  335. return;
  336. }
  337. // add the indicator to the status bar.
  338. CXTPStatusBarPane* pPane = m_wndStatusBar.AddIndicator(ID_INDICATOR_PROG);
  339. // Initialize the pane info and add the control.
  340. int nIndex = m_wndStatusBar.CommandToIndex(ID_INDICATOR_PROG);
  341. ASSERT (nIndex != -1);
  342. pPane->SetCaption(pPane->GetText());
  343. pPane->SetText(_T(""));
  344. m_wndStatusBar.SetPaneWidth(nIndex, 150);
  345. m_wndStatusBar.SetPaneStyle(nIndex, m_wndStatusBar.GetPaneStyle(nIndex) | SBPS_NOBORDERS);
  346. m_wndStatusBar.AddControl(&m_wndProgCtrl, ID_INDICATOR_PROG, FALSE);
  347. // initialize progress control.
  348. m_wndProgCtrl.SetRange (0, 5000);
  349. m_wndProgCtrl.SetPos (0);
  350. m_wndProgCtrl.SetStep (1);
  351. pPane->SetCustomizationVisible(FALSE);
  352. }
  353. void CMainFrame::TestProgress()
  354. {
  355. m_wndProgCtrl.SetPos (0);
  356. int i;
  357. for (i = 0; i <= 5000; i++)
  358. {
  359. m_wndProgCtrl.StepIt();
  360. }
  361. }
  362. void CMainFrame::SetOfficeTheme(XTPPaintTheme eOfficeTheme)
  363. {
  364. m_eOfficeTheme = eOfficeTheme;
  365. XTPPaintManager()->SetTheme(eOfficeTheme);
  366. EnableOffice2007Frame((eOfficeTheme == xtpThemeRibbon)?
  367. GetCommandBars(): NULL);
  368. GetCommandBars()->RedrawCommandBars();
  369. RedrawWindow( NULL, NULL,
  370. RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN );
  371. }
  372. void CMainFrame::OnViewTheme(UINT nID)
  373. {
  374. SetOfficeTheme(
  375. ThemeFromCommand(nID));
  376. UpdateThemeCombo(
  377. ThemeFromCommand(nID));
  378. }
  379. void CMainFrame::OnUpdateViewTheme(CCmdUI* pCmdUI)
  380. {
  381. pCmdUI->SetCheck(m_eOfficeTheme == 
  382. ThemeFromCommand(pCmdUI->m_nID));
  383. }
  384. void CMainFrame::OnIndicatorButton(UINT nID)
  385. {
  386. m_nPaneID = nID;
  387. m_strMessage.LoadString(nID);
  388. CView* pView = GetActiveView();
  389. if (pView)
  390. {
  391. pView->RedrawWindow();
  392. }
  393. CXTPStatusBarSwitchPane* pSwitchPane = (CXTPStatusBarSwitchPane*)m_wndStatusBar.FindPane(ID_INDICATOR_VIEW);
  394. pSwitchPane->SetChecked(nID);
  395. };
  396. void CMainFrame::OnUpdateIndicatorButton(CCmdUI* pCmdUI)
  397. {
  398. pCmdUI->SetCheck(pCmdUI->m_nID == m_nPaneID);
  399. };
  400. void CMainFrame::OnClose()
  401. {
  402. // Save the current state for command bars.
  403. SaveCommandBars(_T("CommandBars"));
  404. CFrameWnd::OnClose();
  405. }
  406. void CMainFrame::OnCustomize()
  407. {
  408. // get a pointer to the command bars object.
  409. CXTPCommandBars* pCommandBars = GetCommandBars();
  410. if (pCommandBars == NULL)
  411. return;
  412. // instantiate the customize dialog
  413. CXTPCustomizeSheet dlg(pCommandBars);
  414. // add the options page to the customize dialog.
  415. CXTPCustomizeOptionsPage pageOptions(&dlg);
  416. dlg.AddPage(&pageOptions);
  417. // add the commands page to the customize dialog.
  418. CXTPCustomizeCommandsPage* pPageCommands = dlg.GetCommandsPage();
  419. pPageCommands->AddCategories(IDR_STATUSTYPE);
  420. // initialize the commands page page.
  421. pPageCommands->InsertAllCommandsCategory();
  422. pPageCommands->InsertBuiltInMenus(IDR_STATUSTYPE);
  423. pPageCommands->InsertNewMenuCategory();
  424. // display the customize dialog.
  425. dlg.DoModal();
  426. }
  427. void CMainFrame::OnStatusBarShowButtons() 
  428. {
  429. CXTPStatusBarPane* pPane = m_wndStatusBar.FindPane(ID_INDICATOR_VIEW);
  430. pPane->SetCustomizationVisible(!pPane->GetCustomizationVisible());
  431. }
  432. void CMainFrame::OnUpdateStatusBarShowButtons(CCmdUI* pCmdUI) 
  433. {
  434. CXTPStatusBarPane* pPane = m_wndStatusBar.FindPane(ID_INDICATOR_VIEW);
  435. pCmdUI->SetCheck(pPane->GetCustomizationVisible());
  436. }
  437. void CMainFrame::OnStatusBarShowAviAnimation() 
  438. {
  439. CXTPStatusBarPane* pPane = m_wndStatusBar.FindPane(ID_INDICATOR_ANIM);
  440. pPane->SetCustomizationVisible(!pPane->GetCustomizationVisible());
  441. }
  442. void CMainFrame::OnUpdateStatusBarShowAviAnimation(CCmdUI* pCmdUI) 
  443. {
  444. CXTPStatusBarPane* pPane = m_wndStatusBar.FindPane(ID_INDICATOR_ANIM);
  445. pCmdUI->SetCheck(pPane->GetCustomizationVisible());
  446. }
  447. void CMainFrame::OnStatusBarShowProgressBar() 
  448. {
  449. CXTPStatusBarPane* pPane = m_wndStatusBar.FindPane(ID_INDICATOR_PROG);
  450. pPane->SetCustomizationVisible(!pPane->GetCustomizationVisible());
  451. }
  452. void CMainFrame::OnUpdateStatusBarShowProgressBar(CCmdUI* pCmdUI) 
  453. {
  454. CXTPStatusBarPane* pPane = m_wndStatusBar.FindPane(ID_INDICATOR_PROG);
  455. pCmdUI->SetCheck(pPane->GetCustomizationVisible());
  456. }
  457. void CMainFrame::OnStatusBarShowEditControl() 
  458. {
  459. CXTPStatusBarPane* pPane = m_wndStatusBar.FindPane(ID_INDICATOR_EDIT);
  460. pPane->SetCustomizationVisible(!pPane->GetCustomizationVisible());
  461. }
  462. void CMainFrame::OnUpdateStatusBarShowEditControl(CCmdUI* pCmdUI) 
  463. {
  464. CXTPStatusBarPane* pPane = m_wndStatusBar.FindPane(ID_INDICATOR_EDIT);
  465. pCmdUI->SetCheck(pPane->GetCustomizationVisible());
  466. }
  467. void CMainFrame::OnStatusBarShowCompanyLogo() 
  468. {
  469. CXTPStatusBarPane* pPane = m_wndStatusBar.FindPane(ID_INDICATOR_LOGO);
  470. pPane->SetCustomizationVisible(!pPane->GetCustomizationVisible());
  471. }
  472. void CMainFrame::OnUpdateStatusBarShowCompanyLogo(CCmdUI* pCmdUI) 
  473. {
  474. CXTPStatusBarPane* pPane = m_wndStatusBar.FindPane(ID_INDICATOR_LOGO);
  475. pCmdUI->SetCheck(pPane->GetCustomizationVisible());
  476. }
  477. void CMainFrame::OnStatusBarPlayAnimation() 
  478. {
  479. m_bPlayAnimation = !m_bPlayAnimation;
  480. if (m_bPlayAnimation)
  481. {
  482. m_wndAnimCtrl.Play(0, (UINT)-1, (UINT)-1);
  483. }
  484. else
  485. {
  486. m_wndAnimCtrl.Stop();
  487. }
  488. }
  489. void CMainFrame::OnUpdateStatusBarPlayAnimation(CCmdUI* pCmdUI) 
  490. {
  491. CXTPStatusBarPane* pPane = m_wndStatusBar.FindPane(ID_INDICATOR_ANIM);
  492. pCmdUI->Enable(pPane->GetCustomizationVisible());
  493. pCmdUI->SetText(m_bPlayAnimation? _T("S&top Animation"): _T("P&lay Animation"));
  494. }
  495. void CMainFrame::OnStatusBarTestProgress() 
  496. {
  497. TestProgress();
  498. }
  499. void CMainFrame::OnUpdateStatusBarTestProgress(CCmdUI* pCmdUI) 
  500. {
  501. CXTPStatusBarPane* pPane = m_wndStatusBar.FindPane(ID_INDICATOR_PROG);
  502. pCmdUI->Enable(pPane->GetCustomizationVisible());
  503. }