A Fast Bresenham Type Algorithm For Drawing Ellipses by John Kennedy
[xy_vsfilter.git] / src / apps / mplayerc / PPagePlayback.cpp
blob205020112f17f5a3024e33fc98705cba2ce4a85f
1 /*
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)
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.
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
22 // PPagePlayback.cpp : implementation file
25 #include "stdafx.h"
26 #include "mplayerc.h"
27 #include "MainFrm.h"
28 #include "PPagePlayback.h"
30 // CPPagePlayback dialog
32 IMPLEMENT_DYNAMIC(CPPagePlayback, CPPageBase)
33 CPPagePlayback::CPPagePlayback()
34 : CPPageBase(CPPagePlayback::IDD, CPPagePlayback::IDD)
35 , m_iLoopForever(0)
36 , m_nLoops(0)
37 , m_fRewind(FALSE)
38 , m_iZoomLevel(0)
39 , m_iRememberZoomLevel(FALSE)
40 , m_fSetFullscreenRes(FALSE)
41 , m_nVolume(0)
42 , m_nBalance(0)
43 , m_fAutoloadAudio(FALSE)
44 , m_fAutoloadSubtitles(FALSE)
45 , m_fEnableWorkerThreadForOpening(FALSE)
46 , m_fReportFailedPins(FALSE)
50 CPPagePlayback::~CPPagePlayback()
54 void CPPagePlayback::DoDataExchange(CDataExchange* pDX)
56 __super::DoDataExchange(pDX);
57 DDX_Control(pDX, IDC_SLIDER1, m_volumectrl);
58 DDX_Control(pDX, IDC_SLIDER2, m_balancectrl);
59 DDX_Slider(pDX, IDC_SLIDER1, m_nVolume);
60 DDX_Slider(pDX, IDC_SLIDER2, m_nBalance);
61 DDX_Radio(pDX, IDC_RADIO1, m_iLoopForever);
62 DDX_Control(pDX, IDC_EDIT1, m_loopnumctrl);
63 DDX_Text(pDX, IDC_EDIT1, m_nLoops);
64 DDX_Check(pDX, IDC_CHECK1, m_fRewind);
65 DDX_CBIndex(pDX, IDC_COMBO1, m_iZoomLevel);
66 DDX_Check(pDX, IDC_CHECK5, m_iRememberZoomLevel);
67 DDX_Check(pDX, IDC_CHECK4, m_fSetFullscreenRes);
68 DDX_Control(pDX, IDC_COMBO2, m_dispmodecombo);
69 DDX_Check(pDX, IDC_CHECK2, m_fAutoloadAudio);
70 DDX_Check(pDX, IDC_CHECK3, m_fAutoloadSubtitles);
71 DDX_Check(pDX, IDC_CHECK7, m_fEnableWorkerThreadForOpening);
72 DDX_Check(pDX, IDC_CHECK6, m_fReportFailedPins);
77 BEGIN_MESSAGE_MAP(CPPagePlayback, CPPageBase)
78 ON_WM_HSCROLL()
79 ON_CONTROL_RANGE(BN_CLICKED, IDC_RADIO1, IDC_RADIO2, OnBnClickedRadio12)
80 ON_UPDATE_COMMAND_UI(IDC_EDIT1, OnUpdateLoopNum)
81 ON_UPDATE_COMMAND_UI(IDC_STATIC1, OnUpdateLoopNum)
82 ON_UPDATE_COMMAND_UI(IDC_COMBO1, OnUpdateAutoZoomCombo)
83 ON_UPDATE_COMMAND_UI(IDC_COMBO2, OnUpdateDispModeCombo)
84 END_MESSAGE_MAP()
87 // CPPagePlayback message handlers
89 BOOL CPPagePlayback::OnInitDialog()
91 __super::OnInitDialog();
93 AppSettings& s = AfxGetAppSettings();
95 m_volumectrl.SetRange(1, 100);
96 m_volumectrl.SetTicFreq(10);
97 m_balancectrl.SetRange(0, 200);
98 m_balancectrl.SetTicFreq(20);
99 m_nVolume = s.nVolume;
100 m_nBalance = s.nBalance+100;
101 m_iLoopForever = s.fLoopForever?1:0;
102 m_nLoops = s.nLoops;
103 m_fRewind = s.fRewind;
104 m_iZoomLevel = s.iZoomLevel;
105 m_iRememberZoomLevel = s.fRememberZoomLevel;
107 m_fSetFullscreenRes = s.dmFullscreenRes.fValid;
108 int iSel = -1;
109 dispmode dm, dmtoset = s.dmFullscreenRes;
110 if(!dmtoset.fValid) GetCurDispMode(dmtoset);
111 for(int i = 0, j = 0; GetDispMode(i, dm); i++)
113 if(dm.bpp <= 8) continue;
115 m_dms.Add(dm);
117 CString str;
118 str.Format(_T("%dx%d %dbpp %dHz"), dm.size.cx, dm.size.cy, dm.bpp, dm.freq);
119 m_dispmodecombo.AddString(str);
121 if(iSel < 0 && dmtoset.fValid && dm.size == dmtoset.size
122 && dm.bpp == dmtoset.bpp && dm.freq == dmtoset.freq)
123 iSel = j;
125 j++;
127 m_dispmodecombo.SetCurSel(iSel);
129 m_fAutoloadAudio = s.fAutoloadAudio;
130 m_fAutoloadSubtitles = s.fAutoloadSubtitles;
131 m_fEnableWorkerThreadForOpening = s.fEnableWorkerThreadForOpening;
132 m_fReportFailedPins = s.fReportFailedPins;
134 UpdateData(FALSE);
136 return TRUE; // return TRUE unless you set the focus to a control
137 // EXCEPTION: OCX Property Pages should return FALSE
140 BOOL CPPagePlayback::OnApply()
142 UpdateData();
144 AppSettings& s = AfxGetAppSettings();
146 s.nVolume = m_nVolume;
147 s.nBalance = m_nBalance-100;
148 s.fLoopForever = !!m_iLoopForever;
149 s.nLoops = m_nLoops;
150 s.fRewind = !!m_fRewind;
151 s.iZoomLevel = m_iZoomLevel;
152 s.fRememberZoomLevel = !!m_iRememberZoomLevel;
153 int iSel = m_dispmodecombo.GetCurSel();
154 if((s.dmFullscreenRes.fValid = !!m_fSetFullscreenRes) && iSel >= 0 && iSel < m_dms.GetCount())
155 s.dmFullscreenRes = m_dms[m_dispmodecombo.GetCurSel()];
156 s.fAutoloadAudio = !!m_fAutoloadAudio;
157 s.fAutoloadSubtitles = !!m_fAutoloadSubtitles;
158 s.fEnableWorkerThreadForOpening = !!m_fEnableWorkerThreadForOpening;
159 s.fReportFailedPins = !!m_fReportFailedPins;
161 return __super::OnApply();
164 LRESULT CPPagePlayback::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
166 if(message == WM_HSCROLL || message == WM_VSCROLL)
168 SetModified();
171 return __super::DefWindowProc(message, wParam, lParam);
174 void CPPagePlayback::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
176 if(*pScrollBar == m_volumectrl)
178 UpdateData();
179 ((CMainFrame*)GetParentFrame())->m_wndToolBar.Volume = m_nVolume; // nice shortcut...
181 else if(*pScrollBar == m_balancectrl)
183 UpdateData();
184 ((CMainFrame*)GetParentFrame())->SetBalance(m_nBalance-100); // see prev note...
187 SetModified();
189 __super::OnHScroll(nSBCode, nPos, pScrollBar);
192 void CPPagePlayback::OnBnClickedRadio12(UINT nID)
194 SetModified();
197 void CPPagePlayback::OnUpdateLoopNum(CCmdUI* pCmdUI)
199 pCmdUI->Enable(!!IsDlgButtonChecked(IDC_RADIO1));
202 void CPPagePlayback::OnUpdateAutoZoomCombo(CCmdUI* pCmdUI)
204 pCmdUI->Enable(!!IsDlgButtonChecked(IDC_CHECK5));
207 void CPPagePlayback::OnUpdateDispModeCombo(CCmdUI* pCmdUI)
209 pCmdUI->Enable(!!IsDlgButtonChecked(IDC_CHECK4));