KiCad PCB EDA Suite
sch_edit_frame.cpp File Reference
#include <base_units.h>
#include <class_library.h>
#include <confirm.h>
#include <connection_graph.h>
#include <dialogs/dialog_schematic_find.h>
#include <eeschema_id.h>
#include <executable_names.h>
#include <gestfich.h>
#include <hierarch.h>
#include <dialogs/html_messagebox.h>
#include <invoke_sch_dialog.h>
#include <kicad_string.h>
#include <kiface_i.h>
#include <kiplatform/app.h>
#include <kiway.h>
#include <symbol_edit_frame.h>
#include <symbol_viewer_frame.h>
#include <pgm_base.h>
#include <profile.h>
#include <project.h>
#include <project/project_file.h>
#include <project/net_settings.h>
#include <sch_edit_frame.h>
#include <sch_painter.h>
#include <sch_sheet.h>
#include <sch_marker.h>
#include <schematic.h>
#include <settings/settings_manager.h>
#include <advanced_config.h>
#include <sim/sim_plot_frame.h>
#include <tool/action_manager.h>
#include <tool/action_toolbar.h>
#include <tool/common_control.h>
#include <tool/common_tools.h>
#include <tool/editor_conditions.h>
#include <tool/picker_tool.h>
#include <tool/selection.h>
#include <tool/tool_dispatcher.h>
#include <tool/tool_manager.h>
#include <tool/zoom_tool.h>
#include <tools/ee_actions.h>
#include <tools/ee_inspection_tool.h>
#include <tools/ee_point_editor.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_drawing_tools.h>
#include <tools/sch_edit_tool.h>
#include <tools/sch_editor_control.h>
#include <tools/sch_line_wire_bus_tool.h>
#include <tools/sch_move_tool.h>
#include <tools/sch_navigate_tool.h>
#include <view/view_controls.h>
#include <widgets/infobar.h>
#include <wildcards_and_files_ext.h>
#include <wx/cmdline.h>
#include <gal/graphics_abstraction_layer.h>
#include <drawing_sheet/ds_proxy_view_item.h>

Go to the source code of this file.


#define ENABLE(x)   ACTION_CONDITIONS().Enable( x )
#define CHECK(x)   ACTION_CONDITIONS().Check( x )
#define CURRENT_TOOL(action)   mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )


static void add_search_paths (SEARCH_STACK *aDst, const SEARCH_STACK &aSrc, int aIndex)
static void inheritNetclass (const SCH_SHEET_PATH &aSheetPath, SCH_TEXT *aItem)

Macro Definition Documentation


#define CHECK (   x)    ACTION_CONDITIONS().Check( x )


#define CURRENT_TOOL (   action)    mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )


#define ENABLE (   x)    ACTION_CONDITIONS().Enable( x )

Function Documentation

◆ add_search_paths()

static void add_search_paths ( SEARCH_STACK aDst,
const SEARCH_STACK aSrc,
int  aIndex 

Definition at line 84 of file sch_edit_frame.cpp.

85 {
86  for( unsigned i=0; i<aSrc.GetCount(); ++i )
87  aDst->AddPaths( aSrc[i], aIndex );
88 }
void AddPaths(const wxString &aPaths, int aIndex=-1)
Insert or append path(s).

References SEARCH_STACK::AddPaths().

◆ inheritNetclass()

static void inheritNetclass ( const SCH_SHEET_PATH aSheetPath,

Definition at line 1098 of file sch_edit_frame.cpp.

1099 {
1100  // Netclasses are assigned to subgraphs by association with their netname. However, when
1101  // a new label is attached to an existing subgraph (with an existing netclass association),
1102  // the association will be lost as the label will drive its name on to the graph.
1103  //
1104  // Here we find the previous driver of the subgraph and if it had a netclass we associate
1105  // the new netname with that netclass as well.
1106  //
1107  SCHEMATIC* schematic = aItem->Schematic();
1108  CONNECTION_SUBGRAPH* subgraph = schematic->ConnectionGraph()->GetSubgraphForItem( aItem );
1110  std::map<wxString, wxString>& netclassAssignments =
1113  if( subgraph )
1114  {
1115  SCH_ITEM* previousDriver = nullptr;
1118  for( SCH_ITEM* item : subgraph->m_drivers )
1119  {
1120  if( item == aItem )
1121  continue;
1125  if( p > priority )
1126  {
1127  priority = p;
1128  previousDriver = item;
1129  }
1130  }
1132  if( previousDriver )
1133  {
1134  wxString path = aSheetPath.PathHumanReadable();
1135  wxString oldDrivenName = path + subgraph->GetNameForDriver( previousDriver );
1136  wxString drivenName = path + subgraph->GetNameForDriver( aItem );
1138  if( netclassAssignments.count( oldDrivenName ) )
1139  netclassAssignments[ drivenName ] = netclassAssignments[ oldDrivenName ];
1140  }
1141  }
1142 }
std::map< wxString, wxString > m_NetClassAssignments
Definition: net_settings.h:43
Holds all the data relating to one schematic A schematic may consist of one or more sheets (and one r...
Definition: schematic.h:58
CONNECTION_GRAPH * ConnectionGraph() const override
Definition: schematic.h:151
wxString PathHumanReadable(bool aUseShortRootName=true) const
Return the sheet path in a human readable form made from the sheet names.
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:145
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:97
NET_SETTINGS & NetSettings()
Definition: project_file.h:92
A subgraph is a set of items that are electrically connected on a single sheet.
const wxString & GetNameForDriver(SCH_ITEM *aItem)
Returns the candidate net name for a driver.
std::vector< SCH_ITEM * > m_drivers
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:99
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:196
PRIORITY GetDriverPriority()

References SCHEMATIC::ConnectionGraph(), CONNECTION_SUBGRAPH::GetDriverPriority(), CONNECTION_SUBGRAPH::GetNameForDriver(), PROJECT::GetProjectFile(), CONNECTION_GRAPH::GetSubgraphForItem(), CONNECTION_SUBGRAPH::INVALID, CONNECTION_SUBGRAPH::m_drivers, NET_SETTINGS::m_NetClassAssignments, PROJECT_FILE::NetSettings(), SCH_SHEET_PATH::PathHumanReadable(), SCHEMATIC::Prj(), and SCH_ITEM::Schematic().

Referenced by SCH_EDIT_FRAME::AddItemToScreenAndUndoList().