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

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
 
ImVec4 current_color
 
uint8_t brush_size = 1
 
bool fill_contiguous = true
 
float zoom_level = 4.0f
 
bool show_grid = true
 
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
 
uint64_t palette_group_index = 0
 
uint64_t palette_index = 0
 
uint64_t sub_palette_index = 0
 
bool refresh_graphics = false
 
PixelSelection selection
 
ImVec2 selection_start
 
bool is_selecting = false
 
TileHighlight tile_highlight
 
std::set< uint16_t > modified_sheets
 
std::function< void(uint16_t)> on_sheet_selected
 
std::function< void()> on_palette_changed
 
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 81 of file graphics_editor_state.h.

Member Function Documentation

◆ MarkSheetModified()

◆ ClearModifiedSheets() [1/2]

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

Clear modification tracking (after save)

Definition at line 143 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 148 of file graphics_editor_state.h.

References modified_sheets.

◆ HasUnsavedChanges()

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

Check if any sheets have unsaved changes.

Definition at line 157 of file graphics_editor_state.h.

References modified_sheets.

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

◆ SelectSheet()

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

◆ 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 187 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 192 of file graphics_editor_state.h.

References current_tool, and on_tool_changed.

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

◆ SetZoom()

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

Set zoom level with clamping.

Definition at line 202 of file graphics_editor_state.h.

References zoom_level.

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

◆ ZoomIn()

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

Definition at line 206 of file graphics_editor_state.h.

References SetZoom(), and zoom_level.

Referenced by yaze::editor::PixelEditorPanel::DrawViewControls(), and yaze::editor::GraphicsEditor::HandleEditorShortcuts().

Here is the call graph for this function:

◆ ZoomOut()

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

Definition at line 207 of file graphics_editor_state.h.

References SetZoom(), and zoom_level.

Referenced by yaze::editor::PixelEditorPanel::DrawViewControls(), and yaze::editor::GraphicsEditor::HandleEditorShortcuts().

Here is the call graph for this function:

◆ GetToolName()

const char * yaze::editor::GraphicsEditorState::GetToolName ( ) const
inline

Member Data Documentation

◆ current_sheet_id

◆ open_sheets

◆ selected_sheets

std::set<uint16_t> yaze::editor::GraphicsEditorState::selected_sheets

◆ current_tool

◆ current_color_index

◆ current_color

ImVec4 yaze::editor::GraphicsEditorState::current_color

◆ brush_size

◆ fill_contiguous

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

Definition at line 93 of file graphics_editor_state.h.

◆ zoom_level

◆ show_grid

◆ show_tile_boundaries

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

Definition at line 98 of file graphics_editor_state.h.

◆ pan_offset

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

Definition at line 99 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 105 of file graphics_editor_state.h.

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

◆ palette_group_index

◆ palette_index

◆ sub_palette_index

◆ refresh_graphics

◆ selection

◆ selection_start

ImVec2 yaze::editor::GraphicsEditorState::selection_start

Definition at line 115 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

◆ on_sheet_selected

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

Definition at line 123 of file graphics_editor_state.h.

Referenced by SelectSheet().

◆ on_palette_changed

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

Definition at line 124 of file graphics_editor_state.h.

◆ on_tool_changed

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

Definition at line 125 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 126 of file graphics_editor_state.h.

Referenced by MarkSheetModified().


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