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 ChangeShape (const TOOL_EVENT &aEvent)
 
int ChangeTextType (const TOOL_EVENT &aEvent)
 
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...
 
TOOL_SETTINGSGetSettings ()
 
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
 
TOOL_SETTINGS m_toolSettings
 

Private Member Functions

void editComponentFieldText (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 119 of file sch_edit_tool.cpp.

119  :
120  EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveEdit" )
121 {
122  m_pickerItem = nullptr;
123 }
EDA_ITEM * m_pickerItem
Definition: sch_edit_tool.h:78

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(), DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), LIB_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(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), LIB_TREE::onContextMenu(), POINT_EDITOR::OnSelectionChange(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), 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  m_toolSettings = TOOL_SETTINGS( this );
64 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:220
friend class TOOL_SETTINGS
Definition: tool_base.h:154

References TOOL_BASE::m_toolMgr, TOOL_BASE::m_toolSettings, and TOOL_BASE::TOOL_SETTINGS.

Referenced by TOOL_MANAGER::RegisterTool().

◆ AutoplaceFields()

int SCH_EDIT_TOOL::AutoplaceFields ( const TOOL_EVENT aEvent)

Definition at line 1148 of file sch_edit_tool.cpp.

1149 {
1151 
1152  if( selection.Empty() )
1153  return 0;
1154 
1155  SCH_COMPONENT* component = (SCH_COMPONENT*) selection.Front();
1156 
1157  if( !component->IsNew() )
1158  m_frame->SaveCopyInUndoList( component, UR_CHANGED );
1159 
1160  component->AutoplaceFields( m_frame->GetScreen(), /* aManual */ true );
1161 
1162  m_frame->GetScreen()->Update( component );
1163  updateView( component );
1164  m_frame->OnModify();
1165 
1166  return 0;
1167 }
static const KICAD_T ComponentsOnly[]
Definition: ee_collectors.h:44
bool IsNew() const
Definition: base_struct.h:218
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:153
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:120
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)
Automatically orient all the fields in the component.
SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:89
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:228
EDA_ITEM * Front() const
Definition: selection.h:183

