undoStudio
The IDE of the undoRT ecosystem
Loading...
Searching...
No Matches
undoAppText.hpp
Go to the documentation of this file.
1
15#pragma once
16
17#include <string>
18#include <vector>
19#include <memory>
20
21// Include TextEditor
22#include <TextEditor.h>
23
24namespace undoApp {
25
35{
36public:
39
41 bool initialize();
42
44 void shutdown();
45
47 void openFile(const std::string& path);
48
54 void renameFileTo(const std::string& path);
55
57 void saveFile();
58
60 void closeFile();
61
64
79 void setDocument(const std::string& path, const std::string& text);
80
82 void document(std::string& path, std::string& text) const;
83
92 bool hasUnsavedChanges() const { return m_isDirty; }
93
94private:
97
98 bool m_initialized = false;
99 std::string m_currentFilePath;
100 std::unique_ptr<TextEditor> m_editor;
101 std::vector<std::string> m_outputLines;
102 bool m_isDirty = false;
103};
104
105} // namespace undoApp
Main application class for the plain-text editor backend.
Definition undoAppText.hpp:35
std::unique_ptr< TextEditor > m_editor
Definition undoAppText.hpp:100
void closeFile()
Clear the editor and forget the current file.
bool m_isDirty
Editor text differs from the file on disk.
Definition undoAppText.hpp:102
bool hasUnsavedChanges() const
Whether the text on screen differs from the file on disk.
Definition undoAppText.hpp:92
bool m_initialized
Definition undoAppText.hpp:98
void saveFile()
Write the editor's current text back to m_currentFilePath.
void renameFileTo(const std::string &path)
Record that the file this editor holds has moved on disk.
void setupEditor()
(Re)create the TextEditor widget with the standard dark palette
std::string m_currentFilePath
Definition undoAppText.hpp:99
void setDocument(const std::string &path, const std::string &text)
Put what is on screen back into an editor, under a new file name.
void document(std::string &path, std::string &text) const
The editor's text and the file it belongs to.
bool initialize()
Initialize the plain-text editor (idempotent)
void renderEditorPanel()
Render the editor inside the unified "Editor" ImGui window.
void shutdown()
Shutdown the plain-text editor.
static TextApp & getInstance()
Get the singleton instance of TextApp.
void openFile(const std::string &path)
Open a file and load it into the editor.
std::vector< std::string > m_outputLines
Definition undoAppText.hpp:101
Definition undoAppCpp.hpp:26