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

Allows the user to view and edit in game palettes. More...

#include <palette_editor.h>

Inheritance diagram for yaze::editor::PaletteEditor:

Public Member Functions

 PaletteEditor (Rom *rom=nullptr)
 
void Initialize () override
 
absl::Status Load () override
 
absl::Status Update () override
 
absl::Status Cut () override
 
absl::Status Copy () override
 
absl::Status Paste () override
 
absl::Status Undo () override
 
absl::Status Redo () override
 
absl::Status Find () override
 
absl::Status Save () override
 
void set_rom (Rom *rom)
 
Romrom () const
 
void JumpToPalette (const std::string &group_name, int palette_index)
 Jump to a specific palette by group and index.
 
- Public Member Functions inherited from yaze::editor::Editor
 Editor ()=default
 
virtual ~Editor ()=default
 
void SetDependencies (const EditorDependencies &deps)
 
virtual absl::Status Clear ()
 
EditorType type () const
 
bool * active ()
 
void set_active (bool active)
 
void toggle_active ()
 
virtual bool IsRomLoaded () const
 
virtual std::string GetRomStatus () const
 

Private Member Functions

void DrawToolset ()
 
void DrawControlPanel ()
 
void DrawQuickAccessCard ()
 
void DrawCustomPaletteCard ()
 
void DrawQuickAccessTab ()
 
void DrawCustomPalette ()
 Draw custom palette editor with enhanced ROM hacking features.
 
absl::Status DrawPaletteGroup (int category, bool right_side=false)
 
absl::Status EditColorInPalette (gfx::SnesPalette &palette, int index)
 
absl::Status ResetColorToOriginal (gfx::SnesPalette &palette, int index, const gfx::SnesPalette &originalPalette)
 
void AddRecentlyUsedColor (const gfx::SnesColor &color)
 
absl::Status HandleColorPopup (gfx::SnesPalette &palette, int i, int j, int n)
 

Private Attributes

absl::Status status_
 
gfx::SnesColor current_color_
 
GfxGroupEditor gfx_group_editor_
 
std::vector< gfx::SnesColorcustom_palette_
 
std::vector< gfx::SnesColorrecently_used_colors_
 
int edit_palette_index_ = -1
 
ImVec4 saved_palette_ [256] = {}
 
palette_internal::PaletteEditorHistory history_
 
Romrom_
 
bool show_control_panel_ = true
 
bool show_ow_main_card_ = false
 
bool show_ow_animated_card_ = false
 
bool show_dungeon_main_card_ = false
 
bool show_sprite_card_ = false
 
bool show_sprites_aux1_card_ = false
 
bool show_sprites_aux2_card_ = false
 
bool show_sprites_aux3_card_ = false
 
bool show_equipment_card_ = false
 
bool show_quick_access_ = false
 
bool show_custom_palette_ = false
 
bool control_panel_minimized_ = false
 
std::unique_ptr< OverworldMainPaletteCardow_main_card_
 
std::unique_ptr< OverworldAnimatedPaletteCardow_animated_card_
 
std::unique_ptr< DungeonMainPaletteCarddungeon_main_card_
 
std::unique_ptr< SpritePaletteCardsprite_card_
 
std::unique_ptr< SpritesAux1PaletteCardsprites_aux1_card_
 
std::unique_ptr< SpritesAux2PaletteCardsprites_aux2_card_
 
std::unique_ptr< SpritesAux3PaletteCardsprites_aux3_card_
 
std::unique_ptr< EquipmentPaletteCardequipment_card_
 

Additional Inherited Members

- Protected Member Functions inherited from yaze::editor::Editor
std::string MakeCardTitle (const std::string &base_title) const
 
std::string MakeCardId (const std::string &base_id) const
 
template<typename T >
absl::StatusOr< T > SafeRomAccess (std::function< T()> accessor, const std::string &operation="") const
 
- Protected Attributes inherited from yaze::editor::Editor
bool active_ = false
 
EditorType type_
 
EditorDependencies dependencies_
 

Detailed Description

Allows the user to view and edit in game palettes.

Definition at line 81 of file palette_editor.h.

Constructor & Destructor Documentation

◆ PaletteEditor()

yaze::editor::PaletteEditor::PaletteEditor ( Rom rom = nullptr)
inlineexplicit

Member Function Documentation

◆ Initialize()

◆ Load()

◆ Update()

◆ Cut()

absl::Status yaze::editor::PaletteEditor::Cut ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 91 of file palette_editor.h.

◆ Copy()

absl::Status yaze::editor::PaletteEditor::Copy ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 92 of file palette_editor.h.

◆ Paste()

absl::Status yaze::editor::PaletteEditor::Paste ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 93 of file palette_editor.h.

◆ Undo()

absl::Status yaze::editor::PaletteEditor::Undo ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 94 of file palette_editor.h.

◆ Redo()

absl::Status yaze::editor::PaletteEditor::Redo ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 95 of file palette_editor.h.

