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

WindowContent for displaying a visual 16x19 grid of all dungeon rooms. More...

#include <room_matrix_content.h>

Inheritance diagram for yaze::editor::RoomMatrixContent:
Collaboration diagram for yaze::editor::RoomMatrixContent:

Public Member Functions

 RoomMatrixContent (int *current_room_id, ImVector< int > *active_rooms, std::function< void(int)> on_room_selected, std::function< void(int, int)> on_room_swap=nullptr, DungeonRoomStore *rooms=nullptr)
 Construct a room matrix panel.
 
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.
 
float GetPreferredWidth () const override
 Get preferred width for this panel (optional)
 
void SetRoomIntentCallback (std::function< void(int, RoomSelectionIntent)> callback)
 
void Draw (bool *p_open) override
 Draw the panel content.
 
void SetRooms (DungeonRoomStore *rooms)
 
- 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 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 GetWorkflowGroup () const
 Optional workflow group for hack-centric actions.
 
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 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 DrawMatrixSummary (const AgentUITheme &theme, int total_rooms) const
 
void DrawMatrixLegend (const AgentUITheme &theme) const
 
void DrawLegendSwatch (const ImVec4 &color, const char *label) const
 
bool MatchesSearchFilter (int room_id) const
 
std::optional< std::pair< int, int > > GetRoomMetadata (int room_id) const
 
ImU32 GetRoomColor (int room_id, const AgentUITheme &theme)
 Get color for a room from dominant preview color, with fallback.
 

Static Private Member Functions

static std::string NormalizeForSearch (const std::string &value)
 
static ImU32 BlendRoomColor (ImU32 source, ImU32 target, float blend)
 

Private Attributes

int * current_room_id_ = nullptr
 
ImVector< int > * active_rooms_ = nullptr
 
DungeonRoomStorerooms_ = nullptr
 
std::function< void(int)> on_room_selected_
 
std::function< void(int, int)> on_room_swap_
 
std::function< void(int, RoomSelectionIntent)> on_room_intent_
 
char search_filter_ [64] = ""
 

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 displaying a visual 16x19 grid of all dungeon rooms.

This panel provides a compact overview of all 296 dungeon rooms in a matrix layout. Users can click on cells to select and open rooms.

Features:

  • Responsive cell sizing based on panel width
  • Palette-based coloring when room data is available
  • Theme-aware selection highlighting
See also
WindowContent - Base interface

Definition at line 41 of file room_matrix_content.h.

Constructor & Destructor Documentation

◆ RoomMatrixContent()

yaze::editor::RoomMatrixContent::RoomMatrixContent ( int * current_room_id,
ImVector< int > * active_rooms,
std::function< void(int)> on_room_selected,
std::function< void(int, int)> on_room_swap = nullptr,
DungeonRoomStore * rooms = nullptr )
inline

Construct a room matrix panel.

Parameters
current_room_idPointer to the current room ID (for highlighting)
active_roomsPointer to list of currently open rooms
on_room_selectedCallback when a room is clicked
roomsOptional pointer to room array for palette-based coloring

Definition at line 50 of file room_matrix_content.h.

Member Function Documentation

◆ GetId()

std::string yaze::editor::RoomMatrixContent::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 64 of file room_matrix_content.h.

◆ GetDisplayName()

std::string yaze::editor::RoomMatrixContent::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 65 of file room_matrix_content.h.

◆ GetIcon()

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

Material Design icon for this panel.

Returns
Icon constant (e.g., ICON_MD_LIST)

Implements yaze::editor::WindowContent.

Definition at line 66 of file room_matrix_content.h.

References ICON_MD_GRID_VIEW.

◆ GetEditorCategory()

std::string yaze::editor::RoomMatrixContent::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 67 of file room_matrix_content.h.

◆ GetPriority()

int yaze::editor::RoomMatrixContent::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 68 of file room_matrix_content.h.

◆ GetPreferredWidth()

float yaze::editor::RoomMatrixContent::GetPreferredWidth ( ) const
inlineoverridevirtual

Get preferred width for this panel (optional)

Returns
Preferred width in pixels, or 0 to use default (250px)

