2#ifndef GYM_PCB_UI_ACTIONS_H
3#define GYM_PCB_UI_ACTIONS_H
7#include "UserSettings.hpp"
26 if (L->getParent() == R->getParent())
27 return L->name() < R->name();
28 if (L->getParent() && R->getParent())
29 return L->getParent()->name() < R->getParent()->name();
30 return !L->getParent();
33using ComSet = std::set<Component *, ObjectPtrNameLessThan>;
34using PinSet = std::set<Pin *, ObjectPtrNameLessThan>;
50 constexpr static const Real MinSegmentLenSq = 1.0;
55 Connection *getConnection()
const {
return mSelection.X; }
56 const auto& getSelectionSetC()
const {
return mSelection.sets.C; }
57 const auto& getSelectionSetP()
const {
return mSelection.sets.P; }
58 const std::vector<Connection *> *getActiveConnections()
const;
61 void deselect(
const Pin *);
62 void setSelection(
Object *);
64 void setSelection(
Pin *);
65 void setSelection(
const std::set<Object *>&);
66 void setSelectionLayer(
char);
67 char getSelectionLayer()
const;
68 void setPreview(
bool);
69 void setPreviewTrack(
const Track&,
bool legal);
70 bool isPreviewing()
const;
71 bool isPreviewReady()
const;
72 bool isPreviewStale()
const;
73 bool isPreviewTrackLegal()
const;
74 const Track& getRoutePreview()
const;
75 void discardPreview();
76 void setTimeoutMS(uint64_t);
77 void setActiveLayer(uint);
78 uint getActiveLayer()
const;
79 void setViaCost(
float);
80 bool autoroute(uint64_t timeoutMS);
84 bool routeTo(
const Point_2&);
85 void setRouteMode(
char mode);
86 char getRouteMode()
const;
87 char getLastRouteMode()
const;
88 bool routePreview(
const Point_2&);
89 bool routeToPointPreview(
const Point_25&);
90 bool addSegmentToPreview(
const Point_25&);
91 bool unrouteConnection();
92 bool unrouteSegment();
93 bool unrouteSelection();
94 void updateIndicators();
96 void setLockStepping(uint granularity);
98 void setSelectionType(
char c);
99 char getSelectionType()
const;
102 uint mActiveLayer{0};
104 char mLastRouteMode{
'*'};
105 bool mSnapToGrid{
true};
106 bool mPreview{
false};
107 bool mPreviewReady{
false};
108 bool mPreviewStale{
false};
109 bool mPreviewLegal{
false};
110 uint mLastPreviewPoint{std::numeric_limits<uint>::max()};
125 float mViaCost{1.0f};
126 void setNetAndConnectionFromPins();
127 void resetLastPreviewPoint();
128 void setPreviewStale();
129 void setSelectionNoNotify(
Pin *);
131 bool _autoroute(PinSet);
139 Point_25 getRouterStartPoint()
const;
142 std::future<bool> mAsyncRV;
146inline void UIActions::setUIElement(
ActionTab *A)
150inline void UIActions::setPreview(
bool b)
156inline void UIActions::setPreviewTrack(
const Track &T,
bool legal)
159 mPreviewReady =
true;
160 mPreviewStale =
false;
161 mPreviewLegal = legal;
163inline bool UIActions::isPreviewing()
const
167inline bool UIActions::isPreviewReady()
const
169 return mPreviewReady;
171inline bool UIActions::isPreviewStale()
const
173 return mPreviewStale;
175inline bool UIActions::isPreviewTrackLegal()
const
177 return mPreviewLegal;
179inline const Track& UIActions::getRoutePreview()
const
181 return mPreviewTrack;
183inline void UIActions::discardPreview()
185 mPreviewTrack.clear();
186 mPreviewReady =
false;
188inline void UIActions::setTimeoutMS(uint64_t ms)
192inline char UIActions::getRouteMode()
const
196inline char UIActions::getLastRouteMode()
const
198 return mLastRouteMode;
200inline uint UIActions::getActiveLayer()
const
204inline void UIActions::setSelectionLayer(
char c)
206 assert(c ==
'A' || c ==
'V' || c ==
'W' || c ==
'T' || c ==
'B');
207 mSelection.layer = c;
209inline char UIActions::getSelectionLayer()
const
211 return mSelection.layer;
213inline void UIActions::setSelectionType(
char c)
215 assert(c ==
'P' || c ==
'N' || c ==
'C');
218inline char UIActions::getSelectionType()
const
220 return mSelection.type;
223inline void UIActions::resetLastPreviewPoint()
225 mLastPreviewPoint = std::numeric_limits<uint>::max();
228inline void UIActions::setPreviewStale()
230 mPreviewStale =
true;
231 resetLastPreviewPoint();
234inline void UIActions::setViaCost(
float v)
236 UserSettings::edit().AStarViaCostFactor = mViaCost = v;
Definition ActionTab.hpp:35
Definition Component.hpp:18
Definition Connection.hpp:17
Definition Actions.hpp:20
bool operator()(const Object *L, const Object *R) const
Parent names take precedent, no parent counts as less.
Definition Actions.hpp:23
Definition Geometry.hpp:131
Definition Application.hpp:41