yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::DungeonWorkbenchPanel Class Reference

#include <dungeon_workbench_panel.h>

Inheritance diagram for yaze::editor::DungeonWorkbenchPanel:
Collaboration diagram for yaze::editor::DungeonWorkbenchPanel:

Public Member Functions

 DungeonWorkbenchPanel (DungeonRoomSelector *room_selector, int *current_room_id, std::function< void(int)> on_room_selected, std::function< void(int, RoomSelectionIntent)> on_room_selected_with_intent, std::function< void(int)> on_save_room, std::function< DungeonCanvasViewer *()> get_viewer, std::function< DungeonCanvasViewer *()> get_compare_viewer, std::function< const std::deque< int > &()> get_recent_rooms, std::function< void(int)> forget_recent_room, std::function< void(const std::string &)> show_panel, std::function< void(bool)> set_workflow_mode, Rom *rom=nullptr)
 
std::string GetId () const override
 Unique identifier for this panel.
 
std::string GetDisplayName () const override
 Human-readable name shown in menus and title bars.
 
std::string GetIcon () const override
 Material Design icon for this panel.
 
std::string GetEditorCategory () const override
 Editor category this panel belongs to.
 
int GetPriority () const override
 Get display priority for menu ordering.
 
void SetRom (Rom *rom)
 
void NotifyRoomChanged (int previous_room_id)
 Called by the editor when the current room changes.
 
void SetUndoRedoProvider (std::function< bool()> can_undo, std::function< bool()> can_redo, std::function< void()> on_undo, std::function< void()> on_redo, std::function< std::string()> undo_desc, std::function< std::string()> redo_desc, std::function< int()> undo_depth)
 
void SetToolModeProvider (std::function< const char *()> provider)
 
void Draw (bool *p_open) override
 Draw the panel content.
 
- Public Member Functions inherited from yaze::editor::EditorPanel
virtual ~EditorPanel ()=default
 
virtual void OnFirstDraw ()
 Called once before the first Draw() in a session.
 
virtual bool RequiresLazyInit () const
 Whether this panel uses lazy initialization.
 
void InvalidateLazyInit ()
 Reset lazy init state so OnFirstDraw() runs again.
 
virtual void OnOpen ()
 Called when panel becomes visible.
 
virtual void OnClose ()
 Called when panel is hidden.
 
virtual void OnFocus ()
 Called when panel receives focus.
 
virtual PanelCategory GetPanelCategory () const
 Get the lifecycle category for this panel.
 
virtual PanelContextScope GetContextScope () const
 Optional context binding for this panel (room/selection/etc)
 
virtual PanelScope GetScope () const
 Get the registration scope for this panel.
 
virtual bool IsEnabled () const
 Check if this panel is currently enabled.
 
virtual std::string GetDisabledTooltip () const
 Get tooltip text when panel is disabled.
 
virtual std::string GetShortcutHint () const
 Get keyboard shortcut hint for display.
 
virtual float GetPreferredWidth () const
 Get preferred width for this panel (optional)
 
virtual bool IsVisibleByDefault () const
 Whether this panel should be visible by default.
 
virtual std::string GetParentPanelId () const
 Get parent panel ID for cascade behavior.
 
virtual bool CascadeCloseChildren () const
 Whether closing this panel should close child panels.
 
void DrawWithLazyInit (bool *p_open)
 Execute lazy initialization if needed, then call Draw()
 

Private Member Functions

void DrawRecentRoomTabs ()
 
void DrawSplitView (DungeonCanvasViewer &primary_viewer)
 
void DrawInspector (DungeonCanvasViewer &viewer)
 
void DrawInspectorShelf (DungeonCanvasViewer &viewer)
 
void DrawInspectorShelfRoom (DungeonCanvasViewer &viewer)
 
void DrawInspectorShelfSelection (DungeonCanvasViewer &viewer)
 
void DrawInspectorShelfView (DungeonCanvasViewer &viewer)
 
void DrawInspectorShelfTools (DungeonCanvasViewer &viewer)
 
void BuildRoomDungeonCache ()
 

Private Attributes

DungeonRoomSelectorroom_selector_ = nullptr
 
int * current_room_id_ = nullptr
 
int previous_room_id_ = -1
 
bool split_view_enabled_ = false
 
int compare_room_id_ = -1
 
DungeonWorkbenchLayoutState layout_state_ {}
 
std::function< void(int)> on_room_selected_
 
std::function< void(int, RoomSelectionIntent)> on_room_selected_with_intent_
 
std::function< void(int)> on_save_room_
 
std::function< DungeonCanvasViewer *()> get_viewer_
 
std::function< DungeonCanvasViewer *()> get_compare_viewer_
 
std::function< const std::deque< int > &()> get_recent_rooms_
 
std::function< void(int)> forget_recent_room_
 
std::function< void(const std::string &) show_panel_ )
 
std::function< void(bool)> set_workflow_mode_
 
Romrom_ = nullptr
 
char compare_search_buf_ [64] = {}
 
bool prev_show_left_ = true
 
bool prev_show_right_ = true
 
int table_generation_ = 0
 
std::unordered_map< int, std::string > room_dungeon_cache_
 
bool room_dungeon_cache_built_ = false
 
std::function< bool()> can_undo_
 
std::function< bool()> can_redo_
 
std::function< void()> on_undo_
 
std::function< void()> on_redo_
 
std::function< std::string()> undo_desc_
 
std::function< std::string()> redo_desc_
 
std::function< int()> undo_depth_
 
std::function< const char *()> get_tool_mode_
 
bool show_shortcut_legend_ = false
 

Additional Inherited Members

- Protected Member Functions inherited from yaze::editor::EditorPanel
void InvalidateCache ()
 Invalidate all cached computations.
 
template<typename T >
T & GetCached (const std::string &key, std::function< T()> compute)
 Get or compute a cached value.
 
bool IsCacheValid () const
 Check if cache has been invalidated.
 
void ClearCache ()
 Clear all cached values (more aggressive than InvalidateCache)
 

Detailed Description

Definition at line 23 of file dungeon_workbench_panel.h.

Constructor & Destructor Documentation

◆ DungeonWorkbenchPanel()

yaze::editor::DungeonWorkbenchPanel::DungeonWorkbenchPanel ( DungeonRoomSelector * room_selector,
int * current_room_id,
std::function< void(int)> on_room_selected,
std::function< void(int, RoomSelectionIntent)> on_room_selected_with_intent,
std::function< void(int)> on_save_room,
std::function< DungeonCanvasViewer *()> get_viewer,
std::function< DungeonCanvasViewer *()> get_compare_viewer,
std::function< const std::deque< int > &()> get_recent_rooms,
std::function< void(int)> forget_recent_room,
std::function< void(const std::string &)> show_panel,
std::function< void(bool)> set_workflow_mode,
Rom * rom = nullptr )

Definition at line 86 of file dungeon_workbench_panel.cc.

Member Function Documentation

◆ GetId()

std::string yaze::editor::DungeonWorkbenchPanel::GetId ( ) const
overridevirtual

Unique identifier for this panel.

Returns
Panel ID in format "{category}.{name}" (e.g., "dungeon.room_selector")

IDs should be:

  • Lowercase with underscores
  • Prefixed with editor category
  • Unique across all panels

Implements yaze::editor::EditorPanel.

Definition at line 110 of file dungeon_workbench_panel.cc.

◆ GetDisplayName()

std::string yaze::editor::DungeonWorkbenchPanel::GetDisplayName ( ) const
overridevirtual

Human-readable name shown in menus and title bars.

Returns
Display name (e.g., "Room Selector")

Implements yaze::editor::EditorPanel.

Definition at line 113 of file dungeon_workbench_panel.cc.

◆ GetIcon()

std::string yaze::editor::DungeonWorkbenchPanel::GetIcon ( ) const
overridevirtual

Material Design icon for this panel.

Returns
Icon constant (e.g., ICON_MD_LIST)

Implements yaze::editor::EditorPanel.

Definition at line 116 of file dungeon_workbench_panel.cc.

References ICON_MD_WORKSPACES.

◆ GetEditorCategory()

std::string yaze::editor::DungeonWorkbenchPanel::GetEditorCategory ( ) const
overridevirtual

Editor category this panel belongs to.

Returns
Category name matching EditorType (e.g., "Dungeon", "Overworld")

Implements yaze::editor::EditorPanel.

Definition at line 119 of file dungeon_workbench_panel.cc.

◆ GetPriority()

int yaze::editor::DungeonWorkbenchPanel::GetPriority ( ) const
overridevirtual

Get display priority for menu ordering.

Returns
Priority value (lower = higher in list, default 50)

Reimplemented from yaze::editor::EditorPanel.

Definition at line 122 of file dungeon_workbench_panel.cc.

◆ SetRom()

void yaze::editor::DungeonWorkbenchPanel::SetRom ( Rom * rom)

Definition at line 126 of file dungeon_workbench_panel.cc.

References rom_, room_dungeon_cache_, and room_dungeon_cache_built_.

◆ NotifyRoomChanged()

void yaze::editor::DungeonWorkbenchPanel::NotifyRoomChanged ( int previous_room_id)
inline

Called by the editor when the current room changes.

Definition at line 47 of file dungeon_workbench_panel.h.

References previous_room_id_.

Referenced by yaze::editor::DungeonEditorV2::OnRoomSelected().

◆ SetUndoRedoProvider()

void yaze::editor::DungeonWorkbenchPanel::SetUndoRedoProvider ( std::function< bool()> can_undo,
std::function< bool()> can_redo,
std::function< void()> on_undo,
std::function< void()> on_redo,
std::function< std::string()> undo_desc,
std::function< std::string()> redo_desc,
std::function< int()> undo_depth )
inline

◆ SetToolModeProvider()

void yaze::editor::DungeonWorkbenchPanel::SetToolModeProvider ( std::function< const char *()> provider)
inline

Definition at line 69 of file dungeon_workbench_panel.h.

References get_tool_mode_.

◆ Draw()

void yaze::editor::DungeonWorkbenchPanel::Draw ( bool * p_open)
overridevirtual

Draw the panel content.

Parameters
p_openPointer to visibility flag (nullptr if not closable)

Called by PanelManager when the panel is visible. Do NOT call ImGui::Begin/End - the PanelWindow wrapper handles that. Just draw your content directly.

Implements yaze::editor::EditorPanel.

Definition at line 132 of file dungeon_workbench_panel.cc.

