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
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
{\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
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
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();
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));
}
}
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
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++)
{
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
#include "stdafx.h"
#include "DirFrame.h"
#include "Merge.h"
+#include "OptionsDef.h"
+#include "OptionsMgr.h"
#ifdef _DEBUG
#define new DEBUG_NEW
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
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);
{
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;
}
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;
}
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();
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());
}
}
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);
{
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;
}
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();
{
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
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);
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)
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)
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))
*/
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();
}
{
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;
}
//
#include "stdafx.h"
#include "OpenFrm.h"
+#include "OptionsDef.h"
+#include "OptionsMgr.h"
#ifdef _DEBUG
#define new DEBUG_NEW
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;
}
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();
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");
// 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");
#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.
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);
#include "CompareOptions.h"
#include "FileOrFolderSelect.h"
#include "Environment.h"
+#include "OptionsDef.h"
+#include "OptionsMgr.h"
#ifdef _DEBUG
#define new DEBUG_NEW
*/
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();
}
*/
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);
}
/**
#include "SelectUnpackerDlg.h"
#include "Plugins.h"
#include "FileTransform.h"
+#include "OptionsMgr.h"
+#include "OptionsDef.h"
#ifdef _DEBUG
#define new DEBUG_NEW
void CSelectUnpackerDlg::OnOK()
{
- AfxGetApp()->WriteProfileInt(_T("Plugins"), _T("UnpackDontCheckExtension"), m_bNoExtensionCheck);
+ GetOptionsMgr()->SaveOption(OPT_PLUGINS_UNPACK_DONT_CHECK_EXTENSION, m_bNoExtensionCheck);
CTrDialog::OnOK();
}
{
CTrDialog::OnInitDialog();
- m_bNoExtensionCheck = !!AfxGetApp()->GetProfileInt(_T("Plugins"), _T("UnpackDontCheckExtension"), false);
+ m_bNoExtensionCheck = GetOptionsMgr()->GetBool(OPT_PLUGINS_UNPACK_DONT_CHECK_EXTENSION);
prepareListbox();