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 }
 

Determines the reason of reset for a tool

More...
 

Public Member Functions

 SCH_EDIT_TOOL ()
 
 ~SCH_EDIT_TOOL () override
 
bool Init () override
 Function Init() 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 UpdateFields (const TOOL_EVENT &aEvent)
 
int ConvertDeMorgan (const TOOL_EVENT &aEvent)
 
int RefreshSymbolFromLibrary (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
 Function Reset() Brings the tool to a known, initial state. More...
 
void Activate ()
 Function Activate() Runs the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Function SetContextMenu() More...
 
void RunMainStack (std::function< void()> aFunc)
 Function RunMainStack() More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Go() More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Wait() More...
 
TOOL_TYPE GetType () const
 Function GetType() Returns the type of the tool. More...
 
TOOL_ID GetId () const
 Function GetId() Returns the unique identifier of the tool. More...
 
const std::string & GetName () const
 Function GetName() Returns the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Protected Member Functions

void updateView (EDA_ITEM *aItem) const
 

Similar to getView()->Update(), but handles items that are redrawn by their parents.

More...
 
void saveCopyInUndoList (EDA_ITEM *aItem, UNDO_REDO_T aType, bool aAppend=false)
 

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

More...
 
void attachManager (TOOL_MANAGER *aManager)
 Function attachManager() More...
 
KIGFX::VIEWgetView () const
 Function getView() More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Function getViewControls() More...
 
template<typename T >
T * getEditFrame () const
 Function getEditFrame() More...
 
template<typename T >
T * getModel () const
 Function getModel() More...
 

Protected Attributes

SCH_EDIT_FRAMEm_frame
 
KIGFX::SCH_VIEWm_view
 
EE_SELECTION_TOOLm_selectionTool
 
bool m_isLibEdit
 
TOOL_MENU m_menu
 functions below are not yet implemented - their interface may change More...
 
TOOL_TYPE m_type
 

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

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

More...
 
std::string m_toolName
 

Name of the tool.

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

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

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

Constructor & Destructor Documentation

◆ SCH_EDIT_TOOL()

SCH_EDIT_TOOL::SCH_EDIT_TOOL ( )

Definition at line 125 of file sch_edit_tool.cpp.

125  :
126  EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveEdit" )
127 {
128  m_pickerItem = nullptr;
129 }
EDA_ITEM * m_pickerItem
Definition: sch_edit_tool.h:89

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

Function Activate() Runs 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:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls 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(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), DeleteItemCursor(), PCBNEW_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(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), LIB_TREE::onContextMenu(), POINT_EDITOR::OnSelectionChange(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Function attachManager()

Sets 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:219

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ AutoplaceFields()

int SCH_EDIT_TOOL::AutoplaceFields ( const TOOL_EVENT aEvent)

Definition at line 1193 of file sch_edit_tool.cpp.

1194 {
1196 
1197  if( selection.Empty() )
1198  return 0;
1199 
1200  SCH_COMPONENT* component = (SCH_COMPONENT*) selection.Front();
1201 
1202  if( !component->IsNew() )
1203  saveCopyInUndoList( component, UR_CHANGED );
1204 
1205  component->AutoplaceFields( m_frame->GetScreen(), /* aManual */ true );
1206 
1207  m_frame->GetScreen()->Update( component );
1208  updateView( component );
1209  m_frame->OnModify();
1210 
1211  if( selection.IsHover() )
1213 
1214  return 0;
1215 }
bool IsHover() const
Definition: selection.h:71
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
static const KICAD_T ComponentsOnly[]
Definition: ee_collectors.h:47
bool IsNew() const
Definition: base_struct.h:199
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.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
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:121
void updateView(EDA_ITEM *aItem) const
Similar to getView()->Update(), but handles items that are redrawn by their parents.
Definition: ee_tool_base.h:104
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Automatically orient all the fields in the component.
Schematic symbol object.
Definition: sch_component.h:88
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO_T aType, bool aAppend=false)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:117
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
void Update(SCH_ITEM *aItem)
Updates aItem's bounding box in the tree.
Definition: sch_screen.cpp:237
EDA_ITEM * Front() const
Definition: selection.h:184

References SCH_COMPONENT::AutoplaceFields(), EE_ACTIONS::clearSelection, EE_COLLECTOR::ComponentsOnly, SELECTION::Empty(), 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(), SCH_SCREEN::Update(), EE_TOOL_BASE< SCH_EDIT_FRAME >::updateView(), and UR_CHANGED.

Referenced by setTransitions().

◆ BreakWire()

int SCH_EDIT_TOOL::BreakWire ( const TOOL_EVENT aEvent)

Definition at line 1649 of file sch_edit_tool.cpp.

1650 {
1651  auto cursorPos = wxPoint( getViewControls()->GetCursorPosition( !aEvent.Modifier( MD_ALT ) ) );
1652 
1653  if( m_frame->BreakSegments( cursorPos ) )
1654  {
1655  if( m_frame->GetScreen()->IsJunctionNeeded( cursorPos, true ) )
1656  m_frame->AddJunction( m_frame->GetScreen(), cursorPos, true, false );
1657 
1659 
1660  m_frame->OnModify();
1661  m_frame->GetCanvas()->Refresh();
1662  }
1663 
1664  return 0;
1665 }
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...
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
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.
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
Returns information about key modifiers state (Ctrl, Alt, etc.)
Definition: tool_event.h:342
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
Function getViewControls()
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().

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

1552 {
1553  KICAD_T convertTo = aEvent.Parameter<KICAD_T>();
1555  EE_SELECTION& selection = m_selectionTool->RequestSelection( allTextTypes );
1556 
1557  for( unsigned int i = 0; i < selection.GetSize(); ++i )
1558  {
1559  SCH_TEXT* text = dynamic_cast<SCH_TEXT*>( selection.GetItem( i ) );
1560 
1561  if( text && text->Type() != convertTo )
1562  {
1563  bool selected = text->IsSelected();
1564  SCH_TEXT* newtext = nullptr;
1565  const wxPoint& position = text->GetPosition();
1566  LABEL_SPIN_STYLE orientation = text->GetLabelSpinStyle();
1567  wxString txt = UnescapeString( text->GetText() );
1568 
1569  // There can be characters in a SCH_TEXT object that can break labels so we have to
1570  // fix them here.
1571  if( text->Type() == SCH_TEXT_T )
1572  {
1573  txt.Replace( "\n", "_" );
1574  txt.Replace( "\r", "_" );
1575  txt.Replace( "\t", "_" );
1576  txt.Replace( " ", "_" );
1577  }
1578 
1579  // label strings are "escaped" i.e. a '/' is replaced by "{slash}"
1580  if( convertTo != SCH_TEXT_T )
1581  txt = EscapeString( txt, CTX_NETNAME );
1582 
1583  switch( convertTo )
1584  {
1585  case SCH_LABEL_T: newtext = new SCH_LABEL( position, txt ); break;
1586  case SCH_GLOBAL_LABEL_T: newtext = new SCH_GLOBALLABEL( position, txt ); break;
1587  case SCH_HIER_LABEL_T: newtext = new SCH_HIERLABEL( position, txt ); break;
1588  case SCH_TEXT_T: newtext = new SCH_TEXT( position, txt ); break;
1589 
1590  default:
1591  wxFAIL_MSG( wxString::Format( "Invalid text type: %d.", convertTo ) );
1592  return 0;
1593  }
1594 
1595  // Copy the old text item settings to the new one. Justifications are not copied
1596  // because they are not used in labels. Justifications will be set to default value
1597  // in the new text item type.
1598  //
1599  newtext->SetFlags( text->GetEditFlags() );
1600  newtext->SetShape( text->GetShape() );
1601  newtext->SetLabelSpinStyle( orientation );
1602  newtext->SetTextSize( text->GetTextSize() );
1603  newtext->SetTextThickness( text->GetTextThickness() );
1604  newtext->SetItalic( text->IsItalic() );
1605  newtext->SetBold( text->IsBold() );
1606  newtext->SetIsDangling( text->IsDangling() );
1607 
1608  if( selected )
1610 
1611  if( !text->IsNew() )
1612  {
1613  saveCopyInUndoList( text, UR_DELETED );
1614  saveCopyInUndoList( newtext, UR_NEW, true );
1615 
1617  m_frame->AddToScreen( newtext, m_frame->GetScreen() );
1618  }
1619 
1620  if( selected )
1621  m_toolMgr->RunAction( EE_ACTIONS::addItemToSel, true, newtext );
1622 
1623  // Otherwise, pointer is owned by the undo stack
1624  if( text->IsNew() )
1625  delete text;
1626 
1627  if( convertTo == SCH_TEXT_T )
1628  {
1629  if( newtext->IsDangling() )
1630  {
1631  newtext->SetIsDangling( false );
1632  getView()->Update( newtext, KIGFX::REPAINT );
1633  }
1634  }
1635  else
1637 
1638  m_frame->OnModify();
1639  }
1640  }
1641 
1642  if( selection.IsHover() )
1644 
1645  return 0;
1646 }
bool IsDangling() const override
Definition: sch_text.h:302
bool IsBold() const
Definition: eda_text.h:183
void SetShape(PINSHEETLABEL_SHAPE aShape)
Definition: sch_text.h:239
bool IsHover() const
Definition: selection.h:71
bool IsSelected() const
Definition: base_struct.h:203
void SetItalic(bool isItalic)
Definition: eda_text.h:179
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
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,...
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:238
void SetIsDangling(bool aIsDangling)
Definition: sch_text.h:303
int GetTextThickness() const
Definition: eda_text.h:159
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
bool IsNew() const
Definition: base_struct.h:199
static TOOL_ACTION removeItemFromSel
Definition: ee_actions.h:60
bool IsItalic() const
Definition: eda_text.h:180
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 is being added to the view.
Definition: view_item.h:62
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
static TOOL_ACTION addItemToSel
Selects an item (specified as the event parameter).
Definition: ee_actions.h:59
STATUS_FLAGS GetEditFlags() const
Definition: base_struct.h:237
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
const wxSize & GetTextSize() const
Definition: eda_text.h:239
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
LABEL_SPIN_STYLE GetLabelSpinStyle() const
Definition: sch_text.h:232
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:105
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1544
wxPoint GetPosition() const override
Definition: sch_text.h:313
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual unsigned int GetSize() const override
Function GetSize() Returns the number of stored items.
Definition: selection.h:100
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 Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:125
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:50
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO_T aType, bool aAppend=false)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:117
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.h:158
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:230
void SetBold(bool aBold)
Definition: eda_text.h:182
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:127
PINSHEETLABEL_SHAPE GetShape() const
Definition: sch_text.h:237
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References EE_ACTIONS::addItemToSel, SCH_BASE_FRAME::AddToScreen(), EE_ACTIONS::clearSelection, CTX_NETNAME, 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, 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(), KIGFX::VIEW::Update(), UR_DELETED, and UR_NEW.

Referenced by setTransitions().

◆ CleanupSheetPins()

int SCH_EDIT_TOOL::CleanupSheetPins ( const TOOL_EVENT aEvent)

Definition at line 1668 of file sch_edit_tool.cpp.

1669 {
1671  SCH_SHEET* sheet = (SCH_SHEET*) selection.Front();
1672 
1673  if( !sheet )
1674  return 0;
1675 
1676  if( !sheet->HasUndefinedPins() )
1677  {
1678  DisplayInfoMessage( m_frame, _( "There are no unreferenced pins in this sheet to remove." ) );
1679  return 0;
1680  }
1681 
1682  if( !IsOK( m_frame, _( "Do you wish to delete the unreferenced pins from this sheet?" ) ) )
1683  return 0;
1684 
1685  saveCopyInUndoList( sheet, UR_CHANGED );
1686 
1687  sheet->CleanupSheet();
1688 
1689  m_frame->GetScreen()->Update( sheet );
1690  updateView( sheet );
1691  m_frame->OnModify();
1692 
1693  if( selection.IsHover() )
1695 
1696  return 0;
1697 }
bool IsHover() const
Definition: selection.h:71
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
static const KICAD_T SheetsOnly[]
Definition: ee_collectors.h:48
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.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
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:457
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:216
bool HasUndefinedPins()
Check all sheet labels against schematic for undefined hierarchical labels.
Definition: sch_sheet.cpp:355
void updateView(EDA_ITEM *aItem) const
Similar to getView()->Update(), but handles items that are redrawn by their parents.
Definition: ee_tool_base.h:104
#define _(s)
Definition: 3d_actions.cpp:33
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO_T aType, bool aAppend=false)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:117
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
void Update(SCH_ITEM *aItem)
Updates aItem's bounding box in the tree.
Definition: sch_screen.cpp:237
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:267
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:283
EDA_ITEM * Front() const
Definition: selection.h:184

References _, SCH_SHEET::CleanupSheet(), EE_ACTIONS::clearSelection, DisplayInfoMessage(), SELECTION::Front(), SCH_EDIT_FRAME::GetScreen(), 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, SCH_SCREEN::Update(), EE_TOOL_BASE< SCH_EDIT_FRAME >::updateView(), and UR_CHANGED.

Referenced by setTransitions().

◆ ConvertDeMorgan()

int SCH_EDIT_TOOL::ConvertDeMorgan ( const TOOL_EVENT aEvent)

Definition at line 1227 of file sch_edit_tool.cpp.

1228 {
1230 
1231  if( selection.Empty() )
1232  return 0;
1233 
1234  SCH_COMPONENT* component = (SCH_COMPONENT*) selection.Front();
1235 
1237  && component->GetConvert() == LIB_ITEM::LIB_CONVERT::BASE )
1238  return 0;
1239 
1241  && component->GetConvert() != LIB_ITEM::LIB_CONVERT::DEMORGAN )
1242  return 0;
1243 
1244  if( !component->IsNew() )
1245  saveCopyInUndoList( component, UR_CHANGED );
1246 
1247  m_frame->ConvertPart( component );
1248 
1249  if( component->IsNew() )
1251 
1252  if( selection.IsHover() )
1254 
1255  return 0;
1256 }
bool IsHover() const
Definition: selection.h:71
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
static const KICAD_T ComponentsOnly[]
Definition: ee_collectors.h:47
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:127
bool IsNew() const
Definition: base_struct.h:199
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:67
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static TOOL_ACTION showDeMorganStandard
Definition: ee_actions.h:126
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:121
Schematic symbol object.
Definition: sch_component.h:88
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO_T aType, bool aAppend=false)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:117
int GetConvert() const
void ConvertPart(SCH_COMPONENT *aComponent)
Definition: getpart.cpp:235
static TOOL_ACTION refreshPreview
Definition: actions.h:102
EDA_ITEM * Front() const
Definition: selection.h:184

References 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, EE_ACTIONS::showDeMorganStandard, and UR_CHANGED.

Referenced by setTransitions().

◆ DeleteItemCursor()

int SCH_EDIT_TOOL::DeleteItemCursor ( const TOOL_EVENT aEvent)

Runs the deletion tool.

Definition at line 1046 of file sch_edit_tool.cpp.

1047 {
1048  std::string tool = aEvent.GetCommandStr().get();
1049  PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
1050 
1052  m_pickerItem = nullptr;
1053 
1054  // Deactivate other tools; particularly important if another PICKER is currently running
1055  Activate();
1056 
1057  picker->SetCursor( wxStockCursor( wxCURSOR_BULLSEYE ) );
1058 
1059  picker->SetClickHandler(
1060  [this] ( const VECTOR2D& aPosition ) -> bool
1061  {
1062  if( m_pickerItem )
1063  {
1064  SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( m_pickerItem );
1065 
1066  if( sch_item && sch_item->IsLocked() )
1067  {
1068  STATUS_TEXT_POPUP statusPopup( m_frame );
1069  statusPopup.SetText( _( "Item locked." ) );
1070  statusPopup.PopupFor( 2000 );
1071  statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
1072  return true;
1073  }
1074 
1076  selectionTool->UnbrightenItem( m_pickerItem );
1077  selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
1079  m_pickerItem = nullptr;
1080  }
1081 
1082  return true;
1083  } );
1084 
1085  picker->SetMotionHandler(
1086  [this] ( const VECTOR2D& aPos )
1087  {
1088  EE_COLLECTOR collector;
1089  collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
1090  collector.Collect( m_frame->GetScreen(), deletableItems, (wxPoint) aPos );
1091 
1093  selectionTool->GuessSelectionCandidates( collector, aPos );
1094 
1095  EDA_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr;
1096 
1097  if( m_pickerItem != item )
1098  {
1099  if( m_pickerItem )
1100  selectionTool->UnbrightenItem( m_pickerItem );
1101 
1102  m_pickerItem = item;
1103 
1104  if( m_pickerItem )
1105  selectionTool->BrightenItem( m_pickerItem );
1106  }
1107  } );
1108 
1109  picker->SetFinalizeHandler(
1110  [this] ( const int& aFinalState )
1111  {
1112  if( m_pickerItem )
1114  } );
1115 
1116  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
1117 
1118  return 0;
1119 }
void SetCursor(const wxCursor &aCursor)
Definition: picker_tool.h:65
#define HITTEST_THRESHOLD_PIXELS
int m_Threshold
Definition: collector.h:67
void SetMotionHandler(MOTION_HANDLER aHandler)
Function SetMotionHandler() Sets a handler for mouse motion.
Definition: picker_tool.h:82
static TOOL_ACTION doDelete
Definition: actions.h:74
void SetClickHandler(CLICK_HANDLER aHandler)
Function SetClickHandler() Sets a handler for mouse click event.
Definition: picker_tool.h:72
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.
STATUS_TEXT_POPUP.
Definition: status_popup.h:79
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
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:149
void SetFinalizeHandler(FINALIZE_HANDLER aHandler)
Function SetFinalizeHandler() Sets a handler for the finalize event.
Definition: picker_tool.h:102
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:101
void BrightenItem(EDA_ITEM *aItem)
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
void UnbrightenItem(EDA_ITEM *aItem)
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
EDA_ITEM * m_pickerItem
Definition: sch_edit_tool.h:89
virtual bool IsLocked() const
Definition: sch_item.h:262
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
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
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
void Activate()
Function Activate() Runs the tool.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187

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(), TOOL_MANAGER::RunAction(), 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 965 of file sch_edit_tool.cpp.

966 {
967  SCH_SCREEN* screen = m_frame->GetScreen();
969  bool appendToUndo = false;
970  std::vector<wxPoint> pts;
971 
972  if( items.empty() )
973  return 0;
974 
975  // Don't leave a freed pointer in the selection
977 
978  for( EDA_ITEM* item : items )
979  item->ClearFlags( STRUCT_DELETED );
980 
981  for( EDA_ITEM* item : items )
982  {
983  SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item );
984 
985  if( !sch_item )
986  continue;
987 
988  if( sch_item->Type() == SCH_JUNCTION_T )
989  {
990  sch_item->SetFlags( STRUCT_DELETED );
991  sch_item->GetConnectionPoints( pts );
992 
993  // clean up junctions at the end
994  }
995  else
996  {
997  sch_item->SetFlags( STRUCT_DELETED );
998  saveCopyInUndoList( item, UR_DELETED, appendToUndo );
999  appendToUndo = true;
1000 
1001  if( sch_item && sch_item->IsConnectable() )
1002  sch_item->GetConnectionPoints( pts );
1003 
1004  updateView( sch_item );
1005 
1006  if( sch_item->Type() == SCH_SHEET_PIN_T )
1007  {
1008  SCH_SHEET_PIN* pin = (SCH_SHEET_PIN*) sch_item;
1009  SCH_SHEET* sheet = pin->GetParent();
1010 
1011  sheet->RemovePin( pin );
1012  }
1013  else
1014  {
1015  m_frame->RemoveFromScreen( sch_item, m_frame->GetScreen() );
1016  }
1017 
1018  if( sch_item->Type() == SCH_SHEET_T )
1020  }
1021  }
1022 
1023  for( auto point : pts )
1024  {
1025  SCH_ITEM* junction = screen->GetItem( point, 0, SCH_JUNCTION_T );
1026 
1027  if( !junction )
1028  continue;
1029 
1030  if( junction->HasFlag( STRUCT_DELETED ) || !screen->IsJunctionNeeded( point ) )
1031  m_frame->DeleteJunction( junction, appendToUndo );
1032  }
1033 
1035 
1036  m_frame->GetCanvas()->Refresh();
1037  m_frame->OnModify();
1038 
1039  return 0;
1040 }
virtual bool IsConnectable() const
Definition: sch_item.h:370
SCH_SHEET * GetParent() const
Get the parent sheet object of this sheet pin.
Definition: sch_sheet.h:168
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:219
virtual void GetConnectionPoints(std::vector< wxPoint > &aPoints) const
Add all the connection points for this item to aPoints.
Definition: sch_item.h:379
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
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,...
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
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 RemovePin(SCH_SHEET_PIN *aSheetPin)
Remove aSheetPin from the sheet.
Definition: sch_sheet.cpp:290
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
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:132
void UpdateHierarchyNavigator(bool aForceUpdate=false)
Run the Hierarchy Navigator dialog.
#define STRUCT_DELETED
flag indication structures to be erased
Definition: base_struct.h:126
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:84
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
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...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:216
static KICAD_T deletableItems[]
void updateView(EDA_ITEM *aItem) const
Similar to getView()->Update(), but handles items that are redrawn by their parents.
Definition: ee_tool_base.h:104
void DeleteJunction(SCH_ITEM *aItem, bool aAppend=false)
Removes a given junction and heals any wire segments under the junction.
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO_T aType, bool aAppend=false)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:117
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
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:309
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
bool HasFlag(STATUS_FLAGS aFlag)
Definition: base_struct.h:235
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References EE_ACTIONS::clearSelection, deletableItems, 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(), EE_TOOL_BASE< SCH_EDIT_FRAME >::updateView(), and UR_DELETED.

Referenced by setTransitions().

◆ Duplicate()

int SCH_EDIT_TOOL::Duplicate ( const TOOL_EVENT aEvent)

Definition at line 775 of file sch_edit_tool.cpp.

776 {
778 
779  if( selection.GetSize() == 0 )
780  return 0;
781 
782  // Doing a duplicate of a new object doesn't really make any sense; we'd just end
783  // up dragging around a stack of objects...
784  if( selection.Front()->IsNew() )
785  return 0;
786 
787  EDA_ITEMS newItems;
788 
789  // Keep track of existing sheet paths. Duplicating a selection can modify this list
790  bool copiedSheets = false;
791  SCH_SHEET_LIST initial_sheetpathList = m_frame->Schematic().GetSheets();
792 
793  for( unsigned ii = 0; ii < selection.GetSize(); ++ii )
794  {
795  SCH_ITEM* oldItem = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
796  SCH_ITEM* newItem = oldItem->Duplicate();
797  newItem->SetFlags( IS_NEW );
798  newItems.push_back( newItem );
799  saveCopyInUndoList( newItem, UR_NEW, ii > 0 );
800 
801  switch( newItem->Type() )
802  {
803  case SCH_JUNCTION_T:
804  case SCH_LINE_T:
805  case SCH_BUS_BUS_ENTRY_T:
807  case SCH_TEXT_T:
808  case SCH_LABEL_T:
809  case SCH_GLOBAL_LABEL_T:
810  case SCH_HIER_LABEL_T:
811  case SCH_NO_CONNECT_T:
812  newItem->SetParent( m_frame->GetScreen() );
813  m_frame->AddToScreen( newItem, m_frame->GetScreen() );
814  break;
815 
816  case SCH_SHEET_T:
817  {
818  SCH_SHEET_LIST hierarchy = m_frame->Schematic().GetSheets();
819  SCH_SHEET* sheet = (SCH_SHEET*) newItem;
820  SCH_FIELD& nameField = sheet->GetFields()[SHEETNAME];
821  wxString baseName = nameField.GetText();
822  wxString candidateName = baseName;
823  int uniquifier = 1;
824 
825  while( hierarchy.NameExists( candidateName ) )
826  candidateName = wxString::Format( wxT( "%s%d" ), baseName, uniquifier++ );
827 
828  nameField.SetText( candidateName );
829 
830  sheet->SetParent( m_frame->GetCurrentSheet().Last() );
831  m_frame->AddToScreen( sheet, m_frame->GetScreen() );
832 
833  copiedSheets = true;
834  break;
835  }
836 
837  case SCH_COMPONENT_T:
838  {
839  SCH_COMPONENT* component = (SCH_COMPONENT*) newItem;
840  component->ClearAnnotation( NULL );
841  component->SetParent( m_frame->GetScreen() );
842  m_frame->AddToScreen( component, m_frame->GetScreen() );
843  break;
844  }
845 
846  default:
847  break;
848  }
849  }
850 
851  if( copiedSheets )
852  {
853  // We clear annotation of new sheet paths.
854  // Annotation of new components added in current sheet is already cleared.
855  SCH_SCREENS screensList( &m_frame->Schematic().Root() );
856  screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
858  }
859 
861  m_toolMgr->RunAction( EE_ACTIONS::addItemsToSel, true, &newItems );
863 
864  return 0;
865 }
SCH_SHEET_LIST.
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:92
static KICAD_T duplicatableItems[]
SCH_SHEET * Last() const
Function Last returns a pointer to the last sheet of the list One can see the others sheet as the "pa...
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:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
virtual void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:196
bool IsNew() const
Definition: base_struct.h:199
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
std::vector< SCH_FIELD > & GetFields()
Definition: sch_sheet.h:268
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
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:81
#define NULL
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: base_struct.h:587
SCHEMATIC & Schematic() const
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
void ClearAnnotation(SCH_SHEET_PATH *aSheetPath)
Clear exiting component annotation.
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.h:105
bool NameExists(const wxString &aSheetName)
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:216
virtual unsigned int GetSize() const override
Function GetSize() Returns the number of stored items.
Definition: selection.h:100
SCH_SHEET & Root() const
Definition: schematic.h:97
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 Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
Schematic symbol object.
Definition: sch_component.h:88
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO_T aType, bool aAppend=false)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:117
SCH_SHEET_PATH & GetCurrentSheet() const
static TOOL_ACTION move
Definition: ee_actions.h:113
void ClearAnnotationOfNewSheetPaths(SCH_SHEET_LIST &aInitialSheetPathList)
Clear the annotation for the components inside new sheetpaths when a complex hierarchy is modified an...
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:127
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:528
EDA_ITEM * Front() const
Definition: selection.h:184

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(), 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(), SHEETNAME, and UR_NEW.

