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

#include <layout_designer_panel.h>

Inheritance diagram for yaze::editor::layout_designer::LayoutDesignerPanel:
Collaboration diagram for yaze::editor::layout_designer::LayoutDesignerPanel:

Classes

struct  ActiveDrag
 

Public Member Functions

 LayoutDesignerPanel ()
 
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.
 
WindowLifecycle GetWindowLifecycle () const override
 Get the lifecycle category for this window.
 
void Draw (bool *p_open) override
 Draw the panel content.
 
void ReplaceTree (DockTree new_tree)
 
const DockTreetree_for_test () const
 
DockNodeId selected_id_for_test () const
 
bool has_active_drag_for_test () const
 
const TreeUndoStackundo_for_test () const
 
void set_selected_id_for_test (DockNodeId id)
 
void set_drag_id_for_test (DockNodeId id)
 
- 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 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 Member Functions

void PushUndoSnapshot ()
 
void DrawPropertiesColumn ()
 
void DrawFileRow ()
 
void DrawOpenPopup ()
 
void DrawSaveAsPopup ()
 
void SaveCurrentTreeToNamedLayouts ()
 
void LoadNamedLayoutIntoTree (const std::string &name)
 
void ApplyCurrentTreeToLiveDockspace ()
 
void SaveOrSaveAs ()
 

Private Attributes

DockTree tree_
 
DockNodeId selected_id_ = kInvalidDockNodeId
 
ActiveDrag drag_
 
std::string palette_query_
 
TreeUndoStack undo_
 
bool open_popup_requested_ = false
 
bool save_as_popup_requested_ = false
 
std::string save_as_buffer_
 
std::string open_selection_
 
std::string status_message_
 
bool status_is_error_ = false
 

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 21 of file layout_designer_panel.h.

Constructor & Destructor Documentation

◆ LayoutDesignerPanel()

yaze::editor::layout_designer::LayoutDesignerPanel::LayoutDesignerPanel ( )

Definition at line 66 of file layout_designer_panel.cc.

Member Function Documentation

◆ GetId()

std::string yaze::editor::layout_designer::LayoutDesignerPanel::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 25 of file layout_designer_panel.h.

Referenced by Draw().

◆ GetDisplayName()

std::string yaze::editor::layout_designer::LayoutDesignerPanel::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 26 of file layout_designer_panel.h.

◆ GetIcon()

std::string yaze::editor::layout_designer::LayoutDesignerPanel::GetIcon ( ) const
inlineoverridevirtual

Material Design icon for this panel.

Returns
Icon constant (e.g., ICON_MD_LIST)

Implements yaze::editor::WindowContent.

Definition at line 27 of file layout_designer_panel.h.

References ICON_MD_DASHBOARD_CUSTOMIZE.

◆ GetEditorCategory()

std::string yaze::editor::layout_designer::LayoutDesignerPanel::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 33 of file layout_designer_panel.h.

◆ GetWindowLifecycle()

WindowLifecycle yaze::editor::layout_designer::LayoutDesignerPanel::GetWindowLifecycle ( ) const
inlineoverridevirtual

Get the lifecycle category for this window.

Returns
WindowLifecycle determining visibility behavior on editor switch

Default is EditorBound (hidden when switching editors).

Reimplemented from yaze::editor::WindowContent.

Definition at line 35 of file layout_designer_panel.h.

References yaze::editor::CrossEditor.

◆ Draw()

void yaze::editor::layout_designer::LayoutDesignerPanel::Draw ( bool * p_open)
overridevirtual

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 352 of file layout_designer_panel.cc.

References yaze::gui::AcceptPanelDropWithinTarget(), yaze::editor::layout_designer::ApplyDropSuggestion(), yaze::editor::layout_designer::CollectPaletteEntries(), yaze::editor::layout_designer::ComputeDraggedSplitRatio(), yaze::editor::layout_designer::ComputeDropPreviewRect(), yaze::editor::layout_designer::ComputeLayout(), yaze::editor::layout_designer::PanelEntry::display_name, drag_, DrawFileRow(), DrawOpenPopup(), yaze::editor::layout_designer::DrawPanelPalette(), DrawPropertiesColumn(), DrawSaveAsPopup(), yaze::editor::layout_designer::DockTree::FindNode(), yaze::editor::ContentRegistry::Panels::Get(), GetId(), yaze::editor::layout_designer::HitTestNode(), yaze::editor::layout_designer::HitTestSplitBoundary(), yaze::editor::layout_designer::SplitBoundaryHit::horizontal, yaze::editor::layout_designer::PanelEntry::icon, yaze::editor::layout_designer::DockNode::id, yaze::editor::layout_designer::kInvalidDockNodeId, yaze::editor::layout_designer::DockNode::kLeaf, yaze::editor::layout_designer::kMinCellSize, yaze::editor::layout_designer::DockTree::name, yaze::editor::layout_designer::DockTreeLayout::node_rects, open_popup_requested_, palette_query_, yaze::editor::layout_designer::PanelEntry::panel_id, yaze::gui::PanelDragPayload::panel_id, yaze::editor::layout_designer::TreeUndoStack::PopLastPush(), PushUndoSnapshot(), yaze::editor::layout_designer::TreeUndoStack::Redo(), yaze::editor::layout_designer::TreeUndoStack::RedoDepth(), yaze::editor::layout_designer::RenderDockTree(), save_as_popup_requested_, SaveOrSaveAs(), selected_id_, yaze::editor::layout_designer::DockNode::split_direction, yaze::editor::layout_designer::LayoutDesignerPanel::ActiveDrag::split_id, yaze::editor::layout_designer::SplitBoundaryHit::split_node, yaze::editor::layout_designer::DockNode::split_ratio, yaze::editor::layout_designer::LayoutDesignerPanel::ActiveDrag::start_mouse, yaze::editor::layout_designer::LayoutDesignerPanel::ActiveDrag::start_ratio, yaze::editor::layout_designer::LayoutDesignerPanel::ActiveDrag::start_rect, status_is_error_, status_message_, yaze::editor::layout_designer::SuggestDrop(), tree_, yaze::editor::layout_designer::DockNode::type, yaze::editor::layout_designer::TreeUndoStack::Undo(), undo_, and yaze::editor::layout_designer::TreeUndoStack::UndoDepth().

