2022-01-18 00:10:10 +01:00
|
|
|
#include <hex/api/content_registry.hpp>
|
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
#include <hex/ui/view.hpp>
|
2022-01-18 00:10:10 +01:00
|
|
|
|
|
|
|
namespace hex::plugin::builtin {
|
|
|
|
|
|
|
|
static void openViewAndDockTo(const std::string &unlocalizedName, ImGuiID dockId) {
|
|
|
|
auto view = ContentRegistry::Views::getViewByName(unlocalizedName);
|
|
|
|
|
|
|
|
if (view != nullptr) {
|
|
|
|
view->getWindowOpenState() = true;
|
|
|
|
ImGui::DockBuilderDockWindow(view->getName().c_str(), dockId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void registerLayouts() {
|
|
|
|
|
|
|
|
ContentRegistry::Interface::addLayout("hex.builtin.layouts.default", [](ImGuiID dockMain) {
|
2022-02-01 22:09:44 +01:00
|
|
|
ImGuiID hexEditor = ImGui::DockBuilderSplitNode(dockMain, ImGuiDir_Left, 0.7F, nullptr, &dockMain);
|
|
|
|
ImGuiID utils = ImGui::DockBuilderSplitNode(dockMain, ImGuiDir_Right, 0.8F, nullptr, &dockMain);
|
2022-01-24 20:53:17 +01:00
|
|
|
ImGuiID patternData = ImGui::DockBuilderSplitNode(hexEditor, ImGuiDir_Down, 0.3F, nullptr, &hexEditor);
|
2022-02-01 22:09:44 +01:00
|
|
|
ImGuiID inspector = ImGui::DockBuilderSplitNode(hexEditor, ImGuiDir_Right, 0.3F, nullptr, &hexEditor);
|
2022-01-18 00:10:10 +01:00
|
|
|
|
2022-02-06 21:02:31 +01:00
|
|
|
openViewAndDockTo("hex.builtin.view.hex_editor.name", hexEditor);
|
2022-01-24 20:53:17 +01:00
|
|
|
openViewAndDockTo("hex.builtin.view.data_inspector.name", inspector);
|
|
|
|
openViewAndDockTo("hex.builtin.view.pattern_data.name", patternData);
|
2022-01-18 00:10:10 +01:00
|
|
|
|
2022-01-24 20:53:17 +01:00
|
|
|
openViewAndDockTo("hex.builtin.view.pattern_editor.name", utils);
|
|
|
|
openViewAndDockTo("hex.builtin.view.hashes.name", utils);
|
2022-01-18 00:10:10 +01:00
|
|
|
openViewAndDockTo("hex.builtin.view.data_information.name", utils);
|
2022-07-29 13:59:57 +02:00
|
|
|
openViewAndDockTo("hex.builtin.view.find.name", utils);
|
2022-01-24 20:53:17 +01:00
|
|
|
openViewAndDockTo("hex.builtin.view.bookmarks.name", utils);
|
2022-01-18 00:10:10 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|