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.
 
std::string GetWorkflowGroup () const override
 Optional workflow group for hack-centric actions.
 
float GetPreferredWidth () const override
 Get preferred width for this panel (optional)
 
void SetRoomIntentCallback (std::function< void(int, RoomSelectionIntent)> callback)
 
void SetRenderContextCallback (std::function< void(int)> callback)
 
void SetCensusManifestProvider (RoomMatrixCensusOverlay::ManifestProvider provider)
 
RoomMatrixCensusOverlay & census_overlay ()
 
void DetachRuntimeContext ()
 
bool OwnsNavigationShortcutFocus () const
 
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 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 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 DrawMatrixHeader (Rom *rom)
 
void DrawCensusCellMarks (ImDrawList *draw_list, int room_id, const ImVec2 &cell_min, const ImVec2 &cell_max, bool matches_filter, const AgentUITheme &theme) 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) const
 

Static Private Member Functions

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

Private Attributes

std::function< void(int)> prepare_render_context_
 
int * current_room_id_ = nullptr
 
ImVector< int > * active_rooms_ = nullptr
 
DungeonRoomStore * rooms_ = nullptr
 
std::function< void(int)> on_room_selected_
 
std::function< void(int, int)> on_room_swap_
 
std::function< void(int, RoomSelectionIntent)> on_room_intent_
 
RoomCompositeOutput tooltip_composite_output_
 
RoomMatrixCensusOverlay census_
 
bool navigation_shortcut_focus_ = false
 
int navigation_shortcut_last_draw_frame_ = -1
 
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
  • "Census" overlay (RoomMatrixCensusOverlay): owner colors, free / reclaimable outlines, legend and filter chips, largest free block
See also
WindowContent - Base interface

Definition at line 49 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 58 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 72 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 73 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 74 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 75 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 76 of file room_matrix_content.h.

◆ GetWorkflowGroup()

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

◆ SetRoomIntentCallback()

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

Definition at line 80 of file room_matrix_content.h.

References on_room_intent_.

◆ SetRenderContextCallback()

void yaze::editor::RoomMatrixContent::SetRenderContextCallback ( std::function< void(int)> callback)
inline

Definition at line 85 of file room_matrix_content.h.

References prepare_render_context_.

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

◆ SetCensusManifestProvider()

void yaze::editor::RoomMatrixContent::SetCensusManifestProvider ( RoomMatrixCensusOverlay::ManifestProvider provider)
inline

Definition at line 90 of file room_matrix_content.h.

References census_, and yaze::editor::RoomMatrixCensusOverlay::SetManifestProvider().

Here is the call graph for this function:

◆ census_overlay()

RoomMatrixCensusOverlay & yaze::editor::RoomMatrixContent::census_overlay ( )
inline

◆ DetachRuntimeContext()

◆ OwnsNavigationShortcutFocus()

bool yaze::editor::RoomMatrixContent::OwnsNavigationShortcutFocus ( ) const
inline

◆ Draw()

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

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 119 of file room_matrix_content.h.

References active_rooms_, yaze::gui::AutoRegisterLastItem(), BlendRoomColor(), yaze::editor::RoomMatrixCensusOverlay::census(), census_, yaze::gui::CanvasMenuItem::Conditional(), yaze::gui::CopyToClipboardItem(), current_room_id_, DrawCensusCellMarks(), DrawMatrixHeader(), yaze::editor::RoomMatrixCensusOverlay::DrawTooltip(), yaze::editor::RoomMatrixCensusOverlay::enabled(), yaze::gfx::EnsureCompositeBitmapTextureQueued(), yaze::editor::RoomMatrixCensusOverlay::FillColor(), yaze::gfx::Arena::Get(), yaze::editor::DungeonRoomStore::GetIfLoaded(), GetRoomColor(), yaze::zelda3::GetRoomLabel(), yaze::editor::AgentUI::GetTheme(), ICON_MD_ARROW_FORWARD, ICON_MD_MY_LOCATION, ICON_MD_OPEN_IN_NEW, ICON_MD_SWAP_HORIZ, ICON_MD_TAB, yaze::gui::ItemContextMenu(), yaze::editor::kFocusInWorkbench, yaze::editor::kOpenStandalone, yaze::editor::RoomMatrixCensusOverlay::MatchesChips(), MatchesSearchFilter(), navigation_shortcut_focus_, navigation_shortcut_last_draw_frame_, on_room_intent_, on_room_selected_, on_room_swap_, prepare_render_context_, yaze::editor::PrepareCanonicalRoomComposite(), yaze::gfx::Arena::ProcessTextureQueue(), yaze::editor::DungeonRoomStore::rom(), rooms_, tooltip_composite_output_, and yaze::editor::RoomMatrixCensusOverlay::Update().

Referenced by yaze::editor::DungeonWorkbenchContent::DrawSidebarContent().

◆ SetRooms()

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

◆ DrawMatrixHeader()

◆ DrawCensusCellMarks()

void yaze::editor::RoomMatrixContent::DrawCensusCellMarks ( ImDrawList * draw_list,
int room_id,
const ImVec2 & cell_min,
const ImVec2 & cell_max,
bool matches_filter,
const AgentUITheme & theme ) const
inlineprivate

◆ MatchesSearchFilter()

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

Definition at line 481 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 501 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 510 of file room_matrix_content.h.

Referenced by Draw(), and DrawCensusCellMarks().

◆ GetRoomMetadata()

std::optional< std::pair< int, int > > yaze::editor::RoomMatrixContent::GetRoomMetadata ( int room_id) const
inlineprivate

◆ GetRoomColor()

Member Data Documentation

◆ prepare_render_context_

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

Definition at line 385 of file room_matrix_content.h.

Referenced by DetachRuntimeContext(), Draw(), and SetRenderContextCallback().

◆ current_room_id_

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

Definition at line 570 of file room_matrix_content.h.

Referenced by DetachRuntimeContext(), Draw(), and DrawMatrixHeader().

◆ active_rooms_

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

Definition at line 571 of file room_matrix_content.h.

Referenced by DetachRuntimeContext(), Draw(), and DrawMatrixHeader().

◆ rooms_

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

◆ on_room_selected_

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

Definition at line 573 of file room_matrix_content.h.

Referenced by DetachRuntimeContext(), and Draw().

◆ on_room_swap_

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

Definition at line 574 of file room_matrix_content.h.

Referenced by DetachRuntimeContext(), and Draw().

◆ on_room_intent_

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

Definition at line 575 of file room_matrix_content.h.

Referenced by DetachRuntimeContext(), Draw(), and SetRoomIntentCallback().

◆ tooltip_composite_output_

RoomCompositeOutput yaze::editor::RoomMatrixContent::tooltip_composite_output_
private

Definition at line 576 of file room_matrix_content.h.

Referenced by Draw(), and SetRooms().

◆ census_

RoomMatrixCensusOverlay yaze::editor::RoomMatrixContent::census_
private

◆ navigation_shortcut_focus_

bool yaze::editor::RoomMatrixContent::navigation_shortcut_focus_ = false
private

Definition at line 578 of file room_matrix_content.h.

Referenced by DetachRuntimeContext(), Draw(), and OwnsNavigationShortcutFocus().

◆ navigation_shortcut_last_draw_frame_

int yaze::editor::RoomMatrixContent::navigation_shortcut_last_draw_frame_ = -1
private

Definition at line 579 of file room_matrix_content.h.

Referenced by Draw(), and OwnsNavigationShortcutFocus().

◆ search_filter_

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

Definition at line 580 of file room_matrix_content.h.

Referenced by DrawMatrixHeader(), and MatchesSearchFilter().


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