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

Shared state between GraphicsEditor panel components. More...

#include <graphics_editor_state.h>

Collaboration diagram for yaze::editor::GraphicsEditorState:

Public Member Functions

const GraphicsPaletteSelection * PreviewPalette (uint16_t sheet) const
 
const GraphicsEditTarget * SourceTarget () const
 
void SelectSourceTarget (size_t index)
 
void ClearSourceContext ()
 
void MarkSheetModified (uint16_t sheet_id)
 Mark a sheet as modified for save tracking.
 
void ClearModifiedSheets ()
 Clear modification tracking (after save)
 
void ClearModifiedSheets (const std::set< uint16_t > &sheet_ids)
 Clear specific sheets from modification tracking.
 
bool HasUnsavedChanges () const
 Check if any sheets have unsaved changes.
 
void SelectSheet (uint16_t sheet_id)
 Select a sheet for editing.
 
void HighlightTile (uint16_t sheet_id, uint16_t tile_index, const std::string &label="", double duration_secs=3.0)
 Highlight a tile in the current sheet for quick visual focus.
 
void CloseSheet (uint16_t sheet_id)
 Close a sheet tab.
 
void SetTool (PixelTool tool)
 Set the current editing tool.
 
void SetZoom (float zoom)
 Set zoom level with clamping.
 
void ZoomIn ()
 
void ZoomOut ()
 
const char * GetToolName () const
 Get tool name for status display.
 

Public Attributes

uint16_t current_sheet_id = 0
 
std::set< uint16_t > open_sheets
 
std::set< uint16_t > selected_sheets
 
PixelTool current_tool = PixelTool::kPencil
 
uint8_t current_color_index = 1
 
uint8_t brush_size = 1
 
bool fill_contiguous = true
 
float zoom_level = 4.0f
 
bool show_grid = true
 
bool show_pixel_grid = false
 
bool show_tile_boundaries = true
 
ImVec2 pan_offset = {0, 0}
 
bool show_cursor_crosshair = true
 
bool show_brush_preview = true
 
bool show_transparency_grid = true
 
bool show_pixel_info_tooltip = true
 
std::map< uint16_t, GraphicsPaletteSelection > preview_palettes
 
PixelSelection selection
 
ImVec2 selection_start
 
bool is_selecting = false
 
TileHighlight tile_highlight
 
std::set< uint16_t > modified_sheets
 
zelda3::GameData * game_data = nullptr
 
std::optional< GraphicsEditContext > source_context
 
uint64_t source_context_revision = 0
 
std::optional< uint16_t > requested_sheet_tab
 
std::array< uint64_t, 223 > arena_revisions {}
 
std::function< void()> on_before_sheet_selected
 
std::function< void(uint16_t)> on_sheet_selected
 
std::function< void()> on_tool_changed
 
std::function< void(uint16_t)> on_sheet_modified
 

Detailed Description

Shared state between GraphicsEditor panel components.

This class maintains the state that needs to be shared between the Sheet Browser, Pixel Editor, and Palette Controls panels. It provides a single source of truth for selection, current sheet, palette, and editing state.

Definition at line 96 of file graphics_editor_state.h.

Member Function Documentation

◆ PreviewPalette()

const GraphicsPaletteSelection * yaze::editor::GraphicsEditorState::PreviewPalette ( uint16_t sheet) const
inline

◆ SourceTarget()

◆ SelectSourceTarget()

void yaze::editor::GraphicsEditorState::SelectSourceTarget ( size_t index)
inline

◆ ClearSourceContext()

◆ MarkSheetModified()

void yaze::editor::GraphicsEditorState::MarkSheetModified ( uint16_t sheet_id)
inline

◆ ClearModifiedSheets() [1/2]

void yaze::editor::GraphicsEditorState::ClearModifiedSheets ( )
inline

Clear modification tracking (after save)

Definition at line 201 of file graphics_editor_state.h.

References modified_sheets.

Referenced by yaze::editor::GraphicsEditor::Save().

◆ ClearModifiedSheets() [2/2]

void yaze::editor::GraphicsEditorState::ClearModifiedSheets ( const std::set< uint16_t > & sheet_ids)
inline

Clear specific sheets from modification tracking.

Definition at line 206 of file graphics_editor_state.h.

References modified_sheets.

◆ HasUnsavedChanges()

bool yaze::editor::GraphicsEditorState::HasUnsavedChanges ( ) const
inline

◆ SelectSheet()

◆ HighlightTile()

void yaze::editor::GraphicsEditorState::HighlightTile ( uint16_t sheet_id,
uint16_t tile_index,
const std::string & label = "",
double duration_secs = 3.0 )
inline

◆ CloseSheet()

void yaze::editor::GraphicsEditorState::CloseSheet ( uint16_t sheet_id)
inline

Close a sheet tab.

Definition at line 247 of file graphics_editor_state.h.

References open_sheets.

Referenced by yaze::editor::PixelEditorPanel::DrawCanvas().

◆ SetTool()

void yaze::editor::GraphicsEditorState::SetTool ( PixelTool tool)
inline

Set the current editing tool.

Definition at line 252 of file graphics_editor_state.h.

References current_tool, and on_tool_changed.

Referenced by yaze::editor::PixelEditorPanel::DrawToolbar(), and yaze::editor::GraphicsEditor::SetPixelTool().

◆ SetZoom()

void yaze::editor::GraphicsEditorState::SetZoom ( float zoom)
inline

Set zoom level with clamping.

Definition at line 262 of file graphics_editor_state.h.

References zoom_level.

Referenced by yaze::editor::PixelEditorPanel::DrawCanvas(), yaze::editor::PixelEditorPanel::DrawStatusBar(), ZoomIn(), and ZoomOut().

◆ ZoomIn()

void yaze::editor::GraphicsEditorState::ZoomIn ( )
inline

Definition at line 264 of file graphics_editor_state.h.

References SetZoom(), and zoom_level.

Referenced by yaze::editor::PixelEditorPanel::DrawStatusBar(), and yaze::editor::GraphicsEditor::ZoomIn().

Here is the call graph for this function:

◆ ZoomOut()

void yaze::editor::GraphicsEditorState::ZoomOut ( )
inline

Definition at line 265 of file graphics_editor_state.h.

References SetZoom(), and zoom_level.

Referenced by yaze::editor::PixelEditorPanel::DrawStatusBar(), and yaze::editor::GraphicsEditor::ZoomOut().

Here is the call graph for this function:

◆ GetToolName()

Member Data Documentation

◆ current_sheet_id

uint16_t yaze::editor::GraphicsEditorState::current_sheet_id = 0

Definition at line 99 of file graphics_editor_state.h.

Referenced by yaze::editor::PixelEditorPanel::ApplyEyedropper(), yaze::editor::PixelEditorPanel::BeginStroke(), yaze::editor::GraphicsEditor::BuildContextSnapshot(), yaze::editor::anonymous_namespace{palette_controls_panel.cc}::Choose(), yaze::editor::PixelEditorPanel::ClampFloatingPaste(), yaze::editor::GraphicsEditor::ContributeStatus(), yaze::editor::PixelEditorPanel::CopyToSystemClipboard(), yaze::editor::PixelEditorPanel::CutToSystemClipboard(), yaze::editor::PixelEditorPanel::DisplayPalette(), yaze::editor::PixelEditorPanel::DisplaySheet(), yaze::editor::UsagePreviewView::Draw(), yaze::editor::PaletteControlsPanel::DrawApplyButtons(), yaze::editor::PixelEditorPanel::DrawCanvas(), yaze::editor::DrawGraphicsPreviewPaletteSelector(), yaze::editor::PaletteControlsPanel::DrawPaletteDisplay(), yaze::editor::SheetBrowserPanel::DrawSelectedSheetInfo(), yaze::editor::SheetBrowserPanel::DrawSheetThumbnail(), yaze::editor::PixelEditorPanel::DrawStatusBar(), yaze::editor::PixelEditorPanel::DrawTileHighlight(), yaze::editor::PixelEditorPanel::EndSelection(), yaze::editor::PixelEditorPanel::HandleCanvasInput(), yaze::editor::UsagePreviewView::HashWatchedSheets(), yaze::editor::GraphicsEditor::NextSheet(), yaze::editor::PixelEditorPanel::PasteFromSystemClipboard(), yaze::editor::GraphicsEditor::PrevSheet(), yaze::editor::UsagePreviewView::RefreshRoomContexts(), SelectSheet(), yaze::editor::UsagePreviewView::SharedUsesHash(), yaze::editor::UsagePreviewView::Snapshot(), SourceTarget(), yaze::editor::PixelEditorPanel::StrokeEdit(), and yaze::editor::SheetBrowserPanel::Update().

◆ open_sheets

◆ selected_sheets

◆ current_tool

◆ current_color_index

◆ brush_size

◆ fill_contiguous

bool yaze::editor::GraphicsEditorState::fill_contiguous = true

Definition at line 107 of file graphics_editor_state.h.

◆ zoom_level

◆ show_grid

bool yaze::editor::GraphicsEditorState::show_grid = true

◆ show_pixel_grid

bool yaze::editor::GraphicsEditorState::show_pixel_grid = false

◆ show_tile_boundaries

bool yaze::editor::GraphicsEditorState::show_tile_boundaries = true

◆ pan_offset

ImVec2 yaze::editor::GraphicsEditorState::pan_offset = {0, 0}

Definition at line 114 of file graphics_editor_state.h.

◆ show_cursor_crosshair

bool yaze::editor::GraphicsEditorState::show_cursor_crosshair = true

◆ show_brush_preview

bool yaze::editor::GraphicsEditorState::show_brush_preview = true

◆ show_transparency_grid

bool yaze::editor::GraphicsEditorState::show_transparency_grid = true

◆ show_pixel_info_tooltip

bool yaze::editor::GraphicsEditorState::show_pixel_info_tooltip = true

Definition at line 120 of file graphics_editor_state.h.

Referenced by yaze::editor::PixelEditorPanel::DrawCanvas().

◆ preview_palettes

◆ selection

◆ selection_start

ImVec2 yaze::editor::GraphicsEditorState::selection_start

Definition at line 133 of file graphics_editor_state.h.

◆ is_selecting

bool yaze::editor::GraphicsEditorState::is_selecting = false

◆ tile_highlight

TileHighlight yaze::editor::GraphicsEditorState::tile_highlight

◆ modified_sheets

◆ game_data

◆ source_context

◆ source_context_revision

◆ requested_sheet_tab

std::optional<uint16_t> yaze::editor::GraphicsEditorState::requested_sheet_tab

◆ arena_revisions

std::array<uint64_t, 223> yaze::editor::GraphicsEditorState::arena_revisions {}

◆ on_before_sheet_selected

std::function<void()> yaze::editor::GraphicsEditorState::on_before_sheet_selected

◆ on_sheet_selected

std::function<void(uint16_t)> yaze::editor::GraphicsEditorState::on_sheet_selected

Definition at line 182 of file graphics_editor_state.h.

Referenced by SelectSheet().

◆ on_tool_changed

std::function<void()> yaze::editor::GraphicsEditorState::on_tool_changed

Definition at line 183 of file graphics_editor_state.h.

Referenced by SetTool().

◆ on_sheet_modified

std::function<void(uint16_t)> yaze::editor::GraphicsEditorState::on_sheet_modified

Definition at line 184 of file graphics_editor_state.h.

Referenced by MarkSheetModified().


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