diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2015-12-31 03:00:00 +0300 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:16:58 +0300 |
commit | 9608215ad8deb58355bae27692669fda067c4f43 (patch) | |
tree | 1227131a3f19bc36e5da4ba11791154d05cc08af /CPP/7zip/UI/FileManager/RegistryUtils.cpp | |
parent | 5de23c1deb52b8be4c43ad9f694c64bbddd0c38a (diff) |
15.1315.13
Diffstat (limited to 'CPP/7zip/UI/FileManager/RegistryUtils.cpp')
-rw-r--r-- | CPP/7zip/UI/FileManager/RegistryUtils.cpp | 97 |
1 files changed, 59 insertions, 38 deletions
diff --git a/CPP/7zip/UI/FileManager/RegistryUtils.cpp b/CPP/7zip/UI/FileManager/RegistryUtils.cpp index 84dada2b..9cc76c36 100644 --- a/CPP/7zip/UI/FileManager/RegistryUtils.cpp +++ b/CPP/7zip/UI/FileManager/RegistryUtils.cpp @@ -18,21 +18,24 @@ static const TCHAR *kCU_FMPath = REG_PATH_7Z TEXT(STRING_PATH_SEPARATOR) TEXT("F // static const TCHAR *kLM_Path = REG_PATH_7Z TEXT(STRING_PATH_SEPARATOR) TEXT("FM"); static const WCHAR *kLangValueName = L"Lang"; + static const WCHAR *kViewer = L"Viewer"; static const WCHAR *kEditor = L"Editor"; static const WCHAR *kDiff = L"Diff"; + static const TCHAR *kShowDots = TEXT("ShowDots"); static const TCHAR *kShowRealFileIcons = TEXT("ShowRealFileIcons"); -static const TCHAR *kShowSystemMenu = TEXT("ShowSystemMenu"); - static const TCHAR *kFullRow = TEXT("FullRow"); static const TCHAR *kShowGrid = TEXT("ShowGrid"); -static const TCHAR *kAlternativeSelection = TEXT("AlternativeSelection"); -// static const TCHAR *kLockMemoryAdd = TEXT("LockMemoryAdd"); -static const TCHAR *kLargePagesEnable = TEXT("LargePages"); static const TCHAR *kSingleClick = TEXT("SingleClick"); +static const TCHAR *kAlternativeSelection = TEXT("AlternativeSelection"); // static const TCHAR *kUnderline = TEXT("Underline"); +static const TCHAR *kShowSystemMenu = TEXT("ShowSystemMenu"); + +// static const TCHAR *kLockMemoryAdd = TEXT("LockMemoryAdd"); +static const TCHAR *kLargePages = TEXT("LargePages"); + static const TCHAR *kFlatViewName = TEXT("FlatViewArc"); // static const TCHAR *kShowDeletedFiles = TEXT("ShowDeleted"); @@ -86,16 +89,11 @@ static bool Read7ZipOption(const TCHAR *value, bool defaultValue) return defaultValue; } -static bool ReadOption(const TCHAR *value, bool defaultValue) +static void ReadOption(CKey &key, const TCHAR *value, bool &dest) { - CKey key; - if (key.Open(HKEY_CURRENT_USER, kCU_FMPath, KEY_READ) == ERROR_SUCCESS) - { - bool enabled; - if (key.QueryValue(value, enabled) == ERROR_SUCCESS) - return enabled; - } - return defaultValue; + bool enabled = false; + if (key.QueryValue(value, enabled) == ERROR_SUCCESS) + dest = enabled; } /* @@ -119,37 +117,52 @@ static bool ReadLmOption(const TCHAR *value, bool defaultValue) } */ -void SaveShowDots(bool showDots) { SaveOption(kShowDots, showDots); } -bool ReadShowDots() { return ReadOption(kShowDots, false); } - -void SaveShowRealFileIcons(bool show) { SaveOption(kShowRealFileIcons, show); } -bool ReadShowRealFileIcons() { return ReadOption(kShowRealFileIcons, false); } - -void Save_ShowSystemMenu(bool show) { SaveOption(kShowSystemMenu, show); } -bool Read_ShowSystemMenu(){ return ReadOption(kShowSystemMenu, false); } - -void SaveFullRow(bool enable) { SaveOption(kFullRow, enable); } -bool ReadFullRow() { return ReadOption(kFullRow, false); } +void CFmSettings::Save() const +{ + SaveOption(kShowDots, ShowDots); + SaveOption(kShowRealFileIcons, ShowRealFileIcons); + SaveOption(kFullRow, FullRow); + SaveOption(kShowGrid, ShowGrid); + SaveOption(kSingleClick, SingleClick); + SaveOption(kAlternativeSelection, AlternativeSelection); + // SaveOption(kUnderline, Underline); + + SaveOption(kShowSystemMenu, ShowSystemMenu); +} -void SaveShowGrid(bool enable) { SaveOption(kShowGrid, enable); } -bool ReadShowGrid(){ return ReadOption(kShowGrid, false); } +void CFmSettings::Load() +{ + ShowDots = false; + ShowRealFileIcons = false; + FullRow = false; + ShowGrid = false; + SingleClick = false; + AlternativeSelection = false; + // Underline = false; -void SaveAlternativeSelection(bool enable) { SaveOption(kAlternativeSelection, enable); } -bool ReadAlternativeSelection(){ return ReadOption(kAlternativeSelection, false); } + ShowSystemMenu = false; -void SaveSingleClick(bool enable) { SaveOption(kSingleClick, enable); } -bool ReadSingleClick(){ return ReadOption(kSingleClick, false); } + CKey key; + if (key.Open(HKEY_CURRENT_USER, kCU_FMPath, KEY_READ) == ERROR_SUCCESS) + { + ReadOption(key, kShowDots, ShowDots); + ReadOption(key, kShowRealFileIcons, ShowRealFileIcons); + ReadOption(key, kFullRow, FullRow); + ReadOption(key, kShowGrid, ShowGrid); + ReadOption(key, kSingleClick, SingleClick); + ReadOption(key, kAlternativeSelection, AlternativeSelection); + // ReadOption(key, kUnderline, Underline); + + ReadOption(key, kShowSystemMenu, ShowSystemMenu ); + } +} -/* -void SaveUnderline(bool enable) { SaveOption(kUnderline, enable); } -bool ReadUnderline(){ return ReadOption(kUnderline, false); } -*/ // void SaveLockMemoryAdd(bool enable) { SaveLmOption(kLockMemoryAdd, enable); } // bool ReadLockMemoryAdd() { return ReadLmOption(kLockMemoryAdd, true); } -void SaveLockMemoryEnable(bool enable) { Save7ZipOption(kLargePagesEnable, enable); } -bool ReadLockMemoryEnable() { return Read7ZipOption(kLargePagesEnable, false); } +void SaveLockMemoryEnable(bool enable) { Save7ZipOption(kLargePages, enable); } +bool ReadLockMemoryEnable() { return Read7ZipOption(kLargePages, false); } static CSysString GetFlatViewName(UInt32 panelIndex) { @@ -159,7 +172,15 @@ static CSysString GetFlatViewName(UInt32 panelIndex) } void SaveFlatView(UInt32 panelIndex, bool enable) { SaveOption(GetFlatViewName(panelIndex), enable); } -bool ReadFlatView(UInt32 panelIndex) { return ReadOption(GetFlatViewName(panelIndex), false); } + +bool ReadFlatView(UInt32 panelIndex) +{ + bool enabled = false; + CKey key; + if (key.Open(HKEY_CURRENT_USER, kCU_FMPath, KEY_READ) == ERROR_SUCCESS) + ReadOption(key, GetFlatViewName(panelIndex), enabled); + return enabled; +} /* void Save_ShowDeleted(bool enable) { SaveOption(kShowDeletedFiles, enable); } |