Referenced by setTransitions().

◆ EditField()

int SCH_EDIT_TOOL::EditField ( const TOOL_EVENT aEvent)

Definition at line 1147 of file sch_edit_tool.cpp.

1148 {
1149  static KICAD_T Nothing[] = { EOT };
1150  static KICAD_T CmpOrReference[] = { SCH_FIELD_LOCATE_REFERENCE_T, SCH_COMPONENT_T, EOT };
1151  static KICAD_T CmpOrValue[] = { SCH_FIELD_LOCATE_VALUE_T, SCH_COMPONENT_T, EOT };
1152  static KICAD_T CmpOrFootprint[] = { SCH_FIELD_LOCATE_FOOTPRINT_T, SCH_COMPONENT_T, EOT };
1153 
1154  KICAD_T* filter = Nothing;
1155 
1156  if( aEvent.IsAction( &EE_ACTIONS::editReference ) )
1157  filter = CmpOrReference;
1158  else if( aEvent.IsAction( &EE_ACTIONS::editValue ) )
1159  filter = CmpOrValue;
1160  else if( aEvent.IsAction( &EE_ACTIONS::editFootprint ) )
1161  filter = CmpOrFootprint;
1162 
1163  EE_SELECTION& selection = m_selectionTool->RequestSelection( filter );
1164 
1165  if( selection.Empty() )
1166  return 0;
1167 
1168  SCH_ITEM* item = (SCH_ITEM*) selection.Front();
1169 
1170  if( item->Type() == SCH_COMPONENT_T )
1171  {
1172  SCH_COMPONENT* component = (SCH_COMPONENT*) item;
1173 
1174  if( aEvent.IsAction( &EE_ACTIONS::editReference ) )
1175  editFieldText( component->GetField( REFERENCE ) );
1176  else if( aEvent.IsAction( &EE_ACTIONS::editValue ) )
1177  editFieldText( component->GetField( VALUE ) );
1178  else if( aEvent.IsAction( &EE_ACTIONS::editFootprint ) )
1179  editFieldText( component->GetField( FOOTPRINT ) );
1180  }
1181  else if( item->Type() == SCH_FIELD_T )
1182  {
1183  editFieldText( (SCH_FIELD*) item );
1184  }
1185 
1186  if( selection.IsHover() )
1188 
1189  return 0;
1190 }
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
bool IsHover() const
Definition: selection.h:71
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
Field Name Module PCB, i.e. "16DIP300".
Field Reference of part, i.e. "IC21".
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:67
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:123
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
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:121
SCH_FIELD * GetField(int aFieldNdx)
Returns a field in this symbol.
Field Value of part, i.e. "3.3K".
static TOOL_ACTION editValue
Definition: ee_actions.h:122
Schematic symbol object.
Definition: sch_component.h:88
static TOOL_ACTION editReference
Definition: ee_actions.h:121
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187
EDA_ITEM * Front() const
Definition: selection.h:184
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References EE_ACTIONS::clearSelection, editFieldText(), EE_ACTIONS::editFootprint, EE_ACTIONS::editReference, EE_ACTIONS::editValue, SELECTION::Empty(), EOT, FOOTPRINT, SELECTION::Front(), SCH_COMPONENT::GetField(), TOOL_EVENT::IsAction(), SELECTION::IsHover(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, REFERENCE, 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, EDA_ITEM::Type(), and VALUE.

Referenced by setTransitions().

◆ editFieldText()

void SCH_EDIT_TOOL::editFieldText ( SCH_FIELD aField)
private

Definition at line 1122 of file sch_edit_tool.cpp.

1123 {
1124  // Save old component in undo list if not already in edit, or moving.
1125  if( aField->GetEditFlags() == 0 ) // i.e. not edited, or moved
1126  saveCopyInUndoList( aField, UR_CHANGED );
1127 
1128  wxString title = wxString::Format( _( "Edit %s Field" ), aField->GetName() );
1129 
1130  DIALOG_SCH_EDIT_ONE_FIELD dlg( m_frame, title, aField );
1131 
1132  // The footprint field dialog can invoke a KIWAY_PLAYER so we must use a quasi-modal
1133  if( dlg.ShowQuasiModal() != wxID_OK )
1134  return;
1135 
1136  dlg.UpdateField( aField, &m_frame->GetCurrentSheet() );
1137 
1138  if( m_frame->eeconfig()->m_AutoplaceFields.enable || aField->GetParent()->Type() == SCH_SHEET_T )
1139  static_cast<SCH_ITEM*>( aField->GetParent() )->AutoAutoplaceFields( m_frame->GetScreen() );
1140 
1142  m_frame->RefreshItem( aField );
1143  m_frame->OnModify();
1144 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:207
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
STATUS_FLAGS GetEditFlags() const
Definition: base_struct.h:237
EDA_ITEM * GetParent() const
Definition: base_struct.h:195
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, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
void RefreshItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
#define _(s)
Definition: 3d_actions.cpp:33
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
Definition: sch_field.cpp:438
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO_T aType, bool aAppend=false)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:117
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)
Puts an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:268
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References _, 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(), SCH_BASE_FRAME::RefreshItem(), EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList(), SCH_SHEET_T, EVENTS::SelectedItemsModified, EDA_ITEM::Type(), and UR_CHANGED.

Referenced by EditField(), and Properties().

◆ getEditFrame()

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

Function getEditFrame()

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

Definition at line 187 of file tool_base.h.

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

Function GetId() Returns 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
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214

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

Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool.

Returns
Instance of the TOOL_MANAGER. If there is no TOOL_MANAGER associated, it returns NULL.

Definition at line 143 of file tool_base.h.

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

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

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 201 of file tool_base.h.

202  {
203  EDA_ITEM* m = getModelInt();
204 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
205  wxASSERT( dynamic_cast<T*>( m ) );
206 #endif
207  return static_cast<T*>( m );
208  }
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:54
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Function GetName() Returns 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 132 of file tool_base.h.

133  {
134  return m_toolName;
135  }
std::string m_toolName
Name of the tool.
Definition: tool_base.h:218

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

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 110 of file tool_base.h.

111  {
112  return m_type;
113  }
TOOL_TYPE m_type
Stores the type of the tool.
Definition: tool_base.h:211

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

Function getView()

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:219

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::checkPart(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), MICROWAVE_TOOL::drawMicrowaveInductor(), PL_DRAWING_TOOLS::DrawShape(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindComponentAndItem(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::GuessSelectionCandidates(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCB_INSPECTION_TOOL::highlightNet(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), PL_EDIT_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PNS::TOOL_BASE::pickSingleItem(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), PCB_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), SELECTION_TOOL::Selectable(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), EE_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), PL_EDITOR_CONTROL::ToggleBackgroundColor(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), EE_POINT_EDITOR::updateItem(), PL_POINT_EDITOR::updateItem(), POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), COMMON_TOOLS::ZoomFitScreen(), SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and SELECTION_TOOL::~SELECTION_TOOL().

◆ getViewControls()

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

Function getViewControls()

Returns 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:219
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(), POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDITOR_CONTROL::AssignNetclass(), BreakWire(), PCB_TOOL_BASE::controls(), 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(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), COMMON_TOOLS::OnGridChanged(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LIB_DRAWING_TOOLS::PlaceAnchor(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PICKER_TOOL::setControls(), PCBNEW_PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), LIB_MOVE_TOOL::updateModificationPoint(), 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

Function Go()

Defines which state (aStateFunc) to go when a certain event arrives (aConditions). No conditions means any event.

Definition at line 129 of file tool_interactive.h.

131 {
132  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
133 
134  goInternal( sptr, aConditions );
135 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:58
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)

References TOOL_INTERACTIVE::goInternal().

Referenced by LENGTH_TUNER_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), LIB_PIN_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), PL_POINT_EDITOR::setTransitions(), COMMON_CONTROL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), LIB_MOVE_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), POINT_EDITOR::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), SCH_MOVE_TOOL::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), LIB_CONTROL::setTransitions(), PL_EDIT_TOOL::setTransitions(), PAD_TOOL::setTransitions(), FOOTPRINT_EDITOR_TOOLS::setTransitions(), setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), PCBNEW_CONTROL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), PCB_INSPECTION_TOOL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), PCBNEW_PICKER_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), DRC::setTransitions(), EDIT_TOOL::setTransitions(), DRAWING_TOOL::setTransitions(), SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ Init()

bool SCH_EDIT_TOOL::Init ( )
overridevirtual

Function Init() 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 134 of file sch_edit_tool.cpp.

