|
KiCad PCB EDA Suite
|
Arc drawing mode and tangent seed bookkeeping for one pass of an editor's managed-shape draw loop. More...
#include <arc_mode_session.h>
Public Types | |
| using | SEED_FINDER |
| Tangent seed from a graphic under the cursor, given the raw and the snapped cursor positions. | |
Public Member Functions | |
| ARC_MODE_SESSION (SHAPE_DRAW_BEHAVIOR &aBehavior, APP_SETTINGS_BASE *aSettings, bool aDrawingArc, const std::optional< ARC_TANGENT_SEED > &aChainSeed, SEED_FINDER aFindSeed, std::function< void(ARC_DRAW_MODE)> aOnModeChanged) | |
| ARC_DRAW_MODE | Mode () const |
| void | SetMode (ARC_DRAW_MODE aMode) |
| Switch mode mid-draw, which drops any seed. Does nothing unless an arc is being drawn. | |
| bool | HandleModeEvent (const TOOL_EVENT &aEvent) |
| Handle a mode or cycle action; return true if aEvent was one. | |
| void | PlacePoint (const VECTOR2I &aMouse, const VECTOR2I &aPos) |
| Lock in a point, or seed a tangent arc from the graphic under it when it would be the arc's first point. | |
| void | RemoveLastPoint () |
| Undo the last point. A seed taken from a click is undone too, one from a chain is kept. | |
Private Attributes | |
| SHAPE_DRAW_BEHAVIOR & | m_behavior |
| APP_SETTINGS_BASE * | m_settings |
| bool | m_drawingArc |
| bool | m_chainSeeded |
| bool | m_clickSeeded = false |
| SEED_FINDER | m_findSeed |
| std::function< void(ARC_DRAW_MODE)> | m_onModeChanged |
Arc drawing mode and tangent seed bookkeeping for one pass of an editor's managed-shape draw loop.
The editor supplies how to find a graphic to seed a tangent arc from and what to refresh when the mode changes. For shapes other than arcs the session only forwards points to the behavior.
Definition at line 49 of file arc_mode_session.h.
Tangent seed from a graphic under the cursor, given the raw and the snapped cursor positions.
Definition at line 53 of file arc_mode_session.h.
| ARC_MODE_SESSION::ARC_MODE_SESSION | ( | SHAPE_DRAW_BEHAVIOR & | aBehavior, |
| APP_SETTINGS_BASE * | aSettings, | ||
| bool | aDrawingArc, | ||
| const std::optional< ARC_TANGENT_SEED > & | aChainSeed, | ||
| SEED_FINDER | aFindSeed, | ||
| std::function< void(ARC_DRAW_MODE)> | aOnModeChanged ) |
| aChainSeed | seeds the arc from the previous one in a chain. It is applied here, so construct the session after the behavior's Reset(). |
Definition at line 44 of file arc_mode_session.cpp.
References m_behavior, m_chainSeeded, m_drawingArc, m_findSeed, m_onModeChanged, m_settings, and move.
| bool ARC_MODE_SESSION::HandleModeEvent | ( | const TOOL_EVENT & | aEvent | ) |
Handle a mode or cycle action; return true if aEvent was one.
Definition at line 82 of file arc_mode_session.cpp.
References TOOL_EVENT::Category(), ACTIONS::cycleArcDrawMode, IncrementArcDrawMode(), TOOL_EVENT::IsAction(), m_drawingArc, Mode(), TOOL_EVENT::ParameterIf(), SetMode(), and TC_COMMAND.
Referenced by DRAWING_TOOL::drawManagedShape().
| ARC_DRAW_MODE ARC_MODE_SESSION::Mode | ( | ) | const |
Definition at line 59 of file arc_mode_session.cpp.
References CENTER_START_END, and m_settings.
Referenced by HandleModeEvent(), and PlacePoint().
Lock in a point, or seed a tangent arc from the graphic under it when it would be the arc's first point.
Definition at line 103 of file arc_mode_session.cpp.
References m_behavior, m_chainSeeded, m_clickSeeded, m_drawingArc, m_findSeed, Mode(), and TANGENT.
Referenced by DRAWING_TOOL::drawManagedShape().
| void ARC_MODE_SESSION::RemoveLastPoint | ( | ) |
Undo the last point. A seed taken from a click is undone too, one from a chain is kept.
Definition at line 122 of file arc_mode_session.cpp.
References m_behavior, and m_clickSeeded.
Referenced by DRAWING_TOOL::drawManagedShape().
| void ARC_MODE_SESSION::SetMode | ( | ARC_DRAW_MODE | aMode | ) |
Switch mode mid-draw, which drops any seed. Does nothing unless an arc is being drawn.
Definition at line 65 of file arc_mode_session.cpp.
References m_behavior, m_chainSeeded, m_clickSeeded, m_drawingArc, m_onModeChanged, and m_settings.
Referenced by HandleModeEvent().
|
private |
Definition at line 79 of file arc_mode_session.h.
Referenced by ARC_MODE_SESSION(), PlacePoint(), RemoveLastPoint(), and SetMode().
|
private |
Definition at line 82 of file arc_mode_session.h.
Referenced by ARC_MODE_SESSION(), PlacePoint(), and SetMode().
|
private |
Definition at line 83 of file arc_mode_session.h.
Referenced by PlacePoint(), RemoveLastPoint(), and SetMode().
|
private |
Definition at line 81 of file arc_mode_session.h.
Referenced by ARC_MODE_SESSION(), HandleModeEvent(), PlacePoint(), and SetMode().
|
private |
Definition at line 84 of file arc_mode_session.h.
Referenced by ARC_MODE_SESSION(), and PlacePoint().
|
private |
Definition at line 85 of file arc_mode_session.h.
Referenced by ARC_MODE_SESSION(), and SetMode().
|
private |
Definition at line 80 of file arc_mode_session.h.
Referenced by ARC_MODE_SESSION(), Mode(), and SetMode().