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

#include <message_editor.h>

Inheritance diagram for yaze::editor::MessageEditor:

Public Member Functions

 MessageEditor (Rom *rom=nullptr)
 
 MessageEditor (Rom *rom, const EditorDependencies &deps)
 
void Initialize () override
 
absl::Status Load () override
 
absl::Status Update () override
 
void SetGameData (zelda3::GameData *game_data) override
 
void DrawMessageList ()
 
void DrawCurrentMessage ()
 
void DrawFontAtlas ()
 
void DrawTextCommands ()
 
void DrawSpecialCharacters ()
 
void DrawExpandedMessageSettings ()
 
void DrawDictionary ()
 
void DrawMessagePreview ()
 
void UpdateCurrentMessageFromText (const std::string &text)
 
bool OpenMessageById (int display_id)
 
absl::Status Save () override
 
absl::Status SaveExpandedMessages ()
 
absl::Status LoadExpandedMessagesFromRom ()
 
int CalculateExpandedBankUsage () const
 
absl::Status Cut () override
 
absl::Status Copy () override
 
absl::Status Paste () override
 
absl::Status Undo () override
 
absl::Status Redo () override
 
absl::Status Find () override
 
void Delete ()
 
void SelectAll ()
 
void set_rom (Rom *rom)
 
Romrom () const
 
- Public Member Functions inherited from yaze::editor::Editor
 Editor ()=default
 
virtual ~Editor ()=default
 
virtual void SetDependencies (const EditorDependencies &deps)
 
virtual std::string GetUndoDescription () const
 
virtual std::string GetRedoDescription () const
 
const UndoManagerundo_manager () const
 
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 PushUndoSnapshot ()
 
void FinalizePendingUndo ()
 
void ApplySnapshot (const MessageSnapshot &snapshot)
 
void ResolveFontPalette ()
 
gfx::SnesPalette BuildFallbackFontPalette () const
 
void LoadFontGraphics ()
 
void RefreshFontAtlasBitmap (const std::vector< uint8_t > &font_data)
 
void ApplyFontPalette ()
 
void EnsureFontTexturesReady ()
 
void ImportMessageBundleFromFile (const std::string &path)
 
int ResolveExpandedMessageBaseId () const
 

Private Attributes

bool case_sensitive_ = false
 
bool match_whole_word_ = false
 
std::string search_text_ = ""
 
std::array< uint8_t, 0x4000 > raw_font_gfx_data_
 
std::vector< std::string > parsed_messages_
 
std::vector< MessageDatalist_of_texts_
 
std::vector< MessageDataexpanded_messages_
 
MessageData current_message_
 
MessagePreview message_preview_
 
gfx::Bitmap font_gfx_bitmap_
 
gfx::Bitmap current_font_gfx16_bitmap_
 
gfx::SnesPalette font_preview_colors_
 
gui::Canvas font_gfx_canvas_ {"##FontGfxCanvas", ImVec2(256, 256)}
 
gui::Canvas current_font_gfx16_canvas_
 
gui::TextBox message_text_box_
 
Romrom_
 
Rom expanded_message_bin_
 
std::string expanded_message_path_
 
int expanded_message_base_id_ = 0
 
int current_message_index_ = 0
 
bool current_message_is_expanded_ = false
 
std::optional< MessageSnapshotpending_undo_before_
 
bool show_message_list_ = false
 
bool show_message_editor_ = false
 
bool show_font_atlas_ = false
 
bool show_dictionary_ = false
 
bool font_graphics_loaded_ = false
 
std::string message_bundle_status_
 
bool message_bundle_status_error_ = false
 

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_
 
UndoManager undo_manager_
 

Detailed Description

Definition at line 35 of file message_editor.h.

Constructor & Destructor Documentation

◆ MessageEditor() [1/2]

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

Definition at line 37 of file message_editor.h.

References yaze::editor::kMessage, and yaze::editor::Editor::type_.

◆ MessageEditor() [2/2]

yaze::editor::MessageEditor::MessageEditor ( Rom * rom,
const EditorDependencies & deps )
inlineexplicit

Definition at line 41 of file message_editor.h.

References yaze::editor::Editor::dependencies_.

Member Function Documentation

◆ Initialize()

◆ Load()

absl::Status yaze::editor::MessageEditor::Load ( )
overridevirtual

Implements yaze::editor::Editor.

Definition at line 332 of file message_editor.cc.

◆ Update()

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

Implements yaze::editor::Editor.

Definition at line 337 of file message_editor.cc.

◆ SetGameData()

void yaze::editor::MessageEditor::SetGameData ( zelda3::GameData * game_data)
overridevirtual

Reimplemented from yaze::editor::Editor.

Definition at line 344 of file message_editor.cc.

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

Here is the call graph for this function:

◆ DrawMessageList()

◆ DrawCurrentMessage()

◆ DrawFontAtlas()

◆ DrawTextCommands()

void yaze::editor::MessageEditor::DrawTextCommands ( )

Definition at line 760 of file message_editor.cc.

References yaze::gui::InputHexByte(), message_text_box_, yaze::gui::TextBox::text, and UpdateCurrentMessageFromText().

Referenced by Initialize().

Here is the call graph for this function:

◆ DrawSpecialCharacters()

void yaze::editor::MessageEditor::DrawSpecialCharacters ( )

Definition at line 779 of file message_editor.cc.

References message_text_box_, yaze::gui::TextBox::text, and UpdateCurrentMessageFromText().

Referenced by Initialize().

Here is the call graph for this function:

◆ DrawExpandedMessageSettings()

◆ DrawDictionary()

void yaze::editor::MessageEditor::DrawDictionary ( )

Definition at line 795 of file message_editor.cc.

References yaze::editor::MessagePreview::all_dictionaries_, yaze::util::HexWord(), yaze::editor::kMessageTableFlags, and message_preview_.

Referenced by Initialize().

Here is the call graph for this function:

◆ DrawMessagePreview()

◆ UpdateCurrentMessageFromText()

◆ OpenMessageById()

◆ Save()

◆ SaveExpandedMessages()

◆ LoadExpandedMessagesFromRom()

◆ CalculateExpandedBankUsage()

int yaze::editor::MessageEditor::CalculateExpandedBankUsage ( ) const

Definition at line 1190 of file message_editor.cc.

References expanded_messages_.

Referenced by DrawExpandedMessageSettings().

◆ Cut()

absl::Status yaze::editor::MessageEditor::Cut ( )
overridevirtual

Implements yaze::editor::Editor.

Definition at line 1200 of file message_editor.cc.

References yaze::gui::TextBox::Cut(), message_text_box_, and yaze::gui::TextBox::text.

Here is the call graph for this function:

◆ Copy()

absl::Status yaze::editor::MessageEditor::Copy ( )
overridevirtual

Implements yaze::editor::Editor.

Definition at line 1218 of file message_editor.cc.

References yaze::gui::TextBox::Copy(), message_text_box_, and yaze::gui::TextBox::selection_length.

Here is the call graph for this function:

◆ Paste()

absl::Status yaze::editor::MessageEditor::Paste ( )
overridevirtual

Implements yaze::editor::Editor.

Definition at line 1209 of file message_editor.cc.

References message_text_box_, and yaze::gui::TextBox::Paste().

Here is the call graph for this function:

◆ Undo()

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

Implements yaze::editor::Editor.

Definition at line 1327 of file message_editor.cc.

References FinalizePendingUndo(), yaze::editor::UndoManager::Undo(), and yaze::editor::Editor::undo_manager_.

Here is the call graph for this function:

◆ Redo()

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

Implements yaze::editor::Editor.

Definition at line 1332 of file message_editor.cc.

References yaze::editor::UndoManager::Redo(), and yaze::editor::Editor::undo_manager_.

Here is the call graph for this function:

◆ Find()

absl::Status yaze::editor::MessageEditor::Find ( )
overridevirtual
Todo
Implement replace functionality

Implements yaze::editor::Editor.

Definition at line 1355 of file message_editor.cc.

References case_sensitive_, match_whole_word_, and search_text_.

◆ Delete()

void yaze::editor::MessageEditor::Delete ( )

Definition at line 1336 of file message_editor.cc.

References yaze::gui::TextBox::clear(), message_text_box_, and yaze::gui::TextBox::selection_length.

Here is the call graph for this function:

◆ SelectAll()

void yaze::editor::MessageEditor::SelectAll ( )

Definition at line 1344 of file message_editor.cc.

References yaze::gui::TextBox::Focus(), message_text_box_, yaze::gui::TextBox::SelectAll(), and yaze::gui::TextBox::selection_length.

Here is the call graph for this function:

◆ set_rom()

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

Definition at line 79 of file message_editor.h.

References rom(), and rom_.

Here is the call graph for this function:

◆ rom()

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

Definition at line 80 of file message_editor.h.

References rom_.

Referenced by Initialize(), LoadFontGraphics(), Save(), and set_rom().

◆ PushUndoSnapshot()

void yaze::editor::MessageEditor::PushUndoSnapshot ( )
private

◆ FinalizePendingUndo()

void yaze::editor::MessageEditor::FinalizePendingUndo ( )
private

◆ ApplySnapshot()

◆ ResolveFontPalette()

void yaze::editor::MessageEditor::ResolveFontPalette ( )
private

◆ BuildFallbackFontPalette()

gfx::SnesPalette yaze::editor::MessageEditor::BuildFallbackFontPalette ( ) const
private

Definition at line 241 of file message_editor.cc.

Referenced by ResolveFontPalette().

◆ LoadFontGraphics()

◆ RefreshFontAtlasBitmap()

◆ ApplyFontPalette()

◆ EnsureFontTexturesReady()

◆ ImportMessageBundleFromFile()

◆ ResolveExpandedMessageBaseId()

int yaze::editor::MessageEditor::ResolveExpandedMessageBaseId ( ) const
private

Member Data Documentation

◆ case_sensitive_

bool yaze::editor::MessageEditor::case_sensitive_ = false
private

Definition at line 83 of file message_editor.h.

Referenced by Find().

◆ match_whole_word_

bool yaze::editor::MessageEditor::match_whole_word_ = false
private

Definition at line 84 of file message_editor.h.

Referenced by Find().

◆ search_text_

std::string yaze::editor::MessageEditor::search_text_ = ""
private

Definition at line 85 of file message_editor.h.

Referenced by Find().

◆ raw_font_gfx_data_

std::array<uint8_t, 0x4000> yaze::editor::MessageEditor::raw_font_gfx_data_
private

Definition at line 87 of file message_editor.h.

Referenced by LoadFontGraphics().

◆ parsed_messages_

◆ list_of_texts_

◆ expanded_messages_

◆ current_message_

◆ message_preview_

◆ font_gfx_bitmap_

gfx::Bitmap yaze::editor::MessageEditor::font_gfx_bitmap_
private

◆ current_font_gfx16_bitmap_

gfx::Bitmap yaze::editor::MessageEditor::current_font_gfx16_bitmap_
private

◆ font_preview_colors_

gfx::SnesPalette yaze::editor::MessageEditor::font_preview_colors_
private

◆ font_gfx_canvas_

gui::Canvas yaze::editor::MessageEditor::font_gfx_canvas_ {"##FontGfxCanvas", ImVec2(256, 256)}
private

Definition at line 99 of file message_editor.h.

Referenced by DrawFontAtlas().

◆ current_font_gfx16_canvas_

gui::Canvas yaze::editor::MessageEditor::current_font_gfx16_canvas_
private
Initial value:
{"##CurrentMessageGfx",
ImVec2(172 * 2, 4096)}

Definition at line 100 of file message_editor.h.

Referenced by DrawCurrentMessage().

◆ message_text_box_

gui::TextBox yaze::editor::MessageEditor::message_text_box_
private

◆ rom_

Rom* yaze::editor::MessageEditor::rom_
private

◆ expanded_message_bin_

Rom yaze::editor::MessageEditor::expanded_message_bin_
private

Definition at line 104 of file message_editor.h.

◆ expanded_message_path_

std::string yaze::editor::MessageEditor::expanded_message_path_
private

Definition at line 105 of file message_editor.h.

Referenced by DrawExpandedMessageSettings(), and LoadExpandedMessagesFromRom().

◆ expanded_message_base_id_

◆ current_message_index_

int yaze::editor::MessageEditor::current_message_index_ = 0
private

◆ current_message_is_expanded_

bool yaze::editor::MessageEditor::current_message_is_expanded_ = false
private

◆ pending_undo_before_

std::optional<MessageSnapshot> yaze::editor::MessageEditor::pending_undo_before_
private

Definition at line 111 of file message_editor.h.

Referenced by FinalizePendingUndo(), and PushUndoSnapshot().

◆ show_message_list_

bool yaze::editor::MessageEditor::show_message_list_ = false
private

Definition at line 117 of file message_editor.h.

◆ show_message_editor_

bool yaze::editor::MessageEditor::show_message_editor_ = false
private

Definition at line 118 of file message_editor.h.

◆ show_font_atlas_

bool yaze::editor::MessageEditor::show_font_atlas_ = false
private

Definition at line 119 of file message_editor.h.

◆ show_dictionary_

bool yaze::editor::MessageEditor::show_dictionary_ = false
private

Definition at line 120 of file message_editor.h.

◆ font_graphics_loaded_

bool yaze::editor::MessageEditor::font_graphics_loaded_ = false
private

Definition at line 131 of file message_editor.h.

Referenced by EnsureFontTexturesReady(), Initialize(), and LoadFontGraphics().

◆ message_bundle_status_

std::string yaze::editor::MessageEditor::message_bundle_status_
private

Definition at line 132 of file message_editor.h.

Referenced by DrawMessageList(), and ImportMessageBundleFromFile().

◆ message_bundle_status_error_

bool yaze::editor::MessageEditor::message_bundle_status_error_ = false
private

Definition at line 133 of file message_editor.h.

Referenced by DrawMessageList(), and ImportMessageBundleFromFile().


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