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

WindowContent for browsing and selecting graphics sheets. More...

#include <sheet_browser_view.h>

Inheritance diagram for yaze::editor::SheetBrowserView:
Collaboration diagram for yaze::editor::SheetBrowserView:

Public Member Functions

 SheetBrowserView (GraphicsEditorState *state)
 
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.
 
bool IsVisibleByDefault () const override
 Whether this panel should be visible by default.
 
float GetPreferredWidth () const override
 Get preferred width for this panel (optional)
 
void Initialize ()
 Initialize the view.
 
void Draw (bool *p_open) override
 Draw the sheet browser UI.
 
absl::Status Update ()
 Legacy Update method for backward compatibility.
 
- 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 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 bool PreferAutoHideTabBar () const
 Whether the dock node hosting this panel should auto-hide its tab bar.
 
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 DrawSearchBar ()
 Draw the search/filter bar.
 
void DrawSheetGrid ()
 Draw the sheet grid view.
 
void DrawSheetThumbnail (int sheet_id, gfx::Bitmap &bitmap)
 Draw a single sheet thumbnail.
 
void DrawBatchOperations ()
 Draw batch operation buttons.
 

Private Attributes

GraphicsEditorStatestate_
 
gui::Canvas thumbnail_canvas_
 
char search_buffer_ [16] = {0}
 
int filter_min_ = 0
 
int filter_max_ = 222
 
bool show_only_modified_ = false
 
float thumbnail_scale_ = 2.0f
 
int columns_ = 2
 

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 browsing and selecting graphics sheets.

Displays a grid view of all 223 graphics sheets from the ROM. Supports single/multi-select, search/filter, and batch operations.

Definition at line 20 of file sheet_browser_view.h.

Constructor & Destructor Documentation

◆ SheetBrowserView()

yaze::editor::SheetBrowserView::SheetBrowserView ( GraphicsEditorState * state)
inlineexplicit

Definition at line 22 of file sheet_browser_view.h.

Member Function Documentation

◆ GetId()

std::string yaze::editor::SheetBrowserView::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 28 of file sheet_browser_view.h.

◆ GetDisplayName()

std::string yaze::editor::SheetBrowserView::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 29 of file sheet_browser_view.h.

◆ GetIcon()

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

Material Design icon for this panel.

Returns
Icon constant (e.g., ICON_MD_LIST)

Implements yaze::editor::WindowContent.

Definition at line 30 of file sheet_browser_view.h.

References ICON_MD_VIEW_LIST.

◆ GetEditorCategory()

std::string yaze::editor::SheetBrowserView::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 31 of file sheet_browser_view.h.

◆ GetPriority()

int yaze::editor::SheetBrowserView::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 32 of file sheet_browser_view.h.

◆ IsVisibleByDefault()

bool yaze::editor::SheetBrowserView::IsVisibleByDefault ( ) const
inlineoverridevirtual

Whether this panel should be visible by default.

Returns
true if panel should be visible when editor first opens

Override this to set panels as visible by default. Most panels default to hidden to reduce UI clutter.

Reimplemented from yaze::editor::WindowContent.

Definition at line 33 of file sheet_browser_view.h.

◆ GetPreferredWidth()

float yaze::editor::SheetBrowserView::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 34 of file sheet_browser_view.h.

◆ Initialize()

void yaze::editor::SheetBrowserView::Initialize ( )

Initialize the view.

Definition at line 18 of file sheet_browser_view.cc.

References columns_, and thumbnail_scale_.

◆ Draw()

void yaze::editor::SheetBrowserView::Draw ( bool * p_open)
overridevirtual

Draw the sheet browser UI.

Implements yaze::editor::WindowContent.

Definition at line 24 of file sheet_browser_view.cc.

References DrawBatchOperations(), DrawSearchBar(), and DrawSheetGrid().

Here is the call graph for this function:

◆ Update()

absl::Status yaze::editor::SheetBrowserView::Update ( )

Legacy Update method for backward compatibility.

Returns
Status of the render operation

Definition at line 33 of file sheet_browser_view.cc.

References DrawBatchOperations(), DrawSearchBar(), and DrawSheetGrid().

Here is the call graph for this function:

◆ DrawSearchBar()

void yaze::editor::SheetBrowserView::DrawSearchBar ( )
private

◆ DrawSheetGrid()

void yaze::editor::SheetBrowserView::DrawSheetGrid ( )
private

◆ DrawSheetThumbnail()

void yaze::editor::SheetBrowserView::DrawSheetThumbnail ( int sheet_id,
gfx::Bitmap & bitmap )
private

Draw a single sheet thumbnail.

Parameters
sheet_idSheet index (0-222)
bitmapThe bitmap to display

Definition at line 137 of file sheet_browser_view.cc.

References yaze::gui::Canvas::AddRectFilledAt(), yaze::gui::Canvas::AddTextAt(), yaze::gui::BeginCanvas(), yaze::gui::CanvasFrameOptions::canvas_size, yaze::gui::BitmapPreviewOptions::canvas_size, yaze::editor::GraphicsEditorState::current_sheet_id, yaze::gfx::Bitmap::depth(), yaze::gui::BitmapPreviewOptions::dest_pos, yaze::gui::BitmapPreviewOptions::dest_size, yaze::gui::CanvasFrameOptions::draw_context_menu, yaze::gui::BitmapPreviewOptions::draw_context_menu, yaze::gui::CanvasFrameOptions::draw_grid, yaze::gui::BitmapPreviewOptions::draw_grid, yaze::gui::CanvasFrameOptions::draw_overlay, yaze::gui::BitmapPreviewOptions::draw_overlay, yaze::gui::DrawBitmapPreview(), yaze::gui::EndCanvas(), yaze::gui::BitmapPreviewOptions::ensure_texture, yaze::gui::GetModifiedColor(), yaze::gui::GetSelectedColor(), yaze::gui::CanvasFrameOptions::grid_step, yaze::gui::BitmapPreviewOptions::grid_step, yaze::gfx::Bitmap::height(), yaze::gfx::Bitmap::is_active(), yaze::editor::GraphicsEditorState::modified_sheets, yaze::editor::GraphicsEditorState::open_sheets, yaze::gui::CanvasFrameOptions::render_popups, yaze::gui::BitmapPreviewOptions::render_popups, yaze::editor::GraphicsEditorState::selected_sheets, yaze::editor::GraphicsEditorState::SelectSheet(), state_, thumbnail_canvas_, thumbnail_scale_, and yaze::gfx::Bitmap::width().

Referenced by DrawSheetGrid().

◆ DrawBatchOperations()

void yaze::editor::SheetBrowserView::DrawBatchOperations ( )
private

Draw batch operation buttons.

Definition at line 72 of file sheet_browser_view.cc.

References filter_max_, filter_min_, yaze::gui::LayoutHelpers::GetSliderWidth(), ICON_MD_DESELECT, ICON_MD_SELECT_ALL, yaze::editor::GraphicsEditorState::selected_sheets, state_, and thumbnail_scale_.

Referenced by Draw(), and Update().

Here is the call graph for this function:

Member Data Documentation

◆ state_

GraphicsEditorState* yaze::editor::SheetBrowserView::state_
private

◆ thumbnail_canvas_

gui::Canvas yaze::editor::SheetBrowserView::thumbnail_canvas_
private

Definition at line 80 of file sheet_browser_view.h.

Referenced by DrawSheetThumbnail().

◆ search_buffer_

char yaze::editor::SheetBrowserView::search_buffer_[16] = {0}
private

Definition at line 83 of file sheet_browser_view.h.

Referenced by DrawSearchBar().

◆ filter_min_

int yaze::editor::SheetBrowserView::filter_min_ = 0
private

Definition at line 84 of file sheet_browser_view.h.

Referenced by DrawBatchOperations(), DrawSearchBar(), and DrawSheetGrid().

◆ filter_max_

int yaze::editor::SheetBrowserView::filter_max_ = 222
private

Definition at line 85 of file sheet_browser_view.h.

Referenced by DrawBatchOperations(), DrawSearchBar(), and DrawSheetGrid().

◆ show_only_modified_

bool yaze::editor::SheetBrowserView::show_only_modified_ = false
private

Definition at line 86 of file sheet_browser_view.h.

Referenced by DrawSearchBar(), and DrawSheetGrid().

◆ thumbnail_scale_

float yaze::editor::SheetBrowserView::thumbnail_scale_ = 2.0f
private

◆ columns_

int yaze::editor::SheetBrowserView::columns_ = 2
private

Definition at line 90 of file sheet_browser_view.h.

Referenced by DrawSheetGrid(), and Initialize().


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