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

#include <minecart_track_editor_panel.h>

Inheritance diagram for yaze::editor::MinecartTrackEditorPanel:
Collaboration diagram for yaze::editor::MinecartTrackEditorPanel:

Classes

struct  RoomTrackAudit
 

Public Types

using ProjectChangedCallback
 
using ProjectDraftChangedCallback = std::function<absl::Status()>
 
using ProjectSaveCallback = std::function<absl::Status()>
 
using RoomNavigationCallback = std::function<void(int room_id)>
 

Public Member Functions

 MinecartTrackEditorPanel ()=default
 
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.
 
void Draw (bool *p_open) override
 Draw the panel content.
 
void SetRooms (DungeonRoomStore *rooms)
 
absl::Status SetProject (project::YazeProject *project)
 
absl::Status RebindProjectContext (project::YazeProject *project)
 
void SetRom (Rom *rom)
 
absl::Status SaveTracks ()
 
absl::Status ReloadTracks ()
 
absl::Status DiscardUnpublishedChanges ()
 
bool HasUnpublishedChanges () const
 
absl::StatusOr< std::filesystem::path > ResolveTrackSourcePath () const
 
absl::Status UpdateTrack (size_t track_index, const MinecartTrack &track)
 
bool HasPendingProjectDraftChanges () const
 
absl::Status PrepareProjectSave ()
 
void SetPickedCoordinates (int room_id, uint16_t camera_x, uint16_t camera_y)
 
bool IsPickingCoordinates () const
 
int GetPickingTrackIndex () const
 
const std::vector< MinecartTrack > & GetTracks ()
 
void SetRoomNavigationCallback (RoomNavigationCallback callback)
 
void SetProjectChangedCallback (ProjectChangedCallback callback)
 
void SetProjectDraftChangedCallback (ProjectDraftChangedCallback callback)
 
