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)
 

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 processDrawTrace () noexcept
 
bool processAbortCommand () noexcept
 
bool processSelectAll () noexcept
 
bool processCut () noexcept
 
bool processCopy () noexcept
 
bool processPaste () noexcept
 
bool processRotateCw () noexcept
 
bool processRotateCcw () noexcept
 
bool processFlipHorizontal () noexcept
 
bool processFlipVertical () noexcept
 
bool processRemove () 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
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processDrawPolygon()

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

◆ processDrawPlane()

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

◆ processDrawTrace()

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

◆ processAbortCommand()

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

◆ processSelectAll()

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

◆ processCut()

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

◆ processCopy()

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

◆ processPaste()

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

◆ processRotateCw()

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

◆ processRotateCcw()

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

◆ processFlipHorizontal()

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

◆ processFlipVertical()

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

◆ processRemove()

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

◆ processKeyPressed()

bool processKeyPressed ( const QKeyEvent &  e)
noexcept
+ Here is the call graph for this function:

◆ processKeyReleased()

bool processKeyReleased ( const QKeyEvent &  e)
noexcept
+ Here is the call graph for this function:

◆ processGraphicsSceneMouseMoved()

bool processGraphicsSceneMouseMoved ( QGraphicsSceneMouseEvent &  e)
noexcept
+ Here is the call graph for this function:

◆ processGraphicsSceneLeftMouseButtonPressed()

bool processGraphicsSceneLeftMouseButtonPressed ( QGraphicsSceneMouseEvent &  e)
noexcept
+ Here is the call graph for this function:

◆ processGraphicsSceneLeftMouseButtonReleased()

bool processGraphicsSceneLeftMouseButtonReleased ( QGraphicsSceneMouseEvent &  e)
noexcept
+ Here is the call graph for this function:

◆ processGraphicsSceneLeftMouseButtonDoubleClicked()

bool processGraphicsSceneLeftMouseButtonDoubleClicked ( QGraphicsSceneMouseEvent &  e)
noexcept
+ Here is the call graph for this function:

◆ processGraphicsSceneRightMouseButtonReleased()

bool processGraphicsSceneRightMouseButtonReleased ( QGraphicsSceneMouseEvent &  e)
noexcept
+ Here is the call graph for this function:

◆ 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
+ Here is the call graph for this function:

◆ operator=()

BoardEditorFsm& operator= ( const BoardEditorFsm rhs)
delete

◆ stateChanged

void stateChanged ( State  newState)
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 call graph for this function:
+ 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:
+ Here is the caller graph for this function:

◆ switchToPreviousState()

bool switchToPreviousState ( )
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller 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: