KiCad PCB EDA Suite
SYMBOL_EDITOR_EDIT_TOOL Class Reference

#include <symbol_editor_edit_tool.h>

Inheritance diagram for SYMBOL_EDITOR_EDIT_TOOL:
EE_TOOL_BASE< SYMBOL_EDIT_FRAME > TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 Determine the reason of reset for a tool. More...
 

Public Member Functions

 SYMBOL_EDITOR_EDIT_TOOL ()
 
 ~SYMBOL_EDITOR_EDIT_TOOL () override
 
bool Init () override
 Init() is called once upon a registration of the tool. More...
 
int Rotate (const TOOL_EVENT &aEvent)
 
int Mirror (const TOOL_EVENT &aEvent)
 
int Duplicate (const TOOL_EVENT &aEvent)
 
int Properties (const TOOL_EVENT &aEvent)
 
int PinTable (const TOOL_EVENT &aEvent)
 
int UpdateSymbolFields (const TOOL_EVENT &aEvent)
 
int Undo (const TOOL_EVENT &aEvent)
 
int Redo (const TOOL_EVENT &aEvent)
 
int Cut (const TOOL_EVENT &aEvent)
 
int Copy (const TOOL_EVENT &aEvent)
 
int Paste (const TOOL_EVENT &aEvent)
 
int DoDelete (const TOOL_EVENT &aEvent)
 Delete the selected items, or the item under the cursor. More...
 
int DeleteItemCursor (const TOOL_EVENT &aEvent)
 
void Reset (RESET_REASON aReason) override
 Bring the tool to a known, initial state. More...
 
void Activate ()
 Run the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Assign a context menu and tells when it should be activated. More...
 
void RunMainStack (std::function< void()> aFunc)
 Call a function using the main stack. More...
 
template<class T >
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). More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Suspend execution of the tool until an event specified in aEventList arrives. More...
 
TOOL_TYPE GetType () const
 Return the type of the tool. More...
 
TOOL_ID GetId () const
 Return the unique identifier of the tool. More...
 
const std::string & GetName () const
 Return the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Return the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Protected Member Functions

void updateItem (EDA_ITEM *aItem, bool aUpdateRTree) const
 Similar to getView()->Update(), but handles items that are redrawn by their parents and updating the SCH_SCREEN's RTree. More...
 
