2 * Copyright (C) 2003-2006 Gabest
3 * http://www.gabest.org
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)
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.
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
23 // PPagePlayer.cpp : implementation file
29 #include "PPagePlayer.h"
31 // CPPagePlayer dialog
33 IMPLEMENT_DYNAMIC(CPPagePlayer
, CPPageBase
)
34 CPPagePlayer::CPPagePlayer()
35 : CPPageBase(CPPagePlayer::IDD
, CPPagePlayer::IDD
)
36 , m_iAllowMultipleInst(0)
37 , m_iAlwaysOnTop(FALSE
)
39 , m_iShowBarsWhenFullScreen(FALSE
)
40 , m_nShowBarsWhenFullScreenTimeOut(0)
41 , m_iTitleBarTextStyle(0)
42 , m_bTitleBarTextTitle(0)
43 , m_fExitFullScreenAtTheEnd(FALSE
)
44 , m_fRememberWindowPos(FALSE
)
45 , m_fRememberWindowSize(FALSE
)
46 , m_fSnapToDesktopEdges(FALSE
)
48 , m_fKeepHistory(FALSE
)
49 , m_fHideCDROMsSubMenu(FALSE
)
51 , m_launchfullscreen(FALSE
)
55 CPPagePlayer::~CPPagePlayer()
59 void CPPagePlayer::DoDataExchange(CDataExchange
* pDX
)
61 __super::DoDataExchange(pDX
);
62 DDX_Radio(pDX
, IDC_RADIO1
, m_iAllowMultipleInst
);
63 DDX_Radio(pDX
, IDC_RADIO3
, m_iTitleBarTextStyle
);
64 DDX_Check(pDX
, IDC_CHECK13
, m_bTitleBarTextTitle
);
65 DDX_Check(pDX
, IDC_CHECK2
, m_iAlwaysOnTop
);
66 DDX_Check(pDX
, IDC_CHECK3
, m_fTrayIcon
);
67 DDX_Check(pDX
, IDC_CHECK4
, m_iShowBarsWhenFullScreen
);
68 DDX_Text(pDX
, IDC_EDIT1
, m_nShowBarsWhenFullScreenTimeOut
);
69 DDX_Check(pDX
, IDC_CHECK5
, m_fExitFullScreenAtTheEnd
);
70 DDX_Check(pDX
, IDC_CHECK6
, m_fRememberWindowPos
);
71 DDX_Check(pDX
, IDC_CHECK7
, m_fRememberWindowSize
);
72 DDX_Check(pDX
, IDC_CHECK12
, m_fSnapToDesktopEdges
);
73 DDX_Check(pDX
, IDC_CHECK8
, m_fUseIni
);
74 DDX_Control(pDX
, IDC_SPIN1
, m_nTimeOutCtrl
);
75 DDX_Check(pDX
, IDC_CHECK1
, m_fKeepHistory
);
76 DDX_Check(pDX
, IDC_CHECK10
, m_fHideCDROMsSubMenu
);
77 DDX_Check(pDX
, IDC_CHECK9
, m_priority
);
78 DDX_Check(pDX
, IDC_CHECK11
, m_launchfullscreen
);
81 BEGIN_MESSAGE_MAP(CPPagePlayer
, CPPageBase
)
82 ON_BN_CLICKED(IDC_CHECK8
, OnBnClickedCheck8
)
83 ON_UPDATE_COMMAND_UI(IDC_SPIN1
, OnUpdateTimeout
)
84 ON_UPDATE_COMMAND_UI(IDC_EDIT1
, OnUpdateTimeout
)
85 ON_UPDATE_COMMAND_UI(IDC_STATIC1
, OnUpdateTimeout
)
86 ON_UPDATE_COMMAND_UI(IDC_STATIC2
, OnUpdateTimeout
)
87 ON_UPDATE_COMMAND_UI(IDC_CHECK13
, OnUpdateCheck13
)
90 // CPPagePlayer message handlers
92 BOOL
CPPagePlayer::OnInitDialog()
94 __super::OnInitDialog();
96 AppSettings
& s
= AfxGetAppSettings();
98 m_iAllowMultipleInst
= s
.fAllowMultipleInst
;
99 m_iTitleBarTextStyle
= s
.iTitleBarTextStyle
;
100 m_bTitleBarTextTitle
= s
.fTitleBarTextTitle
;
101 m_iAlwaysOnTop
= s
.iOnTop
;
102 m_fTrayIcon
= s
.fTrayIcon
;
103 m_iShowBarsWhenFullScreen
= s
.fShowBarsWhenFullScreen
;
104 m_nShowBarsWhenFullScreenTimeOut
= s
.nShowBarsWhenFullScreenTimeOut
;
105 m_nTimeOutCtrl
.SetRange(-1, 10);
106 m_fExitFullScreenAtTheEnd
= s
.fExitFullScreenAtTheEnd
;
107 m_fRememberWindowPos
= s
.fRememberWindowPos
;
108 m_fRememberWindowSize
= s
.fRememberWindowSize
;
109 m_fSnapToDesktopEdges
= s
.fSnapToDesktopEdges
;
110 m_fUseIni
= ((CMPlayerCApp
*)AfxGetApp())->IsIniValid();
111 m_fKeepHistory
= s
.fKeepHistory
;
112 m_fHideCDROMsSubMenu
= s
.fHideCDROMsSubMenu
;
113 m_priority
= s
.priority
!= NORMAL_PRIORITY_CLASS
;
114 m_launchfullscreen
= s
.launchfullscreen
;
118 return TRUE
; // return TRUE unless you set the focus to a control
119 // EXCEPTION: OCX Property Pages should return FALSE
122 BOOL
CPPagePlayer::OnApply()
126 AppSettings
& s
= AfxGetAppSettings();
128 s
.fAllowMultipleInst
= !!m_iAllowMultipleInst
;
129 s
.iTitleBarTextStyle
= m_iTitleBarTextStyle
;
130 s
.fTitleBarTextTitle
= !!m_bTitleBarTextTitle
;
131 s
.iOnTop
= m_iAlwaysOnTop
;
132 s
.fTrayIcon
= !!m_fTrayIcon
;
133 s
.fShowBarsWhenFullScreen
= !!m_iShowBarsWhenFullScreen
;
134 s
.nShowBarsWhenFullScreenTimeOut
= m_nShowBarsWhenFullScreenTimeOut
;
135 s
.fExitFullScreenAtTheEnd
= !!m_fExitFullScreenAtTheEnd
;
136 s
.fRememberWindowPos
= !!m_fRememberWindowPos
;
137 s
.fRememberWindowSize
= !!m_fRememberWindowSize
;
138 s
.fSnapToDesktopEdges
= !!m_fSnapToDesktopEdges
;
139 s
.fKeepHistory
= !!m_fKeepHistory
;
140 s
.fHideCDROMsSubMenu
= !!m_fHideCDROMsSubMenu
;
141 s
.priority
= !m_priority
? NORMAL_PRIORITY_CLASS
: GetVersion() < 0 ? HIGH_PRIORITY_CLASS
: ABOVE_NORMAL_PRIORITY_CLASS
;
142 s
.launchfullscreen
= !!m_launchfullscreen
;
146 for(int i
= 0; i
< s
.MRU
.GetSize(); i
++) s
.MRU
.Remove(i
);
147 for(int i
= 0; i
< s
.MRUDub
.GetSize(); i
++) s
.MRUDub
.Remove(i
);
149 s
.MRUDub
.WriteList();
152 ((CMainFrame
*)AfxGetMainWnd())->ShowTrayIcon(s
.fTrayIcon
);
154 ::SetPriorityClass(::GetCurrentProcess(), s
.priority
);
156 return __super::OnApply();
159 void CPPagePlayer::OnBnClickedCheck8()
163 if(m_fUseIni
) ((CMPlayerCApp
*)AfxGetApp())->StoreSettingsToIni();
164 else ((CMPlayerCApp
*)AfxGetApp())->StoreSettingsToRegistry();
169 void CPPagePlayer::OnUpdateTimeout(CCmdUI
* pCmdUI
)
173 pCmdUI
->Enable(m_iShowBarsWhenFullScreen
);
176 void CPPagePlayer::OnUpdateCheck13(CCmdUI
* pCmdUI
)
180 pCmdUI
->Enable(m_iTitleBarTextStyle
== 1);