Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/elfmz/far2l.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelfmz <fenix1905@tut.by>2021-12-31 00:27:16 +0300
committerelfmz <fenix1905@tut.by>2021-12-31 02:27:02 +0300
commita14dc1a81c797928d4f1b7d6a6b46ecc63f98308 (patch)
treec27c61ac33582bc4d469c6608cd042add388f230 /far2l/src/cfg
parentd5f1bf245e96834d44390d1723cfef3dfbb1fb02 (diff)
shuffle a bit far2l sources
Diffstat (limited to 'far2l/src/cfg')
-rw-r--r--far2l/src/cfg/ConfigRW.cpp603
-rw-r--r--far2l/src/cfg/ConfigRW.hpp113
-rw-r--r--far2l/src/cfg/HotkeyLetterDialog.cpp41
-rw-r--r--far2l/src/cfg/HotkeyLetterDialog.hpp3
-rw-r--r--far2l/src/cfg/config.cpp1273
-rw-r--r--far2l/src/cfg/config.hpp615
6 files changed, 2648 insertions, 0 deletions
diff --git a/far2l/src/cfg/ConfigRW.cpp b/far2l/src/cfg/ConfigRW.cpp
new file mode 100644
index 00000000..7504ce70
--- /dev/null
+++ b/far2l/src/cfg/ConfigRW.cpp
@@ -0,0 +1,603 @@
+#include "headers.hpp"
+#include "ConfigRW.hpp"
+#include <assert.h>
+#include <errno.h>
+#include <algorithm>
+
+#define CONFIG_INI "settings/config.ini"
+
+static bool IsSectionOrSubsection(const std::string &haystack, const char *needle)
+{
+ size_t l = strlen(needle);
+ if (haystack.size() < l) {
+ return false;
+ }
+ if (memcmp(haystack.c_str(), needle, l) != 0) {
+ return false;
+ }
+ if (haystack.size() > l && haystack[l] != '/') {
+ return false;
+ }
+ return true;
+}
+
+static const char *Section2Ini(const std::string &section)
+{
+ if (IsSectionOrSubsection(section, "KeyMacros"))
+ return "settings/key_macros.ini";
+
+ if (IsSectionOrSubsection(section, "Associations"))
+ return "settings/associations.ini";
+
+ if (IsSectionOrSubsection(section, "Panel"))
+ return "settings/panel.ini";
+
+ if (IsSectionOrSubsection(section, "CodePages"))
+ return "settings/codepages.ini";
+
+ if (IsSectionOrSubsection(section, "XLat"))
+ return "settings/xlat.ini";
+
+ if (IsSectionOrSubsection(section, "Colors")
+ || IsSectionOrSubsection(section, "SortGroups") )
+ return "settings/colors.ini";
+
+ if (IsSectionOrSubsection(section, "UserMenu"))
+ return "settings/user_menu.ini";
+
+ if (IsSectionOrSubsection(section, "SavedDialogHistory"))
+ return "history/dialogs.hst";
+
+ if (IsSectionOrSubsection(section, "SavedHistory"))
+ return "history/commands.hst";
+
+ if (IsSectionOrSubsection(section, "SavedFolderHistory"))
+ return "history/folders.hst";
+
+ if (IsSectionOrSubsection(section, "SavedViewHistory"))
+ return "history/view.hst";
+
+ return CONFIG_INI;
+}
+
+void ConfigSection::SelectSection(const std::string &section)
+{
+ if (_section != section) {
+ _section = section;
+ OnSectionSelected();
+ }
+}
+
+void ConfigSection::SelectSection(const wchar_t *section)
+{
+ SelectSection(Wide2MB(section));
+}
+
+void ConfigSection::SelectSectionFmt(const char *format, ...)
+{
+ va_list args;
+ va_start(args, format);
+ const std::string &section = StrPrintfV(format, args);
+ va_end(args);
+
+ SelectSection(section);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////
+ConfigReader::ConfigReader()
+{
+}
+
+ConfigReader::ConfigReader(const std::string &preselect_section)
+{
+ SelectSection(preselect_section);
+}
+
+struct stat ConfigReader::SavedSectionStat(const std::string &section)
+{
+ struct stat out;
+ if (stat(InMyConfig(Section2Ini(section)).c_str(), &out) == -1) {
+ memset(&out, 0, sizeof(out));
+ }
+ return out;
+}
+
+void ConfigReader::OnSectionSelected()
+{
+ const char *ini = Section2Ini(_section);
+ auto &selected_kfh = _ini2kfh[ini];
+ if (!selected_kfh) {
+ selected_kfh.reset(new KeyFileReadHelper(InMyConfig(ini)));
+ }
+ _selected_kfh = selected_kfh.get();
+ _selected_section_values = _selected_kfh->GetSectionValues(_section);
+
+ if (!_selected_section_values) {
+ _has_section = false;
+ if (!_empty_values) {
+ _empty_values.reset(new KeyFileValues);
+ }
+ _selected_section_values = _empty_values.get();
+
+ } else {
+ _has_section = true;
+ }
+}
+
+std::vector<std::string> ConfigReader::EnumKeys()
+{
+ assert(_selected_section_values != nullptr);
+ return _selected_section_values->EnumKeys();
+}
+
+std::vector<std::string> ConfigReader::EnumSectionsAt()
+{
+ assert(_selected_kfh != nullptr);
+ return _selected_kfh->EnumSectionsAt(_section);
+}
+
+bool ConfigReader::HasKey(const std::string &name) const
+{
+ assert(_selected_section_values != nullptr);
+ return _selected_section_values->HasKey(name);
+}
+
+FARString ConfigReader::GetString(const std::string &name, const wchar_t *def) const
+{
+ assert(_selected_section_values != nullptr);
+ return _selected_section_values->GetString(name, def);
+}
+
+bool ConfigReader::GetString(FARString &out, const std::string &name, const wchar_t *def) const
+{
+ assert(_selected_section_values != nullptr);
+ if (!_selected_section_values->HasKey(name)) {
+ return false;
+ }
+ out = _selected_section_values->GetString(name, def);
+ return true;
+}
+
+bool ConfigReader::GetString(std::string &out, const std::string &name, const char *def) const
+{
+ assert(_selected_section_values != nullptr);
+ if (!_selected_section_values->HasKey(name)) {
+ return false;
+ }
+ out = _selected_section_values->GetString(name, def);
+ return true;
+}
+
+int ConfigReader::GetInt(const std::string &name, int def) const
+{
+ assert(_selected_section_values != nullptr);
+ return _selected_section_values->GetInt(name, def);
+}
+
+unsigned int ConfigReader::GetUInt(const std::string &name, unsigned int def) const
+{
+ assert(_selected_section_values != nullptr);
+ return _selected_section_values->GetUInt(name, def);
+}
+
+unsigned long long ConfigReader::GetULL(const std::string &name, unsigned long long def) const
+{
+ assert(_selected_section_values != nullptr);
+ return _selected_section_values->GetULL(name, def);
+}
+
+size_t ConfigReader::GetBytes(unsigned char *out, size_t len, const std::string &name, const unsigned char *def) const
+{
+ assert(_selected_section_values != nullptr);
+ return _selected_section_values->GetBytes(out, len, name, def);
+}
+
+bool ConfigReader::GetBytes(std::vector<unsigned char> &out, const std::string &name) const
+{
+ assert(_selected_section_values != nullptr);
+ return _selected_section_values->GetBytes(out, name);
+}
+
+////
+ConfigWriter::ConfigWriter()
+{
+}
+
+ConfigWriter::ConfigWriter(const std::string &preselect_section)
+{
+ SelectSection(preselect_section);
+}
+
+bool ConfigWriter::Save()
+{
+ bool out = true;
+
+ for (const auto &it : _ini2kfh) {
+ if (!it.second->Save()) {
+ out = false;
+ }
+ }
+
+ return out;
+}
+
+void ConfigWriter::OnSectionSelected()
+{
+ const char *ini = Section2Ini(_section);
+ auto &selected_kfh = _ini2kfh[ini];
+ if (!selected_kfh) {
+ selected_kfh.reset(new KeyFileHelper(InMyConfig(ini)));
+ }
+ _selected_kfh = selected_kfh.get();
+
+ if (IsSectionOrSubsection(_section, "Colors")) {
+ _bytes_space_interval = 1;
+
+ } else if (IsSectionOrSubsection(_section, "SavedHistory")
+ || IsSectionOrSubsection(_section, "SavedDialogHistory")
+ || IsSectionOrSubsection(_section, "SavedFolderHistory")
+ || IsSectionOrSubsection(_section, "SavedViewHistory")) {
+
+ _bytes_space_interval = sizeof(FILETIME);
+
+ } else {
+ _bytes_space_interval = 0;
+ }
+}
+
+void ConfigWriter::RemoveSection()
+{
+ _selected_kfh->RemoveSectionsAt(_section);
+ _selected_kfh->RemoveSection(_section);
+}
+
+std::vector<std::string> ConfigWriter::EnumIndexedSections(const char *indexed_prefix)
+{
+ std::string saved_section = _section;
+ SelectSectionFmt("%s%lu", indexed_prefix, 0);
+
+ const size_t indexed_prefix_len = strlen(indexed_prefix);
+ std::vector<std::string> sections = _selected_kfh->EnumSections();
+ // exclude sections not prefixed by indexed_prefix
+ // and sections that are nested from prefixed by indexed_prefix
+ for (auto it = sections.begin(); it != sections.end();) {
+ if (it->size() <= indexed_prefix_len
+ || memcmp(it->c_str(), indexed_prefix, indexed_prefix_len) != 0
+ || strchr(it->c_str() + indexed_prefix_len, '/') != nullptr) {
+ it = sections.erase(it);
+ } else {
+ ++it;
+ }
+ }
+
+ std::sort(sections.begin(), sections.end(),
+ [&](const std::string &a, const std::string &b) -> bool {
+ return atoi(a.c_str() + indexed_prefix_len) < atoi(b.c_str() + indexed_prefix_len);
+ });
+
+ if (!saved_section.empty()) {
+ SelectSection(saved_section);
+ }
+ return sections;
+}
+
+void ConfigWriter::DefragIndexedSections(const char *indexed_prefix)
+{
+ std::string saved_section = _section;
+ SelectSectionFmt("%s%lu", indexed_prefix, 0);
+
+ std::vector<std::string> sections = EnumIndexedSections(indexed_prefix);
+
+ for (size_t i = 0; i < sections.size(); ++i) {
+ const std::string &expected_section = StrPrintf("%s%lu", indexed_prefix, (unsigned long)i);
+ if (sections[i] != expected_section) {
+ _selected_kfh->RenameSection(sections[i], expected_section, true);
+ if (_section == sections[i]) {
+ _section = expected_section;
+ }
+ }
+ }
+
+ if (!saved_section.empty()) {
+ SelectSection(saved_section);
+ }
+}
+
+void ConfigWriter::ReserveIndexedSection(const char *indexed_prefix, unsigned int index)
+{
+ DefragIndexedSections(indexed_prefix);
+
+ std::vector<std::string> sections = EnumIndexedSections(indexed_prefix);
+
+ for (size_t i = sections.size(); i > index;) {
+ const std::string &new_name = StrPrintf("%s%lu", indexed_prefix, (unsigned long)i);
+ --i;
+ const std::string &old_name = StrPrintf("%s%lu", indexed_prefix, (unsigned long)i);
+ _selected_kfh->RenameSection(old_name, new_name, true);
+ }
+}
+
+void ConfigWriter::MoveIndexedSection(const char *indexed_prefix, unsigned int old_index, unsigned int new_index)
+{
+ if (old_index == new_index) {
+ return;
+ }
+
+ const std::string &old_section_tmp = StrPrintf("%s%u.tmp-%llx",
+ indexed_prefix, old_index, (unsigned long long)time(NULL));
+
+ SelectSection(old_section_tmp);
+
+ _selected_kfh->RenameSection(
+ StrPrintf("%s%u", indexed_prefix, old_index),
+ old_section_tmp,
+ true);
+
+ if (old_index < new_index) {
+ // rename [old_index + 1, new_index] -> [old_index, new_index - 1]
+ for (unsigned int i = old_index + 1; i <= new_index; ++i) {
+ _selected_kfh->RenameSection(
+ StrPrintf("%s%u", indexed_prefix, i),
+ StrPrintf("%s%u", indexed_prefix, i - 1),
+ true);
+ }
+ } else {
+ // rename [new_index, old_index - 1] -> [new_index + 1, old_index]
+ for (unsigned int i = old_index; i > new_index; --i) {
+ _selected_kfh->RenameSection(
+ StrPrintf("%s%u", indexed_prefix, i - 1),
+ StrPrintf("%s%u", indexed_prefix, i),
+ true);
+ }
+ }
+
+ _selected_kfh->RenameSection(
+ old_section_tmp,
+ StrPrintf("%s%u", indexed_prefix, new_index),
+ true);
+
+ DefragIndexedSections(indexed_prefix);
+}
+
+
+void ConfigWriter::SetString(const std::string &name, const wchar_t *value)
+{
+ _selected_kfh->SetString(_section, name, value);
+}
+
+void ConfigWriter::SetString(const std::string &name, const std::string &value)
+{
+ _selected_kfh->SetString(_section, name, value);
+}
+
+void ConfigWriter::SetInt(const std::string &name, int value)
+{
+ _selected_kfh->SetInt(_section, name, value);
+}
+
+void ConfigWriter::SetUInt(const std::string &name, unsigned int value)
+{
+ _selected_kfh->SetUInt(_section, name, value);
+}
+
+void ConfigWriter::SetULL(const std::string &name, unsigned long long value)
+{
+ _selected_kfh->SetULL(_section, name, value);
+}
+
+void ConfigWriter::SetBytes(const std::string &name, const unsigned char *buf, size_t len)
+{
+ _selected_kfh->SetBytes(_section, name, buf, len, _bytes_space_interval);
+}
+
+void ConfigWriter::RemoveKey(const std::string &name)
+{
+ _selected_kfh->RemoveKey(_section, name);
+}
+
+//////////////////////////////////////////////////////////////////////////////////////
+#ifdef WINPORT_REGISTRY
+static bool ShouldImportRegSettings(const std::string &virtual_path)
+{
+
+ return (
+ // dont care about legacy Plugins settings
+ virtual_path != "Plugins"
+
+ // skip stuff that goes to plugins/state.ini
+ && virtual_path != "PluginHotkeys"
+ && virtual_path != "PluginsCache"
+
+ // skip abandoned poscache entires
+ && virtual_path != "Viewer/LastPositions"
+ && virtual_path != "Editor/LastPositions"
+
+ // separately handled by BookmarksLegacy.cpp
+ && virtual_path != "FolderShortcuts"
+ );
+}
+
+static void ConfigUgrade_RegKey(FILE *lf, ConfigWriter &cfg_writer, HKEY root, const wchar_t *subpath, const std::string &virtual_path)
+{
+ HKEY key = 0;
+ LONG r = WINPORT(RegOpenKeyEx)(root, subpath, 0, GENERIC_READ, &key);
+ std::string virtual_subpath;
+ if (r == ERROR_SUCCESS) {
+ std::vector<wchar_t> namebuf(0x400);
+ for (DWORD i = 0; ;++i) {
+ r = WINPORT(RegEnumKey)(key, i, &namebuf[0], namebuf.size() - 1);
+ if (r != ERROR_SUCCESS) break;
+ virtual_subpath = virtual_path;
+ if (!virtual_subpath.empty()) {
+ virtual_subpath+= '/';
+ }
+ virtual_subpath+= Wide2MB(&namebuf[0]);
+ if (ShouldImportRegSettings(virtual_subpath)) {
+ fprintf(lf, "%s: RECURSE '%s'\n", __FUNCTION__, virtual_subpath.c_str());
+ ConfigUgrade_RegKey(lf, cfg_writer, key, &namebuf[0], virtual_subpath);
+ } else {
+ fprintf(lf, "%s: SKIP '%s'\n", __FUNCTION__, virtual_subpath.c_str());
+ }
+ }
+
+ fprintf(lf, "%s: ENUM '%s'\n", __FUNCTION__, virtual_path.c_str());
+ cfg_writer.SelectSection(virtual_path);
+ const bool macro_type_prefix =
+ (virtual_path == "KeyMacros/Vars" || virtual_path == "KeyMacros/Consts");
+
+ std::vector<BYTE> databuf(0x400);
+ for (DWORD i = 0; ;) {
+ DWORD namelen = namebuf.size() - 1;
+ DWORD datalen = databuf.size();
+ DWORD tip = 0;
+ r = WINPORT(RegEnumValue)(key, i,
+ &namebuf[0], &namelen, NULL, &tip, &databuf[0], &datalen);
+ if (r != ERROR_SUCCESS) {
+ if (r != ERROR_MORE_DATA) {
+ break;
+ }
+ namebuf.resize(namebuf.size() + 0x400);
+ databuf.resize(databuf.size() + 0x400);
+
+ } else {
+ fprintf(lf, "%s: SET [%s] '%ls' TYPE=%u DATA={",
+ __FUNCTION__, virtual_path.c_str(), &namebuf[0], tip);
+ for (size_t j = 0; j < datalen; ++j) {
+ fprintf(lf, "%02x ", (unsigned int)databuf[j]);
+ }
+ fprintf(lf, "}\n");
+
+ std::string name(Wide2MB(&namebuf[0]));
+ FARString tmp_str;
+ switch (tip) {
+ case REG_DWORD: {
+ if (macro_type_prefix) {
+ tmp_str.Format(L"INT:%ld", (long)*(int32_t *)&databuf[0]);
+ cfg_writer.SetString(name, tmp_str);
+ } else {
+ cfg_writer.SetUInt(name, (unsigned int)*(uint32_t *)&databuf[0]);
+ }
+ } break;
+ case REG_QWORD: {
+ if (macro_type_prefix) {
+ tmp_str.Format(L"INT:%lld", (long long)*(int64_t *)&databuf[0]);
+ cfg_writer.SetString(name, tmp_str);
+ } else {
+ cfg_writer.SetULL(name, *(uint64_t *)&databuf[0]);
+ }
+ } break;
+ case REG_SZ: case REG_EXPAND_SZ: case REG_MULTI_SZ: {
+ if (macro_type_prefix) {
+ tmp_str = L"STR:";
+ }
+ for (size_t i = 0; i + sizeof(WCHAR) <= datalen ; i+= sizeof(WCHAR)) {
+ WCHAR wc = *(const WCHAR *)&databuf[i];
+ if (!wc) {
+ if (i + sizeof(WCHAR) >= datalen) {
+ break;
+ }
+ // REG_MULTI_SZ was used only in macroses and history.
+ // Macroses did inter-strings zeroes translated to \n.
+ // Now macroses code doesn't do that translation, just need
+ // to one time translate data imported from legacy registry.
+ // History code now also uses '\n' chars as string separators.
+ if (tip == REG_MULTI_SZ) {
+ if (i + 2 * sizeof(WCHAR) >= datalen) {
+ // skip last string terminator translation
+ break;
+ }
+ tmp_str+= L'\n';
+ } else {
+ tmp_str.Append(wc);
+ }
+ } else {
+ tmp_str.Append(wc);
+ }
+ }
+ cfg_writer.SetString(name, tmp_str);
+ } break;
+
+ default:
+ cfg_writer.SetBytes(name, &databuf[0], datalen);
+ }
+ ++i;
+ }
+ }
+ WINPORT(RegCloseKey)(key);
+ }
+}
+
+static void Upgrade_MoveFile(FILE *lf, const char *src, const char *dst)
+{
+ const std::string &str_src = InMyConfig(src);
+ const std::string &str_dst = InMyConfig(dst);
+ int r = rename(str_src.c_str(), str_dst.c_str());
+ if (r == 0) {
+ fprintf(lf, "%s('%s', '%s') - DONE\n", __FUNCTION__, str_src.c_str(), str_dst.c_str());
+ } else {
+ fprintf(lf, "%s('%s', '%s') - ERROR=%d\n", __FUNCTION__, str_src.c_str(), str_dst.c_str(), errno);
+ }
+}
+
+void CheckForConfigUpgrade()
+{
+ const std::string &cfg_ini = InMyConfig(CONFIG_INI);
+ struct stat s{};
+ if (stat(cfg_ini.c_str(), &s) == -1) {
+ FILE *lf = fopen(InMyCache("upgrade.log").c_str(), "a");
+ if (!lf) {
+ lf = stderr;
+ }
+ try {
+ const std::string sh_log = InMyCache("upgrade.sh.log");
+ int r = system(StrPrintf("date >>\"%s\" 2>&1", sh_log.c_str()).c_str());
+ if (r != 0) {
+ perror("system(date)");
+ }
+
+ time_t now = time(NULL);
+ fprintf(lf, "---- Upgrade started on %s\n", ctime(&now));
+ ConfigWriter cfg_writer;
+ ConfigUgrade_RegKey(lf, cfg_writer, HKEY_CURRENT_USER, L"Software/Far2", "");
+ Upgrade_MoveFile(lf, "bookmarks.ini", "settings/bookmarks.ini");
+ Upgrade_MoveFile(lf, "plugins.ini", "plugins/state.ini");
+ Upgrade_MoveFile(lf, "viewer.pos", "history/viewer.pos");
+ Upgrade_MoveFile(lf, "editor.pos", "history/editor.pos");
+
+ const std::string &cmd = StrPrintf(
+ "mv -f \"%s\" \"%s\" >>\"%s\" 2>&1 || cp -f -r \"%s\" \"%s\" >>\"%s\" 2>&1",
+ InMyConfig("NetRocks").c_str(),
+ InMyConfig("plugins/").c_str(),
+ sh_log.c_str(),
+ InMyConfig("NetRocks").c_str(),
+ InMyConfig("plugins/").c_str(),
+ sh_log.c_str() );
+
+ r = system(cmd.c_str());
+ if (r != 0) {
+ fprintf(stderr, "%s: ERROR=%d CMD='%s'\n", __FUNCTION__, r, cmd.c_str());
+ fprintf(lf, "%s: ERROR=%d CMD='%s'\n", __FUNCTION__, r, cmd.c_str());
+ } else {
+ fprintf(lf, "%s: DONE CMD='%s'\n", __FUNCTION__, cmd.c_str());
+ }
+
+ now = time(NULL);
+ cfg_writer.SelectSection("Upgrade");
+ cfg_writer.SetULL("UpgradedOn", (unsigned long long)now);
+ fprintf(lf, "---- Upgrade finished on %s\n", ctime(&now));
+
+ } catch (std::exception &e) {
+ fprintf(stderr, "%s: EXCEPTION: %s\n", __FUNCTION__, e.what());
+ fprintf(lf, "%s: EXCEPTION: %s\n", __FUNCTION__, e.what());
+ }
+ if (lf != stderr) {
+ fclose(lf);
+ }
+ }
+}
+
+#else // WINPORT_REGISTRY
+
+void CheckForConfigUpgrade() { }
+
+#endif // WINPORT_REGISTRY
diff --git a/far2l/src/cfg/ConfigRW.hpp b/far2l/src/cfg/ConfigRW.hpp
new file mode 100644
index 00000000..376210f9
--- /dev/null
+++ b/far2l/src/cfg/ConfigRW.hpp
@@ -0,0 +1,113 @@
+#pragma once
+#include <KeyFileHelper.h>
+#include <memory>
+
+#include "FARString.hpp"
+
+class ConfigSection
+{
+protected:
+ std::string _section;
+ virtual void OnSectionSelected() {}
+
+public:
+ virtual ~ConfigSection() {}
+
+ void SelectSection(const std::string &section);
+ void SelectSection(const wchar_t *section);
+ void SelectSectionFmt(const char *format, ...);
+};
+
+class ConfigReader : public ConfigSection
+{
+ std::map<std::string, std::unique_ptr<KeyFileReadHelper> > _ini2kfh;
+ std::unique_ptr<KeyFileValues> _empty_values;
+ KeyFileReadHelper *_selected_kfh = nullptr;
+ const KeyFileValues *_selected_section_values = nullptr;
+ bool _has_section;
+
+ virtual void OnSectionSelected();
+
+public:
+ ConfigReader();
+ ConfigReader(const std::string &section);
+
+ static struct stat SavedSectionStat(const std::string &section);
+ inline const struct stat &LoadedSectionStat() const { return _selected_kfh->LoadedFileStat(); }
+
+ std::vector<std::string> EnumKeys();
+ std::vector<std::string> EnumSectionsAt();
+ inline bool HasSection() const { return _has_section; };
+ bool HasKey(const std::string &name) const;
+ FARString GetString(const std::string &name, const wchar_t *def = L"") const;
+ bool GetString(FARString &out, const std::string &name, const wchar_t *def) const;
+ bool GetString(std::string &out, const std::string &name, const char *def) const;
+ int GetInt(const std::string &name, int def = 0) const;
+ unsigned int GetUInt(const std::string &name, unsigned int def = 0) const;
+ unsigned long long GetULL(const std::string &name, unsigned long long def = 0) const;
+ size_t GetBytes(unsigned char *out, size_t len, const std::string &name, const unsigned char *def = nullptr) const;
+ bool GetBytes(std::vector<unsigned char> &out, const std::string &name) const;
+ template <class POD> void GetPOD(const std::string &name, POD &pod)
+ { GetBytes((unsigned char *)&pod, sizeof(pod), name); }
+};
+
+class ConfigWriter : public ConfigSection
+{
+ std::map<std::string, std::unique_ptr<KeyFileHelper> > _ini2kfh;
+ KeyFileHelper *_selected_kfh = nullptr;
+ size_t _bytes_space_interval = 0;
+
+ virtual void OnSectionSelected();
+
+ std::vector<std::string> EnumIndexedSections(const char *indexed_prefix);
+
+public:
+ ConfigWriter();
+ ConfigWriter(const std::string &preselect_section);
+
+ bool Save();
+
+ void RemoveSection();
+
+ void DefragIndexedSections(const char *indexed_prefix);
+ void MoveIndexedSection(const char *indexed_prefix, unsigned int old_index, unsigned int new_index);
+ void ReserveIndexedSection(const char *indexed_prefix, unsigned int index);
+
+ void SetString(const std::string &name, const wchar_t *value);
+ void SetString(const std::string &name, const std::string &value);
+ void SetInt(const std::string &name, int value);
+ void SetUInt(const std::string &name, unsigned int value);
+ void SetULL(const std::string &name, unsigned long long value);
+ void SetBytes(const std::string &name, const unsigned char *buf, size_t len);
+ template <class POD> void SetPOD(const std::string &name, const POD &pod)
+ { SetBytes(name, (const unsigned char *)&pod, sizeof(pod)); }
+ void RemoveKey(const std::string &name);
+};
+
+void CheckForConfigUpgrade();
+
+class ConfigReaderScope
+{
+ std::unique_ptr<ConfigReader> &_cfg_reader;
+
+public:
+ ConfigReaderScope(std::unique_ptr<ConfigReader> &cfg_reader)
+ : _cfg_reader(cfg_reader)
+ {
+ _cfg_reader.reset(new ConfigReader);
+ }
+
+ ~ConfigReaderScope()
+ {
+ _cfg_reader.reset();
+ }
+
+ static void Update(std::unique_ptr<ConfigReader> &cfg_reader)
+ {
+ if (cfg_reader) {
+ cfg_reader.reset();
+ cfg_reader.reset(new ConfigReader);
+ }
+ }
+};
+
diff --git a/far2l/src/cfg/HotkeyLetterDialog.cpp b/far2l/src/cfg/HotkeyLetterDialog.cpp
new file mode 100644
index 00000000..eee36016
--- /dev/null
+++ b/far2l/src/cfg/HotkeyLetterDialog.cpp
@@ -0,0 +1,41 @@
+#include "headers.hpp"
+#include "dialog.hpp"
+#include "lang.hpp"
+#include "language.hpp"
+#include "strmix.hpp"
+
+#include "HotkeyLetterDialog.hpp"
+
+bool HotkeyLetterDialog(const wchar_t *Title, const wchar_t *Object, wchar_t &Letter)
+{
+ /*
+ г================ Assign plugin hot key =================¬
+ ¦ Enter hot key (letter or digit) ¦
+ ¦ _ ¦
+ L========================================================-
+ */
+ DialogDataEx HkDlgData[]=
+ {
+ {DI_DOUBLEBOX,3,1,60,4,{},0,Title},
+ {DI_TEXT,5,2,0,2,{},0,MSG(MHelpHotKey)},
+ {DI_FIXEDIT,5,3,5,3,{},DIF_FOCUS|DIF_DEFAULT,L""},
+ {DI_TEXT,8,3,58,3,{},0,Object}
+ };
+ MakeDialogItemsEx(HkDlgData, HkDlg);
+ if (Letter) {
+ HkDlg[2].strData = Letter;
+ }
+
+ {
+ Dialog Dlg(HkDlg, ARRAYSIZE(HkDlg));
+ Dlg.SetPosition(-1,-1,64,6);
+ Dlg.Process();
+ int ExitCode = Dlg.GetExitCode();
+ if (ExitCode != 2)
+ return false;
+ }
+
+ RemoveLeadingSpaces(HkDlg[2].strData);
+ Letter = HkDlg[2].strData.IsEmpty() ? 0 : *HkDlg[2].strData.CPtr();
+ return true;
+}
diff --git a/far2l/src/cfg/HotkeyLetterDialog.hpp b/far2l/src/cfg/HotkeyLetterDialog.hpp
new file mode 100644
index 00000000..3ef9df72
--- /dev/null
+++ b/far2l/src/cfg/HotkeyLetterDialog.hpp
@@ -0,0 +1,3 @@
+#pragma once
+
+bool HotkeyLetterDialog(const wchar_t *Title, const wchar_t *Object, wchar_t &Letter);
diff --git a/far2l/src/cfg/config.cpp b/far2l/src/cfg/config.cpp
new file mode 100644
index 00000000..daedcac4
--- /dev/null
+++ b/far2l/src/cfg/config.cpp
@@ -0,0 +1,1273 @@
+/*
+config.cpp
+
+Конфигурация
+*/
+/*
+Copyright (c) 1996 Eugene Roshal
+Copyright (c) 2000 Far Group
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the authors may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "headers.hpp"
+
+
+#include "config.hpp"
+#include "lang.hpp"
+#include "keys.hpp"
+#include "colors.hpp"
+#include "cmdline.hpp"
+#include "ctrlobj.hpp"
+#include "dialog.hpp"
+#include "filepanels.hpp"
+#include "filelist.hpp"
+#include "panel.hpp"
+#include "help.hpp"
+#include "filefilter.hpp"
+#include "poscache.hpp"
+#include "findfile.hpp"
+#include "hilight.hpp"
+#include "interf.hpp"
+#include "keyboard.hpp"
+#include "palette.hpp"
+#include "message.hpp"
+#include "stddlg.hpp"
+#include "pathmix.hpp"
+#include "dirmix.hpp"
+#include "panelmix.hpp"
+#include "strmix.hpp"
+#include "udlist.hpp"
+#include "datetime.hpp"
+#include "FarDlgBuilder.hpp"
+#include "vtshell.h"
+#include "ConfigRW.hpp"
+
+Options Opt={0};
+
+// Стандартный набор разделителей
+static const wchar_t *WordDiv0 = L"~!%^&*()+|{}:\"<>?`-=\\[];',./";
+
+// Стандартный набор разделителей для функции Xlat
+static const wchar_t *WordDivForXlat0=L" \t!#$%^&*()+|=\\/@?";
+
+FARString strKeyNameConsoleDetachKey;
+static const wchar_t szCtrlDot[]=L"Ctrl.";
+static const wchar_t szCtrlShiftDot[]=L"CtrlShift.";
+
+// KeyName
+static const char NKeyColors[]="Colors";
+static const char NKeyScreen[]="Screen";
+static const char NKeyCmdline[]="Cmdline";
+static const char NKeyInterface[]="Interface";
+static const char NKeyInterfaceCompletion[]="Interface/Completion";
+static const char NKeyViewer[]="Viewer";
+static const char NKeyDialog[]="Dialog";
+static const char NKeyEditor[]="Editor";
+static const char NKeyNotifications[]="Notifications";
+static const char NKeyXLat[]="XLat";
+static const char NKeySystem[]="System";
+static const char NKeySystemExecutor[]="System/Executor";
+static const char NKeySystemNowell[]="System/Nowell";
+static const char NKeyHelp[]="Help";
+static const char NKeyLanguage[]="Language";
+static const char NKeyConfirmations[]="Confirmations";
+static const char NKeyPluginConfirmations[]="PluginConfirmations";
+static const char NKeyPanel[]="Panel";
+static const char NKeyPanelLeft[]="Panel/Left";
+static const char NKeyPanelRight[]="Panel/Right";
+static const char NKeyPanelLayout[]="Panel/Layout";
+static const char NKeyPanelTree[]="Panel/Tree";
+static const char NKeyLayout[]="Layout";
+static const char NKeyDescriptions[]="Descriptions";
+static const char NKeyKeyMacros[]="KeyMacros";
+static const char NKeyPolicies[]="Policies";
+static const char NKeySavedHistory[]="SavedHistory";
+static const char NKeySavedViewHistory[]="SavedViewHistory";
+static const char NKeySavedFolderHistory[]="SavedFolderHistory";
+static const char NKeySavedDialogHistory[]="SavedDialogHistory";
+static const char NKeyCodePages[]="CodePages";
+static const char NParamHistoryCount[]="HistoryCount";
+static const char NKeyVMenu[]="VMenu";
+
+static const wchar_t *constBatchExt=L".BAT;.CMD;";
+
+static DWORD ApplyConsoleTweaks()
+{
+ DWORD tweaks = 0;
+ if (Opt.ExclusiveCtrlLeft) tweaks|= EXCLUSIVE_CTRL_LEFT;
+ if (Opt.ExclusiveCtrlRight) tweaks|= EXCLUSIVE_CTRL_RIGHT;
+ if (Opt.ExclusiveAltLeft) tweaks|= EXCLUSIVE_ALT_LEFT;
+ if (Opt.ExclusiveAltRight) tweaks|= EXCLUSIVE_ALT_RIGHT;
+ if (Opt.ExclusiveWinLeft) tweaks|= EXCLUSIVE_WIN_LEFT;
+ if (Opt.ExclusiveWinRight) tweaks|= EXCLUSIVE_WIN_RIGHT;
+ if (Opt.ConsolePaintSharp) tweaks|= CONSOLE_PAINT_SHARP;
+ return WINPORT(SetConsoleTweaks)(tweaks);
+}
+
+static void ApplySudoConfiguration()
+{
+ const std::string &sudo_app = GetHelperPathName("far2l_sudoapp");
+ const std::string &askpass_app = GetHelperPathName("far2l_askpass");
+
+ SudoClientMode mode;
+ if (Opt.SudoEnabled) {
+ mode = Opt.SudoConfirmModify ? SCM_CONFIRM_MODIFY : SCM_CONFIRM_NONE;
+ } else
+ mode = SCM_DISABLE;
+ sudo_client_configure(mode, Opt.SudoPasswordExpiration, sudo_app.c_str(), askpass_app.c_str(),
+ Wide2MB(MSG(MSudoTitle)).c_str(), Wide2MB(MSG(MSudoPrompt)).c_str(), Wide2MB(MSG(MSudoConfirm)).c_str());
+}
+
+static void AddHistorySettings(DialogBuilder &Builder, int MTitle, int *OptEnabled, int *OptCount)
+{
+ DialogItemEx *EnabledCheckBox = Builder.AddCheckbox(MTitle, OptEnabled);
+ DialogItemEx *CountEdit = Builder.AddIntEditField(OptCount, 6);
+ DialogItemEx *CountText = Builder.AddTextBefore(CountEdit, MConfigMaxHistoryCount);
+ CountEdit->Indent(4);
+ CountText->Indent(4);
+ Builder.LinkFlags(EnabledCheckBox, CountEdit, DIF_DISABLE);
+ Builder.LinkFlags(EnabledCheckBox, CountText, DIF_DISABLE);
+}
+
+static void SanitizeHistoryCounts()
+{
+ Opt.HistoryCount = std::max(Opt.HistoryCount, 16);
+ Opt.FoldersHistoryCount = std::max(Opt.FoldersHistoryCount, 16);
+ Opt.ViewHistoryCount = std::max(Opt.ViewHistoryCount, 16);
+ Opt.DialogsHistoryCount = std::max(Opt.DialogsHistoryCount, 16);
+}
+
+void SystemSettings()
+{
+ DialogBuilder Builder(MConfigSystemTitle, L"SystemSettings");
+
+ DialogItemEx *SudoEnabledItem = Builder.AddCheckbox(MConfigSudoEnabled, &Opt.SudoEnabled);
+ DialogItemEx *SudoPasswordExpirationEdit = Builder.AddIntEditField(&Opt.SudoPasswordExpiration, 4);
+ DialogItemEx *SudoPasswordExpirationText = Builder.AddTextBefore(SudoPasswordExpirationEdit, MConfigSudoPasswordExpiration);
+
+ SudoPasswordExpirationText->Indent(4);
+ SudoPasswordExpirationEdit->Indent(4);
+
+ DialogItemEx *SudoConfirmModifyItem = Builder.AddCheckbox(MConfigSudoConfirmModify, &Opt.SudoConfirmModify);
+ SudoConfirmModifyItem->Indent(4);
+
+ Builder.LinkFlags(SudoEnabledItem, SudoConfirmModifyItem, DIF_DISABLE);
+ Builder.LinkFlags(SudoEnabledItem, SudoPasswordExpirationEdit, DIF_DISABLE);
+
+
+ DialogItemEx *DeleteToRecycleBin = Builder.AddCheckbox(MConfigRecycleBin, &Opt.DeleteToRecycleBin);
+ DialogItemEx *DeleteLinks = Builder.AddCheckbox(MConfigRecycleBinLink, &Opt.DeleteToRecycleBinKillLink);
+ DeleteLinks->Indent(4);
+ Builder.LinkFlags(DeleteToRecycleBin, DeleteLinks, DIF_DISABLE);
+
+
+// Builder.AddCheckbox(MSudoParanoic, &Opt.SudoParanoic);
+// Builder.AddCheckbox(CopyWriteThrough, &Opt.CMOpt.WriteThrough);
+ Builder.AddCheckbox(MConfigScanJunction, &Opt.ScanJunction);
+ Builder.AddCheckbox(MConfigOnlyFilesSize, &Opt.OnlyFilesSize);
+
+ DialogItemEx *InactivityExit = Builder.AddCheckbox(MConfigInactivity, &Opt.InactivityExit);
+ DialogItemEx *InactivityExitTime = Builder.AddIntEditField(&Opt.InactivityExitTime, 2);
+ InactivityExitTime->Indent(4);
+ Builder.AddTextAfter(InactivityExitTime, MConfigInactivityMinutes);
+ Builder.LinkFlags(InactivityExit, InactivityExitTime, DIF_DISABLE);
+
+ AddHistorySettings(Builder, MConfigSaveFoldersHistory, &Opt.SaveFoldersHistory, &Opt.FoldersHistoryCount);
+ AddHistorySettings(Builder, MConfigSaveViewHistory, &Opt.SaveViewHistory, &Opt.ViewHistoryCount);
+
+ Builder.AddCheckbox(MConfigAutoSave, &Opt.AutoSaveSetup);
+ Builder.AddOKCancel();
+
+ if (Builder.ShowDialog())
+ {
+ SanitizeHistoryCounts();
+ ApplySudoConfiguration();
+ }
+}
+
+
+void PanelSettings()
+{
+ DialogBuilder Builder(MConfigPanelTitle, L"PanelSettings");
+ BOOL AutoUpdate = (Opt.AutoUpdateLimit );
+
+ Builder.AddCheckbox(MConfigHidden, &Opt.ShowHidden);
+ Builder.AddCheckbox(MConfigHighlight, &Opt.Highlight);
+ Builder.AddCheckbox(MConfigAutoChange, &Opt.Tree.AutoChangeFolder);
+ Builder.AddCheckbox(MConfigSelectFolders, &Opt.SelectFolders);
+ Builder.AddCheckbox(MConfigSortFolderExt, &Opt.SortFolderExt);
+ Builder.AddCheckbox(MConfigReverseSort, &Opt.ReverseSort);
+
+ DialogItemEx *AutoUpdateEnabled = Builder.AddCheckbox(MConfigAutoUpdateLimit, &AutoUpdate);
+ DialogItemEx *AutoUpdateLimit = Builder.AddIntEditField((int *) &Opt.AutoUpdateLimit, 6);
+ Builder.LinkFlags(AutoUpdateEnabled, AutoUpdateLimit, DIF_DISABLE, false);
+ DialogItemEx *AutoUpdateText = Builder.AddTextBefore(AutoUpdateLimit, MConfigAutoUpdateLimit2);
+ AutoUpdateLimit->Indent(4);
+ AutoUpdateText->Indent(4);
+ Builder.AddCheckbox(MConfigAutoUpdateRemoteDrive, &Opt.AutoUpdateRemoteDrive);
+
+ Builder.AddSeparator();
+ Builder.AddCheckbox(MConfigShowColumns, &Opt.ShowColumnTitles);
+ Builder.AddCheckbox(MConfigShowStatus, &Opt.ShowPanelStatus);
+ Builder.AddCheckbox(MConfigShowTotal, &Opt.ShowPanelTotals);
+ Builder.AddCheckbox(MConfigShowFree, &Opt.ShowPanelFree);
+ Builder.AddCheckbox(MConfigShowScrollbar, &Opt.ShowPanelScrollbar);
+ Builder.AddCheckbox(MConfigShowScreensNumber, &Opt.ShowScreensNumber);
+ Builder.AddCheckbox(MConfigShowSortMode, &Opt.ShowSortMode);
+ Builder.AddOKCancel();
+
+ if (Builder.ShowDialog())
+ {
+ if (!AutoUpdate)
+ Opt.AutoUpdateLimit = 0;
+
+ // FrameManager->RefreshFrame();
+ CtrlObject->Cp()->LeftPanel->Update(UPDATE_KEEP_SELECTION);
+ CtrlObject->Cp()->RightPanel->Update(UPDATE_KEEP_SELECTION);
+ CtrlObject->Cp()->Redraw();
+ }
+}
+
+
+/* $ 17.12.2001 IS
+ Настройка средней кнопки мыши для панелей. Воткнем пока сюда, потом надо
+ переехать в специальный диалог по программированию мыши.
+*/
+void InterfaceSettings()
+{
+ for (;;) {
+ DialogBuilder Builder(MConfigInterfaceTitle, L"InterfSettings");
+
+ Builder.AddCheckbox(MConfigClock, &Opt.Clock);
+ Builder.AddCheckbox(MConfigViewerEditorClock, &Opt.ViewerEditorClock);
+ Builder.AddCheckbox(MConfigMouse, &Opt.Mouse);
+ Builder.AddCheckbox(MConfigKeyBar, &Opt.ShowKeyBar);
+ Builder.AddCheckbox(MConfigMenuBar, &Opt.ShowMenuBar);
+ DialogItemEx *SaverCheckbox = Builder.AddCheckbox(MConfigSaver, &Opt.ScreenSaver);
+
+ DialogItemEx *SaverEdit = Builder.AddIntEditField(&Opt.ScreenSaverTime, 2);
+ SaverEdit->Indent(4);
+ Builder.AddTextAfter(SaverEdit, MConfigSaverMinutes);
+ Builder.LinkFlags(SaverCheckbox, SaverEdit, DIF_DISABLE);
+
+ Builder.AddCheckbox(MConfigCopyTotal, &Opt.CMOpt.CopyShowTotal);
+ Builder.AddCheckbox(MConfigCopyTimeRule, &Opt.CMOpt.CopyTimeRule);
+ Builder.AddCheckbox(MConfigDeleteTotal, &Opt.DelOpt.DelShowTotal);
+ Builder.AddCheckbox(MConfigPgUpChangeDisk, &Opt.PgUpChangeDisk);
+
+
+ DWORD supported_tweaks = ApplyConsoleTweaks();
+ int ChangeFontID = -1;
+ DialogItemEx *Item = Builder.AddButton(MConfigConsoleChangeFont, ChangeFontID);
+
+ if (supported_tweaks & TWEAK_STATUS_SUPPORT_PAINT_SHARP) {
+ Builder.AddCheckboxAfter(Item, MConfigConsolePaintSharp, &Opt.ConsolePaintSharp);
+ }
+ if (supported_tweaks & TWEAK_STATUS_SUPPORT_EXCLUSIVE_KEYS) {
+ Builder.AddText(MConfigExclusiveKeys);
+ Item = Builder.AddCheckbox(MConfigExclusiveCtrlLeft, &Opt.ExclusiveCtrlLeft);
+ Item->Indent(4);
+ Builder.AddCheckboxAfter(Item, MConfigExclusiveCtrlRight, &Opt.ExclusiveCtrlRight);
+
+ Item = Builder.AddCheckbox(MConfigExclusiveAltLeft, &Opt.ExclusiveAltLeft);
+ Item->Indent(4);
+ Builder.AddCheckboxAfter(Item, MConfigExclusiveAltRight, &Opt.ExclusiveAltRight);
+
+ Item = Builder.AddCheckbox(MConfigExclusiveWinLeft, &Opt.ExclusiveWinLeft);
+ Item->Indent(4);
+ Builder.AddCheckboxAfter(Item, MConfigExclusiveWinRight, &Opt.ExclusiveWinRight);
+ }
+
+ Builder.AddText(MConfigTitleAddons);
+ Builder.AddEditField(&Opt.strTitleAddons, 47);
+
+ //OKButton->Flags = DIF_CENTERGROUP;
+ //OKButton->DefaultButton = TRUE;
+ //OKButton->Y1 = OKButton->Y2 = NextY++;
+ //OKButtonID = DialogItemsCount-1;
+
+
+ Builder.AddOKCancel();
+
+ int clicked_id = -1;
+ if (Builder.ShowDialog(&clicked_id)) {
+ if (Opt.CMOpt.CopyTimeRule)
+ Opt.CMOpt.CopyTimeRule = 3;
+
+ SetFarConsoleMode();
+ CtrlObject->Cp()->LeftPanel->Update(UPDATE_KEEP_SELECTION);
+ CtrlObject->Cp()->RightPanel->Update(UPDATE_KEEP_SELECTION);
+ CtrlObject->Cp()->SetScreenPosition();
+ // $ 10.07.2001 SKV ! надо это делать, иначе если кейбар спрятали, будет полный рамс.
+ CtrlObject->Cp()->Redraw();
+ ApplyConsoleTweaks();
+ break;
+ }
+
+ if (clicked_id != ChangeFontID)
+ break;
+
+ WINPORT(ConsoleChangeFont)();
+ }
+}
+
+void AutoCompleteSettings()
+{
+ DialogBuilder Builder(MConfigAutoCompleteTitle, L"AutoCompleteSettings");
+ DialogItemEx *ListCheck=Builder.AddCheckbox(MConfigAutoCompleteShowList, &Opt.AutoComplete.ShowList);
+ DialogItemEx *ModalModeCheck=Builder.AddCheckbox(MConfigAutoCompleteModalList, &Opt.AutoComplete.ModalList);
+ ModalModeCheck->Indent(4);
+ Builder.AddCheckbox(MConfigAutoCompleteAutoAppend, &Opt.AutoComplete.AppendCompletion);
+ Builder.LinkFlags(ListCheck, ModalModeCheck, DIF_DISABLE);
+
+ Builder.AddText(MConfigAutoCompleteExceptions);
+ Builder.AddEditField(&Opt.AutoComplete.Exceptions, 47);
+
+ Builder.AddOKCancel();
+ Builder.ShowDialog();
+}
+
+void InfoPanelSettings()
+{
+
+ DialogBuilder Builder(MConfigInfoPanelTitle, L"InfoPanelSettings");
+ Builder.AddOKCancel();
+ Builder.ShowDialog();
+}
+
+void DialogSettings()
+{
+ DialogBuilder Builder(MConfigDlgSetsTitle, L"DialogSettings");
+
+ AddHistorySettings(Builder, MConfigDialogsEditHistory, &Opt.Dialogs.EditHistory, &Opt.DialogsHistoryCount);
+ Builder.AddCheckbox(MConfigDialogsEditBlock, &Opt.Dialogs.EditBlock);
+ Builder.AddCheckbox(MConfigDialogsDelRemovesBlocks, &Opt.Dialogs.DelRemovesBlocks);
+ Builder.AddCheckbox(MConfigDialogsAutoComplete, &Opt.Dialogs.AutoComplete);
+ Builder.AddCheckbox(MConfigDialogsEULBsClear, &Opt.Dialogs.EULBsClear);
+ Builder.AddCheckbox(MConfigDialogsMouseButton, &Opt.Dialogs.MouseButton);
+ Builder.AddOKCancel();
+
+ if (Builder.ShowDialog())
+ {
+ SanitizeHistoryCounts();
+ if (Opt.Dialogs.MouseButton )
+ Opt.Dialogs.MouseButton = 0xFFFF;
+ }
+}
+
+void VMenuSettings()
+{
+ DialogBuilderListItem CAListItems[]=
+ {
+ { MConfigVMenuClickCancel, VMENUCLICK_CANCEL }, // Cancel menu
+ { MConfigVMenuClickApply, VMENUCLICK_APPLY }, // Execute selected item
+ { MConfigVMenuClickIgnore, VMENUCLICK_IGNORE }, // Do nothing
+ };
+
+ DialogBuilder Builder(MConfigVMenuTitle, L"VMenuSettings");
+
+ Builder.AddText(MConfigVMenuLBtnClick);
+ Builder.AddComboBox((int *) &Opt.VMenu.LBtnClick, 40, CAListItems, ARRAYSIZE(CAListItems), DIF_DROPDOWNLIST|DIF_LISTAUTOHIGHLIGHT|DIF_LISTWRAPMODE);
+ Builder.AddText(MConfigVMenuRBtnClick);
+ Builder.AddComboBox((int *) &Opt.VMenu.RBtnClick, 40, CAListItems, ARRAYSIZE(CAListItems), DIF_DROPDOWNLIST|DIF_LISTAUTOHIGHLIGHT|DIF_LISTWRAPMODE);
+ Builder.AddText(MConfigVMenuMBtnClick);
+ Builder.AddComboBox((int *) &Opt.VMenu.MBtnClick, 40, CAListItems, ARRAYSIZE(CAListItems), DIF_DROPDOWNLIST|DIF_LISTAUTOHIGHLIGHT|DIF_LISTWRAPMODE);
+ Builder.AddOKCancel();
+ Builder.ShowDialog();
+}
+
+void CmdlineSettings()
+{
+ DialogBuilderListItem CMWListItems[]=
+ {
+ { MConfigCmdlineWaitKeypress_Never, 0 },
+ { MConfigCmdlineWaitKeypress_OnError, 1 },
+ { MConfigCmdlineWaitKeypress_Always, 2 },
+ };
+
+ DialogBuilder Builder(MConfigCmdlineTitle, L"CmdlineSettings");
+ AddHistorySettings(Builder, MConfigSaveHistory, &Opt.SaveHistory, &Opt.HistoryCount);
+ Builder.AddCheckbox(MConfigCmdlineEditBlock, &Opt.CmdLine.EditBlock);
+ Builder.AddCheckbox(MConfigCmdlineDelRemovesBlocks, &Opt.CmdLine.DelRemovesBlocks);
+ Builder.AddCheckbox(MConfigCmdlineAutoComplete, &Opt.CmdLine.AutoComplete);
+
+ Builder.AddText(MConfigCmdlineWaitKeypress);
+ Builder.AddComboBox((int *) &Opt.CmdLine.WaitKeypress, 40,
+ CMWListItems, ARRAYSIZE(CMWListItems), DIF_DROPDOWNLIST|DIF_LISTAUTOHIGHLIGHT|DIF_LISTWRAPMODE);
+
+
+ DialogItemEx *UsePromptFormat = Builder.AddCheckbox(MConfigCmdlineUsePromptFormat, &Opt.CmdLine.UsePromptFormat);
+ DialogItemEx *PromptFormat = Builder.AddEditField(&Opt.CmdLine.strPromptFormat, 19);
+ PromptFormat->Indent(4);
+ Builder.LinkFlags(UsePromptFormat, PromptFormat, DIF_DISABLE);
+ DialogItemEx *UseShell = Builder.AddCheckbox(MConfigCmdlineUseShell, &Opt.CmdLine.UseShell);
+ DialogItemEx *Shell =Builder.AddEditField(&Opt.CmdLine.strShell, 19);
+ Shell->Indent(4);
+ Builder.LinkFlags(UseShell, Shell, DIF_DISABLE);
+ Builder.AddOKCancel();
+
+ int oldUseShell = Opt.CmdLine.UseShell;
+ FARString oldShell = FARString(Opt.CmdLine.strShell);
+
+ if (Builder.ShowDialog())
+ {
+ SanitizeHistoryCounts();
+
+ CtrlObject->CmdLine->SetPersistentBlocks(Opt.CmdLine.EditBlock);
+ CtrlObject->CmdLine->SetDelRemovesBlocks(Opt.CmdLine.DelRemovesBlocks);
+ CtrlObject->CmdLine->SetAutoComplete(Opt.CmdLine.AutoComplete);
+
+ if (Opt.CmdLine.UseShell != oldUseShell || Opt.CmdLine.strShell != oldShell)
+ VTShell_Shutdown();
+ }
+}
+
+void SetConfirmations()
+{
+ DialogBuilder Builder(MSetConfirmTitle, L"ConfirmDlg");
+
+ Builder.AddCheckbox(MSetConfirmCopy, &Opt.Confirm.Copy);
+ Builder.AddCheckbox(MSetConfirmMove, &Opt.Confirm.Move);
+ Builder.AddCheckbox(MSetConfirmRO, &Opt.Confirm.RO);
+ Builder.AddCheckbox(MSetConfirmDelete, &Opt.Confirm.Delete);
+ Builder.AddCheckbox(MSetConfirmDeleteFolders, &Opt.Confirm.DeleteFolder);
+ Builder.AddCheckbox(MSetConfirmEsc, &Opt.Confirm.Esc);
+ Builder.AddCheckbox(MSetConfirmRemoveConnection, &Opt.Confirm.RemoveConnection);
+ Builder.AddCheckbox(MSetConfirmRemoveSUBST, &Opt.Confirm.RemoveSUBST);
+ Builder.AddCheckbox(MSetConfirmDetachVHD, &Opt.Confirm.DetachVHD);
+ Builder.AddCheckbox(MSetConfirmRemoveHotPlug, &Opt.Confirm.RemoveHotPlug);
+ Builder.AddCheckbox(MSetConfirmAllowReedit, &Opt.Confirm.AllowReedit);
+ Builder.AddCheckbox(MSetConfirmHistoryClear, &Opt.Confirm.HistoryClear);
+ Builder.AddCheckbox(MSetConfirmExit, &Opt.Confirm.Exit);
+ Builder.AddOKCancel();
+
+ Builder.ShowDialog();
+}
+
+void PluginsManagerSettings()
+{
+ DialogBuilder Builder(MPluginsManagerSettingsTitle, L"PluginsManagerSettings");
+
+ Builder.AddCheckbox(MPluginsManagerOEMPluginsSupport, &Opt.LoadPlug.OEMPluginsSupport);
+ Builder.AddCheckbox(MPluginsManagerScanSymlinks, &Opt.LoadPlug.ScanSymlinks);
+ Builder.AddText(MPluginsManagerPersonalPath);
+ Builder.AddEditField(&Opt.LoadPlug.strPersonalPluginsPath, 45, L"PersPath", DIF_EDITPATH);
+
+ Builder.AddSeparator(MPluginConfirmationTitle);
+ DialogItemEx *ConfirmOFP = Builder.AddCheckbox(MPluginsManagerOFP, &Opt.PluginConfirm.OpenFilePlugin);
+ ConfirmOFP->Flags|=DIF_3STATE;
+ DialogItemEx *StandardAssoc = Builder.AddCheckbox(MPluginsManagerStdAssoc, &Opt.PluginConfirm.StandardAssociation);
+ DialogItemEx *EvenIfOnlyOne = Builder.AddCheckbox(MPluginsManagerEvenOne, &Opt.PluginConfirm.EvenIfOnlyOnePlugin);
+ StandardAssoc->Indent(2);
+ EvenIfOnlyOne->Indent(4);
+
+ Builder.AddCheckbox(MPluginsManagerSFL, &Opt.PluginConfirm.SetFindList);
+ Builder.AddCheckbox(MPluginsManagerPF, &Opt.PluginConfirm.Prefix);
+ Builder.AddOKCancel();
+
+ Builder.ShowDialog();
+}
+
+
+void SetDizConfig()
+{
+ DialogBuilder Builder(MCfgDizTitle, L"FileDiz");
+
+ Builder.AddText(MCfgDizListNames);
+ Builder.AddEditField(&Opt.Diz.strListNames, 65);
+ Builder.AddSeparator();
+
+ Builder.AddCheckbox(MCfgDizSetHidden, &Opt.Diz.SetHidden);
+ Builder.AddCheckbox(MCfgDizROUpdate, &Opt.Diz.ROUpdate);
+ DialogItemEx *StartPos = Builder.AddIntEditField(&Opt.Diz.StartPos, 2);
+ Builder.AddTextAfter(StartPos, MCfgDizStartPos);
+ Builder.AddSeparator();
+
+ static int DizOptions[] = { MCfgDizNotUpdate, MCfgDizUpdateIfDisplayed, MCfgDizAlwaysUpdate };
+ Builder.AddRadioButtons(&Opt.Diz.UpdateMode, 3, DizOptions);
+ Builder.AddSeparator();
+
+ Builder.AddCheckbox(MCfgDizAnsiByDefault, &Opt.Diz.AnsiByDefault);
+ Builder.AddCheckbox(MCfgDizSaveInUTF, &Opt.Diz.SaveInUTF);
+ Builder.AddOKCancel();
+ Builder.ShowDialog();
+}
+
+void ViewerConfig(ViewerOptions &ViOpt,bool Local)
+{
+ DialogBuilder Builder(MViewConfigTitle, L"ViewerSettings");
+
+ if (!Local)
+ {
+ Builder.AddCheckbox(MViewConfigExternalF3, &Opt.ViOpt.UseExternalViewer);
+ Builder.AddText(MViewConfigExternalCommand);
+ Builder.AddEditField(&Opt.strExternalViewer, 64, L"ExternalViewer", DIF_EDITPATH);
+ Builder.AddSeparator(MViewConfigInternal);
+ }
+
+ Builder.StartColumns();
+ Builder.AddCheckbox(MViewConfigPersistentSelection, &ViOpt.PersistentBlocks);
+ DialogItemEx *SavePos = Builder.AddCheckbox(MViewConfigSavePos, &Opt.ViOpt.SavePos);
+ DialogItemEx *TabSize = Builder.AddIntEditField(&ViOpt.TabSize, 3);
+ Builder.AddTextAfter(TabSize, MViewConfigTabSize);
+ Builder.AddCheckbox(MViewShowKeyBar, &ViOpt.ShowKeyBar);
+ Builder.ColumnBreak();
+ Builder.AddCheckbox(MViewConfigArrows, &ViOpt.ShowArrows);
+ DialogItemEx *SaveShortPos = Builder.AddCheckbox(MViewConfigSaveShortPos, &Opt.ViOpt.SaveShortPos);
+ Builder.LinkFlags(SavePos, SaveShortPos, DIF_DISABLE);
+ Builder.AddCheckbox(MViewConfigScrollbar, &ViOpt.ShowScrollbar);
+ Builder.AddCheckbox(MViewShowTitleBar, &ViOpt.ShowTitleBar);
+ Builder.EndColumns();
+
+ if (!Local)
+ {
+ Builder.AddEmptyLine();
+ Builder.AddCheckbox(MViewAutoDetectCodePage, &ViOpt.AutoDetectCodePage);
+ Builder.AddText(MViewConfigDefaultCodePage);
+ Builder.AddCodePagesBox(&ViOpt.DefaultCodePage, 40, false, false);
+ }
+ Builder.AddOKCancel();
+ if (Builder.ShowDialog())
+ {
+ if (ViOpt.TabSize<1 || ViOpt.TabSize>512)
+ ViOpt.TabSize=8;
+ }
+}
+
+void EditorConfig(EditorOptions &EdOpt,bool Local)
+{
+ DialogBuilder Builder(MEditConfigTitle, L"EditorSettings");
+ if (!Local)
+ {
+ Builder.AddCheckbox(MEditConfigEditorF4, &Opt.EdOpt.UseExternalEditor);
+ Builder.AddText(MEditConfigEditorCommand);
+ Builder.AddEditField(&Opt.strExternalEditor, 64, L"ExternalEditor", DIF_EDITPATH);
+ Builder.AddSeparator(MEditConfigInternal);
+ }
+
+ Builder.AddText(MEditConfigExpandTabsTitle);
+ DialogBuilderListItem ExpandTabsItems[] = {
+ { MEditConfigDoNotExpandTabs, EXPAND_NOTABS },
+ { MEditConfigExpandTabs, EXPAND_NEWTABS },
+ { MEditConfigConvertAllTabsToSpaces, EXPAND_ALLTABS }
+ };
+ Builder.AddComboBox(&EdOpt.ExpandTabs, 64, ExpandTabsItems, 3, DIF_DROPDOWNLIST|DIF_LISTAUTOHIGHLIGHT|DIF_LISTWRAPMODE);
+
+ Builder.StartColumns();
+ Builder.AddCheckbox(MEditConfigPersistentBlocks, &EdOpt.PersistentBlocks);
+ DialogItemEx *SavePos = Builder.AddCheckbox(MEditConfigSavePos, &EdOpt.SavePos);
+ Builder.AddCheckbox(MEditConfigAutoIndent, &EdOpt.AutoIndent);
+ DialogItemEx *TabSize = Builder.AddIntEditField(&EdOpt.TabSize, 3);
+ Builder.AddTextAfter(TabSize, MEditConfigTabSize);
+ Builder.AddCheckbox(MEditShowWhiteSpace, &EdOpt.ShowWhiteSpace);
+ Builder.AddCheckbox(MEditShowKeyBar, &EdOpt.ShowKeyBar);
+ Builder.ColumnBreak();
+ Builder.AddCheckbox(MEditConfigDelRemovesBlocks, &EdOpt.DelRemovesBlocks);
+ DialogItemEx *SaveShortPos = Builder.AddCheckbox(MEditConfigSaveShortPos, &EdOpt.SaveShortPos);
+ Builder.LinkFlags(SavePos, SaveShortPos, DIF_DISABLE);
+ Builder.AddCheckbox(MEditCursorBeyondEnd, &EdOpt.CursorBeyondEOL);
+ Builder.AddCheckbox(MEditConfigScrollbar, &EdOpt.ShowScrollBar);
+ Builder.AddCheckbox(MEditConfigPickUpWord, &EdOpt.SearchPickUpWord);
+ Builder.AddCheckbox(MEditShowTitleBar, &EdOpt.ShowTitleBar);
+ Builder.EndColumns();
+
+ if (!Local)
+ {
+ Builder.AddEmptyLine();
+ Builder.AddCheckbox(MEditShareWrite, &EdOpt.EditOpenedForWrite);
+ Builder.AddCheckbox(MEditLockROFileModification, &EdOpt.ReadOnlyLock, 1);
+ Builder.AddCheckbox(MEditWarningBeforeOpenROFile, &EdOpt.ReadOnlyLock, 2);
+ Builder.AddCheckbox(MEditAutoDetectCodePage, &EdOpt.AutoDetectCodePage);
+ Builder.AddText(MEditConfigDefaultCodePage);
+ Builder.AddCodePagesBox(&EdOpt.DefaultCodePage, 40, false, false);
+ }
+
+ Builder.AddOKCancel();
+
+ if (Builder.ShowDialog())
+ {
+ if (EdOpt.TabSize<1 || EdOpt.TabSize>512)
+ EdOpt.TabSize=8;
+ }
+}
+
+
+void NotificationsConfig(NotificationsOptions &NotifOpt)
+{
+ DialogBuilder Builder(MNotifConfigTitle, L"NotificationsSettings");
+
+ Builder.AddCheckbox(MNotifConfigOnFileOperation, &NotifOpt.OnFileOperation);
+ Builder.AddCheckbox(MNotifConfigOnConsole, &NotifOpt.OnConsole);
+ Builder.AddEmptyLine();
+ Builder.AddCheckbox(MNotifConfigOnlyIfBackground, &NotifOpt.OnlyIfBackground);
+ Builder.AddOKCancel();
+
+ if (Builder.ShowDialog())
+ {
+ }
+}
+
+
+void SetFolderInfoFiles()
+{
+ FARString strFolderInfoFiles;
+
+ if (GetString(MSG(MSetFolderInfoTitle),MSG(MSetFolderInfoNames),L"FolderInfoFiles",
+ Opt.InfoPanel.strFolderInfoFiles,strFolderInfoFiles,L"OptMenu",FIB_ENABLEEMPTY|FIB_BUTTONS))
+ {
+ Opt.InfoPanel.strFolderInfoFiles = strFolderInfoFiles;
+
+ if (CtrlObject->Cp()->LeftPanel->GetType() == INFO_PANEL)
+ CtrlObject->Cp()->LeftPanel->Update(0);
+
+ if (CtrlObject->Cp()->RightPanel->GetType() == INFO_PANEL)
+ CtrlObject->Cp()->RightPanel->Update(0);
+ }
+}
+
+
+// Структура, описывающая всю конфигурацию(!)
+static struct FARConfig
+{
+ int IsSave; // =1 - будет записываться в SaveConfig()
+ DWORD ValType; // REG_DWORD, REG_SZ, REG_BINARY
+ const char *KeyName;
+ const char *ValName;
+ void *ValPtr; // адрес переменной, куда помещаем данные
+ DWORD DefDWord; // он же размер данных для REG_SZ и REG_BINARY
+ const wchar_t *DefStr; // строка/данные по умолчанию
+} CFG[]=
+{
+ {1, REG_BINARY, NKeyColors, "CurrentPalette",(char*)Palette,(DWORD)SizeArrayPalette,(wchar_t*)DefaultPalette},
+
+ {1, REG_DWORD, NKeyScreen, "Clock", &Opt.Clock, 1, 0},
+ {1, REG_DWORD, NKeyScreen, "ViewerEditorClock",&Opt.ViewerEditorClock,0, 0},
+ {1, REG_DWORD, NKeyScreen, "KeyBar",&Opt.ShowKeyBar,1, 0},
+ {1, REG_DWORD, NKeyScreen, "ScreenSaver",&Opt.ScreenSaver, 0, 0},
+ {1, REG_DWORD, NKeyScreen, "ScreenSaverTime",&Opt.ScreenSaverTime,5, 0},
+ {0, REG_DWORD, NKeyScreen, "DeltaXY", &Opt.ScrSize.DeltaXY, 0, 0},
+
+ {1, REG_DWORD, NKeyCmdline, "UsePromptFormat", &Opt.CmdLine.UsePromptFormat,0, 0},
+ {1, REG_SZ, NKeyCmdline, "PromptFormat",&Opt.CmdLine.strPromptFormat, 0, L"$p$# "},
+ {1, REG_DWORD, NKeyCmdline, "UseShell",&Opt.CmdLine.UseShell, 0, 0},
+ {1, REG_SZ, NKeyCmdline, "Shell",&Opt.CmdLine.strShell, 0, L"/bin/bash"},
+ {1, REG_DWORD, NKeyCmdline, "DelRemovesBlocks", &Opt.CmdLine.DelRemovesBlocks,1, 0},
+ {1, REG_DWORD, NKeyCmdline, "EditBlock", &Opt.CmdLine.EditBlock,0, 0},
+ {1, REG_DWORD, NKeyCmdline, "AutoComplete",&Opt.CmdLine.AutoComplete,1, 0},
+ {1, REG_DWORD, NKeyCmdline, "WaitKeypress",&Opt.CmdLine.WaitKeypress,1, 0},
+
+ {1, REG_DWORD, NKeyInterface, "Mouse",&Opt.Mouse,1, 0},
+ {0, REG_DWORD, NKeyInterface, "UseVk_oem_x",&Opt.UseVk_oem_x,1, 0},
+ {1, REG_DWORD, NKeyInterface, "ShowMenuBar",&Opt.ShowMenuBar,0, 0},
+ {0, REG_DWORD, NKeyInterface, "CursorSize1",&Opt.CursorSize[0],15, 0},
+ {0, REG_DWORD, NKeyInterface, "CursorSize2",&Opt.CursorSize[1],10, 0},
+ {0, REG_DWORD, NKeyInterface, "CursorSize3",&Opt.CursorSize[2],99, 0},
+ {0, REG_DWORD, NKeyInterface, "CursorSize4",&Opt.CursorSize[3],99, 0},
+ {0, REG_DWORD, NKeyInterface, "ShiftsKeyRules",&Opt.ShiftsKeyRules,1, 0},
+ {1, REG_DWORD, NKeyInterface, "CtrlPgUp",&Opt.PgUpChangeDisk, 1, 0},
+
+ {1, REG_DWORD, NKeyInterface, "ConsolePaintSharp",&Opt.ConsolePaintSharp, 0, 0},
+ {1, REG_DWORD, NKeyInterface, "ExclusiveCtrlLeft",&Opt.ExclusiveCtrlLeft, 0, 0},
+ {1, REG_DWORD, NKeyInterface, "ExclusiveCtrlRight",&Opt.ExclusiveCtrlRight, 0, 0},
+ {1, REG_DWORD, NKeyInterface, "ExclusiveAltLeft",&Opt.ExclusiveAltLeft, 0, 0},
+ {1, REG_DWORD, NKeyInterface, "ExclusiveAltRight",&Opt.ExclusiveAltRight, 0, 0},
+ {1, REG_DWORD, NKeyInterface, "ExclusiveWinLeft",&Opt.ExclusiveWinLeft, 0, 0},
+ {1, REG_DWORD, NKeyInterface, "ExclusiveWinRight",&Opt.ExclusiveWinRight, 0, 0},
+
+ {0, REG_DWORD, NKeyInterface, "ShowTimeoutDelFiles",&Opt.ShowTimeoutDelFiles, 50, 0},
+ {0, REG_DWORD, NKeyInterface, "ShowTimeoutDACLFiles",&Opt.ShowTimeoutDACLFiles, 50, 0},
+ {0, REG_DWORD, NKeyInterface, "FormatNumberSeparators",&Opt.FormatNumberSeparators, 0, 0},
+ {1, REG_DWORD, NKeyInterface, "CopyShowTotal",&Opt.CMOpt.CopyShowTotal,1, 0},
+ {1, REG_DWORD, NKeyInterface, "DelShowTotal",&Opt.DelOpt.DelShowTotal,0, 0},
+ {1, REG_SZ, NKeyInterface, "TitleAddons2",&Opt.strTitleAddons, 0, L"%Ver %Backend %User@%Host"}, // %Platform
+ {1, REG_SZ, NKeyInterfaceCompletion, "Exceptions",&Opt.AutoComplete.Exceptions, 0, L"git*reset*--hard;*://*:*@*"},
+ {1, REG_DWORD, NKeyInterfaceCompletion, "ShowList",&Opt.AutoComplete.ShowList, 1, 0},
+ {1, REG_DWORD, NKeyInterfaceCompletion, "ModalList",&Opt.AutoComplete.ModalList, 0, 0},
+ {1, REG_DWORD, NKeyInterfaceCompletion, "Append",&Opt.AutoComplete.AppendCompletion, 0, 0},
+
+ {1, REG_SZ, NKeyViewer, "ExternalViewerName",&Opt.strExternalViewer, 0, L""},
+ {1, REG_DWORD, NKeyViewer, "UseExternalViewer",&Opt.ViOpt.UseExternalViewer,0, 0},
+ {1, REG_DWORD, NKeyViewer, "SaveViewerPos",&Opt.ViOpt.SavePos,1, 0},
+ {1, REG_DWORD, NKeyViewer, "SaveViewerShortPos",&Opt.ViOpt.SaveShortPos,1, 0},
+ {1, REG_DWORD, NKeyViewer, "AutoDetectCodePage",&Opt.ViOpt.AutoDetectCodePage,0, 0},
+ {1, REG_DWORD, NKeyViewer, "SearchRegexp",&Opt.ViOpt.SearchRegexp,0, 0},
+
+ {1, REG_DWORD, NKeyViewer, "TabSize",&Opt.ViOpt.TabSize,8, 0},
+ {1, REG_DWORD, NKeyViewer, "ShowKeyBar",&Opt.ViOpt.ShowKeyBar,1, 0},
+ {1, REG_DWORD, NKeyViewer, "ShowTitleBar",&Opt.ViOpt.ShowTitleBar,1, 0},
+ {1, REG_DWORD, NKeyViewer, "ShowArrows",&Opt.ViOpt.ShowArrows,1, 0},
+ {1, REG_DWORD, NKeyViewer, "ShowScrollbar",&Opt.ViOpt.ShowScrollbar,0, 0},
+ {1, REG_DWORD, NKeyViewer, "IsWrap",&Opt.ViOpt.ViewerIsWrap,1, 0},
+ {1, REG_DWORD, NKeyViewer, "Wrap",&Opt.ViOpt.ViewerWrap,0, 0},
+ {1, REG_DWORD, NKeyViewer, "PersistentBlocks",&Opt.ViOpt.PersistentBlocks,0, 0},
+ {1, REG_DWORD, NKeyViewer, "DefaultCodePage",&Opt.ViOpt.DefaultCodePage,CP_UTF8, 0},
+
+ {1, REG_DWORD, NKeyDialog, "EditHistory",&Opt.Dialogs.EditHistory,1, 0},
+ {1, REG_DWORD, NKeyDialog, "EditBlock",&Opt.Dialogs.EditBlock,0, 0},
+ {1, REG_DWORD, NKeyDialog, "AutoComplete",&Opt.Dialogs.AutoComplete,1, 0},
+ {1, REG_DWORD, NKeyDialog, "EULBsClear",&Opt.Dialogs.EULBsClear,0, 0},
+ {0, REG_DWORD, NKeyDialog, "SelectFromHistory",&Opt.Dialogs.SelectFromHistory,0, 0},
+ {0, REG_DWORD, NKeyDialog, "EditLine",&Opt.Dialogs.EditLine,0, 0},
+ {1, REG_DWORD, NKeyDialog, "MouseButton",&Opt.Dialogs.MouseButton,0xFFFF, 0},
+ {1, REG_DWORD, NKeyDialog, "DelRemovesBlocks",&Opt.Dialogs.DelRemovesBlocks,1, 0},
+ {0, REG_DWORD, NKeyDialog, "CBoxMaxHeight",&Opt.Dialogs.CBoxMaxHeight,24, 0},
+
+ {1, REG_SZ, NKeyEditor, "ExternalEditorName",&Opt.strExternalEditor, 0, L""},
+ {1, REG_DWORD, NKeyEditor, "UseExternalEditor",&Opt.EdOpt.UseExternalEditor,0, 0},
+ {1, REG_DWORD, NKeyEditor, "ExpandTabs",&Opt.EdOpt.ExpandTabs,0, 0},
+ {1, REG_DWORD, NKeyEditor, "TabSize",&Opt.EdOpt.TabSize,8, 0},
+ {1, REG_DWORD, NKeyEditor, "PersistentBlocks",&Opt.EdOpt.PersistentBlocks,0, 0},
+ {1, REG_DWORD, NKeyEditor, "DelRemovesBlocks",&Opt.EdOpt.DelRemovesBlocks,1, 0},
+ {1, REG_DWORD, NKeyEditor, "AutoIndent",&Opt.EdOpt.AutoIndent,0, 0},
+ {1, REG_DWORD, NKeyEditor, "SaveEditorPos",&Opt.EdOpt.SavePos,1, 0},
+ {1, REG_DWORD, NKeyEditor, "SaveEditorShortPos",&Opt.EdOpt.SaveShortPos,1, 0},
+ {1, REG_DWORD, NKeyEditor, "AutoDetectCodePage",&Opt.EdOpt.AutoDetectCodePage,0, 0},
+ {1, REG_DWORD, NKeyEditor, "EditorCursorBeyondEOL",&Opt.EdOpt.CursorBeyondEOL,1, 0},
+ {1, REG_DWORD, NKeyEditor, "ReadOnlyLock",&Opt.EdOpt.ReadOnlyLock,0, 0}, // Вернём назад дефолт 1.65 - не предупреждать и не блокировать
+ {0, REG_DWORD, NKeyEditor, "EditorUndoSize",&Opt.EdOpt.UndoSize,0, 0}, // $ 03.12.2001 IS размер буфера undo в редакторе
+ {0, REG_SZ, NKeyEditor, "WordDiv",&Opt.strWordDiv, 0, WordDiv0},
+ {0, REG_DWORD, NKeyEditor, "BSLikeDel",&Opt.EdOpt.BSLikeDel,1, 0},
+ {0, REG_DWORD, NKeyEditor, "EditorF7Rules",&Opt.EdOpt.F7Rules,1, 0},
+ {0, REG_DWORD, NKeyEditor, "FileSizeLimit",&Opt.EdOpt.FileSizeLimitLo,(DWORD)0, 0},
+ {0, REG_DWORD, NKeyEditor, "FileSizeLimitHi",&Opt.EdOpt.FileSizeLimitHi,(DWORD)0, 0},
+ {0, REG_DWORD, NKeyEditor, "CharCodeBase",&Opt.EdOpt.CharCodeBase,1, 0},
+ {0, REG_DWORD, NKeyEditor, "AllowEmptySpaceAfterEof", &Opt.EdOpt.AllowEmptySpaceAfterEof,0,0},//skv
+ {1, REG_DWORD, NKeyEditor, "DefaultCodePage",&Opt.EdOpt.DefaultCodePage,CP_UTF8, 0},
+ {1, REG_DWORD, NKeyEditor, "ShowKeyBar",&Opt.EdOpt.ShowKeyBar,1, 0},
+ {1, REG_DWORD, NKeyEditor, "ShowTitleBar",&Opt.EdOpt.ShowTitleBar,1, 0},
+ {1, REG_DWORD, NKeyEditor, "ShowScrollBar",&Opt.EdOpt.ShowScrollBar,0, 0},
+ {1, REG_DWORD, NKeyEditor, "EditOpenedForWrite",&Opt.EdOpt.EditOpenedForWrite,1, 0},
+ {1, REG_DWORD, NKeyEditor, "SearchSelFound",&Opt.EdOpt.SearchSelFound,0, 0},
+ {1, REG_DWORD, NKeyEditor, "SearchRegexp",&Opt.EdOpt.SearchRegexp,0, 0},
+ {1, REG_DWORD, NKeyEditor, "SearchPickUpWord",&Opt.EdOpt.SearchPickUpWord,0, 0},
+ {1, REG_DWORD, NKeyEditor, "ShowWhiteSpace",&Opt.EdOpt.ShowWhiteSpace,0, 0},
+
+ {1, REG_DWORD, NKeyNotifications, "OnFileOperation",&Opt.NotifOpt.OnFileOperation,1, 0},
+ {1, REG_DWORD, NKeyNotifications, "OnConsole",&Opt.NotifOpt.OnConsole,1, 0},
+ {1, REG_DWORD, NKeyNotifications, "OnlyIfBackground",&Opt.NotifOpt.OnlyIfBackground,1, 0},
+
+ {0, REG_DWORD, NKeyXLat, "Flags",&Opt.XLat.Flags,(DWORD)XLAT_SWITCHKEYBLAYOUT|XLAT_CONVERTALLCMDLINE, 0},
+ {0, REG_SZ, NKeyXLat, "Table1",&Opt.XLat.Table[0],0,L""},
+ {0, REG_SZ, NKeyXLat, "Table2",&Opt.XLat.Table[1],0,L""},
+ {0, REG_SZ, NKeyXLat, "Rules1",&Opt.XLat.Rules[0],0,L""},
+ {0, REG_SZ, NKeyXLat, "Rules2",&Opt.XLat.Rules[1],0,L""},
+ {0, REG_SZ, NKeyXLat, "Rules3",&Opt.XLat.Rules[2],0,L""},
+ {0, REG_SZ, NKeyXLat, "WordDivForXlat",&Opt.XLat.strWordDivForXlat, 0,WordDivForXlat0},
+
+ {1, REG_DWORD, NKeySavedHistory, NParamHistoryCount,&Opt.HistoryCount,512, 0},
+ {1, REG_DWORD, NKeySavedFolderHistory, NParamHistoryCount,&Opt.FoldersHistoryCount,512, 0},
+ {1, REG_DWORD, NKeySavedViewHistory, NParamHistoryCount,&Opt.ViewHistoryCount,512, 0},
+ {1, REG_DWORD, NKeySavedDialogHistory, NParamHistoryCount,&Opt.DialogsHistoryCount,512, 0},
+
+ {1, REG_DWORD, NKeySystem, "SaveHistory",&Opt.SaveHistory,1, 0},
+ {1, REG_DWORD, NKeySystem, "SaveFoldersHistory",&Opt.SaveFoldersHistory,1, 0},
+ {0, REG_DWORD, NKeySystem, "SavePluginFoldersHistory",&Opt.SavePluginFoldersHistory,0, 0},
+ {1, REG_DWORD, NKeySystem, "SaveViewHistory",&Opt.SaveViewHistory,1, 0},
+ {1, REG_DWORD, NKeySystem, "AutoSaveSetup",&Opt.AutoSaveSetup,0, 0},
+ {1, REG_DWORD, NKeySystem, "DeleteToRecycleBin",&Opt.DeleteToRecycleBin,0, 0},
+ {1, REG_DWORD, NKeySystem, "DeleteToRecycleBinKillLink",&Opt.DeleteToRecycleBinKillLink,1, 0},
+ {0, REG_DWORD, NKeySystem, "WipeSymbol",&Opt.WipeSymbol,0, 0},
+ {1, REG_DWORD, NKeySystem, "SudoEnabled",&Opt.SudoEnabled,1, 0},
+ {1, REG_DWORD, NKeySystem, "SudoConfirmModify",&Opt.SudoConfirmModify,1, 0},
+ {1, REG_DWORD, NKeySystem, "SudoPasswordExpiration",&Opt.SudoPasswordExpiration,15*60, 0},
+
+ {1, REG_DWORD, NKeySystem, "UseCOW",&Opt.CMOpt.SparseFiles, 0, 0},
+ {1, REG_DWORD, NKeySystem, "SparseFiles",&Opt.CMOpt.SparseFiles, 0, 0},
+ {1, REG_DWORD, NKeySystem, "HowCopySymlink",&Opt.CMOpt.HowCopySymlink, 1, 0},
+ {1, REG_DWORD, NKeySystem, "WriteThrough",&Opt.CMOpt.WriteThrough, 0, 0},
+ {1, REG_DWORD, NKeySystem, "CopyXAttr",&Opt.CMOpt.CopyXAttr, 0, 0},
+ {0, REG_DWORD, NKeySystem, "CopyAccessMode",&Opt.CMOpt.CopyAccessMode,1, 0},
+ {1, REG_DWORD, NKeySystem, "MultiCopy",&Opt.CMOpt.MultiCopy,0, 0},
+ {1, REG_DWORD, NKeySystem, "CopyTimeRule", &Opt.CMOpt.CopyTimeRule, 3, 0},
+
+ {1, REG_DWORD, NKeySystem, "InactivityExit",&Opt.InactivityExit,0, 0},
+ {1, REG_DWORD, NKeySystem, "InactivityExitTime",&Opt.InactivityExitTime,15, 0},
+ {1, REG_DWORD, NKeySystem, "DriveMenuMode",&Opt.ChangeDriveMode,DRIVE_SHOW_TYPE|DRIVE_SHOW_PLUGINS|DRIVE_SHOW_SIZE_FLOAT|DRIVE_SHOW_BOOKMARKS, 0},
+ {1, REG_DWORD, NKeySystem, "DriveDisconnetMode",&Opt.ChangeDriveDisconnetMode,1, 0},
+ {1, REG_DWORD, NKeySystem, "AutoUpdateRemoteDrive",&Opt.AutoUpdateRemoteDrive,1, 0},
+ {1, REG_DWORD, NKeySystem, "FileSearchMode",&Opt.FindOpt.FileSearchMode,FINDAREA_FROM_CURRENT, 0},
+ {0, REG_DWORD, NKeySystem, "CollectFiles",&Opt.FindOpt.CollectFiles, 1, 0},
+ {1, REG_SZ, NKeySystem, "SearchInFirstSize",&Opt.FindOpt.strSearchInFirstSize, 0, L""},
+ {1, REG_DWORD, NKeySystem, "FindAlternateStreams",&Opt.FindOpt.FindAlternateStreams,0,0},
+ {1, REG_SZ, NKeySystem, "SearchOutFormat",&Opt.FindOpt.strSearchOutFormat, 0, L"D,S,A"},
+ {1, REG_SZ, NKeySystem, "SearchOutFormatWidth",&Opt.FindOpt.strSearchOutFormatWidth, 0, L"14,13,0"},
+ {1, REG_DWORD, NKeySystem, "FindFolders",&Opt.FindOpt.FindFolders, 1, 0},
+ {1, REG_DWORD, NKeySystem, "FindSymLinks",&Opt.FindOpt.FindSymLinks, 1, 0},
+ {1, REG_DWORD, NKeySystem, "UseFilterInSearch",&Opt.FindOpt.UseFilter,0,0},
+ {1, REG_DWORD, NKeySystem, "FindCodePage",&Opt.FindCodePage, CP_AUTODETECT, 0},
+ {0, REG_DWORD, NKeySystem, "CmdHistoryRule",&Opt.CmdHistoryRule,0, 0},
+ {0, REG_DWORD, NKeySystem, "SetAttrFolderRules",&Opt.SetAttrFolderRules,1, 0},
+ {0, REG_DWORD, NKeySystem, "MaxPositionCache",&Opt.MaxPositionCache,POSCACHE_MAX_ELEMENTS, 0},
+ {0, REG_SZ, NKeySystem, "ConsoleDetachKey", &strKeyNameConsoleDetachKey, 0, L"CtrlAltTab"},
+ {0, REG_DWORD, NKeySystem, "SilentLoadPlugin", &Opt.LoadPlug.SilentLoadPlugin, 0, 0},
+ {1, REG_DWORD, NKeySystem, "OEMPluginsSupport", &Opt.LoadPlug.OEMPluginsSupport, 1, 0},
+ {1, REG_DWORD, NKeySystem, "ScanSymlinks", &Opt.LoadPlug.ScanSymlinks, 1, 0},
+ {1, REG_DWORD, NKeySystem, "MultiMakeDir",&Opt.MultiMakeDir,0, 0},
+ {0, REG_DWORD, NKeySystem, "MsWheelDelta", &Opt.MsWheelDelta, 1, 0},
+ {0, REG_DWORD, NKeySystem, "MsWheelDeltaView", &Opt.MsWheelDeltaView, 1, 0},
+ {0, REG_DWORD, NKeySystem, "MsWheelDeltaEdit", &Opt.MsWheelDeltaEdit, 1, 0},
+ {0, REG_DWORD, NKeySystem, "MsWheelDeltaHelp", &Opt.MsWheelDeltaHelp, 1, 0},
+ {0, REG_DWORD, NKeySystem, "MsHWheelDelta", &Opt.MsHWheelDelta, 1, 0},
+ {0, REG_DWORD, NKeySystem, "MsHWheelDeltaView", &Opt.MsHWheelDeltaView, 1, 0},
+ {0, REG_DWORD, NKeySystem, "MsHWheelDeltaEdit", &Opt.MsHWheelDeltaEdit, 1, 0},
+ {0, REG_DWORD, NKeySystem, "SubstNameRule", &Opt.SubstNameRule, 2, 0},
+ {0, REG_DWORD, NKeySystem, "ShowCheckingFile", &Opt.ShowCheckingFile, 0, 0},
+ {0, REG_DWORD, NKeySystem, "DelThreadPriority", &Opt.DelThreadPriority, 0, 0},
+ {0, REG_SZ, NKeySystem, "QuotedSymbols",&Opt.strQuotedSymbols, 0, L" $&()[]{};|*?!'`\"\\\xA0"}, //xA0 => 160 =>oem(0xFF)
+ {0, REG_DWORD, NKeySystem, "QuotedName",&Opt.QuotedName,QUOTEDNAME_INSERT, 0},
+ //{0, REG_DWORD, NKeySystem, "CPAJHefuayor",&Opt.strCPAJHefuayor,0, 0},
+ {0, REG_DWORD, NKeySystem, "CloseConsoleRule",&Opt.CloseConsoleRule,1, 0},
+ {0, REG_DWORD, NKeySystem, "PluginMaxReadData",&Opt.PluginMaxReadData,0x40000, 0},
+ {0, REG_DWORD, NKeySystem, "UseNumPad",&Opt.UseNumPad,1, 0},
+ {0, REG_DWORD, NKeySystem, "CASRule",&Opt.CASRule,0xFFFFFFFFU, 0},
+ {0, REG_DWORD, NKeySystem, "AllCtrlAltShiftRule",&Opt.AllCtrlAltShiftRule,0x0000FFFF, 0},
+ {1, REG_DWORD, NKeySystem, "ScanJunction",&Opt.ScanJunction,1, 0},
+ {1, REG_DWORD, NKeySystem, "OnlyFilesSize",&Opt.OnlyFilesSize, 0, 0},
+ {0, REG_DWORD, NKeySystem, "UsePrintManager",&Opt.UsePrintManager,1, 0},
+ {0, REG_DWORD, NKeySystem, "WindowMode",&Opt.WindowMode, 0, 0},
+
+ {0, REG_DWORD, NKeySystemNowell, "MoveRO",&Opt.Nowell.MoveRO,1, 0},
+
+ {0, REG_DWORD, NKeySystemExecutor, "RestoreCP",&Opt.RestoreCPAfterExecute,1, 0},
+ {0, REG_DWORD, NKeySystemExecutor, "UseAppPath",&Opt.ExecuteUseAppPath,1, 0},
+ {0, REG_DWORD, NKeySystemExecutor, "ShowErrorMessage",&Opt.ExecuteShowErrorMessage,1, 0},
+ {0, REG_SZ, NKeySystemExecutor, "BatchType",&Opt.strExecuteBatchType,0,constBatchExt},
+ {0, REG_DWORD, NKeySystemExecutor, "FullTitle",&Opt.ExecuteFullTitle,0, 0},
+ {0, REG_DWORD, NKeySystemExecutor, "SilentExternal",&Opt.ExecuteSilentExternal,0, 0},
+
+ {0, REG_DWORD, NKeyPanelTree, "MinTreeCount",&Opt.Tree.MinTreeCount, 4, 0},
+ {0, REG_DWORD, NKeyPanelTree, "TreeFileAttr",&Opt.Tree.TreeFileAttr, FILE_ATTRIBUTE_HIDDEN, 0},
+ {0, REG_DWORD, NKeyPanelTree, "LocalDisk",&Opt.Tree.LocalDisk, 2, 0},
+ {0, REG_DWORD, NKeyPanelTree, "NetDisk",&Opt.Tree.NetDisk, 2, 0},
+ {0, REG_DWORD, NKeyPanelTree, "RemovableDisk",&Opt.Tree.RemovableDisk, 2, 0},
+ {0, REG_DWORD, NKeyPanelTree, "NetPath",&Opt.Tree.NetPath, 2, 0},
+ {1, REG_DWORD, NKeyPanelTree, "AutoChangeFolder",&Opt.Tree.AutoChangeFolder,0, 0}, // ???
+
+ {0, REG_DWORD, NKeyHelp, "ActivateURL",&Opt.HelpURLRules,1, 0},
+
+ {1, REG_SZ, NKeyLanguage, "Help",&Opt.strHelpLanguage, 0, L"English"},
+ {1, REG_SZ, NKeyLanguage, "Main",&Opt.strLanguage, 0, L"English"},
+
+ {1, REG_DWORD, NKeyConfirmations, "Copy",&Opt.Confirm.Copy,1, 0},
+ {1, REG_DWORD, NKeyConfirmations, "Move",&Opt.Confirm.Move,1, 0},
+ {1, REG_DWORD, NKeyConfirmations, "RO",&Opt.Confirm.RO,1, 0},
+ {1, REG_DWORD, NKeyConfirmations, "Drag",&Opt.Confirm.Drag,1, 0},
+ {1, REG_DWORD, NKeyConfirmations, "Delete",&Opt.Confirm.Delete,1, 0},
+ {1, REG_DWORD, NKeyConfirmations, "DeleteFolder",&Opt.Confirm.DeleteFolder,1, 0},
+ {1, REG_DWORD, NKeyConfirmations, "Esc",&Opt.Confirm.Esc,1, 0},
+ {1, REG_DWORD, NKeyConfirmations, "RemoveConnection",&Opt.Confirm.RemoveConnection,1, 0},
+ {1, REG_DWORD, NKeyConfirmations, "RemoveSUBST",&Opt.Confirm.RemoveSUBST,1, 0},
+ {1, REG_DWORD, NKeyConfirmations, "DetachVHD",&Opt.Confirm.DetachVHD,1, 0},
+ {1, REG_DWORD, NKeyConfirmations, "RemoveHotPlug",&Opt.Confirm.RemoveHotPlug,1, 0},
+ {1, REG_DWORD, NKeyConfirmations, "AllowReedit",&Opt.Confirm.AllowReedit,1, 0},
+ {1, REG_DWORD, NKeyConfirmations, "HistoryClear",&Opt.Confirm.HistoryClear,1, 0},
+ {1, REG_DWORD, NKeyConfirmations, "Exit",&Opt.Confirm.Exit,1, 0},
+ {0, REG_DWORD, NKeyConfirmations, "EscTwiceToInterrupt",&Opt.Confirm.EscTwiceToInterrupt,0, 0},
+
+ {1, REG_DWORD, NKeyPluginConfirmations, "OpenFilePlugin", &Opt.PluginConfirm.OpenFilePlugin, 0, 0},
+ {1, REG_DWORD, NKeyPluginConfirmations, "StandardAssociation", &Opt.PluginConfirm.StandardAssociation, 0, 0},
+ {1, REG_DWORD, NKeyPluginConfirmations, "EvenIfOnlyOnePlugin", &Opt.PluginConfirm.EvenIfOnlyOnePlugin, 0, 0},
+ {1, REG_DWORD, NKeyPluginConfirmations, "SetFindList", &Opt.PluginConfirm.SetFindList, 0, 0},
+ {1, REG_DWORD, NKeyPluginConfirmations, "Prefix", &Opt.PluginConfirm.Prefix, 0, 0},
+
+ {0, REG_DWORD, NKeyPanel, "ShellRightLeftArrowsRule",&Opt.ShellRightLeftArrowsRule,0, 0},
+ {1, REG_DWORD, NKeyPanel, "ShowHidden",&Opt.ShowHidden,1, 0},
+ {1, REG_DWORD, NKeyPanel, "Highlight",&Opt.Highlight,1, 0},
+ {1, REG_DWORD, NKeyPanel, "SortFolderExt",&Opt.SortFolderExt,0, 0},
+ {1, REG_DWORD, NKeyPanel, "SelectFolders",&Opt.SelectFolders,0, 0},
+ {1, REG_DWORD, NKeyPanel, "ReverseSort",&Opt.ReverseSort,1, 0},
+ {0, REG_DWORD, NKeyPanel, "RightClickRule",&Opt.PanelRightClickRule,2, 0},
+ {0, REG_DWORD, NKeyPanel, "CtrlFRule",&Opt.PanelCtrlFRule,1, 0},
+ {0, REG_DWORD, NKeyPanel, "CtrlAltShiftRule",&Opt.PanelCtrlAltShiftRule,0, 0},
+ {0, REG_DWORD, NKeyPanel, "RememberLogicalDrives",&Opt.RememberLogicalDrives, 0, 0},
+ {1, REG_DWORD, NKeyPanel, "AutoUpdateLimit",&Opt.AutoUpdateLimit, 0, 0},
+
+ {1, REG_DWORD, NKeyPanelLeft, "Type",&Opt.LeftPanel.Type,0, 0},
+ {1, REG_DWORD, NKeyPanelLeft, "Visible",&Opt.LeftPanel.Visible,1, 0},
+ {1, REG_DWORD, NKeyPanelLeft, "Focus",&Opt.LeftPanel.Focus,1, 0},
+ {1, REG_DWORD, NKeyPanelLeft, "ViewMode",&Opt.LeftPanel.ViewMode,2, 0},
+ {1, REG_DWORD, NKeyPanelLeft, "SortMode",&Opt.LeftPanel.SortMode,1, 0},
+ {1, REG_DWORD, NKeyPanelLeft, "SortOrder",&Opt.LeftPanel.SortOrder,1, 0},
+ {1, REG_DWORD, NKeyPanelLeft, "SortGroups",&Opt.LeftPanel.SortGroups,0, 0},
+ {1, REG_DWORD, NKeyPanelLeft, "NumericSort",&Opt.LeftPanel.NumericSort,0, 0},
+ {1, REG_DWORD, NKeyPanelLeft, "CaseSensitiveSortNix",&Opt.LeftPanel.CaseSensitiveSort,1, 0},
+ {1, REG_SZ, NKeyPanelLeft, "Folder",&Opt.strLeftFolder, 0, L""},
+ {1, REG_SZ, NKeyPanelLeft, "CurFile",&Opt.strLeftCurFile, 0, L""},
+ {1, REG_DWORD, NKeyPanelLeft, "SelectedFirst",&Opt.LeftSelectedFirst,0,0},
+ {1, REG_DWORD, NKeyPanelLeft, "DirectoriesFirst",&Opt.LeftPanel.DirectoriesFirst,1,0},
+
+ {1, REG_DWORD, NKeyPanelRight, "Type",&Opt.RightPanel.Type,0, 0},
+ {1, REG_DWORD, NKeyPanelRight, "Visible",&Opt.RightPanel.Visible,1, 0},
+ {1, REG_DWORD, NKeyPanelRight, "Focus",&Opt.RightPanel.Focus,0, 0},
+ {1, REG_DWORD, NKeyPanelRight, "ViewMode",&Opt.RightPanel.ViewMode,2, 0},
+ {1, REG_DWORD, NKeyPanelRight, "SortMode",&Opt.RightPanel.SortMode,1, 0},
+ {1, REG_DWORD, NKeyPanelRight, "SortOrder",&Opt.RightPanel.SortOrder,1, 0},
+ {1, REG_DWORD, NKeyPanelRight, "SortGroups",&Opt.RightPanel.SortGroups,0, 0},
+ {1, REG_DWORD, NKeyPanelRight, "NumericSort",&Opt.RightPanel.NumericSort,0, 0},
+ {1, REG_DWORD, NKeyPanelRight, "CaseSensitiveSortNix",&Opt.RightPanel.CaseSensitiveSort,1, 0},
+ {1, REG_SZ, NKeyPanelRight, "Folder",&Opt.strRightFolder, 0,L""},
+ {1, REG_SZ, NKeyPanelRight, "CurFile",&Opt.strRightCurFile, 0,L""},
+ {1, REG_DWORD, NKeyPanelRight, "SelectedFirst",&Opt.RightSelectedFirst,0, 0},
+ {1, REG_DWORD, NKeyPanelRight, "DirectoriesFirst",&Opt.RightPanel.DirectoriesFirst,1,0},
+
+ {1, REG_DWORD, NKeyPanelLayout, "ColumnTitles",&Opt.ShowColumnTitles,1, 0},
+ {1, REG_DWORD, NKeyPanelLayout, "StatusLine",&Opt.ShowPanelStatus,1, 0},
+ {1, REG_DWORD, NKeyPanelLayout, "TotalInfo",&Opt.ShowPanelTotals,1, 0},
+ {1, REG_DWORD, NKeyPanelLayout, "FreeInfo",&Opt.ShowPanelFree,0, 0},
+ {1, REG_DWORD, NKeyPanelLayout, "Scrollbar",&Opt.ShowPanelScrollbar,0, 0},
+ {0, REG_DWORD, NKeyPanelLayout, "ScrollbarMenu",&Opt.ShowMenuScrollbar,1, 0},
+ {1, REG_DWORD, NKeyPanelLayout, "ScreensNumber",&Opt.ShowScreensNumber,1, 0},
+ {1, REG_DWORD, NKeyPanelLayout, "SortMode",&Opt.ShowSortMode,1, 0},
+
+ {1, REG_DWORD, NKeyLayout, "LeftHeightDecrement",&Opt.LeftHeightDecrement,0, 0},
+ {1, REG_DWORD, NKeyLayout, "RightHeightDecrement",&Opt.RightHeightDecrement,0, 0},
+ {1, REG_DWORD, NKeyLayout, "WidthDecrement",&Opt.WidthDecrement,0, 0},
+ {1, REG_DWORD, NKeyLayout, "FullscreenHelp",&Opt.FullScreenHelp,0, 0},
+
+ {1, REG_SZ, NKeyDescriptions, "ListNames",&Opt.Diz.strListNames, 0, L"Descript.ion,Files.bbs"},
+ {1, REG_DWORD, NKeyDescriptions, "UpdateMode",&Opt.Diz.UpdateMode,DIZ_UPDATE_IF_DISPLAYED, 0},
+ {1, REG_DWORD, NKeyDescriptions, "ROUpdate",&Opt.Diz.ROUpdate,0, 0},
+ {1, REG_DWORD, NKeyDescriptions, "SetHidden",&Opt.Diz.SetHidden,1, 0},
+ {1, REG_DWORD, NKeyDescriptions, "StartPos",&Opt.Diz.StartPos,0, 0},
+ {1, REG_DWORD, NKeyDescriptions, "AnsiByDefault",&Opt.Diz.AnsiByDefault,0, 0},
+ {1, REG_DWORD, NKeyDescriptions, "SaveInUTF",&Opt.Diz.SaveInUTF,0, 0},
+
+ {0, REG_DWORD, NKeyKeyMacros, "MacroReuseRules",&Opt.Macro.MacroReuseRules,0, 0},
+ {0, REG_SZ, NKeyKeyMacros, "DateFormat",&Opt.Macro.strDateFormat, 0, L"%a %b %d %H:%M:%S %Z %Y"},
+ {0, REG_SZ, NKeyKeyMacros, "CONVFMT",&Opt.Macro.strMacroCONVFMT, 0, L"%.6g"},
+ {0, REG_DWORD, NKeyKeyMacros, "CallPluginRules",&Opt.Macro.CallPluginRules,0, 0},
+
+ {0, REG_DWORD, NKeyPolicies, "ShowHiddenDrives",&Opt.Policies.ShowHiddenDrives,1, 0},
+ {0, REG_DWORD, NKeyPolicies, "DisabledOptions",&Opt.Policies.DisabledOptions,0, 0},
+
+
+ {0, REG_DWORD, NKeySystem, "ExcludeCmdHistory",&Opt.ExcludeCmdHistory,0, 0}, //AN
+
+ {1, REG_DWORD, NKeyCodePages, "CPMenuMode2",&Opt.CPMenuMode,1,0},
+
+ {1, REG_SZ, NKeySystem, "FolderInfo",&Opt.InfoPanel.strFolderInfoFiles, 0, L"DirInfo,File_Id.diz,Descript.ion,ReadMe.*,Read.Me"},
+
+ {1, REG_DWORD, NKeyVMenu, "LBtnClick",&Opt.VMenu.LBtnClick, VMENUCLICK_CANCEL, 0},
+ {1, REG_DWORD, NKeyVMenu, "RBtnClick",&Opt.VMenu.RBtnClick, VMENUCLICK_CANCEL, 0},
+ {1, REG_DWORD, NKeyVMenu, "MBtnClick",&Opt.VMenu.MBtnClick, VMENUCLICK_APPLY, 0},
+};
+
+static bool g_config_ready = false;
+
+void ReadConfig()
+{
+ FARString strKeyNameFromReg;
+ FARString strPersonalPluginsPath;
+ size_t I;
+
+ ConfigReader cfg_reader;
+
+ /* <ПРЕПРОЦЕССЫ> *************************************************** */
+ cfg_reader.SelectSection(NKeySystem);
+ Opt.LoadPlug.strPersonalPluginsPath = cfg_reader.GetString("PersonalPluginsPath", L"");
+ bool ExplicitWindowMode=Opt.WindowMode!=FALSE;
+ //Opt.LCIDSort=LOCALE_USER_DEFAULT; // проинициализируем на всякий случай
+ /* *************************************************** </ПРЕПРОЦЕССЫ> */
+
+ for (I=0; I < ARRAYSIZE(CFG); ++I)
+ {
+ cfg_reader.SelectSection(CFG[I].KeyName);
+ switch (CFG[I].ValType)
+ {
+ case REG_DWORD:
+ if ((int *)CFG[I].ValPtr == &Opt.Confirm.Exit) {
+ // when background mode available then exit dialog allows also switch to background
+ // so saved settings must differ for that two modes
+ CFG[I].ValName = WINPORT(ConsoleBackgroundMode)(FALSE) ? "ExitOrBknd" : "Exit";
+ }
+ *(unsigned int *)CFG[I].ValPtr = cfg_reader.GetUInt(CFG[I].ValName, (unsigned int)CFG[I].DefDWord);
+ break;
+ case REG_SZ:
+ *(FARString *)CFG[I].ValPtr = cfg_reader.GetString(CFG[I].ValName, CFG[I].DefStr);
+ break;
+ case REG_BINARY:
+ int Size = cfg_reader.GetBytes((BYTE*)CFG[I].ValPtr, CFG[I].DefDWord, CFG[I].ValName, (BYTE*)CFG[I].DefStr);
+ if (Size > 0 && Size < (int)CFG[I].DefDWord)
+ memset(((BYTE*)CFG[I].ValPtr)+Size,0,CFG[I].DefDWord-Size);
+
+ break;
+ }
+ }
+
+ /* <ПОСТПРОЦЕССЫ> *************************************************** */
+
+ SanitizeHistoryCounts();
+
+ if (Opt.ShowMenuBar)
+ Opt.ShowMenuBar=1;
+
+ if (Opt.PluginMaxReadData < 0x1000) // || Opt.PluginMaxReadData > 0x80000)
+ Opt.PluginMaxReadData=0x20000;
+
+ if(ExplicitWindowMode)
+ {
+ Opt.WindowMode=TRUE;
+ }
+
+ Opt.HelpTabSize=8; // пока жестко пропишем...
+ // Уточняем алгоритм "взятия" палитры.
+ for (I=COL_PRIVATEPOSITION_FOR_DIF165ABOVE-COL_FIRSTPALETTECOLOR+1;
+ I < (COL_LASTPALETTECOLOR-COL_FIRSTPALETTECOLOR);
+ ++I)
+ {
+ if (!Palette[I])
+ {
+ if (!Palette[COL_PRIVATEPOSITION_FOR_DIF165ABOVE-COL_FIRSTPALETTECOLOR])
+ Palette[I]=DefaultPalette[I];
+ else if (Palette[COL_PRIVATEPOSITION_FOR_DIF165ABOVE-COL_FIRSTPALETTECOLOR] == 1)
+ Palette[I]=BlackPalette[I];
+
+ /*
+ else
+ в других случаях нифига ничего не делаем, т.к.
+ есть другие палитры...
+ */
+ }
+ }
+
+ Opt.ViOpt.ViewerIsWrap&=1;
+ Opt.ViOpt.ViewerWrap&=1;
+
+ // Исключаем случайное стирание разделителей ;-)
+ if (Opt.strWordDiv.IsEmpty())
+ Opt.strWordDiv = WordDiv0;
+
+ // Исключаем случайное стирание разделителей
+ if (Opt.XLat.strWordDivForXlat.IsEmpty())
+ Opt.XLat.strWordDivForXlat = WordDivForXlat0;
+
+ Opt.PanelRightClickRule%=3;
+ Opt.PanelCtrlAltShiftRule%=3;
+ Opt.ConsoleDetachKey=KeyNameToKey(strKeyNameConsoleDetachKey);
+
+ if (Opt.EdOpt.TabSize<1 || Opt.EdOpt.TabSize>512)
+ Opt.EdOpt.TabSize=8;
+
+ if (Opt.ViOpt.TabSize<1 || Opt.ViOpt.TabSize>512)
+ Opt.ViOpt.TabSize=8;
+
+ cfg_reader.SelectSection(NKeyKeyMacros);
+
+ strKeyNameFromReg = cfg_reader.GetString("KeyRecordCtrlDot", szCtrlDot);
+
+ if ((Opt.Macro.KeyMacroCtrlDot=KeyNameToKey(strKeyNameFromReg)) == KEY_INVALID)
+ Opt.Macro.KeyMacroCtrlDot=KEY_CTRLDOT;
+
+ strKeyNameFromReg = cfg_reader.GetString("KeyRecordCtrlShiftDot", szCtrlShiftDot);
+
+ if ((Opt.Macro.KeyMacroCtrlShiftDot=KeyNameToKey(strKeyNameFromReg)) == KEY_INVALID)
+ Opt.Macro.KeyMacroCtrlShiftDot=KEY_CTRLSHIFTDOT;
+
+ Opt.EdOpt.strWordDiv = Opt.strWordDiv;
+ FileList::ReadPanelModes(cfg_reader);
+
+ if (Opt.strExecuteBatchType.IsEmpty()) // предохраняемся
+ Opt.strExecuteBatchType=constBatchExt;
+
+ {
+ Opt.XLat.CurrentLayout=0;
+ memset(Opt.XLat.Layouts,0,sizeof(Opt.XLat.Layouts));
+ cfg_reader.SelectSection(NKeyXLat);
+ FARString strXLatLayouts = cfg_reader.GetString("Layouts", L"");
+
+ if (!strXLatLayouts.IsEmpty())
+ {
+ wchar_t *endptr;
+ const wchar_t *ValPtr;
+ UserDefinedList DestList;
+ DestList.SetParameters(L';',0,ULF_UNIQUE);
+ DestList.Set(strXLatLayouts);
+ I=0;
+
+ for (size_t DLI = 0; nullptr!=(ValPtr=DestList.Get(DLI)); ++DLI)
+ {
+ DWORD res=(DWORD)wcstoul(ValPtr, &endptr, 16);
+ Opt.XLat.Layouts[I]=(HKL)(LONG_PTR)(HIWORD(res)? res : MAKELONG(res,res));
+ ++I;
+
+ if (I >= ARRAYSIZE(Opt.XLat.Layouts))
+ break;
+ }
+
+ if (I <= 1) // если указано меньше двух - "откключаем" эту
+ Opt.XLat.Layouts[0]=0;
+ }
+ }
+
+ memset(Opt.FindOpt.OutColumnTypes,0,sizeof(Opt.FindOpt.OutColumnTypes));
+ memset(Opt.FindOpt.OutColumnWidths,0,sizeof(Opt.FindOpt.OutColumnWidths));
+ memset(Opt.FindOpt.OutColumnWidthType,0,sizeof(Opt.FindOpt.OutColumnWidthType));
+ Opt.FindOpt.OutColumnCount=0;
+
+
+ if (!Opt.FindOpt.strSearchOutFormat.IsEmpty())
+ {
+ if (Opt.FindOpt.strSearchOutFormatWidth.IsEmpty())
+ Opt.FindOpt.strSearchOutFormatWidth=L"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0";
+ TextToViewSettings(Opt.FindOpt.strSearchOutFormat.CPtr(),Opt.FindOpt.strSearchOutFormatWidth.CPtr(),
+ Opt.FindOpt.OutColumnTypes,Opt.FindOpt.OutColumnWidths,Opt.FindOpt.OutColumnWidthType,
+ Opt.FindOpt.OutColumnCount);
+ }
+
+ FileFilter::InitFilter(cfg_reader);
+
+ g_config_ready = true;
+ /* *************************************************** </ПОСТПРОЦЕССЫ> */
+}
+
+void ApplyConfig()
+{
+ ApplySudoConfiguration();
+ ApplyConsoleTweaks();
+}
+
+void AssertConfigLoaded()
+{
+ if (!g_config_ready)
+ {
+ fprintf(stderr, "%s: oops\n", __FUNCTION__);
+ abort();
+ }
+}
+
+void SaveConfig(int Ask)
+{
+ if (Opt.Policies.DisabledOptions&0x20000) // Bit 17 - Сохранить параметры
+ return;
+
+ if (Ask && Message(0,2,MSG(MSaveSetupTitle),MSG(MSaveSetupAsk1),MSG(MSaveSetupAsk2),MSG(MSaveSetup),MSG(MCancel)))
+ return;
+
+ /* <ПРЕПРОЦЕССЫ> *************************************************** */
+ Panel *LeftPanel=CtrlObject->Cp()->LeftPanel;
+ Panel *RightPanel=CtrlObject->Cp()->RightPanel;
+ Opt.LeftPanel.Focus=LeftPanel->GetFocus();
+ Opt.LeftPanel.Visible=LeftPanel->IsVisible();
+ Opt.RightPanel.Focus=RightPanel->GetFocus();
+ Opt.RightPanel.Visible=RightPanel->IsVisible();
+
+ if (LeftPanel->GetMode()==NORMAL_PANEL)
+ {
+ Opt.LeftPanel.Type=LeftPanel->GetType();
+ Opt.LeftPanel.ViewMode=LeftPanel->GetViewMode();
+ Opt.LeftPanel.SortMode=LeftPanel->GetSortMode();
+ Opt.LeftPanel.SortOrder=LeftPanel->GetSortOrder();
+ Opt.LeftPanel.SortGroups=LeftPanel->GetSortGroups();
+ Opt.LeftPanel.NumericSort=LeftPanel->GetNumericSort();
+ Opt.LeftPanel.CaseSensitiveSort=LeftPanel->GetCaseSensitiveSort();
+ Opt.LeftSelectedFirst=LeftPanel->GetSelectedFirstMode();
+ Opt.LeftPanel.DirectoriesFirst=LeftPanel->GetDirectoriesFirst();
+ }
+
+ LeftPanel->GetCurDir(Opt.strLeftFolder);
+ LeftPanel->GetCurBaseName(Opt.strLeftCurFile);
+
+ if (RightPanel->GetMode()==NORMAL_PANEL)
+ {
+ Opt.RightPanel.Type=RightPanel->GetType();
+ Opt.RightPanel.ViewMode=RightPanel->GetViewMode();
+ Opt.RightPanel.SortMode=RightPanel->GetSortMode();
+ Opt.RightPanel.SortOrder=RightPanel->GetSortOrder();
+ Opt.RightPanel.SortGroups=RightPanel->GetSortGroups();
+ Opt.RightPanel.NumericSort=RightPanel->GetNumericSort();
+ Opt.RightPanel.CaseSensitiveSort=RightPanel->GetCaseSensitiveSort();
+ Opt.RightSelectedFirst=RightPanel->GetSelectedFirstMode();
+ Opt.RightPanel.DirectoriesFirst=RightPanel->GetDirectoriesFirst();
+ }
+
+ RightPanel->GetCurDir(Opt.strRightFolder);
+ RightPanel->GetCurBaseName(Opt.strRightCurFile);
+ CtrlObject->HiFiles->SaveHiData();
+
+ ConfigWriter cfg_writer;
+
+ /* *************************************************** </ПРЕПРОЦЕССЫ> */
+ cfg_writer.SelectSection(NKeySystem);
+ cfg_writer.SetString("PersonalPluginsPath", Opt.LoadPlug.strPersonalPluginsPath);
+// cfg_writer.SetString(NKeyLanguage, "Main", Opt.strLanguage);
+
+ for (size_t I=0; I < ARRAYSIZE(CFG); ++I)
+ {
+ if (CFG[I].IsSave)
+ {
+ cfg_writer.SelectSection(CFG[I].KeyName);
+ switch (CFG[I].ValType)
+ {
+ case REG_DWORD:
+ cfg_writer.SetUInt(CFG[I].ValName, *(unsigned int *)CFG[I].ValPtr);
+ break;
+ case REG_SZ:
+ cfg_writer.SetString(CFG[I].ValName, ((const FARString *)CFG[I].ValPtr)->CPtr());
+ break;
+ case REG_BINARY:
+ cfg_writer.SetBytes(CFG[I].ValName, (const BYTE*)CFG[I].ValPtr, CFG[I].DefDWord);
+ break;
+ }
+ }
+ }
+
+ /* <ПОСТПРОЦЕССЫ> *************************************************** */
+ FileFilter::SaveFilters(cfg_writer);
+ FileList::SavePanelModes(cfg_writer);
+
+ if (Ask)
+ CtrlObject->Macro.SaveMacros();
+
+ /* *************************************************** </ПОСТПРОЦЕССЫ> */
+}
+
+void LanguageSettings()
+{
+ VMenu *LangMenu, *HelpMenu;
+
+ if (Select(FALSE, &LangMenu))
+ {
+ Lang.Close();
+
+ if (!Lang.Init(g_strFarPath, true, MNewFileName))
+ {
+ Message(MSG_WARNING, 1, L"Error", L"Cannot load language data", L"Ok");
+ exit(0);
+ }
+
+ Select(TRUE,&HelpMenu);
+ delete HelpMenu;
+ LangMenu->Hide();
+ CtrlObject->Plugins.ReloadLanguage();
+ setenv("FARLANG", Opt.strLanguage.GetMB().c_str(), 1);
+ PrepareStrFTime();
+ PrepareUnitStr();
+ FrameManager->InitKeyBar();
+ CtrlObject->Cp()->RedrawKeyBar();
+ CtrlObject->Cp()->SetScreenPosition();
+ ApplySudoConfiguration();
+ }
+ delete LangMenu; //???? BUGBUG
+}
diff --git a/far2l/src/cfg/config.hpp b/far2l/src/cfg/config.hpp
new file mode 100644
index 00000000..a7f1e6c7
--- /dev/null
+++ b/far2l/src/cfg/config.hpp
@@ -0,0 +1,615 @@
+#pragma once
+
+/*
+config.hpp
+
+Конфигурация
+*/
+/*
+Copyright (c) 1996 Eugene Roshal
+Copyright (c) 2000 Far Group
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the authors may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "FARString.hpp"
+
+// +CASR_* Поведение Ctrl-Alt-Shift для AllCtrlAltShiftRule
+enum
+{
+ CASR_PANEL = 0x0001,
+ CASR_EDITOR = 0x0002,
+ CASR_VIEWER = 0x0004,
+ CASR_HELP = 0x0008,
+ CASR_DIALOG = 0x0010,
+};
+
+enum ExcludeCmdHistoryType
+{
+ EXCLUDECMDHISTORY_NOTWINASS = 0x00000001, // не помещать в историю команды ассоциаций Windows
+ EXCLUDECMDHISTORY_NOTFARASS = 0x00000002, // не помещать в историю команды выполнения ассоциаций файлов
+ EXCLUDECMDHISTORY_NOTPANEL = 0x00000004, // не помещать в историю команды выполнения с панели
+ EXCLUDECMDHISTORY_NOTCMDLINE = 0x00000008, // не помещать в историю команды выполнения с ком.строки
+ //EXCLUDECMDHISTORY_NOTAPPLYCMD = 0x00000010, // не помещать в историю команды выполнения из "Apply Commang"
+};
+
+// для Opt.QuotedName
+enum QUOTEDNAMETYPE
+{
+ QUOTEDNAME_INSERT = 0x00000001, // кавычить при сбросе в командную строку, в диалогах и редакторе
+ QUOTEDNAME_CLIPBOARD = 0x00000002, // кавычить при помещении в буфер обмена
+};
+
+//Для Opt.Dialogs.MouseButton
+#define DMOUSEBUTTON_LEFT 0x00000001
+#define DMOUSEBUTTON_RIGHT 0x00000002
+
+//Для Opt.VMenu.xBtnClick
+#define VMENUCLICK_IGNORE 0
+#define VMENUCLICK_CANCEL 1
+#define VMENUCLICK_APPLY 2
+
+//Для Opt.Diz.UpdateMode
+enum DIZUPDATETYPE
+{
+ DIZ_NOT_UPDATE,
+ DIZ_UPDATE_IF_DISPLAYED,
+ DIZ_UPDATE_ALWAYS
+};
+
+struct PanelOptions
+{
+ int Type;
+ int Visible;
+ int Focus;
+ int ViewMode;
+ int SortMode;
+ int SortOrder;
+ int SortGroups;
+ int NumericSort;
+ int CaseSensitiveSort;
+ int DirectoriesFirst;
+};
+
+struct AutoCompleteOptions
+{
+ int ShowList;
+ int ModalList;
+ int AppendCompletion;
+ FARString Exceptions;
+};
+
+
+struct PluginConfirmation
+{
+ int OpenFilePlugin;
+ int StandardAssociation;
+ int EvenIfOnlyOnePlugin;
+ int SetFindList;
+ int Prefix;
+};
+
+struct Confirmation
+{
+ int Copy;
+ int Move;
+ int RO;
+ int Drag;
+ int Delete;
+ int DeleteFolder;
+ int Exit;
+ int Esc; // Для CheckForEsc
+ /* $ 12.03.2002 VVM
+ + Opt.EscTwiceToInterrupt
+ Определяет поведение при прерывании длительной операции
+ 0 - второй ESC продолжает операцию
+ 1 - второй ESC прерывает операцию */
+ int EscTwiceToInterrupt;
+ int RemoveConnection;
+ /* $ 23.05.2001
+ + Opt.Confirmation.AllowReedit - Флаг, который изменяет поведение открытия
+ файла на редактирование если, данный файл уже редактируется. По умолчанию - 1
+ 0 - Если уже открытый файл не был изменен, то происходит переход к открытому редактору
+ без дополнительных вопросов. Если файл был изменен, то задается вопрос, и в случае
+ если выбран вариант Reload, то загружается новая копия файла, при этом сделанные
+ изменения теряются.
+ 1 - Так как было раньше. Задается вопрос и происходит переход либо уже к открытому файлу
+ либо загружается новая версия редактора.
+ */
+ int AllowReedit;
+ int HistoryClear;
+ int RemoveSUBST;
+ int RemoveHotPlug;
+ int DetachVHD;
+};
+
+struct DizOptions
+{
+ FARString strListNames;
+ int ROUpdate;
+ int UpdateMode;
+ int SetHidden;
+ int StartPos;
+ int AnsiByDefault;
+ int SaveInUTF;
+};
+
+struct CodeXLAT
+{
+ DWORD Flags; // дополнительные флаги
+
+ /* $ 25.11.2000 IS
+ Разграничитель слов из реестра для функции Xlat
+ */
+ FARString strWordDivForXlat;
+ HKL Layouts[10];
+ int CurrentLayout;
+
+ FARString Table[2]; // [0] non-english буквы, [1] english буквы
+ FARString Rules[3]; // правила:
+ // [0] "если предыдущий символ латинский"
+ // [1] "если предыдущий символ нелатинский символ"
+ // [2] "если предыдущий символ не рус/lat"
+};
+
+struct NotificationsOptions
+{
+ int OnFileOperation;
+ int OnConsole;
+
+ int OnlyIfBackground;
+};
+
+struct EditorOptions
+{
+ int TabSize;
+ int ExpandTabs;
+ int PersistentBlocks;
+ int DelRemovesBlocks;
+ int AutoIndent;
+ int AutoDetectCodePage;
+ UINT DefaultCodePage;
+ int CursorBeyondEOL;
+ int BSLikeDel;
+ int CharCodeBase;
+ int SavePos;
+ int SaveShortPos;
+ int F7Rules; // $ 28.11.2000 SVS - Правило на счет поиска в редакторе
+ int AllowEmptySpaceAfterEof; // $ 21.06.2005 SKV - разрешить показывать пустое пространство после последней строки редактируемого файла.
+ int ReadOnlyLock; // $ 29.11.2000 SVS - лочить файл при открытии в редакторе, если он имеет атрибуты R|S|H
+ int UndoSize; // $ 03.12.2001 IS - размер буфера undo в редакторе
+ int UseExternalEditor;
+ DWORD FileSizeLimitLo;
+ DWORD FileSizeLimitHi;
+ int ShowKeyBar;
+ int ShowTitleBar;
+ int ShowScrollBar;
+ int EditOpenedForWrite;
+ int SearchSelFound;
+ int SearchRegexp;
+ int SearchPickUpWord;
+ int ShowWhiteSpace;
+
+ FARString strWordDiv;
+};
+
+/* $ 29.03.2001 IS
+ Тут следует хранить "локальные" настройки для программы просмотра
+*/
+struct ViewerOptions
+{
+ int TabSize;
+ int AutoDetectCodePage;
+ int ShowScrollbar; // $ 18.07.2000 tran пара настроек для viewer
+ int ShowArrows;
+ int PersistentBlocks; // $ 14.05.2002 VVM Постоянные блоки во вьюере
+ int ViewerIsWrap; // (Wrap|WordWarp)=1 | UnWrap=0
+ int ViewerWrap; // Wrap=0|WordWarp=1
+ int SavePos;
+ int SaveShortPos;
+ int UseExternalViewer;
+ int ShowKeyBar; // $ 15.07.2000 tran + ShowKeyBar
+ UINT DefaultCodePage;
+ int ShowTitleBar;
+ int SearchRegexp;
+};
+
+// "Полиция"
+struct PoliciesOptions
+{
+ int DisabledOptions; // разрешенность меню конфигурации
+ int ShowHiddenDrives; // показывать скрытые логические диски
+};
+
+struct DialogsOptions
+{
+ int EditBlock; // Постоянные блоки в строках ввода
+ int EditHistory; // Добавлять в историю?
+ int AutoComplete; // Разрешено автодополнение?
+ int EULBsClear; // = 1 - BS в диалогах для UnChanged строки удаляет такую строку также, как и Del
+ int SelectFromHistory; // = 0 then (ctrl-down в строке с историей курсор устанавливался на самую верхнюю строку)
+ DWORD EditLine; // общая информация о строке ввода (сейчас это пока... позволяет управлять выделением)
+ int MouseButton; // Отключение восприятия правой/левой кнопки мыши как команд закрытия окна диалога
+ int DelRemovesBlocks;
+ int CBoxMaxHeight; // максимальный размер открываемого списка (по умолчанию=8)
+};
+
+struct VMenuOptions
+{
+ int LBtnClick;
+ int RBtnClick;
+ int MBtnClick;
+};
+
+struct CommandLineOptions
+{
+ int EditBlock;
+ int DelRemovesBlocks;
+ int AutoComplete;
+ int UsePromptFormat;
+ int UseShell;
+ int WaitKeypress;
+ FARString strPromptFormat;
+ FARString strShell;
+};
+
+struct NowellOptions
+{
+ int MoveRO; // перед операцией Move снимать R/S/H атрибуты, после переноса - выставлять обратно
+};
+
+struct ScreenSizes
+{
+ COORD DeltaXY; // на сколько поз. изменить размеры для распахнутого экрана
+ int WScreenSizeSet;
+ COORD WScreenSize[4];
+};
+
+struct LoadPluginsOptions
+{
+// DWORD TypeLoadPlugins; // see TYPELOADPLUGINSOPTIONS
+ int MainPluginDir; // TRUE - использовать стандартный путь к основным плагинам
+ int PluginsCacheOnly; // seting by '/co' switch, not saved in registry
+ int PluginsPersonal;
+
+ FARString strCustomPluginsPath; // путь для поиска плагинов, указанный в /p
+ FARString strPersonalPluginsPath;
+ int SilentLoadPlugin; // при загрузке плагина с кривым...
+ int OEMPluginsSupport;
+ int ScanSymlinks;
+};
+
+struct FindFileOptions
+{
+ int FileSearchMode;
+ bool FindFolders;
+ bool FindSymLinks;
+ bool CollectFiles;
+ bool UseFilter;
+ bool FindAlternateStreams;
+ FARString strSearchInFirstSize;
+
+ FARString strSearchOutFormat;
+ FARString strSearchOutFormatWidth;
+ int OutColumnCount;
+ unsigned int OutColumnTypes[20];
+ int OutColumnWidths[20];
+ int OutColumnWidthType[20];
+};
+
+struct InfoPanelOptions
+{
+ FARString strFolderInfoFiles;
+};
+
+struct TreeOptions
+{
+ int LocalDisk; // Хранить файл структуры папок для локальных дисков
+ int NetDisk; // Хранить файл структуры папок для сетевых дисков
+ int NetPath; // Хранить файл структуры папок для сетевых путей
+ int RemovableDisk; // Хранить файл структуры папок для сменных дисков
+ int MinTreeCount; // Минимальное количество папок для сохранения дерева в файле.
+ int AutoChangeFolder; // автосмена папок при перемещении по дереву
+ DWORD TreeFileAttr; // файловые атрибуты для файлов-деревях
+};
+
+struct CopyMoveOptions
+{
+ int WriteThrough; // disable write caching
+ int CopyXAttr; // copy extended attributes if any
+ int CopyAccessMode; // copy files access mode
+ int CopyOpened; // копировать открытые на запись файлы
+ int CopyShowTotal; // показать общий индикатор копирования
+ int MultiCopy; // "разрешить мультикопирование/перемещение/создание связей"
+ int CopyTimeRule; // $ 30.01.2001 VVM Показывает время копирования,оставшееся время и среднюю скорость
+ int HowCopySymlink;
+ int SparseFiles;
+ int UseCOW;
+};
+
+struct DeleteOptions
+{
+ int DelShowTotal; // показать общий индикатор удаления
+};
+
+struct MacroOptions
+{
+ int MacroReuseRules; // Правило на счет повторно использования забинденных клавиш
+ DWORD DisableMacro; // параметры /m или /ma или /m....
+ DWORD KeyMacroCtrlDot; // аля KEY_CTRLDOT
+ DWORD KeyMacroCtrlShiftDot; // аля KEY_CTRLSHIFTDOT
+ int CallPluginRules; // 0 - блокировать макросы при вызове плагина, 1 - разрешить макросы (ахтунг!)
+ FARString strMacroCONVFMT; // формат преобразования double в строку
+ FARString strDateFormat; // Для $Date
+};
+
+struct Options
+{
+ int Clock;
+ int Mouse;
+ int ShowKeyBar;
+ int ScreenSaver;
+ int ScreenSaverTime;
+ int UseVk_oem_x;
+ int InactivityExit;
+ int InactivityExitTime;
+ int ShowHidden;
+ int Highlight;
+
+ FARString strLeftFolder;
+ FARString strRightFolder;
+
+ FARString strLeftCurFile;
+ FARString strRightCurFile;
+
+ int RightSelectedFirst;
+ int LeftSelectedFirst;
+ int SelectFolders;
+ int ReverseSort;
+ int SortFolderExt;
+ int DeleteToRecycleBin; // удалять в корзину?
+ int DeleteToRecycleBinKillLink; // перед удалением папки в корзину кильнем вложенные симлинки.
+ int WipeSymbol; // символ заполнитель для "ZAP-операции"
+ int SudoEnabled;
+ int SudoConfirmModify;
+ int SudoPasswordExpiration;
+
+ CopyMoveOptions CMOpt;
+
+ DeleteOptions DelOpt;
+
+ int MultiMakeDir; // Опция создания нескольких каталогов за один сеанс
+
+ int ViewerEditorClock;
+
+ enum OnlyEditorViewerUsedT
+ {
+ NOT_ONLY_EDITOR_VIEWER = 0,
+ ONLY_EDITOR,
+ ONLY_VIEWER,
+ ONLY_EDITOR_ON_CMDOUT,
+ ONLY_VIEWER_ON_CMDOUT
+ } OnlyEditorViewerUsed;
+
+ int SaveViewHistory;
+ int ViewHistoryCount;
+
+ FARString strExternalEditor;
+ EditorOptions EdOpt;
+ NotificationsOptions NotifOpt;
+ FARString strExternalViewer;
+ ViewerOptions ViOpt;
+
+
+ FARString strWordDiv; // $ 03.08.2000 SVS Разграничитель слов из реестра
+ FARString strQuotedSymbols;
+ DWORD QuotedName;
+ int AutoSaveSetup;
+ int SetupArgv; // количество каталогов в ком.строке ФАРа
+ int ChangeDriveMode;
+ int ChangeDriveDisconnetMode;
+
+ int SaveHistory;
+ int HistoryCount;
+ int SaveFoldersHistory;
+ int SavePluginFoldersHistory;
+ int FoldersHistoryCount;
+ int DialogsHistoryCount;
+
+ FindFileOptions FindOpt;
+
+ int LeftHeightDecrement;
+ int RightHeightDecrement;
+ int WidthDecrement;
+
+ int ShowColumnTitles;
+ int ShowPanelStatus;
+ int ShowPanelTotals;
+ int ShowPanelFree;
+ int ShowPanelScrollbar;
+ int ShowMenuScrollbar; // $ 29.06.2000 SVS Добавлен атрибут показа Scroll Bar в меню.
+ int ShowScreensNumber;
+ int ShowSortMode;
+ int ShowMenuBar;
+ int FormatNumberSeparators;
+ int CleanAscii;
+ int NoGraphics;
+ int ConsolePaintSharp, ExclusiveCtrlLeft, ExclusiveCtrlRight, ExclusiveAltLeft, ExclusiveAltRight, ExclusiveWinLeft, ExclusiveWinRight;
+
+ Confirmation Confirm;
+ PluginConfirmation PluginConfirm;
+
+ DizOptions Diz;
+
+ int ShellRightLeftArrowsRule;
+ PanelOptions LeftPanel;
+ PanelOptions RightPanel;
+
+ AutoCompleteOptions AutoComplete;
+
+ DWORD AutoUpdateLimit; // выше этого количество автоматически не обновлять панели.
+ int AutoUpdateRemoteDrive;
+
+ FARString strLanguage;
+ int SmallIcon;
+ FARString strRegRoot;
+ int PanelRightClickRule; // задает поведение правой клавиши мыши
+ int PanelCtrlAltShiftRule; // задает поведение Ctrl-Alt-Shift для панелей.
+ // Panel/CtrlFRule в реестре - задает поведение Ctrl-F. Если = 0, то штампуется файл как есть, иначе - с учетом отображения на панели
+ int PanelCtrlFRule;
+ /*
+ битовые флаги, задают поведение Ctrl-Alt-Shift
+ бит установлен - функция включена:
+ 0 - Panel
+ 1 - Edit
+ 2 - View
+ 3 - Help
+ 4 - Dialog
+ */
+ int AllCtrlAltShiftRule;
+
+ int CASRule; // 18.12.2003 - Пробуем различать левый и правый CAS (попытка #1).
+ /*
+ задает поведение Esc для командной строки:
+ =1 - Не изменять положение в History, если после Ctrl-E/Ctrl/-X
+ нажали ESC (поведение - аля VC).
+ =0 - поведение как и было - изменять положение в History
+ */
+ int CmdHistoryRule;
+
+ DWORD ExcludeCmdHistory;
+ int MaxPositionCache; // количество позиций в кэше сохранения
+ int SetAttrFolderRules; // Правило на счет установки атрибутов на каталоги
+ /*
+ + Opt.ShiftsKeyRules - Правило на счет выбора механизма трансляции
+ Alt-Буква для нелатинских буковок и символов "`-=[]\;',./" с
+ модификаторами Alt-, Ctrl-, Alt-Shift-, Ctrl-Shift-, Ctrl-Alt-
+ */
+ int ShiftsKeyRules;
+ int CursorSize[4]; // Размер курсора ФАРа
+
+ CodeXLAT XLat;
+
+ int ConsoleDetachKey; // Комбинация клавиш для детача Far'овской консоли от длительного неинтерактивного процесса в ней запущенного.
+
+ int UsePrintManager;
+
+ FARString strHelpLanguage;
+ int FullScreenHelp;
+ int HelpTabSize;
+
+ int HelpURLRules; // =0 отключить возможность запуска URL-приложений
+
+ // запоминать логические диски и не опрашивать каждый раз. Для предотвращения "просыпания" "зеленых" винтов.
+ int RememberLogicalDrives;
+ /*
+ будет влиять на:
+ добавление файлов в историю с разным регистром
+ добавление LastPositions в редакторе и вьюере
+ */
+ int MsWheelDelta; // задает смещение для прокрутки
+ int MsWheelDeltaView;
+ int MsWheelDeltaEdit;
+ int MsWheelDeltaHelp;
+ // горизонтальная прокрутка
+ int MsHWheelDelta;
+ int MsHWheelDeltaView;
+ int MsHWheelDeltaEdit;
+
+ /* $ 28.04.2001 VVM
+ + Opt.SubstNameRule битовая маска:
+ 0 - если установлен, то опрашивать сменные диски при GetSubstName()
+ 1 - если установлен, то опрашивать все остальные при GetSubstName() */
+ int SubstNameRule;
+
+ int PgUpChangeDisk;
+ int ShowCheckingFile;
+ int CloseConsoleRule;
+
+ DWORD LCIDSort;
+ int RestoreCPAfterExecute;
+ int ExecuteShowErrorMessage;
+ int ExecuteUseAppPath;
+ int ExecuteFullTitle;
+ int ExecuteSilentExternal;
+ FARString strExecuteBatchType;
+
+ DWORD PluginMaxReadData;
+ int UseNumPad;
+ int ScanJunction;
+ int OnlyFilesSize;
+
+ DWORD ShowTimeoutDelFiles; // таймаут в процессе удаления (в ms)
+ DWORD ShowTimeoutDACLFiles;
+ int DelThreadPriority; // приоритет процесса удаления, по умолчанию = THREAD_PRIORITY_NORMAL
+
+ //int CPAJHefuayor; // производное от "Close Plugin And Jump:
+ // Highly experimental feature, use at your own risk"
+
+ LoadPluginsOptions LoadPlug;
+
+ DialogsOptions Dialogs;
+ VMenuOptions VMenu;
+ CommandLineOptions CmdLine;
+ PoliciesOptions Policies;
+ NowellOptions Nowell;
+ ScreenSizes ScrSize;
+ MacroOptions Macro;
+
+ int FindCodePage;
+
+ TreeOptions Tree;
+ InfoPanelOptions InfoPanel;
+
+ DWORD CPMenuMode;
+
+ bool IsUserAdmin;
+ FARString strTitleAddons;
+
+ BOOL WindowMode;
+};
+
+extern Options Opt;
+
+void SystemSettings();
+void PanelSettings();
+void InterfaceSettings();
+void DialogSettings();
+void VMenuSettings();
+void CmdlineSettings();
+void SetConfirmations();
+void PluginsManagerSettings();
+void SetDizConfig();
+void ViewerConfig(ViewerOptions &ViOpt,bool Local=false);
+void EditorConfig(EditorOptions &EdOpt,bool Local=false);
+void NotificationsConfig(NotificationsOptions &NotifOpt);
+void ReadConfig();
+void ApplyConfig();
+void AssertConfigLoaded();
+void SaveConfig(int Ask);
+void SetFolderInfoFiles();
+void InfoPanelSettings();
+void AutoCompleteSettings();
+void LanguageSettings();
+