Index: src/ch/CfgProperties.cpp =================================================================== diff -u -r3493e9fc470285b0a0b417d50be281467a071eb7 -rcdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e --- src/ch/CfgProperties.cpp (.../CfgProperties.cpp) (revision 3493e9fc470285b0a0b417d50be281467a071eb7) +++ src/ch/CfgProperties.cpp (.../CfgProperties.cpp) (revision cdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e) @@ -19,95 +19,100 @@ *************************************************************************/ #include "stdafx.h" #include "CfgProperties.h" +#include "../libicpf/config_property.h" -#ifdef _DEBUG -#define new DEBUG_NEW +#ifdef DEBUG +#define new DEBUG NEW #endif -bool RegisterProperties(CConfigManager* pManager) +bool RegisterProperties(icpf::config* pManager) { - pManager->RegisterBoolProperty(_T("Program"), _T("Enabled clipboard monitoring"), false); - pManager->RegisterIntProperty(_T("Program"), _T("Monitor scan interval"), 1000); - pManager->RegisterBoolProperty(_T("Program"), _T("Reload after restart"), false); - pManager->RegisterBoolProperty(_T("Program"), _T("Shutdown system after finished"), false); - pManager->RegisterIntProperty(_T("Program"), _T("Time before shutdown"), 10000); - pManager->RegisterBoolProperty(_T("Program"), _T("Force shutdown"), false); - pManager->RegisterIntProperty(_T("Program"), _T("Autosave interval"), 30000); - pManager->RegisterIntProperty(_T("Program"), _T("Process priority class"), NORMAL_PRIORITY_CLASS); - pManager->RegisterStringProperty(_T("Program"), _T("Autosave directory"), _T("\\"), RF_PATH); - pManager->RegisterStringProperty(_T("Program"), _T("Plugins directory"), _T("\\Plugins\\"), RF_PATH); - pManager->RegisterStringProperty(_T("Program"), _T("Help directory"), _T("\\Help\\"), RF_PATH); - pManager->RegisterStringProperty(_T("Program"), _T("Language"), _T("\\Langs\\English.lng")); - pManager->RegisterStringProperty(_T("Program"), _T("Languages directory"), _T("\\Langs\\"), RF_PATH); + const long long llHour = 3600UL*1000UL; +// const long long llMinute = 60UL*1000UL; + const long long llSecond = 1000UL; - pManager->RegisterIntProperty(_T("Status dialog"), _T("Status refresh interval"), 1000); - pManager->RegisterBoolProperty(_T("Status dialog"), _T("Show details"), true); - pManager->RegisterBoolProperty(_T("Status dialog"), _T("Auto remove finished"), false); + pManager->register_bool(_t("Program/Enabled clipboard monitoring"), false); + pManager->register_signed_num(_t("Program/Monitor scan interval"), 1000, 0, llHour); + pManager->register_bool(_t("Program/Reload after restart"), false); + pManager->register_bool(_t("Program/Shutdown system after finished"), false); + pManager->register_signed_num(_t("Program/Time before shutdown"), 10000, 0, 24*llHour); + pManager->register_bool(_t("Program/Force shutdown"), false); + pManager->register_signed_num(_t("Program/Autosave interval"), 30*llSecond, 0, 24*llHour); + pManager->register_signed_num(_t("Program/Process priority class"), NORMAL_PRIORITY_CLASS, 0, 0xffffffff); + pManager->register_string(_t("Program/Autosave directory"), _t("\\"), icpf::property::flag_path); + pManager->register_string(_t("Program/Plugins directory"), _t("\\Plugins\\"), icpf::property::flag_path); + pManager->register_string(_t("Program/Help directory"), _t("\\Help\\"), icpf::property::flag_path); + pManager->register_string(_t("Program/Language"), _t("\\Langs\\English.lng")); + pManager->register_string(_t("Program/Languages directory"), _t("\\Langs\\"), icpf::property::flag_path); - pManager->RegisterIntProperty(_T("Folder dialog"), _T("Dialog width"), -1); - pManager->RegisterIntProperty(_T("Folder dialog"), _T("Dialog height"), -1); - pManager->RegisterIntProperty(_T("Folder dialog"), _T("Shortcut list style"), 1); - pManager->RegisterBoolProperty(_T("Folder dialog"), _T("Extended view"), true); - pManager->RegisterBoolProperty(_T("Folder dialog"), _T("Ignore shell dialogs"), false); + pManager->register_signed_num(_t("Status dialog/Status refresh interval"), 1000, 0, 24*llHour); + pManager->register_bool(_t("Status dialog/Show details"), true); + pManager->register_bool(_t("Status dialog/Auto remove finished"), false); - pManager->RegisterBoolProperty(_T("Mini view"), _T("Show filenames"), true); - pManager->RegisterBoolProperty(_T("Mini view"), _T("Show single tasks"), true); - pManager->RegisterIntProperty(_T("Mini view"), _T("Miniview refresh interval"), 200); - pManager->RegisterBoolProperty(_T("Mini view"), _T("Autoshow when run"), true); - pManager->RegisterBoolProperty(_T("Mini view"), _T("Autohide when empty"), true); - pManager->RegisterBoolProperty(_T("Mini view"), _T("Use smooth progress"), true); + pManager->register_signed_num(_t("Folder dialog/Dialog width"), -1, -1, 32767); + pManager->register_signed_num(_t("Folder dialog/Dialog height"), -1, -1, 32767); + pManager->register_signed_num(_t("Folder dialog/Shortcut list style"), 1, 0, 3); + pManager->register_bool(_t("Folder dialog/Extended view"), true); + pManager->register_bool(_t("Folder dialog/Ignore shell dialogs"), false); - pManager->RegisterBoolProperty(_T("Copying/moving"), _T("Use auto-complete files"), true); - pManager->RegisterBoolProperty(_T("Copying/moving"), _T("Always set destination attributes"), true); - pManager->RegisterBoolProperty(_T("Copying/moving"), _T("Always set destination time"), true); - pManager->RegisterBoolProperty(_T("Copying/moving"), _T("Protect read-only files"), false); - pManager->RegisterIntProperty(_T("Copying/moving"), _T("Limit max operations"), 1); - pManager->RegisterBoolProperty(_T("Copying/moving"), _T("Read tasks size before blocking"), true); - pManager->RegisterIntProperty(_T("Copying/moving"), _T("Show visual feedback"), 2); - pManager->RegisterBoolProperty(_T("Copying/moving"), _T("Use timed feedback dialogs"), false); - pManager->RegisterIntProperty(_T("Copying/moving"), _T("Feedback time"), 60000); - pManager->RegisterBoolProperty(_T("Copying/moving"), _T("Auto retry on error"), true); - pManager->RegisterIntProperty(_T("Copying/moving"), _T("Auto retry interval"), 10000); - pManager->RegisterIntProperty(_T("Copying/moving"), _T("Default priority"), THREAD_PRIORITY_NORMAL); - pManager->RegisterBoolProperty(_T("Copying/moving"), _T("Disable priority boost"), false); - pManager->RegisterBoolProperty(_T("Copying/moving"), _T("Delete files after finished"), true); - pManager->RegisterBoolProperty(_T("Copying/moving"), _T("Create log file"), true); + pManager->register_bool(_t("Mini view/Show filenames"), true); + pManager->register_bool(_t("Mini view/Show single tasks"), true); + pManager->register_signed_num(_t("Mini view/Miniview refresh interval"), 200, 0, 24*llHour); + pManager->register_bool(_t("Mini view/Autoshow when run"), true); + pManager->register_bool(_t("Mini view/Autohide when empty"), true); + pManager->register_bool(_t("Mini view/Use smooth progress"), true); - pManager->RegisterBoolProperty(_T("Shell"), _T("Show 'Copy' command"), true); - pManager->RegisterBoolProperty(_T("Shell"), _T("Show 'Move' command"), true); - pManager->RegisterBoolProperty(_T("Shell"), _T("Show 'Copy/move special' command"), true); - pManager->RegisterBoolProperty(_T("Shell"), _T("Show 'Paste' command"), true); - pManager->RegisterBoolProperty(_T("Shell"), _T("Show 'Paste special' command"), true); - pManager->RegisterBoolProperty(_T("Shell"), _T("Show 'Copy to' command"), true); - pManager->RegisterBoolProperty(_T("Shell"), _T("Show 'Move to' command"), true); - pManager->RegisterBoolProperty(_T("Shell"), _T("Show 'Copy to/Move to special' command"), true); - pManager->RegisterBoolProperty(_T("Shell"), _T("Show free space along with shortcut"), true); - pManager->RegisterBoolProperty(_T("Shell"), _T("Show shell icons in shortcuts menu"), false); - pManager->RegisterBoolProperty(_T("Shell"), _T("Use drag&drop default menu item override"), true); - pManager->RegisterIntProperty(_T("Shell"), _T("Default action when dragging"), 3); + pManager->register_bool(_t("Copying/Use auto-complete files"), true); + pManager->register_bool(_t("Copying/Always set destination attributes"), true); + pManager->register_bool(_t("Copying/Always set destination time"), true); + pManager->register_bool(_t("Copying/Protect read-only files"), false); + pManager->register_signed_num(_t("Copying/Limit max operations"), 1, 0, 0xffffffff); + pManager->register_bool(_t("Copying/Read tasks size before blocking"), true); + pManager->register_signed_num(_t("Copying/Show visual feedback"), 2, 0, 2); + pManager->register_bool(_t("Copying/Use timed feedback dialogs"), false); + pManager->register_signed_num(_t("Copying/Feedback time"), 60*llSecond, 0, 24*llHour); + pManager->register_bool(_t("Copying/Auto retry on error"), true); + pManager->register_signed_num(_t("Copying/Auto retry interval"), 10*llSecond, 0, 24*llHour); + pManager->register_signed_num(_t("Copying/Default priority"), THREAD_PRIORITY_NORMAL, 0, 0xffffffff); + pManager->register_bool(_t("Copying/Disable priority boost"), false); + pManager->register_bool(_t("Copying/Delete files after finished"), true); + pManager->register_bool(_t("Copying/Create log file"), true); - pManager->RegisterBoolProperty(_T("Buffer"), _T("Use only default buffer"), false); - pManager->RegisterIntProperty(_T("Buffer"), _T("Default buffer size"), 2097152); - pManager->RegisterIntProperty(_T("Buffer"), _T("One physical disk buffer size"), 4194304); - pManager->RegisterIntProperty(_T("Buffer"), _T("Two different hard disks buffer size"), 524288); - pManager->RegisterIntProperty(_T("Buffer"), _T("CD buffer size"), 262144); - pManager->RegisterIntProperty(_T("Buffer"), _T("LAN buffer size"), 131072); - pManager->RegisterBoolProperty(_T("Buffer"), _T("Use no buffering for large files"), true); - pManager->RegisterIntProperty(_T("Buffer"), _T("Large files lower boundary limit"), 2097152); + pManager->register_bool(_t("Shell/Show 'Copy' command"), true); + pManager->register_bool(_t("Shell/Show 'Move' command"), true); + pManager->register_bool(_t("Shell/Show 'Copy,move special' command"), true); + pManager->register_bool(_t("Shell/Show 'Paste' command"), true); + pManager->register_bool(_t("Shell/Show 'Paste special' command"), true); + pManager->register_bool(_t("Shell/Show 'Copy to' command"), true); + pManager->register_bool(_t("Shell/Show 'Move to' command"), true); + pManager->register_bool(_t("Shell/Show 'Copy to,Move to special' command"), true); + pManager->register_bool(_t("Shell/Show free space along with shortcut"), true); + pManager->register_bool(_t("Shell/Show shell icons in shortcuts menu"), false); + pManager->register_bool(_t("Shell/Use drag&drop default menu item override"), true); + pManager->register_signed_num(_t("Shell/Default action when dragging"), 3, 0, 0xffffffff); - pManager->RegisterStringProperty(_T("Log file"), _T("Path to main log file"), _T("\\ch.log")); - pManager->RegisterBoolProperty(_T("Log file"), _T("Enable logging"), true); - pManager->RegisterBoolProperty(_T("Log file"), _T("Enable log size limitation"), true); - pManager->RegisterIntProperty(_T("Log file"), _T("Max log size limit"), 65535); - pManager->RegisterBoolProperty(_T("Log file"), _T("Precise log size limiting"), false); - pManager->RegisterIntProperty(_T("Log file"), _T("Truncation buffer size"), 65535, PDL_PARANOID); + pManager->register_bool(_t("Buffer/Use only default buffer"), false); + pManager->register_signed_num(_t("Buffer/Default buffer size"), 2097152, 1, 0xffffffff); + pManager->register_signed_num(_t("Buffer/One physical disk buffer size"), 4194304, 1, 0xffffffff); + pManager->register_signed_num(_t("Buffer/Two different hard disks buffer size"), 524288, 1, 0xffffffff); + pManager->register_signed_num(_t("Buffer/CD buffer size"), 262144, 1, 0xffffffff); + pManager->register_signed_num(_t("Buffer/LAN buffer size"), 131072, 1, 0xffffffff); + pManager->register_bool(_t("Buffer/Use no buffering for large files"), true); + pManager->register_signed_num(_t("Buffer/Large files lower boundary limit"), 2097152, 1, 0xffffffff); - pManager->RegisterBoolProperty(_T("Sounds"), _T("Play sounds"), true); - pManager->RegisterStringProperty(_T("Sounds"), _T("Error sound path"), _T("\\media\\chord.wav")); - pManager->RegisterStringProperty(_T("Sounds"), _T("Finished sound path"), _T("\\media\\ding.wav")); + pManager->register_string(_t("Log file/Path to main log file"), _t("\\ch.log")); + pManager->register_bool(_t("Log file/Enable logging"), true); + pManager->register_bool(_t("Log file/Enable log size limitation"), true); + pManager->register_signed_num(_t("Log file/Max log size limit"), 65535, 1024, 0xffffffff); + pManager->register_bool(_t("Log file/Precise log size limiting"), false); + pManager->register_signed_num(_t("Log file/Truncation buffer size"), 65535, 1024, 0xffffffff); - pManager->RegisterStringArrayProperty(_T("Shortcuts")); - pManager->RegisterStringArrayProperty(_T("Recent paths")); + pManager->register_bool(_t("Sounds/Play sounds"), true); + pManager->register_string(_t("Sounds/Error sound path"), _t("\\media\\chord.wav"), icpf::property::flag_path); + pManager->register_string(_t("Sounds/Finished sound path"), _t("\\media\\ding.wav"), icpf::property::flag_path); + pManager->register_string(_t("Shortcuts/Shortcut"), _t(""), icpf::property::flag_array); + pManager->register_string(_t("Recent paths/Path"), _t(""), icpf::property::flag_array); + return true; } Index: src/ch/CfgProperties.h =================================================================== diff -u -r3493e9fc470285b0a0b417d50be281467a071eb7 -rcdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e --- src/ch/CfgProperties.h (.../CfgProperties.h) (revision 3493e9fc470285b0a0b417d50be281467a071eb7) +++ src/ch/CfgProperties.h (.../CfgProperties.h) (revision cdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e) @@ -22,6 +22,8 @@ #pragma once +#include "../libicpf/cfg.h" + // properties definitions #define PP_PCLIPBOARDMONITORING 0 #define PP_PMONITORSCANINTERVAL 1 @@ -107,6 +109,6 @@ #define PP_RECENTPATHS 72 // register function -bool RegisterProperties(CConfigManager* pManager); +bool RegisterProperties(icpf::config* pManager); #endif \ No newline at end of file Index: src/ch/MainWnd.cpp =================================================================== diff -u -r4c272b19c74694c428c943011f279ec064fbd894 -rcdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e --- src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision 4c272b19c74694c428c943011f279ec064fbd894) +++ src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision cdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e) @@ -48,6 +48,7 @@ #include "ShutdownDlg.h" #include "StringHelpers.h" #include "..\common\ipcstructs.h" +#include #ifdef _DEBUG #define new DEBUG_NEW @@ -333,7 +334,7 @@ // save task status TCHAR szPath[_MAX_PATH]; - GetConfig()->GetStringValue(PP_PAUTOSAVEDIRECTORY, szPath, _MAX_PATH); + GetConfig()->get_string(PP_PAUTOSAVEDIRECTORY, szPath, _MAX_PATH); GetApp()->ExpandPath(szPath); pTask->Store(szPath, true); pTask->Store(szPath, false); @@ -372,14 +373,14 @@ // delete data if (fi.IsDirectory()) { - if (!GetConfig()->GetBoolValue(PP_CMPROTECTROFILES)) + if (!GetConfig()->get_bool(PP_CMPROTECTROFILES)) SetFileAttributes(fi.GetFullFilePath(), FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY); bSuccess=RemoveDirectory(fi.GetFullFilePath()); } else { // set files attributes to normal - it'd slow processing a bit, but it's better. - if (!GetConfig()->GetBoolValue(PP_CMPROTECTROFILES)) + if (!GetConfig()->get_bool(PP_CMPROTECTROFILES)) SetFileAttributes(fi.GetFullFilePath(), FILE_ATTRIBUTE_NORMAL); bSuccess=DeleteFile(fi.GetFullFilePath()); } @@ -410,8 +411,8 @@ try { // do we copy rest or recopy ? - bool bCopyRest=GetConfig()->GetBoolValue(PP_CMUSEAUTOCOMPLETEFILES); - UINT uiNotificationType=GetConfig()->GetIntValue(PP_CMSHOWVISUALFEEDBACK); + bool bCopyRest=GetConfig()->get_bool(PP_CMUSEAUTOCOMPLETEFILES); + UINT uiNotificationType=(UINT)GetConfig()->get_signed_num(PP_CMSHOWVISUALFEEDBACK); // Data regarding dest file CFileInfo fiDest; @@ -439,8 +440,8 @@ CSmallReplaceFilesDlg dlg; dlg.m_pfiSource=pData->pfiSrcFile; dlg.m_pfiDest=&fiDest; - dlg.m_bEnableTimer=GetConfig()->GetBoolValue(PP_CMUSETIMEDFEEDBACK); - dlg.m_iTime=GetConfig()->GetIntValue(PP_CMFEEDBACKTIME); + dlg.m_bEnableTimer=GetConfig()->get_bool(PP_CMUSETIMEDFEEDBACK); + dlg.m_iTime=(int)GetConfig()->get_signed_num(PP_CMFEEDBACKTIME); dlg.m_iDefaultOption=ID_IGNORE; iDlgCode=dlg.DoModal(); @@ -472,8 +473,8 @@ CReplaceFilesDlg dlg; dlg.m_pfiSource=pData->pfiSrcFile; dlg.m_pfiDest=&fiDest; - dlg.m_bEnableTimer=GetConfig()->GetBoolValue(PP_CMUSETIMEDFEEDBACK); - dlg.m_iTime=GetConfig()->GetIntValue(PP_CMFEEDBACKTIME); + dlg.m_bEnableTimer=GetConfig()->get_bool(PP_CMUSETIMEDFEEDBACK); + dlg.m_iTime=(int)GetConfig()->get_signed_num(PP_CMFEEDBACKTIME); dlg.m_iDefaultOption=ID_COPYREST; iDlgCode=dlg.DoModal(); @@ -495,8 +496,8 @@ CSmallReplaceFilesDlg dlg; dlg.m_pfiSource=pData->pfiSrcFile; dlg.m_pfiDest=&fiDest; - dlg.m_bEnableTimer=GetConfig()->GetBoolValue(PP_CMUSETIMEDFEEDBACK); - dlg.m_iTime=GetConfig()->GetIntValue(PP_CMFEEDBACKTIME); + dlg.m_bEnableTimer=GetConfig()->get_bool(PP_CMUSETIMEDFEEDBACK); + dlg.m_iTime=(int)GetConfig()->get_signed_num(PP_CMFEEDBACKTIME); dlg.m_iDefaultOption=ID_RECOPY; iDlgCode=dlg.DoModal(); // wy�wietl @@ -532,7 +533,7 @@ break; case IDCANCEL: // log - if (GetConfig()->GetBoolValue(PP_CMCREATELOG)) + if (GetConfig()->get_bool(PP_CMCREATELOG)) pData->pTask->m_log.logi(GetResManager()->LoadString(IDS_OTFPRECHECKCANCELREQUEST_STRING), (PCTSTR)pData->pfiSrcFile->GetFullFilePath()); throw new CProcessingException(E_CANCEL, pData->pTask); break; @@ -545,15 +546,15 @@ } // change attributes of a dest file - if (!GetConfig()->GetBoolValue(PP_CMPROTECTROFILES)) + if (!GetConfig()->get_bool(PP_CMPROTECTROFILES)) SetFileAttributes(pData->strDstFile, FILE_ATTRIBUTE_NORMAL); // first or second pass ? only for FFNB bool bFirstPass=true; // check size of src file to know whether use flag FILE_FLAG_NOBUFFERING l_start: - bool bNoBuffer=(bFirstPass && GetConfig()->GetBoolValue(PP_BFUSENOBUFFERING) && pData->pfiSrcFile->GetLength64() >= GetConfig()->GetIntValue(PP_BFBOUNDARYLIMIT)); + bool bNoBuffer=(bFirstPass && GetConfig()->get_bool(PP_BFUSENOBUFFERING) && pData->pfiSrcFile->GetLength64() >= (unsigned long long)GetConfig()->get_signed_num(PP_BFBOUNDARYLIMIT)); // refresh data about file if (!bFirstPass) @@ -582,8 +583,8 @@ CReplaceOnlyDlg dlg; dlg.m_pfiSource=pData->pfiSrcFile; dlg.m_pfiDest=&fiRealSrc; - dlg.m_bEnableTimer=GetConfig()->GetBoolValue(PP_CMUSETIMEDFEEDBACK); - dlg.m_iTime=GetConfig()->GetIntValue(PP_CMFEEDBACKTIME); + dlg.m_bEnableTimer=GetConfig()->get_bool(PP_CMUSETIMEDFEEDBACK); + dlg.m_iTime=(int)GetConfig()->get_signed_num(PP_CMFEEDBACKTIME); dlg.m_iDefaultOption=ID_WAIT; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwLastError, 0, dlg.m_strMessage.GetBuffer(_MAX_PATH), _MAX_PATH, NULL); @@ -643,8 +644,8 @@ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwLastError, 0, dlg.m_strMessage.GetBuffer(_MAX_PATH), _MAX_PATH, NULL); dlg.m_strMessage.ReleaseBuffer(); - dlg.m_bEnableTimer=GetConfig()->GetBoolValue(PP_CMUSETIMEDFEEDBACK); - dlg.m_iTime=GetConfig()->GetIntValue(PP_CMFEEDBACKTIME); + dlg.m_bEnableTimer=GetConfig()->get_bool(PP_CMUSETIMEDFEEDBACK); + dlg.m_iTime=(int)GetConfig()->get_signed_num(PP_CMFEEDBACKTIME); dlg.m_iDefaultOption=ID_WAIT; iDlgCode=dlg.DoModal(); } @@ -655,7 +656,7 @@ { case ID_RETRY: // change attributes - if (!GetConfig()->GetBoolValue(PP_CMPROTECTROFILES)) + if (!GetConfig()->get_bool(PP_CMPROTECTROFILES)) SetFileAttributes(pData->strDstFile, FILE_ATTRIBUTE_NORMAL); // log @@ -920,21 +921,21 @@ CustomCopyFile(&ccp); // if moving - delete file (only if config flag is set) - if (bMove && !GetConfig()->GetBoolValue(PP_CMDELETEAFTERFINISHED) && j == iCopiesCount-1) + if (bMove && !GetConfig()->get_bool(PP_CMDELETEAFTERFINISHED) && j == iCopiesCount-1) { - if (!GetConfig()->GetBoolValue(PP_CMPROTECTROFILES)) + if (!GetConfig()->get_bool(PP_CMPROTECTROFILES)) SetFileAttributes(fi.GetFullFilePath(), FILE_ATTRIBUTE_NORMAL); DeleteFile(fi.GetFullFilePath()); // there will be another try later, so I don't check // if succeeded } } // set a time - if (GetConfig()->GetBoolValue(PP_CMSETDESTDATE)) + if (GetConfig()->get_bool(PP_CMSETDESTDATE)) SetFileDirectoryTime(ccp.strDstFile, &fi); // no error check - ma�o istotne // attributes - if (GetConfig()->GetBoolValue(PP_CMSETDESTATTRIBUTES)) + if (GetConfig()->get_bool(PP_CMSETDESTATTRIBUTES)) SetFileAttributes(ccp.strDstFile, fi.GetAttributes()); // j.w. } } @@ -998,28 +999,28 @@ TRACE("\n\nENTERING ThrdProc (new task started)...\n"); CTask* pTask=static_cast(pParam); TCHAR szPath[_MAX_PATH]; - GetConfig()->GetStringValue(PP_PAUTOSAVEDIRECTORY, szPath, _MAX_PATH); + GetConfig()->get_string(PP_PAUTOSAVEDIRECTORY, szPath, _MAX_PATH); GetApp()->ExpandPath(szPath); _tcscat(szPath, pTask->GetUniqueName()+_T(".log")); pTask->m_log.init(szPath, 262144, icpf::log_file::level_debug, false, false); // set thread boost HANDLE hThread=GetCurrentThread(); - ::SetThreadPriorityBoost(hThread, GetConfig()->GetBoolValue(PP_CMDISABLEPRIORITYBOOST)); + ::SetThreadPriorityBoost(hThread, GetConfig()->get_bool(PP_CMDISABLEPRIORITYBOOST)); CTime tm=CTime::GetCurrentTime(); pTask->m_log.logi(GetResManager()->LoadString(IDS_OTFTHREADSTART_STRING), tm.GetDay(), tm.GetMonth(), tm.GetYear(), tm.GetHour(), tm.GetMinute(), tm.GetSecond()); try { // to make the value stable - bool bReadTasksSize=GetConfig()->GetBoolValue(PP_CMREADSIZEBEFOREBLOCKING); + bool bReadTasksSize=GetConfig()->get_bool(PP_CMREADSIZEBEFOREBLOCKING); if (!bReadTasksSize) CheckForWaitState(pTask); // operation limiting // set what's needed - pTask->m_lLastTime=time(NULL); // last time (start counting) + pTask->m_lLastTime=(long)time(NULL); // last time (start counting) // search for files if needed if ((pTask->GetStatus(ST_STEP_MASK) == ST_NULL_STATUS @@ -1047,12 +1048,12 @@ // default int iResult=ID_IGNORE; - if (GetConfig()->GetIntValue(PP_CMSHOWVISUALFEEDBACK) > 0) + if (GetConfig()->get_signed_num(PP_CMSHOWVISUALFEEDBACK) > 0) { // make user know that some place is missing CNotEnoughRoomDlg dlg; - dlg.m_bEnableTimer=GetConfig()->GetBoolValue(PP_CMUSETIMEDFEEDBACK); - dlg.m_iTime=GetConfig()->GetIntValue(PP_CMFEEDBACKTIME); + dlg.m_bEnableTimer=GetConfig()->get_bool(PP_CMUSETIMEDFEEDBACK); + dlg.m_iTime=(int)GetConfig()->get_signed_num(PP_CMFEEDBACKTIME); dlg.m_llRequired=i64Needed; @@ -1090,7 +1091,7 @@ CheckForWaitState(pTask); - pTask->m_lLastTime=time(NULL); + pTask->m_lLastTime=(long)time(NULL); } // Phase II - copying/moving @@ -1110,17 +1111,17 @@ // save progress before killed TCHAR szPath[_MAX_PATH]; - GetConfig()->GetStringValue(PP_PAUTOSAVEDIRECTORY, szPath, _MAX_PATH); + GetConfig()->get_string(PP_PAUTOSAVEDIRECTORY, szPath, _MAX_PATH); GetApp()->ExpandPath(szPath); pTask->Store(szPath, false); // we are ending pTask->DecreaseOperationsPending(); // play sound - if (GetConfig()->GetBoolValue(PP_SNDPLAYSOUNDS)) + if (GetConfig()->get_bool(PP_SNDPLAYSOUNDS)) { - GetConfig()->GetStringValue(PP_SNDFINISHEDSOUNDPATH, szPath, _MAX_PATH); + GetConfig()->get_string(PP_SNDFINISHEDSOUNDPATH, szPath, _MAX_PATH); GetApp()->ExpandPath(szPath); PlaySound(szPath, NULL, SND_FILENAME | SND_ASYNC); } @@ -1144,10 +1145,10 @@ // log pTask->m_log.logerr(GetResManager()->LoadString(IDS_OTFCAUGHTEXCEPTIONMAIN_STRING), e->m_dwError, e->m_iType); - if (e->m_iType == E_ERROR && GetConfig()->GetBoolValue(PP_SNDPLAYSOUNDS)) + if (e->m_iType == E_ERROR && GetConfig()->get_bool(PP_SNDPLAYSOUNDS)) { TCHAR szPath[_MAX_PATH]; - GetConfig()->GetStringValue(PP_SNDERRORSOUNDPATH, szPath, _MAX_PATH); + GetConfig()->get_string(PP_SNDERRORSOUNDPATH, szPath, _MAX_PATH); GetApp()->ExpandPath(szPath); PlaySound(szPath, NULL, SND_FILENAME | SND_ASYNC); } @@ -1189,8 +1190,11 @@ while (!pData->bKill) { - if (uiCounter == 0 && GetConfig()->GetBoolValue(PP_PCLIPBOARDMONITORING) && IsClipboardFormatAvailable(CF_HDROP)) + if (uiCounter == 0 && GetConfig()->get_bool(PP_PCLIPBOARDMONITORING) && IsClipboardFormatAvailable(CF_HDROP)) { + icpf::config* pConfig = GetConfig(); + assert(pConfig); + // get data from clipboard OpenClipboard(pData->m_hwnd); HANDLE handle=GetClipboardData(CF_HDROP); @@ -1227,26 +1231,42 @@ CloseClipboard(); BUFFERSIZES bs; - bs.m_bOnlyDefault=GetConfig()->GetBoolValue(PP_BFUSEONLYDEFAULT); - bs.m_uiDefaultSize=GetConfig()->GetIntValue(PP_BFDEFAULT); - bs.m_uiOneDiskSize=GetConfig()->GetIntValue(PP_BFONEDISK); - bs.m_uiTwoDisksSize=GetConfig()->GetIntValue(PP_BFTWODISKS); - bs.m_uiCDSize=GetConfig()->GetIntValue(PP_BFCD); - bs.m_uiLANSize=GetConfig()->GetIntValue(PP_BFLAN); + bs.m_bOnlyDefault=pConfig->get_bool(PP_BFUSEONLYDEFAULT); + bs.m_uiDefaultSize=(UINT)pConfig->get_signed_num(PP_BFDEFAULT); + bs.m_uiOneDiskSize=(UINT)pConfig->get_signed_num(PP_BFONEDISK); + bs.m_uiTwoDisksSize=(UINT)pConfig->get_signed_num(PP_BFTWODISKS); + bs.m_uiCDSize=(UINT)pConfig->get_signed_num(PP_BFCD); + bs.m_uiLANSize=(UINT)pConfig->get_signed_num(PP_BFLAN); pTask->SetBufferSizes(&bs); - pTask->SetPriority(GetConfig()->GetIntValue(PP_CMDEFAULTPRIORITY)); + pTask->SetPriority((int)pConfig->get_signed_num(PP_CMDEFAULTPRIORITY)); // get dest folder CFolderDialog dlg; - GetConfig()->GetStringArrayValue(PP_SHORTCUTS, &dlg.m_bdData.cvShortcuts); - GetConfig()->GetStringArrayValue(PP_RECENTPATHS, &dlg.m_bdData.cvRecent); - dlg.m_bdData.bExtended=GetConfig()->GetBoolValue(PP_FDEXTENDEDVIEW); - dlg.m_bdData.cx=GetConfig()->GetIntValue(PP_FDWIDTH); - dlg.m_bdData.cy=GetConfig()->GetIntValue(PP_FDHEIGHT); - dlg.m_bdData.iView=GetConfig()->GetIntValue(PP_FDSHORTCUTLISTSTYLE); - dlg.m_bdData.bIgnoreDialogs=GetConfig()->GetBoolValue(PP_FDIGNORESHELLDIALOGS); + const tchar_t* pszPath = NULL; + dlg.m_bdData.cvShortcuts.clear(true); + size_t stCount = pConfig->get_value_count(PP_SHORTCUTS); + for(size_t stIndex = 0; stIndex < stCount; stIndex++) + { + pszPath = pConfig->get_string(PP_SHORTCUTS, stIndex); + dlg.m_bdData.cvShortcuts.push_back(pszPath); + } + + dlg.m_bdData.cvRecent.clear(true); + stCount = pConfig->get_value_count(PP_RECENTPATHS); + for(size_t stIndex = 0; stIndex < stCount; stIndex++) + { + pszPath = pConfig->get_string(PP_RECENTPATHS, stIndex); + dlg.m_bdData.cvRecent.push_back(pszPath); + } + + dlg.m_bdData.bExtended=pConfig->get_bool(PP_FDEXTENDEDVIEW); + dlg.m_bdData.cx=(int)pConfig->get_signed_num(PP_FDWIDTH); + dlg.m_bdData.cy=(int)pConfig->get_signed_num(PP_FDHEIGHT); + dlg.m_bdData.iView=(int)pConfig->get_signed_num(PP_FDSHORTCUTLISTSTYLE); + dlg.m_bdData.bIgnoreDialogs=pConfig->get_bool(PP_FDIGNORESHELLDIALOGS); + dlg.m_bdData.strInitialDir=(dlg.m_bdData.cvRecent.size() > 0) ? dlg.m_bdData.cvRecent.at(0) : _T(""); int iStatus=pTask->GetStatus(ST_OPERATION_MASK); @@ -1272,15 +1292,25 @@ int iResult=dlg.DoModal(); // set data to config - GetConfig()->SetStringArrayValue(PP_SHORTCUTS, &dlg.m_bdData.cvShortcuts); - GetConfig()->SetStringArrayValue(PP_RECENTPATHS, &dlg.m_bdData.cvRecent); - GetConfig()->SetBoolValue(PP_FDEXTENDEDVIEW, dlg.m_bdData.bExtended); - GetConfig()->SetIntValue(PP_FDWIDTH, dlg.m_bdData.cx); - GetConfig()->SetIntValue(PP_FDHEIGHT, dlg.m_bdData.cy); - GetConfig()->SetIntValue(PP_FDSHORTCUTLISTSTYLE, dlg.m_bdData.iView); - GetConfig()->SetBoolValue(PP_FDIGNORESHELLDIALOGS, dlg.m_bdData.bIgnoreDialogs); - GetConfig()->Save(); + pConfig->clear_array_values(PP_SHORTCUTS); + for(char_vector::iterator it = dlg.m_bdData.cvShortcuts.begin(); it != dlg.m_bdData.cvShortcuts.end(); it++) + { + pConfig->set_string(PP_SHORTCUTS, (*it), icpf::property::action_add); + } + pConfig->clear_array_values(PP_RECENTPATHS); + for(char_vector::iterator it = dlg.m_bdData.cvRecent.begin(); it != dlg.m_bdData.cvRecent.end(); it++) + { + pConfig->set_string(PP_RECENTPATHS, (*it), icpf::property::action_add); + } + + pConfig->set_bool(PP_FDEXTENDEDVIEW, dlg.m_bdData.bExtended); + pConfig->set_signed_num(PP_FDWIDTH, dlg.m_bdData.cx); + pConfig->set_signed_num(PP_FDHEIGHT, dlg.m_bdData.cy); + pConfig->set_signed_num(PP_FDSHORTCUTLISTSTYLE, dlg.m_bdData.iView); + pConfig->set_bool(PP_FDIGNORESHELLDIALOGS, dlg.m_bdData.bIgnoreDialogs); + pConfig->write(NULL); + if ( iResult != IDOK ) delete pTask; else @@ -1296,7 +1326,7 @@ // write pTask to a file TCHAR szPath[_MAX_PATH]; - GetConfig()->GetStringValue(PP_PAUTOSAVEDIRECTORY, szPath, _MAX_PATH); + GetConfig()->get_string(PP_PAUTOSAVEDIRECTORY, szPath, _MAX_PATH); GetApp()->ExpandPath(szPath); pTask->Store(szPath, true); pTask->Store(szPath, false); @@ -1310,7 +1340,7 @@ } // do we need to check for turning computer off - if (GetConfig()->GetBoolValue(PP_PSHUTDOWNAFTREFINISHED)) + if (GetConfig()->get_bool(PP_PSHUTDOWNAFTREFINISHED)) { if (uiShutCounter == 0) { @@ -1324,17 +1354,17 @@ { TRACE("Shut down windows\n"); bool bShutdown=true; - if (GetConfig()->GetIntValue(PP_PTIMEBEFORESHUTDOWN) != 0) + if (GetConfig()->get_signed_num(PP_PTIMEBEFORESHUTDOWN) != 0) { CShutdownDlg dlg; - dlg.m_iOverallTime=GetConfig()->GetIntValue(PP_PTIMEBEFORESHUTDOWN); + dlg.m_iOverallTime=(int)GetConfig()->get_signed_num(PP_PTIMEBEFORESHUTDOWN); if (dlg.m_iOverallTime < 0) dlg.m_iOverallTime=-dlg.m_iOverallTime; bShutdown=(dlg.DoModal() != IDCANCEL); } - GetConfig()->SetBoolValue(PP_PSHUTDOWNAFTREFINISHED, false); - GetConfig()->Save(); + GetConfig()->set_bool(PP_PSHUTDOWNAFTREFINISHED, false); + GetConfig()->write(NULL); if (bShutdown) { // we're killed @@ -1352,7 +1382,7 @@ AdjustTokenPrivileges(hToken, FALSE, &tp, NULL, NULL, NULL); } - BOOL bExit=ExitWindowsEx(EWX_POWEROFF | EWX_SHUTDOWN | (GetConfig()->GetBoolValue(PP_PFORCESHUTDOWN) ? EWX_FORCE : 0), 0); + BOOL bExit=ExitWindowsEx(EWX_POWEROFF | EWX_SHUTDOWN | (GetConfig()->get_bool(PP_PFORCESHUTDOWN) ? EWX_FORCE : 0), 0); if (bExit) return 1; else @@ -1379,7 +1409,7 @@ Sleep(iSleepCount); uiCounter+=iSleepCount; uiShutCounter+=iSleepCount; - if (uiCounter >= (UINT)GetConfig()->GetIntValue(PP_PMONITORSCANINTERVAL)) + if (uiCounter >= (UINT)GetConfig()->get_signed_num(PP_PMONITORSCANINTERVAL)) uiCounter=0; if (uiShutCounter >= 800) uiShutCounter=0; @@ -1411,7 +1441,7 @@ // load last state TCHAR szPath[_MAX_PATH]; - GetConfig()->GetStringValue(PP_PAUTOSAVEDIRECTORY, szPath, _MAX_PATH); + GetConfig()->get_string(PP_PAUTOSAVEDIRECTORY, szPath, _MAX_PATH); GetApp()->ExpandPath(szPath); m_tasks.LoadDataProgress(szPath); m_tasks.TasksRetryProcessing(); @@ -1425,13 +1455,13 @@ AfxBeginThread(&ClipboardMonitorProc, static_cast(&cmd), THREAD_PRIORITY_IDLE); // start saving timer - SetTimer(1023, GetConfig()->GetIntValue(PP_PAUTOSAVEINTERVAL), NULL); + SetTimer(1023, (UINT)GetConfig()->get_signed_num(PP_PAUTOSAVEINTERVAL), NULL); SetTimer(7834, TM_AUTORESUME/*GetConfig()->GetAutoRetryInterval()*/, NULL); SetTimer(3245, TM_AUTOREMOVE, NULL); SetTimer(8743, TM_ACCEPTING, NULL); // ends wait state in tasks - if (GetConfig()->GetBoolValue(PP_MVAUTOSHOWWHENRUN)) + if (GetConfig()->get_bool(PP_MVAUTOSHOWWHENRUN)) PostMessage(WM_SHOWMINIVIEW); return 0; @@ -1489,8 +1519,8 @@ POINT pt; GetCursorPos(&pt); - pSubMenu->CheckMenuItem(ID_POPUP_MONITORING, MF_BYCOMMAND | (GetConfig()->GetBoolValue(PP_PCLIPBOARDMONITORING) ? MF_CHECKED : MF_UNCHECKED)); - pSubMenu->CheckMenuItem(ID_POPUP_SHUTAFTERFINISHED, MF_BYCOMMAND | (GetConfig()->GetBoolValue(PP_PSHUTDOWNAFTREFINISHED) ? MF_CHECKED : MF_UNCHECKED)); + pSubMenu->CheckMenuItem(ID_POPUP_MONITORING, MF_BYCOMMAND | (GetConfig()->get_bool(PP_PCLIPBOARDMONITORING) ? MF_CHECKED : MF_UNCHECKED)); + pSubMenu->CheckMenuItem(ID_POPUP_SHUTAFTERFINISHED, MF_BYCOMMAND | (GetConfig()->get_bool(PP_PSHUTDOWNAFTREFINISHED) ? MF_CHECKED : MF_UNCHECKED)); // track the menu pSubMenu->TrackPopupMenu(TPM_LEFTBUTTON, pt.x, pt.y, this); @@ -1555,10 +1585,10 @@ // autosave timer KillTimer(1023); TCHAR szPath[_MAX_PATH]; - GetConfig()->GetStringValue(PP_PAUTOSAVEDIRECTORY, szPath, _MAX_PATH); + GetConfig()->get_string(PP_PAUTOSAVEDIRECTORY, szPath, _MAX_PATH); GetApp()->ExpandPath(szPath); m_tasks.SaveProgress(szPath); - SetTimer(1023, GetConfig()->GetIntValue(PP_PAUTOSAVEINTERVAL), NULL); + SetTimer(1023, (UINT)GetConfig()->get_signed_num(PP_PAUTOSAVEINTERVAL), NULL); break; case 7834: { @@ -1568,7 +1598,7 @@ DWORD dwInterval=(m_dwLastTime == 0) ? TM_AUTORESUME : dwTime-m_dwLastTime; m_dwLastTime=dwTime; - if (GetConfig()->GetBoolValue(PP_CMAUTORETRYONERROR)) + if (GetConfig()->get_bool(PP_CMAUTORETRYONERROR)) { if (m_tasks.TasksRetryProcessing(true, dwInterval) && m_pdlgStatus && m_pdlgStatus->m_bLock && IsWindow(m_pdlgStatus->m_hWnd)) m_pdlgStatus->SendMessage(WM_UPDATESTATUS); @@ -1579,7 +1609,7 @@ case 3245: // auto-delete finished tasks timer KillTimer(3245); - if (GetConfig()->GetBoolValue(PP_STATUSAUTOREMOVEFINISHED)) + if (GetConfig()->get_bool(PP_STATUSAUTOREMOVEFINISHED)) { int iSize=m_tasks.GetSize(); m_tasks.RemoveAllFinished(); @@ -1593,13 +1623,13 @@ { // wait state handling section CTask* pTask; - if (GetConfig()->GetIntValue(PP_CMLIMITMAXOPERATIONS) == 0 || m_tasks.GetOperationsPending() < (UINT)GetConfig()->GetIntValue(PP_CMLIMITMAXOPERATIONS)) + if (GetConfig()->get_signed_num(PP_CMLIMITMAXOPERATIONS) == 0 || m_tasks.GetOperationsPending() < (UINT)GetConfig()->get_signed_num(PP_CMLIMITMAXOPERATIONS)) { for (int i=0;iGetStatus(ST_WAITING_MASK) & ST_WAITING && (GetConfig()->GetIntValue(PP_CMLIMITMAXOPERATIONS) == 0 || m_tasks.GetOperationsPending() < (UINT)GetConfig()->GetIntValue(PP_CMLIMITMAXOPERATIONS))) + if (pTask->GetStatus(ST_WAITING_MASK) & ST_WAITING && (GetConfig()->get_signed_num(PP_CMLIMITMAXOPERATIONS) == 0 || m_tasks.GetOperationsPending() < (UINT)GetConfig()->get_signed_num(PP_CMLIMITMAXOPERATIONS))) { TRACE("Enabling task %ld\n", i); pTask->SetContinueFlag(true); @@ -1659,16 +1689,19 @@ } while (iOffset < ulLen); + icpf::config* pConfig = GetConfig(); + assert(pConfig); + // special operation - modify stuff CFiltersArray ffFilters; - int iPriority=GetConfig()->GetIntValue(PP_CMDEFAULTPRIORITY); + int iPriority=(int)GetConfig()->get_signed_num(PP_CMDEFAULTPRIORITY); BUFFERSIZES bsSizes; - bsSizes.m_bOnlyDefault=GetConfig()->GetBoolValue(PP_BFUSEONLYDEFAULT); - bsSizes.m_uiDefaultSize=GetConfig()->GetIntValue(PP_BFDEFAULT); - bsSizes.m_uiOneDiskSize=GetConfig()->GetIntValue(PP_BFONEDISK); - bsSizes.m_uiTwoDisksSize=GetConfig()->GetIntValue(PP_BFTWODISKS); - bsSizes.m_uiCDSize=GetConfig()->GetIntValue(PP_BFCD); - bsSizes.m_uiLANSize=GetConfig()->GetIntValue(PP_BFLAN); + bsSizes.m_bOnlyDefault=GetConfig()->get_bool(PP_BFUSEONLYDEFAULT); + bsSizes.m_uiDefaultSize=(UINT)GetConfig()->get_signed_num(PP_BFDEFAULT); + bsSizes.m_uiOneDiskSize=(UINT)GetConfig()->get_signed_num(PP_BFONEDISK); + bsSizes.m_uiTwoDisksSize=(UINT)GetConfig()->get_signed_num(PP_BFTWODISKS); + bsSizes.m_uiCDSize=(UINT)GetConfig()->get_signed_num(PP_BFCD); + bsSizes.m_uiLANSize=(UINT)GetConfig()->get_signed_num(PP_BFLAN); BOOL bOnlyCreate=FALSE; BOOL bIgnoreDirs=FALSE; @@ -1689,8 +1722,17 @@ dlg.m_ccData.m_bForceDirectories=(bForceDirectories != 0); dlg.m_ccData.m_bCreateStructure=(bOnlyCreate != 0); dlg.m_ccData.m_ucCount=ucCopies; - GetConfig()->GetStringArrayValue(PP_RECENTPATHS, &dlg.m_ccData.m_vRecent); // recent paths + dlg.m_ccData.m_vRecent.clear(true); + const tchar_t* pszPath = NULL; + size_t stCount = pConfig->get_value_count(PP_RECENTPATHS); + for(size_t stIndex = 0; stIndex < stCount; stIndex++) + { + pszPath = pConfig->get_string(PP_RECENTPATHS, stIndex); + if(pszPath) + dlg.m_ccData.m_vRecent.push_back(pszPath); + } + int iModalResult; if ( (iModalResult=dlg.DoModal()) == IDCANCEL) return CWnd::OnCopyData(pWnd, pCopyDataStruct); @@ -1709,7 +1751,11 @@ ucCopies=dlg.m_ccData.m_ucCount; dlg.m_ccData.m_vRecent.insert(dlg.m_ccData.m_vRecent.begin(), (const PTSTR)(LPCTSTR)strDstPath, true); - GetConfig()->SetStringArrayValue(PP_RECENTPATHS, &dlg.m_ccData.m_vRecent); + pConfig->clear_array_values(PP_RECENTPATHS); + for(char_vector::iterator it = dlg.m_ccData.m_vRecent.begin(); it != dlg.m_ccData.m_vRecent.end(); it++) + { + pConfig->set_string(PP_RECENTPATHS, (*it), icpf::property::action_add); + } } // create new task @@ -1739,7 +1785,7 @@ // save state of a task TCHAR szPath[_MAX_PATH]; - GetConfig()->GetStringValue(PP_PAUTOSAVEDIRECTORY, szPath, _MAX_PATH); + GetConfig()->get_string(PP_PAUTOSAVEDIRECTORY, szPath, _MAX_PATH); GetApp()->ExpandPath(szPath); pTask->Store(szPath, true); pTask->Store(szPath, false); @@ -1761,28 +1807,47 @@ void CMainWnd::OnPopupCustomCopy() { + icpf::config* pConfig = GetConfig(); + assert(pConfig); + if(!pConfig) + return; + CCustomCopyDlg dlg; dlg.m_ccData.m_iOperation=0; - dlg.m_ccData.m_iPriority=GetConfig()->GetIntValue(PP_CMDEFAULTPRIORITY); - dlg.m_ccData.m_bsSizes.m_bOnlyDefault=GetConfig()->GetBoolValue(PP_BFUSEONLYDEFAULT); - dlg.m_ccData.m_bsSizes.m_uiDefaultSize=GetConfig()->GetIntValue(PP_BFDEFAULT); - dlg.m_ccData.m_bsSizes.m_uiOneDiskSize=GetConfig()->GetIntValue(PP_BFONEDISK); - dlg.m_ccData.m_bsSizes.m_uiTwoDisksSize=GetConfig()->GetIntValue(PP_BFTWODISKS); - dlg.m_ccData.m_bsSizes.m_uiCDSize=GetConfig()->GetIntValue(PP_BFCD); - dlg.m_ccData.m_bsSizes.m_uiLANSize=GetConfig()->GetIntValue(PP_BFLAN); + dlg.m_ccData.m_iPriority=(int)pConfig->get_signed_num(PP_CMDEFAULTPRIORITY); + dlg.m_ccData.m_bsSizes.m_bOnlyDefault=pConfig->get_bool(PP_BFUSEONLYDEFAULT); + dlg.m_ccData.m_bsSizes.m_uiDefaultSize=(UINT)pConfig->get_signed_num(PP_BFDEFAULT); + dlg.m_ccData.m_bsSizes.m_uiOneDiskSize=(UINT)pConfig->get_signed_num(PP_BFONEDISK); + dlg.m_ccData.m_bsSizes.m_uiTwoDisksSize=(UINT)pConfig->get_signed_num(PP_BFTWODISKS); + dlg.m_ccData.m_bsSizes.m_uiCDSize=(UINT)pConfig->get_signed_num(PP_BFCD); + dlg.m_ccData.m_bsSizes.m_uiLANSize=(UINT)pConfig->get_signed_num(PP_BFLAN); dlg.m_ccData.m_bCreateStructure=false; dlg.m_ccData.m_bForceDirectories=false; dlg.m_ccData.m_bIgnoreFolders=false; dlg.m_ccData.m_ucCount=1; - GetConfig()->GetStringArrayValue(PP_RECENTPATHS, &dlg.m_ccData.m_vRecent); + dlg.m_ccData.m_vRecent.clear(true); + const tchar_t* pszPath = NULL; + size_t stCount = pConfig->get_value_count(PP_RECENTPATHS); + for(size_t stIndex = 0; stIndex < stCount; stIndex++) + { + pszPath = pConfig->get_string(PP_RECENTPATHS, stIndex); + if(pszPath) + dlg.m_ccData.m_vRecent.push_back(pszPath); + } + if (dlg.DoModal() == IDOK) { // save recent paths - dlg.m_ccData.m_vRecent.push_back((const PTSTR)(LPCTSTR)dlg.m_ccData.m_strDestPath, true); - GetConfig()->SetStringArrayValue(PP_RECENTPATHS, &dlg.m_ccData.m_vRecent); + dlg.m_ccData.m_vRecent.push_back((PCTSTR)dlg.m_ccData.m_strDestPath); + pConfig->clear_array_values(PP_RECENTPATHS); + for(char_vector::iterator it = dlg.m_ccData.m_vRecent.begin(); it != dlg.m_ccData.m_vRecent.end(); it++) + { + pConfig->set_string(PP_RECENTPATHS, (*it), icpf::property::action_add); + } + // new task CTask *pTask=new CTask(&m_tasks.m_tcd); pTask->SetDestPath(dlg.m_ccData.m_strDestPath); @@ -1807,7 +1872,7 @@ // save TCHAR szPath[_MAX_PATH]; - GetConfig()->GetStringValue(PP_PAUTOSAVEDIRECTORY, szPath, _MAX_PATH); + GetConfig()->get_string(PP_PAUTOSAVEDIRECTORY, szPath, _MAX_PATH); GetApp()->ExpandPath(szPath); pTask->Store(szPath, true); pTask->Store(szPath, false); @@ -1836,24 +1901,27 @@ case WM_CONFIGNOTIFY: { - GetApp()->SetAutorun(GetConfig()->GetBoolValue(PP_PRELOADAFTERRESTART)); + GetApp()->SetAutorun(GetConfig()->get_bool(PP_PRELOADAFTERRESTART)); // set this process class HANDLE hProcess=GetCurrentProcess(); - ::SetPriorityClass(hProcess, GetConfig()->GetIntValue(PP_PPROCESSPRIORITYCLASS)); + ::SetPriorityClass(hProcess, (DWORD)GetConfig()->get_signed_num(PP_PPROCESSPRIORITYCLASS)); break; } case WM_GETCONFIG: { + icpf::config* pConfig = GetConfig(); + assert(pConfig); + // std config values - g_pscsShared->bShowFreeSpace=GetConfig()->GetBoolValue(PP_SHSHOWFREESPACE); + g_pscsShared->bShowFreeSpace=pConfig->get_bool(PP_SHSHOWFREESPACE); // experimental - doesn't work on all systems - g_pscsShared->bShowShortcutIcons=GetConfig()->GetBoolValue(PP_SHSHOWSHELLICONS); - g_pscsShared->bOverrideDefault=GetConfig()->GetBoolValue(PP_SHUSEDRAGDROP); // only for d&d - g_pscsShared->uiDefaultAction=GetConfig()->GetIntValue(PP_SHDEFAULTACTION); + g_pscsShared->bShowShortcutIcons=pConfig->get_bool(PP_SHSHOWSHELLICONS); + g_pscsShared->bOverrideDefault=pConfig->get_bool(PP_SHUSEDRAGDROP); // only for d&d + g_pscsShared->uiDefaultAction=(UINT)pConfig->get_signed_num(PP_SHDEFAULTACTION); // sizes for (int i=0;i<6;i++) @@ -1869,9 +1937,9 @@ { g_pscsShared->iCommandCount=3; g_pscsShared->iShortcutsCount=0; - g_pscsShared->uiFlags=(GetConfig()->GetBoolValue(PP_SHSHOWCOPY) ? DD_COPY_FLAG : 0) - | (GetConfig()->GetBoolValue(PP_SHSHOWMOVE) ? DD_MOVE_FLAG : 0) - | (GetConfig()->GetBoolValue(PP_SHSHOWCOPYMOVE) ? DD_COPYMOVESPECIAL_FLAG : 0); + g_pscsShared->uiFlags=(pConfig->get_bool(PP_SHSHOWCOPY) ? DD_COPY_FLAG : 0) + | (pConfig->get_bool(PP_SHSHOWMOVE) ? DD_MOVE_FLAG : 0) + | (pConfig->get_bool(PP_SHSHOWCOPYMOVE) ? DD_COPYMOVESPECIAL_FLAG : 0); pCommand[0].uiCommandID=DD_COPY_FLAG; GetResManager()->LoadStringCopy(IDS_MENUCOPY_STRING, pCommand[0].szCommand, 128); @@ -1889,11 +1957,11 @@ case GC_EXPLORER: { g_pscsShared->iCommandCount=5; - g_pscsShared->uiFlags=(GetConfig()->GetBoolValue(PP_SHSHOWPASTE) ? EC_PASTE_FLAG : 0) - | (GetConfig()->GetBoolValue(PP_SHSHOWPASTESPECIAL) ? EC_PASTESPECIAL_FLAG : 0) - | (GetConfig()->GetBoolValue(PP_SHSHOWCOPYTO) ? EC_COPYTO_FLAG : 0) - | (GetConfig()->GetBoolValue(PP_SHSHOWMOVETO) ? EC_MOVETO_FLAG : 0) - | (GetConfig()->GetBoolValue(PP_SHSHOWCOPYMOVETO) ? EC_COPYMOVETOSPECIAL_FLAG : 0); + g_pscsShared->uiFlags=(pConfig->get_bool(PP_SHSHOWPASTE) ? EC_PASTE_FLAG : 0) + | (pConfig->get_bool(PP_SHSHOWPASTESPECIAL) ? EC_PASTESPECIAL_FLAG : 0) + | (pConfig->get_bool(PP_SHSHOWCOPYTO) ? EC_COPYTO_FLAG : 0) + | (pConfig->get_bool(PP_SHSHOWMOVETO) ? EC_MOVETO_FLAG : 0) + | (pConfig->get_bool(PP_SHSHOWCOPYMOVETO) ? EC_COPYMOVETOSPECIAL_FLAG : 0); pCommand[0].uiCommandID=EC_PASTE_FLAG; GetResManager()->LoadStringCopy(IDS_MENUPASTE_STRING, pCommand[0].szCommand, 128); @@ -1913,7 +1981,14 @@ // prepare shortcuts char_vector cvShortcuts; - GetConfig()->GetStringArrayValue(PP_SHORTCUTS, &cvShortcuts); + const tchar_t* pszPath = NULL; + size_t stCount = pConfig->get_value_count(PP_RECENTPATHS); + for(size_t stIndex = 0; stIndex < stCount; stIndex++) + { + pszPath = pConfig->get_string(PP_RECENTPATHS, stIndex); + if(pszPath) + cvShortcuts.push_back(pszPath); + } // count of shortcuts to store g_pscsShared->iShortcutsCount=__min(cvShortcuts.size(), SHARED_BUFFERSIZE-5*sizeof(_COMMAND)); @@ -1997,14 +2072,14 @@ void CMainWnd::OnPopupMonitoring() { // change flag in config - GetConfig()->SetBoolValue(PP_PCLIPBOARDMONITORING, !GetConfig()->GetBoolValue(PP_PCLIPBOARDMONITORING)); - GetConfig()->Save(); + GetConfig()->set_bool(PP_PCLIPBOARDMONITORING, !GetConfig()->get_bool(PP_PCLIPBOARDMONITORING)); + GetConfig()->write(NULL); } void CMainWnd::OnPopupShutafterfinished() { - GetConfig()->SetBoolValue(PP_PSHUTDOWNAFTREFINISHED, !GetConfig()->GetBoolValue(PP_PSHUTDOWNAFTREFINISHED)); - GetConfig()->Save(); + GetConfig()->set_bool(PP_PSHUTDOWNAFTREFINISHED, !GetConfig()->get_bool(PP_PSHUTDOWNAFTREFINISHED)); + GetConfig()->write(NULL); } void CMainWnd::OnPopupRegisterdll() @@ -2060,7 +2135,7 @@ // save TCHAR szPath[_MAX_PATH]; - GetConfig()->GetStringValue(PP_PAUTOSAVEDIRECTORY, szPath, _MAX_PATH); + GetConfig()->get_string(PP_PAUTOSAVEDIRECTORY, szPath, _MAX_PATH); GetApp()->ExpandPath(szPath); m_tasks.SaveProgress(szPath); Index: src/ch/MiniViewDlg.cpp =================================================================== diff -u -r4c272b19c74694c428c943011f279ec064fbd894 -rcdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e --- src/ch/MiniViewDlg.cpp (.../MiniViewDlg.cpp) (revision 4c272b19c74694c428c943011f279ec064fbd894) +++ src/ch/MiniViewDlg.cpp (.../MiniViewDlg.cpp) (revision cdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e) @@ -132,7 +132,7 @@ RefreshStatus(); - SetTimer(9843, GetConfig()->GetIntValue(PP_MVREFRESHINTERVAL), NULL); + SetTimer(9843, GetConfig()->get_signed_num(PP_MVREFRESHINTERVAL), NULL); } CHLanguageDialog::OnTimer(nIDEvent); @@ -180,7 +180,7 @@ int index=0; _PROGRESSITEM_* pItem=NULL; - if (GetConfig()->GetBoolValue(PP_MVSHOWSINGLETASKS)) + if (GetConfig()->get_bool(PP_MVSHOWSINGLETASKS)) { for (int i=0;iGetSize();i++) { @@ -214,10 +214,10 @@ { if (m_bShown) { - if (GetConfig()->GetBoolValue(PP_MVAUTOHIDEWHENEMPTY) || *m_pbHide) + if (GetConfig()->get_bool(PP_MVAUTOHIDEWHENEMPTY) || *m_pbHide) HideWindow(); } - else if (!GetConfig()->GetBoolValue(PP_MVAUTOHIDEWHENEMPTY) && !(*m_pbHide)) + else if (!GetConfig()->get_bool(PP_MVAUTOHIDEWHENEMPTY) && !(*m_pbHide)) { // need to be visible ShowWindow(); @@ -249,10 +249,10 @@ pItem->m_pTask=NULL; // get rid of the rest - m_ctlStatus.SetSmoothProgress(GetConfig()->GetBoolValue(PP_MVUSESMOOTHPROGRESS)); + m_ctlStatus.SetSmoothProgress(GetConfig()->get_bool(PP_MVUSESMOOTHPROGRESS)); m_ctlStatus.UpdateItems(index, true); - m_ctlStatus.SetShowCaptions(GetConfig()->GetBoolValue(PP_MVSHOWFILENAMES)); + m_ctlStatus.SetShowCaptions(GetConfig()->get_bool(PP_MVSHOWFILENAMES)); // calc size RecalcSize(0, bInitial); @@ -269,7 +269,7 @@ RefreshStatus(); // set refresh timer - SetTimer(9843, GetConfig()->GetIntValue(PP_MVREFRESHINTERVAL), NULL); + SetTimer(9843, GetConfig()->get_signed_num(PP_MVREFRESHINTERVAL), NULL); return static_cast(0); } Index: src/ch/OptionsDlg.cpp =================================================================== diff -u -r4c272b19c74694c428c943011f279ec064fbd894 -rcdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e --- src/ch/OptionsDlg.cpp (.../OptionsDlg.cpp) (revision 4c272b19c74694c428c943011f279ec064fbd894) +++ src/ch/OptionsDlg.cpp (.../OptionsDlg.cpp) (revision cdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e) @@ -25,6 +25,7 @@ #include "BufferSizeDlg.h" #include "ShortcutsDlg.h" #include "RecentDlg.h" +#include #ifdef _DEBUG #define new DEBUG_NEW @@ -70,10 +71,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((value), m_szBuffer, 10), 0); + m_ctlProperties.AddString(text, ID_PROPERTY_TEXT, _itot(PtrToInt((value)), m_szBuffer, 10), 0); #define PROP_COMBO(text, prop_text, value)\ - m_ctlProperties.AddString(text, ID_PROPERTY_COMBO_LIST, prop_text, (value)); + m_ctlProperties.AddString(text, ID_PROPERTY_COMBO_LIST, prop_text, PtrToInt((value))); #define PROP_DIR(text, prop_text, value)\ m_ctlProperties.AddString(text, ID_PROPERTY_DIR, (value)+CString(GetResManager()->LoadString(prop_text)), 0); @@ -82,7 +83,7 @@ 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(value, m_szBuffer, 10)), callback, this, param, 0); + m_ctlProperties.AddString(text, ID_PROPERTY_CUSTOM, CString(_itot(PtrToInt(value), m_szBuffer, 10)), callback, this, param, 0); #define SKIP_SEPARATOR(pos)\ pos++; @@ -94,10 +95,29 @@ m_ctlProperties.Init(); // copy shortcut and recent paths - GetConfig()->GetStringArrayValue(PP_RECENTPATHS, &m_cvRecent); - GetConfig()->GetStringArrayValue(PP_SHORTCUTS, &m_cvShortcuts); + icpf::config* pConfig = GetConfig(); + assert(pConfig); - GetConfig()->GetStringValue(PP_PLANGDIR, m_szLangPath, _MAX_PATH); + m_cvRecent.clear(true); + size_t stSize = pConfig->get_value_count(PP_RECENTPATHS); + const tchar_t* pszPath = NULL; + for(size_t stIndex = 0; stIndex < stSize; stIndex++) + { + pszPath = pConfig->get_string(PP_RECENTPATHS, stIndex); + if(pszPath) + m_cvRecent.push_back(pszPath); + } + + m_cvShortcuts.clear(true); + stSize = pConfig->get_value_count(PP_SHORTCUTS); + for(size_t stIndex = 0; stIndex < stSize; stIndex++) + { + pszPath = pConfig->get_string(PP_SHORTCUTS, stIndex); + if(pszPath) + m_cvShortcuts.push_back(pszPath); + } + + GetConfig()->get_string(PP_PLANGDIR, m_szLangPath, _MAX_PATH); GetApp()->ExpandPath(m_szLangPath); GetResManager()->Scan(m_szLangPath, &m_vld); @@ -207,25 +227,25 @@ // load settings PROP_SEPARATOR(IDS_PROGRAM_STRING) - PROP_BOOL(IDS_CLIPBOARDMONITORING_STRING, GetConfig()->GetBoolValue(PP_PCLIPBOARDMONITORING)) - PROP_UINT(IDS_CLIPBOARDINTERVAL_STRING, GetConfig()->GetIntValue(PP_PMONITORSCANINTERVAL)) - PROP_BOOL(IDS_AUTORUNPROGRAM_STRING, GetConfig()->GetBoolValue(PP_PRELOADAFTERRESTART)) - PROP_BOOL(IDS_AUTOSHUTDOWN_STRING, GetConfig()->GetBoolValue(PP_PSHUTDOWNAFTREFINISHED)) - PROP_UINT(IDS_SHUTDOWNTIME_STRING, GetConfig()->GetIntValue(PP_PTIMEBEFORESHUTDOWN)) - PROP_COMBO(IDS_FORCESHUTDOWN_STRING, IDS_FORCESHUTDOWNVALUES_STRING, GetConfig()->GetBoolValue(PP_PFORCESHUTDOWN)) - PROP_UINT(IDS_AUTOSAVEINTERVAL_STRING, GetConfig()->GetIntValue(PP_PAUTOSAVEINTERVAL)) - PROP_COMBO(IDS_CFGPRIORITYCLASS_STRING, IDS_CFGPRIORITYCLASSITEMS_STRING, PriorityClassToIndex(GetConfig()->GetIntValue(PP_PPROCESSPRIORITYCLASS))) + PROP_BOOL(IDS_CLIPBOARDMONITORING_STRING, GetConfig()->get_bool(PP_PCLIPBOARDMONITORING)) + PROP_UINT(IDS_CLIPBOARDINTERVAL_STRING, GetConfig()->get_signed_num(PP_PMONITORSCANINTERVAL)) + PROP_BOOL(IDS_AUTORUNPROGRAM_STRING, GetConfig()->get_bool(PP_PRELOADAFTERRESTART)) + PROP_BOOL(IDS_AUTOSHUTDOWN_STRING, GetConfig()->get_bool(PP_PSHUTDOWNAFTREFINISHED)) + PROP_UINT(IDS_SHUTDOWNTIME_STRING, GetConfig()->get_signed_num(PP_PTIMEBEFORESHUTDOWN)) + PROP_COMBO(IDS_FORCESHUTDOWN_STRING, IDS_FORCESHUTDOWNVALUES_STRING, GetConfig()->get_bool(PP_PFORCESHUTDOWN)) + PROP_UINT(IDS_AUTOSAVEINTERVAL_STRING, GetConfig()->get_signed_num(PP_PAUTOSAVEINTERVAL)) + PROP_COMBO(IDS_CFGPRIORITYCLASS_STRING, IDS_CFGPRIORITYCLASSITEMS_STRING, PriorityClassToIndex(GetConfig()->get_signed_num(PP_PPROCESSPRIORITYCLASS))) - GetConfig()->GetStringValue(PP_PAUTOSAVEDIRECTORY, strPath.GetBuffer(_MAX_PATH), _MAX_PATH); + GetConfig()->get_string(PP_PAUTOSAVEDIRECTORY, strPath.GetBuffer(_MAX_PATH), _MAX_PATH); strPath.ReleaseBuffer(); - TRACE("Autosavedir=%s\n", strPath); + TRACE(_t("Autosavedir=%s\n"), strPath); PROP_DIR(IDS_TEMPFOLDER_STRING, IDS_TEMPFOLDERCHOOSE_STRING, strPath) - GetConfig()->GetStringValue(PP_PPLUGINSDIR, strPath.GetBuffer(_MAX_PATH), _MAX_PATH); + GetConfig()->get_string(PP_PPLUGINSDIR, strPath.GetBuffer(_MAX_PATH), _MAX_PATH); strPath.ReleaseBuffer(); PROP_DIR(IDS_PLUGSFOLDER_STRING, IDS_PLUGSFOLDERCHOOSE_STRING, strPath) - GetConfig()->GetStringValue(PP_PHELPDIR, strPath.GetBuffer(_MAX_PATH), _MAX_PATH); + GetConfig()->get_string(PP_PHELPDIR, strPath.GetBuffer(_MAX_PATH), _MAX_PATH); strPath.ReleaseBuffer(); PROP_DIR(IDS_CFGHELPDIR_STRING, IDS_CFGHELPDIRCHOOSE_STRING, strPath) @@ -243,81 +263,81 @@ PROP_COMBO(IDS_LANGUAGE_STRING, strLangs, uiIndex) - GetConfig()->GetStringValue(PP_PLANGDIR, strPath.GetBuffer(_MAX_PATH), _MAX_PATH); + 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()->GetIntValue(PP_STATUSREFRESHINTERVAL)) - PROP_BOOL(IDS_STATUSSHOWDETAILS_STRING, GetConfig()->GetBoolValue(PP_STATUSSHOWDETAILS)) - PROP_BOOL(IDS_STATUSAUTOREMOVE_STRING, GetConfig()->GetBoolValue(PP_STATUSAUTOREMOVEFINISHED)) + PROP_UINT(IDS_REFRESHSTATUSINTERVAL_STRING, GetConfig()->get_signed_num(PP_STATUSREFRESHINTERVAL)) + PROP_BOOL(IDS_STATUSSHOWDETAILS_STRING, GetConfig()->get_bool(PP_STATUSSHOWDETAILS)) + PROP_BOOL(IDS_STATUSAUTOREMOVE_STRING, GetConfig()->get_bool(PP_STATUSAUTOREMOVEFINISHED)) PROP_SEPARATOR(IDS_MINIVIEW_STRING) - PROP_BOOL(IDS_SHOWFILENAMES_STRING, GetConfig()->GetBoolValue(PP_MVSHOWFILENAMES)) - PROP_BOOL(IDS_SHOWSINGLETASKS_STRING, GetConfig()->GetBoolValue(PP_MVSHOWSINGLETASKS)) - PROP_UINT(IDS_MINIVIEWREFRESHINTERVAL_STRING, GetConfig()->GetIntValue(PP_MVREFRESHINTERVAL)) - PROP_BOOL(IDS_MINIVIEWSHOWAFTERSTART_STRING, GetConfig()->GetBoolValue(PP_MVAUTOSHOWWHENRUN)) - PROP_BOOL(IDS_MINIVIEWAUTOHIDE_STRING, GetConfig()->GetBoolValue(PP_MVAUTOHIDEWHENEMPTY)) - PROP_BOOL(IDS_MINIVIEWSMOOTHPROGRESS_STRING, GetConfig()->GetBoolValue(PP_MVUSESMOOTHPROGRESS)) + PROP_BOOL(IDS_SHOWFILENAMES_STRING, GetConfig()->get_bool(PP_MVSHOWFILENAMES)) + PROP_BOOL(IDS_SHOWSINGLETASKS_STRING, GetConfig()->get_bool(PP_MVSHOWSINGLETASKS)) + PROP_UINT(IDS_MINIVIEWREFRESHINTERVAL_STRING, GetConfig()->get_signed_num(PP_MVREFRESHINTERVAL)) + PROP_BOOL(IDS_MINIVIEWSHOWAFTERSTART_STRING, GetConfig()->get_bool(PP_MVAUTOSHOWWHENRUN)) + PROP_BOOL(IDS_MINIVIEWAUTOHIDE_STRING, GetConfig()->get_bool(PP_MVAUTOHIDEWHENEMPTY)) + PROP_BOOL(IDS_MINIVIEWSMOOTHPROGRESS_STRING, GetConfig()->get_bool(PP_MVUSESMOOTHPROGRESS)) PROP_SEPARATOR(IDS_CFGFOLDERDIALOG_STRING) - PROP_BOOL(IDS_CFGFDEXTVIEW_STRING, GetConfig()->GetBoolValue(PP_FDEXTENDEDVIEW)) - PROP_UINT(IDS_CFGFDWIDTH_STRING, GetConfig()->GetIntValue(PP_FDWIDTH)) - PROP_UINT(IDS_CFGFDHEIGHT_STRING, GetConfig()->GetIntValue(PP_FDHEIGHT)) - PROP_COMBO(IDS_CFGFDSHORTCUTS_STRING, IDS_CFGFDSHORTCUTSSTYLES_STRING, GetConfig()->GetIntValue(PP_FDSHORTCUTLISTSTYLE)) - PROP_BOOL(IDS_CFGFDIGNOREDIALOGS_STRING, GetConfig()->GetBoolValue(PP_FDIGNORESHELLDIALOGS)) + PROP_BOOL(IDS_CFGFDEXTVIEW_STRING, GetConfig()->get_bool(PP_FDEXTENDEDVIEW)) + PROP_UINT(IDS_CFGFDWIDTH_STRING, GetConfig()->get_signed_num(PP_FDWIDTH)) + PROP_UINT(IDS_CFGFDHEIGHT_STRING, GetConfig()->get_signed_num(PP_FDHEIGHT)) + PROP_COMBO(IDS_CFGFDSHORTCUTS_STRING, IDS_CFGFDSHORTCUTSSTYLES_STRING, GetConfig()->get_signed_num(PP_FDSHORTCUTLISTSTYLE)) + PROP_BOOL(IDS_CFGFDIGNOREDIALOGS_STRING, GetConfig()->get_bool(PP_FDIGNORESHELLDIALOGS)) PROP_SEPARATOR(IDS_CFGSHELL_STRING) - PROP_BOOL(IDS_CFGSHCOPY_STRING, GetConfig()->GetBoolValue(PP_SHSHOWCOPY)) - PROP_BOOL(IDS_CFGSHMOVE_STRING, GetConfig()->GetBoolValue(PP_SHSHOWMOVE)) - PROP_BOOL(IDS_CFGSHCMSPECIAL_STRING, GetConfig()->GetBoolValue(PP_SHSHOWCOPYMOVE)) - PROP_BOOL(IDS_CFGSHPASTE_STRING, GetConfig()->GetBoolValue(PP_SHSHOWPASTE)) - PROP_BOOL(IDS_CFGSHPASTESPECIAL_STRING, GetConfig()->GetBoolValue(PP_SHSHOWPASTESPECIAL)) - PROP_BOOL(IDS_CFGSHCOPYTO_STRING, GetConfig()->GetBoolValue(PP_SHSHOWCOPYTO)) - PROP_BOOL(IDS_CFGSHMOVETO_STRING, GetConfig()->GetBoolValue(PP_SHSHOWMOVETO)) - PROP_BOOL(IDS_CFGSHCMTOSPECIAL_STRING, GetConfig()->GetBoolValue(PP_SHSHOWCOPYMOVETO)) - PROP_BOOL(IDS_CFGSHSHOWFREESPACE_STRING, GetConfig()->GetBoolValue(PP_SHSHOWFREESPACE)) - PROP_BOOL(IDS_CFGSHSHOWICONS_STRING, GetConfig()->GetBoolValue(PP_SHSHOWSHELLICONS)) - PROP_BOOL(IDS_CFGSHOVERRIDEDRAG_STRING, GetConfig()->GetBoolValue(PP_SHUSEDRAGDROP)) - PROP_COMBO(IDS_CFGOVERRIDEDEFACTION_STRING, IDS_CFGACTIONS_STRING, GetConfig()->GetIntValue(PP_SHDEFAULTACTION)); + PROP_BOOL(IDS_CFGSHCOPY_STRING, GetConfig()->get_bool(PP_SHSHOWCOPY)) + PROP_BOOL(IDS_CFGSHMOVE_STRING, GetConfig()->get_bool(PP_SHSHOWMOVE)) + PROP_BOOL(IDS_CFGSHCMSPECIAL_STRING, GetConfig()->get_bool(PP_SHSHOWCOPYMOVE)) + PROP_BOOL(IDS_CFGSHPASTE_STRING, GetConfig()->get_bool(PP_SHSHOWPASTE)) + PROP_BOOL(IDS_CFGSHPASTESPECIAL_STRING, GetConfig()->get_bool(PP_SHSHOWPASTESPECIAL)) + PROP_BOOL(IDS_CFGSHCOPYTO_STRING, GetConfig()->get_bool(PP_SHSHOWCOPYTO)) + PROP_BOOL(IDS_CFGSHMOVETO_STRING, GetConfig()->get_bool(PP_SHSHOWMOVETO)) + PROP_BOOL(IDS_CFGSHCMTOSPECIAL_STRING, GetConfig()->get_bool(PP_SHSHOWCOPYMOVETO)) + PROP_BOOL(IDS_CFGSHSHOWFREESPACE_STRING, GetConfig()->get_bool(PP_SHSHOWFREESPACE)) + PROP_BOOL(IDS_CFGSHSHOWICONS_STRING, GetConfig()->get_bool(PP_SHSHOWSHELLICONS)) + PROP_BOOL(IDS_CFGSHOVERRIDEDRAG_STRING, GetConfig()->get_bool(PP_SHUSEDRAGDROP)) + PROP_COMBO(IDS_CFGOVERRIDEDEFACTION_STRING, IDS_CFGACTIONS_STRING, GetConfig()->get_signed_num(PP_SHDEFAULTACTION)); PROP_SEPARATOR(IDS_PROCESSINGTHREAD_STRING) - PROP_BOOL(IDS_AUTOCOPYREST_STRING, GetConfig()->GetBoolValue(PP_CMUSEAUTOCOMPLETEFILES)) - PROP_BOOL(IDS_SETDESTATTRIB_STRING, GetConfig()->GetBoolValue(PP_CMSETDESTATTRIBUTES)) - PROP_BOOL(IDS_SETDESTTIME_STRING, GetConfig()->GetBoolValue(PP_CMSETDESTDATE)) - PROP_BOOL(IDS_PROTECTROFILES_STRING, GetConfig()->GetBoolValue(PP_CMPROTECTROFILES)) - PROP_UINT(IDS_LIMITOPERATIONS_STRING, GetConfig()->GetIntValue(PP_CMLIMITMAXOPERATIONS)) - PROP_BOOL(IDS_READSIZEBEFOREBLOCK_STRING, GetConfig()->GetBoolValue(PP_CMREADSIZEBEFOREBLOCKING)) - PROP_COMBO(IDS_SHOWVISUALFEEDBACK_STRING, IDS_FEEDBACKTYPE_STRING, GetConfig()->GetIntValue(PP_CMSHOWVISUALFEEDBACK)) - PROP_BOOL(IDS_USETIMEDDIALOGS_STRING, GetConfig()->GetBoolValue(PP_CMUSETIMEDFEEDBACK)) - PROP_UINT(IDS_TIMEDDIALOGINTERVAL_STRING, GetConfig()->GetIntValue(PP_CMFEEDBACKTIME)) - PROP_BOOL(IDS_AUTORETRYONERROR_STRING, GetConfig()->GetBoolValue(PP_CMAUTORETRYONERROR)) - PROP_UINT(IDS_AUTORETRYINTERVAL_STRING, GetConfig()->GetIntValue(PP_CMAUTORETRYINTERVAL)) - PROP_COMBO(IDS_DEFAULTPRIORITY_STRING, MakeCompoundString(IDS_PRIORITY0_STRING, 7, _T("!")), PriorityToIndex(GetConfig()->GetIntValue(PP_CMDEFAULTPRIORITY))) - PROP_BOOL(IDS_CFGDISABLEPRIORITYBOOST_STRING, GetConfig()->GetBoolValue(PP_CMDISABLEPRIORITYBOOST)) - PROP_BOOL(IDS_DELETEAFTERFINISHED_STRING, GetConfig()->GetBoolValue(PP_CMDELETEAFTERFINISHED)) - PROP_BOOL(IDS_CREATELOGFILES_STRING, GetConfig()->GetBoolValue(PP_CMCREATELOG)) + PROP_BOOL(IDS_AUTOCOPYREST_STRING, GetConfig()->get_bool(PP_CMUSEAUTOCOMPLETEFILES)) + PROP_BOOL(IDS_SETDESTATTRIB_STRING, GetConfig()->get_bool(PP_CMSETDESTATTRIBUTES)) + PROP_BOOL(IDS_SETDESTTIME_STRING, GetConfig()->get_bool(PP_CMSETDESTDATE)) + PROP_BOOL(IDS_PROTECTROFILES_STRING, GetConfig()->get_bool(PP_CMPROTECTROFILES)) + PROP_UINT(IDS_LIMITOPERATIONS_STRING, GetConfig()->get_signed_num(PP_CMLIMITMAXOPERATIONS)) + PROP_BOOL(IDS_READSIZEBEFOREBLOCK_STRING, GetConfig()->get_bool(PP_CMREADSIZEBEFOREBLOCKING)) + PROP_COMBO(IDS_SHOWVISUALFEEDBACK_STRING, IDS_FEEDBACKTYPE_STRING, GetConfig()->get_signed_num(PP_CMSHOWVISUALFEEDBACK)) + PROP_BOOL(IDS_USETIMEDDIALOGS_STRING, GetConfig()->get_bool(PP_CMUSETIMEDFEEDBACK)) + PROP_UINT(IDS_TIMEDDIALOGINTERVAL_STRING, GetConfig()->get_signed_num(PP_CMFEEDBACKTIME)) + PROP_BOOL(IDS_AUTORETRYONERROR_STRING, GetConfig()->get_bool(PP_CMAUTORETRYONERROR)) + PROP_UINT(IDS_AUTORETRYINTERVAL_STRING, GetConfig()->get_signed_num(PP_CMAUTORETRYINTERVAL)) + PROP_COMBO(IDS_DEFAULTPRIORITY_STRING, MakeCompoundString(IDS_PRIORITY0_STRING, 7, _T("!")), PriorityToIndex(GetConfig()->get_signed_num(PP_CMDEFAULTPRIORITY))) + PROP_BOOL(IDS_CFGDISABLEPRIORITYBOOST_STRING, GetConfig()->get_bool(PP_CMDISABLEPRIORITYBOOST)) + PROP_BOOL(IDS_DELETEAFTERFINISHED_STRING, GetConfig()->get_bool(PP_CMDELETEAFTERFINISHED)) + PROP_BOOL(IDS_CREATELOGFILES_STRING, GetConfig()->get_bool(PP_CMCREATELOG)) // Buffer PROP_SEPARATOR(IDS_OPTIONSBUFFER_STRING) - PROP_BOOL(IDS_AUTODETECTBUFFERSIZE_STRING, GetConfig()->GetBoolValue(PP_BFUSEONLYDEFAULT)) - PROP_CUSTOM_UINT(IDS_DEFAULTBUFFERSIZE_STRING, GetConfig()->GetIntValue(PP_BFDEFAULT), &CustomPropertyCallbackProc, 0) - PROP_CUSTOM_UINT(IDS_ONEDISKBUFFERSIZE_STRING, GetConfig()->GetIntValue(PP_BFONEDISK), &CustomPropertyCallbackProc, 1) - PROP_CUSTOM_UINT(IDS_TWODISKSBUFFERSIZE_STRING, GetConfig()->GetIntValue(PP_BFTWODISKS), &CustomPropertyCallbackProc, 2) - PROP_CUSTOM_UINT(IDS_CDBUFFERSIZE_STRING, GetConfig()->GetIntValue(PP_BFCD), &CustomPropertyCallbackProc, 3) - PROP_CUSTOM_UINT(IDS_LANBUFFERSIZE_STRING, GetConfig()->GetIntValue(PP_BFLAN), &CustomPropertyCallbackProc, 4) - PROP_BOOL(IDS_USENOBUFFERING_STRING, GetConfig()->GetBoolValue(PP_BFUSENOBUFFERING)) - PROP_UINT(IDS_LARGEFILESMINSIZE_STRING, GetConfig()->GetIntValue(PP_BFBOUNDARYLIMIT)) + PROP_BOOL(IDS_AUTODETECTBUFFERSIZE_STRING, GetConfig()->get_bool(PP_BFUSEONLYDEFAULT)) + PROP_CUSTOM_UINT(IDS_DEFAULTBUFFERSIZE_STRING, GetConfig()->get_signed_num(PP_BFDEFAULT), &CustomPropertyCallbackProc, 0) + PROP_CUSTOM_UINT(IDS_ONEDISKBUFFERSIZE_STRING, GetConfig()->get_signed_num(PP_BFONEDISK), &CustomPropertyCallbackProc, 1) + PROP_CUSTOM_UINT(IDS_TWODISKSBUFFERSIZE_STRING, GetConfig()->get_signed_num(PP_BFTWODISKS), &CustomPropertyCallbackProc, 2) + PROP_CUSTOM_UINT(IDS_CDBUFFERSIZE_STRING, GetConfig()->get_signed_num(PP_BFCD), &CustomPropertyCallbackProc, 3) + PROP_CUSTOM_UINT(IDS_LANBUFFERSIZE_STRING, GetConfig()->get_signed_num(PP_BFLAN), &CustomPropertyCallbackProc, 4) + PROP_BOOL(IDS_USENOBUFFERING_STRING, GetConfig()->get_bool(PP_BFUSENOBUFFERING)) + PROP_UINT(IDS_LARGEFILESMINSIZE_STRING, GetConfig()->get_signed_num(PP_BFBOUNDARYLIMIT)) // Sounds PROP_SEPARATOR(IDS_SOUNDS_STRING) - PROP_BOOL(IDS_PLAYSOUNDS_STRING, GetConfig()->GetBoolValue(PP_SNDPLAYSOUNDS)) - GetConfig()->GetStringValue(PP_SNDERRORSOUNDPATH, strPath.GetBuffer(_MAX_PATH), _MAX_PATH); + PROP_BOOL(IDS_PLAYSOUNDS_STRING, GetConfig()->get_bool(PP_SNDPLAYSOUNDS)) + GetConfig()->get_string(PP_SNDERRORSOUNDPATH, strPath.GetBuffer(_MAX_PATH), _MAX_PATH); strPath.ReleaseBuffer(); PROP_PATH(IDS_SOUNDONERROR_STRING, IDS_SOUNDSWAVFILTER_STRING, strPath) - GetConfig()->GetStringValue(PP_SNDFINISHEDSOUNDPATH, strPath.GetBuffer(_MAX_PATH), _MAX_PATH); + GetConfig()->get_string(PP_SNDFINISHEDSOUNDPATH, strPath.GetBuffer(_MAX_PATH), _MAX_PATH); strPath.ReleaseBuffer(); PROP_PATH(IDS_SOUNDONFINISH_STRING, IDS_SOUNDSWAVFILTER_STRING, strPath) @@ -328,127 +348,140 @@ PROP_CUSTOM_UINT(IDS_CFGRPCOUNT_STRING, m_cvRecent.size(), &RecentPropertyCallbackProc, 0) /* PROP_SEPARATOR(IDS_CFGLOGFILE_STRING) - PROP_BOOL(IDS_CFGENABLELOGGING_STRING, GetConfig()->GetBoolValue(PP_LOGENABLELOGGING)) - PROP_BOOL(IDS_CFGLIMITATION_STRING, GetConfig()->GetBoolValue(PP_LOGLIMITATION)) - PROP_UINT(IDS_CFGMAXLIMIT_STRING, GetConfig()->GetIntValue(PP_LOGMAXLIMIT)) - PROP_BOOL(IDS_CFGLOGPRECISELIMITING_STRING, GetConfig()->GetBoolValue(PP_LOGPRECISELIMITING)) - PROP_UINT(IDS_CFGTRUNCBUFFERSIZE_STRING, GetConfig()->GetIntValue(PP_LOGTRUNCBUFFERSIZE))*/ + PROP_BOOL(IDS_CFGENABLELOGGING_STRING, GetConfig()->get_bool(PP_LOGENABLELOGGING)) + PROP_BOOL(IDS_CFGLIMITATION_STRING, GetConfig()->get_bool(PP_LOGLIMITATION)) + PROP_UINT(IDS_CFGMAXLIMIT_STRING, GetConfig()->get_signed_num(PP_LOGMAXLIMIT)) + PROP_BOOL(IDS_CFGLOGPRECISELIMITING_STRING, GetConfig()->get_bool(PP_LOGPRECISELIMITING)) + PROP_UINT(IDS_CFGTRUNCBUFFERSIZE_STRING, GetConfig()->get_signed_num(PP_LOGTRUNCBUFFERSIZE))*/ } void COptionsDlg::ApplyProperties() { // counter int iPosition=0; + icpf::config* pConfig = GetConfig(); + assert(pConfig); + if(!pConfig) + return; + SKIP_SEPARATOR(iPosition) - GetConfig()->SetBoolValue(PP_PCLIPBOARDMONITORING, GetBoolProp(iPosition++)); - GetConfig()->SetIntValue(PP_PMONITORSCANINTERVAL, GetUintProp(iPosition++)); - GetConfig()->SetBoolValue(PP_PRELOADAFTERRESTART, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_PSHUTDOWNAFTREFINISHED, GetBoolProp(iPosition++)); - GetConfig()->SetIntValue(PP_PTIMEBEFORESHUTDOWN, GetUintProp(iPosition++)); - GetConfig()->SetBoolValue(PP_PFORCESHUTDOWN, GetBoolProp(iPosition++)); - GetConfig()->SetIntValue(PP_PAUTOSAVEINTERVAL, GetUintProp(iPosition++)); - GetConfig()->SetIntValue(PP_PPROCESSPRIORITYCLASS, IndexToPriorityClass(GetIndexProp(iPosition++))); - GetConfig()->SetStringValue(PP_PAUTOSAVEDIRECTORY, GetStringProp(iPosition++)); - GetConfig()->SetStringValue(PP_PPLUGINSDIR, GetStringProp(iPosition++)); - GetConfig()->SetStringValue(PP_PHELPDIR, GetStringProp(iPosition++)); + pConfig->set_bool(PP_PCLIPBOARDMONITORING, GetBoolProp(iPosition++)); + pConfig->set_signed_num(PP_PMONITORSCANINTERVAL, GetUintProp(iPosition++)); + pConfig->set_bool(PP_PRELOADAFTERRESTART, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_PSHUTDOWNAFTREFINISHED, GetBoolProp(iPosition++)); + pConfig->set_signed_num(PP_PTIMEBEFORESHUTDOWN, GetUintProp(iPosition++)); + pConfig->set_bool(PP_PFORCESHUTDOWN, GetBoolProp(iPosition++)); + 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) { // replace the first part of path with TCHAR szData[_MAX_PATH]; _sntprintf(szData, _MAX_PATH, _T("%s"), pszSrc+_tcslen(GetApp()->GetProgramPath())); - GetConfig()->SetStringValue(PP_PLANGUAGE, szData); + pConfig->set_string(PP_PLANGUAGE, szData); } else - GetConfig()->SetStringValue(PP_PLANGUAGE, pszSrc); - GetConfig()->SetStringValue(PP_PLANGDIR, GetStringProp(iPosition++)); + pConfig->set_string(PP_PLANGUAGE, pszSrc); + pConfig->set_string(PP_PLANGDIR, GetStringProp(iPosition++)); SKIP_SEPARATOR(iPosition) - GetConfig()->SetIntValue(PP_STATUSREFRESHINTERVAL, GetUintProp(iPosition++)); - GetConfig()->SetBoolValue(PP_STATUSSHOWDETAILS, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_STATUSAUTOREMOVEFINISHED, GetBoolProp(iPosition++)); + pConfig->set_signed_num(PP_STATUSREFRESHINTERVAL, GetUintProp(iPosition++)); + pConfig->set_bool(PP_STATUSSHOWDETAILS, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_STATUSAUTOREMOVEFINISHED, GetBoolProp(iPosition++)); SKIP_SEPARATOR(iPosition) - GetConfig()->SetBoolValue(PP_MVSHOWFILENAMES, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_MVSHOWSINGLETASKS, GetBoolProp(iPosition++)); - GetConfig()->SetIntValue(PP_MVREFRESHINTERVAL, GetUintProp(iPosition++)); - GetConfig()->SetBoolValue(PP_MVAUTOSHOWWHENRUN, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_MVAUTOHIDEWHENEMPTY, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_MVUSESMOOTHPROGRESS, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_MVSHOWFILENAMES, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_MVSHOWSINGLETASKS, GetBoolProp(iPosition++)); + pConfig->set_signed_num(PP_MVREFRESHINTERVAL, GetUintProp(iPosition++)); + pConfig->set_bool(PP_MVAUTOSHOWWHENRUN, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_MVAUTOHIDEWHENEMPTY, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_MVUSESMOOTHPROGRESS, GetBoolProp(iPosition++)); SKIP_SEPARATOR(iPosition) - GetConfig()->SetBoolValue(PP_FDEXTENDEDVIEW, GetBoolProp(iPosition++)); - GetConfig()->SetIntValue(PP_FDWIDTH, GetUintProp(iPosition++)); - GetConfig()->SetIntValue(PP_FDHEIGHT, GetUintProp(iPosition++)); - GetConfig()->SetIntValue(PP_FDSHORTCUTLISTSTYLE, GetIndexProp(iPosition++)); - GetConfig()->SetBoolValue(PP_FDIGNORESHELLDIALOGS, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_FDEXTENDEDVIEW, GetBoolProp(iPosition++)); + pConfig->set_signed_num(PP_FDWIDTH, GetUintProp(iPosition++)); + pConfig->set_signed_num(PP_FDHEIGHT, GetUintProp(iPosition++)); + pConfig->set_signed_num(PP_FDSHORTCUTLISTSTYLE, GetIndexProp(iPosition++)); + pConfig->set_bool(PP_FDIGNORESHELLDIALOGS, GetBoolProp(iPosition++)); SKIP_SEPARATOR(iPosition) - GetConfig()->SetBoolValue(PP_SHSHOWCOPY, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_SHSHOWMOVE, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_SHSHOWCOPYMOVE, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_SHSHOWPASTE, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_SHSHOWPASTESPECIAL, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_SHSHOWCOPYTO, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_SHSHOWMOVETO, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_SHSHOWCOPYMOVETO, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_SHSHOWFREESPACE, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_SHSHOWSHELLICONS, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_SHUSEDRAGDROP, GetBoolProp(iPosition++)); - GetConfig()->SetIntValue(PP_SHDEFAULTACTION, GetIndexProp(iPosition++)); + pConfig->set_bool(PP_SHSHOWCOPY, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_SHSHOWMOVE, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_SHSHOWCOPYMOVE, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_SHSHOWPASTE, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_SHSHOWPASTESPECIAL, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_SHSHOWCOPYTO, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_SHSHOWMOVETO, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_SHSHOWCOPYMOVETO, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_SHSHOWFREESPACE, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_SHSHOWSHELLICONS, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_SHUSEDRAGDROP, GetBoolProp(iPosition++)); + pConfig->set_signed_num(PP_SHDEFAULTACTION, GetIndexProp(iPosition++)); SKIP_SEPARATOR(iPosition) - GetConfig()->SetBoolValue(PP_CMUSEAUTOCOMPLETEFILES, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_CMSETDESTATTRIBUTES, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_CMSETDESTDATE, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_CMPROTECTROFILES, GetBoolProp(iPosition++)); - GetConfig()->SetIntValue(PP_CMLIMITMAXOPERATIONS, GetUintProp(iPosition++)); - GetConfig()->SetBoolValue(PP_CMREADSIZEBEFOREBLOCKING, GetBoolProp(iPosition++)); - GetConfig()->SetIntValue(PP_CMSHOWVISUALFEEDBACK, GetIndexProp(iPosition++)); - GetConfig()->SetBoolValue(PP_CMUSETIMEDFEEDBACK, GetBoolProp(iPosition++)); - GetConfig()->SetIntValue(PP_CMFEEDBACKTIME, GetUintProp(iPosition++)); - GetConfig()->SetBoolValue(PP_CMAUTORETRYONERROR, GetBoolProp(iPosition++)); - GetConfig()->SetIntValue(PP_CMAUTORETRYINTERVAL, GetUintProp(iPosition++)); - GetConfig()->SetIntValue(PP_CMDEFAULTPRIORITY, IndexToPriority(GetIndexProp(iPosition++))); - GetConfig()->SetBoolValue(PP_CMDISABLEPRIORITYBOOST, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_CMDELETEAFTERFINISHED, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_CMCREATELOG, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_CMUSEAUTOCOMPLETEFILES, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_CMSETDESTATTRIBUTES, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_CMSETDESTDATE, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_CMPROTECTROFILES, GetBoolProp(iPosition++)); + pConfig->set_signed_num(PP_CMLIMITMAXOPERATIONS, GetUintProp(iPosition++)); + pConfig->set_bool(PP_CMREADSIZEBEFOREBLOCKING, GetBoolProp(iPosition++)); + pConfig->set_signed_num(PP_CMSHOWVISUALFEEDBACK, GetIndexProp(iPosition++)); + pConfig->set_bool(PP_CMUSETIMEDFEEDBACK, GetBoolProp(iPosition++)); + pConfig->set_signed_num(PP_CMFEEDBACKTIME, GetUintProp(iPosition++)); + pConfig->set_bool(PP_CMAUTORETRYONERROR, GetBoolProp(iPosition++)); + pConfig->set_signed_num(PP_CMAUTORETRYINTERVAL, GetUintProp(iPosition++)); + pConfig->set_signed_num(PP_CMDEFAULTPRIORITY, IndexToPriority(GetIndexProp(iPosition++))); + pConfig->set_bool(PP_CMDISABLEPRIORITYBOOST, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_CMDELETEAFTERFINISHED, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_CMCREATELOG, GetBoolProp(iPosition++)); // Buffer SKIP_SEPARATOR(iPosition) - GetConfig()->SetBoolValue(PP_BFUSEONLYDEFAULT, GetBoolProp(iPosition++)); - GetConfig()->SetIntValue(PP_BFDEFAULT, GetUintProp(iPosition++)); - GetConfig()->SetIntValue(PP_BFONEDISK, GetUintProp(iPosition++)); - GetConfig()->SetIntValue(PP_BFTWODISKS, GetUintProp(iPosition++)); - GetConfig()->SetIntValue(PP_BFCD, GetUintProp(iPosition++)); - GetConfig()->SetIntValue(PP_BFLAN, GetUintProp(iPosition++)); - GetConfig()->SetBoolValue(PP_BFUSENOBUFFERING, GetBoolProp(iPosition++)); - GetConfig()->SetIntValue(PP_BFBOUNDARYLIMIT, GetUintProp(iPosition++)); + pConfig->set_bool(PP_BFUSEONLYDEFAULT, GetBoolProp(iPosition++)); + pConfig->set_signed_num(PP_BFDEFAULT, GetUintProp(iPosition++)); + pConfig->set_signed_num(PP_BFONEDISK, GetUintProp(iPosition++)); + pConfig->set_signed_num(PP_BFTWODISKS, GetUintProp(iPosition++)); + pConfig->set_signed_num(PP_BFCD, GetUintProp(iPosition++)); + pConfig->set_signed_num(PP_BFLAN, GetUintProp(iPosition++)); + pConfig->set_bool(PP_BFUSENOBUFFERING, GetBoolProp(iPosition++)); + pConfig->set_signed_num(PP_BFBOUNDARYLIMIT, GetUintProp(iPosition++)); // log file /* SKIP_SEPARATOR(iPosition) - GetConfig()->SetBoolValue(PP_LOGENABLELOGGING, GetBoolProp(iPosition++)); - GetConfig()->SetBoolValue(PP_LOGLIMITATION, GetBoolProp(iPosition++)); - GetConfig()->SetIntValue(PP_LOGMAXLIMIT, GetUintProp(iPosition++)); - GetConfig()->SetBoolValue(PP_LOGPRECISELIMITING, GetBoolProp(iPosition++)); - GetConfig()->SetIntValue(PP_LOGTRUNCBUFFERSIZE, GetUintProp(iPosition++));*/ + pConfig->set_bool(PP_LOGENABLELOGGING, GetBoolProp(iPosition++)); + pConfig->set_bool(PP_LOGLIMITATION, GetBoolProp(iPosition++)); + pConfig->set_signed_num(PP_LOGMAXLIMIT, GetUintProp(iPosition++)); + pConfig->set_bool(PP_LOGPRECISELIMITING, GetBoolProp(iPosition++)); + pConfig->set_signed_num(PP_LOGTRUNCBUFFERSIZE, GetUintProp(iPosition++));*/ // Sounds SKIP_SEPARATOR(iPosition) - GetConfig()->SetBoolValue(PP_SNDPLAYSOUNDS, GetBoolProp(iPosition++)); - GetConfig()->SetStringValue(PP_SNDERRORSOUNDPATH, GetStringProp(iPosition++)); - GetConfig()->SetStringValue(PP_SNDFINISHEDSOUNDPATH, GetStringProp(iPosition++)); + pConfig->set_bool(PP_SNDPLAYSOUNDS, GetBoolProp(iPosition++)); + pConfig->set_string(PP_SNDERRORSOUNDPATH, GetStringProp(iPosition++)); + pConfig->set_string(PP_SNDFINISHEDSOUNDPATH, GetStringProp(iPosition++)); // shortcuts & recent paths SKIP_SEPARATOR(iPosition) - GetConfig()->SetStringArrayValue(PP_SHORTCUTS, &m_cvShortcuts); + pConfig->clear_array_values(PP_SHORTCUTS); + for(char_vector::iterator it = m_cvShortcuts.begin(); it != m_cvShortcuts.end(); it++) + { + pConfig->set_string(PP_SHORTCUTS, (*it), icpf::property::action_add); + } SKIP_SEPARATOR(iPosition) - GetConfig()->SetStringArrayValue(PP_RECENTPATHS, &m_cvRecent); + pConfig->clear_array_values(PP_RECENTPATHS); + for(char_vector::iterator it = m_cvRecent.begin(); it != m_cvRecent.end(); it++) + { + pConfig->set_string(PP_RECENTPATHS, (*it), icpf::property::action_add); + } - GetConfig()->Save(); + pConfig->write(NULL); } void COptionsDlg::OnCancel() Index: src/ch/ResourceManager.cpp =================================================================== diff -u -r4c272b19c74694c428c943011f279ec064fbd894 -rcdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e --- src/ch/ResourceManager.cpp (.../ResourceManager.cpp) (revision 4c272b19c74694c428c943011f279ec064fbd894) +++ src/ch/ResourceManager.cpp (.../ResourceManager.cpp) (revision cdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e) @@ -241,7 +241,7 @@ { _tcsncpy(szData, pszFile, pszName-pszFile+1); _tcscpy(szData+(pszName-pszFile+1), GetBaseFile()); - TRACE("Base (update) path=%s\n", szData); + TRACE(_t("Base (update) path=%s\n"), szData); ReadTranslation(szData, true); } } Index: src/ch/StatusDlg.cpp =================================================================== diff -u -r4c272b19c74694c428c943011f279ec064fbd894 -rcdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e --- src/ch/StatusDlg.cpp (.../StatusDlg.cpp) (revision 4c272b19c74694c428c943011f279ec064fbd894) +++ src/ch/StatusDlg.cpp (.../StatusDlg.cpp) (revision cdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e) @@ -173,7 +173,7 @@ }; // refresh data timer - SetTimer(777, GetConfig()->GetIntValue(PP_STATUSREFRESHINTERVAL), NULL); + SetTimer(777, (UINT)GetConfig()->get_signed_num(PP_STATUSREFRESHINTERVAL), NULL); return TRUE; } @@ -217,7 +217,7 @@ RefreshStatus(); // reenable - SetTimer(777, GetConfig()->GetIntValue(PP_STATUSREFRESHINTERVAL), NULL); + SetTimer(777, (UINT)GetConfig()->get_signed_num(PP_STATUSREFRESHINTERVAL), NULL); } CHLanguageDialog::OnTimer(nIDEvent); @@ -270,7 +270,7 @@ m_ctlStatusList.SetItem(&lvi); // right side update - if (pTask == pSelectedItem && GetConfig()->GetBoolValue(PP_STATUSSHOWDETAILS)) + if (pTask == pSelectedItem && GetConfig()->get_bool(PP_STATUSSHOWDETAILS)) { // data that can be changed by a thread GetDlgItem(IDC_OPERATION_STATIC)->SetWindowText(td.m_szStatusText); // operation @@ -336,7 +336,7 @@ { GetDlgItem(IDC_DESTINATION_STATIC)->SetWindowText(td.m_pdpDestPath->GetPath()); GetDlgItem(IDC_PRIORITY_STATIC)->SetWindowText(GetResManager()->LoadString(IDS_PRIORITY0_STRING+PriorityToIndex(td.m_nPriority))); - GetConfig()->GetStringValue(PP_PAUTOSAVEDIRECTORY, m_strTemp.GetBuffer(1024), 1024); + GetConfig()->get_string(PP_PAUTOSAVEDIRECTORY, m_strTemp.GetBuffer(1024), 1024); m_strTemp.ReleaseBuffer(); GetDlgItem(IDC_ASSOCIATEDFILES__STATIC)->SetWindowText(m_strTemp+*td.m_pstrUniqueName+_T(".atd (.atp, .log)")); } @@ -389,7 +389,7 @@ void CStatusDlg::OnRollUnrollButton() { // change settings in config dialog - GetConfig()->SetBoolValue(PP_STATUSSHOWDETAILS, !GetConfig()->GetBoolValue(PP_STATUSSHOWDETAILS)); + GetConfig()->set_bool(PP_STATUSSHOWDETAILS, !GetConfig()->get_bool(PP_STATUSSHOWDETAILS)); ApplyDisplayDetails(); } @@ -401,7 +401,7 @@ SystemParametersInfo(SPI_GETWORKAREA, 0, &rcScreen, 0); GetWindowRect(&rect); - bool bDetails=GetConfig()->GetBoolValue(PP_STATUSSHOWDETAILS); + bool bDetails=GetConfig()->get_bool(PP_STATUSSHOWDETAILS); // stick cause if (rect.right == rcScreen.right && rect.bottom == rcScreen.bottom) @@ -437,7 +437,7 @@ { // remember ptr to CTask pSelectedItem=GetSelectedItemPointer(); - bool bShowLog=GetConfig()->GetBoolValue(PP_CMCREATELOG); + bool bShowLog=GetConfig()->get_bool(PP_CMCREATELOG); // set status of buttons pause/resume/cancel if (pSelectedItem != NULL) @@ -755,7 +755,7 @@ SetWindowText(m_szData); // refresh overall progress - if (GetConfig()->GetBoolValue(PP_STATUSSHOWDETAILS)) + if (GetConfig()->get_bool(PP_STATUSSHOWDETAILS)) { m_ctlProgressAll.SetPos(nPercent); @@ -866,12 +866,12 @@ { // show log CTask* pTask; - if ( (pTask=GetSelectedItemPointer()) == NULL || !GetConfig()->GetBoolValue(PP_CMCREATELOG)) + if ( (pTask=GetSelectedItemPointer()) == NULL || !GetConfig()->get_bool(PP_CMCREATELOG)) return; // call what's needed TCHAR szExec[1024]; - GetConfig()->GetStringValue(PP_PAUTOSAVEDIRECTORY, szExec, 1024); + GetConfig()->get_string(PP_PAUTOSAVEDIRECTORY, szExec, 1024); GetApp()->ExpandPath(szExec); unsigned long lResult=(unsigned long)(ShellExecute(this->m_hWnd, _T("open"), _T("notepad.exe"), CString(szExec)+pTask->GetUniqueName()+_T(".log"), szExec, SW_SHOWNORMAL)); Index: src/ch/af_defs.h =================================================================== diff -u -r66e9ad9a512cec46d691cb1ba012424dc7ac8897 -rcdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e --- src/ch/af_defs.h (.../af_defs.h) (revision 66e9ad9a512cec46d691cb1ba012424dc7ac8897) +++ src/ch/af_defs.h (.../af_defs.h) (revision cdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e) @@ -14,7 +14,7 @@ #define ROT_HWNDS 0x0100000000000000 // sends a message to all registered modules #define ROT_REGISTERED 0x0200000000000000 -// sends a message to one excact module +// sends a message to one exact module #define ROT_EXACT 0x0300000000000000 // internal modules Index: src/ch/ch.cpp =================================================================== diff -u -r27c0d76ec85a30292d8c474a1f4f969a9a32c406 -rcdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e --- src/ch/ch.cpp (.../ch.cpp) (revision 27c0d76ec85a30292d8c474a1f4f969a9a32c406) +++ src/ch/ch.cpp (.../ch.cpp) (revision cdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e) @@ -84,44 +84,29 @@ { case ROT_EVERYWHERE: { - // TODO: send it to a registered modules (external plugins ?) - // now additional processing switch (uiMsg) { - case WM_CFGNOTIFY: - theApp.OnConfigNotify((UINT)wParam, lParam); - break; case WM_RMNOTIFY: theApp.OnResManNotify((UINT)wParam, lParam); break; } break; } - - case ROT_REGISTERED: - // TODO: send a message to the registered modules - break; - - case ROT_EXACT: - { - switch(ullDst) - { - case IMID_CONFIGMANAGER: - return theApp.m_cfgManager.MsgRouter(uiMsg, wParam, lParam); - } - - // TODO: send a msg to a registered module/program internal module with a given ID - } - break; } return (LRESULT)TRUE; } +void ConfigPropertyChangedCallback(uint_t uiPropID, ptr_t /*pParam*/) +{ + theApp.OnConfigNotify(uiPropID); +} + CCopyHandlerApp::CCopyHandlerApp() : - m_lfLog() + m_lfLog(), + m_cfgSettings(icpf::config::eIni) { m_pMainWindow=NULL; m_szHelpPath[0]=_T('\0'); @@ -156,9 +141,9 @@ return &theApp.m_resManager; } -CConfigManager* GetConfig() +icpf::config* GetConfig() { - return &theApp.m_cfgManager; + return &theApp.m_cfgSettings; } /* CLogFile* GetLog() @@ -177,7 +162,7 @@ // generate the current filename - uses language from config TCHAR szBuffer[_MAX_PATH]; - GetConfig()->GetStringValue(PP_PHELPDIR, szBuffer, _MAX_PATH); + GetConfig()->get_string(PP_PHELPDIR, szBuffer, _MAX_PATH); ExpandPath(szBuffer); _tcscat(szBuffer, GetResManager()->m_ld.GetHelpName()); if (_tcscmp(szBuffer, m_szHelpPath) != 0) @@ -254,23 +239,29 @@ return FALSE; // load configuration - m_cfgManager.SetCallback((PFNNOTIFYCALLBACK)MainRouter); + m_cfgSettings.set_callback(ConfigPropertyChangedCallback, NULL); TCHAR szPath[_MAX_PATH]; _tcscpy(szPath, GetProgramPath()); _tcscat(szPath, _T("\\ch.ini")); - m_cfgManager.Open(szPath); + try + { + m_cfgSettings.read(szPath); + } + catch(...) + { + } // register all properties - RegisterProperties(&m_cfgManager); + RegisterProperties(&m_cfgSettings); // set this process class HANDLE hProcess=GetCurrentProcess(); - ::SetPriorityClass(hProcess, m_cfgManager.GetIntValue(PP_PPROCESSPRIORITYCLASS)); + ::SetPriorityClass(hProcess, (DWORD)m_cfgSettings.get_signed_num(PP_PPROCESSPRIORITYCLASS)); // set current language m_resManager.Init(AfxGetInstanceHandle()); m_resManager.SetCallback((PFNNOTIFYCALLBACK)MainRouter); - m_cfgManager.GetStringValue(PP_PLANGUAGE, szPath, _MAX_PATH); + m_cfgSettings.get_string(PP_PLANGUAGE, szPath, _MAX_PATH); TRACE(_T("Help path=%s\n"), szPath); if (!m_resManager.SetLanguage(ExpandPath(szPath))) { @@ -287,8 +278,8 @@ CLanguageDialog::SetResManager(&m_resManager); // initialize log file - m_cfgManager.GetStringValue(PP_LOGPATH, szPath, _MAX_PATH); - m_lfLog.init(ExpandPath(szPath), m_cfgManager.GetIntValue(PP_LOGMAXLIMIT), icpf::log_file::level_debug, false, false); + m_cfgSettings.get_string(PP_LOGPATH, szPath, _MAX_PATH); + m_lfLog.init(ExpandPath(szPath), (int_t)m_cfgSettings.get_signed_num(PP_LOGMAXLIMIT), icpf::log_file::level_debug, false, false); // TODO: remove unused properties from configuration /* m_lfLog.EnableLogging(m_cfgManager.GetBoolValue(PP_LOGENABLELOGGING)); @@ -318,19 +309,19 @@ return TRUE; } -void CCopyHandlerApp::OnConfigNotify(UINT uiType, LPARAM lParam) +void CCopyHandlerApp::OnConfigNotify(uint_t uiPropID) { // is this language - if (uiType == CNFT_PROFILECHANGE || (uiType == CNFT_PROPERTYCHANGE && ((UINT)lParam) == PP_PLANGUAGE)) + if(uiPropID == PP_PLANGUAGE) { // update language in resource manager TCHAR szPath[_MAX_PATH]; - m_cfgManager.GetStringValue(PP_PLANGUAGE, szPath, _MAX_PATH); + m_cfgSettings.get_string(PP_PLANGUAGE, szPath, _MAX_PATH); m_resManager.SetLanguage(ExpandPath(szPath)); } - if (uiType == CNFT_PROFILECHANGE || (uiType == CNFT_PROPERTYCHANGE && ((UINT)lParam) == PP_PHELPDIR)) + if(uiPropID == PP_PHELPDIR) { - if (UpdateHelpPaths()) + if(UpdateHelpPaths()) HtmlHelp(HH_CLOSE_ALL, NULL); } } Index: src/ch/ch.h =================================================================== diff -u -ra1df59e4b47f6d8c347f3cff6cfd1a83cd0ec848 -rcdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e --- src/ch/ch.h (.../ch.h) (revision a1df59e4b47f6d8c347f3cff6cfd1a83cd0ec848) +++ src/ch/ch.h (.../ch.h) (revision cdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e) @@ -35,6 +35,8 @@ #include "CfgProperties.h" //#include "LogFile.h" #include "../libicpf/log.h" +#include "../libicpf/cfg.h" +#include "../libicpf/cfg_ini.h" using namespace std; @@ -65,18 +67,19 @@ friend int MsgBox(UINT uiID, UINT nType=MB_OK, UINT nIDHelp=0); friend CCopyHandlerApp* GetApp(); friend CResourceManager* GetResManager(); - friend CConfigManager* GetConfig(); + friend icpf::config* GetConfig(); // friend CLogFile* GetLog(); - void OnConfigNotify(UINT uiType, LPARAM lParam); + void OnConfigNotify(uint_t uiPropID); void OnResManNotify(UINT uiType, LPARAM lParam); protected: bool UpdateHelpPaths(); HWND HHelp(HWND hwndCaller, LPCTSTR pszFile, UINT uCommand, DWORD dwData); public: CResourceManager m_resManager; - CConfigManager m_cfgManager; +// CConfigManager m_cfgManager; + icpf::config m_cfgSettings; icpf::log_file m_lfLog; CWnd *m_pMainWindow; Index: src/ch/charvect.h =================================================================== diff -u -r3493e9fc470285b0a0b417d50be281467a071eb7 -rcdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e --- src/ch/charvect.h (.../charvect.h) (revision 3493e9fc470285b0a0b417d50be281467a071eb7) +++ src/ch/charvect.h (.../charvect.h) (revision cdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e) @@ -75,6 +75,19 @@ else ((vector*)this)->insert(_Where, _Count, _Val); }; + void insert(iterator _Where, size_type _Count, const PCTSTR& _Val) + { + size_type _Size=_tcslen(_Val)+1; + PTSTR *ppsz=new PTSTR[_Count]; + for(size_type i=0;i<_Count;i++) + { + ppsz[i]=new TCHAR[_Size]; + _tcscpy(ppsz[i], _Val); + } + + ((vector*)this)->insert(_Where, ppsz, ppsz+_Count); + delete [] ppsz; + }; template void insert(iterator _Where, _It _First, _It _Last, bool bCopy) { if (bCopy) @@ -100,6 +113,7 @@ void pop_back(bool bDelete) { if (bDelete) delete [] (*(end()-1)); ((vector*)this)->pop_back(); }; void push_back(const PTSTR& _Val, bool bCopy) { insert(end(), 1, _Val, bCopy); }; + void push_back(const PCTSTR& _Val) { insert(end(), 1, _Val); }; }; #endif \ No newline at end of file