void saveCopyInUndoList (EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
 
void attachManager (TOOL_MANAGER *aManager)
 Set the TOOL_MANAGER the tool will belong to. More...
 
KIGFX::VIEWgetView () const
 Returns the instance of #VIEW object used in the application. More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Return the instance of VIEW_CONTROLS object used in the application. More...
 
template<typename T >
T * getEditFrame () const
 Return the application window object, casted to requested user type. More...
 
template<typename T >
T * getModel () const
 Return the model object if it matches the requested type. More...
 

Protected Attributes

SYMBOL_EDIT_FRAMEm_frame
 
KIGFX::SCH_VIEWm_view
 
EE_SELECTION_TOOLm_selectionTool
 
bool m_isSymbolEditor
 
TOOL_MENU m_menu
 The functions below are not yet implemented - their interface may change. More...
 
TOOL_TYPE m_type
 Unique identifier for the tool, assigned by a TOOL_MANAGER instance. More...
 
TOOL_ID m_toolId
 Name of the tool. More...
 
std::string m_toolName
 
TOOL_MANAGERm_toolMgr
 

Private Member Functions

void editShapeProperties (LIB_ITEM *aItem)
 
void editTextProperties (LIB_ITEM *aItem)
 
void editFieldProperties (LIB_FIELD *aField)
 
void editSymbolProperties ()
 Set up handlers for various events. More...
 
void setTransitions () override
 This method is meant to be overridden in order to specify handlers for events. More...
 

Private Attributes

EDA_ITEMm_pickerItem
 

Detailed Description

Definition at line 34 of file symbol_editor_edit_tool.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determine the reason of reset for a tool.

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 77 of file tool_base.h.

78  {
79  RUN,
80  MODEL_RELOAD,
81  GAL_SWITCH
82  };
Model changes (required full reload)
Definition: tool_base.h:80
Tool is invoked after being inactive.
Definition: tool_base.h:79
Rendering engine changes.
Definition: tool_base.h:81

Constructor & Destructor Documentation

◆ SYMBOL_EDITOR_EDIT_TOOL()

SYMBOL_EDITOR_EDIT_TOOL::SYMBOL_EDITOR_EDIT_TOOL ( )

Definition at line 45 of file symbol_editor_edit_tool.cpp.

45  :
46  EE_TOOL_BASE( "eeschema.SymbolEditTool" ),
47  m_pickerItem( nullptr )
48 {
49 }
EE_TOOL_BASE(const std::string &aName)
Create a tool with given name.
Definition: ee_tool_base.h:55

◆ ~SYMBOL_EDITOR_EDIT_TOOL()

SYMBOL_EDITOR_EDIT_TOOL::~SYMBOL_EDITOR_EDIT_TOOL ( )
inlineoverride

Definition at line 38 of file symbol_editor_edit_tool.h.

38 { }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run the tool.

After activation, the tool starts receiving events until it is finished.

Definition at line 51 of file tool_interactive.cpp.

52 {
54 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.

References TOOL_MANAGER::InvokeTool(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCB_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), LIB_TREE::onContextMenu(), PCB_POINT_EDITOR::OnSelectionChange(), GROUP_TOOL::PickNewMember(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Set the TOOL_MANAGER the tool will belong to.

Called by TOOL_MANAGER::RegisterTool()

Definition at line 60 of file tool_base.cpp.

61 {
62  m_toolMgr = aManager;
63 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ Copy()

int SYMBOL_EDITOR_EDIT_TOOL::Copy ( const TOOL_EVENT aEvent)

Definition at line 665 of file symbol_editor_edit_tool.cpp.

666 {
667  LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
669 
670  if( !symbol || !selection.GetSize() )
671  return 0;
672 
673  for( LIB_ITEM& item : symbol->GetDrawItems() )
674  {
675  if( item.Type() == LIB_FIELD_T )
676  continue;
677 
678  wxASSERT( !item.HasFlag( STRUCT_DELETED ) );
679 
680  if( !item.IsSelected() )
681  item.SetFlags( STRUCT_DELETED );
682  }
683 
684  LIB_SYMBOL* partCopy = new LIB_SYMBOL( *symbol );
685 
686  STRING_FORMATTER formatter;
687  SCH_SEXPR_PLUGIN::FormatLibSymbol( partCopy, formatter );
688 
689  delete partCopy;
690 
691  for( LIB_ITEM& item : symbol->GetDrawItems() )
692  item.ClearFlags( STRUCT_DELETED );
693 
694  if( m_toolMgr->SaveClipboard( formatter.GetString() ) )
695  return 0;
696  else
697  return -1;
698 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
Define a library symbol object.
Definition: lib_symbol.h:96
static KICAD_T nonFields[]
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Return either an existing selection (filtered), or the selection at the current cursor if the existin...
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
static void FormatLibSymbol(LIB_SYMBOL *aPart, OUTPUTFORMATTER &aFormatter)
#define STRUCT_DELETED
flag indication structures to be erased
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:153
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
const std::string & GetString()
Definition: richio.h:438
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Definition: lib_symbol.h:484
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:88
bool SaveClipboard(const std::string &aTextUTF8)
Store information to the system clipboard.
Implement an OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:414

References EDA_ITEM::ClearFlags(), SCH_SEXPR_PLUGIN::FormatLibSymbol(), SYMBOL_EDIT_FRAME::GetCurSymbol(), LIB_SYMBOL::GetDrawItems(), SELECTION::GetSize(), STRING_FORMATTER::GetString(), LIB_FIELD_T, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, nonFields, EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::SaveClipboard(), and STRUCT_DELETED.

Referenced by Cut(), and setTransitions().

◆ Cut()

int SYMBOL_EDITOR_EDIT_TOOL::Cut ( const TOOL_EVENT aEvent)

Definition at line 654 of file symbol_editor_edit_tool.cpp.

655 {
656  int retVal = Copy( aEvent );
657 
658  if( retVal == 0 )
659  retVal = DoDelete( aEvent );
660 
661  return retVal;
662 }
int Copy(const TOOL_EVENT &aEvent)
int DoDelete(const TOOL_EVENT &aEvent)
Delete the selected items, or the item under the cursor.

References Copy(), and DoDelete().

Referenced by setTransitions().

◆ DeleteItemCursor()

int SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor ( const TOOL_EVENT aEvent)

Definition at line 331 of file symbol_editor_edit_tool.cpp.

332 {
333  std::string tool = aEvent.GetCommandStr().get();
335 
337  m_pickerItem = nullptr;
338 
339  // Deactivate other tools; particularly important if another PICKER is currently running
340  Activate();
341 
342  picker->SetCursor( KICURSOR::REMOVE );
343 
344  picker->SetClickHandler(
345  [this]( const VECTOR2D& aPosition ) -> bool
346  {
347  if( m_pickerItem )
348  {
350  selectionTool->UnbrightenItem( m_pickerItem );
351  selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
353  m_pickerItem = nullptr;
354  }
355 
356  return true;
357  } );
358 
359  picker->SetMotionHandler(
360  [this]( const VECTOR2D& aPos )
361  {
363  EE_COLLECTOR collector;
364 
365  selectionTool->CollectHits( collector, aPos, nonFields );
366 
367  // Remove unselectable items
368  for( int i = collector.GetCount() - 1; i >= 0; --i )
369  {
370  if( !selectionTool->Selectable( collector[ i ] ) )
371  collector.Remove( i );
372  }
373 
374  if( collector.GetCount() > 1 )
375  selectionTool->GuessSelectionCandidates( collector, aPos );
376 
377  EDA_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr;
378 
379  if( m_pickerItem != item )
380  {
381  if( m_pickerItem )
382  selectionTool->UnbrightenItem( m_pickerItem );
383 
384  m_pickerItem = item;
385 
386  if( m_pickerItem )
387  selectionTool->BrightenItem( m_pickerItem );
388  }
389  } );
390 
391  picker->SetFinalizeHandler(
392  [this]( const int& aFinalState )
393  {
394  if( m_pickerItem )
396 
397  // Wake the selection tool after exiting to ensure the cursor gets updated
399  } );
400 
401  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
402 
403  return 0;
404 }
static TOOL_ACTION doDelete
Definition: actions.h:72
bool Selectable(const EDA_ITEM *aItem, const VECTOR2I *aPos=nullptr, bool checkVisibilityOnly=false) const
Check conditions for an item to be selected.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
void SetFinalizeHandler(FINALIZE_HANDLER aHandler)
Set a handler for the finalize event.
Definition: picker_tool.h:102
static KICAD_T nonFields[]
void GuessSelectionCandidates(EE_COLLECTOR &collector, const VECTOR2I &aPos)
Apply heuristics to try and determine a single object when multiple are found under the cursor.
static TOOL_ACTION pickerTool
Definition: actions.h:155
void BrightenItem(EDA_ITEM *aItem)
void SetMotionHandler(MOTION_HANDLER aHandler)
Set a handler for mouse motion.
Definition: picker_tool.h:82
static TOOL_ACTION selectionActivate
Activation of the selection tool.
Definition: ee_actions.h:46
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
bool CollectHits(EE_COLLECTOR &aCollector, const VECTOR2I &aWhere, const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Select one or more items at the location given by parameter aWhere.
void UnbrightenItem(EDA_ITEM *aItem)
void SetCursor(KICURSOR aCursor)
Definition: picker_tool.h:62
void SetClickHandler(CLICK_HANDLER aHandler)
Set a handler for mouse click event.
Definition: picker_tool.h:71
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:460
int AddItemToSel(const TOOL_EVENT &aEvent)
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
void Activate()
Run the tool.

References TOOL_INTERACTIVE::Activate(), EE_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::BrightenItem(), EE_ACTIONS::clearSelection, EE_SELECTION_TOOL::CollectHits(), ACTIONS::doDelete, TOOL_EVENT::GetCommandStr(), TOOL_MANAGER::GetTool(), EE_SELECTION_TOOL::GuessSelectionCandidates(), m_pickerItem, TOOL_BASE::m_toolMgr, nonFields, ACTIONS::pickerTool, REMOVE, TOOL_MANAGER::RunAction(), EE_SELECTION_TOOL::Selectable(), EE_ACTIONS::selectionActivate, PICKER_TOOL_BASE::SetClickHandler(), PICKER_TOOL_BASE::SetCursor(), PICKER_TOOL_BASE::SetFinalizeHandler(), PICKER_TOOL_BASE::SetMotionHandler(), and EE_SELECTION_TOOL::UnbrightenItem().

Referenced by setTransitions().

◆ DoDelete()

int SYMBOL_EDITOR_EDIT_TOOL::DoDelete ( const TOOL_EVENT aEvent)

Delete the selected items, or the item under the cursor.

Run the deletion tool.

Definition at line 250 of file symbol_editor_edit_tool.cpp.

251 {
252  LIB_SYMBOL *symbol = m_frame->GetCurSymbol();
253  std::deque<EDA_ITEM*> items = m_selectionTool->RequestSelection( nonFields ).GetItems();
254 
255  if( items.empty() )
256  return 0;
257 
258  // Don't leave a freed pointer in the selection
260 
262 
263  std::set<LIB_ITEM *> toDelete;
264 
265  for( EDA_ITEM* item : items )
266  {
267  if( item->Type() == LIB_PIN_T )
268  {
269  LIB_PIN* pin = static_cast<LIB_PIN*>( item );
270  wxPoint pos = pin->GetPosition();
271 
272  toDelete.insert( pin );
273 
274  // when pin editing is synchronized, pins in the same position, with the same name
275  // in different units are also removed. But only one pin per unit (matching)
276  if( m_frame->SynchronizePins() )
277  {
278  std::vector<bool> got_unit( symbol->GetUnitCount() + 1 );
279 
280  got_unit[pin->GetUnit()] = true;
281 
282  int curr_convert = pin->GetConvert();
283  ELECTRICAL_PINTYPE etype = pin->GetType();
284  wxString name = pin->GetName();
285  LIB_PIN* next_pin = symbol->GetNextPin();
286 
287  while( next_pin != nullptr )
288  {
289  pin = next_pin;
290  next_pin = symbol->GetNextPin( pin );
291 
292  if( got_unit[pin->GetUnit()] )
293  continue;
294 
295  if( pin->GetPosition() != pos )
296  continue;
297 
298  if( pin->GetConvert() != curr_convert )
299  continue;
300 
301  if( pin->GetType() != etype )
302  continue;
303 
304  if( pin->GetName() != name )
305  continue;
306 
307  toDelete.insert( pin );
308  got_unit[pin->GetUnit()] = true;
309  }
310  }
311  }
312  else
313  {
314  toDelete.insert( (LIB_ITEM*) item );
315  }
316  }
317 
318  for( LIB_ITEM* item : toDelete )
319  symbol->RemoveDrawItem( item );
320 
321  m_frame->RebuildView();
322  m_frame->OnModify();
323 
324  return 0;
325 }
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
void RemoveDrawItem(LIB_ITEM *aItem)
Remove draw aItem from list.
Definition: lib_symbol.cpp:690
Define a library symbol object.
Definition: lib_symbol.h:96
static KICAD_T nonFields[]
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Return either an existing selection (filtered), or the selection at the current cursor if the existin...
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:134
int GetUnitCount() const override
For items with units, return the number of units.
const std::deque< EDA_ITEM * > GetItems() const
Definition: selection.h:109
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
const char * name
Definition: DXF_plotter.cpp:56
ELECTRICAL_PINTYPE
The symbol library pin object electrical types used in ERC tests.
Definition: pin_type.h:35
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
LIB_PIN * GetNextPin(LIB_PIN *aItem=nullptr)
Return the next pin object from the draw list.
Definition: lib_symbol.h:383

References EE_ACTIONS::clearSelection, SYMBOL_EDIT_FRAME::GetCurSymbol(), SELECTION::GetItems(), LIB_SYMBOL::GetNextPin(), LIB_SYMBOL::GetUnitCount(), LIB_PIN_T, LIBEDIT, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, name, nonFields, SYMBOL_EDIT_FRAME::OnModify(), pin, SYMBOL_EDIT_FRAME::RebuildView(), LIB_SYMBOL::RemoveDrawItem(), EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::saveCopyInUndoList(), and SYMBOL_EDIT_FRAME::SynchronizePins().

Referenced by Cut(), and setTransitions().

◆ Duplicate()

int SYMBOL_EDITOR_EDIT_TOOL::Duplicate ( const TOOL_EVENT aEvent)

Definition at line 766 of file symbol_editor_edit_tool.cpp.

767 {
768  LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
770 
771  if( selection.GetSize() == 0 )
772  return 0;
773 
774  // Doing a duplicate of a new object doesn't really make any sense; we'd just end
775  // up dragging around a stack of objects...
776  if( selection.Front()->IsNew() )
777  return 0;
778 
779  if( !selection.Front()->IsMoving() )
781 
782  EDA_ITEMS newItems;
783 
784  for( unsigned ii = 0; ii < selection.GetSize(); ++ii )
785  {
786  LIB_ITEM* oldItem = static_cast<LIB_ITEM*>( selection.GetItem( ii ) );
787  LIB_ITEM* newItem = (LIB_ITEM*) oldItem->Clone();
788  oldItem->ClearFlags( IS_NEW | IS_PASTED | SELECTED );
789  newItem->SetFlags( IS_NEW | IS_PASTED | SELECTED );
790  newItem->SetParent( symbol );
791  newItems.push_back( newItem );
792 
793  symbol->AddDrawItem( newItem );
794  getView()->Add( newItem );
795  }
796 
798  m_toolMgr->RunAction( EE_ACTIONS::addItemsToSel, true, &newItems );
799 
800  selection.SetReferencePoint( mapCoords( getViewControls()->GetCursorPosition( true ) ) );
802 
803  return 0;
804 }
#define IS_NEW
New item, just created.
static TOOL_ACTION addItemsToSel
Selects a list of items (specified as the event parameter)
Definition: ee_actions.h:63
bool IsMoving() const
Definition: eda_item.h:119
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
Define a library symbol object.
Definition: lib_symbol.h:96
static KICAD_T nonFields[]
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:83
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
bool IsNew() const
Definition: eda_item.h:118
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Return either an existing selection (filtered), or the selection at the current cursor if the existin...
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:192
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:134
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:153
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
#define SELECTED
void AddDrawItem(LIB_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
Definition: lib_symbol.cpp:716
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: eda_item.h:506
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static VECTOR2D mapCoords(const wxPoint &aCoord)
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:88
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.cpp:53
static TOOL_ACTION move
Definition: ee_actions.h:114
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:320
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
EDA_ITEM * Front() const
Definition: selection.h:145

References KIGFX::VIEW::Add(), LIB_SYMBOL::AddDrawItem(), EE_ACTIONS::addItemsToSel, EDA_ITEM::ClearFlags(), EE_ACTIONS::clearSelection, EDA_ITEM::Clone(), SELECTION::Front(), SYMBOL_EDIT_FRAME::GetCurSymbol(), SELECTION::GetItem(), SELECTION::GetSize(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), IS_NEW, IS_PASTED, EDA_ITEM::IsMoving(), EDA_ITEM::IsNew(), LIBEDIT, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, KIGFX::mapCoords(), EE_ACTIONS::move, nonFields, EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::saveCopyInUndoList(), SELECTED, and SELECTION::SetReferencePoint().

Referenced by setTransitions().

◆ editFieldProperties()

void SYMBOL_EDITOR_EDIT_TOOL::editFieldProperties ( LIB_FIELD aField)
private

Definition at line 499 of file symbol_editor_edit_tool.cpp.

500 {
501  if( aField == nullptr )
502  return;
503 
504  wxString caption;
505  LIB_SYMBOL* parent = aField->GetParent();
506  wxCHECK( parent, /* void */ );
507 
508  // Editing the symbol value field is equivalent to creating a new symbol based on the
509  // current symbol. Set the dialog message to inform the user.
510  if( aField->GetId() == VALUE_FIELD )
511  caption = _( "Edit Symbol Name" );
512  else if( aField->GetId() < MANDATORY_FIELDS )
513  caption.Printf( _( "Edit %s Field" ), TitleCaps( aField->GetName() ) );
514  else
515  caption.Printf( _( "Edit '%s' Field" ), aField->GetName() );
516 
517  DIALOG_LIB_FIELD_PROPERTIES dlg( m_frame, caption, aField );
518 
519  // The dialog may invoke a kiway player for footprint fields
520  // so we must use a quasimodal dialog.
521  if( dlg.ShowQuasiModal() != wxID_OK )
522  return;
523 
524  wxString newFieldValue = EscapeString( dlg.GetText(), CTX_LIBID );
525  wxString oldFieldValue = aField->GetFullText( m_frame->GetUnit() );
526  bool renamed = aField->GetId() == VALUE_FIELD && newFieldValue != oldFieldValue;
527 
528  if( renamed )
530  else
532 
533  dlg.UpdateField( aField );
534 
535  if( renamed )
536  {
537  parent->SetName( newFieldValue );
538  m_frame->UpdateAfterSymbolProperties( &oldFieldValue );
539  }
540  else
541  {
542  updateItem( aField, true );
543  m_frame->GetCanvas()->Refresh();
544  m_frame->OnModify();
546  }
547 }
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
int GetId() const
Definition: lib_field.h:115
Define a library symbol object.
Definition: lib_symbol.h:96
wxString GetName(bool aUseDefaultName=true) const
Return the field name.
Definition: lib_field.cpp:393
void UpdateAfterSymbolProperties(wxString *aOldName=nullptr)
Field Value of part, i.e. "3.3K".
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:134
wxString TitleCaps(const wxString &aString)
Capitalize the first letter in each word.
virtual void SetName(const wxString &aName)
Definition: lib_symbol.cpp:362
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
#define _(s)
void UpdateSymbolMsgPanelInfo()
Display the documentation of the selected symbol.
void updateItem(EDA_ITEM *aItem, bool aUpdateRTree) const
Similar to getView()->Update(), but handles items that are redrawn by their parents and updating the ...
Definition: ee_tool_base.h:103
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
LIB_SYMBOL * GetParent() const
Definition: lib_item.h:164
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
wxString GetFullText(int unit=1) const
Return the text of a field.
Definition: lib_field.cpp:325
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
Handle editing a single symbol field in the symbol editor.

References _, CTX_LIBID, EscapeString(), SCH_BASE_FRAME::GetCanvas(), LIB_FIELD::GetFullText(), LIB_FIELD::GetId(), LIB_FIELD::GetName(), LIB_ITEM::GetParent(), DIALOG_FIELD_PROPERTIES::GetText(), SYMBOL_EDIT_FRAME::GetUnit(), LIB_RENAME, LIBEDIT, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_frame, MANDATORY_FIELDS, SYMBOL_EDIT_FRAME::OnModify(), EDA_DRAW_PANEL_GAL::Refresh(), EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::saveCopyInUndoList(), LIB_SYMBOL::SetName(), DIALOG_SHIM::ShowQuasiModal(), TitleCaps(), SYMBOL_EDIT_FRAME::UpdateAfterSymbolProperties(), DIALOG_LIB_FIELD_PROPERTIES::UpdateField(), EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::updateItem(), SYMBOL_EDIT_FRAME::UpdateSymbolMsgPanelInfo(), and VALUE_FIELD.

Referenced by Properties().

◆ editShapeProperties()

void SYMBOL_EDITOR_EDIT_TOOL::editShapeProperties ( LIB_ITEM aItem)
private

Definition at line 462 of file symbol_editor_edit_tool.cpp.

463 {
464  DIALOG_LIB_SHAPE_PROPERTIES dlg( m_frame, aItem );
465 
466  if( dlg.ShowModal() != wxID_OK )
467  return;
468 
469  updateItem( aItem, true );
470  m_frame->GetCanvas()->Refresh();
471  m_frame->OnModify();
472 
474  drawingTools->SetDrawSpecificConvert( !dlg.GetApplyToAllConversions() );
475  drawingTools->SetDrawSpecificUnit( !dlg.GetApplyToAllUnits() );
476 
477  std::vector<MSG_PANEL_ITEM> items;
478  aItem->GetMsgPanelInfo( m_frame, items );
479  m_frame->SetMsgPanel( items );
480 }
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
Dialog to edit library component graphic items.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
Definition: lib_item.cpp:43
void updateItem(EDA_ITEM *aItem, bool aUpdateRTree) const
Similar to getView()->Update(), but handles items that are redrawn by their parents and updating the ...
Definition: ee_tool_base.h:103
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
SYMBOL_EDITOR_DRAWING_TOOLS.

References DIALOG_LIB_SHAPE_PROPERTIES::GetApplyToAllConversions(), DIALOG_LIB_SHAPE_PROPERTIES::GetApplyToAllUnits(), SCH_BASE_FRAME::GetCanvas(), LIB_ITEM::GetMsgPanelInfo(), TOOL_MANAGER::GetTool(), EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, SYMBOL_EDIT_FRAME::OnModify(), EDA_DRAW_PANEL_GAL::Refresh(), SYMBOL_EDITOR_DRAWING_TOOLS::SetDrawSpecificConvert(), SYMBOL_EDITOR_DRAWING_TOOLS::SetDrawSpecificUnit(), EDA_DRAW_FRAME::SetMsgPanel(), and EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::updateItem().

Referenced by Properties().

◆ editSymbolProperties()

void SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties ( )
private

Set up handlers for various events.

Definition at line 550 of file symbol_editor_edit_tool.cpp.

551 {
552  LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
553  bool partLocked = symbol->UnitsLocked();
554 
557 
558  DIALOG_LIB_SYMBOL_PROPERTIES dlg( m_frame, symbol );
559 
560  // This dialog itself subsequently can invoke a KIWAY_PLAYER as a quasimodal
561  // frame. Therefore this dialog as a modal frame parent, MUST be run under
562  // quasimodal mode for the quasimodal frame support to work. So don't use
563  // the QUASIMODAL macros here.
564  if( dlg.ShowQuasiModal() != wxID_OK )
565  return;
566 
567  m_frame->OnModify();
568 
569  // if m_UnitSelectionLocked has changed, set some edit options or defaults
570  // to the best value
571  if( partLocked != symbol->UnitsLocked() )
572  {
574 
575  // Enable synchronized pin edit mode for symbols with interchangeable units
576  m_frame->m_SyncPinEdit = !symbol->UnitsLocked();
577 
578  // also set default edit options to the better value
579  // Usually if units are locked, graphic items are specific to each unit
580  // and if units are interchangeable, graphic items are common to units
581  tools->SetDrawSpecificUnit( symbol->UnitsLocked() );
582  }
583 }
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
static TOOL_ACTION cancelInteractive
Definition: actions.h:62
bool m_SyncPinEdit
Set to true to synchronize pins at the same position when editing symbols with multiple units or mult...
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
Define a library symbol object.
Definition: lib_symbol.h:96
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
bool UnitsLocked() const
Check whether symbol units are interchangeable.
Definition: lib_symbol.h:241
SYMBOL_EDITOR_DRAWING_TOOLS.

References ACTIONS::cancelInteractive, EE_ACTIONS::clearSelection, SYMBOL_EDIT_FRAME::GetCurSymbol(), TOOL_MANAGER::GetTool(), EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_frame, SYMBOL_EDIT_FRAME::m_SyncPinEdit, TOOL_BASE::m_toolMgr, SYMBOL_EDIT_FRAME::OnModify(), TOOL_MANAGER::RunAction(), DIALOG_SHIM::ShowQuasiModal(), tools, and LIB_SYMBOL::UnitsLocked().

Referenced by Properties().

◆ editTextProperties()

void SYMBOL_EDITOR_EDIT_TOOL::editTextProperties ( LIB_ITEM aItem)
private

Definition at line 483 of file symbol_editor_edit_tool.cpp.

484 {
485  if ( aItem->Type() != LIB_TEXT_T )
486  return;
487 
489 
490  if( dlg.ShowModal() != wxID_OK )
491  return;
492 
493  updateItem( aItem, true );
494  m_frame->GetCanvas()->Refresh();
495  m_frame->OnModify( );
496 }
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
Define a symbol library graphical text item.
Definition: lib_text.h:39
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void updateItem(EDA_ITEM *aItem, bool aUpdateRTree) const
Similar to getView()->Update(), but handles items that are redrawn by their parents and updating the ...
Definition: ee_tool_base.h:103
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

References SCH_BASE_FRAME::GetCanvas(), LIB_TEXT_T, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_frame, SYMBOL_EDIT_FRAME::OnModify(), EDA_DRAW_PANEL_GAL::Refresh(), EDA_ITEM::Type(), and EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::updateItem().

Referenced by Properties().

◆ getEditFrame()

template<typename T >
T* TOOL_BASE::getEditFrame ( ) const
inlineprotectedinherited

Return the application window object, casted to requested user type.

Definition at line 184 of file tool_base.h.

185  {
186 #if !defined( QA_TEST ) // Dynamic casts give the linker a seizure in the test framework
187  wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
188 #endif
189  return static_cast<T*>( getToolHolderInt() );
190  }
TOOLS_HOLDER * getToolHolderInt() const
Definition: tool_base.cpp:48

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 120 of file tool_base.h.

121  {
122  return m_toolId;
123  }
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209

References TOOL_BASE::m_toolId.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::isActive(), TOOL_MANAGER::RegisterTool(), ACTION_MANAGER::RunHotKey(), TOOL_MANAGER::runTool(), TOOL_MANAGER::saveViewControls(), and TOOL_MANAGER::ShutdownTool().

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

Return the instance of TOOL_MANAGER that takes care of the tool.

Returns
Instance of the TOOL_MANAGER or NULL if there is no associated tool manager.

Definition at line 143 of file tool_base.h.

144  {
145  return m_toolMgr;
146  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214

References TOOL_BASE::m_toolMgr.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ACTION_MENU::getToolManager(), LIB_TREE::onContextMenu(), ZONE_CREATE_HELPER::OnFirstPoint(), ACTION_MENU::OnMenuEvent(), and ZONE_CREATE_HELPER::performZoneCutout().

◆ getModel()

template<typename T >
T* TOOL_BASE::getModel ( ) const
inlineprotectedinherited

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 196 of file tool_base.h.

References TOOL_BASE::getModelInt().

Referenced by ZONE_CREATE_HELPER::commitZone(), and ZONE_CREATE_HELPER::createZoneFromExisting().

◆ GetName()

const std::string& TOOL_BASE::GetName ( void  ) const
inlineinherited

Return the name of the tool.

Tool names are expected to obey the format: application.ToolName (eg. pcbnew.InteractiveSelection).

Returns
The name of the tool.

Definition at line 133 of file tool_base.h.

134  {
135  return m_toolName;
136  }
std::string m_toolName
Definition: tool_base.h:213

References TOOL_BASE::m_toolName.

Referenced by TOOL_MANAGER::dispatchInternal(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::invokeTool(), TOOL_MANAGER::RegisterTool(), and TOOL_MANAGER::runTool().

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 108 of file tool_base.h.

109  {
110  return m_type;
111  }
TOOL_TYPE m_type
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:206

References TOOL_BASE::m_type.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InvokeTool(), TOOL_MANAGER::ResetTools(), TOOL_MANAGER::runTool(), and TOOL_MANAGER::ShutdownTool().

◆ getView()

KIGFX::VIEW * TOOL_BASE::getView ( ) const
protectedinherited

Returns the instance of #VIEW object used in the application.

It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

37 {
38  return m_toolMgr->GetView();
39 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:283
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214

References TOOL_MANAGER::GetView(), and TOOL_BASE::m_toolMgr.

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), SCH_EDIT_TOOL::ChangeTextType(), EE_INSPECTION_TOOL::CheckSymbol(), GERBVIEW_CONTROL::ClearAllLayers(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::CollectHits(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomFit(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCB_CONTROL::GridResetOrigin(), PCB_CONTROL::GridSetOrigin(), ROUTER_TOOL::handleCommonEvents(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), PL_EDIT_TOOL::moveItem(), SCH_MOVE_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), ROUTER_TOOL::performRouting(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), ROUTER_TOOL::prepareInteractive(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), BOARD_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCB_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), PCB_SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), PCB_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectAll(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), PCB_SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), PCB_SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and PCB_SELECTION_TOOL::~PCB_SELECTION_TOOL().

◆ getViewControls()

KIGFX::VIEW_CONTROLS * TOOL_BASE::getViewControls ( ) const
protectedinherited

Return the instance of VIEW_CONTROLS object used in the application.

It allows tools to read & modify user input and its settings (eg. show cursor, enable snapping to grid, etc.).

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

43 {
44  return m_toolMgr->GetViewControls();
45 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:285

References TOOL_MANAGER::GetViewControls(), and TOOL_BASE::m_toolMgr.

Referenced by EE_POINT_EDITOR::addCorner(), PCB_POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDITOR_CONTROL::AssignNetclass(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), EDIT_TOOL::copyToClipboard(), SCH_DRAWING_TOOLS::createSheetPin(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), SCH_DRAWING_TOOLS::GetCanvasFreeAreaPixels(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), Paste(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), PCB_POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), PCB_SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PCB_PICKER_TOOL::setControls(), PICKER_TOOL::setControls(), PL_POINT_EDITOR::setEditedPoint(), EE_POINT_EDITOR::setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateItem(), PL_EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

template<class T >
void TOOL_INTERACTIVE::Go ( int(T::*)(const TOOL_EVENT &)  aStateFunc,
const TOOL_EVENT_LIST aConditions = TOOL_EVENTTC_ANYTA_ANY ) 
)
inherited

Define which state (aStateFunc) to go when a certain event arrives (aConditions).

No conditions means any event.

Definition at line 147 of file tool_interactive.h.

149 {
150  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
151 
152  goInternal( sptr, aConditions );
153 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:58
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)

References TOOL_INTERACTIVE::goInternal().

Referenced by AUTOPLACE_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), BOARD_REANNOTATE_TOOL::setTransitions(), GERBVIEW_INSPECTION_TOOL::setTransitions(), PCB_PICKER_TOOL::setTransitions(), SCH_NAVIGATE_TOOL::setTransitions(), SYMBOL_EDITOR_PIN_TOOL::setTransitions(), SYMBOL_EDITOR_MOVE_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), PL_POINT_EDITOR::setTransitions(), ROUTER_TOOL::setTransitions(), SCRIPTING_TOOL::setTransitions(), COMMON_CONTROL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), CONVERT_TOOL::setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), MICROWAVE_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PCB_POINT_EDITOR::setTransitions(), GERBVIEW_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), PAD_TOOL::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GROUP_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_CONTROL::setTransitions(), setTransitions(), PL_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), SCH_EDIT_TOOL::setTransitions(), FOOTPRINT_EDITOR_CONTROL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), DRC_TOOL::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), PCB_CONTROL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), BOARD_INSPECTION_TOOL::setTransitions(), BOARD_EDITOR_CONTROL::setTransitions(), PICKER_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), PCB_SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), DRAWING_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ Init()

