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

WindowContent for displaying and editing dungeon entrances. More...

#include <dungeon_entrances_panel.h>

Inheritance diagram for yaze::editor::DungeonEntrancesPanel:
Collaboration diagram for yaze::editor::DungeonEntrancesPanel:

Public Types

using CameraStateProvider
 
using CameraRepairCallback = std::function<absl::Status(int)>
 
using EntrancePropertyEditCallback
 
using SpawnPropertyEditCallback
 

Public Member Functions

 DungeonEntrancesPanel (std::array< zelda3::RoomEntrance, zelda3::kNumDungeonEntranceSlots > *entrances, std::array< zelda3::DungeonSpawnPoint, zelda3::kNumDungeonSpawnPoints > *spawn_points, int *current_entrance_id, std::function< void(int)> on_entrance_selected)
 
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 SetPropertyEditCallbacks (EntrancePropertyEditCallback entrance_callback, SpawnPropertyEditCallback spawn_callback)
 
std::shared_ptr< const int > property_edit_gesture () const
 
void SetCameraTools (CameraStateProvider state_provider, CameraRepairCallback repair_callback, std::function< void()> data_changed_callback={})
 
bool OwnsNavigationShortcutFocus () const
 
void SetGraphicsPreview (std::function< DungeonRenderContext()> context, std::function< bool()> automatic, std::function< void(int)> select)
 
void DrawGraphicsContext (float width=-1.0f)
 
void DrawPropertiesInWorkbench ()
 
void Draw (bool *p_open) override
 Draw the panel content.
 
- 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 DrawCameraRepairPreview ()
 
void DrawCameraSafety (int slot_index)
 
void DrawSelectedProperties ()
 
bool DrawCameraBoundaries (const char *table_id, const std::array< uint8_t *, 8 > &boundaries)
 
void DrawEntranceList ()
 
void DrawSpawnPointProperties (int slot_index)
 
void DrawRegularEntranceProperties (int slot_index)
 
void CommitEntrancePropertyEdit (int slot_index, const zelda3::RoomEntrance &before, bool changed)
 
void CommitSpawnPropertyEdit (int slot_index, const zelda3::DungeonSpawnPoint &before, bool changed)
 
void ObservePropertyEditGesture ()
 
void RegisterPropertyInput (const char *field_label, const char *widget_label)
 

Private Attributes

std::array< zelda3::RoomEntrance, zelda3::kNumDungeonEntranceSlots > * entrances_ = nullptr
 
std::array< zelda3::DungeonSpawnPoint, zelda3::kNumDungeonSpawnPoints > * spawn_points_ = nullptr
 
int * current_entrance_id_ = nullptr
 
std::function< void(int)> on_entrance_selected_
 
std::function< DungeonRenderContext()> preview_context_
 
std::function< bool()> preview_automatic_
 
std::function< void(int)> select_preview_
 
CameraStateProvider camera_state_provider_
 
CameraRepairCallback camera_repair_callback_
 
EntrancePropertyEditCallback entrance_property_edit_callback_
 
SpawnPropertyEditCallback spawn_property_edit_callback_
 
ImGuiID property_edit_active_id_ = 0
 
std::shared_ptr< const int > property_edit_gesture_
 
std::function< void()> camera_data_changed_callback_
 
std::optional< DungeonEntranceCameraState > camera_repair_preview_
 
int camera_repair_slot_ = -1
 
std::string camera_repair_error_
 
bool navigation_shortcut_focus_ = false
 
int navigation_shortcut_last_draw_frame_ = -1
 
ImGuiTextFilter entrance_filter_
 

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 and editing dungeon entrances.

This panel provides a list of all dungeon entrances with their properties. Users can select entrances to navigate to their associated rooms.

See also
WindowContent - Base interface

Definition at line 40 of file dungeon_entrances_panel.h.

Member Typedef Documentation

◆ CameraStateProvider

Initial value:
std::function<std::optional<DungeonEntranceCameraState>(int)>

Definition at line 64 of file dungeon_entrances_panel.h.

◆ CameraRepairCallback

using yaze::editor::DungeonEntrancesPanel::CameraRepairCallback = std::function<absl::Status(int)>

Definition at line 66 of file dungeon_entrances_panel.h.

◆ EntrancePropertyEditCallback

Initial value:
std::function<void(
int, const zelda3::RoomEntrance&, const zelda3::RoomEntrance&)>

Definition at line 67 of file dungeon_entrances_panel.h.

◆ SpawnPropertyEditCallback

Initial value:
std::function<void(
int, const zelda3::DungeonSpawnPoint&, const zelda3::DungeonSpawnPoint&)>

Definition at line 69 of file dungeon_entrances_panel.h.

Constructor & Destructor Documentation

◆ DungeonEntrancesPanel()

