Generated reference › API — ICoreSDK/ICoreStudio/StudioObjects/Panels/CommandWindow
kind: generated#api#icoresdk-icorestudio-studioobjects-panels-commandwindow

API — ICoreSDK/ICoreStudio/StudioObjects/Panels/CommandWindow

The public contract of 4 header(s) under src/ICoreSDK/ICoreStudio/StudioObjects/Panels/CommandWindow — 6 class/struct definition(s), 37 declaration(s). Each section shows the header's banner and its public (and protected-virtual) surface exactly as the file writes it.

ICoreCommandBar.h#

src/ICoreSDK/ICoreStudio/StudioObjects/Panels/CommandWindow/ICoreCommandBar.h

Supplies the candidate names for Tab completion and the live suggestion popup (e.g. command + function names). Keeps the bar decoupled from any specific command system.

ICoreCommandBar#

ICoreCommandBar.h:19 · class · bases public ICoreWidget · pImpl · 20 declaration(s)

class ICoreCommandBar : public ICoreWidget {
public:
    explicit ICoreCommandBar(ICoreWidget* parent = nullptr);

    double bgOpacity() const;
    void setBgOpacity(double opacity);
    void animateBackgroundOpacity(double targetOpacity);

    void cancelCommand();
    void showClearButton() const;
    void focusInput() const;   // put the keyboard caret back in the input line

    // Supplies the candidate names for Tab completion and the live suggestion
    // popup (e.g. command + function names). Keeps the bar decoupled from any
    // specific command system.
    using CompletionSource = std::function<ICoreStringList()>;
    void setCompletionSource(CompletionSource source);

    // True while the live suggestion popup is showing — the input box defers
    // Up/Down to the popup instead of walking history.
    bool isCompleterPopupVisible() const;

    // True once the user has arrowed onto one of the popup's entries. From that
    // moment Enter/Tab belong to the suggestion, not to the half-typed line
    // underneath it.
    bool hasHighlightedCompletion() const;

    // Put the arrowed-onto suggestion into the line (replacing just the name
    // being typed) and close the popup. Returns false — leaving the line
    // untouched — when no entry was picked, so the caller can carry on with
    // whatever the key normally does.
    bool acceptHighlightedCompletion();

    void hideCompleterPopup();

    // Re-evaluate the suggestion list against the text/caret currently in the
    // input. Called on every edit; also after a Tab fills part of a name in.
    void refreshCompletions();

    // Tab completion against the completion source: takes the highlighted
    // suggestion if there is one, otherwise fills the name being typed in as far
    // as the candidates unambiguously agree.
    void tabComplete();

    // Records a submitted line and resets the recall cursor to the newest entry.
    void pushHistory(const ICoreString& commandLine);
    // Up/Down recall. `currentDraft` is the in-progress text, stashed on the
    // first Up so Down past the newest entry can restore it.
    ICoreString historyPrevious(const ICoreString& currentDraft);
    ICoreString historyNext();

    ~ICoreCommandBar() override;

    // Raised when the user presses Enter on a non-empty line. The input is
    // cleared right after, so the console owns the submitted text from here on.
    ICoreSignal<ICoreString> onCommandEntered;

protected:
    void paintContent(ICorePainter& painter) override;
    void pointerEntered() override;
    void pointerLeft() override;

private:
    class Impl;                    // the two-line residue; state lives here
    std::unique_ptr<Impl> impl;
};

ICoreCommandTextBox#

ICoreCommandBar.h:90 · class · bases public ICoreLineEdit · pImpl · 2 declaration(s)

class ICoreCommandTextBox : public ICoreLineEdit {
public:
    // The body moved to the .cpp with the state it sets up: it was the largest
    // in-header body in this module (the header surface rule).
    explicit ICoreCommandTextBox(ICoreCommandBar* parent);

    // Declared, defined in the .cpp: the residue below is a unique_ptr to an
    // Impl this header cannot see.
    ~ICoreCommandTextBox() override;

private:
    class Impl;                    // the two-line residue; state lives here
    std::unique_ptr<Impl> impl;
};

ICoreCommandHistoryStore.h#

src/ICoreSDK/ICoreStudio/StudioObjects/Panels/CommandWindow/ICoreCommandHistoryStore.h

ICoreCommandHistoryStore

Persistence for the command console's Up/Down recall list, so the arrow keys reach lines typed in EARLIER runs of the application and not just this one. Lines are kept, one per line and oldest first, in a flat text file inside the stable application home folder (ICoreDocumentsFolder:: getApplicationHomeFolderPath), the same place and the same shape ICoreRecentProjects uses.

Why APPEND and not rewrite


The application home folder is shared by every instance of the app running as this user -- it is deliberately not sandboxed. A submit therefore appends its one line rather than writing the whole list back: two instances open at

ICoreCommandHistoryStoreNotifier#

ICoreCommandHistoryStore.h:33 · class · final · 0 declaration(s)

ICoreCommandHistoryStore is an all-static facade with no instance to hang a signal on, so the one signal it raises lives on a small notifier beside it -- the shape ICoreUserPreferences uses for the...

class ICoreCommandHistoryStoreNotifier final {
public:
    // Raised by clear(). A live recall list must drop its IN-MEMORY copy when
    // the file goes: clearing only the file would leave Up still walking this
    // session's lines and the next submit writing them straight back.
    ICoreSignal<> onHistoryCleared;
};
};

