yaze 0.2.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
assembly_editor.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_ASSEMBLY_EDITOR_H
2#define YAZE_APP_EDITOR_ASSEMBLY_EDITOR_H
3
4#include <string>
5
6#include "app/editor/editor.h"
8#include "app/gui/style.h"
9#include "app/rom.h"
10
11namespace yaze {
12namespace editor {
13
14struct FolderItem {
15 std::string name;
16 std::vector<FolderItem> subfolders;
17 std::vector<std::string> files;
18};
19
24class AssemblyEditor : public Editor {
25 public:
26 explicit AssemblyEditor(Rom* rom = nullptr) : rom_(rom) {
27 text_editor_.SetLanguageDefinition(gui::GetAssemblyLanguageDef());
29 text_editor_.SetShowWhitespaces(false);
31 }
32 void ChangeActiveFile(const std::string_view &filename) {
33 current_file_ = filename;
34 file_is_loaded_ = false;
35 }
36
37 void Initialize() override;
38 absl::Status Load() override;
39 void Update(bool &is_loaded);
40 void InlineUpdate();
41
42 void UpdateCodeView();
43
44 absl::Status Cut() override;
45 absl::Status Copy() override;
46 absl::Status Paste() override;
47
48 absl::Status Undo() override;
49 absl::Status Redo() override;
50 absl::Status Find() override { return absl::UnimplementedError("Find"); }
51
52 absl::Status Update() override;
53
54 absl::Status Save() override { return absl::UnimplementedError("Save"); }
55
56 void OpenFolder(const std::string &folder_path);
57
58 // Set the ROM pointer
59 void set_rom(Rom* rom) { rom_ = rom; }
60
61 // Get the ROM pointer
62 Rom* rom() const { return rom_; }
63
64 private:
65 void DrawFileMenu();
66 void DrawEditMenu();
67 void SetEditorText();
68 void DrawCurrentFolder();
69 void DrawFileTabView();
70
71 bool file_is_loaded_ = false;
73
74 std::vector<std::string> files_;
75 std::vector<TextEditor> open_files_;
76 ImVector<int> active_files_;
77
78 std::string current_file_;
81
83};
84
85} // namespace editor
86} // namespace yaze
87
88#endif
static const Palette & GetDarkPalette()
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:59
absl::Status Find() override
absl::Status Save() override
std::vector< TextEditor > open_files_
absl::Status Load() override
void ChangeActiveFile(const std::string_view &filename)
absl::Status Copy() override
void OpenFolder(const std::string &folder_path)
absl::Status Paste() override
absl::Status Update() override
std::vector< std::string > files_
AssemblyEditor(Rom *rom=nullptr)
absl::Status Redo() override
absl::Status Undo() override
absl::Status Cut() override
EditorType type_
Definition editor.h:92
Editors are the view controllers for the application.
TextEditor::LanguageDefinition GetAssemblyLanguageDef()
Definition style.cc:292
Main namespace for the application.
Definition controller.cc:18
std::vector< FolderItem > subfolders
std::vector< std::string > files