KiCad PCB EDA Suite
SCH_EDITOR_CONTROL Class Reference

Handle actions specific to the schematic editor. More...

#include <sch_editor_control.h>

Inheritance diagram for SCH_EDITOR_CONTROL:
EE_TOOL_BASE< SCH_EDIT_FRAME > TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 Determine the reason of reset for a tool. More...
 

Public Member Functions

 SCH_EDITOR_CONTROL ()
 
 ~SCH_EDITOR_CONTROL ()
 
int New (const TOOL_EVENT &aEvent)
 
int Open (const TOOL_EVENT &aEvent)
 
int Save (const TOOL_EVENT &aEvent)
 
int SaveAs (const TOOL_EVENT &aEvent)
 
int ShowSchematicSetup (const TOOL_EVENT &aEvent)
 
int PageSetup (const TOOL_EVENT &aEvent)
 
int Print (const TOOL_EVENT &aEvent)
 
int Plot (const TOOL_EVENT &aEvent)
 
int Quit (const TOOL_EVENT &aEvent)
 
int RescueSymbols (const TOOL_EVENT &aEvent)
 Perform rescue operations to recover old projects from before certain changes were made. More...
 
int RemapSymbols (const TOOL_EVENT &aEvent)
 
bool RescueLegacyProject (bool aRunningOnDemand)
 
bool RescueSymbolLibTableProject (bool aRunningOnDemand)
 
int FindAndReplace (const TOOL_EVENT &aEvent)
 
int FindNext (const TOOL_EVENT &aEvent)
 
bool HasMatch ()
 
int ReplaceAndFindNext (const TOOL_EVENT &aEvent)
 
int ReplaceAll (const TOOL_EVENT &aEvent)
 
int UpdateFind (const TOOL_EVENT &aEvent)
 Notifies pcbnew about the selected item. More...
 
int CrossProbeToPcb (const TOOL_EVENT &aEvent)
 Equivalent to the above, but initiated by the user. More...
 
int ExplicitCrossProbeToPcb (const TOOL_EVENT &aEvent)
 
int HighlightNet (const TOOL_EVENT &aEvent)
 < Highlight net under the cursor. More...
 
int ClearHighlight (const TOOL_EVENT &aEvent)
 Update net highlighting after an edit. More...
 
int UpdateNetHighlighting (const TOOL_EVENT &aEvent)
 Launch a tool to highlight nets. More...
 
int HighlightNetCursor (const TOOL_EVENT &aEvent)
 
int AssignNetclass (const TOOL_EVENT &aEvent)
 
int Undo (const TOOL_EVENT &aEvent)
 
int Redo (const TOOL_EVENT &aEvent)
 Clipboard support. More...
 
int Cut (const TOOL_EVENT &aEvent)
 
int Copy (const TOOL_EVENT &aEvent)
 
int Paste (const TOOL_EVENT &aEvent)
 
int EditWithSymbolEditor (const TOOL_EVENT &aEvent)
 
int ShowCvpcb (const TOOL_EVENT &aEvent)
 
int Annotate (const TOOL_EVENT &aEvent)
 
int EditSymbolFields (const TOOL_EVENT &aEvent)
 
int EditSymbolLibraryLinks (const TOOL_EVENT &aEvent)
 
int ShowPcbNew (const TOOL_EVENT &aEvent)
 
int UpdatePCB (const TOOL_EVENT &aEvent)
 
int UpdateFromPCB (const TOOL_EVENT &aEvent)
 
int ImportFPAssignments (const TOOL_EVENT &aEvent)
 
int ExportNetlist (const TOOL_EVENT &aEvent)
 
int GenerateBOM (const TOOL_EVENT &aEvent)
 
int DrawSheetOnClipboard (const TOOL_EVENT &aEvent)
 
int ShowBusManager (const TOOL_EVENT &aEvent)
 
int EnterSheet (const TOOL_EVENT &aEvent)
 
int LeaveSheet (const TOOL_EVENT &aEvent)
 
int NavigateHierarchy (const TOOL_EVENT &aEvent)
 
int ToggleHiddenPins (const TOOL_EVENT &aEvent)
 
int ToggleHiddenFields (const TOOL_EVENT &aEvent)
 
int ToggleForceHV (const TOOL_EVENT &aEvent)
 
void AssignFootprints (const std::string &aChangedSetOfReferences)
 
SCH_ITEMFindComponentAndItem (const wxString &aReference, bool aSearchHierarchy, SCH_SEARCH_T aSearchType, const wxString &aSearchText)
 Find a component in the schematic and an item in this component. More...
 
bool Init () override
 Init() is called once upon a registration of the tool. More...
 
void Reset (RESET_REASON aReason) override
 Bring the tool to a known, initial state. More...
 
void Activate ()
 Run the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Assign a context menu and tells when it should be activated. More...
 
void RunMainStack (std::function< void()> aFunc)
 Call a function using the main stack. More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Define which state (aStateFunc) to go when a certain event arrives (aConditions). More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Suspend execution of the tool until an event specified in aEventList arrives. More...
 
TOOL_TYPE GetType () const
 Return the type of the tool. More...
 
TOOL_ID GetId () const
 Return the unique identifier of the tool. More...
 
const std::string & GetName () const
 Return the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Return the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Protected Member Functions

void updateItem (EDA_ITEM *aItem, bool aUpdateRTree) const
 Similar to getView()->Update(), but handles items that are redrawn by their parents and updating the SCH_SCREEN's RTree. More...
 