References SCH_COMPONENT::AutoplaceFields(), EE_COLLECTOR::ComponentsOnly, SELECTION::Empty(), SELECTION::Front(), SCH_EDIT_FRAME::GetScreen(), EDA_ITEM::IsNew(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, SCH_EDIT_FRAME::OnModify(), EE_SELECTION_TOOL::RequestSelection(), 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 1422 of file sch_edit_tool.cpp.

1423 {
1424  auto cursorPos = wxPoint( getViewControls()->GetCursorPosition( !aEvent.Modifier( MD_ALT ) ) );
1425 
1426  if( m_frame->BreakSegments( cursorPos ) )
1427  {
1428  if( m_frame->GetScreen()->IsJunctionNeeded( cursorPos, true ) )
1429  m_frame->AddJunction( cursorPos, true, false );
1430 
1432 
1433  m_frame->OnModify();
1434  m_frame->GetCanvas()->Refresh();
1435  }
1436 
1437  return 0;
1438 }
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:332
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_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.
SCH_JUNCTION * AddJunction(const wxPoint &aPos, bool aAppendToUndo=false, bool aFinal=true)
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().

◆ ChangeShape()

int SCH_EDIT_TOOL::ChangeShape ( const TOOL_EVENT aEvent)

Definition at line 1375 of file sch_edit_tool.cpp.

1376 {
1377  EE_SELECTION& selection = m_selectionTool->GetSelection();
1378  char shape = aEvent.Parameter<char>();
1379 
1380  for( unsigned int i = 0; i < selection.GetSize(); ++i )
1381  {
1382  SCH_BUS_ENTRY_BASE* entry = dynamic_cast<SCH_BUS_ENTRY_BASE*>( selection.GetItem( i ) );
1383 
1384  if( entry )
1385  {
1386  if( entry->GetEditFlags() == 0 )
1388 
1389  entry->SetBusEntryShape( shape );
1391 
1392  m_frame->GetScreen()->Update( entry );
1393  updateView( entry );
1394  m_frame->OnModify( );
1395  }
1396  }
1397 
1398  g_lastBusEntryShape = shape;
1399 
1400  return 0;
1401 }
char g_lastBusEntryShape
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
Base class for a bus or wire entry.
Definition: sch_bus_entry.h:41
EE_SELECTION & GetSelection()
Function GetSelection()
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
STATUS_FLAGS GetEditFlags() const
Definition: base_struct.h:260
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:153
void SetBusEntryShape(char aShape)
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.h:104
virtual unsigned int GetSize() const override
Function GetSize() Returns the number of stored items.
Definition: selection.h:99
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 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:228

References g_lastBusEntryShape, EDA_ITEM::GetEditFlags(), SELECTION::GetItem(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), SELECTION::GetSize(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, SCH_EDIT_FRAME::OnModify(), TOOL_EVENT::Parameter(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_BUS_ENTRY_BASE::SetBusEntryShape(), SCH_EDIT_FRAME::TestDanglingEnds(), SCH_SCREEN::Update(), EE_TOOL_BASE< SCH_EDIT_FRAME >::updateView(), and UR_CHANGED.

Referenced by setTransitions().

◆ ChangeTextType()

int SCH_EDIT_TOOL::ChangeTextType ( const TOOL_EVENT aEvent)

Definition at line 1404 of file sch_edit_tool.cpp.

1405 {
1406  KICAD_T convertTo = aEvent.Parameter<KICAD_T>();
1408  EE_SELECTION& selection = m_selectionTool->RequestSelection( allTextTypes );
1409 
1410  for( unsigned int i = 0; i < selection.GetSize(); ++i )
1411  {
1412  SCH_TEXT* text = dynamic_cast<SCH_TEXT*>( selection.GetItem( i ) );
1413 
1414  if( text )
1415  m_frame->ConvertTextType( text, convertTo );
1416  }
1417 
1418  return 0;
1419 }
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
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:153
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.h:104
virtual unsigned int GetSize() const override
Function GetSize() Returns the number of stored items.
Definition: selection.h:99
void ConvertTextType(SCH_TEXT *aText, KICAD_T aNewType)
Change a text type to another one.
Definition: edit_label.cpp:190

References SCH_EDIT_FRAME::ConvertTextType(), EOT, SELECTION::GetItem(), SELECTION::GetSize(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_EVENT::Parameter(), EE_SELECTION_TOOL::RequestSelection(), SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, and SCH_TEXT_T.

Referenced by setTransitions().

◆ CleanupSheetPins()

int SCH_EDIT_TOOL::CleanupSheetPins ( const TOOL_EVENT aEvent)

Definition at line 1441 of file sch_edit_tool.cpp.

1442 {
1444  SCH_SHEET* sheet = (SCH_SHEET*) selection.Front();
1445 
1446  if( !sheet )
1447  return 0;
1448 
1449  if( !sheet->HasUndefinedPins() )
1450  {
1451  DisplayInfoMessage( m_frame, _( "There are no unreferenced pins in this sheet to remove." ) );
1452  return 0;
1453  }
1454 
1455  if( !IsOK( m_frame, _( "Do you wish to delete the unreferenced pins from this sheet?" ) ) )
1456  return 0;
1457 
1459 
1460  sheet->CleanupSheet();
1461 
1462  m_frame->GetScreen()->Update( sheet );
1463  updateView( sheet );
1464  m_frame->OnModify();
1465 
1466  return 0;
1467 }
static const KICAD_T SheetsOnly[]
Definition: ee_collectors.h:45
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:153
void CleanupSheet()
Delete sheet label which do not have a corresponding hierarchical label.
Definition: sch_sheet.cpp:344
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:206
bool HasUndefinedPins()
Check all sheet labels against schematic for undefined hierarchical labels.
Definition: sch_sheet.cpp:242
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:31
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:228
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:264
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:280
EDA_ITEM * Front() const
Definition: selection.h:183

References _, SCH_SHEET::CleanupSheet(), DisplayInfoMessage(), SELECTION::Front(), SCH_EDIT_FRAME::GetScreen(), SCH_SHEET::HasUndefinedPins(), IsOK(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, SCH_EDIT_FRAME::OnModify(), EE_SELECTION_TOOL::RequestSelection(), 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 1185 of file sch_edit_tool.cpp.

1186 {
1188 
1189  if( selection.Empty() )
1190  return 0;
1191 
1192  SCH_COMPONENT* component = (SCH_COMPONENT*) selection.Front();
1193 
1195  && component->GetConvert() == LIB_ITEM::LIB_CONVERT::BASE )
1196  return 0;
1197 
1199  && component->GetConvert() != LIB_ITEM::LIB_CONVERT::DEMORGAN )
1200  return 0;
1201 
1202  if( !component->IsNew() )
1203  m_frame->SaveCopyInUndoList( component, UR_CHANGED );
1204 
1205  m_frame->ConvertPart( component );
1206 
1207  if( component->IsNew() )
1209 
1210  return 0;
1211 }
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:109
static const KICAD_T ComponentsOnly[]
Definition: ee_collectors.h:44
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:129
bool IsNew() const
Definition: base_struct.h:218
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 SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:153
static TOOL_ACTION showDeMorganStandard
Definition: ee_actions.h:128
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:120
SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:89
int GetConvert() const
void ConvertPart(SCH_COMPONENT *aComponent)
Definition: getpart.cpp:243
static TOOL_ACTION refreshPreview
Definition: actions.h:101
EDA_ITEM * Front() const
Definition: selection.h:183

References EE_COLLECTOR::ComponentsOnly, SCH_EDIT_FRAME::ConvertPart(), SELECTION::Empty(), SELECTION::Front(), SCH_COMPONENT::GetConvert(), TOOL_EVENT::IsAction(), 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(), 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 1002 of file sch_edit_tool.cpp.

1003 {
1004  std::string tool = aEvent.GetCommandStr().get();
1005  PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
1006 
1008  m_pickerItem = nullptr;
1009 
1010  // Deactivate other tools; particularly important if another PICKER is currently running
1011  Activate();
1012 
1013  picker->SetCursor( wxStockCursor( wxCURSOR_BULLSEYE ) );
1014 
1015  picker->SetClickHandler(
1016  [this] ( const VECTOR2D& aPosition ) -> bool
1017  {
1018  if( m_pickerItem )
1019  {
1020  SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( m_pickerItem );
1021 
1022  if( sch_item && sch_item->IsLocked() )
1023  {
1024  STATUS_TEXT_POPUP statusPopup( m_frame );
1025  statusPopup.SetText( _( "Item locked." ) );
1026  statusPopup.PopupFor( 2000 );
1027  statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
1028  return true;
1029  }
1030 
1032  selectionTool->UnbrightenItem( m_pickerItem );
1033  selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
1035  m_pickerItem = nullptr;
1036  }
1037 
1038  return true;
1039  } );
1040 
1041  picker->SetMotionHandler(
1042  [this] ( const VECTOR2D& aPos )
1043  {
1044  EE_COLLECTOR collector;
1045  collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
1046  collector.Collect( m_frame->GetScreen(), deletableItems, (wxPoint) aPos );
1047 
1049  selectionTool->GuessSelectionCandidates( collector, aPos );
1050 
1051  EDA_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr;
1052 
1053  if( m_pickerItem != item )
1054  {
1055  if( m_pickerItem )
1056  selectionTool->UnbrightenItem( m_pickerItem );
1057 
1058  m_pickerItem = item;
1059 
1060  if( m_pickerItem )
1061  selectionTool->BrightenItem( m_pickerItem );
1062  }
1063  } );
1064 
1065  picker->SetFinalizeHandler(
1066  [this] ( const int& aFinalState )
1067  {
1068  if( m_pickerItem )
1070  } );
1071 
1072  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
1073 
1074  return 0;
1075 }
void SetCursor(const wxCursor &aCursor)
Definition: picker_tool.h:65
#define HITTEST_THRESHOLD_PIXELS
int m_Threshold
Definition: collector.h:68
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:109
EE_COLLECTOR.
Definition: ee_collectors.h:39
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:145
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:116
void BrightenItem(EDA_ITEM *aItem)
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:58
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:78
virtual bool IsLocked() const
Function IsLocked.
Definition: sch_item.h:200
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:31
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:61
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:163
void Activate()
Function Activate() Runs the tool.
SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:136

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

924 {
925  SCH_SCREEN* screen = m_frame->GetScreen();
927  bool appendToUndo = false;
928  std::vector<wxPoint> pts;
929 
930  if( items.empty() )
931  return 0;
932 
933  // Don't leave a freed pointer in the selection
935 
936  for( EDA_ITEM* item : items )
937  item->ClearFlags( STRUCT_DELETED );
938 
939  for( EDA_ITEM* item : items )
940  {
941  SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item );
942 
943  if( !sch_item )
944  continue;
945 
946  if( sch_item->Type() == SCH_JUNCTION_T )
947  {
948  sch_item->SetFlags( STRUCT_DELETED );
949  sch_item->GetConnectionPoints( pts );
950 
951  // clean up junctions at the end
952  }
953  else
954  {
955  sch_item->SetFlags( STRUCT_DELETED );
956  saveCopyInUndoList( item, UR_DELETED, appendToUndo );
957  appendToUndo = true;
958 
959  if( sch_item && sch_item->IsConnectable() )
960  sch_item->GetConnectionPoints( pts );
961 
962  updateView( sch_item );
963 
964  if( sch_item->Type() == SCH_SHEET_PIN_T )
965  {
966  SCH_SHEET_PIN* pin = (SCH_SHEET_PIN*) sch_item;
967  SCH_SHEET* sheet = pin->GetParent();
968 
969  sheet->RemovePin( pin );
970  }
971  else
972  m_frame->RemoveFromScreen( sch_item );
973 
974  if( sch_item->Type() == SCH_SHEET_T )
976  }
977  }
978 
979  for( auto point : pts )
980  {
981  SCH_ITEM* junction = screen->GetItem( point, 0, SCH_JUNCTION_T );
982 
983  if( !junction )
984  continue;
985 
986  if( junction->HasFlag( STRUCT_DELETED ) || !screen->IsJunctionNeeded( point ) )
987  m_frame->DeleteJunction( junction, appendToUndo );
988  }
989 
991 
992  m_frame->GetCanvas()->Refresh();
993  m_frame->OnModify();
994 
995  return 0;
996 }
virtual bool IsConnectable() const
Function IsConnectable returns true if the schematic item can connect to another schematic item.
Definition: sch_item.h:317
SCH_SHEET * GetParent() const
Get the parent sheet object of this sheet pin.
Definition: sch_sheet.h:158
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:332
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
virtual void GetConnectionPoints(std::vector< wxPoint > &aPoints) const
Function GetConnectionPoints add all the connection points for this item to aPoints.
Definition: sch_item.h:327
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
void RemoveFromScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen=nullptr)
Remove an item from the screen (and view) aScreen is the screen the item is located on,...
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void RemovePin(SCH_SHEET_PIN *aSheetPin)
Remove aSheetPin from the sheet.
Definition: sch_sheet.cpp:189
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:255
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:131
void UpdateHierarchyNavigator(bool aForceUpdate=false)
Run the Hierarchy Navigator dialog.
#define STRUCT_DELETED
flag indication structures to be erased
Definition: base_struct.h:129
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:153
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:75
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:58
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:206
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:163
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:270
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:258
SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:136
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207

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

756 {
758 
759  if( selection.GetSize() == 0 )
760  return 0;
761 
762  // Doing a duplicate of a new object doesn't really make any sense; we'd just end
763  // up dragging around a stack of objects...
764  if( selection.Front()->IsNew() )
765  return 0;
766 
767  EDA_ITEMS newItems;
768 
769  // Keep track of existing sheet paths. Duplicating a selection can modify this list
770  bool copiedSheets = false;
771  SCH_SHEET_LIST initial_sheetpathList( g_RootSheet );
772 
773  for( unsigned ii = 0; ii < selection.GetSize(); ++ii )
774  {
775  SCH_ITEM* oldItem = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
776  SCH_ITEM* newItem = oldItem->Duplicate();
777  newItem->SetFlags( IS_NEW );
778  newItems.push_back( newItem );
779  saveCopyInUndoList( newItem, UR_NEW, ii > 0 );
780 
781  switch( newItem->Type() )
782  {
783  case SCH_JUNCTION_T:
784  case SCH_LINE_T:
785  case SCH_BUS_BUS_ENTRY_T:
787  case SCH_TEXT_T:
788  case SCH_LABEL_T:
789  case SCH_GLOBAL_LABEL_T:
790  case SCH_HIER_LABEL_T:
791  case SCH_NO_CONNECT_T:
792  newItem->SetParent( m_frame->GetScreen() );
793  m_frame->AddToScreen( newItem );
794  break;
795 
796  case SCH_SHEET_T:
797  {
798  SCH_SHEET* sheet = (SCH_SHEET*) newItem;
799  // Duplicate sheet names and sheet time stamps are not valid. Use a time stamp
800  // based sheet name and update the time stamp for each sheet in the block.
801  timestamp_t timeStamp = GetNewTimeStamp();
802 
803  sheet->SetName( wxString::Format( wxT( "sheet%8.8lX" ), (unsigned long)timeStamp ) );
804  sheet->SetTimeStamp( timeStamp );
805 
806  sheet->SetParent( m_frame->GetScreen() );
807  m_frame->AddToScreen( sheet );
808 
809  copiedSheets = true;
810  break;
811  }
812 
813  case SCH_COMPONENT_T:
814  {
815  SCH_COMPONENT* component = (SCH_COMPONENT*) newItem;
816 
817  component->SetTimeStamp( GetNewTimeStamp() );
818  component->ClearAnnotation( NULL );
819 
820  component->SetParent( m_frame->GetScreen() );
821  m_frame->AddToScreen( component );
822  break;
823  }
824 
825  default:
826  break;
827  }
828  }
829 
830  if( copiedSheets )
831  {
832  // We clear annotation of new sheet paths.
833  // Annotation of new components added in current sheet is already cleared.
834  SCH_SCREENS screensList( g_RootSheet );
835  screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
837  }
838 
840  m_toolMgr->RunAction( EE_ACTIONS::addItemsToSel, true, &newItems );
842 
843  return 0;
844 }
SCH_SHEET_LIST.
void SetTimeStamp(timestamp_t aNewTimeStamp)
Change the time stamp to aNewTimeStamp and updates the reference path.
SCH_ITEM * Duplicate(bool doClone=false)
Routine to create a new copy of given item.
Definition: sch_item.cpp:75
static KICAD_T duplicatableItems[]
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen=nullptr)
Add an item to the screen (and view) aScreen is the screen the item is located on,...
static TOOL_ACTION addItemsToSel
Selects a list of items (specified as the event parameter)
Definition: ee_actions.h:65
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:109
bool IsNew() const
Definition: base_struct.h:218
#define IS_NEW
New item, just created.
Definition: base_struct.h:120
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.
timestamp_t GetNewTimeStamp()
Definition: common.cpp:215
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:255
#define NULL
void SetName(const wxString &aName)
Definition: sch_sheet.h:270
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:216
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: base_struct.h:601
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:153
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:58
void ClearAnnotation(SCH_SHEET_PATH *aSheetPath)
Clear exiting component annotation.
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.h:104
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:206
virtual unsigned int GetSize() const override
Function GetSize() Returns the number of stored items.
Definition: selection.h:99
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.
SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:89
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
static TOOL_ACTION move
Definition: ee_actions.h:115
uint32_t timestamp_t
timestamp_t is our type to represent unique IDs for all kinds of elements; historically simply the ti...
Definition: common.h:52
SCH_SHEET * g_RootSheet
SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:136
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:498
EDA_ITEM * Front() const
Definition: selection.h:183
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:212

References EE_ACTIONS::addItemsToSel, SCH_BASE_FRAME::AddToScreen(), SCH_COMPONENT::ClearAnnotation(), SCH_SCREENS::ClearAnnotationOfNewSheetPaths(), EE_ACTIONS::clearSelection, duplicatableItems, SCH_ITEM::Duplicate(), Format(), SELECTION::Front(), g_RootSheet, SELECTION::GetItem(), GetNewTimeStamp(), SCH_EDIT_FRAME::GetScreen(), SELECTION::GetSize(), IS_NEW, EDA_ITEM::IsNew(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_ACTIONS::move, NULL, EE_SELECTION_TOOL::RequestSelection(), 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, EDA_ITEM::SetFlags(), SCH_SHEET::SetName(), EDA_ITEM::SetParent(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), EDA_ITEM::SetTimeStamp(), SCH_COMPONENT::SetTimeStamp(), and UR_NEW.

Referenced by setTransitions().

◆ editComponentFieldText()

void SCH_EDIT_TOOL::editComponentFieldText ( SCH_FIELD aField)
private

Definition at line 1078 of file sch_edit_tool.cpp.

1079 {
1080  SCH_COMPONENT* component = (SCH_COMPONENT*) aField->GetParent();
1081 
1082  // Save old component in undo list if not already in edit, or moving.
1083  if( aField->GetEditFlags() == 0 ) // i.e. not edited, or moved
1084  m_frame->SaveCopyInUndoList( component, UR_CHANGED );
1085 
1086  wxString title = wxString::Format( _( "Edit %s Field" ), aField->GetName() );
1087 
1088  DIALOG_SCH_EDIT_ONE_FIELD dlg( m_frame, title, aField );
1089 
1090  // The footprint field dialog can invoke a KIWAY_PLAYER so we must use a quasi-modal
1091  if( dlg.ShowQuasiModal() != wxID_OK )
1092  return;
1093 
1094  dlg.UpdateField( aField, g_CurrentSheet );
1095 
1096  if( m_frame->GetAutoplaceFields() )
1097  component->AutoAutoplaceFields( m_frame->GetScreen() );
1098 
1100  m_frame->RefreshItem( aField );
1101  m_frame->OnModify();
1102 }
void AutoAutoplaceFields(SCH_SCREEN *aScreen)
Autoplace fields only if correct to do so automatically.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool GetAutoplaceFields() const
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:201
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_SHEET_PATH * g_CurrentSheet
With the new connectivity algorithm, many more places than before want to know what the current sheet...
STATUS_FLAGS GetEditFlags() const
Definition: base_struct.h:260
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
EDA_ITEM * GetParent() const
Definition: base_struct.h:215
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:31
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
Definition: sch_field.cpp:371
SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:89
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:237

References _, SCH_COMPONENT::AutoAutoplaceFields(), Format(), g_CurrentSheet, SCH_EDIT_FRAME::GetAutoplaceFields(), EDA_ITEM::GetEditFlags(), SCH_FIELD::GetName(), EDA_ITEM::GetParent(), SCH_EDIT_FRAME::GetScreen(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, SCH_EDIT_FRAME::OnModify(), TOOL_MANAGER::PostEvent(), SCH_BASE_FRAME::RefreshItem(), SCH_EDIT_FRAME::SaveCopyInUndoList(), EVENTS::SelectedItemsModified, and UR_CHANGED.

Referenced by EditField(), and Properties().

◆ EditField()

int SCH_EDIT_TOOL::EditField ( const TOOL_EVENT aEvent)

Definition at line 1105 of file sch_edit_tool.cpp.

1106 {
1107  static KICAD_T Nothing[] = { EOT };
1108  static KICAD_T CmpOrReference[] = { SCH_FIELD_LOCATE_REFERENCE_T, SCH_COMPONENT_T, EOT };
1109  static KICAD_T CmpOrValue[] = { SCH_FIELD_LOCATE_VALUE_T, SCH_COMPONENT_T, EOT };
1110  static KICAD_T CmpOrFootprint[] = { SCH_FIELD_LOCATE_FOOTPRINT_T, SCH_COMPONENT_T, EOT };
1111 
1112  KICAD_T* filter = Nothing;
1113 
1114  if( aEvent.IsAction( &EE_ACTIONS::editReference ) )
1115  filter = CmpOrReference;
1116  else if( aEvent.IsAction( &EE_ACTIONS::editValue ) )
1117  filter = CmpOrValue;
1118  else if( aEvent.IsAction( &EE_ACTIONS::editFootprint ) )
1119  filter = CmpOrFootprint;
1120 
1121  EE_SELECTION& selection = m_selectionTool->RequestSelection( filter );
1122 
1123  if( selection.Empty() )
1124  return 0;
1125 
1126  SCH_ITEM* item = (SCH_ITEM*) selection.Front();
1127 
1128  if( item->Type() == SCH_COMPONENT_T )
1129  {
1130  SCH_COMPONENT* component = (SCH_COMPONENT*) item;
1131 
1132  if( aEvent.IsAction( &EE_ACTIONS::editReference ) )
1133  editComponentFieldText( component->GetField( REFERENCE ) );
1134  else if( aEvent.IsAction( &EE_ACTIONS::editValue ) )
1135  editComponentFieldText( component->GetField( VALUE ) );
1136  else if( aEvent.IsAction( &EE_ACTIONS::editFootprint ) )
1137  editComponentFieldText( component->GetField( FOOTPRINT ) );
1138  }
1139  else if( item->Type() == SCH_FIELD_T )
1140  {
1141  editComponentFieldText( (SCH_FIELD*) item );
1142  }
1143 
1144  return 0;
1145 }
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
void editComponentFieldText(SCH_FIELD *aField)
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
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
#define VALUE
static TOOL_ACTION editFootprint
Definition: ee_actions.h:125
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:153
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:120
static TOOL_ACTION editValue
Definition: ee_actions.h:124
SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:89
static TOOL_ACTION editReference
Definition: ee_actions.h:123
SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:136
EDA_ITEM * Front() const
Definition: selection.h:183
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207

References editComponentFieldText(), EE_ACTIONS::editFootprint, EE_ACTIONS::editReference, EE_ACTIONS::editValue, SELECTION::Empty(), EOT, FOOTPRINT, SELECTION::Front(), SCH_COMPONENT::GetField(), TOOL_EVENT::IsAction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, REFERENCE, EE_SELECTION_TOOL::RequestSelection(), 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().

◆ 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*>( getEditFrameInt() ) );
191 #endif
192  return static_cast<T*>( getEditFrameInt() );
193  }
EDA_BASE_FRAME * getEditFrameInt() const
Definition: tool_base.cpp:48

References TOOL_BASE::getEditFrameInt().

Referenced by ZONE_CREATE_HELPER::createNewZone(), and TOOL_SETTINGS::getConfigBase().

◆ 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(), and TOOL_MANAGER::saveViewControls().

◆ 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:163

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_SETTINGS::getKeyName(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::invokeTool(), and TOOL_MANAGER::RegisterTool().

◆ GetSettings()

TOOL_SETTINGS & TOOL_BASE::GetSettings ( )
inherited

Definition at line 78 of file tool_base.cpp.

79 {
80  return m_toolSettings;
81 }
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:220

References TOOL_BASE::m_toolSettings.

Referenced by ROUTER_TOOL::Init(), GERBVIEW_SELECTION_TOOL::selectable(), and ROUTER_TOOL::~ROUTER_TOOL().

◆ 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(), and TOOL_MANAGER::runTool().

◆ 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:250
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(), EE_SELECTION_TOOL::ClearSelection(), COMMON_TOOLS::CursorControl(), LIB_EDIT_TOOL::DeleteItemCursor(), DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), MICROWAVE_TOOL::drawMicrowaveInductor(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), COMMON_TOOLS::GridPreset(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::GuessSelectionCandidates(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCB_INSPECTION_TOOL::highlightNet(), EE_POINT_EDITOR::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), LIB_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PNS::TOOL_BASE::pickSingleItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), 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(), EE_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), COMMON_TOOLS::ToggleGrid(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), PCBNEW_CONTROL::updateGrid(), EE_POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), 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:255

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

Referenced by EE_POINT_EDITOR::addCorner(), POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), BreakWire(), PCB_TOOL_BASE::controls(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), COMMON_TOOLS::GridPreset(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::HighlightNetTool(), MODULE_EDITOR_TOOLS::ImportFootprint(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), 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(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), 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(), POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), LIB_MOVE_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(), MICROWAVE_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_CONTROL::setTransitions(), LIB_PIN_TOOL::setTransitions(), PAD_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), COMMON_CONTROL::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), LIB_MOVE_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), POINT_EDITOR::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), LIB_CONTROL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), PCB_INSPECTION_TOOL::setTransitions(), PCBNEW_CONTROL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), MODULE_EDITOR_TOOLS::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(), DRAWING_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), EE_SELECTION_TOOL::setTransitions(), and DRC::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 128 of file sch_edit_tool.cpp.

129 {
131 
134 
135  wxASSERT_MSG( drawingTools, "eeshema.InteractiveDrawing tool is not available" );
136 
137  auto sheetTool = [ this ] ( const SELECTION& aSel ) {
139  };
140 
141  auto anyTextTool = [ this ] ( const SELECTION& aSel ) {
146  };
147 
148  auto duplicateCondition = [] ( const SELECTION& aSel ) {
150  return false;
151 
152  return true;
153  };
154 
155  auto orientCondition = [] ( const SELECTION& aSel ) {
156  if( aSel.Empty() )
157  return false;
158 
160  return false;
161 
162  SCH_ITEM* item = (SCH_ITEM*) aSel.Front();
163 
164  if( aSel.GetSize() > 1 )
165  return true;
166 
167  switch( item->Type() )
168  {
169  case SCH_MARKER_T:
170  case SCH_JUNCTION_T:
171  case SCH_NO_CONNECT_T:
172  case SCH_LINE_T:
173  case SCH_PIN_T:
174  return false;
175  default:
176  return true;
177  }
178  };
179 
180  auto propertiesCondition = []( const SELECTION& aSel ) {
181  if( aSel.GetSize() != 1
182  && !( aSel.GetSize() >= 1 && aSel.Front()->Type() == SCH_LINE_T
183  && aSel.AreAllItemsIdentical() ) )
184  return false;
185 
186  auto item = static_cast<EDA_ITEM*>( aSel.Front() );
187  switch( item->Type() )
188  {
189  case SCH_MARKER_T:
190  case SCH_JUNCTION_T:
191  case SCH_NO_CONNECT_T:
193  case SCH_BUS_BUS_ENTRY_T:
194  case SCH_SHEET_PIN_T:
195  case SCH_PIN_T:
196  return false;
197  case SCH_LINE_T:
198  {
199  const std::deque<EDA_ITEM*> items = aSel.GetItems();
200  if( !std::all_of( items.begin(), items.end(),
201  [&]( const EDA_ITEM* selItem )
202  {
203  const SCH_LINE* line = dynamic_cast<const SCH_LINE*>( selItem );
204  if ( line == nullptr )
205  {
206  wxLogWarning(
207  "Non-line object encountered in selection, this shouldn't have bypassed the preceeding check" );
208  return false;
209  }
210  return line->IsGraphicLine();
211  } ) )
212  {
213  return false;
214  }
215 
216  // Only graphic lines support properties in the file format
217  return true;
218  }
219  default:
220  return true;
221  }
222  };
223 
224  static KICAD_T toLabelTypes[] = { SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT };
225  auto toLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toLabelTypes );
226 
227  static KICAD_T toHLableTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_TEXT_T, EOT };
228  auto toHLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toHLableTypes );
229 
230  static KICAD_T toGLableTypes[] = { SCH_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT };
231  auto toGLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toGLableTypes );
232 
233  static KICAD_T toTextTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, EOT };
234  auto toTextlCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toTextTypes );
235 
236  static KICAD_T entryTypes[] = { SCH_BUS_WIRE_ENTRY_T, SCH_BUS_BUS_ENTRY_T, EOT };
237  auto entryCondition = E_C::MoreThan( 0 ) && E_C::OnlyTypes( entryTypes );
238 
239  auto singleComponentCondition = E_C::Count( 1 ) && E_C::OnlyType( SCH_COMPONENT_T );
240  auto wireSelectionCondition = E_C::MoreThan( 0 ) && E_C::OnlyType( SCH_LINE_LOCATE_WIRE_T );
241  auto busSelectionCondition = E_C::MoreThan( 0 ) && E_C::OnlyType( SCH_LINE_LOCATE_BUS_T );
242  auto singleSheetCondition = E_C::Count( 1 ) && E_C::OnlyType( SCH_SHEET_T );
243 
244  //
245  // Add edit actions to the move tool menu
246  //
247  if( moveTool )
248  {
249  CONDITIONAL_MENU& moveMenu = moveTool->GetToolMenu().GetMenu();
250 
251  moveMenu.AddSeparator();
252  moveMenu.AddItem( EE_ACTIONS::rotateCCW, orientCondition );
253  moveMenu.AddItem( EE_ACTIONS::rotateCW, orientCondition );
254  moveMenu.AddItem( EE_ACTIONS::mirrorX, orientCondition );
255  moveMenu.AddItem( EE_ACTIONS::mirrorY, orientCondition );
257 
258  moveMenu.AddItem( EE_ACTIONS::properties, propertiesCondition );
259  moveMenu.AddItem( EE_ACTIONS::editReference, singleComponentCondition );
260  moveMenu.AddItem( EE_ACTIONS::editValue, singleComponentCondition );
261  moveMenu.AddItem( EE_ACTIONS::editFootprint, singleComponentCondition );
263 
264  std::shared_ptr<SYMBOL_UNIT_MENU> symUnitMenu = std::make_shared<SYMBOL_UNIT_MENU>();
265  symUnitMenu->SetTool( this );
266  m_menu.AddSubMenu( symUnitMenu );
267  moveMenu.AddMenu( symUnitMenu.get(), E_C::SingleMultiUnitSymbol, 1 );
268 
269  moveMenu.AddSeparator();
272  moveMenu.AddItem( ACTIONS::duplicate, duplicateCondition );
273  }
274 
275  //
276  // Add editing actions to the drawing tool menu
277  //
278  CONDITIONAL_MENU& drawMenu = drawingTools->GetToolMenu().GetMenu();
279 
280  drawMenu.AddItem( EE_ACTIONS::rotateCCW, orientCondition, 200 );
281  drawMenu.AddItem( EE_ACTIONS::rotateCW, orientCondition, 200 );
282  drawMenu.AddItem( EE_ACTIONS::mirrorX, orientCondition, 200 );
283  drawMenu.AddItem( EE_ACTIONS::mirrorY, orientCondition, 200 );
284 
285  drawMenu.AddItem( EE_ACTIONS::properties, propertiesCondition, 200 );
286  drawMenu.AddItem( EE_ACTIONS::editReference, singleComponentCondition, 200 );
287  drawMenu.AddItem( EE_ACTIONS::editValue, singleComponentCondition, 200 );
288  drawMenu.AddItem( EE_ACTIONS::editFootprint, singleComponentCondition, 200 );
289  drawMenu.AddItem( EE_ACTIONS::autoplaceFields, singleComponentCondition, 200 );
291 
292  std::shared_ptr<SYMBOL_UNIT_MENU> symUnitMenu2 = std::make_shared<SYMBOL_UNIT_MENU>();
293  symUnitMenu2->SetTool( drawingTools );
294  drawingTools->GetToolMenu().AddSubMenu( symUnitMenu2 );
295  drawMenu.AddMenu( symUnitMenu2.get(), E_C::SingleMultiUnitSymbol, 1 );
296 
297  drawMenu.AddItem( EE_ACTIONS::editWithLibEdit, singleComponentCondition && E_C::Idle, 200 );
298 
299  drawMenu.AddItem( EE_ACTIONS::toShapeSlash, entryCondition, 200 );
300  drawMenu.AddItem( EE_ACTIONS::toShapeBackslash, entryCondition, 200 );
301  drawMenu.AddItem( EE_ACTIONS::toLabel, anyTextTool && E_C::Idle, 200 );
302  drawMenu.AddItem( EE_ACTIONS::toHLabel, anyTextTool && E_C::Idle, 200 );
303  drawMenu.AddItem( EE_ACTIONS::toGLabel, anyTextTool && E_C::Idle, 200 );
304  drawMenu.AddItem( EE_ACTIONS::toText, anyTextTool && E_C::Idle, 200 );
305  drawMenu.AddItem( EE_ACTIONS::cleanupSheetPins, sheetTool && E_C::Idle, 250 );
306 
307  //
308  // Add editing actions to the selection tool menu
309  //
311 
312  selToolMenu.AddItem( EE_ACTIONS::rotateCCW, orientCondition, 200 );
313  selToolMenu.AddItem( EE_ACTIONS::rotateCW, orientCondition, 200 );
314  selToolMenu.AddItem( EE_ACTIONS::mirrorX, orientCondition, 200 );
315  selToolMenu.AddItem( EE_ACTIONS::mirrorY, orientCondition, 200 );
316  selToolMenu.AddItem( ACTIONS::doDelete, E_C::NotEmpty, 200 );
317 
318  selToolMenu.AddItem( EE_ACTIONS::properties, propertiesCondition, 200 );
320  selToolMenu.AddItem( EE_ACTIONS::editValue, E_C::SingleSymbol, 200 );
322  selToolMenu.AddItem( EE_ACTIONS::autoplaceFields, singleComponentCondition, 200 );
324 
325  std::shared_ptr<SYMBOL_UNIT_MENU> symUnitMenu3 = std::make_shared<SYMBOL_UNIT_MENU>();
326  symUnitMenu3->SetTool( m_selectionTool );
327  m_selectionTool->GetToolMenu().AddSubMenu( symUnitMenu3 );
328  selToolMenu.AddMenu( symUnitMenu3.get(), E_C::SingleMultiUnitSymbol, 1 );
329 
330  selToolMenu.AddItem( EE_ACTIONS::editWithLibEdit, singleComponentCondition && E_C::Idle, 200 );
331 
332  selToolMenu.AddItem( EE_ACTIONS::toShapeSlash, entryCondition, 200 );
333  selToolMenu.AddItem( EE_ACTIONS::toShapeBackslash, entryCondition, 200 );
334  selToolMenu.AddItem( EE_ACTIONS::toLabel, toLabelCondition, 200 );
335  selToolMenu.AddItem( EE_ACTIONS::toHLabel, toHLabelCondition, 200 );
336  selToolMenu.AddItem( EE_ACTIONS::toGLabel, toGLabelCondition, 200 );
337  selToolMenu.AddItem( EE_ACTIONS::toText, toTextlCondition, 200 );
338  selToolMenu.AddItem( EE_ACTIONS::cleanupSheetPins, singleSheetCondition, 250 );
339 
340  selToolMenu.AddSeparator( 300 );
341  selToolMenu.AddItem( ACTIONS::cut, E_C::IdleSelection, 300 );
342  selToolMenu.AddItem( ACTIONS::copy, E_C::IdleSelection, 300 );
343  selToolMenu.AddItem( ACTIONS::paste, E_C::Idle, 300 );
344  selToolMenu.AddItem( ACTIONS::pasteSpecial, E_C::Idle, 300 );
345  selToolMenu.AddItem( ACTIONS::duplicate, duplicateCondition, 300 );
346 
347  return true;
348 }
void AddMenu(ACTION_MENU *aMenu, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Function AddMenu()
static TOOL_ACTION properties
Definition: ee_actions.h:122
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
bool IsGraphicLine() const
Returns if the line is a graphic (non electrical line)
Definition: sch_line.cpp:815
static TOOL_ACTION toggleDeMorgan
Definition: ee_actions.h:127
static SELECTION_CONDITION SingleSymbol
static TOOL_ACTION doDelete
Definition: actions.h:74
SCH_DRAWING_TOOLS.
static TOOL_ACTION toShapeBackslash
Definition: ee_actions.h:132
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:121
static TOOL_ACTION placeHierLabel
Definition: ee_actions.h:90
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
static SELECTION_CONDITION IdleSelection
TOOL_MENU & GetToolMenu()
static TOOL_ACTION toText
Definition: ee_actions.h:136
static TOOL_ACTION autoplaceFields
Definition: ee_actions.h:126
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:118
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:91
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:119
static TOOL_ACTION editFootprint
Definition: ee_actions.h:125
static TOOL_ACTION placeSchematicText
Definition: ee_actions.h:94
static TOOL_ACTION cut
Definition: actions.h:69
static TOOL_ACTION mirrorX
Definition: ee_actions.h:120
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:153
static SELECTION_CONDITION SingleMultiUnitSymbol
void AddSeparator(int aOrder=ANY_ORDER)
Function AddSeparator()
static TOOL_ACTION pasteSpecial
Definition: actions.h:72
static TOOL_ACTION placeLabel
Definition: ee_actions.h:88
static bool IsDrawingLineWireOrBus(const SELECTION &aSelection)
static TOOL_ACTION editValue
Definition: ee_actions.h:124
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:38
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:163
static TOOL_ACTION editWithLibEdit
Definition: ee_actions.h:156
static TOOL_ACTION toLabel
Definition: ee_actions.h:133
static TOOL_ACTION toHLabel
Definition: ee_actions.h:134
static TOOL_ACTION editReference
Definition: ee_actions.h:123
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:89
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()
bool IsCurrentTool(const TOOL_ACTION &aAction) const
SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:136
static TOOL_ACTION toGLabel
Definition: ee_actions.h:135
static TOOL_ACTION paste
Definition: actions.h:71
static TOOL_ACTION duplicate
Definition: actions.h:73
static TOOL_ACTION toShapeSlash
Definition: ee_actions.h:131
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207

References CONDITIONAL_MENU::AddItem(), CONDITIONAL_MENU::AddMenu(), CONDITIONAL_MENU::AddSeparator(), TOOL_MENU::AddSubMenu(), 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(), EE_CONDITIONS::Idle, EE_CONDITIONS::IdleSelection, EE_TOOL_BASE< T >::Init(), EDA_BASE_FRAME::IsCurrentTool(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus(), SCH_LINE::IsGraphicLine(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_INTERACTIVE::m_menu, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_ACTIONS::mirrorX, EE_ACTIONS::mirrorY, SELECTION_CONDITIONS::MoreThan(), SELECTION_CONDITIONS::NotEmpty(), SELECTION_CONDITIONS::OnlyType(), SELECTION_CONDITIONS::OnlyTypes(), ACTIONS::paste, ACTIONS::pasteSpecial, EE_ACTIONS::placeGlobalLabel, EE_ACTIONS::placeHierLabel, EE_ACTIONS::placeLabel, EE_ACTIONS::placeSchematicText, EE_ACTIONS::properties, EE_ACTIONS::rotateCCW, EE_ACTIONS::rotateCW, SCH_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_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::toShapeBackslash, EE_ACTIONS::toShapeSlash, 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.

◆ Mirror()

int SCH_EDIT_TOOL::Mirror ( const TOOL_EVENT aEvent)

Definition at line 557 of file sch_edit_tool.cpp.

558 {
560 
561  if( selection.GetSize() == 0 )
562  return 0;
563 
564  wxPoint mirrorPoint;
565  bool xAxis = ( aEvent.Matches( EE_ACTIONS::mirrorX.MakeEvent() ) );
566  SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.Front() );
567  bool connections = false;
568  bool moving = item->IsMoving();
569 
570  if( selection.GetSize() == 1 )
571  {
572  if( !moving )
574 
575  switch( item->Type() )
576  {
577  case SCH_COMPONENT_T:
578  {
579  SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
580 
581  if( xAxis )
582  component->SetOrientation( CMP_MIRROR_X );
583  else
584  component->SetOrientation( CMP_MIRROR_Y );
585 
586  if( m_frame->GetAutoplaceFields() )
587  component->AutoAutoplaceFields( m_frame->GetScreen() );
588 
589  break;
590  }
591 
592  case SCH_TEXT_T:
593  case SCH_LABEL_T:
594  case SCH_GLOBAL_LABEL_T:
595  case SCH_HIER_LABEL_T:
596  {
597  SCH_TEXT* textItem = static_cast<SCH_TEXT*>( item );
598 
599  if( xAxis )
600  textItem->SetLabelSpinStyle( textItem->GetLabelSpinStyle().MirrorX() );
601  else
602  textItem->SetLabelSpinStyle( textItem->GetLabelSpinStyle().MirrorY() );
603  break;
604  }
605 
606  case SCH_SHEET_PIN_T:
607  {
608  // mirror within parent sheet
609  SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
610  SCH_SHEET* sheet = pin->GetParent();
611 
612  if( xAxis )
613  pin->MirrorX( sheet->GetBoundingBox().GetCenter().y );
614  else
615  pin->MirrorY( sheet->GetBoundingBox().GetCenter().x );
616 
617  break;
618  }
619 
620  case SCH_BUS_BUS_ENTRY_T:
622  if( xAxis )
623  item->MirrorX( item->GetPosition().y );
624  else
625  item->MirrorY( item->GetPosition().x );
626  break;
627 
628  case SCH_FIELD_T:
629  {
630  SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
631 
632  if( xAxis )
634  else
636 
637  // Now that we're re-justifying a field, they're no longer autoplaced.
638  if( item->GetParent()->Type() == SCH_COMPONENT_T )
639  {
640  SCH_COMPONENT *parent = static_cast<SCH_COMPONENT*>( item->GetParent() );
641  parent->ClearFieldsAutoplaced();
642  }
643 
644  break;
645  }
646 
647  case SCH_BITMAP_T:
648  if( xAxis )
649  item->MirrorX( item->GetPosition().y );
650  else
651  item->MirrorY( item->GetPosition().x );
652 
653  // The bitmap is cached in Opengl: clear the cache to redraw
655  break;
656 
657  case SCH_SHEET_T:
658  // Mirror the sheet on itself. Sheets do not have a anchor point.
659  mirrorPoint = m_frame->GetNearestGridPosition( item->GetBoundingBox().Centre() );
660 
661  if( xAxis )
662  item->MirrorX( mirrorPoint.y );
663  else
664  item->MirrorY( mirrorPoint.x );
665 
666  break;
667 
668  default:
669  break;
670  }
671 
672  connections = item->IsConnectable();
673  m_frame->RefreshItem( item );
674  }
675  else if( selection.GetSize() > 1 )
676  {
677  mirrorPoint = (wxPoint)selection.GetReferencePoint();
678 
679  for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
680  {
681  item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
682 
683  if( !moving )
684  saveCopyInUndoList( item, UR_CHANGED, ii > 0 );
685 
686  if( item->Type() == SCH_SHEET_PIN_T )
687  {
688  if( item->GetParent()->IsSelected() )
689  {
690  // parent will mirror us
691  }
692  else
693  {
694  // mirror within parent sheet
695  SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
696  SCH_SHEET* sheet = pin->GetParent();
697 
698  if( xAxis )
699  pin->MirrorX( sheet->GetBoundingBox().GetCenter().y );
700  else
701  pin->MirrorY( sheet->GetBoundingBox().GetCenter().x );
702  }
703  }
704  else
705  {
706  if( xAxis )
707  item->MirrorX( mirrorPoint.y );
708  else
709  item->MirrorY( mirrorPoint.x );
710  }
711 
712  connections |= item->IsConnectable();
713  m_frame->RefreshItem( item );
714  }
715  }
716 
718 
719  if( item->IsMoving() )
720  {
722  }
723  else
724  {
725  if( selection.IsHover() )
727 
728  if( connections )
730 
731  m_frame->OnModify();
732  }
733 
734  return 0;
735 }
VECTOR2I GetReferencePoint() const
Definition: selection.h:239
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
void AutoAutoplaceFields(SCH_SCREEN *aScreen)
Autoplace fields only if correct to do so automatically.
virtual bool IsConnectable() const
Function IsConnectable returns true if the schematic item can connect to another schematic item.
Definition: sch_item.h:317
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:44
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:184
bool IsHover() const
Definition: selection.h:70
SCH_SHEET * GetParent() const
Get the parent sheet object of this sheet pin.
Definition: sch_sheet.h:158
bool IsSelected() const
Definition: base_struct.h:223
void MirrorY(int aYaxis_position) override
Function MirrorY mirrors item relative to the Y axis about aYaxis_position.
bool IsMoving() const
Definition: base_struct.h:220
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void RecacheAllItems()
Function RecacheAllItems() Rebuilds GAL display lists.
Definition: view.cpp:1402
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
wxPoint GetNearestGridPosition(const wxPoint &aPosition) const
Return the nearest aGridSize location to aPosition.
void MirrorX(int aXaxis_position) override
Function MirrorX mirrors item relative to the X axis about aXaxis_position.
bool GetAutoplaceFields() const
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:201
void ClearFieldsAutoplaced()
Set fields automatically placed flag false.
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.
virtual wxPoint GetPosition() const =0
Function GetPosition.
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:183
EDA_RECT const GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: sch_sheet.cpp:477
void SetVertJustify(EDA_TEXT_VJUSTIFY_T aType)
Definition: eda_text.h:187
EDA_ITEM * GetParent() const
Definition: base_struct.h:215
const KICAD_T rotatableItems[]
static TOOL_ACTION mirrorX
Definition: ee_actions.h:120
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:153
LABEL_SPIN_STYLE GetLabelSpinStyle() const
Definition: sch_text.h:238
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:75
virtual void MirrorX(int aXaxis_position)=0
Function MirrorX mirrors item relative to the X axis about aXaxis_position.
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:58
virtual void MirrorY(int aYaxis_position)=0
Function MirrorY mirrors item relative to the Y axis about aYaxis_position.
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.h:104
LABEL_SPIN_STYLE MirrorY()
Definition: sch_text.h:141
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:206
EDA_TEXT_VJUSTIFY_T
Definition: eda_text.h:51
virtual unsigned int GetSize() const override
Function GetSize() Returns the number of stored items.
Definition: selection.h:99
LABEL_SPIN_STYLE MirrorX()
Definition: sch_text.h:121
void RefreshItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:186
SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:89
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.
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:210
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:237
SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:136
static TOOL_ACTION refreshPreview
Definition: actions.h:101
EDA_ITEM * Front() const
Definition: selection.h:183
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...

References SCH_COMPONENT::AutoAutoplaceFields(), EDA_RECT::Centre(), SCH_COMPONENT::ClearFieldsAutoplaced(), EE_ACTIONS::clearSelection, CMP_MIRROR_X, CMP_MIRROR_Y, SELECTION::Front(), SCH_EDIT_FRAME::GetAutoplaceFields(), EDA_ITEM::GetBoundingBox(), SCH_SHEET::GetBoundingBox(), EDA_RECT::GetCenter(), EDA_TEXT::GetHorizJustify(), SELECTION::GetItem(), SCH_TEXT::GetLabelSpinStyle(), EDA_DRAW_FRAME::GetNearestGridPosition(), SCH_SHEET_PIN::GetParent(), EDA_ITEM::GetParent(), SCH_ITEM::GetPosition(), SELECTION::GetReferencePoint(), SCH_EDIT_FRAME::GetScreen(), SELECTION::GetSize(), EDA_TEXT::GetVertJustify(), TOOL_BASE::getView(), SCH_ITEM::IsConnectable(), SELECTION::IsHover(), EDA_ITEM::IsMoving(), EDA_ITEM::IsSelected(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, TOOL_EVENT::Matches(), EE_ACTIONS::mirrorX, LABEL_SPIN_STYLE::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 1214 of file sch_edit_tool.cpp.

1215 {
1217 
1218  if( selection.Empty() )
1219  return 0;
1220 
1221  SCH_ITEM* item = (SCH_ITEM*) selection.Front();
1222 
1223  switch( item->Type() )
1224  {
1225  case SCH_COMPONENT_T:
1226  {
1227  SCH_COMPONENT* component = (SCH_COMPONENT*) item;
1228  DIALOG_EDIT_COMPONENT_IN_SCHEMATIC dlg( m_frame, component );
1229 
1230  // This dialog itself subsequently can invoke a KIWAY_PLAYER as a quasimodal
1231  // frame. Therefore this dialog as a modal frame parent, MUST be run under
1232  // quasimodal mode for the quasimodal frame support to work. So don't use
1233  // the QUASIMODAL macros here.
1234  if( dlg.ShowQuasiModal() == wxID_OK )
1235  {
1236  if( m_frame->GetAutoplaceFields() )
1237  component->AutoAutoplaceFields( m_frame->GetScreen() );
1238 
1240  m_frame->OnModify();
1241  }
1242  }
1243  break;
1244 
1245  case SCH_SHEET_T:
1246  {
1247  bool doClearAnnotation;
1248  bool doRefresh = false;
1249  // Keep track of existing sheet paths. EditSheet() can modify this list
1250  SCH_SHEET_LIST initial_sheetpathList( g_RootSheet );
1251 
1252  doRefresh = m_frame->EditSheet( (SCH_SHEET*) item, g_CurrentSheet, &doClearAnnotation );
1253 
1254  if( doClearAnnotation ) // happens when the current sheet load a existing file
1255  { // we must clear "new" components annotation
1256  SCH_SCREENS screensList( g_RootSheet );
1257  // We clear annotation of new sheet paths here:
1258  screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
1259  // Clear annotation of g_CurrentSheet itself, because its sheetpath
1260  // is not a new path, but components managed by its sheet path must have
1261  // their annotation cleared, because they are new:
1262  ((SCH_SHEET*) item)->GetScreen()->ClearAnnotation( g_CurrentSheet );
1263  }
1264 
1265  if( doRefresh )
1266  {
1268  m_frame->GetCanvas()->Refresh();
1270  }
1271 
1272  break;
1273  }
1274 
1275  case SCH_SHEET_PIN_T:
1276  {
1277  SCH_SHEET_PIN* pin = (SCH_SHEET_PIN*) item;
1278  DIALOG_EDIT_SHEET_PIN dlg( m_frame, pin );
1279 
1280  if( dlg.ShowModal() == wxID_OK )
1281  {
1283  m_frame->OnModify();
1284  }
1285  }
1286  break;
1287 
1288  case SCH_TEXT_T:
1289  case SCH_LABEL_T:
1290  case SCH_GLOBAL_LABEL_T:
1291  case SCH_HIER_LABEL_T:
1292  if( InvokeDialogLabelEditor( m_frame, (SCH_TEXT*) item ) == wxID_OK )
1293  {
1295  m_frame->OnModify();
1296  }
1297 
1298  break;
1299 
1300  case SCH_FIELD_T:
1301  editComponentFieldText( (SCH_FIELD*) item );
1302  break;
1303 
1304  case SCH_BITMAP_T:
1305  {
1306  SCH_BITMAP* bitmap = (SCH_BITMAP*) item;
1307  DIALOG_IMAGE_EDITOR dlg( m_frame, bitmap->GetImage() );
1308 
1309  if( dlg.ShowModal() == wxID_OK )
1310  {
1311  // save old image in undo list if not already in edit
1312  if( bitmap->GetEditFlags() == 0 )
1314 
1315  dlg.TransferToImage( bitmap->GetImage() );
1316 
1317  // The bitmap is cached in Opengl: clear the cache in case it has become invalid
1318  getView()->RecacheAllItems();
1320  m_frame->OnModify();
1321  }
1322  }
1323  break;
1324 
1325  case SCH_LINE_T:
1326  {
1327  if( !selection.AreAllItemsIdentical() )
1328  break;
1329 
1330  std::deque<SCH_LINE*> lines;
1331  for( auto selItem : selection.Items() )
1332  {
1333  SCH_LINE* line = dynamic_cast<SCH_LINE*>( selItem );
1334 
1335  if( line )
1336  lines.push_back( line );
1337  }
1338 
1339  // Verify we are only editing graphic lines
1340  if( !std::all_of( lines.begin(), lines.end(),
1341  [&]( const SCH_LINE* r ) { return r->IsGraphicLine(); } ) )
1342  break;
1343 
1344  DIALOG_EDIT_LINE_STYLE dlg( m_frame, lines );
1345 
1346  if( dlg.ShowModal() == wxID_OK )
1347  {
1349  m_frame->OnModify();
1350  }
1351  }
1352  break;
1353 
1354  case SCH_MARKER_T: // These items have no properties to edit
1355  case SCH_JUNCTION_T:
1356  case SCH_NO_CONNECT_T:
1357  break;
1358 
1359  default: // Unexpected item
1360  wxFAIL_MSG( wxString( "Cannot edit schematic item type " ) + item->GetClass() );
1361  }
1362 
1363  m_frame->GetScreen()->Update( item );
1364  updateView( item );
1365 
1366  if( selection.IsHover() )
1367  {
1369  }
1370 
1371  return 0;
1372 }
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
void AutoAutoplaceFields(SCH_SCREEN *aScreen)
Autoplace fields only if correct to do so automatically.
bool IsHover() const
Definition: selection.h:70
std::deque< EDA_ITEM * > & Items()
Definition: selection.h:188
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void RecacheAllItems()
Function RecacheAllItems() Rebuilds GAL display lists.
Definition: view.cpp:1402
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
bool AreAllItemsIdentical() const
Checks if all items in the selection are the same KICAD_T type.
Definition: selection.h:259
bool GetAutoplaceFields() const
void editComponentFieldText(SCH_FIELD *aField)
bool EditSheet(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy, bool *aClearAnnotationNewItems)
Edit an existing sheet or add a new sheet to the schematic.
Definition: sheet.cpp:512
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:201
int InvokeDialogLabelEditor(SCH_EDIT_FRAME *aCaller, SCH_TEXT *aTextItem)
Launches the "Edit Text/Label" dialog.
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.
SCH_SHEET_PATH * g_CurrentSheet
With the new connectivity algorithm, many more places than before want to know what the current sheet...
BITMAP_BASE * GetImage()
Definition: sch_bitmap.h:59
STATUS_FLAGS GetEditFlags() const
Definition: base_struct.h:260
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
void UpdateHierarchyNavigator(bool aForceUpdate=false)
Run the Hierarchy Navigator dialog.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:153
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:75
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:58
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:120
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:206
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
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:38
virtual wxString GetClass() const override
Function GetClass returns the class name.
Definition: sch_text.h:219
Dialog used to edit SCH_COMPONENT objects in a schematic.
SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:89
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
SCH_SHEET * g_RootSheet
void Update(SCH_ITEM *aItem)
Updates aItem's bounding box in the tree.
Definition: sch_screen.cpp:228
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:237
SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:136
static const KICAD_T EditableItems[]
Definition: ee_collectors.h:43
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:498
EDA_ITEM * Front() const
Definition: selection.h:183
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207

References SELECTION::AreAllItemsIdentical(), SCH_COMPONENT::AutoAutoplaceFields(), SCH_SCREENS::ClearAnnotationOfNewSheetPaths(), EE_ACTIONS::clearSelection, EE_COLLECTOR::EditableItems, editComponentFieldText(), SCH_EDIT_FRAME::EditSheet(), SELECTION::Empty(), SELECTION::Front(), g_CurrentSheet, g_RootSheet, SCH_EDIT_FRAME::GetAutoplaceFields(), SCH_BASE_FRAME::GetCanvas(), SCH_FIELD::GetClass(), EDA_ITEM::GetEditFlags(), SCH_BITMAP::GetImage(), SCH_EDIT_FRAME::GetScreen(), TOOL_BASE::getView(), InvokeDialogLabelEditor(), SELECTION::IsHover(), SELECTION::Items(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, SCH_EDIT_FRAME::OnModify(), TOOL_MANAGER::PostEvent(), KIGFX::VIEW::RecacheAllItems(), EDA_DRAW_PANEL_GAL::Refresh(), EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_BITMAP_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, EVENTS::SelectedItemsModified, DIALOG_SHIM::ShowQuasiModal(), EDA_ITEM::Type(), SCH_SCREEN::Update(), SCH_EDIT_FRAME::UpdateHierarchyNavigator(), 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 847 of file sch_edit_tool.cpp.

848 {
849  SCH_ITEM* sourceItem = m_frame->GetRepeatItem();
850 
851  if( !sourceItem )
852  return 0;
853 
855 
856  SCH_ITEM* newItem = (SCH_ITEM*) sourceItem->Clone();
857  bool performDrag = false;
858 
859  // If cloning a component then put into 'move' mode.
860  if( newItem->Type() == SCH_COMPONENT_T )
861  {
862  ( (SCH_COMPONENT*) newItem )->SetTimeStamp( GetNewTimeStamp() );
863 
864  wxPoint cursorPos = (wxPoint) getViewControls()->GetCursorPosition( true );
865  newItem->Move( cursorPos - newItem->GetPosition() );
866  performDrag = true;
867  }
868  else
869  {
870  if( newItem->CanIncrementLabel() )
871  ( (SCH_TEXT*) newItem )->IncrementLabel( m_frame->GetRepeatDeltaLabel() );
872 
873  newItem->Move( m_frame->GetRepeatStep() );
874  }
875 
876  newItem->SetFlags( IS_NEW );
877  m_frame->AddToScreen( newItem );
878  m_frame->SaveCopyInUndoList( newItem, UR_NEW );
879 
880  m_selectionTool->AddItemToSel( newItem );
881 
882  if( performDrag )
884 
885  newItem->ClearFlags();
886 
887  if( newItem->IsConnectable() )
888  {
889  auto selection = m_selectionTool->GetSelection();
890 
891  m_toolMgr->RunAction( EE_ACTIONS::addNeededJunctions, true, &selection );
894  }
895 
896  // newItem newItem, now that it has been moved, thus saving new position.
897  m_frame->SaveCopyForRepeatItem( newItem );
898 
899  return 0;
900 }
bool SchematicCleanUp(SCH_SCREEN *aScreen=nullptr)
Performs routine schematic cleaning including breaking wire and buses and deleting identical objects ...
virtual bool IsConnectable() const
Function IsConnectable returns true if the schematic item can connect to another schematic item.
Definition: sch_item.h:317
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen=nullptr)
Add an item to the screen (and view) aScreen is the screen the item is located on,...
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
virtual bool CanIncrementLabel() const
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:109
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
EE_SELECTION & GetSelection()
Function GetSelection()
#define IS_NEW
New item, just created.
Definition: base_struct.h:120
timestamp_t GetNewTimeStamp()
Definition: common.cpp:215
virtual wxPoint GetPosition() const =0
Function GetPosition.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:255
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
void SaveCopyForRepeatItem(SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
const wxPoint GetRepeatStep() const
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:153
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:58
static TOOL_ACTION addNeededJunctions
Definition: ee_actions.h:77
SCH_ITEM * GetRepeatItem() const
Return the item which is to be repeated with the insert key.
int AddItemToSel(const TOOL_EVENT &aEvent)
SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:89
int GetRepeatDeltaLabel() const
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:256
static TOOL_ACTION move
Definition: ee_actions.h:115
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:136
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:212
virtual void Move(const wxPoint &aMoveVector)=0
Function Move moves the item by aMoveVector to a new position.

References EE_SELECTION_TOOL::AddItemToSel(), EE_ACTIONS::addNeededJunctions, SCH_BASE_FRAME::AddToScreen(), SCH_ITEM::CanIncrementLabel(), EDA_ITEM::ClearFlags(), EE_ACTIONS::clearSelection, EDA_ITEM::Clone(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), GetNewTimeStamp(), SCH_ITEM::GetPosition(), SCH_BASE_FRAME::GetRepeatDeltaLabel(), SCH_EDIT_FRAME::GetRepeatItem(), SCH_BASE_FRAME::GetRepeatStep(), EE_SELECTION_TOOL::GetSelection(), TOOL_BASE::getViewControls(), IS_NEW, SCH_ITEM::IsConnectable(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_ACTIONS::move, SCH_ITEM::Move(), TOOL_MANAGER::RunAction(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_COMPONENT_T, SCH_EDIT_FRAME::SchematicCleanUp(), EDA_ITEM::SetFlags(), EDA_ITEM::SetTimeStamp(), SCH_EDIT_FRAME::TestDanglingEnds(), EDA_ITEM::Type(), and UR_NEW.

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

370 {
372 
373  if( selection.GetSize() == 0 )
374  return 0;
375 
376  wxPoint rotPoint;
377  bool clockwise = ( aEvent.Matches( EE_ACTIONS::rotateCW.MakeEvent() ) );
378  SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.Front() );
379  bool connections = false;
380  bool moving = item->IsMoving();
381 
382  if( selection.GetSize() == 1 )
383  {
384  if( !moving )
386 
387  switch( item->Type() )
388  {
389  case SCH_COMPONENT_T:
390  {
391  SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
392 
393  if( clockwise )
394  component->SetOrientation( CMP_ROTATE_CLOCKWISE );
395  else
397 
398  if( m_frame->GetAutoplaceFields() )
399  component->AutoAutoplaceFields( m_frame->GetScreen() );
400 
401  break;
402  }
403 
404  case SCH_TEXT_T:
405  case SCH_LABEL_T:
406  case SCH_GLOBAL_LABEL_T:
407  case SCH_HIER_LABEL_T:
408  {
409  SCH_TEXT* textItem = static_cast<SCH_TEXT*>( item );
410 
411  if( clockwise )
412  textItem->SetLabelSpinStyle( textItem->GetLabelSpinStyle().RotateCW() );
413  else
414  textItem->SetLabelSpinStyle( textItem->GetLabelSpinStyle().RotateCCW() );
415 
416  break;
417  }
418 
419  case SCH_SHEET_PIN_T:
420  {
421  // Rotate pin within parent sheet
422  SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
423  SCH_SHEET* sheet = pin->GetParent();
424  for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
425  {
426  pin->Rotate( sheet->GetBoundingBox().GetCenter() );
427  }
428  break;
429  }
430 
431  case SCH_BUS_BUS_ENTRY_T:
433  for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
434  {
435  item->Rotate( item->GetPosition() );
436  }
437  break;
438 
439  case SCH_FIELD_T:
440  {
441  SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
442 
443  if( field->GetTextAngle() == TEXT_ANGLE_HORIZ )
444  field->SetTextAngle( TEXT_ANGLE_VERT );
445  else
446  field->SetTextAngle( TEXT_ANGLE_HORIZ );
447 
448  // Now that we're moving a field, they're no longer autoplaced.
449  if( item->GetParent()->Type() == SCH_COMPONENT_T )
450  {
451  SCH_COMPONENT* parent = static_cast<SCH_COMPONENT*>( item->GetParent() );
452  parent->ClearFieldsAutoplaced();
453  }
454 
455  break;
456  }
457 
458  case SCH_BITMAP_T:
459  for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
460  {
461  item->Rotate( item->GetPosition() );
462  }
463  // The bitmap is cached in Opengl: clear the cache to redraw
465  break;
466 
467  case SCH_SHEET_T:
468  {
469  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
470 
471  // Rotate the sheet on itself. Sheets do not have an anchor point.
472  for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
473  {
474  rotPoint = m_frame->GetNearestGridPosition( sheet->GetRotationCenter() );
475  sheet->Rotate( rotPoint );
476  }
477  break;
478  }
479 
480  default:
481  break;
482  }
483 
484  connections = item->IsConnectable();
485  m_frame->RefreshItem( item );
486  }
487  else if( selection.GetSize() > 1 )
488  {
489  rotPoint = m_frame->GetNearestGridPosition( (wxPoint)selection.GetCenter() );
490 
491  for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
492  {
493  item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
494 
495  if( !moving )
496  saveCopyInUndoList( item, UR_CHANGED, ii > 0 );
497 
498  for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
499  {
500  if( item->Type() == SCH_LINE_T )
501  {
502  SCH_LINE* line = (SCH_LINE*) item;
503 
504  if( item->HasFlag( STARTPOINT ) )
505  line->RotateStart( rotPoint );
506 
507  if( item->HasFlag( ENDPOINT ) )
508  line->RotateEnd( rotPoint );
509  }
510  else if( item->Type() == SCH_SHEET_PIN_T )
511  {
512  if( item->GetParent()->IsSelected() )
513  {
514  // parent will rotate us
515  }
516  else
517  {
518  // rotate within parent
519  SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
520  SCH_SHEET* sheet = pin->GetParent();
521 
522  pin->Rotate( sheet->GetBoundingBox().GetCenter() );
523  }
524  }
525  else
526  {
527  item->Rotate( rotPoint );
528  }
529  }
530 
531  connections |= item->IsConnectable();
532  m_frame->RefreshItem( item );
533  }
534  }
535 
537 
538  if( item->IsMoving() )
539  {
541  }
542  else
543  {
544  if( selection.IsHover() )
546 
547  if( connections )
549 
550  m_frame->OnModify();
551  }
552 
553  return 0;
554 }
void SetTextAngle(double aAngle)
Definition: eda_text.h:150
#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
void AutoAutoplaceFields(SCH_SCREEN *aScreen)
Autoplace fields only if correct to do so automatically.
virtual bool IsConnectable() const
Function IsConnectable returns true if the schematic item can connect to another schematic item.
Definition: sch_item.h:317
bool IsHover() const
Definition: selection.h:70
SCH_SHEET * GetParent() const
Get the parent sheet object of this sheet pin.
Definition: sch_sheet.h:158
bool IsSelected() const
Definition: base_struct.h:223
#define TEXT_ANGLE_VERT
void RotateEnd(wxPoint aPosition)
Definition: sch_line.cpp:364
virtual VECTOR2I GetCenter() const
Returns the center point of the selection area bounding box.
Definition: selection.h:137
bool IsMoving() const
Definition: base_struct.h:220
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void RecacheAllItems()
Function RecacheAllItems() Rebuilds GAL display lists.
Definition: view.cpp:1402
double GetTextAngle() const
Definition: eda_text.h:158
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
wxPoint GetNearestGridPosition(const wxPoint &aPosition) const
Return the nearest aGridSize location to aPosition.
bool GetAutoplaceFields() const
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:201
void RotateStart(wxPoint aPosition)
Definition: sch_line.cpp:358
static TOOL_ACTION rotateCW
Definition: ee_actions.h:118
void ClearFieldsAutoplaced()
Set fields automatically placed flag false.
virtual void Rotate(wxPoint aPosition)=0
Function Rotate rotates the item around aPosition 90 degrees in the clockwise direction.
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.
virtual wxPoint GetPosition() const =0
Function GetPosition.
EDA_RECT const GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: sch_sheet.cpp:477
EDA_ITEM * GetParent() const
Definition: base_struct.h:215
const KICAD_T rotatableItems[]
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:153
LABEL_SPIN_STYLE GetLabelSpinStyle() const
Definition: sch_text.h:238
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:75
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:58
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.h:104
void Rotate(wxPoint aPosition) override
Function Rotate rotates the item around aPosition 90 degrees in the clockwise direction.
Definition: sch_sheet.cpp:635
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
LABEL_SPIN_STYLE RotateCCW()
Definition: sch_text.h:101
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:206
virtual unsigned int GetSize() const override
Function GetSize() Returns the number of stored items.
Definition: selection.h:99
LABEL_SPIN_STYLE RotateCW()
Definition: sch_text.h:84
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:38
void RefreshItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:126
SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:89
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:511
void Rotate(wxPoint aPosition) override
Function Rotate rotates 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...
bool HasFlag(STATUS_FLAGS aFlag)
Definition: base_struct.h:258
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:210
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:237
SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:136
static TOOL_ACTION refreshPreview
Definition: actions.h:101
EDA_ITEM * Front() const
Definition: selection.h:183
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:125
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...

References SCH_COMPONENT::AutoAutoplaceFields(), SCH_COMPONENT::ClearFieldsAutoplaced(), EE_ACTIONS::clearSelection, CMP_ROTATE_CLOCKWISE, CMP_ROTATE_COUNTERCLOCKWISE, ENDPOINT, SELECTION::Front(), SCH_EDIT_FRAME::GetAutoplaceFields(), SCH_SHEET::GetBoundingBox(), EDA_RECT::GetCenter(), SELECTION::GetCenter(), SELECTION::GetItem(), SCH_TEXT::GetLabelSpinStyle(), EDA_DRAW_FRAME::GetNearestGridPosition(), SCH_SHEET_PIN::GetParent(), EDA_ITEM::GetParent(), SCH_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(), 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  editFrame->SaveCopyInUndoList(
141  static_cast<SCH_ITEM*>( aItem->GetParent() ), UR_CHANGED, aAppend );
142  else
143  editFrame->SaveCopyInUndoList( static_cast<SCH_ITEM*>( aItem ), aType, aAppend );
144  }
145 
146  if( selected && aItem->HasFlag( TEMP_SELECTED ) )
147  aItem->SetSelected();
148  }
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: base_struct.h:128
bool IsSelected() const
Definition: base_struct.h:223
void ClearSelected()
Definition: base_struct.h:233
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
void SetSelected()
Definition: base_struct.h:229
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
EDA_ITEM * GetParent() const
Definition: base_struct.h:215
The symbol library editor main window.
bool HasFlag(STATUS_FLAGS aFlag)
Definition: base_struct.h:258
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:207

◆ 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(), 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 1470 of file sch_edit_tool.cpp.

1471 {
1476  Go( &SCH_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorX.MakeEvent() );
1477  Go( &SCH_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorY.MakeEvent() );
1478  Go( &SCH_EDIT_TOOL::DoDelete, ACTIONS::doDelete.MakeEvent() );
1480 
1490 
1497 
1500 
1503 }
static TOOL_ACTION properties
Definition: ee_actions.h:122
static TOOL_ACTION toggleDeMorgan
Definition: ee_actions.h:127
static TOOL_ACTION breakBus
Definition: ee_actions.h:138
static TOOL_ACTION doDelete
Definition: actions.h:74
static TOOL_ACTION toShapeBackslash
Definition: ee_actions.h:132
int Rotate(const TOOL_EVENT &aEvent)
static TOOL_ACTION mirrorY
Definition: ee_actions.h:121
int BreakWire(const TOOL_EVENT &aEvent)
static TOOL_ACTION toText
Definition: ee_actions.h:136
static TOOL_ACTION autoplaceFields
Definition: ee_actions.h:126
int Properties(const TOOL_EVENT &aEvent)
int UpdateFields(const TOOL_EVENT &aEvent)
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:129
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:137
static TOOL_ACTION rotateCW
Definition: ee_actions.h:118
int Duplicate(const TOOL_EVENT &aEvent)
static TOOL_ACTION cleanupSheetPins
Definition: ee_actions.h:181
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:119
static TOOL_ACTION editFootprint
Definition: ee_actions.h:125
int ChangeShape(const TOOL_EVENT &aEvent)
int AutoplaceFields(const TOOL_EVENT &aEvent)
static TOOL_ACTION repeatDrawItem
Definition: ee_actions.h:117
static TOOL_ACTION mirrorX
Definition: ee_actions.h:120
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:128
int Mirror(const TOOL_EVENT &aEvent)
int RepeatDrawItem(const TOOL_EVENT &aEvent)
static TOOL_ACTION updateFieldsFromLibrary
Definition: ee_actions.h:151
static TOOL_ACTION editValue
Definition: ee_actions.h:124
int EditField(const TOOL_EVENT &aEvent)
static TOOL_ACTION deleteTool
Definition: actions.h:75
static TOOL_ACTION toLabel
Definition: ee_actions.h:133
static TOOL_ACTION toHLabel
Definition: ee_actions.h:134
static TOOL_ACTION editReference
Definition: ee_actions.h:123
int DoDelete(const TOOL_EVENT &aEvent)
Deletes the selected items, or the item under the cursor.
static TOOL_ACTION toGLabel
Definition: ee_actions.h:135
int ConvertDeMorgan(const TOOL_EVENT &aEvent)
static TOOL_ACTION duplicate
Definition: actions.h:73
int ChangeTextType(const TOOL_EVENT &aEvent)
static TOOL_ACTION toShapeSlash
Definition: ee_actions.h:131

References AutoplaceFields(), EE_ACTIONS::autoplaceFields, EE_ACTIONS::breakBus, BreakWire(), EE_ACTIONS::breakWire, ChangeShape(), ChangeTextType(), CleanupSheetPins(), EE_ACTIONS::cleanupSheetPins, ConvertDeMorgan(), DeleteItemCursor(), ACTIONS::deleteTool, DoDelete(), ACTIONS::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, 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::toShapeBackslash, EE_ACTIONS::toShapeSlash, EE_ACTIONS::toText, UpdateFields(), and EE_ACTIONS::updateFieldsFromLibrary.

◆ UpdateFields()

int SCH_EDIT_TOOL::UpdateFields ( const TOOL_EVENT aEvent)

Definition at line 1170 of file sch_edit_tool.cpp.

1171 {
1172  std::list<SCH_COMPONENT*> components;
1173 
1174  for( auto item : m_frame->GetScreen()->Items().OfType( SCH_COMPONENT_T ) )
1175  components.push_back( static_cast<SCH_COMPONENT*>( item ) );
1176 
1177 
1178  if( InvokeDialogUpdateFields( m_frame, components, true ) == wxID_OK )
1179  m_frame->GetCanvas()->Refresh();
1180 
1181  return 0;
1182 }
EE_TYPE OfType(KICAD_T aType)
Definition: sch_rtree.h:219
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.
int InvokeDialogUpdateFields(SCH_EDIT_FRAME *aCaller, const list< SCH_COMPONENT * > aComponents, bool aCreateUndoEntry)
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...
EE_RTREE & Items()
Definition: sch_screen.h:127

References SCH_BASE_FRAME::GetCanvas(), SCH_EDIT_FRAME::GetScreen(), InvokeDialogUpdateFields(), SCH_SCREEN::Items(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_RTREE::OfType(), EDA_DRAW_PANEL_GAL::Refresh(), and SCH_COMPONENT_T.

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:215
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:1540
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207

◆ 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(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), CVPCB_CONTROL::Main(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), 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 151 of file ee_tool_base.h.

◆ m_isLibEdit

bool EE_TOOL_BASE< SCH_EDIT_FRAME >::m_isLibEdit
protectedinherited

Definition at line 154 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(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), PICKER_TOOL::Init(), Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), LIB_DRAWING_TOOLS::Init(), MODULE_EDITOR_TOOLS::Init(), LIB_CONTROL::Init(), PCB_EDITOR_CONTROL::Init(), SCH_DRAWING_TOOLS::Init(), GERBVIEW_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(), EDIT_TOOL::Init(), PCB_TOOL_BASE::Init(), SCH_MOVE_TOOL::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), 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 78 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 153 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(), EE_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemToSel(), SELECTION_TOOL::AddItemToSel(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), EDIT_TOOL::ChangeTrackWidth(), PCB_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), ConvertDeMorgan(), LIB_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), MICROWAVE_TOOL::createInductorBetween(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), ROUTER_TOOL::CustomTrackWidthDialog(), SCH_EDITOR_CONTROL::Cut(), LIB_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_TOOL_BASE::doInteractiveItemPlacement(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), Duplicate(), EDIT_TOOL::Duplicate(), editComponentFieldText(), EDIT_TOOL::EditFpInFpEditor(), LIB_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), 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::getEditFrameInt(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), 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(), MODULE_EDITOR_TOOLS::ImportFootprint(), LIB_EDIT_TOOL::Init(), Init(), PAD_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), LIB_CONTROL::Init(), PCB_EDITOR_CONTROL::Init(), POINT_EDITOR::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(), TOOL_BASE::IsToolActive(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), SCH_MOVE_TOOL::Main(), CVPCB_CONTROL::Main(), LIB_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LIB_EDIT_TOOL::Mirror(), Mirror(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::Move(), EDIT_TOOL::MoveExact(), LIB_CONTROL::OnDeMorgan(), LIB_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickCopyReferencePoint(), LIB_EDIT_TOOL::PinTable(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), 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(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), EE_SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), RepeatDrawItem(), LIB_DRAWING_TOOLS::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), 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(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), 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(), 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(), 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_toolSettings

TOOL_SETTINGS TOOL_BASE::m_toolSettings
protectedinherited

Definition at line 220 of file tool_base.h.

Referenced by TOOL_BASE::attachManager(), and TOOL_BASE::GetSettings().

◆ 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 152 of file ee_tool_base.h.


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