KiCad PCB EDA Suite
SCH_EDITOR_CONTROL Class Reference

SCH_EDITOR_CONTROL. 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 }
 

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

Notifies pcbnew about the selected item.

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

Equivalent to the above, but initiated by the user.

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

Highlights net under the cursor.

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

Removes any net highlighting

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

Updates net highlighting after an edit

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

Launches a tool to highlight nets.

More...
 
int AssignNetclass (const TOOL_EVENT &aEvent)
 
int Undo (const TOOL_EVENT &aEvent)
 
int Redo (const TOOL_EVENT &aEvent)
 
int Cut (const TOOL_EVENT &aEvent)
 

Clipboard support.

More...
 
int Copy (const TOOL_EVENT &aEvent)
 
int Paste (const TOOL_EVENT &aEvent)
 
int EditWithLibEdit (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 BackAnnotateFootprints (const std::string &aChangedSetOfReferences)
 
SCH_ITEMFindComponentAndItem (const wxString &aReference, bool aSearchHierarchy, SCH_SEARCH_T aSearchType, const wxString &aSearchText)
 Finds a component in the schematic and an item in this component. More...
 
bool Init () override
 Function Init() Init() is called once upon a registration of the tool. More...
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings the tool to a known, initial state. More...
 
void Activate ()
 Function Activate() Runs the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Function SetContextMenu() More...
 
void RunMainStack (std::function< void()> aFunc)
 Function RunMainStack() More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Go() More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Wait() More...
 
TOOL_TYPE GetType () const
 Function GetType() Returns the type of the tool. More...
 
TOOL_ID GetId () const
 Function GetId() Returns the unique identifier of the tool. More...
 
const std::string & GetName () const
 Function GetName() Returns the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Protected Member Functions

void updateView (EDA_ITEM *aItem) const
 

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

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

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

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

Protected Attributes

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

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

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

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 

Private Member Functions

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)
 
bool loadCmpToFootprintLinkFile ()
 Loads a .cmp file from CvPcb and update the footprint field of components. More...
 
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
 

Sets up handlers for various events.

More...
 
SCH_ITEMnextMatch (SCH_SCREEN *aScreen, SCH_ITEM *aAfter, wxFindReplaceData *aData)
 Advances 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
 

Detailed Description

SCH_EDITOR_CONTROL.

Handles actions specific to the schematic editor in eeschema.

Definition at line 40 of file sch_editor_control.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determines the reason of reset for a tool

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 79 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ SCH_EDITOR_CONTROL()

SCH_EDITOR_CONTROL::SCH_EDITOR_CONTROL ( )
inline

Definition at line 43 of file sch_editor_control.h.

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

◆ ~SCH_EDITOR_CONTROL()

SCH_EDITOR_CONTROL::~SCH_EDITOR_CONTROL ( )
inline

Definition at line 49 of file sch_editor_control.h.

49 { }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs the tool.

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

Definition at line 51 of file tool_interactive.cpp.

