ui: Open all views and create default layout on first launch
This commit is contained in:
parent
5532a0673f
commit
0a29f25330
@ -34,6 +34,7 @@ namespace hex {
|
|||||||
void frameEnd();
|
void frameEnd();
|
||||||
|
|
||||||
void drawWelcomeScreen();
|
void drawWelcomeScreen();
|
||||||
|
void resetLayout();
|
||||||
|
|
||||||
void initGLFW();
|
void initGLFW();
|
||||||
void initImGui();
|
void initImGui();
|
||||||
@ -45,6 +46,7 @@ namespace hex {
|
|||||||
float m_globalScale = 1.0f, m_fontScale = 1.0f;
|
float m_globalScale = 1.0f, m_fontScale = 1.0f;
|
||||||
bool m_fpsVisible = false;
|
bool m_fpsVisible = false;
|
||||||
bool m_demoWindowOpen = false;
|
bool m_demoWindowOpen = false;
|
||||||
|
bool m_layoutConfigured = false;
|
||||||
|
|
||||||
static inline std::tuple<int, int> s_currShortcut = { -1, -1 };
|
static inline std::tuple<int, int> s_currShortcut = { -1, -1 };
|
||||||
|
|
||||||
|
@ -120,8 +120,8 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.view.hashes.poly", "Polynomial" },
|
{ "hex.view.hashes.poly", "Polynomial" },
|
||||||
{ "hex.view.hashes.result", "Result" },
|
{ "hex.view.hashes.result", "Result" },
|
||||||
|
|
||||||
{ "hex.view.help.title", "Help" },
|
{ "hex.view.help.name", "Help" },
|
||||||
{ "hex.view.help.about.title", "About" },
|
{ "hex.view.help.about.name", "About" },
|
||||||
{ "hex.view.help.about.translator", "Translated by WerWolv" },
|
{ "hex.view.help.about.translator", "Translated by WerWolv" },
|
||||||
{ "hex.view.help.about.source", "Source code available on GitHub:" },
|
{ "hex.view.help.about.source", "Source code available on GitHub:" },
|
||||||
{ "hex.view.help.about.donations", "Donations" },
|
{ "hex.view.help.about.donations", "Donations" },
|
||||||
@ -130,7 +130,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.view.help.pattern_cheat_sheet", "Pattern Language Cheat Sheet"},
|
{ "hex.view.help.pattern_cheat_sheet", "Pattern Language Cheat Sheet"},
|
||||||
{ "hex.view.help.calc_cheat_sheet", "Calculator Cheat Sheet" },
|
{ "hex.view.help.calc_cheat_sheet", "Calculator Cheat Sheet" },
|
||||||
|
|
||||||
{ "hex.view.hexeditor.title", "Hex editor" },
|
{ "hex.view.hexeditor.name", "Hex editor" },
|
||||||
{ "hex.view.hexeditor.save_changes", "Save Changes" },
|
{ "hex.view.hexeditor.save_changes", "Save Changes" },
|
||||||
{ "hex.view.hexeditor.open_file", "Open File" },
|
{ "hex.view.hexeditor.open_file", "Open File" },
|
||||||
{ "hex.view.hexeditor.open_project", "Open Project" },
|
{ "hex.view.hexeditor.open_project", "Open Project" },
|
||||||
@ -194,7 +194,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.view.hexeditor.menu.edit.bookmark", "Create bookmark" },
|
{ "hex.view.hexeditor.menu.edit.bookmark", "Create bookmark" },
|
||||||
{ "hex.view.hexeditor.menu.edit.set_base", "Set base address" },
|
{ "hex.view.hexeditor.menu.edit.set_base", "Set base address" },
|
||||||
|
|
||||||
{ "hex.view.information.title", "Data Information" },
|
{ "hex.view.information.name", "Data Information" },
|
||||||
{ "hex.view.information.analyze", "Analyze current page" },
|
{ "hex.view.information.analyze", "Analyze current page" },
|
||||||
{ "hex.view.information.region", "analyzed region" },
|
{ "hex.view.information.region", "analyzed region" },
|
||||||
{ "hex.view.information.description", "Description:" },
|
{ "hex.view.information.description", "Description:" },
|
||||||
@ -207,13 +207,13 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.view.information.highest_entropy", "Highest entropy block" },
|
{ "hex.view.information.highest_entropy", "Highest entropy block" },
|
||||||
{ "hex.view.information.encrypted", "This data is most likely encrypted or compressed!" },
|
{ "hex.view.information.encrypted", "This data is most likely encrypted or compressed!" },
|
||||||
|
|
||||||
{ "hex.view.patches.title", "Patches" },
|
{ "hex.view.patches.name", "Patches" },
|
||||||
{ "hex.view.patches.offset", "Offset" },
|
{ "hex.view.patches.offset", "Offset" },
|
||||||
{ "hex.view.patches.orig", "Original value" },
|
{ "hex.view.patches.orig", "Original value" },
|
||||||
{ "hex.view.patches.patch", "Patched value"},
|
{ "hex.view.patches.patch", "Patched value"},
|
||||||
{ "hex.view.patches.remove", "Remove patch" },
|
{ "hex.view.patches.remove", "Remove patch" },
|
||||||
|
|
||||||
{ "hex.view.pattern.title", "Pattern editor" },
|
{ "hex.view.pattern.name", "Pattern editor" },
|
||||||
{ "hex.view.pattern.accept_pattern", "Accept pattern" },
|
{ "hex.view.pattern.accept_pattern", "Accept pattern" },
|
||||||
{ "hex.view.pattern.accept_pattern.desc", "One or more patterns compatible with this data type has been found" },
|
{ "hex.view.pattern.accept_pattern.desc", "One or more patterns compatible with this data type has been found" },
|
||||||
{ "hex.view.pattern.accept_pattern.patterns", "Patterns" },
|
{ "hex.view.pattern.accept_pattern.patterns", "Patterns" },
|
||||||
@ -223,7 +223,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.view.pattern.compiling", "[%c] Compiling..." },
|
{ "hex.view.pattern.compiling", "[%c] Compiling..." },
|
||||||
{ "hex.view.pattern.auto", "Auto compile" },
|
{ "hex.view.pattern.auto", "Auto compile" },
|
||||||
|
|
||||||
{ "hex.view.pattern_data.title", "Pattern Data" },
|
{ "hex.view.pattern_data.name", "Pattern Data" },
|
||||||
{ "hex.view.pattern_data.name", "Name" },
|
{ "hex.view.pattern_data.name", "Name" },
|
||||||
{ "hex.view.pattern_data.color", "Color" },
|
{ "hex.view.pattern_data.color", "Color" },
|
||||||
{ "hex.view.pattern_data.offset", "Offset" },
|
{ "hex.view.pattern_data.offset", "Offset" },
|
||||||
@ -231,9 +231,9 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.view.pattern_data.type", "Type" },
|
{ "hex.view.pattern_data.type", "Type" },
|
||||||
{ "hex.view.pattern_data.value", "Value" },
|
{ "hex.view.pattern_data.value", "Value" },
|
||||||
|
|
||||||
{ "hex.view.settings.title", "Settings" },
|
{ "hex.view.settings.name", "Settings" },
|
||||||
|
|
||||||
{ "hex.view.strings.title", "Strings" },
|
{ "hex.view.strings.name", "Strings" },
|
||||||
{ "hex.view.strings.copy", "Copy string" },
|
{ "hex.view.strings.copy", "Copy string" },
|
||||||
{ "hex.view.strings.demangle", "Demangle" },
|
{ "hex.view.strings.demangle", "Demangle" },
|
||||||
{ "hex.view.strings.min_length", "Minimum length" },
|
{ "hex.view.strings.min_length", "Minimum length" },
|
||||||
@ -245,7 +245,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.view.strings.demangle.title", "Demangled name" },
|
{ "hex.view.strings.demangle.title", "Demangled name" },
|
||||||
{ "hex.view.strings.demangle.copy", "Copy" },
|
{ "hex.view.strings.demangle.copy", "Copy" },
|
||||||
|
|
||||||
{ "hex.view.tools.title", "Tools" },
|
{ "hex.view.tools.name", "Tools" },
|
||||||
|
|
||||||
/* Builtin plugin features */
|
/* Builtin plugin features */
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ namespace hex {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_viewName;
|
std::string m_viewName;
|
||||||
bool m_windowOpen = false;
|
bool m_windowOpen = this->hasViewMenuItemEntry();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace hex {
|
namespace hex {
|
||||||
|
|
||||||
ViewHelp::ViewHelp() : View("hex.view.help.about.title"_lang) {
|
ViewHelp::ViewHelp() : View("hex.view.help.about.name"_lang) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewHelp::~ViewHelp() {
|
ViewHelp::~ViewHelp() {
|
||||||
@ -29,7 +29,7 @@ namespace hex {
|
|||||||
|
|
||||||
|
|
||||||
void ViewHelp::drawAboutPopup() {
|
void ViewHelp::drawAboutPopup() {
|
||||||
if (ImGui::BeginPopupModal("hex.view.help.about.title"_lang, &this->m_aboutWindowOpen, ImGuiWindowFlags_AlwaysAutoResize)) {
|
if (ImGui::BeginPopupModal("hex.view.help.about.name"_lang, &this->m_aboutWindowOpen, ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
ImGui::Text("ImHex Hex Editor v%s by WerWolv -", IMHEX_VERSION);
|
ImGui::Text("ImHex Hex Editor v%s by WerWolv -", IMHEX_VERSION);
|
||||||
#if defined(GIT_BRANCH) && defined(GIT_COMMIT_HASH)
|
#if defined(GIT_BRANCH) && defined(GIT_COMMIT_HASH)
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -313,8 +313,8 @@ namespace hex {
|
|||||||
|
|
||||||
void ViewHelp::drawMenu() {
|
void ViewHelp::drawMenu() {
|
||||||
if (ImGui::BeginMenu("hex.menu.help"_lang)) {
|
if (ImGui::BeginMenu("hex.menu.help"_lang)) {
|
||||||
if (ImGui::MenuItem("hex.view.help.about.title"_lang, "")) {
|
if (ImGui::MenuItem("hex.view.help.about.name"_lang, "")) {
|
||||||
View::doLater([] { ImGui::OpenPopup("hex.view.help.about.title"_lang); });
|
View::doLater([] { ImGui::OpenPopup("hex.view.help.about.name"_lang); });
|
||||||
this->m_aboutWindowOpen = true;
|
this->m_aboutWindowOpen = true;
|
||||||
this->getWindowOpenState() = true;
|
this->getWindowOpenState() = true;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
namespace hex {
|
namespace hex {
|
||||||
|
|
||||||
ViewHexEditor::ViewHexEditor(std::vector<lang::PatternData*> &patternData)
|
ViewHexEditor::ViewHexEditor(std::vector<lang::PatternData*> &patternData)
|
||||||
: View("hex.view.hexeditor.title"_lang), m_patternData(patternData) {
|
: View("hex.view.hexeditor.name"_lang), m_patternData(patternData) {
|
||||||
|
|
||||||
this->m_searchStringBuffer.resize(0xFFF, 0x00);
|
this->m_searchStringBuffer.resize(0xFFF, 0x00);
|
||||||
this->m_searchHexBuffer.resize(0xFFF, 0x00);
|
this->m_searchHexBuffer.resize(0xFFF, 0x00);
|
||||||
@ -197,10 +197,10 @@ namespace hex {
|
|||||||
|
|
||||||
size_t dataSize = (provider == nullptr || !provider->isReadable()) ? 0x00 : provider->getSize();
|
size_t dataSize = (provider == nullptr || !provider->isReadable()) ? 0x00 : provider->getSize();
|
||||||
|
|
||||||
this->m_memoryEditor.DrawWindow("hex.view.hexeditor.title"_lang, &this->getWindowOpenState(), this, dataSize, dataSize == 0 ? 0x00 : provider->getBaseAddress());
|
this->m_memoryEditor.DrawWindow("hex.view.hexeditor.name"_lang, &this->getWindowOpenState(), this, dataSize, dataSize == 0 ? 0x00 : provider->getBaseAddress());
|
||||||
|
|
||||||
if (dataSize != 0x00) {
|
if (dataSize != 0x00) {
|
||||||
if (ImGui::Begin("hex.view.hexeditor.title"_lang)) {
|
if (ImGui::Begin("hex.view.hexeditor.name"_lang)) {
|
||||||
|
|
||||||
if (ImGui::IsMouseReleased(ImGuiMouseButton_Right) && ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows))
|
if (ImGui::IsMouseReleased(ImGuiMouseButton_Right) && ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows))
|
||||||
ImGui::OpenPopup("hex.menu.edit"_lang);
|
ImGui::OpenPopup("hex.menu.edit"_lang);
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
namespace hex {
|
namespace hex {
|
||||||
|
|
||||||
ViewInformation::ViewInformation() : View("hex.view.information.title"_lang) {
|
ViewInformation::ViewInformation() : View("hex.view.information.name"_lang) {
|
||||||
View::subscribeEvent(Events::DataChanged, [this](auto) {
|
View::subscribeEvent(Events::DataChanged, [this](auto) {
|
||||||
this->m_dataValid = false;
|
this->m_dataValid = false;
|
||||||
this->m_highestBlockEntropy = 0;
|
this->m_highestBlockEntropy = 0;
|
||||||
@ -45,7 +45,7 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewInformation::drawContent() {
|
void ViewInformation::drawContent() {
|
||||||
if (ImGui::Begin("hex.view.information.title"_lang, &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
if (ImGui::Begin("hex.view.information.name"_lang, &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
||||||
ImGui::BeginChild("##scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoNav);
|
ImGui::BeginChild("##scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoNav);
|
||||||
|
|
||||||
auto provider = SharedData::currentProvider;
|
auto provider = SharedData::currentProvider;
|
||||||
|
@ -11,7 +11,7 @@ using namespace std::literals::string_literals;
|
|||||||
|
|
||||||
namespace hex {
|
namespace hex {
|
||||||
|
|
||||||
ViewPatches::ViewPatches() : View("hex.view.patches.title"_lang) {
|
ViewPatches::ViewPatches() : View("hex.view.patches.name"_lang) {
|
||||||
View::subscribeEvent(Events::ProjectFileStore, [](auto) {
|
View::subscribeEvent(Events::ProjectFileStore, [](auto) {
|
||||||
auto provider = SharedData::currentProvider;
|
auto provider = SharedData::currentProvider;
|
||||||
if (provider != nullptr)
|
if (provider != nullptr)
|
||||||
@ -31,7 +31,7 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewPatches::drawContent() {
|
void ViewPatches::drawContent() {
|
||||||
if (ImGui::Begin("hex.view.patches.title"_lang, &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
if (ImGui::Begin("hex.view.patches.name"_lang, &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
||||||
auto provider = SharedData::currentProvider;
|
auto provider = SharedData::currentProvider;
|
||||||
|
|
||||||
if (provider != nullptr && provider->isReadable()) {
|
if (provider != nullptr && provider->isReadable()) {
|
||||||
|
@ -76,7 +76,7 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ViewPattern::ViewPattern(std::vector<lang::PatternData*> &patternData) : View("hex.view.pattern.title"_lang), m_patternData(patternData) {
|
ViewPattern::ViewPattern(std::vector<lang::PatternData*> &patternData) : View("hex.view.pattern.name"_lang), m_patternData(patternData) {
|
||||||
this->m_patternLanguageRuntime = new lang::PatternLanguage();
|
this->m_patternLanguageRuntime = new lang::PatternLanguage();
|
||||||
|
|
||||||
this->m_textEditor.SetLanguageDefinition(PatternLanguage());
|
this->m_textEditor.SetLanguageDefinition(PatternLanguage());
|
||||||
@ -215,14 +215,14 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewPattern::drawContent() {
|
void ViewPattern::drawContent() {
|
||||||
if (ImGui::Begin("hex.view.pattern.title"_lang, &this->getWindowOpenState(), ImGuiWindowFlags_None | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) {
|
if (ImGui::Begin("hex.view.pattern.name"_lang, &this->getWindowOpenState(), ImGuiWindowFlags_None | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) {
|
||||||
auto provider = SharedData::currentProvider;
|
auto provider = SharedData::currentProvider;
|
||||||
|
|
||||||
if (provider != nullptr && provider->isAvailable()) {
|
if (provider != nullptr && provider->isAvailable()) {
|
||||||
auto textEditorSize = ImGui::GetContentRegionAvail();
|
auto textEditorSize = ImGui::GetContentRegionAvail();
|
||||||
textEditorSize.y *= 4.0/5.0;
|
textEditorSize.y *= 4.0/5.0;
|
||||||
textEditorSize.y -= ImGui::GetTextLineHeightWithSpacing();
|
textEditorSize.y -= ImGui::GetTextLineHeightWithSpacing();
|
||||||
this->m_textEditor.Render("hex.view.pattern.title"_lang, textEditorSize, true);
|
this->m_textEditor.Render("hex.view.pattern.name"_lang, textEditorSize, true);
|
||||||
|
|
||||||
auto consoleSize = ImGui::GetContentRegionAvail();
|
auto consoleSize = ImGui::GetContentRegionAvail();
|
||||||
consoleSize.y -= ImGui::GetTextLineHeightWithSpacing();
|
consoleSize.y -= ImGui::GetTextLineHeightWithSpacing();
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
namespace hex {
|
namespace hex {
|
||||||
|
|
||||||
ViewPatternData::ViewPatternData(std::vector<lang::PatternData*> &patternData)
|
ViewPatternData::ViewPatternData(std::vector<lang::PatternData*> &patternData)
|
||||||
: View("hex.view.pattern_data.title"_lang), m_patternData(patternData) {
|
: View("hex.view.pattern_data.name"_lang), m_patternData(patternData) {
|
||||||
|
|
||||||
this->subscribeEvent(Events::PatternChanged, [this](auto data) {
|
this->subscribeEvent(Events::PatternChanged, [this](auto data) {
|
||||||
this->m_sortedPatternData.clear();
|
this->m_sortedPatternData.clear();
|
||||||
@ -49,7 +49,7 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewPatternData::drawContent() {
|
void ViewPatternData::drawContent() {
|
||||||
if (ImGui::Begin("hex.view.pattern_data.title"_lang, &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
if (ImGui::Begin("hex.view.pattern_data.name"_lang, &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
||||||
auto provider = SharedData::currentProvider;
|
auto provider = SharedData::currentProvider;
|
||||||
if (provider != nullptr && provider->isReadable()) {
|
if (provider != nullptr && provider->isReadable()) {
|
||||||
|
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
|
|
||||||
namespace hex {
|
namespace hex {
|
||||||
|
|
||||||
ViewSettings::ViewSettings() : View("hex.view.settings.title"_lang) {
|
ViewSettings::ViewSettings() : View("hex.view.settings.name"_lang) {
|
||||||
View::subscribeEvent(Events::OpenWindow, [this](auto name) {
|
View::subscribeEvent(Events::OpenWindow, [this](auto name) {
|
||||||
if (std::any_cast<const char*>(name) == std::string("hex.view.settings.title")) {
|
if (std::any_cast<const char*>(name) == std::string("hex.view.settings.name")) {
|
||||||
View::doLater([]{ ImGui::OpenPopup("hex.view.settings.title"_lang); });
|
View::doLater([]{ ImGui::OpenPopup("hex.view.settings.name"_lang); });
|
||||||
this->getWindowOpenState() = true;
|
this->getWindowOpenState() = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -21,7 +21,7 @@ namespace hex {
|
|||||||
|
|
||||||
ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX));
|
ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX));
|
||||||
|
|
||||||
if (ImGui::BeginPopupModal("hex.view.settings.title"_lang, &this->getWindowOpenState(), ImGuiWindowFlags_AlwaysAutoResize)) {
|
if (ImGui::BeginPopupModal("hex.view.settings.name"_lang, &this->getWindowOpenState(), ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
for (auto &[category, entries] : ContentRegistry::Settings::getEntries()) {
|
for (auto &[category, entries] : ContentRegistry::Settings::getEntries()) {
|
||||||
ImGui::TextUnformatted(LangEntry(category));
|
ImGui::TextUnformatted(LangEntry(category));
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
@ -39,8 +39,8 @@ namespace hex {
|
|||||||
|
|
||||||
void ViewSettings::drawMenu() {
|
void ViewSettings::drawMenu() {
|
||||||
if (ImGui::BeginMenu("hex.menu.help"_lang)) {
|
if (ImGui::BeginMenu("hex.menu.help"_lang)) {
|
||||||
if (ImGui::MenuItem("hex.view.settings.title"_lang)) {
|
if (ImGui::MenuItem("hex.view.settings.name"_lang)) {
|
||||||
View::doLater([]{ ImGui::OpenPopup("hex.view.settings.title"_lang); });
|
View::doLater([]{ ImGui::OpenPopup("hex.view.settings.name"_lang); });
|
||||||
this->getWindowOpenState() = true;
|
this->getWindowOpenState() = true;
|
||||||
}
|
}
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
|
@ -11,7 +11,7 @@ using namespace std::literals::string_literals;
|
|||||||
|
|
||||||
namespace hex {
|
namespace hex {
|
||||||
|
|
||||||
ViewStrings::ViewStrings() : View("hex.view.strings.title"_lang) {
|
ViewStrings::ViewStrings() : View("hex.view.strings.name"_lang) {
|
||||||
View::subscribeEvent(Events::DataChanged, [this](auto){
|
View::subscribeEvent(Events::DataChanged, [this](auto){
|
||||||
this->m_foundStrings.clear();
|
this->m_foundStrings.clear();
|
||||||
});
|
});
|
||||||
@ -37,7 +37,7 @@ namespace hex {
|
|||||||
if (ImGui::MenuItem("hex.view.strings.demangle"_lang)) {
|
if (ImGui::MenuItem("hex.view.strings.demangle"_lang)) {
|
||||||
this->m_demangledName = llvm::demangle(this->m_selectedString);
|
this->m_demangledName = llvm::demangle(this->m_selectedString);
|
||||||
if (!this->m_demangledName.empty())
|
if (!this->m_demangledName.empty())
|
||||||
View::doLater([]{ ImGui::OpenPopup("hex.view.strings.demangle.title"_lang); });
|
View::doLater([]{ ImGui::OpenPopup("hex.view.strings.demangle.name"_lang); });
|
||||||
}
|
}
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
namespace hex {
|
namespace hex {
|
||||||
|
|
||||||
ViewTools::ViewTools() : View("hex.view.tools.title"_lang) { }
|
ViewTools::ViewTools() : View("hex.view.tools.name"_lang) { }
|
||||||
|
|
||||||
ViewTools::~ViewTools() { }
|
ViewTools::~ViewTools() { }
|
||||||
|
|
||||||
void ViewTools::drawContent() {
|
void ViewTools::drawContent() {
|
||||||
if (ImGui::Begin("hex.view.tools.title"_lang, &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
if (ImGui::Begin("hex.view.tools.name"_lang, &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
||||||
for (const auto& [name, function] : ContentRegistry::Tools::getEntries()) {
|
for (const auto& [name, function] : ContentRegistry::Tools::getEntries()) {
|
||||||
if (ImGui::CollapsingHeader(LangEntry(name))) {
|
if (ImGui::CollapsingHeader(LangEntry(name))) {
|
||||||
function();
|
function();
|
||||||
|
@ -305,11 +305,7 @@ namespace hex {
|
|||||||
Window::s_currShortcut = { -1, -1 };
|
Window::s_currShortcut = { -1, -1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
bool anyViewOpen = false;
|
if (SharedData::currentProvider == nullptr) {
|
||||||
for (auto &view : ContentRegistry::Views::getEntries())
|
|
||||||
anyViewOpen = anyViewOpen || (view->getWindowOpenState() && view->isAvailable());
|
|
||||||
|
|
||||||
if (!anyViewOpen && SharedData::currentProvider == nullptr) {
|
|
||||||
char title[256];
|
char title[256];
|
||||||
ImFormatString(title, IM_ARRAYSIZE(title), "%s/DockSpace_%08X", ImGui::GetCurrentWindow()->Name, ImGui::GetID("MainDock"));
|
ImFormatString(title, IM_ARRAYSIZE(title), "%s/DockSpace_%08X", ImGui::GetCurrentWindow()->Name, ImGui::GetID("MainDock"));
|
||||||
if (ImGui::Begin(title)) {
|
if (ImGui::Begin(title)) {
|
||||||
@ -321,6 +317,12 @@ namespace hex {
|
|||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
} else if (!this->m_layoutConfigured) {
|
||||||
|
this->m_layoutConfigured = true;
|
||||||
|
if (ContentRegistry::Settings::read("hex.builtin.setting.imhex", "hex.builtin.setting.imhex.launched", 0) == 0) {
|
||||||
|
ContentRegistry::Settings::write("hex.builtin.setting.imhex", "hex.builtin.setting.imhex.launched", 1);
|
||||||
|
this->resetLayout();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -429,7 +431,6 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -469,6 +470,29 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Window::resetLayout() {
|
||||||
|
auto dockId = ImGui::GetID("MainDock");
|
||||||
|
|
||||||
|
ImGui::DockBuilderRemoveNode(dockId);
|
||||||
|
ImGui::DockBuilderAddNode(dockId, ImGuiDockNodeFlags_DockSpace);
|
||||||
|
ImGui::DockBuilderSetNodeSize(dockId, ImGui::GetWindowSize());
|
||||||
|
|
||||||
|
ImGuiID mainWindowId, splitWindowId, hexEditorId, utilitiesId, inspectorId, patternDataId;
|
||||||
|
|
||||||
|
ImGui::DockBuilderSplitNode(dockId, ImGuiDir_Left, 0.8, &mainWindowId, &utilitiesId);
|
||||||
|
ImGui::DockBuilderSplitNode(mainWindowId, ImGuiDir_Down, 0.3, &patternDataId, &splitWindowId);
|
||||||
|
ImGui::DockBuilderSplitNode(splitWindowId, ImGuiDir_Right, 0.3, &inspectorId, &hexEditorId);
|
||||||
|
|
||||||
|
for (auto &view : ContentRegistry::Views::getEntries())
|
||||||
|
|
||||||
|
ImGui::DockBuilderDockWindow(view->getName().data(), utilitiesId);
|
||||||
|
ImGui::DockBuilderDockWindow("hex.view.hexeditor.name"_lang, hexEditorId);
|
||||||
|
ImGui::DockBuilderDockWindow("hex.view.data_inspector.name"_lang, inspectorId);
|
||||||
|
ImGui::DockBuilderDockWindow("hex.view.pattern_data.name"_lang, patternDataId);
|
||||||
|
|
||||||
|
ImGui::DockBuilderFinish(dockId);
|
||||||
|
}
|
||||||
|
|
||||||
void Window::initGLFW() {
|
void Window::initGLFW() {
|
||||||
glfwSetErrorCallback([](int error, const char* desc) {
|
glfwSetErrorCallback([](int error, const char* desc) {
|
||||||
fprintf(stderr, "Glfw Error %d: %s\n", error, desc);
|
fprintf(stderr, "Glfw Error %d: %s\n", error, desc);
|
||||||
|
Loading…
Reference in New Issue
Block a user