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>
30 #include <bitmaps.h>
31 #include <confirm.h>
32 #include <eda_item.h>
33 #include <view/view.h>
34 #include <math/util.h> // for KiROUND
35 
37 #include "tools/pl_actions.h"
38 #include "tools/pl_edit_tool.h"
39 #include "pl_draw_panel_gal.h"
40 #include "pl_editor_frame.h"
41 #include "pl_editor_id.h"
42 
44  TOOL_INTERACTIVE( "plEditor.InteractiveEdit" ),
45  m_frame( nullptr ),
46  m_selectionTool( nullptr ),
47  m_moveInProgress( false ),
48  m_moveOffset( 0, 0 ),
49  m_cursor( 0, 0 ),
50  m_pickerItem( nullptr )
51 {
52 }
53 
54 
56 {
57  m_frame = getEditFrame<PL_EDITOR_FRAME>();
59 
60  wxASSERT_MSG( m_selectionTool, "plEditor.InteractiveSelection tool is not available" );
61 
62  CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
63 
64  // cancel current tool goes in main context menu at the top if present
66 
67  ctxMenu.AddSeparator( 200 );
69 
70  // Finally, add the standard zoom/grid items
72 
73  //
74  // Add editing actions to the selection tool menu
75  //
77 
83 
84  return true;
85 }
86 
87 
89 {
90  if( aReason == MODEL_RELOAD )
91  m_frame = getEditFrame<PL_EDITOR_FRAME>();
92 }
93 
94 
95 int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
96 {
98 
99  VECTOR2I originalCursorPos = controls->GetCursorPosition();
100 
101  // Be sure that there is at least one item that we can move. If there's no selection try
102  // looking for the stuff under mouse cursor (i.e. Kicad old-style hover selection).
104  bool unselect = selection.IsHover();
105 
106  if( selection.Empty() || m_moveInProgress )
107  return 0;
108 
109  std::string tool = aEvent.GetCommandStr().get();
110  m_frame->PushTool( tool );
111  Activate();
112 
113  controls->ShowCursor( true );
114  controls->SetAutoPan( true );
115 
116  bool restore_state = false;
117  bool chain_commands = false;
118  TOOL_EVENT* evt = const_cast<TOOL_EVENT*>( &aEvent );
119  VECTOR2I prevPos;
120 
121  if( !selection.Front()->IsNew() )
123 
124  // Main loop: keep receiving events
125  do
126  {
128 
129  if( evt->IsAction( &PL_ACTIONS::move ) || evt->IsMotion() || evt->IsDrag( BUT_LEFT )
130  || evt->IsAction( &ACTIONS::refreshPreview ) )
131  {
132  //------------------------------------------------------------------------
133  // Start a move operation
134  //
135  if( !m_moveInProgress )
136  {
137  // Apply any initial offset in case we're coming from a previous command.
138  //
139  for( EDA_ITEM* item : selection )
140  moveItem( item, m_moveOffset );
141 
142  // Set up the starting position and move/drag offset
143  //
144  m_cursor = controls->GetCursorPosition();
145 
146  if( selection.HasReferencePoint() )
147  {
148  VECTOR2I delta = m_cursor - selection.GetReferencePoint();
149 
150  // Drag items to the current cursor position
151  for( EDA_ITEM* item : selection )
152  moveItem( item, delta );
153 
154  selection.SetReferencePoint( m_cursor );
155  }
156  else if( selection.Size() == 1 )
157  {
158  // Set the current cursor position to the first dragged item origin,
159  // so the movement vector can be computed later
160  updateModificationPoint( selection );
161  m_cursor = originalCursorPos;
162  }
163  else
164  {
165  updateModificationPoint( selection );
166  }
167 
168  controls->SetCursorPosition( m_cursor, false );
169 
170  prevPos = m_cursor;
171  controls->SetAutoPan( true );
172  m_moveInProgress = true;
173  }
174 
175  //------------------------------------------------------------------------
176  // Follow the mouse
177  //
178  m_cursor = controls->GetCursorPosition();
179  VECTOR2I delta( m_cursor - prevPos );
180  selection.SetReferencePoint( m_cursor );
181 
182  m_moveOffset += delta;
183  prevPos = m_cursor;
184 
185  for( EDA_ITEM* item : selection )
186  moveItem( item, delta );
187 
189  }
190  //------------------------------------------------------------------------
191  // Handle cancel
192  //
193  else if( evt->IsCancelInteractive() || evt->IsActivate() )
194  {
195  if( m_moveInProgress )
196  {
197  evt->SetPassEvent( false );
198  restore_state = true;
199  }
200 
201  break;
202  }
203  //------------------------------------------------------------------------
204  // Handle TOOL_ACTION special cases
205  //
206  else if( evt->Action() == TA_UNDO_REDO_PRE )
207  {
208  unselect = true;
209  break;
210  }
211  else if( evt->Category() == TC_COMMAND )
212  {
213  if( evt->IsAction( &ACTIONS::doDelete ) )
214  {
215  // Exit on a remove operation; there is no further processing for removed items.
216  break;
217  }
218  }
219  //------------------------------------------------------------------------
220  // Handle context menu
221  //
222  else if( evt->IsClick( BUT_RIGHT ) )
223  {
225  }
226  //------------------------------------------------------------------------
227  // Handle drop
228  //
229  else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
230  {
231  break; // Finish
232  }
233  else
234  evt->SetPassEvent();
235 
236  } while( ( evt = Wait() ) ); //Should be assignment not equality test
237 
238  controls->ForceCursorPosition( false );
239  controls->ShowCursor( false );
240  controls->SetAutoPan( false );
241 
242  if( !chain_commands )
243  m_moveOffset = { 0, 0 };
244 
245  selection.ClearReferencePoint();
246 
247  for( auto item : selection )
248  item->ClearEditFlags();
249 
250  if( unselect )
252 
253  if( restore_state )
255  else
256  m_frame->OnModify();
257 
258  m_moveInProgress = false;
259  m_frame->PopTool( tool );
260  return 0;
261 }
262 
263 
265 {
266  WS_DRAW_ITEM_BASE* drawItem = static_cast<WS_DRAW_ITEM_BASE*>( aItem );
267  WS_DATA_ITEM* dataItem = drawItem->GetPeer();
268 
269  dataItem->MoveToUi( dataItem->GetStartPosUi() + (wxPoint) aDelta );
270 
271  for( WS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
272  {
273  getView()->Update( item );
274  item->SetFlags( IS_MOVED );
275  }
276 }
277 
278 
280 {
281  if( m_moveInProgress && aSelection.HasReferencePoint() )
282  return false;
283 
284  // When there is only one item selected, the reference point is its position...
285  if( aSelection.Size() == 1 )
286  {
287  aSelection.SetReferencePoint( aSelection.Front()->GetPosition() );
288  }
289  // ...otherwise modify items with regard to the grid-snapped cursor position
290  else
291  {
293  aSelection.SetReferencePoint( m_cursor );
294  }
295 
296  return true;
297 }
298 
299 
301 {
303 
304  wxCommandEvent evt( wxEVT_NULL, ID_APPEND_DESCR_FILE );
305  m_frame->Files_io( evt );
306 
307  return 0;
308 }
309 
310 
311 int PL_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
312 {
314 
315  if( selection.Size() == 0 )
316  return 0;
317 
319 
320  while( selection.Front() )
321  {
322  WS_DRAW_ITEM_BASE* drawItem = static_cast<WS_DRAW_ITEM_BASE*>( selection.Front() );
323  WS_DATA_ITEM* dataItem = drawItem->GetPeer();
325 
326  for( WS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
327  {
328  // Note: repeat items won't be selected but must be removed & deleted
329 
330  if( item->IsSelected() )
332 
333  getView()->Remove( item );
334  }
335 
336  delete dataItem;
337  }
338 
339  m_frame->OnModify();
340 
341  return 0;
342 }
343 
344 
345 #define HITTEST_THRESHOLD_PIXELS 5
346 
347 
349 {
350  std::string tool = aEvent.GetCommandStr().get();
352 
353  // Deactivate other tools; particularly important if another PICKER is currently running
354  Activate();
355 
356  picker->SetCursor( KICURSOR::REMOVE );
357  m_pickerItem = nullptr;
358 
359  picker->SetClickHandler(
360  [this] ( const VECTOR2D& aPosition ) -> bool
361  {
362  if( m_pickerItem )
363  {
365  selectionTool->UnbrightenItem( m_pickerItem );
366  selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
368  m_pickerItem = nullptr;
369  }
370 
371  return true;
372  } );
373 
374  picker->SetMotionHandler(
375  [this] ( const VECTOR2D& aPos )
376  {
377  int threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
378  EDA_ITEM* item = nullptr;
379 
380  for( WS_DATA_ITEM* dataItem : WS_DATA_MODEL::GetTheInstance().GetItems() )
381  {
382  for( WS_DRAW_ITEM_BASE* drawItem : dataItem->GetDrawItems() )
383  {
384  if( drawItem->HitTest( (wxPoint) aPos, threshold ) )
385  {
386  item = drawItem;
387  break;
388  }
389  }
390  }
391 
392  if( m_pickerItem != item )
393  {
395 
396  if( m_pickerItem )
397  selectionTool->UnbrightenItem( m_pickerItem );
398 
399  m_pickerItem = item;
400 
401  if( m_pickerItem )
402  selectionTool->BrightenItem( m_pickerItem );
403  }
404  } );
405 
406  picker->SetFinalizeHandler(
407  [this] ( const int& aFinalState )
408  {
409  if( m_pickerItem )
411 
412  // Wake the selection tool after exiting to ensure the cursor gets updated
414  } );
415 
416  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
417 
418  return 0;
419 }
420 
421 
422 int PL_EDIT_TOOL::Undo( const TOOL_EVENT& aEvent )
423 {
425  return 0;
426 }
427 
428 
429 int PL_EDIT_TOOL::Redo( const TOOL_EVENT& aEvent )
430 {
432  return 0;
433 }
434 
435 
436 int PL_EDIT_TOOL::Cut( const TOOL_EVENT& aEvent )
437 {
438  int retVal = Copy( aEvent );
439 
440  if( retVal == 0 )
441  retVal = DoDelete( aEvent );
442 
443  return retVal;
444 }
445 
446 
447 int PL_EDIT_TOOL::Copy( const TOOL_EVENT& aEvent )
448 {
450  std::vector<WS_DATA_ITEM*> items;
452  wxString sexpr;
453 
454  if( selection.GetSize() == 0 )
455  return 0;
456 
457  for( EDA_ITEM* item : selection.GetItems() )
458  items.push_back( static_cast<WS_DRAW_ITEM_BASE*>( item )->GetPeer() );
459 
460  try
461  {
462  model.SaveInString( items, sexpr );
463  }
464  catch( const IO_ERROR& ioe )
465  {
466  wxMessageBox( ioe.What(), _( "Error writing objects to clipboard" ) );
467  }
468 
469  if( m_toolMgr->SaveClipboard( TO_UTF8( sexpr ) ) )
470  return 0;
471  else
472  return -1;
473 }
474 
475 
476 int PL_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
477 {
478  PL_SELECTION& selection = m_selectionTool->GetSelection();
480  std::string sexpr = m_toolMgr->GetClipboardUTF8();
481 
483 
484  model.SetPageLayout( sexpr.c_str(), true, wxT( "clipboard" ) );
485 
486  // Build out draw items and select the first of each data item
488  {
489  if( dataItem->GetDrawItems().empty() )
490  {
491  dataItem->SyncDrawItems( nullptr, getView() );
492  dataItem->GetDrawItems().front()->SetSelected();
493  }
494  }
495 
497 
498  if( !selection.Empty() )
499  {
500  selection.SetReferencePoint( selection.GetTopLeftItem()->GetPosition() );
502  }
503 
504  return 0;
505 }
506 
507 
509 {
510  Go( &PL_EDIT_TOOL::Main, PL_ACTIONS::move.MakeEvent() );
511 
513 
514  Go( &PL_EDIT_TOOL::Undo, ACTIONS::undo.MakeEvent() );
515  Go( &PL_EDIT_TOOL::Redo, ACTIONS::redo.MakeEvent() );
516 
517  Go( &PL_EDIT_TOOL::Cut, ACTIONS::cut.MakeEvent() );
518  Go( &PL_EDIT_TOOL::Copy, ACTIONS::copy.MakeEvent() );
519  Go( &PL_EDIT_TOOL::Paste, ACTIONS::paste.MakeEvent() );
521 
523 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
static bool ShowAlways(const SELECTION &aSelection)
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:38
WS_DATA_ITEM * GetPeer() const
Definition: ws_draw_item.h:75
void ClearReferencePoint()
Definition: selection.h:267
void AddStandardSubMenus(TOOL_MENU &aMenu)
Function CreateBasicMenu.
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:70
PL_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetPassEvent(bool aPass=true)
Definition: tool_event.h:256
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:83
Work sheet structure type definitions.
Definition: ws_data_item.h:97
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:75
int Paste(const TOOL_EVENT &aEvent)
void SetClickHandler(CLICK_HANDLER aHandler)
Function SetClickHandler() Sets a handler for mouse click event.
Definition: picker_tool.h:73
PL_SELECTION_TOOL * m_selectionTool
Definition: pl_edit_tool.h:82
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 SetCursor(KICURSOR aCursor)
Definition: picker_tool.h:66
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 PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:357
int ClearSelection(const TOOL_EVENT &aEvent)
TOOL_MENU & GetToolMenu()
bool IsMotion() const
Definition: tool_event.h:306
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:141
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
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Moves cursor to the requested position expressed in world coordinates.
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()
virtual wxPoint GetPosition() const
Definition: eda_item.h:325
void setTransitions() override
Sets up handlers for various events.
static bool NotEmpty(const SELECTION &aSelection)
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)
void SetCurrentCursor(KICURSOR cursor)
Function SetCurrentCursor Set the current cursor shape for this panel.
PL_SELECTION & GetSelection()
Function GetSelection()
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:218
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: eda_item.h:187
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:158
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:103
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:95
static TOOL_ACTION selectionActivate
Activation of the selection tool.
Definition: pl_actions.h:46
static TOOL_ACTION copy
Definition: actions.h:70
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:262
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:29
virtual void PopTool(const std::string &actionName)
VECTOR2I m_moveOffset
Used for chaining commands
Definition: pl_edit_tool.h:88
std::string GetClipboardUTF8() const
Returns the information currently stored in the system clipboard.
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:131
static TOOL_ACTION cut
Definition: actions.h:69
VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (such a...
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
#define IS_MOVED
Item being moved.
Definition: eda_item.h:105
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.
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:120
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:132
void AddSeparator(int aOrder=ANY_ORDER)
Adds a separator to the menu.
virtual unsigned int GetSize() const override
Function GetSize() Returns the number of stored items.
Definition: selection.h:99
void Remove(WS_DATA_ITEM *aItem)
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 SaveClipboard(const std::string &aTextUTF8)
Stores an information to the system clipboard.
bool IsActivate() const
Definition: tool_event.h:321
bool HasReferencePoint() const
Definition: selection.h:252
int ImportWorksheetContent(const TOOL_EVENT &aEvent)
#define _(s)
Definition: 3d_actions.cpp:33
void UnbrightenItem(EDA_ITEM *aItem)
int Size() const
Returns the number of selected parts.
Definition: selection.h:126
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:68
EDA_ITEM is a base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:148
static TOOL_ACTION appendImportedWorksheet
Definition: pl_actions.h:68
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:79
Helper classes to handle basic graphic items used to draw/plot title blocks and frame references segm...
Definition: ws_draw_item.h:56
void SaveCopyInUndoList()
Save a copy of the description (in a S expr string) for Undo/redo commands.
void Activate()
Function Activate() Runs the tool.
static TOOL_ACTION deleteTool
Definition: actions.h:76
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:274
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Adds a menu entry to run a TOOL_ACTION on selected items.
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:109
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
EDA_ITEM * Front() const
Definition: selection.h:201
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1513
int Redo(const TOOL_EVENT &aEvent)
void Files_io(wxCommandEvent &event)