52 {
54 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID.

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

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), LIB_TREE::onContextMenu(), POINT_EDITOR::OnSelectionChange(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ Annotate()

int SCH_EDITOR_CONTROL::Annotate ( const TOOL_EVENT aEvent)

Definition at line 1556 of file sch_editor_control.cpp.

1557 {
1558  wxCommandEvent dummy;
1559  m_frame->OnAnnotate( dummy );
1560  return 0;
1561 }
void OnAnnotate(wxCommandEvent &event)
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.

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

Referenced by setTransitions().

◆ AssignNetclass()

int SCH_EDITOR_CONTROL::AssignNetclass ( const TOOL_EVENT aEvent)

Definition at line 904 of file sch_editor_control.cpp.

905 {
908  VECTOR2D cursorPos = controls->GetCursorPosition( !aEvent.Modifier( MD_ALT ) );
909 
910  // TODO remove once real-time connectivity is a given
912  // Ensure the netlist data is up to date:
914 
915  // Remove selection in favour of highlighting so the whole net is highlighted
916  selectionTool->ClearSelection();
917  highlightNet( m_toolMgr, cursorPos );
918 
920 
921  if( conn )
922  {
923  wxString netName = conn->Name( true );
924 
925  if( conn->Name( true ).IsEmpty() )
926  {
927  DisplayError( m_frame, _( "Net must be labelled to assign a netclass." ) );
929  return 0;
930  }
931 
933  wxString netclassName = netSettings.m_NetClassAssignments[ netName ];
934 
935  wxArrayString headers;
936  std::vector<wxArrayString> items;
937 
938  headers.Add( _( "Netclasses" ) );
939 
940  wxArrayString defaultItem;
941  defaultItem.Add( _( "Default" ) );
942  items.emplace_back( defaultItem );
943 
944  for( const auto& ii : netSettings.m_NetClasses )
945  {
946  wxArrayString item;
947  item.Add( ii.first );
948  items.emplace_back( item );
949  }
950 
951  EDA_LIST_DIALOG dlg( m_frame, _( "Assign Netclass" ), headers, items, netclassName );
952  dlg.SetListLabel( _( "Select netclass:" ) );
953 
954  if( dlg.ShowModal() == wxID_OK )
955  {
956  netclassName = dlg.GetTextSelection();
957 
958  // Remove from old netclass membership list
959  if( netSettings.m_NetClassAssignments.count( netName ) )
960  {
961  const wxString oldNetclassName = netSettings.m_NetClassAssignments[ netName ];
962  NETCLASSPTR oldNetclass = netSettings.m_NetClasses.Find( oldNetclassName );
963 
964  if( oldNetclass )
965  oldNetclass->Remove( netName );
966  }
967 
968  // Add to new netclass membership list
969  NETCLASSPTR newNetclass = netSettings.m_NetClasses.Find( netclassName );
970 
971  if( newNetclass )
972  {
973  newNetclass->Add( netName );
974  }
975 
976  netSettings.m_NetClassAssignments[ netName ] = netclassName;
977  netSettings.ResolveNetClassAssignments();
978  }
979  }
980 
982  return 0;
983 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
std::map< wxString, wxString > m_NetClassAssignments
Definition: net_settings.h:43
NETCLASSPTR Find(const wxString &aName) const
Function Find searches this container for a NETCLASS given by aName.
Definition: netclass.cpp:132
void ResolveNetClassAssignments()
Explodes the list of netclass assignments to include atomic members of composite labels (buses).
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generates the connection data for the entire schematic hierarchy.
const SCH_CONNECTION * GetHighlightedConnection() const
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
NET_SETTINGS & NetSettings()
Definition: project_file.h:92
EDA_LIST_DIALOG.
NETCLASSES m_NetClasses
Definition: net_settings.h:39
VTBL_ENTRY PROJECT_FILE & GetProjectFile() const
Definition: project.h:129
SCHEMATIC & Schematic() const
VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (such a...
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)
const wxString & Name(bool aIgnoreSheet=false) const
static VECTOR2D CLEAR
int Modifier(int aMask=MD_MODIFIER_MASK) const
Returns information about key modifiers state (Ctrl, Alt, etc.)
Definition: tool_event.h:342
static bool m_allowRealTime
bool m_realTimeConnectivity
Do real-time connectivity.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
int ClearSelection(const TOOL_EVENT &aEvent)
Clear current selection event handler.
#define _(s)
Definition: 3d_actions.cpp:33
PROJECT & Prj() const
Return a reference to the project this schematic is part of.
Definition: schematic.h:77
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers of advanced config.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42

References _, CLEAR, EE_SELECTION_TOOL::ClearSelection(), DisplayError(), NETCLASSES::Find(), ADVANCED_CFG::GetCfg(), SCH_EDIT_FRAME::GetHighlightedConnection(), 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(), and EDA_LIST_DIALOG::SetListLabel().

Referenced by setTransitions().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Function attachManager()

Sets the TOOL_MANAGER the tool will belong to. Called by TOOL_MANAGER::RegisterTool()

Definition at line 60 of file tool_base.cpp.

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

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ BackAnnotateFootprints()

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

Definition at line 46 of file backanno.cpp.

47 {
48  // Build a flat list of components in schematic:
49  SCH_REFERENCE_LIST refs;
51  bool isChanged = false;
52 
53  sheets.GetComponents( refs, false );
54 
55  DSNLEXER lexer( aChangedSetOfReferences, FROM_UTF8( __func__ ) );
56  PTREE doc;
57 
58  try
59  {
60  Scan( &doc, &lexer );
61 
62 #if defined(DEBUG) && 0
64  Format( &sf, 0, 0, doc );
65  printf( "%s: '%s'\n", __func__, sf.GetString().c_str() );
66 #endif
67 
68  CPTREE& back_anno = doc.get_child( "back_annotation" );
69  wxString footprint;
70 
71  for( PTREE::const_iterator ref = back_anno.begin(); ref != back_anno.end(); ++ref )
72  {
73  wxASSERT( ref->first == "ref" );
74 
75  wxString reference = (UTF8&) ref->second.front().first;
76 
77  // Ensure the "fpid" node contains a footprint name,
78  // and get it if exists
79  if( ref->second.get_child( "fpid" ).size() )
80  {
81  wxString tmp = (UTF8&) ref->second.get_child( "fpid" ).front().first;
82  footprint = tmp;
83  }
84  else
85  footprint.Empty();
86 
87  // Search the component in the flat list
88  for( unsigned ii = 0; ii < refs.GetCount(); ++ii )
89  {
90  if( reference == refs[ii].GetRef() )
91  {
92  // We have found a candidate.
93  // Note: it can be not unique (multiple parts per package)
94  // So we *do not* stop the search here
95  SCH_COMPONENT* component = refs[ii].GetComp();
96  SCH_FIELD* fpfield = component->GetField( FOOTPRINT );
97  const wxString& oldfp = fpfield->GetText();
98 
99  if( !oldfp && fpfield->IsVisible() )
100  fpfield->SetVisible( false );
101 
102  if( oldfp != footprint )
103  isChanged = true;
104 
105  fpfield->SetText( footprint );
106  }
107  }
108  }
109  }
110  catch( const PTREE_ERROR& ex )
111  {
112  // remap the exception to something the caller is likely to understand.
113  THROW_IO_ERROR( ex.what() );
114  }
115 
116  if( isChanged )
117  {
118  m_frame->SyncView();
119  m_frame->GetCanvas()->Refresh();
120  m_frame->OnModify();
121  }
122 }
UTF8 is an 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to...
Definition: utf8.h:73
SCH_SHEET_LIST.
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:114
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:92
void Scan(PTREE *aTree, DSNLEXER *aLexer)
Function Scan fills an empty PTREE with information from a KiCad s-expresion stream.
Definition: ptree.cpp:90
bool IsVisible() const
Definition: eda_text.h:185
void SetVisible(bool aVisible)
Definition: eda_text.h:184
Field Name Module PCB, i.e. "16DIP300".
SCH_REFERENCE_LIST is used to create a flattened list of components because in a complex hierarchy,...
boost::property_tree::ptree PTREE
Definition: ptree.h:54
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:116
void GetComponents(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false) const
Function GetComponents adds a SCH_REFERENCE() object to aReferences for each component in the list of...
const PTREE CPTREE
Definition: ptree.h:55
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
#define THROW_IO_ERROR(msg)
const std::string & GetString()
Definition: richio.h:475
boost::property_tree::ptree_error PTREE_ERROR
Definition: ptree.h:56
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
unsigned GetCount() const
Function GetCount.
SCH_FIELD * GetField(int aFieldNdx)
Returns a field in this symbol.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
Schematic symbol object.
Definition: sch_component.h:88
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
STRING_FORMATTER implements OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:445
DSNLEXER implements a lexical analyzer for the SPECCTRA DSN file format.
Definition: dsnlexer.h:79
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:126

References FOOTPRINT, Format(), FROM_UTF8(), SCH_BASE_FRAME::GetCanvas(), SCH_SHEET_LIST::GetComponents(), SCH_REFERENCE_LIST::GetCount(), SCH_COMPONENT::GetField(), SCHEMATIC::GetSheets(), STRING_FORMATTER::GetString(), EDA_TEXT::GetText(), 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(), EDA_TEXT::SetText(), EDA_TEXT::SetVisible(), SCH_BASE_FRAME::SyncView(), and THROW_IO_ERROR.

Referenced by SCH_EDIT_FRAME::KiwayMailIn().

◆ ClearHighlight()

int SCH_EDITOR_CONTROL::ClearHighlight ( const TOOL_EVENT aEvent)

Removes any net highlighting

Definition at line 896 of file sch_editor_control.cpp.

897 {
899 
900  return 0;
901 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
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 1284 of file sch_editor_control.cpp.

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

References doCopy().

Referenced by setTransitions().

◆ CrossProbeToPcb()

int SCH_EDITOR_CONTROL::CrossProbeToPcb ( const TOOL_EVENT aEvent)

Notifies pcbnew about the selected item.

Definition at line 528 of file sch_editor_control.cpp.

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

References doCrossProbeSchToPcb().

Referenced by setTransitions().

◆ Cut()

int SCH_EDITOR_CONTROL::Cut ( const TOOL_EVENT aEvent)

Clipboard support.

Definition at line 1267 of file sch_editor_control.cpp.

1268 {
1269  wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( wxWindow::FindFocus() );
1270 
1271  if( textEntry )
1272  {
1273  textEntry->Cut();
1274  return 0;
1275  }
1276 
1277  if( doCopy() )
1279 
1280  return 0;
1281 }
static TOOL_ACTION doDelete
Definition: actions.h:74
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
bool 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 1225 of file sch_editor_control.cpp.

1226 {
1228  EE_SELECTION& selection = selTool->RequestSelection();
1229 
1230  if( !selection.GetSize() )
1231  return false;
1232 
1233  selection.SetScreen( m_frame->GetScreen() );
1234  m_supplementaryClipboard.clear();
1235 
1236  for( EDA_ITEM* item : selection )
1237  {
1238  if( item->Type() == SCH_SHEET_T )
1239  {
1240  SCH_SHEET* sheet = (SCH_SHEET*) item;
1241  m_supplementaryClipboard[ sheet->GetFileName() ] = sheet->GetScreen();
1242  }
1243  }
1244 
1245  STRING_FORMATTER formatter;
1246  SCH_SEXPR_PLUGIN plugin;
1247 
1248  plugin.Format( &selection, &formatter );
1249 
1250  return m_toolMgr->SaveClipboard( formatter.GetString() );
1251 }
void SetScreen(SCH_SCREEN *aScreen)
Definition: ee_selection.h:46
void Format(SCH_SHEET *aSheet)
bool SaveClipboard(const std::string &aText)
Stores an information to the system clipboard.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
SCH_SCREEN * GetScreen() const
Definition: sch_sheet.h:282
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
std::map< wxString, SCH_SCREEN * > m_supplementaryClipboard
const std::string & GetString()
Definition: richio.h:475
wxString GetFileName() const
Return the filename corresponding to this sheet.
Definition: sch_sheet.h:496
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:216
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
STRING_FORMATTER implements OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:445

References SCH_SEXPR_PLUGIN::Format(), SCH_SHEET::GetFileName(), SCH_EDIT_FRAME::GetScreen(), SCH_SHEET::GetScreen(), STRING_FORMATTER::GetString(), TOOL_MANAGER::GetTool(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_supplementaryClipboard, TOOL_BASE::m_toolMgr, EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::SaveClipboard(), SCH_SHEET_T, EE_SELECTION::SetScreen(), 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 542 of file sch_editor_control.cpp.

543 {
544  // Don't get in an infinite loop SCH -> PCB -> SCH -> PCB -> SCH -> ...
545  if( m_probingPcbToSch )
546  return;
547 
549  SCH_ITEM* item = nullptr;
550  SCH_COMPONENT* component = nullptr;
551 
552  if( aForce )
553  {
554  EE_SELECTION& selection = selTool->RequestSelection();
555 
556  if( selection.GetSize() >= 1 )
557  item = (SCH_ITEM*) selection.Front();
558  }
559  else
560  {
561  EE_SELECTION& selection = selTool->GetSelection();
562 
563  if( selection.GetSize() >= 1 )
564  item = (SCH_ITEM*) selection.Front();
565  }
566 
567  if( !item )
568  {
569  if( aForce )
570  m_frame->SendMessageToPCBNEW( nullptr, nullptr );
571 
572  return;
573  }
574 
575 
576  switch( item->Type() )
577  {
578  case SCH_FIELD_T:
579  case LIB_FIELD_T:
580  if( item->GetParent() && item->GetParent()->Type() == SCH_COMPONENT_T )
581  {
582  component = (SCH_COMPONENT*) item->GetParent();
583  m_frame->SendMessageToPCBNEW( item, component );
584  }
585  break;
586 
587  case SCH_COMPONENT_T:
588  component = (SCH_COMPONENT*) item;
589  m_frame->SendMessageToPCBNEW( item, component );
590  break;
591 
592  case SCH_PIN_T:
593  component = (SCH_COMPONENT*) item->GetParent();
594  m_frame->SendMessageToPCBNEW( static_cast<SCH_PIN*>( item ), component );
595  break;
596 
597  case SCH_SHEET_T:
598  if( aForce )
599  m_frame->SendMessageToPCBNEW( item, nullptr );
600  break;
601 
602  default:
603  break;
604  }
605 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
EE_SELECTION & GetSelection()
Function GetSelection()
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
void SendMessageToPCBNEW(EDA_ITEM *aObjectToSync, SCH_COMPONENT *aPart)
Send a message to Pcbnew via a socket connection.
EDA_ITEM * GetParent() const
Definition: base_struct.h:195
virtual unsigned int GetSize() const override
Function GetSize() Returns the number of stored items.
Definition: selection.h:100
Schematic symbol object.
Definition: sch_component.h:88
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187
EDA_ITEM * Front() const
Definition: selection.h:184

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 1632 of file sch_editor_control.cpp.

1633 {
1635  return 0;
1636 }
void DrawCurrentSheetToClipboard()
Use the wxWidgets print code to draw an image of the current sheet onto the clipboard.
Definition: sheet.cpp:554

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 1572 of file sch_editor_control.cpp.

1573 {
1575  dlg.ShowQuasiModal();
1576  return 0;
1577 }

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 1580 of file sch_editor_control.cpp.

1581 {
1583  m_frame->HardRedraw();
1584 
1585  return 0;
1586 }
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().

◆ EditWithLibEdit()

int SCH_EDITOR_CONTROL::EditWithLibEdit ( const TOOL_EVENT aEvent)

Definition at line 1533 of file sch_editor_control.cpp.

1534 {
1537  SCH_COMPONENT* sym = nullptr;
1538  LIB_EDIT_FRAME* libEdit;
1539 
1540  if( selection.GetSize() >= 1 )
1541  sym = (SCH_COMPONENT*) selection.Front();
1542 
1543  if( !sym || sym->GetEditFlags() != 0 )
1544  return 0;
1545 
1547  libEdit = (LIB_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_LIB_EDITOR, false );
1548 
1549  if( libEdit )
1550  libEdit->LoadComponentAndSelectLib( sym->GetLibId(), sym->GetUnit(), sym->GetConvert() );
1551 
1552  return 0;
1553 }
KIWAY & Kiway() const
Function Kiway returns 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:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
static const KICAD_T ComponentsOnly[]
Definition: ee_collectors.h:47
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
int GetUnit() const
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:342
STATUS_FLAGS GetEditFlags() const
Definition: base_struct.h:237
bool LoadComponentAndSelectLib(const LIB_ID &aLibId, int aUnit, int aConvert)
Selects the currently active library and loads the symbol from aLibId.
The symbol library editor main window.
static TOOL_ACTION showSymbolEditor
Definition: actions.h:154
Schematic symbol object.
Definition: sch_component.h:88
int GetConvert() const
const LIB_ID & GetLibId() const

References EE_COLLECTOR::ComponentsOnly, FRAME_SCH_LIB_EDITOR, SCH_COMPONENT::GetConvert(), EDA_ITEM::GetEditFlags(), SCH_COMPONENT::GetLibId(), TOOL_MANAGER::GetTool(), SCH_COMPONENT::GetUnit(), KIWAY_HOLDER::Kiway(), LIB_EDIT_FRAME::LoadComponentAndSelectLib(), 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 1646 of file sch_editor_control.cpp.

1647 {
1649  const EE_SELECTION& selection = selTool->RequestSelection( EE_COLLECTOR::SheetsOnly );
1650 
1651  if( selection.GetSize() == 1 )
1652  {
1653  SCH_SHEET* sheet = (SCH_SHEET*) selection.Front();
1654 
1657 
1658  m_frame->GetCurrentSheet().push_back( sheet );
1661  }
1662 
1663  return 0;
1664 }
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
void DisplayCurrentSheet()
Draw the current sheet on the display.
Definition: hierarch.cpp:229
static const KICAD_T SheetsOnly[]
Definition: ee_collectors.h:48
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
void UpdateHierarchyNavigator(bool aForceUpdate=false)
Run the Hierarchy Navigator dialog.
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:216
SCH_SHEET_PATH & GetCurrentSheet() const

References ACTIONS::cancelInteractive, EE_ACTIONS::clearSelection, SCH_EDIT_FRAME::DisplayCurrentSheet(), SCH_EDIT_FRAME::GetCurrentSheet(), TOOL_MANAGER::GetTool(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, 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)

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 535 of file sch_editor_control.cpp.

536 {
537  doCrossProbeSchToPcb( aEvent, true );
538  return 0;
539 }
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 1613 of file sch_editor_control.cpp.

1614 {
1615  int result = NET_PLUGIN_CHANGE;
1616 
1617  // If a plugin is removed or added, rebuild and reopen the new dialog
1618  while( result == NET_PLUGIN_CHANGE )
1619  result = InvokeDialogNetList( m_frame );
1620 
1621  return 0;
1622 }
#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 230 of file sch_editor_control.cpp.

231 {
233  return UpdateFind( aEvent );
234 }
static TOOL_ACTION findAndReplace
Definition: actions.h:79
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:67
int UpdateFind(const TOOL_EVENT &aEvent)
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 
)

Finds 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 51 of file eeschema/cross-probing.cpp.

55 {
56  SCH_SHEET_PATH* sheetWithComponentFound = NULL;
57  SCH_COMPONENT* component = NULL;
58  wxPoint pos;
59  LIB_PIN* pin = nullptr;
60  SCH_SHEET_LIST sheetList;
61  SCH_ITEM* foundItem = nullptr;
62 
63  if( !aSearchHierarchy )
64  sheetList.push_back( m_frame->GetCurrentSheet() );
65  else
66  sheetList.BuildSheetList( &m_frame->Schematic().Root() );
67 
68  for( SCH_SHEET_PATH& sheet : sheetList )
69  {
70  SCH_SCREEN* screen = sheet.LastScreen();
71 
72  for( auto item : screen->Items().OfType( SCH_COMPONENT_T ) )
73  {
74  SCH_COMPONENT* pSch = static_cast<SCH_COMPONENT*>( item );
75 
76  if( aReference.CmpNoCase( pSch->GetRef( &sheet ) ) == 0 )
77  {
78  component = pSch;
79  sheetWithComponentFound = &sheet;
80 
81  if( aSearchType == HIGHLIGHT_PIN )
82  {
83  pos = pSch->GetPosition(); // temporary: will be changed if the pin is found.
84  pin = pSch->GetPin( aSearchText );
85 
86  if( pin )
87  {
88  pos += pin->GetPosition();
89  foundItem = component;
90  break;
91  }
92  }
93  else
94  {
95  pos = pSch->GetPosition();
96  foundItem = component;
97  break;
98  }
99  }
100  }
101 
102  if( foundItem )
103  break;
104  }
105 
106  CROSS_PROBING_SETTINGS& crossProbingSettings = m_frame->eeconfig()->m_CrossProbing;
107 
108  if( component )
109  {
110  if( *sheetWithComponentFound != m_frame->GetCurrentSheet() )
111  {
112  m_frame->Schematic().SetCurrentSheet( *sheetWithComponentFound );
114  }
115 
116  wxPoint delta;
117  pos -= component->GetPosition();
118  delta = component->GetTransform().TransformCoordinate( pos );
119  pos = delta + component->GetPosition();
120 
121  if( crossProbingSettings.center_on_items )
122  {
124  m_frame->CenterScreen( pos, false );
125 
126  if( crossProbingSettings.zoom_to_fit )
127  {
128  EDA_RECT bbox = component->GetBoundingBox();
129 
130  wxSize bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();
131  VECTOR2D screenSize = getView()->GetViewport().GetSize();
132 
133  screenSize.x = std::max( 10.0, screenSize.x );
134  screenSize.y = std::max( 10.0, screenSize.y );
135  double ratio = std::max( fabs( bbSize.x / screenSize.x ),
136  fabs( bbSize.y / screenSize.y ) );
137 
138  // Try not to zoom on every cross-probe; it gets very noisy
139  if( ratio < 0.1 || ratio > 1.0 )
140  getView()->SetScale( getView()->GetScale() / ratio );
141  }
142  }
143  }
144 
145  /* Print diag */
146  wxString msg_item;
147  wxString msg;
148 
149  if( aSearchType == HIGHLIGHT_PIN )
150  msg_item.Printf( _( "pin %s" ), aSearchText );
151  else
152  msg_item = _( "component" );
153 
154  if( component )
155  {
156  if( foundItem )
157  msg.Printf( _( "%s %s found" ), aReference, msg_item );
158  else
159  msg.Printf( _( "%s found but %s not found" ), aReference, msg_item );
160  }
161  else
162  msg.Printf( _( "Component %s not found" ), aReference );
163 
164  m_frame->SetStatusText( msg );
165 
166  m_probingPcbToSch = true; // recursion guard
167  {
168  // Clear any existing highlighting
170 
171  if( foundItem )
172  m_toolMgr->RunAction( EE_ACTIONS::addItemToSel, true, foundItem );
173  }
174  m_probingPcbToSch = false;
175 
176  m_frame->GetCanvas()->Refresh();
177 
178  return foundItem;
179 }
SCH_SHEET_LIST.
BOX2D GetViewport() const
Function GetViewport() Returns the current viewport visible area rectangle.
Definition: view.cpp:538
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
EE_TYPE OfType(KICAD_T aType)
Definition: sch_rtree.h:219
int GetWidth() const
Definition: eda_rect.h:119
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
LIB_PIN * GetPin(const wxString &number)
Find a symbol pin by number.
void DisplayCurrentSheet()
Draw the current sheet on the display.
Definition: hierarch.cpp:229
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:42
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
EESCHEMA_SETTINGS * eeconfig() const
Cross-probing behavior.
Definition: app_settings.h:30
static TOOL_ACTION addItemToSel
Selects an item (specified as the event parameter).
Definition: ee_actions.h:59
#define NULL
TRANSFORM & GetTransform() const
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:56
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves the graphic crosshair cursor to the requested position expressed in world coordinates.
SCH_SHEET_PATH.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false)
Return the reference for the given sheet path.
void BuildSheetList(SCH_SHEET *aSheet)
Function BuildSheetList builds the list of sheets and their sheet path from aSheet.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
bool zoom_to_fit
Zoom to fit items (ignored if center_on_items is off)
Definition: app_settings.h:33
wxPoint GetPosition() const override
Definition: lib_pin.h:432
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Function SetScale() Sets the scaling factor, zooming around a given anchor point.
Definition: view.cpp:578
SCH_SHEET & Root() const
Definition: schematic.h:97
#define _(s)
Definition: 3d_actions.cpp:33
EE_RTREE & Items()
Definition: sch_screen.h:158
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
Schematic symbol object.
Definition: sch_component.h:88
wxPoint GetPosition() const override
SCH_SHEET_PATH & GetCurrentSheet() const
virtual void CenterScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
const Vec & GetSize() const
Definition: box2.h:188
CROSS_PROBING_SETTINGS m_CrossProbing
Definition: app_settings.h:141
void SetCurrentSheet(const SCH_SHEET_PATH &aPath)
Definition: schematic.h:127
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:187
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.

References _, EE_ACTIONS::addItemToSel, SCH_SHEET_LIST::BuildSheetList(), CROSS_PROBING_SETTINGS::center_on_items, SCH_BASE_FRAME::CenterScreen(), EE_ACTIONS::clearSelection, SCH_EDIT_FRAME::DisplayCurrentSheet(), SCH_BASE_FRAME::eeconfig(), SCH_COMPONENT::GetBoundingBox(), SCH_BASE_FRAME::GetCanvas(), SCH_EDIT_FRAME::GetCurrentSheet(), SCH_COMPONENT::GetPin(), LIB_PIN::GetPosition(), SCH_COMPONENT::GetPosition(), SCH_COMPONENT::GetRef(), BOX2< Vec >::GetSize(), SCH_COMPONENT::GetTransform(), 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, NULL, EE_RTREE::OfType(), EDA_DRAW_PANEL_GAL::Refresh(), SCHEMATIC::Root(), TOOL_MANAGER::RunAction(), SCH_COMPONENT_T, SCH_EDIT_FRAME::Schematic(), KIGFX::VIEW_CONTROLS::SetCrossHairCursorPosition(), SCHEMATIC::SetCurrentSheet(), KIGFX::VIEW::SetScale(), TRANSFORM::TransformCoordinate(), VECTOR2< T >::x, VECTOR2< T >::y, and CROSS_PROBING_SETTINGS::zoom_to_fit.

Referenced by SCH_EDIT_FRAME::ExecuteRemoteCommand(), and DIALOG_FIELDS_EDITOR_GLOBAL::OnTableCellClick().

◆ FindNext()

int SCH_EDITOR_CONTROL::FindNext ( const TOOL_EVENT aEvent)

Definition at line 374 of file sch_editor_control.cpp.

375 {
376  // A timer during which a subsequent FindNext will result in a wrap-around
377  static wxTimer wrapAroundTimer;
378 
379  wxFindReplaceData* data = m_frame->GetFindReplaceData();
380 
381  if( aEvent.IsAction( &ACTIONS::findNextMarker ) )
382  {
383  if( data )
384  g_markersOnly.SetFlags( data->GetFlags() );
385 
386  data = &g_markersOnly;
387  }
388  else if( !data )
389  {
390  return FindAndReplace( ACTIONS::find.MakeEvent() );
391  }
392 
393  bool searchAllSheets = !( data->GetFlags() & FR_CURRENT_SHEET_ONLY );
394  EE_SELECTION& selection = m_selectionTool->GetSelection();
395  SCH_SCREEN* afterScreen = m_frame->GetScreen();
396  SCH_ITEM* afterItem = dynamic_cast<SCH_ITEM*>( selection.Front() );
397  SCH_ITEM* item = nullptr;
398 
399  if( wrapAroundTimer.IsRunning() )
400  {
401  afterScreen = nullptr;
402  afterItem = nullptr;
403  wrapAroundTimer.Stop();
405  }
406 
408 
409  if( afterScreen || !searchAllSheets )
410  item = nextMatch( m_frame->GetScreen(), afterItem, data );
411 
412  if( !item && searchAllSheets )
413  {
414  SCH_SHEET_LIST schematic = m_frame->Schematic().GetSheets();
415  SCH_SCREENS screens( m_frame->Schematic().Root() );
416 
417  for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
418  {
419  if( afterScreen )
420  {
421  if( afterScreen == screen )
422  afterScreen = nullptr;
423 
424  continue;
425  }
426 
427  item = nextMatch( screen, nullptr, data );
428 
429  if( item )
430  {
431  SCH_SHEET_PATH* sheet = schematic.FindSheetForScreen( screen );
432  wxCHECK_MSG( sheet, 0, "Sheet not found for " + screen->GetFileName() );
433 
434  m_frame->Schematic().SetCurrentSheet( *sheet );
436 
437  screen->TestDanglingEnds();
438 
439  m_frame->SetScreen( screen );
440  UpdateFind( ACTIONS::updateFind.MakeEvent() );
441 
442  break;
443  }
444  }
445  }
446 
447  if( item )
448  {
449  m_selectionTool->AddItemToSel( item );
450  m_frame->FocusOnLocation( item->GetBoundingBox().GetCenter() );
451  m_frame->GetCanvas()->Refresh();
452  }
453  else
454  {
455  wxString msg = searchAllSheets ? _( "Reached end of schematic." )
456  : _( "Reached end of sheet." );
457 
458  // Show the popup during the timeperiod the user can wrap the search
459  m_frame->ShowFindReplaceStatus( msg + _( " Find again to wrap around to the start." ),
460  4000 );
461  wrapAroundTimer.StartOnce( 4000 );
462  }
463 
464  return 0;
465 }
SCH_SHEET_LIST.
SCH_ITEM * nextMatch(SCH_SCREEN *aScreen, SCH_ITEM *aAfter, wxFindReplaceData *aData)
Advances the search and returns the next matching item after aAfter.
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_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:92
void SetScreen(BASE_SCREEN *aScreen) override
static wxFindReplaceData g_markersOnly
void UpdateAllScreenReferences()
Function UpdateAllScreenReferences updates the reference and the m_Multi parameter (part selection) f...
static TOOL_ACTION find
Definition: actions.h:78
SCH_SHEET_PATH * FindSheetForScreen(SCH_SCREEN *aScreen)
Function FindSheetForScreen.
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:67
EE_SELECTION & GetSelection()
Function GetSelection()
static TOOL_ACTION updateFind
Definition: actions.h:84
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)
SCHEMATIC & Schematic() const
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
SCH_SHEET_PATH.
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:81
void ClearFindReplaceStatus()
SCH_SHEET & Root() const
Definition: schematic.h:97
int AddItemToSel(const TOOL_EVENT &aEvent)
int ClearSelection(const TOOL_EVENT &aEvent)
Clear current selection event handler.
#define _(s)
Definition: 3d_actions.cpp:33
SCH_SHEET_PATH & GetCurrentSheet() const
void SetCurrentSheet(const SCH_SHEET_PATH &aPath)
Definition: schematic.h:127
void FocusOnLocation(const wxPoint &aPos)
Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor...
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:528
EDA_ITEM * Front() const
Definition: selection.h:184

References _, EE_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 1625 of file sch_editor_control.cpp.

1626 {
1628  return 0;
1629 }
int InvokeDialogCreateBOM(SCH_EDIT_FRAME *aCaller)
Create and show DIALOG_BOM and return whatever DIALOG_BOM::ShowModal() returns.
Definition: dialog_bom.cpp:215

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

Referenced by setTransitions().

◆ getEditFrame()

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

Function getEditFrame()

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

Definition at line 187 of file tool_base.h.

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

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Function GetId() Returns the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 121 of file tool_base.h.

122  {
123  return m_toolId;
124  }
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214

References TOOL_BASE::m_toolId.

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

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

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

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

Definition at line 143 of file tool_base.h.

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

References TOOL_BASE::m_toolMgr.

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

◆ getModel()

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

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 201 of file tool_base.h.

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

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Function GetName() Returns the name of the tool.

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

Returns
The name of the tool.

Definition at line 132 of file tool_base.h.

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

References TOOL_BASE::m_toolName.

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 110 of file tool_base.h.

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

References TOOL_BASE::m_type.

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

◆ getView()

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

Function getView()

Returns the instance of VIEW object used in the application. It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

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

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

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

◆ getViewControls()

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

Function getViewControls()

Returns the instance of VIEW_CONTROLS object used in the application. It allows tools to read & modify user input and its settings (eg. show cursor, enable snapping to grid, etc.)

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

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

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

Referenced by EE_POINT_EDITOR::addCorner(), POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), AssignNetclass(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), PCB_INSPECTION_TOOL::HighlightNet(), HighlightNet(), PCB_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), COMMON_TOOLS::OnGridChanged(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LIB_DRAWING_TOOLS::PlaceAnchor(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PICKER_TOOL::setControls(), PCBNEW_PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), LIB_MOVE_TOOL::updateModificationPoint(), PL_EDIT_TOOL::updateModificationPoint(), EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

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

Function Go()

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

Definition at line 129 of file tool_interactive.h.

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

References TOOL_INTERACTIVE::goInternal().

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

◆ HasMatch()

bool SCH_EDITOR_CONTROL::HasMatch ( )

Definition at line 468 of file sch_editor_control.cpp.

469 {
470  wxFindReplaceData* data = m_frame->GetFindReplaceData();
472 
473  return data && item && item->Matches( *data, nullptr );
474 }
wxFindReplaceData * GetFindReplaceData()
Get the find criteria (as set by the dialog).
EE_SELECTION & GetSelection()
Function GetSelection()
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
virtual bool Matches(wxFindReplaceData &aSearchData, void *aAuxData)
Function Matches compares the item against the search criteria in aSearchData.
Definition: base_struct.h:457
EDA_ITEM * Front() const
Definition: selection.h:184

References SELECTION::Front(), 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)

Highlights net under the cursor.

Definition at line 885 of file sch_editor_control.cpp.

886 {
888  VECTOR2D cursorPos = controls->GetCursorPosition( !aEvent.Modifier( MD_ALT ) );
889 
890  highlightNet( m_toolMgr, cursorPos );
891 
892  return 0;
893 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (such a...
static bool highlightNet(TOOL_MANAGER *aToolMgr, const VECTOR2D &aPosition)
int Modifier(int aMask=MD_MODIFIER_MASK) const
Returns information about key modifiers state (Ctrl, Alt, etc.)
Definition: tool_event.h:342
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
VECTOR2D GetCursorPosition() const
Returns 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)

Launches a tool to highlight nets.

Definition at line 1135 of file sch_editor_control.cpp.

1136 {
1137  // TODO(JE) remove once real-time connectivity is a given
1138  if( !ADVANCED_CFG::GetCfg().m_realTimeConnectivity || !CONNECTION_GRAPH::m_allowRealTime )
1140 
1141  std::string tool = aEvent.GetCommandStr().get();
1142  PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
1143 
1144  // Deactivate other tools; particularly important if another PICKER is currently running
1145  Activate();
1146 
1147  picker->SetCursor( wxStockCursor( wxCURSOR_BULLSEYE ) );
1148 
1149  picker->SetClickHandler(
1150  [this] ( const VECTOR2D& aPos )
1151  {
1152  return highlightNet( m_toolMgr, aPos );
1153  } );
1154 
1155  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
1156 
1157  return 0;
1158 }
void SetCursor(const wxCursor &aCursor)
Definition: picker_tool.h:65
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generates the connection data for the entire schematic hierarchy.
void SetClickHandler(CLICK_HANDLER aHandler)
Function SetClickHandler() Sets a handler for mouse click event.
Definition: picker_tool.h:72
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
static TOOL_ACTION pickerTool
Definition: actions.h:149
static bool highlightNet(TOOL_MANAGER *aToolMgr, const VECTOR2D &aPosition)
static bool m_allowRealTime
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
void Activate()
Function Activate() Runs the tool.
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers of advanced config.

References TOOL_INTERACTIVE::Activate(), 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::SetClickHandler(), and PICKER_TOOL::SetCursor().

Referenced by setTransitions().

◆ ImportFPAssignments()

int SCH_EDITOR_CONTROL::ImportFPAssignments ( const TOOL_EVENT aEvent)

Definition at line 208 of file backanno.cpp.

209 {
210  wxString path = wxPathOnly( m_frame->Prj().GetProjectFullName() );
211 
212  wxFileDialog dlg( m_frame, _( "Load Symbol Footprint Link File" ),
213  path, wxEmptyString,
215  wxFD_OPEN | wxFD_FILE_MUST_EXIST );
216 
217  if( dlg.ShowModal() == wxID_CANCEL )
218  return 0;
219 
220  wxString filename = dlg.GetPath();
221 
222  wxArrayString choices;
223  choices.Add( _( "Keep existing footprint field visibility" ) );
224  choices.Add( _( "Show all footprint fields" ) );
225  choices.Add( _( "Hide all footprint fields" ) );
226 
227  wxSingleChoiceDialog choiceDlg( m_frame, _( "Select the footprint field visibility setting." ),
228  _( "Change Visibility" ), choices );
229 
230  if( choiceDlg.ShowModal() == wxID_CANCEL )
231  return 0;
232 
233  bool forceVisibility = (choiceDlg.GetSelection() != 0 );
234  bool visibilityState = (choiceDlg.GetSelection() == 1 );
235 
236  if( !processCmpToFootprintLinkFile( filename, forceVisibility, visibilityState ) )
237  {
238  wxString msg = wxString::Format( _( "Failed to open component-footprint link file \"%s\"" ),
239  filename.GetData() );
240 
241  DisplayError( m_frame, msg );
242  return 0;
243  }
244 
245  m_frame->SyncView();
246  m_frame->GetCanvas()->Refresh();
247  m_frame->OnModify();
248  return 0;
249 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
wxString ComponentFileWildcard()
void SyncView()
Mark all items for refresh.
PROJECT & Prj() const
Function Prj returns 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.
Definition: backanno.cpp:125
VTBL_ENTRY const wxString GetProjectFullName() const
Function GetProjectFullName returns the full path and name of the project.
Definition: project.cpp:116
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, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#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(), 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 ( )
inlineoverridevirtualinherited

Function Init() Init() is called once upon a registration of the tool.

Returns
True if the initialization went fine, false - otherwise.

Reimplemented from TOOL_BASE.

Definition at line 69 of file ee_tool_base.h.

70  {
71  m_frame = getEditFrame<T>();
74 
75  // A basic context manu. Many (but not all) tools will choose to override this.
76 
77  auto& ctxMenu = m_menu.GetMenu();
78 
79  // cancel current tool goes in main context menu at the top if present
81  ctxMenu.AddSeparator( 1 );
82 
83  // Finally, add the standard zoom/grid items
85 
86  return true;
87  }
static bool ShowAlways(const SELECTION &aSelection)
Function ShowAlways The default condition function (always returns true).
void AddStandardSubMenus(TOOL_MENU &aMenu)
Function CreateBasicMenu.
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
bool IsType(FRAME_T aType) const
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

32 {
33  return m_toolMgr->IsToolActive( m_toolId );
34 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool IsToolActive(TOOL_ID aId) const
Function IsToolActive() Returns true if a tool with given id is active (executing)

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

Referenced by ROUTER_TOOL::onViaCommand().

◆ LeaveSheet()

int SCH_EDITOR_CONTROL::LeaveSheet ( const TOOL_EVENT aEvent)

Definition at line 1667 of file sch_editor_control.cpp.

1668 {
1669  if( m_frame->GetCurrentSheet().Last() != &m_frame->Schematic().Root() )
1670  {
1673 
1677  }
1678 
1679  return 0;
1680 }
SCH_SHEET * Last() const
Function Last returns a pointer to the last sheet of the list One can see the others sheet as the "pa...
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
void DisplayCurrentSheet()
Draw the current sheet on the display.
Definition: hierarch.cpp:229
void pop_back()
Forwarded method from std::vector.
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:56
SCH_SHEET & Root() const
Definition: schematic.h:97
SCH_SHEET_PATH & GetCurrentSheet() const

References ACTIONS::cancelInteractive, EE_ACTIONS::clearSelection, SCH_EDIT_FRAME::DisplayCurrentSheet(), SCH_EDIT_FRAME::GetCurrentSheet(), SCH_SHEET_PATH::Last(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, 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().

◆ loadCmpToFootprintLinkFile()

bool SCH_EDITOR_CONTROL::loadCmpToFootprintLinkFile ( )
private

Loads a .cmp file from CvPcb and update the footprint field of components.

Prepares parameters and calls ProcessCmpToFootprintLinkFileto actually read the file and update the footprint fields

◆ NavigateHierarchy()

int SCH_EDITOR_CONTROL::NavigateHierarchy ( const TOOL_EVENT aEvent)

Definition at line 236 of file sch_editor_control.cpp.

237 {
239  return 0;
240 }
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 64 of file sch_editor_control.cpp.

65 {
67  return 0;
68 }

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_ITEM aAfter,
wxFindReplaceData *  aData 
)
private

Advances 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 306 of file sch_editor_control.cpp.

308 {
309  bool past_item = true;
310 
311  if( aAfter != nullptr )
312  {
313  past_item = false;
314 
315  if( aAfter->Type() == SCH_PIN_T || aAfter->Type() == SCH_FIELD_T )
316  aAfter = static_cast<SCH_ITEM*>( aAfter->GetParent() );
317  }
318 
319 
320  for( SCH_ITEM* item : aScreen->Items() )
321  {
322  if( item == aAfter )
323  {
324  past_item = true;
325  }
326  else if( past_item )
327  {
328  if( aData == &g_markersOnly && item->Type() == SCH_MARKER_T )
329  return item;
330 
331  if( item->Matches( *aData, nullptr ) )
332  return item;
333 
334  if( item->Type() == SCH_COMPONENT_T )
335  {
336  SCH_COMPONENT* cmp = static_cast<SCH_COMPONENT*>( item );
337 
338  for( SCH_FIELD& field : cmp->GetFields() )
339  {
340  if( field.Matches( *aData, nullptr ) )
341  return &field;
342  }
343 
344  for( SCH_PIN* pin : cmp->GetSchPins() )
345  {
346  if( pin->Matches( *aData, nullptr ) )
347  return pin;
348  }
349  }
350 
351  if( item->Type() == SCH_SHEET_T )
352  {
353  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
354 
355  for( SCH_FIELD& field : sheet->GetFields() )
356  {
357  if( field.Matches( *aData, nullptr ) )
358  return &field;
359  }
360 
361  for( SCH_SHEET_PIN* pin : sheet->GetPins() )
362  {
363  if( pin->Matches( *aData, nullptr ) )
364  return pin;
365  }
366  }
367  }
368  }
369 
370  return nullptr;
371 }
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
static wxFindReplaceData g_markersOnly
std::vector< SCH_FIELD > & GetFields()
Definition: sch_sheet.h:268
EDA_ITEM * GetParent() const
Definition: base_struct.h:195
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:84
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:216
std::vector< SCH_SHEET_PIN * > & GetPins()
Definition: sch_sheet.h:362
EE_RTREE & Items()
Definition: sch_screen.h:158
Schematic symbol object.
Definition: sch_component.h:88
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References g_markersOnly, SCH_SHEET::GetFields(), EDA_ITEM::GetParent(), SCH_SHEET::GetPins(), SCH_SCREEN::Items(), 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 71 of file sch_editor_control.cpp.

72 {
74  return 0;
75 }

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 99 of file sch_editor_control.cpp.

100 {
101  PICKED_ITEMS_LIST undoCmd;
102  WS_PROXY_UNDO_ITEM* undoItem = new WS_PROXY_UNDO_ITEM( m_frame );
103  ITEM_PICKER wrapper( m_frame->GetScreen(), undoItem, UR_PAGESETTINGS );
104 
105  undoCmd.PushItem( wrapper );
106  m_frame->SaveCopyInUndoList( undoCmd, UR_PAGESETTINGS, false );
107 
109  dlg.SetWksFileName( BASE_SCREEN::m_PageLayoutDescrFileName );
110 
111  if( dlg.ShowModal() != wxID_OK )
113 
114  return 0;
115 }
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes 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:57
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
void RollbackSchematicFromUndo()
Performs 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, PICKED_ITEMS_LIST::PushItem(), SCH_EDIT_FRAME::RollbackSchematicFromUndo(), SCH_EDIT_FRAME::SaveCopyInUndoList(), DIALOG_PAGES_SETTINGS::SetWksFileName(), and UR_PAGESETTINGS.

Referenced by setTransitions().

◆ Paste()

int SCH_EDITOR_CONTROL::Paste ( const TOOL_EVENT aEvent)

Definition at line 1300 of file sch_editor_control.cpp.

1301 {
1302  wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( wxWindow::FindFocus() );
1303 
1304  if( textEntry )
1305  {
1306  textEntry->Paste();
1307  return 0;
1308  }
1309 
1311  std::string text = m_toolMgr->GetClipboard();
1312 
1313  if( text.empty() )
1314  return 0;
1315 
1316  STRING_LINE_READER reader( text, "Clipboard" );
1317  SCH_SEXPR_PLUGIN plugin;
1318 
1319  SCH_SHEET paste_sheet;
1320  SCH_SCREEN* paste_screen = new SCH_SCREEN( &m_frame->Schematic() );
1321 
1322  // Screen object on heap is owned by the sheet.
1323  paste_sheet.SetScreen( paste_screen );
1324 
1325  try
1326  {
1327  plugin.LoadContent( reader, &paste_sheet );
1328  }
1329  catch( IO_ERROR& ioe )
1330  {
1331  // If it wasn't content, then paste as text
1332  paste_screen->Append( new SCH_TEXT( wxPoint( 0, 0 ), text ) );
1333  }
1334 
1335  bool forceKeepAnnotations = false;
1336  bool forceDropAnnotations = false;
1337  bool dropAnnotations = false;
1338 
1339  if( aEvent.IsAction( &ACTIONS::pasteSpecial ) )
1340  {
1341  DIALOG_PASTE_SPECIAL dlg( m_frame, &forceKeepAnnotations, &forceDropAnnotations );
1342 
1343  if( dlg.ShowModal() == wxID_CANCEL )
1344  return 0;
1345  }
1346 
1347  if( forceDropAnnotations )
1348  dropAnnotations = true;
1349 
1350  // SCH_SEXP_PLUGIN added the items to the paste screen, but not to the view or anything
1351  // else. Pull them back out to start with.
1352  //
1353  EDA_ITEMS loadedItems;
1354  bool sheetsPasted = false;
1355  SCH_SHEET_LIST hierarchy = m_frame->Schematic().GetSheets();
1356  SCH_SHEET_PATH& currentSheet = m_frame->GetCurrentSheet();
1357  wxFileName destFn = currentSheet.Last()->GetFileName();
1358 
1359  if( destFn.IsRelative() )
1360  destFn.MakeAbsolute( m_frame->Prj().GetProjectPath() );
1361 
1362  for( SCH_ITEM* item : paste_screen->Items() )
1363  {
1364  loadedItems.push_back( item );
1365 
1366  if( item->Type() == SCH_COMPONENT_T )
1367  {
1368  if( !dropAnnotations && !forceKeepAnnotations )
1369  {
1370  for( SCH_ITEM* existingItem : m_frame->GetScreen()->Items() )
1371  {
1372  if( item->m_Uuid == existingItem->m_Uuid )
1373  {
1374  dropAnnotations = true;
1375  break;
1376  }
1377  }
1378  }
1379  }
1380  else if( item->Type() == SCH_SHEET_T )
1381  {
1382  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
1383  wxFileName srcFn = sheet->GetFileName();
1384 
1385  if( srcFn.IsRelative() )
1386  srcFn.MakeAbsolute( m_frame->Prj().GetProjectPath() );
1387 
1388  SCH_SHEET_LIST sheetHierarchy( sheet );
1389 
1390  if( hierarchy.TestForRecursion( sheetHierarchy, destFn.GetFullPath( wxPATH_UNIX ) ) )
1391  {
1392  auto msg = wxString::Format( _( "The pasted sheet \"%s\"\n"
1393  "was dropped because the destination already has "
1394  "the sheet or one of its subsheets as a parent." ),
1395  sheet->GetFileName() );
1396  DisplayError( m_frame, msg );
1397  loadedItems.pop_back();
1398  }
1399  }
1400  }
1401 
1402  // Remove the references from our temporary screen to prevent freeing on the DTOR
1403  paste_screen->Clear( false );
1404 
1405  for( unsigned i = 0; i < loadedItems.size(); ++i )
1406  {
1407  EDA_ITEM* item = loadedItems[i];
1408 
1409  if( item->Type() == SCH_COMPONENT_T )
1410  {
1411  SCH_COMPONENT* component = (SCH_COMPONENT*) item;
1412 
1413  // The library symbol gets set from the cached library symbols in the current
1414  // schematic not the symbol libraries. The cached library symbol may have
1415  // changed from the original library symbol which would cause the copy to
1416  // be incorrect.
1417  SCH_SCREEN* currentScreen = m_frame->GetScreen();
1418 
1419  wxCHECK2( currentScreen, continue );
1420 
1421  auto it = currentScreen->GetLibSymbols().find( component->GetSchSymbolLibraryName() );
1422 
1423  if( it != currentScreen->GetLibSymbols().end() )
1424  component->SetLibSymbol( new LIB_PART( *it->second ) );
1425 
1426  if( dropAnnotations )
1427  {
1428  const_cast<KIID&>( component->m_Uuid ) = KIID();
1429 
1430  // clear the annotation, but preserve the selected unit
1431  int unit = component->GetUnit();
1432  component->ClearAnnotation( nullptr );
1433  component->SetUnit( unit );
1434  }
1435  }
1436  else
1437  {
1438  // Everything else gets a new UUID
1439  const_cast<KIID&>( item->m_Uuid ) = KIID();
1440  }
1441 
1442  if( item->Type() == SCH_SHEET_T )
1443  {
1444  SCH_SHEET* sheet = (SCH_SHEET*) item;
1445  SCH_FIELD& nameField = sheet->GetFields()[SHEETNAME];
1446  wxFileName fn = sheet->GetFileName();
1447  SCH_SCREEN* existingScreen = nullptr;
1448  bool dropSheetAnnotations = false;
1449  wxString baseName = nameField.GetText();
1450  wxString candidateName = baseName;
1451  int uniquifier = 1;
1452 
1453  while( hierarchy.NameExists( candidateName ) )
1454  candidateName = wxString::Format( wxT( "%s%d" ), baseName, uniquifier++ );
1455 
1456  nameField.SetText( candidateName );
1457 
1458  sheet->SetParent( currentSheet.Last() );
1459  sheet->SetScreen( nullptr );
1460  sheetsPasted = true;
1461 
1462  if( !fn.IsAbsolute() )
1463  {
1464  wxFileName currentSheetFileName = currentSheet.LastScreen()->GetFileName();
1465  fn.Normalize( wxPATH_NORM_ALL, currentSheetFileName.GetPath() );
1466  }
1467 
1469  fn.GetFullPath( wxPATH_UNIX ), &existingScreen ) )
1470  dropSheetAnnotations = !forceKeepAnnotations;
1471  else
1472  searchSupplementaryClipboard( sheet->GetFileName(), &existingScreen );
1473 
1474  if( existingScreen )
1475  {
1476  sheet->SetScreen( existingScreen );
1477 
1478  SCH_SHEET_PATH sheetpath = currentSheet;
1479  sheetpath.push_back( sheet );
1480 
1481  // Clear annotation and create the AR for this path, if not exists,
1482  // when the screen is shared by sheet paths.
1483  // Otherwise ClearAnnotation do nothing, because the F1 field is used as
1484  // reference default value and takes the latest displayed value
1485  existingScreen->EnsureAlternateReferencesExist();
1486 
1487  if( forceDropAnnotations || dropSheetAnnotations )
1488  existingScreen->ClearAnnotation( &sheetpath );
1489  }
1490  else
1491  {
1492  if( !m_frame->LoadSheetFromFile( sheet, &currentSheet, fn.GetFullPath() ) )
1493  m_frame->InitSheet( sheet, sheet->GetFileName() );
1494  }
1495  }
1496 
1497  item->SetFlags( IS_NEW | IS_PASTED | IS_MOVED );
1499 
1500  // Reset flags for subsequent move operation
1501  item->SetFlags( IS_NEW | IS_PASTED | IS_MOVED );
1502  // Start out hidden so the pasted items aren't "ghosted" in their original location
1503  // before being moved to the current location.
1504  getView()->Hide( item, true );
1505  }
1506 
1507  if( sheetsPasted )
1508  {
1511  }
1512 
1513  // Now clear the previous selection, select the pasted items, and fire up the "move"
1514  // tool.
1515  //
1517  m_toolMgr->RunAction( EE_ACTIONS::addItemsToSel, true, &loadedItems );
1518 
1519  EE_SELECTION& selection = selTool->GetSelection();
1520 
1521  if( !selection.Empty() )
1522  {
1523  SCH_ITEM* item = (SCH_ITEM*) selection.GetTopLeftItem();
1524 
1525  selection.SetReferencePoint( item->GetPosition() );
1527  }
1528 
1529  return 0;
1530 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hides the item in the view (e.g.
Definition: view.cpp:1507
SCH_SHEET_LIST.
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
const wxString & GetFileName() const
Definition: sch_screen.h:185
bool SearchHierarchy(const wxString &aFilename, SCH_SCREEN **aScreen)
Search the existing hierarchy for an instance of screen loaded from aFileName.
Definition: sch_sheet.cpp:632
void SetLibSymbol(LIB_PART *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:92
SCH_SHEET * Last() const
Function Last returns a pointer to the last sheet of the list One can see the others sheet as the "pa...
static TOOL_ACTION addItemsToSel
Selects a list of items (specified as the event parameter)
Definition: ee_actions.h:63
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
wxString GetSchSymbolLibraryName() const
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
Definition: sch_sheet.cpp:151
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
void InitSheet(SCH_SHEET *aSheet, const wxString &aNewFilename)
Definition: sheet.cpp:95
void EnsureAlternateReferencesExist()
For screens shared by many sheetpaths (complex hierarchies): to be able to clear or modify any refere...
Definition: sch_screen.cpp:910
bool searchSupplementaryClipboard(const wxString &aSheetFilename, SCH_SCREEN **aScreen)
virtual wxPoint GetPosition() const
Definition: base_struct.h:337
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:122
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:474
virtual void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:196
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
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:67
EE_SELECTION & GetSelection()
Function GetSelection()
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
std::vector< SCH_FIELD > & GetFields()
Definition: sch_sheet.h:268
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: common.h:68
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:245
bool TestForRecursion(const SCH_SHEET_LIST &aSrcSheetHierarchy, const wxString &aDestFileName)
Function TestForRecursion.
int GetUnit() const
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:103
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:116
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: base_struct.h:587
PROJECT & Prj() const
Function Prj returns 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.
void SetUnit(int aUnit)
Change the unit number to aUnit.
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
SCH_SHEET_PATH.
wxString GetFileName() const
Return the filename corresponding to this sheet.
Definition: sch_sheet.h:496
void ClearAnnotation(SCH_SHEET_PATH *aSheetPath)
Clear exiting component annotation.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
A SCH_PLUGIN derivation for loading schematic files using the new s-expression file format.
bool NameExists(const wxString &aSheetName)
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:121
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:216
static TOOL_ACTION pasteSpecial
Definition: actions.h:72
const KIID m_Uuid
Definition: base_struct.h:162
EDA_ITEM * GetTopLeftItem(bool onlyModules=false) const override
void LoadContent(LINE_READER &aReader, SCH_SHEET *aSheet, int aVersion=SEXPR_SCHEMATIC_FILE_VERSION)
SCH_SHEET & Root() const
Definition: schematic.h:97
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()
Function LastScreen.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
void Append(SCH_ITEM *aItem)
Definition: sch_screen.cpp:132
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
#define _(s)
Definition: 3d_actions.cpp:33
std::string GetClipboard() const
Returns the information currently stored in the system clipboard.
EE_RTREE & Items()
Definition: sch_screen.h:158
Schematic symbol object.
Definition: sch_component.h:88
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
SCH_SHEET_PATH & GetCurrentSheet() const
void ClearAnnotation(SCH_SHEET_PATH *aSheetPath)
Clear the annotation for the components in aSheetPath on the screen.
Definition: sch_screen.cpp:893
static TOOL_ACTION move
Definition: ee_actions.h:113
STRING_LINE_READER is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:254
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:126
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
Definition: base_struct.h:130
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193
#define IS_MOVED
Item being moved.
Definition: base_struct.h:116

References _, EE_ACTIONS::addItemsToSel, SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_SCREEN::Append(), SCH_SCREEN::Clear(), SCH_COMPONENT::ClearAnnotation(), SCH_SCREEN::ClearAnnotation(), EE_ACTIONS::clearSelection, DisplayError(), SELECTION::Empty(), SCH_SCREEN::EnsureAlternateReferencesExist(), Format(), TOOL_MANAGER::GetClipboard(), 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, TOOL_BASE::m_toolMgr, EDA_ITEM::m_Uuid, EE_ACTIONS::move, SCH_SHEET_LIST::NameExists(), ACTIONS::pasteSpecial, 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(), EDA_ITEM::SetParent(), SELECTION::SetReferencePoint(), SCH_SHEET::SetScreen(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), EDA_TEXT::SetText(), SCH_COMPONENT::SetUnit(), SHEETNAME, SCH_SHEET_LIST::TestForRecursion(), EDA_ITEM::Type(), and SCH_EDIT_FRAME::UpdateHierarchyNavigator().

Referenced by setTransitions().

◆ Plot()

int SCH_EDITOR_CONTROL::Plot ( const TOOL_EVENT aEvent)

Definition at line 205 of file sch_editor_control.cpp.

206 {
208 
209  dlg.ShowModal();
210 
211  // save project config if the prj config has changed:
212  if( dlg.PrjConfigChanged() )
214 
215  return 0;
216 }
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 192 of file sch_editor_control.cpp.

193 {
195 
196  wxFileName fn = m_frame->Prj().AbsolutePath( m_frame->Schematic().RootScreen()->GetFileName() );
197 
198  if( fn.GetName() != NAMELESS_PROJECT )
200 
201  return 0;
202 }
const wxString & GetFileName() const
Definition: sch_screen.h:185
void SaveProjectSettings() override
Save changes to the project settings to the project (.pro) file.
VTBL_ENTRY const wxString AbsolutePath(const wxString &aFileName) const
Function AbsolutePath fixes up aFileName if it is relative to the project's directory to be an absolu...
Definition: project.cpp:270
#define NAMELESS_PROJECT
int InvokeDialogPrintUsingPrinter(SCH_EDIT_FRAME *aCaller)
Create and show DIALOG_PRINT_USING_PRINTER and return whatever DIALOG_PRINT_USING_PRINTER::ShowModal(...
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
SCHEMATIC & Schematic() const
SCH_SCREEN * RootScreen() const
Helper to retreive the screen of the root sheet.
Definition: schematic.cpp:126

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.

Definition at line 125 of file backanno.cpp.

128 {
129  // Build a flat list of components in schematic:
130  SCH_REFERENCE_LIST referencesList;
131  SCH_SHEET_LIST sheetList = m_frame->Schematic().GetSheets();
132 
133  sheetList.GetComponents( referencesList, false );
134 
135  FILE* cmpFile = wxFopen( aFullFilename, wxT( "rt" ) );
136 
137  if( cmpFile == NULL )
138  return false;
139 
140  // cmpFileReader dtor will close cmpFile
141  FILE_LINE_READER cmpFileReader( cmpFile, aFullFilename );
142 
143  // Now, for each component found in file,
144  // replace footprint field value by the new value:
145  wxString reference;
146  wxString footprint;
147  wxString buffer;
148  wxString value;
149 
150  while( cmpFileReader.ReadLine() )
151  {
152  buffer = FROM_UTF8( cmpFileReader.Line() );
153 
154  if( !buffer.StartsWith( wxT( "BeginCmp" ) ) )
155  continue;
156 
157  // Begin component description.
158  reference.Empty();
159  footprint.Empty();
160 
161  while( cmpFileReader.ReadLine() )
162  {
163  buffer = FROM_UTF8( cmpFileReader.Line() );
164 
165  if( buffer.StartsWith( wxT( "EndCmp" ) ) )
166  break;
167 
168  // store string value, stored between '=' and ';' delimiters.
169  value = buffer.AfterFirst( '=' );
170  value = value.BeforeLast( ';' );
171  value.Trim(true);
172  value.Trim(false);
173 
174  if( buffer.StartsWith( wxT( "Reference" ) ) )
175  reference = value;
176  else if( buffer.StartsWith( wxT( "IdModule" ) ) )
177  footprint = value;
178  }
179 
180  // A block is read: initialize the footprint field of the corresponding component
181  // if the footprint name is not empty
182  if( reference.IsEmpty() )
183  continue;
184 
185  // Search the component in the flat list
186  for( unsigned ii = 0; ii < referencesList.GetCount(); ii++ )
187  {
188  if( reference == referencesList[ii].GetRef() )
189  {
190  // We have found a candidate.
191  // Note: it can be not unique (multiple units per part)
192  // So we *do not* stop the search here
193  SCH_COMPONENT* component = referencesList[ii].GetComp();
194  SCH_FIELD* fpfield = component->GetField( FOOTPRINT );
195 
196  fpfield->SetText( footprint );
197 
198  if( aForceVisibilityState )
199  component->GetField( FOOTPRINT )->SetVisible( aVisibilityState );
200  }
201  }
202  }
203 
204  return true;
205 }
SCH_SHEET_LIST.
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:114
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:92
void SetVisible(bool aVisible)
Definition: eda_text.h:184
Field Name Module PCB, i.e. "16DIP300".
SCH_REFERENCE_LIST is used to create a flattened list of components because in a complex hierarchy,...
FILE_LINE_READER is a LINE_READER that reads from an open file.
Definition: richio.h:180
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:116
#define NULL
void GetComponents(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false) const
Function GetComponents adds a SCH_REFERENCE() object to aReferences for each component in the list of...
SCHEMATIC & Schematic() const
unsigned GetCount() const
Function GetCount.
SCH_FIELD * GetField(int aFieldNdx)
Returns a field in this symbol.
Schematic symbol object.
Definition: sch_component.h:88

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

Referenced by ImportFPAssignments().

◆ Quit()

int SCH_EDITOR_CONTROL::Quit ( const TOOL_EVENT aEvent)

Definition at line 219 of file sch_editor_control.cpp.

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

References EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame.

Referenced by setTransitions().

◆ Redo()

int SCH_EDITOR_CONTROL::Redo ( const TOOL_EVENT aEvent)

Definition at line 1193 of file sch_editor_control.cpp.

1194 {
1195  if( m_frame->GetRedoCommandCount() == 0 )
1196  return 0;
1197 
1198  // Inform tools that undo command was issued
1200 
1201  /* Get the old list */
1203 
1204  /* Redo the command: */
1205  m_frame->PutDataInPreviousState( List, true );
1206 
1207  /* Put the old list in UndoList */
1208  List->ReversePickersListOrder();
1209  m_frame->PushCommandToUndoList( List );
1210 
1212  selTool->RebuildSelection();
1213 
1216 
1217  m_frame->SyncView();
1218  m_frame->GetCanvas()->Refresh();
1219  m_frame->OnModify();
1220 
1221  return 0;
1222 }
void ReversePickersListOrder()
Function ReversePickersListOrder reverses the order of pickers stored in this list.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
int GetRedoCommandCount() const
virtual void PushCommandToUndoList(PICKED_ITEMS_LIST *aItem)
Function PushCommandToUndoList add a command to undo in undo list delete the very old commands when t...
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
virtual PICKED_ITEMS_LIST * PopCommandFromRedoList()
PopCommandFromRedoList return the last command to undo and remove it from list nothing is deleted.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates 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.
PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
All active tools
Definition: tool_event.h:147
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 PutDataInPreviousState(PICKED_ITEMS_LIST *aList, bool aRedoCommand)
Restore an undo or redo command to put data pointed by aList in the previous state.
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
void RebuildSelection()
Rebuilds the selection from the EDA_ITEMs' selection flags.
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(), 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 180 of file sch_editor_control.cpp.

181 {
182  DIALOG_SYMBOL_REMAP dlgRemap( m_frame );
183 
184  dlgRemap.ShowQuasiModal();
185 
186  m_frame->GetCanvas()->Refresh( true );
187 
188  return 0;
189 }
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 500 of file sch_editor_control.cpp.

501 {
502  wxFindReplaceData* data = m_frame->GetFindReplaceData();
503 
504  if( !data )
505  return FindAndReplace( ACTIONS::find.MakeEvent() );
506 
507  SCH_SHEET_LIST schematic = m_frame->Schematic().GetSheets();
508  SCH_SCREENS screens( m_frame->Schematic().Root() );
509 
510  for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
511  {
512  for( EDA_ITEM* item = nextMatch( screen, nullptr, data ); item; )
513  {
514  if( item->Replace( *data, schematic.FindSheetForScreen( screen ) ) )
515  {
516  m_frame->RefreshItem( item );
517  m_frame->OnModify();
518  }
519 
520  item = nextMatch( screen, dynamic_cast<SCH_ITEM*>( item ), data );
521  }
522  }
523 
524  return 0;
525 }
SCH_SHEET_LIST.
SCH_ITEM * nextMatch(SCH_SCREEN *aScreen, SCH_ITEM *aAfter, wxFindReplaceData *aData)
Advances the search and returns the next matching item after aAfter.
int FindAndReplace(const TOOL_EVENT &aEvent)
wxFindReplaceData * GetFindReplaceData()
Get the find criteria (as set by the dialog).
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:92
static TOOL_ACTION find
Definition: actions.h:78
SCH_SHEET_PATH * FindSheetForScreen(SCH_SCREEN *aScreen)
Function FindSheetForScreen.
SCHEMATIC & Schematic() const
SCH_SHEET & Root() const
Definition: schematic.h:97
void RefreshItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
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:528

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(), SCH_BASE_FRAME::RefreshItem(), SCHEMATIC::Root(), and SCH_EDIT_FRAME::Schematic().

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

◆ ReplaceAndFindNext()

int SCH_EDITOR_CONTROL::ReplaceAndFindNext ( const TOOL_EVENT aEvent)

Definition at line 477 of file sch_editor_control.cpp.

478 {
479  wxFindReplaceData* data = m_frame->GetFindReplaceData();
481 
482  if( !data )
483  return FindAndReplace( ACTIONS::find.MakeEvent() );
484 
485  if( item && item->Matches( *data, nullptr ) )
486  {
487  if( item->Replace( *data, &m_frame->GetCurrentSheet() ) )
488  {
489  m_frame->RefreshItem( item );
490  m_frame->OnModify();
491  }
492 
493  FindNext( ACTIONS::findNext.MakeEvent() );
494  }
495 
496  return 0;
497 }
int FindAndReplace(const TOOL_EVENT &aEvent)
wxFindReplaceData * GetFindReplaceData()
Get the find criteria (as set by the dialog).
static bool Replace(wxFindReplaceData &aSearchData, wxString &aText)
Helper function used in search and replace dialog Function Replace performs a text replace on aText u...
int FindNext(const TOOL_EVENT &aEvent)
static TOOL_ACTION find
Definition: actions.h:78
EE_SELECTION & GetSelection()
Function GetSelection()
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
void RefreshItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
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...
virtual bool Matches(wxFindReplaceData &aSearchData, void *aAuxData)
Function Matches compares the item against the search criteria in aSearchData.
Definition: base_struct.h:457
static TOOL_ACTION findNext
Definition: actions.h:80
EDA_ITEM * Front() const
Definition: selection.h:184

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(), SCH_BASE_FRAME::RefreshItem(), and EDA_ITEM::Replace().

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

◆ RescueLegacyProject()

bool SCH_EDITOR_CONTROL::RescueLegacyProject ( bool  aRunningOnDemand)

Definition at line 131 of file sch_editor_control.cpp.

132 {
134  m_frame->GetCanvas()->GetBackend() );
135 
136  return rescueProject( rescuer, aRunningOnDemand );
137 }
bool rescueProject(RESCUER &aRescuer, bool aRunningOnDemand)
PROJECT & Prj() const
Function Prj returns 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
Function GetBackend Returns 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 150 of file sch_editor_control.cpp.

151 {
152  if( !RESCUER::RescueProject( m_frame, aRescuer, aRunningOnDemand ) )
153  return false;
154 
155  if( aRescuer.GetCandidateCount() )
156  {
157  KIWAY_PLAYER* viewer = m_frame->Kiway().Player( FRAME_SCH_VIEWER, false );
158 
159  if( viewer )
160  static_cast<LIB_VIEW_FRAME*>( viewer )->ReCreateListLib();
161 
162  if( aRunningOnDemand )
163  {
164  SCH_SCREENS schematic( m_frame->Schematic().Root() );
165 
166  schematic.UpdateSymbolLinks();
168  }
169 
171  m_frame->SyncView();
172  m_frame->GetCanvas()->Refresh();
173  m_frame->OnModify();
174  }
175 
176  return true;
177 }
KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of ...
Definition: kiway_player.h:59
KIWAY & Kiway() const
Function Kiway returns 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)
Generates the connection data for the entire schematic hierarchy.
static bool RescueProject(wxWindow *aParent, RESCUER &aRescuer, bool aRunningOnDemand)
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:342
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()
Returen 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:97
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()
Function ClearUndoRedoList clear undo and redo list, using ClearUndoORRedoList() picked items are del...
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:528

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 140 of file sch_editor_control.cpp.

141 {
144  m_frame->GetCanvas()->GetBackend() );
145 
146  return rescueProject( rescuer, aRunningOnDemand );
147 }
bool rescueProject(RESCUER &aRescuer, bool aRunningOnDemand)
PROJECT & Prj() const
Function Prj returns 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
Function GetBackend Returns 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 SCH_EDIT_FRAME::OpenProjectFiles(), and 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 118 of file sch_editor_control.cpp.

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

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

Function Reset() Brings the tool to a known, initial state.

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

Parameters
aReasoncontains information about the reason of tool reset.

Implements TOOL_BASE.

Definition at line 90 of file ee_tool_base.h.

91  {
92  if( aReason == MODEL_RELOAD )
93  {
94  // Init variables used by every drawing tool
95  m_frame = getEditFrame<T>();
96  m_isLibEdit = dynamic_cast<LIB_EDIT_FRAME*>( m_frame ) != nullptr;
97  }
98 
99  m_view = static_cast<KIGFX::SCH_VIEW*>( getView() );
100  }
Model changes (required full reload)
Definition: tool_base.h:82
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36

◆ RunMainStack()

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

Function RunMainStack()

Calls a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

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

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

Referenced by DRAWING_TOOL::PlaceText().

◆ Save()

int SCH_EDITOR_CONTROL::Save ( const TOOL_EVENT aEvent)

Definition at line 78 of file sch_editor_control.cpp.

79 {
81  return 0;
82 }

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 85 of file sch_editor_control.cpp.

86 {
87  m_frame->Save_File( true );
88  return 0;
89 }
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_T  aType,
bool  aAppend = false 
)
inlineprotectedinherited

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

Definition at line 117 of file ee_tool_base.h.

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

◆ searchSupplementaryClipboard()

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

Definition at line 1254 of file sch_editor_control.cpp.

1256 {
1257  if( m_supplementaryClipboard.count( aSheetFilename ) > 0 )
1258  {
1259  *aScreen = m_supplementaryClipboard[ aSheetFilename ];
1260  return true;
1261  }
1262 
1263  return false;
1264 }
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

Function SetContextMenu()

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

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

Definition at line 76 of file tool_interactive.cpp.

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

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ setTransitions()

void SCH_EDITOR_CONTROL::setTransitions ( )
overrideprivatevirtual

Sets up handlers for various events.

Implements TOOL_INTERACTIVE.

Definition at line 1721 of file sch_editor_control.cpp.

1722 {
1723  Go( &SCH_EDITOR_CONTROL::New, ACTIONS::doNew.MakeEvent() );
1724  Go( &SCH_EDITOR_CONTROL::Open, ACTIONS::open.MakeEvent() );
1725  Go( &SCH_EDITOR_CONTROL::Save, ACTIONS::save.MakeEvent() );
1729  Go( &SCH_EDITOR_CONTROL::Print, ACTIONS::print.MakeEvent() );
1730  Go( &SCH_EDITOR_CONTROL::Plot, ACTIONS::plot.MakeEvent() );
1731  Go( &SCH_EDITOR_CONTROL::Quit, ACTIONS::quit.MakeEvent() );
1732 
1735 
1744 
1749 
1750 #ifdef KICAD_SPICE
1751  Go( &SCH_EDITOR_CONTROL::SimProbe, EE_ACTIONS::simProbe.MakeEvent() );
1752  Go( &SCH_EDITOR_CONTROL::SimTune, EE_ACTIONS::simTune.MakeEvent() );
1753 #endif /* KICAD_SPICE */
1754 
1761 
1763 
1764  Go( &SCH_EDITOR_CONTROL::Undo, ACTIONS::undo.MakeEvent() );
1765  Go( &SCH_EDITOR_CONTROL::Redo, ACTIONS::redo.MakeEvent() );
1766  Go( &SCH_EDITOR_CONTROL::Cut, ACTIONS::cut.MakeEvent() );
1767  Go( &SCH_EDITOR_CONTROL::Copy, ACTIONS::copy.MakeEvent() );
1768  Go( &SCH_EDITOR_CONTROL::Paste, ACTIONS::paste.MakeEvent() );
1770 
1783 
1785 
1789 
1793 }
int Save(const TOOL_EVENT &aEvent)
int FindAndReplace(const TOOL_EVENT &aEvent)
static TOOL_ACTION rescueSymbols
Definition: ee_actions.h:152
int Copy(const TOOL_EVENT &aEvent)
static const TOOL_EVENT SelectedEvent
Definition: actions.h:203
static TOOL_ACTION findAndReplace
Definition: actions.h:79
static TOOL_ACTION exportNetlist
Definition: ee_actions.h:160
static TOOL_ACTION navigateHierarchy
Definition: ee_actions.h:178
int ShowSchematicSetup(const TOOL_EVENT &aEvent)
int HighlightNetCursor(const TOOL_EVENT &aEvent)
Launches a tool to highlight nets.
static TOOL_ACTION assignFootprints
Definition: ee_actions.h:147
static TOOL_ACTION pageSettings
Definition: actions.h:59
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:204
int Redo(const TOOL_EVENT &aEvent)
int NavigateHierarchy(const TOOL_EVENT &aEvent)
int EditSymbolFields(const TOOL_EVENT &aEvent)
static TOOL_ACTION replaceAll
Definition: actions.h:83
int ReplaceAndFindNext(const TOOL_EVENT &aEvent)
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
static TOOL_ACTION remapSymbols
Definition: ee_actions.h:153
int New(const TOOL_EVENT &aEvent)
int FindNext(const TOOL_EVENT &aEvent)
static TOOL_ACTION updatePcbFromSchematic
Definition: actions.h:157
int ExplicitCrossProbeToPcb(const TOOL_EVENT &aEvent)
Equivalent to the above, but initiated by the user.
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:78
int EditSymbolLibraryLinks(const TOOL_EVENT &aEvent)
int CrossProbeToPcb(const TOOL_EVENT &aEvent)
Notifies pcbnew about the selected item.
static TOOL_ACTION updateNetHighlighting
Definition: ee_actions.h:208
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
int DrawSheetOnClipboard(const TOOL_EVENT &aEvent)
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:207
int SaveAs(const TOOL_EVENT &aEvent)
int ToggleForceHV(const TOOL_EVENT &aEvent)
int HighlightNet(const TOOL_EVENT &aEvent)
Highlights net under the cursor.
static TOOL_ACTION leaveSheet
Definition: ee_actions.h:177
static TOOL_ACTION updateFind
Definition: actions.h:84
static TOOL_ACTION annotate
Definition: ee_actions.h:141
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:158
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:209
static TOOL_ACTION showBusManager
Definition: ee_actions.h:149
static TOOL_ACTION updateSchematicFromPcb
Definition: actions.h:158
static TOOL_ACTION editSymbolFields
Definition: ee_actions.h:142
int LeaveSheet(const TOOL_EVENT &aEvent)
int ToggleHiddenFields(const TOOL_EVENT &aEvent)
static TOOL_ACTION simTune
Definition: ee_actions.h:203
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:189
static TOOL_ACTION save
Definition: actions.h:54
static TOOL_ACTION doNew
Definition: actions.h:47
int UpdateFind(const TOOL_EVENT &aEvent)
int EditWithLibEdit(const TOOL_EVENT &aEvent)
int Plot(const TOOL_EVENT &aEvent)
static TOOL_ACTION cut
Definition: actions.h:69
int ImportFPAssignments(const TOOL_EVENT &aEvent)
Definition: backanno.cpp:208
static TOOL_ACTION quit
Definition: actions.h:62
static const TOOL_EVENT ClearedEvent
Definition: actions.h:205
static TOOL_ACTION replaceAndFindNext
Definition: actions.h:82
static TOOL_ACTION plot
Definition: actions.h:61
int ToggleHiddenPins(const TOOL_EVENT &aEvent)
int UpdateNetHighlighting(const TOOL_EVENT &aEvent)
Updates net highlighting after an edit
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:81
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:185
int ShowBusManager(const TOOL_EVENT &aEvent)
int Cut(const TOOL_EVENT &aEvent)
Clipboard support.
static TOOL_ACTION importFPAssignments
Definition: ee_actions.h:159
static TOOL_ACTION assignNetclass
Definition: ee_actions.h:148
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)
Removes any net highlighting
static TOOL_ACTION drawSheetOnClipboard
Definition: ee_actions.h:196
int Undo(const TOOL_EVENT &aEvent)
static TOOL_ACTION enterSheet
Definition: ee_actions.h:176
static TOOL_ACTION clearHighlight
Definition: ee_actions.h:207
static TOOL_ACTION editWithLibEdit
Definition: ee_actions.h:157
static TOOL_ACTION simProbe
Definition: ee_actions.h:202
static TOOL_ACTION undo
Definition: actions.h:67
static TOOL_ACTION generateBOM
Definition: ee_actions.h:161
static TOOL_ACTION highlightNet
Definition: ee_actions.h:206
static TOOL_ACTION schematicSetup
Definition: ee_actions.h:150
static TOOL_ACTION editSymbolLibraryLinks
Definition: ee_actions.h:143
static TOOL_ACTION toggleForceHV
Definition: ee_actions.h:195
int UpdateFromPCB(const TOOL_EVENT &aEvent)
static TOOL_ACTION findNext
Definition: actions.h:80
static TOOL_ACTION paste
Definition: actions.h:71
int ExportNetlist(const TOOL_EVENT &aEvent)
static TOOL_ACTION toggleHiddenFields
Definition: ee_actions.h:186

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, EditWithLibEdit(), EE_ACTIONS::editWithLibEdit, 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 1639 of file sch_editor_control.cpp.

1640 {
1642  return 0;
1643 }
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 1564 of file sch_editor_control.cpp.

1565 {
1566  wxCommandEvent dummy;
1568  return 0;
1569 }
void OnOpenCvpcb(wxCommandEvent &event)
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.

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 1589 of file sch_editor_control.cpp.

1590 {
1591  wxCommandEvent dummy;
1593  return 0;
1594 }
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
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 92 of file sch_editor_control.cpp.

93 {
95  return 0;
96 }
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 1698 of file sch_editor_control.cpp.

1699 {
1702 
1703  KIGFX::SCH_PAINTER* painter = static_cast<KIGFX::SCH_PAINTER*>( getView()->GetPainter() );
1705 
1707  m_frame->GetCanvas()->Refresh();
1708 
1709  return 0;
1710 }
void UpdateAllItems(int aUpdateFlags)
Updates all items in the view according to the given flags.
Definition: view.cpp:1444
EESCHEMA_SETTINGS * eeconfig() const
Item is being added to the view.
Definition: view_item.h:62
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
SCH_PAINTER Contains methods for drawing schematic-specific items.
Definition: sch_painter.h:128
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
virtual SCH_RENDER_SETTINGS * GetSettings() override
Definition: sch_painter.h:143

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 1683 of file sch_editor_control.cpp.

1684 {
1687 
1688  KIGFX::SCH_PAINTER* painter = static_cast<KIGFX::SCH_PAINTER*>( getView()->GetPainter() );
1690 
1692  m_frame->GetCanvas()->Refresh();
1693 
1694  return 0;
1695 }
void UpdateAllItems(int aUpdateFlags)
Updates all items in the view according to the given flags.
Definition: view.cpp:1444
EESCHEMA_SETTINGS * eeconfig() const
Item is being added to the view.
Definition: view_item.h:62
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
SCH_PAINTER Contains methods for drawing schematic-specific items.
Definition: sch_painter.h:128
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
virtual SCH_RENDER_SETTINGS * GetSettings() override
Definition: sch_painter.h:143
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 1161 of file sch_editor_control.cpp.

1162 {
1163  if( m_frame->GetUndoCommandCount() <= 0 )
1164  return 0;
1165 
1166  // Inform tools that undo command was issued
1168 
1169  /* Get the old list */
1171 
1172  /* Undo the command */
1173  m_frame->PutDataInPreviousState( List, false );
1174 
1175  /* Put the old list in RedoList */
1176  List->ReversePickersListOrder();
1177  m_frame->PushCommandToRedoList( List );
1178 
1180  selTool->RebuildSelection();
1181 
1184 
1185  m_frame->SyncView();
1186  m_frame->GetCanvas()->Refresh();
1187  m_frame->OnModify();
1188 
1189  return 0;
1190 }
void ReversePickersListOrder()
Function ReversePickersListOrder reverses the order of pickers stored in this list.
int GetUndoCommandCount() const
virtual void PushCommandToRedoList(PICKED_ITEMS_LIST *aItem)
Function PushCommandToRedoList add a command to redo in redo list delete the very old commands when t...
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates 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()
PopCommandFromUndoList return the last command to undo and remove it from list nothing is deleted.
PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
All active tools
Definition: tool_event.h:147
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 PutDataInPreviousState(PICKED_ITEMS_LIST *aList, bool aRedoCommand)
Restore an undo or redo command to put data pointed by aList in the previous state.
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
void RebuildSelection()
Rebuilds the selection from the EDA_ITEMs' selection flags.
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(), 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)

Definition at line 242 of file sch_editor_control.cpp.

243 {
244  wxFindReplaceData* data = m_frame->GetFindReplaceData();
245 
246  auto visit = [&] ( EDA_ITEM* aItem )
247  {
248  if( data && aItem->Matches( *data, nullptr ) )
249  {
250  aItem->SetForceVisible( true );
251  m_selectionTool->BrightenItem( aItem );
252  }
253  else if( aItem->IsBrightened() )
254  {
255  aItem->SetForceVisible( false );
257  }
258  };
259 
260  if( aEvent.IsAction( &ACTIONS::find ) || aEvent.IsAction( &ACTIONS::findAndReplace )
261  || aEvent.IsAction( &ACTIONS::updateFind ) )
262  {
264 
265  for( SCH_ITEM* item : m_frame->GetScreen()->Items() )
266  {
267  visit( item );
268 
269  if( item->Type() == SCH_COMPONENT_T )
270  {
271  SCH_COMPONENT* cmp = static_cast<SCH_COMPONENT*>( item );
272 
273  for( SCH_FIELD& field : cmp->GetFields() )
274  visit( &field );
275 
276  for( SCH_PIN* pin : cmp->GetSchPins() )
277  visit( pin );
278  }
279  else if( item->Type() == SCH_SHEET_T )
280  {
281  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
282 
283  for( SCH_FIELD& field : sheet->GetFields() )
284  visit( &field );
285 
286  for( SCH_SHEET_PIN* pin : sheet->GetPins() )
287  visit( pin );
288  }
289 
290  }
291  }
292  else if( aEvent.Matches( EVENTS::SelectedItemsModified ) )
293  {
294  for( EDA_ITEM* item : m_selectionTool->GetSelection() )
295  visit( item );
296  }
297 
298  getView()->UpdateItems();
299  m_frame->GetCanvas()->Refresh();
300  m_frame->UpdateTitle();
301 
302  return 0;
303 }
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
static TOOL_ACTION findAndReplace
Definition: actions.h:79
wxFindReplaceData * GetFindReplaceData()
Get the find criteria (as set by the dialog).
void UpdateTitle()
Set the main window title bar text.
static TOOL_ACTION find
Definition: actions.h:78
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:207
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:67
EE_SELECTION & GetSelection()
Function GetSelection()
static TOOL_ACTION updateFind
Definition: actions.h:84
std::vector< SCH_FIELD > & GetFields()
Definition: sch_sheet.h:268
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void BrightenItem(EDA_ITEM *aItem)
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:160
void UpdateItems()
Function UpdateItems() Iterates through the list of items that asked for updating and updates them.
Definition: view.cpp:1421
bool Matches(const TOOL_EVENT &aEvent) const
Function Matches() Tests whether two events match in terms of category & action or command.
Definition: tool_event.h:364
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:84
void UnbrightenItem(EDA_ITEM *aItem)
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:216
std::vector< SCH_SHEET_PIN * > & GetPins()
Definition: sch_sheet.h:362
int ClearSelection(const TOOL_EVENT &aEvent)
Clear current selection event handler.
EE_RTREE & Items()
Definition: sch_screen.h:158
Schematic symbol object.
Definition: sch_component.h:88
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187

References EE_SELECTION_TOOL::BrightenItem(), EE_SELECTION_TOOL::ClearSelection(), ACTIONS::find, ACTIONS::findAndReplace, SCH_BASE_FRAME::GetCanvas(), SCH_SHEET::GetFields(), SCH_EDIT_FRAME::GetFindReplaceData(), SCH_SHEET::GetPins(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), TOOL_BASE::getView(), TOOL_EVENT::IsAction(), SCH_SCREEN::Items(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_EVENT::Matches(), EDA_DRAW_PANEL_GAL::Refresh(), SCH_COMPONENT_T, SCH_SHEET_T, EVENTS::SelectedItemsModified, 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 1605 of file sch_editor_control.cpp.

1606 {
1608  dlg.ShowModal();
1609  return 0;
1610 }

References EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame.

Referenced by setTransitions().

◆ UpdateNetHighlighting()

int SCH_EDITOR_CONTROL::UpdateNetHighlighting ( const TOOL_EVENT aEvent)

Updates net highlighting after an edit

Definition at line 986 of file sch_editor_control.cpp.

987 {
989  CONNECTION_GRAPH* connectionGraph = m_frame->Schematic().ConnectionGraph();
990  std::vector<EDA_ITEM*> itemsToRedraw;
991  const SCH_CONNECTION* selectedConn = m_frame->GetHighlightedConnection();
992 
993  if( !screen )
994  return 0;
995 
996  bool selectedIsBus = selectedConn ? selectedConn->IsBus() : false;
997  wxString selectedName = selectedConn ? selectedConn->Name() : "";
998 
999  bool selectedIsNoNet = false;
1000  CONNECTION_SUBGRAPH* selectedSubgraph = nullptr;
1001 
1002  if( selectedConn && selectedConn->Driver() == nullptr )
1003  {
1004  selectedIsNoNet = true;
1005  selectedSubgraph = connectionGraph->GetSubgraphForItem( selectedConn->Parent() );
1006  }
1007 
1008  for( SCH_ITEM* item : screen->Items() )
1009  {
1010  SCH_CONNECTION* itemConn = nullptr;
1011  SCH_COMPONENT* comp = nullptr;
1012  bool redraw = item->IsBrightened();
1013  bool highlight = false;
1014 
1015  if( item->Type() == SCH_COMPONENT_T )
1016  comp = static_cast<SCH_COMPONENT*>( item );
1017 
1018  if( comp && comp->GetPartRef() && comp->GetPartRef()->IsPower() )
1019  itemConn = comp->Connection( m_frame->GetCurrentSheet() );
1020  else
1021  itemConn = item->Connection( m_frame->GetCurrentSheet() );
1022 
1023  if( selectedIsNoNet && selectedSubgraph )
1024  {
1025  for( SCH_ITEM* subgraphItem : selectedSubgraph->m_items )
1026  {
1027  if( item == subgraphItem )
1028  {
1029  highlight = true;
1030  break;
1031  }
1032  }
1033  }
1034  else if( selectedIsBus && itemConn && itemConn->IsNet() )
1035  {
1036  for( const std::shared_ptr<SCH_CONNECTION>& member : selectedConn->Members() )
1037  {
1038  if( member->Name() == itemConn->Name() )
1039  {
1040  highlight = true;
1041  break;
1042  }
1043  else if( member->IsBus() )
1044  {
1045  for( const std::shared_ptr<SCH_CONNECTION>& child_member : member->Members() )
1046  {
1047  if( child_member->Name() == itemConn->Name() )
1048  {
1049  highlight = true;
1050  break;
1051  }
1052  }
1053  }
1054  }
1055  }
1056  else if( selectedConn && itemConn && selectedName == itemConn->Name() )
1057  {
1058  highlight = true;
1059  }
1060 
1061  if( highlight )
1062  item->SetBrightened();
1063  else
1064  item->ClearBrightened();
1065 
1066  redraw |= item->IsBrightened();
1067 
1068  // comp is only non-null if the item is a SCH_COMPONENT_T
1069  if( comp )
1070  {
1071  redraw |= comp->HasBrightenedPins();
1072 
1073  comp->ClearBrightenedPins();
1074  std::vector<LIB_PIN*> pins;
1075  comp->GetPins( pins );
1076 
1077  for( LIB_PIN* pin : pins )
1078  {
1079  SCH_CONNECTION* pin_conn =
1080  comp->GetConnectionForPin( pin, m_frame->GetCurrentSheet() );
1081 
1082  if( pin_conn && pin_conn->Name() == selectedName )
1083  {
1084  comp->BrightenPin( pin );
1085  redraw = true;
1086  }
1087  }
1088 
1089  if( comp->GetPartRef() && comp->GetPartRef()->IsPower() )
1090  {
1091  std::vector<SCH_FIELD>& fields = comp->GetFields();
1092 
1093  for( int id : { REFERENCE, VALUE } )
1094  {
1095  if( item->IsBrightened() && fields[id].IsVisible() )
1096  fields[id].SetBrightened();
1097  else
1098  fields[id].ClearBrightened();
1099  }
1100  }
1101  }
1102  else if( item->Type() == SCH_SHEET_T )
1103  {
1104  for( SCH_SHEET_PIN* pin : static_cast<SCH_SHEET*>( item )->GetPins() )
1105  {
1106  SCH_CONNECTION* pin_conn = pin->Connection( m_frame->GetCurrentSheet() );
1107  bool redrawPin = pin->IsBrightened();
1108 
1109  if( pin_conn && pin_conn->Name() == selectedName )
1110  pin->SetBrightened();
1111  else
1112  pin->ClearBrightened();
1113 
1114  redrawPin ^= pin->IsBrightened();
1115  redraw |= redrawPin;
1116  }
1117  }
1118 
1119  if( redraw )
1120  itemsToRedraw.push_back( item );
1121  }
1122 
1123  // Be sure highlight change will be redrawn
1124  KIGFX::VIEW* view = getView();
1125 
1126  for( EDA_ITEM* redrawItem : itemsToRedraw )
1128 
1129  m_frame->GetCanvas()->Refresh();
1130 
1131  return 0;
1132 }
CONNECTION_GRAPH * ConnectionGraph() const
Definition: schematic.h:132
Calculates the connectivity of a schematic and generates netlists.
const SCH_CONNECTION * GetHighlightedConnection() const
void ClearBrightenedPins()
bool IsBrightened() const
Definition: base_struct.h:205
VIEW_ITEM - is an abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:85
A subgraph is a set of items that are electrically connected on a single sheet.
Field Reference of part, i.e. "IC21".
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populates a std::vector with SCH_FIELDs.
void BrightenPin(LIB_PIN *aPin)
Item is being added to the view.
Definition: view_item.h:62
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
SCH_CONNECTION * GetConnectionForPin(LIB_PIN *aPin, const SCH_SHEET_PATH &aSheet)
Retrieves the connection for a given pin of the component.
const wxString & Name(bool aIgnoreSheet=false) const
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:84
std::unique_ptr< LIB_PART > & GetPartRef()
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
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_CONNECTION * Connection(const SCH_SHEET_PATH &aPath) const
Retrieve the connection associated with this object in the given sheet.
Definition: sch_item.cpp:150
Field Value of part, i.e. "3.3K".
bool IsNet() const
void GetPins(std::vector< LIB_PIN * > &aPinsList)
Populate a vector with all the pins from the library object.
SCH_SCREEN * LastScreen()
Function 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:158
Schematic symbol object.
Definition: sch_component.h:88
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
SCH_ITEM * Parent() const
std::vector< std::shared_ptr< SCH_CONNECTION > > & Members()
SCH_SHEET_PATH & GetCurrentSheet() const
CONNECTION_SUBGRAPH * GetSubgraphForItem(SCH_ITEM *aItem)
VIEW.
Definition: view.h:61
bool IsBus() const
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187

References SCH_COMPONENT::BrightenPin(), EDA_ITEM::ClearBrightened(), SCH_COMPONENT::ClearBrightenedPins(), SCH_ITEM::Connection(), SCHEMATIC::ConnectionGraph(), SCH_CONNECTION::Driver(), SCH_BASE_FRAME::GetCanvas(), SCH_COMPONENT::GetConnectionForPin(), 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(), REFERENCE, 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.

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

◆ UpdatePCB()

int SCH_EDITOR_CONTROL::UpdatePCB ( const TOOL_EVENT aEvent)

Definition at line 1597 of file sch_editor_control.cpp.

1598 {
1599  wxCommandEvent dummy;
1601  return 0;
1602 }
void OnUpdatePCB(wxCommandEvent &event)
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.

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

Referenced by setTransitions().

◆ updateView()

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

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

Definition at line 104 of file ee_tool_base.h.

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

◆ Wait()

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

Function Wait()

Suspends execution of the tool until an event specified in aEventList arrives. No parameters means waiting for any event.

Definition at line 57 of file tool_interactive.cpp.

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

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_frame

SCH_EDIT_FRAME * EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame
protectedinherited

Definition at line 158 of file ee_tool_base.h.

◆ m_isLibEdit

bool EE_TOOL_BASE< SCH_EDIT_FRAME >::m_isLibEdit
protectedinherited

Definition at line 161 of file ee_tool_base.h.

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

functions below are not yet implemented - their interface may change

Definition at line 108 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), PICKER_TOOL::Init(), PL_EDIT_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), SCH_EDIT_TOOL::Init(), LIB_DRAWING_TOOLS::Init(), FOOTPRINT_EDITOR_TOOLS::Init(), PCB_VIEWER_TOOLS::Init(), PL_DRAWING_TOOLS::Init(), LIB_CONTROL::Init(), PCB_EDITOR_CONTROL::Init(), SCH_DRAWING_TOOLS::Init(), EDA_3D_CONTROLLER::Init(), GERBVIEW_SELECTION_TOOL::Init(), PL_SELECTION_TOOL::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), EDIT_TOOL::Init(), PCB_TOOL_BASE::Init(), PL_EDIT_TOOL::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_pickerItem

EDA_ITEM* SCH_EDITOR_CONTROL::m_pickerItem
private

Definition at line 212 of file sch_editor_control.h.

◆ m_probingPcbToSch

bool SCH_EDITOR_CONTROL::m_probingPcbToSch
private

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

◆ m_supplementaryClipboard

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

Definition at line 216 of file sch_editor_control.h.

Referenced by doCopy(), and searchSupplementaryClipboard().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

Definition at line 214 of file tool_base.h.

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

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 219 of file tool_base.h.

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

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

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

Definition at line 218 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 211 of file tool_base.h.

Referenced by TOOL_BASE::GetType(), and BOARD_COMMIT::Push().

◆ m_view

KIGFX::SCH_VIEW* EE_TOOL_BASE< SCH_EDIT_FRAME >::m_view
protectedinherited

Definition at line 159 of file ee_tool_base.h.


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