135 {
137 
140 
141  wxASSERT_MSG( drawingTools, "eeshema.InteractiveDrawing tool is not available" );
142 
143  auto sheetTool =
144  [ this ] ( const SELECTION& aSel )
145  {
147  };
148 
149  auto anyTextTool =
150  [ this ] ( const SELECTION& aSel )
151  {
156  };
157 
158  auto duplicateCondition =
159  [] ( const SELECTION& aSel )
160  {
162  return false;
163 
164  return true;
165  };
166 
167  auto orientCondition =
168  [] ( const SELECTION& aSel )
169  {
170  if( aSel.Empty() )
171  return false;
172 
174  return false;
175 
176  SCH_ITEM* item = (SCH_ITEM*) aSel.Front();
177 
178  if( aSel.GetSize() > 1 )
179  return true;
180 
181  switch( item->Type() )
182  {
183  case SCH_MARKER_T:
184  case SCH_JUNCTION_T:
185  case SCH_NO_CONNECT_T:
186  case SCH_LINE_T:
187  case SCH_PIN_T:
188  return false;
189  default:
190  return true;
191  }
192  };
193 
194  auto propertiesCondition =
195  []( const SELECTION& aSel )
196  {
197  if( aSel.GetSize() == 0 )
198  return true; // Show worksheet properties
199 
200  SCH_ITEM* firstItem = dynamic_cast<SCH_ITEM*>( aSel.Front() );
201 
202  wxCHECK( firstItem, false );
203 
204  const EE_SELECTION* eeSelection = dynamic_cast<const EE_SELECTION*>( &aSel );
205 
206  wxCHECK( eeSelection, false );
207 
208  if( aSel.GetSize() != 1
209  && !( aSel.GetSize() >= 1
210  && ( firstItem->Type() == SCH_LINE_T
211  || firstItem->Type() == SCH_BUS_WIRE_ENTRY_T )
212  && eeSelection->AllItemsHaveLineStroke() ) )
213  return false;
214 
215  if( aSel.GetSize() != 1
216  && !( aSel.GetSize() >= 1
217  && ( firstItem->Type() == SCH_JUNCTION_T )
218  && eeSelection->AreAllItemsIdentical() ) )
219  return false;
220 
221  switch( firstItem->Type() )
222  {
223  case SCH_COMPONENT_T:
224  case SCH_SHEET_T:
225  case SCH_SHEET_PIN_T:
226  case SCH_TEXT_T:
227  case SCH_LABEL_T:
228  case SCH_GLOBAL_LABEL_T:
229  case SCH_HIER_LABEL_T:
230  case SCH_FIELD_T:
231  case SCH_BITMAP_T:
232  return aSel.GetSize() == 1;
233 
234  case SCH_LINE_T:
236  for( EDA_ITEM* item : aSel.GetItems() )
237  {
238  SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( item );
239 
240  if( !schItem || !schItem->HasLineStroke() )
241  return false;
242  }
243 
244  return true;
245 
246  case SCH_JUNCTION_T:
247  return true;
248 
249  default:
250  return false;
251  }
252  };
253 
254  static KICAD_T toLabelTypes[] = { SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT };
255  auto toLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toLabelTypes );
256 
257  static KICAD_T toHLableTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_TEXT_T, EOT };
258  auto toHLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toHLableTypes );
259 
260  static KICAD_T toGLableTypes[] = { SCH_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT };
261  auto toGLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toGLableTypes );
262 
263  static KICAD_T toTextTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, EOT };
264  auto toTextlCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toTextTypes );
265 
266  static KICAD_T entryTypes[] = { SCH_BUS_WIRE_ENTRY_T, SCH_BUS_BUS_ENTRY_T, EOT };
267  auto entryCondition = E_C::MoreThan( 0 ) && E_C::OnlyTypes( entryTypes );
268 
269  auto singleComponentCondition = E_C::Count( 1 ) && E_C::OnlyType( SCH_COMPONENT_T );
270  auto wireSelectionCondition = E_C::MoreThan( 0 ) && E_C::OnlyType( SCH_LINE_LOCATE_WIRE_T );
271  auto busSelectionCondition = E_C::MoreThan( 0 ) && E_C::OnlyType( SCH_LINE_LOCATE_BUS_T );
272  auto singleSheetCondition = E_C::Count( 1 ) && E_C::OnlyType( SCH_SHEET_T );
273  auto symbolsOnlyCondition = E_C::MoreThan( 0 ) && E_C::OnlyType( SCH_COMPONENT_T );
274  //
275  // Add edit actions to the move tool menu
276  //
277  if( moveTool )
278  {
279  CONDITIONAL_MENU& moveMenu = moveTool->GetToolMenu().GetMenu();
280 
281  moveMenu.AddSeparator();
282  moveMenu.AddItem( EE_ACTIONS::rotateCCW, orientCondition );
283  moveMenu.AddItem( EE_ACTIONS::rotateCW, orientCondition );
284  moveMenu.AddItem( EE_ACTIONS::mirrorX, orientCondition );
285  moveMenu.AddItem( EE_ACTIONS::mirrorY, orientCondition );
287 
288  moveMenu.AddItem( EE_ACTIONS::properties, propertiesCondition );
289  moveMenu.AddItem( EE_ACTIONS::editReference, singleComponentCondition );
290  moveMenu.AddItem( EE_ACTIONS::editValue, singleComponentCondition );
291  moveMenu.AddItem( EE_ACTIONS::editFootprint, singleComponentCondition );
293 
294  std::shared_ptr<SYMBOL_UNIT_MENU> symUnitMenu = std::make_shared<SYMBOL_UNIT_MENU>();
295  symUnitMenu->SetTool( this );
296  m_menu.AddSubMenu( symUnitMenu );
297  moveMenu.AddMenu( symUnitMenu.get(), E_C::SingleMultiUnitSymbol, 1 );
298 
299  moveMenu.AddSeparator();
302  moveMenu.AddItem( ACTIONS::duplicate, duplicateCondition );
303  }
304 
305  //
306  // Add editing actions to the drawing tool menu
307  //
308  CONDITIONAL_MENU& drawMenu = drawingTools->GetToolMenu().GetMenu();
309 
310  drawMenu.AddItem( EE_ACTIONS::rotateCCW, orientCondition, 200 );
311  drawMenu.AddItem( EE_ACTIONS::rotateCW, orientCondition, 200 );
312  drawMenu.AddItem( EE_ACTIONS::mirrorX, orientCondition, 200 );
313  drawMenu.AddItem( EE_ACTIONS::mirrorY, orientCondition, 200 );
314 
315  drawMenu.AddItem( EE_ACTIONS::properties, propertiesCondition, 200 );
316  drawMenu.AddItem( EE_ACTIONS::editReference, singleComponentCondition, 200 );
317  drawMenu.AddItem( EE_ACTIONS::editValue, singleComponentCondition, 200 );
318  drawMenu.AddItem( EE_ACTIONS::editFootprint, singleComponentCondition, 200 );
319  drawMenu.AddItem( EE_ACTIONS::autoplaceFields, singleComponentCondition, 200 );
321 
322  std::shared_ptr<SYMBOL_UNIT_MENU> symUnitMenu2 = std::make_shared<SYMBOL_UNIT_MENU>();
323  symUnitMenu2->SetTool( drawingTools );
324  drawingTools->GetToolMenu().AddSubMenu( symUnitMenu2 );
325  drawMenu.AddMenu( symUnitMenu2.get(), E_C::SingleMultiUnitSymbol, 1 );
326 
327  drawMenu.AddItem( EE_ACTIONS::editWithLibEdit, singleComponentCondition && E_C::Idle, 200 );
328 
329  drawMenu.AddItem( EE_ACTIONS::toLabel, anyTextTool && E_C::Idle, 200 );
330  drawMenu.AddItem( EE_ACTIONS::toHLabel, anyTextTool && E_C::Idle, 200 );
331  drawMenu.AddItem( EE_ACTIONS::toGLabel, anyTextTool && E_C::Idle, 200 );
332  drawMenu.AddItem( EE_ACTIONS::toText, anyTextTool && E_C::Idle, 200 );
333  drawMenu.AddItem( EE_ACTIONS::cleanupSheetPins, sheetTool && E_C::Idle, 250 );
334 
335  //
336  // Add editing actions to the selection tool menu
337  //
339 
340  selToolMenu.AddItem( EE_ACTIONS::rotateCCW, orientCondition, 200 );
341  selToolMenu.AddItem( EE_ACTIONS::rotateCW, orientCondition, 200 );
342  selToolMenu.AddItem( EE_ACTIONS::mirrorX, orientCondition, 200 );
343  selToolMenu.AddItem( EE_ACTIONS::mirrorY, orientCondition, 200 );
344  selToolMenu.AddItem( ACTIONS::doDelete, E_C::NotEmpty, 200 );
345 
346  selToolMenu.AddItem( EE_ACTIONS::properties, propertiesCondition, 200 );
348  selToolMenu.AddItem( EE_ACTIONS::editValue, E_C::SingleSymbol, 200 );
350  selToolMenu.AddItem( EE_ACTIONS::autoplaceFields, singleComponentCondition, 200 );
352  selToolMenu.AddItem( EE_ACTIONS::refreshSymbolFromLibrary, symbolsOnlyCondition, 200 );
353 
354  std::shared_ptr<SYMBOL_UNIT_MENU> symUnitMenu3 = std::make_shared<SYMBOL_UNIT_MENU>();
355  symUnitMenu3->SetTool( m_selectionTool );
356  m_selectionTool->GetToolMenu().AddSubMenu( symUnitMenu3 );
357  selToolMenu.AddMenu( symUnitMenu3.get(), E_C::SingleMultiUnitSymbol, 1 );
358 
359  selToolMenu.AddItem( EE_ACTIONS::editWithLibEdit, singleComponentCondition && E_C::Idle, 200 );
360 
361  selToolMenu.AddItem( EE_ACTIONS::toLabel, toLabelCondition, 200 );
362  selToolMenu.AddItem( EE_ACTIONS::toHLabel, toHLabelCondition, 200 );
363  selToolMenu.AddItem( EE_ACTIONS::toGLabel, toGLabelCondition, 200 );
364  selToolMenu.AddItem( EE_ACTIONS::toText, toTextlCondition, 200 );
365  selToolMenu.AddItem( EE_ACTIONS::cleanupSheetPins, singleSheetCondition, 250 );
366 
367  selToolMenu.AddSeparator( 300 );
368  selToolMenu.AddItem( ACTIONS::cut, E_C::IdleSelection, 300 );
369  selToolMenu.AddItem( ACTIONS::copy, E_C::IdleSelection, 300 );
370  selToolMenu.AddItem( ACTIONS::paste, E_C::Idle, 300 );
371  selToolMenu.AddItem( ACTIONS::pasteSpecial, E_C::Idle, 300 );
372  selToolMenu.AddItem( ACTIONS::duplicate, duplicateCondition, 300 );
373 
374  return true;
375 }
void AddMenu(ACTION_MENU *aMenu, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Function AddMenu()
static TOOL_ACTION refreshSymbolFromLibrary
Definition: ee_actions.h:154
static TOOL_ACTION properties
Definition: ee_actions.h:120
bool IsCurrentTool(const TOOL_ACTION &aAction) const
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
static TOOL_ACTION toggleDeMorgan
Definition: ee_actions.h:125
static SELECTION_CONDITION SingleSymbol
static TOOL_ACTION doDelete
Definition: actions.h:74
SCH_DRAWING_TOOLS.
static SELECTION_CONDITION MoreThan(int aNumber)
Function MoreThan Creates a functor that tests if the number of selected items is greater than the va...
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Function OnlyTypes Creates a functor that tests if the selected items are only of given types.
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
static TOOL_ACTION mirrorY
Definition: ee_actions.h:119
static TOOL_ACTION placeHierLabel
Definition: ee_actions.h:87
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
static SELECTION_CONDITION IdleSelection
TOOL_MENU & GetToolMenu()
static TOOL_ACTION toText
Definition: ee_actions.h:132
static TOOL_ACTION autoplaceFields
Definition: ee_actions.h:124
bool AreAllItemsIdentical() const
Checks if all items in the selection are the same KICAD_T type.
Definition: selection.h:260
static SELECTION_CONDITION Idle
static SELECTION_CONDITION Count(int aNumber)
Function Count Creates a functor that tests if the number of selected items is equal to the value giv...
static bool NotEmpty(const SELECTION &aSelection)
Function NotEmpty Tests if there are any items selected.
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
static TOOL_ACTION rotateCW
Definition: ee_actions.h:116
bool Init() override
Function Init() Init() is called once upon a registration of the tool.
Definition: ee_tool_base.h:69
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:181
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:117
static TOOL_ACTION editFootprint
Definition: ee_actions.h:123
static TOOL_ACTION placeSchematicText
Definition: ee_actions.h:91
virtual bool HasLineStroke() const
Check if this schematic item has line stoke properties.
Definition: sch_item.h:465
static TOOL_ACTION cut
Definition: actions.h:69
static TOOL_ACTION mirrorX
Definition: ee_actions.h:118
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
static SELECTION_CONDITION SingleMultiUnitSymbol
bool AllItemsHaveLineStroke() const
Checks if all items in the selection support line strokes.
void AddSeparator(int aOrder=ANY_ORDER)
Function AddSeparator()
static TOOL_ACTION pasteSpecial
Definition: actions.h:72
static TOOL_ACTION placeLabel
Definition: ee_actions.h:85
static bool IsDrawingLineWireOrBus(const SELECTION &aSelection)
static TOOL_ACTION editValue
Definition: ee_actions.h:122
void AddSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Function CreateSubMenu.
Definition: tool_menu.cpp:52
static SELECTION_CONDITION OnlyType(KICAD_T aType)
Function OnlyType Creates a functor that tests if the selected items are only of given type.
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
static TOOL_ACTION editWithLibEdit
Definition: ee_actions.h:157
static TOOL_ACTION toLabel
Definition: ee_actions.h:129
static TOOL_ACTION toHLabel
Definition: ee_actions.h:130
static TOOL_ACTION editReference
Definition: ee_actions.h:121
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:86
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187
static TOOL_ACTION toGLabel
Definition: ee_actions.h:131
static TOOL_ACTION paste
Definition: actions.h:71
static TOOL_ACTION duplicate
Definition: actions.h:73
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References CONDITIONAL_MENU::AddItem(), CONDITIONAL_MENU::AddMenu(), CONDITIONAL_MENU::AddSeparator(), TOOL_MENU::AddSubMenu(), EE_SELECTION::AllItemsHaveLineStroke(), SELECTION::AreAllItemsIdentical(), EE_ACTIONS::autoplaceFields, 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, EOT, TOOL_MENU::GetMenu(), TOOL_MANAGER::GetTool(), TOOL_INTERACTIVE::GetToolMenu(), SCH_ITEM::HasLineStroke(), EE_CONDITIONS::Idle, EE_CONDITIONS::IdleSelection, EE_TOOL_BASE< T >::Init(), TOOLS_HOLDER::IsCurrentTool(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus(), 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::refreshSymbolFromLibrary, 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_LOCATE_BUS_T, SCH_LINE_LOCATE_WIRE_T, SCH_LINE_T, SCH_MARKER_T, SCH_NO_CONNECT_T, SCH_PIN_T, SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_TEXT_T, EE_CONDITIONS::SingleDeMorganSymbol, EE_CONDITIONS::SingleMultiUnitSymbol, EE_CONDITIONS::SingleSymbol, EE_ACTIONS::toggleDeMorgan, EE_ACTIONS::toGLabel, EE_ACTIONS::toHLabel, EE_ACTIONS::toLabel, EE_ACTIONS::toText, and EDA_ITEM::Type().

◆ 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:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool IsToolActive(TOOL_ID aId) const
Function IsToolActive() Returns true if a tool with given id is active (executing)

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

Referenced by EDIT_TOOL::isRouterActive(), and ROUTER_TOOL::onViaCommand().

◆ Mirror()

int SCH_EDIT_TOOL::Mirror ( const TOOL_EVENT aEvent)

Definition at line 581 of file sch_edit_tool.cpp.

582 {
584 
585  if( selection.GetSize() == 0 )
586  return 0;
587 
588  wxPoint mirrorPoint;
589  bool xAxis = ( aEvent.Matches( EE_ACTIONS::mirrorX.MakeEvent() ) );
590  SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.Front() );
591  bool connections = false;
592  bool moving = item->IsMoving();
593 
594  if( selection.GetSize() == 1 )
595  {
596  if( !moving )
598 
599  switch( item->Type() )
600  {
601  case SCH_COMPONENT_T:
602  {
603  SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
604 
605  if( xAxis )
606  component->SetOrientation( CMP_MIRROR_X );
607  else
608  component->SetOrientation( CMP_MIRROR_Y );
609 
611  component->AutoAutoplaceFields( m_frame->GetScreen() );
612 
613  break;
614  }
615 
616  case SCH_TEXT_T:
617  case SCH_LABEL_T:
618  case SCH_GLOBAL_LABEL_T:
619  case SCH_HIER_LABEL_T:
620  {
621  SCH_TEXT* textItem = static_cast<SCH_TEXT*>( item );
622 
623  if( xAxis )
624  textItem->SetLabelSpinStyle( textItem->GetLabelSpinStyle().MirrorX() );
625  else
626  textItem->SetLabelSpinStyle( textItem->GetLabelSpinStyle().MirrorY() );
627  break;
628  }
629 
630  case SCH_SHEET_PIN_T:
631  {
632  // mirror within parent sheet
633  SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
634  SCH_SHEET* sheet = pin->GetParent();
635 
636  if( xAxis )
637  pin->MirrorX( sheet->GetBoundingBox().GetCenter().y );
638  else
639  pin->MirrorY( sheet->GetBoundingBox().GetCenter().x );
640 
641  break;
642  }
643 
644  case SCH_BUS_BUS_ENTRY_T:
646  if( xAxis )
647  item->MirrorX( item->GetPosition().y );
648  else
649  item->MirrorY( item->GetPosition().x );
650  break;
651 
652  case SCH_FIELD_T:
653  {
654  SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
655 
656  if( xAxis )
658  else
660 
661  // Now that we're re-justifying a field, they're no longer autoplaced.
662  static_cast<SCH_ITEM*>( item->GetParent() )->ClearFieldsAutoplaced();
663 
664  break;
665  }
666 
667  case SCH_BITMAP_T:
668  if( xAxis )
669  item->MirrorX( item->GetPosition().y );
670  else
671  item->MirrorY( item->GetPosition().x );
672 
673  // The bitmap is cached in Opengl: clear the cache to redraw
675  break;
676 
677  case SCH_SHEET_T:
678  // Mirror the sheet on itself. Sheets do not have a anchor point.
679  mirrorPoint = m_frame->GetNearestGridPosition( item->GetBoundingBox().Centre() );
680 
681  if( xAxis )
682  item->MirrorX( mirrorPoint.y );
683  else
684  item->MirrorY( mirrorPoint.x );
685 
686  break;
687 
688  default:
689  break;
690  }
691 
692  connections = item->IsConnectable();
693  m_frame->RefreshItem( item );
694  }
695  else if( selection.GetSize() > 1 )
696  {
697  mirrorPoint = m_frame->GetNearestGridPosition( (wxPoint)selection.GetCenter() );
698 
699  for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
700  {
701  item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
702 
703  if( !moving )
704  saveCopyInUndoList( item, UR_CHANGED, ii > 0 );
705 
706  if( item->Type() == SCH_SHEET_PIN_T )
707  {
708  if( item->GetParent()->IsSelected() )
709  {
710  // parent will mirror us
711  }
712  else
713  {
714  // mirror within parent sheet
715  SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
716  SCH_SHEET* sheet = pin->GetParent();
717 
718  if( xAxis )
719  pin->MirrorX( sheet->GetBoundingBox().GetCenter().y );
720  else
721  pin->MirrorY( sheet->GetBoundingBox().GetCenter().x );
722  }
723  }
724  else
725  {
726  if( xAxis )
727  item->MirrorX( mirrorPoint.y );
728  else
729  item->MirrorY( mirrorPoint.x );
730  }
731 
732  connections |= item->IsConnectable();
733  m_frame->RefreshItem( item );
734  }
735  }
736 
738 
739  if( item->IsMoving() )
740  {
742  }
743  else
744  {
745  if( selection.IsHover() )
747 
748  if( connections )
750 
751  m_frame->OnModify();
752  }
753 
754  return 0;
755 }
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
virtual bool IsConnectable() const
Definition: sch_item.h:370
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:48
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:200
bool IsHover() const
Definition: selection.h:71
SCH_SHEET * GetParent() const
Get the parent sheet object of this sheet pin.
Definition: sch_sheet.h:168
bool IsSelected() const
Definition: base_struct.h:203
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:450
virtual VECTOR2I GetCenter() const
Returns the center point of the selection area bounding box.
Definition: selection.h:138
bool IsMoving() const
Definition: base_struct.h:200
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void RecacheAllItems()
Function RecacheAllItems() Rebuilds GAL display lists.
Definition: view.cpp:1406
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
virtual wxPoint GetPosition() const
Definition: base_struct.h:337
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
Definition: actions.h:207
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:199
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: sch_sheet.cpp:595
void SetVertJustify(EDA_TEXT_VJUSTIFY_T aType)
Definition: eda_text.h:203
EDA_ITEM * GetParent() const
Definition: base_struct.h:195
const KICAD_T rotatableItems[]
static TOOL_ACTION mirrorX
Definition: ee_actions.h:118
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
LABEL_SPIN_STYLE GetLabelSpinStyle() const
Definition: sch_text.h:232
bool Matches(const TOOL_EVENT &aEvent) const
Function Matches() Tests whether two events match in terms of category & action or command.
Definition: tool_event.h:364
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:84
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:105
LABEL_SPIN_STYLE MirrorY()
Definition: sch_text.h:127
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:216
EDA_TEXT_VJUSTIFY_T
Definition: eda_text.h:55
virtual unsigned int GetSize() const override
Function GetSize() Returns the number of stored items.
Definition: selection.h:100
LABEL_SPIN_STYLE MirrorX()
Definition: sch_text.h:108
void RefreshItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:202
Schematic symbol object.
Definition: sch_component.h:88
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO_T aType, bool aAppend=false)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:117
wxPoint Centre() const
Definition: eda_rect.h:62
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
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: base_struct.cpp:97
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:230
const wxPoint GetCenter() const
Definition: eda_rect.h:117
void PostEvent(const TOOL_EVENT &aEvent)
Puts an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:268
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187
static TOOL_ACTION refreshPreview
Definition: actions.h:102
EDA_ITEM * Front() const
Definition: selection.h:184
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193
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(), 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(), SCH_TEXT::GetLabelSpinStyle(), EDA_DRAW_FRAME::GetNearestGridPosition(), SCH_SHEET_PIN::GetParent(), EDA_ITEM::GetParent(), EDA_ITEM::GetPosition(), SCH_EDIT_FRAME::GetScreen(), SELECTION::GetSize(), EDA_TEXT::GetVertJustify(), TOOL_BASE::getView(), 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(), LABEL_SPIN_STYLE::MirrorX(), EE_ACTIONS::mirrorX, SCH_SHEET_PIN::MirrorX(), SCH_ITEM::MirrorX(), LABEL_SPIN_STYLE::MirrorY(), SCH_SHEET_PIN::MirrorY(), SCH_ITEM::MirrorY(), SCH_EDIT_FRAME::OnModify(), TOOL_MANAGER::PostEvent(), KIGFX::VIEW::RecacheAllItems(), SCH_BASE_FRAME::RefreshItem(), 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_TEXT::SetLabelSpinStyle(), SCH_COMPONENT::SetOrientation(), EDA_TEXT::SetVertJustify(), SCH_EDIT_FRAME::TestDanglingEnds(), EDA_ITEM::Type(), UR_CHANGED, wxPoint::x, and wxPoint::y.

Referenced by setTransitions().

◆ Properties()

int SCH_EDIT_TOOL::Properties ( const TOOL_EVENT aEvent)

Definition at line 1333 of file sch_edit_tool.cpp.

1334 {
1336 
1337  if( selection.Empty() )
1338  {
1340  {
1342  VECTOR2D cursorPos = getViewControls()->GetCursorPosition( false );
1343 
1344  if( worksheet && worksheet->HitTestWorksheetItems( getView(), (wxPoint) cursorPos ) )
1346  }
1347 
1348  return 0;
1349  }
1350 
1351  SCH_ITEM* item = (SCH_ITEM*) selection.Front();
1352 
1353  switch( item->Type() )
1354  {
1355  case SCH_LINE_T:
1356  case SCH_BUS_WIRE_ENTRY_T:
1357  if( !selection.AllItemsHaveLineStroke() )
1358  return 0;
1359 
1360  break;
1361 
1362  case SCH_JUNCTION_T:
1363  if( !selection.AreAllItemsIdentical() )
1364  return 0;
1365 
1366  break;
1367 
1368  default:
1369  if( selection.Size() > 1 )
1370  return 0;
1371 
1372  break;
1373  }
1374 
1375  switch( item->Type() )
1376  {
1377  case SCH_COMPONENT_T:
1378  {
1379  SCH_COMPONENT* component = (SCH_COMPONENT*) item;
1380  DIALOG_EDIT_COMPONENT_IN_SCHEMATIC dlg( m_frame, component );
1381 
1382  // This dialog itself subsequently can invoke a KIWAY_PLAYER as a quasimodal
1383  // frame. Therefore this dialog as a modal frame parent, MUST be run under
1384  // quasimodal mode for the quasimodal frame support to work. So don't use
1385  // the QUASIMODAL macros here.
1386  if( dlg.ShowQuasiModal() == wxID_OK )
1387  {
1389  component->AutoAutoplaceFields( m_frame->GetScreen() );
1390 
1392  m_frame->OnModify();
1393  }
1394  }
1395  break;
1396 
1397  case SCH_SHEET_T:
1398  {
1399  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
1400  bool doClearAnnotation;
1401  bool doRefresh = false;
1402  // Keep track of existing sheet paths. EditSheet() can modify this list
1403  SCH_SHEET_LIST initial_sheetpathList = m_frame->Schematic().GetSheets();
1404 
1405  doRefresh = m_frame->EditSheetProperties(
1406  sheet, &m_frame->GetCurrentSheet(), &doClearAnnotation );
1407 
1408  // If the sheet file is changed and new sheet contents are loaded then we have to
1409  // clear the annotations on the new content (as it may have been set from some other
1410  // sheet path reference)
1411  if( doClearAnnotation )
1412  {
1413  SCH_SCREENS screensList( &m_frame->Schematic().Root() );
1414  // We clear annotation of new sheet paths here:
1415  screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
1416  // Clear annotation of g_CurrentSheet itself, because its sheetpath is not a new
1417  // path, but components managed by its sheet path must have their annotation
1418  // cleared, because they are new:
1420  }
1421 
1422  if( doRefresh )
1423  {
1425  m_frame->GetCanvas()->Refresh();
1427  }
1428 
1429  break;
1430  }
1431 
1432  case SCH_SHEET_PIN_T:
1433  {
1434  SCH_SHEET_PIN* pin = (SCH_SHEET_PIN*) item;
1435  DIALOG_EDIT_SHEET_PIN dlg( m_frame, pin );
1436 
1437  if( dlg.ShowModal() == wxID_OK )
1438  {
1440  m_frame->OnModify();
1441  }
1442  }
1443  break;
1444 
1445  case SCH_TEXT_T:
1446  case SCH_LABEL_T:
1447  case SCH_GLOBAL_LABEL_T:
1448  case SCH_HIER_LABEL_T:
1449  {
1450  DIALOG_LABEL_EDITOR dlg( m_frame, (SCH_TEXT*) item );
1451 
1452  if( dlg.ShowModal() == wxID_OK )
1453  {
1455  m_frame->OnModify();
1456  }
1457  }
1458  break;
1459 
1460  case SCH_FIELD_T:
1461  editFieldText( (SCH_FIELD*) item );
1462  break;
1463 
1464  case SCH_BITMAP_T:
1465  {
1466  SCH_BITMAP* bitmap = (SCH_BITMAP*) item;
1467  DIALOG_IMAGE_EDITOR dlg( m_frame, bitmap->GetImage() );
1468 
1469  if( dlg.ShowModal() == wxID_OK )
1470  {
1471  // save old image in undo list if not already in edit
1472  if( bitmap->GetEditFlags() == 0 )
1473  saveCopyInUndoList( bitmap, UR_CHANGED );
1474 
1475  dlg.TransferToImage( bitmap->GetImage() );
1476 
1477  // The bitmap is cached in Opengl: clear the cache in case it has become invalid
1478  getView()->RecacheAllItems();
1480  m_frame->OnModify();
1481  }
1482  }
1483  break;
1484 
1485  case SCH_LINE_T:
1486  case SCH_BUS_WIRE_ENTRY_T:
1487  {
1488  std::deque<SCH_ITEM*> strokeItems;
1489 
1490  for( auto selItem : selection.Items() )
1491  {
1492  SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( selItem );
1493 
1494  if( schItem && schItem->HasLineStroke() )
1495  strokeItems.push_back( schItem );
1496  else
1497  return 0;
1498  }
1499 
1500  DIALOG_EDIT_LINE_STYLE dlg( m_frame, strokeItems );
1501 
1502  if( dlg.ShowModal() == wxID_OK )
1503  {
1505  m_frame->OnModify();
1506  }
1507  }
1508  break;
1509 
1510  case SCH_JUNCTION_T:
1511  {
1512  std::deque<SCH_JUNCTION*> junctions;
1513 
1514  for( auto selItem : selection.Items() )
1515  {
1516  SCH_JUNCTION* junction = dynamic_cast<SCH_JUNCTION*>( selItem );
1517 
1518  wxCHECK( junction, 0 );
1519 
1520  junctions.push_back( junction );
1521  }
1522 
1523  DIALOG_JUNCTION_PROPS dlg( m_frame, junctions );
1524 
1525  if( dlg.ShowModal() == wxID_OK )
1526  {
1528  m_frame->OnModify();
1529  }
1530  }
1531  break;
1532 
1533  case SCH_MARKER_T: // These items have no properties to edit
1534  case SCH_NO_CONNECT_T:
1535  break;
1536 
1537  default: // Unexpected item
1538  wxFAIL_MSG( wxString( "Cannot edit schematic item type " ) + item->GetClass() );
1539  }
1540 
1541  m_frame->GetScreen()->Update( item );
1542  updateView( item );
1543 
1544  if( selection.IsHover() )
1546 
1547  return 0;
1548 }
SCH_SHEET_LIST.
KIGFX::SCH_VIEW * GetView() const override
Function GetView() Returns 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:52
bool IsHover() const
Definition: selection.h:71
std::deque< EDA_ITEM * > & Items()
Definition: selection.h:189
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:92
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:450
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void RecacheAllItems()
Function RecacheAllItems() Rebuilds GAL display lists.
Definition: view.cpp:1406
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
WS_PROXY_VIEW_ITEM * GetWorksheet() const
Definition: sch_view.h:96
bool AreAllItemsIdentical() const
Checks if all items in the selection are the same KICAD_T type.
Definition: selection.h:260
SCH_SCREEN * GetScreen() const
Definition: sch_sheet.h:282
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:207
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)
AUTOPLACE_FIELDS m_AutoplaceFields
BITMAP_BASE * GetImage()
Definition: sch_bitmap.h:59
STATUS_FLAGS GetEditFlags() const
Definition: base_struct.h:237
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:465
SCHEMATIC & Schematic() const
void UpdateHierarchyNavigator(bool aForceUpdate=false)
Run the Hierarchy Navigator dialog.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:84
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
Object to handle a bitmap image that can be inserted in a schematic.
Definition: sch_bitmap.h:42
KIGFX::VIEW * getView() const
Function getView()
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:121
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:216
bool AllItemsHaveLineStroke() const
Checks if all items in the selection support line strokes.
SCH_SHEET & Root() const
Definition: schematic.h:97
void updateView(EDA_ITEM *aItem) const
Similar to getView()->Update(), but handles items that are redrawn by their parents.
Definition: ee_tool_base.h:104
Dialog used to edit SCH_COMPONENT objects in a schematic.
int Size() const
Returns the number of selected parts.
Definition: selection.h:127
Schematic symbol object.
Definition: sch_component.h:88
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO_T aType, bool aAppend=false)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:117
virtual wxString GetClass() const override
Function GetClass returns the class name.
Definition: sch_item.h:214
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:893
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
void Update(SCH_ITEM *aItem)
Updates aItem's bounding box in the tree.
Definition: sch_screen.cpp:237
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
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...
void PostEvent(const TOOL_EVENT &aEvent)
Puts an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:268
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187
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
Returns the current cursor position in world coordinates.
EDA_ITEM * Front() const
Definition: selection.h:184
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193
bool IsLayerVisible(int aLayer) const
Function IsLayerVisible() Returns information about visibility of a particular layer.
Definition: view.h:416

