PPagePlayer.cpp
上传用户:tangyu_668
上传日期:2014-02-27
资源大小:678k
文件大小:6k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /* 
  2.  * Copyright (C) 2003-2006 Gabest
  3.  * http://www.gabest.org
  4.  *
  5.  *  This Program is free software; you can redistribute it and/or modify
  6.  *  it under the terms of the GNU General Public License as published by
  7.  *  the Free Software Foundation; either version 2, or (at your option)
  8.  *  any later version.
  9.  *   
  10.  *  This Program is distributed in the hope that it will be useful,
  11.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13.  *  GNU General Public License for more details.
  14.  *   
  15.  *  You should have received a copy of the GNU General Public License
  16.  *  along with GNU Make; see the file COPYING.  If not, write to
  17.  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  18.  *  http://www.gnu.org/copyleft/gpl.html
  19.  *
  20.  */
  21. // PPagePlayer.cpp : implementation file
  22. //
  23. #include "stdafx.h"
  24. #include "mplayerc.h"
  25. #include "MainFrm.h"
  26. #include "PPagePlayer.h"
  27. // CPPagePlayer dialog
  28. IMPLEMENT_DYNAMIC(CPPagePlayer, CPPageBase)
  29. CPPagePlayer::CPPagePlayer()
  30. : CPPageBase(CPPagePlayer::IDD, CPPagePlayer::IDD)
  31. , m_iAllowMultipleInst(0)
  32. , m_iAlwaysOnTop(FALSE)
  33. , m_fTrayIcon(FALSE)
  34. , m_iShowBarsWhenFullScreen(FALSE)
  35. , m_nShowBarsWhenFullScreenTimeOut(0)
  36. , m_iTitleBarTextStyle(0)
  37. , m_bTitleBarTextTitle(0)
  38. , m_fExitFullScreenAtTheEnd(FALSE)
  39. , m_fRememberWindowPos(FALSE)
  40. , m_fRememberWindowSize(FALSE)
  41. , m_fSnapToDesktopEdges(FALSE)
  42. , m_fUseIni(FALSE)
  43. , m_fKeepHistory(FALSE)
  44. , m_fHideCDROMsSubMenu(FALSE)
  45. , m_priority(FALSE)
  46. , m_launchfullscreen(FALSE)
  47. {
  48. }
  49. CPPagePlayer::~CPPagePlayer()
  50. {
  51. }
  52. void CPPagePlayer::DoDataExchange(CDataExchange* pDX)
  53. {
  54. __super::DoDataExchange(pDX);
  55. DDX_Radio(pDX, IDC_RADIO1, m_iAllowMultipleInst);
  56. DDX_Radio(pDX, IDC_RADIO3, m_iTitleBarTextStyle);
  57. DDX_Check(pDX, IDC_CHECK13, m_bTitleBarTextTitle);
  58. DDX_Check(pDX, IDC_CHECK2, m_iAlwaysOnTop);
  59. DDX_Check(pDX, IDC_CHECK3, m_fTrayIcon);
  60. DDX_Check(pDX, IDC_CHECK4, m_iShowBarsWhenFullScreen);
  61. DDX_Text(pDX, IDC_EDIT1, m_nShowBarsWhenFullScreenTimeOut);
  62. DDX_Check(pDX, IDC_CHECK5, m_fExitFullScreenAtTheEnd);
  63. DDX_Check(pDX, IDC_CHECK6, m_fRememberWindowPos);
  64. DDX_Check(pDX, IDC_CHECK7, m_fRememberWindowSize);
  65. DDX_Check(pDX, IDC_CHECK12, m_fSnapToDesktopEdges);
  66. DDX_Check(pDX, IDC_CHECK8, m_fUseIni);
  67. DDX_Control(pDX, IDC_SPIN1, m_nTimeOutCtrl);
  68. DDX_Check(pDX, IDC_CHECK1, m_fKeepHistory);
  69. DDX_Check(pDX, IDC_CHECK10, m_fHideCDROMsSubMenu);
  70. DDX_Check(pDX, IDC_CHECK9, m_priority);
  71. DDX_Check(pDX, IDC_CHECK11, m_launchfullscreen);
  72. }
  73. BEGIN_MESSAGE_MAP(CPPagePlayer, CPPageBase)
  74. ON_BN_CLICKED(IDC_CHECK8, OnBnClickedCheck8)
  75. ON_UPDATE_COMMAND_UI(IDC_SPIN1, OnUpdateTimeout)
  76. ON_UPDATE_COMMAND_UI(IDC_EDIT1, OnUpdateTimeout)
  77. ON_UPDATE_COMMAND_UI(IDC_STATIC1, OnUpdateTimeout)
  78. ON_UPDATE_COMMAND_UI(IDC_STATIC2, OnUpdateTimeout)
  79. ON_UPDATE_COMMAND_UI(IDC_CHECK13, OnUpdateCheck13)
  80. END_MESSAGE_MAP()
  81. // CPPagePlayer message handlers
  82. BOOL CPPagePlayer::OnInitDialog()
  83. {
  84. __super::OnInitDialog();
  85. AppSettings& s = AfxGetAppSettings();
  86. m_iAllowMultipleInst = s.fAllowMultipleInst;
  87. m_iTitleBarTextStyle = s.iTitleBarTextStyle;
  88. m_bTitleBarTextTitle = s.fTitleBarTextTitle;
  89. m_iAlwaysOnTop = s.iOnTop;
  90. m_fTrayIcon = s.fTrayIcon;
  91. m_iShowBarsWhenFullScreen = s.fShowBarsWhenFullScreen;
  92. m_nShowBarsWhenFullScreenTimeOut = s.nShowBarsWhenFullScreenTimeOut;
  93. m_nTimeOutCtrl.SetRange(-1, 10);
  94. m_fExitFullScreenAtTheEnd = s.fExitFullScreenAtTheEnd;
  95. m_fRememberWindowPos = s.fRememberWindowPos;
  96. m_fRememberWindowSize = s.fRememberWindowSize;
  97. m_fSnapToDesktopEdges = s.fSnapToDesktopEdges;
  98. m_fUseIni = ((CMPlayerCApp*)AfxGetApp())->IsIniValid();
  99. m_fKeepHistory = s.fKeepHistory;
  100. m_fHideCDROMsSubMenu = s.fHideCDROMsSubMenu;
  101. m_priority = s.priority != NORMAL_PRIORITY_CLASS;
  102. m_launchfullscreen = s.launchfullscreen;
  103. UpdateData(FALSE);
  104. return TRUE;  // return TRUE unless you set the focus to a control
  105. // EXCEPTION: OCX Property Pages should return FALSE
  106. }
  107. BOOL CPPagePlayer::OnApply()
  108. {
  109. UpdateData();
  110. AppSettings& s = AfxGetAppSettings();
  111. s.fAllowMultipleInst = !!m_iAllowMultipleInst;
  112. s.iTitleBarTextStyle = m_iTitleBarTextStyle;
  113. s.fTitleBarTextTitle = !!m_bTitleBarTextTitle;
  114. s.iOnTop = m_iAlwaysOnTop;
  115. s.fTrayIcon = !!m_fTrayIcon;
  116. s.fShowBarsWhenFullScreen = !!m_iShowBarsWhenFullScreen;
  117. s.nShowBarsWhenFullScreenTimeOut = m_nShowBarsWhenFullScreenTimeOut;
  118. s.fExitFullScreenAtTheEnd = !!m_fExitFullScreenAtTheEnd;
  119. s.fRememberWindowPos = !!m_fRememberWindowPos;
  120. s.fRememberWindowSize = !!m_fRememberWindowSize;
  121. s.fSnapToDesktopEdges = !!m_fSnapToDesktopEdges;
  122. s.fKeepHistory = !!m_fKeepHistory;
  123. s.fHideCDROMsSubMenu = !!m_fHideCDROMsSubMenu;
  124. s.priority = !m_priority ? NORMAL_PRIORITY_CLASS : GetVersion() < 0 ? HIGH_PRIORITY_CLASS : ABOVE_NORMAL_PRIORITY_CLASS;
  125. s.launchfullscreen = !!m_launchfullscreen;
  126. if(!m_fKeepHistory)
  127. {
  128. for(int i = 0; i < s.MRU.GetSize(); i++) s.MRU.Remove(i);
  129. for(int i = 0; i < s.MRUDub.GetSize(); i++) s.MRUDub.Remove(i);
  130. s.MRU.WriteList();
  131. s.MRUDub.WriteList();
  132. }
  133. ((CMainFrame*)AfxGetMainWnd())->ShowTrayIcon(s.fTrayIcon);
  134. ::SetPriorityClass(::GetCurrentProcess(), s.priority);
  135. return __super::OnApply();
  136. }
  137. void CPPagePlayer::OnBnClickedCheck8()
  138. {
  139. UpdateData();
  140. if(m_fUseIni) ((CMPlayerCApp*)AfxGetApp())->StoreSettingsToIni();
  141. else ((CMPlayerCApp*)AfxGetApp())->StoreSettingsToRegistry();
  142. SetModified();
  143. }
  144. void CPPagePlayer::OnUpdateTimeout(CCmdUI* pCmdUI)
  145. {
  146. UpdateData();
  147. pCmdUI->Enable(m_iShowBarsWhenFullScreen);
  148. }
  149. void CPPagePlayer::OnUpdateCheck13(CCmdUI* pCmdUI)
  150. {
  151. UpdateData();
  152. pCmdUI->Enable(m_iTitleBarTextStyle == 1);
  153. }