LibrePCB Developers Documentation
BoardEditorFsm Class Referencefinal

The board editor finite state machine. More...

#include <boardeditorfsm.h>

Inherits QObject.

+ Collaboration diagram for BoardEditorFsm:

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

 BoardEditorFsm ()=delete
 
 BoardEditorFsm (const BoardEditorFsm &other)=delete
 
 BoardEditorFsm (const Context &context, QObject *parent=nullptr) noexcept
 
virtual ~BoardEditorFsm () noexcept
 
State getCurrentState () const noexcept
 
bool processSelect () noexcept
 
bool processAddHole () noexcept
 
bool processAddStrokeText () noexcept
 
bool processAddVia () noexcept
 
bool processAddDevice (ComponentInstance &component, const Uuid &device, const Uuid &footprint) noexcept
 
bool processDrawPolygon () noexcept
 
bool processDrawPlane () noexcept
 
bool processDrawZone () noexcept
 
bool processDrawTrace () noexcept
 
bool processImportDxf () 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 processFlip (Qt::Orientation orientation) noexcept
 
bool processSnapToGrid () noexcept
 
bool processSetLocked (bool locked) noexcept
 
bool processChangeLineWidth (int step) 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 processSwitchToBoard (int index) noexcept
 
BoardEditorFsmoperator= (const BoardEditorFsm &rhs)=delete
 

Private Member Functions

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

Private Attributes

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

Detailed Description

The board editor finite state machine.

Member Enumeration Documentation

◆ State

Constructor & Destructor Documentation

◆ BoardEditorFsm() [1/3]

BoardEditorFsm ( )
delete

◆ BoardEditorFsm() [2/3]

BoardEditorFsm ( const BoardEditorFsm other)
delete

◆ BoardEditorFsm() [3/3]

BoardEditorFsm ( const Context context,
QObject *  parent = nullptr 
)
explicitnoexcept
+ Here is the call graph for this function:

◆ ~BoardEditorFsm()

~BoardEditorFsm ( )
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:
+ Here is the caller graph for this function:

◆ processAddHole()

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

◆ processAddStrokeText()

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

◆ processAddVia()

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

◆ processAddDevice()

bool processAddDevice ( ComponentInstance component,
const Uuid device,
const Uuid footprint 
)
noexcept

◆ processDrawPolygon()

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

◆ processDrawPlane()

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

◆ processDrawZone()

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

◆ processDrawTrace()

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

◆ processImportDxf()

bool processImportDxf ( )
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

◆ processFlip()

bool processFlip ( Qt::Orientation  orientation)
noexcept

◆ processSnapToGrid()

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

◆ processSetLocked()

bool processSetLocked ( bool  locked)
noexcept

◆ processChangeLineWidth()

bool processChangeLineWidth ( int  step)
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

◆ processSwitchToBoard()

bool processSwitchToBoard ( int  index)
noexcept

Switch to another board

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

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

◆ operator=()

BoardEditorFsm & operator= ( const BoardEditorFsm 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()

BoardEditorState * 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, BoardEditorState*> mStates
private

◆ mCurrentState

State mCurrentState
private

◆ mPreviousState

State mPreviousState
private

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