improve menus

This commit is contained in:
Green Sky 2024-09-22 12:35:19 +02:00
parent 557a642ad3
commit 86ce199ac8
No known key found for this signature in database
6 changed files with 25 additions and 20 deletions

View File

@ -109,8 +109,8 @@ void SettingsWindow::render(void) {
if (ImGui::BeginMenuBar()) {
ImGui::Separator();
if (ImGui::BeginMenu("Settings")) {
if (ImGui::MenuItem("settings window")) {
_show_window = true;
if (ImGui::MenuItem("settings window", nullptr, _show_window)) {
_show_window = !_show_window;
}
ImGui::EndMenu();
}

View File

@ -284,20 +284,24 @@ Screen* MainScreen::render(float time_delta, bool&) {
if (ImGui::BeginMenu("Settings")) {
ImGui::SeparatorText("ImGui");
if (ImGui::MenuItem("Style Editor")) {
_show_tool_style_editor = true;
if (ImGui::MenuItem("Style Editor", nullptr, _show_tool_style_editor)) {
_show_tool_style_editor = !_show_tool_style_editor;
}
if (ImGui::MenuItem("Metrics")) {
_show_tool_metrics = true;
if (ImGui::MenuItem("Metrics", nullptr, _show_tool_metrics)) {
_show_tool_metrics = !_show_tool_metrics;
}
if (ImGui::MenuItem("Debug Log")) {
_show_tool_debug_log = true;
if (ImGui::MenuItem("Debug Log", nullptr, _show_tool_debug_log)) {
_show_tool_debug_log = !_show_tool_debug_log;
}
if (ImGui::MenuItem("ID Stack Tool")) {
_show_tool_id_stack = true;
if (ImGui::MenuItem("ID Stack Tool", nullptr, _show_tool_id_stack)) {
_show_tool_id_stack = !_show_tool_id_stack;
}
if (ImGui::MenuItem("Demo", nullptr, _show_tool_demo)) {
_show_tool_demo = !_show_tool_demo;
}
ImGui::EndMenu();
@ -328,8 +332,8 @@ Screen* MainScreen::render(float time_delta, bool&) {
ImGui::ShowIDStackToolWindow(&_show_tool_id_stack);
}
if constexpr (false) {
ImGui::ShowDemoWindow();
if (_show_tool_demo) {
ImGui::ShowDemoWindow(&_show_tool_demo);
}
float tc_unfinished_queue_interval;

View File

@ -95,6 +95,7 @@ struct MainScreen final : public Screen {
bool _show_tool_metrics {false};
bool _show_tool_debug_log {false};
bool _show_tool_id_stack {false};
bool _show_tool_demo {false};
bool _window_hidden {false};
uint64_t _window_hidden_ts {0};

View File

@ -118,8 +118,8 @@ void ObjectStoreUI::render(void) {
if (ImGui::BeginMenuBar()) {
ImGui::Separator();
if (ImGui::BeginMenu("ObjectStore")) {
if (ImGui::MenuItem("Inspector")) {
_ee.show_window = true;
if (ImGui::MenuItem("Inspector", nullptr, _ee.show_window)) {
_ee.show_window = !_ee.show_window;
}
ImGui::EndMenu();
}

View File

@ -38,8 +38,8 @@ void ToxDHTCapHisto::render(void) {
ImGui::Checkbox("enabled", &_enabled);
if (ImGui::MenuItem("show DHT announce capability histogram")) {
_show_window = true;
if (ImGui::MenuItem("announce capability histogram", nullptr, _show_window)) {
_show_window = !_show_window;
}
ImGui::EndMenu();

View File

@ -26,14 +26,14 @@ void ToxUIUtils::render(void) {
if (ImGui::BeginMenu("Tox")) {
ImGui::SeparatorText("Friends/Groups");
if (ImGui::MenuItem("add Friend by ID")) {
_show_add_friend_window = true;
if (ImGui::MenuItem("add Friend by ID", nullptr, _show_add_friend_window)) {
_show_add_friend_window = !_show_add_friend_window;
}
if (ImGui::MenuItem("copy own ToxID")) {
ImGui::SetClipboardText(_tc.toxSelfGetAddressStr().c_str());
}
if (ImGui::MenuItem("join Group by ID (ngc)")) {
_show_add_group_window = true;
if (ImGui::MenuItem("join Group by ID (ngc)", nullptr, _show_add_group_window)) {
_show_add_group_window = !_show_add_group_window;
}
ImGui::SeparatorText("DHT");