bool SYMBOL_EDITOR_EDIT_TOOL::Init ( )
overridevirtual

Init() is called once upon a registration of the tool.

Returns
True if the initialization went fine, false - otherwise.

Reimplemented from TOOL_BASE.

Definition at line 52 of file symbol_editor_edit_tool.cpp.

53 {
55 
58 
59  wxASSERT_MSG( drawingTools, wxT( "eeschema.SymbolDrawing tool is not available" ) );
60 
61  auto haveSymbolCondition =
62  [&]( const SELECTION& sel )
63  {
64  return m_isSymbolEditor &&
65  static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
66  };
67 
68  auto canEdit =
69  [&]( const SELECTION& sel )
70  {
71  SYMBOL_EDIT_FRAME* editor = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
72  wxCHECK( editor, false );
73 
74  if( !editor->IsSymbolEditable() )
75  return false;
76 
77  if( editor->IsSymbolAlias() )
78  {
79  for( EDA_ITEM* item : sel )
80  {
81  if( item->Type() != LIB_FIELD_T )
82  return false;
83  }
84  }
85 
86  return true;
87  };
88 
89  // Add edit actions to the move tool menu
90  if( moveTool )
91  {
92  CONDITIONAL_MENU& moveMenu = moveTool->GetToolMenu().GetMenu();
93 
94  moveMenu.AddSeparator( 200 );
95  moveMenu.AddItem( EE_ACTIONS::rotateCCW, canEdit && EE_CONDITIONS::NotEmpty, 200 );
96  moveMenu.AddItem( EE_ACTIONS::rotateCW, canEdit && EE_CONDITIONS::NotEmpty, 200 );
97  moveMenu.AddItem( EE_ACTIONS::mirrorV, canEdit && EE_CONDITIONS::NotEmpty, 200 );
98  moveMenu.AddItem( EE_ACTIONS::mirrorH, canEdit && EE_CONDITIONS::NotEmpty, 200 );
99 
100  moveMenu.AddItem( EE_ACTIONS::properties, canEdit && EE_CONDITIONS::Count( 1 ), 200 );
101 
102  moveMenu.AddSeparator( 300 );
105  moveMenu.AddItem( ACTIONS::duplicate, canEdit && EE_CONDITIONS::NotEmpty, 300 );
106  moveMenu.AddItem( ACTIONS::doDelete, canEdit && EE_CONDITIONS::NotEmpty, 200 );
107 
108  moveMenu.AddSeparator( 400 );
109  moveMenu.AddItem( ACTIONS::selectAll, haveSymbolCondition, 400 );
110  }
111 
112  // Add editing actions to the drawing tool menu
113  CONDITIONAL_MENU& drawMenu = drawingTools->GetToolMenu().GetMenu();
114 
115  drawMenu.AddSeparator( 200 );
116  drawMenu.AddItem( EE_ACTIONS::rotateCCW, canEdit && EE_CONDITIONS::IdleSelection, 200 );
117  drawMenu.AddItem( EE_ACTIONS::rotateCW, canEdit && EE_CONDITIONS::IdleSelection, 200 );
118  drawMenu.AddItem( EE_ACTIONS::mirrorV, canEdit && EE_CONDITIONS::IdleSelection, 200 );
119  drawMenu.AddItem( EE_ACTIONS::mirrorH, canEdit && EE_CONDITIONS::IdleSelection, 200 );
120 
121  drawMenu.AddItem( EE_ACTIONS::properties, canEdit && EE_CONDITIONS::Count( 1 ), 200 );
122 
123  // Add editing actions to the selection tool menu
125 
126  selToolMenu.AddItem( EE_ACTIONS::rotateCCW, canEdit && EE_CONDITIONS::NotEmpty, 200 );
127  selToolMenu.AddItem( EE_ACTIONS::rotateCW, canEdit && EE_CONDITIONS::NotEmpty, 200 );
128  selToolMenu.AddItem( EE_ACTIONS::mirrorV, canEdit && EE_CONDITIONS::NotEmpty, 200 );
129  selToolMenu.AddItem( EE_ACTIONS::mirrorH, canEdit && EE_CONDITIONS::NotEmpty, 200 );
130 
131  selToolMenu.AddItem( EE_ACTIONS::properties, canEdit && EE_CONDITIONS::Count( 1 ), 200 );
132 
133  selToolMenu.AddSeparator( 300 );
136  selToolMenu.AddItem( ACTIONS::paste, canEdit && EE_CONDITIONS::Idle, 300 );
137  selToolMenu.AddItem( ACTIONS::duplicate, canEdit && EE_CONDITIONS::NotEmpty, 300 );
138  selToolMenu.AddItem( ACTIONS::doDelete, canEdit && EE_CONDITIONS::NotEmpty, 300 );
139 
140  selToolMenu.AddSeparator( 400 );
141  selToolMenu.AddItem( ACTIONS::selectAll, haveSymbolCondition, 400 );
142 
143  return true;
144 }
static TOOL_ACTION properties
Definition: ee_actions.h:121
static TOOL_ACTION doDelete
Definition: actions.h:72
static bool Idle(const SELECTION &aSelection)
Test if there no items selected or being edited.
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
TOOL_MENU & GetToolMenu()
static TOOL_ACTION mirrorH
Definition: ee_actions.h:120
static SELECTION_CONDITION Count(int aNumber)
Create a functor that tests if the number of selected items is equal to the value given as parameter.
static bool IdleSelection(const SELECTION &aSelection)
Test if all selected items are not being edited.
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
static TOOL_ACTION mirrorV
Definition: ee_actions.h:119
static TOOL_ACTION rotateCW
Definition: ee_actions.h:117
bool Init() override
Init() is called once upon a registration of the tool.
Definition: ee_tool_base.h:66
static TOOL_ACTION copy
Definition: actions.h:67
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:118
static TOOL_ACTION cut
Definition: actions.h:66
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
void AddSeparator(int aOrder=ANY_ORDER)
Add a separator to the menu.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add a menu entry to run a TOOL_ACTION on selected items.
static TOOL_ACTION selectAll
Definition: actions.h:70
static TOOL_ACTION paste
Definition: actions.h:68
static TOOL_ACTION duplicate
Definition: actions.h:71
SYMBOL_EDITOR_DRAWING_TOOLS.
The symbol library editor main window.