References EE_SELECTION::AllItemsHaveLineStroke(), SELECTION::AreAllItemsIdentical(), SCH_ITEM::AutoAutoplaceFields(), 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, SELECTION::Front(), SCH_BASE_FRAME::GetCanvas(), SCH_FIELD::GetClass(), SCH_EDIT_FRAME::GetCurrentSheet(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), EDA_ITEM::GetEditFlags(), SCH_BITMAP::GetImage(), SCH_EDIT_FRAME::GetScreen(), SCH_SHEET::GetScreen(), SCHEMATIC::GetSheets(), 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(), 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, 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(), EDA_ITEM::Type(), SCH_SCREEN::Update(), SCH_EDIT_FRAME::UpdateHierarchyNavigator(), EE_TOOL_BASE< SCH_EDIT_FRAME >::updateView(), and UR_CHANGED.

Referenced by setTransitions().

◆ RefreshSymbolFromLibrary()

int SCH_EDIT_TOOL::RefreshSymbolFromLibrary ( const TOOL_EVENT aEvent)

Definition at line 1259 of file sch_edit_tool.cpp.

1260 {
1261  wxString msg;
1262  bool appendToUndo = false;
1264 
1265  if( selection.Empty() )
1266  return 0;
1267 
1268  WX_INFOBAR* infoBar = m_frame->GetInfoBar();
1269 
1270  wxCHECK( infoBar, 0 );
1271 
1272  INFOBAR_REPORTER reporter( infoBar );
1273 
1274  SCH_SCREEN* currentScreen = m_frame->GetScreen();
1275 
1276  wxCHECK( currentScreen, 0 );
1277 
1278  for( auto item : selection )
1279  {
1280  SCH_COMPONENT* symbol = dynamic_cast<SCH_COMPONENT*>( item );
1281 
1282  wxCHECK( symbol, 0 );
1283 
1284  // This needs to be done before the LIB_ID is changed to prevent stale library symbols in
1285  // the schematic file.
1286  currentScreen->Remove( symbol );
1287 
1288  if( !symbol->IsNew() )
1289  {
1290  saveCopyInUndoList( symbol, UR_CHANGED, appendToUndo );
1291  appendToUndo = true;
1292  }
1293 
1294  LIB_ID id = symbol->GetLibId();
1295 
1296  if( !id.IsValid() )
1297  {
1298  msg.Printf( _( "'%s' is not a valid library indentifier." ),
1299  id.GetUniStringLibId() );
1300  reporter.Report( msg, RPT_SEVERITY_WARNING );
1301  continue;
1302  }
1303 
1304  LIB_PART* libSymbol = m_frame->Prj().SchSymbolLibTable()->LoadSymbol( id );
1305 
1306  if( !libSymbol )
1307  {
1308  msg.Printf( _( "Symbol '%s' not found in symbol library '%s'." ),
1309  id.GetLibItemName().wx_str(), id.GetLibNickname().wx_str() );
1310  reporter.Report( msg, RPT_SEVERITY_WARNING );
1311  continue;
1312  }
1313 
1314  symbol->SetLibSymbol( libSymbol->Flatten().release() );
1315  currentScreen->Append( symbol );
1317  updateView( symbol );
1318  }
1319 
1320  if( selection.IsHover() )
1322 
1323  if( reporter.HasMessage() )
1324  reporter.Finalize();
1325 
1326  m_frame->GetCanvas()->Refresh();
1327  m_frame->OnModify();
1328 
1329  return 0;
1330 }
bool Remove(SCH_ITEM *aItem)
Remove aItem from the schematic associated with this screen.
Definition: sch_screen.cpp:244
void SetLibSymbol(LIB_PART *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
static const KICAD_T ComponentsOnly[]
Definition: ee_collectors.h:47
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
bool IsNew() const
Definition: base_struct.h:199
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.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void SelectHighlightItem(EDA_ITEM *aItem)
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Define a library symbol object.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
std::unique_ptr< LIB_PART > Flatten() const
Return a flattened symbol inheritance to the caller.
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:121
A modified version of the wxInfoBar class that allows us to:
Definition: infobar.h:68
void updateView(EDA_ITEM *aItem) const
Similar to getView()->Update(), but handles items that are redrawn by their parents.
Definition: ee_tool_base.h:104
void Append(SCH_ITEM *aItem)
Definition: sch_screen.cpp:132
#define _(s)
Definition: 3d_actions.cpp:33
Schematic symbol object.
Definition: sch_component.h:88
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO_T aType, bool aAppend=false)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:117
WX_INFOBAR * GetInfoBar()
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
const LIB_ID & GetLibId() const
INFOBAR_REPORTER is a wrapper for reporting to a WX_INFOBAR UI element.
Definition: reporter.h:287

