KiCad PCB EDA Suite
pl_edit_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 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 <tool/tool_manager.h>
26 #include <tool/picker_tool.h>
28 #include <tools/pl_actions.h>
29 #include <tools/pl_edit_tool.h>
30 #include <ws_data_model.h>
31 #include <ws_draw_item.h>
32 #include <bitmaps.h>
33 #include <confirm.h>
34 #include <base_struct.h>
35 #include <pl_editor_frame.h>
36 #include <pl_editor_id.h>
37 
38 
40  TOOL_INTERACTIVE( "plEditor.InteractiveEdit" ),
41  m_frame( nullptr ),
42  m_selectionTool( nullptr )
43 {
44 }
45 
46 
48 {
49  m_frame = getEditFrame<PL_EDITOR_FRAME>();
51 
52  wxASSERT_MSG( m_selectionTool, "plEditor.InteractiveSelection tool is not available" );
53 
54  CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
55 
56  // cancel current tool goes in main context menu at the top if present
58 
59  ctxMenu.AddSeparator( 200 );
61 
62  // Finally, add the standard zoom/grid items
64 
65  //
66  // Add editing actions to the selection tool menu
67  //
69 
75 
76  return true;
77 }
78 
79 
81 {
82  if( aReason == MODEL_RELOAD )
83  m_frame = getEditFrame<PL_EDITOR_FRAME>();
84 }
85 
86 
87 int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
88 {
90 
91  controls->SetSnapping( true );
92  VECTOR2I originalCursorPos = controls->GetCursorPosition();
93 
94  // Be sure that there is at least one item that we can move. If there's no selection try
95  // looking for the stuff under mouse cursor (i.e. Kicad old-style hover selection).
97  bool unselect = selection.IsHover();
98 
99  if( selection.Empty() || m_moveInProgress )
100  return 0;
101 
102  std::string tool = aEvent.GetCommandStr().get();
103  m_frame->PushTool( tool );
104  Activate();
105 
106  controls->ShowCursor( true );
107  controls->SetAutoPan( true );
108 
109  bool restore_state = false;
110  bool chain_commands = false;
111  TOOL_EVENT* evt = const_cast<TOOL_EVENT*>( &aEvent );
112  VECTOR2I prevPos;
113 
114  if( !selection.Front()->IsNew() )
116 
117  // Main loop: keep receiving events
118  do
119  {
120  m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
121  controls->SetSnapping( !evt->Modifier( MD_ALT ) );
122 
123  if( evt->IsAction( &PL_ACTIONS::move ) || evt->IsMotion() || evt->IsDrag( BUT_LEFT )
124  || evt->IsAction( &ACTIONS::refreshPreview ) )
125  {
126  //------------------------------------------------------------------------
127  // Start a move operation
128  //
129  if( !m_moveInProgress )
130  {
131  // Apply any initial offset in case we're coming from a previous command.
132  //
133  for( EDA_ITEM* item : selection )
134  moveItem( item, m_moveOffset );
135 
136  // Set up the starting position and move/drag offset
137  //
138  m_cursor = controls->GetCursorPosition();
139 
140  if( selection.HasReferencePoint() )
141  {
142  VECTOR2I delta = m_cursor - selection.GetReferencePoint();
143 
144  // Drag items to the current cursor position
145  for( EDA_ITEM* item : selection )
146  moveItem( item, delta );
147 
148  selection.SetReferencePoint( m_cursor );
149  }
150  else if( selection.Size() == 1 )
151  {
152  // Set the current cursor position to the first dragged item origin,
153  // so the movement vector can be computed later
154  updateModificationPoint( selection );
155  m_cursor = originalCursorPos;
156  }
157  else
158  {
159  updateModificationPoint( selection );
160  }
161 
162  controls->SetCursorPosition( m_cursor, false );
163 
164  prevPos = m_cursor;
165  controls->SetAutoPan( true );
166  m_moveInProgress = true;
167  }
168 
169  //------------------------------------------------------------------------
170  // Follow the mouse
171  //
172  m_cursor = controls->GetCursorPosition();
173  VECTOR2I delta( m_cursor - prevPos );
174  selection.SetReferencePoint( m_cursor );
175 
176  m_moveOffset += delta;
177  prevPos = m_cursor;
178 
179  for( EDA_ITEM* item : selection )
180  moveItem( item, delta );
181 
183  }
184  //------------------------------------------------------------------------
185  // Handle cancel
186  //
187  else if( evt->IsCancelInteractive() || evt->IsActivate() )
188  {
189  if( m_moveInProgress )
190  restore_state = true;
191 
192  break;
193  }
194  //------------------------------------------------------------------------
195  // Handle TOOL_ACTION special cases
196  //
197  else if( evt->Action() == TA_UNDO_REDO_PRE )
198  {
199  unselect = true;
200  break;
201  }
202  else if( evt->Category() == TC_COMMAND )
203  {
204  if( evt->IsAction( &ACTIONS::doDelete ) )
205  {
206  // Exit on a remove operation; there is no further processing for removed items.
207  break;
208  }
209  }
210  //------------------------------------------------------------------------
211  // Handle context menu
212  //
213  else if( evt->IsClick( BUT_RIGHT ) )
214  {
216  }
217  //------------------------------------------------------------------------
218  // Handle drop
219  //
220  else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
221  {
222  break; // Finish
223  }
224  else
225  evt->SetPassEvent();
226 
227  } while( ( evt = Wait() ) ); //Should be assignment not equality test
228 
229  controls->ForceCursorPosition( false );
230  controls->ShowCursor( false );
231  controls->SetSnapping( false );
232  controls->SetAutoPan( false );
233 
234  if( !chain_commands )
235  m_moveOffset = { 0, 0 };
236 
237  selection.ClearReferencePoint();
238 
239  for( auto item : selection )
240  item->ClearEditFlags();
241 
242  if( unselect )
244 
245  if( restore_state )
247  else
248  m_frame->OnModify();
249 
250  m_moveInProgress = false;
251  m_frame->PopTool( tool );
252  return 0;
253 }
254 
255 
257 {
258  WS_DRAW_ITEM_BASE* drawItem = static_cast<WS_DRAW_ITEM_BASE*>( aItem );
259  WS_DATA_ITEM* dataItem = drawItem->GetPeer();
260 
261  dataItem->MoveToUi( dataItem->GetStartPosUi() + (wxPoint) aDelta );
262 
263  for( WS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
264  {
265  getView()->Update( item );
266  item->SetFlags( IS_MOVED );
267  }
268 }
269 
270 
272 {
273  if( m_moveInProgress && aSelection.HasReferencePoint() )
274  return false;
275 
276  // When there is only one item selected, the reference point is its position...
277  if( aSelection.Size() == 1 )
278  {
279  WS_DRAW_ITEM_BASE* item = static_cast<WS_DRAW_ITEM_BASE*>( aSelection.Front() );
280  aSelection.SetReferencePoint( item->GetPosition() );
281  }
282  // ...otherwise modify items with regard to the grid-snapped cursor position
283  else
284  {
286  aSelection.SetReferencePoint( m_cursor );
287  }
288 
289  return true;
290 }
291 
292 
294 {
296 
297  wxCommandEvent evt( wxEVT_NULL, ID_APPEND_DESCR_FILE );
298  m_frame->Files_io( evt );
299 
300  return 0;
301 }
302 
303 
304 int PL_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
305 {
307 
308  if( selection.Size() == 0 )
309  return 0;
310 
312 
313  while( selection.Front() )
314  {
315  WS_DRAW_ITEM_BASE* drawItem = static_cast<WS_DRAW_ITEM_BASE*>( selection.Front() );
316  WS_DATA_ITEM* dataItem = drawItem->GetPeer();
318 
319  for( WS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
320  {
321  // Note: repeat items won't be selected but must be removed & deleted
322 
323  if( item->IsSelected() )
325 
326  getView()->Remove( item );
327  delete item;
328  }
329 
330  delete dataItem;
331  }
332 
333  m_frame->OnModify();
334 
335  return 0;
336 }
337 
338 
339 #define HITTEST_THRESHOLD_PIXELS 5
340 
341 
343 {
344  std::string tool = aEvent.GetCommandStr().get();
346 
347  // Deactivate other tools; particularly important if another PICKER is currently running
348  Activate();
349 
350  picker->SetCursor( wxStockCursor( wxCURSOR_BULLSEYE ) );
351  m_pickerItem = nullptr;
352 
353  picker->SetClickHandler(
354  [this] ( const VECTOR2D& aPosition ) -> bool
355  {
356  if( m_pickerItem )
357  {
359  selectionTool->UnbrightenItem( m_pickerItem );
360  selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
362  m_pickerItem = nullptr;
363  }
364 
365  return true;
366  } );
367 
368  picker->SetMotionHandler(
369  [this] ( const VECTOR2D& aPos )
370  {
371  int threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
372  EDA_ITEM* item = nullptr;
373 
374  for( WS_DATA_ITEM* dataItem : WS_DATA_MODEL::GetTheInstance().GetItems() )
375  {
376  for( WS_DRAW_ITEM_BASE* drawItem : dataItem->GetDrawItems() )
377  {
378  if( drawItem->HitTest( (wxPoint) aPos, threshold ) )
379  {
380  item = drawItem;
381  break;
382  }
383  }
384  }
385 
386  if( m_pickerItem != item )
387  {
389 
390  if( m_pickerItem )
391  selectionTool->UnbrightenItem( m_pickerItem );
392 
393  m_pickerItem = item;
394 
395  if( m_pickerItem )
396  selectionTool->BrightenItem( m_pickerItem );
397  }
398  } );
399 
400  picker->SetFinalizeHandler(
401  [this] ( const int& aFinalState )
402  {
403  if( m_pickerItem )
405  } );
406 
407  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
408 
409  return 0;
410 }
411 
412 
413 int PL_EDIT_TOOL::Undo( const TOOL_EVENT& aEvent )
414 {
416  return 0;
417 }
418 
419 
420 int PL_EDIT_TOOL::Redo( const TOOL_EVENT& aEvent )
421 {
423  return 0;
424 }
425 
426 
427 int PL_EDIT_TOOL::Cut( const TOOL_EVENT& aEvent )
428 {
429  int retVal = Copy( aEvent );
430 
431  if( retVal == 0 )
432  retVal = DoDelete( aEvent );
433 
434  return retVal;
435 }
436 
437 
438 int PL_EDIT_TOOL::Copy( const TOOL_EVENT& aEvent )
439 {
441  std::vector<WS_DATA_ITEM*> items;
443  wxString sexpr;
444 
445  if( selection.GetSize() == 0 )
446  return 0;
447 
448  for( EDA_ITEM* item : selection.GetItems() )
449  items.push_back( static_cast<WS_DRAW_ITEM_BASE*>( item )->GetPeer() );
450 
451  try
452  {
453  model.SaveInString( items, sexpr );
454  }
455  catch( const IO_ERROR& ioe )
456  {
457  wxMessageBox( ioe.What(), _( "Error writing objects to clipboard" ) );
458  }
459 
460  if( m_toolMgr->SaveClipboard( TO_UTF8( sexpr ) ) )
461  return 0;
462  else
463  return -1;
464 }
465 
466 
467 int PL_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
468 {
469  PL_SELECTION& selection = m_selectionTool->GetSelection();
471  std::string sexpr = m_toolMgr->GetClipboard();
472 
474 
475  model.SetPageLayout( sexpr.c_str(), true, wxT( "clipboard" ) );
476 
477  // Build out draw items and select the first of each data item
479  {
480  if( dataItem->GetDrawItems().empty() )
481  {
482  dataItem->SyncDrawItems( nullptr, getView() );
483  dataItem->GetDrawItems().front()->SetSelected();
484  }
485  }
486 
488 
489  if( !selection.Empty() )
490  {
491  WS_DRAW_ITEM_BASE* item = (WS_DRAW_ITEM_BASE*) selection.GetTopLeftItem();
492 
493  selection.SetReferencePoint( item->GetPosition() );
495  }
496 
497  return 0;
498 }
499 
500 
502 {
503  Go( &PL_EDIT_TOOL::Main, PL_ACTIONS::move.MakeEvent() );
504 
506 
507  Go( &PL_EDIT_TOOL::Undo, ACTIONS::undo.MakeEvent() );
508  Go( &PL_EDIT_TOOL::Redo, ACTIONS::redo.MakeEvent() );
509 
510  Go( &PL_EDIT_TOOL::Cut, ACTIONS::cut.MakeEvent() );
511  Go( &PL_EDIT_TOOL::Copy, ACTIONS::copy.MakeEvent() );
512  Go( &PL_EDIT_TOOL::Paste, ACTIONS::paste.MakeEvent() );
514 
516 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
static bool ShowAlways(const SELECTION &aSelection)
Function ShowAlways The default condition function (always returns true).
WS_DATA_MODEL handles the graphic items list to draw/plot the frame and title block.
Definition: ws_data_model.h:39
WS_DATA_ITEM * GetPeer() const
Definition: ws_draw_item.h:66
void SaveCopyInUndoList(bool aSavePageSettingsAndTitleBlock=false)
Save a copy of the description (in a S expr string) for Undo/redo commands.
void ClearReferencePoint()
Definition: selection.h:248
void AddStandardSubMenus(TOOL_MENU &aMenu)
Function CreateBasicMenu.
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
void SetCursor(const wxCursor &aCursor)
Definition: picker_tool.h:65
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
void MoveToUi(wxPoint aPosition)
move item to a new position
void RebuildSelection()
Rebuild the selection from the flags in the view items.
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
bool IsHover() const
Definition: selection.h:69
PL_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
bool updateModificationPoint(PL_SELECTION &aSelection)
Returns the right modification point (e.g.
void SetMotionHandler(MOTION_HANDLER aHandler)
Function SetMotionHandler() Sets a handler for mouse motion.
Definition: picker_tool.h:82
Work sheet structure type definitions.
Definition: ws_data_item.h:93
Model changes (required full reload)
Definition: tool_base.h:82
int DeleteItemCursor(const TOOL_EVENT &aEvent)
Runs the deletion tool.
This file is part of the common library.
static TOOL_ACTION doDelete
Definition: actions.h:74
int Paste(const TOOL_EVENT &aEvent)
void SetClickHandler(CLICK_HANDLER aHandler)
Function SetClickHandler() Sets a handler for mouse click event.
Definition: picker_tool.h:72
PL_SELECTION_TOOL * m_selectionTool
Definition: pl_edit_tool.h:82
bool SaveClipboard(const std::string &aText)
Stores an information to the system clipboard.
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
TOOL_ACTIONS Action() const
Returns more specific information about the type of an event.
Definition: tool_event.h:250
bool IsClick(int aButtonMask=BUT_ANY) const
Definition: tool_event.cpp:178
void BrightenItem(EDA_ITEM *aItem)
int Cut(const TOOL_EVENT &aEvent)
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
int ClearSelection(const TOOL_EVENT &aEvent)
TOOL_MENU & GetToolMenu()
bool IsMotion() const
Definition: tool_event.h:306
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
VECTOR2I m_cursor
Last cursor position (needed for getModificationPoint() to avoid changes of edit reference point).
Definition: pl_edit_tool.h:92
void GetLayoutFromRedoList()
Redo the last edit:
static TOOL_ACTION move
Definition: pl_actions.h:71
TOOL_EVENT_CATEGORY Category() const
Returns the category (eg. mouse/keyboard/action) of an event..
Definition: tool_event.h:247
void SetPageLayout(const wxString &aFullFileName=wxEmptyString, bool Append=false)
Populates the list with a custom layout, or the default layout, if no custom layout available.
std::vector< WS_DATA_ITEM * > & GetItems()
void setTransitions() override
Sets up handlers for various events.
static bool NotEmpty(const SELECTION &aSelection)
Function NotEmpty Tests if there are any items selected.
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
int AddItemToSel(const TOOL_EVENT &aEvent)
PL_SELECTION & GetSelection()
Function GetSelection()
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:201
bool Init() override
Function Init() Init() is called once upon a registration of the tool.
EDA_ITEM * m_pickerItem
Definition: pl_edit_tool.h:94
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:67
bool IsNew() const
Definition: base_struct.h:228
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
const wxPoint GetStartPosUi(int ii=0) const
static TOOL_ACTION pickerTool
Definition: actions.h:145
void OnModify()
Must be called after a change in order to set the "modify" flag.
void SetFinalizeHandler(FINALIZE_HANDLER aHandler)
Function SetFinalizeHandler() Sets a handler for the finalize event.
Definition: picker_tool.h:102
int Main(const TOOL_EVENT &aEvent)
The "move" event loop.
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:48
static TOOL_ACTION copy
Definition: actions.h:70
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:243
EDA_ITEM * GetTopLeftItem(bool onlyModules=false) const override
bool IsDrag(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:296
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
VECTOR2I m_moveOffset
Used for chaining commands
Definition: pl_edit_tool.h:88
Class TOOL_EVENT.
Definition: tool_event.h:171
int Undo(const TOOL_EVENT &aEvent)
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:81
const std::deque< EDA_ITEM * > GetItems() const
Definition: selection.h:130
static TOOL_ACTION cut
Definition: actions.h:69
void SetPassEvent()
Definition: tool_event.h:256
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Function ForceCursorPosition() Places the cursor immediately at a given point.
int Copy(const TOOL_EVENT &aEvent)
bool m_moveInProgress
Flag determining if anything is being dragged right now
Definition: pl_edit_tool.h:85
bool IsMouseUp(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:301
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
void moveItem(EDA_ITEM *aItem, VECTOR2I aDelta)
bool IsCancelInteractive()
Function IsCancelInteractive()
Definition: tool_event.cpp:190
void Reset(RESET_REASON aReason) override
Function Reset() Brings the tool to a known, initial state.
#define _(s)
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:119
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: pl_actions.h:49
#define HITTEST_THRESHOLD_PIXELS
const std::vector< WS_DRAW_ITEM_BASE * > & GetDrawItems() const
Definition: ws_data_item.h:128
void AddSeparator(int aOrder=ANY_ORDER)
Function AddSeparator()
virtual unsigned int GetSize() const override
Function GetSize() Returns the number of stored items.
Definition: selection.h:98
void Remove(WS_DATA_ITEM *aItem)
int Modifier(int aMask=MD_MODIFIER_MASK) const
Returns information about key modifiers state (Ctrl, Alt, etc.)
Definition: tool_event.h:342
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
static TOOL_ACTION redo
Definition: actions.h:68
int DoDelete(const TOOL_EVENT &aEvent)
Function DoDelete()
bool IsActivate() const
Definition: tool_event.h:321
bool HasReferencePoint() const
Definition: selection.h:233
int ImportWorksheetContent(const TOOL_EVENT &aEvent)
virtual const wxPoint GetPosition() const =0
void UnbrightenItem(EDA_ITEM *aItem)
std::string GetClipboard() const
Returns the information currently stored in the system clipboard.
int Size() const
Returns the number of selected parts.
Definition: selection.h:125
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
static TOOL_ACTION appendImportedWorksheet
Definition: pl_actions.h:68
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:79
virtual void PopTool(const std::string &actionName)
void Activate()
Function Activate() Runs the tool.
static TOOL_ACTION deleteTool
Definition: actions.h:75
static TOOL_ACTION undo
Definition: actions.h:67
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
void RollbackFromUndo()
Apply the last command in Undo List without stacking a Redo.
void PostEvent(const TOOL_EVENT &aEvent)
Puts an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:237
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
void GetLayoutFromUndoList()
Undo the last edit:
static TOOL_ACTION paste
Definition: actions.h:71
PL_SELECTION & RequestSelection()
Function RequestSelection()
void SaveInString(wxString &aOutputString)
Save the description in a buffer.
static TOOL_ACTION refreshPreview
Definition: actions.h:101
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false)=0
Moves cursor to the requested position expressed in world coordinates.
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
EDA_ITEM * Front() const
Definition: selection.h:182
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:114
int Redo(const TOOL_EVENT &aEvent)
#define IS_MOVED
Item being moved.
Definition: base_struct.h:119
void Files_io(wxCommandEvent &event)