KiCad PCB EDA Suite
SCH_EDIT_TOOL Class Reference

#include <sch_edit_tool.h>

Inheritance diagram for SCH_EDIT_TOOL:
EE_TOOL_BASE< SCH_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

 SCH_EDIT_TOOL ()
 
 ~SCH_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 RepeatDrawItem (const TOOL_EVENT &aEvent)
 
int Properties (const TOOL_EVENT &aEvent)
 
int EditField (const TOOL_EVENT &aEvent)
 
int AutoplaceFields (const TOOL_EVENT &aEvent)
 
int ChangeSymbols (const TOOL_EVENT &aEvent)
 
int ConvertDeMorgan (const TOOL_EVENT &aEvent)
 
int EditPageNumber (const TOOL_EVENT &aEvent)
 
int ChangeTextType (const TOOL_EVENT &aEvent)
 Change a text type to another one. More...
 
int BreakWire (const TOOL_EVENT &aEvent)
 
int CleanupSheetPins (const TOOL_EVENT &aEvent)
 
int GlobalEdit (const TOOL_EVENT &aEvent)
 Delete the selected items, or the item under the cursor. More...
 
int DoDelete (const TOOL_EVENT &aEvent)
 Run the deletion tool. 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

SCH_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 editFieldText (SCH_FIELD *aField)
 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 36 of file sch_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

◆ SCH_EDIT_TOOL()

SCH_EDIT_TOOL::SCH_EDIT_TOOL ( )

Definition at line 133 of file sch_edit_tool.cpp.

133  :
134  EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveEdit" )
135 {
136  m_pickerItem = nullptr;
137 }
EDA_ITEM * m_pickerItem
Definition: sch_edit_tool.h:87

References m_pickerItem.

◆ ~SCH_EDIT_TOOL()

SCH_EDIT_TOOL::~SCH_EDIT_TOOL ( )
inlineoverride

Definition at line 40 of file sch_edit_tool.h.

40 { }

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(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), 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().

◆ AutoplaceFields()

int SCH_EDIT_TOOL::AutoplaceFields ( const TOOL_EVENT aEvent)

Definition at line 1201 of file sch_edit_tool.cpp.

1202 {
1204  SCH_ITEM* head = static_cast<SCH_ITEM*>( selection.Front() );
1205  bool moving = head && head->IsMoving();
1206 
1207  if( selection.Empty() )
1208  return 0;
1209 
1210  std::vector<SCH_ITEM*> autoplaceItems;
1211 
1212  for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
1213  {
1214  SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
1215 
1216  if( item->IsType( EE_COLLECTOR::FieldOwners ) )
1217  autoplaceItems.push_back( item );
1218  else if( item->GetParent() && item->GetParent()->IsType( EE_COLLECTOR::FieldOwners ) )
1219  autoplaceItems.push_back( static_cast<SCH_ITEM*>( item->GetParent() ) );
1220  }
1221 
1222  bool appendUndo = false;
1223 
1224  for( SCH_ITEM* sch_item : autoplaceItems )
1225  {
1226  if( !moving && !sch_item->IsNew() )
1227  {
1228  saveCopyInUndoList( sch_item, UNDO_REDO::CHANGED, appendUndo );
1229  appendUndo = true;
1230  }
1231 
1232  sch_item->AutoplaceFields( m_frame->GetScreen(), /* aManual */ true );
1233 
1234  updateItem( sch_item, true );
1235  }
1236 
1238 
1239  if( moving )
1240  {
1242  }
1243  else
1244  {
1245  if( selection.IsHover() )
1247 
1248  m_frame->OnModify();
1249  }
1250 
1251  return 0;
1252 }
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
static const KICAD_T FieldOwners[]
Definition: ee_collectors.h:48
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
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...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:134
EDA_ITEM * GetParent() const
Definition: eda_item.h:114
const KICAD_T rotatableItems[]
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
virtual bool IsType(const KICAD_T aScanTypes[]) const
Check whether the item is one of the listed types.
Definition: eda_item.h:182
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:98
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 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 OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:182
static TOOL_ACTION refreshPreview
Definition: actions.h:106
EDA_ITEM * Front() const
Definition: selection.h:145

References CHANGED, EE_ACTIONS::clearSelection, SELECTION::Empty(), EE_COLLECTOR::FieldOwners, SELECTION::Front(), SELECTION::GetItem(), EDA_ITEM::GetParent(), SCH_EDIT_FRAME::GetScreen(), SELECTION::GetSize(), SELECTION::IsHover(), EDA_ITEM::IsMoving(), EDA_ITEM::IsType(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, SCH_EDIT_FRAME::OnModify(), TOOL_MANAGER::PostEvent(), ACTIONS::refreshPreview, EE_SELECTION_TOOL::RequestSelection(), rotatableItems, TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList(), EVENTS::SelectedItemsModified, and EE_TOOL_BASE< SCH_EDIT_FRAME >::updateItem().

Referenced by setTransitions().

◆ BreakWire()

int SCH_EDIT_TOOL::BreakWire ( const TOOL_EVENT aEvent)

Definition at line 1688 of file sch_edit_tool.cpp.

1689 {
1690  wxPoint cursorPos = (wxPoint) getViewControls()->GetCursorPosition( !aEvent.DisableGridSnapping() );
1692 
1693  std::vector<SCH_LINE*> lines;
1694 
1695  for( EDA_ITEM* item : selection )
1696  {
1697  if( SCH_LINE* line = dyn_cast<SCH_LINE*>( item ) )
1698  {
1699  if( !line->IsEndPoint( cursorPos ) )
1700  lines.push_back( line );
1701  }
1702  }
1703 
1705  m_frame->StartNewUndo();
1706 
1707  for( SCH_LINE* line : lines )
1708  m_frame->BreakSegment( line, cursorPos );
1709 
1710  if( !lines.empty() )
1711  {
1712  if( m_frame->GetScreen()->IsExplicitJunctionNeeded( cursorPos ) )
1713  m_frame->AddJunction( m_frame->GetScreen(), cursorPos, true, false );
1714 
1716 
1717  m_frame->OnModify();
1718  m_frame->GetCanvas()->Refresh();
1719 
1720  SCH_MOVE_TOOL_PARAMS params;
1721 
1722  params.appendToLastUndo = true;
1723  params.placingNewItems = false;
1724 
1725  m_toolMgr->RunAction( EE_ACTIONS::drag, true, &params );
1726  }
1727 
1728  return 0;
1729 }
void StartNewUndo()
Create a new, blank stack for future Undo commands to be pushed to.
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
SCH_JUNCTION * AddJunction(SCH_SCREEN *aScreen, const wxPoint &aPos, bool aAppendToUndo, bool aFinal=true)
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...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
bool DisableGridSnapping() const
Definition: tool_event.h:341
bool IsExplicitJunctionNeeded(const wxPoint &aPosition) const
Indicates that a junction dot is necessary at the given location, and does not yet exist.
Definition: sch_screen.cpp:423
bool BreakSegment(SCH_LINE *aSegment, const wxPoint &aPoint, SCH_LINE **aNewSegment=nullptr, SCH_SCREEN *aScreen=nullptr)
Break a single segment into two at the specified point.
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
int ClearSelection(const TOOL_EVENT &aEvent)
Select all visible items in sheet.
static TOOL_ACTION drag
Definition: ee_actions.h:115
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...
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
static const KICAD_T WiresOnly[]
Definition: ee_collectors.h:47

References SCH_EDIT_FRAME::AddJunction(), SCH_MOVE_TOOL_PARAMS::appendToLastUndo, SCH_EDIT_FRAME::BreakSegment(), EE_SELECTION_TOOL::ClearSelection(), TOOL_EVENT::DisableGridSnapping(), EE_ACTIONS::drag, SCH_BASE_FRAME::GetCanvas(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), SCH_EDIT_FRAME::GetScreen(), TOOL_BASE::getViewControls(), SCH_SCREEN::IsExplicitJunctionNeeded(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, SCH_EDIT_FRAME::OnModify(), SCH_MOVE_TOOL_PARAMS::placingNewItems, EDA_DRAW_PANEL_GAL::Refresh(), EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), SCH_EDIT_FRAME::StartNewUndo(), SCH_EDIT_FRAME::TestDanglingEnds(), and EE_COLLECTOR::WiresOnly.

Referenced by setTransitions().

◆ ChangeSymbols()

int SCH_EDIT_TOOL::ChangeSymbols ( const TOOL_EVENT aEvent)

Definition at line 1255 of file sch_edit_tool.cpp.

1256 {
1257  SCH_SYMBOL* selectedSymbol = nullptr;
1259 
1260  if( !selection.Empty() )
1261  selectedSymbol = dynamic_cast<SCH_SYMBOL*>( selection.Front() );
1262 
1264 
1265  if( aEvent.IsAction( &EE_ACTIONS::changeSymbol )
1266  || aEvent.IsAction( &EE_ACTIONS::changeSymbols ) )
1267  {
1269  }
1270 
1271  DIALOG_CHANGE_SYMBOLS dlg( m_frame, selectedSymbol, mode );
1272 
1273  dlg.ShowQuasiModal();
1274 
1275  return 0;
1276 }
static TOOL_ACTION changeSymbol
Definition: ee_actions.h:149
Dialog to update or change schematic library symbols.
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...
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:98
Schematic symbol object.
Definition: sch_symbol.h:78
static TOOL_ACTION changeSymbols
Definition: ee_actions.h:147
static const KICAD_T SymbolsOnly[]
Definition: ee_collectors.h:45
EDA_ITEM * Front() const
Definition: selection.h:145

References DIALOG_CHANGE_SYMBOLS::CHANGE, EE_ACTIONS::changeSymbol, EE_ACTIONS::changeSymbols, SELECTION::Empty(), SELECTION::Front(), TOOL_EVENT::IsAction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, EE_SELECTION_TOOL::RequestSelection(), DIALOG_SHIM::ShowQuasiModal(), EE_COLLECTOR::SymbolsOnly, and DIALOG_CHANGE_SYMBOLS::UPDATE.

Referenced by setTransitions().

◆ ChangeTextType()

int SCH_EDIT_TOOL::ChangeTextType ( const TOOL_EVENT aEvent)

Change a text type to another one.

The new text, label, hierarchical label, or global label is created from the old text and the old text object is deleted.

A tricky case is when the 'old" text is being edited (i.e. moving) because we must create a new text, and prepare the undo/redo command data for this change and the current move/edit command

Definition at line 1585 of file sch_edit_tool.cpp.

1586 {
1587  KICAD_T convertTo = aEvent.Parameter<KICAD_T>();
1589  EE_SELECTION selection = m_selectionTool->RequestSelection( allTextTypes );
1590 
1591  for( unsigned int i = 0; i < selection.GetSize(); ++i )
1592  {
1593  SCH_TEXT* text = dynamic_cast<SCH_TEXT*>( selection.GetItem( i ) );
1594 
1595  if( text && text->Type() != convertTo )
1596  {
1597  bool selected = text->IsSelected();
1598  SCH_TEXT* newtext = nullptr;
1599  const wxPoint& position = text->GetPosition();
1600  LABEL_SPIN_STYLE orientation = text->GetLabelSpinStyle();
1601  wxString txt = UnescapeString( text->GetText() );
1602 
1603  // There can be characters in a SCH_TEXT object that can break labels so we have to
1604  // fix them here.
1605  if( text->Type() == SCH_TEXT_T )
1606  {
1607  txt.Replace( wxT( "\n" ), wxT( "_" ) );
1608  txt.Replace( wxT( "\r" ), wxT( "_" ) );
1609  txt.Replace( wxT( "\t" ), wxT( "_" ) );
1610  txt.Replace( wxT( " " ), wxT( "_" ) );
1611  }
1612 
1613  // label strings are "escaped" i.e. a '/' is replaced by "{slash}"
1614  if( convertTo != SCH_TEXT_T )
1615  txt = EscapeString( txt, CTX_NETNAME );
1616 
1617  switch( convertTo )
1618  {
1619  case SCH_LABEL_T: newtext = new SCH_LABEL( position, txt ); break;
1620  case SCH_GLOBAL_LABEL_T: newtext = new SCH_GLOBALLABEL( position, txt ); break;
1621  case SCH_HIER_LABEL_T: newtext = new SCH_HIERLABEL( position, txt ); break;
1622  case SCH_TEXT_T: newtext = new SCH_TEXT( position, txt ); break;
1623 
1624  default:
1625  wxFAIL_MSG( wxString::Format( wxT( "Invalid text type: %d." ), convertTo ) );
1626  return 0;
1627  }
1628 
1629  // Copy the old text item settings to the new one. Justifications are not copied
1630  // because they are not used in labels. Justifications will be set to default value
1631  // in the new text item type.
1632  //
1633  newtext->SetFlags( text->GetEditFlags() );
1634  newtext->SetShape( text->GetShape() );
1635  newtext->SetLabelSpinStyle( orientation );
1636  newtext->SetTextSize( text->GetTextSize() );
1637  newtext->SetTextThickness( text->GetTextThickness() );
1638  newtext->SetItalic( text->IsItalic() );
1639  newtext->SetBold( text->IsBold() );
1640  newtext->SetIsDangling( text->IsDangling() );
1641 
1642  if( selected )
1644 
1645  if( !text->IsNew() )
1646  {
1648  saveCopyInUndoList( newtext, UNDO_REDO::NEWITEM, true );
1649 
1651  m_frame->AddToScreen( newtext, m_frame->GetScreen() );
1652 
1653  if( convertTo == SCH_GLOBAL_LABEL_T )
1654  static_cast<SCH_GLOBALLABEL*>( newtext )->UpdateIntersheetRefProps();
1655  }
1656 
1657  if( selected )
1658  m_toolMgr->RunAction( EE_ACTIONS::addItemToSel, true, newtext );
1659 
1660  // Otherwise, pointer is owned by the undo stack
1661  if( text->IsNew() )
1662  delete text;
1663 
1664  if( convertTo == SCH_TEXT_T )
1665  {
1666  if( newtext->IsDangling() )
1667  {
1668  newtext->SetIsDangling( false );
1669  getView()->Update( newtext, KIGFX::REPAINT );
1670  }
1671  }
1672  else
1673  {
1675  }
1676 
1677  m_frame->OnModify();
1678  }
1679  }
1680 
1681  if( selection.IsHover() )
1683 
1684  return 0;
1685 }
bool IsDangling() const override
Definition: sch_text.h:230
void SetShape(PINSHEETLABEL_SHAPE aShape)
Definition: sch_text.h:163
bool IsHover() const
Definition: selection.h:74
void SetItalic(bool isItalic)
Definition: eda_text.h:200
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
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
void RemoveFromScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen)
Remove an item from the screen (and view) aScreen is the screen the item is located on,...
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:258
void SetIsDangling(bool aIsDangling)
Definition: sch_text.h:231
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
static TOOL_ACTION removeItemFromSel
Definition: ee_actions.h:60
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...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
Item needs to be redrawn.
Definition: view_item.h:52
static TOOL_ACTION addItemToSel
Selects an item (specified as the event parameter).
Definition: ee_actions.h:59
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:134
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
wxString UnescapeString(const wxString &aSource)
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:88
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen)
Add an item to the screen (and view) aScreen is the screen the item is located on,...
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.cpp:53
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.h:180
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
virtual void SetLabelSpinStyle(LABEL_SPIN_STYLE aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition: sch_text.cpp:330
void SetBold(bool aBold)
Definition: eda_text.h:203
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1570

References EE_ACTIONS::addItemToSel, SCH_BASE_FRAME::AddToScreen(), EE_ACTIONS::clearSelection, CTX_NETNAME, DELETED, EOT, EscapeString(), Format(), SELECTION::GetItem(), SCH_EDIT_FRAME::GetScreen(), SELECTION::GetSize(), TOOL_BASE::getView(), SCH_TEXT::IsDangling(), SELECTION::IsHover(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, NEWITEM, SCH_EDIT_FRAME::OnModify(), TOOL_EVENT::Parameter(), SCH_BASE_FRAME::RemoveFromScreen(), EE_ACTIONS::removeItemFromSel, KIGFX::REPAINT, EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList(), SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_TEXT_T, EDA_TEXT::SetBold(), EDA_ITEM::SetFlags(), SCH_TEXT::SetIsDangling(), EDA_TEXT::SetItalic(), SCH_TEXT::SetLabelSpinStyle(), SCH_TEXT::SetShape(), EDA_TEXT::SetTextSize(), EDA_TEXT::SetTextThickness(), SCH_EDIT_FRAME::TestDanglingEnds(), text, UnescapeString(), and KIGFX::VIEW::Update().

Referenced by setTransitions().

◆ CleanupSheetPins()

int SCH_EDIT_TOOL::CleanupSheetPins ( const TOOL_EVENT aEvent)

Definition at line 1732 of file sch_edit_tool.cpp.

1733 {
1735  SCH_SHEET* sheet = (SCH_SHEET*) selection.Front();
1736 
1737  if( !sheet || !sheet->HasUndefinedPins() )
1738  return 0;
1739 
1740  if( !IsOK( m_frame, _( "Do you wish to delete the unreferenced pins from this sheet?" ) ) )
1741  return 0;
1742 
1744 
1745  sheet->CleanupSheet();
1746 
1747  updateItem( sheet, true );
1748  m_frame->OnModify();
1749 
1750  if( selection.IsHover() )
1752 
1753  return 0;
1754 }
bool IsHover() const
Definition: selection.h:74
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
bool HasUndefinedPins() const
Check all sheet labels against schematic for undefined hierarchical labels.
Definition: sch_sheet.cpp:415
static const KICAD_T SheetsOnly[]
Definition: ee_collectors.h:46
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 saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:134
#define _(s)
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
void CleanupSheet()
Delete sheet label which do not have a corresponding hierarchical label.
Definition: sch_sheet.cpp:529
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
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:323
EDA_ITEM * Front() const
Definition: selection.h:145

References _, CHANGED, SCH_SHEET::CleanupSheet(), EE_ACTIONS::clearSelection, SELECTION::Front(), SCH_SHEET::HasUndefinedPins(), SELECTION::IsHover(), IsOK(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, SCH_EDIT_FRAME::OnModify(), EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList(), EE_COLLECTOR::SheetsOnly, and EE_TOOL_BASE< SCH_EDIT_FRAME >::updateItem().

Referenced by setTransitions().

◆ ConvertDeMorgan()

int SCH_EDIT_TOOL::ConvertDeMorgan ( const TOOL_EVENT aEvent)

Definition at line 1279 of file sch_edit_tool.cpp.

1280 {
1282 
1283  if( selection.Empty() )
1284  return 0;
1285 
1286  SCH_SYMBOL* symbol = (SCH_SYMBOL*) selection.Front();
1287 
1289  && symbol->GetConvert() == LIB_ITEM::LIB_CONVERT::BASE )
1290  {
1291  return 0;
1292  }
1293 
1295  && symbol->GetConvert() != LIB_ITEM::LIB_CONVERT::DEMORGAN )
1296  {
1297  return 0;
1298  }
1299 
1300  if( !symbol->IsNew() )
1302 
1303  m_frame->ConvertPart( symbol );
1304 
1305  if( symbol->IsNew() )
1307 
1308  if( selection.IsHover() )
1310 
1311  return 0;
1312 }
bool IsHover() const
Definition: selection.h:74
void ConvertPart(SCH_SYMBOL *aSymbol)
Definition: picksymbol.cpp:250
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
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:128
bool IsNew() const
Definition: eda_item.h:118
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...
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:134
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static TOOL_ACTION showDeMorganStandard
Definition: ee_actions.h:127
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:98
Schematic symbol object.
Definition: sch_symbol.h:78
static const KICAD_T SymbolsOnly[]
Definition: ee_collectors.h:45
int GetConvert() const
Definition: sch_symbol.h:224
static TOOL_ACTION refreshPreview
Definition: actions.h:106
EDA_ITEM * Front() const
Definition: selection.h:145

References CHANGED, EE_ACTIONS::clearSelection, SCH_EDIT_FRAME::ConvertPart(), SELECTION::Empty(), SELECTION::Front(), SCH_SYMBOL::GetConvert(), TOOL_EVENT::IsAction(), SELECTION::IsHover(), EDA_ITEM::IsNew(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, ACTIONS::refreshPreview, EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList(), EE_ACTIONS::showDeMorganAlternate, EE_ACTIONS::showDeMorganStandard, and EE_COLLECTOR::SymbolsOnly.

Referenced by setTransitions().

◆ DeleteItemCursor()

int SCH_EDIT_TOOL::DeleteItemCursor ( const TOOL_EVENT aEvent)

Definition at line 1044 of file sch_edit_tool.cpp.

1045 {
1046  std::string tool = aEvent.GetCommandStr().get();
1047  PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
1048 
1050  m_pickerItem = nullptr;
1051 
1052  // Deactivate other tools; particularly important if another PICKER is currently running
1053  Activate();
1054 
1055  picker->SetCursor( KICURSOR::REMOVE );
1056  picker->SetSnapping( false );
1057 
1058  picker->SetClickHandler(
1059  [this]( const VECTOR2D& aPosition ) -> bool
1060  {
1061  if( m_pickerItem )
1062  {
1064  selectionTool->UnbrightenItem( m_pickerItem );
1065  selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
1067  m_pickerItem = nullptr;
1068  }
1069 
1070  return true;
1071  } );
1072 
1073  picker->SetMotionHandler(
1074  [this]( const VECTOR2D& aPos )
1075  {
1076  EE_COLLECTOR collector;
1077  collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
1078  collector.Collect( m_frame->GetScreen(), deletableItems, (wxPoint) aPos );
1079 
1081  selectionTool->GuessSelectionCandidates( collector, aPos );
1082 
1083  EDA_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr;
1084 
1085  if( m_pickerItem != item )
1086  {
1087  if( m_pickerItem )
1088  selectionTool->UnbrightenItem( m_pickerItem );
1089 
1090  m_pickerItem = item;
1091 
1092  if( m_pickerItem )
1093  selectionTool->BrightenItem( m_pickerItem );
1094  }
1095  } );
1096 
1097  picker->SetFinalizeHandler(
1098  [this]( const int& aFinalState )
1099  {
1100  if( m_pickerItem )
1102 
1103  // Wake the selection tool after exiting to ensure the cursor gets updated
1105  } );
1106 
1107  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
1108 
1109  return 0;
1110 }
#define HITTEST_THRESHOLD_PIXELS
int m_Threshold
Definition: collector.h:241
static TOOL_ACTION doDelete
Definition: actions.h:72
void Collect(SCH_SCREEN *aScreen, const KICAD_T aFilterList[], const wxPoint &aPos, int aUnit=0, int aConvert=0)
Scan a EDA_ITEM using this class's Inspector method which does the collection.
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
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
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:82
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
void UnbrightenItem(EDA_ITEM *aItem)
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
void SetCursor(KICURSOR aCursor)
Definition: picker_tool.h:62
EDA_ITEM * m_pickerItem
Definition: sch_edit_tool.h:87
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
static KICAD_T deletableItems[]
int AddItemToSel(const TOOL_EVENT &aEvent)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73
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.
void SetSnapping(bool aSnap)
Definition: picker_tool.h:64

References TOOL_INTERACTIVE::Activate(), EE_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::BrightenItem(), EE_ACTIONS::clearSelection, EE_COLLECTOR::Collect(), deletableItems, ACTIONS::doDelete, TOOL_EVENT::GetCommandStr(), COLLECTOR::GetCount(), SCH_EDIT_FRAME::GetScreen(), TOOL_MANAGER::GetTool(), TOOL_BASE::getView(), EE_SELECTION_TOOL::GuessSelectionCandidates(), HITTEST_THRESHOLD_PIXELS, KiROUND(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_pickerItem, COLLECTOR::m_Threshold, TOOL_BASE::m_toolMgr, ACTIONS::pickerTool, REMOVE, TOOL_MANAGER::RunAction(), EE_ACTIONS::selectionActivate, PICKER_TOOL_BASE::SetClickHandler(), PICKER_TOOL_BASE::SetCursor(), PICKER_TOOL_BASE::SetFinalizeHandler(), PICKER_TOOL_BASE::SetMotionHandler(), PICKER_TOOL_BASE::SetSnapping(), and EE_SELECTION_TOOL::UnbrightenItem().

Referenced by setTransitions().

◆ DoDelete()

int SCH_EDIT_TOOL::DoDelete ( const TOOL_EVENT aEvent)

Run the deletion tool.

Definition at line 956 of file sch_edit_tool.cpp.

957 {
958  SCH_SCREEN* screen = m_frame->GetScreen();
960  bool appendToUndo = false;
961  std::vector<wxPoint> pts;
962 
963  if( items.empty() )
964  return 0;
965 
966  // Don't leave a freed pointer in the selection
968 
969  for( EDA_ITEM* item : items )
970  item->ClearFlags( STRUCT_DELETED );
971 
972  for( EDA_ITEM* item : items )
973  {
974  SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item );
975 
976  if( !sch_item )
977  continue;
978 
979  if( sch_item->IsConnectable() )
980  {
981  std::vector<wxPoint> tmp_pts = sch_item->GetConnectionPoints();
982  pts.insert( pts.end(), tmp_pts.begin(), tmp_pts.end() );
983  }
984 
985  if( sch_item->Type() == SCH_JUNCTION_T )
986  {
987  sch_item->SetFlags( STRUCT_DELETED );
988  // clean up junctions at the end
989  }
990  else if( sch_item->Type() == SCH_SHEET_PIN_T )
991  {
992  SCH_SHEET_PIN* pin = (SCH_SHEET_PIN*) sch_item;
993  SCH_SHEET* sheet = pin->GetParent();
994 
995  if( !alg::contains( items, sheet ) )
996  {
997  pin->SetFlags( STRUCT_DELETED );
998  saveCopyInUndoList( item, UNDO_REDO::DELETED, appendToUndo );
999  appendToUndo = true;
1000 
1001  updateItem( pin, false );
1002 
1003  sheet->RemovePin( pin );
1004  }
1005  }
1006  else
1007  {
1008  sch_item->SetFlags( STRUCT_DELETED );
1009  saveCopyInUndoList( item, UNDO_REDO::DELETED, appendToUndo );
1010  appendToUndo = true;
1011 
1012  updateItem( sch_item, false );
1013 
1014  m_frame->RemoveFromScreen( sch_item, m_frame->GetScreen() );
1015 
1016  if( sch_item->Type() == SCH_SHEET_T )
1018  }
1019  }
1020 
1021  for( const wxPoint& point : pts )
1022  {
1023  SCH_ITEM* junction = screen->GetItem( point, 0, SCH_JUNCTION_T );
1024 
1025  if( !junction )
1026  continue;
1027 
1028  if( junction->HasFlag( STRUCT_DELETED ) || !screen->IsExplicitJunction( point ) )
1029  m_frame->DeleteJunction( junction, appendToUndo );
1030  }
1031 
1033 
1034  m_frame->GetCanvas()->Refresh();
1035  m_frame->OnModify();
1036 
1037  return 0;
1038 }
bool IsExplicitJunction(const wxPoint &aPosition) const
Indicates that a junction dot is necessary at the given location.
Definition: sch_screen.cpp:413
virtual bool IsConnectable() const
Definition: sch_item.h:349
virtual std::vector< wxPoint > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Definition: sch_item.h:364
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
Definition: eda_item.h:155
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
void RemoveFromScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen)
Remove an item from the screen (and view) aScreen is the screen the item is located on,...
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...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:134
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
SCH_ITEM * GetItem(const wxPoint &aPosition, int aAccuracy=0, KICAD_T aType=SCH_LOCATE_ANY_T) const
Check aPosition within a distance of aAccuracy for items of type aFilter.
Definition: sch_screen.cpp:342
const std::deque< EDA_ITEM * > GetItems() const
Definition: selection.h:109
void UpdateHierarchyNavigator(bool aForceUpdate=false)
Run the Hierarchy Navigator dialog.
#define STRUCT_DELETED
flag indication structures to be erased
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:65
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:99
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
void RemovePin(const SCH_SHEET_PIN *aSheetPin)
Remove aSheetPin from the sheet.
Definition: sch_sheet.cpp:353
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
static KICAD_T deletableItems[]
void DeleteJunction(SCH_ITEM *aItem, bool aAppend=false)
Removes a given junction and heals any wire segments under the junction.
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...
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:182
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

References EE_ACTIONS::clearSelection, alg::contains(), deletableItems, DELETED, SCH_EDIT_FRAME::DeleteJunction(), SCH_BASE_FRAME::GetCanvas(), SCH_ITEM::GetConnectionPoints(), SCH_SCREEN::GetItem(), SELECTION::GetItems(), SCH_EDIT_FRAME::GetScreen(), EDA_ITEM::HasFlag(), SCH_ITEM::IsConnectable(), SCH_SCREEN::IsExplicitJunction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, SCH_EDIT_FRAME::OnModify(), pin, EDA_DRAW_PANEL_GAL::Refresh(), SCH_BASE_FRAME::RemoveFromScreen(), SCH_SHEET::RemovePin(), EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList(), SCH_JUNCTION_T, SCH_SHEET_PIN_T, SCH_SHEET_T, EDA_ITEM::SetFlags(), STRUCT_DELETED, SCH_EDIT_FRAME::TestDanglingEnds(), EDA_ITEM::Type(), SCH_EDIT_FRAME::UpdateHierarchyNavigator(), and EE_TOOL_BASE< SCH_EDIT_FRAME >::updateItem().

Referenced by setTransitions().

◆ EditField()

int SCH_EDIT_TOOL::EditField ( const TOOL_EVENT aEvent)

Definition at line 1149 of file sch_edit_tool.cpp.

1150 {
1151  static KICAD_T Nothing[] = { EOT };
1152  static KICAD_T CmpOrReference[] = { SCH_FIELD_LOCATE_REFERENCE_T, SCH_SYMBOL_T, EOT };
1153  static KICAD_T CmpOrValue[] = { SCH_FIELD_LOCATE_VALUE_T, SCH_SYMBOL_T, EOT };
1154  static KICAD_T CmpOrFootprint[] = { SCH_FIELD_LOCATE_FOOTPRINT_T, SCH_SYMBOL_T, EOT };
1155 
1156  KICAD_T* filter = Nothing;
1157 
1158  if( aEvent.IsAction( &EE_ACTIONS::editReference ) )
1159  filter = CmpOrReference;
1160  else if( aEvent.IsAction( &EE_ACTIONS::editValue ) )
1161  filter = CmpOrValue;
1162  else if( aEvent.IsAction( &EE_ACTIONS::editFootprint ) )
1163  filter = CmpOrFootprint;
1164 
1166 
1167  if( selection.Size() != 1 )
1168  return 0;
1169 
1170  bool clearSelection = selection.IsHover();
1171  EDA_ITEM* item = selection.Front();
1172 
1173  if( item->Type() == SCH_SYMBOL_T )
1174  {
1175  SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
1176 
1177  if( aEvent.IsAction( &EE_ACTIONS::editReference ) )
1178  editFieldText( symbol->GetField( REFERENCE_FIELD ) );
1179  else if( aEvent.IsAction( &EE_ACTIONS::editValue ) )
1180  editFieldText( symbol->GetField( VALUE_FIELD ) );
1181  else if( aEvent.IsAction( &EE_ACTIONS::editFootprint ) )
1182  editFieldText( symbol->GetField( FOOTPRINT_FIELD ) );
1183  }
1184  else if( item->Type() == SCH_FIELD_T )
1185  {
1186  SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
1187 
1188  editFieldText( field );
1189 
1190  if( !field->IsVisible() )
1191  clearSelection = true;
1192  }
1193 
1194  if( clearSelection )
1196 
1197  return 0;
1198 }
Field Reference of part, i.e. "IC21".
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:49
bool IsHover() const
Definition: selection.h:74
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
Definition: sch_symbol.cpp:705
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
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
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...
void editFieldText(SCH_FIELD *aField)
Set up handlers for various events.
static TOOL_ACTION editFootprint
Definition: ee_actions.h:124
Field Value of part, i.e. "3.3K".
virtual bool IsVisible() const
Definition: eda_text.h:207
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static TOOL_ACTION editValue
Definition: ee_actions.h:123
Schematic symbol object.
Definition: sch_symbol.h:78
int Size() const
Returns the number of selected parts.
Definition: selection.h:104
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
static TOOL_ACTION editReference
Definition: ee_actions.h:122
EDA_ITEM * Front() const
Definition: selection.h:145
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
Field Name Module PCB, i.e. "16DIP300".

References EE_ACTIONS::clearSelection, editFieldText(), EE_ACTIONS::editFootprint, EE_ACTIONS::editReference, EE_ACTIONS::editValue, EOT, filter, FOOTPRINT_FIELD, SELECTION::Front(), SCH_SYMBOL::GetField(), TOOL_EVENT::IsAction(), SELECTION::IsHover(), EDA_TEXT::IsVisible(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, REFERENCE_FIELD, EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), SCH_FIELD_LOCATE_FOOTPRINT_T, SCH_FIELD_LOCATE_REFERENCE_T, SCH_FIELD_LOCATE_VALUE_T, SCH_FIELD_T, SCH_SYMBOL_T, SELECTION::Size(), EDA_ITEM::Type(), and VALUE_FIELD.

Referenced by setTransitions().

◆ editFieldText()

void SCH_EDIT_TOOL::editFieldText ( SCH_FIELD aField)
private

Set up handlers for various events.

Definition at line 1113 of file sch_edit_tool.cpp.

1114 {
1115  // Save old symbol in undo list if not already in edit, or moving.
1116  if( aField->GetEditFlags() == 0 ) // i.e. not edited, or moved
1118 
1119  KICAD_T parentType = aField->GetParent() ? aField->GetParent()->Type() : SCHEMATIC_T;
1120  wxString caption;
1121 
1122  // Use title caps for mandatory fields. "Edit Sheet name Field" looks dorky.
1123  if( parentType == SCH_SYMBOL_T && aField->GetId() < MANDATORY_FIELDS )
1124  caption.Printf( _( "Edit %s Field" ), TitleCaps( aField->GetName() ) );
1125  else if( parentType == SCH_SHEET_T && aField->GetId() < SHEET_MANDATORY_FIELDS )
1126  caption.Printf( _( "Edit %s Field" ), TitleCaps( aField->GetName() ) );
1127  else
1128  caption.Printf( _( "Edit '%s' Field" ), aField->GetName() );
1129 
1130  DIALOG_SCH_FIELD_PROPERTIES dlg( m_frame, caption, aField );
1131 
1132  // The footprint field dialog can invoke a KIWAY_PLAYER so we must use a quasi-modal
1133  if( dlg.ShowQuasiModal() != wxID_OK )
1134  return;
1135 
1136  dlg.UpdateField( aField, &m_frame->GetCurrentSheet() );
1137 
1138  if( m_frame->eeconfig()->m_AutoplaceFields.enable || parentType == SCH_SHEET_T )
1139  static_cast<SCH_ITEM*>( aField->GetParent() )->AutoAutoplaceFields( m_frame->GetScreen() );
1140 
1141  m_frame->UpdateItem( aField, false, true );
1142  m_frame->OnModify();
1143 
1144  // This must go after OnModify() so that the connectivity graph will have been updated.
1146 }
The first 2 are mandatory, and must be instantiated in SCH_SHEET.
Definition: sch_sheet.h:47
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
int GetId() const
Definition: sch_field.h:113
Handle editing a single symbol field in the schematic editor.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
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
EESCHEMA_SETTINGS * eeconfig() const
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
AUTOPLACE_FIELDS m_AutoplaceFields
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.
EDA_ITEM * GetParent() const
Definition: eda_item.h:114
#define _(s)
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false)
Mark an item for refresh.
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:157
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
wxString GetName(bool aUseDefaultName=true) const
Return the field name.
Definition: sch_field.cpp:678
SCH_SHEET_PATH & GetCurrentSheet() const
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

