127 void openFile(
const std::string& path,
bool pin =
true);
185 void renameFile(
const std::string& oldPath,
const std::string& newName);
193 void moveFile(
const std::string& sourcePath,
const std::string& destDir);
251 static constexpr size_t kNoIndex =
static_cast<size_t>(-1);
undoProject management service for undoStudio
Main application class for the Workspace and file routing.
Definition undoAppEditor.hpp:83
void refreshFileTree()
Refresh the file tree.
FileType m_currentFileType
Definition undoAppEditor.hpp:230
void renderWorkspacePanel()
Render the Workspace panel (file tree and workspace management)
char m_newProjectName[256]
Definition undoAppEditor.hpp:368
bool m_showNewFolderPopup
Definition undoAppEditor.hpp:336
bool m_showAddPLCPopup
Definition undoAppEditor.hpp:374
bool m_showRenamePLCPopup
Definition undoAppEditor.hpp:387
void closeTab(const std::string &path)
Close a tab, moving to the one beside it if it was the active one.
std::map< std::string, StashedText > m_cppStashes
Definition undoAppEditor.hpp:247
std::string m_newFileName
Definition undoAppEditor.hpp:339
int m_addTaskPriority
Definition undoAppEditor.hpp:383
void renderFileTree(FileNode &node)
Recursively render the file tree.
bool isProjectOpen() const
True if an undoProject is currently open.
std::string m_newPOUName
Definition undoAppEditor.hpp:330
void openDocument(const std::string &path, DocKind kind, bool pin)
Open a file with a chosen backend, through the tab bar and the model.
char m_addTaskPLC[256]
Definition undoAppEditor.hpp:381
char m_addTaskName[256]
Definition undoAppEditor.hpp:380
bool m_isDragging
Definition undoAppEditor.hpp:357
char m_addPLCName[256]
Definition undoAppEditor.hpp:375
void loadActiveDocument(const std::string &path)
Put a file into the editor its backend owns.
bool m_showNewFilePopup
Definition undoAppEditor.hpp:338
void shutdown()
Shutdown the editor plugin and release resources.
std::string m_deletePLCPending
Definition undoAppEditor.hpp:393
std::string m_newItemName
Definition undoAppEditor.hpp:337
char m_renamePLCNewName[256]
Definition undoAppEditor.hpp:389
bool m_showWorkspaceDialog
Definition undoAppEditor.hpp:352
void followPathChange(const std::string &oldPath, const std::string &newPath)
Follow a file that was renamed or moved on disk.
std::string m_workspacePath
Definition undoAppEditor.hpp:324
void openFile(const std::string &path, bool pin=true)
Open a file using the appropriate backend for its extension.
std::string m_renamePath
Definition undoAppEditor.hpp:344
bool m_isProjectMode
Definition undoAppEditor.hpp:363
void openWorkspaceDialog()
Open a native folder selection dialog.
char m_newProjectAuthor[256]
Definition undoAppEditor.hpp:370
void renameFile(const std::string &oldPath, const std::string &newName)
Rename a file or folder.
bool initialize()
Initialize the editor plugin (called by PluginManager)
void loadWorkspace(const std::string &path)
Load a workspace from the given path.
void closeDocumentsUnder(const std::string &path)
Close every tab under a path, including the files inside a folder.
void createNewFolder(const std::string &parentPath, const std::string &name)
Create a new folder in the workspace.
void createNewGenericFile(const std::string &parentPath, const std::string &name)
Create generic file.
int m_addTaskCycleMs
Definition undoAppEditor.hpp:382
std::string m_newItemParent
Definition undoAppEditor.hpp:331
char m_newProjectParent[1024]
Definition undoAppEditor.hpp:367
void saveActiveDocument()
Write the file on screen back to disk, whichever kind it is.
void openFileAsTree(const std::string &path)
Open a JSON file in the tree viewer, whatever it opens as by default.
ST::POUType m_newPOUType
Definition undoAppEditor.hpp:329
void createProject(const std::string &parentDir, const std::string &name)
Create a new undoProject.
void refreshDirtyState()
Ask the backend on screen whether the file has unsaved changes.
void renderEditorPanel()
Render the unified "Editor" panel by dispatching to the active backend.
char m_newProjectArch[64]
Definition undoAppEditor.hpp:371
char m_addPLCDesc[512]
Definition undoAppEditor.hpp:376
bool m_showDeletePLCConfirm
Definition undoAppEditor.hpp:392
void expandToPath(FileNode &node, const std::string &targetPath)
bool m_showRenamePopup
Definition undoAppEditor.hpp:343
void renderFileTabs()
Draw the bar of open files above whichever editor is showing.
std::map< std::string, JSON::JSONDocument > m_jsonStashes
Definition undoAppEditor.hpp:248
bool m_showNewPOUPopup
Definition undoAppEditor.hpp:328
OpenDocuments m_open
Definition undoAppEditor.hpp:236
void closeProject()
Close the current undoProject.
void moveFile(const std::string &sourcePath, const std::string &destDir)
Move a file to a destination directory.
static EditorApp & getInstance()
Get the singleton instance of EditorApp.
void openFileAsText(const std::string &path)
Open a JSON file as plain text (bypass JSON viewer)
bool m_initialized
Definition undoAppEditor.hpp:229
void closeFile()
Close the currently open file.
void switchToTab(const std::string &path)
Bring a tab to the front, restoring what it held.
std::string m_newPOUReturnType
Definition undoAppEditor.hpp:332
void createNewFile(const std::string &parentPath, const std::string &name)
Create a new file with ST template (POU)
std::string neighbourAfterClose(const std::string &path) const
The tab to show after closing one.
bool m_showAddTaskPopup
Definition undoAppEditor.hpp:379
std::string m_newFileParent
Definition undoAppEditor.hpp:340
int m_addTaskCPU
Definition undoAppEditor.hpp:384
std::string m_deletePendingPath
Definition undoAppEditor.hpp:348
char m_workspaceDialogPath[1024]
Definition undoAppEditor.hpp:353
std::string getCurrentFilePath() const
Get the path of the currently open file (empty when none)
Definition undoAppEditor.hpp:104
void openProject(const std::string &projectDir)
Open an existing undoProject from projectDir.
bool m_showPOUReturnType
Definition undoAppEditor.hpp:333
void deleteFile(const std::string &path)
Delete a file or folder (shows confirmation popup)
static DocKind docKindFor(FileType type)
Which backend a document kind belongs to.
FileNode m_rootNode
Definition undoAppEditor.hpp:325
FileType getCurrentFileType() const
Get the type of the currently open file.
Definition undoAppEditor.hpp:101
std::map< std::string, StashedText > m_textStashes
Definition undoAppEditor.hpp:246
void dropStashes(const std::string &path)
Forget everything stashed for a path.
void stashActiveDocument(bool keep)
Take the file on screen out of its backend, into its own stash.
std::string m_editTaskOriginalName
Definition undoAppEditor.hpp:397
bool m_showDeleteConfirmation
Definition undoAppEditor.hpp:347
std::map< std::string, ST::STDocument > m_stStashes
Definition undoAppEditor.hpp:245
size_t documentIndex(const std::string &path) const
Where a file sits in the open list.
std::string m_currentFilePath
Definition undoAppEditor.hpp:231
bool m_showEditTaskPopup
Definition undoAppEditor.hpp:396
static FileType fileTypeFor(DocKind kind)
bool m_showNewProjectPopup
Definition undoAppEditor.hpp:366
static constexpr size_t kNoIndex
Says "not found", for a lookup that may genuinely have no answer.
Definition undoAppEditor.hpp:251
std::string toLower(std::string s)
Get the file extension in lowercase.
void registerPanels()
Register the unified "Editor" panel and "Workspace" panel with ImGuiManager.
std::string m_draggedItemPath
Definition undoAppEditor.hpp:356
std::string m_renamePLCOldName
Definition undoAppEditor.hpp:388
void buildFileTree(FileNode &node, const std::string &root)
Build a hierarchical file tree from a directory path.
The set of open files, at most one of them a preview.
Definition undoAppOpenDocuments.hpp:87
FileType
The kind of file currently open in the editor.
Definition undoAppEditor.hpp:48
POUType
Enumeration of POU (Program Organization Unit) types.
Definition undoAppST.hpp:42
Definition undoAppCpp.hpp:26
DocKind
Which backend a document belongs to.
Definition undoAppOpenDocuments.hpp:49
NodeRole
Definition ProjectManager.hpp:112
Node structure for the file tree representation.
Definition undoAppEditor.hpp:60
bool expanded
Definition undoAppEditor.hpp:65
NodeRole role
Semantic role within an undoProject.
Definition undoAppEditor.hpp:67
bool isDirectory
Definition undoAppEditor.hpp:63
bool isDragging
Definition undoAppEditor.hpp:66
std::string path
Definition undoAppEditor.hpp:62
std::vector< FileNode > children
Definition undoAppEditor.hpp:64
std::string name
Definition undoAppEditor.hpp:61
One plain-text or C++ document, held while another file is in the editor.
Definition undoAppEditor.hpp:74
std::string path
Definition undoAppEditor.hpp:75
std::string text
Definition undoAppEditor.hpp:76
Header of the C/C++ editor backend.
Header of the JSON Viewer undoApp.
Which files are open, and which of them is only a preview.
Header of the Structured Text editor undoApp.
Header of the plain-text editor undoApp.