refactor: Enhance Assembly Editor with Language Definition and Toolset Integration

- Introduced a new language definition for the 65816 assembly language, improving syntax highlighting and code editing capabilities.
- Updated the AssemblyEditor to utilize the new language definition and integrated a toolset for file management actions, enhancing user experience.
- Refactored the file handling logic to support dynamic file opening and saving, ensuring better resource management within the editor.
- Removed deprecated tab view code, transitioning to a more modular card-based layout for active files, improving UI responsiveness and organization.
This commit is contained in:
scawful
2025-10-05 23:59:22 -04:00
parent 03c1a7bbf2
commit 42217a388f
10 changed files with 382 additions and 221 deletions

View File

@@ -1,6 +1,7 @@
#include "sprite_editor.h"
#include "app/gfx/performance_profiler.h"
#include "gui/ui_helpers.h"
#include "util/file_util.h"
#include "app/editor/sprite/zsprite.h"
#include "app/gfx/arena.h"
@@ -36,21 +37,40 @@ absl::Status SpriteEditor::Update() {
sheets_loaded_ = true;
}
if (ImGui::BeginTabBar("##SpriteEditorTabs")) {
if (ImGui::BeginTabItem("Vanilla")) {
DrawVanillaSpriteEditor();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Custom")) {
DrawCustomSprites();
ImGui::EndTabItem();
}
ImGui::EndTabBar();
DrawToolset();
gui::VerticalSpacing(2.0f);
static gui::EditorCard vanilla_card("Vanilla Sprites", ICON_MD_PEST_CONTROL_RODENT);
static gui::EditorCard custom_card("Custom Sprites", ICON_MD_ADD_MODERATOR);
if (show_vanilla_editor_ && vanilla_card.Begin(&show_vanilla_editor_)) {
DrawVanillaSpriteEditor();
vanilla_card.End();
}
if (show_custom_editor_ && custom_card.Begin(&show_custom_editor_)) {
DrawCustomSprites();
custom_card.End();
}
return status_.ok() ? absl::OkStatus() : status_;
}
void SpriteEditor::DrawToolset() {
static gui::Toolset toolbar;
toolbar.Begin();
if (toolbar.AddAction(ICON_MD_PEST_CONTROL_RODENT, "Vanilla Sprites")) {
show_vanilla_editor_ = !show_vanilla_editor_;
}
if (toolbar.AddAction(ICON_MD_ADD_MODERATOR, "Custom Sprites")) {
show_custom_editor_ = !show_custom_editor_;
}
toolbar.End();
}
void SpriteEditor::DrawVanillaSpriteEditor() {
if (ImGui::BeginTable("##SpriteCanvasTable", 3, ImGuiTableFlags_Resizable,
ImVec2(0, 0))) {

View File

@@ -8,6 +8,7 @@
#include "app/editor/editor.h"
#include "app/editor/sprite/zsprite.h"
#include "app/gui/canvas.h"
#include "app/gui/editor_layout.h"
#include "app/rom.h"
namespace yaze {
@@ -80,6 +81,11 @@ class SpriteEditor : public Editor {
* @brief Draws the animation frames manager.
*/
void DrawAnimationFrames();
void DrawToolset();
// Card visibility
bool show_vanilla_editor_ = true;
bool show_custom_editor_ = false;
ImVector<int> active_sprites_; /**< Active sprites. */