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
"
8
#include "
app/gui/modules/text_editor.h
"
9
10
namespace
yaze
{
11
namespace
editor {
12
13
class
ToastManager;
14
25
class
ProjectFileEditor
{
26
public
:
27
ProjectFileEditor
();
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
:
79
void
ApplySyntaxHighlighting
();
80
void
ValidateContent
();
81
void
ShowValidationErrors
();
82
83
TextEditor
text_editor_
;
84
std::string
filepath_
;
85
bool
active_
=
false
;
86
bool
modified_
=
false
;
87
bool
show_validation_
=
true
;
88
std::vector<std::string>
validation_errors_
;
89
ToastManager
*
toast_manager_
=
nullptr
;
90
};
91
92
}
// namespace editor
93
}
// namespace yaze
94
95
#endif
// YAZE_APP_EDITOR_CODE_PROJECT_FILE_EDITOR_H_
TextEditor
Definition
text_editor.h:17
TextEditor::IsTextChanged
bool IsTextChanged() const
Definition
text_editor.h:203
yaze::editor::ProjectFileEditor
Editor for .yaze project files with syntax highlighting and validation.
Definition
project_file_editor.h:25
yaze::editor::ProjectFileEditor::ApplySyntaxHighlighting
void ApplySyntaxHighlighting()
Definition
project_file_editor.cc:226
yaze::editor::ProjectFileEditor::Draw
void Draw()
Definition
project_file_editor.cc:23
yaze::editor::ProjectFileEditor::toast_manager_
ToastManager * toast_manager_
Definition
project_file_editor.h:89
yaze::editor::ProjectFileEditor::ProjectFileEditor
ProjectFileEditor()
Definition
project_file_editor.cc:17
yaze::editor::ProjectFileEditor::active
bool * active()
Get pointer to active state for ImGui.
Definition
project_file_editor.h:64
yaze::editor::ProjectFileEditor::SaveFileAs
absl::Status SaveFileAs(const std::string &filepath)
Save to a new file path.
Definition
project_file_editor.cc:153
yaze::editor::ProjectFileEditor::LoadFile
absl::Status LoadFile(const std::string &filepath)
Load a project file into the editor.
Definition
project_file_editor.cc:125
yaze::editor::ProjectFileEditor::NewFile
void NewFile()
Create a new empty project file.
Definition
project_file_editor.cc:180
yaze::editor::ProjectFileEditor::text_editor_
TextEditor text_editor_
Definition
project_file_editor.h:83
yaze::editor::ProjectFileEditor::IsModified
bool IsModified() const
Get whether the file has unsaved changes.
Definition
project_file_editor.h:49
yaze::editor::ProjectFileEditor::active_
bool active_
Definition
project_file_editor.h:85
yaze::editor::ProjectFileEditor::modified_
bool modified_
Definition
project_file_editor.h:86
yaze::editor::ProjectFileEditor::ValidateContent
void ValidateContent()
Definition
project_file_editor.cc:231
yaze::editor::ProjectFileEditor::set_active
void set_active(bool active)
Set whether the editor window is active.
Definition
project_file_editor.h:59
yaze::editor::ProjectFileEditor::show_validation_
bool show_validation_
Definition
project_file_editor.h:87
yaze::editor::ProjectFileEditor::validation_errors_
std::vector< std::string > validation_errors_
Definition
project_file_editor.h:88
yaze::editor::ProjectFileEditor::SaveFile
absl::Status SaveFile()
Save the current editor contents to disk.
Definition
project_file_editor.cc:145
yaze::editor::ProjectFileEditor::ShowValidationErrors
void ShowValidationErrors()
Definition
project_file_editor.cc:278
yaze::editor::ProjectFileEditor::filepath_
std::string filepath_
Definition
project_file_editor.h:84
yaze::editor::ProjectFileEditor::SetToastManager
void SetToastManager(ToastManager *toast_manager)
Set toast manager for notifications.
Definition
project_file_editor.h:69
yaze::editor::ProjectFileEditor::filepath
const std::string & filepath() const
Get the current filepath.
Definition
project_file_editor.h:54
yaze::editor::ToastManager
Definition
toast_manager.h:25
yaze
Main namespace for the application.
Definition
asar_wrapper.cc:14
project.h
text_editor.h
src
app
editor
code
project_file_editor.h
Generated by
1.9.8