ICoreCommandHistoryStore#

ICoreCommandHistoryStore.h:43 · class · 7 declaration(s)

class ICoreCommandHistoryStore {
public:
    // The change-signal source -- see ICoreCommandHistoryStoreNotifier.
    static ICoreCommandHistoryStoreNotifier& notifier();

    // Binds the console verb that clears the history (clearCommandHistory).
    // Called once from Initialization, beside the other registerAll()s.
    static void registerConsoleCommands();

    // Oldest -> newest, already capped at maxEntries(), trimming the file if it
    // had grown past it. Empty on first launch, which is not an error -- and
    // empty at depth 0, where it deliberately leaves the file alone.
    static std::vector<std::string> load();

    // Records one submitted line. Blank lines and a line identical to the one
    // already at the end of the file are dropped, so holding Enter on a command
    // does not fill the file with it. Records nothing at all at depth 0.
    static void append(const std::string& commandLine);

    // Forgets every recorded line and raises notifier().onHistoryCleared, so a
    // live recall list empties with the file. This is the console's "clear
    // history", not its "clear the output pane" -- and it has no visible
    // effect, which is why it reports HOW MANY lines it dropped rather than
    // succeeding in silence the way cls() can afford to.
    static size_t clear();

    // Where the list is kept: <application home>/commandHistory.txt. Public for
    // the same reason ICoreRecentProjects::recentProjectsFilePath() is -- the
    // regression suite has to leave a non-sandboxed application home exactly as
    // it found it, and needs to name the file without restating it.
    static std::filesystem::path historyFilePath();

    // How many lines survive a trim: ICoreUserPreferences::
    // getCommandHistoryDepth(), which Settings -> Editor -> Command Console
    // drives. ZERO means recall is off -- append() writes nothing and load()
    // returns nothing, but neither erases the file that is already there.
    static size_t maxEntries();
};
};

ICoreCommandScriptWindow.h#

src/ICoreSDK/ICoreStudio/StudioObjects/Panels/CommandWindow/ICoreCommandScriptWindow.h

ICoreCommandScriptWindow#

ICoreCommandScriptWindow.h:29 · class · bases public ICoreWidget · pImpl · 2 declaration(s)

Standalone Script Runner window, opened from the block editor's left fixed panel.

class ICoreCommandScriptWindow : public ICoreWidget {
public:
    explicit ICoreCommandScriptWindow(ICoreWidget* parent = nullptr);
    ~ICoreCommandScriptWindow() override;

protected:
    void shown() override;      // refresh the explorer from disk on open
    bool closing() override;    // autosave the open script on close
private:
    class Impl;                    // the two-line residue; state lives here
    std::unique_ptr<Impl> impl;
};

ICoreCommandWindow.h#

src/ICoreSDK/ICoreStudio/StudioObjects/Panels/CommandWindow/ICoreCommandWindow.h

ICoreCommandWindow#

ICoreCommandWindow.h:21 · class · bases public ICoreWidget · pImpl · nested LineResult · 6 declaration(s)

Self-use developer command console with a Python-REPL feel.

class ICoreCommandWindow : public ICoreWidget {
public:
    explicit ICoreCommandWindow(ICoreWidget* parent = nullptr);

    ICoreLoggerTextBox* getHistoryTextBox() const;

    // Outcome of resolving a single console line (see evaluateLine).
    struct LineResult {
        bool    ok = true;   // false => the line failed (render/log as an error)
        ICoreString output;      // the text the prompt would have printed
    };

    // Resolve one console line through the exact same grammar the interactive
    // prompt uses — recipe statements, assignment, variable read, bare expression,
    // then a command dispatched via ICoreCommandEngine — but with no UI side
    // effects, returning the text/outcome instead of printing it. Lets other tools
    // (the Script Runner) reuse the full console behaviour. Assignment side effects
    // (declaring variables, autosave) still apply, exactly as at the prompt.
    // `;` separates multiple statements on one line (top-level only — a matrix
    // literal's row-separating ';' inside "[...]" is left alone); they run in
    // order and stop at the first failure, same as separate lines would. As in
    // MATLAB, a statement ending in ';' is silent: its output is dropped when it
    // succeeds (errors are always reported), so "A = 5;" declares without echoing.
    static LineResult evaluateLine(const ICoreString& line);

    // True when every statement on `line` is ';'-terminated (nothing follows the
    // last top-level ';'), so a successful run prints nothing whatsoever. Callers
    // that echo the source line before running it — the Script Runner — use this
    // to drop the echo too, otherwise the ';' would silence the output but leave
    // a bare ">>> line" behind. Failures should still be echoed for context.
    static bool isFullySuppressed(const ICoreString& line);

    // Variable lookup for ICoreExpressionEvaluator: rebuilds the typed ICoreValue
    // (matrix / polynomial / tf / state-space) from the global variables space.
    // Exposed so other command-engine commands can evaluate matrix expressions
    // the same way the console prompt does (e.g. plot's matrix argument).
    static bool resolveGlobalVariable(const std::string& name, ICoreValue& out);

    ~ICoreCommandWindow() override;
private:
    class Impl;                    // the two-line residue; state lives here
    std::unique_ptr<Impl> impl;
};