References _, CHANGED, SCH_BASE_FRAME::eeconfig(), EESCHEMA_SETTINGS::AUTOPLACE_FIELDS::enable, SCH_EDIT_FRAME::GetCurrentSheet(), EDA_ITEM::GetEditFlags(), SCH_FIELD::GetId(), SCH_FIELD::GetName(), EDA_ITEM::GetParent(), SCH_EDIT_FRAME::GetScreen(), EESCHEMA_SETTINGS::m_AutoplaceFields, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, MANDATORY_FIELDS, SCH_EDIT_FRAME::OnModify(), TOOL_MANAGER::PostEvent(), EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList(), SCH_SHEET_T, SCH_SYMBOL_T, SCHEMATIC_T, EVENTS::SelectedItemsModified, SHEET_MANDATORY_FIELDS, DIALOG_SHIM::ShowQuasiModal(), TitleCaps(), EDA_ITEM::Type(), DIALOG_SCH_FIELD_PROPERTIES::UpdateField(), and SCH_BASE_FRAME::UpdateItem().

Referenced by EditField(), and Properties().

◆ EditPageNumber()

int SCH_EDIT_TOOL::EditPageNumber ( const TOOL_EVENT aEvent)

Definition at line 1757 of file sch_edit_tool.cpp.

1758 {
1760 
1761  if( selection.GetSize() > 1 )
1762  return 0;
1763 
1764  SCH_SHEET* sheet = (SCH_SHEET*) selection.Front();
1765 
1766  SCH_SHEET_PATH instance = m_frame->GetCurrentSheet();
1767 
1768  SCH_SCREEN* screen;
1769 
1770  if( sheet )
1771  {
1772  // When changing the page number of a selected sheet, the current screen owns the sheet.
1773  screen = m_frame->GetScreen();
1774 
1775  instance.push_back( sheet );
1776  }
1777  else
1778  {
1779  SCH_SHEET_PATH prevInstance = instance;
1780 
1781  // When change the page number in the screen, the previous screen owns the sheet.
1782  if( prevInstance.size() )
1783  {
1784  prevInstance.pop_back();
1785  screen = prevInstance.LastScreen();
1786  }
1787  else
1788  {
1789  // The root sheet and root screen are effectively the same thing.
1790  screen = m_frame->GetScreen();
1791  }
1792 
1793  sheet = m_frame->GetCurrentSheet().Last();
1794  }
1795 
1796  wxString msg;
1797  wxString sheetPath = instance.PathHumanReadable( false );
1798  wxString pageNumber = instance.GetPageNumber();
1799 
1800  msg.Printf( _( "Enter page number for sheet path%s" ),
1801  ( sheetPath.Length() > 20 ) ? wxT( "\n" ) + sheetPath : wxT( " " ) + sheetPath );
1802 
1803  wxTextEntryDialog dlg( m_frame, msg, _( "Edit Sheet Page Number" ), pageNumber );
1804 
1805  dlg.SetTextValidator( wxFILTER_ALPHANUMERIC ); // No white space.
1806 
1807  if( dlg.ShowModal() == wxID_CANCEL || dlg.GetValue() == instance.GetPageNumber() )
1808  return 0;
1809 
1810  m_frame->SaveCopyInUndoList( screen, sheet, UNDO_REDO::CHANGED, false );
1811 
1812  instance.SetPageNumber( dlg.GetValue() );
1813 
1814  if( instance == m_frame->GetCurrentSheet() )
1815  {
1816  m_frame->GetScreen()->SetPageNumber( dlg.GetValue() );
1818  }
1819 
1820  m_frame->OnModify();
1821 
1822  return 0;
1823 }
void SetPageNumber(const wxString &aPageNumber)
Set the sheet instance user definable page number.
void SetPageNumber(const wxString &aPageNumber)
Definition: base_screen.h:79
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
wxString PathHumanReadable(bool aUseShortRootName=true) const
Return the sheet path in a human readable form made from the sheet names.
void OnPageSettingsChange() override
Called when modifying the page settings.
static const KICAD_T SheetsOnly[]
Definition: ee_collectors.h:46
void pop_back()
Forwarded method from std::vector.
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...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
size_t size() const
Forwarded method from std::vector.
wxString GetPageNumber() const
#define _(s)
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:88
SCH_SCREEN * LastScreen()
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.
SCH_SHEET_PATH & GetCurrentSheet() const
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
EDA_ITEM * Front() const
Definition: selection.h:145

References _, CHANGED, SELECTION::Front(), SCH_EDIT_FRAME::GetCurrentSheet(), SCH_SHEET_PATH::GetPageNumber(), SCH_EDIT_FRAME::GetScreen(), SELECTION::GetSize(), SCH_SHEET_PATH::Last(), SCH_SHEET_PATH::LastScreen(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, SCH_EDIT_FRAME::OnModify(), SCH_EDIT_FRAME::OnPageSettingsChange(), SCH_SHEET_PATH::PathHumanReadable(), SCH_SHEET_PATH::pop_back(), SCH_SHEET_PATH::push_back(), EE_SELECTION_TOOL::RequestSelection(), SCH_EDIT_FRAME::SaveCopyInUndoList(), BASE_SCREEN::SetPageNumber(), SCH_SHEET_PATH::SetPageNumber(), EE_COLLECTOR::SheetsOnly, and SCH_SHEET_PATH::size().

Referenced by setTransitions().

◆ 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(), 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(), 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(), SYMBOL_EDITOR_EDIT_TOOL::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(), 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(), Mirror(), EDIT_TOOL::MoveExact(), PL_EDIT_TOOL::moveItem(), SCH_MOVE_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), SYMBOL_EDITOR_EDIT_TOOL::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(), 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(), 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(), 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(), SYMBOL_EDITOR_EDIT_TOOL::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(), 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(), SYMBOL_EDITOR_EDIT_TOOL::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(), Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), 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().

◆ GlobalEdit()

int SCH_EDIT_TOOL::GlobalEdit ( const TOOL_EVENT aEvent)

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

Definition at line 489 of file eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp.

References EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame.

Referenced by setTransitions().

◆ 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(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), PL_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), 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 SCH_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 142 of file sch_edit_tool.cpp.

