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 <ignore.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 <dialog_erc.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/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_conditions.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 <widgets/wx_aui_utils.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 inheritNetclass (const SCH_SHEET_PATH &aSheetPath, SCH_LABEL_BASE *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

◆ inheritNetclass()

static void inheritNetclass ( const SCH_SHEET_PATH aSheetPath,
SCH_LABEL_BASE aItem 
)
static

Definition at line 1274 of file sch_edit_frame.cpp.

1275{
1277 return;
1278
1279 // Netclasses are assigned to subgraphs by association with their netname. However, when
1280 // a new label is attached to an existing subgraph (with an existing netclass association),
1281 // the association will be lost as the label will drive its name on to the graph.
1282 //
1283 // Here we find the previous driver of the subgraph and if it had a netclass we associate
1284 // the new netname with that netclass as well.
1285 //
1286 SCHEMATIC* schematic = aItem->Schematic();
1287 CONNECTION_SUBGRAPH* subgraph = schematic->ConnectionGraph()->GetSubgraphForItem( aItem );
1288
1289 std::map<wxString, wxString>& netclassAssignments =
1291
1292 if( subgraph )
1293 {
1294 SCH_ITEM* previousDriver = nullptr;
1296
1297 for( SCH_ITEM* item : subgraph->m_drivers )
1298 {
1299 if( item == aItem )
1300 continue;
1301
1303
1304 if( p > priority )
1305 {
1306 priority = p;
1307 previousDriver = item;
1308 }
1309 }
1310
1311 if( previousDriver )
1312 {
1313 wxString path = aSheetPath.PathHumanReadable();
1314 wxString oldDrivenName = path + subgraph->GetNameForDriver( previousDriver );
1315 wxString drivenName = path + subgraph->GetNameForDriver( aItem );
1316
1317 if( netclassAssignments.count( oldDrivenName ) )
1318 netclassAssignments[ drivenName ] = netclassAssignments[ oldDrivenName ];
1319 }
1320 }
1321}
CONNECTION_SUBGRAPH * GetSubgraphForItem(SCH_ITEM *aItem)
A subgraph is a set of items that are electrically connected on a single sheet.
PRIORITY GetDriverPriority()
const wxString & GetNameForDriver(SCH_ITEM *aItem)
Returns the candidate net name for a driver.
std::vector< SCH_ITEM * > m_drivers
std::map< wxString, wxString > m_NetClassAssignments
Definition: net_settings.h:44
NET_SETTINGS & NetSettings()
Definition: project_file.h:96
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:145
Holds all the data relating to one schematic.
Definition: schematic.h:60
CONNECTION_GRAPH * ConnectionGraph() const override
Definition: schematic.h:131
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:75
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:145
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:112
wxString PathHumanReadable(bool aUseShortRootName=true) const
Return the sheet path in a human readable form made from the sheet names.

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(), CONNECTION_SUBGRAPH::NONE, path, SCH_SHEET_PATH::PathHumanReadable(), SCHEMATIC::Prj(), and SCH_ITEM::Schematic().

Referenced by SCH_EDIT_FRAME::AddItemToScreenAndUndoList().