yaze::editor::DungeonEntrancesPanel::DungeonEntrancesPanel ( std::array< zelda3::RoomEntrance, zelda3::kNumDungeonEntranceSlots > * entrances,
std::array< zelda3::DungeonSpawnPoint, zelda3::kNumDungeonSpawnPoints > * spawn_points,
int * current_entrance_id,
std::function< void(int)> on_entrance_selected )
inline

Definition at line 42 of file dungeon_entrances_panel.h.

Member Function Documentation

◆ GetId()

std::string yaze::editor::DungeonEntrancesPanel::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 57 of file dungeon_entrances_panel.h.

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

◆ GetDisplayName()

std::string yaze::editor::DungeonEntrancesPanel::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 58 of file dungeon_entrances_panel.h.

◆ GetIcon()

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

Material Design icon for this panel.

Returns
Icon constant (e.g., ICON_MD_LIST)

Implements yaze::editor::WindowContent.

Definition at line 59 of file dungeon_entrances_panel.h.

References ICON_MD_DOOR_FRONT.

◆ GetEditorCategory()

std::string yaze::editor::DungeonEntrancesPanel::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 60 of file dungeon_entrances_panel.h.

◆ GetPriority()

int yaze::editor::DungeonEntrancesPanel::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 61 of file dungeon_entrances_panel.h.

◆ GetWorkflowGroup()

std::string yaze::editor::DungeonEntrancesPanel::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 62 of file dungeon_entrances_panel.h.

◆ SetPropertyEditCallbacks()

void yaze::editor::DungeonEntrancesPanel::SetPropertyEditCallbacks ( EntrancePropertyEditCallback entrance_callback,
SpawnPropertyEditCallback spawn_callback )
inline

◆ property_edit_gesture()

std::shared_ptr< const int > yaze::editor::DungeonEntrancesPanel::property_edit_gesture ( ) const
inline

◆ SetCameraTools()

void yaze::editor::DungeonEntrancesPanel::SetCameraTools ( CameraStateProvider state_provider,
CameraRepairCallback repair_callback,
std::function< void()> data_changed_callback = {} )
inline

◆ OwnsNavigationShortcutFocus()

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

◆ SetGraphicsPreview()

void yaze::editor::DungeonEntrancesPanel::SetGraphicsPreview ( std::function< DungeonRenderContext()> context,
std::function< bool()> automatic,
std::function< void(int)> select )
inline

Definition at line 96 of file dungeon_entrances_panel.h.

References preview_automatic_, preview_context_, and select_preview_.

◆ DrawGraphicsContext()

◆ DrawPropertiesInWorkbench()

void yaze::editor::DungeonEntrancesPanel::DrawPropertiesInWorkbench ( )
inline

◆ Draw()

void yaze::editor::DungeonEntrancesPanel::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 210 of file dungeon_entrances_panel.h.

References current_entrance_id_, DrawEntranceList(), DrawSelectedProperties(), entrances_, ICON_MD_DOOR_FRONT, ICON_MD_TUNE, navigation_shortcut_focus_, navigation_shortcut_last_draw_frame_, and spawn_points_.

Here is the call graph for this function:

◆ DrawCameraRepairPreview()

void yaze::editor::DungeonEntrancesPanel::DrawCameraRepairPreview ( )
inlineprivate

◆ DrawCameraSafety()

void yaze::editor::DungeonEntrancesPanel::DrawCameraSafety ( int slot_index)
inlineprivate

◆ DrawSelectedProperties()

void yaze::editor::DungeonEntrancesPanel::DrawSelectedProperties ( )
inlineprivate

◆ DrawCameraBoundaries()

bool yaze::editor::DungeonEntrancesPanel::DrawCameraBoundaries ( const char * table_id,
const std::array< uint8_t *, 8 > & boundaries )
inlineprivate

Definition at line 412 of file dungeon_entrances_panel.h.

References yaze::gui::InputHexByte().

Referenced by DrawRegularEntranceProperties(), and DrawSpawnPointProperties().

Here is the call graph for this function:

◆ DrawEntranceList()

void yaze::editor::DungeonEntrancesPanel::DrawEntranceList ( )
inlineprivate

◆ DrawSpawnPointProperties()

void yaze::editor::DungeonEntrancesPanel::DrawSpawnPointProperties ( int slot_index)
inlineprivate

◆ DrawRegularEntranceProperties()

void yaze::editor::DungeonEntrancesPanel::DrawRegularEntranceProperties ( int slot_index)
inlineprivate

◆ CommitEntrancePropertyEdit()

void yaze::editor::DungeonEntrancesPanel::CommitEntrancePropertyEdit ( int slot_index,
const zelda3::RoomEntrance & before,
bool changed )
inlineprivate

◆ CommitSpawnPropertyEdit()

void yaze::editor::DungeonEntrancesPanel::CommitSpawnPropertyEdit ( int slot_index,
const zelda3::DungeonSpawnPoint & before,
bool changed )
inlineprivate

◆ ObservePropertyEditGesture()

void yaze::editor::DungeonEntrancesPanel::ObservePropertyEditGesture ( )
private

◆ RegisterPropertyInput()

Member Data Documentation

◆ entrances_

std::array<zelda3::RoomEntrance, zelda3::kNumDungeonEntranceSlots>* yaze::editor::DungeonEntrancesPanel::entrances_ = nullptr
private

Definition at line 678 of file dungeon_entrances_panel.h.

Referenced by Draw(), DrawGraphicsContext(), and DrawPropertiesInWorkbench().

◆ spawn_points_

std::array<zelda3::DungeonSpawnPoint, zelda3::kNumDungeonSpawnPoints>* yaze::editor::DungeonEntrancesPanel::spawn_points_ = nullptr
private

Definition at line 680 of file dungeon_entrances_panel.h.

Referenced by Draw(), DrawGraphicsContext(), and DrawPropertiesInWorkbench().

◆ current_entrance_id_

int* yaze::editor::DungeonEntrancesPanel::current_entrance_id_ = nullptr
private

◆ on_entrance_selected_

std::function<void(int)> yaze::editor::DungeonEntrancesPanel::on_entrance_selected_
private

Definition at line 682 of file dungeon_entrances_panel.h.

Referenced by DrawEntranceList(), and DrawGraphicsContext().

◆ preview_context_

std::function<DungeonRenderContext()> yaze::editor::DungeonEntrancesPanel::preview_context_
private

◆ preview_automatic_

std::function<bool()> yaze::editor::DungeonEntrancesPanel::preview_automatic_
private

◆ select_preview_

std::function<void(int)> yaze::editor::DungeonEntrancesPanel::select_preview_
private

Definition at line 685 of file dungeon_entrances_panel.h.

Referenced by DrawGraphicsContext(), and SetGraphicsPreview().

◆ camera_state_provider_

CameraStateProvider yaze::editor::DungeonEntrancesPanel::camera_state_provider_
private

Definition at line 686 of file dungeon_entrances_panel.h.

Referenced by DrawCameraSafety().

◆ camera_repair_callback_

CameraRepairCallback yaze::editor::DungeonEntrancesPanel::camera_repair_callback_
private

Definition at line 687 of file dungeon_entrances_panel.h.

Referenced by DrawCameraRepairPreview(), and DrawCameraSafety().

◆ entrance_property_edit_callback_

EntrancePropertyEditCallback yaze::editor::DungeonEntrancesPanel::entrance_property_edit_callback_
private

◆ spawn_property_edit_callback_

SpawnPropertyEditCallback yaze::editor::DungeonEntrancesPanel::spawn_property_edit_callback_
private

Definition at line 689 of file dungeon_entrances_panel.h.

Referenced by CommitSpawnPropertyEdit(), and SetPropertyEditCallbacks().

◆ property_edit_active_id_

ImGuiID yaze::editor::DungeonEntrancesPanel::property_edit_active_id_ = 0
private

Definition at line 690 of file dungeon_entrances_panel.h.

Referenced by ObservePropertyEditGesture().

◆ property_edit_gesture_

std::shared_ptr<const int> yaze::editor::DungeonEntrancesPanel::property_edit_gesture_
private

Definition at line 691 of file dungeon_entrances_panel.h.

Referenced by ObservePropertyEditGesture(), and property_edit_gesture().

◆ camera_data_changed_callback_

std::function<void()> yaze::editor::DungeonEntrancesPanel::camera_data_changed_callback_
private

◆ camera_repair_preview_

std::optional<DungeonEntranceCameraState> yaze::editor::DungeonEntrancesPanel::camera_repair_preview_
private

Definition at line 693 of file dungeon_entrances_panel.h.

Referenced by DrawCameraRepairPreview(), and DrawCameraSafety().

◆ camera_repair_slot_

int yaze::editor::DungeonEntrancesPanel::camera_repair_slot_ = -1
private

Definition at line 694 of file dungeon_entrances_panel.h.

Referenced by DrawCameraRepairPreview(), and DrawCameraSafety().

◆ camera_repair_error_

std::string yaze::editor::DungeonEntrancesPanel::camera_repair_error_
private

Definition at line 695 of file dungeon_entrances_panel.h.

Referenced by DrawCameraRepairPreview(), and DrawCameraSafety().

◆ navigation_shortcut_focus_

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

Definition at line 696 of file dungeon_entrances_panel.h.

Referenced by Draw(), and OwnsNavigationShortcutFocus().

◆ navigation_shortcut_last_draw_frame_

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

Definition at line 697 of file dungeon_entrances_panel.h.

Referenced by Draw(), and OwnsNavigationShortcutFocus().

◆ entrance_filter_

ImGuiTextFilter yaze::editor::DungeonEntrancesPanel::entrance_filter_
private

Definition at line 698 of file dungeon_entrances_panel.h.

Referenced by DrawEntranceList().


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