SILICON
Loading...
Searching...
No Matches
EditorWorkspace Class Reference

Selects and hosts editors while preserving detached document preparation. More...

#include <editorWorkspace.hpp>

Inheritance diagram for EditorWorkspace:
Collaboration diagram for EditorWorkspace:

Classes

class  PreparedDocument

Signals

void activeEditorChanged ()
void historyStateChanged ()
 Emitted when the active editor's undo/redo availability may have changed.
void editStateChanged ()
 Emitted when the active editor's editing availability may have changed.
void editorCreated (DocumentEditor *editor)

Public Member Functions

 EditorWorkspace (ProjectSession &session, QWidget *parent=nullptr)
 ~EditorWorkspace () override
CircuitEditor & circuitEditor ()
DocumentEditor * activeEditor () const noexcept
bool hasUnsavedChanges () const
void setProjectHistory (QUndoStack *history) noexcept
 Applies the project-wide history shared by every hosted editor.
EditorEditState activeEditState () const
 Which generic editing commands the active editor currently accepts.
bool canUndoActiveDocument () const
bool canRedoActiveDocument () const
void resetEditorDirtyState () noexcept
void reset ()
void undoActiveDocument ()
void redoActiveDocument ()
void flushActiveDocument ()
void copyActiveDocument ()
void cutActiveDocument ()
void pasteActiveDocument ()
void deleteInActiveDocument ()
void zoomActiveDocument (bool in)
std::shared_ptr< PreparedDocument > prepareDocument (const SILICON::project::Document &document)
void activateDocument (const PreparedDocument &prepared)
void loadDocument (const SILICON::project::Document &document)

Private Member Functions

DocumentEditor & editorFor (SILICON::project::DocumentType type)
CodeDocumentEditor & ensureCodeEditor ()
BinaryDocumentEditor & ensureBinaryEditor ()
ArchitectureDocumentEditor & ensureArchitectureEditor ()
EditorNotifications notifications ()

Private Attributes

ProjectSession & session
QStackedWidget * stack
DocumentEditor * activeDocumentEditor = nullptr
QUndoStack * projectHistory = nullptr
std::unique_ptr< CircuitEditor > circuit
std::unique_ptr< CodeDocumentEditor > code
std::unique_ptr< BinaryDocumentEditor > binary
std::unique_ptr< ArchitectureDocumentEditor > architecture
CallbackScope callbacks

Detailed Description

Selects and hosts editors while preserving detached document preparation.

Single source of truth for the active editor's action state: editor-local changes arrive through EditorNotifications, and the global clipboard is observed once here, so consumers only ever observe this workspace's signals.

Definition at line 39 of file editorWorkspace.hpp.

Constructor & Destructor Documentation

◆ EditorWorkspace()

EditorWorkspace ( ProjectSession & session,
QWidget * parent = nullptr )
explicit

Definition at line 35 of file editorWorkspace.cpp.

◆ ~EditorWorkspace()

~EditorWorkspace ( )
overridedefault

Member Function Documentation

◆ activateDocument()

void activateDocument ( const PreparedDocument & prepared)

Definition at line 203 of file editorWorkspace.cpp.

◆ activeEditor()

DocumentEditor * activeEditor ( ) const
inlinenodiscardnoexcept

Definition at line 48 of file editorWorkspace.hpp.

◆ activeEditorChanged

void activeEditorChanged ( )
signal

◆ activeEditState()

EditorEditState activeEditState ( ) const
nodiscard

Which generic editing commands the active editor currently accepts.

Definition at line 130 of file editorWorkspace.cpp.

◆ canRedoActiveDocument()

bool canRedoActiveDocument ( ) const
nodiscard

Definition at line 143 of file editorWorkspace.cpp.

◆ canUndoActiveDocument()

bool canUndoActiveDocument ( ) const
nodiscard

Definition at line 139 of file editorWorkspace.cpp.

◆ circuitEditor()

CircuitEditor & circuitEditor ( )

Definition at line 57 of file editorWorkspace.cpp.

◆ copyActiveDocument()

void copyActiveDocument ( )

Definition at line 212 of file editorWorkspace.cpp.

◆ cutActiveDocument()

void cutActiveDocument ( )

Definition at line 217 of file editorWorkspace.cpp.

◆ deleteInActiveDocument()

void deleteInActiveDocument ( )

Definition at line 227 of file editorWorkspace.cpp.

