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

Interactive node graph of Oracle narrative progression. More...

#include <story_event_graph_panel.h>

Inheritance diagram for yaze::editor::StoryEventGraphPanel:
Collaboration diagram for yaze::editor::StoryEventGraphPanel:

Public Member Functions

 StoryEventGraphPanel ()=default
 
 ~StoryEventGraphPanel () override
 
void SetManifest (core::HackManifest *manifest)
 Inject manifest pointer (called by host editor or lazy-resolved).
 
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.
 
PanelCategory GetPanelCategory () const override
 Get the lifecycle category for this panel.
 
float GetPreferredWidth () const override
 Get preferred width for this panel (optional)
 
void Draw (bool *) override
 Draw the panel content.
 
- Public Member Functions inherited from yaze::editor::EditorPanel
virtual ~EditorPanel ()=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 PanelContextScope GetContextScope () const
 Optional context binding for this panel (room/selection/etc)
 
virtual PanelScope GetScope () const
 Get the registration scope for this panel.
 
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 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 DrawNodeDetail (const core::StoryEventGraph &graph)
 
void PublishJumpToRoom (int room_id) const
 
void PublishJumpToMap (int map_id) const
 
void PublishJumpToMessage (int message_id) const
 
void PublishJumpToAssemblySymbol (const std::string &symbol) const
 
uint64_t ComputeProgressionFingerprint () const
 
void DrawFilterControls (const core::StoryEventGraph &graph)
 
bool HasNonEmptyQuery () const
 
bool IsNodeVisible (const std::string &id) const
 
bool IsNodeQueryMatch (const std::string &id) const
 
void UpdateFilterCache (const core::StoryEventGraph &graph)
 
void ImportOracleSramFromFileDialog ()
 
void ClearOracleSramState ()
 
void DrawLiveSyncControls ()
 
void RefreshLiveClientBinding ()
 
void EnsureLiveSubscription ()
 
void ProcessPendingLiveRefresh ()
 
bool RefreshStateFromLiveSram ()
 
void DetachLiveListener ()
 

Static Private Member Functions

static ImU32 GetStatusColor (core::StoryNodeStatus status)
 
static std::optional< int > ParseIntLoose (const std::string &input)
 
static uint8_t StatusMask (bool completed, bool available, bool locked, bool blocked)
 

Private Attributes

core::HackManifestmanifest_ = nullptr
 
std::string selected_node_
 
float scroll_x_ = 0
 
float scroll_y_ = 0
 
float zoom_ = 1.0f
 
std::string filter_query_
 
bool hide_non_matching_ = false
 
bool show_completed_ = true
 
bool show_available_ = true
 
bool show_locked_ = true
 
bool show_blocked_ = true
 
bool filter_dirty_ = true
 
size_t last_node_count_ = 0
 
std::string last_filter_query_
 
uint8_t last_status_mask_ = 0
 
std::unordered_map< std::string, bool > node_query_match_by_id_
 
std::unordered_map< std::string, bool > node_visible_by_id_
 
std::string loaded_srm_path_
 
std::string last_srm_error_
 
std::shared_ptr< emu::mesen::MesenSocketClientlive_client_
 
emu::mesen::EventListenerId live_listener_id_ = 0
 
bool live_sync_enabled_ = true
 
bool live_subscription_active_ = false
 
std::atomic< bool > live_refresh_pending_ {false}
 
float live_refresh_interval_seconds_ = 0.10f
 
double last_live_refresh_time_ = 0.0
 
double last_subscribe_attempt_time_ = 0.0
 
std::string live_sync_error_
 
uint64_t last_progress_fp_ = 0
 

Static Private Attributes

static constexpr float kNodeWidth = 160.0f
 
static constexpr float kNodeHeight = 40.0f
 

Additional Inherited Members

- Protected Member Functions inherited from yaze::editor::EditorPanel
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

Interactive node graph of Oracle narrative progression.

Renders story events as rounded rectangles connected by Bezier curves, colored by SRAM completion state (green=completed, yellow=available, gray=locked, red=blocked).

Supports pan/zoom via mouse drag + scroll. Click a node to show detail sidebar with flags, locations, and text IDs.

Definition at line 41 of file story_event_graph_panel.h.

Constructor & Destructor Documentation

◆ StoryEventGraphPanel()

yaze::editor::StoryEventGraphPanel::StoryEventGraphPanel ( )
default

◆ ~StoryEventGraphPanel()

yaze::editor::StoryEventGraphPanel::~StoryEventGraphPanel ( )
inlineoverride

Definition at line 44 of file story_event_graph_panel.h.

References DetachLiveListener().

