inherit virtual Editor for all editor classes
This commit is contained in:
@@ -329,6 +329,33 @@ void AssemblyEditor::SetEditorText() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
absl::Status AssemblyEditor::Cut() {
|
||||||
|
text_editor_.Cut();
|
||||||
|
return absl::OkStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
absl::Status AssemblyEditor::Copy() {
|
||||||
|
text_editor_.Copy();
|
||||||
|
return absl::OkStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
absl::Status AssemblyEditor::Paste() {
|
||||||
|
text_editor_.Paste();
|
||||||
|
return absl::OkStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
absl::Status AssemblyEditor::Undo() {
|
||||||
|
text_editor_.Undo();
|
||||||
|
return absl::OkStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
absl::Status AssemblyEditor::Redo() {
|
||||||
|
text_editor_.Redo();
|
||||||
|
return absl::OkStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
absl::Status AssemblyEditor::Update() { return absl::OkStatus(); }
|
||||||
|
|
||||||
} // namespace editor
|
} // namespace editor
|
||||||
} // namespace app
|
} // namespace app
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "app/core/common.h"
|
#include "app/core/common.h"
|
||||||
|
#include "app/editor/utils/editor.h"
|
||||||
#include "app/gui/widgets.h"
|
#include "app/gui/widgets.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
@@ -19,12 +20,13 @@ namespace editor {
|
|||||||
* @class AssemblyEditor
|
* @class AssemblyEditor
|
||||||
* @brief Text editor for modifying assembly code.
|
* @brief Text editor for modifying assembly code.
|
||||||
*/
|
*/
|
||||||
class AssemblyEditor {
|
class AssemblyEditor : public Editor {
|
||||||
public:
|
public:
|
||||||
AssemblyEditor() {
|
AssemblyEditor() {
|
||||||
text_editor_.SetLanguageDefinition(gui::GetAssemblyLanguageDef());
|
text_editor_.SetLanguageDefinition(gui::GetAssemblyLanguageDef());
|
||||||
text_editor_.SetPalette(TextEditor::GetDarkPalette());
|
text_editor_.SetPalette(TextEditor::GetDarkPalette());
|
||||||
text_editor_.SetShowWhitespaces(false);
|
text_editor_.SetShowWhitespaces(false);
|
||||||
|
type_ = EditorType::kAssembly;
|
||||||
}
|
}
|
||||||
void ChangeActiveFile(const std::string_view &filename) {
|
void ChangeActiveFile(const std::string_view &filename) {
|
||||||
current_file_ = filename;
|
current_file_ = filename;
|
||||||
@@ -36,6 +38,15 @@ class AssemblyEditor {
|
|||||||
|
|
||||||
void UpdateCodeView();
|
void UpdateCodeView();
|
||||||
|
|
||||||
|
absl::Status Cut() override;
|
||||||
|
absl::Status Copy() override;
|
||||||
|
absl::Status Paste() override;
|
||||||
|
|
||||||
|
absl::Status Undo() override;
|
||||||
|
absl::Status Redo() override;
|
||||||
|
|
||||||
|
absl::Status Update() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DrawFileMenu();
|
void DrawFileMenu();
|
||||||
void DrawEditMenu();
|
void DrawEditMenu();
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
#include <imgui/imgui.h>
|
#include <imgui/imgui.h>
|
||||||
|
|
||||||
#include "app/core/common.h"
|
#include "app/core/common.h"
|
||||||
#include "app/editor/utils/editor.h"
|
|
||||||
#include "app/core/labeling.h"
|
#include "app/core/labeling.h"
|
||||||
#include "app/editor/modules/gfx_group_editor.h"
|
#include "app/editor/modules/gfx_group_editor.h"
|
||||||
#include "app/editor/modules/palette_editor.h"
|
#include "app/editor/modules/palette_editor.h"
|
||||||
|
#include "app/editor/utils/editor.h"
|
||||||
#include "app/gui/canvas.h"
|
#include "app/gui/canvas.h"
|
||||||
#include "app/gui/icons.h"
|
#include "app/gui/icons.h"
|
||||||
#include "app/rom.h"
|
#include "app/rom.h"
|
||||||
@@ -46,6 +46,8 @@ class DungeonEditor : public Editor,
|
|||||||
public SharedRom,
|
public SharedRom,
|
||||||
public core::ExperimentFlags {
|
public core::ExperimentFlags {
|
||||||
public:
|
public:
|
||||||
|
DungeonEditor() { type_ = EditorType::kDungeon; }
|
||||||
|
|
||||||
absl::Status Update() override;
|
absl::Status Update() override;
|
||||||
absl::Status Cut() override { return absl::OkStatus(); }
|
absl::Status Cut() override { return absl::OkStatus(); }
|
||||||
absl::Status Copy() override { return absl::OkStatus(); }
|
absl::Status Copy() override { return absl::OkStatus(); }
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
#include "absl/status/statusor.h"
|
#include "absl/status/statusor.h"
|
||||||
#include "app/editor/modules/palette_editor.h"
|
#include "app/editor/modules/palette_editor.h"
|
||||||
|
#include "app/editor/utils/editor.h"
|
||||||
#include "app/gfx/bitmap.h"
|
#include "app/gfx/bitmap.h"
|
||||||
#include "app/gfx/snes_tile.h"
|
#include "app/gfx/snes_tile.h"
|
||||||
#include "app/gui/canvas.h"
|
#include "app/gui/canvas.h"
|
||||||
@@ -73,10 +74,18 @@ constexpr ImGuiTableFlags kGfxEditFlags = ImGuiTableFlags_Reorderable |
|
|||||||
* drawing toolsets, palette controls, clipboard imports, experimental features,
|
* drawing toolsets, palette controls, clipboard imports, experimental features,
|
||||||
* and memory editor.
|
* and memory editor.
|
||||||
*/
|
*/
|
||||||
class GraphicsEditor : public SharedRom {
|
class GraphicsEditor : public SharedRom, public Editor {
|
||||||
public:
|
public:
|
||||||
|
GraphicsEditor() { type_ = EditorType::kGraphics; }
|
||||||
|
|
||||||
absl::Status Update();
|
absl::Status Update();
|
||||||
|
|
||||||
|
absl::Status Cut() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Copy() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Paste() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Undo() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Redo() override { return absl::OkStatus(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class GfxEditMode {
|
enum class GfxEditMode {
|
||||||
kSelect,
|
kSelect,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace yaze {
|
|||||||
namespace app {
|
namespace app {
|
||||||
namespace editor {
|
namespace editor {
|
||||||
|
|
||||||
void MusicEditor::Update() {
|
absl::Status MusicEditor::Update() {
|
||||||
if (ImGui::BeginTable("MusicEditorColumns", 2, music_editor_flags_,
|
if (ImGui::BeginTable("MusicEditorColumns", 2, music_editor_flags_,
|
||||||
ImVec2(0, 0))) {
|
ImVec2(0, 0))) {
|
||||||
ImGui::TableSetupColumn("Assembly");
|
ImGui::TableSetupColumn("Assembly");
|
||||||
@@ -30,6 +30,8 @@ void MusicEditor::Update() {
|
|||||||
|
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return absl::OkStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MusicEditor::DrawChannels() {
|
void MusicEditor::DrawChannels() {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "absl/strings/str_format.h"
|
#include "absl/strings/str_format.h"
|
||||||
#include "app/editor/code/assembly_editor.h"
|
#include "app/editor/code/assembly_editor.h"
|
||||||
|
#include "app/editor/utils/editor.h"
|
||||||
#include "app/gui/canvas.h"
|
#include "app/gui/canvas.h"
|
||||||
#include "app/gui/icons.h"
|
#include "app/gui/icons.h"
|
||||||
#include "app/gui/input.h"
|
#include "app/gui/input.h"
|
||||||
@@ -58,9 +59,17 @@ static constexpr absl::string_view kSongNotes[] = {
|
|||||||
* @class MusicEditor
|
* @class MusicEditor
|
||||||
* @brief A class for editing music data in a Rom.
|
* @brief A class for editing music data in a Rom.
|
||||||
*/
|
*/
|
||||||
class MusicEditor : public SharedRom {
|
class MusicEditor : public SharedRom, public Editor {
|
||||||
public:
|
public:
|
||||||
void Update();
|
MusicEditor() { type_ = EditorType::kMusic; }
|
||||||
|
|
||||||
|
absl::Status Update() override;
|
||||||
|
|
||||||
|
absl::Status Cut() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Copy() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Paste() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Undo() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Redo() override { return absl::OkStatus(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DrawChannels();
|
void DrawChannels();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <imgui/imgui.h>
|
#include <imgui/imgui.h>
|
||||||
|
|
||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
|
#include "app/editor/utils/editor.h"
|
||||||
#include "app/gfx/snes_palette.h"
|
#include "app/gfx/snes_palette.h"
|
||||||
#include "app/gui/canvas.h"
|
#include "app/gui/canvas.h"
|
||||||
#include "app/gui/icons.h"
|
#include "app/gui/icons.h"
|
||||||
@@ -81,9 +82,18 @@ class PaletteEditorHistory {
|
|||||||
* @class PaletteEditor
|
* @class PaletteEditor
|
||||||
* @brief Allows the user to view and edit in game palettes.
|
* @brief Allows the user to view and edit in game palettes.
|
||||||
*/
|
*/
|
||||||
class PaletteEditor : public SharedRom {
|
class PaletteEditor : public SharedRom, public Editor {
|
||||||
public:
|
public:
|
||||||
absl::Status Update();
|
PaletteEditor() { type_ = EditorType::kPalette; }
|
||||||
|
|
||||||
|
absl::Status Update() override;
|
||||||
|
|
||||||
|
absl::Status Cut() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Copy() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Paste() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Undo() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Redo() override { return absl::OkStatus(); }
|
||||||
|
|
||||||
void DisplayCategoryTable();
|
void DisplayCategoryTable();
|
||||||
absl::Status DrawPaletteGroups();
|
absl::Status DrawPaletteGroups();
|
||||||
|
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ class OverworldEditor : public Editor,
|
|||||||
public context::EntranceContext,
|
public context::EntranceContext,
|
||||||
public core::ExperimentFlags {
|
public core::ExperimentFlags {
|
||||||
public:
|
public:
|
||||||
|
OverworldEditor() { type_ = EditorType::kOverworld; }
|
||||||
|
|
||||||
void InitializeZeml();
|
void InitializeZeml();
|
||||||
|
|
||||||
absl::Status Update() final;
|
absl::Status Update() final;
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ namespace yaze {
|
|||||||
namespace app {
|
namespace app {
|
||||||
namespace editor {
|
namespace editor {
|
||||||
|
|
||||||
ScreenEditor::ScreenEditor() { screen_canvas_.SetCanvasSize(ImVec2(512, 512)); }
|
|
||||||
|
|
||||||
void ScreenEditor::Update() {
|
|
||||||
|
absl::Status ScreenEditor::Update() {
|
||||||
TAB_BAR("##TabBar")
|
TAB_BAR("##TabBar")
|
||||||
TAB_ITEM("Dungeon Maps")
|
TAB_ITEM("Dungeon Maps")
|
||||||
if (rom()->is_loaded()) {
|
if (rom()->is_loaded()) {
|
||||||
@@ -39,6 +39,8 @@ void ScreenEditor::Update() {
|
|||||||
DrawTitleScreenEditor();
|
DrawTitleScreenEditor();
|
||||||
DrawNamingScreenEditor();
|
DrawNamingScreenEditor();
|
||||||
END_TAB_BAR()
|
END_TAB_BAR()
|
||||||
|
|
||||||
|
return absl::OkStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenEditor::DrawInventoryMenuEditor() {
|
void ScreenEditor::DrawInventoryMenuEditor() {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
#include "app/core/constants.h"
|
#include "app/core/constants.h"
|
||||||
|
#include "app/editor/utils/editor.h"
|
||||||
#include "app/gfx/bitmap.h"
|
#include "app/gfx/bitmap.h"
|
||||||
#include "app/gfx/snes_palette.h"
|
#include "app/gfx/snes_palette.h"
|
||||||
#include "app/gfx/snes_tile.h"
|
#include "app/gfx/snes_tile.h"
|
||||||
@@ -36,10 +37,20 @@ namespace editor {
|
|||||||
*
|
*
|
||||||
* The class inherits from the SharedRom class.
|
* The class inherits from the SharedRom class.
|
||||||
*/
|
*/
|
||||||
class ScreenEditor : public SharedRom {
|
class ScreenEditor : public SharedRom, public Editor {
|
||||||
public:
|
public:
|
||||||
ScreenEditor();
|
ScreenEditor() {
|
||||||
void Update();
|
screen_canvas_.SetCanvasSize(ImVec2(512, 512));
|
||||||
|
type_ = EditorType::kScreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
absl::Status Update() override;
|
||||||
|
|
||||||
|
absl::Status Cut() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Copy() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Paste() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Undo() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Redo() override { return absl::OkStatus(); }
|
||||||
|
|
||||||
absl::Status SaveDungeonMaps();
|
absl::Status SaveDungeonMaps();
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#define YAZE_APP_EDITOR_SPRITE_EDITOR_H
|
#define YAZE_APP_EDITOR_SPRITE_EDITOR_H
|
||||||
|
|
||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
|
#include "app/editor/utils/editor.h"
|
||||||
#include "app/gui/canvas.h"
|
#include "app/gui/canvas.h"
|
||||||
#include "app/rom.h"
|
#include "app/rom.h"
|
||||||
|
|
||||||
@@ -29,14 +30,22 @@ constexpr ImGuiTableFlags kSpriteTableFlags =
|
|||||||
* This class provides functionality for updating the sprite editor, drawing the
|
* This class provides functionality for updating the sprite editor, drawing the
|
||||||
* editor table, drawing the sprite canvas, and drawing the current sheets.
|
* editor table, drawing the sprite canvas, and drawing the current sheets.
|
||||||
*/
|
*/
|
||||||
class SpriteEditor : public SharedRom {
|
class SpriteEditor : public SharedRom, public Editor {
|
||||||
public:
|
public:
|
||||||
|
SpriteEditor() { type_ = EditorType::kSprite; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Updates the sprite editor.
|
* @brief Updates the sprite editor.
|
||||||
*
|
*
|
||||||
* @return An absl::Status indicating the success or failure of the update.
|
* @return An absl::Status indicating the success or failure of the update.
|
||||||
*/
|
*/
|
||||||
absl::Status Update();
|
absl::Status Update() override;
|
||||||
|
|
||||||
|
absl::Status Cut() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Copy() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Paste() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Undo() override { return absl::OkStatus(); }
|
||||||
|
absl::Status Redo() override { return absl::OkStatus(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user