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 SetGameData (zelda3::GameData *game_data) override
 
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
 
Romrom () const
 
zelda3::GameDatagame_data () const
 
EditorContext context () const
 
bool HasContext () const
 

Private Member Functions

void DrawToolset ()
 
void DrawControlPanel ()
 
void DrawQuickAccessPanel ()
 
void DrawCustomPalettePanel ()
 
void DrawCategorizedPaletteList ()
 
void DrawSearchBar ()
 
bool PassesSearchFilter (const std::string &group_name) const
 
bool * GetShowFlagForGroup (const std::string &group_name)
 
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_
 
char search_buffer_ [256] = ""
 
bool show_control_panel_ = true
 
bool control_panel_minimized_ = false
 
bool show_ow_main_panel_ = false
 
bool show_ow_animated_panel_ = false
 
bool show_dungeon_main_panel_ = false
 
bool show_sprite_panel_ = false
 
bool show_sprites_aux1_panel_ = false
 
bool show_sprites_aux2_panel_ = false
 
bool show_sprites_aux3_panel_ = false
 
bool show_equipment_panel_ = false
 
bool show_quick_access_ = false
 
bool show_custom_palette_ = false
 
OverworldMainPalettePanelow_main_panel_ = nullptr
 
OverworldAnimatedPalettePanelow_anim_panel_ = nullptr
 
DungeonMainPalettePaneldungeon_main_panel_ = nullptr
 
SpritePalettePanelsprite_global_panel_ = nullptr
 
SpritesAux1PalettePanelsprite_aux1_panel_ = nullptr
 
SpritesAux2PalettePanelsprite_aux2_panel_ = nullptr
 
SpritesAux3PalettePanelsprite_aux3_panel_ = nullptr
 
EquipmentPalettePanelequipment_panel_ = nullptr
 

Additional Inherited Members

- Protected Member Functions inherited from yaze::editor::Editor
std::string MakePanelTitle (const std::string &base_title) const
 
std::string MakePanelId (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 82 of file palette_editor.h.

Constructor & Destructor Documentation

◆ PaletteEditor()

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

Member Function Documentation

◆ Initialize()

◆ Load()

◆ Update()

absl::Status yaze::editor::PaletteEditor::Update ( )
overridevirtual

Implements yaze::editor::Editor.

Definition at line 510 of file palette_editor.cc.

◆ Cut()

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

Implements yaze::editor::Editor.

Definition at line 92 of file palette_editor.h.

◆ Copy()

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

Implements yaze::editor::Editor.

Definition at line 93 of file palette_editor.h.

◆ Paste()

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

Implements yaze::editor::Editor.

Definition at line 94 of file palette_editor.h.

◆ Undo()

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

Implements yaze::editor::Editor.

Definition at line 492 of file palette_editor.cc.

References yaze::gfx::PaletteManager::Get(), and yaze::gfx::PaletteManager::Undo().

Here is the call graph for this function:

◆ Redo()

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

Implements yaze::editor::Editor.

Definition at line 501 of file palette_editor.cc.

References yaze::gfx::PaletteManager::Get(), and yaze::gfx::PaletteManager::Redo().

Here is the call graph for this function:

◆ Find()

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

Implements yaze::editor::Editor.

Definition at line 97 of file palette_editor.h.

◆ Save()

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

Implements yaze::editor::Editor.

Definition at line 478 of file palette_editor.cc.

References yaze::gfx::PaletteManager::Get(), yaze::Rom::is_loaded(), RETURN_IF_ERROR, rom_, and yaze::Rom::set_dirty().

Here is the call graph for this function:

◆ set_rom()

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

Definition at line 100 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 101 of file palette_editor.h.

References rom_.

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

◆ SetGameData()

void yaze::editor::PaletteEditor::SetGameData ( zelda3::GameData * game_data)
inlineoverridevirtual

Reimplemented from yaze::editor::Editor.

Definition at line 104 of file palette_editor.h.

References yaze::editor::Editor::game_data(), gfx_group_editor_, yaze::editor::GfxGroupEditor::SetGameData(), and yaze::editor::Editor::SetGameData().

Here is the call graph for this function:

◆ JumpToPalette()

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

◆ DrawToolset()

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

Definition at line 846 of file palette_editor.cc.

Referenced by DrawControlPanel().

◆ DrawControlPanel()

◆ DrawQuickAccessPanel()

◆ DrawCustomPalettePanel()

◆ DrawCategorizedPaletteList()

◆ DrawSearchBar()

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

Definition at line 1303 of file palette_editor.cc.

References ICON_MD_SEARCH, and search_buffer_.

Referenced by DrawCategorizedPaletteList().

◆ PassesSearchFilter()

bool yaze::editor::PaletteEditor::PassesSearchFilter ( const std::string & group_name) const
private

Definition at line 1312 of file palette_editor.cc.

References yaze::gui::FuzzyMatch(), yaze::editor::GetGroupDisplayName(), and search_buffer_.

Referenced by DrawCategorizedPaletteList().

Here is the call graph for this function:

◆ GetShowFlagForGroup()

bool * yaze::editor::PaletteEditor::GetShowFlagForGroup ( const std::string & group_name)
private

◆ 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 584 of file palette_editor.cc.

References AddRecentlyUsedColor(), yaze::gui::ConvertSnesColorToImVec4(), current_color_, custom_palette_, edit_palette_index_, yaze::editor::kColorPopupFlags, yaze::gui::EditorNames::kPalette, yaze::gui::MakePopupId(), 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 811 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 830 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 138 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 141 of file palette_editor.h.

Referenced by Load(), and SetGameData().

◆ 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

◆ edit_palette_index_

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

Definition at line 146 of file palette_editor.h.

Referenced by DrawCustomPalette(), and DrawCustomPalettePanel().

◆ saved_palette_

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

Definition at line 148 of file palette_editor.h.

◆ history_

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

Definition at line 150 of file palette_editor.h.

Referenced by HandleColorPopup().

◆ rom_

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

Definition at line 152 of file palette_editor.h.

Referenced by Initialize(), Load(), rom(), Save(), and set_rom().

◆ search_buffer_

char yaze::editor::PaletteEditor::search_buffer_[256] = ""
private

Definition at line 155 of file palette_editor.h.

Referenced by DrawSearchBar(), and PassesSearchFilter().

◆ show_control_panel_

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

Definition at line 158 of file palette_editor.h.

Referenced by DrawControlPanel(), and Initialize().

◆ control_panel_minimized_

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

Definition at line 159 of file palette_editor.h.

Referenced by DrawControlPanel().

◆ show_ow_main_panel_

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

Definition at line 162 of file palette_editor.h.

Referenced by GetShowFlagForGroup(), and Initialize().

◆ show_ow_animated_panel_

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

Definition at line 163 of file palette_editor.h.

Referenced by GetShowFlagForGroup(), and Initialize().

◆ show_dungeon_main_panel_

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

Definition at line 164 of file palette_editor.h.

Referenced by GetShowFlagForGroup(), and Initialize().

◆ show_sprite_panel_

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

Definition at line 165 of file palette_editor.h.

Referenced by GetShowFlagForGroup(), and Initialize().

◆ show_sprites_aux1_panel_

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

Definition at line 166 of file palette_editor.h.

Referenced by GetShowFlagForGroup(), and Initialize().

◆ show_sprites_aux2_panel_

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

Definition at line 167 of file palette_editor.h.

Referenced by GetShowFlagForGroup(), and Initialize().

◆ show_sprites_aux3_panel_

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

Definition at line 168 of file palette_editor.h.

Referenced by GetShowFlagForGroup(), and Initialize().

◆ show_equipment_panel_

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

Definition at line 169 of file palette_editor.h.

Referenced by GetShowFlagForGroup(), and Initialize().

◆ show_quick_access_

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

Definition at line 170 of file palette_editor.h.

Referenced by DrawCategorizedPaletteList(), DrawQuickAccessPanel(), and Initialize().

◆ show_custom_palette_

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

◆ ow_main_panel_

OverworldMainPalettePanel* yaze::editor::PaletteEditor::ow_main_panel_ = nullptr
private

Definition at line 175 of file palette_editor.h.

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

◆ ow_anim_panel_

OverworldAnimatedPalettePanel* yaze::editor::PaletteEditor::ow_anim_panel_ = nullptr
private

Definition at line 176 of file palette_editor.h.

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

◆ dungeon_main_panel_

DungeonMainPalettePanel* yaze::editor::PaletteEditor::dungeon_main_panel_ = nullptr
private

Definition at line 177 of file palette_editor.h.

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

◆ sprite_global_panel_

SpritePalettePanel* yaze::editor::PaletteEditor::sprite_global_panel_ = nullptr
private

Definition at line 178 of file palette_editor.h.

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

◆ sprite_aux1_panel_

SpritesAux1PalettePanel* yaze::editor::PaletteEditor::sprite_aux1_panel_ = nullptr
private

Definition at line 179 of file palette_editor.h.

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

◆ sprite_aux2_panel_

SpritesAux2PalettePanel* yaze::editor::PaletteEditor::sprite_aux2_panel_ = nullptr
private

Definition at line 180 of file palette_editor.h.

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

◆ sprite_aux3_panel_

SpritesAux3PalettePanel* yaze::editor::PaletteEditor::sprite_aux3_panel_ = nullptr
private

Definition at line 181 of file palette_editor.h.

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

◆ equipment_panel_

EquipmentPalettePanel* yaze::editor::PaletteEditor::equipment_panel_ = nullptr
private

Definition at line 182 of file palette_editor.h.

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


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