Here is the call graph for this function:

Member Function Documentation

◆ SetManifest()

void yaze::editor::StoryEventGraphPanel::SetManifest ( core::HackManifest * manifest)
inline

Inject manifest pointer (called by host editor or lazy-resolved).

Definition at line 49 of file story_event_graph_panel.h.

References manifest_.

◆ GetId()

std::string yaze::editor::StoryEventGraphPanel::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::EditorPanel.

Definition at line 51 of file story_event_graph_panel.h.

◆ GetDisplayName()

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

Human-readable name shown in menus and title bars.

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

Implements yaze::editor::EditorPanel.

Definition at line 52 of file story_event_graph_panel.h.

◆ GetIcon()

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

Material Design icon for this panel.

Returns
Icon constant (e.g., ICON_MD_LIST)

Implements yaze::editor::EditorPanel.

Definition at line 53 of file story_event_graph_panel.h.

References ICON_MD_ACCOUNT_TREE.

◆ GetEditorCategory()

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

Editor category this panel belongs to.

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

Implements yaze::editor::EditorPanel.

Definition at line 54 of file story_event_graph_panel.h.

◆ GetPanelCategory()

PanelCategory yaze::editor::StoryEventGraphPanel::GetPanelCategory ( ) const
inlineoverridevirtual

Get the lifecycle category for this panel.

Returns
PanelCategory determining visibility behavior on editor switch

Default is EditorBound (hidden when switching editors).

Reimplemented from yaze::editor::EditorPanel.

Definition at line 55 of file story_event_graph_panel.h.

References yaze::editor::CrossEditor.

◆ GetPreferredWidth()

float yaze::editor::StoryEventGraphPanel::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::EditorPanel.

Definition at line 58 of file story_event_graph_panel.h.

◆ Draw()

◆ GetStatusColor()

static ImU32 yaze::editor::StoryEventGraphPanel::GetStatusColor ( core::StoryNodeStatus status)
inlinestaticprivate

◆ DrawNodeDetail()

void yaze::editor::StoryEventGraphPanel::DrawNodeDetail ( const core::StoryEventGraph & graph)
inlineprivate

◆ ParseIntLoose()

static std::optional< int > yaze::editor::StoryEventGraphPanel::ParseIntLoose ( const std::string & input)
inlinestaticprivate

Definition at line 412 of file story_event_graph_panel.h.

Referenced by DrawNodeDetail().

◆ PublishJumpToRoom()

void yaze::editor::StoryEventGraphPanel::PublishJumpToRoom ( int room_id) const
inlineprivate

Definition at line 429 of file story_event_graph_panel.h.

References yaze::editor::JumpToRoomRequestEvent::Create(), and yaze::editor::ContentRegistry::Context::event_bus().

Referenced by DrawNodeDetail().

Here is the call graph for this function:

◆ PublishJumpToMap()

void yaze::editor::StoryEventGraphPanel::PublishJumpToMap ( int map_id) const
inlineprivate

Definition at line 435 of file story_event_graph_panel.h.

References yaze::editor::JumpToMapRequestEvent::Create(), and yaze::editor::ContentRegistry::Context::event_bus().

Referenced by DrawNodeDetail().

Here is the call graph for this function:

◆ PublishJumpToMessage()

void yaze::editor::StoryEventGraphPanel::PublishJumpToMessage ( int message_id) const
inlineprivate

Definition at line 441 of file story_event_graph_panel.h.

References yaze::editor::JumpToMessageRequestEvent::Create(), and yaze::editor::ContentRegistry::Context::event_bus().

Referenced by DrawNodeDetail().

Here is the call graph for this function:

◆ PublishJumpToAssemblySymbol()

void yaze::editor::StoryEventGraphPanel::PublishJumpToAssemblySymbol ( const std::string & symbol) const
inlineprivate

Definition at line 447 of file story_event_graph_panel.h.

References yaze::editor::JumpToAssemblySymbolRequestEvent::Create(), and yaze::editor::ContentRegistry::Context::event_bus().

Referenced by DrawNodeDetail().

Here is the call graph for this function:

◆ ComputeProgressionFingerprint()

uint64_t yaze::editor::StoryEventGraphPanel::ComputeProgressionFingerprint ( ) const
inlineprivate

Definition at line 453 of file story_event_graph_panel.h.

References manifest_, and yaze::core::HackManifest::oracle_progression_state().

Referenced by UpdateFilterCache().

Here is the call graph for this function:

◆ DrawFilterControls()

void yaze::editor::StoryEventGraphPanel::DrawFilterControls ( const core::StoryEventGraph & graph)
inlineprivate

◆ StatusMask()

static uint8_t yaze::editor::StoryEventGraphPanel::StatusMask ( bool completed,
bool available,
bool locked,
bool blocked )
inlinestaticprivate

Definition at line 506 of file story_event_graph_panel.h.

Referenced by UpdateFilterCache().

◆ HasNonEmptyQuery()

bool yaze::editor::StoryEventGraphPanel::HasNonEmptyQuery ( ) const
inlineprivate

Definition at line 516 of file story_event_graph_panel.h.

References filter_query_.

Referenced by Draw().

◆ IsNodeVisible()

bool yaze::editor::StoryEventGraphPanel::IsNodeVisible ( const std::string & id) const
inlineprivate

Definition at line 518 of file story_event_graph_panel.h.

References node_visible_by_id_.

Referenced by Draw(), and UpdateFilterCache().

◆ IsNodeQueryMatch()

bool yaze::editor::StoryEventGraphPanel::IsNodeQueryMatch ( const std::string & id) const
inlineprivate

Definition at line 523 of file story_event_graph_panel.h.

References node_query_match_by_id_.

Referenced by Draw().

◆ UpdateFilterCache()

◆ ImportOracleSramFromFileDialog()

void yaze::editor::StoryEventGraphPanel::ImportOracleSramFromFileDialog ( )
inlineprivate

◆ ClearOracleSramState()

void yaze::editor::StoryEventGraphPanel::ClearOracleSramState ( )
inlineprivate

Definition at line 603 of file story_event_graph_panel.h.

References yaze::core::HackManifest::ClearOracleProgressionState(), filter_dirty_, last_srm_error_, loaded_srm_path_, and manifest_.

Referenced by Draw().

Here is the call graph for this function:

◆ DrawLiveSyncControls()

void yaze::editor::StoryEventGraphPanel::DrawLiveSyncControls ( )
inlineprivate

Definition at line 611 of file story_event_graph_panel.h.

References live_client_, live_refresh_interval_seconds_, live_refresh_pending_, live_sync_enabled_, live_sync_error_, and RefreshStateFromLiveSram().

Referenced by Draw().

Here is the call graph for this function:

◆ RefreshLiveClientBinding()

void yaze::editor::StoryEventGraphPanel::RefreshLiveClientBinding ( )
inlineprivate

◆ EnsureLiveSubscription()

void yaze::editor::StoryEventGraphPanel::EnsureLiveSubscription ( )
inlineprivate

◆ ProcessPendingLiveRefresh()

void yaze::editor::StoryEventGraphPanel::ProcessPendingLiveRefresh ( )
inlineprivate

Definition at line 702 of file story_event_graph_panel.h.

References last_live_refresh_time_, live_refresh_interval_seconds_, live_refresh_pending_, live_sync_enabled_, and RefreshStateFromLiveSram().

Referenced by Draw().

Here is the call graph for this function:

◆ RefreshStateFromLiveSram()

◆ DetachLiveListener()

void yaze::editor::StoryEventGraphPanel::DetachLiveListener ( )
inlineprivate

Member Data Documentation

◆ kNodeWidth

constexpr float yaze::editor::StoryEventGraphPanel::kNodeWidth = 160.0f
staticconstexprprivate

Definition at line 290 of file story_event_graph_panel.h.

Referenced by Draw().

◆ kNodeHeight

constexpr float yaze::editor::StoryEventGraphPanel::kNodeHeight = 40.0f
staticconstexprprivate

Definition at line 291 of file story_event_graph_panel.h.

Referenced by Draw().

◆ manifest_

core::HackManifest* yaze::editor::StoryEventGraphPanel::manifest_ = nullptr
private

◆ selected_node_

std::string yaze::editor::StoryEventGraphPanel::selected_node_
private

Definition at line 774 of file story_event_graph_panel.h.

Referenced by Draw(), DrawNodeDetail(), and UpdateFilterCache().

◆ scroll_x_

float yaze::editor::StoryEventGraphPanel::scroll_x_ = 0
private

Definition at line 775 of file story_event_graph_panel.h.

Referenced by Draw().

◆ scroll_y_

float yaze::editor::StoryEventGraphPanel::scroll_y_ = 0
private

Definition at line 776 of file story_event_graph_panel.h.

Referenced by Draw().

◆ zoom_

float yaze::editor::StoryEventGraphPanel::zoom_ = 1.0f
private

Definition at line 777 of file story_event_graph_panel.h.

Referenced by Draw().

◆ filter_query_

std::string yaze::editor::StoryEventGraphPanel::filter_query_
private

◆ hide_non_matching_