◆ ReplaceTree()

void yaze::editor::layout_designer::LayoutDesignerPanel::ReplaceTree ( DockTree new_tree)

◆ tree_for_test()

const DockTree & yaze::editor::layout_designer::LayoutDesignerPanel::tree_for_test ( ) const
inline

Definition at line 56 of file layout_designer_panel.h.

References tree_.

◆ selected_id_for_test()

DockNodeId yaze::editor::layout_designer::LayoutDesignerPanel::selected_id_for_test ( ) const
inline

Definition at line 57 of file layout_designer_panel.h.

References selected_id_.

◆ has_active_drag_for_test()

bool yaze::editor::layout_designer::LayoutDesignerPanel::has_active_drag_for_test ( ) const
inline

◆ undo_for_test()

const TreeUndoStack & yaze::editor::layout_designer::LayoutDesignerPanel::undo_for_test ( ) const
inline

Definition at line 61 of file layout_designer_panel.h.

References undo_.

◆ set_selected_id_for_test()

void yaze::editor::layout_designer::LayoutDesignerPanel::set_selected_id_for_test ( DockNodeId id)
inline

Definition at line 65 of file layout_designer_panel.h.

References selected_id_.

◆ set_drag_id_for_test()

void yaze::editor::layout_designer::LayoutDesignerPanel::set_drag_id_for_test ( DockNodeId id)
inline

◆ PushUndoSnapshot()

void yaze::editor::layout_designer::LayoutDesignerPanel::PushUndoSnapshot ( )
private

Definition at line 68 of file layout_designer_panel.cc.

References yaze::editor::layout_designer::TreeUndoStack::Push(), tree_, and undo_.

Referenced by Draw(), and DrawPropertiesColumn().

Here is the call graph for this function:

◆ DrawPropertiesColumn()

◆ DrawFileRow()

◆ DrawOpenPopup()

void yaze::editor::layout_designer::LayoutDesignerPanel::DrawOpenPopup ( )
private

◆ DrawSaveAsPopup()

void yaze::editor::layout_designer::LayoutDesignerPanel::DrawSaveAsPopup ( )
private

Definition at line 325 of file layout_designer_panel.cc.

References yaze::editor::layout_designer::DockTree::name, save_as_buffer_, SaveCurrentTreeToNamedLayouts(), and tree_.

Referenced by Draw().

Here is the call graph for this function:

◆ SaveCurrentTreeToNamedLayouts()

◆ LoadNamedLayoutIntoTree()

void yaze::editor::layout_designer::LayoutDesignerPanel::LoadNamedLayoutIntoTree ( const std::string & name)
private

◆ ApplyCurrentTreeToLiveDockspace()

◆ SaveOrSaveAs()

void yaze::editor::layout_designer::LayoutDesignerPanel::SaveOrSaveAs ( )
private

Definition at line 195 of file layout_designer_panel.cc.

References yaze::editor::layout_designer::DockTree::name, save_as_buffer_, save_as_popup_requested_, SaveCurrentTreeToNamedLayouts(), and tree_.

Referenced by Draw(), and DrawFileRow().

Here is the call graph for this function:

Member Data Documentation

◆ tree_

◆ selected_id_

DockNodeId yaze::editor::layout_designer::LayoutDesignerPanel::selected_id_ = kInvalidDockNodeId
private

◆ drag_

ActiveDrag yaze::editor::layout_designer::LayoutDesignerPanel::drag_
private

◆ palette_query_

std::string yaze::editor::layout_designer::LayoutDesignerPanel::palette_query_
private

Definition at line 114 of file layout_designer_panel.h.

Referenced by Draw().

◆ undo_

TreeUndoStack yaze::editor::layout_designer::LayoutDesignerPanel::undo_
private

◆ open_popup_requested_

bool yaze::editor::layout_designer::LayoutDesignerPanel::open_popup_requested_ = false
private

Definition at line 119 of file layout_designer_panel.h.

Referenced by Draw(), and DrawFileRow().

◆ save_as_popup_requested_

bool yaze::editor::layout_designer::LayoutDesignerPanel::save_as_popup_requested_ = false
private

Definition at line 120 of file layout_designer_panel.h.

Referenced by Draw(), DrawFileRow(), and SaveOrSaveAs().

◆ save_as_buffer_

std::string yaze::editor::layout_designer::LayoutDesignerPanel::save_as_buffer_
private

Definition at line 121 of file layout_designer_panel.h.

Referenced by DrawFileRow(), DrawSaveAsPopup(), and SaveOrSaveAs().

◆ open_selection_

std::string yaze::editor::layout_designer::LayoutDesignerPanel::open_selection_
private

Definition at line 123 of file layout_designer_panel.h.

Referenced by DrawOpenPopup().

◆ status_message_

std::string yaze::editor::layout_designer::LayoutDesignerPanel::status_message_
private

◆ status_is_error_

bool yaze::editor::layout_designer::LayoutDesignerPanel::status_is_error_ = false
private

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