void SetProjectSaveCallback (ProjectSaveCallback 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 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 int GetPriority () const
 Get display priority for menu ordering.
 
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 float GetPreferredWidth () const
 Get preferred width for this panel (optional)
 
virtual float GetPreferredHeight () const
 Get preferred height for this panel (optional)
 
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 Types

using OverlayListMember
 

Private Member Functions

absl::Status LoadTracks ()
 
absl::Status ValidateLoadedManifestIdentity () const
 
absl::Status RefreshProjectBinding ()
 
void ResetTrackSession ()
 
void StartCoordinatePicking (int track_index)
 
void CancelCoordinatePicking ()
 
void RebuildAuditCache ()
 
bool IsDefaultTrack (const MinecartTrack &track) const
 
void DrawOverlaySettings ()
 
void InitializeOverlayInputs ()
 
void ClearOverlayInputs ()
 
bool UpdateOverlayList (const char *label, std::string &input, OverlayListMember member)
 
absl::StatusOr< bool > CommitOverlayList (std::string &input, OverlayListMember member)
 
absl::StatusOr< bool > CommitOverlayInputsForSave ()
 
absl::StatusOr< bool > ResetOverlaySettings ()
 
absl::Status NotifyProjectChanged (const project::DungeonOverlaySettings &overlay)
 
absl::Status NotifyProjectDraftChanged ()
 
absl::Status SaveProjectSettings ()
 

Private Attributes

std::vector< MinecartTracktracks_
 
std::vector< MinecartTrackloaded_tracks_
 
std::optional< MinecartTrackSourceDocumentsource_document_
 
std::optional< core::MinecartTrackLayout::Sourceloaded_source_identity_
 
std::filesystem::path loaded_source_path_
 
std::string loaded_source_sha256_
 
std::string bound_project_filepath_
 
std::optional< core::MinecartTrackLayout::Sourcebound_source_identity_
 
Romrom_ = nullptr
 
DungeonRoomStorerooms_ = nullptr
 
project::YazeProjectproject_ = nullptr
 
std::unordered_map< int, RoomTrackAuditroom_audit_
 
std::unordered_map< int, std::vector< int > > track_usage_rooms_
 
std::vector< bool > track_subtype_used_
 
bool audit_dirty_ = true
 
bool load_attempted_ = false
 
bool loaded_ = false
 
std::string status_message_
 
bool show_success_ = false
 
float success_timer_ = 0.0f
 
bool picking_mode_ = false
 
int picking_track_index_ = -1
 
uint16_t last_picked_x_ = 0
 
uint16_t last_picked_y_ = 0
 
bool has_picked_coords_ = false
 
RoomNavigationCallback room_navigation_callback_
 
ProjectChangedCallback project_changed_callback_
 
ProjectDraftChangedCallback project_draft_changed_callback_
 
ProjectSaveCallback project_save_callback_
 
bool overlay_inputs_initialized_ = false
 
std::optional< project::DungeonOverlaySettingsoverlay_inputs_model_
 
std::string overlay_track_tiles_input_
 
std::string overlay_track_stop_tiles_input_
 
std::string overlay_track_switch_tiles_input_
 
std::string overlay_track_object_ids_input_
 
std::string overlay_minecart_sprite_ids_input_
 

Friends

class MinecartTrackEditorPanelTestPeer
 

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

Definition at line 26 of file minecart_track_editor_panel.h.

Member Typedef Documentation

◆ ProjectChangedCallback

Initial value:
std::function<absl::Status(const project::DungeonOverlaySettings&)>

Definition at line 28 of file minecart_track_editor_panel.h.

◆ ProjectDraftChangedCallback

Definition at line 30 of file minecart_track_editor_panel.h.

◆ ProjectSaveCallback

using yaze::editor::MinecartTrackEditorPanel::ProjectSaveCallback = std::function<absl::Status()>

Definition at line 31 of file minecart_track_editor_panel.h.

◆ RoomNavigationCallback

using yaze::editor::MinecartTrackEditorPanel::RoomNavigationCallback = std::function<void(int room_id)>

Definition at line 71 of file minecart_track_editor_panel.h.

◆ OverlayListMember

Initial value:
std::vector<uint16_t> project::DungeonOverlaySettings::*

Definition at line 100 of file minecart_track_editor_panel.h.

Constructor & Destructor Documentation

◆ MinecartTrackEditorPanel()

yaze::editor::MinecartTrackEditorPanel::MinecartTrackEditorPanel ( )
default

Member Function Documentation

◆ GetId()

std::string yaze::editor::MinecartTrackEditorPanel::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 36 of file minecart_track_editor_panel.h.

◆ GetDisplayName()

std::string yaze::editor::MinecartTrackEditorPanel::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 37 of file minecart_track_editor_panel.h.

◆ GetIcon()

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

Material Design icon for this panel.

Returns
Icon constant (e.g., ICON_MD_LIST)

Implements yaze::editor::WindowContent.

Definition at line 38 of file minecart_track_editor_panel.h.

References ICON_MD_TRAIN.

◆ GetEditorCategory()

std::string yaze::editor::MinecartTrackEditorPanel::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 39 of file minecart_track_editor_panel.h.

◆ Draw()

◆ SetRooms()

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

◆ SetProject()

absl::Status yaze::editor::MinecartTrackEditorPanel::SetProject ( project::YazeProject * project)

◆ RebindProjectContext()

absl::Status yaze::editor::MinecartTrackEditorPanel::RebindProjectContext ( project::YazeProject * project)

◆ SetRom()

void yaze::editor::MinecartTrackEditorPanel::SetRom ( Rom * rom)
inline

◆ SaveTracks()

◆ ReloadTracks()

absl::Status yaze::editor::MinecartTrackEditorPanel::ReloadTracks ( )

Definition at line 367 of file minecart_track_editor_panel.cc.

References HasUnpublishedChanges(), LoadTracks(), and RefreshProjectBinding().

Referenced by Draw().

Here is the call graph for this function:

◆ DiscardUnpublishedChanges()

absl::Status yaze::editor::MinecartTrackEditorPanel::DiscardUnpublishedChanges ( )

Definition at line 357 of file minecart_track_editor_panel.cc.

References audit_dirty_, CancelCoordinatePicking(), loaded_, loaded_tracks_, and tracks_.

Referenced by Draw().

Here is the call graph for this function:

◆ HasUnpublishedChanges()

bool yaze::editor::MinecartTrackEditorPanel::HasUnpublishedChanges ( ) const

◆ ResolveTrackSourcePath()

absl::StatusOr< std::filesystem::path > yaze::editor::MinecartTrackEditorPanel::ResolveTrackSourcePath ( ) const

◆ UpdateTrack()

absl::Status yaze::editor::MinecartTrackEditorPanel::UpdateTrack ( size_t track_index,
const MinecartTrack & track )

◆ HasPendingProjectDraftChanges()

◆ PrepareProjectSave()

absl::Status yaze::editor::MinecartTrackEditorPanel::PrepareProjectSave ( )

Definition at line 337 of file minecart_track_editor_panel.cc.

References CommitOverlayInputsForSave().

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

Here is the call graph for this function:

◆ SetPickedCoordinates()

void yaze::editor::MinecartTrackEditorPanel::SetPickedCoordinates ( int room_id,
uint16_t camera_x,
uint16_t camera_y )

◆ IsPickingCoordinates()

bool yaze::editor::MinecartTrackEditorPanel::IsPickingCoordinates ( ) const
inline

◆ GetPickingTrackIndex()

int yaze::editor::MinecartTrackEditorPanel::GetPickingTrackIndex ( ) const
inline

◆ GetTracks()

const std::vector< MinecartTrack > & yaze::editor::MinecartTrackEditorPanel::GetTracks ( )

◆ SetRoomNavigationCallback()

void yaze::editor::MinecartTrackEditorPanel::SetRoomNavigationCallback ( RoomNavigationCallback callback)
inline

◆ SetProjectChangedCallback()

void yaze::editor::MinecartTrackEditorPanel::SetProjectChangedCallback ( ProjectChangedCallback callback)
inline

◆ SetProjectDraftChangedCallback()

void yaze::editor::MinecartTrackEditorPanel::SetProjectDraftChangedCallback ( ProjectDraftChangedCallback callback)
inline

◆ SetProjectSaveCallback()

void yaze::editor::MinecartTrackEditorPanel::SetProjectSaveCallback ( ProjectSaveCallback callback)
inline

◆ LoadTracks()

◆ ValidateLoadedManifestIdentity()

absl::Status yaze::editor::MinecartTrackEditorPanel::ValidateLoadedManifestIdentity ( ) const
private

◆ RefreshProjectBinding()

absl::Status yaze::editor::MinecartTrackEditorPanel::RefreshProjectBinding ( )
private

◆ ResetTrackSession()

void yaze::editor::MinecartTrackEditorPanel::ResetTrackSession ( )
private

◆ StartCoordinatePicking()

void yaze::editor::MinecartTrackEditorPanel::StartCoordinatePicking ( int track_index)
private

Definition at line 719 of file minecart_track_editor_panel.cc.

References picking_mode_, picking_track_index_, show_success_, and status_message_.

Referenced by Draw().

◆ CancelCoordinatePicking()

void yaze::editor::MinecartTrackEditorPanel::CancelCoordinatePicking ( )
private

◆ RebuildAuditCache()

◆ IsDefaultTrack()

bool yaze::editor::MinecartTrackEditorPanel::IsDefaultTrack ( const MinecartTrack & track) const
private

◆ DrawOverlaySettings()

◆ InitializeOverlayInputs()

◆ ClearOverlayInputs()

void yaze::editor::MinecartTrackEditorPanel::ClearOverlayInputs ( )
private

◆ UpdateOverlayList()

bool yaze::editor::MinecartTrackEditorPanel::UpdateOverlayList ( const char * label,
std::string & input,
OverlayListMember member )
private

◆ CommitOverlayList()

absl::StatusOr< bool > yaze::editor::MinecartTrackEditorPanel::CommitOverlayList ( std::string & input,
OverlayListMember member )
private

◆ CommitOverlayInputsForSave()

◆ ResetOverlaySettings()

◆ NotifyProjectChanged()

absl::Status yaze::editor::MinecartTrackEditorPanel::NotifyProjectChanged ( const project::DungeonOverlaySettings & overlay)
private

◆ NotifyProjectDraftChanged()

absl::Status yaze::editor::MinecartTrackEditorPanel::NotifyProjectDraftChanged ( )
private

Definition at line 608 of file minecart_track_editor_panel.cc.

References project_, and project_draft_changed_callback_.

Referenced by UpdateOverlayList().

◆ SaveProjectSettings()

absl::Status yaze::editor::MinecartTrackEditorPanel::SaveProjectSettings ( )
private

Definition at line 619 of file minecart_track_editor_panel.cc.

References CommitOverlayInputsForSave(), project_, yaze::project::YazeProject::project_opened(), and project_save_callback_.

Referenced by Draw().

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ MinecartTrackEditorPanelTestPeer

friend class MinecartTrackEditorPanelTestPeer
friend

Definition at line 86 of file minecart_track_editor_panel.h.

Member Data Documentation

◆ tracks_

std::vector<MinecartTrack> yaze::editor::MinecartTrackEditorPanel::tracks_
private

◆ loaded_tracks_

std::vector<MinecartTrack> yaze::editor::MinecartTrackEditorPanel::loaded_tracks_
private

◆ source_document_

std::optional<MinecartTrackSourceDocument> yaze::editor::MinecartTrackEditorPanel::source_document_
private

Definition at line 123 of file minecart_track_editor_panel.h.

Referenced by LoadTracks(), ResetTrackSession(), and SaveTracks().

◆ loaded_source_identity_

std::optional<core::MinecartTrackLayout::Source> yaze::editor::MinecartTrackEditorPanel::loaded_source_identity_
private

◆ loaded_source_path_

std::filesystem::path yaze::editor::MinecartTrackEditorPanel::loaded_source_path_
private

Definition at line 125 of file minecart_track_editor_panel.h.

Referenced by LoadTracks(), ResetTrackSession(), and SaveTracks().

◆ loaded_source_sha256_

std::string yaze::editor::MinecartTrackEditorPanel::loaded_source_sha256_
private

Definition at line 126 of file minecart_track_editor_panel.h.

Referenced by LoadTracks(), ResetTrackSession(), and SaveTracks().

◆ bound_project_filepath_

std::string yaze::editor::MinecartTrackEditorPanel::bound_project_filepath_
private

◆ bound_source_identity_

std::optional<core::MinecartTrackLayout::Source> yaze::editor::MinecartTrackEditorPanel::bound_source_identity_
private

Definition at line 128 of file minecart_track_editor_panel.h.

Referenced by RefreshProjectBinding(), and SetProject().

◆ rom_

Rom* yaze::editor::MinecartTrackEditorPanel::rom_ = nullptr
private

Definition at line 129 of file minecart_track_editor_panel.h.

Referenced by Draw(), and SetRom().

◆ rooms_

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

Definition at line 130 of file minecart_track_editor_panel.h.

Referenced by Draw(), RebuildAuditCache(), and SetRooms().

◆ project_

◆ room_audit_

std::unordered_map<int, RoomTrackAudit> yaze::editor::MinecartTrackEditorPanel::room_audit_
private

Definition at line 132 of file minecart_track_editor_panel.h.

Referenced by Draw(), and RebuildAuditCache().

◆ track_usage_rooms_

std::unordered_map<int, std::vector<int> > yaze::editor::MinecartTrackEditorPanel::track_usage_rooms_
private

Definition at line 133 of file minecart_track_editor_panel.h.

Referenced by Draw(), and RebuildAuditCache().

◆ track_subtype_used_

std::vector<bool> yaze::editor::MinecartTrackEditorPanel::track_subtype_used_
private

Definition at line 134 of file minecart_track_editor_panel.h.

Referenced by Draw(), and RebuildAuditCache().

◆ audit_dirty_

◆ load_attempted_

bool yaze::editor::MinecartTrackEditorPanel::load_attempted_ = false
private

Definition at line 136 of file minecart_track_editor_panel.h.

Referenced by Draw(), GetTracks(), LoadTracks(), and ResetTrackSession().

◆ loaded_

bool yaze::editor::MinecartTrackEditorPanel::loaded_ = false
private

◆ status_message_

◆ show_success_

◆ success_timer_

float yaze::editor::MinecartTrackEditorPanel::success_timer_ = 0.0f
private

Definition at line 140 of file minecart_track_editor_panel.h.

◆ picking_mode_

bool yaze::editor::MinecartTrackEditorPanel::picking_mode_ = false
private

◆ picking_track_index_

int yaze::editor::MinecartTrackEditorPanel::picking_track_index_ = -1
private

◆ last_picked_x_

uint16_t yaze::editor::MinecartTrackEditorPanel::last_picked_x_ = 0
private

Definition at line 147 of file minecart_track_editor_panel.h.

Referenced by SetPickedCoordinates().

◆ last_picked_y_

uint16_t yaze::editor::MinecartTrackEditorPanel::last_picked_y_ = 0
private

Definition at line 148 of file minecart_track_editor_panel.h.

Referenced by SetPickedCoordinates().

◆ has_picked_coords_

bool yaze::editor::MinecartTrackEditorPanel::has_picked_coords_ = false
private

Definition at line 149 of file minecart_track_editor_panel.h.

Referenced by SetPickedCoordinates().

◆ room_navigation_callback_

RoomNavigationCallback yaze::editor::MinecartTrackEditorPanel::room_navigation_callback_
private

Definition at line 151 of file minecart_track_editor_panel.h.

Referenced by Draw(), and SetRoomNavigationCallback().

◆ project_changed_callback_

ProjectChangedCallback yaze::editor::MinecartTrackEditorPanel::project_changed_callback_
private

◆ project_draft_changed_callback_

ProjectDraftChangedCallback yaze::editor::MinecartTrackEditorPanel::project_draft_changed_callback_
private

◆ project_save_callback_

ProjectSaveCallback yaze::editor::MinecartTrackEditorPanel::project_save_callback_
private

◆ overlay_inputs_initialized_

bool yaze::editor::MinecartTrackEditorPanel::overlay_inputs_initialized_ = false
private

◆ overlay_inputs_model_

std::optional<project::DungeonOverlaySettings> yaze::editor::MinecartTrackEditorPanel::overlay_inputs_model_
private

◆ overlay_track_tiles_input_

std::string yaze::editor::MinecartTrackEditorPanel::overlay_track_tiles_input_
private

◆ overlay_track_stop_tiles_input_

std::string yaze::editor::MinecartTrackEditorPanel::overlay_track_stop_tiles_input_
private

◆ overlay_track_switch_tiles_input_

std::string yaze::editor::MinecartTrackEditorPanel::overlay_track_switch_tiles_input_
private

◆ overlay_track_object_ids_input_

std::string yaze::editor::MinecartTrackEditorPanel::overlay_track_object_ids_input_
private

◆ overlay_minecart_sprite_ids_input_

std::string yaze::editor::MinecartTrackEditorPanel::overlay_minecart_sprite_ids_input_
private

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