143 {
145 
148 
149  wxASSERT_MSG( drawingTools, "eeshema.InteractiveDrawing tool is not available" );
150 
151  auto hasElements =
152  [this]( const SELECTION& aSel )
153  {
154  return !m_frame->GetScreen()->Items().empty();
155  };
156 
157  auto sheetHasUndefinedPins =
158  []( const SELECTION& aSel )
159  {
160  if( aSel.Size() != 1 )
161  return false;
162 
163  if( !aSel.HasType( SCH_SHEET_T ) )
164  return false;
165 
166  SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aSel.Front() );
167 
168  wxCHECK( item, false );
169 
170  SCH_SHEET* sheet = dynamic_cast<SCH_SHEET*>( item );
171 
172  wxCHECK( sheet, false );
173 
174  return sheet->HasUndefinedPins();
175  };
176 
177  auto anyTextTool =
178  [this]( const SELECTION& aSel )
179  {
184  };
185 
186  auto duplicateCondition =
187  []( const SELECTION& aSel )
188  {
190  return false;
191 
192  return true;
193  };
194 
195  auto orientCondition =
196  []( const SELECTION& aSel )
197  {
198  if( aSel.Empty() )
199  return false;
200 
202  return false;
203 
204  if( aSel.GetSize() > 1 )
205  return true;
206 
207  SCH_ITEM* item = (SCH_ITEM*) aSel.Front();
208 
209  switch( item->Type() )
210  {
211  case SCH_MARKER_T:
212  case SCH_JUNCTION_T:
213  case SCH_NO_CONNECT_T:
214  case SCH_PIN_T:
215  return false;
216  case SCH_LINE_T:
217  return item->GetLayer() != LAYER_WIRE && item->GetLayer() != LAYER_BUS;
218  default:
219  return true;
220  }
221  };
222 
223  auto propertiesCondition =
224  [&]( const SELECTION& aSel )
225  {
226  if( aSel.GetSize() == 0 )
227  {
229  {
232 
233  if( ds && ds->HitTestDrawingSheetItems( getView(), (wxPoint) cursor ) )
234  return true;
235  }
236 
237  return false;
238  }
239 
240  SCH_ITEM* firstItem = dynamic_cast<SCH_ITEM*>( aSel.Front() );
241  const EE_SELECTION* eeSelection = dynamic_cast<const EE_SELECTION*>( &aSel );
242 
243  if( !firstItem || !eeSelection )
244  return false;
245 
246  switch( firstItem->Type() )
247  {
248  case SCH_SYMBOL_T:
249  case SCH_SHEET_T:
250  case SCH_SHEET_PIN_T:
251  case SCH_TEXT_T:
252  case SCH_LABEL_T:
253  case SCH_GLOBAL_LABEL_T:
254  case SCH_HIER_LABEL_T:
255  case SCH_FIELD_T:
256  case SCH_BITMAP_T:
257  return aSel.GetSize() == 1;
258 
259  case SCH_LINE_T:
261  return eeSelection->AllItemsHaveLineStroke();
262 
263  case SCH_JUNCTION_T:
264  return eeSelection->AreAllItemsIdentical();
265 
266  default:
267  return false;
268  }
269  };
270 
271  auto autoplaceCondition =
272  []( const SELECTION& aSel )
273  {
274  for( const EDA_ITEM* item : aSel )
275  {
276  if( item->IsType( EE_COLLECTOR::FieldOwners ) )
277  return true;
278  }
279 
280  return false;
281  };
282 
283  static KICAD_T allLabelTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT };
284 
285  static KICAD_T toLabelTypes[] = { SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT };
286  auto toLabelCondition = ( E_C::Count( 1 ) && E_C::OnlyTypes( toLabelTypes ) )
287  || ( E_C::MoreThan( 1 ) && E_C::OnlyTypes( allLabelTypes ) );
288 
289  static KICAD_T toHLableTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_TEXT_T, EOT };
290  auto toHLabelCondition = ( E_C::Count( 1 ) && E_C::OnlyTypes( toHLableTypes ) )
291  || ( E_C::MoreThan( 1 ) && E_C::OnlyTypes( allLabelTypes ) );
292 
293  static KICAD_T toGLableTypes[] = { SCH_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT };
294  auto toGLabelCondition = ( E_C::Count( 1 ) && E_C::OnlyTypes( toGLableTypes ) )
295  || ( E_C::MoreThan( 1 ) && E_C::OnlyTypes( allLabelTypes ) );
296 
297  static KICAD_T toTextTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, EOT };
298  auto toTextlCondition = ( E_C::Count( 1 ) && E_C::OnlyTypes( toTextTypes ) )
299  || ( E_C::MoreThan( 1 ) && E_C::OnlyTypes( allLabelTypes ) );
300 
301  static KICAD_T entryTypes[] = { SCH_BUS_WIRE_ENTRY_T, SCH_BUS_BUS_ENTRY_T, EOT };
302  auto entryCondition = E_C::MoreThan( 0 ) && E_C::OnlyTypes( entryTypes );
303 
304  auto singleSheetCondition = E_C::Count( 1 ) && E_C::OnlyType( SCH_SHEET_T );
305 
306  //
307  // Add edit actions to the move tool menu
308  //
309  if( moveTool )
310  {
311  CONDITIONAL_MENU& moveMenu = moveTool->GetToolMenu().GetMenu();
312 
313  moveMenu.AddSeparator();
314  moveMenu.AddItem( EE_ACTIONS::rotateCCW, orientCondition );
315  moveMenu.AddItem( EE_ACTIONS::rotateCW, orientCondition );
316  moveMenu.AddItem( EE_ACTIONS::mirrorV, orientCondition );
317  moveMenu.AddItem( EE_ACTIONS::mirrorH, orientCondition );
318 
319  moveMenu.AddItem( EE_ACTIONS::properties, propertiesCondition );
324 
325  std::shared_ptr<SYMBOL_UNIT_MENU> symUnitMenu = std::make_shared<SYMBOL_UNIT_MENU>();
326  symUnitMenu->SetTool( this );
327  m_menu.AddSubMenu( symUnitMenu );
328  moveMenu.AddMenu( symUnitMenu.get(), E_C::SingleMultiUnitSymbol, 1 );
329 
330  moveMenu.AddSeparator();
334  moveMenu.AddItem( ACTIONS::duplicate, duplicateCondition );
335 
336  moveMenu.AddSeparator();
337  moveMenu.AddItem( ACTIONS::selectAll, hasElements );
338  }
339 
340  //
341  // Add editing actions to the drawing tool menu
342  //
343  CONDITIONAL_MENU& drawMenu = drawingTools->GetToolMenu().GetMenu();
344 
345  drawMenu.AddItem( EE_ACTIONS::rotateCCW, orientCondition, 200 );
346  drawMenu.AddItem( EE_ACTIONS::rotateCW, orientCondition, 200 );
347  drawMenu.AddItem( EE_ACTIONS::mirrorV, orientCondition, 200 );
348  drawMenu.AddItem( EE_ACTIONS::mirrorH, orientCondition, 200 );
349 
350  drawMenu.AddItem( EE_ACTIONS::properties, propertiesCondition, 200 );
354  drawMenu.AddItem( EE_ACTIONS::autoplaceFields, autoplaceCondition, 200 );
356 
357  std::shared_ptr<SYMBOL_UNIT_MENU> symUnitMenu2 = std::make_shared<SYMBOL_UNIT_MENU>();
358  symUnitMenu2->SetTool( drawingTools );
359  drawingTools->GetToolMenu().AddSubMenu( symUnitMenu2 );
360  drawMenu.AddMenu( symUnitMenu2.get(), E_C::SingleMultiUnitSymbol, 1 );
361 
363 
364  drawMenu.AddItem( EE_ACTIONS::toLabel, anyTextTool && E_C::Idle, 200 );
365  drawMenu.AddItem( EE_ACTIONS::toHLabel, anyTextTool && E_C::Idle, 200 );
366  drawMenu.AddItem( EE_ACTIONS::toGLabel, anyTextTool && E_C::Idle, 200 );
367  drawMenu.AddItem( EE_ACTIONS::toText, anyTextTool && E_C::Idle, 200 );
368 
369  //
370  // Add editing actions to the selection tool menu
371  //
373 
374  selToolMenu.AddItem( EE_ACTIONS::rotateCCW, orientCondition, 200 );
375  selToolMenu.AddItem( EE_ACTIONS::rotateCW, orientCondition, 200 );
376  selToolMenu.AddItem( EE_ACTIONS::mirrorV, orientCondition, 200 );
377  selToolMenu.AddItem( EE_ACTIONS::mirrorH, orientCondition, 200 );
378 
379  selToolMenu.AddItem( EE_ACTIONS::properties, propertiesCondition, 200 );
381  selToolMenu.AddItem( EE_ACTIONS::editValue, E_C::SingleSymbol, 200 );
383  selToolMenu.AddItem( EE_ACTIONS::autoplaceFields, autoplaceCondition, 200 );
385 
386  std::shared_ptr<SYMBOL_UNIT_MENU> symUnitMenu3 = std::make_shared<SYMBOL_UNIT_MENU>();
387  symUnitMenu3->SetTool( m_selectionTool );
388  m_selectionTool->GetToolMenu().AddSubMenu( symUnitMenu3 );
389  selToolMenu.AddMenu( symUnitMenu3.get(), E_C::SingleMultiUnitSymbol, 1 );
390 
394 
395  selToolMenu.AddItem( EE_ACTIONS::toLabel, toLabelCondition, 200 );
396  selToolMenu.AddItem( EE_ACTIONS::toHLabel, toHLabelCondition, 200 );
397  selToolMenu.AddItem( EE_ACTIONS::toGLabel, toGLabelCondition, 200 );
398  selToolMenu.AddItem( EE_ACTIONS::toText, toTextlCondition, 200 );
399  selToolMenu.AddItem( EE_ACTIONS::cleanupSheetPins, sheetHasUndefinedPins, 250 );
400 
401  selToolMenu.AddSeparator( 300 );
402  selToolMenu.AddItem( ACTIONS::cut, E_C::IdleSelection, 300 );
403  selToolMenu.AddItem( ACTIONS::copy, E_C::IdleSelection, 300 );
404  selToolMenu.AddItem( ACTIONS::paste, E_C::Idle, 300 );
405  selToolMenu.AddItem( ACTIONS::pasteSpecial, E_C::Idle, 300 );
406  selToolMenu.AddItem( ACTIONS::doDelete, E_C::NotEmpty, 300 );
407  selToolMenu.AddItem( ACTIONS::duplicate, duplicateCondition, 300 );
408 
409  selToolMenu.AddSeparator( 400 );
410  selToolMenu.AddItem( ACTIONS::selectAll, hasElements, 400 );
411 
412 
413  return true;
414 }
bool empty() const
Definition: sch_rtree.h:177
void AddMenu(ACTION_MENU *aMenu, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Add a submenu to the menu.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
static TOOL_ACTION properties
Definition: ee_actions.h:121
bool IsCurrentTool(const TOOL_ACTION &aAction) const
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
static TOOL_ACTION toggleDeMorgan
Definition: ee_actions.h:126
static SELECTION_CONDITION SingleSymbol
static TOOL_ACTION doDelete
Definition: actions.h:72
Tool responsible for drawing/placing items (symbols, wires, buses, labels, etc.).
static SELECTION_CONDITION MoreThan(int aNumber)
Create a functor that tests if the number of selected items is greater than the value given as parame...
static bool Idle(const SELECTION &aSelection)
Test if there no items selected or being edited.
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Create a functor that tests if the selected items are only of given types.
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
static TOOL_ACTION placeHierLabel
Definition: ee_actions.h:88
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
static TOOL_ACTION changeSymbol
Definition: ee_actions.h:149
TOOL_MENU & GetToolMenu()
bool HasUndefinedPins() const
Check all sheet labels against schematic for undefined hierarchical labels.
Definition: sch_sheet.cpp:415
static TOOL_ACTION toText
Definition: ee_actions.h:133
static const KICAD_T FieldOwners[]
Definition: ee_collectors.h:48
static TOOL_ACTION autoplaceFields
Definition: ee_actions.h:125
bool HitTestDrawingSheetItems(KIGFX::VIEW *aView, const wxPoint &aPosition)
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.
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
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
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
static SELECTION_CONDITION SingleDeMorganSymbol
static TOOL_ACTION copy
Definition: actions.h:67
static TOOL_ACTION cleanupSheetPins
Definition: ee_actions.h:192
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:118
static TOOL_ACTION editFootprint
Definition: ee_actions.h:124
static TOOL_ACTION placeSchematicText
Definition: ee_actions.h:91
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
static TOOL_ACTION updateSymbol
Definition: ee_actions.h:150
static TOOL_ACTION cut
Definition: actions.h:66
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
virtual bool IsType(const KICAD_T aScanTypes[]) const
Check whether the item is one of the listed types.
Definition: eda_item.h:182
static SELECTION_CONDITION SingleMultiUnitSymbol
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
void AddSeparator(int aOrder=ANY_ORDER)
Add a separator to the menu.
static TOOL_ACTION pasteSpecial
Definition: actions.h:69
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:259
static TOOL_ACTION placeLabel
Definition: ee_actions.h:86
static bool IsDrawingLineWireOrBus(const SELECTION &aSelection)
static TOOL_ACTION editValue
Definition: ee_actions.h:123
void AddSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Store a submenu of this menu model.
Definition: tool_menu.cpp:52
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
Definition: sch_screen.h:110
static SELECTION_CONDITION OnlyType(KICAD_T aType)
Create a functor that tests if the selected items are only of given type.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
static SELECTION_CONDITION SingleSymbolOrPower
static TOOL_ACTION editWithLibEdit
Definition: ee_actions.h:162
static TOOL_ACTION toLabel
Definition: ee_actions.h:130
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
Definition: sch_view.h:98
static TOOL_ACTION toHLabel
Definition: ee_actions.h:131
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
static TOOL_ACTION editReference
Definition: ee_actions.h:122
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:87
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.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:182
static TOOL_ACTION selectAll
Definition: actions.h:70
static TOOL_ACTION toGLabel
Definition: ee_actions.h:132
static TOOL_ACTION paste
Definition: actions.h:68
static TOOL_ACTION duplicate
Definition: actions.h:71
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
Definition: view.h:405

References CONDITIONAL_MENU::AddItem(), CONDITIONAL_MENU::AddMenu(), CONDITIONAL_MENU::AddSeparator(), TOOL_MENU::AddSubMenu(), EE_ACTIONS::autoplaceFields, EE_ACTIONS::changeSymbol, EE_ACTIONS::cleanupSheetPins, ACTIONS::copy, SELECTION_CONDITIONS::Count(), cursor, ACTIONS::cut, ACTIONS::doDelete, ACTIONS::duplicate, EE_ACTIONS::editFootprint, EE_ACTIONS::editReference, EE_ACTIONS::editValue, EE_ACTIONS::editWithLibEdit, EE_RTREE::empty(), EOT, EE_COLLECTOR::FieldOwners, SCH_BASE_FRAME::GetCanvas(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), KIGFX::SCH_VIEW::GetDrawingSheet(), SCH_ITEM::GetLayer(), TOOL_MENU::GetMenu(), SCH_EDIT_FRAME::GetScreen(), TOOL_MANAGER::GetTool(), TOOL_INTERACTIVE::GetToolMenu(), SCH_DRAW_PANEL::GetView(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), SCH_SHEET::HasUndefinedPins(), DS_PROXY_VIEW_ITEM::HitTestDrawingSheetItems(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), EE_TOOL_BASE< T >::Init(), TOOLS_HOLDER::IsCurrentTool(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus(), KIGFX::VIEW::IsLayerVisible(), SCH_SCREEN::Items(), LAYER_BUS, LAYER_SCHEMATIC_DRAWINGSHEET, LAYER_WIRE, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_INTERACTIVE::m_menu, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_ACTIONS::mirrorH, EE_ACTIONS::mirrorV, SELECTION_CONDITIONS::MoreThan(), SELECTION_CONDITIONS::NotEmpty(), SELECTION_CONDITIONS::OnlyType(), SELECTION_CONDITIONS::OnlyTypes(), ACTIONS::paste, ACTIONS::pasteSpecial, EE_ACTIONS::placeGlobalLabel, EE_ACTIONS::placeHierLabel, EE_ACTIONS::placeLabel, EE_ACTIONS::placeSchematicText, EE_ACTIONS::properties, EE_ACTIONS::rotateCCW, EE_ACTIONS::rotateCW, SCH_BITMAP_T, SCH_BUS_BUS_ENTRY_T, SCH_BUS_WIRE_ENTRY_T, SCH_FIELD_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_JUNCTION_T, SCH_LABEL_T, SCH_LINE_T, SCH_MARKER_T, SCH_NO_CONNECT_T, SCH_PIN_T, SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_SYMBOL_T, SCH_TEXT_T, ACTIONS::selectAll, EE_CONDITIONS::SingleDeMorganSymbol, EE_CONDITIONS::SingleMultiUnitSymbol, EE_CONDITIONS::SingleSymbol, EE_CONDITIONS::SingleSymbolOrPower, EE_ACTIONS::toggleDeMorgan, EE_ACTIONS::toGLabel, EE_ACTIONS::toHLabel, EE_ACTIONS::toLabel, EE_ACTIONS::toText, EDA_ITEM::Type(), and EE_ACTIONS::updateSymbol.

◆ 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 SCH_EDIT_TOOL::Mirror ( const TOOL_EVENT aEvent)

Definition at line 688 of file sch_edit_tool.cpp.

689 {
691 
692  if( selection.GetSize() == 0 )
693  return 0;
694 
695  wxPoint mirrorPoint;
696  bool vertical = ( aEvent.Matches( EE_ACTIONS::mirrorV.MakeEvent() ) );
697  SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.Front() );
698  bool connections = false;
699  bool moving = item->IsMoving();
700 
701  if( selection.GetSize() == 1 )
702  {
703  if( !moving )
705 
706  switch( item->Type() )
707  {
708  case SCH_SYMBOL_T:
709  {
710  SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
711 
712  if( vertical )
713  symbol->SetOrientation( SYM_MIRROR_X );
714  else
715  symbol->SetOrientation( SYM_MIRROR_Y );
716 
718  symbol->AutoAutoplaceFields( m_frame->GetScreen() );
719 
720  break;
721  }
722 
723  case SCH_TEXT_T:
724  case SCH_LABEL_T:
725  case SCH_GLOBAL_LABEL_T:
726  case SCH_HIER_LABEL_T:
727  {
728  SCH_TEXT* textItem = static_cast<SCH_TEXT*>( item );
729  textItem->MirrorSpinStyle( !vertical );
730  break;
731  }
732 
733  case SCH_SHEET_PIN_T:
734  {
735  // mirror within parent sheet
736  SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
737  SCH_SHEET* sheet = pin->GetParent();
738 
739  if( vertical )
740  pin->MirrorVertically( sheet->GetBoundingBox().GetCenter().y );
741  else
742  pin->MirrorHorizontally( sheet->GetBoundingBox().GetCenter().x );
743 
744  break;
745  }
746 
747  case SCH_BUS_BUS_ENTRY_T:
749  if( vertical )
750  item->MirrorVertically( item->GetPosition().y );
751  else
752  item->MirrorHorizontally( item->GetPosition().x );
753  break;
754 
755  case SCH_FIELD_T:
756  {
757  SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
758 
759  if( vertical )
761  else
763 
764  // Now that we're re-justifying a field, they're no longer autoplaced.
765  static_cast<SCH_ITEM*>( item->GetParent() )->ClearFieldsAutoplaced();
766 
767  break;
768  }
769 
770  case SCH_BITMAP_T:
771  if( vertical )
772  item->MirrorVertically( item->GetPosition().y );
773  else
774  item->MirrorHorizontally( item->GetPosition().x );
775 
776  // The bitmap is cached in Opengl: clear the cache to redraw
778  break;
779 
780  case SCH_SHEET_T:
781  // Mirror the sheet on itself. Sheets do not have a anchor point.
782  mirrorPoint = m_frame->GetNearestHalfGridPosition( item->GetBoundingBox().Centre() );
783 
784  if( vertical )
785  item->MirrorVertically( mirrorPoint.y );
786  else
787  item->MirrorHorizontally( mirrorPoint.x );
788 
789  break;
790 
791  default:
792  break;
793  }
794 
795  connections = item->IsConnectable();
796  m_frame->UpdateItem( item, false, true );
797  }
798  else if( selection.GetSize() > 1 )
799  {
800  mirrorPoint = m_frame->GetNearestHalfGridPosition( (wxPoint)selection.GetCenter() );
801 
802  for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
803  {
804  item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
805 
806  if( !moving )
807  saveCopyInUndoList( item, UNDO_REDO::CHANGED, ii > 0 );
808 
809  if( item->Type() == SCH_SHEET_PIN_T )
810  {
811  if( item->GetParent()->IsSelected() )
812  {
813  // parent will mirror us
814  }
815  else
816  {
817  // mirror within parent sheet
818  SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
819  SCH_SHEET* sheet = pin->GetParent();
820 
821  if( vertical )
822  pin->MirrorVertically( sheet->GetBoundingBox().GetCenter().y );
823  else
824  pin->MirrorHorizontally( sheet->GetBoundingBox().GetCenter().x );
825  }
826  }
827  else
828  {
829  if( vertical )
830  item->MirrorVertically( mirrorPoint.y );
831  else
832  item->MirrorHorizontally( mirrorPoint.x );
833  }
834 
835  connections |= item->IsConnectable();
836  m_frame->UpdateItem( item, false, true );
837  }
838  }
839 
841 
842  // Update R-Tree for modified items
843  for( EDA_ITEM* selected : selection )
844  updateItem( selected, true );
845 
846  if( item->IsMoving() )
847  {
849  }
850  else
851  {
852  if( selection.IsHover() )
854 
855  if( connections )
857 
858  m_frame->OnModify();
859  }
860 
861  return 0;
862 }
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:49
virtual bool IsConnectable() const
Definition: sch_item.h:349
virtual VECTOR2I GetCenter() const
Returns the center point of the selection area bounding box.
Definition: selection.cpp:71
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:82
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:220
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
bool IsSelected() const
Definition: eda_item.h:122
void AutoAutoplaceFields(SCH_SCREEN *aScreen)
Autoplace fields only if correct to do so automatically.
Definition: sch_item.h:436
bool IsMoving() const
Definition: eda_item.h:119
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1385
virtual void MirrorVertically(int aCenter)=0
Mirror item vertically about aCenter.
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
static TOOL_ACTION mirrorV
Definition: ee_actions.h:119
EESCHEMA_SETTINGS * eeconfig() const
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...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
AUTOPLACE_FIELDS m_AutoplaceFields
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:219
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_sheet.cpp:653
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:134
void SetVertJustify(EDA_TEXT_VJUSTIFY_T aType)
Definition: eda_text.h:223
EDA_ITEM * GetParent() const
Definition: eda_item.h:114
const KICAD_T rotatableItems[]
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
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:65
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
virtual void MirrorHorizontally(int aCenter)=0
Mirror item horizontally about aCenter.
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
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
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
EDA_TEXT_VJUSTIFY_T
Definition: eda_text.h:89
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:88
Schematic symbol object.
Definition: sch_symbol.h:78
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.cpp:53
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:222
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
wxPoint Centre() const
Definition: eda_rect.h:64
virtual void MirrorSpinStyle(bool aLeftRight)
Definition: sch_text.cpp:321
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:75
const wxPoint GetCenter() const
Definition: eda_rect.h:113
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:182
static TOOL_ACTION refreshPreview
Definition: actions.h:106
EDA_ITEM * Front() const
Definition: selection.h:145
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

References SCH_ITEM::AutoAutoplaceFields(), EDA_RECT::Centre(), CHANGED, EE_ACTIONS::clearSelection, SCH_BASE_FRAME::eeconfig(), EESCHEMA_SETTINGS::AUTOPLACE_FIELDS::enable, SELECTION::Front(), EDA_ITEM::GetBoundingBox(), SCH_SHEET::GetBoundingBox(), EDA_RECT::GetCenter(), SELECTION::GetCenter(), EDA_TEXT::GetHorizJustify(), SELECTION::GetItem(), EDA_DRAW_FRAME::GetNearestHalfGridPosition(), EDA_ITEM::GetParent(), EDA_ITEM::GetPosition(), SCH_EDIT_FRAME::GetScreen(), SELECTION::GetSize(), EDA_TEXT::GetVertJustify(), TOOL_BASE::getView(), SCH_ITEM::IsConnectable(), EDA_ITEM::IsMoving(), EDA_ITEM::IsSelected(), EESCHEMA_SETTINGS::m_AutoplaceFields, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, TOOL_EVENT::Matches(), SCH_ITEM::MirrorHorizontally(), SCH_TEXT::MirrorSpinStyle(), EE_ACTIONS::mirrorV, SCH_ITEM::MirrorVertically(), SCH_EDIT_FRAME::OnModify(), pin, TOOL_MANAGER::PostEvent(), KIGFX::VIEW::RecacheAllItems(), ACTIONS::refreshPreview, EE_SELECTION_TOOL::RequestSelection(), rotatableItems, TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList(), SCH_BITMAP_T, SCH_BUS_BUS_ENTRY_T, SCH_BUS_WIRE_ENTRY_T, SCH_FIELD_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_SYMBOL_T, SCH_TEXT_T, EVENTS::SelectedItemsModified, EDA_TEXT::SetHorizJustify(), SCH_SYMBOL::SetOrientation(), EDA_TEXT::SetVertJustify(), SYM_MIRROR_X, SYM_MIRROR_Y, SCH_EDIT_FRAME::TestDanglingEnds(), EDA_ITEM::Type(), EE_TOOL_BASE< SCH_EDIT_FRAME >::updateItem(), and SCH_BASE_FRAME::UpdateItem().

Referenced by setTransitions().

◆ Properties()

int SCH_EDIT_TOOL::Properties ( const TOOL_EVENT aEvent)

Definition at line 1315 of file sch_edit_tool.cpp.

1316 {
1318  bool clearSelection = selection.IsHover();
1319 
1320  if( selection.Empty() )
1321  {
1323  {
1325  VECTOR2D cursorPos = getViewControls()->GetCursorPosition( false );
1326 
1327  if( ds && ds->HitTestDrawingSheetItems( getView(), (wxPoint) cursorPos ) )
1329  }
1330 
1331  return 0;
1332  }
1333 
1334  EDA_ITEM* item = selection.Front();
1335 
1336  switch( item->Type() )
1337  {
1338  case SCH_LINE_T:
1339  case SCH_BUS_WIRE_ENTRY_T:
1340  if( !selection.AllItemsHaveLineStroke() )
1341  return 0;
1342 
1343  break;
1344 
1345  case SCH_JUNCTION_T:
1346  if( !selection.AreAllItemsIdentical() )
1347  return 0;
1348 
1349  break;
1350 
1351  default:
1352  if( selection.Size() > 1 )
1353  return 0;
1354 
1355  break;
1356  }
1357 
1358  auto doTextAndLabelProps =
1359  [&]( SCH_TEXT* aText )
1360  {
1362 
1363  // Must be quasi modal for syntax help
1364  if( dlg.ShowQuasiModal() == wxID_OK )
1365  {
1367  m_frame->OnModify();
1368  }
1369  };
1370 
1371  switch( item->Type() )
1372  {
1373  case SCH_SYMBOL_T:
1374  {
1375  SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
1376  DIALOG_SYMBOL_PROPERTIES symbolPropsDialog( m_frame, symbol );
1377 
1378  // This dialog itself subsequently can invoke a KIWAY_PLAYER as a quasimodal
1379  // frame. Therefore this dialog as a modal frame parent, MUST be run under
1380  // quasimodal mode for the quasimodal frame support to work. So don't use
1381  // the QUASIMODAL macros here.
1382  int retval = symbolPropsDialog.ShowQuasiModal();
1383 
1384  if( retval == SYMBOL_PROPS_EDIT_OK )
1385  {
1387  symbol->AutoAutoplaceFields( m_frame->GetScreen() );
1388 
1390  m_frame->OnModify();
1391  }
1392  else if( retval == SYMBOL_PROPS_EDIT_SCHEMATIC_SYMBOL )
1393  {
1395  true );
1396 
1397  editor->LoadSymbolFromSchematic( symbol );
1398 
1399  editor->Show( true );
1400  editor->Raise();
1401  }
1402  else if( retval == SYMBOL_PROPS_EDIT_LIBRARY_SYMBOL )
1403  {
1405  true );
1406 
1407  editor->LoadSymbol( symbol->GetLibId(), symbol->GetUnit(), symbol->GetConvert() );
1408 
1409  editor->Show( true );
1410  editor->Raise();
1411  }
1412  else if( retval == SYMBOL_PROPS_WANT_UPDATE_SYMBOL )
1413  {
1415  dlg.ShowQuasiModal();
1416  }
1417  else if( retval == SYMBOL_PROPS_WANT_EXCHANGE_SYMBOL )
1418  {
1420  dlg.ShowQuasiModal();
1421  }
1422  }
1423  break;
1424 
1425  case SCH_SHEET_T:
1426  {
1427  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
1428  bool doClearAnnotation;
1429  bool doRefresh = false;
1430 
1431  // Keep track of existing sheet paths. EditSheet() can modify this list.
1432  // Note that we use the validity checking/repairing version here just to make sure
1433  // we've got a valid hierarchy to begin with.
1434  SCH_SHEET_LIST initial_sheetpathList( &m_frame->Schematic().Root(), true );
1435 
1436  doRefresh = m_frame->EditSheetProperties( sheet, &m_frame->GetCurrentSheet(),
1437  &doClearAnnotation );
1438 
1439  // If the sheet file is changed and new sheet contents are loaded then we have to
1440  // clear the annotations on the new content (as it may have been set from some other
1441  // sheet path reference)
1442  if( doClearAnnotation )
1443  {
1444  SCH_SCREENS screensList( &m_frame->Schematic().Root() );
1445  // We clear annotation of new sheet paths here:
1446  screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
1447  // Clear annotation of g_CurrentSheet itself, because its sheetpath is not a new
1448  // path, but symbols managed by its sheet path must have their annotation cleared
1449  // because they are new:
1451  }
1452 
1453  if( doRefresh )
1454  {
1456  m_frame->GetCanvas()->Refresh();
1458  }
1459 
1460  break;
1461  }
1462 
1463  case SCH_SHEET_PIN_T:
1464  {
1465  SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
1467 
1468  // QuasiModal required for help dialog
1469  if( dlg.ShowQuasiModal() == wxID_OK )
1470  {
1472  m_frame->OnModify();
1473  }
1474  }
1475  break;
1476 
1477  case SCH_TEXT_T:
1478  case SCH_LABEL_T:
1479  case SCH_GLOBAL_LABEL_T:
1480  case SCH_HIER_LABEL_T:
1481  doTextAndLabelProps( static_cast<SCH_TEXT*>( item ) );
1482  break;
1483 
1484  case SCH_FIELD_T:
1485  {
1486  SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
1487  EDA_ITEM* parent = field->GetParent();
1488 
1489  if( parent->Type() == SCH_GLOBAL_LABEL_T )
1490  doTextAndLabelProps( static_cast<SCH_TEXT*>( parent ) );
1491  else
1492  editFieldText( field );
1493 
1494  if( !field->IsVisible() )
1495  clearSelection = true;
1496  }
1497  break;
1498 
1499  case SCH_BITMAP_T:
1500  {
1501  SCH_BITMAP* bitmap = static_cast<SCH_BITMAP*>( item );
1502  DIALOG_IMAGE_EDITOR dlg( m_frame, bitmap->GetImage() );
1503 
1504  if( dlg.ShowModal() == wxID_OK )
1505  {
1506  // save old image in undo list if not already in edit
1507  if( bitmap->GetEditFlags() == 0 )
1509 
1510  dlg.TransferToImage( bitmap->GetImage() );
1511 
1512  // The bitmap is cached in Opengl: clear the cache in case it has become invalid
1513  getView()->RecacheAllItems();
1515  m_frame->OnModify();
1516  }
1517  }
1518  break;
1519 
1520  case SCH_LINE_T:
1521  case SCH_BUS_WIRE_ENTRY_T:
1522  {
1523  std::deque<SCH_ITEM*> strokeItems;
1524 
1525  for( EDA_ITEM* selItem : selection.Items() )
1526  {
1527  SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( selItem );
1528 
1529  if( schItem && schItem->HasLineStroke() )
1530  strokeItems.push_back( schItem );
1531  else
1532  return 0;
1533  }
1534 
1535  DIALOG_LINE_WIRE_BUS_PROPERTIES dlg( m_frame, strokeItems );
1536 
1537  if( dlg.ShowModal() == wxID_OK )
1538  {
1540  m_frame->OnModify();
1541  }
1542  }
1543  break;
1544 
1545  case SCH_JUNCTION_T:
1546  {
1547  std::deque<SCH_JUNCTION*> junctions;
1548 
1549  for( EDA_ITEM* selItem : selection.Items() )
1550  {
1551  SCH_JUNCTION* junction = dynamic_cast<SCH_JUNCTION*>( selItem );
1552 
1553  wxCHECK( junction, 0 );
1554 
1555  junctions.push_back( junction );
1556  }
1557 
1558  DIALOG_JUNCTION_PROPS dlg( m_frame, junctions );
1559 
1560  if( dlg.ShowModal() == wxID_OK )
1561  {
1563  m_frame->OnModify();
1564  }
1565  }
1566  break;
1567 
1568  case SCH_MARKER_T: // These items have no properties to edit
1569  case SCH_NO_CONNECT_T:
1570  break;
1571 
1572  default: // Unexpected item
1573  wxFAIL_MSG( wxString( wxT( "Cannot edit schematic item type " ) ) + item->GetClass() );
1574  }
1575 
1576  updateItem( item, true );
1577 
1578  if( clearSelection )
1580 
1581  return 0;
1582 }
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:49
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
bool IsHover() const
Definition: selection.h:74
std::deque< EDA_ITEM * > & Items()
Definition: selection.h:150
static TOOL_ACTION pageSettings
Definition: actions.h:56
void AutoAutoplaceFields(SCH_SCREEN *aScreen)
Autoplace fields only if correct to do so automatically.
Definition: sch_item.h:436
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1385
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:393
bool HitTestDrawingSheetItems(KIGFX::VIEW *aView, const wxPoint &aPosition)
bool AreAllItemsIdentical() const
Checks if all items in the selection are the same KICAD_T type.
Definition: selection.cpp:160
SCH_SCREEN * GetScreen() const
Definition: sch_sheet.h:102
Dialog to update or change schematic library symbols.
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
EESCHEMA_SETTINGS * eeconfig() const
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...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void editFieldText(SCH_FIELD *aField)
Set up handlers for various events.
AUTOPLACE_FIELDS m_AutoplaceFields
BITMAP_BASE * GetImage() const
Definition: sch_bitmap.h:54
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:134
virtual bool IsVisible() const
Definition: eda_text.h:207
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual bool HasLineStroke() const
Check if this schematic item has line stoke properties.
Definition: sch_item.h:453
SCHEMATIC & Schematic() const
void UpdateHierarchyNavigator(bool aForceUpdate=false)
Run the Hierarchy Navigator dialog.
EDA_ITEM * GetParent() const
Definition: eda_item.h:114
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:65
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:157
Object to handle a bitmap image that can be inserted in a schematic.
Definition: sch_bitmap.h:40
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 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
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
bool AllItemsHaveLineStroke() const
Checks if all items in the selection support line strokes.
SCH_SHEET & Root() const
Definition: schematic.h:92
virtual wxString GetClass() const =0
Return the class name.
Schematic symbol object.
Definition: sch_symbol.h:78
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...
int Size() const
Returns the number of selected parts.
Definition: selection.h:104
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
bool EditSheetProperties(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy, bool *aClearAnnotationNewItems)
Edit an existing sheet or add a new sheet to the schematic.
Definition: sheet.cpp:461
SCH_SHEET_PATH & GetCurrentSheet() const
void ClearAnnotation(SCH_SHEET_PATH *aSheetPath)
Clear the annotation for the symbols in aSheetPath on the screen.
Definition: sch_screen.cpp:984
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
Definition: sch_view.h:98
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
void ClearAnnotationOfNewSheetPaths(SCH_SHEET_LIST &aInitialSheetPathList)
Clear the annotation for the symbols inside new sheetpaths when a complex hierarchy is modified and n...
int GetUnit() const
Definition: sch_symbol.h:196
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
int GetConvert() const
Definition: sch_symbol.h:224
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:182
static const KICAD_T EditableItems[]
Definition: ee_collectors.h:43
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:593
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
EDA_ITEM * Front() const
Definition: selection.h:145
Dialog used to edit SCH_SYMBOL objects in a schematic.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
const LIB_ID & GetLibId() const
Definition: sch_symbol.h:148
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
Definition: view.h:405
The symbol library editor main window.

References EE_SELECTION::AllItemsHaveLineStroke(), SELECTION::AreAllItemsIdentical(), SCH_ITEM::AutoAutoplaceFields(), DIALOG_CHANGE_SYMBOLS::CHANGE, CHANGED, SCH_SCREEN::ClearAnnotation(), SCH_SCREENS::ClearAnnotationOfNewSheetPaths(), EE_ACTIONS::clearSelection, EE_COLLECTOR::EditableItems, editFieldText(), editor, SCH_EDIT_FRAME::EditSheetProperties(), SCH_BASE_FRAME::eeconfig(), SELECTION::Empty(), EESCHEMA_SETTINGS::AUTOPLACE_FIELDS::enable, FRAME_SCH_SYMBOL_EDITOR, SELECTION::Front(), SCH_BASE_FRAME::GetCanvas(), EDA_ITEM::GetClass(), SCH_SYMBOL::GetConvert(), SCH_EDIT_FRAME::GetCurrentSheet(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), KIGFX::SCH_VIEW::GetDrawingSheet(), EDA_ITEM::GetEditFlags(), SCH_BITMAP::GetImage(), SCH_SYMBOL::GetLibId(), EDA_ITEM::GetParent(), SCH_SHEET::GetScreen(), SCH_EDIT_FRAME::GetScreen(), SCH_SYMBOL::GetUnit(), SCH_DRAW_PANEL::GetView(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), SCH_ITEM::HasLineStroke(), DS_PROXY_VIEW_ITEM::HitTestDrawingSheetItems(), SELECTION::IsHover(), KIGFX::VIEW::IsLayerVisible(), EDA_TEXT::IsVisible(), SELECTION::Items(), KIWAY_HOLDER::Kiway(), LAYER_SCHEMATIC_DRAWINGSHEET, EESCHEMA_SETTINGS::m_AutoplaceFields, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, SCH_EDIT_FRAME::OnModify(), ACTIONS::pageSettings, pin, KIWAY::Player(), TOOL_MANAGER::PostEvent(), KIGFX::VIEW::RecacheAllItems(), EDA_DRAW_PANEL_GAL::Refresh(), EE_SELECTION_TOOL::RequestSelection(), SCHEMATIC::Root(), TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList(), SCH_BITMAP_T, SCH_BUS_WIRE_ENTRY_T, SCH_FIELD_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_JUNCTION_T, SCH_LABEL_T, SCH_LINE_T, SCH_MARKER_T, SCH_NO_CONNECT_T, SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_SYMBOL_T, SCH_TEXT_T, SCH_EDIT_FRAME::Schematic(), EVENTS::SelectedItemsModified, DIALOG_SHIM::ShowQuasiModal(), SELECTION::Size(), SYMBOL_PROPS_EDIT_LIBRARY_SYMBOL, SYMBOL_PROPS_EDIT_OK, SYMBOL_PROPS_EDIT_SCHEMATIC_SYMBOL, SYMBOL_PROPS_WANT_EXCHANGE_SYMBOL, SYMBOL_PROPS_WANT_UPDATE_SYMBOL, EDA_ITEM::Type(), DIALOG_CHANGE_SYMBOLS::UPDATE, SCH_EDIT_FRAME::UpdateHierarchyNavigator(), and EE_TOOL_BASE< SCH_EDIT_FRAME >::updateItem().

Referenced by setTransitions().

◆ RepeatDrawItem()

int SCH_EDIT_TOOL::RepeatDrawItem ( const TOOL_EVENT aEvent)

Definition at line 865 of file sch_edit_tool.cpp.

866 {
867  SCH_ITEM* sourceItem = m_frame->GetRepeatItem();
868 
869  if( !sourceItem )
870  return 0;
871 
873 
874  SCH_ITEM* newItem = sourceItem->Duplicate();
875  bool performDrag = false;
876 
877  // If cloning a symbol then put into 'move' mode.
878  if( newItem->Type() == SCH_SYMBOL_T )
879  {
880  wxPoint cursorPos = (wxPoint) getViewControls()->GetCursorPosition( true );
881  newItem->Move( cursorPos - newItem->GetPosition() );
882  performDrag = true;
883  }
884  else
885  {
886  EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
887 
888  if( dynamic_cast<SCH_TEXT*>( newItem ) )
889  {
890  SCH_TEXT* text = static_cast<SCH_TEXT*>( newItem );
891 
892  // If incrementing tries to go below zero, tell user why the value is repeated
893 
894  if( !text->IncrementLabel( cfg->m_Drawing.repeat_label_increment ) )
895  m_frame->ShowInfoBarWarning( _( "Label value cannot go below zero" ), true );
896  }
897 
898  newItem->Move( wxPoint( Mils2iu( cfg->m_Drawing.default_repeat_offset_x ),
899  Mils2iu( cfg->m_Drawing.default_repeat_offset_y ) ) );
900  }
901 
902  m_toolMgr->RunAction( EE_ACTIONS::addItemToSel, true, newItem );
903  newItem->SetFlags( IS_NEW );
904  m_frame->AddToScreen( newItem, m_frame->GetScreen() );
906 
907  // Symbols need to be handled by the move tool. The move tool will handle schematic
908  // cleanup routines
909  if( performDrag )
911 
912  newItem->ClearFlags();
913 
914  if( !performDrag && newItem->IsConnectable() )
915  {
916  EE_SELECTION new_sel;
917  new_sel.Add( newItem );
918 
921 
924  }
925 
926  m_frame->GetCanvas()->Refresh();
927  m_frame->OnModify();
928 
929  // Save newItem at the new position.
930  m_frame->SaveCopyForRepeatItem( newItem );
931 
932  return 0;
933 }
virtual bool IsConnectable() const
Definition: sch_item.h:349
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generate the connection data for the entire schematic hierarchy.
#define IS_NEW
New item, just created.
virtual void Add(EDA_ITEM *aItem)
Definition: selection.cpp:32
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
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
virtual wxPoint GetPosition() const
Definition: eda_item.h:251
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
void ShowInfoBarWarning(const wxString &aWarningMsg, bool aShowCloseButton=false)
Show the WX_INFOBAR displayed on the top of the canvas with a message and a warning icon on the left ...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
static TOOL_ACTION trimOverlappingWires
Definition: ee_actions.h:76
static TOOL_ACTION addItemToSel
Selects an item (specified as the event parameter).
Definition: ee_actions.h:59
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
Definition: sch_item.cpp:85
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SaveCopyForRepeatItem(const SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
#define _(s)
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:153
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static TOOL_ACTION addNeededJunctions
Definition: ee_actions.h:75
SCH_ITEM * GetRepeatItem() const
Return the item which is to be repeated with the insert key.
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen)
Add an item to the screen (and view) aScreen is the screen the item is located on,...
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.
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...
static TOOL_ACTION move
Definition: ee_actions.h:114
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:182
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
virtual void Move(const wxPoint &aMoveVector)=0
Move the item by aMoveVector to a new position.

References _, SELECTION::Add(), EE_ACTIONS::addItemToSel, EE_ACTIONS::addNeededJunctions, SCH_BASE_FRAME::AddToScreen(), EDA_ITEM::ClearFlags(), EE_ACTIONS::clearSelection, EESCHEMA_SETTINGS::DRAWING::default_repeat_offset_x, EESCHEMA_SETTINGS::DRAWING::default_repeat_offset_y, SCH_ITEM::Duplicate(), SCH_BASE_FRAME::GetCanvas(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), EDA_ITEM::GetPosition(), SCH_EDIT_FRAME::GetRepeatItem(), SCH_EDIT_FRAME::GetScreen(), TOOL_BASE::getViewControls(), IS_NEW, SCH_ITEM::IsConnectable(), LOCAL_CLEANUP, EESCHEMA_SETTINGS::m_Drawing, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, EE_ACTIONS::move, SCH_ITEM::Move(), NEWITEM, SCH_EDIT_FRAME::OnModify(), Pgm(), SCH_EDIT_FRAME::RecalculateConnections(), EDA_DRAW_PANEL_GAL::Refresh(), EESCHEMA_SETTINGS::DRAWING::repeat_label_increment, TOOL_MANAGER::RunAction(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_SYMBOL_T, EDA_ITEM::SetFlags(), EDA_BASE_FRAME::ShowInfoBarWarning(), SCH_EDIT_FRAME::TestDanglingEnds(), text, EE_ACTIONS::trimOverlappingWires, and EDA_ITEM::Type().

Referenced by setTransitions().

◆ Reset()

void EE_TOOL_BASE< SCH_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 SCH_EDIT_TOOL::Rotate ( const TOOL_EVENT aEvent)

Definition at line 436 of file sch_edit_tool.cpp.

437 {
438  bool clockwise = ( aEvent.Matches( EE_ACTIONS::rotateCW.MakeEvent() ) );
440 
441  if( selection.GetSize() == 0 )
442  return 0;
443 
444  SCH_ITEM* head = nullptr;
445  int principalItemCount = 0; // User-selected items (as opposed to connected wires)
446  wxPoint rotPoint;
447  bool moving = false;
448 
449  for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
450  {
451  SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
452 
453  if( item->HasFlag( TEMP_SELECTED ) )
454  continue;
455 
456  principalItemCount++;
457 
458  if( !head )
459  head = item;
460  }
461 
462  if( head && head->IsMoving() )
463  moving = true;
464 
465  if( principalItemCount == 1 )
466  {
467  if( moving && selection.HasReferencePoint() )
468  rotPoint = (wxPoint) selection.GetReferencePoint();
469  else
470  rotPoint = head->GetPosition();
471 
472  if( !moving )
474 
475  switch( head->Type() )
476  {
477  case SCH_SYMBOL_T:
478  {
479  SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( head );
480 
481  for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
482  symbol->Rotate( rotPoint );
483 
485  symbol->AutoAutoplaceFields( m_frame->GetScreen() );
486 
487  break;
488  }
489 
490  case SCH_TEXT_T:
491  case SCH_LABEL_T:
492  case SCH_GLOBAL_LABEL_T:
493  case SCH_HIER_LABEL_T:
494  {
495  SCH_TEXT* textItem = static_cast<SCH_TEXT*>( head );
496  textItem->Rotate90( clockwise );
497  break;
498  }
499 
500  case SCH_SHEET_PIN_T:
501  {
502  // Rotate pin within parent sheet
503  SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( head );
504  SCH_SHEET* sheet = pin->GetParent();
505 
506  for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
507  pin->Rotate( sheet->GetBodyBoundingBox().GetCenter() );
508 
509  break;
510  }
511 
512  case SCH_LINE_T:
513  {
514  SCH_LINE* line = static_cast<SCH_LINE*>( head );
515 
516  // Equal checks for both and neither. We need this because on undo
517  // the item will have both flags cleared, but will be selected, so it is possible
518  // for the user to get a selected line with neither endpoint selected. We
519  // set flags to make sure Rotate() works when we call it.
520  if( line->HasFlag( STARTPOINT ) == line->HasFlag( ENDPOINT ) )
521  {
522  line->SetFlags( STARTPOINT | ENDPOINT );
523  // When we allow off grid items, the rotPoint should be set to the midpoint
524  // of the line to allow rotation around the center, and the next if
525  // should become an else-if
526  }
527 
528  if( line->HasFlag( STARTPOINT ) )
529  rotPoint = line->GetEndPoint();
530  else if( line->HasFlag( ENDPOINT ) )
531  rotPoint = line->GetStartPoint();
532  }
533 
535  case SCH_BUS_BUS_ENTRY_T:
537  for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
538  head->Rotate( rotPoint );
539 
540  break;
541 
542  case SCH_FIELD_T:
543  {
544  SCH_FIELD* field = static_cast<SCH_FIELD*>( head );
545 
546  if( field->GetTextAngle() == TEXT_ANGLE_HORIZ )
547  field->SetTextAngle( TEXT_ANGLE_VERT );
548  else
549  field->SetTextAngle( TEXT_ANGLE_HORIZ );
550 
551  // Now that we're moving a field, they're no longer autoplaced.
552  static_cast<SCH_ITEM*>( head->GetParent() )->ClearFieldsAutoplaced();
553 
554  break;
555  }
556 
557  case SCH_BITMAP_T:
558  for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
559  head->Rotate( rotPoint );
560 
561  // The bitmap is cached in Opengl: clear the cache to redraw
563  break;
564 
565  case SCH_SHEET_T:
566  {
567  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( head );
568  rotPoint = m_frame->GetNearestHalfGridPosition( sheet->GetRotationCenter() );
569 
570  // Rotate the sheet on itself. Sheets do not have an anchor point.
571  for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
572  sheet->Rotate( rotPoint );
573 
574  break;
575  }
576 
577  default:
578  break;
579  }
580 
581  m_frame->UpdateItem( head, false, true );
582  }
583  else
584  {
585  if( moving && selection.HasReferencePoint() )
586  rotPoint = (wxPoint) selection.GetReferencePoint();
587  else
588  rotPoint = m_frame->GetNearestHalfGridPosition( (wxPoint) selection.GetCenter() );
589  }
590 
591  for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
592  {
593  SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
594 
595  // We've already rotated the user selected item if there was only one. We're just
596  // here to rotate the ends of wires that were attached to it.
597  if( principalItemCount == 1 && !item->HasFlag( TEMP_SELECTED ) )
598  continue;
599 
600  if( !moving )
601  saveCopyInUndoList( item, UNDO_REDO::CHANGED, ii > 0 );
602 
603  for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
604  {
605  if( item->Type() == SCH_LINE_T )
606  {
607  SCH_LINE* line = (SCH_LINE*) item;
608 
609  // If we are rotating more than one item, we do not have start/end
610  // points separately selected
611  if( item->HasFlag( STARTPOINT ) )
612  line->RotateStart( rotPoint );
613 
614  if( item->HasFlag( ENDPOINT ) )
615  line->RotateEnd( rotPoint );
616  }
617  else if( item->Type() == SCH_SHEET_PIN_T )
618  {
619  if( item->GetParent()->IsSelected() )
620  {
621  // parent will rotate us
622  }
623  else
624  {
625  // rotate within parent
626  SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
627  SCH_SHEET* sheet = pin->GetParent();
628 
629  pin->Rotate( sheet->GetBodyBoundingBox().GetCenter() );
630  }
631  }
632  else if( item->Type() == SCH_FIELD_T )
633  {
634  if( item->GetParent()->IsSelected() )
635  {
636  // parent will rotate us
637  }
638  else
639  {
640  SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
641 
642  field->Rotate( rotPoint );
643 
644  if( field->GetTextAngle() == TEXT_ANGLE_HORIZ )
645  field->SetTextAngle( TEXT_ANGLE_VERT );
646  else
647  field->SetTextAngle( TEXT_ANGLE_HORIZ );
648 
649  // Now that we're moving a field, they're no longer autoplaced.
650  static_cast<SCH_ITEM*>( field->GetParent() )->ClearFieldsAutoplaced();
651  }
652  }
653  else
654  {
655  item->Rotate( rotPoint );
656  }
657  }
658 
659  m_frame->UpdateItem( item, false, true );
660  updateItem( item, true );
661  }
662 
664 
665  if( moving )
666  {
668  }
669  else
670  {
671  if( selection.IsHover() )
673 
674  EE_SELECTION selectionCopy = selection;
675  m_toolMgr->RunAction( EE_ACTIONS::trimOverlappingWires, true, &selectionCopy );
676  m_toolMgr->RunAction( EE_ACTIONS::addNeededJunctions, true, &selectionCopy );
677 
680 
681  m_frame->OnModify();
682  }
683 
684  return 0;
685 }
VECTOR2I GetReferencePoint() const
Definition: selection.h:184
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: eda_text.h:71
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:49
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
#define STARTPOINT
When a line is selected, these flags indicate which.
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generate the connection data for the entire schematic hierarchy.
wxPoint GetStartPoint() const
Definition: sch_line.h:90
bool IsSelected() const
Definition: eda_item.h:122
void AutoAutoplaceFields(SCH_SCREEN *aScreen)
Autoplace fields only if correct to do so automatically.
Definition: sch_item.h:436
bool IsMoving() const
Definition: eda_item.h:119
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1385
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
Definition: eda_item.h:155
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:152
double GetTextAngle() const
Definition: eda_text.h:195
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.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:83
#define ENDPOINT
ends. (Used to support dragging.)
virtual wxPoint GetPosition() const
Definition: eda_item.h:251
virtual void Rotate(const wxPoint &aCenter)=0
Rotate the item around aCenter 90 degrees in the clockwise direction.
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
void Rotate(const wxPoint &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition: sch_sheet.cpp:797
static TOOL_ACTION rotateCW
Definition: ee_actions.h:117
EESCHEMA_SETTINGS * eeconfig() const
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...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
static TOOL_ACTION trimOverlappingWires
Definition: ee_actions.h:76
AUTOPLACE_FIELDS m_AutoplaceFields
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:134
EDA_ITEM * GetParent() const
Definition: eda_item.h:114
const KICAD_T rotatableItems[]
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false)
Mark an item for refresh.
const EDA_RECT GetBodyBoundingBox() const
Return a bounding box for the sheet body but not the fields.
Definition: sch_sheet.cpp:632
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
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:65
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static TOOL_ACTION addNeededJunctions
Definition: ee_actions.h:75
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
void Rotate(const wxPoint &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition: sch_field.cpp:562
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
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
virtual void Rotate90(bool aClockwise)
Definition: sch_text.cpp:312
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:88
bool HasReferencePoint() const
Definition: selection.h:179
Schematic symbol object.
Definition: sch_symbol.h:78
#define TEMP_SELECTED
flag indicating that the structure has already selected
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.cpp:53
void Rotate(const wxPoint &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
void RotateEnd(const wxPoint &aCenter)
Definition: sch_line.cpp:466
wxPoint GetRotationCenter() const
Rotating around the boundingBox's center can cause walking when the sheetname or filename is longer t...
Definition: sch_sheet.cpp:664
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
#define TEXT_ANGLE_VERT
Definition: eda_text.h:72
virtual void SetTextAngle(double aAngle)
Definition: eda_text.h:188
void RotateStart(const wxPoint &aCenter)
Definition: sch_line.cpp:460
const wxPoint GetCenter() const
Definition: eda_rect.h:113
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:182
static TOOL_ACTION refreshPreview
Definition: actions.h:106
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
wxPoint GetEndPoint() const
Definition: sch_line.h:93

References EE_ACTIONS::addNeededJunctions, SCH_ITEM::AutoAutoplaceFields(), CHANGED, EE_ACTIONS::clearSelection, SCH_BASE_FRAME::eeconfig(), EESCHEMA_SETTINGS::AUTOPLACE_FIELDS::enable, ENDPOINT, SCH_SHEET::GetBodyBoundingBox(), EDA_RECT::GetCenter(), SELECTION::GetCenter(), SCH_LINE::GetEndPoint(), SELECTION::GetItem(), EDA_DRAW_FRAME::GetNearestHalfGridPosition(), EDA_ITEM::GetParent(), EDA_ITEM::GetPosition(), SELECTION::GetReferencePoint(), SCH_SHEET::GetRotationCenter(), SCH_EDIT_FRAME::GetScreen(), SELECTION::GetSize(), SCH_LINE::GetStartPoint(), EDA_TEXT::GetTextAngle(), TOOL_BASE::getView(), EDA_ITEM::HasFlag(), SELECTION::HasReferencePoint(), SELECTION::IsHover(), EDA_ITEM::IsMoving(), EDA_ITEM::IsSelected(), KI_FALLTHROUGH, LOCAL_CLEANUP, EESCHEMA_SETTINGS::m_AutoplaceFields, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, TOOL_EVENT::Matches(), SCH_EDIT_FRAME::OnModify(), pin, TOOL_MANAGER::PostEvent(), KIGFX::VIEW::RecacheAllItems(), SCH_EDIT_FRAME::RecalculateConnections(), ACTIONS::refreshPreview, EE_SELECTION_TOOL::RequestSelection(), rotatableItems, SCH_FIELD::Rotate(), SCH_ITEM::Rotate(), SCH_SHEET::Rotate(), SCH_SYMBOL::Rotate(), SCH_TEXT::Rotate90(), EE_ACTIONS::rotateCW, SCH_LINE::RotateEnd(), SCH_LINE::RotateStart(), TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList(), SCH_BITMAP_T, SCH_BUS_BUS_ENTRY_T, SCH_BUS_WIRE_ENTRY_T, SCH_FIELD_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_LINE_T, SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_SYMBOL_T, SCH_TEXT_T, EVENTS::SelectedItemsModified, EDA_ITEM::SetFlags(), EDA_TEXT::SetTextAngle(), STARTPOINT, TEMP_SELECTED, SCH_EDIT_FRAME::TestDanglingEnds(), TEXT_ANGLE_HORIZ, TEXT_ANGLE_VERT, EE_ACTIONS::trimOverlappingWires, EDA_ITEM::Type(), EE_TOOL_BASE< SCH_EDIT_FRAME >::updateItem(), 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< SCH_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 SCH_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 1826 of file sch_edit_tool.cpp.

1827 {
1831  Go( &SCH_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorV.MakeEvent() );
1832  Go( &SCH_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorH.MakeEvent() );
1833  Go( &SCH_EDIT_TOOL::DoDelete, ACTIONS::doDelete.MakeEvent() );
1835 
1852 
1855 
1859 }
static TOOL_ACTION editPageNumber
Definition: ee_actions.h:155
static TOOL_ACTION properties
Definition: ee_actions.h:121
static TOOL_ACTION toggleDeMorgan
Definition: ee_actions.h:126
static TOOL_ACTION breakBus
Definition: ee_actions.h:135
static TOOL_ACTION doDelete
Definition: actions.h:72
int Rotate(const TOOL_EVENT &aEvent)
static TOOL_ACTION changeSymbol
Definition: ee_actions.h:149
int EditPageNumber(const TOOL_EVENT &aEvent)
int BreakWire(const TOOL_EVENT &aEvent)
static TOOL_ACTION toText
Definition: ee_actions.h:133
static TOOL_ACTION autoplaceFields
Definition: ee_actions.h:125
int Properties(const TOOL_EVENT &aEvent)
static TOOL_ACTION updateSymbols
Definition: ee_actions.h:148
static TOOL_ACTION mirrorH
Definition: ee_actions.h:120
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:128
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 breakWire
Definition: ee_actions.h:134
static TOOL_ACTION mirrorV
Definition: ee_actions.h:119
static TOOL_ACTION rotateCW
Definition: ee_actions.h:117
static TOOL_ACTION cleanupSheetPins
Definition: ee_actions.h:192
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:118
int GlobalEdit(const TOOL_EVENT &aEvent)
Delete the selected items, or the item under the cursor.
static TOOL_ACTION editFootprint
Definition: ee_actions.h:124
static TOOL_ACTION updateSymbol
Definition: ee_actions.h:150
int AutoplaceFields(const TOOL_EVENT &aEvent)
static TOOL_ACTION repeatDrawItem
Definition: ee_actions.h:116
int CleanupSheetPins(const TOOL_EVENT &aEvent)
static TOOL_ACTION editTextAndGraphics
Definition: ee_actions.h:193
int DeleteItemCursor(const TOOL_EVENT &aEvent)
static TOOL_ACTION showDeMorganStandard
Definition: ee_actions.h:127
int Mirror(const TOOL_EVENT &aEvent)
int RepeatDrawItem(const TOOL_EVENT &aEvent)
static TOOL_ACTION editValue
Definition: ee_actions.h:123
int EditField(const TOOL_EVENT &aEvent)
static TOOL_ACTION changeSymbols
Definition: ee_actions.h:147
int ChangeSymbols(const TOOL_EVENT &aEvent)
static TOOL_ACTION deleteTool
Definition: actions.h:73
static TOOL_ACTION toLabel
Definition: ee_actions.h:130
static TOOL_ACTION toHLabel
Definition: ee_actions.h:131
static TOOL_ACTION editReference
Definition: ee_actions.h:122
int DoDelete(const TOOL_EVENT &aEvent)
Run the deletion tool.
static TOOL_ACTION toGLabel
Definition: ee_actions.h:132
int ConvertDeMorgan(const TOOL_EVENT &aEvent)
int ChangeTextType(const TOOL_EVENT &aEvent)
Change a text type to another one.

References AutoplaceFields(), EE_ACTIONS::autoplaceFields, EE_ACTIONS::breakBus, BreakWire(), EE_ACTIONS::breakWire, EE_ACTIONS::changeSymbol, ChangeSymbols(), EE_ACTIONS::changeSymbols, ChangeTextType(), CleanupSheetPins(), EE_ACTIONS::cleanupSheetPins, ConvertDeMorgan(), DeleteItemCursor(), ACTIONS::deleteTool, ACTIONS::doDelete, DoDelete(), EditField(), EE_ACTIONS::editFootprint, EditPageNumber(), EE_ACTIONS::editPageNumber, EE_ACTIONS::editReference, EE_ACTIONS::editTextAndGraphics, EE_ACTIONS::editValue, GlobalEdit(), TOOL_INTERACTIVE::Go(), Mirror(), EE_ACTIONS::mirrorH, EE_ACTIONS::mirrorV, Properties(), EE_ACTIONS::properties, RepeatDrawItem(), EE_ACTIONS::repeatDrawItem, Rotate(), EE_ACTIONS::rotateCCW, EE_ACTIONS::rotateCW, EE_ACTIONS::showDeMorganAlternate, EE_ACTIONS::showDeMorganStandard, EE_ACTIONS::toggleDeMorgan, EE_ACTIONS::toGLabel, EE_ACTIONS::toHLabel, EE_ACTIONS::toLabel, EE_ACTIONS::toText, EE_ACTIONS::updateSymbol, and EE_ACTIONS::updateSymbols.

◆ updateItem()

void EE_TOOL_BASE< SCH_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.

◆ 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

SCH_EDIT_FRAME * EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame
protectedinherited

Definition at line 177 of file ee_tool_base.h.

◆ m_isSymbolEditor

bool EE_TOOL_BASE< SCH_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(), 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* SCH_EDIT_TOOL::m_pickerItem
private

Definition at line 87 of file sch_edit_tool.h.

Referenced by DeleteItemCursor(), and SCH_EDIT_TOOL().

◆ m_selectionTool

EE_SELECTION_TOOL* EE_TOOL_BASE< SCH_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(), AutoplaceFields(), BreakWire(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), 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(), ConvertDeMorgan(), PL_EDIT_TOOL::Copy(), SYMBOL_EDITOR_EDIT_TOOL::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(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), 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(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), EditField(), editFieldText(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editShapeProperties(), SYMBOL_EDITOR_EDIT_TOOL::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(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), 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(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), 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(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_EDIT_TOOL::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(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::recombinePad(), SYMBOL_EDITOR_EDIT_TOOL::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(), 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(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), 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(), SYMBOL_EDITOR_EDIT_TOOL::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< SCH_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: