LibrePCB Developers Documentation
SchematicEditorFsm Class Referencefinal

The schematic editor finite state machine (FSM) More...

#include <schematiceditorfsm.h>

Inherits QObject.

+ Collaboration diagram for SchematicEditorFsm:

Classes

struct  Context
 FSM Context. More...
 

Public Types

enum  State
 FSM States. More...
 

Signals

void stateChanged (State newState)
 
void statusBarMessageChanged (const QString &message, int timeoutMs=-1)
 

Public Member Functions

 SchematicEditorFsm ()=delete
 
 SchematicEditorFsm (const SchematicEditorFsm &other)=delete
 
 SchematicEditorFsm (const Context &context, QObject *parent=nullptr) noexcept
 
virtual ~SchematicEditorFsm () noexcept
 
State getCurrentState () const noexcept
 
bool processSelect () noexcept
 
bool processAddComponent (const QString &searchTerm=QString()) noexcept
 
bool processAddComponent (const Uuid &cmp, const Uuid &symbVar) noexcept
 
bool processAddNetLabel () noexcept
 
bool processDrawPolygon () noexcept
 
bool processAddText () noexcept
 
bool processDrawWire () noexcept
 
bool processMeasure () noexcept
 
bool processAbortCommand () noexcept
 
bool processSelectAll () noexcept
 
bool processCut () noexcept
 
bool processCopy () noexcept
 
bool processPaste () noexcept
 
bool processMove (const Point &delta) noexcept
 
bool processRotate (const Angle &rotation) noexcept
 
bool processMirror (Qt::Orientation orientation) noexcept
 
bool processResetAllTexts () noexcept
 
bool processRemove () noexcept
 
bool processEditProperties () noexcept
 
bool processKeyPressed (const QKeyEvent &e) noexcept
 
bool processKeyReleased (const QKeyEvent &e) noexcept
 
bool processGraphicsSceneMouseMoved (QGraphicsSceneMouseEvent &e) noexcept
 
bool processGraphicsSceneLeftMouseButtonPressed (QGraphicsSceneMouseEvent &e) noexcept
 
bool processGraphicsSceneLeftMouseButtonReleased (QGraphicsSceneMouseEvent &e) noexcept
 
bool processGraphicsSceneLeftMouseButtonDoubleClicked (QGraphicsSceneMouseEvent &e) noexcept
 
bool processGraphicsSceneRightMouseButtonReleased (QGraphicsSceneMouseEvent &e) noexcept
 
bool processSwitchToSchematicPage (int index) noexcept
 
SchematicEditorFsmoperator= (const SchematicEditorFsm &rhs)=delete
 

Private Member Functions

SchematicEditorStategetCurrentStateObj () const noexcept
 
bool setNextState (State state) noexcept
 
bool leaveCurrentState () noexcept
 
bool enterNextState (State state) noexcept
 
bool switchToPreviousState () noexcept
 

Private Attributes

QMap< State, SchematicEditorState * > mStates
 
State mCurrentState
 
State mPreviousState
 

Detailed Description

The schematic editor finite state machine (FSM)

Member Enumeration Documentation

◆ State

Constructor & Destructor Documentation

◆ SchematicEditorFsm() [1/3]

SchematicEditorFsm ( )
delete

◆ SchematicEditorFsm() [2/3]

SchematicEditorFsm ( const SchematicEditorFsm other)
delete

◆ SchematicEditorFsm() [3/3]

SchematicEditorFsm ( const Context context,
QObject *  parent = nullptr 
)
explicitnoexcept

◆ ~SchematicEditorFsm()

~SchematicEditorFsm ( )
virtualnoexcept
+ Here is the call graph for this function:

Member Function Documentation

◆ getCurrentState()

State getCurrentState ( ) const
inlinenoexcept

◆ processSelect()

bool processSelect ( )
noexcept
+ Here is the call graph for this function:

◆ processAddComponent() [1/2]

bool processAddComponent ( const QString &  searchTerm = QString())
noexcept

◆ processAddComponent() [2/2]

bool processAddComponent ( const Uuid cmp,
const Uuid symbVar 
)
noexcept

◆ processAddNetLabel()

bool processAddNetLabel ( )
noexcept
+ Here is the call graph for this function:

◆ processDrawPolygon()

bool processDrawPolygon ( )
noexcept
+ Here is the call graph for this function:

