11#include "imgui/imgui.h"
12#include "imgui/imgui_internal.h"
26 LOG_WARN(
"EditorActivator",
"Not initialized, cannot switch editor");
31 ImGuiContext* imgui_ctx = ImGui::GetCurrentContext();
32 const bool frame_active = imgui_ctx !=
nullptr && imgui_ctx->WithinFrameScope;
51 for (
auto* editor : editor_set->active_editors_) {
52 if (editor->type() == editor_type) {
54 editor->set_active(
true);
56 editor->toggle_active();
60 if (*editor->active()) {
81 if (old_category != new_category) {
90 ImGuiID dockspace_id = ImGui::GetID(
"MainDockSpace");
91 deps_.layout_manager->InitializeEditorLayout(type, dockspace_id);
108 if (old_category != new_category) {
128 if (force_visible) is_visible =
true;
137 ImGuiContext* ctx = ImGui::GetCurrentContext();
139 ImGuiID dockspace_id = ImGui::GetID(
"MainDockSpace");
143 LOG_INFO(
"EditorActivator",
"Initialized emulator layout");
180 ImGuiContext* ctx = ImGui::GetCurrentContext();
181 if (!ctx || !ctx->WithinFrameScope) {
191 ImGuiID dockspace_id = ImGui::GetID(
"MainDockSpace");
193 LOG_INFO(
"EditorActivator",
"Initialized layout for editor type %d",
194 static_cast<int>(type));
200 if (!editor_set)
return;
206 editor_set->GetDungeonEditor()->add_room(room_id);
211 if (!editor_set)
return;
217 editor_set->GetOverworldEditor()->set_current_map(map_id);
void HandleNonEditorClassSwitch(EditorType type, bool force_visible)
void ActivatePanelBasedEditor(EditorType type, Editor *editor)
void SwitchToEditor(EditorType type, bool force_visible=false, bool from_dialog=false)
Switch to an editor, optionally forcing visibility.
void Initialize(const Dependencies &deps)
void InitializeEditorLayout(EditorType type)
Initialize the DockBuilder layout for an editor.
void JumpToDungeonRoom(int room_id)
Jump to a specific dungeon room.
void JumpToOverworldMap(int map_id)
Jump to a specific overworld map.
void DeactivatePanelBasedEditor(EditorType type, Editor *editor, EditorSet *editor_set)
static bool IsPanelBasedEditor(EditorType type)
static std::string GetEditorCategory(EditorType type)
Contains a complete set of editors for a single ROM instance.
std::vector< Editor * > active_editors_
Interface for editor classes.
bool IsLayoutInitialized(EditorType type) const
Check if a layout has been initialized for an editor.
void InitializeEditorLayout(EditorType type, ImGuiID dockspace_id)
Initialize the default layout for a specific editor type.
void OnEditorSwitch(const std::string &from_category, const std::string &to_category)
Handle editor/category switching for panel visibility.
bool ShowPanel(size_t session_id, const std::string &base_card_id)
std::string GetActiveCategory() const
void SetActiveCategory(const std::string &category)
void ClosePanel()
Close the currently active panel.
PanelType GetActivePanel() const
Get the currently active panel type.
void OpenPanel(PanelType type)
Open a specific panel.
bool IsEmulatorVisible() const
bool IsAsmEditorVisible() const
void SetEmulatorVisible(bool visible)
void SetAsmEditorVisible(bool visible)
void SetEditorSelectionVisible(bool visible)
#define LOG_WARN(category, format,...)
#define LOG_INFO(category, format,...)
LayoutManager * layout_manager
PanelManager * panel_manager
std::function< EditorSet *()> get_current_editor_set
std::function< void(std::function< void()>)> queue_deferred_action
RightPanelManager * right_panel_manager
UICoordinator * ui_coordinator
std::function< size_t()> get_current_session_id