PPageDVD.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 // PPageDVD.cpp : implementation file
00023 //
00024 
00025 #include "stdafx.h"
00026 #include "mplayerc.h"
00027 #include "PPageDVD.h"
00028 
00029 struct
00030 {
00031         LCID lcid;
00032         TCHAR name[64];
00033 } 
00034 LCIDNameList[] =
00035 {
00036         {0x0000, _T("Default")},
00037         {0x0436, _T("Afrikaans")},
00038         {0x041c, _T("Albanian")},
00039         {0x0401, _T("Arabic (Saudi Arabia)")},
00040         {0x0801, _T("Arabic (Iraq)")},
00041         {0x0c01, _T("Arabic (Egypt)")},
00042         {0x1001, _T("Arabic (Libya)")},
00043         {0x1401, _T("Arabic (Algeria)")},
00044         {0x1801, _T("Arabic (Morocco)")},
00045         {0x1c01, _T("Arabic (Tunisia)")},
00046         {0x2001, _T("Arabic (Oman)")},
00047         {0x2401, _T("Arabic (Yemen)")},
00048         {0x2801, _T("Arabic (Syria)")},
00049         {0x2c01, _T("Arabic (Jordan)")},
00050         {0x3001, _T("Arabic (Lebanon)")},
00051         {0x3401, _T("Arabic (Kuwait)")},
00052         {0x3801, _T("Arabic (U.A.E.)")},
00053         {0x3c01, _T("Arabic (Bahrain)")},
00054         {0x4001, _T("Arabic (Qatar)")},
00055         {0x042b, _T("Armenian")},
00056         {0x042c, _T("Azeri (Latin)")},
00057         {0x082c, _T("Azeri (Cyrillic)")},
00058         {0x042d, _T("Basque")},
00059         {0x0423, _T("Belarusian")},
00060         {0x0402, _T("Bulgarian")},
00061         {0x0455, _T("Burmese")},
00062         {0x0403, _T("Catalan")},
00063         {0x0404, _T("Chinese (Taiwan)")},
00064         {0x0804, _T("Chinese (PRC)")},
00065         {0x0c04, _T("Chinese (Hong Kong SAR, PRC)")},
00066         {0x1004, _T("Chinese (Singapore)")},
00067         {0x1404, _T("Chinese (Macau SAR)")},
00068         {0x041a, _T("Croatian")},
00069         {0x0405, _T("Czech")},
00070         {0x0406, _T("Danish")},
00071         {0x0465, _T("Divehi")},
00072         {0x0413, _T("Dutch (Netherlands)")},
00073         {0x0813, _T("Dutch (Belgium)")},
00074         {0x0409, _T("English (United States)")},
00075         {0x0809, _T("English (United Kingdom)")},
00076         {0x0c09, _T("English (Australian)")},
00077         {0x1009, _T("English (Canadian)")},
00078         {0x1409, _T("English (New Zealand)")},
00079         {0x1809, _T("English (Ireland)")},
00080         {0x1c09, _T("English (South Africa)")},
00081         {0x2009, _T("English (Jamaica)")},
00082         {0x2409, _T("English (Caribbean)")},
00083         {0x2809, _T("English (Belize)")},
00084         {0x2c09, _T("English (Trinidad)")},
00085         {0x3009, _T("English (Zimbabwe)")},
00086         {0x3409, _T("English (Philippines)")},
00087         {0x0425, _T("Estonian")},
00088         {0x0438, _T("Faeroese")},
00089         {0x0429, _T("Farsi")},
00090         {0x040b, _T("Finnish")},
00091         {0x040c, _T("French (Standard)")},
00092         {0x080c, _T("French (Belgian)")},
00093         {0x0c0c, _T("French (Canadian)")},
00094         {0x100c, _T("French (Switzerland)")},
00095         {0x140c, _T("French (Luxembourg)")},
00096         {0x180c, _T("French (Monaco)")},
00097         {0x0456, _T("Galician")},
00098         {0x0437, _T("Georgian")},
00099         {0x0407, _T("German (Standard)")},
00100         {0x0807, _T("German (Switzerland)")},
00101         {0x0c07, _T("German (Austria)")},
00102         {0x1007, _T("German (Luxembourg)")},
00103         {0x1407, _T("German (Liechtenstein)")},
00104         {0x0408, _T("Greek")},
00105         {0x0447, _T("Gujarati")},
00106         {0x040d, _T("Hebrew")},
00107         {0x0439, _T("Hindi")},
00108         {0x040e, _T("Hungarian")},
00109         {0x040f, _T("Icelandic")},
00110         {0x0421, _T("Indonesian")},
00111         {0x0410, _T("Italian (Standard)")},
00112         {0x0810, _T("Italian (Switzerland)")},
00113         {0x0411, _T("Japanese")},
00114         {0x044b, _T("Kannada")},
00115         {0x0457, _T("Konkani")},
00116         {0x0412, _T("Korean")},
00117         {0x0812, _T("Korean (Johab)")},
00118         {0x0440, _T("Kyrgyz")},
00119         {0x0426, _T("Latvian")},
00120         {0x0427, _T("Lithuanian")},
00121         {0x0827, _T("Lithuanian (Classic)")},
00122         {0x042f, _T("FYRO Macedonian")},
00123         {0x043e, _T("Malay (Malaysian)")},
00124         {0x083e, _T("Malay (Brunei Darussalam)")},
00125         {0x044e, _T("Marathi")},
00126         {0x0450, _T("Mongolian")},
00127         {0x0414, _T("Norwegian (Bokmal)")},
00128         {0x0814, _T("Norwegian (Nynorsk)")},
00129         {0x0415, _T("Polish")},
00130         {0x0416, _T("Portuguese (Brazil)")},
00131         {0x0816, _T("Portuguese (Portugal)")},
00132         {0x0446, _T("Punjabi")},
00133         {0x0418, _T("Romanian")},
00134         {0x0419, _T("Russian")},
00135         {0x044f, _T("Sanskrit")},
00136         {0x0c1a, _T("Serbian (Cyrillic)")},
00137         {0x081a, _T("Serbian (Latin)")},
00138         {0x041b, _T("Slovak")},
00139         {0x0424, _T("Slovenian")},
00140         {0x040a, _T("Spanish (Spain, Traditional Sort)")},
00141         {0x080a, _T("Spanish (Mexican)")},
00142         {0x0c0a, _T("Spanish (Spain, International Sort)")},
00143         {0x100a, _T("Spanish (Guatemala)")},
00144         {0x140a, _T("Spanish (Costa Rica)")},
00145         {0x180a, _T("Spanish (Panama)")},
00146         {0x1c0a, _T("Spanish (Dominican Republic)")},
00147         {0x200a, _T("Spanish (Venezuela)")},
00148         {0x240a, _T("Spanish (Colombia)")},
00149         {0x280a, _T("Spanish (Peru)")},
00150         {0x2c0a, _T("Spanish (Argentina)")},
00151         {0x300a, _T("Spanish (Ecuador)")},
00152         {0x340a, _T("Spanish (Chile)")},
00153         {0x380a, _T("Spanish (Uruguay)")},
00154         {0x3c0a, _T("Spanish (Paraguay)")},
00155         {0x400a, _T("Spanish (Bolivia)")},
00156         {0x440a, _T("Spanish (El Salvador)")},
00157         {0x480a, _T("Spanish (Honduras)")},
00158         {0x4c0a, _T("Spanish (Nicaragua)")},
00159         {0x500a, _T("Spanish (Puerto Rico)")},
00160         {0x0430, _T("Sutu")},
00161         {0x0441, _T("Swahili (Kenya)")},
00162         {0x041d, _T("Swedish")},
00163         {0x081d, _T("Swedish (Finland)")},
00164         {0x045a, _T("Syriac")},
00165         {0x0449, _T("Tamil")},
00166         {0x0444, _T("Tatar (Tatarstan)")},
00167         {0x044a, _T("Telugu")},
00168         {0x041e, _T("Thai")},
00169         {0x041f, _T("Turkish")},
00170         {0x0422, _T("Ukrainian")},
00171         {0x0420, _T("Urdu (Pakistan)")},
00172         {0x0820, _T("Urdu (India)")},
00173         {0x0443, _T("Uzbek (Latin)")},
00174         {0x0843, _T("Uzbek (Cyrillic)")},
00175         {0x042a, _T("Vietnamese")}
00176 };
00177 
00178 
00179 // CPPageDVD dialog
00180 
00181 IMPLEMENT_DYNAMIC(CPPageDVD, CPPageBase)
00182 CPPageDVD::CPPageDVD()
00183         : CPPageBase(CPPageDVD::IDD, CPPageDVD::IDD)
00184         , m_iDVDLocation(0)
00185         , m_iDVDLangType(0)
00186         , m_dvdpath(_T(""))
00187         , m_fAutoSpeakerConf(FALSE)
00188 {
00189 }
00190 
00191 CPPageDVD::~CPPageDVD()
00192 {
00193 }
00194 
00195 void CPPageDVD::DoDataExchange(CDataExchange* pDX)
00196 {
00197         __super::DoDataExchange(pDX);
00198         DDX_Radio(pDX, IDC_LOCRADIO1, m_iDVDLocation);
00199         DDX_Radio(pDX, IDC_LANGRADIO1, m_iDVDLangType);
00200         DDX_Control(pDX, IDC_LIST1, m_lcids);
00201         DDX_Text(pDX, IDC_DVDPATH, m_dvdpath);
00202         DDX_Control(pDX, IDC_DVDPATH, m_dvdpathctrl);
00203         DDX_Control(pDX, IDC_BUTTON1, m_dvdpathselctrl);
00204         DDX_Check(pDX, IDC_CHECK1, m_fAutoSpeakerConf);
00205 }
00206 
00207 void CPPageDVD::UpdateLCIDList()
00208 {
00209         UpdateData();
00210 
00211         LCID lcid = m_iDVDLangType == 0 ? m_idMenuLang
00212                 : m_iDVDLangType == 1 ? m_idAudioLang
00213                 : m_idSubtitlesLang;
00214 
00215         for(int i = 0; i < m_lcids.GetCount(); i++)
00216         {
00217                 if(m_lcids.GetItemData(i) == lcid)
00218                 {
00219                         m_lcids.SetCurSel(i);
00220                         m_lcids.SetTopIndex(i);
00221                         break;
00222                 }
00223         }
00224 }
00225 
00226 BEGIN_MESSAGE_MAP(CPPageDVD, CPPageBase)
00227         ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
00228         ON_CONTROL_RANGE(BN_CLICKED, IDC_LANGRADIO1, IDC_LANGRADIO3, OnBnClickedLangradio123)
00229         ON_LBN_SELCHANGE(IDC_LIST1, OnLbnSelchangeList1)
00230         ON_UPDATE_COMMAND_UI(IDC_DVDPATH, OnUpdateDVDPath)
00231         ON_UPDATE_COMMAND_UI(IDC_BUTTON1, OnUpdateDVDPath)
00232 END_MESSAGE_MAP()
00233 
00234 
00235 // CPPageDVD message handlers
00236 
00237 BOOL CPPageDVD::OnInitDialog()
00238 {
00239         __super::OnInitDialog();
00240 
00241         AppSettings& s = AfxGetAppSettings();
00242 
00243         m_iDVDLocation = s.fUseDVDPath ? 1 : 0;
00244         m_dvdpath = s.sDVDPath;
00245         m_iDVDLangType = 0;
00246 
00247         m_idMenuLang = s.idMenuLang;
00248         m_idAudioLang = s.idAudioLang;
00249         m_idSubtitlesLang = s.idSubtitlesLang;
00250         m_fAutoSpeakerConf = s.fAutoSpeakerConf;
00251 
00252         UpdateData(FALSE);
00253 
00254         for(int i = 0; i < countof(LCIDNameList); i++)
00255         {
00256                 m_lcids.AddString(LCIDNameList[i].name);
00257                 m_lcids.SetItemData(i, LCIDNameList[i].lcid);
00258         }
00259 
00260         UpdateLCIDList();
00261 
00262         return TRUE;  // return TRUE unless you set the focus to a control
00263         // EXCEPTION: OCX Property Pages should return FALSE
00264 }
00265 
00266 BOOL CPPageDVD::OnApply()
00267 {
00268         UpdateData();
00269 
00270         AppSettings& s = AfxGetAppSettings();
00271 
00272         s.sDVDPath = m_dvdpath;
00273         s.fUseDVDPath = (m_iDVDLocation == 1);
00274         s.idMenuLang = m_idMenuLang;
00275         s.idAudioLang = m_idAudioLang;
00276         s.idSubtitlesLang = m_idSubtitlesLang;
00277         s.fAutoSpeakerConf = !!m_fAutoSpeakerConf;
00278 
00279         return __super::OnApply();
00280 }
00281 
00282 void CPPageDVD::OnBnClickedButton1()
00283 {
00284         TCHAR path[MAX_PATH];
00285 
00286         BROWSEINFO bi;
00287         bi.hwndOwner = m_hWnd;
00288         bi.pidlRoot = NULL;
00289         bi.pszDisplayName = path;
00290         bi.lpszTitle = _T("Select the path for the DVD:");
00291         bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_VALIDATE | BIF_USENEWUI | BIF_NONEWFOLDERBUTTON;
00292         bi.lpfn = NULL;
00293         bi.lParam = 0;
00294         bi.iImage = 0; 
00295 
00296         LPITEMIDLIST iil;
00297         if(iil = SHBrowseForFolder(&bi))
00298         {
00299                 SHGetPathFromIDList(iil, path);
00300                 m_dvdpath = path;
00301 
00302                 UpdateData(FALSE);
00303 
00304                 SetModified();
00305         }
00306 }
00307 
00308 void CPPageDVD::OnBnClickedLangradio123(UINT nID)
00309 {
00310         UpdateLCIDList();
00311 }
00312 
00313 void CPPageDVD::OnLbnSelchangeList1()
00314 {
00315         LCID& lcid = m_iDVDLangType == 0 ? m_idMenuLang
00316                 : m_iDVDLangType == 1 ? m_idAudioLang
00317                 : m_idSubtitlesLang;
00318 
00319         lcid = m_lcids.GetItemData(m_lcids.GetCurSel());
00320 
00321         SetModified();
00322 }
00323 
00324 void CPPageDVD::OnUpdateDVDPath(CCmdUI* pCmdUI)
00325 {
00326         UpdateData();
00327         pCmdUI->Enable(m_iDVDLocation == 1);
00328 }

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