OSDN Git Service

Use COptionsMgr instead of GetProfile*() and WriteProfile*()
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Sun, 24 Feb 2019 07:41:35 +0000 (16:41 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Sun, 24 Feb 2019 07:41:35 +0000 (16:41 +0900)
16 files changed:
Src/7zCommon.cpp
Src/ChildFrm.cpp
Src/Common/RegOptionsMgr.cpp
Src/DirDoc.cpp
Src/DirFrame.cpp
Src/HexMergeDoc.cpp
Src/HexMergeFrm.cpp
Src/ImgMergeFrm.cpp
Src/MainFrm.cpp
Src/Merge.cpp
Src/MergeDoc.cpp
Src/OpenFrm.cpp
Src/OptionsDef.h
Src/OptionsInit.cpp
Src/PatchDlg.cpp
Src/SelectUnpackerDlg.cpp

index 5d01c84..ccd9b65 100644 (file)
@@ -543,9 +543,6 @@ void DirItemEnumerator::CompressArchive(LPCTSTR path)
        String strPath;\r
        if (path == nullptr)\r
        {\r
-               // No path given, so prompt for path!\r
-               static const TCHAR _T_Merge7z[] = _T("Merge7z");\r
-               static const TCHAR _T_FilterIndex[] = _T("FilterIndex");\r
                // 7z311 can only write 7z, zip, and tar(.gz|.bz2) archives, so don't\r
                // offer other formats here!\r
                static const TCHAR _T_Filter[]\r
@@ -584,7 +581,7 @@ void DirItemEnumerator::CompressArchive(LPCTSTR path)
                        OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_NOREADONLYRETURN,\r
                        strFilter.c_str()\r
                );\r
-               dlg.m_ofn.nFilterIndex = AfxGetApp()->GetProfileInt(_T_Merge7z, _T_FilterIndex, 1);\r
+               dlg.m_ofn.nFilterIndex = GetOptionsMgr()->GetInt(OPT_ARCHIVE_FILTER_INDEX);\r
                // Use extension from current filter as default extension:\r
                if (int i = dlg.m_ofn.nFilterIndex)\r
                {\r
@@ -603,7 +600,7 @@ void DirItemEnumerator::CompressArchive(LPCTSTR path)
                {\r
                        strPath = dlg.GetPathName();\r
                        path = strPath.c_str();\r
-                       AfxGetApp()->WriteProfileInt(_T_Merge7z, _T_FilterIndex, dlg.m_ofn.nFilterIndex);\r
+                       GetOptionsMgr()->SaveOption(OPT_ARCHIVE_FILTER_INDEX, static_cast<int>(dlg.m_ofn.nFilterIndex));\r
                }\r
        }\r
        if (path && !MultiStepCompressArchive(path))\r
index b01bc96..395d535 100644 (file)
@@ -267,7 +267,7 @@ void CChildFrame::ActivateFrame(int nCmdShow)
                CMDIChildWnd * oldActiveFrame = GetMDIFrame()->MDIGetActive(&bMaximized);
                if (oldActiveFrame == nullptr)
                        // for the first frame, get the restored/maximized state from the registry
-                       bMaximized = theApp.GetProfileInt(_T("Settings"), _T("ActiveFrameMax"), TRUE);
+                       bMaximized = GetOptionsMgr()->GetBool(OPT_ACTIVE_FRAME_MAX);
                if (bMaximized)
                        nCmdShow = SW_SHOWMAXIMIZED;
                else
@@ -296,7 +296,7 @@ BOOL CChildFrame::DestroyWindow()
                WINDOWPLACEMENT wp;
                wp.length = sizeof(WINDOWPLACEMENT);
                GetWindowPlacement(&wp);
-               theApp.WriteProfileInt(_T("Settings"), _T("ActiveFrameMax"), (wp.showCmd == SW_MAXIMIZE));
+               GetOptionsMgr()->SaveOption(OPT_ACTIVE_FRAME_MAX, (wp.showCmd == SW_MAXIMIZE));
        }
 
        return CMDIChildWnd::DestroyWindow();
@@ -326,7 +326,7 @@ void CChildFrame::SavePosition()
                auto& splitterWnd = static_cast<CMergeEditSplitterView *>(m_wndSplitter.GetPane(iRow, 0))->m_wndSplitter;
                splitterWnd.GetActivePane(&iRow, &iCol);
                if (iRow >= 0 || iCol >= 0)
-                       theApp.WriteProfileInt(_T("Settings"), _T("ActivePane"), max(iRow, iCol));
+                       GetOptionsMgr()->SaveOption(OPT_ACTIVE_PANE, max(iRow, iCol));
        }
 }
 
index 5b89901..76867ae 100644 (file)
@@ -613,7 +613,7 @@ int CRegOptionsMgr::ExportOptions(const String& filename, const bool bHexColor /
 int CRegOptionsMgr::ImportOptions(const String& filename)
 {
        int retVal = COption::OPT_OK;
-       const int BufSize = 10240; // This should be enough for a long time..
+       const int BufSize = 20480; // This should be enough for a long time..
        TCHAR buf[BufSize] = {0};
 
        // Query keys - returns NUL separated strings
index 27a9bd6..d19b801 100644 (file)
@@ -266,7 +266,7 @@ void CDirDoc::Rescan()
        pf->GetHeaderInterface()->SetPaneCount(m_nDirs);
        pf->GetHeaderInterface()->SetOnSetFocusCallback([&](int pane) {
                m_pDirView->SetActivePane(pane);
-               theApp.WriteProfileInt(_T("Settings"), _T("ActivePane"), pane);
+               GetOptionsMgr()->SaveOption(OPT_ACTIVE_PANE, pane);
        });
        for (int nIndex = 0; nIndex < m_nDirs; nIndex++)
        {
@@ -275,7 +275,7 @@ void CDirDoc::Rescan()
                pf->GetHeaderInterface()->SetActive(nIndex, false);
        }
        pf->GetHeaderInterface()->Resize();
-       int nPane = theApp.GetProfileInt(_T("Settings"), _T("ActivePane"), 0);
+       int nPane = GetOptionsMgr()->GetInt(OPT_ACTIVE_PANE);
        m_pDirView->SetActivePane((nPane >= 0 && nPane < m_nDirs) ? nPane : 0);
 
        // Make sure filters are up-to-date
index 53f4ba7..005d56d 100644 (file)
@@ -28,6 +28,8 @@
 #include "stdafx.h"
 #include "DirFrame.h"
 #include "Merge.h"
+#include "OptionsDef.h"
+#include "OptionsMgr.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -193,7 +195,7 @@ void CDirFrame::ActivateFrame(int nCmdShow)
        CMDIChildWnd * oldActiveFrame = GetMDIFrame()->MDIGetActive(&bMaximized);
        if (oldActiveFrame == nullptr)
                // for the first frame, get the restored/maximized state from the registry
-               bMaximized = theApp.GetProfileInt(_T("Settings"), _T("ActiveFrameMax"), TRUE);
+               bMaximized = GetOptionsMgr()->GetBool(OPT_ACTIVE_FRAME_MAX);
        if (bMaximized)
                nCmdShow = SW_SHOWMAXIMIZED;
        else
@@ -254,7 +256,7 @@ BOOL CDirFrame::DestroyWindow()
                WINDOWPLACEMENT wp;
                wp.length = sizeof(WINDOWPLACEMENT);
                GetWindowPlacement(&wp);
-               theApp.WriteProfileInt(_T("Settings"), _T("ActiveFrameMax"), (wp.showCmd == SW_MAXIMIZE));
+               GetOptionsMgr()->SaveOption(OPT_ACTIVE_FRAME_MAX, (wp.showCmd == SW_MAXIMIZE));
                // save docking positions and sizes
                CDockState dockState;
                GetDockState(dockState);
index eaf96d5..dfb9d75 100644 (file)
@@ -535,7 +535,7 @@ void CHexMergeDoc::MoveOnLoad(int nPane, int)
 {
        if (nPane < 0)
        {
-               nPane = theApp.GetProfileInt(_T("Settings"), _T("ActivePane"), 0);
+               nPane = GetOptionsMgr()->GetInt(OPT_ACTIVE_PANE);
                if (nPane < 0 || nPane >= m_nBuffers)
                        nPane = 0;
        }
index 1f89e54..69502bf 100644 (file)
@@ -196,7 +196,7 @@ BOOL CHexMergeFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/,
 
 void CHexMergeFrame::ActivateFrame(int nCmdShow) 
 {
-       if (!GetMDIFrame()->MDIGetActive() && theApp.GetProfileInt(_T("Settings"), _T("ActiveFrameMax"), FALSE))
+       if (!GetMDIFrame()->MDIGetActive() && GetOptionsMgr()->GetBool(OPT_ACTIVE_FRAME_MAX))
        {
                nCmdShow = SW_SHOWMAXIMIZED;
        }
@@ -216,7 +216,7 @@ BOOL CHexMergeFrame::DestroyWindow()
                WINDOWPLACEMENT wp;
                wp.length = sizeof(WINDOWPLACEMENT);
                GetWindowPlacement(&wp);
-               theApp.WriteProfileInt(_T("Settings"), _T("ActiveFrameMax"), (wp.showCmd == SW_MAXIMIZE));
+               GetOptionsMgr()->SaveOption(OPT_ACTIVE_FRAME_MAX, (wp.showCmd == SW_MAXIMIZE));
        }
 
        return CMDIChildWnd::DestroyWindow();
@@ -235,7 +235,7 @@ void CHexMergeFrame::SavePosition()
                CRect rc;
                pLeft->GetWindowRect(&rc);
                theApp.WriteProfileInt(_T("Settings"), _T("WLeft"), rc.Width());
-               theApp.WriteProfileInt(_T("Settings"), _T("ActivePane"), GetActivePane());
+               GetOptionsMgr()->SaveOption(OPT_ACTIVE_PANE, GetActivePane());
        }
 }
 
index 2d60249..d2f1c04 100644 (file)
@@ -218,7 +218,7 @@ bool CImgMergeFrame::OpenDocs(int nFiles, const FileLocation fileloc[], const bo
                return false;
 
        int nCmdShow = SW_SHOW;
-       if (theApp.GetProfileInt(_T("Settings"), _T("ActiveFrameMax"), FALSE))
+       if (GetOptionsMgr()->GetBool(OPT_ACTIVE_FRAME_MAX))
                nCmdShow = SW_SHOWMAXIMIZED;
        ShowWindow(nCmdShow);
        BringToTop(nCmdShow);
@@ -235,7 +235,7 @@ void CImgMergeFrame::MoveOnLoad(int nPane, int)
 {
        if (nPane < 0)
        {
-               nPane = theApp.GetProfileInt(_T("Settings"), _T("ActivePane"), 0);
+               nPane = GetOptionsMgr()->GetInt(OPT_ACTIVE_PANE);
                if (nPane < 0 || nPane >= m_pImgMergeWindow->GetPaneCount())
                        nPane = 0;
        }
@@ -564,7 +564,7 @@ BOOL CImgMergeFrame::DestroyWindow()
                WINDOWPLACEMENT wp;
                wp.length = sizeof(WINDOWPLACEMENT);
                GetWindowPlacement(&wp);
-               theApp.WriteProfileInt(_T("Settings"), _T("ActiveFrameMax"), (wp.showCmd == SW_MAXIMIZE));
+               GetOptionsMgr()->SaveOption(OPT_ACTIVE_FRAME_MAX, (wp.showCmd == SW_MAXIMIZE));
        }
 
        return CMDIChildWnd::DestroyWindow();
@@ -610,7 +610,7 @@ void CImgMergeFrame::SavePosition()
 {
        CRect rc;
        GetWindowRect(&rc);
-       theApp.WriteProfileInt(_T("Settings"), _T("ActivePane"), m_pImgMergeWindow->GetActivePane());
+       GetOptionsMgr()->SaveOption(OPT_ACTIVE_PANE, m_pImgMergeWindow->GetActivePane());
 
        // save the bars layout
        // save docking positions and sizes
index 86ec140..2fb8bcb 100644 (file)
@@ -905,8 +905,8 @@ bool CMainFrame::DoFileOpen(const PathContext * pFiles /*= nullptr*/,
        if (pDirDoc != nullptr && !pDirDoc->CloseMergeDocs())
                return false;
 
-       FileTransform::g_UnpackerMode = static_cast<PLUGIN_MODE>(theApp.GetProfileInt(_T("Settings"), _T("UnpackerMode"), PLUGIN_MANUAL));
-       FileTransform::g_PredifferMode = static_cast<PLUGIN_MODE>(theApp.GetProfileInt(_T("Settings"), _T("PredifferMode"), PLUGIN_MANUAL));
+       FileTransform::g_UnpackerMode = static_cast<PLUGIN_MODE>(GetOptionsMgr()->GetInt(OPT_PLUGINS_UNPACKER_MODE));
+       FileTransform::g_PredifferMode = static_cast<PLUGIN_MODE>(GetOptionsMgr()->GetInt(OPT_PLUGINS_PREDIFFER_MODE));
 
        Merge7zFormatMergePluginScope scope(infoUnpacker);
 
@@ -1394,7 +1394,7 @@ void CMainFrame::OnPluginUnpackMode(UINT nID )
                FileTransform::g_UnpackerMode = PLUGIN_AUTO;
                break;
        }
-       theApp.WriteProfileInt(_T("Settings"), _T("UnpackerMode"), FileTransform::g_UnpackerMode);
+       GetOptionsMgr()->SaveOption(OPT_PLUGINS_UNPACKER_MODE, FileTransform::g_UnpackerMode);
 }
 
 void CMainFrame::OnUpdatePluginUnpackMode(CCmdUI* pCmdUI) 
@@ -1422,7 +1422,7 @@ void CMainFrame::OnPluginPrediffMode(UINT nID )
                pMergeDoc->SetPrediffer(&infoPrediffer);
        for (auto pDirDoc : GetAllDirDocs())
                pDirDoc->GetPluginManager().SetPrediffSettingAll(FileTransform::g_PredifferMode);
-       theApp.WriteProfileInt(_T("Settings"), _T("PredifferMode"), FileTransform::g_PredifferMode);
+       GetOptionsMgr()->SaveOption(OPT_PLUGINS_PREDIFFER_MODE, FileTransform::g_PredifferMode);
 }
 
 void CMainFrame::OnUpdatePluginPrediffMode(CCmdUI* pCmdUI) 
index 1b5b713..dbd44f9 100644 (file)
@@ -282,8 +282,8 @@ BOOL CMergeApp::InitInstance()
        charsets_init();
        UpdateCodepageModule();
 
-       FileTransform::g_UnpackerMode = static_cast<PLUGIN_MODE>(theApp.GetProfileInt(_T("Settings"), _T("UnpackerMode"), PLUGIN_MANUAL));
-       FileTransform::g_PredifferMode = static_cast<PLUGIN_MODE>(theApp.GetProfileInt(_T("Settings"), _T("PredifferMode"), PLUGIN_MANUAL));
+       FileTransform::g_UnpackerMode = static_cast<PLUGIN_MODE>(GetOptionsMgr()->GetInt(OPT_PLUGINS_UNPACKER_MODE));
+       FileTransform::g_PredifferMode = static_cast<PLUGIN_MODE>(GetOptionsMgr()->GetInt(OPT_PLUGINS_PREDIFFER_MODE));
 
        NONCLIENTMETRICS ncm = { sizeof NONCLIENTMETRICS };
        if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof NONCLIENTMETRICS, &ncm, 0))
@@ -561,11 +561,11 @@ BOOL CMergeApp::OnIdle(LONG lCount)
  */
 void CMergeApp::InitializeFileFilters()
 {
-       CString filterPath = GetProfileString(_T("Settings"), _T("UserFilterPath"), _T(""));
+       String filterPath = GetOptionsMgr()->GetString(OPT_FILTER_USERPATH);
 
-       if (!filterPath.IsEmpty())
+       if (!filterPath.empty())
        {
-               m_pGlobalFileFilter->SetUserFilterPath((LPCTSTR)filterPath);
+               m_pGlobalFileFilter->SetUserFilterPath(filterPath);
        }
        m_pGlobalFileFilter->LoadAllFileFilters();
 }
index 42cb916..61dbaeb 100644 (file)
@@ -2854,7 +2854,7 @@ void CMergeDoc::MoveOnLoad(int nPane, int nLineIndex)
 {
        if (nPane < 0)
        {
-               nPane = theApp.GetProfileInt(_T("Settings"), _T("ActivePane"), 0);
+               nPane = GetOptionsMgr()->GetInt(OPT_ACTIVE_PANE);
                if (nPane < 0 || nPane >= m_nBuffers)
                        nPane = 0;
        }
index 1d44585..f171e62 100644 (file)
@@ -2,6 +2,8 @@
 //
 #include "stdafx.h"
 #include "OpenFrm.h"
+#include "OptionsDef.h"
+#include "OptionsMgr.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -98,7 +100,7 @@ void COpenFrame::OnGetMinMaxInfo(MINMAXINFO* lpMMI)
 
 void COpenFrame::ActivateFrame(int nCmdShow) 
 {
-       if (!GetMDIFrame()->MDIGetActive() && AfxGetApp()->GetProfileInt(_T("Settings"), _T("ActiveFrameMax"), TRUE))
+       if (!GetMDIFrame()->MDIGetActive() && GetOptionsMgr()->GetBool(OPT_ACTIVE_FRAME_MAX))
        {
                nCmdShow = SW_SHOWMAXIMIZED;
        }
@@ -137,7 +139,7 @@ BOOL COpenFrame::DestroyWindow()
                WINDOWPLACEMENT wp;
                wp.length = sizeof(WINDOWPLACEMENT);
                GetWindowPlacement(&wp);
-               AfxGetApp()->WriteProfileInt(_T("Settings"), _T("ActiveFrameMax"), (wp.showCmd == SW_MAXIMIZE));
+               GetOptionsMgr()->SaveOption(OPT_ACTIVE_FRAME_MAX, (wp.showCmd == SW_MAXIMIZE));
        }
 
        return CMDIChildWnd::DestroyWindow();
index e89defb..950c695 100644 (file)
@@ -58,6 +58,10 @@ extern const String OPT_DIRVIEW_SORT_COLUMN3 OP("Settings/DirViewSortCol3");
 extern const String OPT_DIRVIEW_SORT_ASCENDING OP("Settings/DirViewSortAscending");
 extern const String OPT_DIRVIEW_EXPAND_SUBDIRS OP("Settings/DirViewExpandSubdirs");
 
+// Window/Pane
+extern const String OPT_ACTIVE_FRAME_MAX OP("Settings/ActiveFrameMax");
+extern const String OPT_ACTIVE_PANE OP("Settings/ActivePane");
+
 // Folder Compare Report
 extern const String OPT_REPORTFILES_REPORTTYPE OP("ReportFiles/ReportType");
 extern const String OPT_REPORTFILES_COPYTOCLIPBOARD OP("ReportFiles/CopyToClipboard");
@@ -196,10 +200,24 @@ extern const String OPT_FILEFILTER_SHARED OP("Settings/Filters/Shared");
 // Archive support
 extern const String OPT_ARCHIVE_ENABLE OP("Merge7z/Enable");
 extern const String OPT_ARCHIVE_PROBETYPE OP("Merge7z/ProbeSignature");
+extern const String OPT_ARCHIVE_FILTER_INDEX OP("Merge7z/FilterIndex");
+
+// Patch Creator
+extern const String OPT_PATCHCREATOR_PATCH_STYLE OP("PatchCreator/PatchStyle");
+extern const String OPT_PATCHCREATOR_CONTEXT_LINES OP("PatchCreator/ContextLines");
+extern const String OPT_PATCHCREATOR_CASE_SENSITIVE OP("PatchCreator/CaseSensitive");
+extern const String OPT_PATCHCREATOR_EOL_SENSITIVE OP("PatchCreator/EOLSensitive");
+extern const String OPT_PATCHCREATOR_IGNORE_BLANK_LINES OP("PatchCreator/IgnoreBlankLines");
+extern const String OPT_PATCHCREATOR_WHITESPACE OP("PatchCreator/Whitespace");
+extern const String OPT_PATCHCREATOR_OPEN_TO_EDITOR OP("PatchCreator/OpenToEditor");
+extern const String OPT_PATCHCREATOR_INCLUDE_CMD_LINE OP("PatchCreator/IncludeCmdLine");
 
 // Plugins
 extern const String OPT_PLUGINS_ENABLED OP("Settings/PluginsEnabled");
 extern const String OPT_PLUGINS_DISABLED_LIST OP("Settings/PluginsDisabledList");
+extern const String OPT_PLUGINS_UNPACKER_MODE OP("Settings/UnpackerMode");
+extern const String OPT_PLUGINS_PREDIFFER_MODE OP("Settings/PredifferMode");
+extern const String OPT_PLUGINS_UNPACK_DONT_CHECK_EXTENSION OP("Plugins/UnpackDontCheckExtension");
 
 // Startup options
 extern const String OPT_SHOW_SELECT_FILES_AT_STARTUP OP("Settings/ShowFileDialog");
index 3310275..952ca5a 100644 (file)
@@ -14,6 +14,7 @@
 #include "DiffWrapper.h" // CMP_CONTENT
 #include "paths.h"
 #include "Environment.h"
+#include "FileTransform.h"
 #include "Constants.h"
 
 // Functions to copy values set by installer from HKLM to HKCU.
@@ -172,11 +173,26 @@ void Init(COptionsMgr *pOptions)
 
        pOptions->InitOption(OPT_ARCHIVE_ENABLE, 1); // Enable by default
        pOptions->InitOption(OPT_ARCHIVE_PROBETYPE, false);
+       pOptions->InitOption(OPT_ARCHIVE_FILTER_INDEX, 1);
 
        pOptions->InitOption(OPT_PLUGINS_ENABLED, true);
        pOptions->InitOption(OPT_PLUGINS_DISABLED_LIST, _T(""));
+       pOptions->InitOption(OPT_PLUGINS_UNPACKER_MODE, PLUGIN_MANUAL);
+       pOptions->InitOption(OPT_PLUGINS_PREDIFFER_MODE, PLUGIN_MANUAL);
+       pOptions->InitOption(OPT_PLUGINS_UNPACK_DONT_CHECK_EXTENSION, false);
+
+       pOptions->InitOption(OPT_PATCHCREATOR_PATCH_STYLE, 0);
+       pOptions->InitOption(OPT_PATCHCREATOR_CONTEXT_LINES, 0);
+       pOptions->InitOption(OPT_PATCHCREATOR_CASE_SENSITIVE, true);
+       pOptions->InitOption(OPT_PATCHCREATOR_EOL_SENSITIVE, true);
+       pOptions->InitOption(OPT_PATCHCREATOR_IGNORE_BLANK_LINES, false);
+       pOptions->InitOption(OPT_PATCHCREATOR_WHITESPACE, WHITESPACE_COMPARE_ALL);
+       pOptions->InitOption(OPT_PATCHCREATOR_OPEN_TO_EDITOR, false);
+       pOptions->InitOption(OPT_PATCHCREATOR_INCLUDE_CMD_LINE, false);
 
        pOptions->InitOption(OPT_TABBAR_AUTO_MAXWIDTH, true);
+       pOptions->InitOption(OPT_ACTIVE_FRAME_MAX, true);
+       pOptions->InitOption(OPT_ACTIVE_PANE, 0);
 
        pOptions->InitOption(OPT_MRU_MAX, 9);
 
index 74d7968..210b9ba 100644 (file)
@@ -28,6 +28,8 @@
 #include "CompareOptions.h"
 #include "FileOrFolderSelect.h"
 #include "Environment.h"
+#include "OptionsDef.h"
+#include "OptionsMgr.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -415,28 +417,28 @@ void CPatchDlg::UpdateSettings()
  */
 void CPatchDlg::LoadSettings()
 {
-       int patchStyle = AfxGetApp()->GetProfileInt(_T("PatchCreator"), _T("PatchStyle"), 0);
+       int patchStyle = GetOptionsMgr()->GetInt(OPT_PATCHCREATOR_PATCH_STYLE);
        if ((patchStyle < DIFF_OUTPUT_NORMAL || patchStyle > DIFF_OUTPUT_UNIFIED) &&  patchStyle != DIFF_OUTPUT_HTML)
                patchStyle = DIFF_OUTPUT_NORMAL;
        m_outputStyle = (enum output_style) patchStyle;
        
-       m_contextLines = AfxGetApp()->GetProfileInt(_T("PatchCreator"), _T("ContextLines"), 0);
+       m_contextLines = GetOptionsMgr()->GetInt(OPT_PATCHCREATOR_CONTEXT_LINES);
        if (m_contextLines < 0 || m_contextLines > 50)
                m_contextLines = 0;
 
-       m_caseSensitive = !!AfxGetApp()->GetProfileInt(_T("PatchCreator"), _T("CaseSensitive"), true);
-       m_ignoreEOLDifference = !!AfxGetApp()->GetProfileInt(_T("PatchCreator"), _T("EOLSensitive"), true);
-       m_ignoreBlanks = !!AfxGetApp()->GetProfileInt(_T("PatchCreator"), _T("IgnoreBlankLines"), false);
+       m_caseSensitive = GetOptionsMgr()->GetBool(OPT_PATCHCREATOR_CASE_SENSITIVE);
+       m_ignoreEOLDifference = GetOptionsMgr()->GetBool(OPT_PATCHCREATOR_EOL_SENSITIVE);
+       m_ignoreBlanks = GetOptionsMgr()->GetBool(OPT_PATCHCREATOR_IGNORE_BLANK_LINES);
        
-       m_whitespaceCompare = AfxGetApp()->GetProfileInt(_T("PatchCreator"), _T("Whitespace"), WHITESPACE_COMPARE_ALL);
+       m_whitespaceCompare = GetOptionsMgr()->GetInt(OPT_PATCHCREATOR_WHITESPACE);
        if (m_whitespaceCompare < WHITESPACE_COMPARE_ALL ||
                m_whitespaceCompare > WHITESPACE_IGNORE_ALL)
        {
                m_whitespaceCompare = WHITESPACE_COMPARE_ALL;
        }
        
-       m_openToEditor = !!AfxGetApp()->GetProfileInt(_T("PatchCreator"), _T("OpenToEditor"), false);
-       m_includeCmdLine = !!AfxGetApp()->GetProfileInt(_T("PatchCreator"), _T("IncludeCmdLine"), false);
+       m_openToEditor = GetOptionsMgr()->GetBool(OPT_PATCHCREATOR_OPEN_TO_EDITOR);
+       m_includeCmdLine = GetOptionsMgr()->GetBool(OPT_PATCHCREATOR_INCLUDE_CMD_LINE);
 
        UpdateSettings();
 }
@@ -446,14 +448,15 @@ void CPatchDlg::LoadSettings()
  */
 void CPatchDlg::SaveSettings()
 {
-       AfxGetApp()->WriteProfileInt(_T("PatchCreator"), _T("PatchStyle"), m_outputStyle);
-       AfxGetApp()->WriteProfileInt(_T("PatchCreator"), _T("ContextLines"), m_contextLines);
-       AfxGetApp()->WriteProfileInt(_T("PatchCreator"), _T("CaseSensitive"), m_caseSensitive);
-       AfxGetApp()->WriteProfileInt(_T("PatchCreator"), _T("EOLSensitive"), m_ignoreEOLDifference);
-       AfxGetApp()->WriteProfileInt(_T("PatchCreator"), _T("IgnoreBlankLines"), m_ignoreBlanks);
-       AfxGetApp()->WriteProfileInt(_T("PatchCreator"), _T("Whitespace"), m_whitespaceCompare);
-       AfxGetApp()->WriteProfileInt(_T("PatchCreator"), _T("OpenToEditor"), m_openToEditor);
-       AfxGetApp()->WriteProfileInt(_T("PatchCreator"), _T("IncludeCmdLine"), m_includeCmdLine);
+       COptionsMgr *pOptions = GetOptionsMgr();
+       pOptions->SaveOption(OPT_PATCHCREATOR_PATCH_STYLE, m_outputStyle);
+       pOptions->SaveOption(OPT_PATCHCREATOR_CONTEXT_LINES, m_contextLines);
+       pOptions->SaveOption(OPT_PATCHCREATOR_CASE_SENSITIVE, m_caseSensitive);
+       pOptions->SaveOption(OPT_PATCHCREATOR_EOL_SENSITIVE, m_ignoreEOLDifference);
+       pOptions->SaveOption(OPT_PATCHCREATOR_IGNORE_BLANK_LINES, m_ignoreBlanks);
+       pOptions->SaveOption(OPT_PATCHCREATOR_WHITESPACE, m_whitespaceCompare);
+       pOptions->SaveOption(OPT_PATCHCREATOR_OPEN_TO_EDITOR, m_openToEditor);
+       pOptions->SaveOption(OPT_PATCHCREATOR_INCLUDE_CMD_LINE, m_includeCmdLine);
 }
 
 /** 
index 8d5d87b..0b8dd71 100644 (file)
@@ -28,6 +28,8 @@
 #include "SelectUnpackerDlg.h"
 #include "Plugins.h"
 #include "FileTransform.h"
+#include "OptionsMgr.h"
+#include "OptionsDef.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -194,7 +196,7 @@ END_MESSAGE_MAP()
 
 void CSelectUnpackerDlg::OnOK() 
 {
-       AfxGetApp()->WriteProfileInt(_T("Plugins"), _T("UnpackDontCheckExtension"), m_bNoExtensionCheck);
+       GetOptionsMgr()->SaveOption(OPT_PLUGINS_UNPACK_DONT_CHECK_EXTENSION, m_bNoExtensionCheck);
 
        CTrDialog::OnOK();
 }
@@ -203,7 +205,7 @@ BOOL CSelectUnpackerDlg::OnInitDialog()
 {
        CTrDialog::OnInitDialog();
 
-       m_bNoExtensionCheck = !!AfxGetApp()->GetProfileInt(_T("Plugins"), _T("UnpackDontCheckExtension"), false);
+       m_bNoExtensionCheck = GetOptionsMgr()->GetBool(OPT_PLUGINS_UNPACK_DONT_CHECK_EXTENSION);
 
        prepareListbox();