void saveCopyInUndoList (EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
 
void attachManager (TOOL_MANAGER *aManager)
 Set the TOOL_MANAGER the tool will belong to. More...
 
KIGFX::VIEWgetView () const
 Returns the instance of #VIEW object used in the application. More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Return the instance of VIEW_CONTROLS object used in the application. More...
 
template<typename T >
T * getEditFrame () const
 Return the application window object, casted to requested user type. More...
 
template<typename T >
T * getModel () const
 Return the model object if it matches the requested type. More...
 

Protected Attributes

SCH_EDIT_FRAMEm_frame
 
KIGFX::SCH_VIEWm_view
 
EE_SELECTION_TOOLm_selectionTool
 
bool m_isSymbolEditor
 
TOOL_MENU m_menu
 The functions below are not yet implemented - their interface may change. More...
 
TOOL_TYPE m_type
 Unique identifier for the tool, assigned by a TOOL_MANAGER instance. More...
 
TOOL_ID m_toolId
 Name of the tool. More...
 
std::string m_toolName
 
TOOL_MANAGERm_toolMgr
 

Private Member Functions

bool doCopy ()
 < copy selection to clipboard More...
 
bool rescueProject (RESCUER &aRescuer, bool aRunningOnDemand)
 
bool searchSupplementaryClipboard (const wxString &aSheetFilename, SCH_SCREEN **aScreen)
 
void doCrossProbeSchToPcb (const TOOL_EVENT &aEvent, bool aForce)
 
void updatePastedInstances (const SCH_SHEET_PATH &aPastePath, const KIID_PATH &aClipPath, SCH_SHEET *aSheet, bool aForceKeepAnnotations)
 
bool processCmpToFootprintLinkFile (const wxString &aFullFilename, bool aForceVisibilityState, bool aVisibilityState)
 Read the footprint info from each line in the stuff file by reference designator. More...
 
void setTransitions () override
 This method is meant to be overridden in order to specify handlers for events. More...
 
SCH_ITEMnextMatch (SCH_SCREEN *aScreen, SCH_SHEET_PATH *aSheet, SCH_ITEM *aAfter, wxFindReplaceData *aData)
 Advance the search and returns the next matching item after aAfter. More...
 

Private Attributes

bool m_probingPcbToSch
 
EDA_ITEMm_pickerItem
 
std::map< wxString, SCH_SCREEN * > m_supplementaryClipboard
 
SCH_REFERENCE_LIST m_supplementaryClipboardInstances
 
KIID_PATH m_supplementaryClipboardPath
 

Detailed Description

Handle actions specific to the schematic editor.

Definition at line 38 of file sch_editor_control.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determine the reason of reset for a tool.

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 78 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ SCH_EDITOR_CONTROL()

SCH_EDITOR_CONTROL::SCH_EDITOR_CONTROL ( )
inline

Definition at line 41 of file sch_editor_control.h.

41  :
42  EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.EditorControl" ),
43  m_probingPcbToSch( false ),
44  m_pickerItem( nullptr )
45  { }

◆ ~SCH_EDITOR_CONTROL()

SCH_EDITOR_CONTROL::~SCH_EDITOR_CONTROL ( )
inline

Definition at line 47 of file sch_editor_control.h.

47 { }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run the tool.

After activation, the tool starts receiving events until it is finished.

Definition at line 51 of file tool_interactive.cpp.

52 {
54 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.

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

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCB_CONTROL::GridSetOrigin(), HighlightNetCursor(), BOARD_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), LIB_TREE::onContextMenu(), PCB_POINT_EDITOR::OnSelectionChange(), GROUP_TOOL::PickNewMember(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ Annotate()

int SCH_EDITOR_CONTROL::Annotate ( const TOOL_EVENT aEvent)

Definition at line 1609 of file sch_editor_control.cpp.

1610 {
1611  wxCommandEvent dummy;
1612  m_frame->OnAnnotate( dummy );
1613  return 0;
1614 }
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
Definition: sch_symbol.cpp:69
void OnAnnotate(wxCommandEvent &event)

References dummy(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, and SCH_EDIT_FRAME::OnAnnotate().

Referenced by setTransitions().

◆ AssignFootprints()

void SCH_EDITOR_CONTROL::AssignFootprints ( const std::string &  aChangedSetOfReferences)

Definition at line 42 of file assign_footprints.cpp.

43 {
44  // Build a flat list of components in schematic:
45  SCH_REFERENCE_LIST refs;
47  bool isChanged = false;
48 
49  sheets.GetSymbols( refs, false );
50 
51  DSNLEXER lexer( aChangedSetOfReferences, FROM_UTF8( __func__ ) );
52  PTREE doc;
53 
54  try
55  {
56  Scan( &doc, &lexer );
57 
58  CPTREE& back_anno = doc.get_child( "cvpcb_netlist" );
59  wxString footprint;
60 
61  for( PTREE::const_iterator ref = back_anno.begin(); ref != back_anno.end(); ++ref )
62  {
63  wxASSERT( ref->first == "ref" );
64 
65  wxString reference = (UTF8&) ref->second.front().first;
66 
67  // Ensure the "fpid" node contains a footprint name, and get it if exists
68  if( ref->second.get_child( "fpid" ).size() )
69  {
70  wxString tmp = (UTF8&) ref->second.get_child( "fpid" ).front().first;
71  footprint = tmp;
72  }
73  else
74  footprint.Empty();
75 
76  // Search the component in the flat list
77  for( unsigned ii = 0; ii < refs.GetCount(); ++ii )
78  {
79  if( reference == refs[ii].GetRef() )
80  {
81  // We have found a candidate.
82  // Note: it can be not unique (multiple parts per package)
83  // So we *do not* stop the search here
84  SCH_COMPONENT* component = refs[ ii ].GetSymbol();
85  // For backwards-compatibility CvPcb currently updates all instances of a
86  // component (even though it lists these instances separately).
87  SCH_SHEET_PATH* sheetPath = nullptr; // &refs[ii].GetSheetPath();
88  wxString oldfp = refs[ii].GetFootprint();
89 
90  if( oldfp.IsEmpty() && component->GetField( FOOTPRINT_FIELD )->IsVisible() )
91  component->GetField( FOOTPRINT_FIELD )->SetVisible( false );
92 
93  if( oldfp != footprint )
94  {
95  isChanged = true;
96  component->SetFootprint( sheetPath, footprint );
97  }
98  }
99  }
100  }
101  }
102  catch( const PTREE_ERROR& ex )
103  {
104  // remap the exception to something the caller is likely to understand.
105  THROW_IO_ERROR( ex.what() );
106  }
107 
108  if( isChanged )
109  {
110  m_frame->SyncView();
111  m_frame->GetCanvas()->Refresh();
112  m_frame->OnModify();
113  }
114 }
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
Definition: utf8.h:70
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:110
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
Definition: sch_symbol.cpp:693
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets.
void Scan(PTREE *aTree, DSNLEXER *aLexer)
Fill an empty PTREE with information from a KiCad s-expression stream.
Definition: ptree.cpp:86
bool IsVisible() const
Definition: eda_text.h:193
void SetVisible(bool aVisible)
Definition: eda_text.h:192
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
boost::property_tree::ptree PTREE
Definition: ptree.h:52
const PTREE CPTREE
Definition: ptree.h:53
void SyncView()
Mark all items for refresh.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
SCHEMATIC & Schematic() const
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
boost::property_tree::ptree_error PTREE_ERROR
Definition: ptree.h:54
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...
unsigned GetCount() const
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:87
Schematic symbol object.
Definition: sch_symbol.h:78
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
#define THROW_IO_ERROR(msg)
Definition: ki_exception.h:38
Implement a lexical analyzer for the SPECCTRA DSN file format.
Definition: dsnlexer.h:78
void SetFootprint(const SCH_SHEET_PATH *sheet, const wxString &aFootprint)
Definition: sch_symbol.cpp:664
Field Name Module PCB, i.e. "16DIP300".

References FOOTPRINT_FIELD, FROM_UTF8(), SCH_BASE_FRAME::GetCanvas(), SCH_REFERENCE_LIST::GetCount(), SCH_COMPONENT::GetField(), SCHEMATIC::GetSheets(), SCH_SHEET_LIST::GetSymbols(), EDA_TEXT::IsVisible(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, SCH_EDIT_FRAME::OnModify(), EDA_DRAW_PANEL_GAL::Refresh(), Scan(), SCH_EDIT_FRAME::Schematic(), SCH_COMPONENT::SetFootprint(), EDA_TEXT::SetVisible(), SCH_BASE_FRAME::SyncView(), and THROW_IO_ERROR.

Referenced by SCH_EDIT_FRAME::KiwayMailIn().

◆ AssignNetclass()

int SCH_EDITOR_CONTROL::AssignNetclass ( const TOOL_EVENT aEvent)

Definition at line 898 of file sch_editor_control.cpp.

899 {
902  VECTOR2D cursorPos = controls->GetCursorPosition( !aEvent.Modifier( MD_ALT ) );
903 
904  // TODO remove once real-time connectivity is a given
906  // Ensure the netlist data is up to date:
908 
909  // Remove selection in favor of highlighting so the whole net is highlighted
910  selectionTool->ClearSelection();
911  highlightNet( m_toolMgr, cursorPos );
912 
914 
915  if( conn )
916  {
917  if( !conn->Driver() || CONNECTION_SUBGRAPH::GetDriverPriority( conn->Driver() )
919  {
920  m_frame->ShowInfoBarError( _( "Net must be labeled to assign a netclass." ) );
922  return 0;
923  }
924 
925  wxString netName = conn->Name();
927  wxString netclassName = netSettings.GetNetclassName( netName );
928 
929  wxArrayString headers;
930  std::vector<wxArrayString> items;
931 
932  headers.Add( _( "Netclasses" ) );
933 
934  wxArrayString defaultItem;
935  defaultItem.Add( _( "Default" ) );
936  items.emplace_back( defaultItem );
937 
938  for( const auto& ii : netSettings.m_NetClasses )
939  {
940  wxArrayString item;
941  item.Add( ii.first );
942  items.emplace_back( item );
943  }
944 
945  EDA_LIST_DIALOG dlg( m_frame, _( "Assign Netclass" ), headers, items, netclassName );
946  dlg.SetListLabel( _( "Select netclass:" ) );
947 
948  if( dlg.ShowModal() == wxID_OK )
949  {
950  netclassName = dlg.GetTextSelection();
951 
952  // Remove from old netclass membership list
953  if( netSettings.m_NetClassAssignments.count( netName ) )
954  {
955  const wxString oldNetclassName = netSettings.m_NetClassAssignments[ netName ];
956  NETCLASSPTR oldNetclass = netSettings.m_NetClasses.Find( oldNetclassName );
957 
958  if( oldNetclass )
959  oldNetclass->Remove( netName );
960  }
961 
962  // Add to new netclass membership list
963  NETCLASSPTR newNetclass = netSettings.m_NetClasses.Find( netclassName );
964 
965  if( newNetclass )
966  newNetclass->Add( netName );
967 
968  netSettings.m_NetClassAssignments[ netName ] = netclassName;
969  netSettings.ResolveNetClassAssignments();
970  }
971  }
972 
974  return 0;
975 }
std::map< wxString, wxString > m_NetClassAssignments
Definition: net_settings.h:43
NETCLASSPTR Find(const wxString &aName) const
Search this container for a NETCLASS given by aName.
Definition: netclass.cpp:132
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generate the connection data for the entire schematic hierarchy.
const wxString & GetNetclassName(const wxString &aNetName) const
const SCH_CONNECTION * GetHighlightedConnection() const
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:145
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
NET_SETTINGS & NetSettings()
Definition: project_file.h:94
A dialog which shows:
NETCLASSES m_NetClasses
Definition: net_settings.h:39
wxString Name(bool aIgnoreSheet=false) const
void ResolveNetClassAssignments(bool aRebuildFromScratch=false)
Explodes the list of netclass assignments to include atomic members of composite labels (buses).
SCHEMATIC & Schematic() const
SCH_ITEM * Driver() const
An interface for classes handling user events controlling the view behavior such as zooming,...
NET_SETTINGS stores various net-related settings in a project context.
Definition: net_settings.h:31
static bool highlightNet(TOOL_MANAGER *aToolMgr, const VECTOR2D &aPosition)
static VECTOR2D CLEAR
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:75
int Modifier(int aMask=MD_MODIFIER_MASK) const
Definition: tool_event.h:352
static bool m_allowRealTime
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
int ClearSelection(const TOOL_EVENT &aEvent)
Select all visible items in sheet.
#define _(s)
Definition: 3d_actions.cpp:33
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
bool m_RealTimeConnectivity
Do real-time connectivity.
PRIORITY GetDriverPriority()

References _, CLEAR, EE_SELECTION_TOOL::ClearSelection(), SCH_CONNECTION::Driver(), NETCLASSES::Find(), ADVANCED_CFG::GetCfg(), CONNECTION_SUBGRAPH::GetDriverPriority(), SCH_EDIT_FRAME::GetHighlightedConnection(), NET_SETTINGS::GetNetclassName(), PROJECT::GetProjectFile(), EDA_LIST_DIALOG::GetTextSelection(), TOOL_MANAGER::GetTool(), TOOL_BASE::getViewControls(), highlightNet(), CONNECTION_GRAPH::m_allowRealTime, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, NET_SETTINGS::m_NetClassAssignments, NET_SETTINGS::m_NetClasses, ADVANCED_CFG::m_RealTimeConnectivity, TOOL_BASE::m_toolMgr, MD_ALT, TOOL_EVENT::Modifier(), SCH_CONNECTION::Name(), PROJECT_FILE::NetSettings(), NO_CLEANUP, SCHEMATIC::Prj(), SCH_EDIT_FRAME::RecalculateConnections(), NET_SETTINGS::ResolveNetClassAssignments(), SCH_EDIT_FRAME::Schematic(), EDA_LIST_DIALOG::SetListLabel(), CONNECTION_SUBGRAPH::SHEET_PIN, and EDA_BASE_FRAME::ShowInfoBarError().

Referenced by setTransitions().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Set the TOOL_MANAGER the tool will belong to.

Called by TOOL_MANAGER::RegisterTool()

Definition at line 60 of file tool_base.cpp.

61 {
62  m_toolMgr = aManager;
63 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ ClearHighlight()

int SCH_EDITOR_CONTROL::ClearHighlight ( const TOOL_EVENT aEvent)

Update net highlighting after an edit.

Definition at line 890 of file sch_editor_control.cpp.

891 {
893 
894  return 0;
895 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
static bool highlightNet(TOOL_MANAGER *aToolMgr, const VECTOR2D &aPosition)
static VECTOR2D CLEAR

References CLEAR, highlightNet(), and TOOL_BASE::m_toolMgr.

Referenced by setTransitions().

◆ Copy()

int SCH_EDITOR_CONTROL::Copy ( const TOOL_EVENT aEvent)

Definition at line 1281 of file sch_editor_control.cpp.

1282 {
1283  wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( wxWindow::FindFocus() );
1284 
1285  if( textEntry )
1286  {
1287  textEntry->Copy();
1288  return 0;
1289  }
1290 
1291  doCopy();
1292 
1293  return 0;
1294 }
bool doCopy()
< copy selection to clipboard

References doCopy().

Referenced by setTransitions().

◆ CrossProbeToPcb()

int SCH_EDITOR_CONTROL::CrossProbeToPcb ( const TOOL_EVENT aEvent)

Equivalent to the above, but initiated by the user.

We also do SCH_SHEETs on this one (they're too slow on big projects for the auto version above).

Definition at line 520 of file sch_editor_control.cpp.

521 {
522  doCrossProbeSchToPcb( aEvent, false );
523  return 0;
524 }
void doCrossProbeSchToPcb(const TOOL_EVENT &aEvent, bool aForce)

References doCrossProbeSchToPcb().

Referenced by setTransitions().

◆ Cut()

int SCH_EDITOR_CONTROL::Cut ( const TOOL_EVENT aEvent)

Definition at line 1264 of file sch_editor_control.cpp.

1265 {
1266  wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( wxWindow::FindFocus() );
1267 
1268  if( textEntry )
1269  {
1270  textEntry->Cut();
1271  return 0;
1272  }
1273 
1274  if( doCopy() )
1276 
1277  return 0;
1278 }
static TOOL_ACTION doDelete
Definition: actions.h:75
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
bool doCopy()
< copy selection to clipboard

References doCopy(), ACTIONS::doDelete, TOOL_BASE::m_toolMgr, and TOOL_MANAGER::RunAction().

Referenced by setTransitions().

◆ doCopy()

bool SCH_EDITOR_CONTROL::doCopy ( )
private

< copy selection to clipboard

Definition at line 1217 of file sch_editor_control.cpp.

1218 {
1220  EE_SELECTION& selection = selTool->RequestSelection();
1221  SCHEMATIC& schematic = m_frame->Schematic();
1222 
1223  if( !selection.GetSize() )
1224  return false;
1225 
1226  selection.SetScreen( m_frame->GetScreen() );
1227  m_supplementaryClipboard.clear();
1228 
1229  for( EDA_ITEM* item : selection )
1230  {
1231  if( item->Type() == SCH_SHEET_T )
1232  {
1233  SCH_SHEET* sheet = (SCH_SHEET*) item;
1234  m_supplementaryClipboard[ sheet->GetFileName() ] = sheet->GetScreen();
1235  }
1236  }
1237 
1239  schematic.GetSheets().GetSymbols( m_supplementaryClipboardInstances, true, true );
1241 
1242  STRING_FORMATTER formatter;
1243  SCH_SEXPR_PLUGIN plugin;
1244 
1245  plugin.Format( &selection, &m_frame->GetCurrentSheet(), &formatter );
1246 
1247  return m_toolMgr->SaveClipboard( formatter.GetString() );
1248 }
void Format(SCH_SHEET *aSheet)
Holds all the data relating to one schematic.
Definition: schematic.h:59
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets.
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
SCH_SCREEN * GetScreen() const
Definition: sch_sheet.h:103
KIID_PATH m_supplementaryClipboardPath
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Return either an existing selection (filtered), or the selection at the current cursor if the existin...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
std::map< wxString, SCH_SCREEN * > m_supplementaryClipboard
SCHEMATIC & Schematic() const
const std::string & GetString()
Definition: richio.h:435
wxString GetFileName() const
Return the filename corresponding to this sheet.
Definition: sch_sheet.h:315
SCH_REFERENCE_LIST m_supplementaryClipboardInstances
A SCH_PLUGIN derivation for loading schematic files using the new s-expression file format.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:87
bool SaveClipboard(const std::string &aTextUTF8)
Store information to the system clipboard.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
SCH_SHEET_PATH & GetCurrentSheet() const
Implement an OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:411

References SCH_REFERENCE_LIST::Clear(), SCH_SEXPR_PLUGIN::Format(), SCH_EDIT_FRAME::GetCurrentSheet(), SCH_SHEET::GetFileName(), SCH_SHEET::GetScreen(), SCH_EDIT_FRAME::GetScreen(), SCHEMATIC::GetSheets(), STRING_FORMATTER::GetString(), SCH_SHEET_LIST::GetSymbols(), TOOL_MANAGER::GetTool(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_supplementaryClipboard, m_supplementaryClipboardInstances, m_supplementaryClipboardPath, TOOL_BASE::m_toolMgr, SCH_SHEET_PATH::Path(), EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::SaveClipboard(), SCH_SHEET_T, SCH_EDIT_FRAME::Schematic(), and EDA_ITEM::Type().

Referenced by Copy(), and Cut().

◆ doCrossProbeSchToPcb()

void SCH_EDITOR_CONTROL::doCrossProbeSchToPcb ( const TOOL_EVENT aEvent,
bool  aForce 
)
private

Definition at line 534 of file sch_editor_control.cpp.

535 {
536  // Don't get in an infinite loop SCH -> PCB -> SCH -> PCB -> SCH -> ...
537  if( m_probingPcbToSch )
538  return;
539 
541  SCH_ITEM* item = nullptr;
542  SCH_COMPONENT* symbol = nullptr;
543 
544  if( aForce )
545  {
546  EE_SELECTION& selection = selTool->RequestSelection();
547 
548  if( selection.GetSize() >= 1 )
549  item = (SCH_ITEM*) selection.Front();
550  }
551  else
552  {
553  EE_SELECTION& selection = selTool->GetSelection();
554 
555  if( selection.GetSize() >= 1 )
556  item = (SCH_ITEM*) selection.Front();
557  }
558 
559  if( !item )
560  {
561  if( aForce )
562  m_frame->SendMessageToPCBNEW( nullptr, nullptr );
563 
564  return;
565  }
566 
567 
568  switch( item->Type() )
569  {
570  case SCH_FIELD_T:
571  case LIB_FIELD_T:
572  if( item->GetParent() && item->GetParent()->Type() == SCH_COMPONENT_T )
573  {
574  symbol = (SCH_COMPONENT*) item->GetParent();
575  m_frame->SendMessageToPCBNEW( item, symbol );
576  }
577  break;
578 
579  case SCH_COMPONENT_T:
580  symbol = (SCH_COMPONENT*) item;
581  m_frame->SendMessageToPCBNEW( item, symbol );
582  break;
583 
584  case SCH_PIN_T:
585  symbol = (SCH_COMPONENT*) item->GetParent();
586  m_frame->SendMessageToPCBNEW( static_cast<SCH_PIN*>( item ), symbol );
587  break;
588 
589  case SCH_SHEET_T:
590  if( aForce )
591  m_frame->SendMessageToPCBNEW( item, nullptr );
592  break;
593 
594  default:
595  break;
596  }
597 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
EE_SELECTION & GetSelection()
Return the set of currently selected items.
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Return either an existing selection (filtered), or the selection at the current cursor if the existin...
void SendMessageToPCBNEW(EDA_ITEM *aObjectToSync, SCH_COMPONENT *aPart)
Send a message to Pcbnew via a socket connection.
EDA_ITEM * GetParent() const
Definition: eda_item.h:165
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:101
Schematic symbol object.
Definition: sch_symbol.h:78
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:197
EDA_ITEM * Front() const
Definition: selection.h:203

References SELECTION::Front(), EDA_ITEM::GetParent(), EE_SELECTION_TOOL::GetSelection(), SELECTION::GetSize(), TOOL_MANAGER::GetTool(), LIB_FIELD_T, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_probingPcbToSch, TOOL_BASE::m_toolMgr, EE_SELECTION_TOOL::RequestSelection(), SCH_COMPONENT_T, SCH_FIELD_T, SCH_PIN_T, SCH_SHEET_T, and SCH_EDIT_FRAME::SendMessageToPCBNEW().

Referenced by CrossProbeToPcb(), and ExplicitCrossProbeToPcb().

◆ DrawSheetOnClipboard()

int SCH_EDITOR_CONTROL::DrawSheetOnClipboard ( const TOOL_EVENT aEvent)

Definition at line 1685 of file sch_editor_control.cpp.

1686 {
1688  return 0;
1689 }
void DrawCurrentSheetToClipboard()
Use the wxWidgets print code to draw an image of the current sheet onto the clipboard.
Definition: sheet.cpp:481

References SCH_EDIT_FRAME::DrawCurrentSheetToClipboard(), and EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame.

Referenced by setTransitions().

◆ EditSymbolFields()

int SCH_EDITOR_CONTROL::EditSymbolFields ( const TOOL_EVENT aEvent)

Definition at line 1625 of file sch_editor_control.cpp.

1626 {
1628  dlg.ShowQuasiModal();
1629  return 0;
1630 }

References EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, and DIALOG_SHIM::ShowQuasiModal().

Referenced by setTransitions().

◆ EditSymbolLibraryLinks()

int SCH_EDITOR_CONTROL::EditSymbolLibraryLinks ( const TOOL_EVENT aEvent)

Definition at line 1633 of file sch_editor_control.cpp.

1634 {
1636  m_frame->HardRedraw();
1637 
1638  return 0;
1639 }
void HardRedraw() override
Rebuild the GAL and redraw the screen.
bool InvokeDialogEditComponentsLibId(SCH_EDIT_FRAME *aCaller)
Run a dialog to modify the LIB_ID of components for instance when a symbol has moved from a symbol li...

References SCH_EDIT_FRAME::HardRedraw(), InvokeDialogEditComponentsLibId(), and EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame.

Referenced by setTransitions().

◆ EditWithSymbolEditor()

int SCH_EDITOR_CONTROL::EditWithSymbolEditor ( const TOOL_EVENT aEvent)

Definition at line 1586 of file sch_editor_control.cpp.

1587 {
1590  SCH_COMPONENT* symbol = nullptr;
1591  SYMBOL_EDIT_FRAME* symbolEditor;
1592 
1593  if( selection.GetSize() >= 1 )
1594  symbol = (SCH_COMPONENT*) selection.Front();
1595 
1596  if( !symbol || symbol->GetEditFlags() != 0 )
1597  return 0;
1598 
1600  symbolEditor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false );
1601 
1602  if( symbolEditor )
1603  symbolEditor->LoadSymbolFromSchematic( symbol );
1604 
1605  return 0;
1606 }
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:56
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:357
static const KICAD_T ComponentsOnly[]
Definition: ee_collectors.h:48
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Return either an existing selection (filtered), or the selection at the current cursor if the existin...
STATUS_FLAGS GetEditFlags() const
Definition: eda_item.h:208
void LoadSymbolFromSchematic(SCH_COMPONENT *aSymbol)
Load a symbol from the schematic to edit in place.
static TOOL_ACTION showSymbolEditor
Definition: actions.h:163
Schematic symbol object.
Definition: sch_symbol.h:78
The symbol library editor main window.

References EE_COLLECTOR::ComponentsOnly, FRAME_SCH_SYMBOL_EDITOR, EDA_ITEM::GetEditFlags(), TOOL_MANAGER::GetTool(), KIWAY_HOLDER::Kiway(), SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, KIWAY::Player(), EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), and ACTIONS::showSymbolEditor.

Referenced by setTransitions().

◆ EnterSheet()

int SCH_EDITOR_CONTROL::EnterSheet ( const TOOL_EVENT aEvent)

Definition at line 1699 of file sch_editor_control.cpp.

1700 {
1702  const EE_SELECTION& selection = selTool->RequestSelection( EE_COLLECTOR::SheetsOnly );
1703 
1704  if( selection.GetSize() == 1 )
1705  {
1706  SCH_SHEET* sheet = (SCH_SHEET*) selection.Front();
1707 
1710 
1711  // Store the current zoom level into the current screen before switching
1713 
1714  m_frame->GetCurrentSheet().push_back( sheet );
1717  }
1718 
1719  return 0;
1720 }
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
double m_LastZoomLevel
last value for the zoom level, useful in Eeschema when changing the current displayed sheet to reuse ...
Definition: sch_screen.h:473
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
void DisplayCurrentSheet()
Draw the current sheet on the display.
Definition: hierarch.cpp:289
static const KICAD_T SheetsOnly[]
Definition: ee_collectors.h:49
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Return either an existing selection (filtered), or the selection at the current cursor if the existin...
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.
void UpdateHierarchyNavigator(bool aForceUpdate=false)
Run the Hierarchy Navigator dialog.
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
SCH_SHEET_PATH & GetCurrentSheet() const
double GetScale() const
Definition: view.h:263

References ACTIONS::cancelInteractive, EE_ACTIONS::clearSelection, SCH_EDIT_FRAME::DisplayCurrentSheet(), SCH_BASE_FRAME::GetCanvas(), SCH_EDIT_FRAME::GetCurrentSheet(), KIGFX::VIEW::GetScale(), SCH_EDIT_FRAME::GetScreen(), TOOL_MANAGER::GetTool(), SCH_DRAW_PANEL::GetView(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, SCH_SCREEN::m_LastZoomLevel, TOOL_BASE::m_toolMgr, SCH_SHEET_PATH::push_back(), EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), EE_COLLECTOR::SheetsOnly, and SCH_EDIT_FRAME::UpdateHierarchyNavigator().

Referenced by setTransitions().

◆ ExplicitCrossProbeToPcb()

int SCH_EDITOR_CONTROL::ExplicitCrossProbeToPcb ( const TOOL_EVENT aEvent)

Definition at line 527 of file sch_editor_control.cpp.

528 {
529  doCrossProbeSchToPcb( aEvent, true );
530  return 0;
531 }
void doCrossProbeSchToPcb(const TOOL_EVENT &aEvent, bool aForce)

References doCrossProbeSchToPcb().

Referenced by setTransitions().

◆ ExportNetlist()

int SCH_EDITOR_CONTROL::ExportNetlist ( const TOOL_EVENT aEvent)

Definition at line 1666 of file sch_editor_control.cpp.

1667 {
1668  int result = NET_PLUGIN_CHANGE;
1669 
1670  // If a plugin is removed or added, rebuild and reopen the new dialog
1671  while( result == NET_PLUGIN_CHANGE )
1672  result = InvokeDialogNetList( m_frame );
1673 
1674  return 0;
1675 }
#define NET_PLUGIN_CHANGE
Create and shows NETLIST_DIALOG and returns whatever NETLIST_DIALOG::ShowModal() returns.
int InvokeDialogNetList(SCH_EDIT_FRAME *aCaller)

References InvokeDialogNetList(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, and NET_PLUGIN_CHANGE.

Referenced by setTransitions().

◆ FindAndReplace()

int SCH_EDITOR_CONTROL::FindAndReplace ( const TOOL_EVENT aEvent)

Definition at line 231 of file sch_editor_control.cpp.

232 {
234  return UpdateFind( aEvent );
235 }
static TOOL_ACTION findAndReplace
Definition: actions.h:80
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:70
int UpdateFind(const TOOL_EVENT &aEvent)
Notifies pcbnew about the selected item.
void ShowFindReplaceDialog(bool aReplace)
Run the Find or Find & Replace dialog.

References ACTIONS::findAndReplace, TOOL_EVENT::IsAction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, SCH_EDIT_FRAME::ShowFindReplaceDialog(), and UpdateFind().

Referenced by FindNext(), ReplaceAll(), ReplaceAndFindNext(), and setTransitions().

◆ FindComponentAndItem()

SCH_ITEM * SCH_EDITOR_CONTROL::FindComponentAndItem ( const wxString &  aReference,
bool  aSearchHierarchy,
SCH_SEARCH_T  aSearchType,
const wxString &  aSearchText 
)

Find a component in the schematic and an item in this component.

Parameters
aReferenceThe component reference designator to find.
aSearchHierarchyIf false, search the current sheet only. Otherwise, the entire hierarchy
aSearchTypeA SCH_SEARCH_T value used to determine what to search for.
aSearchTextThe text to search for, either in value, reference or elsewhere.

Definition at line 43 of file eeschema/cross-probing.cpp.

47 {
48  SCH_SHEET_PATH* sheetWithComponentFound = NULL;
49  SCH_COMPONENT* component = NULL;
50  wxPoint pos;
51  SCH_PIN* pin = nullptr;
52  SCH_SHEET_LIST sheetList;
53  SCH_ITEM* foundItem = nullptr;
54 
55  if( !aSearchHierarchy )
56  sheetList.push_back( m_frame->GetCurrentSheet() );
57  else
58  sheetList = m_frame->Schematic().GetSheets();
59 
60  for( SCH_SHEET_PATH& sheet : sheetList )
61  {
62  SCH_SCREEN* screen = sheet.LastScreen();
63 
64  for( auto item : screen->Items().OfType( SCH_COMPONENT_T ) )
65  {
66  SCH_COMPONENT* candidate = static_cast<SCH_COMPONENT*>( item );
67 
68  if( aReference.CmpNoCase( candidate->GetRef( &sheet ) ) == 0 )
69  {
70  component = candidate;
71  sheetWithComponentFound = &sheet;
72 
73  if( aSearchType == HIGHLIGHT_PIN )
74  {
75  pos = component->GetPosition(); // temporary: will be changed if the pin is found.
76  pin = component->GetPin( aSearchText );
77 
78  // Ensure we have found the right unit in case of multi-units symbol
79  if( pin )
80  {
81  int unit = pin->GetLibPin()->GetUnit();
82 
83  if( unit != 0 && unit != component->GetUnit() )
84  {
85  pin = nullptr;
86  continue;
87  }
88 
89  // Get pin position in true schematic coordinate
90  pos = pin->GetPosition();
91  foundItem = pin;
92  break;
93  }
94  }
95  else
96  {
97  pos = component->GetPosition();
98  foundItem = component;
99  break;
100  }
101  }
102  }
103 
104  if( foundItem )
105  break;
106  }
107 
108  CROSS_PROBING_SETTINGS& crossProbingSettings = m_frame->eeconfig()->m_CrossProbing;
109 
110 
111  if( component )
112  {
113  if( *sheetWithComponentFound != m_frame->GetCurrentSheet() )
114  {
115  m_frame->Schematic().SetCurrentSheet( *sheetWithComponentFound );
117  }
118 
119  if( crossProbingSettings.center_on_items )
120  {
122  m_frame->CenterScreen( pos, false );
123 
124  if( crossProbingSettings.zoom_to_fit )
125  {
126 //#define COMP_1_TO_1_RATIO // Un-comment for normal KiCad full screen zoom cross-probe
127 #ifdef COMP_1_TO_1_RATIO
128  // Pass "false" to only include visible fields of component in bbox calculations
129  EDA_RECT bbox = component->GetBoundingBox( false );
130  wxSize bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();
131  VECTOR2D screenSize = getView()->GetViewport().GetSize();
132 
133  // NOTE: The 1:1 here is using the default KiCad sizing, which adds a margin of 20%
134 
135  screenSize.x = std::max( 10.0, screenSize.x );
136  screenSize.y = std::max( 10.0, screenSize.y );
137  double ratio = std::max(
138  fabs( bbSize.x / screenSize.x ), fabs( bbSize.y / screenSize.y ) );
139 
140  // Try not to zoom on every cross-probe; it gets very noisy
141  if( ratio < 0.5 || ratio > 1.0 )
142  getView()->SetScale( getView()->GetScale() / ratio );
143 #endif // COMP_1_TO_1_RATIO
144 
145 #ifndef COMP_1_TO_1_RATIO // Do the scaled zoom
146  // Pass "false" to only include visible fields of component in bbox calculations
147  EDA_RECT bbox = component->GetBoundingBox( false );
148  wxSize bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();
149  VECTOR2D screenSize = getView()->GetViewport().GetSize();
150 
151  // This code tries to come up with a zoom factor that doesn't simply zoom in
152  // to the cross probed component, but instead shows a reasonable amount of the
153  // circuit around it to provide context. This reduces or eliminates the need
154  // to manually change the zoom because it's too close.
155 
156  // Using the default text height as a constant to compare against, use the
157  // height of the bounding box of visible items for a footprint to figure out
158  // if this is a big symbol (like a processor) or a small symbol (like a resistor).
159  // This ratio is not useful by itself as a scaling factor. It must be "bent" to
160  // provide good scaling at varying component sizes. Bigger components need less
161  // scaling than small ones.
162  double currTextHeight = Mils2iu( DEFAULT_TEXT_SIZE );
163 
164  double compRatio = bbSize.y / currTextHeight; // Ratio of component to text height
165  double compRatioBent = 1.0;
166 
167  // LUT to scale zoom ratio to provide reasonable schematic context. Must work
168  // with symbols of varying sizes (e.g. 0402 package and 200 pin BGA).
169  // "first" is used as the input and "second" as the output
170  //
171  // "first" = compRatio (symbol height / default text height)
172  // "second" = Amount to scale ratio by
173  std::vector<std::pair<double, double>> lut
174  {
175  {1.25, 16}, // 32
176  {2.5, 12}, //24
177  {5, 8}, // 16
178  {6, 6}, //
179  {10, 4}, //8
180  {20, 2}, //4
181  {40, 1.5}, // 2
182  {100, 1}
183  };
184 
185  std::vector<std::pair<double, double>>::iterator it;
186 
187  compRatioBent =
188  lut.back().second; // Large component default is last LUT entry (1:1)
189 
190  // Use LUT to do linear interpolation of "compRatio" within "first", then
191  // use that result to linearly interpolate "second" which gives the scaling
192  // factor needed.
193 
194  if( compRatio >= lut.front().first )
195  {
196  for( it = lut.begin(); it < lut.end() - 1; it++ )
197  {
198  if( it->first <= compRatio && next( it )->first >= compRatio )
199  {
200 
201  double diffx = compRatio - it->first;
202  double diffn = next( it )->first - it->first;
203 
204  compRatioBent = it->second
205  + ( next( it )->second - it->second ) * diffx / diffn;
206  break; // We have our interpolated value
207  }
208  }
209  }
210  else
211  compRatioBent = lut.front().second; // Small component default is first entry
212 
213  // This is similar to the original KiCad code that scaled the zoom to make sure
214  // components were visible on screen. It's simply a ratio of screen size to component
215  // size, and its job is to zoom in to make the component fullscreen. Earlier in the
216  // code the component BBox is given a 20% margin to add some breathing room. We compare
217  // the height of this enlarged component bbox to the default text height. If a
218  // component will end up with the sides clipped, we adjust later to make sure it fits
219  // on screen.
220  screenSize.x = std::max( 10.0, screenSize.x );
221  screenSize.y = std::max( 10.0, screenSize.y );
222  double ratio = std::max( -1.0, fabs( bbSize.y / screenSize.y ) );
223  // Original KiCad code for how much to scale the zoom
224  double kicadRatio = std::max( fabs( bbSize.x / screenSize.x ),
225  fabs( bbSize.y / screenSize.y ) );
226 
227  // If the width of the part we're probing is bigger than what the screen width will be
228  // after the zoom, then punt and use the KiCad zoom algorithm since it guarantees the
229  // part's width will be encompassed within the screen.
230 
231  if( bbSize.x > screenSize.x * ratio * compRatioBent )
232  {
233  ratio = kicadRatio; // Use standard KiCad zoom for parts too wide to fit on screen
234  compRatioBent = 1.0; // Reset so we don't modify the "KiCad" ratio
235  wxLogTrace( "CROSS_PROBE_SCALE",
236  "Part TOO WIDE for screen. Using normal KiCad zoom ratio: %1.5f",
237  ratio );
238  }
239 
240  // Now that "compRatioBent" holds our final scaling factor we apply it to the original
241  // fullscreen zoom ratio to arrive at the final ratio itself.
242  ratio *= compRatioBent;
243 
244  bool alwaysZoom = false; // DEBUG - allows us to minimize zooming or not
245  // Try not to zoom on every cross-probe; it gets very noisy
246  if( ( ratio < 0.5 || ratio > 1.0 ) || alwaysZoom )
247  getView()->SetScale( getView()->GetScale() / ratio );
248 #endif // ifndef COMP_1_TO_1_RATIO
249  }
250  }
251  }
252 
253  /* Print diag */
254  wxString msg;
255 
256  if( component )
257  {
258  if( aSearchType == HIGHLIGHT_PIN )
259  {
260  if( foundItem )
261  msg.Printf( _( "%s pin %s found" ), aReference, aSearchText );
262  else
263  msg.Printf( _( "%s found but pin %s not found" ), aReference, aSearchText );
264  }
265  else
266  {
267  msg.Printf( _( "%s found" ), aReference );
268  }
269  }
270  else
271  {
272  msg.Printf( _( "%s not found" ), aReference );
273  }
274 
275  m_frame->SetStatusText( msg );
276 
277  m_probingPcbToSch = true; // recursion guard
278  {
279  // Clear any existing highlighting
281 
282  if( foundItem )
283  m_toolMgr->RunAction( EE_ACTIONS::addItemToSel, true, foundItem );
284  }
285  m_probingPcbToSch = false;
286 
287  m_frame->GetCanvas()->Refresh();
288 
289  return foundItem;
290 }
CITER next(CITER it)
Definition: ptree.cpp:126
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
EE_TYPE OfType(KICAD_T aType) const
Definition: sch_rtree.h:216
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
Definition: view.cpp:514
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return a pointer to the #VIEW_CONTROLS instance used in the panel.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
int GetWidth() const
Definition: eda_rect.h:114
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
void DisplayCurrentSheet()
Draw the current sheet on the display.
Definition: hierarch.cpp:289
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
EESCHEMA_SETTINGS * eeconfig() const
Cross-probing behavior.
Definition: app_settings.h:30
int GetUnit() const
Definition: sch_symbol.h:195
static TOOL_ACTION addItemToSel
Selects an item (specified as the event parameter).
Definition: ee_actions.h:57
#define NULL
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
SCHEMATIC & Schematic() const
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Move the graphic crosshair cursor to the requested position expressed in world coordinates.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
bool zoom_to_fit
Zoom to fit items (ignored if center_on_items is off)
Definition: app_settings.h:33
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Set the scaling factor, zooming around a given anchor point.
Definition: view.cpp:554
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:87
#define _(s)
Definition: 3d_actions.cpp:33
EE_RTREE & Items()
Definition: sch_screen.h:103
Handle the component boundary box.
Definition: eda_rect.h:42
Schematic symbol object.
Definition: sch_symbol.h:78
wxPoint GetPosition() const override
Definition: sch_symbol.h:641
void SetCurrentSheet(const SCH_SHEET_PATH &aPath) override
Definition: schematic.h:124
SCH_SHEET_PATH & GetCurrentSheet() const
virtual void CenterScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
#define DEFAULT_TEXT_SIZE
Ratio of the font height to the baseline of the text above the wire.
const Vec & GetSize() const
Definition: box2.h:189
CROSS_PROBING_SETTINGS m_CrossProbing
Definition: app_settings.h:167
bool center_on_items
Automatically pan to cross-probed items.
Definition: app_settings.h:32
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:197
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:363
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
Definition: sch_symbol.cpp:432
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
Definition: sch_symbol.cpp:858

References _, EE_ACTIONS::addItemToSel, CROSS_PROBING_SETTINGS::center_on_items, SCH_BASE_FRAME::CenterScreen(), EE_ACTIONS::clearSelection, DEFAULT_TEXT_SIZE, SCH_EDIT_FRAME::DisplayCurrentSheet(), SCH_BASE_FRAME::eeconfig(), SCH_COMPONENT::GetBoundingBox(), SCH_BASE_FRAME::GetCanvas(), SCH_EDIT_FRAME::GetCurrentSheet(), SCH_COMPONENT::GetPin(), SCH_COMPONENT::GetPosition(), SCH_COMPONENT::GetRef(), SCHEMATIC::GetSheets(), BOX2< Vec >::GetSize(), SCH_COMPONENT::GetUnit(), TOOL_BASE::getView(), EDA_DRAW_PANEL_GAL::GetViewControls(), KIGFX::VIEW::GetViewport(), EDA_RECT::GetWidth(), HIGHLIGHT_PIN, EDA_RECT::Inflate(), SCH_SCREEN::Items(), APP_SETTINGS_BASE::m_CrossProbing, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_probingPcbToSch, TOOL_BASE::m_toolMgr, next(), NULL, EE_RTREE::OfType(), pin, EDA_DRAW_PANEL_GAL::Refresh(), TOOL_MANAGER::RunAction(), SCH_COMPONENT_T, SCH_EDIT_FRAME::Schematic(), KIGFX::VIEW_CONTROLS::SetCrossHairCursorPosition(), SCHEMATIC::SetCurrentSheet(), KIGFX::VIEW::SetScale(), VECTOR2< T >::x, VECTOR2< T >::y, and CROSS_PROBING_SETTINGS::zoom_to_fit.

◆ FindNext()

int SCH_EDITOR_CONTROL::FindNext ( const TOOL_EVENT aEvent)

Definition at line 362 of file sch_editor_control.cpp.

363 {
364  // A timer during which a subsequent FindNext will result in a wrap-around
365  static wxTimer wrapAroundTimer;
366 
367  wxFindReplaceData* data = m_frame->GetFindReplaceData();
368 
369  if( aEvent.IsAction( &ACTIONS::findNextMarker ) )
370  {
371  if( data )
372  g_markersOnly.SetFlags( data->GetFlags() );
373 
374  data = &g_markersOnly;
375  }
376  else if( !data )
377  {
378  return FindAndReplace( ACTIONS::find.MakeEvent() );
379  }
380 
381  bool searchAllSheets = !( data->GetFlags() & FR_CURRENT_SHEET_ONLY );
382  EE_SELECTION& selection = m_selectionTool->GetSelection();
383  SCH_SCREEN* afterScreen = m_frame->GetScreen();
384  SCH_ITEM* afterItem = dynamic_cast<SCH_ITEM*>( selection.Front() );
385  SCH_ITEM* item = nullptr;
386 
387  if( wrapAroundTimer.IsRunning() )
388  {
389  afterScreen = nullptr;
390  afterItem = nullptr;
391  wrapAroundTimer.Stop();
393  }
394 
396 
397  if( afterScreen || !searchAllSheets )
398  item = nextMatch( m_frame->GetScreen(), &m_frame->GetCurrentSheet(), afterItem, data );
399 
400  if( !item && searchAllSheets )
401  {
402  SCH_SHEET_LIST schematic = m_frame->Schematic().GetSheets();
403  SCH_SCREENS screens( m_frame->Schematic().Root() );
404 
405  for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
406  {
407  if( afterScreen )
408  {
409  if( afterScreen == screen )
410  afterScreen = nullptr;
411 
412  continue;
413  }
414 
415  SCH_SHEET_PATH* sheet = schematic.FindSheetForScreen( screen );
416 
417  item = nextMatch( screen, sheet, nullptr, data );
418 
419  if( item )
420  {
421  wxCHECK_MSG( sheet, 0, "Sheet not found for " + screen->GetFileName() );
422 
423  m_frame->Schematic().SetCurrentSheet( *sheet );
425 
426  screen->TestDanglingEnds();
427 
428  m_frame->SetScreen( screen );
429  UpdateFind( ACTIONS::updateFind.MakeEvent() );
430 
431  break;
432  }
433  }
434  }
435 
436  if( item )
437  {
438  m_selectionTool->AddItemToSel( item );
439  m_frame->FocusOnLocation( item->GetBoundingBox().GetCenter() );
440  m_frame->GetCanvas()->Refresh();
441  }
442  else
443  {
444  wxString msg = searchAllSheets ? _( "Reached end of schematic." )
445  : _( "Reached end of sheet." );
446 
447  // Show the popup during the time period the user can wrap the search
448  m_frame->ShowFindReplaceStatus( msg + wxS( " " ) + _( "Find again to wrap around to the start." ),
449  4000 );
450  wrapAroundTimer.StartOnce( 4000 );
451  }
452 
453  return 0;
454 }
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void ShowFindReplaceStatus(const wxString &aMsg, int aStatusTime)
int FindAndReplace(const TOOL_EVENT &aEvent)
wxFindReplaceData * GetFindReplaceData()
Get the find criteria (as set by the dialog).
SCH_SHEET_PATH * FindSheetForScreen(const SCH_SCREEN *aScreen)
Return a pointer to the first SCH_SHEET_PATH object (not necessarily the only one) using a particular...
void SetScreen(BASE_SCREEN *aScreen) override
static wxFindReplaceData g_markersOnly
void UpdateAllScreenReferences()
Update all the symbol references for this sheet path.
static TOOL_ACTION find
Definition: actions.h:79
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:70
EE_SELECTION & GetSelection()
Return the set of currently selected items.
static TOOL_ACTION updateFind
Definition: actions.h:85
SCH_ITEM * nextMatch(SCH_SCREEN *aScreen, SCH_SHEET_PATH *aSheet, SCH_ITEM *aAfter, wxFindReplaceData *aData)
Advance the search and returns the next matching item after aAfter.
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 UpdateFind(const TOOL_EVENT &aEvent)
Notifies pcbnew about the selected item.
SCHEMATIC & Schematic() const
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
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...
static TOOL_ACTION findNextMarker
Definition: actions.h:82
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:87
void ClearFindReplaceStatus()
SCH_SHEET & Root() const
Definition: schematic.h:92
int AddItemToSel(const TOOL_EVENT &aEvent)
int ClearSelection(const TOOL_EVENT &aEvent)
Select all visible items in sheet.
#define _(s)
Definition: 3d_actions.cpp:33
void SetCurrentSheet(const SCH_SHEET_PATH &aPath) override
Definition: schematic.h:124
SCH_SHEET_PATH & GetCurrentSheet() const
void FocusOnLocation(const wxPoint &aPos)
Useful to focus on a particular location, in find functions.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:197
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:549
EDA_ITEM * Front() const
Definition: selection.h:203

References _, EE_SELECTION_TOOL::AddItemToSel(), SCH_EDIT_FRAME::ClearFindReplaceStatus(), EE_SELECTION_TOOL::ClearSelection(), ACTIONS::find, FindAndReplace(), ACTIONS::findNextMarker, SCH_SHEET_LIST::FindSheetForScreen(), EDA_DRAW_FRAME::FocusOnLocation(), FR_CURRENT_SHEET_ONLY, SELECTION::Front(), g_markersOnly, SCH_BASE_FRAME::GetCanvas(), SCH_EDIT_FRAME::GetCurrentSheet(), SCH_EDIT_FRAME::GetFindReplaceData(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), SCHEMATIC::GetSheets(), TOOL_EVENT::IsAction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, nextMatch(), EDA_DRAW_PANEL_GAL::Refresh(), SCHEMATIC::Root(), SCH_EDIT_FRAME::Schematic(), SCHEMATIC::SetCurrentSheet(), SCH_EDIT_FRAME::SetScreen(), SCH_EDIT_FRAME::ShowFindReplaceStatus(), SCH_SHEET_PATH::UpdateAllScreenReferences(), UpdateFind(), and ACTIONS::updateFind.

Referenced by DIALOG_SCH_FIND::OnFind(), ReplaceAndFindNext(), and setTransitions().

◆ GenerateBOM()

int SCH_EDITOR_CONTROL::GenerateBOM ( const TOOL_EVENT aEvent)

Definition at line 1678 of file sch_editor_control.cpp.

1679 {
1681  return 0;
1682 }
int InvokeDialogCreateBOM(SCH_EDIT_FRAME *aCaller)
Create and show DIALOG_BOM and return whatever DIALOG_BOM::ShowModal() returns.
Definition: dialog_bom.cpp:106

References InvokeDialogCreateBOM(), and EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame.

Referenced by setTransitions().

◆ getEditFrame()

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

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

Definition at line 185 of file tool_base.h.

186  {
187 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
188  wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
189 #endif
190  return static_cast<T*>( getToolHolderInt() );
191  }
TOOLS_HOLDER * getToolHolderInt() const
Definition: tool_base.cpp:48

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 121 of file tool_base.h.

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

References TOOL_BASE::m_toolId.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::isActive(), TOOL_MANAGER::RegisterTool(), ACTION_MANAGER::RunHotKey(), TOOL_MANAGER::runTool(), TOOL_MANAGER::saveViewControls(), and TOOL_MANAGER::ShutdownTool().

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

Return the instance of TOOL_MANAGER that takes care of the tool.

Returns
Instance of the TOOL_MANAGER or NULL if there is no associated tool manager.

Definition at line 144 of file tool_base.h.

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

References TOOL_BASE::m_toolMgr.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ACTION_MENU::getToolManager(), LIB_TREE::onContextMenu(), ZONE_CREATE_HELPER::OnFirstPoint(), ACTION_MENU::OnMenuEvent(), and ZONE_CREATE_HELPER::performZoneCutout().

◆ getModel()

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

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 197 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Return the name of the tool.

Tool names are expected to obey the format: application.ToolName (eg. pcbnew.InteractiveSelection).

Returns
The name of the tool.

Definition at line 134 of file tool_base.h.

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

References TOOL_BASE::m_toolName.

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 109 of file tool_base.h.

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

References TOOL_BASE::m_type.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InvokeTool(), TOOL_MANAGER::ResetTools(), TOOL_MANAGER::runTool(), and TOOL_MANAGER::ShutdownTool().

◆ getView()

KIGFX::VIEW * TOOL_BASE::getView ( ) const
protectedinherited

Returns the instance of #VIEW object used in the application.

It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

37 {
38  return m_toolMgr->GetView();
39 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:289
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215

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

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), SCH_EDIT_TOOL::ChangeTextType(), EE_INSPECTION_TOOL::CheckSymbol(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::CollectHits(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomFit(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), FindComponentAndItem(), ROUTER_TOOL::getStartLayer(), PCB_CONTROL::GridResetOrigin(), PCB_CONTROL::GridSetOrigin(), ROUTER_TOOL::handleCommonEvents(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), PCB_SELECTION_TOOL::hitTestDistance(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), PL_EDIT_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), PL_EDIT_TOOL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), Paste(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), BOARD_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCB_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), PCB_SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), PCB_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectAll(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), ToggleHiddenFields(), ToggleHiddenPins(), SCH_DRAWING_TOOLS::TwoClickPlace(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), UpdateFind(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateItem(), UpdateNetHighlighting(), EE_POINT_EDITOR::updateParentItem(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), PCB_SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), PCB_SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and PCB_SELECTION_TOOL::~PCB_SELECTION_TOOL().

◆ getViewControls()

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

Return the instance of VIEW_CONTROLS object used in the application.

It allows tools to read & modify user input and its settings (eg. show cursor, enable snapping to grid, etc.).

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

43 {
44  return m_toolMgr->GetViewControls();
45 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:291

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

Referenced by EE_POINT_EDITOR::addCorner(), PCB_POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), AssignNetclass(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), EDIT_TOOL::copyToClipboard(), SCH_DRAWING_TOOLS::createSheetPin(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), BOARD_INSPECTION_TOOL::HighlightNet(), HighlightNet(), BOARD_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), PCB_POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), PCB_SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PCB_PICKER_TOOL::setControls(), PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateItem(), PL_EDIT_TOOL::updateModificationPoint(), EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

template<class T >
void TOOL_INTERACTIVE::Go ( int(T::*)(const TOOL_EVENT &)  aStateFunc,
const TOOL_EVENT_LIST aConditions = TOOL_EVENTTC_ANYTA_ANY ) 
)
inherited

Define which state (aStateFunc) to go when a certain event arrives (aConditions).

No conditions means any event.

Definition at line 128 of file tool_interactive.h.

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

References TOOL_INTERACTIVE::goInternal().

Referenced by AUTOPLACE_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), BOARD_REANNOTATE_TOOL::setTransitions(), GERBVIEW_INSPECTION_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), PCB_PICKER_TOOL::setTransitions(), SCH_NAVIGATE_TOOL::setTransitions(), SYMBOL_EDITOR_PIN_TOOL::setTransitions(), SYMBOL_EDITOR_MOVE_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), PL_POINT_EDITOR::setTransitions(), COMMON_CONTROL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), CONVERT_TOOL::setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), MICROWAVE_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), PAD_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PCB_POINT_EDITOR::setTransitions(), GERBVIEW_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GROUP_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), SYMBOL_EDITOR_CONTROL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), PL_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), FOOTPRINT_EDITOR_CONTROL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), PCB_CONTROL::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), DRC_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), BOARD_EDITOR_CONTROL::setTransitions(), BOARD_INSPECTION_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), PCB_SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), setTransitions(), DRAWING_TOOL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ HasMatch()

