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

WindowContent for placing and managing dungeon sprites. More...

#include <sprite_editor_panel.h>

Inheritance diagram for yaze::editor::SpriteEditorPanel:
Collaboration diagram for yaze::editor::SpriteEditorPanel:

Public Member Functions

 SpriteEditorPanel (int *current_room_id, DungeonRoomStore *rooms, DungeonCanvasViewer *canvas_viewer=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.
 
std::string GetWorkflowGroup () const override
 Optional workflow group for hack-centric actions.
 
void Draw (bool *p_open) override
 Draw the panel content.
 
void DrawInWorkbench ()
 
void SetCanvasViewer (DungeonCanvasViewer *viewer)
 
void SetSpritePlacedCallback (std::function< void(const zelda3::Sprite &)> callback)
 
void SetOpenSelectionInspectorCallback (std::function< void()> callback)
 
- Public Member Functions inherited from yaze::editor::WindowContent
virtual ~WindowContent ()=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 WindowLifecycle GetWindowLifecycle () const
 Get the lifecycle category for this window.
 
virtual WindowContextScope GetContextScope () const
 Optional context binding for this window (room/selection/etc)
 
virtual WindowScope GetScope () const
 Get the registration scope for this window.
 
virtual WindowPresentationPolicy GetPresentationPolicy () const
 How this content is hosted and advertised by workspace chrome.
 
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 std::string GetWorkflowLabel () const
 Optional workflow label for menus/command palette.
 
virtual std::string GetWorkflowDescription () const
 Optional workflow description for menus/command palette.
 
virtual int GetWorkflowPriority () const
 Optional workflow ordering priority (lower sorts first).
 
virtual float GetPreferredWidth () const
 Get preferred width for this panel (optional)
 
virtual bool HasExactPreferredWidth () const
 Whether GetPreferredWidth() is an exact content width.
 
virtual float GetPreferredHeight () const
 Get preferred height for this panel (optional)
 
virtual bool PrefersFloating () const
 
virtual bool PreferAutoHideTabBar () const
 Whether the dock node hosting this panel should auto-hide its tab bar.
 
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 DrawContent (bool show_room_sprites)
 
void DrawPlacementControls ()
 
void DrawSpriteSelector (bool show_room_sprites)
 
void DrawRoomSprites ()
 
std::string SpriteName (int sprite_id) const
 
bool MatchesFilter (int sprite_id) const
 

Private Attributes

int * current_room_id_ = nullptr
 
DungeonRoomStore * rooms_ = nullptr
 
DungeonCanvasViewer * canvas_viewer_ = nullptr
 
int selected_sprite_id_ = 0
 
char search_filter_ [64] = {0}
 
std::function< void(const zelda3::Sprite &) sprite_placed_callback_ )
 
std::function< void()> open_selection_inspector_callback_
 

Additional Inherited Members

- Protected Member Functions inherited from yaze::editor::WindowContent
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

WindowContent for placing and managing dungeon sprites.

Panel layout, filtering, and placement behavior live in the matching .cc file. Room edits continue through DungeonCanvasViewer's interaction handlers.

Definition at line 25 of file sprite_editor_panel.h.

Constructor & Destructor Documentation

◆ SpriteEditorPanel()

yaze::editor::SpriteEditorPanel::SpriteEditorPanel ( int * current_room_id,
DungeonRoomStore * rooms,
DungeonCanvasViewer * canvas_viewer = nullptr )

Definition at line 24 of file sprite_editor_panel.cc.

Member Function Documentation

◆ GetId()

std::string yaze::editor::SpriteEditorPanel::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::WindowContent.

Definition at line 31 of file sprite_editor_panel.cc.

◆ GetDisplayName()

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

Human-readable name shown in menus and title bars.

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

Implements yaze::editor::WindowContent.

Definition at line 35 of file sprite_editor_panel.cc.

◆ GetIcon()

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

Material Design icon for this panel.

Returns
Icon constant (e.g., ICON_MD_LIST)

Implements yaze::editor::WindowContent.