References _, SCH_SCREEN::Append(), EE_ACTIONS::clearSelection, EE_COLLECTOR::ComponentsOnly, SELECTION::Empty(), INFOBAR_REPORTER::Finalize(), LIB_PART::Flatten(), SCH_BASE_FRAME::GetCanvas(), EDA_BASE_FRAME::GetInfoBar(), SCH_COMPONENT::GetLibId(), SCH_EDIT_FRAME::GetScreen(), INFOBAR_REPORTER::HasMessage(), 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(), KIWAY_HOLDER::Prj(), EDA_DRAW_PANEL_GAL::Refresh(), SCH_SCREEN::Remove(), INFOBAR_REPORTER::Report(), EE_SELECTION_TOOL::RequestSelection(), RPT_SEVERITY_WARNING, TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList(), EE_SELECTION_TOOL::SelectHighlightItem(), SCH_COMPONENT::SetLibSymbol(), EE_TOOL_BASE< SCH_EDIT_FRAME >::updateView(), and UR_CHANGED.

Referenced by setTransitions().

◆ RepeatDrawItem()

int SCH_EDIT_TOOL::RepeatDrawItem ( const TOOL_EVENT aEvent)

Definition at line 868 of file sch_edit_tool.cpp.

869 {
870  SCH_ITEM* sourceItem = m_frame->GetRepeatItem();
871 
872  if( !sourceItem )
873  return 0;
874 
876 
877  SCH_ITEM* newItem = sourceItem->Duplicate();
878  bool performDrag = false;
879 
880  // If cloning a component then put into 'move' mode.
881  if( newItem->Type() == SCH_COMPONENT_T )
882  {
883  wxPoint cursorPos = (wxPoint) getViewControls()->GetCursorPosition( true );
884  newItem->Move( cursorPos - newItem->GetPosition() );
885  performDrag = true;
886  }
887  else
888  {
889  if( m_isLibEdit )
890  {
891  LIBEDIT_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
892 
893  if( dynamic_cast<SCH_TEXT*>( newItem ) )
894  {
895  SCH_TEXT* text = static_cast<SCH_TEXT*>( newItem );
896  text->IncrementLabel( cfg->m_Repeat.label_delta );
897  }
898 
899  newItem->Move( wxPoint( Mils2iu( cfg->m_Repeat.x_step ),
900  Mils2iu( cfg->m_Repeat.y_step ) ) );
901  }
902  else
903  {
904  EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
905 
906  if( dynamic_cast<SCH_TEXT*>( newItem ) )
907  {
908  SCH_TEXT* text = static_cast<SCH_TEXT*>( newItem );
910  }
911 
912  newItem->Move( wxPoint( Mils2iu( cfg->m_Drawing.default_repeat_offset_x ),
913  Mils2iu( cfg->m_Drawing.default_repeat_offset_y ) ) );
914  }
915 
916  }
917 
918  newItem->SetFlags( IS_NEW );
919  m_frame->AddToScreen( newItem, m_frame->GetScreen() );
920  m_frame->SaveCopyInUndoList( m_frame->GetScreen(), newItem, UR_NEW, false );
921 
922  m_selectionTool->AddItemToSel( newItem );
923 
924  if( performDrag )
926 
927  newItem->ClearFlags();
928 
929  if( newItem->IsConnectable() )
930  {
931  auto selection = m_selectionTool->GetSelection();
932 
933  m_toolMgr->RunAction( EE_ACTIONS::addNeededJunctions, true, &selection );
936  }
937 
938  // newItem newItem, now that it has been moved, thus saving new position.
939  m_frame->SaveCopyForRepeatItem( newItem );
940 
941  return 0;
942 }
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:370
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
virtual wxPoint GetPosition() const
Definition: base_struct.h:337
EE_SELECTION & GetSelection()
Function GetSelection()
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
Definition: sch_item.cpp:81
void SaveCopyForRepeatItem(SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
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,...
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO_T 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 ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:233
static TOOL_ACTION move
Definition: ee_actions.h:113
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193
void IncrementLabel(int aIncrement)
Increment the label text, if it ends with a number.
Definition: sch_text.cpp:150
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(), LIBEDIT_SETTINGS::REPEAT::label_delta, EESCHEMA_SETTINGS::m_Drawing, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_isLibEdit, LIBEDIT_SETTINGS::m_Repeat, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_ACTIONS::move, SCH_ITEM::Move(), 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(), SCH_EDIT_FRAME::TestDanglingEnds(), EDA_ITEM::Type(), UR_NEW, LIBEDIT_SETTINGS::REPEAT::x_step, and LIBEDIT_SETTINGS::REPEAT::y_step.

Referenced by setTransitions().

◆ Reset()

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

Function Reset() Brings 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_isLibEdit = dynamic_cast<LIB_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:82
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36

◆ Rotate()

int SCH_EDIT_TOOL::Rotate ( const TOOL_EVENT aEvent)

Definition at line 397 of file sch_edit_tool.cpp.

398 {
400 
401  if( selection.GetSize() == 0 )
402  return 0;
403 
404  wxPoint rotPoint;
405  bool clockwise = ( aEvent.Matches( EE_ACTIONS::rotateCW.MakeEvent() ) );
406  SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.Front() );
407  bool connections = false;
408  bool moving = item->IsMoving();
409 
410  if( selection.GetSize() == 1 )
411  {
412  if( !moving )
414 
415  switch( item->Type() )
416  {
417  case SCH_COMPONENT_T:
418  {
419  SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
420 
421  if( clockwise )
422  component->SetOrientation( CMP_ROTATE_CLOCKWISE );
423  else
425 
427  component->AutoAutoplaceFields( m_frame->GetScreen() );
428 
429  break;
430  }
431 
432  case SCH_TEXT_T:
433  case SCH_LABEL_T:
434  case SCH_GLOBAL_LABEL_T:
435  case SCH_HIER_LABEL_T:
436  {
437  SCH_TEXT* textItem = static_cast<SCH_TEXT*>( item );
438 
439  if( clockwise )
440  textItem->SetLabelSpinStyle( textItem->GetLabelSpinStyle().RotateCW() );
441  else
442  textItem->SetLabelSpinStyle( textItem->GetLabelSpinStyle().RotateCCW() );
443 
444  break;
445  }
446 
447  case SCH_SHEET_PIN_T:
448  {
449  // Rotate pin within parent sheet
450  SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
451  SCH_SHEET* sheet = pin->GetParent();
452  for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
453  {
454  pin->Rotate( sheet->GetBoundingBox().GetCenter() );
455  }
456  break;
457  }
458 
459  case SCH_BUS_BUS_ENTRY_T:
461  for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
462  {
463  item->Rotate( item->GetPosition() );
464  }
465  break;
466 
467  case SCH_FIELD_T:
468  {
469  SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
470 
471  if( field->GetTextAngle() == TEXT_ANGLE_HORIZ )
472  field->SetTextAngle( TEXT_ANGLE_VERT );
473  else
474  field->SetTextAngle( TEXT_ANGLE_HORIZ );
475 
476  // Now that we're moving a field, they're no longer autoplaced.
477  static_cast<SCH_ITEM*>( item->GetParent() )->ClearFieldsAutoplaced();
478 
479  break;
480  }
481 
482  case SCH_BITMAP_T:
483  for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
484  {
485  item->Rotate( item->GetPosition() );
486  }
487  // The bitmap is cached in Opengl: clear the cache to redraw
489  break;
490 
491  case SCH_SHEET_T:
492  {
493  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
494 
495  // Rotate the sheet on itself. Sheets do not have an anchor point.
496  for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
497  {
498  rotPoint = m_frame->GetNearestGridPosition( sheet->GetRotationCenter() );
499  sheet->Rotate( rotPoint );
500  }
501  break;
502  }
503 
504  default:
505  break;
506  }
507 
508  connections = item->IsConnectable();
509  m_frame->RefreshItem( item );
510  }
511  else if( selection.GetSize() > 1 )
512  {
513  rotPoint = m_frame->GetNearestGridPosition( (wxPoint)selection.GetCenter() );
514 
515  for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
516  {
517  item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
518 
519  if( !moving )
520  saveCopyInUndoList( item, UR_CHANGED, ii > 0 );
521 
522  for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
523  {
524  if( item->Type() == SCH_LINE_T )
525  {
526  SCH_LINE* line = (SCH_LINE*) item;
527 
528  if( item->HasFlag( STARTPOINT ) )
529  line->RotateStart( rotPoint );
530 
531  if( item->HasFlag( ENDPOINT ) )
532  line->RotateEnd( rotPoint );
533  }
534  else if( item->Type() == SCH_SHEET_PIN_T )
535  {
536  if( item->GetParent()->IsSelected() )
537  {
538  // parent will rotate us
539  }
540  else
541  {
542  // rotate within parent
543  SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
544  SCH_SHEET* sheet = pin->GetParent();
545 
546  pin->Rotate( sheet->GetBoundingBox().GetCenter() );
547  }
548  }
549  else
550  {
551  item->Rotate( rotPoint );
552  }
553  }
554 
555  connections |= item->IsConnectable();
556  m_frame->RefreshItem( item );
557  }
558  }
559 
561 
562  if( item->IsMoving() )
563  {
565  }
566  else
567  {
568  if( selection.IsHover() )
570 
571  if( connections )
573 
574  m_frame->OnModify();
575  }
576 
577  return 0;
578 }
#define TEXT_ANGLE_HORIZ
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
virtual bool IsConnectable() const
Definition: sch_item.h:370
bool IsHover() const
Definition: selection.h:71
SCH_SHEET * GetParent() const
Get the parent sheet object of this sheet pin.
Definition: sch_sheet.h:168
bool IsSelected() const
Definition: base_struct.h:203
#define TEXT_ANGLE_VERT
void AutoAutoplaceFields(SCH_SCREEN *aScreen)
Autoplace fields only if correct to do so automatically.
Definition: sch_item.h:450
void RotateEnd(wxPoint aPosition)
Definition: sch_line.cpp:328
virtual VECTOR2I GetCenter() const
Returns the center point of the selection area bounding box.
Definition: selection.h:138
bool IsMoving() const
Definition: base_struct.h:200
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void RecacheAllItems()
Function RecacheAllItems() Rebuilds GAL display lists.
Definition: view.cpp:1406
double GetTextAngle() const
Definition: eda_text.h:174
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
virtual wxPoint GetPosition() const
Definition: base_struct.h:337
wxPoint GetNearestGridPosition(const wxPoint &aPosition) const
Return the nearest aGridSize location to aPosition.
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:207
void RotateStart(wxPoint aPosition)
Definition: sch_line.cpp:322
static TOOL_ACTION rotateCW
Definition: ee_actions.h:116
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
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: sch_sheet.cpp:595
EDA_ITEM * GetParent() const
Definition: base_struct.h:195
const KICAD_T rotatableItems[]
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
LABEL_SPIN_STYLE GetLabelSpinStyle() const
Definition: sch_text.h:232
bool Matches(const TOOL_EVENT &aEvent) const
Function Matches() Tests whether two events match in terms of category & action or command.
Definition: tool_event.h:364
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:84
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:105
void Rotate(wxPoint aPosition) override
Rotate the item around aPosition 90 degrees in the clockwise direction.
Definition: sch_sheet.cpp:730
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
LABEL_SPIN_STYLE RotateCCW()
Definition: sch_text.h:89
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:216
virtual unsigned int GetSize() const override
Function GetSize() Returns the number of stored items.
Definition: selection.h:100
LABEL_SPIN_STYLE RotateCW()
Definition: sch_text.h:73
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
void RefreshItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:123
Schematic symbol object.
Definition: sch_component.h:88
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO_T aType, bool aAppend=false)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:117
wxPoint GetRotationCenter() const
Rotating around the boundingBox's center can cause walking when the sheetname or filename is longer t...
Definition: sch_sheet.cpp:606
void Rotate(wxPoint aPosition) override
Rotate the item around aPosition 90 degrees in the clockwise direction.
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 SetTextAngle(double aAngle)
Definition: eda_text.h:167
bool HasFlag(STATUS_FLAGS aFlag)
Definition: base_struct.h:235
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:230
const wxPoint GetCenter() const
Definition: eda_rect.h:117
void PostEvent(const TOOL_EVENT &aEvent)
Puts an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:268
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187
static TOOL_ACTION refreshPreview
Definition: actions.h:102
EDA_ITEM * Front() const
Definition: selection.h:184
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:122
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(), EE_ACTIONS::clearSelection, CMP_ROTATE_CLOCKWISE, CMP_ROTATE_COUNTERCLOCKWISE, SCH_BASE_FRAME::eeconfig(), EESCHEMA_SETTINGS::AUTOPLACE_FIELDS::enable, ENDPOINT, SELECTION::Front(), SCH_SHEET::GetBoundingBox(), EDA_RECT::GetCenter(), SELECTION::GetCenter(), SELECTION::GetItem(), SCH_TEXT::GetLabelSpinStyle(), EDA_DRAW_FRAME::GetNearestGridPosition(), SCH_SHEET_PIN::GetParent(), EDA_ITEM::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(), SCH_BASE_FRAME::RefreshItem(), ACTIONS::refreshPreview, EE_SELECTION_TOOL::RequestSelection(), rotatableItems, SCH_SHEET_PIN::Rotate(), SCH_ITEM::Rotate(), SCH_SHEET::Rotate(), LABEL_SPIN_STYLE::RotateCCW(), LABEL_SPIN_STYLE::RotateCW(), 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_TEXT::SetLabelSpinStyle(), SCH_COMPONENT::SetOrientation(), EDA_TEXT::SetTextAngle(), STARTPOINT, SCH_EDIT_FRAME::TestDanglingEnds(), TEXT_ANGLE_HORIZ, TEXT_ANGLE_VERT, EDA_ITEM::Type(), and UR_CHANGED.

