refactor: Simplify card shortcuts and enhance card control in editor
- Removed individual card shortcuts for dungeon and graphics categories to prevent hash table overflow, consolidating functionality into a Card Browser. - Introduced a context-sensitive card control feature that dynamically displays relevant cards based on the active editor. - Updated PaletteEditor to clarify its use of internal tabs instead of separate cards. - Registered multiple cards in MessageEditor and OverworldEditor, improving visibility and management of editor functionalities.
This commit is contained in:
@@ -60,6 +60,47 @@ constexpr ImGuiTableFlags kMessageTableFlags = ImGuiTableFlags_Hideable |
|
||||
ImGuiTableFlags_Resizable;
|
||||
|
||||
void MessageEditor::Initialize() {
|
||||
// Register cards with EditorCardManager
|
||||
auto& card_manager = gui::EditorCardManager::Get();
|
||||
|
||||
card_manager.RegisterCard({
|
||||
.card_id = "message.message_list",
|
||||
.display_name = "Message List",
|
||||
.icon = ICON_MD_LIST,
|
||||
.category = "Message",
|
||||
.visibility_flag = &show_message_list_,
|
||||
.priority = 10
|
||||
});
|
||||
|
||||
card_manager.RegisterCard({
|
||||
.card_id = "message.message_editor",
|
||||
.display_name = "Message Editor",
|
||||
.icon = ICON_MD_EDIT,
|
||||
.category = "Message",
|
||||
.visibility_flag = &show_message_editor_,
|
||||
.priority = 20
|
||||
});
|
||||
|
||||
card_manager.RegisterCard({
|
||||
.card_id = "message.font_atlas",
|
||||
.display_name = "Font Atlas",
|
||||
.icon = ICON_MD_FONT_DOWNLOAD,
|
||||
.category = "Message",
|
||||
.visibility_flag = &show_font_atlas_,
|
||||
.priority = 30
|
||||
});
|
||||
|
||||
card_manager.RegisterCard({
|
||||
.card_id = "message.dictionary",
|
||||
.display_name = "Dictionary",
|
||||
.icon = ICON_MD_BOOK,
|
||||
.category = "Message",
|
||||
.visibility_flag = &show_dictionary_,
|
||||
.priority = 40
|
||||
});
|
||||
|
||||
printf("[MessageEditor] Registered 4 cards with EditorCardManager\n");
|
||||
|
||||
for (int i = 0; i < kWidthArraySize; i++) {
|
||||
message_preview_.width_array[i] = rom()->data()[kCharactersWidth + i];
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "app/editor/editor.h"
|
||||
#include "app/editor/message/message_data.h"
|
||||
#include "app/editor/message/message_preview.h"
|
||||
#include "app/gui/editor_card_manager.h"
|
||||
#include "app/gfx/bitmap.h"
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/style.h"
|
||||
@@ -84,6 +85,12 @@ class MessageEditor : public Editor {
|
||||
gui::TextBox message_text_box_;
|
||||
Rom* rom_;
|
||||
Rom expanded_message_bin_;
|
||||
|
||||
// Card visibility states
|
||||
bool show_message_list_ = false;
|
||||
bool show_message_editor_ = false;
|
||||
bool show_font_atlas_ = false;
|
||||
bool show_dictionary_ = false;
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
|
||||
Reference in New Issue
Block a user