- Main Page
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

# PPagePlayer.cpp

    00001 /*
    00002  *      Copyright (C) 2003-2005 Gabest
    00003  *      http://www.gabest.org
    00004  *
    00005  *  This Program is free software; you can redistribute it and/or modify
    00006  *  it under the terms of the GNU General Public License as published by
    00007  *  the Free Software Foundation; either version 2, or (at your option)
    00008  *  any later version.
    00009  *
    00010  *  This Program is distributed in the hope that it will be useful,
    00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    00013  *  GNU General Public License for more details.
    00014  *
    00015  *  You should have received a copy of the GNU General Public License
    00016  *  along with GNU Make; see the file COPYING.  If not, write to
    00017  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
    00018  *  http://www.gnu.org/copyleft/gpl.html
    00019  *
    00020  */
    00021
    00022
    00023 // PPagePlayer.cpp : implementation file
    00024 //
    00025
    00026 #include "stdafx.h"
    00027 #include "mplayerc.h"
    00028 #include "MainFrm.h"
    00029 #include "PPagePlayer.h"
    00030
    00031 // CPPagePlayer dialog
    00032
    00033 IMPLEMENT_DYNAMIC(CPPagePlayer, CPPageBase)
    00034 CPPagePlayer::CPPagePlayer()
    00035         : CPPageBase(CPPagePlayer::IDD, CPPagePlayer::IDD)
    00036         , m_iAllowMultipleInst(0)
    00037         , m_iAlwaysOnTop(FALSE)
    00038         , m_fTrayIcon(FALSE)
    00039         , m_iShowBarsWhenFullScreen(FALSE)
    00040         , m_nShowBarsWhenFullScreenTimeOut(0)
    00041         , m_iTitleBarTextStyle(0)
    00042         , m_fExitFullScreenAtTheEnd(FALSE)
    00043         , m_fRememberWindowPos(FALSE)
    00044         , m_fRememberWindowSize(FALSE)
    00045         , m_fUseIni(FALSE)
    00046         , m_fKeepHistory(FALSE)
    00047         , m_fHideCDROMsSubMenu(FALSE)
    00048         , m_priority(FALSE)
    00049         , m_launchfullscreen(FALSE)
    00050 {
    00051 }
    00052
    00053 CPPagePlayer::~CPPagePlayer()
    00054 {
    00055 }
    00056
    00057 void CPPagePlayer::DoDataExchange(CDataExchange* pDX)
    00058 {
    00059         __super::DoDataExchange(pDX);
    00060         DDX_Radio(pDX, IDC_RADIO1, m_iAllowMultipleInst);
    00061         DDX_Radio(pDX, IDC_RADIO3, m_iTitleBarTextStyle);
    00062         DDX_Check(pDX, IDC_CHECK2, m_iAlwaysOnTop);
    00063         DDX_Check(pDX, IDC_CHECK3, m_fTrayIcon);
    00064         DDX_Check(pDX, IDC_CHECK4, m_iShowBarsWhenFullScreen);
    00065         DDX_Text(pDX, IDC_EDIT1, m_nShowBarsWhenFullScreenTimeOut);
    00066         DDX_Check(pDX, IDC_CHECK5, m_fExitFullScreenAtTheEnd);
    00067         DDX_Check(pDX, IDC_CHECK6, m_fRememberWindowPos);
    00068         DDX_Check(pDX, IDC_CHECK7, m_fRememberWindowSize);
    00069         DDX_Check(pDX, IDC_CHECK8, m_fUseIni);
    00070         DDX_Control(pDX, IDC_SPIN1, m_nTimeOutCtrl);
    00071         DDX_Check(pDX, IDC_CHECK1, m_fKeepHistory);
    00072         DDX_Check(pDX, IDC_CHECK10, m_fHideCDROMsSubMenu);
    00073         DDX_Check(pDX, IDC_CHECK9, m_priority);
    00074         DDX_Check(pDX, IDC_CHECK11, m_launchfullscreen);
    00075 }
    00076
    00077
    00078 BEGIN_MESSAGE_MAP(CPPagePlayer, CPPageBase)
    00079         ON_BN_CLICKED(IDC_CHECK8, OnBnClickedCheck8)
    00080         ON_UPDATE_COMMAND_UI(IDC_SPIN1, OnUpdateTimeout)
    00081         ON_UPDATE_COMMAND_UI(IDC_EDIT1, OnUpdateTimeout)
    00082         ON_UPDATE_COMMAND_UI(IDC_STATIC1, OnUpdateTimeout)
    00083         ON_UPDATE_COMMAND_UI(IDC_STATIC2, OnUpdateTimeout)
    00084 END_MESSAGE_MAP()
    00085
    00086
    00087 // CPPagePlayer message handlers
    00088
    00089 BOOL CPPagePlayer::OnInitDialog()
    00090 {
    00091         __super::OnInitDialog();
    00092
    00093         AppSettings& s = AfxGetAppSettings();
    00094
    00095         m_iAllowMultipleInst = s.fAllowMultipleInst;
    00096         m_iTitleBarTextStyle = s.iTitleBarTextStyle;
    00097         m_iAlwaysOnTop = s.iOnTop;
    00098         m_fTrayIcon = s.fTrayIcon;
    00099         m_iShowBarsWhenFullScreen = s.fShowBarsWhenFullScreen;
    00100         m_nShowBarsWhenFullScreenTimeOut = s.nShowBarsWhenFullScreenTimeOut;
    00101         m_nTimeOutCtrl.SetRange(-1, 10);
    00102         m_fExitFullScreenAtTheEnd = s.fExitFullScreenAtTheEnd;
    00103         m_fRememberWindowPos = s.fRememberWindowPos;
    00104         m_fRememberWindowSize = s.fRememberWindowSize;
    00105         m_fUseIni = ((CMPlayerCApp*)AfxGetApp())->IsIniValid();
    00106         m_fKeepHistory = s.fKeepHistory;
    00107         m_fHideCDROMsSubMenu = s.fHideCDROMsSubMenu;
    00108         m_priority = s.priority != NORMAL_PRIORITY_CLASS;
    00109         m_launchfullscreen = s.launchfullscreen;
    00110
    00111         UpdateData(FALSE);
    00112
    00113         return TRUE;  // return TRUE unless you set the focus to a control
    00114         // EXCEPTION: OCX Property Pages should return FALSE
    00115 }
    00116
    00117 BOOL CPPagePlayer::OnApply()
    00118 {
    00119         UpdateData();
    00120
    00121         AppSettings& s = AfxGetAppSettings();
    00122
    00123         s.fAllowMultipleInst = !!m_iAllowMultipleInst;
    00124         s.iTitleBarTextStyle = m_iTitleBarTextStyle;
    00125         s.iOnTop = m_iAlwaysOnTop;
    00126         s.fTrayIcon = !!m_fTrayIcon;
    00127         s.fShowBarsWhenFullScreen = !!m_iShowBarsWhenFullScreen;
    00128         s.nShowBarsWhenFullScreenTimeOut = m_nShowBarsWhenFullScreenTimeOut;
    00129         s.fExitFullScreenAtTheEnd = !!m_fExitFullScreenAtTheEnd;
    00130         s.fRememberWindowPos = !!m_fRememberWindowPos;
    00131         s.fRememberWindowSize = !!m_fRememberWindowSize;
    00132         s.fKeepHistory = !!m_fKeepHistory;
    00133         s.fHideCDROMsSubMenu = !!m_fHideCDROMsSubMenu;
    00134         s.priority = !m_priority ? NORMAL_PRIORITY_CLASS : GetVersion() < 0 ? HIGH_PRIORITY_CLASS : ABOVE_NORMAL_PRIORITY_CLASS;
    00135         s.launchfullscreen = !!m_launchfullscreen;
    00136
    00137         if(!m_fKeepHistory)
    00138         {
    00139                 for(int i = 0; i < s.MRU.GetSize(); i++) s.MRU.Remove(i);
    00140                 for(int i = 0; i < s.MRUDub.GetSize(); i++) s.MRUDub.Remove(i);
    00141                 s.MRU.WriteList();
    00142                 s.MRUDub.WriteList();
    00143         }
    00144
    00145         ((CMainFrame*)AfxGetMainWnd())->ShowTrayIcon(s.fTrayIcon);
    00146
    00147         ::SetPriorityClass(::GetCurrentProcess(), s.priority);
    00148
    00149         return __super::OnApply();
    00150 }
    00151
    00152 void CPPagePlayer::OnBnClickedCheck8()
    00153 {
    00154         UpdateData();
    00155
    00156         if(m_fUseIni) ((CMPlayerCApp*)AfxGetApp())->StoreSettingsToIni();
    00157         else ((CMPlayerCApp*)AfxGetApp())->StoreSettingsToRegistry();
    00158 }
    00159
    00160 void CPPagePlayer::OnUpdateTimeout(CCmdUI* pCmdUI)
    00161 {
    00162         UpdateData();
    00163         pCmdUI->Enable(m_iShowBarsWhenFullScreen);
    00164 }
    00165