Definition at line 39 of file sprite_editor_panel.cc.

References ICON_MD_PERSON.

◆ GetEditorCategory()

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

Editor category this panel belongs to.

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

Implements yaze::editor::WindowContent.

Definition at line 43 of file sprite_editor_panel.cc.

◆ GetPriority()

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

Get display priority for menu ordering.

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

Reimplemented from yaze::editor::WindowContent.

Definition at line 47 of file sprite_editor_panel.cc.

◆ GetWorkflowGroup()

std::string yaze::editor::SpriteEditorPanel::GetWorkflowGroup ( ) const
overridevirtual

Optional workflow group for hack-centric actions.

Returns
Non-empty group name to surface this panel in hack workflows.

Reimplemented from yaze::editor::WindowContent.

Definition at line 51 of file sprite_editor_panel.cc.

◆ Draw()

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

Draw the panel content.

Parameters
p_openPointer to visibility flag (nullptr if not closable)

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

Implements yaze::editor::WindowContent.

Definition at line 55 of file sprite_editor_panel.cc.

References DrawContent().

Here is the call graph for this function:

◆ DrawInWorkbench()

void yaze::editor::SpriteEditorPanel::DrawInWorkbench ( )

Definition at line 59 of file sprite_editor_panel.cc.

References DrawContent().

Here is the call graph for this function:

◆ SetCanvasViewer()

void yaze::editor::SpriteEditorPanel::SetCanvasViewer ( DungeonCanvasViewer * viewer)

◆ SetSpritePlacedCallback()

void yaze::editor::SpriteEditorPanel::SetSpritePlacedCallback ( std::function< void(const zelda3::Sprite &)> callback)

Definition at line 93 of file sprite_editor_panel.cc.

References sprite_placed_callback_.

◆ SetOpenSelectionInspectorCallback()

void yaze::editor::SpriteEditorPanel::SetOpenSelectionInspectorCallback ( std::function< void()> callback)

Definition at line 98 of file sprite_editor_panel.cc.

References open_selection_inspector_callback_.

◆ DrawContent()

◆ DrawPlacementControls()

◆ DrawSpriteSelector()

◆ DrawRoomSprites()

◆ SpriteName()

std::string yaze::editor::SpriteEditorPanel::SpriteName ( int sprite_id) const
private

◆ MatchesFilter()

bool yaze::editor::SpriteEditorPanel::MatchesFilter ( int sprite_id) const
private

Definition at line 267 of file sprite_editor_panel.cc.

References search_filter_, and SpriteName().

Referenced by DrawSpriteSelector().

Here is the call graph for this function:

Member Data Documentation

◆ current_room_id_

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

◆ rooms_

DungeonRoomStore* yaze::editor::SpriteEditorPanel::rooms_ = nullptr
private

Definition at line 55 of file sprite_editor_panel.h.

Referenced by DrawContent().

◆ canvas_viewer_

DungeonCanvasViewer* yaze::editor::SpriteEditorPanel::canvas_viewer_ = nullptr
private

◆ selected_sprite_id_

int yaze::editor::SpriteEditorPanel::selected_sprite_id_ = 0
private

Definition at line 59 of file sprite_editor_panel.h.

Referenced by DrawPlacementControls(), and DrawSpriteSelector().

◆ search_filter_

char yaze::editor::SpriteEditorPanel::search_filter_[64] = {0}
private

Definition at line 60 of file sprite_editor_panel.h.

Referenced by DrawSpriteSelector(), and MatchesFilter().

◆ sprite_placed_callback_

std::function<void(const zelda3::Sprite&) yaze::editor::SpriteEditorPanel::sprite_placed_callback_)
private

Definition at line 62 of file sprite_editor_panel.h.

Referenced by SetSpritePlacedCallback().

◆ open_selection_inspector_callback_

std::function<void()> yaze::editor::SpriteEditorPanel::open_selection_inspector_callback_
private

Definition at line 63 of file sprite_editor_panel.h.

Referenced by DrawRoomSprites(), and SetOpenSelectionInspectorCallback().


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