Referenced by setTransitions().

◆ RunMainStack()

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

Function RunMainStack()

Calls 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:219
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_T  aType,
bool  aAppend = false 
)
inlineprotectedinherited

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

Definition at line 117 of file ee_tool_base.h.

118  {
119  KICAD_T itemType = aItem->Type();
120  bool selected = aItem->IsSelected();
121 
122  // IS_SELECTED flag should not be set on undo items which were added for
123  // a drag operation.
124  if( selected && aItem->HasFlag( TEMP_SELECTED ))
125  aItem->ClearSelected();
126 
127  if( m_isLibEdit )
128  {
129  LIB_EDIT_FRAME* editFrame = dynamic_cast<LIB_EDIT_FRAME*>( m_frame );
130  wxASSERT( editFrame );
131 
132  editFrame->SaveCopyInUndoList( static_cast<LIB_ITEM*>( aItem ), aType, aAppend );
133  }
134  else
135  {
136  SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
137  wxASSERT( editFrame );
138 
139  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
140  {
141  editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
142  static_cast<SCH_ITEM*>( aItem->GetParent() ),
143  UR_CHANGED, aAppend );
144  }
145  else
146  {
147  editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
148  static_cast<SCH_ITEM*>( aItem ),
149  aType, aAppend );
150  }
151  }
152 
153  if( selected && aItem->HasFlag( TEMP_SELECTED ) )
154  aItem->SetSelected();
155  }
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: base_struct.h:125
bool IsSelected() const
Definition: base_struct.h:203
void ClearSelected()
Definition: base_struct.h:211
Schematic editor (Eeschema) main window.
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetSelected()
Definition: base_struct.h:208
EDA_ITEM * GetParent() const
Definition: base_struct.h:195
The symbol library editor main window.
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
bool HasFlag(STATUS_FLAGS aFlag)
Definition: base_struct.h:235
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy, UNDO_REDO_T undoType=UR_LIBEDIT, bool aAppend=false)
Create a copy of the current component, and save it in the undo list.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

◆ SetContextMenu()

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

Function SetContextMenu()

Assigns 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:219
void SetTool(TOOL_INTERACTIVE *aTool)
Function SetTool() Sets a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Sets behaviour 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(), SELECTION_TOOL::doSelectionMenu(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), 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 1700 of file sch_edit_tool.cpp.

1701 {
1706  Go( &SCH_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorX.MakeEvent() );
1707  Go( &SCH_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorY.MakeEvent() );
1708  Go( &SCH_EDIT_TOOL::DoDelete, ACTIONS::doDelete.MakeEvent() );
1710 
1726 
1729 
1732 }
static TOOL_ACTION refreshSymbolFromLibrary
Definition: ee_actions.h:154
static TOOL_ACTION properties
Definition: ee_actions.h:120
static TOOL_ACTION toggleDeMorgan
Definition: ee_actions.h:125
static TOOL_ACTION breakBus
Definition: ee_actions.h:134
int RefreshSymbolFromLibrary(const TOOL_EVENT &aEvent)
static TOOL_ACTION doDelete
Definition: actions.h:74
int Rotate(const TOOL_EVENT &aEvent)
static TOOL_ACTION mirrorY
Definition: ee_actions.h:119
int BreakWire(const TOOL_EVENT &aEvent)
static TOOL_ACTION toText
Definition: ee_actions.h:132
static TOOL_ACTION autoplaceFields
Definition: ee_actions.h:124
int Properties(const TOOL_EVENT &aEvent)
int UpdateFields(const TOOL_EVENT &aEvent)
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:127
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
static TOOL_ACTION breakWire
Definition: ee_actions.h:133
static TOOL_ACTION rotateCW
Definition: ee_actions.h:116
int Duplicate(const TOOL_EVENT &aEvent)
static TOOL_ACTION cleanupSheetPins
Definition: ee_actions.h:181
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:117
static TOOL_ACTION editFootprint
Definition: ee_actions.h:123
int AutoplaceFields(const TOOL_EVENT &aEvent)
static TOOL_ACTION repeatDrawItem
Definition: ee_actions.h:115
static TOOL_ACTION mirrorX
Definition: ee_actions.h:118
int CleanupSheetPins(const TOOL_EVENT &aEvent)
static TOOL_ACTION editTextAndGraphics
Definition: ee_actions.h:182
int DeleteItemCursor(const TOOL_EVENT &aEvent)
Runs the deletion tool.
static TOOL_ACTION showDeMorganStandard
Definition: ee_actions.h:126
int Mirror(const TOOL_EVENT &aEvent)
int RepeatDrawItem(const TOOL_EVENT &aEvent)
static TOOL_ACTION updateFieldsFromLibrary
Definition: ee_actions.h:146
static TOOL_ACTION editValue
Definition: ee_actions.h:122
int EditField(const TOOL_EVENT &aEvent)
static TOOL_ACTION deleteTool
Definition: actions.h:75
static TOOL_ACTION toLabel
Definition: ee_actions.h:129
static TOOL_ACTION toHLabel
Definition: ee_actions.h:130
static TOOL_ACTION editReference
Definition: ee_actions.h:121
int DoDelete(const TOOL_EVENT &aEvent)
Deletes the selected items, or the item under the cursor.
static TOOL_ACTION toGLabel
Definition: ee_actions.h:131
int ConvertDeMorgan(const TOOL_EVENT &aEvent)
static TOOL_ACTION duplicate
Definition: actions.h:73
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, ChangeTextType(), CleanupSheetPins(), EE_ACTIONS::cleanupSheetPins, ConvertDeMorgan(), DeleteItemCursor(), ACTIONS::deleteTool, ACTIONS::doDelete, DoDelete(), Duplicate(), ACTIONS::duplicate, EditField(), EE_ACTIONS::editFootprint, EE_ACTIONS::editReference, EE_ACTIONS::editTextAndGraphics, EE_ACTIONS::editValue, GlobalEdit(), TOOL_INTERACTIVE::Go(), Mirror(), EE_ACTIONS::mirrorX, EE_ACTIONS::mirrorY, Properties(), EE_ACTIONS::properties, RefreshSymbolFromLibrary(), EE_ACTIONS::refreshSymbolFromLibrary, 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, UpdateFields(), and EE_ACTIONS::updateFieldsFromLibrary.

◆ UpdateFields()

int SCH_EDIT_TOOL::UpdateFields ( const TOOL_EVENT aEvent)

Definition at line 1218 of file sch_edit_tool.cpp.

1219 {
1220  if( InvokeDialogUpdateFields( m_frame ) == wxID_OK )
1221  m_frame->GetCanvas()->Refresh();
1222 
1223  return 0;
1224 }
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 InvokeDialogUpdateFields(SCH_EDIT_FRAME *aCaller, SCH_COMPONENT *aSpecificComponent, bool aCreateUndoEntry)
Update symbol fields.

References SCH_BASE_FRAME::GetCanvas(), InvokeDialogUpdateFields(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, and EDA_DRAW_PANEL_GAL::Refresh().

Referenced by setTransitions().

◆ updateView()

void EE_TOOL_BASE< SCH_EDIT_FRAME >::updateView ( EDA_ITEM aItem) const
inlineprotectedinherited

Similar to getView()->Update(), but handles items that are redrawn by their parents.

Definition at line 104 of file ee_tool_base.h.

105  {
106  KICAD_T itemType = aItem->Type();
107 
108  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
109  getView()->Update( aItem->GetParent() );
110 
111  getView()->Update( aItem );
112  }
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
EDA_ITEM * GetParent() const
Definition: base_struct.h:195
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1544
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

◆ Wait()

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

Function Wait()

Suspends 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:219
TOOL_EVENT * ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pauses 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(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_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(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_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 158 of file ee_tool_base.h.

◆ m_isLibEdit

bool EE_TOOL_BASE< SCH_EDIT_FRAME >::m_isLibEdit
protectedinherited

Definition at line 161 of file ee_tool_base.h.

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

functions below are not yet implemented - their interface may change

Definition at line 108 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(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), PICKER_TOOL::Init(), Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), PL_EDIT_TOOL::Init(), LIB_DRAWING_TOOLS::Init(), PCB_VIEWER_TOOLS::Init(), FOOTPRINT_EDITOR_TOOLS::Init(), PL_DRAWING_TOOLS::Init(), LIB_CONTROL::Init(), PCB_EDITOR_CONTROL::Init(), SCH_DRAWING_TOOLS::Init(), EDA_3D_CONTROLLER::Init(), GERBVIEW_SELECTION_TOOL::Init(), PL_SELECTION_TOOL::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), PCB_TOOL_BASE::Init(), PL_EDIT_TOOL::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_pickerItem

EDA_ITEM* SCH_EDIT_TOOL::m_pickerItem
private

Definition at line 89 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 160 of file ee_tool_base.h.

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

Definition at line 214 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 219 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), SELECTION_TOOL::AddItemToSel(), SCH_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), AutoplaceFields(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), CleanupSheetPins(), PCB_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), SELECTION_TOOL::ClearSelection(), PL_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), ConvertDeMorgan(), LIB_EDIT_TOOL::Copy(), PL_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), MICROWAVE_TOOL::createInductorBetween(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), SCH_EDITOR_CONTROL::Cut(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), LIB_EDIT_TOOL::DoDelete(), DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_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(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), Duplicate(), EDIT_TOOL::Duplicate(), EditField(), editFieldText(), PCB_EDITOR_CONTROL::EditFpInFpEditor(), LIB_EDIT_TOOL::editGraphicProperties(), PAD_TOOL::EditPad(), LIB_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindComponentAndItem(), 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(), PCBNEW_CONTROL::GridSetOrigin(), GERBVIEW_CONTROL::HighlightControl(), PCB_INSPECTION_TOOL::HighlightItem(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::ImportWorksheetContent(), LIB_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), Init(), PCB_INSPECTION_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), PAD_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PL_DRAWING_TOOLS::Init(), LIB_CONTROL::Init(), PL_POINT_EDITOR::Init(), POINT_EDITOR::Init(), PCB_EDITOR_CONTROL::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), LIB_EDIT_TOOL::Mirror(), Mirror(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), LIB_CONTROL::OnDeMorgan(), COMMON_TOOLS::OnGridChanged(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickReferencePoint(), LIB_EDIT_TOOL::PinTable(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCBNEW_CONTROL::Print(), GERBVIEW_CONTROL::Print(), LIB_EDIT_TOOL::Properties(), Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), LIB_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), RefreshSymbolFromLibrary(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), PL_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), RepeatDrawItem(), LIB_DRAWING_TOOLS::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), LIB_EDIT_TOOL::Rotate(), Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), DRC::RunTests(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), GERBVIEW_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::SelectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), DRC::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), EDA_3D_CONTROLLER::ToggleVisibility(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), LIB_EDIT_TOOL::Undo(), SCH_EDITOR_CONTROL::Undo(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCBNEW_CONTROL::UpdateMessagePanel(), PCB_INSPECTION_TOOL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), PCB_EDITOR_CONTROL::ZoneDuplicate(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

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

Definition at line 218 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 211 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 159 of file ee_tool_base.h.


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