WindowContent for browsing and selecting graphics sheets. More...
#include <sheet_browser_panel.h>

Public Types | |
| using | LabelSetter |
| using | LabelImporter |
| using | SavePlanner |
Public Member Functions | |
| SheetBrowserPanel (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. | |
| void | Initialize () |
| Initialize the panel. | |
| void | Draw (bool *p_open) override |
| Draw the sheet browser UI. | |
| absl::Status | Update () |
| Legacy Update method for backward compatibility. | |
| void | SetDataSources (Rom *rom, zelda3::GameData *game_data, std::function< const project::YazeProject *()> project_getter) |
| Where free-block and "used by" data come from. The project getter may return null (no project open). | |
| void | RefreshInventory () |
| Rebuild the sheet inventory from the ROM buffer. Runs lazily on the first draw and when the ROM changes. | |
| const std::optional< zelda3::GfxSheetInventory > & | inventory () const |
| void | SetLabelCallbacks (LabelSetter setter, LabelImporter importer) |
| Project-label writers. Unset callbacks disable label editing. | |
| void | SetUndoManager (UndoManager *undo_manager) |
| Where PNG imports push their undo steps. Unset means no undo. | |
| void | SetSavePlanner (SavePlanner planner) |
| Source of the "Pending graphics save" preflight list (GraphicsEditor::PlanGraphicsSave). Unset hides the list. | |
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 | 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 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 | 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. | |
| void | DrawSelectedSheetInfo () |
| Storage, reserved state, free 16x16 blocks and "used by" for the current sheet. | |
| std::string | SheetLabel (uint16_t sheet) const |
| void | DrawSheetLabelEditor (uint16_t sheet_id) |
| void | DrawPngTransfer (uint16_t sheet_id) |
| absl::StatusOr< zelda3::SheetPalette > | PngPalette (int sheet_id=-1) |
| void | SetPngStatus (std::string message, bool is_error) |
| void | DrawPendingSave () |
| std::string | SheetUsageSummary (uint16_t sheet_id) const |
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) | |
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 40 of file sheet_browser_panel.h.
Definition at line 92 of file sheet_browser_panel.h.
Definition at line 94 of file sheet_browser_panel.h.
Definition at line 112 of file sheet_browser_panel.h.
|
inlineexplicit |
Definition at line 42 of file sheet_browser_panel.h.
|
inlineoverridevirtual |
Unique identifier for this panel.
IDs should be:
Implements yaze::editor::WindowContent.
Definition at line 48 of file sheet_browser_panel.h.
|
inlineoverridevirtual |
Human-readable name shown in menus and title bars.
Implements yaze::editor::WindowContent.
Definition at line 49 of file sheet_browser_panel.h.
|
inlineoverridevirtual |
Material Design icon for this panel.
Implements yaze::editor::WindowContent.
Definition at line 50 of file sheet_browser_panel.h.
References ICON_MD_VIEW_LIST.
|
inlineoverridevirtual |
Editor category this panel belongs to.
Implements yaze::editor::WindowContent.
Definition at line 51 of file sheet_browser_panel.h.
|
inlineoverridevirtual |
Get display priority for menu ordering.
Reimplemented from yaze::editor::WindowContent.
Definition at line 52 of file sheet_browser_panel.h.
| void yaze::editor::SheetBrowserPanel::Initialize | ( | ) |
Initialize the panel.
Definition at line 34 of file sheet_browser_panel.cc.
References columns_, and thumbnail_scale_.
|
overridevirtual |
Draw the sheet browser UI.
Implements yaze::editor::WindowContent.
Definition at line 40 of file sheet_browser_panel.cc.
References Update().