◆ editorCreated

void editorCreated ( DocumentEditor * editor)
signal

◆ editorFor()

DocumentEditor & editorFor ( SILICON::project::DocumentType type)
nodiscardprivate

Definition at line 94 of file editorWorkspace.cpp.

◆ editStateChanged

void editStateChanged ( )
signal

Emitted when the active editor's editing availability may have changed.

Aggregates the selection-driven and mode-driven changes reported by every hosted editor through EditorNotifications, plus the clipboard changes observed above, so observers never have to subscribe to an individual editor or to the clipboard.

◆ ensureArchitectureEditor()

ArchitectureDocumentEditor & ensureArchitectureEditor ( )
private

Definition at line 84 of file editorWorkspace.cpp.

◆ ensureBinaryEditor()

BinaryDocumentEditor & ensureBinaryEditor ( )
private

Definition at line 75 of file editorWorkspace.cpp.

◆ ensureCodeEditor()

CodeDocumentEditor & ensureCodeEditor ( )
private

Definition at line 66 of file editorWorkspace.cpp.

◆ flushActiveDocument()

void flushActiveDocument ( )

Definition at line 181 of file editorWorkspace.cpp.

◆ hasUnsavedChanges()

bool hasUnsavedChanges ( ) const
nodiscard

Definition at line 134 of file editorWorkspace.cpp.

◆ historyStateChanged

void historyStateChanged ( )
signal

Emitted when the active editor's undo/redo availability may have changed.

Aggregates the history notifications of every hosted editor, of the project-wide undo stack, and of the architecture tabs, so observers never have to subscribe to an individual editor.

◆ loadDocument()

void loadDocument ( const SILICON::project::Document & document)

Definition at line 232 of file editorWorkspace.cpp.

◆ notifications()

EditorNotifications notifications ( )
nodiscardprivate

Definition at line 51 of file editorWorkspace.cpp.

◆ pasteActiveDocument()

void pasteActiveDocument ( )

Definition at line 222 of file editorWorkspace.cpp.

◆ prepareDocument()

std::shared_ptr< EditorWorkspace::PreparedDocument > prepareDocument ( const SILICON::project::Document & document)
nodiscard

Definition at line 198 of file editorWorkspace.cpp.

◆ redoActiveDocument()

void redoActiveDocument ( )

Definition at line 176 of file editorWorkspace.cpp.

◆ reset()

void reset ( )

Definition at line 158 of file editorWorkspace.cpp.

◆ resetEditorDirtyState()

void resetEditorDirtyState ( )
noexcept

Definition at line 147 of file editorWorkspace.cpp.

◆ setProjectHistory()

void setProjectHistory ( QUndoStack * history)
noexcept

Applies the project-wide history shared by every hosted editor.

Replacing the history re-points every editor and drops the previous stack subscriptions; passing nullptr detaches the editors from any history.

Definition at line 105 of file editorWorkspace.cpp.

◆ undoActiveDocument()

void undoActiveDocument ( )

Definition at line 171 of file editorWorkspace.cpp.

◆ zoomActiveDocument()

void zoomActiveDocument ( bool in)

Definition at line 236 of file editorWorkspace.cpp.

Member Data Documentation

◆ activeDocumentEditor

DocumentEditor* activeDocumentEditor = nullptr
private

Definition at line 114 of file editorWorkspace.hpp.

◆ architecture

std::unique_ptr<ArchitectureDocumentEditor> architecture
private

Definition at line 119 of file editorWorkspace.hpp.

◆ binary

std::unique_ptr<BinaryDocumentEditor> binary
private

Definition at line 118 of file editorWorkspace.hpp.

◆ callbacks

CallbackScope callbacks
private

Definition at line 120 of file editorWorkspace.hpp.

◆ circuit

std::unique_ptr<CircuitEditor> circuit
private

Definition at line 116 of file editorWorkspace.hpp.

◆ code

std::unique_ptr<CodeDocumentEditor> code
private

Definition at line 117 of file editorWorkspace.hpp.

◆ projectHistory

QUndoStack* projectHistory = nullptr
private

Definition at line 115 of file editorWorkspace.hpp.

◆ session

ProjectSession& session
private

Definition at line 112 of file editorWorkspace.hpp.

◆ stack

QStackedWidget* stack
private

Definition at line 113 of file editorWorkspace.hpp.


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