KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pl_selection_tool.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2019 CERN
5 * Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <advanced_config.h>
26#include <view/view.h>
27#include <view/view_controls.h>
29#include <tool/tool_event.h>
30#include <tool/tool_manager.h>
31#include <tool/selection.h>
34#include <tools/pl_actions.h>
38#include <collector.h>
39#include <math/util.h> // for KiROUND
40
41#include "pl_editor_frame.h"
42
43
44#define HITTEST_THRESHOLD_PIXELS 3
45
46
48 SELECTION_TOOL( "plEditor.InteractiveSelection" ),
49 m_frame( nullptr )
50{
51}
52
53
55{
56 m_frame = getEditFrame<PL_EDITOR_FRAME>();
57
58 auto& menu = m_menu.GetMenu();
59
60 menu.AddSeparator( 200 );
65
66 menu.AddSeparator( 1000 );
68
69 m_disambiguateTimer.SetOwner( this );
70 Connect( wxEVT_TIMER, wxTimerEventHandler( PL_SELECTION_TOOL::onDisambiguationExpire ), nullptr, this );
71
72 return true;
73}
74
75
77{
78 if( aReason == MODEL_RELOAD )
79 m_frame = getEditFrame<PL_EDITOR_FRAME>();
80}
81
82
84{
85 // Main loop: keep receiving events
86 while( TOOL_EVENT* evt = Wait() )
87 {
88 // on left click, a selection is made, depending on modifiers ALT, SHIFT, CTRL:
89 setModifiersState( evt->Modifier( MD_SHIFT ), evt->Modifier( MD_CTRL ),
90 evt->Modifier( MD_ALT ) );
91
92 if( evt->IsMouseDown( BUT_LEFT ) )
93 {
94 // Avoid triggering when running under other tools
96
97 if( m_frame->ToolStackIsEmpty() && pt_tool && !pt_tool->HasPoint() )
98 {
101 }
102 }
103 // Single click? Select single object
104 else if( evt->IsClick( BUT_LEFT ) )
105 {
106 // If the timer has stopped, then we have already run the disambiguate routine
107 // and we don't want to register an extra click here
108 if( !m_disambiguateTimer.IsRunning() )
109 {
110 evt->SetPassEvent();
111 continue;
112 }
113
114 m_disambiguateTimer.Stop();
115 SelectPoint( evt->Position() );
116 }
117
118 // right click? if there is any object - show the context menu
119 else if( evt->IsClick( BUT_RIGHT ) )
120 {
121 m_disambiguateTimer.Stop();
122 bool selectionCancelled = false;
123
124 if( m_selection.Empty() )
125 {
126 SelectPoint( evt->Position(), &selectionCancelled );
127 m_selection.SetIsHover( true );
128 }
129
130 if( !selectionCancelled )
132 }
133
134 // double click? Display the properties window
135 else if( evt->IsDblClick( BUT_LEFT ) )
136 {
137 // No double-click actions currently defined
138 }
139
140 // drag with LMB? Select multiple objects (or at least draw a selection box) or drag them
141 else if( evt->IsDrag( BUT_LEFT ) )
142 {
143 m_disambiguateTimer.Stop();
144
145 if( hasModifier() || m_selection.Empty() )
146 {
148 }
149 else
150 {
151 // Check if dragging has started within any of selected items bounding box
152 if( selectionContains( evt->Position() ) )
153 {
154 // Yes -> run the move tool and wait till it finishes
155 m_toolMgr->RunAction( "plEditor.InteractiveMove.move" );
156 }
157 else
158 {
159 // No -> clear the selection list
161 }
162 }
163 }
164
165 // Middle double click? Do zoom to fit or zoom to objects
166 else if( evt->IsDblClick( BUT_MIDDLE ) )
167 {
169 }
170
171 else if( evt->IsCancelInteractive() )
172 {
173 m_disambiguateTimer.Stop();
175 }
176
177 else if( evt->Action() == TA_UNDO_REDO_PRE )
178 {
180 }
181
182 else
183 evt->SetPassEvent();
184
185
187 {
188 if( !hasModifier()
189 && !m_selection.Empty()
190 && m_frame->GetDragAction() == MOUSE_DRAG_ACTION::DRAG_SELECTED
191 && evt->HasPosition()
192 && selectionContains( evt->Position() ) )
193 {
194 m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING );
195 }
196 else
197 {
198 if( m_additive )
199 m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ADD );
200 else if( m_subtractive )
201 m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::SUBTRACT );
202 else if( m_exclusive_or )
203 m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::XOR );
204 else
205 m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
206 }
207 }
208 }
209
210 return 0;
211}
212
213
215{
216 wxMouseState keyboardState = wxGetMouseState();
217
218 setModifiersState( keyboardState.ShiftDown(), keyboardState.ControlDown(),
219 keyboardState.AltDown() );
220
221 m_skip_heuristics = true;
223 m_skip_heuristics = false;
224
225 return 0;
226}
227
228
230{
231 return m_selection;
232}
233
234
235void PL_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere, bool* aSelectionCancelledFlag )
236{
237 int threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
238
239 // locate items.
240 COLLECTOR collector;
241
242 for( DS_DATA_ITEM* dataItem : DS_DATA_MODEL::GetTheInstance().GetItems() )
243 {
244 for( DS_DRAW_ITEM_BASE* drawItem : dataItem->GetDrawItems() )
245 {
246 if( drawItem->HitTest( aWhere, threshold ) )
247 collector.Append( drawItem );
248 }
249 }
250
252
253 // Apply some ugly heuristics to avoid disambiguation menus whenever possible
254 if( collector.GetCount() > 1 && !m_skip_heuristics )
255 guessSelectionCandidates( collector, aWhere );
256
257 // If still more than one item we're going to have to ask the user.
258 if( collector.GetCount() > 1 )
259 {
260 doSelectionMenu( &collector );
261
262 if( collector.m_MenuCancelled )
263 {
264 if( aSelectionCancelledFlag )
265 *aSelectionCancelledFlag = true;
266
267 return;
268 }
269 }
270
271 bool anyAdded = false;
272 bool anySubtracted = false;
273
274
276 {
277 if( collector.GetCount() == 0 )
278 anySubtracted = true;
279
281 }
282
283 if( collector.GetCount() > 0 )
284 {
285 for( int i = 0; i < collector.GetCount(); ++i )
286 {
287 if( m_subtractive || ( m_exclusive_or && collector[i]->IsSelected() ) )
288 {
289 unselect( collector[i] );
290 anySubtracted = true;
291 }
292 else
293 {
294 select( collector[i] );
295 anyAdded = true;
296 }
297 }
298 }
299
300 if( anyAdded )
302
303 if( anySubtracted )
305}
306
307
309{
310 // There are certain conditions that can be handled automatically.
311
312 // Prefer an exact hit to a sloppy one
313 for( int i = 0; collector.GetCount() == 2 && i < 2; ++i )
314 {
315 EDA_ITEM* item = collector[ i ];
316 EDA_ITEM* other = collector[ ( i + 1 ) % 2 ];
317
318 if( item->HitTest( aPos, 0 ) && !other->HitTest( aPos, 0 ) )
319 collector.Transfer( other );
320 }
321}
322
323
325{
326 // If nothing is selected do a hover selection
327 if( m_selection.Empty() )
328 {
329 VECTOR2D cursorPos = getViewControls()->GetCursorPosition( true );
330
332 SelectPoint( cursorPos );
333 m_selection.SetIsHover( true );
334 }
335
336 return m_selection;
337}
338
339
341{
342 bool cancelled = false; // Was the tool cancelled while it was running?
343 m_multiple = true; // Multiple selection mode is active
344 KIGFX::VIEW* view = getView();
345
347 view->Add( &area );
348
349 while( TOOL_EVENT* evt = Wait() )
350 {
351 int width = area.GetEnd().x - area.GetOrigin().x;
352
353 /* Selection mode depends on direction of drag-selection:
354 * Left > Right : Select objects that are fully enclosed by selection
355 * Right > Left : Select objects that are crossed by selection
356 */
357 bool windowSelection = width >= 0 ? true : false;
358
359 m_frame->GetCanvas()->SetCurrentCursor( windowSelection ? KICURSOR::SELECT_WINDOW
360 : KICURSOR::SELECT_LASSO );
361
362 if( evt->IsCancelInteractive() || evt->IsActivate() )
363 {
364 cancelled = true;
365 break;
366 }
367
368 if( evt->IsDrag( BUT_LEFT ) )
369 {
372
373 // Start drawing a selection box
374 area.SetOrigin( evt->DragOrigin() );
375 area.SetEnd( evt->Position() );
378 area.SetExclusiveOr( false );
379
380 view->SetVisible( &area, true );
381 view->Update( &area );
382 getViewControls()->SetAutoPan( true );
383 }
384
385 if( evt->IsMouseUp( BUT_LEFT ) )
386 {
387 getViewControls()->SetAutoPan( false );
388
389 // End drawing the selection box
390 view->SetVisible( &area, false );
391
392 int height = area.GetEnd().y - area.GetOrigin().y;
393
394 bool anyAdded = false;
395 bool anySubtracted = false;
396
397 // Construct a BOX2I to determine EDA_ITEM selection
398 BOX2I selectionRect( area.GetOrigin(), VECTOR2I( width, height ) );
399
400 selectionRect.Normalize();
401
402 for( DS_DATA_ITEM* dataItem : DS_DATA_MODEL::GetTheInstance().GetItems() )
403 {
404 for( DS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
405 {
406 if( item->HitTest( selectionRect, windowSelection ) )
407 {
408 if( m_subtractive || ( m_exclusive_or && item->IsSelected() ) )
409 {
410 unselect( item );
411 anySubtracted = true;
412 }
413 else
414 {
415 select( item );
416 anyAdded = true;
417 }
418 }
419 }
420 }
421
422 // Inform other potentially interested tools
423 if( anyAdded )
425
426 if( anySubtracted )
428
429 break; // Stop waiting for events
430 }
431 }
432
433 getViewControls()->SetAutoPan( false );
434
435 // Stop drawing the selection box
436 view->Remove( &area );
437 m_multiple = false; // Multiple selection mode is inactive
438
439 if( !cancelled )
441
442 return cancelled;
443}
444
445
447{
449 return 0;
450}
451
452
454{
456
457 for( DS_DATA_ITEM* dataItem : DS_DATA_MODEL::GetTheInstance().GetItems() )
458 {
459 for( DS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
460 {
461 if( item->IsSelected() )
462 select( item );
463 }
464 }
465}
466
467
469{
470 if( m_selection.Empty() )
471 return;
472
473 while( m_selection.GetSize() )
475
477
478 m_selection.SetIsHover( false );
480
481 // Inform other potentially interested tools
483}
484
485
487{
488 highlight( aItem, SELECTED, &m_selection );
489}
490
491
493{
494 unhighlight( aItem, SELECTED, &m_selection );
495}
496
497
498void PL_SELECTION_TOOL::highlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup )
499{
500 if( aMode == SELECTED )
501 aItem->SetSelected();
502 else if( aMode == BRIGHTENED )
503 aItem->SetBrightened();
504
505 if( aGroup )
506 aGroup->Add( aItem );
507
508 getView()->Update( aItem );
509}
510
511
512void PL_SELECTION_TOOL::unhighlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup )
513{
514 if( aMode == SELECTED )
515 aItem->ClearSelected();
516 else if( aMode == BRIGHTENED )
517 aItem->ClearBrightened();
518
519 if( aGroup )
520 aGroup->Remove( aItem );
521
522 getView()->Update( aItem );
523}
524
525
527{
528 const unsigned GRIP_MARGIN = 20;
529 VECTOR2I margin = getView()->ToWorld( VECTOR2I( GRIP_MARGIN, GRIP_MARGIN ), false );
530
531 // Check if the point is located within any of the currently selected items bounding boxes
532 for( EDA_ITEM* item : m_selection )
533 {
534 BOX2I itemBox = item->ViewBBox();
535 itemBox.Inflate( margin.x, margin.y ); // Give some margin for gripping an item
536
537 if( itemBox.Contains( aPoint ) )
538 return true;
539 }
540
541 return false;
542}
543
544
546{
548
551
557
559}
static TOOL_ACTION updateMenu
Definition: actions.h:180
static TOOL_ACTION zoomFitScreen
Definition: actions.h:100
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
Definition: box2.h:120
bool Contains(const Vec &aPoint) const
Definition: box2.h:142
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:507
An abstract class that will find and hold all the objects according to an inspection done by the Insp...
Definition: collector.h:48
void Transfer(int aIndex)
Move the item at aIndex (first position is 0) to the backup list.
Definition: collector.h:151
bool m_MenuCancelled
Definition: collector.h:237
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:81
void Append(EDA_ITEM *item)
Add an item to the end of the list.
Definition: collector.h:99
void AddSeparator(int aOrder=ANY_ORDER)
Add a separator to the menu.
Drawing sheet structure type definitions.
Definition: ds_data_item.h:96
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
Base class to handle basic graphic items.
Definition: ds_draw_item.h:59
void AddStandardSubMenus(TOOL_MENU &aMenu)
Construct a "basic" menu for a tool, containing only items that apply to all tools (e....
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
void ClearSelected()
Definition: eda_item.h:118
void SetSelected()
Definition: eda_item.h:115
void ClearBrightened()
Definition: eda_item.h:119
void SetBrightened()
Definition: eda_item.h:116
virtual bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const
Test if aPosition is inside or on the boundary of this item.
Definition: eda_item.h:212
static const TOOL_EVENT DisambiguatePoint
Used for hotkey feedback.
Definition: actions.h:249
static const TOOL_EVENT ClearedEvent
Definition: actions.h:234
static const TOOL_EVENT SelectedEvent
Definition: actions.h:232
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:233
Represent a selection area (currently a rectangle) in a VIEW, drawn corner-to-corner between two poin...
void SetSubtractive(bool aSubtractive)
void SetAdditive(bool aAdditive)
void SetOrigin(const VECTOR2I &aOrigin)
void SetExclusiveOr(bool aExclusiveOr)
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the corner that moves with the cursor.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:313
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:350
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1607
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:444
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Set the item visibility.
Definition: view.cpp:1545
static TOOL_ACTION clearSelection
Clear the current selection.
Definition: pl_actions.h:43
static TOOL_ACTION placeImage
Definition: pl_actions.h:59
static TOOL_ACTION selectionActivate
Activation of the selection tool.
Definition: pl_actions.h:40
static TOOL_ACTION selectionMenu
Run a selection menu to select from a list of items.
Definition: pl_actions.h:54
static TOOL_ACTION drawRectangle
Definition: pl_actions.h:60
static TOOL_ACTION removeItemFromSel
Definition: pl_actions.h:47
static TOOL_ACTION addItemsToSel
Select a list of items (specified as the event parameter)
Definition: pl_actions.h:50
static TOOL_ACTION removeItemsFromSel
Definition: pl_actions.h:51
static TOOL_ACTION addItemToSel
Select an item (specified as the event parameter).
Definition: pl_actions.h:46
static TOOL_ACTION placeText
Definition: pl_actions.h:58
static TOOL_ACTION drawLine
Definition: pl_actions.h:61
PL_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Tool that displays edit points allowing to modify items by dragging the points.
bool HasPoint()
Indicate the cursor is over an edit point.
void select(EDA_ITEM *aItem) override
Takes necessary action mark an item as selected.
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
bool Init() override
Init() is called once upon a registration of the tool.
PL_SELECTION m_selection
int disambiguateCursor(const TOOL_EVENT &aEvent)
Handle disambiguation actions including displaying the menu.
void SelectPoint(const VECTOR2I &aWhere, bool *aSelectionCancelledFlag=nullptr)
Select an item pointed by the parameter aWhere.
void guessSelectionCandidates(COLLECTOR &collector, const VECTOR2I &aWhere)
Apply heuristics to try and determine a single object when multiple are found under the cursor.
bool selectionContains(const VECTOR2I &aPoint) const
Set up handlers for various events.
void unselect(EDA_ITEM *aItem) override
Take necessary action mark an item as unselected.
bool selectMultiple()
Handle drawing a selection box that allows one to select many items at the same time.
PL_SELECTION & GetSelection()
Return the set of currently selected items.
PL_SELECTION & RequestSelection()
Return either an existing selection (filtered), or the selection at the current cursor if the existin...
void highlight(EDA_ITEM *aItem, int aHighlightMode, SELECTION *aGroup=nullptr) override
Highlight the item visually.
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, SELECTION *aGroup=nullptr) override
Unhighlight the item visually.
PL_EDITOR_FRAME * m_frame
int Main(const TOOL_EVENT &aEvent)
The main loop.
void RebuildSelection()
Rebuild the selection from the flags in the view items.
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
static bool Empty(const SELECTION &aSelection)
Test if there are no items selected.
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
bool doSelectionMenu(COLLECTOR *aCollector)
wxTimer m_disambiguateTimer
int AddItemsToSel(const TOOL_EVENT &aEvent)
int AddItemToSel(const TOOL_EVENT &aEvent)
int UpdateMenu(const TOOL_EVENT &aEvent)
Update a menu's state based on the current selection.
void setModifiersState(bool aShiftState, bool aCtrlState, bool aAltState)
Set the configuration of m_additive, m_subtractive, m_exclusive_or, m_skip_heuristics from the state ...
VECTOR2I m_originalCursor
int SelectionMenu(const TOOL_EVENT &aEvent)
Show a popup menu to trim the COLLECTOR passed as aEvent's parameter down to a single item.
int RemoveItemsFromSel(const TOOL_EVENT &aEvent)
bool hasModifier()
True if a selection modifier is enabled, false otherwise.
void onDisambiguationExpire(wxTimerEvent &aEvent)
Start the process to show our disambiguation menu once the user has kept the mouse down for the minim...
virtual void Add(EDA_ITEM *aItem)
Definition: selection.cpp:42
void SetIsHover(bool aIsHover)
Definition: selection.h:78
virtual void Remove(EDA_ITEM *aItem)
Definition: selection.cpp:60
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:99
EDA_ITEM * Front() const
Definition: selection.h:208
virtual void Clear() override
Remove all the stored items from the group.
Definition: selection.h:92
void ClearReferencePoint()
Definition: selection.h:265
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:109
MOUSE_DRAG_ACTION GetDragAction() const
Indicates whether a drag should draw a selection rectangle or drag selected (or unselected) objects.
Definition: tools_holder.h:142
bool ToolStackIsEmpty()
Definition: tools_holder.h:123
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
RESET_REASON
Determine the reason of reset for a tool.
Definition: tool_base.h:78
@ MODEL_RELOAD
Model changes (the sheet for a schematic)
Definition: tool_base.h:80
Generic, UI-independent tool event.
Definition: tool_event.h:167
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Suspend execution of the tool until an event specified in aEventList arrives.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
Definition: tool_manager.h:145
VECTOR2D GetMousePosition() const
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:44
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:57
#define BRIGHTENED
item is drawn with a bright contour
#define SELECTED
Item was manually selected by the user.
#define HITTEST_THRESHOLD_PIXELS
int m_DisambiguationMenuDelay
The number of milliseconds to wait in a click before showing a disambiguation menu.
@ TA_UNDO_REDO_PRE
Definition: tool_event.h:105
@ MD_ALT
Definition: tool_event.h:144
@ MD_CTRL
Definition: tool_event.h:143
@ MD_SHIFT
Definition: tool_event.h:142
@ BUT_MIDDLE
Definition: tool_event.h:133
@ BUT_LEFT
Definition: tool_event.h:131
@ BUT_RIGHT
Definition: tool_event.h:132
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588