| absl::Status yaze::editor::SheetBrowserPanel::Update | ( | ) |
Legacy Update method for backward compatibility.
Definition at line 45 of file sheet_browser_panel.cc.
References yaze::gui::AutoRegisterLastItem(), yaze::editor::GraphicsEditorState::current_sheet_id, DrawPendingSave(), DrawPngTransfer(), DrawSearchBar(), DrawSelectedSheetInfo(), DrawSheetGrid(), inventory_, inventory_error_, inventory_rom_, RefreshInventory(), rom_, and state_.
Referenced by Draw().
| void yaze::editor::SheetBrowserPanel::SetDataSources | ( | Rom * | rom, |
| zelda3::GameData * | game_data, | ||
| std::function< const project::YazeProject *()> | project_getter ) |
Where free-block and "used by" data come from. The project getter may return null (no project open).
Definition at line 80 of file sheet_browser_panel.cc.
References game_data_, project_getter_, and rom_.
| void yaze::editor::SheetBrowserPanel::RefreshInventory | ( | ) |
Rebuild the sheet inventory from the ROM buffer. Runs lazily on the first draw and when the ROM changes.
Definition at line 88 of file sheet_browser_panel.cc.
References yaze::zelda3::BuildGfxSheetInventory(), yaze::core::BuildGfxSheetInventoryOptions(), yaze::zelda3::CollectOverworldAreaGfx(), yaze::zelda3::CollectRoomGfx(), game_data_, inventory(), inventory_, inventory_error_, inventory_rom_, yaze::Rom::is_loaded(), project_getter_, and rom_.
Referenced by DrawSelectedSheetInfo(), and Update().
|
inline |
Definition at line 88 of file sheet_browser_panel.h.
References inventory_.
Referenced by RefreshInventory().
|
inline |
Project-label writers. Unset callbacks disable label editing.
Definition at line 100 of file sheet_browser_panel.h.
References label_importer_, and label_setter_.
|
inline |
Where PNG imports push their undo steps. Unset means no undo.
Definition at line 108 of file sheet_browser_panel.h.
References undo_manager_.
|
inline |
Source of the "Pending graphics save" preflight list (GraphicsEditor::PlanGraphicsSave). Unset hides the list.
Definition at line 118 of file sheet_browser_panel.h.
References save_planner_.
|
private |
Draw the search/filter bar.
Definition at line 667 of file sheet_browser_panel.cc.
References yaze::gui::AutoRegisterLastItem(), DrawBatchOperations(), filter_max_, filter_min_, yaze::gui::LayoutHelpers::GetHexInputWidth(), HOVER_HINT, ICON_MD_TUNE, search_buffer_, yaze::editor::GraphicsEditorState::SelectSheet(), show_only_modified_, and state_.
Referenced by Update().

|
private |
Draw the sheet grid view.
Definition at line 725 of file sheet_browser_panel.cc.
References columns_, DrawSheetThumbnail(), filter_max_, filter_min_, yaze::gfx::Arena::Get(), yaze::gfx::Arena::gfx_sheets(), yaze::zelda3::kNumGfxSheets, yaze::editor::GraphicsEditorState::modified_sheets, show_only_modified_, state_, and thumbnail_scale_.
Referenced by Update().

|
private |
Draw a single sheet thumbnail.
| sheet_id | Sheet index (0-222) |
| bitmap | The bitmap to display |
Definition at line 771 of file sheet_browser_panel.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::Canvas::GetConfig(), yaze::gui::GetErrorColor(), yaze::gui::GetModifiedColor(), yaze::gui::GetSelectedColor(), yaze::gui::GetWarningColor(), yaze::gui::CanvasFrameOptions::grid_step, yaze::gui::BitmapPreviewOptions::grid_step, yaze::gfx::Bitmap::height(), inventory_, yaze::gfx::Bitmap::is_active(), yaze::gui::kPreviewOnly, yaze::editor::GraphicsEditorState::modified_sheets, yaze::editor::GraphicsEditorState::open_sheets, yaze::gui::CanvasFrameOptions::render_popups, yaze::gui::BitmapPreviewOptions::render_popups, yaze::gui::CanvasConfig::role, yaze::editor::GraphicsEditorState::selected_sheets, yaze::editor::GraphicsEditorState::SelectSheet(), SheetLabel(), show_free_blocks_, state_, thumbnail_canvas_, thumbnail_scale_, yaze::gfx::Bitmap::width(), and yaze::gui::Canvas::zero_point().
Referenced by DrawSheetGrid().
|
private |
Draw batch operation buttons.
Definition at line 703 of file sheet_browser_panel.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 DrawSearchBar().

|
private |
Storage, reserved state, free 16x16 blocks and "used by" for the current sheet.
Definition at line 186 of file sheet_browser_panel.cc.
References yaze::editor::GraphicsEditorState::current_sheet_id, DrawSheetLabelEditor(), yaze::gui::GetErrorColor(), yaze::gui::GetInfoColor(), yaze::gui::GetWarningColor(), yaze::zelda3::GfxSheetInventoryKindName(), HOVER_HINT, ICON_MD_BLOCK, ICON_MD_FLAG, ICON_MD_MEMORY, ICON_MD_REFRESH, inventory_, inventory_error_, RefreshInventory(), show_free_blocks_, and state_.
Referenced by Update().
|
private |
Definition at line 132 of file sheet_browser_panel.cc.
References yaze::core::GetGraphicsSheetLabel(), and project_getter_.
Referenced by DrawSheetLabelEditor(), and DrawSheetThumbnail().

