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 Duplicate (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 78 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ SCH_EDIT_TOOL()

SCH_EDIT_TOOL::SCH_EDIT_TOOL ( )

Definition at line 130 of file sch_edit_tool.cpp.

130  :
131  EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveEdit" )
132 {
133  m_pickerItem = nullptr;
134 }
EDA_ITEM * m_pickerItem
Definition: sch_edit_tool.h:88

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:215
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210
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(), BOARD_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), 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(), 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(), SCH_DRAWING_TOOLS::PlaceComponent(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), 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:215

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ AutoplaceFields()

int SCH_EDIT_TOOL::AutoplaceFields ( const TOOL_EVENT aEvent)

Definition at line 1246 of file sch_edit_tool.cpp.

1247 {
1249 
1250  if( selection.Empty() )
1251  return 0;
1252 
1253  SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.Front() );
1254 
1255  if( !item->IsNew() )
1257 
1258  item->AutoplaceFields( m_frame->GetScreen(), /* aManual */ true );
1259 
1260  updateItem( item, true );
1261  m_frame->OnModify();
1262 
1263  if( selection.IsHover() )
1265 
1266  return 0;
1267 }
bool IsHover() const
Definition: selection.h:72
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
static const KICAD_T FieldOwners[]
Definition: ee_collectors.h:51
bool IsNew() const
Definition: eda_item.h:168
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:133
virtual void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual)
Definition: sch_item.h:466
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:122
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:102
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:196
EDA_ITEM * Front() const
Definition: selection.h:203

References SCH_ITEM::AutoplaceFields(), CHANGED, EE_ACTIONS::clearSelection, SELECTION::Empty(), EE_COLLECTOR::FieldOwners, SELECTION::Front(), SCH_EDIT_FRAME::GetScreen(), 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, SCH_EDIT_FRAME::OnModify(), EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList(), and EE_TOOL_BASE< SCH_EDIT_FRAME >::updateItem().

Referenced by setTransitions().

◆ BreakWire()

int SCH_EDIT_TOOL::BreakWire ( const TOOL_EVENT aEvent)

Definition at line 1684 of file sch_edit_tool.cpp.

1685 {
1686  wxPoint cursorPos = wxPoint( getViewControls()->GetCursorPosition( !aEvent.Modifier( MD_ALT ) ) );
1688 
1689  std::vector<SCH_LINE*> lines;
1690 
1691  for( auto& item : selection )
1692  {
1693  if( SCH_LINE* line = dyn_cast<SCH_LINE*>( item ) )
1694  {
1695  if( !line->IsEndPoint( cursorPos ) )
1696  lines.push_back( line );
1697  }
1698  }
1699 
1701  m_frame->StartNewUndo();
1702 
1703  for( SCH_LINE* line : lines )
1704  m_frame->BreakSegment( line, cursorPos );
1705 
1706  if( !lines.empty() )
1707  {
1708  if( m_frame->GetScreen()->IsJunctionNeeded( cursorPos, true ) )
1709  m_frame->AddJunction( m_frame->GetScreen(), cursorPos, true, false );
1710 
1712 
1713  m_frame->OnModify();
1714  m_frame->GetCanvas()->Refresh();
1715 
1717  }
1718 
1719  return 0;
1720 }
void StartNewUndo()
Create a new, blank stack for future Undo commands to be pushed to.
bool IsJunctionNeeded(const wxPoint &aPosition, bool aNew=false)
Test if a junction is required for the items at aPosition on the screen.
Definition: sch_screen.cpp:373
bool BreakSegment(SCH_LINE *aSegment, const wxPoint &aPoint, SCH_LINE **aNewSegment=NULL, SCH_SCREEN *aScreen=nullptr)
Breaks a single segment into two at the specified point.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
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:176
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
int Modifier(int aMask=MD_MODIFIER_MASK) const
Definition: tool_event.h:352
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:112
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
static const KICAD_T WiresOnly[]
Definition: ee_collectors.h:50

References SCH_EDIT_FRAME::AddJunction(), SCH_EDIT_FRAME::BreakSegment(), EE_SELECTION_TOOL::ClearSelection(), EE_ACTIONS::drag, SCH_BASE_FRAME::GetCanvas(), SCH_EDIT_FRAME::GetScreen(), TOOL_BASE::getViewControls(), SCH_SCREEN::IsJunctionNeeded(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, MD_ALT, TOOL_EVENT::Modifier(), SCH_EDIT_FRAME::OnModify(), 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 1270 of file sch_edit_tool.cpp.

1271 {
1272  SCH_COMPONENT* selectedSymbol = nullptr;
1274 
1275  if( !selection.Empty() )
1276  selectedSymbol = dynamic_cast<SCH_COMPONENT*>( selection.Front() );
1277 
1279 
1280  if( aEvent.IsAction( &EE_ACTIONS::changeSymbol )
1281  || aEvent.IsAction( &EE_ACTIONS::changeSymbols ) )
1282  {
1284  }
1285 
1286  DIALOG_CHANGE_SYMBOLS dlg( m_frame, selectedSymbol, mode );
1287 
1288  dlg.ShowQuasiModal();
1289 
1290  return 0;
1291 }
static TOOL_ACTION changeSymbol
Definition: ee_actions.h:146
static const KICAD_T ComponentsOnly[]
Definition: ee_collectors.h:48
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:70
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:176
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:122
Schematic symbol object.
Definition: sch_symbol.h:78
static TOOL_ACTION changeSymbols
Definition: ee_actions.h:144
EDA_ITEM * Front() const
Definition: selection.h:203

References DIALOG_CHANGE_SYMBOLS::CHANGE, EE_ACTIONS::changeSymbol, EE_ACTIONS::changeSymbols, EE_COLLECTOR::ComponentsOnly, 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(), 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 1583 of file sch_edit_tool.cpp.

1584 {
1585  KICAD_T convertTo = aEvent.Parameter<KICAD_T>();
1587  EE_SELECTION& selection = m_selectionTool->RequestSelection( allTextTypes );
1588 
1589  for( unsigned int i = 0; i < selection.GetSize(); ++i )
1590  {
1591  SCH_TEXT* text = dynamic_cast<SCH_TEXT*>( selection.GetItem( i ) );
1592 
1593  if( text && text->Type() != convertTo )
1594  {
1595  bool selected = text->IsSelected();
1596  SCH_TEXT* newtext = nullptr;
1597  const wxPoint& position = text->GetPosition();
1598  LABEL_SPIN_STYLE orientation = text->GetLabelSpinStyle();
1599  wxString txt = UnescapeString( text->GetText() );
1600 
1601  // There can be characters in a SCH_TEXT object that can break labels so we have to
1602  // fix them here.
1603  if( text->Type() == SCH_TEXT_T )
1604  {
1605  txt.Replace( "\n", "_" );
1606  txt.Replace( "\r", "_" );
1607  txt.Replace( "\t", "_" );
1608  txt.Replace( " ", "_" );
1609  }
1610 
1611  // label strings are "escaped" i.e. a '/' is replaced by "{slash}"
1612  if( convertTo != SCH_TEXT_T )
1613  txt = EscapeString( txt, CTX_NETNAME );
1614 
1615  switch( convertTo )
1616  {
1617  case SCH_LABEL_T: newtext = new SCH_LABEL( position, txt ); break;
1618  case SCH_GLOBAL_LABEL_T: newtext = new SCH_GLOBALLABEL( position, txt ); break;
1619  case SCH_HIER_LABEL_T: newtext = new SCH_HIERLABEL( position, txt ); break;
1620  case SCH_TEXT_T: newtext = new SCH_TEXT( position, txt ); break;
1621 
1622  default:
1623  wxFAIL_MSG( wxString::Format( "Invalid text type: %d.", convertTo ) );
1624  return 0;
1625  }
1626 
1627  // Copy the old text item settings to the new one. Justifications are not copied
1628  // because they are not used in labels. Justifications will be set to default value
1629  // in the new text item type.
1630  //
1631  newtext->SetFlags( text->GetEditFlags() );
1632  newtext->SetShape( text->GetShape() );
1633  newtext->SetLabelSpinStyle( orientation );
1634  newtext->SetTextSize( text->GetTextSize() );
1635  newtext->SetTextThickness( text->GetTextThickness() );
1636  newtext->SetItalic( text->IsItalic() );
1637  newtext->SetBold( text->IsBold() );
1638  newtext->SetIsDangling( text->IsDangling() );
1639 
1640  if( selected )
1642 
1643  if( !text->IsNew() )
1644  {
1646  saveCopyInUndoList( newtext, UNDO_REDO::NEWITEM, true );
1647 
1649  m_frame->AddToScreen( newtext, m_frame->GetScreen() );
1650 
1651  if( convertTo == SCH_GLOBAL_LABEL_T )
1652  static_cast<SCH_GLOBALLABEL*>( newtext )->UpdateIntersheetRefProps();
1653  }
1654 
1655  if( selected )
1656  m_toolMgr->RunAction( EE_ACTIONS::addItemToSel, true, newtext );
1657 
1658  // Otherwise, pointer is owned by the undo stack
1659  if( text->IsNew() )
1660  delete text;
1661 
1662  if( convertTo == SCH_TEXT_T )
1663  {
1664  if( newtext->IsDangling() )
1665  {
1666  newtext->SetIsDangling( false );
1667  getView()->Update( newtext, KIGFX::REPAINT );
1668  }
1669  }
1670  else
1672 
1673  m_frame->OnModify();
1674  }
1675  }
1676 
1677  if( selection.IsHover() )
1679 
1680  return 0;
1681 }
bool IsDangling() const override
Definition: sch_text.h:303
bool IsBold() const
Definition: eda_text.h:190
void SetShape(PINSHEETLABEL_SHAPE aShape)
Definition: sch_text.h:237
bool IsHover() const
Definition: selection.h:72
bool IsSelected() const
Definition: eda_item.h:172
void SetItalic(bool isItalic)
Definition: eda_text.h:186
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
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:244
void SetIsDangling(bool aIsDangling)
Definition: sch_text.h:304
int GetTextThickness() const
Definition: eda_text.h:167
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 IsNew() const
Definition: eda_item.h:168
static TOOL_ACTION removeItemFromSel
Definition: ee_actions.h:58
bool IsItalic() const
Definition: eda_text.h:187
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:57
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:202
static TOOL_ACTION addItemToSel
Selects an item (specified as the event parameter).
Definition: ee_actions.h:57
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:133
STATUS_FLAGS GetEditFlags() const
Definition: eda_item.h:207
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:443
const wxSize & GetTextSize() const
Definition: eda_text.h:245
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
LABEL_SPIN_STYLE GetLabelSpinStyle() const
Definition: sch_text.h:233
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.h:106
wxPoint GetPosition() const override
Definition: sch_text.h:312
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:101
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,...
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:150
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
These Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which ar...
Definition: string.cpp:77
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.h:166
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
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:248
void SetBold(bool aBold)
Definition: eda_text.h:189
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133
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:1508
PINSHEETLABEL_SHAPE GetShape() const
Definition: sch_text.h:235
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162

References EE_ACTIONS::addItemToSel, SCH_BASE_FRAME::AddToScreen(), EE_ACTIONS::clearSelection, CTX_NETNAME, DELETED, EOT, EscapeString(), Format(), EDA_ITEM::GetEditFlags(), SELECTION::GetItem(), SCH_TEXT::GetLabelSpinStyle(), SCH_TEXT::GetPosition(), SCH_EDIT_FRAME::GetScreen(), SCH_TEXT::GetShape(), SELECTION::GetSize(), EDA_TEXT::GetText(), EDA_TEXT::GetTextSize(), EDA_TEXT::GetTextThickness(), TOOL_BASE::getView(), EDA_TEXT::IsBold(), SCH_TEXT::IsDangling(), SELECTION::IsHover(), EDA_TEXT::IsItalic(), EDA_ITEM::IsNew(), EDA_ITEM::IsSelected(), 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(), EDA_ITEM::Type(), UnescapeString(), and KIGFX::VIEW::Update().

Referenced by setTransitions().

◆ CleanupSheetPins()

int SCH_EDIT_TOOL::CleanupSheetPins ( const TOOL_EVENT aEvent)

Definition at line 1723 of file sch_edit_tool.cpp.

1724 {
1726  SCH_SHEET* sheet = (SCH_SHEET*) selection.Front();
1727 
1728  if( !sheet )
1729  return 0;
1730 
1731  if( !sheet->HasUndefinedPins() )
1732  {
1733  DisplayInfoMessage( m_frame, _( "There are no unreferenced pins in this sheet to remove." ) );
1734  return 0;
1735  }
1736 
1737  if( !IsOK( m_frame, _( "Do you wish to delete the unreferenced pins from this sheet?" ) ) )
1738  return 0;
1739 
1741 
1742  sheet->CleanupSheet();
1743 
1744  updateItem( sheet, true );
1745  m_frame->OnModify();
1746 
1747  if( selection.IsHover() )
1749 
1750  return 0;
1751 }
bool IsHover() const
Definition: selection.h:72
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
bool HasUndefinedPins() const
Check all sheet labels against schematic for undefined hierarchical labels.
Definition: sch_sheet.cpp:371
static const KICAD_T SheetsOnly[]
Definition: ee_collectors.h:49
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:133
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
void CleanupSheet()
Delete sheet label which do not have a corresponding hierarchical label.
Definition: sch_sheet.cpp:473
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:102
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:219
#define _(s)
Definition: 3d_actions.cpp:33
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:280
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:296
EDA_ITEM * Front() const
Definition: selection.h:203

References _, CHANGED, SCH_SHEET::CleanupSheet(), EE_ACTIONS::clearSelection, DisplayInfoMessage(), 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 1294 of file sch_edit_tool.cpp.

1295 {
1297 
1298  if( selection.Empty() )
1299  return 0;
1300 
1301  SCH_COMPONENT* component = (SCH_COMPONENT*) selection.Front();
1302 
1304  && component->GetConvert() == LIB_ITEM::LIB_CONVERT::BASE )
1305  {
1306  return 0;
1307  }
1308 
1310  && component->GetConvert() != LIB_ITEM::LIB_CONVERT::DEMORGAN )
1311  {
1312  return 0;
1313  }
1314 
1315  if( !component->IsNew() )
1316  saveCopyInUndoList( component, UNDO_REDO::CHANGED );
1317 
1318  m_frame->ConvertPart( component );
1319 
1320  if( component->IsNew() )
1322 
1323  if( selection.IsHover() )
1325 
1326  return 0;
1327 }
bool IsHover() const
Definition: selection.h:72
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
static const KICAD_T ComponentsOnly[]
Definition: ee_collectors.h:48
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:125
bool IsNew() const
Definition: eda_item.h:168
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:70
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:133
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
static TOOL_ACTION showDeMorganStandard
Definition: ee_actions.h:124
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:122
Schematic symbol object.
Definition: sch_symbol.h:78
int GetConvert() const
Definition: sch_symbol.h:264
void ConvertPart(SCH_COMPONENT *aComponent)
Definition: getpart.cpp:237
static TOOL_ACTION refreshPreview
Definition: actions.h:109
EDA_ITEM * Front() const
Definition: selection.h:203

References CHANGED, EE_ACTIONS::clearSelection, EE_COLLECTOR::ComponentsOnly, SCH_EDIT_FRAME::ConvertPart(), SELECTION::Empty(), SELECTION::Front(), SCH_COMPONENT::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, and EE_ACTIONS::showDeMorganStandard.

Referenced by setTransitions().

◆ DeleteItemCursor()

int SCH_EDIT_TOOL::DeleteItemCursor ( const TOOL_EVENT aEvent)

Definition at line 1093 of file sch_edit_tool.cpp.

1094 {
1095  std::string tool = aEvent.GetCommandStr().get();
1096  PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
1097 
1099  m_pickerItem = nullptr;
1100 
1101  // Deactivate other tools; particularly important if another PICKER is currently running
1102  Activate();
1103 
1104  picker->SetCursor( KICURSOR::REMOVE );
1105  picker->SetSnapping( false );
1106 
1107  picker->SetClickHandler(
1108  [this]( const VECTOR2D& aPosition ) -> bool
1109  {
1110  if( m_pickerItem )
1111  {
1112  SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( m_pickerItem );
1113 
1114  if( sch_item && sch_item->IsLocked() )
1115  {
1116  STATUS_TEXT_POPUP statusPopup( m_frame );
1117  statusPopup.SetText( _( "Item locked." ) );
1118  statusPopup.PopupFor( 2000 );
1119  statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
1120  return true;
1121  }
1122 
1124  selectionTool->UnbrightenItem( m_pickerItem );
1125  selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
1127  m_pickerItem = nullptr;
1128  }
1129 
1130  return true;
1131  } );
1132 
1133  picker->SetMotionHandler(
1134  [this]( const VECTOR2D& aPos )
1135  {
1136  EE_COLLECTOR collector;
1137  collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
1138  collector.Collect( m_frame->GetScreen(), deletableItems, (wxPoint) aPos );
1139 
1141  selectionTool->GuessSelectionCandidates( collector, aPos );
1142 
1143  EDA_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr;
1144 
1145  if( m_pickerItem != item )
1146  {
1147  if( m_pickerItem )
1148  selectionTool->UnbrightenItem( m_pickerItem );
1149 
1150  m_pickerItem = item;
1151 
1152  if( m_pickerItem )
1153  selectionTool->BrightenItem( m_pickerItem );
1154  }
1155  } );
1156 
1157  picker->SetFinalizeHandler(
1158  [this]( const int& aFinalState )
1159  {
1160  if( m_pickerItem )
1162 
1163  // Wake the selection tool after exiting to ensure the cursor gets updated
1165  } );
1166 
1167  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
1168 
1169  return 0;
1170 }
#define HITTEST_THRESHOLD_PIXELS
int m_Threshold
Definition: collector.h:248
static TOOL_ACTION doDelete
Definition: actions.h:75
void Collect(SCH_SCREEN *aScreen, const KICAD_T aFilterList[], const wxPoint &aPos, int aUnit=0, int aConvert=0)
Function Collect scans a EDA_ITEM using this class's Inspector method, which does the collection.
Extension of STATUS_POPUP for displaying a single line text.
Definition: status_popup.h:79
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
EE_COLLECTOR.
Definition: ee_collectors.h:42
void SetFinalizeHandler(FINALIZE_HANDLER aHandler)
Set a handler for the finalize event.
Definition: picker_tool.h:100
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:158
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:87
void BrightenItem(EDA_ITEM *aItem)
void SetMotionHandler(MOTION_HANDLER aHandler)
Set a handler for mouse motion.
Definition: picker_tool.h:80
static TOOL_ACTION selectionActivate
Activation of the selection tool.
Definition: ee_actions.h:44
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
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:60
EDA_ITEM * m_pickerItem
Definition: sch_edit_tool.h:88
void SetClickHandler(CLICK_HANDLER aHandler)
Set a handler for mouse click event.
Definition: picker_tool.h:69
virtual bool IsLocked() const
Definition: sch_item.h:270
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:471
static KICAD_T deletableItems[]
int AddItemToSel(const TOOL_EVENT &aEvent)
#define _(s)
Definition: 3d_actions.cpp:33
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:149
void Activate()
Run the tool.
void SetSnapping(bool aSnap)
Definition: picker_tool.h:62
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:196

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, SCH_ITEM::IsLocked(), KiROUND(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_pickerItem, COLLECTOR::m_Threshold, TOOL_BASE::m_toolMgr, STATUS_POPUP::Move(), ACTIONS::pickerTool, STATUS_POPUP::PopupFor(), 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(), STATUS_TEXT_POPUP::SetText(), 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 1005 of file sch_edit_tool.cpp.

1006 {
1007  SCH_SCREEN* screen = m_frame->GetScreen();
1009  bool appendToUndo = false;
1010  std::vector<wxPoint> pts;
1011 
1012  if( items.empty() )
1013  return 0;
1014 
1015  // Don't leave a freed pointer in the selection
1017 
1018  for( EDA_ITEM* item : items )
1019  item->ClearFlags( STRUCT_DELETED );
1020 
1021  for( EDA_ITEM* item : items )
1022  {
1023  SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item );
1024 
1025  if( !sch_item )
1026  continue;
1027 
1028  if( sch_item->IsConnectable() )
1029  {
1030  std::vector<wxPoint> tmp_pts = sch_item->GetConnectionPoints();
1031  pts.insert( pts.end(), tmp_pts.begin(), tmp_pts.end() );
1032  }
1033 
1034  if( sch_item->Type() == SCH_JUNCTION_T )
1035  {
1036  sch_item->SetFlags( STRUCT_DELETED );
1037  // clean up junctions at the end
1038  }
1039  else if( sch_item->Type() == SCH_SHEET_PIN_T )
1040  {
1041  SCH_SHEET_PIN* pin = (SCH_SHEET_PIN*) sch_item;
1042  SCH_SHEET* sheet = pin->GetParent();
1043 
1044  if( !alg::contains( items, sheet ) )
1045  {
1046  pin->SetFlags( STRUCT_DELETED );
1047  saveCopyInUndoList( item, UNDO_REDO::DELETED, appendToUndo );
1048  appendToUndo = true;
1049 
1050  updateItem( pin, false );
1051 
1052  sheet->RemovePin( pin );
1053  }
1054  }
1055  else
1056  {
1057  sch_item->SetFlags( STRUCT_DELETED );
1058  saveCopyInUndoList( item, UNDO_REDO::DELETED, appendToUndo );
1059  appendToUndo = true;
1060 
1061  updateItem( sch_item, false );
1062 
1063  m_frame->RemoveFromScreen( sch_item, m_frame->GetScreen() );
1064 
1065  if( sch_item->Type() == SCH_SHEET_T )
1067  }
1068  }
1069 
1070  for( auto point : pts )
1071  {
1072  SCH_ITEM* junction = screen->GetItem( point, 0, SCH_JUNCTION_T );
1073 
1074  if( !junction )
1075  continue;
1076 
1077  if( junction->HasFlag( STRUCT_DELETED ) || !screen->IsJunctionNeeded( point ) )
1078  m_frame->DeleteJunction( junction, appendToUndo );
1079  }
1080 
1082 
1083  m_frame->GetCanvas()->Refresh();
1084  m_frame->OnModify();
1085 
1086  return 0;
1087 }
virtual bool IsConnectable() const
Definition: sch_item.h:376
SCH_SHEET * GetParent() const
Get the parent sheet object of this sheet pin.
Definition: sch_sheet.h:169
virtual std::vector< wxPoint > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Definition: sch_item.h:390
bool IsJunctionNeeded(const wxPoint &aPosition, bool aNew=false)
Test if a junction is required for the items at aPosition on the screen.
Definition: sch_screen.cpp:373
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
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 SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:202
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:133
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
const std::deque< EDA_ITEM * > GetItems() const
Definition: selection.h:133
void UpdateHierarchyNavigator(bool aForceUpdate=false)
Run the Hierarchy Navigator dialog.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
#define STRUCT_DELETED
flag indication structures to be erased
Definition: eda_item.h:115
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:85
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:81
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
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:102
void RemovePin(const SCH_SHEET_PIN *aSheetPin)
Remove aSheetPin from the sheet.
Definition: sch_sheet.cpp:309
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:219
static KICAD_T deletableItems[]
void DeleteJunction(SCH_ITEM *aItem, bool aAppend=false)
Removes a given junction and heals any wire segments under the junction.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:149
SCH_ITEM * GetItem(const wxPoint &aPosition, int aAccuracy=0, KICAD_T aType=SCH_LOCATE_ANY_T)
Check aPosition within a distance of aAccuracy for items of type aFilter.
Definition: sch_screen.cpp:312
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:196
bool HasFlag(STATUS_FLAGS aFlag) const
Definition: eda_item.h:205
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162

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_SHEET_PIN::GetParent(), SCH_EDIT_FRAME::GetScreen(), EDA_ITEM::HasFlag(), SCH_ITEM::IsConnectable(), SCH_SCREEN::IsJunctionNeeded(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, SCH_EDIT_FRAME::OnModify(), 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().

◆ Duplicate()

int SCH_EDIT_TOOL::Duplicate ( const TOOL_EVENT aEvent)

Definition at line 800 of file sch_edit_tool.cpp.

801 {
803 
804  if( selection.GetSize() == 0 )
805  return 0;
806 
807  // Doing a duplicate of a new object doesn't really make any sense; we'd just end
808  // up dragging around a stack of objects...
809  if( selection.Front()->IsNew() )
810  return 0;
811 
812  EDA_ITEMS newItems;
813 
814  // Keep track of existing sheet paths. Duplicating a selection can modify this list
815  bool copiedSheets = false;
816  SCH_SHEET_LIST initial_sheetpathList = m_frame->Schematic().GetSheets();
817 
818  for( unsigned ii = 0; ii < selection.GetSize(); ++ii )
819  {
820  SCH_ITEM* oldItem = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
821  SCH_ITEM* newItem = oldItem->Duplicate();
822  newItem->SetFlags( IS_NEW );
823  newItems.push_back( newItem );
824  saveCopyInUndoList( newItem, UNDO_REDO::NEWITEM, ii > 0 );
825 
826  switch( newItem->Type() )
827  {
828  case SCH_JUNCTION_T:
829  case SCH_LINE_T:
830  case SCH_BUS_BUS_ENTRY_T:
832  case SCH_TEXT_T:
833  case SCH_LABEL_T:
834  case SCH_GLOBAL_LABEL_T:
835  case SCH_HIER_LABEL_T:
836  case SCH_NO_CONNECT_T:
837  newItem->SetParent( m_frame->GetScreen() );
838  m_frame->AddToScreen( newItem, m_frame->GetScreen() );
839  break;
840 
841  case SCH_SHEET_T:
842  {
843  SCH_SHEET_LIST hierarchy = m_frame->Schematic().GetSheets();
844  SCH_SHEET* sheet = (SCH_SHEET*) newItem;
845  SCH_FIELD& nameField = sheet->GetFields()[SHEETNAME];
846  wxString baseName = nameField.GetText();
847  wxString number;
848 
849  while( !baseName.IsEmpty() && wxIsdigit( baseName.Last() ) )
850  {
851  number = baseName.Last() + number;
852  baseName.RemoveLast();
853  }
854 
855  int uniquifier = std::max( 0, wxAtoi( number ) ) + 1;
856  wxString candidateName = wxString::Format( wxT( "%s%d" ), baseName, uniquifier++ );
857 
858  while( hierarchy.NameExists( candidateName ) )
859  candidateName = wxString::Format( wxT( "%s%d" ), baseName, uniquifier++ );
860 
861  nameField.SetText( candidateName );
862 
863  sheet->SetParent( m_frame->GetCurrentSheet().Last() );
864  m_frame->AddToScreen( sheet, m_frame->GetScreen() );
865 
866  copiedSheets = true;
867  break;
868  }
869 
870  case SCH_COMPONENT_T:
871  {
872  SCH_COMPONENT* component = (SCH_COMPONENT*) newItem;
873  component->ClearAnnotation( NULL );
874  component->SetParent( m_frame->GetScreen() );
875  m_frame->AddToScreen( component, m_frame->GetScreen() );
876  break;
877  }
878 
879  default:
880  break;
881  }
882  }
883 
884  if( copiedSheets )
885  {
886  // We clear annotation of new sheet paths.
887  // Annotation of new components added in current sheet is already cleared.
888  SCH_SCREENS screensList( &m_frame->Schematic().Root() );
889  screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
891  }
892 
894  m_toolMgr->RunAction( EE_ACTIONS::addItemsToSel, true, &newItems );
896 
897  return 0;
898 }
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:51
static KICAD_T duplicatableItems[]
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
static TOOL_ACTION addItemsToSel
Selects a list of items (specified as the event parameter)
Definition: ee_actions.h:61
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:165
bool IsNew() const
Definition: eda_item.h:168
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...
std::vector< SCH_FIELD > & GetFields()
Definition: sch_sheet.h:270
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:202
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:121
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
Definition: sch_item.cpp:78
#define NULL
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:133
SCHEMATIC & Schematic() const
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: eda_item.h:556
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.h:106
bool NameExists(const wxString &aSheetName)
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:219
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:101
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
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:111
SCH_SHEET & Root() const
Definition: schematic.h:116
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 SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
Schematic symbol object.
Definition: sch_symbol.h:78
SCH_SHEET_PATH & GetCurrentSheet() const
static TOOL_ACTION move
Definition: ee_actions.h:111
void ClearAnnotationOfNewSheetPaths(SCH_SHEET_LIST &aInitialSheetPathList)
Clear the annotation for the components inside new sheetpaths when a complex hierarchy is modified an...
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath)
Clear exiting component annotation.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:196
#define IS_NEW
New item, just created.
Definition: eda_item.h:106
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:536
EDA_ITEM * Front() const
Definition: selection.h:203

References EE_ACTIONS::addItemsToSel, SCH_BASE_FRAME::AddToScreen(), SCH_COMPONENT::ClearAnnotation(), SCH_SCREENS::ClearAnnotationOfNewSheetPaths(), EE_ACTIONS::clearSelection, duplicatableItems, SCH_ITEM::Duplicate(), Format(), SELECTION::Front(), SCH_EDIT_FRAME::GetCurrentSheet(), SCH_SHEET::GetFields(), SELECTION::GetItem(), SCH_EDIT_FRAME::GetScreen(), SCHEMATIC::GetSheets(), SELECTION::GetSize(), EDA_TEXT::GetText(), IS_NEW, EDA_ITEM::IsNew(), SCH_SHEET_PATH::Last(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_ACTIONS::move, SCH_SHEET_LIST::NameExists(), NEWITEM, NULL, EE_SELECTION_TOOL::RequestSelection(), SCHEMATIC::Root(), TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList(), SCH_BUS_BUS_ENTRY_T, SCH_BUS_WIRE_ENTRY_T, SCH_COMPONENT_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_JUNCTION_T, SCH_LABEL_T, SCH_LINE_T, SCH_NO_CONNECT_T, SCH_SHEET_T, SCH_TEXT_T, SCH_EDIT_FRAME::Schematic(), EDA_ITEM::SetFlags(), EDA_ITEM::SetParent(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), EDA_TEXT::SetText(), and SHEETNAME.

Referenced by setTransitions().

◆ EditField()

int SCH_EDIT_TOOL::EditField ( const TOOL_EVENT aEvent)

Definition at line 1200 of file sch_edit_tool.cpp.

1201 {
1202  static KICAD_T Nothing[] = { EOT };
1203  static KICAD_T CmpOrReference[] = { SCH_FIELD_LOCATE_REFERENCE_T, SCH_COMPONENT_T, EOT };
1204  static KICAD_T CmpOrValue[] = { SCH_FIELD_LOCATE_VALUE_T, SCH_COMPONENT_T, EOT };
1205  static KICAD_T CmpOrFootprint[] = { SCH_FIELD_LOCATE_FOOTPRINT_T, SCH_COMPONENT_T, EOT };
1206 
1207  KICAD_T* filter = Nothing;
1208 
1209  if( aEvent.IsAction( &EE_ACTIONS::editReference ) )
1210  filter = CmpOrReference;
1211  else if( aEvent.IsAction( &EE_ACTIONS::editValue ) )
1212  filter = CmpOrValue;
1213  else if( aEvent.IsAction( &EE_ACTIONS::editFootprint ) )
1214  filter = CmpOrFootprint;
1215 
1216  EE_SELECTION& selection = m_selectionTool->RequestSelection( filter );
1217 
1218  if( selection.Size() != 1 )
1219  return 0;
1220 
1221  SCH_ITEM* item = (SCH_ITEM*) selection.Front();
1222 
1223  if( item->Type() == SCH_COMPONENT_T )
1224  {
1225  SCH_COMPONENT* component = (SCH_COMPONENT*) item;
1226 
1227  if( aEvent.IsAction( &EE_ACTIONS::editReference ) )
1228  editFieldText( component->GetField( REFERENCE_FIELD ) );
1229  else if( aEvent.IsAction( &EE_ACTIONS::editValue ) )
1230  editFieldText( component->GetField( VALUE_FIELD ) );
1231  else if( aEvent.IsAction( &EE_ACTIONS::editFootprint ) )
1232  editFieldText( component->GetField( FOOTPRINT_FIELD ) );
1233  }
1234  else if( item->Type() == SCH_FIELD_T )
1235  {
1236  editFieldText( (SCH_FIELD*) item );
1237  }
1238 
1239  if( selection.IsHover() )
1241 
1242  return 0;
1243 }
Field Reference of part, i.e. "IC21".
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:51
bool IsHover() const
Definition: selection.h:72
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Returns a mandatory field in this symbol.
Definition: sch_symbol.cpp:688
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
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:70
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:121
Field Value of part, i.e. "3.3K".
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
static TOOL_ACTION editValue
Definition: ee_actions.h:120
int Size() const
Returns the number of selected parts.
Definition: selection.h:128
Schematic symbol object.
Definition: sch_symbol.h:78
static TOOL_ACTION editReference
Definition: ee_actions.h:119
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:196
EDA_ITEM * Front() const
Definition: selection.h:203
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162
Field Name Module PCB, i.e. "16DIP300".

References EE_ACTIONS::clearSelection, editFieldText(), EE_ACTIONS::editFootprint, EE_ACTIONS::editReference, EE_ACTIONS::editValue, EOT, FOOTPRINT_FIELD, SELECTION::Front(), SCH_COMPONENT::GetField(), TOOL_EVENT::IsAction(), SELECTION::IsHover(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, REFERENCE_FIELD, EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), SCH_COMPONENT_T, SCH_FIELD_LOCATE_FOOTPRINT_T, SCH_FIELD_LOCATE_REFERENCE_T, SCH_FIELD_LOCATE_VALUE_T, SCH_FIELD_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 1173 of file sch_edit_tool.cpp.

1174 {
1175  // Save old component in undo list if not already in edit, or moving.
1176  if( aField->GetEditFlags() == 0 ) // i.e. not edited, or moved
1178 
1179  wxString title = wxString::Format( _( "Edit %s Field" ), aField->GetName() );
1180 
1181  DIALOG_SCH_EDIT_ONE_FIELD dlg( m_frame, title, aField );
1182 
1183  // The footprint field dialog can invoke a KIWAY_PLAYER so we must use a quasi-modal
1184  if( dlg.ShowQuasiModal() != wxID_OK )
1185  return;
1186 
1187  dlg.UpdateField( aField, &m_frame->GetCurrentSheet() );
1188 
1189  if( m_frame->eeconfig()->m_AutoplaceFields.enable || aField->GetParent()->Type() == SCH_SHEET_T )
1190  static_cast<SCH_ITEM*>( aField->GetParent() )->AutoAutoplaceFields( m_frame->GetScreen() );
1191 
1192  m_frame->UpdateItem( aField );
1193  m_frame->OnModify();
1194 
1195  // This must go after OnModify() so that the connectivity graph will have been updated.
1197 }
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:214
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:133
STATUS_FLAGS GetEditFlags() const
Definition: eda_item.h:207
EDA_ITEM * GetParent() const
Definition: eda_item.h:164
DIALOG_SCH_EDIT_ONE_FIELD is a the class to handle editing a single component field in the schematic ...
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
#define _(s)
Definition: 3d_actions.cpp:33
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
Definition: sch_field.cpp:505
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.
Definition: tool_manager.h:267
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162

References _, CHANGED, SCH_BASE_FRAME::eeconfig(), EESCHEMA_SETTINGS::AUTOPLACE_FIELDS::enable, Format(), SCH_EDIT_FRAME::GetCurrentSheet(), EDA_ITEM::GetEditFlags(), 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, SCH_EDIT_FRAME::OnModify(), TOOL_MANAGER::PostEvent(), EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList(), SCH_SHEET_T, EVENTS::SelectedItemsModified, EDA_ITEM::Type(), and SCH_BASE_FRAME::UpdateItem().

Referenced by EditField(), and Properties().

◆ EditPageNumber()

int SCH_EDIT_TOOL::EditPageNumber ( const TOOL_EVENT aEvent)

Definition at line 1754 of file sch_edit_tool.cpp.

1755 {
1757 
1758  if( selection.GetSize() > 1 )
1759  return 0;
1760 
1761  SCH_SHEET* sheet = (SCH_SHEET*) selection.Front();
1762 
1763  SCH_SHEET_PATH instance = m_frame->GetCurrentSheet();
1764 
1765  SCH_SCREEN* screen;
1766 
1767  if( sheet )
1768  {
1769  // When changing the page number of a selected sheet, the current screen owns the sheet.
1770  screen = m_frame->GetScreen();
1771 
1772  instance.push_back( sheet );
1773  }
1774  else
1775  {
1776  SCH_SHEET_PATH prevInstance = instance;
1777 
1778  // When change the page number in the screen, the previous screen owns the sheet.
1779  if( prevInstance.size() )
1780  {
1781  prevInstance.pop_back();
1782  screen = prevInstance.LastScreen();
1783  }
1784  else
1785  {
1786  // The root sheet and root screen are effectively the same thing.
1787  screen = m_frame->GetScreen();
1788  }
1789 
1790  sheet = m_frame->GetCurrentSheet().Last();
1791  }
1792 
1793  wxString msg;
1794  wxString sheetPath = instance.PathHumanReadable( false );
1795  wxString pageNumber = instance.GetPageNumber();
1796 
1797  msg.Printf( _( "Enter page number for sheet path%s" ),
1798  ( sheetPath.Length() > 20 ) ? "\n" + sheetPath : " " + sheetPath );
1799 
1800  wxTextEntryDialog dlg( m_frame, msg, _( "Edit Sheet Page Number" ), pageNumber );
1801 
1802  dlg.SetTextValidator( wxFILTER_ALPHANUMERIC ); // No white space.
1803 
1804  if( dlg.ShowModal() == wxID_CANCEL || dlg.GetValue() == instance.GetPageNumber() )
1805  return 0;
1806 
1807  m_frame->SaveCopyInUndoList( screen, sheet, UNDO_REDO::CHANGED, false );
1808 
1809  instance.SetPageNumber( dlg.GetValue() );
1810 
1811  if( instance == m_frame->GetCurrentSheet() )
1812  {
1813  m_frame->GetScreen()->SetPageNumber( dlg.GetValue() );
1815  }
1816 
1817  m_frame->OnModify();
1818 
1819  return 0;
1820 }
void SetPageNumber(const wxString &aPageNumber)
Set the sheet instance user definable page number.
void SetPageNumber(const wxString &aPageNumber)
Definition: base_screen.h:83
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:49
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
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
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:219
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:101
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.
#define _(s)
Definition: 3d_actions.cpp:33
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:203

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 185 of file tool_base.h.

186  {
187 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
188  wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
189 #endif
190  return static_cast<T*>( getToolHolderInt() );
191  }
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 121 of file tool_base.h.

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

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 144 of file tool_base.h.

145  {
146  return m_toolMgr;
147  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215

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 197 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

◆ 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 134 of file tool_base.h.

135  {
136  return m_toolName;
137  }
std::string m_toolName
Definition: tool_base.h:214

References TOOL_BASE::m_toolName.

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 109 of file tool_base.h.

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

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:289
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215

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(), 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(), 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::FindComponentAndItem(), 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(), 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(), SCH_MOVE_TOOL::moveItem(), PL_EDIT_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), PL_EDIT_TOOL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), 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(), 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::updateParentItem(), 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:215
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:291

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(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), 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(), SCH_DRAWING_TOOLS::PlaceComponent(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), 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(), EE_POINT_EDITOR::setEditedPoint(), PL_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(), 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 512 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 128 of file tool_interactive.h.

130 {
131  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
132 
133  goInternal( sptr, aConditions );
134 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:59
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(), ROUTER_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(), COMMON_CONTROL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), CONVERT_TOOL::setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), MICROWAVE_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), PAD_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PCB_POINT_EDITOR::setTransitions(), GERBVIEW_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GROUP_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), SYMBOL_EDITOR_CONTROL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), SCH_MOVE_TOOL::setTransitions(), PL_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), FOOTPRINT_EDITOR_CONTROL::setTransitions(), setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), PCB_CONTROL::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), DRC_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), BOARD_EDITOR_CONTROL::setTransitions(), BOARD_INSPECTION_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), PCB_SELECTION_TOOL::setTransitions(), DRAWING_TOOL::setTransitions(), PL_SELECTION_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 139 of file sch_edit_tool.cpp.

140 {
142 
145 
146  wxASSERT_MSG( drawingTools, "eeshema.InteractiveDrawing tool is not available" );
147 
148  auto hasElements =
149  [ this ] ( const SELECTION& aSel )
150  {
151  return !m_frame->GetScreen()->Items().empty();
152  };
153 
154  auto sheetTool =
155  [ this ] ( const SELECTION& aSel )
156  {
158  };
159 
160  auto anyTextTool =
161  [ this ] ( const SELECTION& aSel )
162  {
167  };
168 
169  auto duplicateCondition =
170  [] ( const SELECTION& aSel )
171  {
173  return false;
174 
175  return true;
176  };
177 
178  auto orientCondition =
179  [] ( const SELECTION& aSel )
180  {
181  if( aSel.Empty() )
182  return false;
183 
185  return false;
186 
187  SCH_ITEM* item = (SCH_ITEM*) aSel.Front();
188 
189  if( aSel.GetSize() > 1 )
190  return true;
191 
192  switch( item->Type() )
193  {
194  case SCH_MARKER_T:
195  case SCH_JUNCTION_T:
196  case SCH_NO_CONNECT_T:
197  case SCH_PIN_T:
198  return false;
199  case SCH_LINE_T:
200  return item->GetLayer() != LAYER_WIRE && item->GetLayer() != LAYER_BUS;
201  default:
202  return true;
203  }
204  };
205 
206  auto propertiesCondition =
207  []( const SELECTION& aSel )
208  {
209  if( aSel.GetSize() == 0 )
210  return true; // Show drawing-sheet properties
211 
212  SCH_ITEM* firstItem = dynamic_cast<SCH_ITEM*>( aSel.Front() );
213  const EE_SELECTION* eeSelection = dynamic_cast<const EE_SELECTION*>( &aSel );
214 
215  if( !firstItem || !eeSelection )
216  return false;
217 
218  switch( firstItem->Type() )
219  {
220  case SCH_COMPONENT_T:
221  case SCH_SHEET_T:
222  case SCH_SHEET_PIN_T:
223  case SCH_TEXT_T:
224  case SCH_LABEL_T:
225  case SCH_GLOBAL_LABEL_T:
226  case SCH_HIER_LABEL_T:
227  case SCH_FIELD_T:
228  case SCH_BITMAP_T:
229  return aSel.GetSize() == 1;
230 
231  case SCH_LINE_T:
233  return eeSelection->AllItemsHaveLineStroke();
234 
235  case SCH_JUNCTION_T:
236  return eeSelection->AreAllItemsIdentical();
237 
238  default:
239  return false;
240  }
241  };
242 
243  static KICAD_T toLabelTypes[] = { SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT };
244  auto toLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toLabelTypes );
245 
246  static KICAD_T toHLableTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_TEXT_T, EOT };
247  auto toHLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toHLableTypes );
248 
249  static KICAD_T toGLableTypes[] = { SCH_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT };
250  auto toGLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toGLableTypes );
251 
252  static KICAD_T toTextTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, EOT };
253  auto toTextlCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toTextTypes );
254 
255  static KICAD_T entryTypes[] = { SCH_BUS_WIRE_ENTRY_T, SCH_BUS_BUS_ENTRY_T, EOT };
256  auto entryCondition = E_C::MoreThan( 0 ) && E_C::OnlyTypes( entryTypes );
257 
258  static KICAD_T fieldParentTypes[] = { SCH_COMPONENT_T, SCH_SHEET_T, SCH_GLOBAL_LABEL_T, EOT };
259  auto singleFieldParentCondition = E_C::Count( 1 ) && E_C::OnlyTypes( fieldParentTypes );
260 
261  auto singleSheetCondition = E_C::Count( 1 ) && E_C::OnlyType( SCH_SHEET_T );
262 
263  //
264  // Add edit actions to the move tool menu
265  //
266  if( moveTool )
267  {
268  CONDITIONAL_MENU& moveMenu = moveTool->GetToolMenu().GetMenu();
269 
270  moveMenu.AddSeparator();
271  moveMenu.AddItem( EE_ACTIONS::rotateCCW, orientCondition );
272  moveMenu.AddItem( EE_ACTIONS::rotateCW, orientCondition );
273  moveMenu.AddItem( EE_ACTIONS::mirrorV, orientCondition );
274  moveMenu.AddItem( EE_ACTIONS::mirrorH, orientCondition );
275 
276  moveMenu.AddItem( EE_ACTIONS::properties, propertiesCondition );
281 
282  std::shared_ptr<SYMBOL_UNIT_MENU> symUnitMenu = std::make_shared<SYMBOL_UNIT_MENU>();
283  symUnitMenu->SetTool( this );
284  m_menu.AddSubMenu( symUnitMenu );
285  moveMenu.AddMenu( symUnitMenu.get(), E_C::SingleMultiUnitSymbol, 1 );
286 
287  moveMenu.AddSeparator();
291  moveMenu.AddItem( ACTIONS::duplicate, duplicateCondition );
292 
293  moveMenu.AddSeparator();
294  moveMenu.AddItem( ACTIONS::selectAll, hasElements );
295  }
296 
297  //
298  // Add editing actions to the drawing tool menu
299  //
300  CONDITIONAL_MENU& drawMenu = drawingTools->GetToolMenu().GetMenu();
301 
302  drawMenu.AddItem( EE_ACTIONS::rotateCCW, orientCondition, 200 );
303  drawMenu.AddItem( EE_ACTIONS::rotateCW, orientCondition, 200 );
304  drawMenu.AddItem( EE_ACTIONS::mirrorV, orientCondition, 200 );
305  drawMenu.AddItem( EE_ACTIONS::mirrorH, orientCondition, 200 );
306 
307  drawMenu.AddItem( EE_ACTIONS::properties, propertiesCondition, 200 );
311  drawMenu.AddItem( EE_ACTIONS::autoplaceFields, singleFieldParentCondition, 200 );
313 
314  std::shared_ptr<SYMBOL_UNIT_MENU> symUnitMenu2 = std::make_shared<SYMBOL_UNIT_MENU>();
315  symUnitMenu2->SetTool( drawingTools );
316  drawingTools->GetToolMenu().AddSubMenu( symUnitMenu2 );
317  drawMenu.AddMenu( symUnitMenu2.get(), E_C::SingleMultiUnitSymbol, 1 );
318 
320 
321  drawMenu.AddItem( EE_ACTIONS::toLabel, anyTextTool && E_C::Idle, 200 );
322  drawMenu.AddItem( EE_ACTIONS::toHLabel, anyTextTool && E_C::Idle, 200 );
323  drawMenu.AddItem( EE_ACTIONS::toGLabel, anyTextTool && E_C::Idle, 200 );
324  drawMenu.AddItem( EE_ACTIONS::toText, anyTextTool && E_C::Idle, 200 );
325  drawMenu.AddItem( EE_ACTIONS::cleanupSheetPins, sheetTool && E_C::Idle, 250 );
326 
327  //
328  // Add editing actions to the selection tool menu
329  //
331 
332  selToolMenu.AddItem( EE_ACTIONS::rotateCCW, orientCondition, 200 );
333  selToolMenu.AddItem( EE_ACTIONS::rotateCW, orientCondition, 200 );
334  selToolMenu.AddItem( EE_ACTIONS::mirrorV, orientCondition, 200 );
335  selToolMenu.AddItem( EE_ACTIONS::mirrorH, orientCondition, 200 );
336 
337  selToolMenu.AddItem( EE_ACTIONS::properties, propertiesCondition, 200 );
339  selToolMenu.AddItem( EE_ACTIONS::editValue, E_C::SingleSymbol, 200 );
341  selToolMenu.AddItem( EE_ACTIONS::autoplaceFields, singleFieldParentCondition, 200 );
343 
344  std::shared_ptr<SYMBOL_UNIT_MENU> symUnitMenu3 = std::make_shared<SYMBOL_UNIT_MENU>();
345  symUnitMenu3->SetTool( m_selectionTool );
346  m_selectionTool->GetToolMenu().AddSubMenu( symUnitMenu3 );
347  selToolMenu.AddMenu( symUnitMenu3.get(), E_C::SingleMultiUnitSymbol, 1 );
348 
352 
353  selToolMenu.AddItem( EE_ACTIONS::toLabel, toLabelCondition, 200 );
354  selToolMenu.AddItem( EE_ACTIONS::toHLabel, toHLabelCondition, 200 );
355  selToolMenu.AddItem( EE_ACTIONS::toGLabel, toGLabelCondition, 200 );
356  selToolMenu.AddItem( EE_ACTIONS::toText, toTextlCondition, 200 );
357  selToolMenu.AddItem( EE_ACTIONS::cleanupSheetPins, singleSheetCondition, 250 );
358 
359  selToolMenu.AddSeparator( 300 );
360  selToolMenu.AddItem( ACTIONS::cut, E_C::IdleSelection, 300 );
361  selToolMenu.AddItem( ACTIONS::copy, E_C::IdleSelection, 300 );
362  selToolMenu.AddItem( ACTIONS::paste, E_C::Idle, 300 );
363  selToolMenu.AddItem( ACTIONS::pasteSpecial, E_C::Idle, 300 );
364  selToolMenu.AddItem( ACTIONS::doDelete, E_C::NotEmpty, 300 );
365  selToolMenu.AddItem( ACTIONS::duplicate, duplicateCondition, 300 );
366 
367  selToolMenu.AddSeparator( 400 );
368  selToolMenu.AddItem( ACTIONS::selectAll, hasElements, 400 );
369 
370 
371  return true;
372 }
bool empty() const
Definition: sch_rtree.h:166
void AddMenu(ACTION_MENU *aMenu, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Add a submenu to the menu.
static TOOL_ACTION properties
Definition: ee_actions.h:118
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:123
static SELECTION_CONDITION SingleSymbol
static TOOL_ACTION doDelete
Definition: actions.h:75
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:85
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
static TOOL_ACTION changeSymbol
Definition: ee_actions.h:146
TOOL_MENU & GetToolMenu()
static TOOL_ACTION toText
Definition: ee_actions.h:130
static TOOL_ACTION autoplaceFields
Definition: ee_actions.h:122
static TOOL_ACTION mirrorH
Definition: ee_actions.h:117
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:116
static TOOL_ACTION rotateCW
Definition: ee_actions.h:114
bool Init() override
Init() is called once upon a registration of the tool.
Definition: ee_tool_base.h:65
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
static TOOL_ACTION drawSheet
Definition: ee_actions.h:86
static SELECTION_CONDITION SingleDeMorganSymbol
static TOOL_ACTION copy
Definition: actions.h:70
static TOOL_ACTION cleanupSheetPins
Definition: ee_actions.h:188
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:115
static TOOL_ACTION editFootprint
Definition: ee_actions.h:121
static TOOL_ACTION placeSchematicText
Definition: ee_actions.h:88
static TOOL_ACTION updateSymbol
Definition: ee_actions.h:147
static TOOL_ACTION cut
Definition: actions.h:69
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
static SELECTION_CONDITION SingleMultiUnitSymbol
void AddSeparator(int aOrder=ANY_ORDER)
Add a separator to the menu.
static TOOL_ACTION pasteSpecial
Definition: actions.h:72
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:287
static TOOL_ACTION placeLabel
Definition: ee_actions.h:83
static bool IsDrawingLineWireOrBus(const SELECTION &aSelection)
static TOOL_ACTION editValue
Definition: ee_actions.h:120
void AddSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Store a submenu of this menu model.
Definition: tool_menu.cpp:52
EE_RTREE & Items()
Definition: sch_screen.h:162
static SELECTION_CONDITION OnlyType(KICAD_T aType)
Create a functor that tests if the selected items are only of given type.
static SELECTION_CONDITION SingleSymbolOrPower
static TOOL_ACTION editWithLibEdit
Definition: ee_actions.h:159
static TOOL_ACTION toLabel
Definition: ee_actions.h:127
static TOOL_ACTION toHLabel
Definition: ee_actions.h:128
static TOOL_ACTION editReference
Definition: ee_actions.h:119
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:84
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:196
static TOOL_ACTION selectAll
Definition: actions.h:73
static TOOL_ACTION toGLabel
Definition: ee_actions.h:129
static TOOL_ACTION paste
Definition: actions.h:71
static TOOL_ACTION duplicate
Definition: actions.h:74
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162

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(), ACTIONS::cut, ACTIONS::doDelete, EE_ACTIONS::drawSheet, ACTIONS::duplicate, EE_ACTIONS::editFootprint, EE_ACTIONS::editReference, EE_ACTIONS::editValue, EE_ACTIONS::editWithLibEdit, EE_RTREE::empty(), EOT, SCH_ITEM::GetLayer(), TOOL_MENU::GetMenu(), SCH_EDIT_FRAME::GetScreen(), TOOL_MANAGER::GetTool(), TOOL_INTERACTIVE::GetToolMenu(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), EE_TOOL_BASE< T >::Init(), TOOLS_HOLDER::IsCurrentTool(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus(), SCH_SCREEN::Items(), LAYER_BUS, 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_COMPONENT_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_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:215
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210
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 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 606 of file sch_edit_tool.cpp.

607 {
609 
610  if( selection.GetSize() == 0 )
611  return 0;
612 
613  wxPoint mirrorPoint;
614  bool vertical = ( aEvent.Matches( EE_ACTIONS::mirrorV.MakeEvent() ) );
615  SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.Front() );
616  bool connections = false;
617  bool moving = item->IsMoving();
618 
619  if( selection.GetSize() == 1 )
620  {
621  if( !moving )
623 
624  switch( item->Type() )
625  {
626  case SCH_COMPONENT_T:
627  {
628  SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
629 
630  if( vertical )
631  component->SetOrientation( CMP_MIRROR_X );
632  else
633  component->SetOrientation( CMP_MIRROR_Y );
634 
636  component->AutoAutoplaceFields( m_frame->GetScreen() );
637 
638  break;
639  }
640 
641  case SCH_TEXT_T:
642  case SCH_LABEL_T:
643  case SCH_GLOBAL_LABEL_T:
644  case SCH_HIER_LABEL_T:
645  {
646  SCH_TEXT* textItem = static_cast<SCH_TEXT*>( item );
647  textItem->MirrorSpinStyle( !vertical );
648  break;
649  }
650 
651  case SCH_SHEET_PIN_T:
652  {
653  // mirror within parent sheet
654  SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
655  SCH_SHEET* sheet = pin->GetParent();
656 
657  if( vertical )
658  pin->MirrorVertically( sheet->GetBoundingBox().GetCenter().y );
659  else
660  pin->MirrorHorizontally( sheet->GetBoundingBox().GetCenter().x );
661 
662  break;
663  }
664 
665  case SCH_BUS_BUS_ENTRY_T:
667  if( vertical )
668  item->MirrorVertically( item->GetPosition().y );
669  else
670  item->MirrorHorizontally( item->GetPosition().x );
671  break;
672 
673  case SCH_FIELD_T:
674  {
675  SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
676 
677  if( vertical )
679  else
681 
682  // Now that we're re-justifying a field, they're no longer autoplaced.
683  static_cast<SCH_ITEM*>( item->GetParent() )->ClearFieldsAutoplaced();
684 
685  break;
686  }
687 
688  case SCH_BITMAP_T:
689  if( vertical )
690  item->MirrorVertically( item->GetPosition().y );
691  else
692  item->MirrorHorizontally( item->GetPosition().x );
693 
694  // The bitmap is cached in Opengl: clear the cache to redraw
696  break;
697 
698  case SCH_SHEET_T:
699  // Mirror the sheet on itself. Sheets do not have a anchor point.
700  mirrorPoint = m_frame->GetNearestHalfGridPosition( item->GetBoundingBox().Centre() );
701 
702  if( vertical )
703  item->MirrorVertically( mirrorPoint.y );
704  else
705  item->MirrorHorizontally( mirrorPoint.x );
706 
707  break;
708 
709  default:
710  break;
711  }
712 
713  connections = item->IsConnectable();
714  m_frame->UpdateItem( item );
715  }
716  else if( selection.GetSize() > 1 )
717  {
718  mirrorPoint = m_frame->GetNearestHalfGridPosition( (wxPoint)selection.GetCenter() );
719 
720  for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
721  {
722  item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
723 
724  if( !moving )
725  saveCopyInUndoList( item, UNDO_REDO::CHANGED, ii > 0 );
726 
727  if( item->Type() == SCH_SHEET_PIN_T )
728  {
729  if( item->GetParent()->IsSelected() )
730  {
731  // parent will mirror us
732  }
733  else
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  }
745  else
746  {
747  if( vertical )
748  item->MirrorVertically( mirrorPoint.y );
749  else
750  item->MirrorHorizontally( mirrorPoint.x );
751  }
752 
753  connections |= item->IsConnectable();
754  m_frame->UpdateItem( item );
755  }
756  }
757 
759 
760  // Update R-Tree for modified items
761  for( EDA_ITEM* selected : selection )
762  updateItem( selected, true );
763 
764  if( item->IsMoving() )
765  {
767  }
768  else
769  {
770  if( selection.IsHover() )
772 
773  if( connections )
775 
776  m_frame->OnModify();
777  }
778 
779  return 0;
780 }
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:51
virtual bool IsConnectable() const
Definition: sch_item.h:376
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:61
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:206
SCH_SHEET * GetParent() const
Get the parent sheet object of this sheet pin.
Definition: sch_sheet.h:169
bool IsSelected() const
Definition: eda_item.h:172
void AutoAutoplaceFields(SCH_SCREEN *aScreen)
Autoplace fields only if correct to do so automatically.
Definition: sch_item.h:460
virtual VECTOR2I GetCenter() const
Returns the center point of the selection area bounding box.
Definition: selection.h:139
bool IsMoving() const
Definition: eda_item.h:169
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1372
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:141
wxPoint GetNearestHalfGridPosition(const wxPoint &aPosition) const
Return the nearest aGridSize / 2 location to aPosition.
virtual wxPoint GetPosition() const
Definition: eda_item.h:301
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:214
static TOOL_ACTION mirrorV
Definition: ee_actions.h:116
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:205
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_sheet.cpp:591
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:133
void SetVertJustify(EDA_TEXT_VJUSTIFY_T aType)
Definition: eda_text.h:209
EDA_ITEM * GetParent() const
Definition: eda_item.h:164
const KICAD_T rotatableItems[]
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
bool Matches(const TOOL_EVENT &aEvent) const
Test whether two events match in terms of category & action or command.
Definition: tool_event.h:373
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:85
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
virtual void MirrorHorizontally(int aCenter)=0
Mirror item horizontally about aCenter.
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.h:106
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:102
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:219
EDA_TEXT_VJUSTIFY_T
Definition: eda_text.h:68
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:101
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:208
Schematic symbol object.
Definition: sch_symbol.h:78
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:149
wxPoint Centre() const
Definition: eda_rect.h:60
virtual void MirrorSpinStyle(bool aLeftRight)
Definition: sch_text.cpp:239
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:89
const wxPoint GetCenter() const
Definition: eda_rect.h:109
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:267
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:196
static TOOL_ACTION refreshPreview
Definition: actions.h:109
EDA_ITEM * Front() const
Definition: selection.h:203
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...

References SCH_ITEM::AutoAutoplaceFields(), EDA_RECT::Centre(), CHANGED, EE_ACTIONS::clearSelection, CMP_MIRROR_X, CMP_MIRROR_Y, 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(), SCH_SHEET_PIN::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_SHEET_PIN::MirrorHorizontally(), SCH_ITEM::MirrorHorizontally(), SCH_TEXT::MirrorSpinStyle(), EE_ACTIONS::mirrorV, SCH_SHEET_PIN::MirrorVertically(), SCH_ITEM::MirrorVertically(), SCH_EDIT_FRAME::OnModify(), 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_COMPONENT_T, SCH_FIELD_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_TEXT_T, EVENTS::SelectedItemsModified, EDA_TEXT::SetHorizJustify(), SCH_COMPONENT::SetOrientation(), EDA_TEXT::SetVertJustify(), 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 1330 of file sch_edit_tool.cpp.

1331 {
1333 
1334  if( selection.Empty() )
1335  {
1337  {
1339  VECTOR2D cursorPos = getViewControls()->GetCursorPosition( false );
1340 
1341  if( ds && ds->HitTestDrawingSheetItems( getView(), (wxPoint) cursorPos ) )
1343  }
1344 
1345  return 0;
1346  }
1347 
1348  SCH_ITEM* item = (SCH_ITEM*) selection.Front();
1349 
1350  switch( item->Type() )
1351  {
1352  case SCH_LINE_T:
1353  case SCH_BUS_WIRE_ENTRY_T:
1354  if( !selection.AllItemsHaveLineStroke() )
1355  return 0;
1356 
1357  break;
1358 
1359  case SCH_JUNCTION_T:
1360  if( !selection.AreAllItemsIdentical() )
1361  return 0;
1362 
1363  break;
1364 
1365  default:
1366  if( selection.Size() > 1 )
1367  return 0;
1368 
1369  break;
1370  }
1371 
1372  switch( item->Type() )
1373  {
1374  case SCH_COMPONENT_T:
1375  {
1376  SCH_COMPONENT* component = (SCH_COMPONENT*) item;
1377  DIALOG_SYMBOL_PROPERTIES symbolPropsDialog( m_frame, component );
1378 
1379  // This dialog itself subsequently can invoke a KIWAY_PLAYER as a quasimodal
1380  // frame. Therefore this dialog as a modal frame parent, MUST be run under
1381  // quasimodal mode for the quasimodal frame support to work. So don't use
1382  // the QUASIMODAL macros here.
1383  int retval = symbolPropsDialog.ShowQuasiModal();
1384 
1385  if( retval == SYMBOL_PROPS_EDIT_OK )
1386  {
1388  component->AutoAutoplaceFields( m_frame->GetScreen() );
1389 
1391  m_frame->OnModify();
1392  }
1393  else if( retval == SYMBOL_PROPS_EDIT_SCHEMATIC_SYMBOL )
1394  {
1395  auto editor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, true );
1396 
1397  editor->LoadSymbolFromSchematic( component );
1398 
1399  editor->Show( true );
1400  editor->Raise();
1401  }
1402  else if( retval == SYMBOL_PROPS_EDIT_LIBRARY_SYMBOL )
1403  {
1404  auto editor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, true );
1405 
1406  editor->LoadSymbolAndSelectLib( component->GetLibId(), component->GetUnit(),
1407  component->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 components managed by its sheet path must have their annotation
1449  // cleared, 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 = (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  {
1482  DIALOG_LABEL_EDITOR dlg( m_frame, (SCH_TEXT*) item );
1483 
1484  // Must be quasi modal for syntax help
1485  if( dlg.ShowQuasiModal() == wxID_OK )
1486  {
1488  m_frame->OnModify();
1489  }
1490  }
1491  break;
1492 
1493  case SCH_FIELD_T:
1494  editFieldText( (SCH_FIELD*) item );
1495  break;
1496 
1497  case SCH_BITMAP_T:
1498  {
1499  SCH_BITMAP* bitmap = (SCH_BITMAP*) item;
1500  DIALOG_IMAGE_EDITOR dlg( m_frame, bitmap->GetImage() );
1501 
1502  if( dlg.ShowModal() == wxID_OK )
1503  {
1504  // save old image in undo list if not already in edit
1505  if( bitmap->GetEditFlags() == 0 )
1507 
1508  dlg.TransferToImage( bitmap->GetImage() );
1509 
1510  // The bitmap is cached in Opengl: clear the cache in case it has become invalid
1511  getView()->RecacheAllItems();
1513  m_frame->OnModify();
1514  }
1515  }
1516  break;
1517 
1518  case SCH_LINE_T:
1519  case SCH_BUS_WIRE_ENTRY_T:
1520  {
1521  std::deque<SCH_ITEM*> strokeItems;
1522 
1523  for( auto selItem : selection.Items() )
1524  {
1525  SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( selItem );
1526 
1527  if( schItem && schItem->HasLineStroke() )
1528  strokeItems.push_back( schItem );
1529  else
1530  return 0;
1531  }
1532 
1533  DIALOG_EDIT_LINE_STYLE dlg( m_frame, strokeItems );
1534 
1535  if( dlg.ShowModal() == wxID_OK )
1536  {
1538  m_frame->OnModify();
1539  }
1540  }
1541  break;
1542 
1543  case SCH_JUNCTION_T:
1544  {
1545  std::deque<SCH_JUNCTION*> junctions;
1546 
1547  for( auto selItem : selection.Items() )
1548  {
1549  SCH_JUNCTION* junction = dynamic_cast<SCH_JUNCTION*>( selItem );
1550 
1551  wxCHECK( junction, 0 );
1552 
1553  junctions.push_back( junction );
1554  }
1555 
1556  DIALOG_JUNCTION_PROPS dlg( m_frame, junctions );
1557 
1558  if( dlg.ShowModal() == wxID_OK )
1559  {
1561  m_frame->OnModify();
1562  }
1563  }
1564  break;
1565 
1566  case SCH_MARKER_T: // These items have no properties to edit
1567  case SCH_NO_CONNECT_T:
1568  break;
1569 
1570  default: // Unexpected item
1571  wxFAIL_MSG( wxString( "Cannot edit schematic item type " ) + item->GetClass() );
1572  }
1573 
1574  updateItem( item, true );
1575 
1576  if( selection.IsHover() )
1578 
1579  return 0;
1580 }
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.
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:51
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:56
bool IsHover() const
Definition: selection.h:72
std::deque< EDA_ITEM * > & Items()
Definition: selection.h:208
static TOOL_ACTION pageSettings
Definition: actions.h:59
void AutoAutoplaceFields(SCH_SCREEN *aScreen)
Autoplace fields only if correct to do so automatically.
Definition: sch_item.h:460
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1372
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:345
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.h:279
SCH_SCREEN * GetScreen() const
Definition: sch_sheet.h:285
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:214
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.
int GetUnit() const
Definition: sch_symbol.h:236
AUTOPLACE_FIELDS m_AutoplaceFields
BITMAP_BASE * GetImage() const
Definition: sch_bitmap.h:59
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:133
STATUS_FLAGS GetEditFlags() const
Definition: eda_item.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:477
SCHEMATIC & Schematic() const
void UpdateHierarchyNavigator(bool aForceUpdate=false)
Run the Hierarchy Navigator dialog.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:85
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
Object to handle a bitmap image that can be inserted in a schematic.
Definition: sch_bitmap.h:42
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:122
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:102
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:219
bool AllItemsHaveLineStroke() const
Checks if all items in the selection support line strokes.
SCH_SHEET & Root() const
Definition: schematic.h:116
int Size() const
Returns the number of selected parts.
Definition: selection.h:128
Schematic symbol object.
Definition: sch_symbol.h:78
virtual wxString GetClass() const override
Return the class name.
Definition: sch_item.h:222
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:465
SCH_SHEET_PATH & GetCurrentSheet() const
void ClearAnnotation(SCH_SHEET_PATH *aSheetPath)
Clear the annotation for the components in aSheetPath on the screen.
Definition: sch_screen.cpp:939
int GetConvert() const
Definition: sch_symbol.h:264
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 components inside new sheetpaths when a complex hierarchy is modified an...
const LIB_ID & GetLibId() const
Definition: sch_symbol.h:188
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:267
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:196
static const KICAD_T EditableItems[]
Definition: ee_collectors.h:46
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:536
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
EDA_ITEM * Front() const
Definition: selection.h:203
Dialog used to edit SCH_COMPONENT objects in a schematic.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
Definition: view.h:404
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(), 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(), SCH_FIELD::GetClass(), SCH_COMPONENT::GetConvert(), SCH_EDIT_FRAME::GetCurrentSheet(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), KIGFX::SCH_VIEW::GetDrawingSheet(), EDA_ITEM::GetEditFlags(), SCH_BITMAP::GetImage(), SCH_COMPONENT::GetLibId(), SCH_EDIT_FRAME::GetScreen(), SCH_SHEET::GetScreen(), SCH_COMPONENT::GetUnit(), SCH_DRAW_PANEL::GetView(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), SCH_ITEM::HasLineStroke(), DS_PROXY_VIEW_ITEM::HitTestDrawingSheetItems(), SELECTION::IsHover(), KIGFX::VIEW::IsLayerVisible(), 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, 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_COMPONENT_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_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 901 of file sch_edit_tool.cpp.

902 {
903  SCH_ITEM* sourceItem = m_frame->GetRepeatItem();
904 
905  if( !sourceItem )
906  return 0;
907 
909 
910  SCH_ITEM* newItem = sourceItem->Duplicate();
911  bool performDrag = false;
912 
913  // If cloning a component then put into 'move' mode.
914  if( newItem->Type() == SCH_COMPONENT_T )
915  {
916  wxPoint cursorPos = (wxPoint) getViewControls()->GetCursorPosition( true );
917  newItem->Move( cursorPos - newItem->GetPosition() );
918  performDrag = true;
919  }
920  else
921  {
922  if( m_isSymbolEditor )
923  {
924  auto* cfg = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
925 
926  if( dynamic_cast<SCH_TEXT*>( newItem ) )
927  {
928  SCH_TEXT* text = static_cast<SCH_TEXT*>( newItem );
929  text->IncrementLabel( cfg->m_Repeat.label_delta );
930  }
931 
932  newItem->Move( wxPoint( Mils2iu( cfg->m_Repeat.x_step ),
933  Mils2iu( cfg->m_Repeat.y_step ) ) );
934  }
935  else
936  {
937  EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
938 
939  if( dynamic_cast<SCH_TEXT*>( newItem ) )
940  {
941  SCH_TEXT* text = static_cast<SCH_TEXT*>( newItem );
942 
943  // If incrementing tries to go below zero, tell user why the value is repeated
944 
945  if( !text->IncrementLabel( cfg->m_Drawing.repeat_label_increment ) )
946  m_frame->ShowInfoBarWarning( _( "Label value cannot go below zero" ), true );
947  }
948 
949  newItem->Move( wxPoint( Mils2iu( cfg->m_Drawing.default_repeat_offset_x ),
950  Mils2iu( cfg->m_Drawing.default_repeat_offset_y ) ) );
951  }
952 
953  }
954 
955  newItem->SetFlags( IS_NEW );
956  m_frame->AddToScreen( newItem, m_frame->GetScreen() );
958 
959  m_selectionTool->AddItemToSel( newItem );
960 
961  // Components need to be handled by the move tool. The move tool will handle schematic
962  // cleanup routines
963  if( performDrag )
965 
966  newItem->ClearFlags();
967 
968  if( !performDrag && newItem->IsConnectable() )
969  {
971  new_sel.Add( newItem );
972 
976  }
977 
978  // newItem newItem, now that it has been moved, thus saving new position.
979  m_frame->SaveCopyForRepeatItem( newItem );
980 
981  return 0;
982 }
bool SchematicCleanUp(SCH_SCREEN *aScreen=nullptr)
Performs routine schematic cleaning including breaking wire and buses and deleting identical objects ...
virtual bool IsConnectable() const
Definition: sch_item.h:376
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
virtual wxPoint GetPosition() const
Definition: eda_item.h:301
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 ...
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:77
EE_SELECTION & GetSelection()
Return the set of currently selected items.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:202
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
Definition: sch_item.cpp:78
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
bool IncrementLabel(int aIncrement)
Increment the label text, if it ends with a number.
Definition: sch_text.cpp:164
void SaveCopyForRepeatItem(SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
static TOOL_ACTION addNeededJunctions
Definition: ee_actions.h:73
SCH_ITEM * GetRepeatItem() const
Return the item which is to be repeated with the insert key.
int AddItemToSel(const TOOL_EVENT &aEvent)
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.
#define _(s)
Definition: 3d_actions.cpp:33
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:203
static TOOL_ACTION move
Definition: ee_actions.h:111
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:196
#define IS_NEW
New item, just created.
Definition: eda_item.h:106
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162
virtual void Move(const wxPoint &aMoveVector)=0
Move the item by aMoveVector to a new position.

References _, SELECTION::Add(), EE_SELECTION_TOOL::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(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), EDA_ITEM::GetPosition(), SCH_EDIT_FRAME::GetRepeatItem(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), TOOL_BASE::getViewControls(), SCH_TEXT::IncrementLabel(), IS_NEW, SCH_ITEM::IsConnectable(), EESCHEMA_SETTINGS::m_Drawing, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_isSymbolEditor, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_ACTIONS::move, SCH_ITEM::Move(), NEWITEM, Pgm(), EESCHEMA_SETTINGS::DRAWING::repeat_label_increment, TOOL_MANAGER::RunAction(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_COMPONENT_T, SCH_EDIT_FRAME::SchematicCleanUp(), EDA_ITEM::SetFlags(), EDA_BASE_FRAME::ShowInfoBarWarning(), SCH_EDIT_FRAME::TestDanglingEnds(), 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 85 of file ee_tool_base.h.

86  {
87  if( aReason == MODEL_RELOAD )
88  {
89  // Init variables used by every drawing tool
90  m_frame = getEditFrame<T>();
91  m_isSymbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) != nullptr;
92  }
93 
94  m_view = static_cast<KIGFX::SCH_VIEW*>( getView() );
95  }
Model changes (required full reload)
Definition: tool_base.h:81
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 394 of file sch_edit_tool.cpp.

395 {
396  bool clockwise = ( aEvent.Matches( EE_ACTIONS::rotateCW.MakeEvent() ) );
398 
399  if( selection.GetSize() == 0 )
400  return 0;
401 
402  SCH_ITEM* head = nullptr;
403  int principalItemCount = 0; // User-selected items (as opposed to connected wires)
404  wxPoint rotPoint;
405  bool moving = false;
406  bool connections = false;
407 
408  for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
409  {
410  SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
411 
412  if( item->HasFlag( TEMP_SELECTED ) )
413  continue;
414 
415  principalItemCount++;
416 
417  if( !head )
418  head = item;
419  }
420 
421  if( head && head->IsMoving() )
422  moving = true;
423 
424  if( principalItemCount == 1 )
425  {
426  rotPoint = head->GetPosition();
427 
428  if( !moving )
430 
431  switch( head->Type() )
432  {
433  case SCH_COMPONENT_T:
434  {
435  SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( head );
436 
437  if( clockwise )
438  component->SetOrientation( CMP_ROTATE_CLOCKWISE );
439  else
441 
443  component->AutoAutoplaceFields( m_frame->GetScreen() );
444 
445  break;
446  }
447 
448  case SCH_TEXT_T:
449  case SCH_LABEL_T:
450  case SCH_GLOBAL_LABEL_T:
451  case SCH_HIER_LABEL_T:
452  {
453  SCH_TEXT* textItem = static_cast<SCH_TEXT*>( head );
454  textItem->Rotate90( clockwise );
455  break;
456  }
457 
458  case SCH_SHEET_PIN_T:
459  {
460  // Rotate pin within parent sheet
461  SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( head );
462  SCH_SHEET* sheet = pin->GetParent();
463 
464  for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
465  pin->Rotate( sheet->GetBoundingBox().GetCenter() );
466 
467  break;
468  }
469 
470  case SCH_LINE_T:
471  case SCH_BUS_BUS_ENTRY_T:
473  for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
474  head->Rotate( rotPoint );
475 
476  break;
477 
478  case SCH_FIELD_T:
479  {
480  SCH_FIELD* field = static_cast<SCH_FIELD*>( head );
481 
482  if( field->GetTextAngle() == TEXT_ANGLE_HORIZ )
483  field->SetTextAngle( TEXT_ANGLE_VERT );
484  else
485  field->SetTextAngle( TEXT_ANGLE_HORIZ );
486 
487  // Now that we're moving a field, they're no longer autoplaced.
488  static_cast<SCH_ITEM*>( head->GetParent() )->ClearFieldsAutoplaced();
489 
490  break;
491  }
492 
493  case SCH_BITMAP_T:
494  for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
495  head->Rotate( rotPoint );
496 
497  // The bitmap is cached in Opengl: clear the cache to redraw
499  break;
500 
501  case SCH_SHEET_T:
502  {
503  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( head );
504  rotPoint = m_frame->GetNearestGridPosition( sheet->GetRotationCenter() );
505 
506  // Rotate the sheet on itself. Sheets do not have an anchor point.
507  for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
508  sheet->Rotate( rotPoint );
509 
510  break;
511  }
512 
513  default:
514  break;
515  }
516 
517  connections = head->IsConnectable();
518  m_frame->UpdateItem( head );
519  }
520  else
521  {
522  rotPoint = m_frame->GetNearestGridPosition( (wxPoint)selection.GetCenter() );
523  }
524 
525  for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
526  {
527  SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
528 
529  // We've already rotated the user selected item if there was only one. We're just
530  // here to rotate the ends of wires that were attached to it.
531  if( principalItemCount == 1 && !item->HasFlag( TEMP_SELECTED ) )
532  continue;
533 
534  if( !moving )
535  saveCopyInUndoList( item, UNDO_REDO::CHANGED, ii > 0 );
536 
537  for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
538  {
539  if( item->Type() == SCH_LINE_T )
540  {
541  SCH_LINE* line = (SCH_LINE*) item;
542 
543  if( item->HasFlag( STARTPOINT ) )
544  line->RotateStart( rotPoint );
545 
546  if( item->HasFlag( ENDPOINT ) )
547  line->RotateEnd( rotPoint );
548  }
549  else if( item->Type() == SCH_SHEET_PIN_T )
550  {
551  if( item->GetParent()->IsSelected() )
552  {
553  // parent will rotate us
554  }
555  else
556  {
557  // rotate within parent
558  SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
559  SCH_SHEET* sheet = pin->GetParent();
560 
561  pin->Rotate( sheet->GetBoundingBox().GetCenter() );
562  }
563  }
564  else if( item->Type() == SCH_FIELD_T )
565  {
566  if( item->GetParent()->IsSelected() )
567  {
568  // parent will rotate us
569  }
570  else
571  {
572  item->Rotate( rotPoint );
573  }
574  }
575  else
576  {
577  item->Rotate( rotPoint );
578  }
579  }
580 
581  connections |= item->IsConnectable();
582  m_frame->UpdateItem( item );
583  }
584 
586 
587  if( moving )
588  {
590  }
591  else
592  {
593  if( selection.IsHover() )
595 
596  if( connections )
598 
599  m_frame->OnModify();
600  }
601 
602  return 0;
603 }
#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:50
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:51
virtual bool IsConnectable() const
Definition: sch_item.h:376
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
bool IsHover() const
Definition: selection.h:72
SCH_SHEET * GetParent() const
Get the parent sheet object of this sheet pin.
Definition: sch_sheet.h:169
bool IsSelected() const
Definition: eda_item.h:172
void AutoAutoplaceFields(SCH_SCREEN *aScreen)
Autoplace fields only if correct to do so automatically.
Definition: sch_item.h:460
void RotateEnd(wxPoint aPosition)
Definition: sch_line.cpp:408
virtual VECTOR2I GetCenter() const
Returns the center point of the selection area bounding box.
Definition: selection.h:139
bool IsMoving() const
Definition: eda_item.h:169
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1372
double GetTextAngle() const
Definition: eda_text.h:181
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
virtual wxPoint GetPosition() const
Definition: eda_item.h:301
wxPoint GetNearestGridPosition(const wxPoint &aPosition) const
Return the nearest aGridSize location to aPosition.
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: eda_item.h:114
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:214
void RotateStart(wxPoint aPosition)
Definition: sch_line.cpp:402
static TOOL_ACTION rotateCW
Definition: ee_actions.h:114
virtual void Rotate(wxPoint aPosition)=0
Rotate the item around aPosition 90 degrees in the clockwise direction.
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
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_sheet.cpp:591
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:133
EDA_ITEM * GetParent() const
Definition: eda_item.h:164
const KICAD_T rotatableItems[]
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
bool Matches(const TOOL_EVENT &aEvent) const
Test whether two events match in terms of category & action or command.
Definition: tool_event.h:373
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:85
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.h:106
void Rotate(wxPoint aPosition) override
Rotate the item around aPosition 90 degrees in the clockwise direction.
Definition: sch_sheet.cpp:723
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:219
virtual void Rotate90(bool aClockwise)
Definition: sch_text.cpp:230
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:101
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: eda_item.h:111
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
Schematic symbol object.
Definition: sch_symbol.h:78
wxPoint GetRotationCenter() const
Rotating around the boundingBox's center can cause walking when the sheetname or filename is longer t...
Definition: sch_sheet.cpp:602
void Rotate(wxPoint aPosition) override
Rotate the item around aPosition 90 degrees in the clockwise direction.
#define ENDPOINT
ends. (Used to support dragging.)
Definition: eda_item.h:112
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:51
virtual void SetTextAngle(double aAngle)
Definition: eda_text.h:174
const wxPoint GetCenter() const
Definition: eda_rect.h:109
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:267
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:196
bool HasFlag(STATUS_FLAGS aFlag) const
Definition: eda_item.h:205
static TOOL_ACTION refreshPreview
Definition: actions.h:109
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...

References SCH_ITEM::AutoAutoplaceFields(), CHANGED, EE_ACTIONS::clearSelection, CMP_ROTATE_CLOCKWISE, CMP_ROTATE_COUNTERCLOCKWISE, SCH_BASE_FRAME::eeconfig(), EESCHEMA_SETTINGS::AUTOPLACE_FIELDS::enable, ENDPOINT, SCH_SHEET::GetBoundingBox(), EDA_RECT::GetCenter(), SELECTION::GetCenter(), SELECTION::GetItem(), EDA_DRAW_FRAME::GetNearestGridPosition(), EDA_ITEM::GetParent(), SCH_SHEET_PIN::GetParent(), EDA_ITEM::GetPosition(), SCH_SHEET::GetRotationCenter(), SCH_EDIT_FRAME::GetScreen(), SELECTION::GetSize(), EDA_TEXT::GetTextAngle(), TOOL_BASE::getView(), EDA_ITEM::HasFlag(), SCH_ITEM::IsConnectable(), SELECTION::IsHover(), 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_EDIT_FRAME::OnModify(), TOOL_MANAGER::PostEvent(), KIGFX::VIEW::RecacheAllItems(), ACTIONS::refreshPreview, EE_SELECTION_TOOL::RequestSelection(), rotatableItems, SCH_SHEET_PIN::Rotate(), SCH_ITEM::Rotate(), SCH_SHEET::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_COMPONENT_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_TEXT_T, EVENTS::SelectedItemsModified, SCH_COMPONENT::SetOrientation(), EDA_TEXT::SetTextAngle(), STARTPOINT, TEMP_SELECTED, SCH_EDIT_FRAME::TestDanglingEnds(), TEXT_ANGLE_HORIZ, TEXT_ANGLE_VERT, EDA_ITEM::Type(), 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:215
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 133 of file ee_tool_base.h.

134  {
135  KICAD_T itemType = aItem->Type();
136  bool selected = aItem->IsSelected();
137 
138  // IS_SELECTED flag should not be set on undo items which were added for
139  // a drag operation.
140  if( selected && aItem->HasFlag( TEMP_SELECTED ) )
141  aItem->ClearSelected();
142 
143  if( m_isSymbolEditor )
144  {
145  SYMBOL_EDIT_FRAME* editFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
146  wxASSERT( editFrame );
147 
148  editFrame->SaveCopyInUndoList( static_cast<LIB_ITEM*>( aItem ), aType, aAppend );
149  }
150  else
151  {
152  SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
153  wxASSERT( editFrame );
154 
155  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
156  {
157  editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
158  static_cast<SCH_ITEM*>( aItem->GetParent() ),
159  UNDO_REDO::CHANGED, aAppend );
160  }
161  else
162  {
163  editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
164  static_cast<SCH_ITEM*>( aItem ),
165  aType, aAppend );
166  }
167  }
168 
169  if( selected && aItem->HasFlag( TEMP_SELECTED ) )
170  aItem->SetSelected();
171  }
bool IsSelected() const
Definition: eda_item.h:172
void ClearSelected()
Definition: eda_item.h:181
Schematic editor (Eeschema) main window.
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: eda_item.h:114
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:178
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:164
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.
bool HasFlag(STATUS_FLAGS aFlag) const
Definition: eda_item.h:205
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162
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:215
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 1823 of file sch_edit_tool.cpp.

1824 {
1829  Go( &SCH_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorV.MakeEvent() );
1830  Go( &SCH_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorH.MakeEvent() );
1831  Go( &SCH_EDIT_TOOL::DoDelete, ACTIONS::doDelete.MakeEvent() );
1833 
1850 
1853 
1857 }
static TOOL_ACTION editPageNumber
Definition: ee_actions.h:152
static TOOL_ACTION properties
Definition: ee_actions.h:118
static TOOL_ACTION toggleDeMorgan
Definition: ee_actions.h:123
static TOOL_ACTION breakBus
Definition: ee_actions.h:132
static TOOL_ACTION doDelete
Definition: actions.h:75
int Rotate(const TOOL_EVENT &aEvent)
static TOOL_ACTION changeSymbol
Definition: ee_actions.h:146
int EditPageNumber(const TOOL_EVENT &aEvent)
int BreakWire(const TOOL_EVENT &aEvent)
static TOOL_ACTION toText
Definition: ee_actions.h:130
static TOOL_ACTION autoplaceFields
Definition: ee_actions.h:122
int Properties(const TOOL_EVENT &aEvent)
static TOOL_ACTION updateSymbols
Definition: ee_actions.h:145
static TOOL_ACTION mirrorH
Definition: ee_actions.h:117
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:125
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:131
static TOOL_ACTION mirrorV
Definition: ee_actions.h:116
static TOOL_ACTION rotateCW
Definition: ee_actions.h:114
int Duplicate(const TOOL_EVENT &aEvent)
static TOOL_ACTION cleanupSheetPins
Definition: ee_actions.h:188
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:115
int GlobalEdit(const TOOL_EVENT &aEvent)
Delete the selected items, or the item under the cursor.
static TOOL_ACTION editFootprint
Definition: ee_actions.h:121
static TOOL_ACTION updateSymbol
Definition: ee_actions.h:147
int AutoplaceFields(const TOOL_EVENT &aEvent)
static TOOL_ACTION repeatDrawItem
Definition: ee_actions.h:113
int CleanupSheetPins(const TOOL_EVENT &aEvent)
static TOOL_ACTION editTextAndGraphics
Definition: ee_actions.h:189
int DeleteItemCursor(const TOOL_EVENT &aEvent)
static TOOL_ACTION showDeMorganStandard
Definition: ee_actions.h:124
int Mirror(const TOOL_EVENT &aEvent)
int RepeatDrawItem(const TOOL_EVENT &aEvent)
static TOOL_ACTION editValue
Definition: ee_actions.h:120
int EditField(const TOOL_EVENT &aEvent)
static TOOL_ACTION changeSymbols
Definition: ee_actions.h:144
int ChangeSymbols(const TOOL_EVENT &aEvent)
static TOOL_ACTION deleteTool
Definition: actions.h:76
static TOOL_ACTION toLabel
Definition: ee_actions.h:127
static TOOL_ACTION toHLabel
Definition: ee_actions.h:128
static TOOL_ACTION editReference
Definition: ee_actions.h:119
int DoDelete(const TOOL_EVENT &aEvent)
Run the deletion tool.
static TOOL_ACTION toGLabel
Definition: ee_actions.h:129
int ConvertDeMorgan(const TOOL_EVENT &aEvent)
static TOOL_ACTION duplicate
Definition: actions.h:74
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(), Duplicate(), ACTIONS::duplicate, 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 102 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:215
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(), ZOOM_TOOL::Main(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PL_POINT_EDITOR::Main(), CVPCB_CONTROL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::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(), SCH_DRAWING_TOOLS::PlaceComponent(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), 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 174 of file ee_tool_base.h.

◆ m_isSymbolEditor

bool EE_TOOL_BASE< SCH_EDIT_FRAME >::m_isSymbolEditor
protectedinherited

Definition at line 177 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 106 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_CONTROL::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), PCB_VIEWER_TOOLS::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PL_SELECTION_TOOL::Init(), SCH_DRAWING_TOOLS::Init(), GERBVIEW_SELECTION_TOOL::Init(), BOARD_EDITOR_CONTROL::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(), PCB_PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::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(), SCH_DRAWING_TOOLS::PlaceComponent(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), 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 88 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 176 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 210 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 215 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(), MICROWAVE_TOOL::createInductorBetween(), 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(), 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(), Duplicate(), EDIT_TOOL::Duplicate(), EditField(), editFieldText(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), SYMBOL_EDITOR_EDIT_TOOL::editGraphicProperties(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), EE_INSPECTION_TOOL::ExcludeMarker(), PCB_SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), PCB_SELECTION_TOOL::filterSelection(), PCB_SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindComponentAndItem(), PCB_POINT_EDITOR::finishItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), EE_SELECTION_TOOL::GetNode(), 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(), EE_SELECTION_TOOL::GuessSelectionCandidates(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), BOARD_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), PL_EDIT_TOOL::ImportWorksheetContent(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), Init(), GROUP_TOOL::Init(), PAD_TOOL::Init(), CONVERT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), GLOBAL_EDIT_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), PL_POINT_EDITOR::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), PCB_POINT_EDITOR::Init(), POSITION_RELATIVE_TOOL::Init(), BOARD_INSPECTION_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(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), 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(), SCH_MOVE_TOOL::Main(), PL_SELECTION_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(), 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::performRouting(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_EDIT_TOOL::PinTable(), PCB_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), 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(), 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(), 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::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(), 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 214 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 207 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 175 of file ee_tool_base.h.


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