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)
 
int DoDelete (const TOOL_EVENT &aEvent)
 

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

More...
 
int DeleteItemCursor (const TOOL_EVENT &aEvent)
 

Runs the deletion tool.

More...
 
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)
 

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

More...
 
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)
 
void setTransitions () override
 

Sets up handlers for various 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 129 of file sch_edit_tool.cpp.

129  :
130  EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveEdit" )
131 {
132  m_pickerItem = nullptr;
133 }
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(), 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(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PCB_PICKER_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(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceModule(), 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 1231 of file sch_edit_tool.cpp.

1232 {
1234 
1235  if( selection.Empty() )
1236  return 0;
1237 
1238  SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.Front() );
1239 
1240  if( !item->IsNew() )
1242 
1243  item->AutoplaceFields( m_frame->GetScreen(), /* aManual */ true );
1244 
1245  updateItem( item, true );
1246  m_frame->OnModify();
1247 
1248  if( selection.IsHover() )
1250 
1251  return 0;
1252 }
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:49
bool IsNew() const
Definition: eda_item.h:167
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
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)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:138
virtual void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual)
Definition: sch_item.h:473
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:181
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
bool Empty() const
Checks if there is anything selected.
Definition: selection.h: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:107
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:194
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 1668 of file sch_edit_tool.cpp.

1669 {
1670  auto cursorPos = wxPoint( getViewControls()->GetCursorPosition( !aEvent.Modifier( MD_ALT ) ) );
1671 
1672  if( m_frame->BreakSegments( cursorPos ) )
1673  {
1674  if( m_frame->GetScreen()->IsJunctionNeeded( cursorPos, true ) )
1675  m_frame->AddJunction( m_frame->GetScreen(), cursorPos, true, false );
1676 
1678 
1679  m_frame->OnModify();
1680  m_frame->GetCanvas()->Refresh();
1681  }
1682 
1683  return 0;
1684 }
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:371
bool BreakSegments(const wxPoint &aPoint, SCH_SCREEN *aScreen=nullptr)
Checks every wire and bus for a intersection at aPoint and break into two segments at aPoint if an in...
SCH_JUNCTION * AddJunction(SCH_SCREEN *aScreen, const wxPoint &aPos, bool aAppendToUndo, bool aFinal=true)
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.
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:340
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

References SCH_EDIT_FRAME::AddJunction(), SCH_EDIT_FRAME::BreakSegments(), SCH_BASE_FRAME::GetCanvas(), SCH_EDIT_FRAME::GetScreen(), TOOL_BASE::getViewControls(), SCH_SCREEN::IsJunctionNeeded(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, MD_ALT, TOOL_EVENT::Modifier(), SCH_EDIT_FRAME::OnModify(), EDA_DRAW_PANEL_GAL::Refresh(), and SCH_EDIT_FRAME::TestDanglingEnds().

Referenced by setTransitions().

◆ ChangeSymbols()

int SCH_EDIT_TOOL::ChangeSymbols ( const TOOL_EVENT aEvent)

Definition at line 1255 of file sch_edit_tool.cpp.

1256 {
1257  SCH_COMPONENT* selectedSymbol = nullptr;
1259 
1260  if( !selection.Empty() )
1261  selectedSymbol = dynamic_cast<SCH_COMPONENT*>( selection.Front() );
1262 
1264 
1265  if( aEvent.IsAction( &EE_ACTIONS::changeSymbol )
1266  || aEvent.IsAction( &EE_ACTIONS::changeSymbols ) )
1267  {
1269  }
1270 
1271  DIALOG_CHANGE_SYMBOLS dlg( m_frame, selectedSymbol, mode );
1272 
1273  dlg.ShowQuasiModal();
1274 
1275  return 0;
1276 }
static TOOL_ACTION changeSymbol
Definition: ee_actions.h:149
static const KICAD_T ComponentsOnly[]
Definition: ee_collectors.h:47
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:67
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:181
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:122
Schematic symbol object.
Definition: sch_component.h:79
static TOOL_ACTION changeSymbols
Definition: ee_actions.h:147
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 1570 of file sch_edit_tool.cpp.

1571 {
1572  KICAD_T convertTo = aEvent.Parameter<KICAD_T>();
1574  EE_SELECTION& selection = m_selectionTool->RequestSelection( allTextTypes );
1575 
1576  for( unsigned int i = 0; i < selection.GetSize(); ++i )
1577  {
1578  SCH_TEXT* text = dynamic_cast<SCH_TEXT*>( selection.GetItem( i ) );
1579 
1580  if( text && text->Type() != convertTo )
1581  {
1582  bool selected = text->IsSelected();
1583  SCH_TEXT* newtext = nullptr;
1584  const wxPoint& position = text->GetPosition();
1585  LABEL_SPIN_STYLE orientation = text->GetLabelSpinStyle();
1586  wxString txt = UnescapeString( text->GetText() );
1587 
1588  // There can be characters in a SCH_TEXT object that can break labels so we have to
1589  // fix them here.
1590  if( text->Type() == SCH_TEXT_T )
1591  {
1592  txt.Replace( "\n", "_" );
1593  txt.Replace( "\r", "_" );
1594  txt.Replace( "\t", "_" );
1595  txt.Replace( " ", "_" );
1596  }
1597 
1598  // label strings are "escaped" i.e. a '/' is replaced by "{slash}"
1599  if( convertTo != SCH_TEXT_T )
1600  txt = EscapeString( txt, CTX_NETNAME );
1601 
1602  switch( convertTo )
1603  {
1604  case SCH_LABEL_T: newtext = new SCH_LABEL( position, txt ); break;
1605  case SCH_GLOBAL_LABEL_T: newtext = new SCH_GLOBALLABEL( position, txt ); break;
1606  case SCH_HIER_LABEL_T: newtext = new SCH_HIERLABEL( position, txt ); break;
1607  case SCH_TEXT_T: newtext = new SCH_TEXT( position, txt ); break;
1608 
1609  default:
1610  wxFAIL_MSG( wxString::Format( "Invalid text type: %d.", convertTo ) );
1611  return 0;
1612  }
1613 
1614  // Copy the old text item settings to the new one. Justifications are not copied
1615  // because they are not used in labels. Justifications will be set to default value
1616  // in the new text item type.
1617  //
1618  newtext->SetFlags( text->GetEditFlags() );
1619  newtext->SetShape( text->GetShape() );
1620  newtext->SetLabelSpinStyle( orientation );
1621  newtext->SetTextSize( text->GetTextSize() );
1622  newtext->SetTextThickness( text->GetTextThickness() );
1623  newtext->SetItalic( text->IsItalic() );
1624  newtext->SetBold( text->IsBold() );
1625  newtext->SetIsDangling( text->IsDangling() );
1626 
1627  if( selected )
1629 
1630  if( !text->IsNew() )
1631  {
1633  saveCopyInUndoList( newtext, UNDO_REDO::NEWITEM, true );
1634 
1636  m_frame->AddToScreen( newtext, m_frame->GetScreen() );
1637  }
1638 
1639  if( selected )
1640  m_toolMgr->RunAction( EE_ACTIONS::addItemToSel, true, newtext );
1641 
1642  // Otherwise, pointer is owned by the undo stack
1643  if( text->IsNew() )
1644  delete text;
1645 
1646  if( convertTo == SCH_TEXT_T )
1647  {
1648  if( newtext->IsDangling() )
1649  {
1650  newtext->SetIsDangling( false );
1651  getView()->Update( newtext, KIGFX::REPAINT );
1652  }
1653  }
1654  else
1656 
1657  m_frame->OnModify();
1658  }
1659  }
1660 
1661  if( selection.IsHover() )
1663 
1664  return 0;
1665 }
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:171
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:167
static TOOL_ACTION removeItemFromSel
Definition: ee_actions.h:60
bool IsItalic() const
Definition: eda_text.h:187
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
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:201
static TOOL_ACTION addItemToSel
Selects an item (specified as the event parameter).
Definition: ee_actions.h:59
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:138
STATUS_FLAGS GetEditFlags() const
Definition: eda_item.h:206
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:426
const wxSize & GetTextSize() const
Definition: eda_text.h:245
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:181
LABEL_SPIN_STYLE GetLabelSpinStyle() const
Definition: sch_text.h:233
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
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:1513
PINSHEETLABEL_SHAPE GetShape() const
Definition: sch_text.h:235
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:161

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 1687 of file sch_edit_tool.cpp.

1688 {
1690  SCH_SHEET* sheet = (SCH_SHEET*) selection.Front();
1691 
1692  if( !sheet )
1693  return 0;
1694 
1695  if( !sheet->HasUndefinedPins() )
1696  {
1697  DisplayInfoMessage( m_frame, _( "There are no unreferenced pins in this sheet to remove." ) );
1698  return 0;
1699  }
1700 
1701  if( !IsOK( m_frame, _( "Do you wish to delete the unreferenced pins from this sheet?" ) ) )
1702  return 0;
1703 
1705 
1706  sheet->CleanupSheet();
1707 
1708  updateItem( sheet, true );
1709  m_frame->OnModify();
1710 
1711  if( selection.IsHover() )
1713 
1714  return 0;
1715 }
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:356
static const KICAD_T SheetsOnly[]
Definition: ee_collectors.h:48
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:138
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:181
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
void CleanupSheet()
Delete sheet label which do not have a corresponding hierarchical label.
Definition: sch_sheet.cpp:458
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:107
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:281
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:297
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 1279 of file sch_edit_tool.cpp.

1280 {
1282 
1283  if( selection.Empty() )
1284  return 0;
1285 
1286  SCH_COMPONENT* component = (SCH_COMPONENT*) selection.Front();
1287 
1289  && component->GetConvert() == LIB_ITEM::LIB_CONVERT::BASE )
1290  {
1291  return 0;
1292  }
1293 
1295  && component->GetConvert() != LIB_ITEM::LIB_CONVERT::DEMORGAN )
1296  {
1297  return 0;
1298  }
1299 
1300  if( !component->IsNew() )
1301  saveCopyInUndoList( component, UNDO_REDO::CHANGED );
1302 
1303  m_frame->ConvertPart( component );
1304 
1305  if( component->IsNew() )
1307 
1308  if( selection.IsHover() )
1310 
1311  return 0;
1312 }
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:47
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:128
bool IsNew() const
Definition: eda_item.h:167
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:67
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:138
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:181
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static TOOL_ACTION showDeMorganStandard
Definition: ee_actions.h:127
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:122
Schematic symbol object.
Definition: sch_component.h:79
int GetConvert() const
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)

Runs the deletion tool.

Definition at line 1079 of file sch_edit_tool.cpp.

1080 {
1081  std::string tool = aEvent.GetCommandStr().get();
1082  PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
1083 
1085  m_pickerItem = nullptr;
1086 
1087  // Deactivate other tools; particularly important if another PICKER is currently running
1088  Activate();
1089 
1090  picker->SetCursor( KICURSOR::REMOVE );
1091 
1092  picker->SetClickHandler(
1093  [this]( const VECTOR2D& aPosition ) -> bool
1094  {
1095  if( m_pickerItem )
1096  {
1097  SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( m_pickerItem );
1098 
1099  if( sch_item && sch_item->IsLocked() )
1100  {
1101  STATUS_TEXT_POPUP statusPopup( m_frame );
1102  statusPopup.SetText( _( "Item locked." ) );
1103  statusPopup.PopupFor( 2000 );
1104  statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
1105  return true;
1106  }
1107 
1109  selectionTool->UnbrightenItem( m_pickerItem );
1110  selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
1112  m_pickerItem = nullptr;
1113  }
1114 
1115  return true;
1116  } );
1117 
1118  picker->SetMotionHandler(
1119  [this]( const VECTOR2D& aPos )
1120  {
1121  EE_COLLECTOR collector;
1122  collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
1123  collector.Collect( m_frame->GetScreen(), deletableItems, (wxPoint) aPos );
1124 
1126  selectionTool->GuessSelectionCandidates( collector, aPos );
1127 
1128  EDA_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr;
1129 
1130  if( m_pickerItem != item )
1131  {
1132  if( m_pickerItem )
1133  selectionTool->UnbrightenItem( m_pickerItem );
1134 
1135  m_pickerItem = item;
1136 
1137  if( m_pickerItem )
1138  selectionTool->BrightenItem( m_pickerItem );
1139  }
1140  } );
1141 
1142  picker->SetFinalizeHandler(
1143  [this]( const int& aFinalState )
1144  {
1145  if( m_pickerItem )
1147 
1148  // Wake the selection tool after exiting to ensure the cursor gets updated
1150  } );
1151 
1152  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
1153 
1154  return 0;
1155 }
#define HITTEST_THRESHOLD_PIXELS
int m_Threshold
Definition: collector.h:248
void SetMotionHandler(MOTION_HANDLER aHandler)
Set a handler for mouse motion.
Definition: picker_tool.h:84
static TOOL_ACTION doDelete
Definition: actions.h:75
void SetClickHandler(CLICK_HANDLER aHandler)
Set a handler for mouse click event.
Definition: picker_tool.h:73
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.
void SetCursor(KICURSOR aCursor)
Definition: picker_tool.h:66
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 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
void SetFinalizeHandler(FINALIZE_HANDLER aHandler)
Set a handler for the finalize event.
Definition: picker_tool.h:104
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)
static TOOL_ACTION selectionActivate
Activation of the selection tool.
Definition: ee_actions.h:46
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
void UnbrightenItem(EDA_ITEM *aItem)
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
EDA_ITEM * m_pickerItem
Definition: sch_edit_tool.h:88
virtual bool IsLocked() const
Definition: sch_item.h:268
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:454
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:148
void Activate()
Run the tool.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:194

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::SetClickHandler(), PICKER_TOOL::SetCursor(), PICKER_TOOL::SetFinalizeHandler(), PICKER_TOOL::SetMotionHandler(), STATUS_TEXT_POPUP::SetText(), and EE_SELECTION_TOOL::UnbrightenItem().

Referenced by setTransitions().

◆ DoDelete()

int SCH_EDIT_TOOL::DoDelete ( const TOOL_EVENT aEvent)

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

Definition at line 991 of file sch_edit_tool.cpp.

992 {
993  SCH_SCREEN* screen = m_frame->GetScreen();
995  bool appendToUndo = false;
996  std::vector<wxPoint> pts;
997 
998  if( items.empty() )
999  return 0;
1000 
1001  // Don't leave a freed pointer in the selection
1003 
1004  for( EDA_ITEM* item : items )
1005  item->ClearFlags( STRUCT_DELETED );
1006 
1007  for( EDA_ITEM* item : items )
1008  {
1009  SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item );
1010 
1011  if( !sch_item )
1012  continue;
1013 
1014  if( sch_item->IsConnectable() )
1015  {
1016  std::vector<wxPoint> tmp_pts = sch_item->GetConnectionPoints();
1017  pts.insert( pts.end(), tmp_pts.begin(), tmp_pts.end() );
1018  }
1019 
1020  if( sch_item->Type() == SCH_JUNCTION_T )
1021  {
1022  sch_item->SetFlags( STRUCT_DELETED );
1023  // clean up junctions at the end
1024  }
1025  else if( sch_item->Type() == SCH_SHEET_PIN_T )
1026  {
1027  SCH_SHEET_PIN* pin = (SCH_SHEET_PIN*) sch_item;
1028  SCH_SHEET* sheet = pin->GetParent();
1029 
1030  if( !alg::contains( items, sheet ) )
1031  {
1032  pin->SetFlags( STRUCT_DELETED );
1033  saveCopyInUndoList( item, UNDO_REDO::DELETED, appendToUndo );
1034  appendToUndo = true;
1035 
1036  updateItem( pin, false );
1037 
1038  sheet->RemovePin( pin );
1039  }
1040  }
1041  else
1042  {
1043  sch_item->SetFlags( STRUCT_DELETED );
1044  saveCopyInUndoList( item, UNDO_REDO::DELETED, appendToUndo );
1045  appendToUndo = true;
1046 
1047  updateItem( sch_item, false );
1048 
1049  m_frame->RemoveFromScreen( sch_item, m_frame->GetScreen() );
1050 
1051  if( sch_item->Type() == SCH_SHEET_T )
1053  }
1054  }
1055 
1056  for( auto point : pts )
1057  {
1058  SCH_ITEM* junction = screen->GetItem( point, 0, SCH_JUNCTION_T );
1059 
1060  if( !junction )
1061  continue;
1062 
1063  if( junction->HasFlag( STRUCT_DELETED ) || !screen->IsJunctionNeeded( point ) )
1064  m_frame->DeleteJunction( junction, appendToUndo );
1065  }
1066 
1068 
1069  m_frame->GetCanvas()->Refresh();
1070  m_frame->OnModify();
1071 
1072  return 0;
1073 }
virtual bool IsConnectable() const
Definition: sch_item.h:383
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:397
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:371
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)
Function RequestSelection()
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:201
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)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:138
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:181
#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:56
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:107
void RemovePin(const SCH_SHEET_PIN *aSheetPin)
Remove aSheetPin from the sheet.
Definition: sch_sheet.cpp:294
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:148
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:310
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:194
bool HasFlag(STATUS_FLAGS aFlag) const
Definition: eda_item.h:204
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:161

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 789 of file sch_edit_tool.cpp.