|
private |
Definition at line 139 of file sheet_browser_panel.cc.
References HOVER_HINT, ICON_MD_UPLOAD_FILE, label_buffer_, label_edit_sheet_, label_importer_, label_setter_, label_status_, SheetLabel(), and yaze::util::FileDialogWrapper::ShowOpenFileDialog().
Referenced by DrawSelectedSheetInfo().

|
private |
Definition at line 405 of file sheet_browser_panel.cc.
References yaze::editor::ApplySheetPngImport(), yaze::editor::DescribeSheetPngImport(), yaze::zelda3::DungeonBackgroundPaletteOffset(), yaze::zelda3::ExportRoomBackgroundPng(), yaze::editor::ExportSheetPixelsPng(), yaze::util::FileDialogOptions::filters, game_data_, yaze::gfx::Arena::Get(), yaze::gui::GetErrorColor(), yaze::gui::GetInfoColor(), yaze::gui::GetWarningColor(), yaze::gfx::Arena::gfx_sheets(), yaze::gfx::Arena::gfx_sheets_owner(), HOVER_HINT, ICON_MD_CHECK, ICON_MD_CLOSE, ICON_MD_FILE_DOWNLOAD, ICON_MD_FILE_UPLOAD, yaze::zelda3::LoadRoomHeaderFromRom(), yaze::editor::GraphicsEditorState::modified_sheets, png_first_block_, png_palette_mode_, png_palette_row_, png_path_, png_pending_, png_room_, png_room_slot_, png_status_, png_status_is_error_, PngPalette(), yaze::editor::PreviewRoomPngImport(), yaze::editor::PreviewSheetPngImport(), yaze::util::ReadBinaryFile(), yaze::zelda3::ResolveAllRoomBackgroundSets(), yaze::zelda3::ResolveRoomBackgroundSet(), rom_, SetPngStatus(), yaze::util::FileDialogWrapper::ShowOpenFileDialog(), yaze::util::FileDialogWrapper::ShowSaveFileDialog(), yaze::editor::GraphicsEditorState::SourceTarget(), state_, undo_manager_, and yaze::util::WriteBinaryFile().
Referenced by Update().
|
private |
Definition at line 364 of file sheet_browser_panel.cc.
References yaze::editor::GraphicsEditorState::game_data, game_data_, yaze::zelda3::GrayscaleSheetPalette(), yaze::Rom::is_loaded(), png_palette_mode_, png_palette_row_, png_room_, png_room_slot_, yaze::zelda3::ResolveRoomSheetPalette(), rom_, yaze::zelda3::RoomBackgroundSheetPalette(), yaze::zelda3::RoomSpriteSheetPalette(), yaze::editor::GraphicsEditorState::SourceTarget(), and state_.
Referenced by DrawPngTransfer().
|
private |
Definition at line 359 of file sheet_browser_panel.cc.
References png_status_, and png_status_is_error_.
Referenced by DrawPngTransfer().
|
private |
Definition at line 305 of file sheet_browser_panel.cc.
References yaze::editor::DescribeGraphicsSavePlanEntry(), yaze::gui::GetErrorColor(), yaze::gui::GetSuccessColor(), yaze::gui::GetWarningColor(), HOVER_HINT, ICON_MD_FACT_CHECK, yaze::zelda3::kRelocated, yaze::editor::GraphicsEditorState::modified_sheets, save_plan_, save_plan_error_, save_plan_sheets_, save_planner_, SheetUsageSummary(), and state_.
Referenced by Update().
|
private |
Definition at line 285 of file sheet_browser_panel.cc.
References inventory_.
Referenced by DrawPendingSave().
|
private |
Definition at line 151 of file sheet_browser_panel.h.
Referenced by DrawBatchOperations(), DrawPendingSave(), DrawPngTransfer(), DrawSearchBar(), DrawSelectedSheetInfo(), DrawSheetGrid(), DrawSheetThumbnail(), PngPalette(), and Update().
|
private |
Definition at line 152 of file sheet_browser_panel.h.
Referenced by DrawSheetThumbnail().
|
private |
Definition at line 155 of file sheet_browser_panel.h.
Referenced by DrawSearchBar().
|
private |
Definition at line 156 of file sheet_browser_panel.h.
Referenced by DrawBatchOperations(), DrawSearchBar(), and DrawSheetGrid().
|
private |
Definition at line 157 of file sheet_browser_panel.h.
Referenced by DrawBatchOperations(), DrawSearchBar(), and DrawSheetGrid().
|
private |
Definition at line 158 of file sheet_browser_panel.h.
Referenced by DrawSearchBar(), and DrawSheetGrid().
|
private |
Definition at line 161 of file sheet_browser_panel.h.
Referenced by DrawBatchOperations(), DrawSheetGrid(), DrawSheetThumbnail(), and Initialize().
|
private |
Definition at line 162 of file sheet_browser_panel.h.
Referenced by DrawSheetGrid(), and Initialize().
|
private |
Definition at line 165 of file sheet_browser_panel.h.
Referenced by DrawPngTransfer(), PngPalette(), RefreshInventory(), SetDataSources(), and Update().
|
private |
Definition at line 166 of file sheet_browser_panel.h.
Referenced by DrawPngTransfer(), PngPalette(), RefreshInventory(), and SetDataSources().
|
private |
Definition at line 167 of file sheet_browser_panel.h.
Referenced by RefreshInventory(), SetDataSources(), and SheetLabel().
|
private |
Definition at line 168 of file sheet_browser_panel.h.
Referenced by DrawSelectedSheetInfo(), DrawSheetThumbnail(), inventory(), RefreshInventory(), SheetUsageSummary(), and Update().
|
private |
Definition at line 169 of file sheet_browser_panel.h.
Referenced by DrawSelectedSheetInfo(), RefreshInventory(), and Update().
|
private |
Definition at line 170 of file sheet_browser_panel.h.
Referenced by RefreshInventory(), and Update().
|
private |
Definition at line 171 of file sheet_browser_panel.h.
Referenced by DrawSelectedSheetInfo(), and DrawSheetThumbnail().
|
private |
Definition at line 176 of file sheet_browser_panel.h.
Referenced by DrawSheetLabelEditor(), and SetLabelCallbacks().
|
private |
Definition at line 177 of file sheet_browser_panel.h.
Referenced by DrawSheetLabelEditor(), and SetLabelCallbacks().
|
private |
Definition at line 178 of file sheet_browser_panel.h.
Referenced by DrawSheetLabelEditor().
|
private |
Definition at line 179 of file sheet_browser_panel.h.
Referenced by DrawSheetLabelEditor().
|
private |
Definition at line 180 of file sheet_browser_panel.h.
Referenced by DrawSheetLabelEditor().
|
private |
Definition at line 188 of file sheet_browser_panel.h.
Referenced by DrawPngTransfer(), and SetUndoManager().
|
private |
Definition at line 189 of file sheet_browser_panel.h.
Referenced by DrawPngTransfer(), and PngPalette().
|
private |
Definition at line 191 of file sheet_browser_panel.h.
Referenced by DrawPngTransfer(), and PngPalette().
|
private |
Definition at line 192 of file sheet_browser_panel.h.
Referenced by DrawPngTransfer(), and PngPalette().
|
private |
Definition at line 193 of file sheet_browser_panel.h.
Referenced by DrawPngTransfer(), and PngPalette().
|
private |
Definition at line 194 of file sheet_browser_panel.h.
Referenced by DrawPngTransfer().
|
private |
Definition at line 195 of file sheet_browser_panel.h.
Referenced by DrawPngTransfer().
|
private |
Definition at line 196 of file sheet_browser_panel.h.
Referenced by DrawPngTransfer().
|
private |
Definition at line 197 of file sheet_browser_panel.h.
Referenced by DrawPngTransfer(), and SetPngStatus().
|
private |
Definition at line 198 of file sheet_browser_panel.h.
Referenced by DrawPngTransfer(), and SetPngStatus().
|
private |
Definition at line 204 of file sheet_browser_panel.h.
Referenced by DrawPendingSave(), and SetSavePlanner().
|
private |
Definition at line 205 of file sheet_browser_panel.h.
Referenced by DrawPendingSave().
|
private |
Definition at line 206 of file sheet_browser_panel.h.
Referenced by DrawPendingSave().
|
private |
Definition at line 207 of file sheet_browser_panel.h.
Referenced by DrawPendingSave().