References CONDITIONAL_MENU::AddItem(), CONDITIONAL_MENU::AddSeparator(), ACTIONS::copy, SELECTION_CONDITIONS::Count(), ACTIONS::cut, ACTIONS::doDelete, ACTIONS::duplicate, editor, TOOL_MENU::GetMenu(), TOOL_MANAGER::GetTool(), TOOL_INTERACTIVE::GetToolMenu(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), EE_TOOL_BASE< T >::Init(), LIB_FIELD_T, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_isSymbolEditor, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_ACTIONS::mirrorH, EE_ACTIONS::mirrorV, SELECTION_CONDITIONS::NotEmpty(), ACTIONS::paste, EE_ACTIONS::properties, EE_ACTIONS::rotateCCW, EE_ACTIONS::rotateCW, and ACTIONS::selectAll.

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

32 {
33  return m_toolMgr->IsToolActive( m_toolId );
34 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209
bool IsToolActive(TOOL_ID aId) const
Return true if a tool with given id is active (executing)

References TOOL_MANAGER::IsToolActive(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

Referenced by EDIT_TOOL::Drag(), ROUTER_TOOL::handleLayerSwitch(), EDIT_TOOL::isRouterActive(), PCB_SELECTION_TOOL::Main(), BOARD_EDITOR_CONTROL::TrackWidthDec(), and BOARD_EDITOR_CONTROL::TrackWidthInc().

◆ Mirror()

int SYMBOL_EDITOR_EDIT_TOOL::Mirror ( const TOOL_EVENT aEvent)

Definition at line 191 of file symbol_editor_edit_tool.cpp.

192 {
194 
195  if( selection.GetSize() == 0 )
196  return 0;
197 
198  wxPoint mirrorPoint;
199  bool xAxis = ( aEvent.Matches( EE_ACTIONS::mirrorV.MakeEvent() ) );
200  LIB_ITEM* item = static_cast<LIB_ITEM*>( selection.Front() );
201 
202  if( !item->IsMoving() )
204 
205  if( selection.GetSize() == 1 )
206  mirrorPoint = item->GetPosition();
207  else
208  mirrorPoint = m_frame->GetNearestHalfGridPosition( mapCoords( selection.GetCenter() ) );
209 
210  for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
211  {
212  item = static_cast<LIB_ITEM*>( selection.GetItem( ii ) );
213 
214  if( xAxis )
215  item->MirrorVertical( mirrorPoint );
216  else
217  item->MirrorHorizontal( mirrorPoint );
218 
219  m_frame->UpdateItem( item, false, true );
220  }
221 
223 
224  if( item->IsMoving() )
225  {
227  }
228  else
229  {
230  if( selection.IsHover() )
232 
233  m_frame->OnModify();
234  }
235 
236  return 0;
237 }
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
virtual VECTOR2I GetCenter() const
Returns the center point of the selection area bounding box.
Definition: selection.cpp:71
bool IsHover() const
Definition: selection.h:74
bool IsMoving() const
Definition: eda_item.h:119
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
wxPoint GetNearestHalfGridPosition(const wxPoint &aPosition) const
Return the nearest aGridSize / 2 location to aPosition.
virtual void MirrorHorizontal(const wxPoint &aCenter)=0
Mirror the draw object along the horizontal (X) axis about aCenter point.
virtual wxPoint GetPosition() const
Definition: eda_item.h:251
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:205
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
static TOOL_ACTION mirrorV
Definition: ee_actions.h:119
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Return either an existing selection (filtered), or the selection at the current cursor if the existin...
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:134
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false)
Mark an item for refresh.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
bool Matches(const TOOL_EVENT &aEvent) const
Test whether two events match in terms of category & action or command.
Definition: tool_event.h:362
virtual void MirrorVertical(const wxPoint &aCenter)=0
Mirror the draw object along the MirrorVertical (Y) axis about aCenter point.
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static VECTOR2D mapCoords(const wxPoint &aCoord)
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:88
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.cpp:53
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
static TOOL_ACTION refreshPreview
Definition: actions.h:106
EDA_ITEM * Front() const
Definition: selection.h:145

References EE_ACTIONS::clearSelection, SELECTION::Front(), SELECTION::GetCenter(), SYMBOL_EDIT_FRAME::GetCurSymbol(), SELECTION::GetItem(), EDA_DRAW_FRAME::GetNearestHalfGridPosition(), EDA_ITEM::GetPosition(), SELECTION::GetSize(), SELECTION::IsHover(), EDA_ITEM::IsMoving(), LIBEDIT, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, KIGFX::mapCoords(), TOOL_EVENT::Matches(), LIB_ITEM::MirrorHorizontal(), EE_ACTIONS::mirrorV, LIB_ITEM::MirrorVertical(), SYMBOL_EDIT_FRAME::OnModify(), TOOL_MANAGER::PostEvent(), ACTIONS::refreshPreview, EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::saveCopyInUndoList(), EVENTS::SelectedItemsModified, and SCH_BASE_FRAME::UpdateItem().

Referenced by setTransitions().

◆ Paste()

int SYMBOL_EDITOR_EDIT_TOOL::Paste ( const TOOL_EVENT aEvent)

Definition at line 701 of file symbol_editor_edit_tool.cpp.

702 {
703  LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
704 
705  if( !symbol || symbol->IsAlias() )
706  return 0;
707 
708  std::string text_utf8 = m_toolMgr->GetClipboardUTF8();
709  STRING_LINE_READER reader( text_utf8, wxT( "Clipboard" ) );
710  LIB_SYMBOL* newPart;
711 
712  try
713  {
714  newPart = SCH_SEXPR_PLUGIN::ParseLibSymbol( reader );
715  }
716  catch( IO_ERROR& )
717  {
718  // If it's not a symbol then paste as text
719  newPart = new LIB_SYMBOL( wxT( "dummy_part" ) );
720  LIB_TEXT* newText = new LIB_TEXT( newPart );
721  newText->SetText( wxString::FromUTF8( text_utf8.c_str() ) );
722  newPart->AddDrawItem( newText );
723  }
724 
725  if( !newPart )
726  return -1;
727 
728  m_frame->SaveCopyInUndoList( symbol );
730 
731  for( LIB_ITEM& item : symbol->GetDrawItems() )
732  item.ClearFlags( IS_NEW | IS_PASTED | SELECTED );
733 
734  for( LIB_ITEM& item : newPart->GetDrawItems() )
735  {
736  if( item.Type() == LIB_FIELD_T )
737  continue;
738 
739  LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
740  newItem->SetParent( symbol );
741  newItem->SetFlags( IS_NEW | IS_PASTED | SELECTED );
742 
743  newItem->SetUnit( newItem->GetUnit() ? m_frame->GetUnit() : 0 );
744  newItem->SetConvert( newItem->GetConvert() ? m_frame->GetConvert() : 0 );
745 
746  symbol->AddDrawItem( newItem );
747  getView()->Add( newItem );
748  }
749 
750  delete newPart;
751 
753 
754  EE_SELECTION& selection = m_selectionTool->GetSelection();
755 
756  if( !selection.Empty() )
757  {
758  selection.SetReferencePoint( getViewControls()->GetCursorPosition( true ) );
760  }
761 
762  return 0;
763 }
#define IS_NEW
New item, just created.
Define a symbol library graphical text item.
Definition: lib_text.h:39
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool IsAlias() const
Definition: lib_symbol.h:172
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:152
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
Define a library symbol object.
Definition: lib_symbol.h:96
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:115
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:83
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
EE_SELECTION & GetSelection()
Return the set of currently selected items.
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:192
int GetUnit() const
Definition: lib_item.h:266
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
static LIB_SYMBOL * ParseLibSymbol(LINE_READER &aReader, int aVersion=SEXPR_SCHEMATIC_FILE_VERSION)
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:124
std::string GetClipboardUTF8() const
Return the information currently stored in the system clipboard.
void SaveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aUndoType=UNDO_REDO::LIBEDIT, bool aAppend=false)
Create a copy of the current symbol, and save it in the undo list.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
#define SELECTED
void AddDrawItem(LIB_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
Definition: lib_symbol.cpp:716
int GetConvert() const
Definition: lib_item.h:269
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Definition: lib_symbol.h:484
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:98
void SetConvert(int aConvert)
Definition: lib_item.h:268
void SetUnit(int aUnit)
Definition: lib_item.h:265
int ClearSelection(const TOOL_EVENT &aEvent)
Select all visible items in sheet.
void RebuildSelection()
Rebuild the selection from the EDA_ITEMs' selection flags.
static TOOL_ACTION move
Definition: ee_actions.h:114
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:320
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:240
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75

References KIGFX::VIEW::Add(), LIB_SYMBOL::AddDrawItem(), EE_SELECTION_TOOL::ClearSelection(), EDA_ITEM::Clone(), SELECTION::Empty(), TOOL_MANAGER::GetClipboardUTF8(), SYMBOL_EDIT_FRAME::GetConvert(), LIB_ITEM::GetConvert(), SYMBOL_EDIT_FRAME::GetCurSymbol(), LIB_SYMBOL::GetDrawItems(), EE_SELECTION_TOOL::GetSelection(), SYMBOL_EDIT_FRAME::GetUnit(), LIB_ITEM::GetUnit(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), IS_NEW, IS_PASTED, LIB_SYMBOL::IsAlias(), LIB_FIELD_T, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_ACTIONS::move, SCH_SEXPR_PLUGIN::ParseLibSymbol(), EE_SELECTION_TOOL::RebuildSelection(), TOOL_MANAGER::RunAction(), SYMBOL_EDIT_FRAME::SaveCopyInUndoList(), SELECTED, LIB_ITEM::SetConvert(), EDA_ITEM::SetFlags(), EDA_ITEM::SetParent(), SELECTION::SetReferencePoint(), EDA_TEXT::SetText(), and LIB_ITEM::SetUnit().

Referenced by setTransitions().

◆ PinTable()

int SYMBOL_EDITOR_EDIT_TOOL::PinTable ( const TOOL_EVENT aEvent)

Definition at line 586 of file symbol_editor_edit_tool.cpp.

587 {
588  LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
589 
590  if( !symbol )
591  return 0;
592 
594 
596 
597  DIALOG_LIB_EDIT_PIN_TABLE dlg( m_frame, symbol );
598 
599  if( dlg.ShowModal() == wxID_CANCEL )
600  return -1;
601 
602  m_frame->RebuildView();
603  m_frame->OnModify();
604 
605  return 0;
606 }
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
Define a library symbol object.
Definition: lib_symbol.h:96
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:134
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56

References EE_ACTIONS::clearSelection, SYMBOL_EDIT_FRAME::GetCurSymbol(), LIBEDIT, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, SYMBOL_EDIT_FRAME::OnModify(), SYMBOL_EDIT_FRAME::RebuildView(), TOOL_MANAGER::RunAction(), and EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::saveCopyInUndoList().

Referenced by setTransitions().

◆ Properties()

int SYMBOL_EDITOR_EDIT_TOOL::Properties ( const TOOL_EVENT aEvent)

Definition at line 407 of file symbol_editor_edit_tool.cpp.

408 {
410 
411  if( selection.Empty() || aEvent.IsAction( &EE_ACTIONS::symbolProperties ) )
412  {
413  if( m_frame->GetCurSymbol() )
415  }
416  else if( selection.Size() == 1 )
417  {
418  LIB_ITEM* item = (LIB_ITEM*) selection.Front();
419 
420  // Save copy for undo if not in edit (edit command already handle the save copy)
421  if( item->GetEditFlags() == 0 )
423 
424  switch( item->Type() )
425  {
426  case LIB_PIN_T:
427  {
429 
430  if( pinTool )
431  pinTool->EditPinProperties( (LIB_PIN*) item );
432  }
433  break;
434 
435  case LIB_SHAPE_T:
436  editShapeProperties( item );
437  break;
438 
439  case LIB_TEXT_T:
440  editTextProperties( item );
441  break;
442 
443  case LIB_FIELD_T:
444  editFieldProperties( (LIB_FIELD*) item );
445  break;
446 
447  default:
448  wxFAIL_MSG( wxT( "Unhandled item <" ) + item->GetClass() + wxT( ">" ) );
449  break;
450  }
451  }
452 
453  if( selection.IsHover() )
455  else
457 
458  return 0;
459 }
bool IsHover() const
Definition: selection.h:74
void editSymbolProperties()
Set up handlers for various events.
void editFieldProperties(LIB_FIELD *aField)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
Field object used in symbol libraries.
Definition: lib_field.h:59
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:205
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:88
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Return either an existing selection (filtered), or the selection at the current cursor if the existin...
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:134
static TOOL_ACTION symbolProperties
Definition: ee_actions.h:145
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:157
void editShapeProperties(LIB_ITEM *aItem)
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:98
LIB_SYMBOL * GetParent() const
Definition: lib_item.h:164
virtual wxString GetClass() const =0
Return the class name.
int Size() const
Returns the number of selected parts.
Definition: selection.h:104
void editTextProperties(LIB_ITEM *aItem)
bool EditPinProperties(LIB_PIN *aPin)
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
EDA_ITEM * Front() const
Definition: selection.h:145
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

References EE_ACTIONS::clearSelection, editFieldProperties(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), editShapeProperties(), editSymbolProperties(), editTextProperties(), SELECTION::Empty(), SELECTION::Front(), LIB_FIELD::GetClass(), SYMBOL_EDIT_FRAME::GetCurSymbol(), EDA_ITEM::GetEditFlags(), LIB_ITEM::GetParent(), TOOL_MANAGER::GetTool(), TOOL_EVENT::IsAction(), SELECTION::IsHover(), LIB_FIELD_T, LIB_PIN_T, LIB_SHAPE_T, LIB_TEXT_T, LIBEDIT, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, TOOL_MANAGER::PostEvent(), EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::saveCopyInUndoList(), EVENTS::SelectedItemsModified, SELECTION::Size(), EE_ACTIONS::symbolProperties, and EDA_ITEM::Type().

Referenced by setTransitions().

◆ Redo()

int SYMBOL_EDITOR_EDIT_TOOL::Redo ( const TOOL_EVENT aEvent)

Definition at line 643 of file symbol_editor_edit_tool.cpp.

644 {
646 
648  selTool->RebuildSelection();
649 
650  return 0;
651 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void RebuildSelection()
Rebuild the selection from the EDA_ITEMs' selection flags.

References SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), TOOL_MANAGER::GetTool(), EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, and EE_SELECTION_TOOL::RebuildSelection().

Referenced by setTransitions().

◆ Reset()

void EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::Reset ( RESET_REASON  aReason)
inlineoverridevirtualinherited

Bring the tool to a known, initial state.

If the tool claimed anything from the model or the view, it must release it when its reset.

Parameters
aReasoncontains information about the reason of tool reset.

Implements TOOL_BASE.

Definition at line 86 of file ee_tool_base.h.

87  {
88  if( aReason == MODEL_RELOAD )
89  {
90  // Init variables used by every drawing tool
91  m_frame = getEditFrame<T>();
92  m_isSymbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) != nullptr;
93  }
94 
95  m_view = static_cast<KIGFX::SCH_VIEW*>( getView() );
96  }
Model changes (required full reload)
Definition: tool_base.h:80
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36

◆ Rotate()

int SYMBOL_EDITOR_EDIT_TOOL::Rotate ( const TOOL_EVENT aEvent)

Definition at line 147 of file symbol_editor_edit_tool.cpp.

148 {
150 
151  if( selection.GetSize() == 0 )
152  return 0;
153 
154  wxPoint rotPoint;
155  bool ccw = ( aEvent.Matches( EE_ACTIONS::rotateCCW.MakeEvent() ) );
156  LIB_ITEM* item = static_cast<LIB_ITEM*>( selection.Front() );
157 
158  if( !item->IsMoving() )
160 
161  if( selection.GetSize() == 1 )
162  rotPoint = item->GetPosition();
163  else
164  rotPoint = m_frame->GetNearestHalfGridPosition( mapCoords( selection.GetCenter() ) );
165 
166  for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
167  {
168  item = static_cast<LIB_ITEM*>( selection.GetItem( ii ) );
169  item->Rotate( rotPoint, ccw );
170  m_frame->UpdateItem( item, false, true );
171  }
172 
173  if( item->IsMoving() )
174  {
176  }
177  else
178  {
180 
181  if( selection.IsHover() )
183 
184  m_frame->OnModify();
185  }
186 
187  return 0;
188 }
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
virtual VECTOR2I GetCenter() const
Returns the center point of the selection area bounding box.
Definition: selection.cpp:71
bool IsHover() const
Definition: selection.h:74
bool IsMoving() const
Definition: eda_item.h:119
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
wxPoint GetNearestHalfGridPosition(const wxPoint &aPosition) const
Return the nearest aGridSize / 2 location to aPosition.
virtual wxPoint GetPosition() const
Definition: eda_item.h:251
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:205
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Return either an existing selection (filtered), or the selection at the current cursor if the existin...
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:118
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:134
virtual void Rotate(const wxPoint &aCenter, bool aRotateCCW=true)=0
Rotate the object about aCenter point.
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false)
Mark an item for refresh.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
bool Matches(const TOOL_EVENT &aEvent) const
Test whether two events match in terms of category & action or command.
Definition: tool_event.h:362
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static VECTOR2D mapCoords(const wxPoint &aCoord)
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:88
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.cpp:53
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
static TOOL_ACTION refreshPreview
Definition: actions.h:106
EDA_ITEM * Front() const
Definition: selection.h:145

References EE_ACTIONS::clearSelection, SELECTION::Front(), SELECTION::GetCenter(), SYMBOL_EDIT_FRAME::GetCurSymbol(), SELECTION::GetItem(), EDA_DRAW_FRAME::GetNearestHalfGridPosition(), EDA_ITEM::GetPosition(), SELECTION::GetSize(), SELECTION::IsHover(), EDA_ITEM::IsMoving(), LIBEDIT, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, KIGFX::mapCoords(), TOOL_EVENT::Matches(), SYMBOL_EDIT_FRAME::OnModify(), TOOL_MANAGER::PostEvent(), ACTIONS::refreshPreview, EE_SELECTION_TOOL::RequestSelection(), LIB_ITEM::Rotate(), EE_ACTIONS::rotateCCW, TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::saveCopyInUndoList(), EVENTS::SelectedItemsModified, and SCH_BASE_FRAME::UpdateItem().

Referenced by setTransitions().

◆ RunMainStack()

void TOOL_INTERACTIVE::RunMainStack ( std::function< void()>  aFunc)
inherited

Call a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

88 {
89  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
90 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::RunMainStack().

Referenced by DRAWING_TOOL::PlaceText().

◆ saveCopyInUndoList()

void EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::saveCopyInUndoList ( EDA_ITEM aItem,
UNDO_REDO  aType,
bool  aAppend = false 
)
inlineprotectedinherited

Definition at line 134 of file ee_tool_base.h.

135  {
136  wxASSERT( aItem );
137 
138  KICAD_T itemType = aItem->Type();
139  bool selected = aItem->IsSelected();
140 
141  // IS_SELECTED flag should not be set on undo items which were added for
142  // a drag operation.
143  if( selected && aItem->HasFlag( TEMP_SELECTED ) )
144  aItem->ClearSelected();
145 
146  if( m_isSymbolEditor )
147  {
148  SYMBOL_EDIT_FRAME* editFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
149  wxASSERT( editFrame );
150 
151  editFrame->SaveCopyInUndoList( static_cast<LIB_ITEM*>( aItem ), aType, aAppend );
152  }
153  else
154  {
155  SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
156  wxASSERT( editFrame );
157 
158  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
159  {
160  editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
161  static_cast<SCH_ITEM*>( aItem->GetParent() ),
162  UNDO_REDO::CHANGED, aAppend );
163  }
164  else
165  {
166  editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
167  static_cast<SCH_ITEM*>( aItem ),
168  aType, aAppend );
169  }
170  }
171 
172  if( selected && aItem->HasFlag( TEMP_SELECTED ) )
173  aItem->SetSelected();
174  }
bool IsSelected() const
Definition: eda_item.h:122
void ClearSelected()
Definition: eda_item.h:131
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
Definition: eda_item.h:155
Schematic editor (Eeschema) main window.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetSelected()
Definition: eda_item.h:128
void SaveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aUndoType=UNDO_REDO::LIBEDIT, bool aAppend=false)
Create a copy of the current symbol, and save it in the undo list.
EDA_ITEM * GetParent() const
Definition: eda_item.h:114
#define TEMP_SELECTED
flag indicating that the structure has already selected
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend)
Create a copy of the current schematic item, and put it in the undo list.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
The symbol library editor main window.

◆ SetContextMenu()

void TOOL_INTERACTIVE::SetContextMenu ( ACTION_MENU aMenu,
CONTEXT_MENU_TRIGGER  aTrigger = CMENU_BUTTON 
)
inherited

Assign a context menu and tells when it should be activated.

Parameters
aMenuis the menu to be assigned.
aTriggerdetermines conditions upon which the context menu is activated.

Definition at line 76 of file tool_interactive.cpp.

77 {
78  if( aMenu )
79  aMenu->SetTool( this );
80  else
81  aTrigger = CMENU_OFF;
82 
83  m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
84 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void SetTool(TOOL_INTERACTIVE *aTool)
Set a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Set behavior of the tool's context popup menu.

References CMENU_OFF, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ScheduleContextMenu(), and ACTION_MENU::SetTool().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ setTransitions()

void SYMBOL_EDITOR_EDIT_TOOL::setTransitions ( )
overrideprivatevirtual

This method is meant to be overridden in order to specify handlers for events.

It is called every time tool is reset or finished.

Implements TOOL_INTERACTIVE.

Definition at line 807 of file symbol_editor_edit_tool.cpp.

808 {
815 
822 
827 }
static TOOL_ACTION pinTable
Definition: ee_actions.h:146
static TOOL_ACTION properties
Definition: ee_actions.h:121
int UpdateSymbolFields(const TOOL_EVENT &aEvent)
static TOOL_ACTION doDelete
Definition: actions.h:72
int Copy(const TOOL_EVENT &aEvent)
static TOOL_ACTION mirrorH
Definition: ee_actions.h:120
static TOOL_ACTION updateSymbolFields
Definition: ee_actions.h:182
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).
static TOOL_ACTION mirrorV
Definition: ee_actions.h:119
static TOOL_ACTION rotateCW
Definition: ee_actions.h:117
static TOOL_ACTION copy
Definition: actions.h:67
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:118
int Redo(const TOOL_EVENT &aEvent)
int Properties(const TOOL_EVENT &aEvent)
static TOOL_ACTION symbolProperties
Definition: ee_actions.h:145
static TOOL_ACTION cut
Definition: actions.h:66
int DeleteItemCursor(const TOOL_EVENT &aEvent)
int Mirror(const TOOL_EVENT &aEvent)
int Duplicate(const TOOL_EVENT &aEvent)
static TOOL_ACTION redo
Definition: actions.h:65
int PinTable(const TOOL_EVENT &aEvent)
int Rotate(const TOOL_EVENT &aEvent)
static TOOL_ACTION deleteTool
Definition: actions.h:73
int Paste(const TOOL_EVENT &aEvent)
static TOOL_ACTION undo
Definition: actions.h:64
int Undo(const TOOL_EVENT &aEvent)
static TOOL_ACTION paste
Definition: actions.h:68
static TOOL_ACTION duplicate
Definition: actions.h:71
int Cut(const TOOL_EVENT &aEvent)
int DoDelete(const TOOL_EVENT &aEvent)
Delete the selected items, or the item under the cursor.