bool yaze::editor::StoryEventGraphPanel::hide_non_matching_ = false
private

Definition at line 781 of file story_event_graph_panel.h.

Referenced by Draw(), DrawFilterControls(), and UpdateFilterCache().

◆ show_completed_

bool yaze::editor::StoryEventGraphPanel::show_completed_ = true
private

Definition at line 782 of file story_event_graph_panel.h.

Referenced by DrawFilterControls(), and UpdateFilterCache().

◆ show_available_

bool yaze::editor::StoryEventGraphPanel::show_available_ = true
private

Definition at line 783 of file story_event_graph_panel.h.

Referenced by DrawFilterControls(), and UpdateFilterCache().

◆ show_locked_

bool yaze::editor::StoryEventGraphPanel::show_locked_ = true
private

Definition at line 784 of file story_event_graph_panel.h.

Referenced by DrawFilterControls(), and UpdateFilterCache().

◆ show_blocked_

bool yaze::editor::StoryEventGraphPanel::show_blocked_ = true
private

Definition at line 785 of file story_event_graph_panel.h.

Referenced by DrawFilterControls(), and UpdateFilterCache().

◆ filter_dirty_

bool yaze::editor::StoryEventGraphPanel::filter_dirty_ = true
private

◆ last_node_count_

size_t yaze::editor::StoryEventGraphPanel::last_node_count_ = 0
private

Definition at line 789 of file story_event_graph_panel.h.

Referenced by UpdateFilterCache().

◆ last_filter_query_

std::string yaze::editor::StoryEventGraphPanel::last_filter_query_
private

Definition at line 790 of file story_event_graph_panel.h.

Referenced by UpdateFilterCache().

◆ last_status_mask_

uint8_t yaze::editor::StoryEventGraphPanel::last_status_mask_ = 0
private

Definition at line 791 of file story_event_graph_panel.h.

Referenced by UpdateFilterCache().

◆ node_query_match_by_id_

std::unordered_map<std::string, bool> yaze::editor::StoryEventGraphPanel::node_query_match_by_id_
private

Definition at line 792 of file story_event_graph_panel.h.

Referenced by IsNodeQueryMatch(), and UpdateFilterCache().

◆ node_visible_by_id_

std::unordered_map<std::string, bool> yaze::editor::StoryEventGraphPanel::node_visible_by_id_
private

Definition at line 793 of file story_event_graph_panel.h.

Referenced by IsNodeVisible(), and UpdateFilterCache().

◆ loaded_srm_path_

std::string yaze::editor::StoryEventGraphPanel::loaded_srm_path_
private

◆ last_srm_error_

std::string yaze::editor::StoryEventGraphPanel::last_srm_error_
private

◆ live_client_

std::shared_ptr<emu::mesen::MesenSocketClient> yaze::editor::StoryEventGraphPanel::live_client_
private

◆ live_listener_id_

emu::mesen::EventListenerId yaze::editor::StoryEventGraphPanel::live_listener_id_ = 0
private

Definition at line 800 of file story_event_graph_panel.h.

Referenced by DetachLiveListener(), and EnsureLiveSubscription().

◆ live_sync_enabled_

bool yaze::editor::StoryEventGraphPanel::live_sync_enabled_ = true
private

◆ live_subscription_active_

bool yaze::editor::StoryEventGraphPanel::live_subscription_active_ = false
private

◆ live_refresh_pending_

std::atomic<bool> yaze::editor::StoryEventGraphPanel::live_refresh_pending_ {false}
private

◆ live_refresh_interval_seconds_

float yaze::editor::StoryEventGraphPanel::live_refresh_interval_seconds_ = 0.10f
private

Definition at line 804 of file story_event_graph_panel.h.

Referenced by DrawLiveSyncControls(), and ProcessPendingLiveRefresh().

◆ last_live_refresh_time_

double yaze::editor::StoryEventGraphPanel::last_live_refresh_time_ = 0.0
private

Definition at line 805 of file story_event_graph_panel.h.

Referenced by ProcessPendingLiveRefresh().

◆ last_subscribe_attempt_time_

double yaze::editor::StoryEventGraphPanel::last_subscribe_attempt_time_ = 0.0
private

Definition at line 806 of file story_event_graph_panel.h.

Referenced by EnsureLiveSubscription().

◆ live_sync_error_

std::string yaze::editor::StoryEventGraphPanel::live_sync_error_
private

◆ last_progress_fp_

uint64_t yaze::editor::StoryEventGraphPanel::last_progress_fp_ = 0
private

Definition at line 809 of file story_event_graph_panel.h.

Referenced by UpdateFilterCache().


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