References yaze::gui::LayoutHelpers::BeginContentChild(), yaze::editor::DungeonStatusBar::BuildState(), can_redo_, can_undo_, yaze::editor::DungeonWorkbenchToolbarParams::compare_room_id, compare_room_id_, yaze::editor::DungeonWorkbenchToolbarParams::compare_search_buf, compare_search_buf_, yaze::editor::DungeonWorkbenchToolbarParams::compare_search_buf_size, yaze::editor::DungeonWorkbenchToolbarParams::compare_viewer, yaze::editor::DungeonWorkbenchToolbarParams::current_room_id, current_room_id_, yaze::editor::DungeonStatusBar::Draw(), yaze::editor::DungeonWorkbenchToolbar::Draw(), yaze::editor::DungeonCanvasViewer::DrawDungeonCanvas(), DrawInspector(), DrawRecentRoomTabs(), yaze::editor::DungeonRoomSelector::DrawRoomSelector(), DrawSplitView(), yaze::gui::LayoutHelpers::EndContentChild(), get_compare_viewer_, yaze::editor::DungeonWorkbenchToolbarParams::get_recent_rooms, get_recent_rooms_, get_tool_mode_, get_viewer_, yaze::gui::LayoutHelpers::GetMinTouchTarget(), yaze::editor::AgentUI::GetTheme(), yaze::gui::LayoutHelpers::GetTouchSafeWidgetHeight(), ICON_MD_CHEVRON_LEFT, ICON_MD_CHEVRON_RIGHT, ICON_MD_INFO, ICON_MD_LIST, ICON_MD_TUNE, yaze::Rom::is_loaded(), yaze::gui::UIConfig::kContentMinHeightCanvas, yaze::gui::UIConfig::kContentMinWidthSidebar, yaze::editor::DungeonWorkbenchToolbarParams::layout, layout_state_, yaze::editor::DungeonWorkbenchLayoutState::left_width, on_redo_, yaze::editor::DungeonWorkbenchToolbarParams::on_room_selected, on_room_selected_, on_undo_, prev_show_left_, prev_show_right_, yaze::editor::DungeonWorkbenchToolbarParams::previous_room_id, previous_room_id_, yaze::editor::DungeonWorkbenchToolbarParams::primary_viewer, redo_desc_, yaze::editor::DungeonWorkbenchLayoutState::right_width, rom_, room_selector_, yaze::editor::DungeonWorkbenchToolbarParams::set_workflow_mode, set_workflow_mode_, yaze::editor::DungeonWorkbenchLayoutState::show_left_sidebar, yaze::editor::DungeonWorkbenchLayoutState::show_right_inspector, yaze::editor::DungeonWorkbenchToolbarParams::split_view_enabled, split_view_enabled_, table_generation_, undo_depth_, and undo_desc_.

◆ DrawRecentRoomTabs()

◆ DrawSplitView()

◆ DrawInspector()

void yaze::editor::DungeonWorkbenchPanel::DrawInspector ( DungeonCanvasViewer & viewer)
private

Definition at line 579 of file dungeon_workbench_panel.cc.

References DrawInspectorShelf().

Referenced by Draw().

Here is the call graph for this function:

◆ DrawInspectorShelf()

◆ DrawInspectorShelfRoom()

◆ DrawInspectorShelfSelection()

◆ DrawInspectorShelfView()

void yaze::editor::DungeonWorkbenchPanel::DrawInspectorShelfView ( DungeonCanvasViewer & viewer)
private

Definition at line 1077 of file dungeon_workbench_panel.cc.

References yaze::editor::DungeonCanvasViewer::set_show_camera_quadrant_overlay(), yaze::editor::DungeonCanvasViewer::set_show_coordinate_overlay(), yaze::editor::DungeonCanvasViewer::set_show_custom_collision_overlay(), yaze::editor::DungeonCanvasViewer::set_show_custom_objects_overlay(), yaze::editor::DungeonCanvasViewer::set_show_grid(), yaze::editor::DungeonCanvasViewer::set_show_minecart_sprite_overlay(), yaze::editor::DungeonCanvasViewer::set_show_object_bounds(), yaze::editor::DungeonCanvasViewer::set_show_track_collision_overlay(), yaze::editor::DungeonCanvasViewer::set_show_track_gap_overlay(), yaze::editor::DungeonCanvasViewer::set_show_track_route_overlay(), yaze::editor::DungeonCanvasViewer::set_show_water_fill_overlay(), yaze::editor::DungeonCanvasViewer::show_camera_quadrant_overlay(), yaze::editor::DungeonCanvasViewer::show_coordinate_overlay(), yaze::editor::DungeonCanvasViewer::show_custom_collision_overlay(), yaze::editor::DungeonCanvasViewer::show_custom_objects_overlay(), yaze::editor::DungeonCanvasViewer::show_grid(), yaze::editor::DungeonCanvasViewer::show_minecart_sprite_overlay(), yaze::editor::DungeonCanvasViewer::show_object_bounds(), yaze::editor::DungeonCanvasViewer::show_track_collision_overlay(), yaze::editor::DungeonCanvasViewer::show_track_gap_overlay(), yaze::editor::DungeonCanvasViewer::show_track_route_overlay(), and yaze::editor::DungeonCanvasViewer::show_water_fill_overlay().

