PPagePlayback.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 // PPagePlayback.cpp : implementation file
00023 //
00024 
00025 #include "stdafx.h"
00026 #include "mplayerc.h"
00027 #include "MainFrm.h"
00028 #include "PPagePlayback.h"
00029 
00030 // CPPagePlayback dialog
00031 
00032 IMPLEMENT_DYNAMIC(CPPagePlayback, CPPageBase)
00033 CPPagePlayback::CPPagePlayback()
00034         : CPPageBase(CPPagePlayback::IDD, CPPagePlayback::IDD)
00035         , m_iLoopForever(0)
00036         , m_nLoops(0)
00037         , m_fRewind(FALSE)
00038         , m_iZoomLevel(0)
00039         , m_iRememberZoomLevel(FALSE)
00040         , m_fSetFullscreenRes(FALSE)
00041         , m_nVolume(0)
00042         , m_nBalance(0)
00043         , m_fAutoloadAudio(FALSE)
00044         , m_fAutoloadSubtitles(FALSE)
00045         , m_fEnableWorkerThreadForOpening(FALSE)
00046         , m_fReportFailedPins(FALSE)
00047 {
00048 }
00049 
00050 CPPagePlayback::~CPPagePlayback()
00051 {
00052 }
00053 
00054 void CPPagePlayback::DoDataExchange(CDataExchange* pDX)
00055 {
00056         __super::DoDataExchange(pDX);
00057         DDX_Control(pDX, IDC_SLIDER2, m_volumectrl);
00058         DDX_Control(pDX, IDC_SLIDER3, m_balancectrl);
00059         DDX_Slider(pDX, IDC_SLIDER2, m_nVolume);
00060         DDX_Slider(pDX, IDC_SLIDER3, m_nBalance);
00061         DDX_Radio(pDX, IDC_RADIO1, m_iLoopForever);
00062         DDX_Control(pDX, IDC_EDIT1, m_loopnumctrl);
00063         DDX_Text(pDX, IDC_EDIT1, m_nLoops);
00064         DDX_Check(pDX, IDC_CHECK1, m_fRewind);
00065         DDX_CBIndex(pDX, IDC_COMBO1, m_iZoomLevel);
00066         DDX_Check(pDX, IDC_CHECK5, m_iRememberZoomLevel);
00067         DDX_Check(pDX, IDC_CHECK4, m_fSetFullscreenRes);
00068         DDX_Control(pDX, IDC_COMBO2, m_dispmodecombo);
00069         DDX_Check(pDX, IDC_CHECK2, m_fAutoloadAudio);
00070         DDX_Check(pDX, IDC_CHECK3, m_fAutoloadSubtitles);
00071         DDX_Check(pDX, IDC_CHECK9, m_fEnableWorkerThreadForOpening);
00072         DDX_Check(pDX, IDC_CHECK6, m_fReportFailedPins);
00073 }
00074 
00075 
00076 
00077 BEGIN_MESSAGE_MAP(CPPagePlayback, CPPageBase)
00078         ON_WM_HSCROLL()
00079         ON_CONTROL_RANGE(BN_CLICKED, IDC_RADIO1, IDC_RADIO2, OnBnClickedRadio12)
00080         ON_UPDATE_COMMAND_UI(IDC_EDIT1, OnUpdateLoopNum)
00081         ON_UPDATE_COMMAND_UI(IDC_STATIC1, OnUpdateLoopNum)
00082         ON_UPDATE_COMMAND_UI(IDC_COMBO1, OnUpdateAutoZoomCombo)
00083         ON_UPDATE_COMMAND_UI(IDC_COMBO2, OnUpdateDispModeCombo)
00084 END_MESSAGE_MAP()
00085 
00086 
00087 // CPPagePlayback message handlers
00088 
00089 BOOL CPPagePlayback::OnInitDialog()
00090 {
00091         __super::OnInitDialog();
00092 
00093         AppSettings& s = AfxGetAppSettings();
00094 
00095         m_volumectrl.SetRange(1, 100);
00096         m_volumectrl.SetTicFreq(10);
00097         m_balancectrl.SetRange(0, 200);
00098         m_balancectrl.SetTicFreq(20);
00099         m_nVolume = s.nVolume;
00100         m_nBalance = s.nBalance+100;
00101         m_iLoopForever = s.fLoopForever?1:0;
00102         m_nLoops = s.nLoops;
00103         m_fRewind = s.fRewind;
00104         m_iZoomLevel = s.iZoomLevel;
00105         m_iRememberZoomLevel = s.fRememberZoomLevel;
00106 
00107         m_fSetFullscreenRes = s.dmFullscreenRes.fValid;
00108         int iSel = -1;
00109         dispmode dm, dmtoset = s.dmFullscreenRes;
00110         if(!dmtoset.fValid) GetCurDispMode(dmtoset);
00111         for(int i = 0, j = 0; GetDispMode(i, dm); i++)
00112         {
00113                 if(dm.bpp <= 8) continue;
00114 
00115                 m_dms.Add(dm);
00116 
00117                 CString str;
00118                 str.Format(_T("%dx%d %dbpp %dHz"), dm.size.cx, dm.size.cy, dm.bpp, dm.freq);
00119                 m_dispmodecombo.AddString(str);
00120 
00121                 if(iSel < 0 && dmtoset.fValid && dm.size == dmtoset.size
00122                 && dm.bpp == dmtoset.bpp && dm.freq == dmtoset.freq)
00123                         iSel = j;
00124 
00125                 j++;
00126         }
00127         m_dispmodecombo.SetCurSel(iSel);
00128 
00129         m_fAutoloadAudio = s.fAutoloadAudio;
00130         m_fAutoloadSubtitles = s.fAutoloadSubtitles;
00131         m_fEnableWorkerThreadForOpening = s.fEnableWorkerThreadForOpening;
00132         m_fReportFailedPins = s.fReportFailedPins;
00133 
00134         UpdateData(FALSE);
00135 
00136         return TRUE;  // return TRUE unless you set the focus to a control
00137         // EXCEPTION: OCX Property Pages should return FALSE
00138 }
00139 
00140 BOOL CPPagePlayback::OnApply()
00141 {
00142         UpdateData();
00143 
00144         AppSettings& s = AfxGetAppSettings();
00145 
00146         s.nVolume = m_nVolume;
00147         s.nBalance = m_nBalance-100;
00148         s.fLoopForever = !!m_iLoopForever;
00149         s.nLoops = m_nLoops;
00150         s.fRewind = !!m_fRewind;
00151         s.iZoomLevel = m_iZoomLevel;
00152         s.fRememberZoomLevel = !!m_iRememberZoomLevel;
00153         int iSel = m_dispmodecombo.GetCurSel();
00154         if((s.dmFullscreenRes.fValid = !!m_fSetFullscreenRes) && iSel >= 0 && iSel < m_dms.GetCount())
00155                 s.dmFullscreenRes = m_dms[m_dispmodecombo.GetCurSel()];
00156         s.fAutoloadAudio = !!m_fAutoloadAudio;
00157         s.fAutoloadSubtitles = !!m_fAutoloadSubtitles;
00158         s.fEnableWorkerThreadForOpening = !!m_fEnableWorkerThreadForOpening;
00159         s.fReportFailedPins = !!m_fReportFailedPins;
00160 
00161         return __super::OnApply();
00162 }
00163 
00164 LRESULT CPPagePlayback::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
00165 {
00166         if(message == WM_HSCROLL || message == WM_VSCROLL)
00167         {
00168                 SetModified();
00169         }
00170 
00171         return __super::DefWindowProc(message, wParam, lParam);
00172 }
00173 
00174 void CPPagePlayback::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
00175 {
00176         if(*pScrollBar == m_volumectrl)
00177         {
00178                 UpdateData();
00179                 ((CMainFrame*)GetParentFrame())->m_wndToolBar.Volume = m_nVolume; // nice shortcut...
00180         }
00181         else if(*pScrollBar == m_balancectrl)
00182         {
00183                 UpdateData();
00184                 ((CMainFrame*)GetParentFrame())->SetBalance(m_nBalance-100); // see prev note...
00185         }
00186 
00187         SetModified();
00188 
00189         __super::OnHScroll(nSBCode, nPos, pScrollBar);
00190 }
00191 
00192 void CPPagePlayback::OnBnClickedRadio12(UINT nID)
00193 {
00194         SetModified();
00195 }
00196 
00197 void CPPagePlayback::OnUpdateLoopNum(CCmdUI* pCmdUI)
00198 {
00199         pCmdUI->Enable(!!IsDlgButtonChecked(IDC_RADIO1));
00200 }
00201 
00202 void CPPagePlayback::OnUpdateAutoZoomCombo(CCmdUI* pCmdUI)
00203 {
00204         pCmdUI->Enable(!!IsDlgButtonChecked(IDC_CHECK5));
00205 }
00206 
00207 void CPPagePlayback::OnUpdateDispModeCombo(CCmdUI* pCmdUI)
00208 {
00209         pCmdUI->Enable(!!IsDlgButtonChecked(IDC_CHECK4));
00210 }

Generated on Tue Dec 13 14:47:02 2005 for guliverkli by  doxygen 1.4.5