From 876dbe8179f451356fbaa31cb766ef90d020943c Mon Sep 17 00:00:00 2001 From: WerWolv Date: Wed, 2 Feb 2022 00:36:09 +0100 Subject: [PATCH] sys: Final cleanup to get rid of everything builtin in the main application --- .../include/hex/api/content_registry.hpp | 9 + lib/libimhex/source/api/content_registry.cpp | 787 +++++++++--------- lib/libimhex/source/ui/view.cpp | 28 +- main/source/init/tasks.cpp | 1 + main/source/window/win_window.cpp | 25 +- .../source/content/providers/gdb_provider.cpp | 2 +- .../builtin/source/content/tools_entries.cpp | 8 +- .../content/views/view_data_inspector.cpp | 10 +- .../content/views/view_data_processor.cpp | 2 +- .../content/views/view_disassembler.cpp | 6 +- .../source/content/views/view_hashes.cpp | 16 +- .../source/content/views/view_hexeditor.cpp | 16 +- .../content/views/view_pattern_editor.cpp | 4 +- .../content/views/view_provider_settings.cpp | 4 +- .../source/content/views/view_yara.cpp | 4 +- .../builtin/source/content/welcome_screen.cpp | 80 +- plugins/builtin/source/lang/de_DE.cpp | 140 ++-- plugins/builtin/source/lang/en_US.cpp | 144 ++-- plugins/builtin/source/lang/it_IT.cpp | 142 ++-- plugins/builtin/source/lang/zh_CN.cpp | 140 ++-- plugins/windows/source/content/ui_items.cpp | 25 + plugins/windows/source/lang/en_US.cpp | 3 + plugins/windows/source/lang/zh_CN.cpp | 3 + plugins/windows/source/plugin_windows.cpp | 2 + 24 files changed, 818 insertions(+), 783 deletions(-) diff --git a/lib/libimhex/include/hex/api/content_registry.hpp b/lib/libimhex/include/hex/api/content_registry.hpp index a87476045..06f8e96de 100644 --- a/lib/libimhex/include/hex/api/content_registry.hpp +++ b/lib/libimhex/include/hex/api/content_registry.hpp @@ -246,6 +246,7 @@ namespace hex { using DrawCallback = std::function; using LayoutFunction = std::function; + using ClickCallback = std::function; struct Layout { std::string unlocalizedName; @@ -266,6 +267,12 @@ namespace hex { DrawCallback callback; }; + struct TitleBarButton { + std::string icon; + std::string unlocalizedTooltip; + ClickCallback callback; + }; + } void registerMainMenuItem(const std::string &unlocalizedName, u32 priority); @@ -275,6 +282,7 @@ namespace hex { void addFooterItem(const impl::DrawCallback &function); void addToolbarItem(const impl::DrawCallback &function); void addSidebarItem(const std::string &icon, const impl::DrawCallback &function); + void addTitleBarButton(const std::string &icon, const std::string &unlocalizedTooltip, const impl::ClickCallback &function); void addLayout(const std::string &unlocalizedName, const impl::LayoutFunction &function); @@ -285,6 +293,7 @@ namespace hex { std::vector &getFooterItems(); std::vector &getToolbarItems(); std::vector &getSidebarItems(); + std::vector &getTitleBarButtons(); std::vector &getLayouts(); } diff --git a/lib/libimhex/source/api/content_registry.cpp b/lib/libimhex/source/api/content_registry.cpp index cbeecf832..5e4bb0c36 100644 --- a/lib/libimhex/source/api/content_registry.cpp +++ b/lib/libimhex/source/api/content_registry.cpp @@ -12,461 +12,488 @@ namespace hex { - /* Settings */ + namespace ContentRegistry::Settings { - void ContentRegistry::Settings::load() { - bool loaded = false; - for (const auto &dir : hex::getPath(ImHexPath::Config)) { - std::ifstream settingsFile(dir / "settings.json"); + void load() { + bool loaded = false; + for (const auto &dir : hex::getPath(ImHexPath::Config)) { + std::ifstream settingsFile(dir / "settings.json"); - if (settingsFile.good()) { - settingsFile >> getSettingsData(); - loaded = true; - break; + if (settingsFile.good()) { + settingsFile >> getSettingsData(); + loaded = true; + break; + } + } + + if (!loaded) + store(); + } + + void store() { + for (const auto &dir : hex::getPath(ImHexPath::Config)) { + std::ofstream settingsFile(dir / "settings.json", std::ios::trunc); + + if (settingsFile.good()) { + settingsFile << getSettingsData(); + break; + } } } - if (!loaded) - ContentRegistry::Settings::store(); - } + void add(const std::string &unlocalizedCategory, const std::string &unlocalizedName, i64 defaultValue, const Callback &callback) { + log::info("Registered new integer setting: [{}]: {}", unlocalizedCategory, unlocalizedName); - void ContentRegistry::Settings::store() { - for (const auto &dir : hex::getPath(ImHexPath::Config)) { - std::ofstream settingsFile(dir / "settings.json", std::ios::trunc); + getEntries()[unlocalizedCategory.c_str()].emplace_back(Entry { unlocalizedName.c_str(), callback }); - if (settingsFile.good()) { - settingsFile << getSettingsData(); - break; - } + auto &json = getSettingsData(); + + if (!json.contains(unlocalizedCategory)) + json[unlocalizedCategory] = nlohmann::json::object(); + if (!json[unlocalizedCategory].contains(unlocalizedName) || !json[unlocalizedCategory][unlocalizedName].is_number()) + json[unlocalizedCategory][unlocalizedName] = int(defaultValue); } - } - void ContentRegistry::Settings::add(const std::string &unlocalizedCategory, const std::string &unlocalizedName, i64 defaultValue, const ContentRegistry::Settings::Callback &callback) { - log::info("Registered new integer setting: [{}]: {}", unlocalizedCategory, unlocalizedName); + void add(const std::string &unlocalizedCategory, const std::string &unlocalizedName, const std::string &defaultValue, const Callback &callback) { + log::info("Registered new string setting: [{}]: {}", unlocalizedCategory, unlocalizedName); - ContentRegistry::Settings::getEntries()[unlocalizedCategory.c_str()].emplace_back(Entry { unlocalizedName.c_str(), callback }); + getEntries()[unlocalizedCategory].emplace_back(Entry { unlocalizedName, callback }); - auto &json = getSettingsData(); + auto &json = getSettingsData(); - if (!json.contains(unlocalizedCategory)) - json[unlocalizedCategory] = nlohmann::json::object(); - if (!json[unlocalizedCategory].contains(unlocalizedName) || !json[unlocalizedCategory][unlocalizedName].is_number()) - json[unlocalizedCategory][unlocalizedName] = int(defaultValue); - } + if (!json.contains(unlocalizedCategory)) + json[unlocalizedCategory] = nlohmann::json::object(); + if (!json[unlocalizedCategory].contains(unlocalizedName) || !json[unlocalizedCategory][unlocalizedName].is_string()) + json[unlocalizedCategory][unlocalizedName] = std::string(defaultValue); + } - void ContentRegistry::Settings::add(const std::string &unlocalizedCategory, const std::string &unlocalizedName, const std::string &defaultValue, const ContentRegistry::Settings::Callback &callback) { - log::info("Registered new string setting: [{}]: {}", unlocalizedCategory, unlocalizedName); + void write(const std::string &unlocalizedCategory, const std::string &unlocalizedName, i64 value) { + auto &json = getSettingsData(); - ContentRegistry::Settings::getEntries()[unlocalizedCategory].emplace_back(Entry { unlocalizedName, callback }); + if (!json.contains(unlocalizedCategory)) + json[unlocalizedCategory] = nlohmann::json::object(); - auto &json = getSettingsData(); + json[unlocalizedCategory][unlocalizedName] = value; + } - if (!json.contains(unlocalizedCategory)) - json[unlocalizedCategory] = nlohmann::json::object(); - if (!json[unlocalizedCategory].contains(unlocalizedName) || !json[unlocalizedCategory][unlocalizedName].is_string()) - json[unlocalizedCategory][unlocalizedName] = std::string(defaultValue); - } + void write(const std::string &unlocalizedCategory, const std::string &unlocalizedName, const std::string &value) { + auto &json = getSettingsData(); - void ContentRegistry::Settings::write(const std::string &unlocalizedCategory, const std::string &unlocalizedName, i64 value) { - auto &json = getSettingsData(); + if (!json.contains(unlocalizedCategory)) + json[unlocalizedCategory] = nlohmann::json::object(); - if (!json.contains(unlocalizedCategory)) - json[unlocalizedCategory] = nlohmann::json::object(); + json[unlocalizedCategory][unlocalizedName] = value; + } - json[unlocalizedCategory][unlocalizedName] = value; - } + void write(const std::string &unlocalizedCategory, const std::string &unlocalizedName, const std::vector &value) { + auto &json = getSettingsData(); - void ContentRegistry::Settings::write(const std::string &unlocalizedCategory, const std::string &unlocalizedName, const std::string &value) { - auto &json = getSettingsData(); + if (!json.contains(unlocalizedCategory)) + json[unlocalizedCategory] = nlohmann::json::object(); - if (!json.contains(unlocalizedCategory)) - json[unlocalizedCategory] = nlohmann::json::object(); + json[unlocalizedCategory][unlocalizedName] = value; + } - json[unlocalizedCategory][unlocalizedName] = value; - } - void ContentRegistry::Settings::write(const std::string &unlocalizedCategory, const std::string &unlocalizedName, const std::vector &value) { - auto &json = getSettingsData(); + i64 read(const std::string &unlocalizedCategory, const std::string &unlocalizedName, i64 defaultValue) { + auto &json = getSettingsData(); - if (!json.contains(unlocalizedCategory)) - json[unlocalizedCategory] = nlohmann::json::object(); + if (!json.contains(unlocalizedCategory)) + return defaultValue; + if (!json[unlocalizedCategory].contains(unlocalizedName)) + return defaultValue; + + if (!json[unlocalizedCategory][unlocalizedName].is_number()) + json[unlocalizedCategory][unlocalizedName] = defaultValue; + + return json[unlocalizedCategory][unlocalizedName].get(); + } + + std::string read(const std::string &unlocalizedCategory, const std::string &unlocalizedName, const std::string &defaultValue) { + auto &json = getSettingsData(); + + if (!json.contains(unlocalizedCategory)) + return defaultValue; + if (!json[unlocalizedCategory].contains(unlocalizedName)) + return defaultValue; + + if (!json[unlocalizedCategory][unlocalizedName].is_string()) + json[unlocalizedCategory][unlocalizedName] = defaultValue; + + return json[unlocalizedCategory][unlocalizedName].get(); + } + + std::vector read(const std::string &unlocalizedCategory, const std::string &unlocalizedName, const std::vector &defaultValue) { + auto &json = getSettingsData(); + + if (!json.contains(unlocalizedCategory)) + return defaultValue; + if (!json[unlocalizedCategory].contains(unlocalizedName)) + return defaultValue; + + if (!json[unlocalizedCategory][unlocalizedName].is_array()) + json[unlocalizedCategory][unlocalizedName] = defaultValue; + + if (!json[unlocalizedCategory][unlocalizedName].array().empty() && !json[unlocalizedCategory][unlocalizedName][0].is_string()) + json[unlocalizedCategory][unlocalizedName] = defaultValue; + + return json[unlocalizedCategory][unlocalizedName].get>(); + } + + + std::map> &getEntries() { + static std::map> entries; + + return entries; + } + + nlohmann::json getSetting(const std::string &unlocalizedCategory, const std::string &unlocalizedName) { + auto &settings = getSettingsData(); + + if (!settings.contains(unlocalizedCategory)) return {}; + if (!settings[unlocalizedCategory].contains(unlocalizedName)) return {}; + + return settings[unlocalizedCategory][unlocalizedName]; + } + + nlohmann::json &getSettingsData() { + static nlohmann::json settings; + + return settings; + } - json[unlocalizedCategory][unlocalizedName] = value; } - i64 ContentRegistry::Settings::read(const std::string &unlocalizedCategory, const std::string &unlocalizedName, i64 defaultValue) { - auto &json = getSettingsData(); + namespace ContentRegistry::CommandPaletteCommands { - if (!json.contains(unlocalizedCategory)) - return defaultValue; - if (!json[unlocalizedCategory].contains(unlocalizedName)) - return defaultValue; + void add(Type type, const std::string &command, const std::string &unlocalizedDescription, const DisplayCallback &displayCallback, const ExecuteCallback &executeCallback) { + log::info("Registered new command palette command: {}", command); - if (!json[unlocalizedCategory][unlocalizedName].is_number()) - json[unlocalizedCategory][unlocalizedName] = defaultValue; + getEntries().push_back(ContentRegistry::CommandPaletteCommands::Entry { type, command, unlocalizedDescription, displayCallback, executeCallback }); + } - return json[unlocalizedCategory][unlocalizedName].get(); - } + std::vector &getEntries() { + static std::vector commands; - std::string ContentRegistry::Settings::read(const std::string &unlocalizedCategory, const std::string &unlocalizedName, const std::string &defaultValue) { - auto &json = getSettingsData(); + return commands; + } - if (!json.contains(unlocalizedCategory)) - return defaultValue; - if (!json[unlocalizedCategory].contains(unlocalizedName)) - return defaultValue; - - if (!json[unlocalizedCategory][unlocalizedName].is_string()) - json[unlocalizedCategory][unlocalizedName] = defaultValue; - - return json[unlocalizedCategory][unlocalizedName].get(); - } - - std::vector ContentRegistry::Settings::read(const std::string &unlocalizedCategory, const std::string &unlocalizedName, const std::vector &defaultValue) { - auto &json = getSettingsData(); - - if (!json.contains(unlocalizedCategory)) - return defaultValue; - if (!json[unlocalizedCategory].contains(unlocalizedName)) - return defaultValue; - - if (!json[unlocalizedCategory][unlocalizedName].is_array()) - json[unlocalizedCategory][unlocalizedName] = defaultValue; - - if (!json[unlocalizedCategory][unlocalizedName].array().empty() && !json[unlocalizedCategory][unlocalizedName][0].is_string()) - json[unlocalizedCategory][unlocalizedName] = defaultValue; - - return json[unlocalizedCategory][unlocalizedName].get>(); } - std::map> &ContentRegistry::Settings::getEntries() { - static std::map> entries; + namespace ContentRegistry::PatternLanguage { - return entries; - } + static std::string getFunctionName(const Namespace &ns, const std::string &name) { + std::string functionName; + for (auto &scope : ns) + functionName += scope + "::"; - nlohmann::json ContentRegistry::Settings::getSetting(const std::string &unlocalizedCategory, const std::string &unlocalizedName) { - auto &settings = getSettingsData(); + functionName += name; - if (!settings.contains(unlocalizedCategory)) return {}; - if (!settings[unlocalizedCategory].contains(unlocalizedName)) return {}; + return functionName; + } - return settings[unlocalizedCategory][unlocalizedName]; - } + void addFunction(const Namespace &ns, const std::string &name, u32 parameterCount, const Callback &func) { + log::info("Registered new pattern language function: {}", getFunctionName(ns, name)); - nlohmann::json &ContentRegistry::Settings::getSettingsData() { - static nlohmann::json settings; + getFunctions()[getFunctionName(ns, name)] = Function { parameterCount, func, false }; + } + + void addDangerousFunction(const Namespace &ns, const std::string &name, u32 parameterCount, const Callback &func) { + log::info("Registered new dangerous pattern language function: {}", getFunctionName(ns, name)); + + getFunctions()[getFunctionName(ns, name)] = Function { parameterCount, func, true }; + } + + std::map &getFunctions() { + static std::map functions; + + return functions; + } + + + static std::vector s_colorPalettes; + static u32 s_colorIndex; + static u32 s_selectedColorPalette; + + std::vector &getPalettes() { + return s_colorPalettes; + } + + void addColorPalette(const std::string &unlocalizedName, const std::vector &colors) { + s_colorPalettes.push_back({ unlocalizedName, + colors }); + } + + void setSelectedPalette(u32 index) { + if (index < s_colorPalettes.size()) + s_selectedColorPalette = index; + + resetPalette(); + } + + u32 getNextColor() { + if (s_colorPalettes.empty()) + return 0x00; + + auto &currColors = s_colorPalettes[s_selectedColorPalette].colors; + + u32 color = currColors[s_colorIndex]; + + s_colorIndex++; + s_colorIndex %= currColors.size(); + + return color; + } + + void resetPalette() { + s_colorIndex = 0; + } - return settings; } - /* Command Palette Commands */ + namespace ContentRegistry::Views { - void ContentRegistry::CommandPaletteCommands::add(ContentRegistry::CommandPaletteCommands::Type type, const std::string &command, const std::string &unlocalizedDescription, const std::function &displayCallback, const std::function &executeCallback) { - log::info("Registered new command palette command: {}", command); + void impl::add(View *view) { + log::info("Registered new view: {}", view->getUnlocalizedName()); + + getEntries().insert({ view->getUnlocalizedName(), view }); + } + + std::map &getEntries() { + static std::map views; + + return views; + } + + View *getViewByName(const std::string &unlocalizedName) { + auto &views = getEntries(); + + if (views.contains(unlocalizedName)) + return views[unlocalizedName]; + else + return nullptr; + } - getEntries().push_back(ContentRegistry::CommandPaletteCommands::Entry { type, command, unlocalizedDescription, displayCallback, executeCallback }); } - std::vector &ContentRegistry::CommandPaletteCommands::getEntries() { - static std::vector commands; + namespace ContentRegistry::Tools { + + void add(const std::string &unlocalizedName, const impl::Callback &function) { + log::info("Registered new tool: {}", unlocalizedName); + + getEntries().emplace_back(impl::Entry { unlocalizedName, function }); + } + + std::vector &getEntries() { + static std::vector entries; + + return entries; + } - return commands; } + namespace ContentRegistry::DataInspector { - /* Pattern Language Functions */ + void add(const std::string &unlocalizedName, size_t requiredSize, impl::GeneratorFunction function) { + log::info("Registered new data inspector format: {}", unlocalizedName); + getEntries().push_back({ unlocalizedName, requiredSize, std::move(function) }); + } - static std::string getFunctionName(const ContentRegistry::PatternLanguage::Namespace &ns, const std::string &name) { - std::string functionName; - for (auto &scope : ns) - functionName += scope + "::"; + std::vector &getEntries() { + static std::vector entries; - functionName += name; + return entries; + } - return functionName; } - void ContentRegistry::PatternLanguage::addFunction(const Namespace &ns, const std::string &name, u32 parameterCount, const ContentRegistry::PatternLanguage::Callback &func) { - log::info("Registered new pattern language function: {}", getFunctionName(ns, name)); + namespace ContentRegistry::DataProcessorNode { + + void impl::add(const impl::Entry &entry) { + log::info("Registered new data processor node type: [{}]: ", entry.category, entry.name); + + getEntries().push_back(entry); + } + + void addSeparator() { + getEntries().push_back({ "", "", [] { return nullptr; } }); + } + + std::vector &getEntries() { + static std::vector nodes; + + return nodes; + } - getFunctions()[getFunctionName(ns, name)] = Function { parameterCount, func, false }; } - void ContentRegistry::PatternLanguage::addDangerousFunction(const Namespace &ns, const std::string &name, u32 parameterCount, const ContentRegistry::PatternLanguage::Callback &func) { - log::info("Registered new dangerous pattern language function: {}", getFunctionName(ns, name)); + namespace ContentRegistry::Language { + + void registerLanguage(const std::string &name, const std::string &languageCode) { + log::info("Registered new language: {} ({})", name, languageCode); + + getLanguages().insert({ languageCode, name }); + } + + void addLocalizations(const std::string &languageCode, const LanguageDefinition &definition) { + log::info("Registered new localization for language {} with {} entries", languageCode, definition.getEntries().size()); + + getLanguageDefinitions()[languageCode].push_back(definition); + } + + std::map &getLanguages() { + static std::map languages; + + return languages; + } + + std::map> &getLanguageDefinitions() { + static std::map> definitions; + + return definitions; + } - getFunctions()[getFunctionName(ns, name)] = Function { parameterCount, func, true }; } - std::map &ContentRegistry::PatternLanguage::getFunctions() { - static std::map functions; + namespace ContentRegistry::Interface { + + void registerMainMenuItem(const std::string &unlocalizedName, u32 priority) { + log::info("Registered new main menu item: {}", unlocalizedName); + + getMainMenuItems().insert({ priority, { unlocalizedName } }); + } + + void addMenuItem(const std::string &unlocalizedMainMenuName, u32 priority, const impl::DrawCallback &function) { + log::info("Added new menu item to menu {} with priority {}", unlocalizedMainMenuName, priority); + + getMenuItems().insert({ + priority, {unlocalizedMainMenuName, function} + }); + } + + void addWelcomeScreenEntry(const impl::DrawCallback &function) { + getWelcomeScreenEntries().push_back(function); + } + + void addFooterItem(const impl::DrawCallback &function) { + getFooterItems().push_back(function); + } + + void addToolbarItem(const impl::DrawCallback &function) { + getToolbarItems().push_back(function); + } + + void addSidebarItem(const std::string &icon, const impl::DrawCallback &function) { + getSidebarItems().push_back({ icon, function }); + } + + void addTitleBarButton(const std::string &icon, const std::string &unlocalizedTooltip, const impl::ClickCallback &function) { + getTitleBarButtons().push_back({ icon, unlocalizedTooltip, function }); + } + + void addLayout(const std::string &unlocalizedName, const impl::LayoutFunction &function) { + log::info("Added new layout: {}", unlocalizedName); + + getLayouts().push_back({ unlocalizedName, function }); + } + + + std::multimap &getMainMenuItems() { + static std::multimap items; + + return items; + } + std::multimap &getMenuItems() { + static std::multimap items; + + return items; + } + + std::vector &getWelcomeScreenEntries() { + static std::vector entries; + + return entries; + } + std::vector &getFooterItems() { + static std::vector items; + + return items; + } + std::vector &getToolbarItems() { + static std::vector items; + + return items; + } + std::vector &getSidebarItems() { + static std::vector items; + + return items; + } + std::vector &getTitleBarButtons() { + static std::vector buttons; + + return buttons; + } + + std::vector &getLayouts() { + static std::vector layouts; + + return layouts; + } - return functions; } + namespace ContentRegistry::Provider { - static std::vector s_colorPalettes; - static u32 s_colorIndex; - static u32 s_selectedColorPalette; + void impl::addProviderName(const std::string &unlocalizedName) { + log::info("Registered new provider: {}", unlocalizedName); + + getEntries().push_back(unlocalizedName); + } + + std::vector &getEntries() { + static std::vector providerNames; + + return providerNames; + } - std::vector &ContentRegistry::PatternLanguage::getPalettes() { - return s_colorPalettes; } - void ContentRegistry::PatternLanguage::addColorPalette(const std::string &unlocalizedName, const std::vector &colors) { - s_colorPalettes.push_back({ unlocalizedName, - colors }); + namespace ContentRegistry::DataFormatter { + + void add(const std::string &unlocalizedName, const impl::Callback &callback) { + log::info("Registered new data formatter: {}", unlocalizedName); + + getEntries().push_back({ unlocalizedName, callback }); + } + + std::vector &getEntries() { + static std::vector entries; + + return entries; + } + } - void ContentRegistry::PatternLanguage::setSelectedPalette(u32 index) { - if (index < s_colorPalettes.size()) - s_selectedColorPalette = index; + namespace ContentRegistry::FileHandler { + + void add(const std::vector &extensions, const impl::Callback &callback) { + for (const auto &extension : extensions) + log::info("Registered new data handler for extensions: {}", extension); + + getEntries().push_back({ extensions, callback }); + } + + std::vector &getEntries() { + static std::vector entries; + + return entries; + } - resetPalette(); } - u32 ContentRegistry::PatternLanguage::getNextColor() { - if (s_colorPalettes.empty()) - return 0x00; - - auto &currColors = s_colorPalettes[s_selectedColorPalette].colors; - - u32 color = currColors[s_colorIndex]; - - s_colorIndex++; - s_colorIndex %= currColors.size(); - - return color; - } - - void ContentRegistry::PatternLanguage::resetPalette() { - s_colorIndex = 0; - } - - - /* Views */ - - void ContentRegistry::Views::impl::add(View *view) { - log::info("Registered new view: {}", view->getUnlocalizedName()); - - getEntries().insert({ view->getUnlocalizedName(), view }); - } - - std::map &ContentRegistry::Views::getEntries() { - static std::map views; - - return views; - } - - View *ContentRegistry::Views::getViewByName(const std::string &unlocalizedName) { - auto &views = getEntries(); - - if (views.contains(unlocalizedName)) - return views[unlocalizedName]; - else - return nullptr; - } - - - /* Tools */ - - void ContentRegistry::Tools::add(const std::string &unlocalizedName, const std::function &function) { - log::info("Registered new tool: {}", unlocalizedName); - - getEntries().emplace_back(impl::Entry { unlocalizedName, function }); - } - - std::vector &ContentRegistry::Tools::getEntries() { - static std::vector entries; - - return entries; - } - - - /* Data Inspector */ - - void ContentRegistry::DataInspector::add(const std::string &unlocalizedName, size_t requiredSize, ContentRegistry::DataInspector::impl::GeneratorFunction function) { - log::info("Registered new data inspector format: {}", unlocalizedName); - - getEntries().push_back({ unlocalizedName, requiredSize, std::move(function) }); - } - - std::vector &ContentRegistry::DataInspector::getEntries() { - static std::vector entries; - - return entries; - } - - /* Data Processor Nodes */ - - void ContentRegistry::DataProcessorNode::impl::add(const impl::Entry &entry) { - log::info("Registered new data processor node type: [{}]: ", entry.category, entry.name); - - getEntries().push_back(entry); - } - - void ContentRegistry::DataProcessorNode::addSeparator() { - getEntries().push_back({ "", "", [] { return nullptr; } }); - } - - std::vector &ContentRegistry::DataProcessorNode::getEntries() { - static std::vector nodes; - - return nodes; - } - - /* Languages */ - - void ContentRegistry::Language::registerLanguage(const std::string &name, const std::string &languageCode) { - log::info("Registered new language: {} ({})", name, languageCode); - - getLanguages().insert({ languageCode, name }); - } - - void ContentRegistry::Language::addLocalizations(const std::string &languageCode, const LanguageDefinition &definition) { - log::info("Registered new localization for language {} with {} entries", languageCode, definition.getEntries().size()); - - getLanguageDefinitions()[languageCode].push_back(definition); - } - - std::map &ContentRegistry::Language::getLanguages() { - static std::map languages; - - return languages; - } - - std::map> &ContentRegistry::Language::getLanguageDefinitions() { - static std::map> definitions; - - return definitions; - } - - - /* Interface */ - - void ContentRegistry::Interface::registerMainMenuItem(const std::string &unlocalizedName, u32 priority) { - log::info("Registered new main menu item: {}", unlocalizedName); - - getMainMenuItems().insert({ priority, { unlocalizedName } }); - } - - void ContentRegistry::Interface::addMenuItem(const std::string &unlocalizedMainMenuName, u32 priority, const impl::DrawCallback &function) { - log::info("Added new menu item to menu {} with priority {}", unlocalizedMainMenuName, priority); - - getMenuItems().insert({ - priority, {unlocalizedMainMenuName, function} - }); - } - - void ContentRegistry::Interface::addWelcomeScreenEntry(const ContentRegistry::Interface::impl::DrawCallback &function) { - getWelcomeScreenEntries().push_back(function); - } - - void ContentRegistry::Interface::addFooterItem(const ContentRegistry::Interface::impl::DrawCallback &function) { - getFooterItems().push_back(function); - } - - void ContentRegistry::Interface::addToolbarItem(const ContentRegistry::Interface::impl::DrawCallback &function) { - getToolbarItems().push_back(function); - } - - void ContentRegistry::Interface::addSidebarItem(const std::string &icon, const impl::DrawCallback &function) { - getSidebarItems().push_back({ icon, function }); - } - - void ContentRegistry::Interface::addLayout(const std::string &unlocalizedName, const impl::LayoutFunction &function) { - log::info("Added new layout: {}", unlocalizedName); - - getLayouts().push_back({ unlocalizedName, function }); - } - - - std::multimap &ContentRegistry::Interface::getMainMenuItems() { - static std::multimap items; - - return items; - } - std::multimap &ContentRegistry::Interface::getMenuItems() { - static std::multimap items; - - return items; - } - - std::vector &ContentRegistry::Interface::getWelcomeScreenEntries() { - static std::vector entries; - - return entries; - } - std::vector &ContentRegistry::Interface::getFooterItems() { - static std::vector items; - - return items; - } - std::vector &ContentRegistry::Interface::getToolbarItems() { - static std::vector items; - - return items; - } - std::vector &ContentRegistry::Interface::getSidebarItems() { - static std::vector items; - - return items; - } - - std::vector &ContentRegistry::Interface::getLayouts() { - static std::vector layouts; - - return layouts; - } - - - /* Providers */ - - void ContentRegistry::Provider::impl::addProviderName(const std::string &unlocalizedName) { - log::info("Registered new provider: {}", unlocalizedName); - - getEntries().push_back(unlocalizedName); - } - - std::vector &ContentRegistry::Provider::getEntries() { - static std::vector providerNames; - - return providerNames; - } - - - /* Data Formatters */ - - void ContentRegistry::DataFormatter::add(const std::string &unlocalizedName, const impl::Callback &callback) { - log::info("Registered new data formatter: {}", unlocalizedName); - - getEntries().push_back({ unlocalizedName, callback }); - } - - std::vector &ContentRegistry::DataFormatter::getEntries() { - static std::vector entries; - - return entries; - } - - - /* File Handlers */ - - void ContentRegistry::FileHandler::add(const std::vector &extensions, const impl::Callback &callback) { - for (const auto &extension : extensions) - log::info("Registered new data handler for extensions: {}", extension); - - getEntries().push_back({ extensions, callback }); - } - - std::vector &ContentRegistry::FileHandler::getEntries() { - static std::vector entries; - - return entries; - } } \ No newline at end of file diff --git a/lib/libimhex/source/ui/view.cpp b/lib/libimhex/source/ui/view.cpp index 2d747aec3..f6bc923a8 100644 --- a/lib/libimhex/source/ui/view.cpp +++ b/lib/libimhex/source/ui/view.cpp @@ -28,11 +28,11 @@ namespace hex { auto windowSize = ImHexApi::System::getMainWindowSize(); ImGui::SetNextWindowSizeConstraints(scaled(ImVec2(400, 100)), scaled(ImVec2(600, 300))); - if (ImGui::BeginPopupModal("hex.common.info"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { + if (ImGui::BeginPopupModal("hex.builtin.common.info"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { ImGui::TextFormattedWrapped("{}", s_popupMessage.c_str()); ImGui::NewLine(); ImGui::Separator(); - if (ImGui::Button("hex.common.okay"_lang) || ImGui::IsKeyDown(ImGuiKey_Escape)) + if (ImGui::Button("hex.builtin.common.okay"_lang) || ImGui::IsKeyDown(ImGuiKey_Escape)) ImGui::CloseCurrentPopup(); ImGui::SetWindowPos((windowSize - ImGui::GetWindowSize()) / 2, ImGuiCond_Appearing); @@ -40,11 +40,11 @@ namespace hex { } ImGui::SetNextWindowSizeConstraints(scaled(ImVec2(400, 100)), scaled(ImVec2(600, 300))); - if (ImGui::BeginPopupModal("hex.common.error"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { + if (ImGui::BeginPopupModal("hex.builtin.common.error"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { ImGui::TextFormattedWrapped("{}", s_popupMessage.c_str()); ImGui::NewLine(); ImGui::Separator(); - if (ImGui::Button("hex.common.okay"_lang) || ImGui::IsKeyDown(ImGuiKey_Escape)) + if (ImGui::Button("hex.builtin.common.okay"_lang) || ImGui::IsKeyDown(ImGuiKey_Escape)) ImGui::CloseCurrentPopup(); ImGui::SetWindowPos((windowSize - ImGui::GetWindowSize()) / 2, ImGuiCond_Appearing); @@ -52,11 +52,11 @@ namespace hex { } ImGui::SetNextWindowSizeConstraints(scaled(ImVec2(400, 100)), scaled(ImVec2(600, 300))); - if (ImGui::BeginPopupModal("hex.common.fatal"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { + if (ImGui::BeginPopupModal("hex.builtin.common.fatal"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { ImGui::TextFormattedWrapped("{}", s_popupMessage.c_str()); ImGui::NewLine(); ImGui::Separator(); - if (ImGui::Button("hex.common.okay"_lang) || ImGui::IsKeyDown(ImGuiKey_Escape)) { + if (ImGui::Button("hex.builtin.common.okay"_lang) || ImGui::IsKeyDown(ImGuiKey_Escape)) { ImHexApi::Common::closeImHex(); ImGui::CloseCurrentPopup(); } @@ -67,7 +67,7 @@ namespace hex { bool opened = true; ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_Appearing, ImVec2(0.5F, 0.5F)); - if (ImGui::BeginPopupModal("hex.common.choose_file"_lang, &opened, ImGuiWindowFlags_AlwaysAutoResize)) { + if (ImGui::BeginPopupModal("hex.builtin.common.choose_file"_lang, &opened, ImGuiWindowFlags_AlwaysAutoResize)) { if (ImGui::BeginListBox("##files", ImVec2(300_scaled, 0))) { @@ -81,15 +81,15 @@ namespace hex { ImGui::EndListBox(); } - if (ImGui::Button("hex.common.open"_lang)) { + if (ImGui::Button("hex.builtin.common.open"_lang)) { View::s_selectableFileOpenCallback(View::s_selectableFiles[View::s_selectableFileIndex]); ImGui::CloseCurrentPopup(); } ImGui::SameLine(); - if (ImGui::Button("hex.common.browse"_lang)) { - hex::openFileBrowser("hex.common.open"_lang, DialogMode::Open, View::s_selectableFilesValidExtensions, [](const auto &path) { + if (ImGui::Button("hex.builtin.common.browse"_lang)) { + hex::openFileBrowser("hex.builtin.common.open"_lang, DialogMode::Open, View::s_selectableFilesValidExtensions, [](const auto &path) { View::s_selectableFileOpenCallback(path); ImGui::CloseCurrentPopup(); }); @@ -102,19 +102,19 @@ namespace hex { void View::showMessagePopup(const std::string &message) { s_popupMessage = message; - ImHexApi::Tasks::doLater([] { ImGui::OpenPopup("hex.common.info"_lang); }); + ImHexApi::Tasks::doLater([] { ImGui::OpenPopup("hex.builtin.common.info"_lang); }); } void View::showErrorPopup(const std::string &errorMessage) { s_popupMessage = errorMessage; - ImHexApi::Tasks::doLater([] { ImGui::OpenPopup("hex.common.error"_lang); }); + ImHexApi::Tasks::doLater([] { ImGui::OpenPopup("hex.builtin.common.error"_lang); }); } void View::showFatalPopup(const std::string &errorMessage) { s_popupMessage = errorMessage; - ImHexApi::Tasks::doLater([] { ImGui::OpenPopup("hex.common.fatal"_lang); }); + ImHexApi::Tasks::doLater([] { ImGui::OpenPopup("hex.builtin.common.fatal"_lang); }); } void View::showFileChooserPopup(const std::vector &paths, const std::vector &validExtensions, const std::function &callback) { @@ -123,7 +123,7 @@ namespace hex { View::s_selectableFilesValidExtensions = validExtensions; View::s_selectableFileOpenCallback = callback; - ImHexApi::Tasks::doLater([] { ImGui::OpenPopup("hex.common.choose_file"_lang); }); + ImHexApi::Tasks::doLater([] { ImGui::OpenPopup("hex.builtin.common.choose_file"_lang); }); } bool View::hasViewMenuItemEntry() const { diff --git a/main/source/init/tasks.cpp b/main/source/init/tasks.cpp index a0d5fba29..92721503c 100644 --- a/main/source/init/tasks.cpp +++ b/main/source/init/tasks.cpp @@ -192,6 +192,7 @@ namespace hex::init { ContentRegistry::Interface::getToolbarItems().clear(); ContentRegistry::Interface::getMainMenuItems().clear(); ContentRegistry::Interface::getMenuItems().clear(); + ContentRegistry::Interface::getTitleBarButtons().clear(); ShortcutManager::clearShortcuts(); diff --git a/main/source/window/win_window.cpp b/main/source/window/win_window.cpp index 972167be3..b38975b34 100644 --- a/main/source/window/win_window.cpp +++ b/main/source/window/win_window.cpp @@ -325,26 +325,15 @@ namespace hex { ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImGui::GetColorU32(ImGuiCol_ScrollbarGrabActive)); ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::GetColorU32(ImGuiCol_ScrollbarGrabHovered)); - ImGui::SetCursorPosX(ImGui::GetWindowWidth() - buttonSize.x * 6); - #if defined(DEBUG) - if (ImGui::TitleBarButton(ICON_VS_DEBUG, buttonSize)) { - if (ImGui::GetIO().KeyCtrl) { - // Explicitly trigger a segfault by writing to an invalid memory location - // Used for debugging crashes - *reinterpret_cast(0x10) = 0x10; - } else if (ImGui::GetIO().KeyShift) { - // Explicitly trigger an abort by throwing an uncaught exception - // Used for debugging exception errors - throw std::runtime_error("Debug Error"); - } else { - hex::openWebpage("https://imhex.werwolv.net/debug"); + auto &titleBarButtons = ContentRegistry::Interface::getTitleBarButtons(); + + ImGui::SetCursorPosX(ImGui::GetWindowWidth() - buttonSize.x * (4 + titleBarButtons.size())); + for (const auto &[icon, tooltip, callback] : titleBarButtons) { + if (ImGui::TitleBarButton(icon.c_str(), buttonSize)) { + callback(); } + ImGui::InfoTooltip(LangEntry(tooltip)); } - ImGui::InfoTooltip("hex.menu.debug_build"_lang); - #endif - if (ImGui::TitleBarButton(ICON_VS_SMILEY, buttonSize)) - hex::openWebpage("mailto://hey@werwolv.net"); - ImGui::InfoTooltip("hex.menu.feedback"_lang); ImGui::SetCursorPosX(ImGui::GetWindowWidth() - buttonSize.x * 3); if (ImGui::TitleBarButton(ICON_VS_CHROME_MINIMIZE, buttonSize)) diff --git a/plugins/builtin/source/content/providers/gdb_provider.cpp b/plugins/builtin/source/content/providers/gdb_provider.cpp index 6a1596783..37f24cad4 100644 --- a/plugins/builtin/source/content/providers/gdb_provider.cpp +++ b/plugins/builtin/source/content/providers/gdb_provider.cpp @@ -304,7 +304,7 @@ namespace hex::plugin::builtin::prv { ImGui::TextUnformatted("0x"); ImGui::SameLine(); - ImGui::InputScalar("hex.common.size"_lang, ImGuiDataType_U64, &this->m_size, nullptr, nullptr, "%llx", ImGuiInputTextFlags_CharsHexadecimal); + ImGui::InputScalar("hex.builtin.common.size"_lang, ImGuiDataType_U64, &this->m_size, nullptr, nullptr, "%llx", ImGuiInputTextFlags_CharsHexadecimal); if (this->m_port < 0) this->m_port = 0; diff --git a/plugins/builtin/source/content/tools_entries.cpp b/plugins/builtin/source/content/tools_entries.cpp index 4e9afe4d1..a4500c2da 100644 --- a/plugins/builtin/source/content/tools_entries.cpp +++ b/plugins/builtin/source/content/tools_entries.cpp @@ -590,7 +590,7 @@ namespace hex::plugin::builtin { }); } } else { - if (ImGui::Button("hex.common.cancel"_lang)) { + if (ImGui::Button("hex.builtin.common.cancel"_lang)) { net.cancel(); } } @@ -603,9 +603,9 @@ namespace hex::plugin::builtin { if (ImGui::BeginTable("##links", 3, ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg, ImVec2(0, 200))) { ImGui::TableSetupScrollFreeze(0, 1); - ImGui::TableSetupColumn("hex.common.file"_lang); - ImGui::TableSetupColumn("hex.common.link"_lang); - ImGui::TableSetupColumn("hex.common.size"_lang); + ImGui::TableSetupColumn("hex.builtin.common.file"_lang); + ImGui::TableSetupColumn("hex.builtin.common.link"_lang); + ImGui::TableSetupColumn("hex.builtin.common.size"_lang); ImGui::TableHeadersRow(); ImGuiListClipper clipper; diff --git a/plugins/builtin/source/content/views/view_data_inspector.cpp b/plugins/builtin/source/content/views/view_data_inspector.cpp index a5ee38d2c..be9658f3a 100644 --- a/plugins/builtin/source/content/views/view_data_inspector.cpp +++ b/plugins/builtin/source/content/views/view_data_inspector.cpp @@ -82,27 +82,27 @@ namespace hex::plugin::builtin { ImGui::Separator(); ImGui::NewLine(); - if (ImGui::RadioButton("hex.common.little_endian"_lang, this->m_endian == std::endian::little)) { + if (ImGui::RadioButton("hex.builtin.common.little_endian"_lang, this->m_endian == std::endian::little)) { this->m_endian = std::endian::little; this->m_shouldInvalidate = true; } ImGui::SameLine(); - if (ImGui::RadioButton("hex.common.big_endian"_lang, this->m_endian == std::endian::big)) { + if (ImGui::RadioButton("hex.builtin.common.big_endian"_lang, this->m_endian == std::endian::big)) { this->m_endian = std::endian::big; this->m_shouldInvalidate = true; } - if (ImGui::RadioButton("hex.common.decimal"_lang, this->m_numberDisplayStyle == NumberDisplayStyle::Decimal)) { + if (ImGui::RadioButton("hex.builtin.common.decimal"_lang, this->m_numberDisplayStyle == NumberDisplayStyle::Decimal)) { this->m_numberDisplayStyle = NumberDisplayStyle::Decimal; this->m_shouldInvalidate = true; } ImGui::SameLine(); - if (ImGui::RadioButton("hex.common.hexadecimal"_lang, this->m_numberDisplayStyle == NumberDisplayStyle::Hexadecimal)) { + if (ImGui::RadioButton("hex.builtin.common.hexadecimal"_lang, this->m_numberDisplayStyle == NumberDisplayStyle::Hexadecimal)) { this->m_numberDisplayStyle = NumberDisplayStyle::Hexadecimal; this->m_shouldInvalidate = true; } ImGui::SameLine(); - if (ImGui::RadioButton("hex.common.octal"_lang, this->m_numberDisplayStyle == NumberDisplayStyle::Octal)) { + if (ImGui::RadioButton("hex.builtin.common.octal"_lang, this->m_numberDisplayStyle == NumberDisplayStyle::Octal)) { this->m_numberDisplayStyle = NumberDisplayStyle::Octal; this->m_shouldInvalidate = true; } diff --git a/plugins/builtin/source/content/views/view_data_processor.cpp b/plugins/builtin/source/content/views/view_data_processor.cpp index 8452e1485..aaf8a567a 100644 --- a/plugins/builtin/source/content/views/view_data_processor.cpp +++ b/plugins/builtin/source/content/views/view_data_processor.cpp @@ -264,7 +264,7 @@ namespace hex::plugin::builtin { int nodeId; if (ImNodes::IsNodeHovered(&nodeId) && this->m_currNodeError.has_value() && this->m_currNodeError->first->getId() == nodeId) { ImGui::BeginTooltip(); - ImGui::TextUnformatted("hex.common.error"_lang); + ImGui::TextUnformatted("hex.builtin.common.error"_lang); ImGui::Separator(); ImGui::TextUnformatted(this->m_currNodeError->second.c_str()); ImGui::EndTooltip(); diff --git a/plugins/builtin/source/content/views/view_disassembler.cpp b/plugins/builtin/source/content/views/view_disassembler.cpp index b89525a32..4eec6f322 100644 --- a/plugins/builtin/source/content/views/view_disassembler.cpp +++ b/plugins/builtin/source/content/views/view_disassembler.cpp @@ -112,7 +112,7 @@ namespace hex::plugin::builtin { ImGui::InputScalar("hex.builtin.view.disassembler.base"_lang, ImGuiDataType_U64, &this->m_baseAddress, nullptr, nullptr, "%08llX", ImGuiInputTextFlags_CharsHexadecimal); ImGui::InputScalarN("hex.builtin.view.disassembler.region"_lang, ImGuiDataType_U64, this->m_codeRegion, 2, nullptr, nullptr, "%08llX", ImGuiInputTextFlags_CharsHexadecimal); - ImGui::Checkbox("hex.common.match_selection"_lang, &this->m_shouldMatchSelection); + ImGui::Checkbox("hex.builtin.common.match_selection"_lang, &this->m_shouldMatchSelection); if (ImGui::IsItemEdited()) { // Force execution of Region Selection Event EventManager::post(Region { 0, 0 }); @@ -129,9 +129,9 @@ namespace hex::plugin::builtin { if (ImGui::BeginChild("modes", ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 6), true, ImGuiWindowFlags_AlwaysAutoResize)) { static int littleEndian = true; - ImGui::RadioButton("hex.common.little_endian"_lang, &littleEndian, true); + ImGui::RadioButton("hex.builtin.common.little_endian"_lang, &littleEndian, true); ImGui::SameLine(); - ImGui::RadioButton("hex.common.big_endian"_lang, &littleEndian, false); + ImGui::RadioButton("hex.builtin.common.big_endian"_lang, &littleEndian, false); ImGui::NewLine(); diff --git a/plugins/builtin/source/content/views/view_hashes.cpp b/plugins/builtin/source/content/views/view_hashes.cpp index 7e95023f2..7df62637a 100644 --- a/plugins/builtin/source/content/views/view_hashes.cpp +++ b/plugins/builtin/source/content/views/view_hashes.cpp @@ -46,13 +46,13 @@ namespace hex::plugin::builtin { auto provider = ImHexApi::Provider::get(); if (ImHexApi::Provider::isValid() && provider->isAvailable()) { - ImGui::TextUnformatted("hex.common.region"_lang); + ImGui::TextUnformatted("hex.builtin.common.region"_lang); ImGui::Separator(); ImGui::InputScalarN("##nolabel", ImGuiDataType_U64, this->m_hashRegion, 2, nullptr, nullptr, "%08X", ImGuiInputTextFlags_CharsHexadecimal); if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; - ImGui::Checkbox("hex.common.match_selection"_lang, &this->m_shouldMatchSelection); + ImGui::Checkbox("hex.builtin.common.match_selection"_lang, &this->m_shouldMatchSelection); if (ImGui::IsItemEdited()) { // Force execution of Region Selection Event EventManager::post(Region { 0, 0 }); @@ -92,10 +92,10 @@ namespace hex::plugin::builtin { ImGui::InputInt("hex.builtin.view.hashes.xorout"_lang, &xorout, 0, 0, ImGuiInputTextFlags_CharsHexadecimal); if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; - ImGui::Checkbox("hex.common.reflectIn"_lang, &reflectIn); + ImGui::Checkbox("hex.builtin.common.reflectIn"_lang, &reflectIn); if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; - ImGui::Checkbox("hex.common.reflectOut"_lang, &reflectOut); + ImGui::Checkbox("hex.builtin.common.reflectOut"_lang, &reflectOut); if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; ImGui::InputInt("hex.builtin.view.hashes.poly"_lang, &polynomial, 0, 0, ImGuiInputTextFlags_CharsHexadecimal); @@ -127,10 +127,10 @@ namespace hex::plugin::builtin { ImGui::InputInt("hex.builtin.view.hashes.xorout"_lang, &xorout, 0, 0, ImGuiInputTextFlags_CharsHexadecimal); if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; - ImGui::Checkbox("hex.common.reflectIn"_lang, &reflectIn); + ImGui::Checkbox("hex.builtin.common.reflectIn"_lang, &reflectIn); if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; - ImGui::Checkbox("hex.common.reflectOut"_lang, &reflectOut); + ImGui::Checkbox("hex.builtin.common.reflectOut"_lang, &reflectOut); if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; ImGui::InputInt("hex.builtin.view.hashes.poly"_lang, &polynomial, 0, 0, ImGuiInputTextFlags_CharsHexadecimal); @@ -163,10 +163,10 @@ namespace hex::plugin::builtin { ImGui::InputInt("hex.builtin.view.hashes.xorout"_lang, &xorout, 0, 0, ImGuiInputTextFlags_CharsHexadecimal); if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; - ImGui::Checkbox("hex.common.reflectIn"_lang, &reflectIn); + ImGui::Checkbox("hex.builtin.common.reflectIn"_lang, &reflectIn); if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; - ImGui::Checkbox("hex.common.reflectOut"_lang, &reflectOut); + ImGui::Checkbox("hex.builtin.common.reflectOut"_lang, &reflectOut); if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; ImGui::InputInt("hex.builtin.view.hashes.poly"_lang, &polynomial, 0, 0, ImGuiInputTextFlags_CharsHexadecimal); diff --git a/plugins/builtin/source/content/views/view_hexeditor.cpp b/plugins/builtin/source/content/views/view_hexeditor.cpp index e4609e063..06df4ceb8 100644 --- a/plugins/builtin/source/content/views/view_hexeditor.cpp +++ b/plugins/builtin/source/content/views/view_hexeditor.cpp @@ -251,7 +251,7 @@ namespace hex::plugin::builtin { ImGui::NewLine(); confirmButtons( - "hex.common.yes"_lang, "hex.common.no"_lang, [] { ImHexApi::Common::closeImHex(true); }, [] { ImGui::CloseCurrentPopup(); }); + "hex.builtin.common.yes"_lang, "hex.builtin.common.no"_lang, [] { ImHexApi::Common::closeImHex(true); }, [] { ImGui::CloseCurrentPopup(); }); if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_Escape))) ImGui::CloseCurrentPopup(); @@ -287,7 +287,7 @@ namespace hex::plugin::builtin { ImGui::NewLine(); confirmButtons( - "hex.common.load"_lang, "hex.common.cancel"_lang, [this, &provider] { + "hex.builtin.common.load"_lang, "hex.builtin.common.cancel"_lang, [this, &provider] { if (!this->m_loaderScriptScriptPath.empty() && !this->m_loaderScriptFilePath.empty()) { EventManager::post(this->m_loaderScriptFilePath); LoaderScript::setFilePath(this->m_loaderScriptFilePath); @@ -300,11 +300,11 @@ namespace hex::plugin::builtin { } if (ImGui::BeginPopupModal("hex.builtin.view.hexeditor.menu.edit.set_base"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { - ImGui::InputText("hex.common.address"_lang, this->m_baseAddressBuffer, 16, ImGuiInputTextFlags_CharsHexadecimal); + ImGui::InputText("hex.builtin.common.address"_lang, this->m_baseAddressBuffer, 16, ImGuiInputTextFlags_CharsHexadecimal); ImGui::NewLine(); confirmButtons( - "hex.common.set"_lang, "hex.common.cancel"_lang, [this, &provider] { + "hex.builtin.common.set"_lang, "hex.builtin.common.cancel"_lang, [this, &provider] { provider->setBaseAddress(strtoull(this->m_baseAddressBuffer, nullptr, 16)); ImGui::CloseCurrentPopup(); }, [] { ImGui::CloseCurrentPopup(); }); @@ -317,11 +317,11 @@ namespace hex::plugin::builtin { if (ImGui::BeginPopupModal("hex.builtin.view.hexeditor.menu.edit.resize"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { ImGui::TextUnformatted("0x"); ImGui::SameLine(); - ImGui::InputScalar("hex.common.size"_lang, ImGuiDataType_U64, &this->m_resizeSize, nullptr, nullptr, "%llx", ImGuiInputTextFlags_CharsHexadecimal); + ImGui::InputScalar("hex.builtin.common.size"_lang, ImGuiDataType_U64, &this->m_resizeSize, nullptr, nullptr, "%llx", ImGuiInputTextFlags_CharsHexadecimal); ImGui::NewLine(); confirmButtons( - "hex.common.set"_lang, "hex.common.cancel"_lang, [this, &provider] { + "hex.builtin.common.set"_lang, "hex.builtin.common.cancel"_lang, [this, &provider] { provider->resize(this->m_resizeSize); ImGui::CloseCurrentPopup(); }, [] { ImGui::CloseCurrentPopup(); }); @@ -334,11 +334,11 @@ namespace hex::plugin::builtin { if (ImGui::BeginPopupModal("hex.builtin.view.hexeditor.menu.edit.insert"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { ImGui::TextUnformatted("0x"); ImGui::SameLine(); - ImGui::InputScalar("hex.common.size"_lang, ImGuiDataType_U64, &this->m_resizeSize, nullptr, nullptr, "%llx", ImGuiInputTextFlags_CharsHexadecimal); + ImGui::InputScalar("hex.builtin.common.size"_lang, ImGuiDataType_U64, &this->m_resizeSize, nullptr, nullptr, "%llx", ImGuiInputTextFlags_CharsHexadecimal); ImGui::NewLine(); confirmButtons( - "hex.common.set"_lang, "hex.common.cancel"_lang, [this, &provider] { + "hex.builtin.common.set"_lang, "hex.builtin.common.cancel"_lang, [this, &provider] { provider->insert(std::min(this->m_memoryEditor.DataPreviewAddr, this->m_memoryEditor.DataPreviewAddrEnd), this->m_resizeSize); ImGui::CloseCurrentPopup(); }, [] { ImGui::CloseCurrentPopup(); }); diff --git a/plugins/builtin/source/content/views/view_pattern_editor.cpp b/plugins/builtin/source/content/views/view_pattern_editor.cpp index c1c001549..5b9badb9c 100644 --- a/plugins/builtin/source/content/views/view_pattern_editor.cpp +++ b/plugins/builtin/source/content/views/view_pattern_editor.cpp @@ -323,7 +323,7 @@ namespace hex::plugin::builtin { ImGui::NewLine(); View::confirmButtons( - "hex.common.yes"_lang, "hex.common.no"_lang, [] { + "hex.builtin.common.yes"_lang, "hex.builtin.common.no"_lang, [] { ImHexApi::Provider::get()->getPatternLanguageRuntime().allowDangerousFunctions(true); ImGui::CloseCurrentPopup(); }, [] { ImHexApi::Provider::get()->getPatternLanguageRuntime().allowDangerousFunctions(false); @@ -552,7 +552,7 @@ namespace hex::plugin::builtin { ImGui::TextUnformatted("hex.builtin.view.pattern_editor.accept_pattern.question"_lang); confirmButtons( - "hex.common.yes"_lang, "hex.common.no"_lang, [this] { + "hex.builtin.common.yes"_lang, "hex.builtin.common.no"_lang, [this] { this->loadPatternFile(this->m_possiblePatternFiles[this->m_selectedPatternFile].string()); ImGui::CloseCurrentPopup(); }, [] { ImGui::CloseCurrentPopup(); }); diff --git a/plugins/builtin/source/content/views/view_provider_settings.cpp b/plugins/builtin/source/content/views/view_provider_settings.cpp index 5c644d129..846ad374c 100644 --- a/plugins/builtin/source/content/views/view_provider_settings.cpp +++ b/plugins/builtin/source/content/views/view_provider_settings.cpp @@ -35,14 +35,14 @@ namespace hex::plugin::builtin { ImGui::NewLine(); ImGui::Separator(); - if (ImGui::Button("hex.common.open"_lang)) { + if (ImGui::Button("hex.builtin.common.open"_lang)) { if (provider->open()) ImGui::CloseCurrentPopup(); } ImGui::SameLine(); - if (ImGui::Button("hex.common.cancel"_lang)) { + if (ImGui::Button("hex.builtin.common.cancel"_lang)) { ImHexApi::Provider::remove(provider); ImGui::CloseCurrentPopup(); } diff --git a/plugins/builtin/source/content/views/view_yara.cpp b/plugins/builtin/source/content/views/view_yara.cpp index 30c6d474c..1a0f5bc00 100644 --- a/plugins/builtin/source/content/views/view_yara.cpp +++ b/plugins/builtin/source/content/views/view_yara.cpp @@ -86,8 +86,8 @@ namespace hex::plugin::builtin { ImGui::TableSetupScrollFreeze(0, 1); ImGui::TableSetupColumn("hex.builtin.view.yara.matches.identifier"_lang); ImGui::TableSetupColumn("hex.builtin.view.yara.matches.variable"_lang); - ImGui::TableSetupColumn("hex.common.address"_lang); - ImGui::TableSetupColumn("hex.common.size"_lang); + ImGui::TableSetupColumn("hex.builtin.common.address"_lang); + ImGui::TableSetupColumn("hex.builtin.common.size"_lang); ImGui::TableHeadersRow(); diff --git a/plugins/builtin/source/content/welcome_screen.cpp b/plugins/builtin/source/content/welcome_screen.cpp index b89e90eec..a9350f2ee 100644 --- a/plugins/builtin/source/content/welcome_screen.cpp +++ b/plugins/builtin/source/content/welcome_screen.cpp @@ -54,20 +54,20 @@ namespace hex::plugin::builtin { static void drawPopups() { ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_Appearing, ImVec2(0.5F, 0.5F)); ImGui::SetNextWindowSize(ImGui::GetMainViewport()->Size / 3, ImGuiCond_Appearing); - if (ImGui::BeginPopup("hex.welcome.tip_of_the_day"_lang)) { - ImGui::Header("hex.welcome.tip_of_the_day"_lang, true); + if (ImGui::BeginPopup("hex.builtin.welcome.tip_of_the_day"_lang)) { + ImGui::Header("hex.builtin.welcome.tip_of_the_day"_lang, true); ImGui::TextFormattedWrapped("{}", s_tipOfTheDay.c_str()); ImGui::NewLine(); static bool dontShowAgain = false; - if (ImGui::Checkbox("hex.common.dont_show_again"_lang, &dontShowAgain)) { + if (ImGui::Checkbox("hex.builtin.common.dont_show_again"_lang, &dontShowAgain)) { ContentRegistry::Settings::write("hex.builtin.setting.general", "hex.builtin.setting.general.show_tips", !dontShowAgain); } - ImGui::SameLine((ImGui::GetMainViewport()->Size / 3 - ImGui::CalcTextSize("hex.common.close"_lang) - ImGui::GetStyle().FramePadding).x); + ImGui::SameLine((ImGui::GetMainViewport()->Size / 3 - ImGui::CalcTextSize("hex.builtin.common.close"_lang) - ImGui::GetStyle().FramePadding).x); - if (ImGui::Button("hex.common.close"_lang)) + if (ImGui::Button("hex.builtin.common.close"_lang)) ImGui::CloseCurrentPopup(); ImGui::EndPopup(); @@ -76,13 +76,13 @@ namespace hex::plugin::builtin { // Popup for if there is a safety backup present because ImHex crashed ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_Appearing, ImVec2(0.5F, 0.5F)); - if (ImGui::BeginPopupModal("hex.safety_backup.title"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove)) { - ImGui::TextUnformatted("hex.safety_backup.desc"_lang); + if (ImGui::BeginPopupModal("hex.builtin.welcome.safety_backup.title"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove)) { + ImGui::TextUnformatted("hex.builtin.welcome.safety_backup.desc"_lang); ImGui::NewLine(); auto width = ImGui::GetWindowWidth(); ImGui::SetCursorPosX(width / 9); - if (ImGui::Button("hex.safety_backup.restore"_lang, ImVec2(width / 3, 0))) { + if (ImGui::Button("hex.builtin.welcome.safety_backup.restore"_lang, ImVec2(width / 3, 0))) { ProjectFile::load(s_safetyBackupPath.string()); ProjectFile::markDirty(); @@ -93,7 +93,7 @@ namespace hex::plugin::builtin { } ImGui::SameLine(); ImGui::SetCursorPosX(width / 9 * 5); - if (ImGui::Button("hex.safety_backup.delete"_lang, ImVec2(width / 3, 0))) { + if (ImGui::Button("hex.builtin.welcome.safety_backup.delete"_lang, ImVec2(width / 3, 0))) { fs::remove(s_safetyBackupPath); ImGui::CloseCurrentPopup(); @@ -120,21 +120,21 @@ namespace hex::plugin::builtin { ImGui::TableNextColumn(); - ImGui::UnderlinedText("hex.welcome.header.start"_lang); + ImGui::UnderlinedText("hex.builtin.welcome.header.start"_lang); ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5_scaled); { - if (ImGui::IconHyperlink(ICON_VS_NEW_FILE, "hex.welcome.start.create_file"_lang)) + if (ImGui::IconHyperlink(ICON_VS_NEW_FILE, "hex.builtin.welcome.start.create_file"_lang)) EventManager::post("Create File"); - if (ImGui::IconHyperlink(ICON_VS_GO_TO_FILE, "hex.welcome.start.open_file"_lang)) + if (ImGui::IconHyperlink(ICON_VS_GO_TO_FILE, "hex.builtin.welcome.start.open_file"_lang)) EventManager::post("Open File"); - if (ImGui::IconHyperlink(ICON_VS_NOTEBOOK, "hex.welcome.start.open_project"_lang)) + if (ImGui::IconHyperlink(ICON_VS_NOTEBOOK, "hex.builtin.welcome.start.open_project"_lang)) EventManager::post("Open Project"); - if (ImGui::IconHyperlink(ICON_VS_TELESCOPE, "hex.welcome.start.open_other"_lang)) - ImGui::OpenPopup("hex.welcome.start.popup.open_other"_lang); + if (ImGui::IconHyperlink(ICON_VS_TELESCOPE, "hex.builtin.welcome.start.open_other"_lang)) + ImGui::OpenPopup("hex.builtin.welcome.start.popup.open_other"_lang); } ImGui::SetNextWindowPos(ImGui::GetWindowPos() + ImGui::GetCursorPos()); - if (ImGui::BeginPopup("hex.welcome.start.popup.open_other"_lang)) { + if (ImGui::BeginPopup("hex.builtin.welcome.start.popup.open_other"_lang)) { for (const auto &unlocalizedProviderName : ContentRegistry::Provider::getEntries()) { if (ImGui::Hyperlink(LangEntry(unlocalizedProviderName))) { @@ -148,7 +148,7 @@ namespace hex::plugin::builtin { ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 9); ImGui::TableNextColumn(); - ImGui::UnderlinedText("hex.welcome.start.recent"_lang); + ImGui::UnderlinedText("hex.builtin.welcome.start.recent"_lang); ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5_scaled); { for (auto &path : s_recentFilePaths) { @@ -162,35 +162,35 @@ namespace hex::plugin::builtin { if (ImHexApi::System::getInitArguments().contains("update-available")) { ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 5); ImGui::TableNextColumn(); - ImGui::UnderlinedText("hex.welcome.header.update"_lang); + ImGui::UnderlinedText("hex.builtin.welcome.header.update"_lang); { - if (ImGui::DescriptionButton("hex.welcome.update.title"_lang, hex::format("hex.welcome.update.desc"_lang, ImHexApi::System::getInitArguments()["update-available"]).c_str(), ImVec2(ImGui::GetContentRegionAvail().x * 0.8F, 0))) - hex::openWebpage("hex.welcome.update.link"_lang); + if (ImGui::DescriptionButton("hex.builtin.welcome.update.title"_lang, hex::format("hex.builtin.welcome.update.desc"_lang, ImHexApi::System::getInitArguments()["update-available"]).c_str(), ImVec2(ImGui::GetContentRegionAvail().x * 0.8F, 0))) + hex::openWebpage("hex.builtin.welcome.update.link"_lang); } } ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 6); ImGui::TableNextColumn(); - ImGui::UnderlinedText("hex.welcome.header.help"_lang); + ImGui::UnderlinedText("hex.builtin.welcome.header.help"_lang); ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5_scaled); { - if (ImGui::IconHyperlink(ICON_VS_GITHUB, "hex.welcome.help.repo"_lang)) hex::openWebpage("hex.welcome.help.repo.link"_lang); - if (ImGui::IconHyperlink(ICON_VS_ORGANIZATION, "hex.welcome.help.gethelp"_lang)) hex::openWebpage("hex.welcome.help.gethelp.link"_lang); - if (ImGui::IconHyperlink(ICON_VS_COMMENT_DISCUSSION, "hex.welcome.help.discord"_lang)) hex::openWebpage("hex.welcome.help.discord.link"_lang); + if (ImGui::IconHyperlink(ICON_VS_GITHUB, "hex.builtin.welcome.help.repo"_lang)) hex::openWebpage("hex.builtin.welcome.help.repo.link"_lang); + if (ImGui::IconHyperlink(ICON_VS_ORGANIZATION, "hex.builtin.welcome.help.gethelp"_lang)) hex::openWebpage("hex.builtin.welcome.help.gethelp.link"_lang); + if (ImGui::IconHyperlink(ICON_VS_COMMENT_DISCUSSION, "hex.builtin.welcome.help.discord"_lang)) hex::openWebpage("hex.builtin.welcome.help.discord.link"_lang); } ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 5); ImGui::TableNextColumn(); - ImGui::UnderlinedText("hex.welcome.header.plugins"_lang); + ImGui::UnderlinedText("hex.builtin.welcome.header.plugins"_lang); { const auto &plugins = PluginManager::getPlugins(); if (!plugins.empty()) { if (ImGui::BeginTable("plugins", 4, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY | ImGuiTableFlags_SizingFixedFit, ImVec2((ImGui::GetContentRegionAvail().x * 5) / 6, ImGui::GetTextLineHeightWithSpacing() * 5))) { ImGui::TableSetupScrollFreeze(0, 1); - ImGui::TableSetupColumn("hex.welcome.plugins.plugin"_lang, ImGuiTableColumnFlags_WidthStretch, 0.2); - ImGui::TableSetupColumn("hex.welcome.plugins.author"_lang, ImGuiTableColumnFlags_WidthStretch, 0.2); - ImGui::TableSetupColumn("hex.welcome.plugins.desc"_lang, ImGuiTableColumnFlags_WidthStretch, 0.6); + ImGui::TableSetupColumn("hex.builtin.welcome.plugins.plugin"_lang, ImGuiTableColumnFlags_WidthStretch, 0.2); + ImGui::TableSetupColumn("hex.builtin.welcome.plugins.author"_lang, ImGuiTableColumnFlags_WidthStretch, 0.2); + ImGui::TableSetupColumn("hex.builtin.welcome.plugins.desc"_lang, ImGuiTableColumnFlags_WidthStretch, 0.6); ImGui::TableSetupColumn("##loaded", ImGuiTableColumnFlags_WidthFixed, ImGui::GetTextLineHeight()); ImGui::TableHeadersRow(); @@ -227,28 +227,28 @@ namespace hex::plugin::builtin { if (ImGui::BeginTable("Welcome Right", 1, ImGuiTableFlags_NoBordersInBody, ImVec2(availableSpace.x / 2, 0))) { ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 5); ImGui::TableNextColumn(); - ImGui::UnderlinedText("hex.welcome.header.customize"_lang); + ImGui::UnderlinedText("hex.builtin.welcome.header.customize"_lang); { - if (ImGui::DescriptionButton("hex.welcome.customize.settings.title"_lang, "hex.welcome.customize.settings.desc"_lang, ImVec2(ImGui::GetContentRegionAvail().x * 0.8F, 0))) + if (ImGui::DescriptionButton("hex.builtin.welcome.customize.settings.title"_lang, "hex.builtin.welcome.customize.settings.desc"_lang, ImVec2(ImGui::GetContentRegionAvail().x * 0.8F, 0))) EventManager::post("Settings"); } ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 5); ImGui::TableNextColumn(); - ImGui::UnderlinedText("hex.welcome.header.learn"_lang); + ImGui::UnderlinedText("hex.builtin.welcome.header.learn"_lang); { - if (ImGui::DescriptionButton("hex.welcome.learn.latest.title"_lang, "hex.welcome.learn.latest.desc"_lang, ImVec2(ImGui::GetContentRegionAvail().x * 0.8F, 0))) - hex::openWebpage("hex.welcome.learn.latest.link"_lang); - if (ImGui::DescriptionButton("hex.welcome.learn.pattern.title"_lang, "hex.welcome.learn.pattern.desc"_lang, ImVec2(ImGui::GetContentRegionAvail().x * 0.8F, 0))) - hex::openWebpage("hex.welcome.learn.pattern.link"_lang); - if (ImGui::DescriptionButton("hex.welcome.learn.plugins.title"_lang, "hex.welcome.learn.plugins.desc"_lang, ImVec2(ImGui::GetContentRegionAvail().x * 0.8F, 0))) - hex::openWebpage("hex.welcome.learn.plugins.link"_lang); + if (ImGui::DescriptionButton("hex.builtin.welcome.learn.latest.title"_lang, "hex.builtin.welcome.learn.latest.desc"_lang, ImVec2(ImGui::GetContentRegionAvail().x * 0.8F, 0))) + hex::openWebpage("hex.builtin.welcome.learn.latest.link"_lang); + if (ImGui::DescriptionButton("hex.builtin.welcome.learn.pattern.title"_lang, "hex.builtin.welcome.learn.pattern.desc"_lang, ImVec2(ImGui::GetContentRegionAvail().x * 0.8F, 0))) + hex::openWebpage("hex.builtin.welcome.learn.pattern.link"_lang); + if (ImGui::DescriptionButton("hex.builtin.welcome.learn.plugins.title"_lang, "hex.builtin.welcome.learn.plugins.desc"_lang, ImVec2(ImGui::GetContentRegionAvail().x * 0.8F, 0))) + hex::openWebpage("hex.builtin.welcome.learn.plugins.link"_lang); } auto extraWelcomeScreenEntries = ContentRegistry::Interface::getWelcomeScreenEntries(); if (!extraWelcomeScreenEntries.empty()) { ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 5); ImGui::TableNextColumn(); - ImGui::UnderlinedText("hex.welcome.header.various"_lang); + ImGui::UnderlinedText("hex.builtin.welcome.header.various"_lang); { for (const auto &callback : extraWelcomeScreenEntries) callback(); @@ -450,7 +450,7 @@ namespace hex::plugin::builtin { for (const auto &path : hex::getPath(ImHexPath::Config)) { if (auto filePath = fs::path(path) / CrashBackupFileName; fs::exists(filePath)) { s_safetyBackupPath = filePath; - ImHexApi::Tasks::doLater([] { ImGui::OpenPopup("hex.safety_backup.title"_lang); }); + ImHexApi::Tasks::doLater([] { ImGui::OpenPopup("hex.builtin.welcome.safety_backup.title"_lang); }); } } @@ -462,7 +462,7 @@ namespace hex::plugin::builtin { bool showTipOfTheDay = ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.show_tips", 1); if (showTipOfTheDay) - ImHexApi::Tasks::doLater([] { ImGui::OpenPopup("hex.welcome.tip_of_the_day"_lang); }); + ImHexApi::Tasks::doLater([] { ImGui::OpenPopup("hex.builtin.welcome.tip_of_the_day"_lang); }); } } diff --git a/plugins/builtin/source/lang/de_DE.cpp b/plugins/builtin/source/lang/de_DE.cpp index 5f8a19cf2..c27070527 100644 --- a/plugins/builtin/source/lang/de_DE.cpp +++ b/plugins/builtin/source/lang/de_DE.cpp @@ -7,85 +7,79 @@ namespace hex::plugin::builtin { ContentRegistry::Language::registerLanguage("German", "de-DE"); ContentRegistry::Language::addLocalizations("de-DE", { - /* ImHex default functionality */ - { "hex.menu.feedback", "Feedback hinterlassen" }, - { "hex.menu.debug_build", "Debug build"}, + { "hex.builtin.welcome.header.main", "Wilkommen zu ImHex" }, + { "hex.builtin.welcome.header.start", "Start" }, + { "hex.builtin.welcome.start.create_file", "Neue Datei Erstellen" }, + { "hex.builtin.welcome.start.open_file", "Datei Öffnen" }, + { "hex.builtin.welcome.start.open_project", "Projekt Öffnen" }, + { "hex.builtin.welcome.start.recent", "Kürzlich geöffnet" }, + { "hex.builtin.welcome.start.open_other", "Andere Provider" }, + { "hex.builtin.welcome.header.help", "Hilfe" }, + { "hex.builtin.welcome.help.repo", "GitHub Repository" }, + { "hex.builtin.welcome.help.repo.link", "https://imhex.werwolv.net/git" }, + { "hex.builtin.welcome.help.gethelp", "Hilfe erhalten" }, + { "hex.builtin.welcome.help.gethelp.link", "https://github.com/WerWolv/ImHex/discussions/categories/get-help" }, + { "hex.builtin.welcome.help.discord", "Discord Server" }, + { "hex.builtin.welcome.help.discord.link", "https://imhex.werwolv.net/discord" }, + { "hex.builtin.welcome.header.plugins", "Geladene Plugins" }, + { "hex.builtin.welcome.plugins.plugin", "Plugin" }, + { "hex.builtin.welcome.plugins.author", "Autor" }, + { "hex.builtin.welcome.plugins.desc", "Beschreibung" }, + { "hex.builtin.welcome.header.customize", "Anpassen" }, + { "hex.builtin.welcome.customize.settings.title", "Einstellungen" }, + { "hex.builtin.welcome.customize.settings.desc", "Ändere ImHex's Einstellungen" }, + { "hex.builtin.welcome.header.update", "Updates" }, + { "hex.builtin.welcome.update.title", "Neues Update verfügbar!" }, + { "hex.builtin.welcome.update.desc", "ImHex {0} wurde gerade released! Downloade die neue version hier" }, + { "hex.builtin.welcome.update.link", "https://github.com/WerWolv/ImHex/releases/latest" }, + { "hex.builtin.welcome.header.learn", "Lernen" }, + { "hex.builtin.welcome.learn.latest.title", "Neuster Release" }, + { "hex.builtin.welcome.learn.latest.desc", "Lies den momentanen ImHex Changelog" }, + { "hex.builtin.welcome.learn.latest.link", "https://github.com/WerWolv/ImHex/releases/latest" }, + { "hex.builtin.welcome.learn.pattern.title", "Pattern Language Dokumentation" }, + { "hex.builtin.welcome.learn.pattern.desc", "Lern ImHex Patterns zu schreiben mit unserer umfangreichen Dokumentation" }, + { "hex.builtin.welcome.learn.pattern.link", "https://imhex.werwolv.net/docs/pattern_language/pattern_language.html" }, + { "hex.builtin.welcome.learn.plugins.title", "Plugins API" }, + { "hex.builtin.welcome.learn.plugins.desc", "Erweitere ImHex mit neuen Funktionen mit Plugins" }, + { "hex.builtin.welcome.learn.plugins.link", "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide" }, + { "hex.builtin.welcome.header.various", "Verschiedenes" }, + { "hex.builtin.welcome.tip_of_the_day", "Tipp des Tages" }, - { "hex.welcome.header.main", "Wilkommen zu ImHex" }, - { "hex.welcome.header.start", "Start" }, - { "hex.welcome.start.create_file", "Neue Datei Erstellen" }, - { "hex.welcome.start.open_file", "Datei Öffnen" }, - { "hex.welcome.start.open_project", "Projekt Öffnen" }, - { "hex.welcome.start.recent", "Kürzlich geöffnet" }, - { "hex.welcome.start.open_other", "Andere Provider" }, - { "hex.welcome.header.help", "Hilfe" }, - { "hex.welcome.help.repo", "GitHub Repository" }, - { "hex.welcome.help.repo.link", "https://imhex.werwolv.net/git" }, - { "hex.welcome.help.gethelp", "Hilfe erhalten" }, - { "hex.welcome.help.gethelp.link", "https://github.com/WerWolv/ImHex/discussions/categories/get-help" }, - { "hex.welcome.help.discord", "Discord Server" }, - { "hex.welcome.help.discord.link", "https://imhex.werwolv.net/discord" }, - { "hex.welcome.header.plugins", "Geladene Plugins" }, - { "hex.welcome.plugins.plugin", "Plugin" }, - { "hex.welcome.plugins.author", "Autor" }, - { "hex.welcome.plugins.desc", "Beschreibung" }, - { "hex.welcome.header.customize", "Anpassen" }, - { "hex.welcome.customize.settings.title", "Einstellungen" }, - { "hex.welcome.customize.settings.desc", "Ändere ImHex's Einstellungen" }, - { "hex.welcome.header.update", "Updates" }, - { "hex.welcome.update.title", "Neues Update verfügbar!" }, - { "hex.welcome.update.desc", "ImHex {0} wurde gerade released! Downloade die neue version hier" }, - { "hex.welcome.update.link", "https://github.com/WerWolv/ImHex/releases/latest" }, - { "hex.welcome.header.learn", "Lernen" }, - { "hex.welcome.learn.latest.title", "Neuster Release" }, - { "hex.welcome.learn.latest.desc", "Lies den momentanen ImHex Changelog" }, - { "hex.welcome.learn.latest.link", "https://github.com/WerWolv/ImHex/releases/latest" }, - { "hex.welcome.learn.pattern.title", "Pattern Language Dokumentation" }, - { "hex.welcome.learn.pattern.desc", "Lern ImHex Patterns zu schreiben mit unserer umfangreichen Dokumentation" }, - { "hex.welcome.learn.pattern.link", "https://imhex.werwolv.net/docs/pattern_language/pattern_language.html" }, - { "hex.welcome.learn.plugins.title", "Plugins API" }, - { "hex.welcome.learn.plugins.desc", "Erweitere ImHex mit neuen Funktionen mit Plugins" }, - { "hex.welcome.learn.plugins.link", "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide" }, - { "hex.welcome.header.various", "Verschiedenes" }, - { "hex.welcome.tip_of_the_day", "Tipp des Tages" }, - - { "hex.safety_backup.title", "Verlorene Daten wiederherstellen" }, - { "hex.safety_backup.desc", "Oh nein, ImHex ist letztes mal abgestürtzt.\nWillst du das verherige Projekt wiederherstellen?"}, - { "hex.safety_backup.restore", "Ja, Wiederherstellen" }, - { "hex.safety_backup.delete", "Nein, Entfernen" }, + { "hex.builtin.welcome.safety_backup.title", "Verlorene Daten wiederherstellen" }, + { "hex.builtin.welcome.safety_backup.desc", "Oh nein, ImHex ist letztes mal abgestürtzt.\nWillst du das verherige Projekt wiederherstellen?"}, + { "hex.builtin.welcome.safety_backup.restore", "Ja, Wiederherstellen" }, + { "hex.builtin.welcome.safety_backup.delete", "Nein, Entfernen" }, - { "hex.common.little_endian", "Little Endian" }, - { "hex.common.big_endian", "Big Endian" }, - { "hex.common.decimal", "Dezimal" }, - { "hex.common.hexadecimal", "Hexadezimal" }, - { "hex.common.octal", "Oktal" }, - { "hex.common.info", "Information" }, - { "hex.common.error", "Fehler" }, - { "hex.common.fatal", "Fataler Fehler" }, - { "hex.common.address", "Adresse" }, - { "hex.common.size", "Länge" }, - { "hex.common.region", "Region" }, - { "hex.common.match_selection", "Arbeitsbereich synchronisieren" }, - { "hex.common.yes", "Ja" }, - { "hex.common.no", "Nein" }, - { "hex.common.okay", "Okay" }, - { "hex.common.load", "Laden" }, - { "hex.common.cancel", "Abbrechen" }, - { "hex.common.set", "Setzen" }, - { "hex.common.close", "Schliessen" }, - { "hex.common.dont_show_again", "Nicht mehr anzeigen" }, - { "hex.common.link", "Link" }, - { "hex.common.file", "Datei" }, - { "hex.common.open", "Öffnen" }, - { "hex.common.browse", "Druchsuchen..." }, - { "hex.common.choose_file", "Datei auswählen" }, + { "hex.builtin.common.little_endian", "Little Endian" }, + { "hex.builtin.common.big_endian", "Big Endian" }, + { "hex.builtin.common.decimal", "Dezimal" }, + { "hex.builtin.common.hexadecimal", "Hexadezimal" }, + { "hex.builtin.common.octal", "Oktal" }, + { "hex.builtin.common.info", "Information" }, + { "hex.builtin.common.error", "Fehler" }, + { "hex.builtin.common.fatal", "Fataler Fehler" }, + { "hex.builtin.common.address", "Adresse" }, + { "hex.builtin.common.size", "Länge" }, + { "hex.builtin.common.region", "Region" }, + { "hex.builtin.common.match_selection", "Arbeitsbereich synchronisieren" }, + { "hex.builtin.common.yes", "Ja" }, + { "hex.builtin.common.no", "Nein" }, + { "hex.builtin.common.okay", "Okay" }, + { "hex.builtin.common.load", "Laden" }, + { "hex.builtin.common.cancel", "Abbrechen" }, + { "hex.builtin.common.set", "Setzen" }, + { "hex.builtin.common.close", "Schliessen" }, + { "hex.builtin.common.dont_show_again", "Nicht mehr anzeigen" }, + { "hex.builtin.common.link", "Link" }, + { "hex.builtin.common.file", "Datei" }, + { "hex.builtin.common.open", "Öffnen" }, + { "hex.builtin.common.browse", "Druchsuchen..." }, + { "hex.builtin.common.choose_file", "Datei auswählen" }, - { "hex.message.file_handler_failed", "Datei konnte nicht mit registriertem Dateihandler geöffnet werden." }, + { "hex.builtin.message.file_handler_failed", "Datei konnte nicht mit registriertem Dateihandler geöffnet werden." }, - /* Builtin plugin features */ - { "hex.builtin.menu.file", "Datei" }, { "hex.builtin.menu.edit", "Bearbeiten" }, { "hex.builtin.menu.view", "Ansicht" }, diff --git a/plugins/builtin/source/lang/en_US.cpp b/plugins/builtin/source/lang/en_US.cpp index e357f61eb..75f352ef9 100644 --- a/plugins/builtin/source/lang/en_US.cpp +++ b/plugins/builtin/source/lang/en_US.cpp @@ -8,83 +8,77 @@ namespace hex::plugin::builtin { LangEntry::setFallbackLanguage("en-US"); ContentRegistry::Language::addLocalizations("en-US", { - /* ImHex default functionality */ - { "hex.menu.feedback", "Leave Feedback" }, - { "hex.menu.debug_build", "Debug build"}, + { "hex.builtin.welcome.header.main", "Welcome to ImHex" }, + { "hex.builtin.welcome.header.start", "Start" }, + { "hex.builtin.welcome.start.create_file", "Create New File" }, + { "hex.builtin.welcome.start.open_file", "Open File" }, + { "hex.builtin.welcome.start.open_project", "Open Project" }, + { "hex.builtin.welcome.start.recent", "Recent Files" }, + { "hex.builtin.welcome.start.open_other", "Other Providers" }, + { "hex.builtin.welcome.header.help", "Help" }, + { "hex.builtin.welcome.help.repo", "GitHub Repository" }, + { "hex.builtin.welcome.help.repo.link", "https://imhex.werwolv.net/git" }, + { "hex.builtin.welcome.help.gethelp", "Get Help" }, + { "hex.builtin.welcome.help.gethelp.link", "https://github.com/WerWolv/ImHex/discussions/categories/get-help" }, + { "hex.builtin.welcome.help.discord", "Discord Server" }, + { "hex.builtin.welcome.help.discord.link", "https://imhex.werwolv.net/discord" }, + { "hex.builtin.welcome.header.plugins", "Loaded Plugins" }, + { "hex.builtin.welcome.plugins.plugin", "Plugin" }, + { "hex.builtin.welcome.plugins.author", "Author" }, + { "hex.builtin.welcome.plugins.desc", "Description" }, + { "hex.builtin.welcome.header.customize", "Customize" }, + { "hex.builtin.welcome.customize.settings.title", "Settings" }, + { "hex.builtin.welcome.customize.settings.desc", "Change preferences of ImHex" }, + { "hex.builtin.welcome.header.update", "Updates" }, + { "hex.builtin.welcome.update.title", "New Update available!" }, + { "hex.builtin.welcome.update.desc", "ImHex {0} just released! Download it here." }, + { "hex.builtin.welcome.update.link", "https://github.com/WerWolv/ImHex/releases/latest" }, + { "hex.builtin.welcome.header.learn", "Learn" }, + { "hex.builtin.welcome.learn.latest.title", "Latest Release" }, + { "hex.builtin.welcome.learn.latest.desc", "Read ImHex's current changelog" }, + { "hex.builtin.welcome.learn.latest.link", "https://github.com/WerWolv/ImHex/releases/latest" }, + { "hex.builtin.welcome.learn.pattern.title", "Pattern Language Documentation" }, + { "hex.builtin.welcome.learn.pattern.desc", "Learn how to write ImHex patterns with our extensive documentation" }, + { "hex.builtin.welcome.learn.pattern.link", "https://imhex.werwolv.net/docs/pattern_language/pattern_language.html" }, + { "hex.builtin.welcome.learn.plugins.title", "Plugins API" }, + { "hex.builtin.welcome.learn.plugins.desc", "Extend ImHex with additional features using plugins" }, + { "hex.builtin.welcome.learn.plugins.link", "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide" }, + { "hex.builtin.welcome.header.various", "Various" }, + { "hex.builtin.welcome.tip_of_the_day", "Tip of the Day" }, - { "hex.welcome.header.main", "Welcome to ImHex" }, - { "hex.welcome.header.start", "Start" }, - { "hex.welcome.start.create_file", "Create New File" }, - { "hex.welcome.start.open_file", "Open File" }, - { "hex.welcome.start.open_project", "Open Project" }, - { "hex.welcome.start.recent", "Recent Files" }, - { "hex.welcome.start.open_other", "Other Providers" }, - { "hex.welcome.header.help", "Help" }, - { "hex.welcome.help.repo", "GitHub Repository" }, - { "hex.welcome.help.repo.link", "https://imhex.werwolv.net/git" }, - { "hex.welcome.help.gethelp", "Get Help" }, - { "hex.welcome.help.gethelp.link", "https://github.com/WerWolv/ImHex/discussions/categories/get-help" }, - { "hex.welcome.help.discord", "Discord Server" }, - { "hex.welcome.help.discord.link", "https://imhex.werwolv.net/discord" }, - { "hex.welcome.header.plugins", "Loaded Plugins" }, - { "hex.welcome.plugins.plugin", "Plugin" }, - { "hex.welcome.plugins.author", "Author" }, - { "hex.welcome.plugins.desc", "Description" }, - { "hex.welcome.header.customize", "Customize" }, - { "hex.welcome.customize.settings.title", "Settings" }, - { "hex.welcome.customize.settings.desc", "Change preferences of ImHex" }, - { "hex.welcome.header.update", "Updates" }, - { "hex.welcome.update.title", "New Update available!" }, - { "hex.welcome.update.desc", "ImHex {0} just released! Download it here." }, - { "hex.welcome.update.link", "https://github.com/WerWolv/ImHex/releases/latest" }, - { "hex.welcome.header.learn", "Learn" }, - { "hex.welcome.learn.latest.title", "Latest Release" }, - { "hex.welcome.learn.latest.desc", "Read ImHex's current changelog" }, - { "hex.welcome.learn.latest.link", "https://github.com/WerWolv/ImHex/releases/latest" }, - { "hex.welcome.learn.pattern.title", "Pattern Language Documentation" }, - { "hex.welcome.learn.pattern.desc", "Learn how to write ImHex patterns with our extensive documentation" }, - { "hex.welcome.learn.pattern.link", "https://imhex.werwolv.net/docs/pattern_language/pattern_language.html" }, - { "hex.welcome.learn.plugins.title", "Plugins API" }, - { "hex.welcome.learn.plugins.desc", "Extend ImHex with additional features using plugins" }, - { "hex.welcome.learn.plugins.link", "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide" }, - { "hex.welcome.header.various", "Various" }, - { "hex.welcome.tip_of_the_day", "Tip of the Day" }, - - { "hex.safety_backup.title", "Restore lost data" }, - { "hex.safety_backup.desc", "Oh no, ImHex crashed last time.\nDo you want to restore your past work?"}, - { "hex.safety_backup.restore", "Yes, Restore" }, - { "hex.safety_backup.delete", "No, Delete" }, + { "hex.builtin.welcome.safety_backup.title", "Restore lost data" }, + { "hex.builtin.welcome.safety_backup.desc", "Oh no, ImHex crashed last time.\nDo you want to restore your past work?"}, + { "hex.builtin.welcome.safety_backup.restore", "Yes, Restore" }, + { "hex.builtin.welcome.safety_backup.delete", "No, Delete" }, - { "hex.common.little_endian", "Little Endian" }, - { "hex.common.big_endian", "Big Endian" }, - { "hex.common.decimal", "Decimal" }, - { "hex.common.hexadecimal", "Hexadecimal" }, - { "hex.common.octal", "Octal" }, - { "hex.common.info", "Information" }, - { "hex.common.error", "Error" }, - { "hex.common.fatal", "Fatal Error" }, - { "hex.common.address", "Address" }, - { "hex.common.size", "Size" }, - { "hex.common.region", "Region" }, - { "hex.common.match_selection", "Match Selection" }, - { "hex.common.yes", "Yes" }, - { "hex.common.no", "No" }, - { "hex.common.okay", "Okay" }, - { "hex.common.load", "Load" }, - { "hex.common.cancel", "Cancel" }, - { "hex.common.set", "Set" }, - { "hex.common.close", "Close" }, - { "hex.common.dont_show_again", "Don't show again" }, - { "hex.common.link", "Link" }, - { "hex.common.file", "File" }, - { "hex.common.open", "Open" }, - { "hex.common.browse", "Browse..." }, - { "hex.common.choose_file", "Choose file" }, + { "hex.builtin.common.little_endian", "Little Endian" }, + { "hex.builtin.common.big_endian", "Big Endian" }, + { "hex.builtin.common.decimal", "Decimal" }, + { "hex.builtin.common.hexadecimal", "Hexadecimal" }, + { "hex.builtin.common.octal", "Octal" }, + { "hex.builtin.common.info", "Information" }, + { "hex.builtin.common.error", "Error" }, + { "hex.builtin.common.fatal", "Fatal Error" }, + { "hex.builtin.common.address", "Address" }, + { "hex.builtin.common.size", "Size" }, + { "hex.builtin.common.region", "Region" }, + { "hex.builtin.common.match_selection", "Match Selection" }, + { "hex.builtin.common.yes", "Yes" }, + { "hex.builtin.common.no", "No" }, + { "hex.builtin.common.okay", "Okay" }, + { "hex.builtin.common.load", "Load" }, + { "hex.builtin.common.cancel", "Cancel" }, + { "hex.builtin.common.set", "Set" }, + { "hex.builtin.common.close", "Close" }, + { "hex.builtin.common.dont_show_again", "Don't show again" }, + { "hex.builtin.common.link", "Link" }, + { "hex.builtin.common.file", "File" }, + { "hex.builtin.common.open", "Open" }, + { "hex.builtin.common.browse", "Browse..." }, + { "hex.builtin.common.choose_file", "Choose file" }, - { "hex.message.file_handler_failed", "Failed to open file with registered file handler." }, - - /* Builtin plugin features */ + { "hex.builtin.message.file_handler_failed", "Failed to open file with registered file handler." }, { "hex.builtin.menu.file", "File" }, { "hex.builtin.menu.edit", "Edit" }, @@ -192,8 +186,8 @@ namespace hex::plugin::builtin { { "hex.builtin.view.hashes.function", "Hash function" }, { "hex.builtin.view.hashes.iv", "Initial value" }, { "hex.builtin.view.hashes.xorout", "Final XOR value" }, - { "hex.common.reflectIn", "Reflect input" }, - { "hex.common.reflectOut", "Reflect output" }, + { "hex.builtin.common.reflectIn", "Reflect input" }, + { "hex.builtin.common.reflectOut", "Reflect output" }, { "hex.builtin.view.hashes.poly", "Polynomial" }, { "hex.builtin.view.hashes.result", "Result" }, diff --git a/plugins/builtin/source/lang/it_IT.cpp b/plugins/builtin/source/lang/it_IT.cpp index 45d988b7a..a56fa3aa6 100644 --- a/plugins/builtin/source/lang/it_IT.cpp +++ b/plugins/builtin/source/lang/it_IT.cpp @@ -7,82 +7,76 @@ namespace hex::plugin::builtin { ContentRegistry::Language::registerLanguage("Italian", "it-IT"); ContentRegistry::Language::addLocalizations("it-IT", { - /* ImHex default functionality */ - { "hex.menu.feedback", "Lascia una Recensione" }, - { "hex.menu.debug_build", "Build di Debug"}, + { "hex.builtin.welcome.header.main", "Benvenuto in ImHex" }, + { "hex.builtin.welcome.header.start", "Inizia" }, + { "hex.builtin.welcome.start.create_file", "Crea un nuovo File" }, + { "hex.builtin.welcome.start.open_file", "Apri un File" }, + { "hex.builtin.welcome.start.open_project", "Apri un Progetto" }, + { "hex.builtin.welcome.start.recent", "File recenti" }, + //{ "hex.builtin.welcome.start.open_other", "Other Providers" }, + { "hex.builtin.welcome.header.help", "Aiuto" }, + { "hex.builtin.welcome.help.repo", "Repo GitHub" }, + { "hex.builtin.welcome.help.repo.link", "https://imhex.werwolv.net/git" }, + { "hex.builtin.welcome.help.gethelp", "Chiedi aiuto" }, + { "hex.builtin.welcome.help.gethelp.link", "https://github.com/WerWolv/ImHex/discussions/categories/get-help" }, + { "hex.builtin.welcome.help.discord", "Server Discord" }, + { "hex.builtin.welcome.help.discord.link", "https://imhex.werwolv.net/discord" }, + { "hex.builtin.welcome.header.plugins", "Plugins caricati" }, + { "hex.builtin.welcome.plugins.plugin", "Plugin" }, + { "hex.builtin.welcome.plugins.author", "Autore" }, + { "hex.builtin.welcome.plugins.desc", "Descrizione" }, + { "hex.builtin.welcome.header.customize", "Personalizza" }, + { "hex.builtin.welcome.customize.settings.title", "Impostazioni" }, + { "hex.builtin.welcome.customize.settings.desc", "Cambia le preferenze di ImHex" }, + { "hex.builtin.welcome.header.update", "Aggiornamenti" }, + { "hex.builtin.welcome.update.title", "Nuovo aggiornamento disponibile!" }, + { "hex.builtin.welcome.update.desc", "ImHex {0} è appena stato rilasciato! Scaricalo qua" }, + { "hex.builtin.welcome.update.link", "https://github.com/WerWolv/ImHex/releases/latest" }, + { "hex.builtin.welcome.header.learn", "Scopri" }, + { "hex.builtin.welcome.learn.latest.title", "Ultima Versione" }, + { "hex.builtin.welcome.learn.latest.desc", "Leggi il nuovo changelog di ImHex'" }, + { "hex.builtin.welcome.learn.latest.link", "https://github.com/WerWolv/ImHex/releases/latest" }, + { "hex.builtin.welcome.learn.pattern.title", "Documentazione dei Pattern" }, + { "hex.builtin.welcome.learn.pattern.desc", "Scopri come scrivere pattern per ImHex con la nostra dettagliata documentazione" }, + { "hex.builtin.welcome.learn.pattern.link", "https://imhex.werwolv.net/docs/pattern_language/pattern_language.html" }, + { "hex.builtin.welcome.learn.plugins.title", "Plugins API" }, + { "hex.builtin.welcome.learn.plugins.desc", "Espandi l'utilizzo di ImHex con i Plugin" }, + { "hex.builtin.welcome.learn.plugins.link", "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide" }, + { "hex.builtin.welcome.header.various", "Varie" }, + { "hex.builtin.welcome.tip_of_the_day", "Consiglio del giorno" }, - { "hex.welcome.header.main", "Benvenuto in ImHex" }, - { "hex.welcome.header.start", "Inizia" }, - { "hex.welcome.start.create_file", "Crea un nuovo File" }, - { "hex.welcome.start.open_file", "Apri un File" }, - { "hex.welcome.start.open_project", "Apri un Progetto" }, - { "hex.welcome.start.recent", "File recenti" }, - //{ "hex.welcome.start.open_other", "Other Providers" }, - { "hex.welcome.header.help", "Aiuto" }, - { "hex.welcome.help.repo", "Repo GitHub" }, - { "hex.welcome.help.repo.link", "https://imhex.werwolv.net/git" }, - { "hex.welcome.help.gethelp", "Chiedi aiuto" }, - { "hex.welcome.help.gethelp.link", "https://github.com/WerWolv/ImHex/discussions/categories/get-help" }, - { "hex.welcome.help.discord", "Server Discord" }, - { "hex.welcome.help.discord.link", "https://imhex.werwolv.net/discord" }, - { "hex.welcome.header.plugins", "Plugins caricati" }, - { "hex.welcome.plugins.plugin", "Plugin" }, - { "hex.welcome.plugins.author", "Autore" }, - { "hex.welcome.plugins.desc", "Descrizione" }, - { "hex.welcome.header.customize", "Personalizza" }, - { "hex.welcome.customize.settings.title", "Impostazioni" }, - { "hex.welcome.customize.settings.desc", "Cambia le preferenze di ImHex" }, - { "hex.welcome.header.update", "Aggiornamenti" }, - { "hex.welcome.update.title", "Nuovo aggiornamento disponibile!" }, - { "hex.welcome.update.desc", "ImHex {0} è appena stato rilasciato! Scaricalo qua" }, - { "hex.welcome.update.link", "https://github.com/WerWolv/ImHex/releases/latest" }, - { "hex.welcome.header.learn", "Scopri" }, - { "hex.welcome.learn.latest.title", "Ultima Versione" }, - { "hex.welcome.learn.latest.desc", "Leggi il nuovo changelog di ImHex'" }, - { "hex.welcome.learn.latest.link", "https://github.com/WerWolv/ImHex/releases/latest" }, - { "hex.welcome.learn.pattern.title", "Documentazione dei Pattern" }, - { "hex.welcome.learn.pattern.desc", "Scopri come scrivere pattern per ImHex con la nostra dettagliata documentazione" }, - { "hex.welcome.learn.pattern.link", "https://imhex.werwolv.net/docs/pattern_language/pattern_language.html" }, - { "hex.welcome.learn.plugins.title", "Plugins API" }, - { "hex.welcome.learn.plugins.desc", "Espandi l'utilizzo di ImHex con i Plugin" }, - { "hex.welcome.learn.plugins.link", "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide" }, - { "hex.welcome.header.various", "Varie" }, - { "hex.welcome.tip_of_the_day", "Consiglio del giorno" }, + { "hex.builtin.welcome.safety_backup.title", "Ripristina i dati persi" }, + { "hex.builtin.welcome.safety_backup.desc", "Oh no, l'ultima volta ImHex è crashato.\nVuoi ripristinare il tuo lavoro?"}, + { "hex.builtin.welcome.safety_backup.restore", "Sì, Ripristina" }, + { "hex.builtin.welcome.safety_backup.delete", "No, Elimina" }, - { "hex.safety_backup.title", "Ripristina i dati persi" }, - { "hex.safety_backup.desc", "Oh no, l'ultima volta ImHex è crashato.\nVuoi ripristinare il tuo lavoro?"}, - { "hex.safety_backup.restore", "Sì, Ripristina" }, - { "hex.safety_backup.delete", "No, Elimina" }, + { "hex.builtin.common.little_endian", "Little Endian" }, + { "hex.builtin.common.big_endian", "Big Endian" }, + { "hex.builtin.common.decimal", "Decimale" }, + { "hex.builtin.common.hexadecimal", "Esadecimale" }, + { "hex.builtin.common.octal", "Ottale" }, + { "hex.builtin.common.info", "Informazioni" }, + { "hex.builtin.common.error", "Errore" }, + { "hex.builtin.common.fatal", "Errore Fatale" }, + { "hex.builtin.common.address", "Indirizzo" }, + { "hex.builtin.common.size", "Dimensione" }, + { "hex.builtin.common.region", "Regione" }, + { "hex.builtin.common.match_selection", "Seleziona abbinamento" }, + { "hex.builtin.common.yes", "Sì" }, + { "hex.builtin.common.no", "No" }, + { "hex.builtin.common.okay", "Okay" }, + { "hex.builtin.common.load", "Carica" }, + { "hex.builtin.common.cancel", "Cancella" }, + { "hex.builtin.common.set", "Imposta" }, + { "hex.builtin.common.close", "Chiudi" }, + { "hex.builtin.common.dont_show_again", "Non mostrare di nuovo" }, + { "hex.builtin.common.link", "Link" }, + { "hex.builtin.common.file", "File" }, + { "hex.builtin.common.open", "Apri" }, + { "hex.builtin.common.browse", "Esplora..." }, + { "hex.builtin.common.choose_file", "Scegli file" }, - { "hex.common.little_endian", "Little Endian" }, - { "hex.common.big_endian", "Big Endian" }, - { "hex.common.decimal", "Decimale" }, - { "hex.common.hexadecimal", "Esadecimale" }, - { "hex.common.octal", "Ottale" }, - { "hex.common.info", "Informazioni" }, - { "hex.common.error", "Errore" }, - { "hex.common.fatal", "Errore Fatale" }, - { "hex.common.address", "Indirizzo" }, - { "hex.common.size", "Dimensione" }, - { "hex.common.region", "Regione" }, - { "hex.common.match_selection", "Seleziona abbinamento" }, - { "hex.common.yes", "Sì" }, - { "hex.common.no", "No" }, - { "hex.common.okay", "Okay" }, - { "hex.common.load", "Carica" }, - { "hex.common.cancel", "Cancella" }, - { "hex.common.set", "Imposta" }, - { "hex.common.close", "Chiudi" }, - { "hex.common.dont_show_again", "Non mostrare di nuovo" }, - { "hex.common.link", "Link" }, - { "hex.common.file", "File" }, - { "hex.common.open", "Apri" }, - { "hex.common.browse", "Esplora..." }, - { "hex.common.choose_file", "Scegli file" }, - - { "hex.message.file_handler_failed", "Impossibile aprire il file con il gestore di file registrato." }, - - /* Builtin plugin features */ + { "hex.builtin.message.file_handler_failed", "Impossibile aprire il file con il gestore di file registrato." }, { "hex.builtin.menu.file", "File" }, { "hex.builtin.menu.edit", "Modifica" }, @@ -118,7 +112,7 @@ namespace hex::plugin::builtin { { "hex.builtin.view.data_processor.menu.file.load_processor", "Caricare processore di dati..." }, { "hex.builtin.view.data_processor.menu.file.save_processor", "Salva processore di dati..." }, - { "hex.builtin.view.disassembler.name", "Disassembla" }, + { "hex.builtin.view.disassembler.name", "Disassembla" }, { "hex.builtin.view.disassembler.position", "Posiziona" }, { "hex.builtin.view.disassembler.base", "Indirizzo di base" }, { "hex.builtin.view.disassembler.region", "Regione del Codice" }, diff --git a/plugins/builtin/source/lang/zh_CN.cpp b/plugins/builtin/source/lang/zh_CN.cpp index 39de9a18e..9e8f2c34c 100644 --- a/plugins/builtin/source/lang/zh_CN.cpp +++ b/plugins/builtin/source/lang/zh_CN.cpp @@ -7,83 +7,77 @@ namespace hex::plugin::builtin { ContentRegistry::Language::registerLanguage("Chinese (Simplified)", "zh-CN"); ContentRegistry::Language::addLocalizations("zh-CN", { - /* ImHex default functionality */ - { "hex.menu.feedback", "反馈" }, - { "hex.menu.debug_build", "调试构建"}, + { "hex.builtin.welcome.header.main", "欢迎来到ImHex" }, + { "hex.builtin.welcome.header.start", "开始" }, + { "hex.builtin.welcome.start.create_file", "创建新文件" }, + { "hex.builtin.welcome.start.open_file", "打开文件" }, + { "hex.builtin.welcome.start.open_project", "打开工程" }, + { "hex.builtin.welcome.start.recent", "最近文件" }, + { "hex.builtin.welcome.start.open_other", "其他提供者" }, + { "hex.builtin.welcome.header.help", "帮助" }, + { "hex.builtin.welcome.help.repo", "GitHub仓库" }, + { "hex.builtin.welcome.help.repo.link", "https://imhex.werwolv.net/git" }, + { "hex.builtin.welcome.help.gethelp", "获得帮助" }, + { "hex.builtin.welcome.help.gethelp.link", "https://github.com/WerWolv/ImHex/discussions/categories/get-help" }, + { "hex.builtin.welcome.help.discord", "Discord服务器" }, + { "hex.builtin.welcome.help.discord.link", "https://imhex.werwolv.net/discord" }, + { "hex.builtin.welcome.header.plugins", "已加载插件" }, + { "hex.builtin.welcome.plugins.plugin", "插件" }, + { "hex.builtin.welcome.plugins.author", "作者" }, + { "hex.builtin.welcome.plugins.desc", "描述" }, + { "hex.builtin.welcome.header.customize", "自定义" }, + { "hex.builtin.welcome.customize.settings.title", "设置" }, + { "hex.builtin.welcome.customize.settings.desc", "更改ImHex的设置" }, + { "hex.builtin.welcome.header.update", "更新" }, + { "hex.builtin.welcome.update.title", "新的更新可用!" }, + { "hex.builtin.welcome.update.desc", "ImHex {0} 已发布!在这里下载。" }, + { "hex.builtin.welcome.update.link", "https://github.com/WerWolv/ImHex/releases/latest" }, + { "hex.builtin.welcome.header.learn", "学习" }, + { "hex.builtin.welcome.learn.latest.title", "最新版本" }, + { "hex.builtin.welcome.learn.latest.desc", "阅读ImHex最新版本的更改日志" }, + { "hex.builtin.welcome.learn.latest.link", "https://github.com/WerWolv/ImHex/releases/latest" }, + { "hex.builtin.welcome.learn.pattern.title", "模式文档" }, + { "hex.builtin.welcome.learn.pattern.desc", "如何基于我们完善的文档编写ImHex模式" }, + { "hex.builtin.welcome.learn.pattern.link", "https://imhex.werwolv.net/docs/pattern_language/pattern_language.html" }, + { "hex.builtin.welcome.learn.plugins.title", "插件API" }, + { "hex.builtin.welcome.learn.plugins.desc", "通过插件扩展ImHex获得更多功能" }, + { "hex.builtin.welcome.learn.plugins.link", "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide" }, + { "hex.builtin.welcome.header.various", "杂项" }, + { "hex.builtin.welcome.tip_of_the_day", "小提示" }, - { "hex.welcome.header.main", "欢迎来到ImHex" }, - { "hex.welcome.header.start", "开始" }, - { "hex.welcome.start.create_file", "创建新文件" }, - { "hex.welcome.start.open_file", "打开文件" }, - { "hex.welcome.start.open_project", "打开工程" }, - { "hex.welcome.start.recent", "最近文件" }, - { "hex.welcome.start.open_other", "其他提供者" }, - { "hex.welcome.header.help", "帮助" }, - { "hex.welcome.help.repo", "GitHub仓库" }, - { "hex.welcome.help.repo.link", "https://imhex.werwolv.net/git" }, - { "hex.welcome.help.gethelp", "获得帮助" }, - { "hex.welcome.help.gethelp.link", "https://github.com/WerWolv/ImHex/discussions/categories/get-help" }, - { "hex.welcome.help.discord", "Discord服务器" }, - { "hex.welcome.help.discord.link", "https://imhex.werwolv.net/discord" }, - { "hex.welcome.header.plugins", "已加载插件" }, - { "hex.welcome.plugins.plugin", "插件" }, - { "hex.welcome.plugins.author", "作者" }, - { "hex.welcome.plugins.desc", "描述" }, - { "hex.welcome.header.customize", "自定义" }, - { "hex.welcome.customize.settings.title", "设置" }, - { "hex.welcome.customize.settings.desc", "更改ImHex的设置" }, - { "hex.welcome.header.update", "更新" }, - { "hex.welcome.update.title", "新的更新可用!" }, - { "hex.welcome.update.desc", "ImHex {0} 已发布!在这里下载。" }, - { "hex.welcome.update.link", "https://github.com/WerWolv/ImHex/releases/latest" }, - { "hex.welcome.header.learn", "学习" }, - { "hex.welcome.learn.latest.title", "最新版本" }, - { "hex.welcome.learn.latest.desc", "阅读ImHex最新版本的更改日志" }, - { "hex.welcome.learn.latest.link", "https://github.com/WerWolv/ImHex/releases/latest" }, - { "hex.welcome.learn.pattern.title", "模式文档" }, - { "hex.welcome.learn.pattern.desc", "如何基于我们完善的文档编写ImHex模式" }, - { "hex.welcome.learn.pattern.link", "https://imhex.werwolv.net/docs/pattern_language/pattern_language.html" }, - { "hex.welcome.learn.plugins.title", "插件API" }, - { "hex.welcome.learn.plugins.desc", "通过插件扩展ImHex获得更多功能" }, - { "hex.welcome.learn.plugins.link", "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide" }, - { "hex.welcome.header.various", "杂项" }, - { "hex.welcome.tip_of_the_day", "小提示" }, - - { "hex.safety_backup.title", "恢复丢失数据" }, - { "hex.safety_backup.desc", "不!ImHex上次崩溃了\n你想恢复你之前的工作吗?"}, - { "hex.safety_backup.restore", "恢复" }, - { "hex.safety_backup.delete", "删除" }, + { "hex.builtin.welcome.safety_backup.title", "恢复丢失数据" }, + { "hex.builtin.welcome.safety_backup.desc", "不!ImHex上次崩溃了\n你想恢复你之前的工作吗?"}, + { "hex.builtin.welcome.safety_backup.restore", "恢复" }, + { "hex.builtin.welcome.safety_backup.delete", "删除" }, - { "hex.common.little_endian", "小端序" }, - { "hex.common.big_endian", "大端序" }, - { "hex.common.decimal", "十进制" }, - { "hex.common.hexadecimal", "十六进制" }, - { "hex.common.octal", "八进制" }, - { "hex.common.info", "信息" }, - { "hex.common.error", "错误" }, - { "hex.common.fatal", "致命错误" }, - { "hex.common.address", "地址" }, - { "hex.common.size", "大小" }, - { "hex.common.region", "区域" }, - { "hex.common.match_selection", "匹配选择" }, - { "hex.common.yes", "是" }, - { "hex.common.no", "否" }, - { "hex.common.okay", "好的" }, - { "hex.common.load", "加载" }, - { "hex.common.cancel", "取消" }, - { "hex.common.set", "设置" }, - { "hex.common.close", "关闭文件" }, - { "hex.common.dont_show_again", "不要再次显示" }, - { "hex.common.link", "链接" }, - { "hex.common.file", "文件" }, - { "hex.common.open", "打开" }, - { "hex.common.browse", "浏览..." }, - { "hex.common.choose_file", "选择文件" }, + { "hex.builtin.common.little_endian", "小端序" }, + { "hex.builtin.common.big_endian", "大端序" }, + { "hex.builtin.common.decimal", "十进制" }, + { "hex.builtin.common.hexadecimal", "十六进制" }, + { "hex.builtin.common.octal", "八进制" }, + { "hex.builtin.common.info", "信息" }, + { "hex.builtin.common.error", "错误" }, + { "hex.builtin.common.fatal", "致命错误" }, + { "hex.builtin.common.address", "地址" }, + { "hex.builtin.common.size", "大小" }, + { "hex.builtin.common.region", "区域" }, + { "hex.builtin.common.match_selection", "匹配选择" }, + { "hex.builtin.common.yes", "是" }, + { "hex.builtin.common.no", "否" }, + { "hex.builtin.common.okay", "好的" }, + { "hex.builtin.common.load", "加载" }, + { "hex.builtin.common.cancel", "取消" }, + { "hex.builtin.common.set", "设置" }, + { "hex.builtin.common.close", "关闭文件" }, + { "hex.builtin.common.dont_show_again", "不要再次显示" }, + { "hex.builtin.common.link", "链接" }, + { "hex.builtin.common.file", "文件" }, + { "hex.builtin.common.open", "打开" }, + { "hex.builtin.common.browse", "浏览..." }, + { "hex.builtin.common.choose_file", "选择文件" }, - { "hex.message.file_handler_failed", "通过注册的文件处理器打开文件失败。" }, - - /* Builtin plugin features */ + { "hex.builtin.message.file_handler_failed", "通过注册的文件处理器打开文件失败。" }, { "hex.builtin.menu.file", "文件" }, { "hex.builtin.menu.edit", "编辑" }, diff --git a/plugins/windows/source/content/ui_items.cpp b/plugins/windows/source/content/ui_items.cpp index 0f3b31ebb..a9cbbbe4e 100644 --- a/plugins/windows/source/content/ui_items.cpp +++ b/plugins/windows/source/content/ui_items.cpp @@ -8,7 +8,9 @@ #include #include + #include +#include namespace hex::plugin::windows { @@ -24,6 +26,29 @@ namespace hex::plugin::windows { return a.QuadPart - b.QuadPart; } + void addTitleBarButtons() { +#if defined(DEBUG) + ContentRegistry::Interface::addTitleBarButton(ICON_VS_DEBUG, "hex.windows.title_bar_button.debug_build", []{ + if (ImGui::GetIO().KeyCtrl) { + // Explicitly trigger a segfault by writing to an invalid memory location + // Used for debugging crashes + *reinterpret_cast(0x10) = 0x10; + } else if (ImGui::GetIO().KeyShift) { + // Explicitly trigger an abort by throwing an uncaught exception + // Used for debugging exception errors + throw std::runtime_error("Debug Error"); + } else { + hex::openWebpage("https://imhex.werwolv.net/debug"); + } + }); +#endif + + ContentRegistry::Interface::addTitleBarButton(ICON_VS_SMILEY, "hex.windows.title_bar_button.feedback", []{ + hex::openWebpage("mailto://hey@werwolv.net"); + }); + + } + void addFooterItems() { ContentRegistry::Interface::addFooterItem([] { diff --git a/plugins/windows/source/lang/en_US.cpp b/plugins/windows/source/lang/en_US.cpp index d88c048ea..fe7e68db1 100644 --- a/plugins/windows/source/lang/en_US.cpp +++ b/plugins/windows/source/lang/en_US.cpp @@ -5,6 +5,9 @@ namespace hex::plugin::windows { void registerLanguageEnUS() { ContentRegistry::Language::addLocalizations("en-US", { + { "hex.windows.title_bar_button.feedback", "Leave Feedback" }, + { "hex.windows.title_bar_button.debug_build", "Debug build"}, + { "hex.windows.view.tty_console.name", "TTY Console" }, { "hex.windows.view.tty_console.config", "Configuration"}, { "hex.windows.view.tty_console.port", "Port" }, diff --git a/plugins/windows/source/lang/zh_CN.cpp b/plugins/windows/source/lang/zh_CN.cpp index d690de5e1..f9b369fbb 100644 --- a/plugins/windows/source/lang/zh_CN.cpp +++ b/plugins/windows/source/lang/zh_CN.cpp @@ -5,6 +5,9 @@ namespace hex::plugin::windows { void registerLanguageZhCN() { ContentRegistry::Language::addLocalizations("zh-CN", { + { "hex.windows.title_bar_button.feedback", "反馈" }, + { "hex.windows.title_bar_button.debug_build", "调试构建"}, + { "hex.windows.view.tty_console.name", "TTY控制台" }, { "hex.windows.view.tty_console.config", "配置"}, { "hex.windows.view.tty_console.port", "端口" }, diff --git a/plugins/windows/source/plugin_windows.cpp b/plugins/windows/source/plugin_windows.cpp index 936ed62a1..4d027feca 100644 --- a/plugins/windows/source/plugin_windows.cpp +++ b/plugins/windows/source/plugin_windows.cpp @@ -10,6 +10,7 @@ namespace hex::plugin::windows { void registerLanguageZhCN(); void addFooterItems(); + void addTitleBarButtons(); void registerSettings(); } @@ -23,5 +24,6 @@ IMHEX_PLUGIN_SETUP("Windows", "WerWolv", "Windows-only features") { registerLanguageZhCN(); addFooterItems(); + addTitleBarButtons(); registerSettings(); }