-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split ims_gui.cpp into 5; Context menu for bufferwindow
- Loading branch information
Showing
9 changed files
with
1,149 additions
and
1,104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
#include "ims_gui.h" | ||
|
||
void ImStudio::GUI::ShowMenubar() | ||
{ | ||
ImGui::SetNextWindowPos(mb_P); | ||
ImGui::SetNextWindowSize(mb_S); | ||
ImGui::Begin("Menubar", NULL, | ||
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | | ||
ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse); | ||
|
||
// MENU | ||
if (ImGui::BeginMenuBar()) | ||
{ | ||
/// menu-file | ||
if (ImGui::BeginMenu("File")) | ||
{ | ||
#ifndef __EMSCRIPTEN__ | ||
if (ImGui::MenuItem("Export to clipboard")) | ||
{ | ||
ImGui::LogToClipboard(); | ||
ImGui::LogText("%s", output.c_str()); | ||
ImGui::LogFinish(); | ||
}; | ||
#endif | ||
|
||
if (ImGui::MenuItem("Exit")) | ||
{ | ||
state = false; | ||
}; | ||
ImGui::EndMenu(); | ||
} | ||
|
||
/// menu-edit | ||
if (ImGui::BeginMenu("Edit")) | ||
{ | ||
if (ImGui::BeginMenu("Layout")) | ||
{ | ||
ImGui::MenuItem("Compact", NULL, &compact); | ||
ImGui::EndMenu(); | ||
} | ||
if (ImGui::BeginMenu("Behavior")) | ||
{ | ||
ImGui::MenuItem("Static Mode", NULL, &bw.staticlayout); | ||
ImGui::SameLine(); | ||
utils::HelpMarker("Toggle between static/linear layout and fixed/manual layout"); | ||
|
||
ImGui::EndMenu(); | ||
} | ||
if (ImGui::MenuItem("Reset")) | ||
{ | ||
bw.objects.clear(); | ||
bw.selected_obj_id = -1; | ||
bw.open_child_id = -1; | ||
bw.open_child = false; | ||
bw.idgen = 0; | ||
} | ||
|
||
ImGui::EndMenu(); | ||
} | ||
|
||
/// menu-tools | ||
if (ImGui::BeginMenu("Tools")) | ||
{ | ||
ImGui::MenuItem("Style Editor", NULL, &child_style); | ||
ImGui::MenuItem("Demo Window", NULL, &child_demo); | ||
ImGui::MenuItem("Metrics", NULL, &child_metrics); | ||
ImGui::MenuItem("Stack Tool", NULL, &child_stack); | ||
ImGui::MenuItem("Color Export", NULL, &child_color); | ||
ImGui::EndMenu(); | ||
} | ||
|
||
if (ImGui::BeginMenu("Help")) | ||
{ | ||
if (ImGui::MenuItem("Resources")) child_resources = true; | ||
if (ImGui::MenuItem("About ImStudio")) child_about = true; | ||
ImGui::EndMenu(); | ||
} | ||
|
||
ImGui::EndMenuBar(); | ||
} | ||
|
||
// TAB | ||
if (!compact) | ||
{ | ||
if (ImGui::BeginTabBar("##Tabs", ImGuiTabBarFlags_None)) | ||
{ | ||
// tab-create | ||
if (ImGui::BeginTabItem("Create")) | ||
{ | ||
wksp_output = false; | ||
wksp_create = true; | ||
ImGui::EndTabItem(); | ||
} | ||
|
||
// tab-output | ||
if (ImGui::BeginTabItem("Output")) | ||
{ | ||
wksp_create = false; | ||
wksp_output = true; | ||
ImGui::EndTabItem(); | ||
} | ||
|
||
ImGui::EndTabBar(); | ||
} | ||
} | ||
|
||
|
||
ImGui::End(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "ims_gui.h" | ||
|
||
void ImStudio::GUI::ShowOutputWorkspace() | ||
{ | ||
ImGui::SetNextWindowPos(ot_P); | ||
ImGui::SetNextWindowSizeConstraints(ImVec2(0, -1), ImVec2(FLT_MAX, -1)); | ||
ImGui::SetNextWindowSize(ot_S); | ||
ImGui::Begin("wksp_output", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar); | ||
{ | ||
#ifdef __EMSCRIPTEN__ | ||
if(ImGui::Button("Copy")){ | ||
ImGui::LogToClipboard(); | ||
ImGui::LogText(output.c_str()); | ||
ImGui::LogFinish(); | ||
}; | ||
JsClipboard_SetClipboardText(ImGui::GetClipboardText()); | ||
#endif | ||
ImStudio::GenerateCode(&output, &bw); | ||
} | ||
ImGui::End(); | ||
} |
Oops, something went wrong.