Base class for palette group editing cards. More...
#include <palette_group_card.h>
Inherited by yaze::editor::DungeonMainPaletteCard, yaze::editor::EquipmentPaletteCard, yaze::editor::OverworldAnimatedPaletteCard, yaze::editor::OverworldMainPaletteCard, yaze::editor::SpritePaletteCard, yaze::editor::SpritesAux1PaletteCard, yaze::editor::SpritesAux2PaletteCard, and yaze::editor::SpritesAux3PaletteCard.
Public Member Functions | |
PaletteGroupCard (const std::string &group_name, const std::string &display_name, Rom *rom) | |
Construct a new Palette Group Card. | |
virtual | ~PaletteGroupCard ()=default |
void | Draw () |
Draw the card's ImGui UI. | |
void | Show () |
void | Hide () |
bool | IsVisible () const |
bool * | visibility_flag () |
absl::Status | SaveToRom () |
Save all modified palettes to ROM. | |
void | DiscardChanges () |
Discard all unsaved changes. | |
void | ResetPalette (int palette_index) |
Reset a specific palette to original ROM values. | |
void | ResetColor (int palette_index, int color_index) |
Reset a specific color to original ROM value. | |
void | SetColor (int palette_index, int color_index, const gfx::SnesColor &new_color) |
Set a color value (records change for undo) | |
void | Undo () |
void | Redo () |
bool | CanUndo () const |
bool | CanRedo () const |
void | ClearHistory () |
bool | HasUnsavedChanges () const |
bool | IsPaletteModified (int palette_index) const |
bool | IsColorModified (int palette_index, int color_index) const |
int | GetSelectedPaletteIndex () const |
void | SetSelectedPaletteIndex (int index) |
int | GetSelectedColorIndex () const |
void | SetSelectedColorIndex (int index) |
std::string | ExportToJson () const |
absl::Status | ImportFromJson (const std::string &json) |
std::string | ExportToClipboard () const |
absl::Status | ImportFromClipboard () |
Protected Member Functions | |
virtual gfx::PaletteGroup * | GetPaletteGroup ()=0 |
Get the palette group for this card. | |
virtual const gfx::PaletteGroup * | GetPaletteGroup () const =0 |
virtual const PaletteGroupMetadata & | GetMetadata () const =0 |
Get metadata for this palette group. | |
virtual void | DrawPaletteGrid ()=0 |
Draw the palette grid specific to this palette type. | |
virtual int | GetColorsPerRow () const =0 |
Get the number of colors per row for grid layout. | |
virtual void | DrawCustomToolbarButtons () |
Draw additional toolbar buttons (called after standard buttons) | |
virtual void | DrawCustomPanels () |
Draw additional panels (called after main content) | |
void | DrawToolbar () |
Draw standard toolbar with save/discard/undo/redo. | |
void | DrawPaletteSelector () |
Draw palette selector dropdown. | |
void | DrawColorPicker () |
Draw color picker for selected color. | |
void | DrawColorInfo () |
Draw color info panel with RGB/SNES/Hex values. | |
void | DrawMetadataInfo () |
Draw palette metadata info panel. | |
void | DrawBatchOperationsPopup () |
Draw batch operations popup. | |
gfx::SnesPalette * | GetMutablePalette (int index) |
Get mutable palette by index. | |
gfx::SnesColor | GetOriginalColor (int palette_index, int color_index) const |
Get original color from ROM (for reset/comparison) | |
absl::Status | WriteColorToRom (int palette_index, int color_index, const gfx::SnesColor &color) |
Write a single color to ROM. | |
void | MarkModified (int palette_index, int color_index) |
Mark palette as modified. | |
void | ClearModified (int palette_index) |
Clear modified flags for palette. | |
Protected Attributes | |
std::string | group_name_ |
std::string | display_name_ |
Rom * | rom_ |
bool | show_ = false |
int | selected_palette_ = 0 |
int | selected_color_ = -1 |
gfx::SnesColor | editing_color_ |
bool | auto_save_enabled_ = false |
bool | show_snes_format_ = true |
bool | show_hex_format_ = true |
Base class for palette group editing cards.
Provides common functionality for all palette group editors:
Derived classes implement specific grid layouts and palette access.
Definition at line 67 of file palette_group_card.h.
yaze::editor::PaletteGroupCard::PaletteGroupCard | ( | const std::string & | group_name, |
const std::string & | display_name, | ||
Rom * | rom | ||
) |
Construct a new Palette Group Card.
group_name | Internal palette group name (e.g., "ow_main", "dungeon_main") |
display_name | Human-readable name for UI |
rom | ROM instance for reading/writing palettes |
Definition at line 24 of file palette_group_card.cc.
|
virtualdefault |
void yaze::editor::PaletteGroupCard::Draw | ( | ) |
Draw the card's ImGui UI.
Definition at line 35 of file palette_group_card.cc.
References display_name_, DrawBatchOperationsPopup(), DrawColorInfo(), DrawColorPicker(), DrawCustomPanels(), DrawMetadataInfo(), DrawPaletteGrid(), DrawPaletteSelector(), DrawToolbar(), yaze::Rom::is_loaded(), rom_, selected_color_, and show_.
|
inline |
Definition at line 90 of file palette_group_card.h.
References show_.
|
inline |
Definition at line 91 of file palette_group_card.h.
References show_.
|
inline |
Definition at line 92 of file palette_group_card.h.
References show_.
|
inline |
Definition at line 93 of file palette_group_card.h.
References show_.
absl::Status yaze::editor::PaletteGroupCard::SaveToRom | ( | ) |
Save all modified palettes to ROM.
Definition at line 407 of file palette_group_card.cc.
References yaze::gfx::PaletteManager::Get(), group_name_, and yaze::gfx::PaletteManager::SaveGroup().
Referenced by DrawToolbar().
void yaze::editor::PaletteGroupCard::DiscardChanges | ( | ) |
Discard all unsaved changes.
Definition at line 412 of file palette_group_card.cc.
References yaze::gfx::PaletteManager::DiscardGroup(), yaze::gfx::PaletteManager::Get(), group_name_, and selected_color_.
Referenced by DrawBatchOperationsPopup(), and DrawToolbar().
void yaze::editor::PaletteGroupCard::ResetPalette | ( | int | palette_index | ) |
Reset a specific palette to original ROM values.
Definition at line 420 of file palette_group_card.cc.
References yaze::gfx::PaletteManager::Get(), group_name_, and yaze::gfx::PaletteManager::ResetPalette().
Referenced by DrawPaletteSelector().
void yaze::editor::PaletteGroupCard::ResetColor | ( | int | palette_index, |
int | color_index | ||
) |
Reset a specific color to original ROM value.
Definition at line 425 of file palette_group_card.cc.
References yaze::gfx::PaletteManager::Get(), group_name_, and yaze::gfx::PaletteManager::ResetColor().
Referenced by DrawColorPicker().
void yaze::editor::PaletteGroupCard::SetColor | ( | int | palette_index, |
int | color_index, | ||
const gfx::SnesColor & | new_color | ||
) |
Set a color value (records change for undo)
Definition at line 391 of file palette_group_card.cc.
References auto_save_enabled_, yaze::gfx::PaletteManager::Get(), group_name_, yaze::gfx::PaletteManager::SetColor(), and WriteColorToRom().
Referenced by DrawColorPicker().
void yaze::editor::PaletteGroupCard::Undo | ( | ) |
Definition at line 433 of file palette_group_card.cc.
References yaze::gfx::PaletteManager::Get(), and yaze::gfx::PaletteManager::Undo().
Referenced by DrawToolbar().
void yaze::editor::PaletteGroupCard::Redo | ( | ) |
Definition at line 438 of file palette_group_card.cc.
References yaze::gfx::PaletteManager::Get(), and yaze::gfx::PaletteManager::Redo().
Referenced by DrawToolbar().
bool yaze::editor::PaletteGroupCard::CanUndo | ( | ) | const |
Definition at line 468 of file palette_group_card.cc.
References yaze::gfx::PaletteManager::CanUndo(), and yaze::gfx::PaletteManager::Get().
Referenced by DrawToolbar().
bool yaze::editor::PaletteGroupCard::CanRedo | ( | ) | const |
Definition at line 473 of file palette_group_card.cc.
References yaze::gfx::PaletteManager::CanRedo(), and yaze::gfx::PaletteManager::Get().
Referenced by DrawToolbar().
void yaze::editor::PaletteGroupCard::ClearHistory | ( | ) |
Definition at line 443 of file palette_group_card.cc.
References yaze::gfx::PaletteManager::ClearHistory(), and yaze::gfx::PaletteManager::Get().
bool yaze::editor::PaletteGroupCard::HasUnsavedChanges | ( | ) | const |
Definition at line 463 of file palette_group_card.cc.
References yaze::gfx::PaletteManager::Get(), group_name_, and yaze::gfx::PaletteManager::IsGroupModified().
bool yaze::editor::PaletteGroupCard::IsPaletteModified | ( | int | palette_index | ) | const |
Definition at line 450 of file palette_group_card.cc.
References yaze::gfx::PaletteManager::Get(), group_name_, and yaze::gfx::PaletteManager::IsPaletteModified().
Referenced by DrawPaletteSelector(), and DrawToolbar().
bool yaze::editor::PaletteGroupCard::IsColorModified | ( | int | palette_index, |
int | color_index | ||
) | const |
Definition at line 456 of file palette_group_card.cc.
References yaze::gfx::PaletteManager::Get(), group_name_, and yaze::gfx::PaletteManager::IsColorModified().
Referenced by DrawColorPicker(), yaze::editor::OverworldMainPaletteCard::DrawPaletteGrid(), yaze::editor::OverworldAnimatedPaletteCard::DrawPaletteGrid(), yaze::editor::DungeonMainPaletteCard::DrawPaletteGrid(), yaze::editor::SpritePaletteCard::DrawPaletteGrid(), yaze::editor::SpritesAux1PaletteCard::DrawPaletteGrid(), yaze::editor::SpritesAux2PaletteCard::DrawPaletteGrid(), yaze::editor::SpritesAux3PaletteCard::DrawPaletteGrid(), and yaze::editor::EquipmentPaletteCard::DrawPaletteGrid().
|
inline |
Definition at line 136 of file palette_group_card.h.
References selected_palette_.
|
inline |
Definition at line 137 of file palette_group_card.h.
References selected_palette_.
|
inline |
Definition at line 139 of file palette_group_card.h.
References selected_color_.
|
inline |
Definition at line 140 of file palette_group_card.h.
References selected_color_.
std::string yaze::editor::PaletteGroupCard::ExportToJson | ( | ) | const |
Definition at line 505 of file palette_group_card.cc.
absl::Status yaze::editor::PaletteGroupCard::ImportFromJson | ( | const std::string & | json | ) |
Definition at line 510 of file palette_group_card.cc.
std::string yaze::editor::PaletteGroupCard::ExportToClipboard | ( | ) | const |
Definition at line 515 of file palette_group_card.cc.
References GetPaletteGroup(), and selected_palette_.
Referenced by DrawBatchOperationsPopup(), and DrawToolbar().
absl::Status yaze::editor::PaletteGroupCard::ImportFromClipboard | ( | ) |
Definition at line 535 of file palette_group_card.cc.
Referenced by DrawBatchOperationsPopup(), and DrawToolbar().
|
protectedpure virtual |
Get the palette group for this card.
Implemented in yaze::editor::OverworldMainPaletteCard, yaze::editor::OverworldAnimatedPaletteCard, yaze::editor::DungeonMainPaletteCard, yaze::editor::SpritePaletteCard, yaze::editor::SpritesAux1PaletteCard, yaze::editor::SpritesAux2PaletteCard, yaze::editor::SpritesAux3PaletteCard, and yaze::editor::EquipmentPaletteCard.
Referenced by DrawPaletteSelector(), DrawToolbar(), ExportToClipboard(), and GetMutablePalette().
|
protectedpure virtual |
Implemented in yaze::editor::OverworldMainPaletteCard, yaze::editor::OverworldAnimatedPaletteCard, yaze::editor::DungeonMainPaletteCard, yaze::editor::SpritePaletteCard, yaze::editor::SpritesAux1PaletteCard, yaze::editor::SpritesAux2PaletteCard, yaze::editor::SpritesAux3PaletteCard, and yaze::editor::EquipmentPaletteCard.
|
protectedpure virtual |
Get metadata for this palette group.
Implemented in yaze::editor::OverworldMainPaletteCard, yaze::editor::OverworldAnimatedPaletteCard, yaze::editor::DungeonMainPaletteCard, yaze::editor::SpritePaletteCard, yaze::editor::SpritesAux1PaletteCard, yaze::editor::SpritesAux2PaletteCard, yaze::editor::SpritesAux3PaletteCard, and yaze::editor::EquipmentPaletteCard.
Referenced by DrawMetadataInfo().
|
protectedpure virtual |
Draw the palette grid specific to this palette type.
Implemented in yaze::editor::OverworldMainPaletteCard, yaze::editor::OverworldAnimatedPaletteCard, yaze::editor::DungeonMainPaletteCard, yaze::editor::SpritePaletteCard, yaze::editor::SpritesAux1PaletteCard, yaze::editor::SpritesAux2PaletteCard, yaze::editor::SpritesAux3PaletteCard, and yaze::editor::EquipmentPaletteCard.
Referenced by Draw().
|
protectedpure virtual |
Get the number of colors per row for grid layout.
Implemented in yaze::editor::OverworldMainPaletteCard, yaze::editor::OverworldAnimatedPaletteCard, yaze::editor::DungeonMainPaletteCard, yaze::editor::SpritePaletteCard, yaze::editor::SpritesAux1PaletteCard, yaze::editor::SpritesAux2PaletteCard, yaze::editor::SpritesAux3PaletteCard, and yaze::editor::EquipmentPaletteCard.
|
inlineprotectedvirtual |
Draw additional toolbar buttons (called after standard buttons)
Definition at line 179 of file palette_group_card.h.
Referenced by DrawToolbar().
|
inlineprotectedvirtual |
Draw additional panels (called after main content)
Reimplemented in yaze::editor::SpritePaletteCard.
Definition at line 184 of file palette_group_card.h.
Referenced by Draw().
|
protected |
Draw standard toolbar with save/discard/undo/redo.
Definition at line 89 of file palette_group_card.cc.
References CanRedo(), CanUndo(), yaze::gui::DangerButton(), DiscardChanges(), DrawCustomToolbarButtons(), ExportToClipboard(), yaze::gfx::PaletteManager::Get(), GetPaletteGroup(), group_name_, ICON_MD_EDIT, ICON_MD_FILE_DOWNLOAD, ICON_MD_FILE_UPLOAD, ICON_MD_MORE_VERT, ICON_MD_REDO, ICON_MD_SAVE, ICON_MD_UNDO, ImportFromClipboard(), yaze::gfx::PaletteManager::IsGroupModified(), IsPaletteModified(), yaze::gui::PrimaryButton(), Redo(), SaveToRom(), yaze::gui::ThemedIconButton(), and Undo().
Referenced by Draw().
|
protected |
Draw palette selector dropdown.
Definition at line 170 of file palette_group_card.cc.
References GetPaletteGroup(), yaze::gui::LayoutHelpers::GetStandardInputWidth(), ICON_MD_RESTORE, IsPaletteModified(), ResetPalette(), selected_color_, selected_palette_, and yaze::gui::ThemedIconButton().
Referenced by Draw().
|
protected |
Draw color picker for selected color.
Definition at line 211 of file palette_group_card.cc.
References yaze::gui::ConvertImVec4ToSnesColor(), yaze::gui::ConvertSnesColorToImVec4(), editing_color_, GetMutablePalette(), GetOriginalColor(), yaze::gui::LayoutHelpers::HelpMarker(), ICON_MD_RESTORE, IsColorModified(), ResetColor(), yaze::gui::SectionHeader(), selected_color_, selected_palette_, SetColor(), and yaze::gui::ThemedButton().
Referenced by Draw().
|
protected |
Draw color info panel with RGB/SNES/Hex values.
Definition at line 267 of file palette_group_card.cc.
References editing_color_, yaze::gfx::SnesColor::rgb(), yaze::gui::SectionHeader(), selected_color_, show_hex_format_, show_snes_format_, and yaze::gfx::SnesColor::snes().
Referenced by Draw().
|
protected |
Draw palette metadata info panel.
Definition at line 302 of file palette_group_card.cc.
References GetMetadata(), yaze::gui::SectionHeader(), and selected_palette_.
Referenced by Draw().
|
protected |
Draw batch operations popup.
Definition at line 364 of file palette_group_card.cc.
References DiscardChanges(), ExportToClipboard(), ImportFromClipboard(), yaze::gui::SectionHeader(), and yaze::gui::ThemedButton().
Referenced by Draw().
|
protected |
Get mutable palette by index.
Definition at line 480 of file palette_group_card.cc.
References GetPaletteGroup().
Referenced by DrawColorPicker(), yaze::editor::OverworldMainPaletteCard::DrawPaletteGrid(), yaze::editor::OverworldAnimatedPaletteCard::DrawPaletteGrid(), yaze::editor::DungeonMainPaletteCard::DrawPaletteGrid(), yaze::editor::SpritePaletteCard::DrawPaletteGrid(), yaze::editor::SpritesAux1PaletteCard::DrawPaletteGrid(), yaze::editor::SpritesAux2PaletteCard::DrawPaletteGrid(), yaze::editor::SpritesAux3PaletteCard::DrawPaletteGrid(), and yaze::editor::EquipmentPaletteCard::DrawPaletteGrid().
|
protected |
Get original color from ROM (for reset/comparison)
Definition at line 488 of file palette_group_card.cc.
References yaze::gfx::PaletteManager::Get(), yaze::gfx::PaletteManager::GetColor(), and group_name_.
Referenced by DrawColorPicker().
|
protected |
Write a single color to ROM.
Definition at line 495 of file palette_group_card.cc.
References yaze::gfx::GetPaletteAddress(), group_name_, rom_, and yaze::Rom::WriteColor().
Referenced by SetColor().
|
protected |
Mark palette as modified.
|
protected |
Clear modified flags for palette.
|
protected |
Definition at line 248 of file palette_group_card.h.
Referenced by DiscardChanges(), DrawToolbar(), GetOriginalColor(), HasUnsavedChanges(), IsColorModified(), IsPaletteModified(), ResetColor(), ResetPalette(), SaveToRom(), SetColor(), and WriteColorToRom().
|
protected |
Definition at line 249 of file palette_group_card.h.
Referenced by Draw().
|
protected |
Definition at line 250 of file palette_group_card.h.
Referenced by Draw(), yaze::editor::OverworldMainPaletteCard::GetPaletteGroup(), yaze::editor::OverworldAnimatedPaletteCard::GetPaletteGroup(), yaze::editor::DungeonMainPaletteCard::GetPaletteGroup(), yaze::editor::SpritePaletteCard::GetPaletteGroup(), yaze::editor::SpritesAux1PaletteCard::GetPaletteGroup(), yaze::editor::SpritesAux2PaletteCard::GetPaletteGroup(), yaze::editor::SpritesAux3PaletteCard::GetPaletteGroup(), yaze::editor::EquipmentPaletteCard::GetPaletteGroup(), yaze::editor::OverworldMainPaletteCard::GetPaletteGroup(), yaze::editor::OverworldAnimatedPaletteCard::GetPaletteGroup(), yaze::editor::DungeonMainPaletteCard::GetPaletteGroup(), yaze::editor::SpritePaletteCard::GetPaletteGroup(), yaze::editor::SpritesAux1PaletteCard::GetPaletteGroup(), yaze::editor::SpritesAux2PaletteCard::GetPaletteGroup(), yaze::editor::SpritesAux3PaletteCard::GetPaletteGroup(), yaze::editor::EquipmentPaletteCard::GetPaletteGroup(), and WriteColorToRom().
|
protected |
Definition at line 251 of file palette_group_card.h.
Referenced by Draw(), Hide(), IsVisible(), Show(), and visibility_flag().
|
protected |
Definition at line 254 of file palette_group_card.h.
Referenced by DrawColorPicker(), yaze::editor::SpritePaletteCard::DrawCustomPanels(), DrawMetadataInfo(), yaze::editor::OverworldMainPaletteCard::DrawPaletteGrid(), yaze::editor::OverworldAnimatedPaletteCard::DrawPaletteGrid(), yaze::editor::DungeonMainPaletteCard::DrawPaletteGrid(), yaze::editor::SpritePaletteCard::DrawPaletteGrid(), yaze::editor::SpritesAux1PaletteCard::DrawPaletteGrid(), yaze::editor::SpritesAux2PaletteCard::DrawPaletteGrid(), yaze::editor::SpritesAux3PaletteCard::DrawPaletteGrid(), yaze::editor::EquipmentPaletteCard::DrawPaletteGrid(), DrawPaletteSelector(), ExportToClipboard(), GetSelectedPaletteIndex(), and SetSelectedPaletteIndex().
|
protected |
Definition at line 255 of file palette_group_card.h.
Referenced by DiscardChanges(), Draw(), DrawColorInfo(), DrawColorPicker(), yaze::editor::OverworldMainPaletteCard::DrawPaletteGrid(), yaze::editor::OverworldAnimatedPaletteCard::DrawPaletteGrid(), yaze::editor::DungeonMainPaletteCard::DrawPaletteGrid(), yaze::editor::SpritePaletteCard::DrawPaletteGrid(), yaze::editor::SpritesAux1PaletteCard::DrawPaletteGrid(), yaze::editor::SpritesAux2PaletteCard::DrawPaletteGrid(), yaze::editor::SpritesAux3PaletteCard::DrawPaletteGrid(), yaze::editor::EquipmentPaletteCard::DrawPaletteGrid(), DrawPaletteSelector(), GetSelectedColorIndex(), and SetSelectedColorIndex().
|
protected |
Definition at line 256 of file palette_group_card.h.
Referenced by DrawColorInfo(), DrawColorPicker(), yaze::editor::OverworldMainPaletteCard::DrawPaletteGrid(), yaze::editor::OverworldAnimatedPaletteCard::DrawPaletteGrid(), yaze::editor::DungeonMainPaletteCard::DrawPaletteGrid(), yaze::editor::SpritePaletteCard::DrawPaletteGrid(), yaze::editor::SpritesAux1PaletteCard::DrawPaletteGrid(), yaze::editor::SpritesAux2PaletteCard::DrawPaletteGrid(), yaze::editor::SpritesAux3PaletteCard::DrawPaletteGrid(), and yaze::editor::EquipmentPaletteCard::DrawPaletteGrid().
|
protected |
Definition at line 259 of file palette_group_card.h.
Referenced by SetColor().
|
protected |
Definition at line 260 of file palette_group_card.h.
Referenced by DrawColorInfo().
|
protected |
Definition at line 261 of file palette_group_card.h.
Referenced by DrawColorInfo().