Override this to specify content-based sizing. For example, a tile selector with 8 tiles at 16px × 2.0 scale would return ~276px.

Reimplemented from yaze::editor::WindowContent.

Definition at line 69 of file room_matrix_content.h.

◆ SetRoomIntentCallback()

void yaze::editor::RoomMatrixContent::SetRoomIntentCallback ( std::function< void(int, RoomSelectionIntent)> callback)
inline

Definition at line 71 of file room_matrix_content.h.

References on_room_intent_.

◆ Draw()

void yaze::editor::RoomMatrixContent::Draw ( bool * p_open)
inlineoverridevirtual

◆ SetRooms()

void yaze::editor::RoomMatrixContent::SetRooms ( DungeonRoomStore * rooms)
inline

Definition at line 345 of file room_matrix_content.h.

References rooms_.

◆ DrawMatrixSummary()

void yaze::editor::RoomMatrixContent::DrawMatrixSummary ( const AgentUITheme & theme,
int total_rooms ) const
inlineprivate

Definition at line 348 of file room_matrix_content.h.

References active_rooms_, current_room_id_, yaze::zelda3::GetRoomLabel(), GetRoomMetadata(), and yaze::editor::AgentUITheme::status_success.

Referenced by Draw().

Here is the call graph for this function:

◆ DrawMatrixLegend()

void yaze::editor::RoomMatrixContent::DrawMatrixLegend ( const AgentUITheme & theme) const
inlineprivate

◆ DrawLegendSwatch()

void yaze::editor::RoomMatrixContent::DrawLegendSwatch ( const ImVec4 & color,
const char * label ) const
inlineprivate

Definition at line 382 of file room_matrix_content.h.

Referenced by DrawMatrixLegend().

◆ MatchesSearchFilter()

bool yaze::editor::RoomMatrixContent::MatchesSearchFilter ( int room_id) const
inlineprivate

Definition at line 396 of file room_matrix_content.h.

References yaze::zelda3::GetRoomLabel(), NormalizeForSearch(), and search_filter_.

Referenced by Draw().

Here is the call graph for this function:

◆ NormalizeForSearch()

static std::string yaze::editor::RoomMatrixContent::NormalizeForSearch ( const std::string & value)
inlinestaticprivate

Definition at line 416 of file room_matrix_content.h.

Referenced by MatchesSearchFilter().

◆ BlendRoomColor()

static ImU32 yaze::editor::RoomMatrixContent::BlendRoomColor ( ImU32 source,
ImU32 target,
float blend )
inlinestaticprivate

Definition at line 425 of file room_matrix_content.h.

Referenced by Draw().

◆ GetRoomMetadata()

◆ GetRoomColor()

ImU32 yaze::editor::RoomMatrixContent::GetRoomColor ( int room_id,
const AgentUITheme & theme )
inlineprivate

Member Data Documentation

◆ current_room_id_

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

Definition at line 581 of file room_matrix_content.h.

Referenced by Draw(), and DrawMatrixSummary().

◆ active_rooms_

ImVector<int>* yaze::editor::RoomMatrixContent::active_rooms_ = nullptr
private

Definition at line 582 of file room_matrix_content.h.

Referenced by Draw(), and DrawMatrixSummary().

◆ rooms_

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

Definition at line 583 of file room_matrix_content.h.

Referenced by Draw(), GetRoomColor(), GetRoomMetadata(), and SetRooms().

◆ on_room_selected_

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

Definition at line 584 of file room_matrix_content.h.

Referenced by Draw().

◆ on_room_swap_

std::function<void(int, int)> yaze::editor::RoomMatrixContent::on_room_swap_
private

Definition at line 585 of file room_matrix_content.h.

Referenced by Draw().

◆ on_room_intent_

std::function<void(int, RoomSelectionIntent)> yaze::editor::RoomMatrixContent::on_room_intent_
private

Definition at line 586 of file room_matrix_content.h.

Referenced by Draw(), and SetRoomIntentCallback().

◆ search_filter_

char yaze::editor::RoomMatrixContent::search_filter_[64] = ""
private

Definition at line 587 of file room_matrix_content.h.

Referenced by Draw(), and MatchesSearchFilter().


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