inherit virtual Editor for all editor classes

This commit is contained in:
scawful
2024-07-13 17:18:36 -04:00
parent 9dd770c0f5
commit 93d0aa2ca5
11 changed files with 109 additions and 15 deletions

View File

@@ -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 app
} // namespace yaze

View File

@@ -9,6 +9,7 @@
#include <string>
#include "app/core/common.h"
#include "app/editor/utils/editor.h"
#include "app/gui/widgets.h"
namespace yaze {
@@ -19,12 +20,13 @@ namespace editor {
* @class AssemblyEditor
* @brief Text editor for modifying assembly code.
*/
class AssemblyEditor {
class AssemblyEditor : public Editor {
public:
AssemblyEditor() {
text_editor_.SetLanguageDefinition(gui::GetAssemblyLanguageDef());
text_editor_.SetPalette(TextEditor::GetDarkPalette());
text_editor_.SetShowWhitespaces(false);
type_ = EditorType::kAssembly;
}
void ChangeActiveFile(const std::string_view &filename) {
current_file_ = filename;
@@ -36,6 +38,15 @@ class AssemblyEditor {
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:
void DrawFileMenu();
void DrawEditMenu();