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

WindowContent for placing and managing dungeon pot items. More...

#include <item_editor_panel.h>

Inheritance diagram for yaze::editor::ItemEditorPanel:
Collaboration diagram for yaze::editor::ItemEditorPanel:

Classes

struct  CachedItemPreview
 

Public Member Functions

 ItemEditorPanel (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 SetItemPlacedCallback (std::function< void(const zelda3::PotItem &)> 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_items)
 
bool HasMatchingViewer () const
 
bool CanEditRoom () const
 
void DrawPlacementControls ()
 
void DrawItemSelector (bool show_room_items)
 
void DrawRoomItems ()
 
ImVec4 GetItemTypeColor (int item_id, const AgentUITheme &theme) const
 
const char * GetItemTypeIcon (int item_id) const
 
const CachedItemPreview & GetOrCreateItemPreview (uint8_t item_id, const zelda3::Room &room)
 

Private Attributes

std::unordered_map< uint8_t, CachedItemPreview > item_preview_cache_
 
uint64_t cached_item_graphics_revision_ = 0
 
int * current_room_id_ = nullptr
 
DungeonRoomStore * rooms_ = nullptr
 
DungeonCanvasViewer * canvas_viewer_ = nullptr
 
workbench::DungeonBrowserState browser_state_
 
int selected_item_id_ = 0
 
bool placement_mode_ = false
 
std::function< void(const zelda3::PotItem &) item_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 pot items.

This panel provides item selection and placement functionality for dungeon rooms, similar to ObjectSelectorContent and SpriteEditorPanel.

Definition at line 31 of file item_editor_panel.h.

Constructor & Destructor Documentation

◆ ItemEditorPanel()

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

Definition at line 33 of file item_editor_panel.h.

Member Function Documentation

◆ GetId()

std::string yaze::editor::ItemEditorPanel::GetId ( ) const
inlineoverridevirtual

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 39 of file item_editor_panel.h.

◆ GetDisplayName()

std::string yaze::editor::ItemEditorPanel::GetDisplayName ( ) const
inlineoverridevirtual

Human-readable name shown in menus and title bars.

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

Implements yaze::editor::WindowContent.

Definition at line 40 of file item_editor_panel.h.

◆ GetIcon()

std::string yaze::editor::ItemEditorPanel::GetIcon ( ) const
inlineoverridevirtual

Material Design icon for this panel.

Returns
Icon constant (e.g., ICON_MD_LIST)

Implements yaze::editor::WindowContent.

Definition at line 41 of file item_editor_panel.h.

References ICON_MD_INVENTORY.

◆ GetEditorCategory()

std::string yaze::editor::ItemEditorPanel::GetEditorCategory ( ) const
inlineoverridevirtual

Editor category this panel belongs to.

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

Implements yaze::editor::WindowContent.

Definition at line 42 of file item_editor_panel.h.

◆ GetPriority()

int yaze::editor::ItemEditorPanel::GetPriority ( ) const
inlineoverridevirtual

Get display priority for menu ordering.

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

Reimplemented from yaze::editor::WindowContent.

Definition at line 43 of file item_editor_panel.h.

◆ GetWorkflowGroup()

std::string yaze::editor::ItemEditorPanel::GetWorkflowGroup ( ) const
inlineoverridevirtual

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 44 of file item_editor_panel.h.

◆ Draw()

void yaze::editor::ItemEditorPanel::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 19 of file item_editor_panel.cc.

References DrawContent().

Here is the call graph for this function:

◆ DrawInWorkbench()

◆ SetCanvasViewer()

void yaze::editor::ItemEditorPanel::SetCanvasViewer ( DungeonCanvasViewer * viewer)
inline

◆ SetItemPlacedCallback()

void yaze::editor::ItemEditorPanel::SetItemPlacedCallback ( std::function< void(const zelda3::PotItem &)> callback)
inline

Definition at line 51 of file item_editor_panel.h.

References item_placed_callback_.

◆ SetOpenSelectionInspectorCallback()

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

Definition at line 55 of file item_editor_panel.h.

References open_selection_inspector_callback_.

◆ DrawContent()

void yaze::editor::ItemEditorPanel::DrawContent ( bool show_room_items)
private

◆ HasMatchingViewer()

◆ CanEditRoom()

bool yaze::editor::ItemEditorPanel::CanEditRoom ( ) const
private

◆ DrawPlacementControls()

◆ DrawItemSelector()

◆ DrawRoomItems()

◆ GetItemTypeColor()

◆ GetItemTypeIcon()

◆ GetOrCreateItemPreview()

Member Data Documentation

◆ item_preview_cache_

std::unordered_map<uint8_t, CachedItemPreview> yaze::editor::ItemEditorPanel::item_preview_cache_
mutableprivate

Definition at line 77 of file item_editor_panel.h.

Referenced by GetOrCreateItemPreview().

◆ cached_item_graphics_revision_

uint64_t yaze::editor::ItemEditorPanel::cached_item_graphics_revision_ = 0
mutableprivate

Definition at line 78 of file item_editor_panel.h.

Referenced by GetOrCreateItemPreview().

◆ current_room_id_

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

◆ rooms_

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

Definition at line 81 of file item_editor_panel.h.

Referenced by DrawContent(), DrawInWorkbench(), DrawRoomItems(), and HasMatchingViewer().

◆ canvas_viewer_

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

◆ browser_state_

workbench::DungeonBrowserState yaze::editor::ItemEditorPanel::browser_state_
private

Definition at line 84 of file item_editor_panel.h.

Referenced by DrawInWorkbench().

◆ selected_item_id_

int yaze::editor::ItemEditorPanel::selected_item_id_ = 0
private

Definition at line 85 of file item_editor_panel.h.

Referenced by DrawInWorkbench(), DrawItemSelector(), and DrawPlacementControls().

◆ placement_mode_

bool yaze::editor::ItemEditorPanel::placement_mode_ = false
private

Definition at line 86 of file item_editor_panel.h.

Referenced by DrawItemSelector(), and DrawPlacementControls().

◆ item_placed_callback_

std::function<void(const zelda3::PotItem&) yaze::editor::ItemEditorPanel::item_placed_callback_)
private

Definition at line 88 of file item_editor_panel.h.

Referenced by SetItemPlacedCallback().

◆ open_selection_inspector_callback_

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

Definition at line 89 of file item_editor_panel.h.

Referenced by DrawRoomItems(), and SetOpenSelectionInspectorCallback().


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