#include <message_editor.h>
Classes | |
struct | TextBox |
Public Member Functions | |
MessageEditor () | |
absl::Status | Initialize () |
absl::Status | Update () override |
void | DrawMessageList () |
void | DrawCurrentMessage () |
void | DrawTextCommands () |
void | DrawDictionary () |
void | ReadAllTextDataV2 () |
void | ReadAllTextData () |
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 () |
void | Delete () |
void | SelectAll () |
DictionaryEntry | GetDictionaryFromID (uint8_t value) |
void | DrawTileToPreview (int x, int y, int srcx, int srcy, int pal, int sizex=1, int sizey=1) |
void | DrawCharacterToPreview (char c) |
void | DrawCharacterToPreview (const std::vector< uint8_t > &text) |
void | DrawStringToPreview (std::string str) |
void | DrawMessagePreview () |
std::string | DisplayTextOverflowError (int pos, bool bank) |
Public Member Functions inherited from yaze::app::editor::Editor | |
Editor ()=default | |
virtual | ~Editor ()=default |
EditorType | type () const |
Public Member Functions inherited from yaze::app::SharedRom | |
SharedRom ()=default | |
virtual | ~SharedRom ()=default |
std::shared_ptr< Rom > | shared_rom () |
auto | rom () |
Private Attributes | |
bool | skip_next = false |
bool | data_loaded_ = false |
int | text_line_ = 0 |
int | text_position_ = 0 |
int | shown_lines_ = 0 |
uint8_t | width_array [kWidthArraySize] |
std::string | search_text_ = "" |
std::vector< uint8_t > | font_gfx16_data_ |
std::vector< uint8_t > | current_font_gfx16_data_ |
std::vector< std::string > | parsed_messages_ |
std::vector< MessageData > | list_of_texts_ |
std::vector< DictionaryEntry > | all_dictionaries_ |
MessageData | current_message_ |
gfx::Bitmap | font_gfx_bitmap_ |
gfx::Bitmap | current_font_gfx16_bitmap_ |
gfx::SnesPalette | font_preview_colors_ |
gui::Canvas | font_gfx_canvas_ {"##FontGfxCanvas", ImVec2(128, 128)} |
gui::Canvas | current_font_gfx16_canvas_ |
TextBox | message_text_box_ |
Additional Inherited Members | |
Static Public Attributes inherited from yaze::app::SharedRom | |
static std::shared_ptr< Rom > | shared_rom_ = nullptr |
Protected Attributes inherited from yaze::app::editor::Editor | |
EditorType | type_ |
EditorContext | context_ |
Definition at line 39 of file message_editor.h.
|
inline |
Definition at line 41 of file message_editor.h.
References yaze::app::editor::kMessage, and yaze::app::editor::Editor::type_.
absl::Status yaze::app::editor::MessageEditor::Initialize | ( | ) |
Definition at line 47 of file message_editor.cc.
References yaze::app::gfx::SnesPalette::AddColor(), all_dictionaries_, yaze::app::editor::BuildDictionaryEntries(), current_font_gfx16_bitmap_, current_font_gfx16_data_, yaze::app::editor::DICTOFF, DrawMessagePreview(), yaze::app::editor::TextElement::Empty(), yaze::app::editor::FindMatchingCommand(), font_gfx16_data_, font_gfx_bitmap_, font_preview_colors_, yaze::app::editor::TextElement::GenericToken, GetDictionaryFromID(), yaze::app::core::Renderer::GetInstance(), yaze::app::editor::TextElement::ID, yaze::app::editor::kCharactersWidth, yaze::app::editor::kCurrentMessageHeight, yaze::app::editor::kCurrentMessageWidth, yaze::app::editor::kFontGfxMessageDepth, yaze::app::editor::kFontGfxMessageSize, yaze::app::editor::kGfxFont, yaze::app::editor::kLine2, yaze::app::editor::kLine3, yaze::app::editor::kScrollVertical, yaze::app::editor::kWidthArraySize, list_of_texts_, yaze::app::gfx::SnesPalette::mutable_color(), yaze::app::gfx::Bitmap::mutable_palette(), yaze::app::gfx::Bitmap::palette(), parsed_messages_, ReadAllTextDataV2(), RETURN_IF_ERROR, yaze::app::SharedRom::rom(), yaze::app::gfx::SnesPalette::size(), yaze::app::gfx::SnesTo8bppSheet(), yaze::app::core::UppercaseHexLong(), and width_array.
Referenced by Update().
|
overridevirtual |
Implements yaze::app::editor::Editor.
Definition at line 131 of file message_editor.cc.
References current_message_, data_loaded_, DrawCurrentMessage(), DrawDictionary(), DrawMessageList(), DrawTextCommands(), Initialize(), yaze::app::editor::kDictTableFlags, list_of_texts_, RETURN_IF_ERROR, and yaze::app::SharedRom::rom().
Referenced by yaze::app::editor::EditorManager::ManageActiveEditors().
void yaze::app::editor::MessageEditor::DrawMessageList | ( | ) |
Definition at line 164 of file message_editor.cc.
References current_message_, DrawMessagePreview(), yaze::app::editor::kMessageTableFlags, list_of_texts_, parsed_messages_, search_text_, yaze::app::core::UppercaseHexLong(), and yaze::app::core::UppercaseHexWord().
Referenced by Update().
void yaze::app::editor::MessageEditor::DrawCurrentMessage | ( | ) |
Definition at line 198 of file message_editor.cc.
References yaze::app::gui::BeginPadding(), current_font_gfx16_bitmap_, current_font_gfx16_canvas_, current_message_, yaze::app::editor::MessageData::Data, yaze::app::gui::Canvas::DrawBackground(), yaze::app::gui::Canvas::DrawBitmap(), yaze::app::gui::Canvas::DrawContextMenu(), yaze::app::gui::Canvas::DrawGrid(), DrawMessagePreview(), yaze::app::gui::Canvas::DrawOverlay(), yaze::app::gui::EndPadding(), font_gfx_bitmap_, font_gfx_canvas_, yaze::app::core::Renderer::GetInstance(), yaze::app::editor::MessageData::ID, message_text_box_, parsed_messages_, yaze::app::editor::ParseMessageToData(), yaze::app::editor::MessageEditor::TextBox::text, and yaze::app::core::Renderer::UpdateBitmap().
Referenced by Update().
void yaze::app::editor::MessageEditor::DrawTextCommands | ( | ) |
Definition at line 236 of file message_editor.cc.
Referenced by Update().
void yaze::app::editor::MessageEditor::DrawDictionary | ( | ) |
Definition at line 250 of file message_editor.cc.
References all_dictionaries_, yaze::app::editor::kDictTableFlags, and yaze::app::core::UppercaseHexWord().
Referenced by Update().
void yaze::app::editor::MessageEditor::ReadAllTextDataV2 | ( | ) |
Definition at line 271 of file message_editor.cc.
References yaze::app::editor::BANKToken, yaze::app::editor::DICTIONARYTOKEN, yaze::app::editor::TextElement::Empty(), yaze::app::editor::FindDictionaryEntry(), yaze::app::editor::FindMatchingCommand(), yaze::app::editor::FindMatchingSpecial(), yaze::app::core::Get24LocalFromPC(), yaze::app::editor::TextElement::GetParameterizedToken(), yaze::app::editor::TextElement::HasArgument, yaze::app::editor::kMessageTerminator, yaze::app::editor::kPointersDictionaries, yaze::app::editor::kTextData, yaze::app::editor::kTextData2, list_of_texts_, yaze::app::editor::ParseTextDataByte(), yaze::app::SharedRom::rom(), yaze::app::editor::TextElement::Token, and yaze::app::core::UppercaseHexWord().
Referenced by Initialize().
void yaze::app::editor::MessageEditor::ReadAllTextData | ( | ) |
Definition at line 366 of file message_editor.cc.
References yaze::app::editor::BANKToken, yaze::app::editor::DICTIONARYTOKEN, yaze::app::editor::TextElement::Empty(), yaze::app::editor::FindDictionaryEntry(), yaze::app::editor::FindMatchingCommand(), yaze::app::editor::FindMatchingSpecial(), yaze::app::core::Get24LocalFromPC(), yaze::app::editor::TextElement::GetParameterizedToken(), yaze::app::editor::TextElement::HasArgument, yaze::app::editor::kMessageTerminator, yaze::app::editor::kPointersDictionaries, yaze::app::editor::kTextData, yaze::app::editor::kTextData2, list_of_texts_, yaze::app::editor::ParseTextDataByte(), yaze::app::SharedRom::rom(), yaze::app::editor::TextElement::Token, and yaze::app::core::UppercaseHexWord().
|
overridevirtual |
Implements yaze::app::editor::Editor.
Definition at line 589 of file message_editor.cc.
References yaze::app::editor::MessageEditor::TextBox::Cut(), message_text_box_, and yaze::app::editor::MessageEditor::TextBox::text.
|
overridevirtual |
Implements yaze::app::editor::Editor.
Definition at line 607 of file message_editor.cc.
References yaze::app::editor::MessageEditor::TextBox::Copy(), message_text_box_, and yaze::app::editor::MessageEditor::TextBox::selection_length.
|
overridevirtual |
Implements yaze::app::editor::Editor.
Definition at line 598 of file message_editor.cc.
References message_text_box_, and yaze::app::editor::MessageEditor::TextBox::Paste().
|
overridevirtual |
Implements yaze::app::editor::Editor.
Definition at line 616 of file message_editor.cc.
References yaze::app::editor::MessageEditor::TextBox::can_undo, yaze::app::editor::MessageEditor::TextBox::clearUndo(), message_text_box_, and yaze::app::editor::MessageEditor::TextBox::Undo().
|
inlineoverridevirtual |
Implements yaze::app::editor::Editor.
Definition at line 57 of file message_editor.h.
|
inlineoverridevirtual |
Implements yaze::app::editor::Editor.
Definition at line 60 of file message_editor.h.
absl::Status yaze::app::editor::MessageEditor::Save | ( | ) |
Definition at line 628 of file message_editor.cc.
References DisplayTextOverflowError(), yaze::app::editor::kBlockTerminator, yaze::app::editor::kCharactersWidth, yaze::app::editor::kMessageTerminator, yaze::app::editor::kTextData, yaze::app::editor::kTextData2, yaze::app::editor::kTextData2End, yaze::app::editor::kTextDataEnd, list_of_texts_, RETURN_IF_ERROR, yaze::app::SharedRom::rom(), and width_array.
void yaze::app::editor::MessageEditor::Delete | ( | ) |
Definition at line 686 of file message_editor.cc.
References yaze::app::editor::MessageEditor::TextBox::clear(), message_text_box_, and yaze::app::editor::MessageEditor::TextBox::selection_length.
void yaze::app::editor::MessageEditor::SelectAll | ( | ) |
Definition at line 694 of file message_editor.cc.
References yaze::app::editor::MessageEditor::TextBox::Focus(), message_text_box_, yaze::app::editor::MessageEditor::TextBox::SelectAll(), and yaze::app::editor::MessageEditor::TextBox::selection_length.
DictionaryEntry yaze::app::editor::MessageEditor::GetDictionaryFromID | ( | uint8_t | value | ) |
Definition at line 476 of file message_editor.cc.
References all_dictionaries_.
Referenced by DrawCharacterToPreview(), and Initialize().
void yaze::app::editor::MessageEditor::DrawTileToPreview | ( | int | x, |
int | y, | ||
int | srcx, | ||
int | srcy, | ||
int | pal, | ||
int | sizex = 1, | ||
int | sizey = 1 ) |
Definition at line 483 of file message_editor.cc.
References current_font_gfx16_data_, and font_gfx16_data_.
Referenced by DrawCharacterToPreview().
void yaze::app::editor::MessageEditor::DrawCharacterToPreview | ( | char | c | ) |
Definition at line 521 of file message_editor.cc.
References DrawCharacterToPreview(), and yaze::app::editor::FindMatchingCharacter().
Referenced by DrawCharacterToPreview(), DrawCharacterToPreview(), DrawMessagePreview(), and DrawStringToPreview().
void yaze::app::editor::MessageEditor::DrawCharacterToPreview | ( | const std::vector< uint8_t > & | text | ) |
Definition at line 525 of file message_editor.cc.
References yaze::app::editor::DICTOFF, DrawCharacterToPreview(), DrawStringToPreview(), DrawTileToPreview(), GetDictionaryFromID(), yaze::app::editor::kLine1, yaze::app::editor::kLine2, yaze::app::editor::kLine3, yaze::app::editor::kScrollVertical, skip_next, text_line_, text_position_, and width_array.
void yaze::app::editor::MessageEditor::DrawStringToPreview | ( | std::string | str | ) |
Definition at line 515 of file message_editor.cc.
References DrawCharacterToPreview().
Referenced by DrawCharacterToPreview().
void yaze::app::editor::MessageEditor::DrawMessagePreview | ( | ) |
Definition at line 578 of file message_editor.cc.
References current_font_gfx16_data_, current_message_, yaze::app::editor::MessageData::Data, DrawCharacterToPreview(), shown_lines_, text_line_, and text_position_.
Referenced by DrawCurrentMessage(), DrawMessageList(), and Initialize().
std::string yaze::app::editor::MessageEditor::DisplayTextOverflowError | ( | int | pos, |
bool | bank ) |
Definition at line 673 of file message_editor.cc.
References yaze::app::editor::kTextData, yaze::app::editor::kTextData2, yaze::app::editor::kTextData2End, and yaze::app::editor::kTextDataEnd.
Referenced by Save().
|
private |
Definition at line 78 of file message_editor.h.
Referenced by DrawCharacterToPreview().
|
private |
Definition at line 79 of file message_editor.h.
Referenced by Update().
|
private |
Definition at line 81 of file message_editor.h.
Referenced by DrawCharacterToPreview(), and DrawMessagePreview().
|
private |
Definition at line 82 of file message_editor.h.
Referenced by DrawCharacterToPreview(), and DrawMessagePreview().
|
private |
Definition at line 83 of file message_editor.h.
Referenced by DrawMessagePreview().
|
private |
Definition at line 85 of file message_editor.h.
Referenced by DrawCharacterToPreview(), Initialize(), and Save().
|
private |
Definition at line 87 of file message_editor.h.
Referenced by DrawMessageList().
|
private |
Definition at line 89 of file message_editor.h.
Referenced by DrawTileToPreview(), and Initialize().
|
private |
Definition at line 90 of file message_editor.h.
Referenced by DrawMessagePreview(), DrawTileToPreview(), and Initialize().
|
private |
Definition at line 91 of file message_editor.h.
Referenced by DrawCurrentMessage(), DrawMessageList(), and Initialize().
|
private |
Definition at line 93 of file message_editor.h.
Referenced by DrawMessageList(), Initialize(), ReadAllTextData(), ReadAllTextDataV2(), Save(), and Update().
|
private |
Definition at line 95 of file message_editor.h.
Referenced by DrawDictionary(), GetDictionaryFromID(), and Initialize().
|
private |
Definition at line 97 of file message_editor.h.
Referenced by DrawCurrentMessage(), DrawMessageList(), DrawMessagePreview(), and Update().
|
private |
Definition at line 99 of file message_editor.h.
Referenced by DrawCurrentMessage(), and Initialize().
|
private |
Definition at line 100 of file message_editor.h.
Referenced by DrawCurrentMessage(), and Initialize().
|
private |
Definition at line 101 of file message_editor.h.
Referenced by Initialize().
|
private |
Definition at line 103 of file message_editor.h.
Referenced by DrawCurrentMessage().
|
private |
Definition at line 104 of file message_editor.h.
Referenced by DrawCurrentMessage().
|
private |
Definition at line 162 of file message_editor.h.
Referenced by Copy(), Cut(), Delete(), DrawCurrentMessage(), Paste(), SelectAll(), and Undo().