Commit b4623689 authored by Gauthier Quesnel's avatar Gauthier Quesnel
Browse files

gui: enable minimap from imnodes project

parent 78e65437
Pipeline #34623 failed with stage
in 53 seconds
......@@ -211,9 +211,8 @@ application::show_settings_window()
void
application::shutdown()
{
editor* ed = nullptr;
while (editors.next(ed))
ImNodes::EditorContextFree(ed->context);
editors.clear();
log_w.clear();
}
static void
......
......@@ -226,6 +226,7 @@ struct editor
std::filesystem::path path;
ImNodesEditorContext* context = nullptr;
bool show = true;
bool show_minimap = true;
simulation sim;
external_source srcs;
......
......@@ -102,8 +102,11 @@ editor::editor() noexcept
editor::~editor() noexcept
{
ImNodes::PopAttributeFlag();
ImNodes::EditorContextFree(context);
if (context) {
ImNodes::EditorContextSet(context);
ImNodes::PopAttributeFlag();
ImNodes::EditorContextFree(context);
}
}
void
......@@ -2628,19 +2631,23 @@ editor::show_editor() noexcept
}
if (ImGui::BeginMenu("Edition")) {
ImGui::MenuItem("Show minimap", nullptr, &show_minimap);
ImGui::MenuItem("Show parameter in models",
nullptr,
&settings.show_dynamics_inputs_in_editor);
ImGui::Separator();
if (ImGui::MenuItem("Clear"))
clear();
ImGui::Separator();
if (ImGui::MenuItem("Grid Reorder"))
compute_grid_layout();
if (ImGui::MenuItem("Automatic Layout"))
compute_automatic_layout();
if (ImGui::MenuItem("Settings"))
show_settings = true;
ImGui::Separator();
if (ImGui::MenuItem("External sources"))
show_sources = true;
if (ImGui::MenuItem("Settings"))
show_settings = true;
ImGui::EndMenu();
}
......@@ -2853,6 +2860,9 @@ editor::show_editor() noexcept
show_top();
show_connections();
if (show_minimap)
ImNodes::MiniMap(0.2f, ImNodesMiniMapLocation_BottomLeft);
ImNodes::EndNodeEditor();
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(8.f, 8.f));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment