From 0a8219a412d74fbca682d63055b042982888cb14 Mon Sep 17 00:00:00 2001 From: scawful Date: Sun, 14 Jul 2024 09:52:08 -0400 Subject: [PATCH] cleanup anon namespace master editor --- src/app/editor/graphics_editor.h | 2 +- src/app/editor/master_editor.cc | 46 +++++++++++++++----------------- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/src/app/editor/graphics_editor.h b/src/app/editor/graphics_editor.h index 805d8c64..d4824ac7 100644 --- a/src/app/editor/graphics_editor.h +++ b/src/app/editor/graphics_editor.h @@ -78,7 +78,7 @@ class GraphicsEditor : public SharedRom, public Editor { public: GraphicsEditor() { type_ = EditorType::kGraphics; } - absl::Status Update(); + absl::Status Update() override; absl::Status Cut() override { return absl::OkStatus(); } absl::Status Copy() override { return absl::OkStatus(); } diff --git a/src/app/editor/master_editor.cc b/src/app/editor/master_editor.cc index 3857af41..e1539ba3 100644 --- a/src/app/editor/master_editor.cc +++ b/src/app/editor/master_editor.cc @@ -116,6 +116,27 @@ class RecentFilesManager { std::vector recentFiles_; }; +// Function to switch the active tab in a tab bar +void SetTabBarTab(ImGuiTabBar* tab_bar, ImGuiID tab_id) { + if (tab_bar == NULL) return; + + // Find the tab item with the specified tab_id + ImGuiTabItem* tab_item = &tab_bar->Tabs[tab_id]; + tab_item->LastFrameVisible = -1; + tab_item->LastFrameSelected = -1; + tab_bar->VisibleTabId = tab_id; + tab_bar->VisibleTabWasSubmitted = true; + tab_bar->SelectedTabId = tab_id; + tab_bar->NextSelectedTabId = tab_id; + tab_bar->ReorderRequestTabId = tab_id; + tab_bar->CurrFrameVisible = -1; +} + +bool IsEditorActive(Editor* editor, std::vector& active_editors) { + return std::find(active_editors.begin(), active_editors.end(), editor) != + active_editors.end(); +} + } // namespace using ImGui::BeginMenu; @@ -133,24 +154,6 @@ void MasterEditor::SetupScreen(std::shared_ptr renderer, overworld_editor_.InitializeZeml(); } -namespace { -// Function to switch the active tab in a tab bar -void SetTabBarTab(ImGuiTabBar* tab_bar, ImGuiID tab_id) { - if (tab_bar == NULL) return; - - // Find the tab item with the specified tab_id - ImGuiTabItem* tab_item = &tab_bar->Tabs[tab_id]; - tab_item->LastFrameVisible = -1; - tab_item->LastFrameSelected = -1; - tab_bar->VisibleTabId = tab_id; - tab_bar->VisibleTabWasSubmitted = true; - tab_bar->SelectedTabId = tab_id; - tab_bar->NextSelectedTabId = tab_id; - tab_bar->ReorderRequestTabId = tab_id; - tab_bar->CurrFrameVisible = -1; -} -} // namespace - absl::Status MasterEditor::Update() { NewMasterFrame(); @@ -177,13 +180,6 @@ absl::Status MasterEditor::Update() { return absl::OkStatus(); } -namespace { -bool IsEditorActive(Editor* editor, std::vector& active_editors) { - return std::find(active_editors.begin(), active_editors.end(), editor) != - active_editors.end(); -} -} // namespace - void MasterEditor::ManageActiveEditors() { // Show popup pane to select an editor to add static bool show_add_editor = false;