mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-03 05:57:40 -05:00
impr: Clean up entire API and added doc comments
This commit is contained in:
@@ -57,9 +57,9 @@ namespace hex::plugin::builtin {
|
||||
ContentRegistry::CommandPaletteCommands::Type::SymbolCommand,
|
||||
">",
|
||||
[](const auto &input) {
|
||||
std::vector<ContentRegistry::CommandPaletteCommands::QueryResult> result;
|
||||
std::vector<ContentRegistry::CommandPaletteCommands::impl::QueryResult> result;
|
||||
|
||||
for (const auto &[priority, entry] : ContentRegistry::Interface::getMenuItems()) {
|
||||
for (const auto &[priority, entry] : ContentRegistry::Interface::impl::getMenuItems()) {
|
||||
if (!entry.enabledCallback())
|
||||
continue;
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace hex::plugin::builtin {
|
||||
std::transform(entry.unlocalizedNames.begin(), entry.unlocalizedNames.end(), std::back_inserter(names), [](auto &name) { return LangEntry(name); });
|
||||
|
||||
if (auto combined = wolv::util::combineStrings(names, " -> "); hex::containsIgnoreCase(combined, input) && !combined.contains(ContentRegistry::Interface::impl::SeparatorValue) && !combined.contains(ContentRegistry::Interface::impl::SubMenuValue)) {
|
||||
result.emplace_back(ContentRegistry::CommandPaletteCommands::QueryResult {
|
||||
result.emplace_back(ContentRegistry::CommandPaletteCommands::impl::QueryResult {
|
||||
std::move(combined),
|
||||
[entry](const auto&) { entry.callback(); }
|
||||
});
|
||||
|
||||
@@ -297,7 +297,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
/* Open Other */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.open_other"}, 1150, Shortcut::None, [] {
|
||||
for (const auto &unlocalizedProviderName : ContentRegistry::Provider::getEntries()) {
|
||||
for (const auto &unlocalizedProviderName : ContentRegistry::Provider::impl::getEntries()) {
|
||||
if (ImGui::MenuItem(LangEntry(unlocalizedProviderName)))
|
||||
ImHexApi::Provider::createProvider(unlocalizedProviderName);
|
||||
}
|
||||
@@ -390,7 +390,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
/* Quit ImHex */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.quit"}, 10100, ALT + Keys::F4, [] {
|
||||
ImHexApi::Common::closeImHex();
|
||||
ImHexApi::System::closeImHex();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -415,7 +415,7 @@ namespace hex::plugin::builtin {
|
||||
ContentRegistry::Interface::registerMainMenuItem("hex.builtin.menu.view", 3000);
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.view" }, 1000, [] {
|
||||
for (auto &[name, view] : ContentRegistry::Views::getEntries()) {
|
||||
for (auto &[name, view] : ContentRegistry::Views::impl::getEntries()) {
|
||||
if (view->hasViewMenuItemEntry())
|
||||
ImGui::MenuItem(LangEntry(view->getUnlocalizedName()), "", &view->getWindowOpenState());
|
||||
}
|
||||
@@ -433,11 +433,11 @@ namespace hex::plugin::builtin {
|
||||
ContentRegistry::Interface::registerMainMenuItem("hex.builtin.menu.layout", 4000);
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.layout" }, 1000, [] {
|
||||
for (auto &[layoutName, func] : ContentRegistry::Interface::getLayouts()) {
|
||||
for (auto &[layoutName, func] : ContentRegistry::Interface::impl::getLayouts()) {
|
||||
if (ImGui::MenuItem(LangEntry(layoutName), "", false, ImHexApi::Provider::isValid())) {
|
||||
auto dock = ImHexApi::System::getMainDockSpaceId();
|
||||
|
||||
for (auto &[viewName, view] : ContentRegistry::Views::getEntries()) {
|
||||
for (auto &[viewName, view] : ContentRegistry::Views::impl::getEntries()) {
|
||||
view->getWindowOpenState() = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,13 +22,13 @@ namespace {
|
||||
|
||||
std::vector<std::fs::path> userFolders;
|
||||
|
||||
void loadUserFoldersFromSetting(nlohmann::json &setting) {
|
||||
void loadUserFoldersFromSetting(const std::vector<std::string> &paths) {
|
||||
userFolders.clear();
|
||||
std::vector<std::string> paths = setting;
|
||||
for (const auto &path : paths) {
|
||||
// JSON reads char8_t as array, char8_t is not supported as of now
|
||||
std::u8string_view uString(reinterpret_cast<const char8_t *>(&path.front()), reinterpret_cast<const char8_t *>(std::next(&path.back())));
|
||||
userFolders.emplace_back(uString);
|
||||
userFolders.emplace_back(
|
||||
reinterpret_cast<const char8_t*>(path.data()),
|
||||
reinterpret_cast<const char8_t*>(path.data() + path.size())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace hex::plugin::builtin {
|
||||
if (ImGui::Combo(name.data(), &selection, scaling, IM_ARRAYSIZE(scaling))) {
|
||||
setting = selection;
|
||||
|
||||
ImHexApi::Common::restartImHex();
|
||||
ImHexApi::System::restartImHex();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -618,9 +618,9 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
static void loadFoldersSettings() {
|
||||
static const std::string dirsSetting { "hex.builtin.setting.folders" };
|
||||
auto dirs = ContentRegistry::Settings::getSetting(dirsSetting, dirsSetting);
|
||||
loadUserFoldersFromSetting(dirs);
|
||||
auto directories = ContentRegistry::Settings::read("hex.builtin.setting.folders", "hex.builtin.setting.folders", std::vector<std::string> { });
|
||||
|
||||
loadUserFoldersFromSetting(directories);
|
||||
ImHexApi::System::setAdditionalFolderPaths(userFolders);
|
||||
}
|
||||
|
||||
|
||||
@@ -658,8 +658,8 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
std::string getWikipediaApiUrl() {
|
||||
auto setting = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.wiki_explain_language");
|
||||
return "https://" + std::string(setting) + ".wikipedia.org/w/api.php?format=json&action=query&prop=extracts&explaintext&redirects=10&formatversion=2";
|
||||
auto setting = ContentRegistry::Settings::read("hex.builtin.setting.interface", "hex.builtin.setting.interface.wiki_explain_language", "en");
|
||||
return "https://" + setting + ".wikipedia.org/w/api.php?format=json&action=query&prop=extracts&explaintext&redirects=10&formatversion=2";
|
||||
}
|
||||
|
||||
void drawWikiExplainer() {
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace hex::plugin::builtin {
|
||||
View::confirmButtons("hex.builtin.common.yes"_lang, "hex.builtin.common.no"_lang,
|
||||
[] {
|
||||
ImHexApi::Provider::resetDirty();
|
||||
ImHexApi::Common::closeImHex();
|
||||
ImHexApi::System::closeImHex();
|
||||
},
|
||||
[] { ImGui::CloseCurrentPopup(); }
|
||||
);
|
||||
@@ -73,7 +73,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
if (TaskManager::getRunningTaskCount() == 0 && TaskManager::getRunningBackgroundTaskCount() == 0) {
|
||||
ImGui::CloseCurrentPopup();
|
||||
ImHexApi::Common::closeImHex();
|
||||
ImHexApi::System::closeImHex();
|
||||
}
|
||||
|
||||
ImGui::EndPopup();
|
||||
@@ -114,7 +114,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::NewLine();
|
||||
ImGui::Separator();
|
||||
if (ImGui::Button("hex.builtin.common.okay"_lang) || ImGui::IsKeyDown(ImGuiKey_Escape)) {
|
||||
ImHexApi::Common::closeImHex();
|
||||
ImHexApi::System::closeImHex();
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
std::vector<CommandResult> results;
|
||||
|
||||
for (const auto &[type, command, unlocalizedDescription, displayCallback, executeCallback] : ContentRegistry::CommandPaletteCommands::getEntries()) {
|
||||
for (const auto &[type, command, unlocalizedDescription, displayCallback, executeCallback] : ContentRegistry::CommandPaletteCommands::impl::getEntries()) {
|
||||
|
||||
auto AutoComplete = [this, currCommand = command](auto) {
|
||||
this->focusInputTextBox();
|
||||
@@ -137,7 +137,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &handler : ContentRegistry::CommandPaletteCommands::getHandlers()) {
|
||||
for (const auto &handler : ContentRegistry::CommandPaletteCommands::impl::getHandlers()) {
|
||||
const auto &[type, command, queryCallback, displayCallback] = handler;
|
||||
|
||||
auto processedInput = input;
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace hex::plugin::builtin {
|
||||
return;
|
||||
|
||||
// Decode bytes using registered inspectors
|
||||
for (auto &entry : ContentRegistry::DataInspector::getEntries()) {
|
||||
for (auto &entry : ContentRegistry::DataInspector::impl::getEntries()) {
|
||||
if (validBytes < entry.requiredSize)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -264,7 +264,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &[unlocalizedCategory, unlocalizedName, function] : ContentRegistry::DataProcessorNode::getEntries()) {
|
||||
for (const auto &[unlocalizedCategory, unlocalizedName, function] : ContentRegistry::DataProcessorNode::impl::getEntries()) {
|
||||
if (unlocalizedCategory.empty() && unlocalizedName.empty()) {
|
||||
ImGui::Separator();
|
||||
} else if (unlocalizedCategory.empty()) {
|
||||
@@ -617,7 +617,7 @@ namespace hex::plugin::builtin {
|
||||
std::unique_ptr<dp::Node> ViewDataProcessor::loadNode(const nlohmann::json &node) {
|
||||
try {
|
||||
|
||||
auto &nodeEntries = ContentRegistry::DataProcessorNode::getEntries();
|
||||
auto &nodeEntries = ContentRegistry::DataProcessorNode::impl::getEntries();
|
||||
|
||||
std::unique_ptr<dp::Node> newNode;
|
||||
for (auto &entry : nodeEntries) {
|
||||
|
||||
@@ -1083,7 +1083,7 @@ namespace hex::plugin::builtin {
|
||||
auto selection = ImHexApi::HexEditor::getSelection();
|
||||
auto provider = ImHexApi::Provider::get();
|
||||
|
||||
for (const auto &[unlocalizedName, callback] : ContentRegistry::DataFormatter::getEntries()) {
|
||||
for (const auto &[unlocalizedName, callback] : ContentRegistry::DataFormatter::impl::getEntries()) {
|
||||
if (ImGui::MenuItem(LangEntry(unlocalizedName))) {
|
||||
ImGui::SetClipboardText(
|
||||
callback(
|
||||
|
||||
@@ -12,10 +12,8 @@ namespace hex::plugin::builtin {
|
||||
ViewPatternData::ViewPatternData() : View("hex.builtin.view.pattern_data.name") {
|
||||
|
||||
EventManager::subscribe<EventSettingsChanged>(this, [this]() {
|
||||
auto patternStyle = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.pattern_tree_style");
|
||||
|
||||
if (patternStyle.is_number())
|
||||
this->m_patternDrawer.setTreeStyle(static_cast<ui::PatternDrawer::TreeStyle>(patternStyle.get<int>()));
|
||||
auto patternStyle = ContentRegistry::Settings::read("hex.builtin.setting.interface", "hex.builtin.setting.interface.pattern_tree_style", 0);
|
||||
this->m_patternDrawer.setTreeStyle(static_cast<ui::PatternDrawer::TreeStyle>(patternStyle));
|
||||
});
|
||||
|
||||
EventManager::subscribe<EventProviderChanged>(this, [this](auto, auto) {
|
||||
|
||||
@@ -753,19 +753,8 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
|
||||
EventManager::subscribe<EventSettingsChanged>(this, [this] {
|
||||
{
|
||||
auto syncPatternSource = ContentRegistry::Settings::getSetting("hex.builtin.setting.general", "hex.builtin.setting.general.sync_pattern_source");
|
||||
|
||||
if (syncPatternSource.is_number())
|
||||
this->m_syncPatternSourceCode = static_cast<int>(syncPatternSource);
|
||||
}
|
||||
|
||||
{
|
||||
auto autoLoadPatterns = ContentRegistry::Settings::getSetting("hex.builtin.setting.general", "hex.builtin.setting.general.auto_load_patterns");
|
||||
|
||||
if (autoLoadPatterns.is_number())
|
||||
this->m_autoLoadPatterns = static_cast<int>(autoLoadPatterns);
|
||||
}
|
||||
this->m_syncPatternSourceCode = ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.sync_pattern_source", 0);
|
||||
this->m_autoLoadPatterns = ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.auto_load_patterns", 1);
|
||||
});
|
||||
|
||||
EventManager::subscribe<EventProviderOpened>(this, [this](prv::Provider *provider) {
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
if (ImGui::BeginPopupModal(View::toWindowName("hex.builtin.view.settings.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoResize)) {
|
||||
if (ImGui::BeginTabBar("settings")) {
|
||||
auto &entries = ContentRegistry::Settings::getEntries();
|
||||
auto &entries = ContentRegistry::Settings::impl::getEntries();
|
||||
|
||||
std::vector<std::decay_t<decltype(entries)>::const_iterator> sortedCategories;
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace hex::plugin::builtin {
|
||||
return item0->first.slot < item1->first.slot;
|
||||
});
|
||||
|
||||
const auto &descriptions = ContentRegistry::Settings::getCategoryDescriptions();
|
||||
const auto &descriptions = ContentRegistry::Settings::impl::getCategoryDescriptions();
|
||||
|
||||
for (auto &it : sortedCategories) {
|
||||
auto &[category, settings] = *it;
|
||||
@@ -59,7 +59,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::Separator();
|
||||
|
||||
for (auto &[name, requiresRestart, callback] : settings) {
|
||||
auto &setting = ContentRegistry::Settings::getSettingsData()[category.name][name];
|
||||
auto &setting = ContentRegistry::Settings::impl::getSettingsData()[category.name][name];
|
||||
if (callback(LangEntry(name), setting)) {
|
||||
log::debug("Setting [{}]: {} was changed to {}", category.name, name, [&] -> std::string{
|
||||
if (setting.is_number())
|
||||
@@ -87,7 +87,7 @@ namespace hex::plugin::builtin {
|
||||
this->getWindowOpenState() = false;
|
||||
|
||||
if (!this->getWindowOpenState() && this->m_restartRequested) {
|
||||
View::showYesNoQuestionPopup("hex.builtin.view.settings.restart_question"_lang, ImHexApi::Common::restartImHex, [] {});
|
||||
View::showYesNoQuestionPopup("hex.builtin.view.settings.restart_question"_lang, ImHexApi::System::restartImHex, [] {});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace hex::plugin::builtin {
|
||||
ViewTools::ViewTools() : View("hex.builtin.view.tools.name") { }
|
||||
|
||||
void ViewTools::drawContent() {
|
||||
auto &tools = ContentRegistry::Tools::getEntries();
|
||||
auto &tools = ContentRegistry::Tools::impl::getEntries();
|
||||
|
||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.tools.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
||||
for (auto iter = tools.begin(); iter != tools.end(); iter++) {
|
||||
|
||||
@@ -136,10 +136,10 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
static void loadDefaultLayout() {
|
||||
auto layouts = ContentRegistry::Interface::getLayouts();
|
||||
auto layouts = ContentRegistry::Interface::impl::getLayouts();
|
||||
if (!layouts.empty()) {
|
||||
|
||||
for (auto &[viewName, view] : ContentRegistry::Views::getEntries()) {
|
||||
for (auto &[viewName, view] : ContentRegistry::Views::impl::getEntries()) {
|
||||
view->getWindowOpenState() = false;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
static bool isAnyViewOpen() {
|
||||
const auto &views = ContentRegistry::Views::getEntries();
|
||||
const auto &views = ContentRegistry::Views::impl::getEntries();
|
||||
return std::any_of(views.begin(), views.end(),
|
||||
[](const std::pair<std::string, View*> &entry) {
|
||||
return entry.second->getWindowOpenState();
|
||||
@@ -252,7 +252,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::SetNextWindowPos(ImGui::GetWindowPos() + ImGui::GetCursorPos());
|
||||
if (ImGui::BeginPopup("hex.builtin.welcome.start.popup.open_other"_lang)) {
|
||||
|
||||
for (const auto &unlocalizedProviderName : ContentRegistry::Provider::getEntries()) {
|
||||
for (const auto &unlocalizedProviderName : ContentRegistry::Provider::impl::getEntries()) {
|
||||
if (ImGui::Hyperlink(LangEntry(unlocalizedProviderName))) {
|
||||
ImHexApi::Provider::createProvider(unlocalizedProviderName);
|
||||
ImGui::CloseCurrentPopup();
|
||||
@@ -365,7 +365,7 @@ namespace hex::plugin::builtin {
|
||||
hex::openWebpage("hex.builtin.welcome.learn.plugins.link"_lang);
|
||||
}
|
||||
|
||||
auto extraWelcomeScreenEntries = ContentRegistry::Interface::getWelcomeScreenEntries();
|
||||
auto extraWelcomeScreenEntries = ContentRegistry::Interface::impl::getWelcomeScreenEntries();
|
||||
if (!extraWelcomeScreenEntries.empty()) {
|
||||
ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 5);
|
||||
ImGui::TableNextColumn();
|
||||
@@ -442,36 +442,28 @@ namespace hex::plugin::builtin {
|
||||
|
||||
(void)EventManager::subscribe<EventSettingsChanged>([]() {
|
||||
{
|
||||
auto theme = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.color");
|
||||
auto theme = ContentRegistry::Settings::read("hex.builtin.setting.interface", "hex.builtin.setting.interface.color", api::ThemeManager::NativeTheme);
|
||||
|
||||
if (theme.is_string()) {
|
||||
if (theme != api::ThemeManager::NativeTheme) {
|
||||
static std::string lastTheme;
|
||||
if (theme != api::ThemeManager::NativeTheme) {
|
||||
static std::string lastTheme;
|
||||
|
||||
if (const auto thisTheme = theme.get<std::string>(); thisTheme != lastTheme) {
|
||||
EventManager::post<RequestChangeTheme>(thisTheme);
|
||||
lastTheme = thisTheme;
|
||||
}
|
||||
if (theme != lastTheme) {
|
||||
EventManager::post<RequestChangeTheme>(theme);
|
||||
lastTheme = theme;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
auto language = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.language");
|
||||
auto language = ContentRegistry::Settings::read("hex.builtin.setting.interface", "hex.builtin.setting.interface.language", "en-US");
|
||||
|
||||
if (language.is_string()) {
|
||||
LangEntry::loadLanguage(static_cast<std::string>(language));
|
||||
} else {
|
||||
// If no language is specified, fall back to English.
|
||||
LangEntry::loadLanguage("en-US");
|
||||
}
|
||||
LangEntry::loadLanguage(language);
|
||||
}
|
||||
|
||||
{
|
||||
auto targetFps = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.fps");
|
||||
auto targetFps = ContentRegistry::Settings::read("hex.builtin.setting.interface", "hex.builtin.setting.interface.fps", 60);
|
||||
|
||||
if (targetFps.is_number())
|
||||
ImHexApi::System::setTargetFPS(targetFps);
|
||||
ImHexApi::System::setTargetFPS(targetFps);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -91,72 +91,27 @@ namespace hex::plugin::builtin::ui {
|
||||
|
||||
EventManager::subscribe<EventSettingsChanged>(this, [this] {
|
||||
{
|
||||
auto bytesPerRow = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.bytes_per_row");
|
||||
|
||||
if (bytesPerRow.is_number()) {
|
||||
this->m_bytesPerRow = static_cast<int>(bytesPerRow);
|
||||
this->m_encodingLineStartAddresses.clear();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
auto ascii = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.ascii");
|
||||
|
||||
if (ascii.is_number())
|
||||
this->m_showAscii = static_cast<int>(ascii);
|
||||
}
|
||||
|
||||
{
|
||||
auto greyOutZeros = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.grey_zeros");
|
||||
|
||||
if (greyOutZeros.is_number())
|
||||
this->m_grayOutZero = static_cast<int>(greyOutZeros);
|
||||
}
|
||||
|
||||
{
|
||||
auto upperCaseHex = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.uppercase_hex");
|
||||
|
||||
if (upperCaseHex.is_number())
|
||||
this->m_upperCaseHex = static_cast<int>(upperCaseHex);
|
||||
}
|
||||
|
||||
{
|
||||
auto selectionColor = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.highlight_color");
|
||||
|
||||
if (selectionColor.is_number())
|
||||
this->m_selectionColor = static_cast<color_t>(selectionColor);
|
||||
this->m_bytesPerRow = ContentRegistry::Settings::read("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.bytes_per_row", 16);
|
||||
this->m_encodingLineStartAddresses.clear();
|
||||
}
|
||||
|
||||
{
|
||||
auto &visualizers = ContentRegistry::HexEditor::impl::getVisualizers();
|
||||
auto selectedVisualizer = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.visualizer");
|
||||
auto selectedVisualizer = ContentRegistry::Settings::read("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.visualizer", "hex.builtin.visualizer.hexadecimal.8bit");
|
||||
|
||||
if (selectedVisualizer.is_string() && visualizers.contains(selectedVisualizer))
|
||||
if (visualizers.contains(selectedVisualizer))
|
||||
this->m_currDataVisualizer = visualizers[selectedVisualizer];
|
||||
else
|
||||
this->m_currDataVisualizer = visualizers["hex.builtin.visualizer.hexadecimal.8bit"];
|
||||
}
|
||||
|
||||
{
|
||||
auto syncScrolling = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.sync_scrolling");
|
||||
|
||||
if (syncScrolling.is_number())
|
||||
this->m_syncScrolling = static_cast<int>(syncScrolling);
|
||||
}
|
||||
|
||||
{
|
||||
auto padding = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.byte_padding");
|
||||
|
||||
if (padding.is_number())
|
||||
this->m_byteCellPadding = static_cast<int>(padding);
|
||||
}
|
||||
|
||||
{
|
||||
auto padding = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.char_padding");
|
||||
|
||||
if (padding.is_number())
|
||||
this->m_characterCellPadding = static_cast<int>(padding);
|
||||
}
|
||||
this->m_showAscii = ContentRegistry::Settings::read("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.ascii", 1);
|
||||
this->m_grayOutZero = ContentRegistry::Settings::read("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.grey_zeros", 1);
|
||||
this->m_upperCaseHex = ContentRegistry::Settings::read("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.uppercase_hex", 1);
|
||||
this->m_selectionColor = ContentRegistry::Settings::read("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.highlight_color", 0x60C08080);
|
||||
this->m_syncScrolling = ContentRegistry::Settings::read("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.sync_scrolling", 0);
|
||||
this->m_byteCellPadding = ContentRegistry::Settings::read("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.byte_padding", 0);
|
||||
this->m_characterCellPadding = ContentRegistry::Settings::read("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.char_padding", 0);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user