790 {
792 
793  if( selection.GetSize() == 0 )
794  return 0;
795 
796  // Doing a duplicate of a new object doesn't really make any sense; we'd just end
797  // up dragging around a stack of objects...
798  if( selection.Front()->IsNew() )
799  return 0;
800 
801  EDA_ITEMS newItems;
802 
803  // Keep track of existing sheet paths. Duplicating a selection can modify this list
804  bool copiedSheets = false;
805  SCH_SHEET_LIST initial_sheetpathList = m_frame->Schematic().GetSheets();
806 
807  for( unsigned ii = 0; ii < selection.GetSize(); ++ii )
808  {
809  SCH_ITEM* oldItem = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
810  SCH_ITEM* newItem = oldItem->Duplicate();
811  newItem->SetFlags( IS_NEW );
812  newItems.push_back( newItem );
813  saveCopyInUndoList( newItem, UNDO_REDO::NEWITEM, ii > 0 );
814 
815  switch( newItem->Type() )
816  {
817  case SCH_JUNCTION_T:
818  case SCH_LINE_T:
819  case SCH_BUS_BUS_ENTRY_T:
821  case SCH_TEXT_T:
822  case SCH_LABEL_T:
823  case SCH_GLOBAL_LABEL_T:
824  case SCH_HIER_LABEL_T:
825  case SCH_NO_CONNECT_T:
826  newItem->SetParent( m_frame->GetScreen() );
827  m_frame->AddToScreen( newItem, m_frame->GetScreen() );
828  break;
829 
830  case SCH_SHEET_T:
831  {
832  SCH_SHEET_LIST hierarchy = m_frame->Schematic().GetSheets();
833  SCH_SHEET* sheet = (SCH_SHEET*) newItem;
834  SCH_FIELD& nameField = sheet->GetFields()[SHEETNAME];
835  wxString baseName = nameField.GetText();
836  wxString number;
837 
838  while( !baseName.IsEmpty() && wxIsdigit( baseName.Last() ) )
839  {
840  number = baseName.Last() + number;
841  baseName.RemoveLast();
842  }
843 
844  int uniquifier = std::max( 0, wxAtoi( number ) ) + 1;
845  wxString candidateName = wxString::Format( wxT( "%s%d" ), baseName, uniquifier++ );
846 
847  while( hierarchy.NameExists( candidateName ) )
848  candidateName = wxString::Format( wxT( "%s%d" ), baseName, uniquifier++ );
849 
850  nameField.SetText( candidateName );
851 
852  sheet->SetParent( m_frame->GetCurrentSheet().Last() );
853  m_frame->AddToScreen( sheet, m_frame->GetScreen() );
854 
855  copiedSheets = true;
856  break;
857  }
858 
859  case SCH_COMPONENT_T:
860  {
861  SCH_COMPONENT* component = (SCH_COMPONENT*) newItem;
862  component->ClearAnnotation( NULL );
863  component->SetParent( m_frame->GetScreen() );
864  m_frame->AddToScreen( component, m_frame->GetScreen() );
865  break;
866  }
867 
868  default:
869  break;
870  }
871  }
872 
873  if( copiedSheets )
874  {
875  // We clear annotation of new sheet paths.
876  // Annotation of new components added in current sheet is already cleared.
877  SCH_SCREENS screensList( &m_frame->Schematic().Root() );
878  screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
880  }
881 
883  m_toolMgr->RunAction( EE_ACTIONS::addItemsToSel, true, &newItems );
885 
886  return 0;
887 }
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
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:97
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:63
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:164
bool IsNew() const
Definition: eda_item.h:167
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
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:201
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)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:138
SCHEMATIC & Schematic() const
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:181
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: eda_item.h:555
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
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 & Root() const
Definition: schematic.h:102
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_component.h:79
SCH_SHEET_PATH & GetCurrentSheet() const
static TOOL_ACTION move
Definition: ee_actions.h:114
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:194
#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:528
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 1185 of file sch_edit_tool.cpp.

1186 {
1187  static KICAD_T Nothing[] = { EOT };
1188  static KICAD_T CmpOrReference[] = { SCH_FIELD_LOCATE_REFERENCE_T, SCH_COMPONENT_T, EOT };
1189  static KICAD_T CmpOrValue[] = { SCH_FIELD_LOCATE_VALUE_T, SCH_COMPONENT_T, EOT };
1190  static KICAD_T CmpOrFootprint[] = { SCH_FIELD_LOCATE_FOOTPRINT_T, SCH_COMPONENT_T, EOT };
1191 
1192  KICAD_T* filter = Nothing;
1193 
1194  if( aEvent.IsAction( &EE_ACTIONS::editReference ) )
1195  filter = CmpOrReference;
1196  else if( aEvent.IsAction( &EE_ACTIONS::editValue ) )
1197  filter = CmpOrValue;
1198  else if( aEvent.IsAction( &EE_ACTIONS::editFootprint ) )
1199  filter = CmpOrFootprint;
1200 
1201  EE_SELECTION& selection = m_selectionTool->RequestSelection( filter );
1202 
1203  if( selection.Size() != 1 )
1204  return 0;
1205 
1206  SCH_ITEM* item = (SCH_ITEM*) selection.Front();
1207 
1208  if( item->Type() == SCH_COMPONENT_T )
1209  {
1210  SCH_COMPONENT* component = (SCH_COMPONENT*) item;
1211 
1212  if( aEvent.IsAction( &EE_ACTIONS::editReference ) )
1213  editFieldText( component->GetField( REFERENCE_FIELD ) );
1214  else if( aEvent.IsAction( &EE_ACTIONS::editValue ) )
1215  editFieldText( component->GetField( VALUE_FIELD ) );
1216  else if( aEvent.IsAction( &EE_ACTIONS::editFootprint ) )
1217  editFieldText( component->GetField( FOOTPRINT_FIELD ) );
1218  }
1219  else if( item->Type() == SCH_FIELD_T )
1220  {
1221  editFieldText( (SCH_FIELD*) item );
1222  }
1223 
1224  if( selection.IsHover() )
1226 
1227  return 0;
1228 }
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
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
Field Value of part, i.e. "3.3K".
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:67
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
void editFieldText(SCH_FIELD *aField)
static TOOL_ACTION editFootprint
Definition: ee_actions.h:124
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:181
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
Field Name Module PCB, i.e. "16DIP300".
SCH_FIELD * GetField(int aFieldNdx)
Returns a field in this symbol.
static TOOL_ACTION editValue
Definition: ee_actions.h:123
int Size() const
Returns the number of selected parts.
Definition: selection.h:128
Schematic symbol object.
Definition: sch_component.h:79
static TOOL_ACTION editReference
Definition: ee_actions.h:122
Field Reference of part, i.e. "IC21".
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:194
EDA_ITEM * Front() const
Definition: selection.h:203
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:161

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

Definition at line 1158 of file sch_edit_tool.cpp.

1159 {
1160  // Save old component in undo list if not already in edit, or moving.
1161  if( aField->GetEditFlags() == 0 ) // i.e. not edited, or moved
1163 
1164  wxString title = wxString::Format( _( "Edit %s Field" ), aField->GetName() );
1165 
1166  DIALOG_SCH_EDIT_ONE_FIELD dlg( m_frame, title, aField );
1167 
1168  // The footprint field dialog can invoke a KIWAY_PLAYER so we must use a quasi-modal
1169  if( dlg.ShowQuasiModal() != wxID_OK )
1170  return;
1171 
1172  dlg.UpdateField( aField, &m_frame->GetCurrentSheet() );
1173 
1174  if( m_frame->eeconfig()->m_AutoplaceFields.enable || aField->GetParent()->Type() == SCH_SHEET_T )
1175  static_cast<SCH_ITEM*>( aField->GetParent() )->AutoAutoplaceFields( m_frame->GetScreen() );
1176 
1177  m_frame->UpdateItem( aField );
1178  m_frame->OnModify();
1179 
1180  // This must go after OnModify() so that the connectivity graph will have been updated.
1182 }
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:216
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)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:138
STATUS_FLAGS GetEditFlags() const
Definition: eda_item.h:206
EDA_ITEM * GetParent() const
Definition: eda_item.h:163
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:161

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 1718 of file sch_edit_tool.cpp.

1719 {
1721 
1722  if( selection.GetSize() > 1 )
1723  return 0;
1724 
1725  SCH_SHEET* sheet = (SCH_SHEET*) selection.Front();
1726 
1727  SCH_SHEET_PATH instance = m_frame->GetCurrentSheet();
1728 
1729  SCH_SCREEN* screen;
1730 
1731  if( sheet )
1732  {
1733  // When changing the page number of a selected sheet, the current screen owns the sheet.
1734  screen = m_frame->GetScreen();
1735 
1736  instance.push_back( sheet );
1737  }
1738  else
1739  {
1740  SCH_SHEET_PATH prevInstance = instance;
1741 
1742  // When change the page number in the screen, the previous screen owns the sheet.
1743  if( prevInstance.size() )
1744  {
1745  prevInstance.pop_back();
1746  screen = prevInstance.LastScreen();
1747  }
1748  else
1749  {
1750  // The root sheet and root screen are effectively the same thing.
1751  screen = m_frame->GetScreen();
1752  }
1753 
1754  sheet = m_frame->GetCurrentSheet().Last();
1755  }
1756 
1757  wxString msg;
1758  wxString sheetPath = instance.PathHumanReadable( false );
1759  wxString pageNumber = instance.GetPageNumber();
1760 
1761  msg.Printf( _( "Enter page number for sheet path%s" ),
1762  ( sheetPath.Length() > 20 ) ? "\n" + sheetPath : " " + sheetPath );
1763 
1764  wxTextEntryDialog dlg( m_frame, msg, _( "Edit Page Number" ), pageNumber );
1765 
1766  dlg.SetTextValidator( wxFILTER_ALPHANUMERIC ); // No white space.
1767 
1768  if( dlg.ShowModal() == wxID_CANCEL || dlg.GetValue() == instance.GetPageNumber() )
1769  return 0;
1770 
1771  m_frame->SaveCopyInUndoList( screen, sheet, UNDO_REDO::CHANGED, false );
1772 
1773  instance.SetPageNumber( dlg.GetValue() );
1774 
1775  if( instance == m_frame->GetCurrentSheet() )
1776  {
1777  m_frame->GetScreen()->SetPageNumber( dlg.GetValue() );
1779  }
1780 
1781  m_frame->OnModify();
1782 
1783  return 0;
1784 }
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 thesheet names.
void OnPageSettingsChange() override
Called when modifying the page settings.
static const KICAD_T SheetsOnly[]
Definition: ee_collectors.h:48
void pop_back()
Forwarded method from std::vector.
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
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
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:181
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()
#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:284
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(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindComponentAndItem(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCB_CONTROL::GridResetOrigin(), PCB_CONTROL::GridSetOrigin(), 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(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_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(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PNS::TOOL_BASE::pickSingleItem(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceModule(), 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_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:286

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(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), 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(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PCB_PICKER_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(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceModule(), 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(), PICKER_TOOL::setControls(), PCB_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)

◆ 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 ZOOM_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), BOARD_REANNOTATE_TOOL::setTransitions(), GERBVIEW_INSPECTION_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), SYMBOL_EDITOR_PIN_TOOL::setTransitions(), SCH_NAVIGATE_TOOL::setTransitions(), SYMBOL_EDITOR_MOVE_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), COMMON_CONTROL::setTransitions(), EE_POINT_EDITOR::setTransitions(), PL_POINT_EDITOR::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), CONVERT_TOOL::setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), DRC_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), MICROWAVE_TOOL::setTransitions(), PCB_POINT_EDITOR::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), PAD_TOOL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), GROUP_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), PL_EDIT_TOOL::setTransitions(), FOOTPRINT_EDITOR_CONTROL::setTransitions(), setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), PCB_CONTROL::setTransitions(), COMMON_TOOLS::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), PCB_PICKER_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), BOARD_INSPECTION_TOOL::setTransitions(), BOARD_EDITOR_CONTROL::setTransitions(), DRAWING_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), PCB_SELECTION_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 138 of file sch_edit_tool.cpp.

139 {
141 
144 
145  wxASSERT_MSG( drawingTools, "eeshema.InteractiveDrawing tool is not available" );
146 
147  auto hasElements =
148  [ this ] ( const SELECTION& aSel )
149  {
150  return !m_frame->GetScreen()->Items().empty();
151  };
152 
153  auto sheetTool =
154  [ this ] ( const SELECTION& aSel )
155  {
157  };
158 
159  auto anyTextTool =
160  [ this ] ( const SELECTION& aSel )
161  {
166  };
167 
168  auto duplicateCondition =
169  [] ( const SELECTION& aSel )
170  {
172  return false;
173 
174  return true;
175  };
176 
177  auto orientCondition =
178  [] ( const SELECTION& aSel )
179  {
180  if( aSel.Empty() )
181  return false;
182 
184  return false;
185 
186  SCH_ITEM* item = (SCH_ITEM*) aSel.Front();
187 
188  if( aSel.GetSize() > 1 )
189  return true;
190 
191  switch( item->Type() )
192  {
193  case SCH_MARKER_T:
194  case SCH_JUNCTION_T:
195  case SCH_NO_CONNECT_T:
196  case SCH_PIN_T:
197  return false;
198  case SCH_LINE_T:
199  return item->GetLayer() != LAYER_WIRE && item->GetLayer() != LAYER_BUS;
200  default:
201  return true;
202  }
203  };
204 
205  auto propertiesCondition =
206  []( const SELECTION& aSel )
207  {
208  if( aSel.GetSize() == 0 )
209  return true; // Show worksheet properties
210 
211  SCH_ITEM* firstItem = dynamic_cast<SCH_ITEM*>( aSel.Front() );
212  const EE_SELECTION* eeSelection = dynamic_cast<const EE_SELECTION*>( &aSel );
213 
214  if( !firstItem || !eeSelection )
215  return false;
216 
217  switch( firstItem->Type() )
218  {
219  case SCH_COMPONENT_T:
220  case SCH_SHEET_T:
221  case SCH_SHEET_PIN_T:
222  case SCH_TEXT_T:
223  case SCH_LABEL_T:
224  case SCH_GLOBAL_LABEL_T:
225  case SCH_HIER_LABEL_T:
226  case SCH_FIELD_T:
227  case SCH_BITMAP_T:
228  return aSel.GetSize() == 1;
229 
230  case SCH_LINE_T:
232  return eeSelection->AllItemsHaveLineStroke();
233 
234  case SCH_JUNCTION_T:
235  return eeSelection->AreAllItemsIdentical();
236 
237  default:
238  return false;
239  }
240  };
241 
242  static KICAD_T toLabelTypes[] = { SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT };
243  auto toLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toLabelTypes );
244 
245  static KICAD_T toHLableTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_TEXT_T, EOT };
246  auto toHLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toHLableTypes );
247 
248  static KICAD_T toGLableTypes[] = { SCH_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT };
249  auto toGLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toGLableTypes );
250 
251  static KICAD_T toTextTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, EOT };
252  auto toTextlCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toTextTypes );
253 
254  static KICAD_T entryTypes[] = { SCH_BUS_WIRE_ENTRY_T, SCH_BUS_BUS_ENTRY_T, EOT };
255  auto entryCondition = E_C::MoreThan( 0 ) && E_C::OnlyTypes( entryTypes );
256 
257  static KICAD_T fieldParentTypes[] = { SCH_COMPONENT_T, SCH_SHEET_T, SCH_GLOBAL_LABEL_T, EOT };
258  auto singleFieldParentCondition = E_C::Count( 1 ) && E_C::OnlyTypes( fieldParentTypes );
259 
260  auto singleSymbolCondition = E_C::Count( 1 ) && E_C::OnlyType( SCH_COMPONENT_T );
261 
262  auto singleSheetCondition = E_C::Count( 1 ) && E_C::OnlyType( SCH_SHEET_T );
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::mirrorX, orientCondition );
274  moveMenu.AddItem( EE_ACTIONS::mirrorY, orientCondition );
275 
276  moveMenu.AddItem( EE_ACTIONS::properties, propertiesCondition );
277  moveMenu.AddItem( EE_ACTIONS::editReference, singleSymbolCondition );
278  moveMenu.AddItem( EE_ACTIONS::editValue, singleSymbolCondition );
279  moveMenu.AddItem( EE_ACTIONS::editFootprint, singleSymbolCondition );
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::mirrorX, orientCondition, 200 );
305  drawMenu.AddItem( EE_ACTIONS::mirrorY, orientCondition, 200 );
306 
307  drawMenu.AddItem( EE_ACTIONS::properties, propertiesCondition, 200 );
308  drawMenu.AddItem( EE_ACTIONS::editReference, singleSymbolCondition, 200 );
309  drawMenu.AddItem( EE_ACTIONS::editValue, singleSymbolCondition, 200 );
310  drawMenu.AddItem( EE_ACTIONS::editFootprint, singleSymbolCondition, 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 
319  drawMenu.AddItem( EE_ACTIONS::editWithLibEdit, singleSymbolCondition && E_C::Idle, 200 );
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::mirrorX, orientCondition, 200 );
335  selToolMenu.AddItem( EE_ACTIONS::mirrorY, 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 
349  selToolMenu.AddItem( EE_ACTIONS::editWithLibEdit, singleSymbolCondition && E_C::Idle, 200 );
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:121
bool IsCurrentTool(const TOOL_ACTION &aAction) const
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
static TOOL_ACTION toggleDeMorgan
Definition: ee_actions.h:126
static SELECTION_CONDITION SingleSymbol
static TOOL_ACTION doDelete
Definition: actions.h:75
SCH_DRAWING_TOOLS.
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 mirrorY
Definition: ee_actions.h:120
static TOOL_ACTION placeHierLabel
Definition: ee_actions.h:87
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
static TOOL_ACTION changeSymbol
Definition: ee_actions.h:149
TOOL_MENU & GetToolMenu()
static TOOL_ACTION toText
Definition: ee_actions.h:133
static TOOL_ACTION autoplaceFields
Definition: ee_actions.h:125
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 rotateCW
Definition: ee_actions.h:117
bool Init() override
Init() is called once upon a registration of the tool.
Definition: ee_tool_base.h:69
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:88
static SELECTION_CONDITION SingleDeMorganSymbol
static TOOL_ACTION copy
Definition: actions.h:70
static TOOL_ACTION cleanupSheetPins
Definition: ee_actions.h:192
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:118
static TOOL_ACTION editFootprint
Definition: ee_actions.h:124
static TOOL_ACTION placeSchematicText
Definition: ee_actions.h:91
static TOOL_ACTION updateSymbol
Definition: ee_actions.h:150
static TOOL_ACTION cut
Definition: actions.h:69
static TOOL_ACTION mirrorX
Definition: ee_actions.h:119
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:181
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:285
static TOOL_ACTION placeLabel
Definition: ee_actions.h:85
static bool IsDrawingLineWireOrBus(const SELECTION &aSelection)
static TOOL_ACTION editValue
Definition: ee_actions.h:123
void AddSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Store a submenu of this menu model.
Definition: tool_menu.cpp:52
EE_RTREE & Items()
Definition: sch_screen.h:159
static SELECTION_CONDITION OnlyType(KICAD_T aType)
Create a functor that tests if the selected items are only of given type.
static TOOL_ACTION editWithLibEdit
Definition: ee_actions.h:162
static TOOL_ACTION toLabel
Definition: ee_actions.h:130
static TOOL_ACTION toHLabel
Definition: ee_actions.h:131
static TOOL_ACTION editReference
Definition: ee_actions.h:122
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:86
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:194
static TOOL_ACTION selectAll
Definition: actions.h:73
static TOOL_ACTION toGLabel
Definition: ee_actions.h:132
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:161

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::mirrorX, EE_ACTIONS::mirrorY, 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_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 595 of file sch_edit_tool.cpp.

596 {
598 
599  if( selection.GetSize() == 0 )
600  return 0;
601 
602  wxPoint mirrorPoint;
603  bool xAxis = ( aEvent.Matches( EE_ACTIONS::mirrorX.MakeEvent() ) );
604  SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.Front() );
605  bool connections = false;
606  bool moving = item->IsMoving();
607 
608  if( selection.GetSize() == 1 )
609  {
610  if( !moving )
612 
613  switch( item->Type() )
614  {
615  case SCH_COMPONENT_T:
616  {
617  SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
618 
619  if( xAxis )
620  component->SetOrientation( CMP_MIRROR_X );
621  else
622  component->SetOrientation( CMP_MIRROR_Y );
623 
625  component->AutoAutoplaceFields( m_frame->GetScreen() );
626 
627  break;
628  }
629 
630  case SCH_TEXT_T:
631  case SCH_LABEL_T:
632  case SCH_GLOBAL_LABEL_T:
633  case SCH_HIER_LABEL_T:
634  {
635  SCH_TEXT* textItem = static_cast<SCH_TEXT*>( item );
636  textItem->MirrorSpinStyle( !xAxis );
637  break;
638  }
639 
640  case SCH_SHEET_PIN_T:
641  {
642  // mirror within parent sheet
643  SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
644  SCH_SHEET* sheet = pin->GetParent();
645 
646  if( xAxis )
647  pin->MirrorX( sheet->GetBoundingBox().GetCenter().y );
648  else
649  pin->MirrorY( sheet->GetBoundingBox().GetCenter().x );
650 
651  break;
652  }
653 
654  case SCH_BUS_BUS_ENTRY_T:
656  if( xAxis )
657  item->MirrorX( item->GetPosition().y );
658  else
659  item->MirrorY( item->GetPosition().x );
660  break;
661 
662  case SCH_FIELD_T:
663  {
664  SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
665 
666  if( xAxis )
668  else
670 
671  // Now that we're re-justifying a field, they're no longer autoplaced.
672  static_cast<SCH_ITEM*>( item->GetParent() )->ClearFieldsAutoplaced();
673 
674  break;
675  }
676 
677  case SCH_BITMAP_T:
678  if( xAxis )
679  item->MirrorX( item->GetPosition().y );
680  else
681  item->MirrorY( item->GetPosition().x );
682 
683  // The bitmap is cached in Opengl: clear the cache to redraw
685  break;
686 
687  case SCH_SHEET_T:
688  // Mirror the sheet on itself. Sheets do not have a anchor point.
689  mirrorPoint = m_frame->GetNearestGridPosition( item->GetBoundingBox().Centre() );
690 
691  if( xAxis )
692  item->MirrorX( mirrorPoint.y );
693  else
694  item->MirrorY( mirrorPoint.x );
695 
696  break;
697 
698  default:
699  break;
700  }
701 
702  connections = item->IsConnectable();
703  m_frame->UpdateItem( item );
704  }
705  else if( selection.GetSize() > 1 )
706  {
707  mirrorPoint = m_frame->GetNearestGridPosition( (wxPoint)selection.GetCenter() );
708 
709  for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
710  {
711  item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
712 
713  if( !moving )
714  saveCopyInUndoList( item, UNDO_REDO::CHANGED, ii > 0 );
715 
716  if( item->Type() == SCH_SHEET_PIN_T )
717  {
718  if( item->GetParent()->IsSelected() )
719  {
720  // parent will mirror us
721  }
722  else
723  {
724  // mirror within parent sheet
725  SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
726  SCH_SHEET* sheet = pin->GetParent();
727 
728  if( xAxis )
729  pin->MirrorX( sheet->GetBoundingBox().GetCenter().y );
730  else
731  pin->MirrorY( sheet->GetBoundingBox().GetCenter().x );
732  }
733  }
734  else
735  {
736  if( xAxis )
737  item->MirrorX( mirrorPoint.y );
738  else
739  item->MirrorY( mirrorPoint.x );
740  }
741 
742  connections |= item->IsConnectable();
743  m_frame->UpdateItem( item );
744  }
745  }
746 
748 
749  // Update R-Tree for modified items
750  for( EDA_ITEM* selected : selection )
751  updateItem( selected, true );
752 
753  if( item->IsMoving() )
754  {
756  }
757  else
758  {
759  if( selection.IsHover() )
761 
762  if( connections )
764 
765  m_frame->OnModify();
766  }
767 
768  return 0;
769 }
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:383
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:171
void MirrorY(int aYaxis_position) override
Mirror item relative to the Y axis about aYaxis_position.
void AutoAutoplaceFields(SCH_SCREEN *aScreen)
Autoplace fields only if correct to do so automatically.
Definition: sch_item.h:467
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:168
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1377
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:300
wxPoint GetNearestGridPosition(const wxPoint &aPosition) const
Return the nearest aGridSize location to aPosition.
void MirrorX(int aXaxis_position) override
Mirror item relative to the X axis about aXaxis_position.
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:216
EESCHEMA_SETTINGS * eeconfig() const
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
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:576
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)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:138
void SetVertJustify(EDA_TEXT_VJUSTIFY_T aType)
Definition: eda_text.h:209
EDA_ITEM * GetParent() const
Definition: eda_item.h:163
const KICAD_T rotatableItems[]
static TOOL_ACTION mirrorX
Definition: ee_actions.h:119
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:181
bool Matches(const TOOL_EVENT &aEvent) const
Test whether two events match in terms of category & action or command.
Definition: tool_event.h:361
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:85
virtual void MirrorX(int aXaxis_position)=0
Mirror item relative to the X axis about aXaxis_position.
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
virtual void MirrorY(int aYaxis_position)=0
Mirror item relative to the Y axis about aYaxis_position.
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:107
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 SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:208
Schematic symbol object.
Definition: sch_component.h:79
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:148
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:194
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:161
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::GetNearestGridPosition(), 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_TEXT::MirrorSpinStyle(), EE_ACTIONS::mirrorX, SCH_SHEET_PIN::MirrorX(), SCH_ITEM::MirrorX(), SCH_SHEET_PIN::MirrorY(), SCH_ITEM::MirrorY(), 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 1315 of file sch_edit_tool.cpp.

1316 {
1318 
1319  if( selection.Empty() )
1320  {
1322  {
1324  VECTOR2D cursorPos = getViewControls()->GetCursorPosition( false );
1325 
1326  if( worksheet && worksheet->HitTestWorksheetItems( getView(), (wxPoint) cursorPos ) )
1328  }
1329 
1330  return 0;
1331  }
1332 
1333  SCH_ITEM* item = (SCH_ITEM*) selection.Front();
1334 
1335  switch( item->Type() )
1336  {
1337  case SCH_LINE_T:
1338  case SCH_BUS_WIRE_ENTRY_T:
1339  if( !selection.AllItemsHaveLineStroke() )
1340  return 0;
1341 
1342  break;
1343 
1344  case SCH_JUNCTION_T:
1345  if( !selection.AreAllItemsIdentical() )
1346  return 0;
1347 
1348  break;
1349 
1350  default:
1351  if( selection.Size() > 1 )
1352  return 0;
1353 
1354  break;
1355  }
1356 
1357  switch( item->Type() )
1358  {
1359  case SCH_COMPONENT_T:
1360  {
1361  SCH_COMPONENT* component = (SCH_COMPONENT*) item;
1362  DIALOG_SYMBOL_PROPERTIES symbolPropsDialog( m_frame, component );
1363 
1364  // This dialog itself subsequently can invoke a KIWAY_PLAYER as a quasimodal
1365  // frame. Therefore this dialog as a modal frame parent, MUST be run under
1366  // quasimodal mode for the quasimodal frame support to work. So don't use
1367  // the QUASIMODAL macros here.
1368  int retval = symbolPropsDialog.ShowQuasiModal();
1369 
1370  if( retval == SYMBOL_PROPS_EDIT_OK )
1371  {
1373  component->AutoAutoplaceFields( m_frame->GetScreen() );
1374 
1376  m_frame->OnModify();
1377  }
1378  else if( retval == SYMBOL_PROPS_EDIT_SCHEMATIC_SYMBOL )
1379  {
1380  auto editor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, true );
1381 
1382  editor->LoadSymbolFromSchematic( component->GetPartRef(),
1383  component->GetRef( &m_frame->GetCurrentSheet() ),
1384  component->GetUnit(), component->GetConvert() );
1385 
1386  editor->Show( true );
1387  editor->Raise();
1388  }
1389  else if( retval == SYMBOL_PROPS_EDIT_LIBRARY_SYMBOL )
1390  {
1391  auto editor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, true );
1392 
1393  editor->LoadSymbolAndSelectLib( component->GetLibId(), component->GetUnit(),
1394  component->GetConvert() );
1395 
1396  editor->Show( true );
1397  editor->Raise();
1398  }
1399  else if( retval == SYMBOL_PROPS_WANT_UPDATE_SYMBOL )
1400  {
1402  dlg.ShowQuasiModal();
1403  }
1404  else if( retval == SYMBOL_PROPS_WANT_EXCHANGE_SYMBOL )
1405  {
1407  dlg.ShowQuasiModal();
1408  }
1409  }
1410  break;
1411 
1412  case SCH_SHEET_T:
1413  {
1414  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
1415  bool doClearAnnotation;
1416  bool doRefresh = false;
1417 
1418  // Keep track of existing sheet paths. EditSheet() can modify this list.
1419  // Note that we use the validity checking/repairing version here just to make sure
1420  // we've got a valid hierarchy to begin with.
1421  SCH_SHEET_LIST initial_sheetpathList( &m_frame->Schematic().Root(), true );
1422 
1423  doRefresh = m_frame->EditSheetProperties( sheet, &m_frame->GetCurrentSheet(),
1424  &doClearAnnotation );
1425 
1426  // If the sheet file is changed and new sheet contents are loaded then we have to
1427  // clear the annotations on the new content (as it may have been set from some other
1428  // sheet path reference)
1429  if( doClearAnnotation )
1430  {
1431  SCH_SCREENS screensList( &m_frame->Schematic().Root() );
1432  // We clear annotation of new sheet paths here:
1433  screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
1434  // Clear annotation of g_CurrentSheet itself, because its sheetpath is not a new
1435  // path, but components managed by its sheet path must have their annotation
1436  // cleared, because they are new:
1438  }
1439 
1440  if( doRefresh )
1441  {
1443  m_frame->GetCanvas()->Refresh();
1445  }
1446 
1447  break;
1448  }
1449 
1450  case SCH_SHEET_PIN_T:
1451  {
1452  SCH_SHEET_PIN* pin = (SCH_SHEET_PIN*) item;
1454 
1455  // QuasiModal required for help dialog
1456  if( dlg.ShowQuasiModal() == wxID_OK )
1457  {
1459  m_frame->OnModify();
1460  }
1461  }
1462  break;
1463 
1464  case SCH_TEXT_T:
1465  case SCH_LABEL_T:
1466  case SCH_GLOBAL_LABEL_T:
1467  case SCH_HIER_LABEL_T:
1468  {
1469  DIALOG_LABEL_EDITOR dlg( m_frame, (SCH_TEXT*) item );
1470 
1471  // Must be quasi modal for syntax help
1472  if( dlg.ShowQuasiModal() == wxID_OK )
1473  {
1475  m_frame->OnModify();
1476  }
1477  }
1478  break;
1479 
1480  case SCH_FIELD_T:
1481  editFieldText( (SCH_FIELD*) item );
1482  break;
1483 
1484  case SCH_BITMAP_T:
1485  {
1486  SCH_BITMAP* bitmap = (SCH_BITMAP*) item;
1487  DIALOG_IMAGE_EDITOR dlg( m_frame, bitmap->GetImage() );
1488 
1489  if( dlg.ShowModal() == wxID_OK )
1490  {
1491  // save old image in undo list if not already in edit
1492  if( bitmap->GetEditFlags() == 0 )
1494 
1495  dlg.TransferToImage( bitmap->GetImage() );
1496 
1497  // The bitmap is cached in Opengl: clear the cache in case it has become invalid
1498  getView()->RecacheAllItems();
1500  m_frame->OnModify();
1501  }
1502  }
1503  break;
1504 
1505  case SCH_LINE_T:
1506  case SCH_BUS_WIRE_ENTRY_T:
1507  {
1508  std::deque<SCH_ITEM*> strokeItems;
1509 
1510  for( auto selItem : selection.Items() )
1511  {
1512  SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( selItem );
1513 
1514  if( schItem && schItem->HasLineStroke() )
1515  strokeItems.push_back( schItem );
1516  else
1517  return 0;
1518  }
1519 
1520  DIALOG_EDIT_LINE_STYLE dlg( m_frame, strokeItems );
1521 
1522  if( dlg.ShowModal() == wxID_OK )
1523  {
1525  m_frame->OnModify();
1526  }
1527  }
1528  break;
1529 
1530  case SCH_JUNCTION_T:
1531  {
1532  std::deque<SCH_JUNCTION*> junctions;
1533 
1534  for( auto selItem : selection.Items() )
1535  {
1536  SCH_JUNCTION* junction = dynamic_cast<SCH_JUNCTION*>( selItem );
1537 
1538  wxCHECK( junction, 0 );
1539 
1540  junctions.push_back( junction );
1541  }
1542 
1543  DIALOG_JUNCTION_PROPS dlg( m_frame, junctions );
1544 
1545  if( dlg.ShowModal() == wxID_OK )
1546  {
1548  m_frame->OnModify();
1549  }
1550  }
1551  break;
1552 
1553  case SCH_MARKER_T: // These items have no properties to edit
1554  case SCH_NO_CONNECT_T:
1555  break;
1556 
1557  default: // Unexpected item
1558  wxFAIL_MSG( wxString( "Cannot edit schematic item type " ) + item->GetClass() );
1559  }
1560 
1561  updateItem( item, true );
1562 
1563  if( selection.IsHover() )
1565 
1566  return 0;
1567 }
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:467
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1377
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
WS_PROXY_VIEW_ITEM * GetWorksheet() const
Definition: sch_view.h:97
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 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:216
EESCHEMA_SETTINGS * eeconfig() const
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void editFieldText(SCH_FIELD *aField)
bool HitTestWorksheetItems(VIEW *aView, const wxPoint &aPosition)
int GetUnit() const
AUTOPLACE_FIELDS m_AutoplaceFields
BITMAP_BASE * GetImage() const
Definition: sch_bitmap.h:59
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:138
STATUS_FLAGS GetEditFlags() const
Definition: eda_item.h:206
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:484
SCHEMATIC & Schematic() const
void UpdateHierarchyNavigator(bool aForceUpdate=false)
Run the Hierarchy Navigator dialog.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:181
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:56
std::unique_ptr< LIB_PART > & GetPartRef()
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:107
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:102
int Size() const
Returns the number of selected parts.
Definition: selection.h:128
Schematic symbol object.
Definition: sch_component.h:79
virtual wxString GetClass() const override
Return the class name.
Definition: sch_item.h:220
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:929
int GetConvert() const
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
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:194
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:528
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:161
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
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(), EDA_ITEM::GetEditFlags(), SCH_BITMAP::GetImage(), SCH_COMPONENT::GetLibId(), SCH_COMPONENT::GetPartRef(), SCH_COMPONENT::GetRef(), SCH_EDIT_FRAME::GetScreen(), SCH_SHEET::GetScreen(), SCH_COMPONENT::GetUnit(), SCH_DRAW_PANEL::GetView(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), KIGFX::SCH_VIEW::GetWorksheet(), SCH_ITEM::HasLineStroke(), KIGFX::WS_PROXY_VIEW_ITEM::HitTestWorksheetItems(), SELECTION::IsHover(), KIGFX::VIEW::IsLayerVisible(), SELECTION::Items(), KIWAY_HOLDER::Kiway(), LAYER_SCHEMATIC_WORKSHEET, 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 890 of file sch_edit_tool.cpp.

891 {
892  SCH_ITEM* sourceItem = m_frame->GetRepeatItem();
893 
894  if( !sourceItem )
895  return 0;
896 
898 
899  SCH_ITEM* newItem = sourceItem->Duplicate();
900  bool performDrag = false;
901 
902  // If cloning a component then put into 'move' mode.
903  if( newItem->Type() == SCH_COMPONENT_T )
904  {
905  wxPoint cursorPos = (wxPoint) getViewControls()->GetCursorPosition( true );
906  newItem->Move( cursorPos - newItem->GetPosition() );
907  performDrag = true;
908  }
909  else
910  {
911  if( m_isSymbolEditor )
912  {
913  auto* cfg = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
914 
915  if( dynamic_cast<SCH_TEXT*>( newItem ) )
916  {
917  SCH_TEXT* text = static_cast<SCH_TEXT*>( newItem );
918  text->IncrementLabel( cfg->m_Repeat.label_delta );
919  }
920 
921  newItem->Move( wxPoint( Mils2iu( cfg->m_Repeat.x_step ),
922  Mils2iu( cfg->m_Repeat.y_step ) ) );
923  }
924  else
925  {
926  EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
927 
928  if( dynamic_cast<SCH_TEXT*>( newItem ) )
929  {
930  SCH_TEXT* text = static_cast<SCH_TEXT*>( newItem );
931 
932  // If incrementing tries to go below zero, tell user why the value is repeated
933 
934  if( !text->IncrementLabel( cfg->m_Drawing.repeat_label_increment ) )
935  m_frame->ShowInfoBarWarning( _( "Label value cannot go below zero" ), true );
936  }
937 
938  newItem->Move( wxPoint( Mils2iu( cfg->m_Drawing.default_repeat_offset_x ),
939  Mils2iu( cfg->m_Drawing.default_repeat_offset_y ) ) );
940  }
941 
942  }
943 
944  newItem->SetFlags( IS_NEW );
945  m_frame->AddToScreen( newItem, m_frame->GetScreen() );
947 
948  m_selectionTool->AddItemToSel( newItem );
949 
950  if( performDrag )
952 
953  newItem->ClearFlags();
954 
955  if( newItem->IsConnectable() )
956  {
957  auto selection = m_selectionTool->GetSelection();
958 
959  m_toolMgr->RunAction( EE_ACTIONS::addNeededJunctions, true, &selection );
962  }
963 
964  // newItem newItem, now that it has been moved, thus saving new position.
965  m_frame->SaveCopyForRepeatItem( newItem );
966 
967  return 0;
968 }
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:383
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:300
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:102
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 ...
EE_SELECTION & GetSelection()
Function GetSelection()
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:201
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 SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
void SaveCopyForRepeatItem(SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:181
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static TOOL_ACTION addNeededJunctions
Definition: ee_actions.h:75
SCH_ITEM * GetRepeatItem() const
Return the item which is to be repeated with the insert key.
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,...
#define _(s)
Definition: 3d_actions.cpp:33
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:202
static TOOL_ACTION move
Definition: ee_actions.h:114
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:194
#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:161
virtual void Move(const wxPoint &aMoveVector)=0
Move the item by aMoveVector to a new position.

References _, 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 90 of file ee_tool_base.h.

91  {
92  if( aReason == MODEL_RELOAD )
93  {
94  // Init variables used by every drawing tool
95  m_frame = getEditFrame<T>();
96  m_isSymbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) != nullptr;
97  }
98 
99  m_view = static_cast<KIGFX::SCH_VIEW*>( getView() );
100  }
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
565  {
566  item->Rotate( rotPoint );
567  }
568  }
569 
570  connections |= item->IsConnectable();
571  m_frame->UpdateItem( item );
572  }
573 
575 
576  if( moving )
577  {
579  }
580  else
581  {
582  if( selection.IsHover() )
584 
585  if( connections )
587 
588  m_frame->OnModify();
589  }
590 
591  return 0;
592 }
#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:383
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:171
void AutoAutoplaceFields(SCH_SCREEN *aScreen)
Autoplace fields only if correct to do so automatically.
Definition: sch_item.h:467
void RotateEnd(wxPoint aPosition)
Definition: sch_line.cpp:362
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:168
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1377
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:300
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:216
void RotateStart(wxPoint aPosition)
Definition: sch_line.cpp:356
static TOOL_ACTION rotateCW
Definition: ee_actions.h:117
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)
Function RequestSelection()
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:576
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)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:138
EDA_ITEM * GetParent() const
Definition: eda_item.h:163
const KICAD_T rotatableItems[]
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:181
bool Matches(const TOOL_EVENT &aEvent) const
Test whether two events match in terms of category & action or command.
Definition: tool_event.h:361
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:56
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:708
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_component.h:79
wxPoint GetRotationCenter() const
Rotating around the boundingBox's center can cause walking when the sheetname or filename is longer t...
Definition: sch_sheet.cpp:587
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:194
bool HasFlag(STATUS_FLAGS aFlag) const
Definition: eda_item.h:204
static TOOL_ACTION refreshPreview
Definition: actions.h:109
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:161
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

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

Definition at line 138 of file ee_tool_base.h.

139  {
140  KICAD_T itemType = aItem->Type();
141  bool selected = aItem->IsSelected();
142 
143  // IS_SELECTED flag should not be set on undo items which were added for
144  // a drag operation.
145  if( selected && aItem->HasFlag( TEMP_SELECTED ) )
146  aItem->ClearSelected();
147 
148  if( m_isSymbolEditor )
149  {
150  SYMBOL_EDIT_FRAME* editFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
151  wxASSERT( editFrame );
152 
153  editFrame->SaveCopyInUndoList( static_cast<LIB_ITEM*>( aItem ), aType, aAppend );
154  }
155  else
156  {
157  SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
158  wxASSERT( editFrame );
159 
160  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
161  {
162  editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
163  static_cast<SCH_ITEM*>( aItem->GetParent() ),
164  UNDO_REDO::CHANGED, aAppend );
165  }
166  else
167  {
168  editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
169  static_cast<SCH_ITEM*>( aItem ),
170  aType, aAppend );
171  }
172  }
173 
174  if( selected && aItem->HasFlag( TEMP_SELECTED ) )
175  aItem->SetSelected();
176  }
bool IsSelected() const
Definition: eda_item.h:171
void ClearSelected()
Definition: eda_item.h:180
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:177
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.
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
EDA_ITEM * GetParent() const
Definition: eda_item.h:163
bool HasFlag(STATUS_FLAGS aFlag) const
Definition: eda_item.h:204
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:161
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

Sets up handlers for various events.

Implements TOOL_INTERACTIVE.

Definition at line 1787 of file sch_edit_tool.cpp.

1788 {
1793  Go( &SCH_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorX.MakeEvent() );
1794  Go( &SCH_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorY.MakeEvent() );
1795  Go( &SCH_EDIT_TOOL::DoDelete, ACTIONS::doDelete.MakeEvent() );
1797 
1814 
1817 
1821 }
static TOOL_ACTION editPageNumber
Definition: ee_actions.h:155
static TOOL_ACTION properties
Definition: ee_actions.h:121
static TOOL_ACTION toggleDeMorgan
Definition: ee_actions.h:126
static TOOL_ACTION breakBus
Definition: ee_actions.h:135
static TOOL_ACTION doDelete
Definition: actions.h:75
int Rotate(const TOOL_EVENT &aEvent)
static TOOL_ACTION mirrorY
Definition: ee_actions.h:120
static TOOL_ACTION changeSymbol
Definition: ee_actions.h:149
int EditPageNumber(const TOOL_EVENT &aEvent)
int BreakWire(const TOOL_EVENT &aEvent)
static TOOL_ACTION toText
Definition: ee_actions.h:133
static TOOL_ACTION autoplaceFields
Definition: ee_actions.h:125
int Properties(const TOOL_EVENT &aEvent)
static TOOL_ACTION updateSymbols
Definition: ee_actions.h:148
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:128
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
static TOOL_ACTION breakWire
Definition: ee_actions.h:134
static TOOL_ACTION rotateCW
Definition: ee_actions.h:117
int Duplicate(const TOOL_EVENT &aEvent)
static TOOL_ACTION cleanupSheetPins
Definition: ee_actions.h:192
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:118
static TOOL_ACTION editFootprint
Definition: ee_actions.h:124
static TOOL_ACTION updateSymbol
Definition: ee_actions.h:150
int AutoplaceFields(const TOOL_EVENT &aEvent)
static TOOL_ACTION repeatDrawItem
Definition: ee_actions.h:116
static TOOL_ACTION mirrorX
Definition: ee_actions.h:119
int CleanupSheetPins(const TOOL_EVENT &aEvent)
static TOOL_ACTION editTextAndGraphics
Definition: ee_actions.h:193
int DeleteItemCursor(const TOOL_EVENT &aEvent)
Runs the deletion tool.
static TOOL_ACTION showDeMorganStandard
Definition: ee_actions.h:127
int Mirror(const TOOL_EVENT &aEvent)
int RepeatDrawItem(const TOOL_EVENT &aEvent)
static TOOL_ACTION editValue
Definition: ee_actions.h:123
int EditField(const TOOL_EVENT &aEvent)
static TOOL_ACTION changeSymbols
Definition: ee_actions.h:147
int ChangeSymbols(const TOOL_EVENT &aEvent)
static TOOL_ACTION deleteTool
Definition: actions.h:76
static TOOL_ACTION toLabel
Definition: ee_actions.h:130
static TOOL_ACTION toHLabel
Definition: ee_actions.h:131
static TOOL_ACTION editReference
Definition: ee_actions.h:122
int DoDelete(const TOOL_EVENT &aEvent)
Deletes the selected items, or the item under the cursor.
static TOOL_ACTION toGLabel
Definition: ee_actions.h:132
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::mirrorX, EE_ACTIONS::mirrorY, 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.

Definition at line 107 of file ee_tool_base.h.

108  {
109  switch( aItem->Type() )
110  {
111  case SCH_SHEET_PIN_T:
112  getView()->Update( aItem );
113  getView()->Update( aItem->GetParent() );
114 
115  // Moving sheet pins does not change the BBox.
116  break;
117 
118  case SCH_PIN_T:
119  case SCH_FIELD_T:
120  getView()->Update( aItem );
121  getView()->Update( aItem->GetParent() );
122 
123  if( aUpdateRTree )
124  m_frame->GetScreen()->Update( static_cast<SCH_ITEM*>( aItem->GetParent() ) );
125 
126  break;
127 
128  default:
129  getView()->Update( aItem );
130 
131  if( aUpdateRTree )
132  m_frame->GetScreen()->Update( static_cast<SCH_ITEM*>( aItem ) );
133  }
134  }
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
EDA_ITEM * GetParent() const
Definition: eda_item.h:163
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
void Update(SCH_ITEM *aItem)
Updates aItem's bounding box in the tree.
Definition: sch_screen.cpp:234
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:1513
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:161

◆ 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(), 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(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCB_PICKER_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PL_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_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(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceModule(), 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 179 of file ee_tool_base.h.

◆ m_isSymbolEditor

bool EE_TOOL_BASE< SCH_EDIT_FRAME >::m_isSymbolEditor
protectedinherited

Definition at line 182 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(), Init(), PICKER_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), PL_EDIT_TOOL::Init(), PAD_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PCB_VIEWER_TOOLS::Init(), PL_DRAWING_TOOLS::Init(), PL_SELECTION_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), SCH_DRAWING_TOOLS::Init(), EDA_3D_CONTROLLER::Init(), GERBVIEW_SELECTION_TOOL::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(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCB_PICKER_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PL_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_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(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceModule(), 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 181 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(), 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(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), PL_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::EditWithLibEdit(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), 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(), 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(), CONVERT_TOOL::Init(), PAD_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PL_POINT_EDITOR::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(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCB_PICKER_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(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_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(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceModule(), 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(), GERBVIEW_CONTROL::ReloadAllLayers(), 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 180 of file ee_tool_base.h.


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