Refactor message editor tables and constants
This commit refactors the message editor code by introducing separate table flags for the message table and dictionary table. The message table now uses the kMessageTableFlags, which includes the Hideable, Borders, and Resizable flags. Similarly, the dictionary table now uses the kDictTableFlags, which includes the Borders and Resizable flags. Additionally, the commit adds two new constants to the message_editor.h file: kFontGfxMessageSize with a value of 128 and kFontGfxMessageDepth with a value of 8. These constants are used in the message_editor.cc file to specify the size and depth of the font graphics data. No functional changes are made in this commit.
This commit is contained in:
@@ -37,6 +37,13 @@ using ImGui::TableSetupColumn;
|
||||
using ImGui::Text;
|
||||
using ImGui::TextWrapped;
|
||||
|
||||
constexpr ImGuiTableFlags kMessageTableFlags = ImGuiTableFlags_Hideable |
|
||||
ImGuiTableFlags_Borders |
|
||||
ImGuiTableFlags_Resizable;
|
||||
|
||||
constexpr ImGuiTableFlags kDictTableFlags =
|
||||
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable;
|
||||
|
||||
absl::Status MessageEditor::Initialize() {
|
||||
for (int i = 0; i < kWidthArraySize; i++) {
|
||||
width_array[i] = rom()->data()[kCharactersWidth + i];
|
||||
@@ -58,7 +65,8 @@ absl::Status MessageEditor::Initialize() {
|
||||
|
||||
// 4bpp
|
||||
RETURN_IF_ERROR(Renderer::GetInstance().CreateAndRenderBitmap(
|
||||
128, 128, 8, font_gfx16_data_, font_gfx_bitmap_, font_preview_colors_))
|
||||
kFontGfxMessageSize, kFontGfxMessageSize, kFontGfxMessageDepth,
|
||||
font_gfx16_data_, font_gfx_bitmap_, font_preview_colors_))
|
||||
|
||||
current_font_gfx16_data_.reserve(kCurrentMessageWidth *
|
||||
kCurrentMessageHeight);
|
||||
@@ -122,8 +130,7 @@ absl::Status MessageEditor::Update() {
|
||||
data_loaded_ = true;
|
||||
}
|
||||
|
||||
if (BeginTable("##MessageEditor", 4,
|
||||
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable)) {
|
||||
if (BeginTable("##MessageEditor", 4, kDictTableFlags)) {
|
||||
TableSetupColumn("List");
|
||||
TableSetupColumn("Contents");
|
||||
TableSetupColumn("Commands");
|
||||
@@ -143,8 +150,7 @@ absl::Status MessageEditor::Update() {
|
||||
TableNextColumn();
|
||||
if (ImGui::BeginChild("##DictionaryChild", ImVec2(0, 0), true,
|
||||
ImGuiWindowFlags_AlwaysVerticalScrollbar)) {
|
||||
if (BeginTable("##Dictionary", 2,
|
||||
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable)) {
|
||||
if (BeginTable("##Dictionary", 2, kDictTableFlags)) {
|
||||
TableSetupColumn("ID");
|
||||
TableSetupColumn("Contents");
|
||||
|
||||
@@ -173,9 +179,7 @@ void MessageEditor::DrawMessageList() {
|
||||
|
||||
if (BeginChild("##MessagesList", ImVec2(0, 0), true,
|
||||
ImGuiWindowFlags_AlwaysVerticalScrollbar)) {
|
||||
if (BeginTable("##MessagesTable", 3,
|
||||
ImGuiTableFlags_Hideable | ImGuiTableFlags_Borders |
|
||||
ImGuiTableFlags_Resizable)) {
|
||||
if (BeginTable("##MessagesTable", 3, kMessageTableFlags)) {
|
||||
TableSetupColumn("ID");
|
||||
TableSetupColumn("Contents");
|
||||
TableSetupColumn("Data");
|
||||
|
||||
@@ -22,6 +22,8 @@ constexpr int kCharactersWidth = 0x74ADF;
|
||||
constexpr int kNumMessages = 396;
|
||||
constexpr int kCurrentMessageWidth = 172;
|
||||
constexpr int kCurrentMessageHeight = 4096;
|
||||
constexpr int kFontGfxMessageSize = 128;
|
||||
constexpr int kFontGfxMessageDepth = 8;
|
||||
|
||||
constexpr uint8_t kWidthArraySize = 100;
|
||||
constexpr uint8_t kBlockTerminator = 0x80;
|
||||
|
||||
Reference in New Issue
Block a user