◆ Find()

absl::Status yaze::editor::PaletteEditor::Find ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 96 of file palette_editor.h.

◆ Save()

absl::Status yaze::editor::PaletteEditor::Save ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 97 of file palette_editor.h.

◆ set_rom()

void yaze::editor::PaletteEditor::set_rom ( Rom rom)
inline

Definition at line 99 of file palette_editor.h.

References rom(), and rom_.

Here is the call graph for this function:

◆ rom()

Rom * yaze::editor::PaletteEditor::rom ( ) const
inline

Definition at line 100 of file palette_editor.h.

References rom_.

Referenced by DrawPaletteGroup(), Load(), and set_rom().

◆ JumpToPalette()

void yaze::editor::PaletteEditor::JumpToPalette ( const std::string &  group_name,
int  palette_index 
)

◆ DrawToolset()

void yaze::editor::PaletteEditor::DrawToolset ( )
private

Definition at line 752 of file palette_editor.cc.

Referenced by DrawControlPanel().

◆ DrawControlPanel()

◆ DrawQuickAccessCard()

◆ DrawCustomPaletteCard()

◆ DrawQuickAccessTab()

◆ DrawCustomPalette()

void yaze::editor::PaletteEditor::DrawCustomPalette ( )
private

Draw custom palette editor with enhanced ROM hacking features.

Enhanced Features:

  • Drag-and-drop color reordering
  • Context menu for each color with advanced options
  • Export/import functionality for palette sharing
  • Integration with recently used colors
  • Undo/redo support for palette modifications

Performance Notes:

  • Efficient color conversion caching
  • Minimal redraws with dirty region tracking
  • Batch operations for multiple color changes

Definition at line 506 of file palette_editor.cc.

References AddRecentlyUsedColor(), yaze::gui::ConvertSnesColorToImVec4(), current_color_, custom_palette_, edit_palette_index_, yaze::editor::kColorPopupFlags, and yaze::gui::SnesColorEdit4().

Referenced by DrawQuickAccessTab().

Here is the call graph for this function:

◆ DrawPaletteGroup()

◆ EditColorInPalette()

absl::Status yaze::editor::PaletteEditor::EditColorInPalette ( gfx::SnesPalette palette,
int  index 
)
private

Definition at line 717 of file palette_editor.cc.

References AddRecentlyUsedColor(), yaze::gui::ConvertImVec4ToSnesColor(), and yaze::gfx::SnesPalette::size().

Here is the call graph for this function:

◆ ResetColorToOriginal()

absl::Status yaze::editor::PaletteEditor::ResetColorToOriginal ( gfx::SnesPalette palette,
int  index,
const gfx::SnesPalette originalPalette 
)
private

Definition at line 736 of file palette_editor.cc.

References yaze::gui::ConvertImVec4ToSnesColor(), and yaze::gfx::SnesPalette::size().

Here is the call graph for this function:

◆ AddRecentlyUsedColor()

void yaze::editor::PaletteEditor::AddRecentlyUsedColor ( const gfx::SnesColor color)
private

◆ HandleColorPopup()

Member Data Documentation

◆ status_

absl::Status yaze::editor::PaletteEditor::status_
private

Definition at line 125 of file palette_editor.h.

◆ current_color_

gfx::SnesColor yaze::editor::PaletteEditor::current_color_
private

◆ gfx_group_editor_

GfxGroupEditor yaze::editor::PaletteEditor::gfx_group_editor_
private

Definition at line 128 of file palette_editor.h.

◆ custom_palette_

std::vector<gfx::SnesColor> yaze::editor::PaletteEditor::custom_palette_
private

◆ recently_used_colors_

std::vector<gfx::SnesColor> yaze::editor::PaletteEditor::recently_used_colors_
private

Definition at line 131 of file palette_editor.h.

Referenced by AddRecentlyUsedColor(), DrawQuickAccessCard(), and DrawQuickAccessTab().

◆ edit_palette_index_

int yaze::editor::PaletteEditor::edit_palette_index_ = -1
private

Definition at line 133 of file palette_editor.h.

Referenced by DrawCustomPalette(), and DrawCustomPaletteCard().

◆ saved_palette_

ImVec4 yaze::editor::PaletteEditor::saved_palette_[256] = {}
private

Definition at line 135 of file palette_editor.h.

◆ history_

palette_internal::PaletteEditorHistory yaze::editor::PaletteEditor::history_
private

Definition at line 137 of file palette_editor.h.

Referenced by HandleColorPopup().

◆ rom_

Rom* yaze::editor::PaletteEditor::rom_
private

Definition at line 139 of file palette_editor.h.

Referenced by Load(), rom(), set_rom(), and Update().

◆ show_control_panel_

bool yaze::editor::PaletteEditor::show_control_panel_ = true
private

Definition at line 142 of file palette_editor.h.

Referenced by DrawControlPanel(), Initialize(), JumpToPalette(), and Update().

◆ show_ow_main_card_

bool yaze::editor::PaletteEditor::show_ow_main_card_ = false
private

Definition at line 143 of file palette_editor.h.

Referenced by DrawControlPanel(), Initialize(), JumpToPalette(), and Update().

◆ show_ow_animated_card_

bool yaze::editor::PaletteEditor::show_ow_animated_card_ = false
private

Definition at line 144 of file palette_editor.h.

Referenced by DrawControlPanel(), Initialize(), JumpToPalette(), and Update().

◆ show_dungeon_main_card_

bool yaze::editor::PaletteEditor::show_dungeon_main_card_ = false
private

Definition at line 145 of file palette_editor.h.

Referenced by DrawControlPanel(), Initialize(), JumpToPalette(), and Update().

◆ show_sprite_card_

bool yaze::editor::PaletteEditor::show_sprite_card_ = false
private

Definition at line 146 of file palette_editor.h.

Referenced by DrawControlPanel(), Initialize(), JumpToPalette(), and Update().

◆ show_sprites_aux1_card_

bool yaze::editor::PaletteEditor::show_sprites_aux1_card_ = false
private

Definition at line 147 of file palette_editor.h.

Referenced by Initialize(), JumpToPalette(), and Update().

◆ show_sprites_aux2_card_

bool yaze::editor::PaletteEditor::show_sprites_aux2_card_ = false
private

Definition at line 148 of file palette_editor.h.

Referenced by Initialize(), JumpToPalette(), and Update().

◆ show_sprites_aux3_card_

bool yaze::editor::PaletteEditor::show_sprites_aux3_card_ = false
private

Definition at line 149 of file palette_editor.h.

Referenced by Initialize(), JumpToPalette(), and Update().

◆ show_equipment_card_

bool yaze::editor::PaletteEditor::show_equipment_card_ = false
private

Definition at line 150 of file palette_editor.h.

Referenced by DrawControlPanel(), Initialize(), JumpToPalette(), and Update().

◆ show_quick_access_

bool yaze::editor::PaletteEditor::show_quick_access_ = false
private

Definition at line 151 of file palette_editor.h.

Referenced by DrawControlPanel(), DrawQuickAccessCard(), Initialize(), and Update().

◆ show_custom_palette_

bool yaze::editor::PaletteEditor::show_custom_palette_ = false
private

Definition at line 152 of file palette_editor.h.

Referenced by DrawControlPanel(), DrawCustomPaletteCard(), Initialize(), and Update().

◆ control_panel_minimized_

bool yaze::editor::PaletteEditor::control_panel_minimized_ = false
private

Definition at line 153 of file palette_editor.h.

Referenced by DrawControlPanel(), and Update().

◆ ow_main_card_

std::unique_ptr<OverworldMainPaletteCard> yaze::editor::PaletteEditor::ow_main_card_
private

Definition at line 156 of file palette_editor.h.

Referenced by DrawControlPanel(), JumpToPalette(), Load(), and Update().

◆ ow_animated_card_

std::unique_ptr<OverworldAnimatedPaletteCard> yaze::editor::PaletteEditor::ow_animated_card_
private

Definition at line 157 of file palette_editor.h.

Referenced by DrawControlPanel(), JumpToPalette(), Load(), and Update().

◆ dungeon_main_card_

std::unique_ptr<DungeonMainPaletteCard> yaze::editor::PaletteEditor::dungeon_main_card_
private

Definition at line 158 of file palette_editor.h.

Referenced by DrawControlPanel(), JumpToPalette(), Load(), and Update().

◆ sprite_card_

std::unique_ptr<SpritePaletteCard> yaze::editor::PaletteEditor::sprite_card_
private

Definition at line 159 of file palette_editor.h.

Referenced by DrawControlPanel(), JumpToPalette(), Load(), and Update().

◆ sprites_aux1_card_

std::unique_ptr<SpritesAux1PaletteCard> yaze::editor::PaletteEditor::sprites_aux1_card_
private

Definition at line 160 of file palette_editor.h.

Referenced by DrawControlPanel(), JumpToPalette(), Load(), and Update().

◆ sprites_aux2_card_

std::unique_ptr<SpritesAux2PaletteCard> yaze::editor::PaletteEditor::sprites_aux2_card_
private

Definition at line 161 of file palette_editor.h.

Referenced by DrawControlPanel(), JumpToPalette(), Load(), and Update().

◆ sprites_aux3_card_

std::unique_ptr<SpritesAux3PaletteCard> yaze::editor::PaletteEditor::sprites_aux3_card_
private

Definition at line 162 of file palette_editor.h.

Referenced by DrawControlPanel(), JumpToPalette(), Load(), and Update().

◆ equipment_card_

std::unique_ptr<EquipmentPaletteCard> yaze::editor::PaletteEditor::equipment_card_
private

Definition at line 163 of file palette_editor.h.

Referenced by DrawControlPanel(), JumpToPalette(), Load(), and Update().


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