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
22 // PPageSubtitles.cpp : implementation file
28 #include "PPageSubtitles.h"
30 // CPPageSubtitles dialog
32 IMPLEMENT_DYNAMIC(CPPageSubtitles
, CPPageBase
)
33 CPPageSubtitles::CPPageSubtitles()
34 : CPPageBase(CPPageSubtitles::IDD
, CPPageSubtitles::IDD
)
35 , m_fOverridePlacement(FALSE
)
39 , m_fSPCPow2Tex(FALSE
)
40 , m_nSubDelayInterval(0)
44 CPPageSubtitles::~CPPageSubtitles()
48 void CPPageSubtitles::DoDataExchange(CDataExchange
* pDX
)
50 __super::DoDataExchange(pDX
);
51 DDX_Check(pDX
, IDC_CHECK3
, m_fOverridePlacement
);
52 DDX_Text(pDX
, IDC_EDIT2
, m_nHorPos
);
53 DDX_Control(pDX
, IDC_SPIN2
, m_nHorPosCtrl
);
54 DDX_Text(pDX
, IDC_EDIT3
, m_nVerPos
);
55 DDX_Control(pDX
, IDC_SPIN3
, m_nVerPosCtrl
);
56 DDX_Text(pDX
, IDC_EDIT1
, m_nSPCSize
);
57 DDX_Control(pDX
, IDC_SPIN1
, m_nSPCSizeCtrl
);
58 DDX_Control(pDX
, IDC_COMBO1
, m_spmaxres
);
59 DDX_Control(pDX
, IDC_EDIT2
, m_nHorPosEdit
);
60 DDX_Control(pDX
, IDC_EDIT3
, m_nVerPosEdit
);
61 DDX_Check(pDX
, IDC_CHECK_SPCPOW2TEX
, m_fSPCPow2Tex
);
62 DDX_Text(pDX
, IDC_EDIT4
, m_nSubDelayInterval
);
66 BEGIN_MESSAGE_MAP(CPPageSubtitles
, CPPageBase
)
67 ON_UPDATE_COMMAND_UI(IDC_EDIT2
, OnUpdatePosOverride
)
68 ON_UPDATE_COMMAND_UI(IDC_SPIN2
, OnUpdatePosOverride
)
69 ON_UPDATE_COMMAND_UI(IDC_EDIT3
, OnUpdatePosOverride
)
70 ON_UPDATE_COMMAND_UI(IDC_SPIN3
, OnUpdatePosOverride
)
71 ON_UPDATE_COMMAND_UI(IDC_STATIC1
, OnUpdatePosOverride
)
72 ON_UPDATE_COMMAND_UI(IDC_STATIC2
, OnUpdatePosOverride
)
73 ON_UPDATE_COMMAND_UI(IDC_STATIC3
, OnUpdatePosOverride
)
74 ON_UPDATE_COMMAND_UI(IDC_STATIC4
, OnUpdatePosOverride
)
75 ON_EN_CHANGE(IDC_EDIT4
, OnSubDelayInterval
)
79 // CPPageSubtitles message handlers
81 BOOL
CPPageSubtitles::OnInitDialog()
83 __super::OnInitDialog();
85 AppSettings
& s
= AfxGetAppSettings();
87 m_fOverridePlacement
= s
.fOverridePlacement
;
88 m_nHorPos
= s
.nHorPos
;
89 m_nHorPosCtrl
.SetRange(-10,110);
90 m_nVerPos
= s
.nVerPos
;
91 m_nVerPosCtrl
.SetRange(110,-10);
92 m_nSPCSize
= s
.nSPCSize
;
93 m_nSPCSizeCtrl
.SetRange(0, 10);
94 m_spmaxres
.AddString(_T("Desktop"));
95 m_spmaxres
.AddString(_T("1024x768"));
96 m_spmaxres
.AddString(_T("800x600"));
97 m_spmaxres
.AddString(_T("640x480"));
98 m_spmaxres
.AddString(_T("512x384"));
99 m_spmaxres
.AddString(_T("384x288"));
100 m_spmaxres
.SetCurSel(s
.nSPCMaxRes
);
101 m_fSPCPow2Tex
= s
.fSPCPow2Tex
;
102 m_nSubDelayInterval
= s
.nSubDelayInterval
;
108 return TRUE
; // return TRUE unless you set the focus to a control
109 // EXCEPTION: OCX Property Pages should return FALSE
112 BOOL
CPPageSubtitles::OnApply()
116 AppSettings
& s
= AfxGetAppSettings();
118 if(s
.fOverridePlacement
!= !!m_fOverridePlacement
119 || s
.nHorPos
!= m_nHorPos
120 || s
.nVerPos
!= m_nVerPos
121 || s
.nSPCSize
!= m_nSPCSize
122 || s
.nSubDelayInterval
!= m_nSubDelayInterval
123 || s
.nSPCMaxRes
!= m_spmaxres
.GetCurSel()
124 || s
.fSPCPow2Tex
!= !!m_fSPCPow2Tex
)
126 s
.fOverridePlacement
= !!m_fOverridePlacement
;
127 s
.nHorPos
= m_nHorPos
;
128 s
.nVerPos
= m_nVerPos
;
129 s
.nSPCSize
= m_nSPCSize
;
130 s
.nSubDelayInterval
= m_nSubDelayInterval
;
131 s
.nSPCMaxRes
= m_spmaxres
.GetCurSel();
132 s
.fSPCPow2Tex
= !!m_fSPCPow2Tex
;
134 if(CMainFrame
* pFrame
= (CMainFrame
*)GetParentFrame())
135 pFrame
->UpdateSubtitle(true);
138 return __super::OnApply();
141 void CPPageSubtitles::OnUpdatePosOverride(CCmdUI
* pCmdUI
)
144 pCmdUI
->Enable(m_fOverridePlacement
);
148 void CPPageSubtitles::OnSubDelayInterval()
150 // If incorrect number, revert modifications