◆ processAddText()

bool processAddText ( )
noexcept
+ Here is the call graph for this function:

◆ processDrawWire()

bool processDrawWire ( )
noexcept
+ Here is the call graph for this function:

◆ processMeasure()

bool processMeasure ( )
noexcept
+ Here is the call graph for this function:

◆ processAbortCommand()

bool processAbortCommand ( )
noexcept
+ Here is the call graph for this function:

◆ processSelectAll()

bool processSelectAll ( )
noexcept
+ Here is the call graph for this function:

◆ processCut()

bool processCut ( )
noexcept
+ Here is the call graph for this function:

◆ processCopy()

bool processCopy ( )
noexcept
+ Here is the call graph for this function:

◆ processPaste()

bool processPaste ( )
noexcept
+ Here is the call graph for this function:

◆ processMove()

bool processMove ( const Point delta)
noexcept

◆ processRotate()

bool processRotate ( const Angle rotation)
noexcept

◆ processMirror()

bool processMirror ( Qt::Orientation  orientation)
noexcept

◆ processResetAllTexts()

bool processResetAllTexts ( )
noexcept
+ Here is the call graph for this function:

◆ processRemove()

bool processRemove ( )
noexcept
+ Here is the call graph for this function:

◆ processEditProperties()

bool processEditProperties ( )
noexcept
+ Here is the call graph for this function:

◆ processKeyPressed()

bool processKeyPressed ( const QKeyEvent &  e)
noexcept

◆ processKeyReleased()

bool processKeyReleased ( const QKeyEvent &  e)
noexcept

◆ processGraphicsSceneMouseMoved()

bool processGraphicsSceneMouseMoved ( QGraphicsSceneMouseEvent &  e)
noexcept

◆ processGraphicsSceneLeftMouseButtonPressed()

bool processGraphicsSceneLeftMouseButtonPressed ( QGraphicsSceneMouseEvent &  e)
noexcept

◆ processGraphicsSceneLeftMouseButtonReleased()

bool processGraphicsSceneLeftMouseButtonReleased ( QGraphicsSceneMouseEvent &  e)
noexcept

◆ processGraphicsSceneLeftMouseButtonDoubleClicked()

bool processGraphicsSceneLeftMouseButtonDoubleClicked ( QGraphicsSceneMouseEvent &  e)
noexcept

◆ processGraphicsSceneRightMouseButtonReleased()

bool processGraphicsSceneRightMouseButtonReleased ( QGraphicsSceneMouseEvent &  e)
noexcept

◆ processSwitchToSchematicPage()

bool processSwitchToSchematicPage ( int  index)
noexcept

Switch to another schematic page

If someone (the user or the application) wants to switch to another schematic page in the schematic editor, this is not allowed at any time (for example, while drawing a netline in the active schematic, you cannot switch to another schematic). So this kind of event must be processed by the FSM. The FSM then will only decide whether changing the schematic is allowed (event accepted) or not (event rejected). If the event was accepted, the schematic editor then is allowed to switch to the requested schematic page.

Parameters
indexThe new schematic page index
Return values
trueIf switching is allowed
falseIf switching is rejected

◆ operator=()

SchematicEditorFsm & operator= ( const SchematicEditorFsm rhs)
delete

◆ stateChanged

void stateChanged ( State  newState)
signal
+ Here is the caller graph for this function:

◆ statusBarMessageChanged

void statusBarMessageChanged ( const QString &  message,
int  timeoutMs = -1 
)
signal
+ Here is the caller graph for this function:

◆ getCurrentStateObj()

SchematicEditorState * getCurrentStateObj ( ) const
privatenoexcept
+ Here is the caller graph for this function:

◆ setNextState()

bool setNextState ( State  state)
privatenoexcept
+ Here is the caller graph for this function:

◆ leaveCurrentState()

bool leaveCurrentState ( )
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enterNextState()

bool enterNextState ( State  state)
privatenoexcept
+ Here is the call graph for this function:

◆ switchToPreviousState()

bool switchToPreviousState ( )
privatenoexcept
+ Here is the call graph for this function:

Member Data Documentation

◆ mStates

QMap<State, SchematicEditorState*> mStates
private

◆ mCurrentState

State mCurrentState
private

◆ mPreviousState

State mPreviousState
private

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