Index: src/ch/OptionsDlg.cpp =================================================================== diff -u -r37a273b73ad2ba80df122121bc36c7a11a5492bc -rb6b8ac5b0a1ab85b4ac788e5429be860d2f20bd5 --- src/ch/OptionsDlg.cpp (.../OptionsDlg.cpp) (revision 37a273b73ad2ba80df122121bc36c7a11a5492bc) +++ src/ch/OptionsDlg.cpp (.../OptionsDlg.cpp) (revision b6b8ac5b0a1ab85b4ac788e5429be860d2f20bd5) @@ -1,23 +1,21 @@ -/************************************************************************ - Copy Handler 1.x - program for copying data in Microsoft Windows - systems. - Copyright (C) 2001-2004 Ixen Gerthannes (copyhandler@o2.pl) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*************************************************************************/ - +/*************************************************************************** +* Copyright (C) 2001-2008 by J�zef Starosczyk * +* ixen@copyhandler.com * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU Library General Public License * +* (version 2) as published by the Free Software Foundation; * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU Library General Public * +* License along with this program; if not, write to the * +* Free Software Foundation, Inc., * +* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * +***************************************************************************/ #include "stdafx.h" #include "ch.h" #include "resource.h" @@ -39,7 +37,7 @@ // COptionsDlg dialog COptionsDlg::COptionsDlg(CWnd* pParent /*=NULL*/) - : CHLanguageDialog(COptionsDlg::IDD, pParent, &m_bLock) + :ictranslate::CLanguageDialog(COptionsDlg::IDD, pParent, &m_bLock) { //{{AFX_DATA_INIT(COptionsDlg) // NOTE: the ClassWizard will add member initialization here @@ -48,13 +46,13 @@ void COptionsDlg::DoDataExchange(CDataExchange* pDX) { - CHLanguageDialog::DoDataExchange(pDX); + CLanguageDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(COptionsDlg) DDX_Control(pDX, IDC_PROPERTIES_LIST, m_ctlProperties); //}}AFX_DATA_MAP } -BEGIN_MESSAGE_MAP(COptionsDlg, CHLanguageDialog) +BEGIN_MESSAGE_MAP(COptionsDlg,ictranslate::CLanguageDialog) //{{AFX_MSG_MAP(COptionsDlg) ON_BN_CLICKED(IDC_APPLY_BUTTON, OnApplyButton) //}}AFX_MSG_MAP @@ -71,10 +69,10 @@ m_ctlProperties.AddString(text, ID_PROPERTY_COMBO_LIST, IDS_BOOLTEXT_STRING, (value)); #define PROP_UINT(text, value)\ - m_ctlProperties.AddString(text, ID_PROPERTY_TEXT, _itot(PtrToInt((value)), m_szBuffer, 10), 0); + m_ctlProperties.AddString(text, ID_PROPERTY_TEXT, _itot((int)(value), m_szBuffer, 10), 0); #define PROP_COMBO(text, prop_text, value)\ - m_ctlProperties.AddString(text, ID_PROPERTY_COMBO_LIST, prop_text, PtrToInt((value))); + m_ctlProperties.AddString(text, ID_PROPERTY_COMBO_LIST, prop_text, (int)((value))); #define PROP_DIR(text, prop_text, value)\ m_ctlProperties.AddString(text, ID_PROPERTY_DIR, (value)+CString(GetResManager()->LoadString(prop_text)), 0); @@ -83,20 +81,22 @@ m_ctlProperties.AddString(text, ID_PROPERTY_PATH, (value)+CString(GetResManager()->LoadString(prop_text)), 0); #define PROP_CUSTOM_UINT(text, value, callback, param)\ - m_ctlProperties.AddString(text, ID_PROPERTY_CUSTOM, CString(_itot(PtrToInt(value), m_szBuffer, 10)), callback, this, param, 0); + m_ctlProperties.AddString(text, ID_PROPERTY_CUSTOM, CString(_itot((int)(value), m_szBuffer, 10)), callback, this, param, 0); #define SKIP_SEPARATOR(pos)\ pos++; BOOL COptionsDlg::OnInitDialog() { - CHLanguageDialog::OnInitDialog(); + CLanguageDialog::OnInitDialog(); m_ctlProperties.Init(); // copy shortcut and recent paths icpf::config* pConfig = GetConfig(); assert(pConfig); + if(!pConfig) + return FALSE; m_cvRecent.clear(true); size_t stSize = pConfig->get_value_count(PP_RECENTPATHS); @@ -117,7 +117,7 @@ m_cvShortcuts.push_back(pszPath); } - GetConfig()->get_string(PP_PLANGDIR, m_szLangPath, _MAX_PATH); + _tcscpy(m_szLangPath, _T("\\Langs\\")); GetApp()->ExpandPath(m_szLangPath); GetResManager()->Scan(m_szLangPath, &m_vld); @@ -218,7 +218,7 @@ ApplyProperties(); SendClosingNotify(); - CHLanguageDialog::OnOK(); + CLanguageDialog::OnOK(); } void COptionsDlg::FillPropertyList() @@ -241,20 +241,12 @@ TRACE(_t("Autosavedir=%s\n"), strPath); PROP_DIR(IDS_TEMPFOLDER_STRING, IDS_TEMPFOLDERCHOOSE_STRING, strPath) - GetConfig()->get_string(PP_PPLUGINSDIR, strPath.GetBuffer(_MAX_PATH), _MAX_PATH); - strPath.ReleaseBuffer(); - PROP_DIR(IDS_PLUGSFOLDER_STRING, IDS_PLUGSFOLDERCHOOSE_STRING, strPath) - - GetConfig()->get_string(PP_PHELPDIR, strPath.GetBuffer(_MAX_PATH), _MAX_PATH); - strPath.ReleaseBuffer(); - PROP_DIR(IDS_CFGHELPDIR_STRING, IDS_CFGHELPDIRCHOOSE_STRING, strPath) - // lang CString strLangs; UINT uiIndex=0; - for (vector::iterator it=m_vld.begin();it != m_vld.end();it++) + for (vector::iterator it=m_vld.begin();it != m_vld.end();it++) { - strLangs+=(*it).m_pszLngName; + strLangs+=(*it).GetLangName(); strLangs+=_T("!"); if (_tcsicmp((*it).GetFilename(true), GetResManager()->m_ld.GetFilename(true)) == 0) uiIndex=it-m_vld.begin(); @@ -263,10 +255,6 @@ PROP_COMBO(IDS_LANGUAGE_STRING, strLangs, uiIndex) - GetConfig()->get_string(PP_PLANGDIR, strPath.GetBuffer(_MAX_PATH), _MAX_PATH); - strPath.ReleaseBuffer(); - PROP_DIR(IDS_LANGUAGESFOLDER_STRING, IDS_LANGSFOLDERCHOOSE_STRING, strPath) - ///////////////// PROP_SEPARATOR(IDS_STATUSWINDOW_STRING); PROP_UINT(IDS_REFRESHSTATUSINTERVAL_STRING, GetConfig()->get_signed_num(PP_STATUSREFRESHINTERVAL)) @@ -375,8 +363,6 @@ pConfig->set_signed_num(PP_PAUTOSAVEINTERVAL, GetUintProp(iPosition++)); pConfig->set_signed_num(PP_PPROCESSPRIORITYCLASS, IndexToPriorityClass(GetIndexProp(iPosition++))); pConfig->set_string(PP_PAUTOSAVEDIRECTORY, GetStringProp(iPosition++)); - pConfig->set_string(PP_PPLUGINSDIR, GetStringProp(iPosition++)); - pConfig->set_string(PP_PHELPDIR, GetStringProp(iPosition++)); // language PCTSTR pszSrc=m_vld.at(GetIndexProp(iPosition++)).GetFilename(true); if (_tcsnicmp(pszSrc, GetApp()->GetProgramPath(), _tcslen(GetApp()->GetProgramPath())) == 0) @@ -388,7 +374,6 @@ } else pConfig->set_string(PP_PLANGUAGE, pszSrc); - pConfig->set_string(PP_PLANGDIR, GetStringProp(iPosition++)); SKIP_SEPARATOR(iPosition) pConfig->set_signed_num(PP_STATUSREFRESHINTERVAL, GetUintProp(iPosition++)); @@ -487,7 +472,7 @@ void COptionsDlg::OnCancel() { SendClosingNotify(); - CHLanguageDialog::OnCancel(); + CLanguageDialog::OnCancel(); } void COptionsDlg::SendClosingNotify() @@ -497,6 +482,9 @@ CString COptionsDlg::MakeCompoundString(UINT uiBase, int iCount, LPCTSTR lpszSeparator) { + assert(lpszSeparator); + if(!lpszSeparator) + return _T(""); _tcscpy(m_szBuffer, GetResManager()->LoadString(uiBase+0)); for (int i=1;i