From 1f61d3bd2738a90f22936603e85690fe9af76669 Mon Sep 17 00:00:00 2001 From: scawful Date: Fri, 19 Jul 2024 16:41:08 -0400 Subject: [PATCH] housekeeping --- src/app/core/constants.h | 7 ---- src/app/editor/code/assembly_editor.cc | 13 ++++---- src/app/editor/context/gfx_context.h | 3 -- src/app/editor/graphics/tile16_editor.h | 4 --- src/app/editor/master_editor.cc | 43 +++++++++++++------------ 5 files changed, 29 insertions(+), 41 deletions(-) diff --git a/src/app/core/constants.h b/src/app/core/constants.h index 99cf7485..3a34f3c2 100644 --- a/src/app/core/constants.h +++ b/src/app/core/constants.h @@ -5,8 +5,6 @@ #include "absl/strings/string_view.h" -#define BASIC_BUTTON(w) if (ImGui::Button(w)) - #define TAB_BAR(w) if (ImGui::BeginTabBar(w)) { #define END_TAB_BAR() \ ImGui::EndTabBar(); \ @@ -17,11 +15,6 @@ ImGui::EndTabItem(); \ } -#define MENU_BAR() if (ImGui::BeginMenuBar()) { -#define END_MENU_BAR() \ - ImGui::EndMenuBar(); \ - } - #define MENU_ITEM(w) if (ImGui::MenuItem(w)) #define MENU_ITEM2(w, v) if (ImGui::MenuItem(w, v)) diff --git a/src/app/editor/code/assembly_editor.cc b/src/app/editor/code/assembly_editor.cc index add02801..8f50f925 100644 --- a/src/app/editor/code/assembly_editor.cc +++ b/src/app/editor/code/assembly_editor.cc @@ -3,9 +3,9 @@ #include #include "app/core/platform/file_dialog.h" -#include "app/gui/widgets.h" -#include "app/gui/input.h" #include "app/gui/icons.h" +#include "app/gui/input.h" +#include "app/gui/widgets.h" #include "core/constants.h" namespace yaze { @@ -101,10 +101,11 @@ void AssemblyEditor::OpenFolder(const std::string& folder_path) { void AssemblyEditor::Update(bool& is_loaded) { ImGui::Begin("Assembly Editor", &is_loaded); - MENU_BAR() - DrawFileMenu(); - DrawEditMenu(); - END_MENU_BAR() + if (ImGui::BeginMenuBar()) { + DrawFileMenu(); + DrawEditMenu(); + ImGui::EndMenuBar(); + } auto cpos = text_editor_.GetCursorPosition(); SetEditorText(); diff --git a/src/app/editor/context/gfx_context.h b/src/app/editor/context/gfx_context.h index b8372ccf..74dff9c1 100644 --- a/src/app/editor/context/gfx_context.h +++ b/src/app/editor/context/gfx_context.h @@ -24,9 +24,6 @@ namespace context { * @brief Shared graphical context across editors. */ class GfxContext { - public: - absl::Status Update(); - protected: // Palettesets for the tile16 individual tiles static std::unordered_map palettesets_; diff --git a/src/app/editor/graphics/tile16_editor.h b/src/app/editor/graphics/tile16_editor.h index 5bc7adb4..0a21cd74 100644 --- a/src/app/editor/graphics/tile16_editor.h +++ b/src/app/editor/graphics/tile16_editor.h @@ -79,10 +79,6 @@ class Tile16Editor : public context::GfxContext, public SharedRom { core::NotifyValue notify_tile16; core::NotifyValue notify_palette; - // Canvas dimensions - int canvas_width; - int canvas_height; - // Texture ID for the canvas int texture_id; diff --git a/src/app/editor/master_editor.cc b/src/app/editor/master_editor.cc index 3c6ff136..675e2d93 100644 --- a/src/app/editor/master_editor.cc +++ b/src/app/editor/master_editor.cc @@ -356,30 +356,31 @@ void MasterEditor::DrawYazeMenu() { static bool show_display_settings = false; static bool show_command_line_interface = false; - MENU_BAR() - DrawFileMenu(); - DrawEditMenu(); - DrawViewMenu(); - DrawProjectMenu(); - DrawHelpMenu(); + if (ImGui::BeginMenuBar()) { + DrawFileMenu(); + DrawEditMenu(); + DrawViewMenu(); + DrawProjectMenu(); + DrawHelpMenu(); - SameLine(ImGui::GetWindowWidth() - ImGui::GetStyle().ItemSpacing.x - - ImGui::CalcTextSize(ICON_MD_DISPLAY_SETTINGS).x - 150); - // Modify the style of the button to have no background color - ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); - if (ImGui::Button(ICON_MD_DISPLAY_SETTINGS)) { - show_display_settings = !show_display_settings; + SameLine(ImGui::GetWindowWidth() - ImGui::GetStyle().ItemSpacing.x - + ImGui::CalcTextSize(ICON_MD_DISPLAY_SETTINGS).x - 150); + // Modify the style of the button to have no background color + ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); + if (ImGui::Button(ICON_MD_DISPLAY_SETTINGS)) { + show_display_settings = !show_display_settings; + } + + if (ImGui::Button(ICON_MD_TERMINAL)) { + show_command_line_interface = !show_command_line_interface; + } + ImGui::PopStyleColor(); + + Text("%s", absl::StrCat("yaze v", core::kYazeVersion).c_str()); + + ImGui::EndMenuBar(); } - if (ImGui::Button(ICON_MD_TERMINAL)) { - show_command_line_interface = !show_command_line_interface; - } - ImGui::PopStyleColor(); - - Text("%s", absl::StrCat("yaze v", core::kYazeVersion).c_str()); - - END_MENU_BAR() - if (show_display_settings) { ImGui::Begin("Display Settings", &show_display_settings, ImGuiWindowFlags_None);