![]() |
undoStudio
The IDE of the undoRT ecosystem
|
Main application class for the Structured Text editor plugin. More...
#include <undoAppST.hpp>

Classes | |
| struct | CompletionSpot |
| struct | MethodLineInfo |
| struct | WorkspaceDeclaration |
| A declaration found somewhere in the workspace. More... | |
| struct | WorkspaceMethod |
| A METHOD of a file in the workspace, for the file tree. More... | |
Public Member Functions | |
| bool | initialize () |
| Initialize the ST undoApp. | |
| void | shutdown () |
| Shutdown the ST undoApp and release resources. | |
| void | registerPanels () |
| Register UI panels with ImGuiManager. | |
| void | beginEditorFrame () |
| Do the ST editor's per-frame work, before any document is drawn. | |
| void | renderDocument () |
| Draw the Structured Text document, inside the editor panel. | |
| void | endEditorFrame () |
| Draw the ST editor's overlays, after the document. | |
| void | renderOutputPanel () |
| Render the Output panel (validation and compilation messages) | |
| void | renderOutlinePanel () |
| Render the Outline panel (AST structure tree with methods) | |
| void | renderWorkspacePanel () |
| Render the workspace/file-tree panel. | |
| void | renderFileTree (FileNode &node) |
| Render one file-tree node and its children recursively. | |
| void | loadWorkspace (const std::string &path) |
| Load a workspace directory into the file tree. | |
| void | openWorkspaceDialog () |
| Open a folder-picker dialog and load the chosen workspace. | |
| void | createNewFile (const std::string &parentPath, const std::string &name) |
| Create a new ST file under parentPath. | |
| void | createNewFolder (const std::string &parentPath, const std::string &name) |
| Create a new folder under parentPath. | |
| void | deleteFile (const std::string &path) |
| Delete the file or folder at path. | |
| void | renameFile (const std::string &oldPath, const std::string &newName) |
| Rename the entry at oldPath to newName. | |
| void | moveFile (const std::string &sourcePath, const std::string &destDir) |
| Move sourcePath into destDir. | |
| void | renameFileTo (const std::string &path) |
| Record that the file this editor holds has moved on disk. | |
| void | saveCurrentFile () |
| Save the currently open file. | |
| bool | hasUnsavedChanges () const |
| Whether the file has edits that are not on disk. | |
| void | openFile (const std::string &path) |
| Open a file for editing (with method extraction) | |
| void | closeFile () |
| Close the currently open ST file and clear the editor state. | |
| bool | handleKeyboardShortcuts () |
| Handle keyboard shortcuts. | |
| std::string | generateSTFile () |
| Generate the full ST file content from the editor sections and methods. | |
| std::string | generateSTFileWithMap (std::vector< SourceSegment > &outSegments) |
| Generate the ST file and record where each editor section landed. | |
| void | refreshSemanticHighlighting () |
| Re-run the st2cpp analyzer and push resolved symbol colors to the editors. | |
| const SourceSegment * | segmentForLine (int fullLine) const |
| Map a generated-file line to the editor that owns it. | |
| const Declaration * | findDeclaration (const std::string &name, const std::string &scope) const |
| Resolve a name to the declaration it should navigate to. | |
| void | revealGeneratedLine (int fullLine, int col, int tokenLength=0) |
| Move the editor to a generated-file line, switching METHOD tabs. | |
| STDocument | takeDocument () |
| Take the open file out whole, to be put back later. | |
| void | setDocument (const STDocument &doc) |
| Show a file taken out by takeDocument() | |
| bool | revealMethodTab (const std::string &methodName) |
| Switch to a METHOD tab, materializing it if needed. | |
| void | requestTabSelection (const std::string &tabName) |
| Ask the tab bar to show a tab on the next frame. | |
| void | requestAddMethodDialog () |
| Ask the ST document to show the "Add Method" dialog. | |
| bool | consumeAddMethodDialogRequest () |
| Take the pending "Add Method" request, if there is one. | |
| bool | revealDeclaration (const Declaration &decl) |
| Reveal a declaration, handling METHOD headers and parameters. | |
| void | handleNavigationInput (const char *id, TextEditor &editor) |
| Handle Ctrl+Click and hover on one editor. | |
| void | applyPendingJump () |
| Resolve a name queued by a cross-file Ctrl+Click and reveal it. | |
| void | showIdentifierTooltip (TextEditor &editor) |
| Show the resolved declaration of the identifier under the mouse. | |
| void | updateDirtyState () |
| Poll the editors and update the dirty flag. | |
| void | requestOpenFile (const std::string &path) |
| Open a file, asking first when there are unsaved changes. | |
| void | openMethodOf (const std::string &filePath, const std::string &methodName) |
| Open a file and land on one of its METHOD tabs. | |
| void | renderDirtyPrompt () |
| Render the save / discard confirmation. | |
| void | renderJumpPopup () |
| Let the user pick a target when a name has several declarations. | |
| void | ensureWorkspaceIndex () |
| Build (or reuse) the index of declarations across the workspace. | |
| void | ensureProjectRegistry () |
| Build (or reuse) the library registry describing the sibling files. | |
| void | invalidateWorkspaceIndex (const std::string &path) |
| Invalidate the workspace index after a file changed. | |
| std::vector< WorkspaceDeclaration > | findWorkspaceDeclarations (const std::string &name) const |
| All declarations of a name across the workspace. | |
| void | indexSTFile (const std::string &path, std::unordered_map< std::string, std::vector< WorkspaceDeclaration > > &outDecls) const |
| Index the declarations of one .st file. | |
| void | setupEditors () |
| Setup and configure the TextEditor widgets. | |
| void | validateAndParse () |
| Validate and parse the current ST code (includes semantic analysis) | |
| void | compile () |
| Compile the current ST code. | |
| void | addOutput (OutSeverity severity, std::string text) |
| Append a tagged line to the Output panel. | |
| void | setErrorMarkers () |
| Set error markers on the appropriate editors based on m_errors. | |
| void | renderSplitEditor (TextEditor &varEditor, TextEditor &bodyEditor, float &splitterPos, const char *varLabel, const char *bodyLabel, const char *varId, const char *bodyId) |
| Render one Variables/Body split editor (shared by the POU tab and every method tab) | |
| MethodEditors & | getOrCreateMethodEditors (MethodData &method) |
| Get (creating on first use) the editor pair for a method tab. | |
| void | syncMethodEditorsToData () |
| Pull the live text out of every currently-open method editor back into m_methods. | |
| void | addMethod (const std::string &name, const std::string &returnType) |
| Add a new, empty method and switch to its tab. | |
| void | deleteMethod (const std::string &name) |
| Delete a method by name. | |
| int | findMethodIndex (const std::string &name) const |
| Find the index of a method by name, or -1 if not found. | |
| void | resetMethodState () |
| Reset all method-related state (called whenever the open file changes/closes) | |
Static Public Member Functions | |
| static STApp & | getInstance () |
| Get the singleton instance of STApp. | |
| static bool | identifierAt (const TextEditor &editor, int line, int col, std::string &outName) |
| Extract the identifier surrounding a position in an editor. | |
| static int | columnOfName (const std::vector< std::string > &srcLines, int line, const std::string &name) |
| Column of a name inside a generated line, or -1 when absent. | |
| static int | countLines (const std::string &text) |
| Count the number of lines in a text string. | |
Private Member Functions | |
| TextEditor * | editorForSegment (const SourceSegment &segment) const |
| Resolve the TextEditor that backs a segment, or nullptr if closed. | |
| void | updateMemberCompletion (const char *id, TextEditor &editor, bool editorHasKeyboard) |
| void | clearMemberCompletion () |
| void | dismissMemberCompletion () |
| void | moveMemberCompletion (int delta) |
| void | moveMemberCompletionByPage (int pages) |
| void | acceptMemberCompletion () |
| void | renderMemberCompletion () |
| ImGuiKey | handleMemberCompletionKeys () |
| std::string | methodScopeAtLine (int line) const |
| The METHOD whose body a line sits in, empty for POU-level code. | |
| st2cpp::semantic::ScopeId | scopeIdForLine (int line) const |
| The scope an identifier on a line resolves from, 0 when nothing is. | |
| void | updateSignatureHelp (const char *id, TextEditor &editor, bool editorHasKeyboard) |
| void | clearSignatureHelp () |
| void | dismissSignatureHelp () |
| void | renderSignatureHelp () |
| ImGuiKey | handleSignatureHelpKeys () |
| void | renderParameterNameHint (const char *id, TextEditor &editor) |
| void | runTranspiler () |
| Run st2cpp over the open project and report what it says. | |
| void | updateStatementCompletion (const char *id, TextEditor &editor, bool editorHasKeyboard, bool inVariables) |
| void | clearStatementCompletion () |
| void | dismissStatementCompletion () |
| void | moveStatementCompletion (int delta) |
| void | moveStatementCompletionByPage (int pages) |
| void | acceptStatementCompletion () |
| void | renderStatementCompletion () |
| ImGuiKey | handleStatementCompletionKeys () |
| bool | statementCompletionOpen () const |
| True while a statement list is up, which the member list defers to. | |
| void | invalidateSemanticTokens () |
| Drop the semantic spans the editors are painting. | |
| void | claimOverlayNavigationKeys () |
| Claim the navigation keys for whichever overlay is open. | |
| bool | anyOverlayOpen () const |
| True while any of the three overlays is on screen. | |
| bool | buildParameterPicker (TextEditor &editor, const std::vector< std::string > &lines, const TextEditor::Coordinates &cursor) |
| Fill the completion list with the parameters of the call at the caret. | |
Private Attributes | |
| bool | m_initialized = false |
| Initialization flag. | |
| std::string | m_workspacePath |
| Current workspace path. | |
| FileNode | m_rootNode |
| Root of the file tree. | |
| std::string | m_currentFilePath |
| Path of the currently open file. | |
| std::string | m_currentFileContent |
| Content of the currently open file. | |
| std::vector< OutputLine > | m_outputLines |
| bool | m_showGeneratedDump = false |
| OutputFilter | m_outputFilter |
| char | m_outputSearch [256] = {} |
| size_t | m_outputLinesShown = 0 |
| Last line count the Output panel drew, so it can tell new output from old. | |
| std::unique_ptr< TextEditor > | m_variablesEditor |
| Editor for the Variables section. | |
| std::unique_ptr< TextEditor > | m_bodyEditor |
| Editor for the Body section. | |
| std::string | m_pouName |
| Name of the current POU. | |
| POUType | m_pouType = POUType::Program |
| Type of the current POU. | |
| std::unique_ptr< TranslationUnit > | m_ast |
| AST of the current file. | |
| std::vector< ParseError > | m_errors |
| Parsing errors. | |
| std::vector< SourceSegment > | m_sourceMap |
| Layout of the last generated file. | |
| std::vector< std::string > | m_srcLines |
| Generated source, 1-based via index+1. | |
| std::unique_ptr< st2cpp::semantic::SemanticInfo > | m_semantic |
| Cached analysis of the current AST, rebuilt by validateAndParse() | |
| DeclarationIndex | m_declarations |
| Declarations of the open file, keyed by normalized name. | |
| bool | m_showTooltips = false |
| Hover tooltips are opt-in: they interrupt reading. | |
| bool | m_isDirty = false |
| Editor text differs from the file on disk. | |
| int | m_ignoreChangeFrames = 0 |
| Frames to skip after a programmatic load. | |
| bool | m_showDirtyPrompt = false |
| True while the confirmation popup is open. | |
| std::string | m_pendingOpenPath |
| File queued to open once the user decides. | |
| std::unordered_map< std::string, std::vector< WorkspaceDeclaration > > | m_workspaceDecls |
| bool | m_workspaceIndexValid = false |
| std::unique_ptr< st2cpp::library::LibraryRegistry > | m_projectRegistry |
| Declarations of the sibling files, as the analyzer's external scope. | |
| std::unordered_map< std::string, std::vector< WorkspaceMethod > > | m_workspaceMethods |
| METHODS of each indexed .st file, so the tree can show them. | |
| std::string | m_pendingTabAfterOpen |
| Tab to select once a pending file switch has completed. | |
| std::string | m_pendingJumpName |
| Identifier to reveal after a file switch. | |
| std::vector< WorkspaceDeclaration > | m_jumpCandidates |
| std::string | m_jumpCandidateName |
| bool | m_showJumpPopup = false |
| True when a name is declared more than once. | |
| std::vector< MethodData > | m_methods |
| List of methods. | |
| std::string | m_currentContext |
| Current context: "POU" or "METHOD:name". | |
| std::string | m_pouVariablesText |
| Variables text for the main POU. | |
| std::string | m_pouBodyText |
| Body text for the main POU. | |
| std::string | m_activeTab |
| "" = POU tab (Variables/Body), otherwise the open method's name | |
| std::string | m_pendingTabSelection |
| One-shot request to select a tab, honoured via ImGuiTabItemFlags_SetSelected. | |
| bool | m_pendingSelectPOU = false |
| Request to select the POU tab. | |
| std::unordered_map< std::string, MethodEditors > | m_methodEditors |
| Lazily-created editors, keyed by method name. | |
| bool | m_showNewFilePopup = false |
| bool | m_showNewFolderPopup = false |
| bool | m_showRenamePopup = false |
| bool | m_showNewPOUPopup = false |
| bool | m_showAddMethodPopup = false |
| True if add method popup is visible. | |
| bool | m_addMethodDialogPending = false |
| Asked for from another panel; the document opens the popup. | |
| TextEditor * | m_completionEditor = nullptr |
| std::vector< MemberAccess > | m_completionCandidates |
| Candidates the pattern still matches, best match first. | |
| int | m_completionSelected = 0 |
| Index into m_completionCandidates. | |
| std::string | m_completionPrefix |
| Prefix the candidates were filtered with. | |
| std::string | m_completionObject |
| Instance name the '.' was typed after. | |
| TextEditor * | m_parameterPickerEditor = nullptr |
| bool | m_completionIsParameterList = false |
| CompletionSpot | m_completionDismissed |
| bool | m_completionDismissedValid = false |
| int | m_completionLine = -1 |
| Line and column span the completion would replace, in editor coordinates. | |
| int | m_completionColStart = 0 |
| int | m_completionColEnd = 0 |
| ImVec2 | m_completionRectMin = ImVec2(0.0f, 0.0f) |
| ImVec2 | m_completionRectMax = ImVec2(0.0f, 0.0f) |
| ImVec2 | m_completionEditorMin = ImVec2(0.0f, 0.0f) |
| ImVec2 | m_completionEditorMax = ImVec2(0.0f, 0.0f) |
| ImVec2 | m_completionCursorScreen = ImVec2(0.0f, 0.0f) |
| int | m_completionScroll = 0 |
| int | m_completionPageSize = 8 |
| Rows the last frame had room for, so navigation knows a page. | |
| TextEditor * | m_signatureEditor = nullptr |
| CallSignature | m_signature |
| The callee the cursor is inside. | |
| CallSite | m_signatureCall |
| Where that call is, for its label. | |
| int | m_signatureArgument = 0 |
| Index of the argument the cursor is in. | |
| CompletionSpot | m_signatureDismissed |
| bool | m_signatureDismissedValid = false |
| ImVec2 | m_signatureRectMin = ImVec2(0.0f, 0.0f) |
| ImVec2 | m_signatureRectMax = ImVec2(0.0f, 0.0f) |
| ImVec2 | m_signatureCursorScreen = ImVec2(0.0f, 0.0f) |
| ImVec2 | m_signatureEditorMin = ImVec2(0.0f, 0.0f) |
| ImVec2 | m_signatureEditorMax = ImVec2(0.0f, 0.0f) |
| bool | m_signatureArgumentEmpty = false |
| TextEditor * | m_snippetEditor = nullptr |
| Editor the list belongs to. | |
| std::vector< StatementSnippet > | m_snippetCandidates |
| Matching skeletons, best first. | |
| std::vector< std::vector< int > > | m_snippetMatchMask |
| One row per candidate, a byte per label character, 1 where the pattern matched. | |
| int | m_snippetSelected = 0 |
| Index into m_snippetCandidates. | |
| int | m_snippetScroll = 0 |
| First candidate row on screen. | |
| std::string | m_snippetPrefix |
| What the candidates were filtered with. | |
| bool | m_snippetInVariables = false |
| Pane the list was built for. | |
| int | m_snippetLine = -1 |
| Line and column span the list would replace, in editor coordinates. | |
| int | m_snippetColStart = 0 |
| int | m_snippetColEnd = 0 |
| CompletionSpot | m_snippetDismissed |
| bool | m_snippetDismissedValid = false |
| ImVec2 | m_snippetRectMin = ImVec2(0.0f, 0.0f) |
| ImVec2 | m_snippetRectMax = ImVec2(0.0f, 0.0f) |
| ImVec2 | m_snippetCursorScreen = ImVec2(0.0f, 0.0f) |
| ImVec2 | m_snippetEditorMin = ImVec2(0.0f, 0.0f) |
| ImVec2 | m_snippetEditorMax = ImVec2(0.0f, 0.0f) |
| bool | m_showDeleteMethodConfirmation = false |
| True if delete method confirmation is visible. | |
| POUType | m_newPOUType = POUType::Program |
| std::string | m_newPOUName |
| std::string | m_newItemName |
| std::string | m_newItemParent |
| std::string | m_renamePath |
| float | m_splitterPos = 0.5f |
| Where the Variables and Body sections are divided. | |
| bool | m_splitterDirty = false |
| It has been dragged and not yet written out. | |
| std::string | m_functionReturnType |
| std::string | m_newMethodName |
| std::string | m_newMethodReturnType |
| std::string | m_newMethodVisibility |
| std::string | m_methodToDelete |
| bool | m_showDeleteConfirmation = false |
| True if delete confirmation popup is visible. | |
| bool | m_showWorkspaceDialog = false |
| char | m_workspaceDialogPath [1024] = {} |
| std::string | m_deletePendingPath |
| Path of the file/folder pending deletion. | |
| std::string | m_draggedItemPath |
| bool | m_isDragging = false |
| std::string | m_dropTargetPath |
| bool | m_showDropIndicator = false |
Static Private Attributes | |
| static constexpr ImGuiWindowFlags | kMemberCompletionWindowFlags |
| static constexpr ImGuiWindowFlags | kSignatureHelpWindowFlags = kMemberCompletionWindowFlags |
| Same flags for the signature help, which is the same kind of overlay. | |
Main application class for the Structured Text editor plugin.
Implements a two-pane editor (Variables + Body) with workspace management, syntax highlighting, semantic validation, AST outline, and method support.
|
private |
|
private |
| void undoApp::ST::STApp::addMethod | ( | const std::string & | name, |
| const std::string & | returnType | ||
| ) |
Add a new, empty method and switch to its tab.
| void undoApp::ST::STApp::addOutput | ( | OutSeverity | severity, |
| std::string | text | ||
| ) |
Append a tagged line to the Output panel.
|
private |
True while any of the three overlays is on screen.
| void undoApp::ST::STApp::applyPendingJump | ( | ) |
Resolve a name queued by a cross-file Ctrl+Click and reveal it.
| void undoApp::ST::STApp::beginEditorFrame | ( | ) |
Do the ST editor's per-frame work, before any document is drawn.
Keyboard shortcuts, the unsaved-changes state, and the two popups that have to be opened and closed inside the panel that draws them: ImGui resolves a popup against the window it is opened in, so one opened anywhere else is never found again.
|
private |
Fill the completion list with the parameters of the call at the caret.
The one thing the list can offer that the text at the caret cannot: what the callee is called, written out as names. The parameters already written to the left of the caret are marked and pushed down, so Tab walks the call in the order it was declared rather than in the order the user remembers it.
|
private |
Claim the navigation keys for whichever overlay is open.
A suggestion list owns the arrow keys and the two page keys while it is up, and ImGui's keyboard navigation has to be blind to them for the same period: it turns an arrow press into a request to move the focus to another window, and the window it lands on is scrolled into view, which drags the panel out from under the popup.
Ownership is the mechanism rather than clearing ImGuiConfigFlags_NavEnableKeyboard, which is a flag on the whole application and not this editor's to stand down: the keys are taken one at a time, and only while a list is up. NavProcessKey() asks for them with ImGuiKeyOwner_NoOwner, so a key that has an owner is not seen by it at all, while the list's own IsKeyPressed() — which asks with ImGuiKeyOwner_Any — keeps working.
Nothing is released here. Ownership is given up by ImGui on the frame after the key comes up, and claiming a key the list is no longer using would take it from whatever does.
|
private |
|
private |
|
private |
| void undoApp::ST::STApp::closeFile | ( | ) |
Close the currently open ST file and clear the editor state.
|
static |
Column of a name inside a generated line, or -1 when absent.
| void undoApp::ST::STApp::compile | ( | ) |
Compile the current ST code.
| bool undoApp::ST::STApp::consumeAddMethodDialogRequest | ( | ) |
Take the pending "Add Method" request, if there is one.
|
static |
Count the number of lines in a text string.
| void undoApp::ST::STApp::createNewFile | ( | const std::string & | parentPath, |
| const std::string & | name | ||
| ) |
Create a new ST file under parentPath.
| void undoApp::ST::STApp::createNewFolder | ( | const std::string & | parentPath, |
| const std::string & | name | ||
| ) |
Create a new folder under parentPath.
| void undoApp::ST::STApp::deleteFile | ( | const std::string & | path | ) |
Delete the file or folder at path.
| void undoApp::ST::STApp::deleteMethod | ( | const std::string & | name | ) |
Delete a method by name.
|
private |
|
private |
|
private |
|
private |
Resolve the TextEditor that backs a segment, or nullptr if closed.
| void undoApp::ST::STApp::endEditorFrame | ( | ) |
Draw the ST editor's overlays, after the document.
The signature help and the two completion lists are separate windows drawn after the document so that the editor cannot clip them, and the navigation keys are claimed last so that the claim exists by the end of the frame.
| void undoApp::ST::STApp::ensureProjectRegistry | ( | ) |
Build (or reuse) the library registry describing the sibling files.
The analyzer resolves an unknown named type by consulting its external scope, so exporting every other .st file as a semantic-only library is what makes a FUNCTION_BLOCK declared in a sibling file usable from the open one. Cached: parsing every file on each keystroke is not affordable.
| void undoApp::ST::STApp::ensureWorkspaceIndex | ( | ) |
Build (or reuse) the index of declarations across the workspace.
| const Declaration * undoApp::ST::STApp::findDeclaration | ( | const std::string & | name, |
| const std::string & | scope | ||
| ) | const |
Resolve a name to the declaration it should navigate to.
| int undoApp::ST::STApp::findMethodIndex | ( | const std::string & | name | ) | const |
Find the index of a method by name, or -1 if not found.
| std::vector< WorkspaceDeclaration > undoApp::ST::STApp::findWorkspaceDeclarations | ( | const std::string & | name | ) | const |
All declarations of a name across the workspace.
| std::string undoApp::ST::STApp::generateSTFile | ( | ) |
Generate the full ST file content from the editor sections and methods.
| std::string undoApp::ST::STApp::generateSTFileWithMap | ( | std::vector< SourceSegment > & | outSegments | ) |
Generate the ST file and record where each editor section landed.
| outSegments | Receives one entry per editor-backed block |
This is the single source of truth for the generated layout: the segment list is filled while the text is emitted, so it can never drift from what generateSTFile() actually produces. Diagnostic and semantic mapping both consume it instead of re-deriving offsets by hand.
| MethodEditors & undoApp::ST::STApp::getOrCreateMethodEditors | ( | MethodData & | method | ) |
Get (creating on first use) the editor pair for a method tab.
| bool undoApp::ST::STApp::handleKeyboardShortcuts | ( | ) |
Handle keyboard shortcuts.
|
private |
| void undoApp::ST::STApp::handleNavigationInput | ( | const char * | id, |
| TextEditor & | editor | ||
| ) |
Handle Ctrl+Click and hover on one editor.
|
private |
|
private |
|
inline |
Whether the file has edits that are not on disk.
Kept here rather than asked of the editors, because the ST file is not one buffer: it is the panes, and what they hold together is not what any single one of them can answer.
|
static |
Extract the identifier surrounding a position in an editor.
| void undoApp::ST::STApp::indexSTFile | ( | const std::string & | path, |
| std::unordered_map< std::string, std::vector< WorkspaceDeclaration > > & | outDecls | ||
| ) | const |
Index the declarations of one .st file.
|
private |
Drop the semantic spans the editors are painting.
| void undoApp::ST::STApp::invalidateWorkspaceIndex | ( | const std::string & | path | ) |
Invalidate the workspace index after a file changed.
| void undoApp::ST::STApp::loadWorkspace | ( | const std::string & | path | ) |
Load a workspace directory into the file tree.
|
private |
The METHOD whose body a line sits in, empty for POU-level code.
| void undoApp::ST::STApp::moveFile | ( | const std::string & | sourcePath, |
| const std::string & | destDir | ||
| ) |
Move sourcePath into destDir.
|
private |
|
private |
|
private |
|
private |
| void undoApp::ST::STApp::openFile | ( | const std::string & | path | ) |
Open a file for editing (with method extraction)
| void undoApp::ST::STApp::openMethodOf | ( | const std::string & | filePath, |
| const std::string & | methodName | ||
| ) |
Open a file and land on one of its METHOD tabs.
| void undoApp::ST::STApp::openWorkspaceDialog | ( | ) |
Open a folder-picker dialog and load the chosen workspace.
| void undoApp::ST::STApp::refreshSemanticHighlighting | ( | ) |
Re-run the st2cpp analyzer and push resolved symbol colors to the editors.
| void undoApp::ST::STApp::registerPanels | ( | ) |
Register UI panels with ImGuiManager.
| void undoApp::ST::STApp::renameFile | ( | const std::string & | oldPath, |
| const std::string & | newName | ||
| ) |
Rename the entry at oldPath to newName.
| void undoApp::ST::STApp::renameFileTo | ( | const std::string & | path | ) |
Record that the file this editor holds has moved on disk.
Only the path, never the panes: the editor is still showing the same file, and without this a save after a rename writes a second copy at the old path. The workspace index is invalidated for both paths, because it is keyed by path and the entry that described the file now answers to the other one.
| path | Where the file now is |
| void undoApp::ST::STApp::renderDirtyPrompt | ( | ) |
Render the save / discard confirmation.
| void undoApp::ST::STApp::renderDocument | ( | ) |
Draw the Structured Text document, inside the editor panel.
The panel belongs to EditorApp, which draws the bar of open files and then asks for whichever backend the file on screen needs. This is the ST one, so it draws no window of its own: a second Begin here would be a second window with the panel's name, laid out twice in one frame.
| void undoApp::ST::STApp::renderFileTree | ( | FileNode & | node | ) |
Render one file-tree node and its children recursively.
| void undoApp::ST::STApp::renderJumpPopup | ( | ) |
Let the user pick a target when a name has several declarations.
|
private |
| void undoApp::ST::STApp::renderOutlinePanel | ( | ) |
Render the Outline panel (AST structure tree with methods)
| void undoApp::ST::STApp::renderOutputPanel | ( | ) |
Render the Output panel (validation and compilation messages)
|
private |
Draw the parameter name and type in place after the cursor, the way an editor hints at the next thing to type
|
private |
| void undoApp::ST::STApp::renderSplitEditor | ( | TextEditor & | varEditor, |
| TextEditor & | bodyEditor, | ||
| float & | splitterPos, | ||
| const char * | varLabel, | ||
| const char * | bodyLabel, | ||
| const char * | varId, | ||
| const char * | bodyId | ||
| ) |
Render one Variables/Body split editor (shared by the POU tab and every method tab)
|
private |
| void undoApp::ST::STApp::renderWorkspacePanel | ( | ) |
Render the workspace/file-tree panel.
| void undoApp::ST::STApp::requestAddMethodDialog | ( | ) |
| void undoApp::ST::STApp::requestOpenFile | ( | const std::string & | path | ) |
Open a file, asking first when there are unsaved changes.
| void undoApp::ST::STApp::requestTabSelection | ( | const std::string & | tabName | ) |
Ask the tab bar to show a tab on the next frame.
| tabName | METHOD name, or empty for the POU tab |
| void undoApp::ST::STApp::resetMethodState | ( | ) |
Reset all method-related state (called whenever the open file changes/closes)
| bool undoApp::ST::STApp::revealDeclaration | ( | const Declaration & | decl | ) |
Reveal a declaration, handling METHOD headers and parameters.
| void undoApp::ST::STApp::revealGeneratedLine | ( | int | fullLine, |
| int | col, | ||
| int | tokenLength = 0 |
||
| ) |
Move the editor to a generated-file line, switching METHOD tabs.
| bool undoApp::ST::STApp::revealMethodTab | ( | const std::string & | methodName | ) |
Switch to a METHOD tab, materializing it if needed.
|
private |
Run st2cpp over the open project and report what it says.
| void undoApp::ST::STApp::saveCurrentFile | ( | ) |
Save the currently open file.
|
private |
The scope an identifier on a line resolves from, 0 when nothing is.
| const SourceSegment * undoApp::ST::STApp::segmentForLine | ( | int | fullLine | ) | const |
Map a generated-file line to the editor that owns it.
| void undoApp::ST::STApp::setDocument | ( | const STDocument & | doc | ) |
Show a file taken out by takeDocument()
| doc | The file and its contents |
Refuses a document that is not a POU, rather than showing an empty editor: a file that parses as nothing is a file worth looking at, and taking its content on the way in is what it is worth looking at for.
| void undoApp::ST::STApp::setErrorMarkers | ( | ) |
Set error markers on the appropriate editors based on m_errors.
| void undoApp::ST::STApp::setupEditors | ( | ) |
Setup and configure the TextEditor widgets.
| void undoApp::ST::STApp::showIdentifierTooltip | ( | TextEditor & | editor | ) |
Show the resolved declaration of the identifier under the mouse.
|
inlineprivate |
True while a statement list is up, which the member list defers to.
| void undoApp::ST::STApp::syncMethodEditorsToData | ( | ) |
Pull the live text out of every currently-open method editor back into m_methods.
| STDocument undoApp::ST::STApp::takeDocument | ( | ) |
Take the open file out whole, to be put back later.
The other end of switching tabs. Everything the editors hold is read out, including unsaved changes, because that is the only copy of them: reading the file off disk instead would hand back the saved version and lose the rest.
The AST, the semantic analysis and the source map are left out on purpose. They are derived from the text and are rebuilt when the file is shown again, so keeping them would mean carrying a second, stale copy of the truth.
| void undoApp::ST::STApp::updateDirtyState | ( | ) |
Poll the editors and update the dirty flag.
|
private |
|
private |
|
private |
| void undoApp::ST::STApp::validateAndParse | ( | ) |
Validate and parse the current ST code (includes semantic analysis)
|
staticconstexprprivate |
Window flags for the member completion list.
The list is drawn as a plain overlay rather than a real popup, and it never takes the keyboard: the editor keeps it and keeps receiving the characters that filter the list, which is what makes the list feel like part of the text rather than a dialog that stole it. NoFocusOnAppearing and NoNavFocus are what keep that true — the editors are BeginChild windows, and TextEditor::HandleKeyboardInputs only claims io.WantTextInput when its own child is focused, so a list that took focus the moment it opened would strip the keyboard from the editor underneath.
The overlay is therefore given a border and a background explicitly, since a popup-window background would be drawn only for a window the user is interacting with.
|
staticconstexprprivate |
Same flags for the signature help, which is the same kind of overlay.
|
private |
"" = POU tab (Variables/Body), otherwise the open method's name
|
private |
Asked for from another panel; the document opens the popup.
|
private |
AST of the current file.
|
private |
Editor for the Body section.
|
private |
Candidates the pattern still matches, best match first.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
The editor the completion belongs to; the pointer is stable because editors are held by unique_ptr and never moved.
|
private |
|
private |
|
private |
True while the open list is that parameter list rather than a member or identifier list, which decides what a key press means
|
private |
Line and column span the completion would replace, in editor coordinates.
|
private |
Instance name the '.' was typed after.
|
private |
Rows the last frame had room for, so navigation knows a page.
|
private |
Prefix the candidates were filtered with.
|
private |
|
private |
Screen rectangle of the editor child that owns the list, plus where the cursor sits inside it, so the list opens under the glyph being typed rather than at the top-left of the pane Screen rectangle the list took this frame, set once the window exists and is really the size ImGui gave it. Empty corners mean it drew nothing, which a window left over from an earlier frame cannot tell you.
|
private |
First candidate row on screen. Kept in step with the highlight while arrowing, and moved by the wheel.
|
private |
Index into m_completionCandidates.
|
private |
Current context: "POU" or "METHOD:name".
|
private |
Content of the currently open file.
|
private |
Path of the currently open file.
|
private |
Declarations of the open file, keyed by normalized name.
|
private |
Path of the file/folder pending deletion.
|
private |
|
private |
|
private |
Parsing errors.
|
private |
|
private |
Frames to skip after a programmatic load.
|
private |
Initialization flag.
|
private |
Editor text differs from the file on disk.
|
private |
|
private |
|
private |
|
private |
Lazily-created editors, keyed by method name.
|
private |
List of methods.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Which severities the Output panel shows. A member, not a local of renderOutputPanel(), because a local is rebuilt on every frame and the checkbox that writes it would be writing into a copy that dies at the end of the frame: the box would flip, the panel would ignore it, and nothing would say so.
|
private |
Lines to display in the Output panel
|
private |
Last line count the Output panel drew, so it can tell new output from old.
|
private |
What the Output panel is filtered by, as the user typed it. A member, and a fixed array rather than a std::string because ImGui 1.92.9's InputText takes a char buffer and this tree does not link imgui_stdlib, which is the wrapper that takes a std::string. A function-local static, which is what this was, also held its text and so appeared to work: it survived because it was static, not because the panel owned it, so a query typed for one project was still filtering the next one's log to nothing.
|
private |
Set for one frame when Tab asks for the parameters of the call being written. The editor it was asked for, since both are visited every frame and only the one holding the keyboard may answer it.
|
private |
Identifier to reveal after a file switch.
|
private |
File queued to open once the user decides.
|
private |
Request to select the POU tab.
|
private |
Tab to select once a pending file switch has completed.
|
private |
One-shot request to select a tab, honoured via ImGuiTabItemFlags_SetSelected.
METHOD to select, empty for none
|
private |
Body text for the main POU.
|
private |
Name of the current POU.
|
private |
Type of the current POU.
|
private |
Variables text for the main POU.
|
private |
Declarations of the sibling files, as the analyzer's external scope.
|
private |
|
private |
Root of the file tree.
|
private |
Cached analysis of the current AST, rebuilt by validateAndParse()
|
private |
True if add method popup is visible.
|
private |
True if delete confirmation popup is visible.
|
private |
True if delete method confirmation is visible.
|
private |
True while the confirmation popup is open.
|
private |
|
private |
Whether the Output panel dumps the generated ST in full. Off by default: it is hundreds of lines and it buried the diagnostics under it.
|
private |
True when a name is declared more than once.
|
private |
|
private |
|
private |
|
private |
|
private |
Hover tooltips are opt-in: they interrupt reading.
|
private |
Fallback workspace picker, for when neither tinyfiledialogs nor zenity is available. A modal of the app's own, so it has to be drawn by the panel.
|
private |
The callee the cursor is inside.
|
private |
Index of the argument the cursor is in.
|
private |
True when the cursor sits at an empty argument, which is what the inline parameter-name hint is drawn for
|
private |
Where that call is, for its label.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Screen rectangle the signature help took this frame, so a list anchored to the same cursor can step around it instead of covering it. Two corners rather than an ImRect, which lives in an internal header this one does not need. Equal corners mean nothing was on screen.
|
private |
Matching skeletons, best first.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Editor the list belongs to.
|
private |
|
private |
|
private |
Pane the list was built for.
|
private |
Line and column span the list would replace, in editor coordinates.
|
private |
One row per candidate, a byte per label character, 1 where the pattern matched.
|
private |
What the candidates were filtered with.
|
private |
|
private |
|
private |
First candidate row on screen.
|
private |
Index into m_snippetCandidates.
|
private |
Layout of the last generated file.
|
private |
It has been dragged and not yet written out.
|
private |
Where the Variables and Body sections are divided.
|
private |
Generated source, 1-based via index+1.
|
private |
Editor for the Variables section.
|
private |
|
private |
|
private |
|
mutableprivate |
METHODS of each indexed .st file, so the tree can show them.
|
private |
Current workspace path.