Editor for .yaze project files with syntax highlighting and validation. More...
#include <project_file_editor.h>

Public Member Functions | |
| ProjectFileEditor () | |
| void | Draw () |
| absl::Status | LoadFile (const std::string &filepath) |
| Load a project file into the editor. | |
| absl::Status | SaveFile () |
| Save the current editor contents to disk. | |
| absl::Status | SaveFileAs (const std::string &filepath) |
| Save to a new file path. | |
| bool | IsModified () const |
| Get whether the file has unsaved changes. | |
| const std::string & | filepath () const |
| Get the current filepath. | |
| void | set_active (bool active) |
| Set whether the editor window is active. | |
| bool * | active () |
| Get pointer to active state for ImGui. | |
| void | SetToastManager (ToastManager *toast_manager) |
| Set toast manager for notifications. | |
| void | NewFile () |
| Create a new empty project file. | |
| void | SetProject (project::YazeProject *project) |
| Set the project pointer for label import operations. | |
Private Member Functions | |
| absl::Status | ImportLabelsFromZScream () |
| Import labels from a ZScream DefaultNames.txt file. | |
| void | ApplySyntaxHighlighting () |
| void | ValidateContent () |
| void | ShowValidationErrors () |
Private Attributes | |
| TextEditor | text_editor_ |
| std::string | filepath_ |
| bool | active_ = false |
| bool | modified_ = false |
| bool | show_validation_ = true |
| std::vector< std::string > | validation_errors_ |
| ToastManager * | toast_manager_ = nullptr |
| project::YazeProject * | project_ = nullptr |
Editor for .yaze project files with syntax highlighting and validation.
Provides a rich text editing experience for yaze project files with:
Definition at line 25 of file project_file_editor.h.
| yaze::editor::ProjectFileEditor::ProjectFileEditor | ( | ) |
Definition at line 22 of file project_file_editor.cc.
References TextEditor::LanguageDefinition::C(), TextEditor::SetLanguageDefinition(), TextEditor::SetShowWhitespaces(), TextEditor::SetTabSize(), and text_editor_.

| void yaze::editor::ProjectFileEditor::Draw | ( | ) |
Definition at line 28 of file project_file_editor.cc.
References active_, filepath_, ICON_MD_CHECK_CIRCLE, ICON_MD_DESCRIPTION, ICON_MD_ERROR, ICON_MD_FOLDER_OPEN, ICON_MD_LABEL, ICON_MD_NOTE_ADD, ICON_MD_SAVE, ICON_MD_SAVE_AS, ImportLabelsFromZScream(), IsModified(), yaze::editor::kError, yaze::editor::kSuccess, LoadFile(), NewFile(), TextEditor::Render(), SaveFile(), SaveFileAs(), yaze::editor::ToastManager::Show(), show_validation_, yaze::util::FileDialogWrapper::ShowOpenFileDialog(), yaze::util::FileDialogWrapper::ShowSaveFileDialog(), text_editor_, toast_manager_, ValidateContent(), and validation_errors_.
Referenced by yaze::editor::EditorManager::DrawMenuBar().
| absl::Status yaze::editor::ProjectFileEditor::LoadFile | ( | const std::string & | filepath | ) |
Load a project file into the editor.
Definition at line 155 of file project_file_editor.cc.
References filepath(), filepath_, modified_, TextEditor::SetText(), text_editor_, and ValidateContent().
Referenced by Draw(), and yaze::editor::EditorManager::ShowProjectFileEditor().

| absl::Status yaze::editor::ProjectFileEditor::SaveFile | ( | ) |
Save the current editor contents to disk.
Definition at line 190 of file project_file_editor.cc.
References filepath_, and SaveFileAs().
Referenced by Draw().

| absl::Status yaze::editor::ProjectFileEditor::SaveFileAs | ( | const std::string & | filepath | ) |
Save to a new file path.
Definition at line 198 of file project_file_editor.cc.
References filepath(), filepath_, yaze::project::RecentFilesManager::GetInstance(), TextEditor::GetText(), modified_, and text_editor_.
Referenced by Draw(), and SaveFile().

|
inline |
Get whether the file has unsaved changes.
Definition at line 49 of file project_file_editor.h.
References TextEditor::IsTextChanged(), modified_, and text_editor_.
Referenced by Draw().

|
inline |
Get the current filepath.
Definition at line 54 of file project_file_editor.h.
References filepath_.
Referenced by LoadFile(), and SaveFileAs().
|
inline |
Set whether the editor window is active.
Definition at line 59 of file project_file_editor.h.
References active(), and active_.
Referenced by yaze::editor::EditorManager::ShowProjectFileEditor().

|
inline |
Get pointer to active state for ImGui.
Definition at line 64 of file project_file_editor.h.
References active_.
Referenced by set_active().
|
inline |
Set toast manager for notifications.
Definition at line 69 of file project_file_editor.h.
References toast_manager_.
Referenced by yaze::editor::EditorManager::Initialize().
| void yaze::editor::ProjectFileEditor::NewFile | ( | ) |
Create a new empty project file.
Definition at line 243 of file project_file_editor.cc.
References filepath_, modified_, TextEditor::SetText(), text_editor_, and validation_errors_.
Referenced by Draw().

|
inline |
Set the project pointer for label import operations.
Definition at line 81 of file project_file_editor.h.
References project_.
Referenced by yaze::editor::EditorManager::ShowProjectFileEditor().
|
private |
Import labels from a ZScream DefaultNames.txt file.
Definition at line 375 of file project_file_editor.cc.
References yaze::project::YazeProject::ImportLabelsFromZScreamContent(), project_, yaze::project::YazeProject::Save(), and yaze::util::FileDialogWrapper::ShowOpenFileDialog().
Referenced by Draw().

|
private |
Definition at line 311 of file project_file_editor.cc.
|
private |
Definition at line 316 of file project_file_editor.cc.
References TextEditor::GetText(), yaze::editor::kSuccess, yaze::editor::ToastManager::Show(), show_validation_, text_editor_, toast_manager_, and validation_errors_.
Referenced by Draw(), and LoadFile().

|
private |
Definition at line 365 of file project_file_editor.cc.
References validation_errors_.
|
private |
Definition at line 93 of file project_file_editor.h.
Referenced by Draw(), IsModified(), LoadFile(), NewFile(), ProjectFileEditor(), SaveFileAs(), and ValidateContent().
|
private |
Definition at line 94 of file project_file_editor.h.
Referenced by Draw(), filepath(), LoadFile(), NewFile(), SaveFile(), and SaveFileAs().
|
private |
Definition at line 95 of file project_file_editor.h.
Referenced by active(), Draw(), and set_active().
|
private |
Definition at line 96 of file project_file_editor.h.
Referenced by IsModified(), LoadFile(), NewFile(), and SaveFileAs().
|
private |
Definition at line 97 of file project_file_editor.h.
Referenced by Draw(), and ValidateContent().
|
private |
Definition at line 98 of file project_file_editor.h.
Referenced by Draw(), NewFile(), ShowValidationErrors(), and ValidateContent().
|
private |
Definition at line 99 of file project_file_editor.h.
Referenced by Draw(), SetToastManager(), and ValidateContent().
|
private |
Definition at line 100 of file project_file_editor.h.
Referenced by ImportLabelsFromZScream(), and SetProject().