References Copy(), ACTIONS::copy, Cut(), ACTIONS::cut, DeleteItemCursor(), ACTIONS::deleteTool, DoDelete(), ACTIONS::doDelete, Duplicate(), ACTIONS::duplicate, TOOL_INTERACTIVE::Go(), Mirror(), EE_ACTIONS::mirrorH, EE_ACTIONS::mirrorV, Paste(), ACTIONS::paste, PinTable(), EE_ACTIONS::pinTable, Properties(), EE_ACTIONS::properties, Redo(), ACTIONS::redo, Rotate(), EE_ACTIONS::rotateCCW, EE_ACTIONS::rotateCW, EE_ACTIONS::symbolProperties, Undo(), ACTIONS::undo, UpdateSymbolFields(), and EE_ACTIONS::updateSymbolFields.

◆ Undo()

int SYMBOL_EDITOR_EDIT_TOOL::Undo ( const TOOL_EVENT aEvent)

Definition at line 632 of file symbol_editor_edit_tool.cpp.

633 {
635 
637  selTool->RebuildSelection();
638 
639  return 0;
640 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void RebuildSelection()
Rebuild the selection from the EDA_ITEMs' selection flags.

References SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), TOOL_MANAGER::GetTool(), EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, and EE_SELECTION_TOOL::RebuildSelection().

Referenced by setTransitions().

◆ updateItem()

void EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::updateItem ( EDA_ITEM aItem,
bool  aUpdateRTree 
) const
inlineprotectedinherited

Similar to getView()->Update(), but handles items that are redrawn by their parents and updating the SCH_SCREEN's RTree.

Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.

Definition at line 103 of file ee_tool_base.h.

◆ UpdateSymbolFields()

int SYMBOL_EDITOR_EDIT_TOOL::UpdateSymbolFields ( const TOOL_EVENT aEvent)

Definition at line 609 of file symbol_editor_edit_tool.cpp.

610 {
611  LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
612 
613  if( !symbol )
614  return 0;
615 
616  if( !symbol->IsAlias() )
617  {
618  m_frame->ShowInfoBarError( _( "Symbol is not derived from another symbol." ) );
619  }
620  else
621  {
622  DIALOG_UPDATE_SYMBOL_FIELDS dlg( m_frame, symbol );
623 
624  if( dlg.ShowModal() == wxID_CANCEL )
625  return -1;
626  }
627 
628  return 0;
629 }
bool IsAlias() const
Definition: lib_symbol.h:172
Define a library symbol object.
Definition: lib_symbol.h:96
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
Dialog to update or change schematic library symbols.
#define _(s)

References _, SYMBOL_EDIT_FRAME::GetCurSymbol(), LIB_SYMBOL::IsAlias(), EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_frame, and EDA_BASE_FRAME::ShowInfoBarError().

Referenced by setTransitions().

◆ Wait()

TOOL_EVENT * TOOL_INTERACTIVE::Wait ( const TOOL_EVENT_LIST aEventList = TOOL_EVENTTC_ANYTA_ANY ))
inherited

Suspend execution of the tool until an event specified in aEventList arrives.

No parameters means waiting for any event.

Definition at line 57 of file tool_interactive.cpp.

58 {
59  return m_toolMgr->ScheduleWait( this, aEventList );
60 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
TOOL_EVENT * ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pause execution of a given tool until one or more events matching aConditions arrives.

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::ScheduleWait().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), ZOOM_TOOL::Main(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), CVPCB_CONTROL::Main(), PL_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_frame

SYMBOL_EDIT_FRAME * EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_frame
protectedinherited

Definition at line 177 of file ee_tool_base.h.

◆ m_isSymbolEditor

bool EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_isSymbolEditor
protectedinherited

Definition at line 180 of file ee_tool_base.h.

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

The functions below are not yet implemented - their interface may change.

Definition at line 125 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), ROUTER_TOOL::Init(), LENGTH_TUNER_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), PL_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_CONTROL::Init(), PCB_VIEWER_TOOLS::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PL_SELECTION_TOOL::Init(), SCH_DRAWING_TOOLS::Init(), BOARD_EDITOR_CONTROL::Init(), GERBVIEW_SELECTION_TOOL::Init(), EDA_3D_CONTROLLER::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), PCB_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), PCB_TOOL_BASE::Init(), PICKER_TOOL::Init(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_PICKER_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PL_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_pickerItem

EDA_ITEM* SYMBOL_EDITOR_EDIT_TOOL::m_pickerItem
private

Definition at line 75 of file symbol_editor_edit_tool.h.

Referenced by DeleteItemCursor().

◆ m_selectionTool

EE_SELECTION_TOOL* EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_selectionTool
protectedinherited

Definition at line 179 of file ee_tool_base.h.

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

Names are expected to obey the format application.ToolName (eg. pcbnew.InteractiveSelection).

Definition at line 209 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), TOOL_BASE::GetId(), and TOOL_BASE::IsToolActive().

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 214 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), PCB_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), SCH_MOVE_TOOL::AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), SCH_EDIT_TOOL::BreakWire(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_CONTROL::ClearAllLayers(), BOARD_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), PL_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), PL_EDIT_TOOL::Copy(), Copy(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), MICROWAVE_TOOL::createInductorBetween(), DRC_TOOL::CrossProbe(), BOARD_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), SCH_EDITOR_CONTROL::Cut(), DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), BOARD_INSPECTION_TOOL::doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::Drag(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), editShapeProperties(), editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), EE_INSPECTION_TOOL::ExcludeMarker(), PCB_SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), PCB_SELECTION_TOOL::filterSelection(), PCB_SELECTION_TOOL::FindItem(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getToolHolderInt(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), PCB_CONTROL::GridSetOrigin(), GROUP_TOOL::Group(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PL_EDIT_TOOL::ImportDrawingSheetContent(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), BOARD_REANNOTATE_TOOL::Init(), Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), GROUP_TOOL::Init(), PAD_TOOL::Init(), CONVERT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_CONTROL::Init(), GLOBAL_EDIT_TOOL::Init(), PL_POINT_EDITOR::Init(), BOARD_INSPECTION_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PCB_POINT_EDITOR::Init(), BOARD_EDITOR_CONTROL::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), GROUP_TOOL::LeaveGroup(), SCH_NAVIGATE_TOOL::LeaveSheet(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), CVPCB_CONTROL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), SYMBOL_EDITOR_CONTROL::OnDeMorgan(), PL_SELECTION_TOOL::onDisambiguationExpire(), EE_SELECTION_TOOL::onDisambiguationExpire(), PCB_SELECTION_TOOL::onDisambiguationExpire(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), PL_EDIT_TOOL::Paste(), Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), PinTable(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_CONTROL::Print(), GERBVIEW_CONTROL::Print(), Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::recombinePad(), Redo(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), GROUP_TOOL::RemoveFromGroup(), PL_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemFromSel(), PCB_SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), PCB_SELECTION_TOOL::RequestSelection(), PAD_TOOL::Reset(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), DRC_TOOL::RunTests(), EE_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), PCB_SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), GERBVIEW_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::selectPoint(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), EDA_3D_CONTROLLER::SetMaterial(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), EDA_3D_CONTROLLER::ToggleVisibility(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), Undo(), SCH_EDITOR_CONTROL::Undo(), GROUP_TOOL::Ungroup(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), PCB_SELECTION_TOOL::UnselectItems(), PNS::TOOL_BASE::updateEndItem(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCB_CONTROL::UpdateMessagePanel(), EDIT_TOOL::updateModificationPoint(), EE_POINT_EDITOR::updateParentItem(), BOARD_INSPECTION_TOOL::UpdateSelectionRatsnest(), PNS::TOOL_BASE::updateStartItem(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), BOARD_EDITOR_CONTROL::ZoneDuplicate(), and BOARD_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Definition at line 213 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Unique identifier for the tool, assigned by a TOOL_MANAGER instance.

Definition at line 206 of file tool_base.h.

Referenced by TOOL_BASE::GetType(), and BOARD_COMMIT::Push().

◆ m_view

KIGFX::SCH_VIEW* EE_TOOL_BASE< SYMBOL_EDIT_FRAME >::m_view
protectedinherited

Definition at line 178 of file ee_tool_base.h.


The documentation for this class was generated from the following files: