KiCad PCB EDA Suite
sch_edit_frame.cpp File Reference
#include <base_units.h>
#include <bitmaps.h>
#include <symbol_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_message_box.h>
#include <invoke_sch_dialog.h>
#include <string_utils.h>
#include <kiface_base.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 <python_scripting.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 <sim/spice_settings.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 <wx/app.h>
#include <wx/filedlg.h>
#include <wx/socket.h>
#include <gal/graphics_abstraction_layer.h>
#include <drawing_sheet/ds_proxy_view_item.h>

Go to the source code of this file.

Macros

#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 ) ) )
 

Functions

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

◆ CHECK

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

◆ CURRENT_TOOL

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

◆ ENABLE

#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 
)
static

Definition at line 91 of file sch_edit_frame.cpp.

92 {
93  for( unsigned i=0; i<aSrc.GetCount(); ++i )
94  aDst->AddPaths( aSrc[i], aIndex );
95 }
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,
SCH_TEXT aItem 
)
static

Definition at line 1082 of file sch_edit_frame.cpp.

1083 {
1084  // Netclasses are assigned to subgraphs by association with their netname. However, when
1085  // a new label is attached to an existing subgraph (with an existing netclass association),
1086  // the association will be lost as the label will drive its name on to the graph.
1087  //
1088  // Here we find the previous driver of the subgraph and if it had a netclass we associate
1089  // the new netname with that netclass as well.
1090  //
1091  SCHEMATIC* schematic = aItem->Schematic();
1092  CONNECTION_SUBGRAPH* subgraph = schematic->ConnectionGraph()->GetSubgraphForItem( aItem );
1093 
1094  std::map<wxString, wxString>& netclassAssignments =
1096 
1097  if( subgraph )
1098  {
1099  SCH_ITEM* previousDriver = nullptr;
1101 
1102  for( SCH_ITEM* item : subgraph->m_drivers )
1103  {
1104  if( item == aItem )
1105  continue;
1106 
1108 
1109  if( p > priority )
1110  {
1111  priority = p;
1112  previousDriver = item;
1113  }
1114  }
1115 
1116  if( previousDriver )
1117  {
1118  wxString path = aSheetPath.PathHumanReadable();
1119  wxString oldDrivenName = path + subgraph->GetNameForDriver( previousDriver );
1120  wxString drivenName = path + subgraph->GetNameForDriver( aItem );
1121 
1122  if( netclassAssignments.count( oldDrivenName ) )
1123  netclassAssignments[ drivenName ] = netclassAssignments[ oldDrivenName ];
1124  }
1125  }
1126 }
std::map< wxString, wxString > m_NetClassAssignments
Definition: net_settings.h:44
Holds all the data relating to one schematic.
Definition: schematic.h:59
CONNECTION_GRAPH * ConnectionGraph() const override
Definition: schematic.h:131
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:94
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:75
CONNECTION_SUBGRAPH * GetSubgraphForItem(SCH_ITEM *aItem)
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:193
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(), path, SCH_SHEET_PATH::PathHumanReadable(), SCHEMATIC::Prj(), and SCH_ITEM::Schematic().

Referenced by SCH_EDIT_FRAME::AddItemToScreenAndUndoList().