Referenced by DrawInspectorShelf().

◆ DrawInspectorShelfTools()

void yaze::editor::DungeonWorkbenchPanel::DrawInspectorShelfTools ( DungeonCanvasViewer & viewer)
private

◆ BuildRoomDungeonCache()

void yaze::editor::DungeonWorkbenchPanel::BuildRoomDungeonCache ( )
private

Member Data Documentation

◆ room_selector_

DungeonRoomSelector* yaze::editor::DungeonWorkbenchPanel::room_selector_ = nullptr
private

Definition at line 89 of file dungeon_workbench_panel.h.

Referenced by Draw().

◆ current_room_id_

int* yaze::editor::DungeonWorkbenchPanel::current_room_id_ = nullptr
private

◆ previous_room_id_

int yaze::editor::DungeonWorkbenchPanel::previous_room_id_ = -1
private

Definition at line 93 of file dungeon_workbench_panel.h.

Referenced by Draw(), and NotifyRoomChanged().

◆ split_view_enabled_

bool yaze::editor::DungeonWorkbenchPanel::split_view_enabled_ = false
private

Definition at line 94 of file dungeon_workbench_panel.h.

Referenced by Draw(), DrawRecentRoomTabs(), and DrawSplitView().

◆ compare_room_id_

int yaze::editor::DungeonWorkbenchPanel::compare_room_id_ = -1
private

Definition at line 95 of file dungeon_workbench_panel.h.

Referenced by Draw(), DrawRecentRoomTabs(), and DrawSplitView().

◆ layout_state_

DungeonWorkbenchLayoutState yaze::editor::DungeonWorkbenchPanel::layout_state_ {}
private

Definition at line 96 of file dungeon_workbench_panel.h.

Referenced by Draw(), and DrawSplitView().

◆ on_room_selected_

std::function<void(int)> yaze::editor::DungeonWorkbenchPanel::on_room_selected_
private

Definition at line 97 of file dungeon_workbench_panel.h.

Referenced by Draw(), DrawInspectorShelfRoom(), and DrawRecentRoomTabs().

◆ on_room_selected_with_intent_

std::function<void(int, RoomSelectionIntent)> yaze::editor::DungeonWorkbenchPanel::on_room_selected_with_intent_
private

Definition at line 98 of file dungeon_workbench_panel.h.

Referenced by DrawRecentRoomTabs().

◆ on_save_room_

std::function<void(int)> yaze::editor::DungeonWorkbenchPanel::on_save_room_
private

Definition at line 99 of file dungeon_workbench_panel.h.

Referenced by DrawInspectorShelfRoom().

◆ get_viewer_

std::function<DungeonCanvasViewer*()> yaze::editor::DungeonWorkbenchPanel::get_viewer_
private

Definition at line 100 of file dungeon_workbench_panel.h.

Referenced by Draw().

◆ get_compare_viewer_

std::function<DungeonCanvasViewer*()> yaze::editor::DungeonWorkbenchPanel::get_compare_viewer_
private

Definition at line 101 of file dungeon_workbench_panel.h.

Referenced by Draw(), and DrawSplitView().

◆ get_recent_rooms_

std::function<const std::deque<int>&()> yaze::editor::DungeonWorkbenchPanel::get_recent_rooms_
private

◆ forget_recent_room_

std::function<void(int)> yaze::editor::DungeonWorkbenchPanel::forget_recent_room_
private

Definition at line 103 of file dungeon_workbench_panel.h.

Referenced by DrawRecentRoomTabs().

◆ show_panel_

std::function<void(const std::string&) yaze::editor::DungeonWorkbenchPanel::show_panel_)
private

Definition at line 104 of file dungeon_workbench_panel.h.

Referenced by DrawInspectorShelfRoom(), and DrawInspectorShelfTools().

◆ set_workflow_mode_

std::function<void(bool)> yaze::editor::DungeonWorkbenchPanel::set_workflow_mode_
private

Definition at line 105 of file dungeon_workbench_panel.h.

Referenced by Draw().

◆ rom_

Rom* yaze::editor::DungeonWorkbenchPanel::rom_ = nullptr
private

◆ compare_search_buf_

char yaze::editor::DungeonWorkbenchPanel::compare_search_buf_[64] = {}
private

Definition at line 108 of file dungeon_workbench_panel.h.

Referenced by Draw().

◆ prev_show_left_

bool yaze::editor::DungeonWorkbenchPanel::prev_show_left_ = true
private

Definition at line 111 of file dungeon_workbench_panel.h.

Referenced by Draw().

◆ prev_show_right_

bool yaze::editor::DungeonWorkbenchPanel::prev_show_right_ = true
private

Definition at line 112 of file dungeon_workbench_panel.h.

Referenced by Draw().

◆ table_generation_

int yaze::editor::DungeonWorkbenchPanel::table_generation_ = 0
private

Definition at line 113 of file dungeon_workbench_panel.h.

Referenced by Draw().

◆ room_dungeon_cache_

std::unordered_map<int, std::string> yaze::editor::DungeonWorkbenchPanel::room_dungeon_cache_
private

◆ room_dungeon_cache_built_

bool yaze::editor::DungeonWorkbenchPanel::room_dungeon_cache_built_ = false
private

◆ can_undo_

std::function<bool()> yaze::editor::DungeonWorkbenchPanel::can_undo_
private

Definition at line 120 of file dungeon_workbench_panel.h.

Referenced by Draw(), and SetUndoRedoProvider().

◆ can_redo_

std::function<bool()> yaze::editor::DungeonWorkbenchPanel::can_redo_
private

Definition at line 121 of file dungeon_workbench_panel.h.

Referenced by Draw(), and SetUndoRedoProvider().

◆ on_undo_

std::function<void()> yaze::editor::DungeonWorkbenchPanel::on_undo_
private

Definition at line 122 of file dungeon_workbench_panel.h.

Referenced by Draw(), and SetUndoRedoProvider().

◆ on_redo_

std::function<void()> yaze::editor::DungeonWorkbenchPanel::on_redo_
private

Definition at line 123 of file dungeon_workbench_panel.h.

Referenced by Draw(), and SetUndoRedoProvider().

◆ undo_desc_

std::function<std::string()> yaze::editor::DungeonWorkbenchPanel::undo_desc_
private

Definition at line 124 of file dungeon_workbench_panel.h.

Referenced by Draw(), and SetUndoRedoProvider().

◆ redo_desc_

std::function<std::string()> yaze::editor::DungeonWorkbenchPanel::redo_desc_
private

Definition at line 125 of file dungeon_workbench_panel.h.

Referenced by Draw(), and SetUndoRedoProvider().

◆ undo_depth_

std::function<int()> yaze::editor::DungeonWorkbenchPanel::undo_depth_
private

Definition at line 126 of file dungeon_workbench_panel.h.

Referenced by Draw(), and SetUndoRedoProvider().

◆ get_tool_mode_

std::function<const char*()> yaze::editor::DungeonWorkbenchPanel::get_tool_mode_
private

Definition at line 129 of file dungeon_workbench_panel.h.

Referenced by Draw(), and SetToolModeProvider().

◆ show_shortcut_legend_

bool yaze::editor::DungeonWorkbenchPanel::show_shortcut_legend_ = false
private

Definition at line 132 of file dungeon_workbench_panel.h.

Referenced by DrawInspectorShelfTools().


The documentation for this class was generated from the following files: