yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
project_file_editor.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_CODE_PROJECT_FILE_EDITOR_H_
2#define YAZE_APP_EDITOR_CODE_PROJECT_FILE_EDITOR_H_
3
4#include <string>
5
6#include "absl/status/status.h"
7#include "app/core/project.h"
9
10namespace yaze {
11namespace editor {
12
13class ToastManager;
14
26 public:
28
29 void Draw();
30
34 absl::Status LoadFile(const std::string& filepath);
35
39 absl::Status SaveFile();
40
44 absl::Status SaveFileAs(const std::string& filepath);
45
49 bool IsModified() const { return text_editor_.IsTextChanged() || modified_; }
50
54 const std::string& filepath() const { return filepath_; }
55
59 void set_active(bool active) { active_ = active; }
60
64 bool* active() { return &active_; }
65
69 void SetToastManager(ToastManager* toast_manager) {
70 toast_manager_ = toast_manager;
71 }
72
76 void NewFile();
77
78 private:
80 void ValidateContent();
82
84 std::string filepath_;
85 bool active_ = false;
86 bool modified_ = false;
87 bool show_validation_ = true;
88 std::vector<std::string> validation_errors_;
90};
91
92} // namespace editor
93} // namespace yaze
94
95#endif // YAZE_APP_EDITOR_CODE_PROJECT_FILE_EDITOR_H_
bool IsTextChanged() const
Editor for .yaze project files with syntax highlighting and validation.
bool * active()
Get pointer to active state for ImGui.
absl::Status SaveFileAs(const std::string &filepath)
Save to a new file path.
absl::Status LoadFile(const std::string &filepath)
Load a project file into the editor.
void NewFile()
Create a new empty project file.
bool IsModified() const
Get whether the file has unsaved changes.
void set_active(bool active)
Set whether the editor window is active.
std::vector< std::string > validation_errors_
absl::Status SaveFile()
Save the current editor contents to disk.
void SetToastManager(ToastManager *toast_manager)
Set toast manager for notifications.
const std::string & filepath() const
Get the current filepath.
Main namespace for the application.