bool SCH_EDITOR_CONTROL::HasMatch ( )

Definition at line 457 of file sch_editor_control.cpp.

458 {
459  wxFindReplaceData* data = m_frame->GetFindReplaceData();
461 
462  return data && item && item->Matches( *data, &m_frame->GetCurrentSheet() );
463 }
virtual bool Matches(const wxFindReplaceData &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Definition: eda_item.h:415
wxFindReplaceData * GetFindReplaceData()
Get the find criteria (as set by the dialog).
EE_SELECTION & GetSelection()
Return the set of currently selected items.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
SCH_SHEET_PATH & GetCurrentSheet() const
EDA_ITEM * Front() const
Definition: selection.h:203

References SELECTION::Front(), SCH_EDIT_FRAME::GetCurrentSheet(), SCH_EDIT_FRAME::GetFindReplaceData(), EE_SELECTION_TOOL::GetSelection(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, and EDA_ITEM::Matches().

Referenced by DIALOG_SCH_FIND::OnUpdateReplaceUI().

◆ HighlightNet()

int SCH_EDITOR_CONTROL::HighlightNet ( const TOOL_EVENT aEvent)

< Highlight net under the cursor.

Remove any net highlighting

Definition at line 879 of file sch_editor_control.cpp.

880 {
882  VECTOR2D cursorPos = controls->GetCursorPosition( !aEvent.Modifier( MD_ALT ) );
883 
884  highlightNet( m_toolMgr, cursorPos );
885 
886  return 0;
887 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
An interface for classes handling user events controlling the view behavior such as zooming,...
static bool highlightNet(TOOL_MANAGER *aToolMgr, const VECTOR2D &aPosition)
int Modifier(int aMask=MD_MODIFIER_MASK) const
Definition: tool_event.h:352
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.

References KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_BASE::getViewControls(), highlightNet(), TOOL_BASE::m_toolMgr, MD_ALT, and TOOL_EVENT::Modifier().

Referenced by setTransitions().

◆ HighlightNetCursor()

int SCH_EDITOR_CONTROL::HighlightNetCursor ( const TOOL_EVENT aEvent)

Definition at line 1124 of file sch_editor_control.cpp.

1125 {
1126  // TODO(JE) remove once real-time connectivity is a given
1127  if( !ADVANCED_CFG::GetCfg().m_RealTimeConnectivity || !CONNECTION_GRAPH::m_allowRealTime )
1129 
1130  std::string tool = aEvent.GetCommandStr().get();
1131  PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
1132 
1133  // Deactivate other tools; particularly important if another PICKER is currently running
1134  Activate();
1135 
1136  picker->SetCursor( KICURSOR::BULLSEYE );
1137  picker->SetSnapping( false );
1138 
1139  picker->SetClickHandler(
1140  [this] ( const VECTOR2D& aPos )
1141  {
1142  return highlightNet( m_toolMgr, aPos );
1143  } );
1144 
1145  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
1146 
1147  return 0;
1148 }
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generate the connection data for the entire schematic hierarchy.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
static TOOL_ACTION pickerTool
Definition: actions.h:158
static bool highlightNet(TOOL_MANAGER *aToolMgr, const VECTOR2D &aPosition)
void SetCursor(KICURSOR aCursor)
Definition: picker_tool.h:60
void SetClickHandler(CLICK_HANDLER aHandler)
Set a handler for mouse click event.
Definition: picker_tool.h:69
static bool m_allowRealTime
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:471
void Activate()
Run the tool.
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
void SetSnapping(bool aSnap)
Definition: picker_tool.h:62

References TOOL_INTERACTIVE::Activate(), BULLSEYE, ADVANCED_CFG::GetCfg(), TOOL_EVENT::GetCommandStr(), TOOL_MANAGER::GetTool(), highlightNet(), CONNECTION_GRAPH::m_allowRealTime, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, NO_CLEANUP, ACTIONS::pickerTool, SCH_EDIT_FRAME::RecalculateConnections(), TOOL_MANAGER::RunAction(), PICKER_TOOL_BASE::SetClickHandler(), PICKER_TOOL_BASE::SetCursor(), and PICKER_TOOL_BASE::SetSnapping().

Referenced by setTransitions().

◆ ImportFPAssignments()

int SCH_EDITOR_CONTROL::ImportFPAssignments ( const TOOL_EVENT aEvent)

Definition at line 200 of file assign_footprints.cpp.

201 {
202  wxString path = wxPathOnly( m_frame->Prj().GetProjectFullName() );
203 
204  wxFileDialog dlg( m_frame, _( "Load Symbol Footprint Link File" ),
205  path, wxEmptyString,
207  wxFD_OPEN | wxFD_FILE_MUST_EXIST );
208 
209  if( dlg.ShowModal() == wxID_CANCEL )
210  return 0;
211 
212  wxString filename = dlg.GetPath();
213 
214  wxArrayString choices;
215  choices.Add( _( "Keep existing footprint field visibility" ) );
216  choices.Add( _( "Show all footprint fields" ) );
217  choices.Add( _( "Hide all footprint fields" ) );
218 
219  wxSingleChoiceDialog choiceDlg( m_frame, _( "Select the footprint field visibility setting." ),
220  _( "Change Visibility" ), choices );
221 
222  if( choiceDlg.ShowModal() == wxID_CANCEL )
223  return 0;
224 
225  bool forceVisibility = (choiceDlg.GetSelection() != 0 );
226  bool visibilityState = (choiceDlg.GetSelection() == 1 );
227 
228  if( !processCmpToFootprintLinkFile( filename, forceVisibility, visibilityState ) )
229  {
230  wxString msg = wxString::Format( _( "Failed to open component-footprint link file \"%s\"" ),
231  filename.GetData() );
232 
233  DisplayError( m_frame, msg );
234  return 0;
235  }
236 
237  m_frame->SyncView();
238  m_frame->GetCanvas()->Refresh();
239  m_frame->OnModify();
240  return 0;
241 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:252
wxString ComponentFileWildcard()
void SyncView()
Mark all items for refresh.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
bool processCmpToFootprintLinkFile(const wxString &aFullFilename, bool aForceVisibilityState, bool aVisibilityState)
Read the footprint info from each line in the stuff file by reference designator.
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
Definition: project.cpp:117
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
#define _(s)
Definition: 3d_actions.cpp:33
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...

References _, ComponentFileWildcard(), DisplayError(), Format(), SCH_BASE_FRAME::GetCanvas(), PROJECT::GetProjectFullName(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, SCH_EDIT_FRAME::OnModify(), path, KIWAY_HOLDER::Prj(), processCmpToFootprintLinkFile(), EDA_DRAW_PANEL_GAL::Refresh(), and SCH_BASE_FRAME::SyncView().

Referenced by setTransitions().

◆ Init()

bool EE_TOOL_BASE< SCH_EDIT_FRAME >::Init ( void  )
inlineoverridevirtualinherited

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

66  {
67  m_frame = getEditFrame<T>();
70 
71  // A basic context menu. Many (but not all) tools will choose to override this.
72  auto& ctxMenu = m_menu.GetMenu();
73 
74  // cancel current tool goes in main context menu at the top if present
76  ctxMenu.AddSeparator( 1 );
77 
78  // Finally, add the standard zoom/grid items
80 
81  return true;
82  }
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
void AddStandardSubMenus(TOOL_MENU &aMenu)
Construct a "basic" menu for a tool, containing only items that apply to all tools (e....
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
bool IsType(FRAME_T aType) const
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add a menu entry to run a TOOL_ACTION on selected items.

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

32 {
33  return m_toolMgr->IsToolActive( m_toolId );
34 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210
bool IsToolActive(TOOL_ID aId) const
Return true if a tool with given id is active (executing)

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

Referenced by ROUTER_TOOL::handleLayerSwitch(), EDIT_TOOL::isRouterActive(), PCB_SELECTION_TOOL::Main(), BOARD_EDITOR_CONTROL::TrackWidthDec(), and BOARD_EDITOR_CONTROL::TrackWidthInc().

◆ LeaveSheet()

int SCH_EDITOR_CONTROL::LeaveSheet ( const TOOL_EVENT aEvent)

Definition at line 1723 of file sch_editor_control.cpp.

1724 {
1725  if( m_frame->GetCurrentSheet().Last() != &m_frame->Schematic().Root() )
1726  {
1729 
1730  // Store the current zoom level into the current screen before switching
1732 
1736  }
1737 
1738  return 0;
1739 }
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
double m_LastZoomLevel
last value for the zoom level, useful in Eeschema when changing the current displayed sheet to reuse ...
Definition: sch_screen.h:473
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
void DisplayCurrentSheet()
Draw the current sheet on the display.
Definition: hierarch.cpp:289
void pop_back()
Forwarded method from std::vector.
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.
SCHEMATIC & Schematic() const
void UpdateHierarchyNavigator(bool aForceUpdate=false)
Run the Hierarchy Navigator dialog.
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
SCH_SHEET & Root() const
Definition: schematic.h:92
SCH_SHEET_PATH & GetCurrentSheet() const
double GetScale() const
Definition: view.h:263

References ACTIONS::cancelInteractive, EE_ACTIONS::clearSelection, SCH_EDIT_FRAME::DisplayCurrentSheet(), SCH_BASE_FRAME::GetCanvas(), SCH_EDIT_FRAME::GetCurrentSheet(), KIGFX::VIEW::GetScale(), SCH_EDIT_FRAME::GetScreen(), SCH_DRAW_PANEL::GetView(), SCH_SHEET_PATH::Last(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, SCH_SCREEN::m_LastZoomLevel, TOOL_BASE::m_toolMgr, SCH_SHEET_PATH::pop_back(), SCHEMATIC::Root(), TOOL_MANAGER::RunAction(), SCH_EDIT_FRAME::Schematic(), and SCH_EDIT_FRAME::UpdateHierarchyNavigator().

Referenced by setTransitions().

◆ NavigateHierarchy()

int SCH_EDITOR_CONTROL::NavigateHierarchy ( const TOOL_EVENT aEvent)

Definition at line 238 of file sch_editor_control.cpp.

239 {
241  return 0;
242 }
void UpdateHierarchyNavigator(bool aForceUpdate=false)
Run the Hierarchy Navigator dialog.

References EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, and SCH_EDIT_FRAME::UpdateHierarchyNavigator().

Referenced by setTransitions().

◆ New()

int SCH_EDITOR_CONTROL::New ( const TOOL_EVENT aEvent)

Definition at line 65 of file sch_editor_control.cpp.

66 {
68  return 0;
69 }

References EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, and SCH_EDIT_FRAME::NewProject().

Referenced by setTransitions().

◆ nextMatch()

SCH_ITEM * SCH_EDITOR_CONTROL::nextMatch ( SCH_SCREEN aScreen,
SCH_SHEET_PATH aSheet,
SCH_ITEM aAfter,
wxFindReplaceData *  aData 
)
private

Advance the search and returns the next matching item after aAfter.

Parameters
aScreenPointer to the screen used for searching
aAfterStarting match to compare
aDataSearch data to compare against or NULL to match the first item found
Returns
pointer to the next search item found or NULL if nothing found

Definition at line 294 of file sch_editor_control.cpp.

296 {
297  bool past_item = true;
298 
299  if( aAfter != nullptr )
300  {
301  past_item = false;
302 
303  if( aAfter->Type() == SCH_PIN_T || aAfter->Type() == SCH_FIELD_T )
304  aAfter = static_cast<SCH_ITEM*>( aAfter->GetParent() );
305  }
306 
307 
308  for( SCH_ITEM* item : aScreen->Items() )
309  {
310  if( item == aAfter )
311  {
312  past_item = true;
313  }
314  else if( past_item )
315  {
316  if( aData == &g_markersOnly && item->Type() == SCH_MARKER_T )
317  return item;
318 
319  if( item->Matches( *aData, aSheet ) )
320  return item;
321 
322  if( item->Type() == SCH_COMPONENT_T )
323  {
324  SCH_COMPONENT* cmp = static_cast<SCH_COMPONENT*>( item );
325 
326  for( SCH_FIELD& field : cmp->GetFields() )
327  {
328  if( field.Matches( *aData, aSheet ) )
329  return &field;
330  }
331 
332  for( SCH_PIN* pin : cmp->GetPins() )
333  {
334  if( pin->Matches( *aData, aSheet ) )
335  return pin;
336  }
337  }
338 
339  if( item->Type() == SCH_SHEET_T )
340  {
341  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
342 
343  for( SCH_FIELD& field : sheet->GetFields() )
344  {
345  if( field.Matches( *aData, aSheet ) )
346  return &field;
347  }
348 
349  for( SCH_SHEET_PIN* pin : sheet->GetPins() )
350  {
351  if( pin->Matches( *aData, aSheet ) )
352  return pin;
353  }
354  }
355  }
356  }
357 
358  return nullptr;
359 }
Instances are attached to a symbol or sheet and provide a place for the component's value,...
Definition: sch_field.h:50
static wxFindReplaceData g_markersOnly
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populate a std::vector with SCH_FIELDs.
Definition: sch_symbol.cpp:729
std::vector< SCH_FIELD > & GetFields()
Definition: sch_sheet.h:88
EDA_ITEM * GetParent() const
Definition: eda_item.h:165
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:65
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve a list of the SCH_PINs for the given sheet path.
Definition: sch_symbol.cpp:884
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
std::vector< SCH_SHEET_PIN * > & GetPins()
Definition: sch_sheet.h:184
EE_RTREE & Items()
Definition: sch_screen.h:103
Schematic symbol object.
Definition: sch_symbol.h:78
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:197
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References g_markersOnly, SCH_SHEET::GetFields(), SCH_COMPONENT::GetFields(), EDA_ITEM::GetParent(), SCH_SHEET::GetPins(), SCH_COMPONENT::GetPins(), SCH_SCREEN::Items(), pin, SCH_COMPONENT_T, SCH_FIELD_T, SCH_MARKER_T, SCH_PIN_T, SCH_SHEET_T, and EDA_ITEM::Type().

Referenced by FindNext(), and ReplaceAll().

◆ Open()

int SCH_EDITOR_CONTROL::Open ( const TOOL_EVENT aEvent)

Definition at line 72 of file sch_editor_control.cpp.

73 {
75  return 0;
76 }

References SCH_EDIT_FRAME::LoadProject(), and EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame.

Referenced by setTransitions().

◆ PageSetup()

int SCH_EDITOR_CONTROL::PageSetup ( const TOOL_EVENT aEvent)

Definition at line 100 of file sch_editor_control.cpp.

101 {
102  PICKED_ITEMS_LIST undoCmd;
103  DS_PROXY_UNDO_ITEM* undoItem = new DS_PROXY_UNDO_ITEM( m_frame );
104  ITEM_PICKER wrapper( m_frame->GetScreen(), undoItem, UNDO_REDO::PAGESETTINGS );
105 
106  undoCmd.PushItem( wrapper );
108 
110  dlg.SetWksFileName( BASE_SCREEN::m_PageLayoutDescrFileName );
111 
112  if( dlg.ShowModal() != wxID_OK )
114 
115  return 0;
116 }
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
static wxString m_PageLayoutDescrFileName
the name of the page layout descr file, or emty to used the default pagelayout
Definition: base_screen.h:89
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
A holder to handle information on schematic or board items.
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend)
Create a copy of the current schematic item, and put it in the undo list.
void RollbackSchematicFromUndo()
Perform an undo of the last edit WITHOUT logging a corresponding redo.
#define MAX_PAGE_SIZE_MILS
Definition: page_info.h:41

References SCH_EDIT_FRAME::GetScreen(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, BASE_SCREEN::m_PageLayoutDescrFileName, MAX_PAGE_SIZE_MILS, PAGESETTINGS, PICKED_ITEMS_LIST::PushItem(), SCH_EDIT_FRAME::RollbackSchematicFromUndo(), SCH_EDIT_FRAME::SaveCopyInUndoList(), and DIALOG_PAGES_SETTINGS::SetWksFileName().

Referenced by setTransitions().

◆ Paste()

int SCH_EDITOR_CONTROL::Paste ( const TOOL_EVENT aEvent)

Definition at line 1354 of file sch_editor_control.cpp.

1355 {
1356  wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( wxWindow::FindFocus() );
1357 
1358  if( textEntry )
1359  {
1360  textEntry->Paste();
1361  return 0;
1362  }
1363 
1365  std::string text = m_toolMgr->GetClipboardUTF8();
1366 
1367  if( text.empty() )
1368  return 0;
1369 
1370  STRING_LINE_READER reader( text, "Clipboard" );
1371  SCH_SEXPR_PLUGIN plugin;
1372 
1373  SCH_SHEET paste_sheet;
1374  SCH_SCREEN* paste_screen = new SCH_SCREEN( &m_frame->Schematic() );
1375 
1376  // Screen object on heap is owned by the sheet.
1377  paste_sheet.SetScreen( paste_screen );
1378 
1379  try
1380  {
1381  plugin.LoadContent( reader, &paste_sheet );
1382  }
1383  catch( IO_ERROR& )
1384  {
1385  // If it wasn't content, then paste as text
1386  paste_screen->Append( new SCH_TEXT( wxPoint( 0, 0 ), text ) );
1387  }
1388 
1389  bool forceKeepAnnotations = false;
1390 
1391  if( aEvent.IsAction( &ACTIONS::pasteSpecial ) )
1392  {
1393  DIALOG_PASTE_SPECIAL dlg( m_frame, &forceKeepAnnotations );
1394 
1395  if( dlg.ShowModal() == wxID_CANCEL )
1396  return 0;
1397  }
1398 
1399  // SCH_SEXP_PLUGIN added the items to the paste screen, but not to the view or anything
1400  // else. Pull them back out to start with.
1401  //
1402  EDA_ITEMS loadedItems;
1403  bool sheetsPasted = false;
1404  SCH_SHEET_LIST hierarchy = m_frame->Schematic().GetSheets();
1405  SCH_SHEET_PATH& pasteRoot = m_frame->GetCurrentSheet();
1406  wxFileName destFn = pasteRoot.Last()->GetFileName();
1407 
1408  if( destFn.IsRelative() )
1409  destFn.MakeAbsolute( m_frame->Prj().GetProjectPath() );
1410 
1411  for( SCH_ITEM* item : paste_screen->Items() )
1412  {
1413  loadedItems.push_back( item );
1414 
1415  if( item->Type() == SCH_SHEET_T )
1416  {
1417  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
1418  wxFileName srcFn = sheet->GetFileName();
1419 
1420  if( srcFn.IsRelative() )
1421  srcFn.MakeAbsolute( m_frame->Prj().GetProjectPath() );
1422 
1423  SCH_SHEET_LIST sheetHierarchy( sheet );
1424 
1425  if( hierarchy.TestForRecursion( sheetHierarchy, destFn.GetFullPath( wxPATH_UNIX ) ) )
1426  {
1427  auto msg = wxString::Format( _( "The pasted sheet \"%s\"\n"
1428  "was dropped because the destination already has "
1429  "the sheet or one of its subsheets as a parent." ),
1430  sheet->GetFileName() );
1431  DisplayError( m_frame, msg );
1432  loadedItems.pop_back();
1433  }
1434  }
1435  }
1436 
1437  // Remove the references from our temporary screen to prevent freeing on the DTOR
1438  paste_screen->Clear( false );
1439 
1440  for( unsigned i = 0; i < loadedItems.size(); ++i )
1441  {
1442  EDA_ITEM* item = loadedItems[i];
1444 
1445  if( item->Type() == SCH_COMPONENT_T )
1446  {
1447  SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
1448 
1449  // The library symbol gets set from the cached library symbols in the current
1450  // schematic not the symbol libraries. The cached library symbol may have
1451  // changed from the original library symbol which would cause the copy to
1452  // be incorrect.
1453  SCH_SCREEN* currentScreen = m_frame->GetScreen();
1454 
1455  wxCHECK2( currentScreen, continue );
1456 
1457  auto it = currentScreen->GetLibSymbols().find( symbol->GetSchSymbolLibraryName() );
1458 
1459  if( it != currentScreen->GetLibSymbols().end() )
1460  symbol->SetLibSymbol( new LIB_PART( *it->second ) );
1461 
1462  if( !forceKeepAnnotations )
1463  {
1464  // clear the annotation, but preserve the selected unit
1465  int unit = symbol->GetUnit();
1466  symbol->ClearAnnotation( nullptr );
1467  symbol->SetUnit( unit );
1468  }
1469  }
1470 
1471  if( item->Type() == SCH_SHEET_T )
1472  {
1473  SCH_SHEET* sheet = (SCH_SHEET*) item;
1474  SCH_FIELD& nameField = sheet->GetFields()[SHEETNAME];
1475  wxFileName fn = sheet->GetFileName();
1476  SCH_SCREEN* existingScreen = nullptr;
1477  wxString baseName = nameField.GetText();
1478  wxString candidateName = baseName;
1479  wxString number;
1480 
1481  while( !baseName.IsEmpty() && wxIsdigit( baseName.Last() ) )
1482  {
1483  number = baseName.Last() + number;
1484  baseName.RemoveLast();
1485  }
1486 
1487  int uniquifier = std::max( 0, wxAtoi( number ) ) + 1;
1488 
1489  // Ensure we have latest hierarchy, as we may have added a sheet in the previous
1490  // iteration
1491  hierarchy = m_frame->Schematic().GetSheets();
1492 
1493  while( hierarchy.NameExists( candidateName ) )
1494  candidateName = wxString::Format( wxT( "%s%d" ), baseName, uniquifier++ );
1495 
1496  nameField.SetText( candidateName );
1497 
1498  sheet->SetParent( pasteRoot.Last() );
1499  sheet->SetScreen( nullptr );
1500  sheetsPasted = true;
1501 
1502  if( !fn.IsAbsolute() )
1503  {
1504  wxFileName currentSheetFileName = pasteRoot.LastScreen()->GetFileName();
1505  fn.Normalize( wxPATH_NORM_ALL, currentSheetFileName.GetPath() );
1506  }
1507 
1508  if( !m_frame->Schematic().Root().SearchHierarchy( fn.GetFullPath( wxPATH_UNIX ),
1509  &existingScreen ) )
1510  {
1511  searchSupplementaryClipboard( sheet->GetFileName(), &existingScreen );
1512  }
1513 
1514  if( existingScreen )
1515  {
1516  sheet->SetScreen( existingScreen );
1517  }
1518  else
1519  {
1520  if( !m_frame->LoadSheetFromFile( sheet, &pasteRoot, fn.GetFullPath() ) )
1521  m_frame->InitSheet( sheet, sheet->GetFileName() );
1522  }
1523 
1524  // Push it to the clipboard path while it still has its old KIID
1525  clipPath.push_back( sheet->m_Uuid );
1526  }
1527 
1528  // Everything gets a new KIID
1529  const_cast<KIID&>( item->m_Uuid ) = KIID();
1530 
1531  // Once we have our new KIID we can update all pasted instances. This will either
1532  // reset the annotations or copy "kept" annotations from the supplementary clipboard.
1533  if( item->Type() == SCH_SHEET_T )
1534  {
1535  SCH_SHEET* sheet = (SCH_SHEET*) item;
1536  SCH_SHEET_PATH pastePath = pasteRoot;
1537  pastePath.push_back( sheet );
1538 
1539  int page = 1;
1540  wxString pageNum = wxString::Format( "%d", page );
1541 
1542  while( hierarchy.PageNumberExists( pageNum ) )
1543  pageNum = wxString::Format( "%d", ++page );
1544 
1545  sheet->AddInstance( pastePath.Path() );
1546  sheet->SetPageNumber( pastePath, pageNum );
1547  updatePastedInstances( pastePath, clipPath, sheet, forceKeepAnnotations );
1548  }
1549 
1550  item->SetFlags( IS_NEW | IS_PASTED | IS_MOVED );
1552 
1553  // Reset flags for subsequent move operation
1554  item->SetFlags( IS_NEW | IS_PASTED | IS_MOVED );
1555  // Start out hidden so the pasted items aren't "ghosted" in their original location
1556  // before being moved to the current location.
1557  getView()->Hide( item, true );
1558  }
1559 
1560  if( sheetsPasted )
1561  {
1564  }
1565 
1566  // Now clear the previous selection, select the pasted items, and fire up the "move"
1567  // tool.
1568  //
1570  m_toolMgr->RunAction( EE_ACTIONS::addItemsToSel, true, &loadedItems );
1571 
1572  EE_SELECTION& selection = selTool->GetSelection();
1573 
1574  if( !selection.Empty() )
1575  {
1576  SCH_ITEM* item = (SCH_ITEM*) selection.GetTopLeftItem();
1577 
1578  selection.SetReferencePoint( item->GetPosition() );
1580  }
1581 
1582  return 0;
1583 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:252
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hide the item in the view (e.g.
Definition: view.cpp:1470
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
Instances are attached to a symbol or sheet and provide a place for the component's value,...
Definition: sch_field.h:50
const wxString & GetFileName() const
Definition: sch_screen.h:133
bool SearchHierarchy(const wxString &aFilename, SCH_SCREEN **aScreen)
Search the existing hierarchy for an instance of screen loaded from aFileName.
Definition: sch_sheet.cpp:629
void SetLibSymbol(LIB_PART *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
Definition: sch_symbol.cpp:248
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
bool PageNumberExists(const wxString &aPageNumber) const
void updatePastedInstances(const SCH_SHEET_PATH &aPastePath, const KIID_PATH &aClipPath, SCH_SHEET *aSheet, bool aForceKeepAnnotations)
static TOOL_ACTION addItemsToSel
Selects a list of items (specified as the event parameter)
Definition: ee_actions.h:61
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
wxString GetSchSymbolLibraryName() const
Definition: sch_symbol.cpp:239
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
Definition: sch_sheet.cpp:156
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
void InitSheet(SCH_SHEET *aSheet, const wxString &aNewFilename)
Definition: sheet.cpp:93
bool searchSupplementaryClipboard(const wxString &aSheetFilename, SCH_SCREEN **aScreen)
virtual wxPoint GetPosition() const
Definition: eda_item.h:302
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition: project.cpp:123
std::map< wxString, LIB_PART * > & GetLibSymbols()
Fetch a list of unique LIB_PART object pointers required to properly render each SCH_COMPONENT in thi...
Definition: sch_screen.h:416
void SetPageNumber(const SCH_SHEET_PATH &aInstance, const wxString &aPageNumber)
Set the page number for the sheet instance aInstance.
Definition: sch_sheet.cpp:1135
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:166
void Clear(bool aFree=true)
Delete all draw items and clears the project settings.
Definition: sch_screen.cpp:199
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:70
KIID_PATH m_supplementaryClipboardPath
EE_SELECTION & GetSelection()
Return the set of currently selected items.
std::vector< SCH_FIELD > & GetFields()
Definition: sch_sheet.h:88
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: kiid.h:44
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:264
bool TestForRecursion(const SCH_SHEET_LIST &aSrcSheetHierarchy, const wxString &aDestFileName)
Test every SCH_SHEET_PATH in this SCH_SHEET_LIST to verify if adding the sheets stored in aSrcSheetHi...
int GetUnit() const
Definition: sch_symbol.h:195
bool LoadSheetFromFile(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy, const wxString &aFileName)
Load a the KiCad schematic file aFileName into the sheet aSheet.
Definition: sheet.cpp:101
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:203
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:121
std::string GetClipboardUTF8() const
Return the information currently stored in the system clipboard.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
SCHEMATIC & Schematic() const
void UpdateHierarchyNavigator(bool aForceUpdate=false)
Run the Hierarchy Navigator dialog.
Define a library symbol object.
Definition: lib_symbol.h:93
bool NameExists(const wxString &aSheetName) const
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: eda_item.h:557
void SetUnit(int aUnit)
Change the unit number to aUnit.
Definition: sch_symbol.cpp:322
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
wxString GetFileName() const
Return the filename corresponding to this sheet.
Definition: sch_sheet.h:315
#define IS_MOVED
Item being moved.
Definition: eda_item.h:106
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
A SCH_PLUGIN derivation for loading schematic files using the new s-expression file format.
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:122
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
static TOOL_ACTION pasteSpecial
Definition: actions.h:72
const KIID m_Uuid
Definition: eda_item.h:525
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
Definition: eda_item.h:120
EDA_ITEM * GetTopLeftItem(bool onlyModules=false) const override
void LoadContent(LINE_READER &aReader, SCH_SHEET *aSheet, int aVersion=SEXPR_SCHEMATIC_FILE_VERSION)
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:87
SCH_SHEET & Root() const
Definition: schematic.h:92
void AddItemToScreenAndUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItem, bool aUndoAppend)
Add an item to the schematic and adds the changes to the undo/redo container.
SCH_SCREEN * LastScreen()
void Append(SCH_ITEM *aItem)
Definition: sch_screen.cpp:128
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
#define _(s)
Definition: 3d_actions.cpp:33
EE_RTREE & Items()
Definition: sch_screen.h:103
Schematic symbol object.
Definition: sch_symbol.h:78
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
SCH_SHEET_PATH & GetCurrentSheet() const
static TOOL_ACTION move
Definition: ee_actions.h:111
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath)
Clear exiting symbol annotation.
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:237
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:197
#define IS_NEW
New item, just created.
Definition: eda_item.h:107
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133
bool AddInstance(const KIID_PATH &aInstance)
Add a new instance aSheetPath to the instance list.
Definition: sch_sheet.cpp:1093
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References _, SCH_SHEET::AddInstance(), EE_ACTIONS::addItemsToSel, SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_SCREEN::Append(), SCH_SCREEN::Clear(), SCH_COMPONENT::ClearAnnotation(), EE_ACTIONS::clearSelection, DisplayError(), SELECTION::Empty(), Format(), TOOL_MANAGER::GetClipboardUTF8(), SCH_EDIT_FRAME::GetCurrentSheet(), SCH_SHEET::GetFields(), SCH_SCREEN::GetFileName(), SCH_SHEET::GetFileName(), SCH_SCREEN::GetLibSymbols(), EDA_ITEM::GetPosition(), PROJECT::GetProjectPath(), SCH_COMPONENT::GetSchSymbolLibraryName(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), SCHEMATIC::GetSheets(), EDA_TEXT::GetText(), TOOL_MANAGER::GetTool(), EE_SELECTION::GetTopLeftItem(), SCH_COMPONENT::GetUnit(), TOOL_BASE::getView(), KIGFX::VIEW::Hide(), SCH_EDIT_FRAME::InitSheet(), IS_MOVED, IS_NEW, IS_PASTED, TOOL_EVENT::IsAction(), SCH_SCREEN::Items(), SCH_SHEET_PATH::Last(), SCH_SHEET_PATH::LastScreen(), SCH_SEXPR_PLUGIN::LoadContent(), SCH_EDIT_FRAME::LoadSheetFromFile(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_supplementaryClipboardPath, TOOL_BASE::m_toolMgr, EDA_ITEM::m_Uuid, EE_ACTIONS::move, SCH_SHEET_LIST::NameExists(), SCH_SHEET_LIST::PageNumberExists(), ACTIONS::pasteSpecial, SCH_SHEET_PATH::Path(), KIWAY_HOLDER::Prj(), SCH_SHEET_PATH::push_back(), SCHEMATIC::Root(), TOOL_MANAGER::RunAction(), SCH_COMPONENT_T, SCH_SHEET_T, SCH_EDIT_FRAME::Schematic(), SCH_SHEET::SearchHierarchy(), searchSupplementaryClipboard(), EDA_ITEM::SetFlags(), SCH_COMPONENT::SetLibSymbol(), SCH_SHEET::SetPageNumber(), EDA_ITEM::SetParent(), SELECTION::SetReferencePoint(), SCH_SHEET::SetScreen(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), EDA_TEXT::SetText(), SCH_COMPONENT::SetUnit(), SHEETNAME, SCH_SHEET_LIST::TestForRecursion(), text, EDA_ITEM::Type(), SCH_EDIT_FRAME::UpdateHierarchyNavigator(), and updatePastedInstances().

Referenced by setTransitions().

◆ Plot()

int SCH_EDITOR_CONTROL::Plot ( const TOOL_EVENT aEvent)

Definition at line 206 of file sch_editor_control.cpp.

207 {
209 
210  dlg.ShowModal();
211 
212  // save project config if the prj config has changed:
213  if( dlg.PrjConfigChanged() )
215 
216  return 0;
217 }
void SaveProjectSettings() override
Save changes to the project settings to the project (.pro) file.

References EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, DIALOG_PLOT_SCHEMATIC::PrjConfigChanged(), and SCH_EDIT_FRAME::SaveProjectSettings().

Referenced by setTransitions().

◆ Print()

int SCH_EDITOR_CONTROL::Print ( const TOOL_EVENT aEvent)

Definition at line 193 of file sch_editor_control.cpp.

194 {
196 
197  wxFileName fn = m_frame->Prj().AbsolutePath( m_frame->Schematic().RootScreen()->GetFileName() );
198 
199  if( fn.GetName() != NAMELESS_PROJECT )
201 
202  return 0;
203 }
const wxString & GetFileName() const
Definition: sch_screen.h:133
void SaveProjectSettings() override
Save changes to the project settings to the project (.pro) file.
virtual const wxString AbsolutePath(const wxString &aFileName) const
Fix up aFileName if it is relative to the project's directory to be an absolute path and filename.
Definition: project.cpp:271
int InvokeDialogPrintUsingPrinter(SCH_EDIT_FRAME *aCaller)
Create and show DIALOG_PRINT_USING_PRINTER and return whatever DIALOG_PRINT_USING_PRINTER::ShowModal(...
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
SCHEMATIC & Schematic() const
#define NAMELESS_PROJECT
default name for nameless projects
Definition: project.h:41
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
Definition: schematic.cpp:115

References PROJECT::AbsolutePath(), SCH_SCREEN::GetFileName(), InvokeDialogPrintUsingPrinter(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, NAMELESS_PROJECT, KIWAY_HOLDER::Prj(), SCHEMATIC::RootScreen(), SCH_EDIT_FRAME::SaveProjectSettings(), and SCH_EDIT_FRAME::Schematic().

Referenced by setTransitions().

◆ processCmpToFootprintLinkFile()

bool SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile ( const wxString &  aFullFilename,
bool  aForceVisibilityState,
bool  aVisibilityState 
)
private

Read the footprint info from each line in the stuff file by reference designator.

The footprint link file (.cmp) entries created by CvPcb:

BeginCmp TimeStamp = /32307DE2/AA450F67; Reference = C1; ValeurCmp = 47uF; IdModule = CP6; EndCmp

Parameters
aFullFilename= the full filename to read
aForceVisibilityState= Set to true to change the footprint field visibility state to aVisibilityState. False retains the current footprint field visibility state.
aVisibilityStateTrue to show the footprint field or false to hide the footprint field if aForceVisibilityState is true.
Returns
bool = true if success.Set up handlers for various events.

Definition at line 117 of file assign_footprints.cpp.

120 {
121  // Build a flat list of components in schematic:
122  SCH_REFERENCE_LIST referencesList;
123  SCH_SHEET_LIST sheetList = m_frame->Schematic().GetSheets();
124 
125  sheetList.GetSymbols( referencesList, false );
126 
127  FILE* cmpFile = wxFopen( aFullFilename, wxT( "rt" ) );
128 
129  if( cmpFile == NULL )
130  return false;
131 
132  // cmpFileReader dtor will close cmpFile
133  FILE_LINE_READER cmpFileReader( cmpFile, aFullFilename );
134 
135  // Now, for each component found in file,
136  // replace footprint field value by the new value:
137  wxString reference;
138  wxString footprint;
139  wxString buffer;
140  wxString value;
141 
142  while( cmpFileReader.ReadLine() )
143  {
144  buffer = FROM_UTF8( cmpFileReader.Line() );
145 
146  if( !buffer.StartsWith( wxT( "BeginCmp" ) ) )
147  continue;
148 
149  // Begin component description.
150  reference.Empty();
151  footprint.Empty();
152 
153  while( cmpFileReader.ReadLine() )
154  {
155  buffer = FROM_UTF8( cmpFileReader.Line() );
156 
157  if( buffer.StartsWith( wxT( "EndCmp" ) ) )
158  break;
159 
160  // store string value, stored between '=' and ';' delimiters.
161  value = buffer.AfterFirst( '=' );
162  value = value.BeforeLast( ';' );
163  value.Trim(true);
164  value.Trim(false);
165 
166  if( buffer.StartsWith( wxT( "Reference" ) ) )
167  reference = value;
168  else if( buffer.StartsWith( wxT( "IdModule" ) ) )
169  footprint = value;
170  }
171 
172  // A block is read: initialize the footprint field of the corresponding component
173  // if the footprint name is not empty
174  if( reference.IsEmpty() )
175  continue;
176 
177  // Search the component in the flat list
178  for( unsigned ii = 0; ii < referencesList.GetCount(); ii++ )
179  {
180  if( reference == referencesList[ii].GetRef() )
181  {
182  // We have found a candidate.
183  // Note: it can be not unique (multiple units per part)
184  // So we *do not* stop the search here
185  SCH_COMPONENT* symbol = referencesList[ ii ].GetSymbol();
186  SCH_SHEET_PATH* sheetPath = &referencesList[ii].GetSheetPath();
187 
188  symbol->SetFootprint( sheetPath, footprint );
189 
190  if( aForceVisibilityState )
191  symbol->GetField( FOOTPRINT_FIELD )->SetVisible( aVisibilityState );
192  }
193  }
194  }
195 
196  return true;
197 }
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:110
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
Definition: sch_symbol.cpp:693
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets.
void SetVisible(bool aVisible)
Definition: eda_text.h:192
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
A LINE_READER that reads from an open file.
Definition: richio.h:172
#define NULL
SCHEMATIC & Schematic() const
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
unsigned GetCount() const
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:87
Schematic symbol object.
Definition: sch_symbol.h:78
void SetFootprint(const SCH_SHEET_PATH *sheet, const wxString &aFootprint)
Definition: sch_symbol.cpp:664
Field Name Module PCB, i.e. "16DIP300".

References FOOTPRINT_FIELD, FROM_UTF8(), SCH_REFERENCE_LIST::GetCount(), SCH_COMPONENT::GetField(), SCHEMATIC::GetSheets(), SCH_SHEET_LIST::GetSymbols(), LINE_READER::Line(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, NULL, FILE_LINE_READER::ReadLine(), SCH_EDIT_FRAME::Schematic(), SCH_COMPONENT::SetFootprint(), and EDA_TEXT::SetVisible().

Referenced by ImportFPAssignments().

◆ Quit()

int SCH_EDITOR_CONTROL::Quit ( const TOOL_EVENT aEvent)

Definition at line 220 of file sch_editor_control.cpp.

221 {
222  m_frame->Close( false );
223  return 0;
224 }

References EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame.

Referenced by setTransitions().

◆ Redo()

int SCH_EDITOR_CONTROL::Redo ( const TOOL_EVENT aEvent)

Clipboard support.

Definition at line 1184 of file sch_editor_control.cpp.

1185 {
1186  if( m_frame->GetRedoCommandCount() == 0 )
1187  return 0;
1188 
1189  // Inform tools that undo command was issued
1191 
1192  /* Get the old list */
1194 
1195  /* Redo the command: */
1197 
1198  /* Put the old list in UndoList */
1199  list->ReversePickersListOrder();
1200  m_frame->PushCommandToUndoList( list );
1201 
1203  selTool->RebuildSelection();
1204 
1207 
1209  m_frame->SyncView();
1210  m_frame->GetCanvas()->Refresh();
1211  m_frame->OnModify();
1212 
1213  return 0;
1214 }
void ReversePickersListOrder()
Reverse the order of pickers stored in this list.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
virtual void PushCommandToUndoList(PICKED_ITEMS_LIST *aItem)
Add a command to undo in the undo list.
virtual int GetRedoCommandCount() const
virtual PICKED_ITEMS_LIST * PopCommandFromRedoList()
Return the last command to undo and remove it from list, nothing is deleted.
void OnPageSettingsChange() override
Called when modifying the page settings.
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
void SyncView()
Mark all items for refresh.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
A holder to handle information on schematic or board items.
Global action (toolbar/main menu event, global shortcut)
Definition: tool_event.h:151
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
void RebuildSelection()
Rebuild the selection from the EDA_ITEMs' selection flags.
void PutDataInPreviousState(PICKED_ITEMS_LIST *aList)
Restore an undo or redo command to put data pointed by aList in the previous state.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...

References AS_GLOBAL, SCH_BASE_FRAME::GetCanvas(), EDA_BASE_FRAME::GetRedoCommandCount(), TOOL_MANAGER::GetTool(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, SCH_EDIT_FRAME::OnModify(), SCH_EDIT_FRAME::OnPageSettingsChange(), EDA_BASE_FRAME::PopCommandFromRedoList(), TOOL_MANAGER::ProcessEvent(), EDA_BASE_FRAME::PushCommandToUndoList(), SCH_EDIT_FRAME::PutDataInPreviousState(), EE_SELECTION_TOOL::RebuildSelection(), EDA_DRAW_PANEL_GAL::Refresh(), PICKED_ITEMS_LIST::ReversePickersListOrder(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), SCH_BASE_FRAME::SyncView(), TA_UNDO_REDO_PRE, TC_MESSAGE, and SCH_EDIT_FRAME::TestDanglingEnds().

Referenced by setTransitions().

◆ RemapSymbols()

int SCH_EDITOR_CONTROL::RemapSymbols ( const TOOL_EVENT aEvent)

Definition at line 181 of file sch_editor_control.cpp.

182 {
183  DIALOG_SYMBOL_REMAP dlgRemap( m_frame );
184 
185  dlgRemap.ShowQuasiModal();
186 
187  m_frame->GetCanvas()->Refresh( true );
188 
189  return 0;
190 }
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...

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

Referenced by setTransitions().

◆ ReplaceAll()

int SCH_EDITOR_CONTROL::ReplaceAll ( const TOOL_EVENT aEvent)

Definition at line 490 of file sch_editor_control.cpp.

491 {
492  wxFindReplaceData* data = m_frame->GetFindReplaceData();
493 
494  if( !data )
495  return FindAndReplace( ACTIONS::find.MakeEvent() );
496 
497  SCH_SHEET_LIST schematic = m_frame->Schematic().GetSheets();
498  SCH_SCREENS screens( m_frame->Schematic().Root() );
499 
500  for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
501  {
502  SCH_SHEET_PATH* sheet = schematic.FindSheetForScreen( screen );
503 
504  for( EDA_ITEM* item = nextMatch( screen, sheet, nullptr, data ); item; )
505  {
506  if( item->Replace( *data, sheet ) )
507  {
508  m_frame->UpdateItem( item );
509  m_frame->OnModify();
510  }
511 
512  item = nextMatch( screen, sheet, dynamic_cast<SCH_ITEM*>( item ), data );
513  }
514  }
515 
516  return 0;
517 }
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
int FindAndReplace(const TOOL_EVENT &aEvent)
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
wxFindReplaceData * GetFindReplaceData()
Get the find criteria (as set by the dialog).
SCH_SHEET_PATH * FindSheetForScreen(const SCH_SCREEN *aScreen)
Return a pointer to the first SCH_SHEET_PATH object (not necessarily the only one) using a particular...
static TOOL_ACTION find
Definition: actions.h:79
SCH_ITEM * nextMatch(SCH_SCREEN *aScreen, SCH_SHEET_PATH *aSheet, SCH_ITEM *aAfter, wxFindReplaceData *aData)
Advance the search and returns the next matching item after aAfter.
SCHEMATIC & Schematic() const
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:87
SCH_SHEET & Root() const
Definition: schematic.h:92
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:549

References ACTIONS::find, FindAndReplace(), SCH_SHEET_LIST::FindSheetForScreen(), SCH_EDIT_FRAME::GetFindReplaceData(), SCHEMATIC::GetSheets(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, nextMatch(), SCH_EDIT_FRAME::OnModify(), SCHEMATIC::Root(), SCH_EDIT_FRAME::Schematic(), and SCH_BASE_FRAME::UpdateItem().

Referenced by DIALOG_SCH_FIND::OnReplace(), and setTransitions().

◆ ReplaceAndFindNext()

int SCH_EDITOR_CONTROL::ReplaceAndFindNext ( const TOOL_EVENT aEvent)

Definition at line 466 of file sch_editor_control.cpp.

467 {
468  wxFindReplaceData* data = m_frame->GetFindReplaceData();
471 
472  if( !data )
473  return FindAndReplace( ACTIONS::find.MakeEvent() );
474 
475  if( item && item->Matches( *data, sheet ) )
476  {
477  if( item->Replace( *data, sheet ) )
478  {
479  m_frame->UpdateItem( item );
480  m_frame->OnModify();
481  }
482 
483  FindNext( ACTIONS::findNext.MakeEvent() );
484  }
485 
486  return 0;
487 }
int FindAndReplace(const TOOL_EVENT &aEvent)
virtual bool Matches(const wxFindReplaceData &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Definition: eda_item.h:415
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
wxFindReplaceData * GetFindReplaceData()
Get the find criteria (as set by the dialog).
int FindNext(const TOOL_EVENT &aEvent)
static TOOL_ACTION find
Definition: actions.h:79
EE_SELECTION & GetSelection()
Return the set of currently selected items.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
static bool Replace(const wxFindReplaceData &aSearchData, wxString &aText)
Perform a text replace on aText using the find and replace criteria in aSearchData on items that supp...
Definition: eda_item.cpp:143
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
SCH_SHEET_PATH & GetCurrentSheet() const
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
static TOOL_ACTION findNext
Definition: actions.h:81
EDA_ITEM * Front() const
Definition: selection.h:203

References ACTIONS::find, FindAndReplace(), FindNext(), ACTIONS::findNext, SELECTION::Front(), SCH_EDIT_FRAME::GetCurrentSheet(), SCH_EDIT_FRAME::GetFindReplaceData(), EE_SELECTION_TOOL::GetSelection(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, EDA_ITEM::Matches(), SCH_EDIT_FRAME::OnModify(), EDA_ITEM::Replace(), and SCH_BASE_FRAME::UpdateItem().

Referenced by DIALOG_SCH_FIND::OnReplace(), and setTransitions().

◆ RescueLegacyProject()

bool SCH_EDITOR_CONTROL::RescueLegacyProject ( bool  aRunningOnDemand)

Definition at line 132 of file sch_editor_control.cpp.

133 {
135  m_frame->GetCanvas()->GetBackend() );
136 
137  return rescueProject( rescuer, aRunningOnDemand );
138 }
bool rescueProject(RESCUER &aRescuer, bool aRunningOnDemand)
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
SCHEMATIC & Schematic() const
SCH_SHEET_PATH & GetCurrentSheet() const
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.

References EDA_DRAW_PANEL_GAL::GetBackend(), SCH_BASE_FRAME::GetCanvas(), SCH_EDIT_FRAME::GetCurrentSheet(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, KIWAY_HOLDER::Prj(), rescueProject(), and SCH_EDIT_FRAME::Schematic().

Referenced by RescueSymbols().

◆ rescueProject()

bool SCH_EDITOR_CONTROL::rescueProject ( RESCUER aRescuer,
bool  aRunningOnDemand 
)
private

Definition at line 151 of file sch_editor_control.cpp.

152 {
153  if( !RESCUER::RescueProject( m_frame, aRescuer, aRunningOnDemand ) )
154  return false;
155 
156  if( aRescuer.GetCandidateCount() )
157  {
158  KIWAY_PLAYER* viewer = m_frame->Kiway().Player( FRAME_SCH_VIEWER, false );
159 
160  if( viewer )
161  static_cast<SYMBOL_VIEWER_FRAME*>( viewer )->ReCreateLibList();
162 
163  if( aRunningOnDemand )
164  {
165  SCH_SCREENS schematic( m_frame->Schematic().Root() );
166 
167  schematic.UpdateSymbolLinks();
169  }
170 
172  m_frame->SyncView();
173  m_frame->GetCanvas()->Refresh();
174  m_frame->OnModify();
175  }
176 
177  return true;
178 }
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:61
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:56
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generate the connection data for the entire schematic hierarchy.
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:357
static bool RescueProject(wxWindow *aParent, RESCUER &aRescuer, bool aRunningOnDemand)
void SyncView()
Mark all items for refresh.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
size_t GetCandidateCount()
Return the number of rescue candidates found.
SCHEMATIC & Schematic() const
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...
SCH_SHEET & Root() const
Definition: schematic.h:92
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
void UpdateSymbolLinks(REPORTER *aReporter=nullptr)
Initialize the LIB_PART reference for each SCH_COMPONENT found in the full schematic.
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:549

References EDA_BASE_FRAME::ClearUndoRedoList(), FRAME_SCH_VIEWER, RESCUER::GetCandidateCount(), SCH_BASE_FRAME::GetCanvas(), GLOBAL_CLEANUP, KIWAY_HOLDER::Kiway(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, SCH_EDIT_FRAME::OnModify(), KIWAY::Player(), SCH_EDIT_FRAME::RecalculateConnections(), EDA_DRAW_PANEL_GAL::Refresh(), RESCUER::RescueProject(), SCHEMATIC::Root(), SCH_EDIT_FRAME::Schematic(), SCH_BASE_FRAME::SyncView(), and SCH_SCREENS::UpdateSymbolLinks().

Referenced by RescueLegacyProject(), and RescueSymbolLibTableProject().

◆ RescueSymbolLibTableProject()

bool SCH_EDITOR_CONTROL::RescueSymbolLibTableProject ( bool  aRunningOnDemand)

Definition at line 141 of file sch_editor_control.cpp.

142 {
145  m_frame->GetCanvas()->GetBackend() );
146 
147  return rescueProject( rescuer, aRunningOnDemand );
148 }
bool rescueProject(RESCUER &aRescuer, bool aRunningOnDemand)
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
SCHEMATIC & Schematic() const
SCH_SHEET_PATH & GetCurrentSheet() const
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.

References EDA_DRAW_PANEL_GAL::GetBackend(), SCH_BASE_FRAME::GetCanvas(), SCH_EDIT_FRAME::GetCurrentSheet(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, KIWAY_HOLDER::Prj(), rescueProject(), and SCH_EDIT_FRAME::Schematic().

Referenced by RescueSymbols().

◆ RescueSymbols()

int SCH_EDITOR_CONTROL::RescueSymbols ( const TOOL_EVENT aEvent)

Perform rescue operations to recover old projects from before certain changes were made.

  • Exports cached symbols that conflict with new symbols to a separate library.
  • Exports cached symbols not found in any symbol library.
  • Renames symbols named before libraries were case sensitive.

Definition at line 119 of file sch_editor_control.cpp.

120 {
121  SCH_SCREENS schematic( m_frame->Schematic().Root() );
122 
123  if( schematic.HasNoFullyDefinedLibIds() )
124  RescueLegacyProject( true );
125  else
127 
128  return 0;
129 }
bool RescueLegacyProject(bool aRunningOnDemand)
bool RescueSymbolLibTableProject(bool aRunningOnDemand)
SCHEMATIC & Schematic() const
SCH_SHEET & Root() const
Definition: schematic.h:92
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:549

References EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, RescueLegacyProject(), RescueSymbolLibTableProject(), SCHEMATIC::Root(), and SCH_EDIT_FRAME::Schematic().

Referenced by setTransitions().

◆ Reset()

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

Bring the tool to a known, initial state.

If the tool claimed anything from the model or the view, it must release it when its reset.

Parameters
aReasoncontains information about the reason of tool reset.

Implements TOOL_BASE.

Definition at line 85 of file ee_tool_base.h.

86  {
87  if( aReason == MODEL_RELOAD )
88  {
89  // Init variables used by every drawing tool
90  m_frame = getEditFrame<T>();
91  m_isSymbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) != nullptr;
92  }
93 
94  m_view = static_cast<KIGFX::SCH_VIEW*>( getView() );
95  }
Model changes (required full reload)
Definition: tool_base.h:81
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36

◆ RunMainStack()

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

Call a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

88 {
89  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
90 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)

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

Referenced by DRAWING_TOOL::PlaceText().

◆ Save()

int SCH_EDITOR_CONTROL::Save ( const TOOL_EVENT aEvent)

Definition at line 79 of file sch_editor_control.cpp.

80 {
82  return 0;
83 }

References EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, and SCH_EDIT_FRAME::SaveProject().

Referenced by setTransitions().

◆ SaveAs()

int SCH_EDITOR_CONTROL::SaveAs ( const TOOL_EVENT aEvent)

Definition at line 86 of file sch_editor_control.cpp.

87 {
88  m_frame->Save_File( true );
89  return 0;
90 }
void Save_File(bool doSaveAs=false)

References EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, and SCH_EDIT_FRAME::Save_File().

Referenced by setTransitions().

◆ saveCopyInUndoList()

void EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList ( EDA_ITEM aItem,
UNDO_REDO  aType,
bool  aAppend = false 
)
inlineprotectedinherited

Definition at line 133 of file ee_tool_base.h.

134  {
135  KICAD_T itemType = aItem->Type();
136  bool selected = aItem->IsSelected();
137 
138  // IS_SELECTED flag should not be set on undo items which were added for
139  // a drag operation.
140  if( selected && aItem->HasFlag( TEMP_SELECTED ) )
141  aItem->ClearSelected();
142 
143  if( m_isSymbolEditor )
144  {
145  SYMBOL_EDIT_FRAME* editFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
146  wxASSERT( editFrame );
147 
148  editFrame->SaveCopyInUndoList( static_cast<LIB_ITEM*>( aItem ), aType, aAppend );
149  }
150  else
151  {
152  SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
153  wxASSERT( editFrame );
154 
155  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
156  {
157  editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
158  static_cast<SCH_ITEM*>( aItem->GetParent() ),
159  UNDO_REDO::CHANGED, aAppend );
160  }
161  else
162  {
163  editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
164  static_cast<SCH_ITEM*>( aItem ),
165  aType, aAppend );
166  }
167  }
168 
169  if( selected && aItem->HasFlag( TEMP_SELECTED ) )
170  aItem->SetSelected();
171  }
bool IsSelected() const
Definition: eda_item.h:173
void ClearSelected()
Definition: eda_item.h:182
Schematic editor (Eeschema) main window.
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: eda_item.h:115
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetSelected()
Definition: eda_item.h:179
void SaveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aUndoType=UNDO_REDO::LIBEDIT, bool aAppend=false)
Create a copy of the current symbol, and save it in the undo list.
EDA_ITEM * GetParent() const
Definition: eda_item.h:165
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend)
Create a copy of the current schematic item, and put it in the undo list.
bool HasFlag(STATUS_FLAGS aFlag) const
Definition: eda_item.h:206
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163
The symbol library editor main window.

◆ searchSupplementaryClipboard()

bool SCH_EDITOR_CONTROL::searchSupplementaryClipboard ( const wxString &  aSheetFilename,
SCH_SCREEN **  aScreen 
)
private

Definition at line 1251 of file sch_editor_control.cpp.

1253 {
1254  if( m_supplementaryClipboard.count( aSheetFilename ) > 0 )
1255  {
1256  *aScreen = m_supplementaryClipboard[ aSheetFilename ];
1257  return true;
1258  }
1259 
1260  return false;
1261 }
std::map< wxString, SCH_SCREEN * > m_supplementaryClipboard

References m_supplementaryClipboard.

Referenced by Paste().

◆ SetContextMenu()

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

Assign a context menu and tells when it should be activated.

Parameters
aMenuis the menu to be assigned.
aTriggerdetermines conditions upon which the context menu is activated.

Definition at line 76 of file tool_interactive.cpp.

77 {
78  if( aMenu )
79  aMenu->SetTool( this );
80  else
81  aTrigger = CMENU_OFF;
82 
83  m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
84 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void SetTool(TOOL_INTERACTIVE *aTool)
Set a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Set behavior of the tool's context popup menu.

References CMENU_OFF, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ScheduleContextMenu(), and ACTION_MENU::SetTool().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ setTransitions()

void SCH_EDITOR_CONTROL::setTransitions ( )
overrideprivatevirtual

This method is meant to be overridden in order to specify handlers for events.

It is called every time tool is reset or finished.

Implements TOOL_INTERACTIVE.

Definition at line 1780 of file sch_editor_control.cpp.

1781 {
1782  Go( &SCH_EDITOR_CONTROL::New, ACTIONS::doNew.MakeEvent() );
1783  Go( &SCH_EDITOR_CONTROL::Open, ACTIONS::open.MakeEvent() );
1784  Go( &SCH_EDITOR_CONTROL::Save, ACTIONS::save.MakeEvent() );
1788  Go( &SCH_EDITOR_CONTROL::Print, ACTIONS::print.MakeEvent() );
1789  Go( &SCH_EDITOR_CONTROL::Plot, ACTIONS::plot.MakeEvent() );
1790  Go( &SCH_EDITOR_CONTROL::Quit, ACTIONS::quit.MakeEvent() );
1791 
1794 
1803 
1808 
1809 #ifdef KICAD_SPICE
1810  Go( &SCH_EDITOR_CONTROL::SimProbe, EE_ACTIONS::simProbe.MakeEvent() );
1811  Go( &SCH_EDITOR_CONTROL::SimTune, EE_ACTIONS::simTune.MakeEvent() );
1812 #endif /* KICAD_SPICE */
1813 
1820 
1822 
1823  Go( &SCH_EDITOR_CONTROL::Undo, ACTIONS::undo.MakeEvent() );
1824  Go( &SCH_EDITOR_CONTROL::Redo, ACTIONS::redo.MakeEvent() );
1825  Go( &SCH_EDITOR_CONTROL::Cut, ACTIONS::cut.MakeEvent() );
1826  Go( &SCH_EDITOR_CONTROL::Copy, ACTIONS::copy.MakeEvent() );
1827  Go( &SCH_EDITOR_CONTROL::Paste, ACTIONS::paste.MakeEvent() );
1829 
1842 
1844 
1848 
1852 }
int Save(const TOOL_EVENT &aEvent)
int EditWithSymbolEditor(const TOOL_EVENT &aEvent)
int FindAndReplace(const TOOL_EVENT &aEvent)
static TOOL_ACTION rescueSymbols
Definition: ee_actions.h:155
int Copy(const TOOL_EVENT &aEvent)
static const TOOL_EVENT SelectedEvent
Definition: actions.h:201
static TOOL_ACTION findAndReplace
Definition: actions.h:80
static TOOL_ACTION exportNetlist
Definition: ee_actions.h:162
static TOOL_ACTION navigateHierarchy
Definition: ee_actions.h:183
int ShowSchematicSetup(const TOOL_EVENT &aEvent)
int HighlightNetCursor(const TOOL_EVENT &aEvent)
static TOOL_ACTION assignFootprints
Definition: ee_actions.h:148
static TOOL_ACTION pageSettings
Definition: actions.h:59
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:202
int Redo(const TOOL_EVENT &aEvent)
Clipboard support.
int NavigateHierarchy(const TOOL_EVENT &aEvent)
int EditSymbolFields(const TOOL_EVENT &aEvent)
static TOOL_ACTION replaceAll
Definition: actions.h:84
int ReplaceAndFindNext(const TOOL_EVENT &aEvent)
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
static TOOL_ACTION remapSymbols
Definition: ee_actions.h:156
int New(const TOOL_EVENT &aEvent)
int FindNext(const TOOL_EVENT &aEvent)
static TOOL_ACTION updatePcbFromSchematic
Definition: actions.h:166
int ExplicitCrossProbeToPcb(const TOOL_EVENT &aEvent)
static TOOL_ACTION print
Definition: actions.h:60
int Annotate(const TOOL_EVENT &aEvent)
int GenerateBOM(const TOOL_EVENT &aEvent)
static TOOL_ACTION find
Definition: actions.h:79
int EditSymbolLibraryLinks(const TOOL_EVENT &aEvent)
int CrossProbeToPcb(const TOOL_EVENT &aEvent)
Equivalent to the above, but initiated by the user.
static TOOL_ACTION updateNetHighlighting
Definition: ee_actions.h:216
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
int DrawSheetOnClipboard(const TOOL_EVENT &aEvent)
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:206
int SaveAs(const TOOL_EVENT &aEvent)
int ToggleForceHV(const TOOL_EVENT &aEvent)
int HighlightNet(const TOOL_EVENT &aEvent)
< Highlight net under the cursor.
static TOOL_ACTION leaveSheet
Definition: ee_actions.h:182
static TOOL_ACTION updateFind
Definition: actions.h:85
static TOOL_ACTION annotate
Definition: ee_actions.h:139
int EnterSheet(const TOOL_EVENT &aEvent)
int ShowPcbNew(const TOOL_EVENT &aEvent)
int Paste(const TOOL_EVENT &aEvent)
static TOOL_ACTION showPcbNew
Definition: ee_actions.h:160
static TOOL_ACTION copy
Definition: actions.h:70
int UpdatePCB(const TOOL_EVENT &aEvent)
int ShowCvpcb(const TOOL_EVENT &aEvent)
static TOOL_ACTION highlightNetTool
Definition: ee_actions.h:217
static TOOL_ACTION showBusManager
Definition: ee_actions.h:150
static TOOL_ACTION updateSchematicFromPcb
Definition: actions.h:167
static TOOL_ACTION editSymbolFields
Definition: ee_actions.h:140
int LeaveSheet(const TOOL_EVENT &aEvent)
int ToggleHiddenFields(const TOOL_EVENT &aEvent)
static TOOL_ACTION simTune
Definition: ee_actions.h:211
int Print(const TOOL_EVENT &aEvent)
int ReplaceAll(const TOOL_EVENT &aEvent)
static TOOL_ACTION open
Definition: actions.h:53
static TOOL_ACTION explicitCrossProbe
Definition: ee_actions.h:196
static TOOL_ACTION save
Definition: actions.h:54
static TOOL_ACTION doNew
Definition: actions.h:47
int UpdateFind(const TOOL_EVENT &aEvent)
Notifies pcbnew about the selected item.
int Plot(const TOOL_EVENT &aEvent)
static TOOL_ACTION cut
Definition: actions.h:69
int ImportFPAssignments(const TOOL_EVENT &aEvent)
static TOOL_ACTION quit
Definition: actions.h:62
static const TOOL_EVENT ClearedEvent
Selected item had a property changed (except movement)
Definition: actions.h:203
static TOOL_ACTION replaceAndFindNext
Definition: actions.h:83
static TOOL_ACTION plot
Definition: actions.h:61
int ToggleHiddenPins(const TOOL_EVENT &aEvent)
int UpdateNetHighlighting(const TOOL_EVENT &aEvent)
Launch a tool to highlight nets.
int RemapSymbols(const TOOL_EVENT &aEvent)
int AssignNetclass(const TOOL_EVENT &aEvent)
static TOOL_ACTION pasteSpecial
Definition: actions.h:72
int Open(const TOOL_EVENT &aEvent)
static TOOL_ACTION findNextMarker
Definition: actions.h:82
static TOOL_ACTION redo
Definition: actions.h:68
int PageSetup(const TOOL_EVENT &aEvent)
int Quit(const TOOL_EVENT &aEvent)
static TOOL_ACTION saveAs
Definition: actions.h:55
static TOOL_ACTION toggleHiddenPins
Definition: ee_actions.h:192
int ShowBusManager(const TOOL_EVENT &aEvent)
int Cut(const TOOL_EVENT &aEvent)
static TOOL_ACTION importFPAssignments
Definition: ee_actions.h:161
static TOOL_ACTION assignNetclass
Definition: ee_actions.h:149
int RescueSymbols(const TOOL_EVENT &aEvent)
Perform rescue operations to recover old projects from before certain changes were made.
int ClearHighlight(const TOOL_EVENT &aEvent)
Update net highlighting after an edit.
static TOOL_ACTION drawSheetOnClipboard
Definition: ee_actions.h:204
int Undo(const TOOL_EVENT &aEvent)
static TOOL_ACTION enterSheet
Definition: ee_actions.h:181
static TOOL_ACTION clearHighlight
Definition: ee_actions.h:215
static TOOL_ACTION editWithLibEdit
Definition: ee_actions.h:159
static TOOL_ACTION simProbe
Definition: ee_actions.h:210
static TOOL_ACTION undo
Definition: actions.h:67
static TOOL_ACTION generateBOM
Definition: ee_actions.h:163
static TOOL_ACTION highlightNet
Definition: ee_actions.h:214
static TOOL_ACTION schematicSetup
Definition: ee_actions.h:151
static TOOL_ACTION editSymbolLibraryLinks
Definition: ee_actions.h:141
static TOOL_ACTION toggleForceHV
Definition: ee_actions.h:203
int UpdateFromPCB(const TOOL_EVENT &aEvent)
static TOOL_ACTION findNext
Definition: actions.h:81
static TOOL_ACTION paste
Definition: actions.h:71
int ExportNetlist(const TOOL_EVENT &aEvent)
static TOOL_ACTION toggleHiddenFields
Definition: ee_actions.h:193

References Annotate(), EE_ACTIONS::annotate, EE_ACTIONS::assignFootprints, AssignNetclass(), EE_ACTIONS::assignNetclass, ACTIONS::cancelInteractive, EVENTS::ClearedEvent, ClearHighlight(), EE_ACTIONS::clearHighlight, ACTIONS::copy, Copy(), CrossProbeToPcb(), ACTIONS::cut, Cut(), ACTIONS::doNew, DrawSheetOnClipboard(), EE_ACTIONS::drawSheetOnClipboard, EditSymbolFields(), EE_ACTIONS::editSymbolFields, EditSymbolLibraryLinks(), EE_ACTIONS::editSymbolLibraryLinks, EE_ACTIONS::editWithLibEdit, EditWithSymbolEditor(), EnterSheet(), EE_ACTIONS::enterSheet, EE_ACTIONS::explicitCrossProbe, ExplicitCrossProbeToPcb(), ExportNetlist(), EE_ACTIONS::exportNetlist, ACTIONS::find, FindAndReplace(), ACTIONS::findAndReplace, FindNext(), ACTIONS::findNext, ACTIONS::findNextMarker, GenerateBOM(), EE_ACTIONS::generateBOM, TOOL_INTERACTIVE::Go(), HighlightNet(), EE_ACTIONS::highlightNet, HighlightNetCursor(), EE_ACTIONS::highlightNetTool, ImportFPAssignments(), EE_ACTIONS::importFPAssignments, LeaveSheet(), EE_ACTIONS::leaveSheet, NavigateHierarchy(), EE_ACTIONS::navigateHierarchy, New(), Open(), ACTIONS::open, ACTIONS::pageSettings, PageSetup(), ACTIONS::paste, Paste(), ACTIONS::pasteSpecial, Plot(), ACTIONS::plot, Print(), ACTIONS::print, Quit(), ACTIONS::quit, ACTIONS::redo, Redo(), RemapSymbols(), EE_ACTIONS::remapSymbols, ReplaceAll(), ACTIONS::replaceAll, ReplaceAndFindNext(), ACTIONS::replaceAndFindNext, RescueSymbols(), EE_ACTIONS::rescueSymbols, Save(), ACTIONS::save, SaveAs(), ACTIONS::saveAs, EE_ACTIONS::schematicSetup, EVENTS::SelectedEvent, EVENTS::SelectedItemsModified, ShowBusManager(), EE_ACTIONS::showBusManager, ShowCvpcb(), ShowPcbNew(), EE_ACTIONS::showPcbNew, ShowSchematicSetup(), EE_ACTIONS::simProbe, EE_ACTIONS::simTune, ToggleForceHV(), EE_ACTIONS::toggleForceHV, ToggleHiddenFields(), EE_ACTIONS::toggleHiddenFields, ToggleHiddenPins(), EE_ACTIONS::toggleHiddenPins, ACTIONS::undo, Undo(), EVENTS::UnselectedEvent, UpdateFind(), ACTIONS::updateFind, UpdateFromPCB(), UpdateNetHighlighting(), EE_ACTIONS::updateNetHighlighting, UpdatePCB(), ACTIONS::updatePcbFromSchematic, and ACTIONS::updateSchematicFromPcb.

◆ ShowBusManager()

int SCH_EDITOR_CONTROL::ShowBusManager ( const TOOL_EVENT aEvent)

Definition at line 1692 of file sch_editor_control.cpp.

1693 {
1695  return 0;
1696 }
void InvokeDialogBusManager(SCH_EDIT_FRAME *aCaller)
Create and show DIALOG_BUS_MANAGER.

References InvokeDialogBusManager(), and EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame.

Referenced by setTransitions().

◆ ShowCvpcb()

int SCH_EDITOR_CONTROL::ShowCvpcb ( const TOOL_EVENT aEvent)

Definition at line 1617 of file sch_editor_control.cpp.

1618 {
1619  wxCommandEvent dummy;
1621  return 0;
1622 }
void OnOpenCvpcb(wxCommandEvent &event)
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
Definition: sch_symbol.cpp:69

References dummy(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, and SCH_EDIT_FRAME::OnOpenCvpcb().

Referenced by setTransitions().

◆ ShowPcbNew()

int SCH_EDITOR_CONTROL::ShowPcbNew ( const TOOL_EVENT aEvent)

Definition at line 1642 of file sch_editor_control.cpp.

1643 {
1644  wxCommandEvent dummy;
1646  return 0;
1647 }
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
Definition: sch_symbol.cpp:69
void OnOpenPcbnew(wxCommandEvent &event)

References dummy(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, and SCH_EDIT_FRAME::OnOpenPcbnew().

Referenced by setTransitions().

◆ ShowSchematicSetup()

int SCH_EDITOR_CONTROL::ShowSchematicSetup ( const TOOL_EVENT aEvent)

Definition at line 93 of file sch_editor_control.cpp.

94 {
96  return 0;
97 }
void ShowSchematicSetupDialog(const wxString &aInitialPage=wxEmptyString)

References EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, and SCH_EDIT_FRAME::ShowSchematicSetupDialog().

Referenced by setTransitions().

◆ ToggleForceHV()

int SCH_EDITOR_CONTROL::ToggleForceHV ( const TOOL_EVENT aEvent)

◆ ToggleHiddenFields()

int SCH_EDITOR_CONTROL::ToggleHiddenFields ( const TOOL_EVENT aEvent)

Definition at line 1757 of file sch_editor_control.cpp.

1758 {
1761 
1762  KIGFX::SCH_PAINTER* painter = static_cast<KIGFX::SCH_PAINTER*>( getView()->GetPainter() );
1764 
1766  m_frame->GetCanvas()->Refresh();
1767 
1768  return 0;
1769 }
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1415
EESCHEMA_SETTINGS * eeconfig() const
Item needs to be redrawn.
Definition: view_item.h:57
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Contains methods for drawing schematic-specific items.
Definition: sch_painter.h:133
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
virtual SCH_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
Definition: sch_painter.h:142

References SCH_BASE_FRAME::eeconfig(), SCH_BASE_FRAME::GetCanvas(), KIGFX::SCH_PAINTER::GetSettings(), TOOL_BASE::getView(), EESCHEMA_SETTINGS::m_Appearance, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, KIGFX::SCH_RENDER_SETTINGS::m_ShowHiddenText, EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::REPAINT, EESCHEMA_SETTINGS::APPEARANCE::show_hidden_fields, and KIGFX::VIEW::UpdateAllItems().

Referenced by setTransitions().

◆ ToggleHiddenPins()

int SCH_EDITOR_CONTROL::ToggleHiddenPins ( const TOOL_EVENT aEvent)

Definition at line 1742 of file sch_editor_control.cpp.

1743 {
1746 
1747  KIGFX::SCH_PAINTER* painter = static_cast<KIGFX::SCH_PAINTER*>( getView()->GetPainter() );
1749 
1751  m_frame->GetCanvas()->Refresh();
1752 
1753  return 0;
1754 }
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1415
EESCHEMA_SETTINGS * eeconfig() const
Item needs to be redrawn.
Definition: view_item.h:57
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Contains methods for drawing schematic-specific items.
Definition: sch_painter.h:133
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
virtual SCH_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
Definition: sch_painter.h:142
bool GetShowAllPins() const override
Allow edit frame to show/hide hidden pins.

References SCH_BASE_FRAME::eeconfig(), SCH_BASE_FRAME::GetCanvas(), KIGFX::SCH_PAINTER::GetSettings(), SCH_EDIT_FRAME::GetShowAllPins(), TOOL_BASE::getView(), EESCHEMA_SETTINGS::m_Appearance, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, KIGFX::SCH_RENDER_SETTINGS::m_ShowHiddenPins, EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::REPAINT, EESCHEMA_SETTINGS::APPEARANCE::show_hidden_pins, and KIGFX::VIEW::UpdateAllItems().

Referenced by setTransitions().

◆ Undo()

int SCH_EDITOR_CONTROL::Undo ( const TOOL_EVENT aEvent)

Definition at line 1151 of file sch_editor_control.cpp.

1152 {
1153  if( m_frame->GetUndoCommandCount() <= 0 )
1154  return 0;
1155 
1156  // Inform tools that undo command was issued
1158 
1159  /* Get the old list */
1161 
1162  /* Undo the command */
1164 
1165  /* Put the old list in RedoList */
1166  List->ReversePickersListOrder();
1167  m_frame->PushCommandToRedoList( List );
1168 
1170  selTool->RebuildSelection();
1171 
1174 
1176  m_frame->SyncView();
1177  m_frame->GetCanvas()->Refresh();
1178  m_frame->OnModify();
1179 
1180  return 0;
1181 }
void ReversePickersListOrder()
Reverse the order of pickers stored in this list.
virtual void PushCommandToRedoList(PICKED_ITEMS_LIST *aItem)
Add a command to redo in the redo list.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void OnPageSettingsChange() override
Called when modifying the page settings.
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
virtual int GetUndoCommandCount() const
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
void SyncView()
Mark all items for refresh.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual PICKED_ITEMS_LIST * PopCommandFromUndoList()
Return the last command to undo and remove it from list, nothing is deleted.
A holder to handle information on schematic or board items.
Global action (toolbar/main menu event, global shortcut)
Definition: tool_event.h:151
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
void RebuildSelection()
Rebuild the selection from the EDA_ITEMs' selection flags.
void PutDataInPreviousState(PICKED_ITEMS_LIST *aList)
Restore an undo or redo command to put data pointed by aList in the previous state.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...

References AS_GLOBAL, SCH_BASE_FRAME::GetCanvas(), TOOL_MANAGER::GetTool(), EDA_BASE_FRAME::GetUndoCommandCount(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, SCH_EDIT_FRAME::OnModify(), SCH_EDIT_FRAME::OnPageSettingsChange(), EDA_BASE_FRAME::PopCommandFromUndoList(), TOOL_MANAGER::ProcessEvent(), EDA_BASE_FRAME::PushCommandToRedoList(), SCH_EDIT_FRAME::PutDataInPreviousState(), EE_SELECTION_TOOL::RebuildSelection(), EDA_DRAW_PANEL_GAL::Refresh(), PICKED_ITEMS_LIST::ReversePickersListOrder(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), SCH_BASE_FRAME::SyncView(), TA_UNDO_REDO_PRE, TC_MESSAGE, and SCH_EDIT_FRAME::TestDanglingEnds().

Referenced by setTransitions().

◆ UpdateFind()

int SCH_EDITOR_CONTROL::UpdateFind ( const TOOL_EVENT aEvent)

Notifies pcbnew about the selected item.

Definition at line 245 of file sch_editor_control.cpp.

246 {
247  wxFindReplaceData* data = m_frame->GetFindReplaceData();
248 
249  auto visit =
250  [&]( EDA_ITEM* aItem, SCH_SHEET_PATH* aSheet )
251  {
252  if( data && aItem->Matches( *data, aSheet ) )
253  {
254  aItem->SetForceVisible( true );
255  m_selectionTool->BrightenItem( aItem );
256  }
257  else if( aItem->IsBrightened() )
258  {
259  aItem->SetForceVisible( false );
261  }
262  };
263 
264  if( aEvent.IsAction( &ACTIONS::find ) || aEvent.IsAction( &ACTIONS::findAndReplace )
265  || aEvent.IsAction( &ACTIONS::updateFind ) )
266  {
268 
269  for( SCH_ITEM* item : m_frame->GetScreen()->Items() )
270  {
271  visit( item, &m_frame->GetCurrentSheet() );
272 
273  item->RunOnChildren(
274  [&]( SCH_ITEM* aChild )
275  {
276  visit( aChild, &m_frame->GetCurrentSheet() );
277  } );
278  }
279  }
280  else if( aEvent.Matches( EVENTS::SelectedItemsModified ) )
281  {
282  for( EDA_ITEM* item : m_selectionTool->GetSelection() )
283  visit( item, &m_frame->GetCurrentSheet() );
284  }
285 
286  getView()->UpdateItems();
287  m_frame->GetCanvas()->Refresh();
288  m_frame->UpdateTitle();
289 
290  return 0;
291 }
virtual bool Matches(const wxFindReplaceData &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Definition: eda_item.h:415
static TOOL_ACTION findAndReplace
Definition: actions.h:80
wxFindReplaceData * GetFindReplaceData()
Get the find criteria (as set by the dialog).
void UpdateTitle()
Set the main window title bar text.
bool IsBrightened() const
Definition: eda_item.h:176
static TOOL_ACTION find
Definition: actions.h:79
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:206
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:70
EE_SELECTION & GetSelection()
Return the set of currently selected items.
static TOOL_ACTION updateFind
Definition: actions.h:85
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void BrightenItem(EDA_ITEM *aItem)
void SetForceVisible(bool aEnable)
Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is se...
Definition: eda_item.h:254
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
void UpdateItems()
Iterate through the list of items that asked for updating and updates them.
Definition: view.cpp:1397
bool Matches(const TOOL_EVENT &aEvent) const
Test whether two events match in terms of category & action or command.
Definition: tool_event.h:373
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void UnbrightenItem(EDA_ITEM *aItem)
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
int ClearSelection(const TOOL_EVENT &aEvent)
Select all visible items in sheet.
EE_RTREE & Items()
Definition: sch_screen.h:103
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
SCH_SHEET_PATH & GetCurrentSheet() const
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:197

References EE_SELECTION_TOOL::BrightenItem(), EE_SELECTION_TOOL::ClearSelection(), ACTIONS::find, ACTIONS::findAndReplace, SCH_BASE_FRAME::GetCanvas(), SCH_EDIT_FRAME::GetCurrentSheet(), SCH_EDIT_FRAME::GetFindReplaceData(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), TOOL_BASE::getView(), TOOL_EVENT::IsAction(), EDA_ITEM::IsBrightened(), SCH_SCREEN::Items(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_EVENT::Matches(), EDA_ITEM::Matches(), EDA_DRAW_PANEL_GAL::Refresh(), EVENTS::SelectedItemsModified, EDA_ITEM::SetForceVisible(), EE_SELECTION_TOOL::UnbrightenItem(), ACTIONS::updateFind, KIGFX::VIEW::UpdateItems(), and SCH_EDIT_FRAME::UpdateTitle().

Referenced by FindAndReplace(), FindNext(), DIALOG_SCH_FIND::OnIdle(), DIALOG_SCH_FIND::OnSearchForSelect(), and setTransitions().

◆ UpdateFromPCB()

int SCH_EDITOR_CONTROL::UpdateFromPCB ( const TOOL_EVENT aEvent)

Definition at line 1658 of file sch_editor_control.cpp.

1659 {
1661  dlg.ShowModal();
1662  return 0;
1663 }

References EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame.

Referenced by setTransitions().

◆ updateItem()

void EE_TOOL_BASE< SCH_EDIT_FRAME >::updateItem ( EDA_ITEM aItem,
bool  aUpdateRTree 
) const
inlineprotectedinherited

Similar to getView()->Update(), but handles items that are redrawn by their parents and updating the SCH_SCREEN's RTree.

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

Definition at line 102 of file ee_tool_base.h.

◆ UpdateNetHighlighting()

int SCH_EDITOR_CONTROL::UpdateNetHighlighting ( const TOOL_EVENT aEvent)

Launch a tool to highlight nets.

Definition at line 978 of file sch_editor_control.cpp.

979 {
981  CONNECTION_GRAPH* connectionGraph = m_frame->Schematic().ConnectionGraph();
982  std::vector<EDA_ITEM*> itemsToRedraw;
983  const SCH_CONNECTION* selectedConn = m_frame->GetHighlightedConnection();
984 
985  if( !screen )
986  return 0;
987 
988  bool selectedIsBus = selectedConn ? selectedConn->IsBus() : false;
989  wxString selectedName = selectedConn ? selectedConn->Name() : "";
990 
991  bool selectedIsNoNet = false;
992  CONNECTION_SUBGRAPH* selectedSubgraph = nullptr;
993 
994  if( selectedConn && selectedConn->Driver() == nullptr )
995  {
996  selectedIsNoNet = true;
997  selectedSubgraph = connectionGraph->GetSubgraphForItem( selectedConn->Parent() );
998  }
999 
1000  for( SCH_ITEM* item : screen->Items() )
1001  {
1002  SCH_CONNECTION* itemConn = nullptr;
1003  SCH_COMPONENT* symbol = nullptr;
1004  bool redraw = item->IsBrightened();
1005  bool highlight = false;
1006 
1007  if( item->Type() == SCH_COMPONENT_T )
1008  symbol = static_cast<SCH_COMPONENT*>( item );
1009 
1010  if( symbol && symbol->GetPartRef() && symbol->GetPartRef()->IsPower() )
1011  itemConn = symbol->Connection();
1012  else
1013  itemConn = item->Connection();
1014 
1015  if( selectedIsNoNet && selectedSubgraph )
1016  {
1017  for( SCH_ITEM* subgraphItem : selectedSubgraph->m_items )
1018  {
1019  if( item == subgraphItem )
1020  {
1021  highlight = true;
1022  break;
1023  }
1024  }
1025  }
1026  else if( selectedIsBus && itemConn && itemConn->IsNet() )
1027  {
1028  for( const std::shared_ptr<SCH_CONNECTION>& member : selectedConn->Members() )
1029  {
1030  if( member->Name() == itemConn->Name() )
1031  {
1032  highlight = true;
1033  break;
1034  }
1035  else if( member->IsBus() )
1036  {
1037  for( const std::shared_ptr<SCH_CONNECTION>& child_member : member->Members() )
1038  {
1039  if( child_member->Name() == itemConn->Name() )
1040  {
1041  highlight = true;
1042  break;
1043  }
1044  }
1045  }
1046  }
1047  }
1048  else if( selectedConn && itemConn && selectedName == itemConn->Name() )
1049  {
1050  highlight = true;
1051  }
1052 
1053  if( highlight )
1054  item->SetBrightened();
1055  else
1056  item->ClearBrightened();
1057 
1058  redraw |= item->IsBrightened();
1059 
1060  // symbol is only non-null if the item is a SCH_COMPONENT_T
1061  if( symbol )
1062  {
1063  redraw |= symbol->HasBrightenedPins();
1064 
1065  symbol->ClearBrightenedPins();
1066 
1067  for( SCH_PIN* pin : symbol->GetPins() )
1068  {
1069  SCH_CONNECTION* pin_conn = pin->Connection();
1070 
1071  if( pin_conn && pin_conn->Name() == selectedName )
1072  {
1073  pin->SetBrightened();
1074  redraw = true;
1075  }
1076  }
1077 
1078  if( symbol->GetPartRef() && symbol->GetPartRef()->IsPower() )
1079  {
1080  std::vector<SCH_FIELD>& fields = symbol->GetFields();
1081 
1082  for( int id : { REFERENCE_FIELD, VALUE_FIELD } )
1083  {
1084  if( item->IsBrightened() && fields[id].IsVisible() )
1085  fields[id].SetBrightened();
1086  else
1087  fields[id].ClearBrightened();
1088  }
1089  }
1090  }
1091  else if( item->Type() == SCH_SHEET_T )
1092  {
1093  for( SCH_SHEET_PIN* pin : static_cast<SCH_SHEET*>( item )->GetPins() )
1094  {
1095  SCH_CONNECTION* pin_conn = pin->Connection();
1096  bool redrawPin = pin->IsBrightened();
1097 
1098  if( pin_conn && pin_conn->Name() == selectedName )
1099  pin->SetBrightened();
1100  else
1101  pin->ClearBrightened();
1102 
1103  redrawPin ^= pin->IsBrightened();
1104  redraw |= redrawPin;
1105  }
1106  }
1107 
1108  if( redraw )
1109  itemsToRedraw.push_back( item );
1110  }
1111 
1112  // Be sure highlight change will be redrawn
1113  KIGFX::VIEW* view = getView();
1114 
1115  for( EDA_ITEM* redrawItem : itemsToRedraw )
1117 
1118  m_frame->GetCanvas()->Refresh();
1119 
1120  return 0;
1121 }
Field Reference of part, i.e. "IC21".
CONNECTION_GRAPH * ConnectionGraph() const override
Definition: schematic.h:129
Calculates the connectivity of a schematic and generates netlists.
const SCH_CONNECTION * GetHighlightedConnection() const
void ClearBrightenedPins()
bool IsBrightened() const
Definition: eda_item.h:176
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:81
A subgraph is a set of items that are electrically connected on a single sheet.
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populate a std::vector with SCH_FIELDs.
Definition: sch_symbol.cpp:729
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
Definition: sch_item.cpp:131
Item needs to be redrawn.
Definition: view_item.h:57
wxString Name(bool aIgnoreSheet=false) const
Field Value of part, i.e. "3.3K".
std::vector< SCH_ITEM * > m_items
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
SCHEMATIC & Schematic() const
SCH_ITEM * Driver() const
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:65
std::unique_ptr< LIB_PART > & GetPartRef()
Definition: sch_symbol.h:164
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve a list of the SCH_PINs for the given sheet path.
Definition: sch_symbol.cpp:884
bool IsNet() const
SCH_SCREEN * LastScreen()
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
bool HasBrightenedPins()
EE_RTREE & Items()
Definition: sch_screen.h:103
Schematic symbol object.
Definition: sch_symbol.h:78
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
SCH_ITEM * Parent() const
std::vector< std::shared_ptr< SCH_CONNECTION > > & Members()
SCH_SHEET_PATH & GetCurrentSheet() const
CONNECTION_SUBGRAPH * GetSubgraphForItem(SCH_ITEM *aItem)
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67
bool IsBus() const
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:197
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1503

References EDA_ITEM::ClearBrightened(), SCH_COMPONENT::ClearBrightenedPins(), SCH_ITEM::Connection(), SCHEMATIC::ConnectionGraph(), SCH_CONNECTION::Driver(), SCH_BASE_FRAME::GetCanvas(), SCH_EDIT_FRAME::GetCurrentSheet(), SCH_COMPONENT::GetFields(), SCH_EDIT_FRAME::GetHighlightedConnection(), SCH_COMPONENT::GetPartRef(), SCH_COMPONENT::GetPins(), CONNECTION_GRAPH::GetSubgraphForItem(), TOOL_BASE::getView(), SCH_COMPONENT::HasBrightenedPins(), EDA_ITEM::IsBrightened(), SCH_CONNECTION::IsBus(), SCH_CONNECTION::IsNet(), SCH_SCREEN::Items(), SCH_SHEET_PATH::LastScreen(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, CONNECTION_SUBGRAPH::m_items, SCH_CONNECTION::Members(), SCH_CONNECTION::Name(), SCH_CONNECTION::Parent(), pin, REFERENCE_FIELD, EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::REPAINT, SCH_COMPONENT_T, SCH_SHEET_T, SCH_EDIT_FRAME::Schematic(), EDA_ITEM::SetBrightened(), EDA_ITEM::Type(), KIGFX::VIEW::Update(), and VALUE_FIELD.

Referenced by SCH_EDIT_FRAME::DisplayCurrentSheet(), and setTransitions().

◆ updatePastedInstances()

void SCH_EDITOR_CONTROL::updatePastedInstances ( const SCH_SHEET_PATH aPastePath,
const KIID_PATH aClipPath,
SCH_SHEET aSheet,
bool  aForceKeepAnnotations 
)
private

Definition at line 1297 of file sch_editor_control.cpp.

1300 {
1301  for( SCH_ITEM* item : aSheet->GetScreen()->Items() )
1302  {
1303  if( item->Type() == SCH_COMPONENT_T )
1304  {
1305  SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
1306 
1307  KIID_PATH clipItemPath = aClipPath;
1308  clipItemPath.push_back( symbol->m_Uuid );
1309 
1310  // SCH_REFERENCE_LIST doesn't include the root sheet in the path
1311  clipItemPath.erase( clipItemPath.begin() );
1312 
1313  int ii = m_supplementaryClipboardInstances.FindRefByPath( clipItemPath.AsString() );
1314 
1315  if( ii >= 0 )
1316  {
1318 
1319  symbol->SetUnitSelection( &aPastePath, instance.GetUnit() );
1320  symbol->SetUnit( instance.GetUnit() );
1321 
1322  if( aForceKeepAnnotations )
1323  {
1324  symbol->SetRef( &aPastePath, instance.GetRef() );
1325  symbol->SetValue( &aPastePath, instance.GetValue() );
1326  symbol->SetFootprint( &aPastePath, instance.GetFootprint() );
1327  }
1328  else
1329  {
1330  symbol->ClearAnnotation( &aPastePath );
1331  }
1332  }
1333  else
1334  {
1335  symbol->ClearAnnotation( &aPastePath );
1336  }
1337  }
1338  else if( item->Type() == SCH_SHEET_T )
1339  {
1340  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
1341  SCH_SHEET_PATH pastePath = aPastePath;
1342  pastePath.push_back( sheet );
1343 
1344  KIID_PATH clipPath = aClipPath;
1345  clipPath.push_back( sheet->m_Uuid );
1346 
1347  sheet->AddInstance( pastePath.Path() );
1348  updatePastedInstances( pastePath, clipPath, sheet, aForceKeepAnnotations );
1349  }
1350  }
1351 }
int FindRefByPath(const wxString &aPath) const
Search the list for a symbol with the given KIID path.
void updatePastedInstances(const SCH_SHEET_PATH &aPastePath, const KIID_PATH &aClipPath, SCH_SHEET *aSheet, bool aForceKeepAnnotations)
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
int GetUnit() const
SCH_SCREEN * GetScreen() const
Definition: sch_sheet.h:103
wxString GetRef() const
const wxString GetFootprint() const
void SetUnit(int aUnit)
Change the unit number to aUnit.
Definition: sch_symbol.cpp:322
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_REFERENCE_LIST m_supplementaryClipboardInstances
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
const KIID m_Uuid
Definition: eda_item.h:525
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
Definition: sch_symbol.cpp:482
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Set the selected unit of this symbol on one sheet.
Definition: sch_symbol.cpp:567
wxString AsString() const
Definition: kiid.cpp:256
EE_RTREE & Items()
Definition: sch_screen.h:103
Schematic symbol object.
Definition: sch_symbol.h:78
const wxString GetValue() const
void SetValue(const SCH_SHEET_PATH *sheet, const wxString &aValue)
Definition: sch_symbol.cpp:614
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath)
Clear exiting symbol annotation.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:197
void SetFootprint(const SCH_SHEET_PATH *sheet, const wxString &aFootprint)
Definition: sch_symbol.cpp:664
A helper to define a symbol's reference designator in a schematic.
bool AddInstance(const KIID_PATH &aInstance)
Add a new instance aSheetPath to the instance list.
Definition: sch_sheet.cpp:1093

References SCH_SHEET::AddInstance(), KIID_PATH::AsString(), SCH_COMPONENT::ClearAnnotation(), SCH_REFERENCE_LIST::FindRefByPath(), SCH_REFERENCE::GetFootprint(), SCH_REFERENCE::GetRef(), SCH_SHEET::GetScreen(), SCH_REFERENCE::GetUnit(), SCH_REFERENCE::GetValue(), SCH_SCREEN::Items(), m_supplementaryClipboardInstances, EDA_ITEM::m_Uuid, SCH_SHEET_PATH::Path(), SCH_SHEET_PATH::push_back(), SCH_COMPONENT_T, SCH_SHEET_T, SCH_COMPONENT::SetFootprint(), SCH_COMPONENT::SetRef(), SCH_COMPONENT::SetUnit(), SCH_COMPONENT::SetUnitSelection(), SCH_COMPONENT::SetValue(), and EDA_ITEM::Type().

Referenced by Paste().

◆ UpdatePCB()

int SCH_EDITOR_CONTROL::UpdatePCB ( const TOOL_EVENT aEvent)

Definition at line 1650 of file sch_editor_control.cpp.

1651 {
1652  wxCommandEvent dummy;
1654  return 0;
1655 }
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
Definition: sch_symbol.cpp:69
void OnUpdatePCB(wxCommandEvent &event)

References dummy(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, and SCH_EDIT_FRAME::OnUpdatePCB().

Referenced by setTransitions().

◆ Wait()

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

Suspend execution of the tool until an event specified in aEventList arrives.

No parameters means waiting for any event.

Definition at line 57 of file tool_interactive.cpp.

58 {
59  return m_toolMgr->ScheduleWait( this, aEventList );
60 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_EVENT * ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pause execution of a given tool until one or more events matching aConditions arrives.

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), ZOOM_TOOL::Main(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), CVPCB_CONTROL::Main(), PL_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_frame

SCH_EDIT_FRAME * EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame
protectedinherited

Definition at line 174 of file ee_tool_base.h.

◆ m_isSymbolEditor

bool EE_TOOL_BASE< SCH_EDIT_FRAME >::m_isSymbolEditor
protectedinherited

Definition at line 177 of file ee_tool_base.h.

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

The functions below are not yet implemented - their interface may change.

Definition at line 106 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), ROUTER_TOOL::Init(), LENGTH_TUNER_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), PL_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_CONTROL::Init(), PCB_VIEWER_TOOLS::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PL_SELECTION_TOOL::Init(), SCH_DRAWING_TOOLS::Init(), GERBVIEW_SELECTION_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), EDA_3D_CONTROLLER::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), PCB_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), PCB_TOOL_BASE::Init(), PICKER_TOOL::Init(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_PICKER_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_pickerItem

EDA_ITEM* SCH_EDITOR_CONTROL::m_pickerItem
private

Definition at line 207 of file sch_editor_control.h.

◆ m_probingPcbToSch

bool SCH_EDITOR_CONTROL::m_probingPcbToSch
private

Definition at line 206 of file sch_editor_control.h.

Referenced by doCrossProbeSchToPcb(), and FindComponentAndItem().

◆ m_selectionTool

EE_SELECTION_TOOL* EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool
protectedinherited

Definition at line 176 of file ee_tool_base.h.

◆ m_supplementaryClipboard

std::map<wxString, SCH_SCREEN*> SCH_EDITOR_CONTROL::m_supplementaryClipboard
private

Definition at line 211 of file sch_editor_control.h.

Referenced by doCopy(), and searchSupplementaryClipboard().

◆ m_supplementaryClipboardInstances

SCH_REFERENCE_LIST SCH_EDITOR_CONTROL::m_supplementaryClipboardInstances
private

Definition at line 212 of file sch_editor_control.h.

Referenced by doCopy(), and updatePastedInstances().

◆ m_supplementaryClipboardPath

KIID_PATH SCH_EDITOR_CONTROL::m_supplementaryClipboardPath
private

Definition at line 213 of file sch_editor_control.h.

Referenced by doCopy(), and Paste().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

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

Definition at line 210 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), TOOL_BASE::GetId(), and TOOL_BASE::IsToolActive().

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 215 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), PCB_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), SCH_MOVE_TOOL::AlignElements(), AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), SCH_EDIT_TOOL::BreakWire(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_CONTROL::ClearAllLayers(), BOARD_INSPECTION_TOOL::ClearHighlight(), ClearHighlight(), PL_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), PL_EDIT_TOOL::Copy(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), BOARD_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), Cut(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), doCopy(), doCrossProbeSchToPcb(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), BOARD_INSPECTION_TOOL::doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), SYMBOL_EDITOR_EDIT_TOOL::editGraphicProperties(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), EditWithSymbolEditor(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), EE_INSPECTION_TOOL::ExcludeMarker(), PCB_SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), PCB_SELECTION_TOOL::filterSelection(), PCB_SELECTION_TOOL::findCallback(), FindComponentAndItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), EE_SELECTION_TOOL::GetNode(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getToolHolderInt(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), PCB_CONTROL::GridSetOrigin(), GROUP_TOOL::Group(), EE_SELECTION_TOOL::GuessSelectionCandidates(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::HighlightNet(), HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), HighlightNetCursor(), BOARD_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), PL_EDIT_TOOL::ImportWorksheetContent(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), GROUP_TOOL::Init(), CONVERT_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(),