#include "pch.h"
#include <vector>
+#include <typeinfo>
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include "RegOptionsMgr.h"
+#include "OptionsCustomColors.h"
#include "OptionsDiffOptions.h"
#include "OptionsDiffColors.h"
+#include "OptionsDirColors.h"
+#include "OptionsEditorSyntax.h"
#include "OptionsFont.h"
#include "DiffWrapper.h" // CMP_CONTENT
#include "paths.h"
#include "Constants.h"
// Functions to copy values set by installer from HKLM to HKCU.
-static void CopyHKLMValues();
static bool OpenHKLM(HKEY *key, LPCTSTR relpath = nullptr);
static bool OpenHKCU(HKEY *key, LPCTSTR relpath = nullptr);
static void CopyFromLMtoCU(HKEY lmKey, HKEY cuKey, LPCTSTR valname);
*/
void Init(COptionsMgr *pOptions)
{
- // Copy some values from HKLM to HKCU
- CopyHKLMValues();
-
- static_cast<CRegOptionsMgr *>(pOptions)->SetRegRootKey(_T("Thingamahoochie\\WinMerge\\"));
-
- LANGID LangId = GetUserDefaultLangID();
- if (PRIMARYLANGID(LangId) == LANG_JAPANESE)
+ if (typeid(*pOptions) == typeid(CRegOptionsMgr))
{
- // Default language to Japanese unless installer set it otherwise
- pOptions->InitOption(OPT_SELECTED_LANGUAGE, 0x411);
- }
- else
- {
- // Default language to English unless installer set it otherwise
- pOptions->InitOption(OPT_SELECTED_LANGUAGE, 0x409);
+ static_cast<CRegOptionsMgr*>(pOptions)->SetRegRootKey(_T("Thingamahoochie\\WinMerge\\"));
}
+ LANGID LangId = GetUserDefaultLangID();
+ pOptions->InitOption(OPT_SELECTED_LANGUAGE, static_cast<int>(LangId));
+
// Initialise options (name, default value)
pOptions->InitOption(OPT_SHOW_UNIQUE_LEFT, true);
pOptions->InitOption(OPT_SHOW_UNIQUE_MIDDLE, true);
pOptions->InitOption(OPT_SHOW_DIFFERENT_LEFT_ONLY, true);
pOptions->InitOption(OPT_SHOW_DIFFERENT_MIDDLE_ONLY, true);
pOptions->InitOption(OPT_SHOW_DIFFERENT_RIGHT_ONLY, true);
+ pOptions->InitOption(OPT_SHOW_MISSING_LEFT_ONLY, true);
+ pOptions->InitOption(OPT_SHOW_MISSING_MIDDLE_ONLY, true);
+ pOptions->InitOption(OPT_SHOW_MISSING_RIGHT_ONLY, true);
pOptions->InitOption(OPT_SHOW_TOOLBAR, true);
pOptions->InitOption(OPT_SHOW_STATUSBAR, true);
pOptions->InitOption(OPT_SHOW_TABBAR, true);
- pOptions->InitOption(OPT_TOOLBAR_SIZE, GetSystemMetrics(SM_CXSMICON) < 24 ? 0 : 1);
+ pOptions->InitOption(OPT_TOOLBAR_SIZE, 0);
pOptions->InitOption(OPT_RESIZE_PANES, false);
pOptions->InitOption(OPT_SYNTAX_HIGHLIGHT, true);
pOptions->InitOption(OPT_WORDWRAP, false);
pOptions->InitOption(OPT_VIEW_LINENUMBERS, false);
pOptions->InitOption(OPT_VIEW_WHITESPACE, false);
- pOptions->InitOption(OPT_CONNECT_MOVED_BLOCKS, 0);
+ pOptions->InitOption(OPT_VIEW_EOL, false);
pOptions->InitOption(OPT_SCROLL_TO_FIRST, false);
+ pOptions->InitOption(OPT_SCROLL_TO_FIRST_INLINE_DIFF, false);
pOptions->InitOption(OPT_VERIFY_OPEN_PATHS, true);
pOptions->InitOption(OPT_AUTO_COMPLETE_SOURCE, (int)1);
pOptions->InitOption(OPT_VIEW_FILEMARGIN, false);
pOptions->InitOption(OPT_DIFF_CONTEXT, (int)-1);
+ pOptions->InitOption(OPT_INVERT_DIFF_CONTEXT, false);
pOptions->InitOption(OPT_SPLIT_HORIZONTALLY, false);
+ pOptions->InitOption(OPT_RENDERING_MODE, -1);
+ pOptions->InitOption(OPT_FILE_SIZE_THRESHOLD, 64*1024*1024);
pOptions->InitOption(OPT_WORDDIFF_HIGHLIGHT, true);
- pOptions->InitOption(OPT_BREAK_SEPARATORS, _T(".,:;?[](){}<>`'!\"#$%&^~\\|@+-*/"));
+ pOptions->InitOption(OPT_BREAK_SEPARATORS, _T(".,:;?[](){}<=>`'!\"#$%&^~\\|@+-*/"));
pOptions->InitOption(OPT_BACKUP_FOLDERCMP, false);
pOptions->InitOption(OPT_BACKUP_FILECMP, true);
pOptions->InitOption(OPT_DIRVIEW_SORT_ASCENDING, true);
pOptions->InitOption(OPT_SHOW_SELECT_FILES_AT_STARTUP, false);
pOptions->InitOption(OPT_DIRVIEW_EXPAND_SUBDIRS, false);
+ pOptions->InitOption(OPT_DIRVIEW_COLUMN_ORDERS, _T(""));
+ pOptions->InitOption(OPT_DIRVIEW_COLUMN_WIDTHS, _T(""));
+ pOptions->InitOption(OPT_DIRVIEW3_COLUMN_ORDERS, _T(""));
+ pOptions->InitOption(OPT_DIRVIEW3_COLUMN_WIDTHS, _T(""));
pOptions->InitOption(OPT_REPORTFILES_REPORTTYPE, 0);
pOptions->InitOption(OPT_REPORTFILES_COPYTOCLIPBOARD, false);
pOptions->InitOption(OPT_AUTOMATIC_RESCAN, false);
pOptions->InitOption(OPT_ALLOW_MIXED_EOL, false);
+ pOptions->InitOption(OPT_COPY_FULL_LINE, false);
pOptions->InitOption(OPT_TAB_SIZE, (int)4);
pOptions->InitOption(OPT_TAB_TYPE, (int)0); // 0 means tabs inserted
- pOptions->InitOption(OPT_EXT_EDITOR_CMD, paths::ConcatPath(env::GetWindowsDirectory(), _T("NOTEPAD.EXE")));
+ pOptions->InitOption(OPT_EXT_EDITOR_CMD, _T("%windir%\\NOTEPAD.EXE"));
pOptions->InitOption(OPT_USE_RECYCLE_BIN, true);
- pOptions->InitOption(OPT_SINGLE_INSTANCE, false);
+ pOptions->InitOption(OPT_SINGLE_INSTANCE, 0);
pOptions->InitOption(OPT_MERGE_MODE, false);
// OPT_WORDDIFF_HIGHLIGHT is initialized above
pOptions->InitOption(OPT_BREAK_ON_WORDS, false);
pOptions->InitOption(OPT_BREAK_TYPE, 1);
- pOptions->InitOption(OPT_CLOSE_WITH_ESC, true);
+ pOptions->InitOption(OPT_CLOSE_WITH_ESC, 1);
pOptions->InitOption(OPT_CLOSE_WITH_OK, false);
pOptions->InitOption(OPT_IGNORE_SMALL_FILETIME, false);
pOptions->InitOption(OPT_ASK_MULTIWINDOW_CLOSE, false);
pOptions->InitOption(OPT_CMP_MATCH_SIMILAR_LINES, false);
pOptions->InitOption(OPT_CMP_STOP_AFTER_FIRST, false);
pOptions->InitOption(OPT_CMP_QUICK_LIMIT, 4 * 1024 * 1024); // 4 Megs
+ pOptions->InitOption(OPT_CMP_BINARY_LIMIT, 64 * 1024 * 1024); // 64 Megs
pOptions->InitOption(OPT_CMP_COMPARE_THREADS, -1);
- pOptions->InitOption(OPT_CMP_WALK_UNIQUE_DIRS, false);
+ pOptions->InitOption(OPT_CMP_WALK_UNIQUE_DIRS, true);
pOptions->InitOption(OPT_CMP_IGNORE_REPARSE_POINTS, false);
- pOptions->InitOption(OPT_CMP_IGNORE_CODEPAGE, true);
+ pOptions->InitOption(OPT_CMP_IGNORE_CODEPAGE, false);
pOptions->InitOption(OPT_CMP_INCLUDE_SUBDIRS, true);
+ pOptions->InitOption(OPT_CMP_ENABLE_IMGCMP_IN_DIRCMP, false);
pOptions->InitOption(OPT_CMP_BIN_FILEPATTERNS, _T("*.bin;*.frx"));
+ pOptions->InitOption(OPT_CMP_CSV_FILEPATTERNS, _T("*.csv"));
+ pOptions->InitOption(OPT_CMP_TSV_FILEPATTERNS, _T("*.tsv"));
+ pOptions->InitOption(OPT_CMP_DSV_FILEPATTERNS, _T(""));
+ pOptions->InitOption(OPT_CMP_DSV_DELIM_CHAR, _T(";"));
+ pOptions->InitOption(OPT_CMP_TBL_ALLOW_NEWLINES_IN_QUOTES, true);
+ pOptions->InitOption(OPT_CMP_TBL_QUOTE_CHAR, _T("\""));
+
pOptions->InitOption(OPT_CMP_IMG_FILEPATTERNS, _T("*.bmp;*.cut;*.dds;*.exr;*.g3;*.gif;*.hdr;*.ico;*.iff;*.lbm;*.j2k;*.j2c;*.jng;*.jp2;*.jpg;*.jif;*.jpeg;*.jpe;*.jxr;*.wdp;*.hdp;*.koa;*.mng;*.pcd;*.pcx;*.pfm;*.pct;*.pict;*.pic;*.png;*.pbm;*.pgm;*.ppm;*.psd;*.ras;*.sgi;*.rgb;*.rgba;*.bw;*.tga;*.targa;*.tif;*.tiff;*.wap;*.wbmp;*.wbm;*.webp;*.xbm;*.xpm"));
pOptions->InitOption(OPT_CMP_IMG_SHOWDIFFERENCES, true);
pOptions->InitOption(OPT_CMP_IMG_OVERLAYMOVE, 0);
pOptions->InitOption(OPT_CMP_IMG_DIFFBLOCKSIZE, 8);
pOptions->InitOption(OPT_CMP_IMG_DIFFCOLORALPHA, 70);
pOptions->InitOption(OPT_CMP_IMG_THRESHOLD, 0);
+ pOptions->InitOption(OPT_CMP_IMG_INSERTIONDELETIONDETECTION_MODE, 0);
+ pOptions->InitOption(OPT_CMP_IMG_VECTOR_IMAGE_ZOOM_RATIO, 1000);
+ pOptions->InitOption(OPT_CMP_IMG_OCR_RESULT_TYPE, 0);
pOptions->InitOption(OPT_PROJECTS_PATH, _T(""));
pOptions->InitOption(OPT_USE_SYSTEM_TEMP_PATH, true);
pOptions->InitOption(OPT_CUSTOM_TEMP_PATH, _T(""));
pOptions->InitOption(OPT_LINEFILTER_ENABLED, false);
+ pOptions->InitOption(OPT_SUBSTITUTION_FILTERS_ENABLED, false);
+
pOptions->InitOption(OPT_FILEFILTER_CURRENT, _T("*.*"));
// CMainFrame initializes this when it is empty.
- pOptions->InitOption(OPT_FILTER_USERPATH, paths::ConcatPath(env::GetMyDocuments(), DefaultRelativeFilterPath));
+ pOptions->InitOption(OPT_FILTER_USERPATH, _T(""));
+ if (pOptions->GetString(OPT_FILTER_USERPATH).empty())
+ pOptions->SaveOption(OPT_FILTER_USERPATH, paths::ConcatPath(env::GetMyDocuments(), DefaultRelativeFilterPath));
pOptions->InitOption(OPT_FILEFILTER_SHARED, false);
pOptions->InitOption(OPT_CP_DEFAULT_MODE, (int)0);
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_PLUGINS_CUSTOM_SETTINGS_LIST, _T(""));
+ pOptions->InitOption(OPT_PLUGINS_UNPACKER_MODE, false);
+ pOptions->InitOption(OPT_PLUGINS_PREDIFFER_MODE, false);
+ pOptions->InitOption(OPT_PLUGINS_UNPACK_DONT_CHECK_EXTENSION, true);
+ pOptions->InitOption(OPT_PLUGINS_OPEN_IN_SAME_FRAME_TYPE, false);
pOptions->InitOption(OPT_PATCHCREATOR_PATCH_STYLE, 0);
pOptions->InitOption(OPT_PATCHCREATOR_CONTEXT_LINES, 0);
pOptions->InitOption(OPT_MRU_MAX, 9);
+ pOptions->InitOption(OPT_COLOR_SCHEME, _T("Default"));
+
+ Options::CustomColors::SetDefaults(pOptions);
Options::DiffOptions::SetDefaults(pOptions);
Options::DiffColors::SetDefaults(pOptions);
+ Options::DirColors::SetDefaults(pOptions);
+ Options::EditorSyntax::SetDefaults(pOptions);
Options::Font::SetDefaults(pOptions);
}
-}
-
/**
* @brief Copy some HKLM values to HKCU.
* The installer sets HKLM values for "all users". This function copies
* few of those values for "user" values. E.g. enabling ShellExtension
* initially for user is done by this function.
*/
-static void CopyHKLMValues()
+void CopyHKLMValues()
{
HKEY LMKey;
HKEY CUKey;
}
}
+}
+
/**
* @brief Open HKLM registry key.
* @param [out] key Pointer to open HKLM key.