yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::ProjectFileEditor Class Reference

Editor for .yaze project files with syntax highlighting and validation. More...

#include <project_file_editor.h>

Collaboration diagram for yaze::editor::ProjectFileEditor:

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.
 

Private Member Functions

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_
 
ToastManagertoast_manager_ = nullptr
 

Detailed Description

Editor for .yaze project files with syntax highlighting and validation.

Provides a rich text editing experience for yaze project files with:

  • Syntax highlighting for INI-style format
  • Real-time validation
  • Auto-save capability
  • Integration with core::YazeProject

Definition at line 25 of file project_file_editor.h.

Constructor & Destructor Documentation

◆ ProjectFileEditor()

yaze::editor::ProjectFileEditor::ProjectFileEditor ( )

Member Function Documentation

◆ Draw()

◆ LoadFile()

absl::Status yaze::editor::ProjectFileEditor::LoadFile ( const std::string &  filepath)

Load a project file into the editor.

Definition at line 125 of file project_file_editor.cc.

References filepath(), filepath_, modified_, TextEditor::SetText(), text_editor_, and ValidateContent().

Referenced by Draw().

Here is the call graph for this function:

◆ SaveFile()

absl::Status yaze::editor::ProjectFileEditor::SaveFile ( )

Save the current editor contents to disk.

Definition at line 145 of file project_file_editor.cc.

References filepath_, and SaveFileAs().

Referenced by Draw().

Here is the call graph for this function:

◆ SaveFileAs()

absl::Status yaze::editor::ProjectFileEditor::SaveFileAs ( const std::string &  filepath)

Save to a new file path.

Definition at line 153 of file project_file_editor.cc.

References filepath(), filepath_, yaze::core::RecentFilesManager::GetInstance(), TextEditor::GetText(), modified_, and text_editor_.

Referenced by Draw(), and SaveFile().

Here is the call graph for this function:

◆ IsModified()

bool yaze::editor::ProjectFileEditor::IsModified ( ) const
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().

Here is the call graph for this function:

◆ filepath()

const std::string & yaze::editor::ProjectFileEditor::filepath ( ) const
inline

Get the current filepath.

Definition at line 54 of file project_file_editor.h.

References filepath_.

Referenced by LoadFile(), and SaveFileAs().

◆ set_active()

void yaze::editor::ProjectFileEditor::set_active ( bool  active)
inline

Set whether the editor window is active.

Definition at line 59 of file project_file_editor.h.

References active(), and active_.

Here is the call graph for this function:

◆ active()

bool * yaze::editor::ProjectFileEditor::active ( )
inline

Get pointer to active state for ImGui.

Definition at line 64 of file project_file_editor.h.

References active_.

Referenced by set_active().

◆ SetToastManager()

void yaze::editor::ProjectFileEditor::SetToastManager ( ToastManager toast_manager)
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().

◆ NewFile()

void yaze::editor::ProjectFileEditor::NewFile ( )

Create a new empty project file.

Definition at line 180 of file project_file_editor.cc.

References filepath_, modified_, TextEditor::SetText(), text_editor_, and validation_errors_.

Referenced by Draw().

Here is the call graph for this function:

◆ ApplySyntaxHighlighting()

void yaze::editor::ProjectFileEditor::ApplySyntaxHighlighting ( )
private
Todo:
Implement custom syntax highlighting for INI format

Definition at line 226 of file project_file_editor.cc.

◆ ValidateContent()

void yaze::editor::ProjectFileEditor::ValidateContent ( )
private

Definition at line 231 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().

Here is the call graph for this function:

◆ ShowValidationErrors()

void yaze::editor::ProjectFileEditor::ShowValidationErrors ( )
private

Definition at line 278 of file project_file_editor.cc.

References validation_errors_.

Member Data Documentation

◆ text_editor_

TextEditor yaze::editor::ProjectFileEditor::text_editor_
private

◆ filepath_

std::string yaze::editor::ProjectFileEditor::filepath_
private

Definition at line 84 of file project_file_editor.h.

Referenced by Draw(), filepath(), LoadFile(), NewFile(), SaveFile(), and SaveFileAs().

◆ active_

bool yaze::editor::ProjectFileEditor::active_ = false
private

Definition at line 85 of file project_file_editor.h.

Referenced by active(), Draw(), and set_active().

◆ modified_

bool yaze::editor::ProjectFileEditor::modified_ = false
private

Definition at line 86 of file project_file_editor.h.

Referenced by IsModified(), LoadFile(), NewFile(), and SaveFileAs().

◆ show_validation_

bool yaze::editor::ProjectFileEditor::show_validation_ = true
private

Definition at line 87 of file project_file_editor.h.

Referenced by Draw(), and ValidateContent().

◆ validation_errors_

std::vector<std::string> yaze::editor::ProjectFileEditor::validation_errors_
private

Definition at line 88 of file project_file_editor.h.

Referenced by Draw(), NewFile(), ShowValidationErrors(), and ValidateContent().

◆ toast_manager_

ToastManager* yaze::editor::ProjectFileEditor::toast_manager_ = nullptr
private

Definition at line 89 of file project_file_editor.h.

Referenced by Draw(), SetToastManager(), and ValidateContent().


The documentation for this class was generated from the following files: