- Main Page
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

# PPageSubtitles.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 // PPageSubtitles.cpp : implementation file
    00023 //
    00024
    00025 #include "stdafx.h"
    00026 #include "mplayerc.h"
    00027 #include "MainFrm.h"
    00028 #include "PPageSubtitles.h"
    00029
    00030 // CPPageSubtitles dialog
    00031
    00032 IMPLEMENT_DYNAMIC(CPPageSubtitles, CPPageBase)
    00033 CPPageSubtitles::CPPageSubtitles()
    00034         : CPPageBase(CPPageSubtitles::IDD, CPPageSubtitles::IDD)
    00035         , m_fOverridePlacement(FALSE)
    00036         , m_nHorPos(0)
    00037         , m_nVerPos(0)
    00038         , m_nSPCSize(0)
    00039         , m_fSPCPow2Tex(FALSE)
    00040 {
    00041 }
    00042
    00043 CPPageSubtitles::~CPPageSubtitles()
    00044 {
    00045 }
    00046
    00047 void CPPageSubtitles::DoDataExchange(CDataExchange* pDX)
    00048 {
    00049         __super::DoDataExchange(pDX);
    00050         DDX_Check(pDX, IDC_CHECK3, m_fOverridePlacement);
    00051         DDX_Text(pDX, IDC_EDIT2, m_nHorPos);
    00052         DDX_Control(pDX, IDC_SPIN2, m_nHorPosCtrl);
    00053         DDX_Text(pDX, IDC_EDIT3, m_nVerPos);
    00054         DDX_Control(pDX, IDC_SPIN3, m_nVerPosCtrl);
    00055         DDX_Text(pDX, IDC_EDIT1, m_nSPCSize);
    00056         DDX_Control(pDX, IDC_SPIN1, m_nSPCSizeCtrl);
    00057         DDX_Control(pDX, IDC_COMBO1, m_spmaxres);
    00058         DDX_Control(pDX, IDC_EDIT2, m_nHorPosEdit);
    00059         DDX_Control(pDX, IDC_EDIT3, m_nVerPosEdit);
    00060         DDX_Check(pDX, IDC_CHECK_SPCPOW2TEX, m_fSPCPow2Tex);
    00061 }
    00062
    00063
    00064 BEGIN_MESSAGE_MAP(CPPageSubtitles, CPPageBase)
    00065         ON_UPDATE_COMMAND_UI(IDC_EDIT2, OnUpdatePosOverride)
    00066         ON_UPDATE_COMMAND_UI(IDC_SPIN2, OnUpdatePosOverride)
    00067         ON_UPDATE_COMMAND_UI(IDC_EDIT3, OnUpdatePosOverride)
    00068         ON_UPDATE_COMMAND_UI(IDC_SPIN3, OnUpdatePosOverride)
    00069         ON_UPDATE_COMMAND_UI(IDC_STATIC1, OnUpdatePosOverride)
    00070         ON_UPDATE_COMMAND_UI(IDC_STATIC2, OnUpdatePosOverride)
    00071         ON_UPDATE_COMMAND_UI(IDC_STATIC3, OnUpdatePosOverride)
    00072         ON_UPDATE_COMMAND_UI(IDC_STATIC4, OnUpdatePosOverride)
    00073 END_MESSAGE_MAP()
    00074
    00075
    00076 // CPPageSubtitles message handlers
    00077
    00078 BOOL CPPageSubtitles::OnInitDialog()
    00079 {
    00080         __super::OnInitDialog();
    00081
    00082         AppSettings& s = AfxGetAppSettings();
    00083
    00084         m_fOverridePlacement = s.fOverridePlacement;
    00085         m_nHorPos = s.nHorPos;
    00086         m_nHorPosCtrl.SetRange(-10,110);
    00087         m_nVerPos = s.nVerPos;
    00088         m_nVerPosCtrl.SetRange(110,-10);
    00089         m_nSPCSize = s.nSPCSize;
    00090         m_nSPCSizeCtrl.SetRange(0, 10);
    00091         m_spmaxres.AddString(_T("Desktop"));
    00092         m_spmaxres.AddString(_T("1024x768"));
    00093         m_spmaxres.AddString(_T("800x600"));
    00094         m_spmaxres.AddString(_T("640x480"));
    00095         m_spmaxres.AddString(_T("512x384"));
    00096         m_spmaxres.AddString(_T("384x288"));
    00097         m_spmaxres.SetCurSel(s.nSPCMaxRes);
    00098         m_fSPCPow2Tex = s.fSPCPow2Tex;
    00099
    00100         UpdateData(FALSE);
    00101
    00102         CreateToolTip();
    00103
    00104         return TRUE;  // return TRUE unless you set the focus to a control
    00105         // EXCEPTION: OCX Property Pages should return FALSE
    00106 }
    00107
    00108 BOOL CPPageSubtitles::OnApply()
    00109 {
    00110         UpdateData();
    00111
    00112         AppSettings& s = AfxGetAppSettings();
    00113
    00114         if(s.fOverridePlacement != !!m_fOverridePlacement
    00115         || s.nHorPos != m_nHorPos
    00116         || s.nVerPos != m_nVerPos
    00117         || s.nSPCSize != m_nSPCSize
    00118         || s.nSPCMaxRes != m_spmaxres.GetCurSel()
    00119         || s.fSPCPow2Tex != !!m_fSPCPow2Tex)
    00120         {
    00121                 s.fOverridePlacement = !!m_fOverridePlacement;
    00122                 s.nHorPos = m_nHorPos;
    00123                 s.nVerPos = m_nVerPos;
    00124                 s.nSPCSize = m_nSPCSize;
    00125                 s.nSPCMaxRes = m_spmaxres.GetCurSel();
    00126                 s.fSPCPow2Tex = !!m_fSPCPow2Tex;
    00127
    00128                 if(CMainFrame* pFrame = (CMainFrame*)GetParentFrame())
    00129                         pFrame->UpdateSubtitle(true);
    00130         }
    00131
    00132         return __super::OnApply();
    00133 }
    00134
    00135 void CPPageSubtitles::OnUpdatePosOverride(CCmdUI* pCmdUI)
    00136 {
    00137         UpdateData();
    00138         pCmdUI->Enable(m_fOverridePlacement);
    00139 }