Add net navigator panel to schematic editor.

[ADDED]: A panel to the schematic editor  that allows quick access to all
         of the items connected to the currently highlighted net.

This is an initial swag at implementing a full net navigator feature.  For
now it only shows the currently highlighted net nodes.  The incremental
net list advanced setting must be enabled in order to use this feature due
to performance reasons.  There are still some issues with saving the panel
position which will be addressed in the future.

Initial code for serializing wxAuiPaneInfo settings to and from JSON have
be implemented.
This commit is contained in:
Wayne Stambaugh 2023-05-20 13:47:12 -04:00
parent 88bf6b2627
commit 24b04795fd
22 changed files with 893 additions and 38 deletions

View File

@ -447,6 +447,7 @@ set( COMMON_SRCS
tool/zoom_tool.cpp
settings/app_settings.cpp
settings/aui_settings.cpp
settings/bom_settings.cpp
settings/color_settings.cpp
settings/cvpcb_settings.cpp

View File

@ -0,0 +1,255 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2023 Rivos
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Wayne Stambaugh <stambaughw@gmail.com>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <settings/aui_settings.h>
#include <nlohmann/json.hpp>
#include <wx/gdicmn.h>
#include <wx/aui/framemanager.h>
void to_json( nlohmann::json& aJson, const wxPoint& aPoint )
{
aJson = nlohmann::json
{
{ "x", aPoint.x },
{ "y", aPoint.y }
};
}
void from_json( const nlohmann::json& aJson, wxPoint& aPoint )
{
aPoint.x = aJson.at( "x" ).get<int>();
aPoint.y = aJson.at( "y" ).get<int>();
}
bool operator<( const wxPoint& aLhs, const wxPoint& aRhs )
{
int xDelta = aLhs.x - aRhs.x;
if( xDelta < 0 )
return true;
if( ( xDelta == 0 ) && (aLhs.y < aRhs.y ) )
return true;
return false;
}
void to_json( nlohmann::json& aJson, const wxSize& aSize )
{
aJson = nlohmann::json
{
{ "width", aSize.x },
{ "height", aSize.y }
};
}
void from_json( const nlohmann::json& aJson, wxSize& aSize )
{
aSize.SetWidth( aJson.at( "width" ).get<int>() );
aSize.SetHeight( aJson.at( "height" ).get<int>() );
}
bool operator<( const wxSize& aLhs, const wxSize& aRhs )
{
int xDelta = aLhs.x - aRhs.x;
if( xDelta < 0 )
return true;
if( ( xDelta == 0 ) && (aLhs.y < aRhs.y ) )
return true;
return false;
}
void to_json( nlohmann::json& aJson, const wxRect& aRect )
{
aJson = nlohmann::json
{
{ "position", aRect.GetPosition() },
{ "size", aRect.GetSize() }
};
}
void from_json( const nlohmann::json& aJson, wxRect& aRect )
{
aRect.SetPosition( aJson.at( "position" ).get<wxPoint>() );
aRect.SetSize( aJson.at( "size" ).get<wxSize>() );
}
bool operator<( const wxRect& aLhs, const wxRect& aRhs )
{
if( aLhs.GetSize() < aRhs.GetSize() )
return true;
if( aLhs.GetPosition() < aRhs.GetPosition() )
return true;
return false;
}
void to_json( nlohmann::json& aJson, const wxAuiPaneInfo& aPaneInfo )
{
aJson = nlohmann::json
{
{ "name", aPaneInfo.name },
{ "caption", aPaneInfo.caption },
{ "state", aPaneInfo.state },
{ "dock_direction", aPaneInfo.dock_direction },
{ "dock_layer", aPaneInfo.dock_layer },
{ "dock_row", aPaneInfo.dock_row },
{ "dock_pos", aPaneInfo.dock_pos },
{ "dock_proportion", aPaneInfo.dock_proportion },
{ "best_size", aPaneInfo.best_size },
{ "min_size", aPaneInfo.min_size },
{ "max_size", aPaneInfo.max_size },
{ "floating_pos", aPaneInfo.floating_pos },
{ "floating_size", aPaneInfo.floating_size },
{ "rect", aPaneInfo.rect }
};
}
void from_json( const nlohmann::json& aJson, wxAuiPaneInfo& aPaneInfo )
{
aPaneInfo.name = aJson.at( "name" ).get<wxString>();
aPaneInfo.caption = aJson.at( "caption" ).get<wxString>();
aPaneInfo.state = aJson.at( "state" ).get<int>();
aPaneInfo.dock_direction = aJson.at( "dock_direction" ).get<unsigned int>();
aPaneInfo.dock_layer = aJson.at( "dock_layer" ).get<int>();
aPaneInfo.dock_row = aJson.at( "dock_row" ).get<int>();
aPaneInfo.dock_pos = aJson.at( "dock_pos" ).get<int>();
aPaneInfo.dock_proportion = aJson.at( "dock_proportion" ).get<int>();
aPaneInfo.best_size = aJson.at( "best_size" ).get<wxSize>();
aPaneInfo.min_size = aJson.at( "min_size" ).get<wxSize>();
aPaneInfo.max_size = aJson.at( "max_size" ).get<wxSize>();
aPaneInfo.floating_pos = aJson.at( "floating_pos" ).get<wxPoint>();
aPaneInfo.floating_size = aJson.at( "floating_size" ).get<wxSize>();
aPaneInfo.rect = aJson.at( "rect" ).get<wxRect>();
}
bool operator<( const wxAuiPaneInfo& aLhs, const wxAuiPaneInfo& aRhs )
{
if( aLhs.name < aRhs.name )
return true;
if( aLhs.caption < aRhs.caption )
return true;
if( aLhs.state < aRhs.state )
return true;
if( aLhs.dock_direction < aRhs.dock_direction )
return true;
if( aLhs.dock_layer < aRhs.dock_layer )
return true;
if( aLhs.dock_row < aRhs.dock_row )
return true;
if( aLhs.dock_pos < aRhs.dock_pos )
return true;
if( aLhs.dock_proportion < aRhs.dock_proportion )
return true;
if( aLhs.best_size < aRhs.best_size )
return true;
if( aLhs.min_size < aRhs.min_size )
return true;
if( aLhs.max_size < aRhs.max_size )
return true;
if( aLhs.floating_pos < aRhs.floating_pos )
return true;
if( aLhs.floating_size < aRhs.floating_size )
return true;
if( aLhs.rect < aRhs.rect )
return true;
return false;
}
bool operator==( const wxAuiPaneInfo& aLhs, const wxAuiPaneInfo& aRhs )
{
if( aLhs.name != aRhs.name )
return false;
if( aLhs.caption != aRhs.caption )
return false;
if( aLhs.state != aRhs.state )
return false;
if( aLhs.dock_direction != aRhs.dock_direction )
return false;
if( aLhs.dock_layer != aRhs.dock_layer )
return false;
if( aLhs.dock_row != aRhs.dock_row )
return false;
if( aLhs.dock_pos != aRhs.dock_pos )
return false;
if( aLhs.dock_proportion != aRhs.dock_proportion )
return false;
if( aLhs.best_size != aRhs.best_size )
return false;
if( aLhs.min_size != aRhs.min_size )
return false;
if( aLhs.max_size != aRhs.max_size )
return false;
if( aLhs.floating_pos != aRhs.floating_pos )
return false;
if( aLhs.floating_size != aRhs.floating_size )
return false;
if( aLhs.rect != aRhs.rect )
return false;
return true;
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -31,10 +31,13 @@
#include <settings/nested_settings.h>
#include <settings/parameters.h>
#include <settings/bom_settings.h>
#include <settings/aui_settings.h>
#include <wx/aui/framemanager.h>
#include <wx/config.h>
#include <wx/debug.h>
#include <wx/fileconf.h>
#include <wx/filename.h>
#include <wx/gdicmn.h>
#include <wx/log.h>
#include <wx/stdstream.h>
#include <wx/wfstream.h>
@ -569,7 +572,10 @@ template std::optional<KIGFX::COLOR4D> JSON_SETTINGS::Get<KIGFX::COLOR4D>( const
template std::optional<BOM_FIELD> JSON_SETTINGS::Get<BOM_FIELD>( const std::string& aPath ) const;
template std::optional<BOM_PRESET> JSON_SETTINGS::Get<BOM_PRESET>( const std::string& aPath ) const;
template std::optional<BOM_FMT_PRESET> JSON_SETTINGS::Get<BOM_FMT_PRESET>( const std::string& aPath ) const;
template std::optional<wxPoint> JSON_SETTINGS::Get<wxPoint>( const std::string& aPath ) const;
template std::optional<wxSize> JSON_SETTINGS::Get<wxSize>( const std::string& aPath ) const;
template std::optional<wxRect> JSON_SETTINGS::Get<wxRect>( const std::string& aPath ) const;
template std::optional<wxAuiPaneInfo> JSON_SETTINGS::Get<wxAuiPaneInfo>( const std::string& aPath ) const;
template<typename ValueType>
void JSON_SETTINGS::Set( const std::string& aPath, ValueType aVal )
@ -592,6 +598,10 @@ template void JSON_SETTINGS::Set<KIGFX::COLOR4D>( const std::string& aPath, KIGF
template void JSON_SETTINGS::Set<BOM_FIELD>( const std::string& aPath, BOM_FIELD aValue );
template void JSON_SETTINGS::Set<BOM_PRESET>( const std::string& aPath, BOM_PRESET aValue );
template void JSON_SETTINGS::Set<BOM_FMT_PRESET>( const std::string& aPath, BOM_FMT_PRESET aValue );
template void JSON_SETTINGS::Set<wxPoint>( const std::string& aPath, wxPoint aValue );
template void JSON_SETTINGS::Set<wxSize>( const std::string& aPath, wxSize aValue );
template void JSON_SETTINGS::Set<wxRect>( const std::string& aPath, wxRect aValue );
template void JSON_SETTINGS::Set<wxAuiPaneInfo>( const std::string& aPath, wxAuiPaneInfo aValue );
void JSON_SETTINGS::registerMigration( int aOldSchemaVersion, int aNewSchemaVersion,

View File

@ -75,7 +75,6 @@ template class PARAM_LAMBDA<int>;
template class PARAM_LAMBDA<nlohmann::json>;
template class PARAM_LAMBDA<std::string>;
template <typename ValueType>
void PARAM_LIST<ValueType>::Load( JSON_SETTINGS* aSettings, bool aResetIfMissing ) const
{

View File

@ -286,6 +286,7 @@ set( EESCHEMA_SRCS
lib_textbox.cpp
libarch.cpp
menubar.cpp
net_navigator.cpp
pin_numbers.cpp
pin_type.cpp
project_rescue.cpp

View File

@ -2693,6 +2693,20 @@ CONNECTION_SUBGRAPH* CONNECTION_GRAPH::GetSubgraphForItem( SCH_ITEM* aItem )
}
const std::vector<CONNECTION_SUBGRAPH*> CONNECTION_GRAPH::GetAllSubgraphs(
const wxString& aNetName ) const
{
std::vector<CONNECTION_SUBGRAPH*> subgraphs;
auto it = m_net_name_to_subgraphs_map.find( aNetName );
if( it == m_net_name_to_subgraphs_map.end() )
return subgraphs;
return it->second;
}
int CONNECTION_GRAPH::RunERC()
{
int error_count = 0;

View File

@ -28,6 +28,7 @@
#include <erc_settings.h>
#include <sch_connection.h>
#include <sch_item.h>
#include <wx/treectrl.h>
#ifdef DEBUG
@ -138,7 +139,8 @@ public:
}
/// Finds all items in the subgraph as well as child subgraphs recursively
void getAllConnectedItems( std::set<std::pair<SCH_SHEET_PATH, SCH_ITEM*>>& aItems, std::set<CONNECTION_SUBGRAPH*>& aSubgraphs );
void getAllConnectedItems( std::set<std::pair<SCH_SHEET_PATH, SCH_ITEM*>>& aItems,
std::set<CONNECTION_SUBGRAPH*>& aSubgraphs );
/**
* Return the priority (higher is more important) of a candidate driver
@ -412,6 +414,8 @@ public:
CONNECTION_SUBGRAPH* GetSubgraphForItem( SCH_ITEM* aItem );
const std::vector<CONNECTION_SUBGRAPH*> GetAllSubgraphs( const wxString& aNetName ) const;
/**
* Returns the fully-resolved netname for a given subgraph
* @param aSubGraph Reference to the subgraph

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -33,6 +33,7 @@
#include <settings/json_settings_internals.h>
#include <settings/parameters.h>
#include <settings/settings_manager.h>
#include <settings/aui_settings.h>
#include <wx/config.h>
#include <widgets/ui_common.h>
#include <default_values.h> // For some default values
@ -60,6 +61,28 @@ const nlohmann::json defaultBomPlugins =
};
const wxAuiPaneInfo& defaultNetNavigatorPaneInfo()
{
static wxAuiPaneInfo paneInfo;
paneInfo.Name( wxS( "NetNavigator" ) )
.Caption( _( "Net Navigator" ) )
.CaptionVisible( true )
.PaneBorder( true )
.Left().Layer( 3 )
.TopDockable( false )
.BottomDockable( false )
.CloseButton( true )
.MinSize( 120, 60 )
.BestSize( 200, 200 )
.FloatingSize( 200, 200 )
.FloatingPosition( 50, 200 )
.Show( false );
return paneInfo;
}
EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
APP_SETTINGS_BASE( "eeschema", eeschemaSchemaVersion ),
m_Appearance(),
@ -161,6 +184,9 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_docked_width",
&m_AuiPanels.hierarchy_panel_docked_width, -1 ) );
m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_docked_height",
&m_AuiPanels.hierarchy_panel_docked_height, -1 ) );
m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_float_width",
&m_AuiPanels.hierarchy_panel_float_width, -1 ) );
@ -176,6 +202,24 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
m_params.emplace_back( new PARAM<bool>( "aui.show_search",
&m_AuiPanels.show_search, false ) );
m_params.emplace_back( new PARAM<bool>( "aui.show_net_nav_panel",
&m_AuiPanels.show_net_nav_panel, false ) );
m_params.emplace_back( new PARAM<bool>( "aui.float_net_nav_panel",
&m_AuiPanels.float_net_nav_panel, false ) );
m_params.emplace_back( new PARAM<wxSize>( "aui.net_nav_panel_docked_size",
&m_AuiPanels.net_nav_panel_docked_size, wxSize( 120, -1 ) ) );
m_params.emplace_back( new PARAM<bool>( "aui.float_net_nav_panel",
&m_AuiPanels.float_net_nav_panel, false ) );
m_params.emplace_back( new PARAM<wxPoint>( "aui.net_nav_panel_float_pos",
&m_AuiPanels.net_nav_panel_float_pos, wxPoint( 50, 200 ), false ) );
m_params.emplace_back( new PARAM<wxSize>( "aui.net_nav_panel_float_size",
&m_AuiPanels.net_nav_panel_float_size, wxSize( 200, 200 ) ) );
m_params.emplace_back( new PARAM<bool>( "autoplace_fields.enable",
&m_AutoplaceFields.enable, true ) );

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -24,12 +24,17 @@
#ifndef _EESCHEMA_SETTINGS_H
#define _EESCHEMA_SETTINGS_H
#include <wx/aui/framemanager.h>
#include <settings/app_settings.h>
using KIGFX::COLOR4D;
extern const wxAuiPaneInfo& defaultNetNavigatorPaneInfo();
enum LINE_MODE
{
LINE_MODE_FREE = 0,
@ -75,12 +80,18 @@ public:
struct AUI_PANELS
{
int hierarchy_panel_docked_width; // width of hierarchy tree panel and pane when docked
int hierarchy_panel_docked_height; // height of hierarchy tree panel and pane when docked
int hierarchy_panel_float_width; // width of hierarchy tree panel when floating
int hierarchy_panel_float_height; // height of hierarchy tree panel when floating
int search_panel_height; // height of the search panel
bool schematic_hierarchy_float; // show hierarchy tree panel as floating
bool show_schematic_hierarchy; // show hierarchy tree pane
bool show_search; // show the search panel
wxSize net_nav_panel_docked_size;
wxPoint net_nav_panel_float_pos;
wxSize net_nav_panel_float_size;
bool float_net_nav_panel;
bool show_net_nav_panel;
};
struct AUTOPLACE_FIELDS

View File

@ -107,11 +107,13 @@ void SCH_EDIT_FRAME::doReCreateMenuBar()
submenuImport->SetTitle( _( "Import" ) );
submenuImport->SetIcon( BITMAPS::import );
submenuImport->Add( _( "Non-KiCad Schematic..." ),
_( "Replace current schematic sheet with one imported from another application" ),
_( "Replace current schematic sheet with one imported from another "
"application" ),
ID_IMPORT_NON_KICAD_SCH,
BITMAPS::import_document );
submenuImport->Add( EE_ACTIONS::importFPAssignments, ACTION_MENU::NORMAL, _( "Footprint Assignments..." ) );
submenuImport->Add( EE_ACTIONS::importFPAssignments, ACTION_MENU::NORMAL,
_( "Footprint Assignments..." ) );
fileMenu->Add( submenuImport );
@ -119,7 +121,8 @@ void SCH_EDIT_FRAME::doReCreateMenuBar()
ACTION_MENU* submenuExport = new ACTION_MENU( false, selTool );
submenuExport->SetTitle( _( "Export" ) );
submenuExport->SetIcon( BITMAPS::export_file );
submenuExport->Add( EE_ACTIONS::drawSheetOnClipboard, ACTION_MENU::NORMAL, _( "Drawing to Clipboard" ) );
submenuExport->Add( EE_ACTIONS::drawSheetOnClipboard, ACTION_MENU::NORMAL,
_( "Drawing to Clipboard" ) );
submenuExport->Add( EE_ACTIONS::exportNetlist, ACTION_MENU::NORMAL, _( "Netlist..." ) );
submenuExport->Add( EE_ACTIONS::exportSymbolsToLibrary, ACTION_MENU::NORMAL,
_( "Symbols to Library..." ) );
@ -179,6 +182,12 @@ void SCH_EDIT_FRAME::doReCreateMenuBar()
viewMenu->Add( EE_ACTIONS::navigatePrevious );
viewMenu->Add( EE_ACTIONS::navigateNext );
if( ADVANCED_CFG::GetCfg().m_IncrementalConnectivity )
{
viewMenu->AppendSeparator();
viewMenu->Add( EE_ACTIONS::showNetNavigator, ACTION_MENU::CHECK );
}
viewMenu->AppendSeparator();
viewMenu->Add( ACTIONS::zoomInCenter );
viewMenu->Add( ACTIONS::zoomOutCenter );

298
eeschema/net_navigator.cpp Normal file
View File

@ -0,0 +1,298 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2023 Rivos
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Wayne Stambaugh <stambaughw@gmail.com>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wx/log.h>
#include <tool/tool_manager.h>
#include <kiface_base.h>
#include <sch_edit_frame.h>
#include <schematic.h>
#include <connection_graph.h>
#include <widgets/wx_aui_utils.h>
#include <tools/ee_actions.h>
class NET_NAVIGATOR_ITEM_DATA : public wxTreeItemData
{
public:
NET_NAVIGATOR_ITEM_DATA( const SCH_SHEET_PATH& aSheetPath, const VECTOR2I& aItemCenterPos ) :
m_sheetPath( aSheetPath ),
m_itemCenterPos( aItemCenterPos )
{
}
NET_NAVIGATOR_ITEM_DATA() {}
SCH_SHEET_PATH& GetSheetPath() { return m_sheetPath; }
VECTOR2I& GetItemCenterPos() { return m_itemCenterPos; }
bool operator==( const NET_NAVIGATOR_ITEM_DATA& aRhs ) const
{
return ( m_sheetPath == aRhs.m_sheetPath ) && ( m_itemCenterPos == aRhs.m_itemCenterPos );
}
NET_NAVIGATOR_ITEM_DATA& operator=( const NET_NAVIGATOR_ITEM_DATA& aItemData )
{
if( this == &aItemData )
return *this;
m_sheetPath = aItemData.m_sheetPath;
m_itemCenterPos = aItemData.m_itemCenterPos;
return *this;
}
private:
SCH_SHEET_PATH m_sheetPath;
VECTOR2I m_itemCenterPos;
};
void SCH_EDIT_FRAME::MakeNetNavigatorNode( const wxString& aNetName, wxTreeItemId aParentId )
{
wxCHECK( !aNetName.IsEmpty(), /* void */ );
wxCHECK( m_schematic, /* void */ );
wxCHECK( m_netNavigator, /* void */ );
CONNECTION_GRAPH* connectionGraph = m_schematic->ConnectionGraph();
wxCHECK( connectionGraph, /* void */ );
wxString sheetPathPrefix;
const std::vector<CONNECTION_SUBGRAPH*> subgraphs =
connectionGraph->GetAllSubgraphs( aNetName );
for( const CONNECTION_SUBGRAPH* subGraph : subgraphs )
{
SCH_SHEET_PATH sheetPath = subGraph->GetSheet();
// if( subgraphs.size() > 1 )
sheetPathPrefix = _( "Sheet: " ) + sheetPath.PathHumanReadable() + wxS( ", " );
for( const SCH_ITEM* item : subGraph->GetItems() )
{
VECTOR2I itemCenterPos = item->GetBoundingBox().Centre();
m_netNavigator->AppendItem( aParentId,
sheetPathPrefix + item->GetItemDescription( this ),
-1, -1,
new NET_NAVIGATOR_ITEM_DATA( sheetPath, itemCenterPos ) );
}
}
}
void SCH_EDIT_FRAME::RefreshNetNavigator()
{
wxCHECK( m_netNavigator, /* void */ );
if( m_netNavigator->IsEmpty() && m_highlightedConn.IsEmpty() )
return;
if( !m_netNavigator->IsEmpty() && m_highlightedConn.IsEmpty() )
{
m_netNavigator->DeleteAllItems();
return;
}
if( !m_netNavigator->IsEmpty() )
{
const wxString shownNetName = m_netNavigator->GetItemText( m_netNavigator->GetRootItem() );
if( shownNetName != m_highlightedConn )
{
m_netNavigator->DeleteAllItems();
wxTreeItemId rootId = m_netNavigator->AddRoot( m_highlightedConn, 0 );
MakeNetNavigatorNode( m_highlightedConn, rootId );
m_netNavigator->Expand( rootId );
}
else
{
// If it's the same net, we have to manually check to make sure the net has
// not changed. This is an ugly hack because we have no way to track a
// single connection object change in the connection graph code.
wxTreeItemData* treeItemData = nullptr;
NET_NAVIGATOR_ITEM_DATA* tmp = nullptr;
wxTreeItemId selectedId = m_netNavigator->GetSelection();
wxString selectedText;
NET_NAVIGATOR_ITEM_DATA selectedItemData;
if( ( selectedId != m_netNavigator->GetRootItem() ) && selectedId.IsOk() )
{
selectedText = m_netNavigator->GetItemText( selectedId );
treeItemData = m_netNavigator->GetItemData( selectedId );
tmp = static_cast<NET_NAVIGATOR_ITEM_DATA*>( treeItemData );
if( tmp )
selectedItemData = *tmp;
}
m_netNavigator->DeleteAllItems();
wxTreeItemId rootId = m_netNavigator->AddRoot( m_highlightedConn, 0 );
MakeNetNavigatorNode( m_highlightedConn, rootId );
m_netNavigator->Expand( rootId );
if( ( selectedId != m_netNavigator->GetRootItem() ) && !selectedText.IsEmpty() )
{
wxTreeItemIdValue cookie;
wxTreeItemId id = m_netNavigator->GetFirstChild( rootId, cookie );
while( id.IsOk() )
{
wxString treeItemText = m_netNavigator->GetItemText( id );
treeItemData = m_netNavigator->GetItemData( id );
tmp = static_cast<NET_NAVIGATOR_ITEM_DATA*>( treeItemData );
if( ( treeItemText == selectedText )
&& ( tmp && ( *tmp == selectedItemData ) ) )
{
m_netNavigator->SetFocusedItem( id );
break;
}
id = m_netNavigator->GetNextChild( rootId, cookie );
}
}
}
}
else
{
wxTreeItemId rootId = m_netNavigator->AddRoot( m_highlightedConn, 0 );
MakeNetNavigatorNode( m_highlightedConn, rootId );
m_netNavigator->Expand( rootId );
}
}
void SCH_EDIT_FRAME::onNetNavigatorSelection( wxTreeEvent& aEvent )
{
wxCHECK( m_netNavigator, /* void */ );
wxTreeItemId id = aEvent.GetItem();
// Clicking on the root item (net name ) does nothing.
if( id == m_netNavigator->GetRootItem() )
return;
NET_NAVIGATOR_ITEM_DATA* itemData =
dynamic_cast<NET_NAVIGATOR_ITEM_DATA*>( m_netNavigator->GetItemData( id ) );
wxCHECK( itemData, /* void */ );
if( GetCurrentSheet() != itemData->GetSheetPath() )
{
// GetToolManager()->RunAction( ACTIONS::cancelInteractive, true );
// GetToolManager()->RunAction( EE_ACTIONS::clearSelection, true );
Schematic().SetCurrentSheet( itemData->GetSheetPath() );
DisplayCurrentSheet();
}
FocusOnLocation( itemData->GetItemCenterPos() );
GetCanvas()->Refresh();
}
void SCH_EDIT_FRAME::onNetNavigatorSelChanging( wxTreeEvent& aEvent )
{
wxCHECK( m_netNavigator, /* void */ );
}
void SCH_EDIT_FRAME::ToggleNetNavigator()
{
EESCHEMA_SETTINGS* cfg = eeconfig();
wxCHECK( cfg, /* void */ );
wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
netNavigatorPane.Show( !netNavigatorPane.IsShown() );
cfg->m_AuiPanels.show_net_nav_panel = netNavigatorPane.IsShown();
if( netNavigatorPane.IsShown() )
{
if( netNavigatorPane.IsFloating() )
{
netNavigatorPane.FloatingSize( cfg->m_AuiPanels.net_nav_panel_float_size );
m_auimgr.Update();
}
else if( cfg->m_AuiPanels.net_nav_panel_docked_size.GetWidth() > 0 )
{
// SetAuiPaneSize also updates m_auimgr
SetAuiPaneSize( m_auimgr, netNavigatorPane,
cfg->m_AuiPanels.net_nav_panel_docked_size.GetWidth(), -1 );
}
}
else
{
if( netNavigatorPane.IsFloating() )
{
cfg->m_AuiPanels.net_nav_panel_float_size = netNavigatorPane.floating_size;
}
else
{
cfg->m_AuiPanels.net_nav_panel_docked_size = m_netNavigator->GetSize();
}
m_auimgr.Update();
}
}
void SCH_EDIT_FRAME::onResizeNetNavigator( wxSizeEvent& aEvent )
{
aEvent.Skip();
// Called when resizing the Hierarchy Navigator panel
// Store the current pane size
// It allows to retrieve the last defined pane size when switching between
// docked and floating pane state
// Note: *DO NOT* call m_auimgr.Update() here: it crashes Kicad at least on Windows
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
wxCHECK( cfg, /* void */ );
wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
if( m_netNavigator->IsShown() )
{
cfg->m_AuiPanels.net_nav_panel_float_size = netNavigatorPane.floating_size;
// initialize net_nav_panel_docked_width and best size only if the netNavigatorPane
// width is > 0 (i.e. if its size is already set and has meaning)
// if it is floating, its size is not initialized (only floating_size is initialized)
// initializing netNavigatorPane.best_size is useful when switching to float pane and
// after switching to the docked pane, to retrieve the last docked pane width
if( netNavigatorPane.rect.width > 50 ) // 50 is a good margin
{
cfg->m_AuiPanels.net_nav_panel_docked_size.SetWidth( netNavigatorPane.rect.width );
netNavigatorPane.best_size.x = netNavigatorPane.rect.width;
}
}
}

View File

@ -349,6 +349,22 @@ wxString SCH_CONNECTION::Name( bool aIgnoreSheet ) const
}
wxString SCH_CONNECTION::GetNetName() const
{
wxString retv;
if( m_graph )
{
CONNECTION_SUBGRAPH* subgraph = m_graph->GetSubgraphForItem( m_parent );
if( subgraph )
retv = subgraph->GetNetName();
}
return retv;
}
void SCH_CONNECTION::recacheName()
{
m_cached_name = m_name.IsEmpty() ? wxString( wxT( "<NO NET>" ) )

View File

@ -153,6 +153,8 @@ public:
recacheName();
}
wxString GetNetName() const;
wxString Prefix() const { return m_prefix; }
void SetPrefix( const wxString& aPrefix );

View File

@ -116,13 +116,17 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, SCH_BASE_FRAME )
EVT_DROP_FILES( SCH_EDIT_FRAME::OnDropFiles )
END_EVENT_TABLE()
wxDEFINE_EVENT( EDA_EVT_SCHEMATIC_CHANGED, wxCommandEvent );
SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH, wxT( "Eeschema" ), wxDefaultPosition,
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, SCH_EDIT_FRAME_NAME ),
m_ercDialog( nullptr ),
m_diffSymbolDialog( nullptr )
m_diffSymbolDialog( nullptr ),
m_netNavigator( nullptr ),
m_highlightedConnChanged( false )
{
m_maximizeByDefault = true;
m_schematic = new SCHEMATIC( nullptr );
@ -194,7 +198,11 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
.MinSize( 120, 60 )
.BestSize( 200, 200 )
.FloatingSize( 200, 200 )
.FloatingPosition( 50, 50 )
.Show( false ) );
m_auimgr.AddPane( createHighlightedNetNavigator(), defaultNetNavigatorPaneInfo() );
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( wxS( "OptToolbar" ) )
.Left().Layer( 2 ) );
@ -229,9 +237,11 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
static_cast<KIGFX::SCH_PAINTER*>( view->GetPainter() )->SetSchematic( m_schematic );
wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
EESCHEMA_SETTINGS* cfg = eeconfig();
hierarchy_pane.Show( cfg->m_AuiPanels.show_schematic_hierarchy );
netNavigatorPane.Show( cfg->m_AuiPanels.show_net_nav_panel );
if( cfg->m_AuiPanels.hierarchy_panel_float_width > 0
&& cfg->m_AuiPanels.hierarchy_panel_float_height > 0 )
@ -241,6 +251,12 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
cfg->m_AuiPanels.hierarchy_panel_float_height );
}
if( cfg->m_AuiPanels.net_nav_panel_float_size.GetWidth() > 0
&& cfg->m_AuiPanels.net_nav_panel_float_size.GetHeight() > 0 )
{
netNavigatorPane.FloatingSize( cfg->m_AuiPanels.net_nav_panel_float_size );
}
if( cfg->m_AuiPanels.schematic_hierarchy_float )
hierarchy_pane.Float();
@ -250,24 +266,46 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SetAuiPaneSize( m_auimgr, searchPane, -1, cfg->m_AuiPanels.search_panel_height );
}
if( cfg->m_AuiPanels.float_net_nav_panel )
netNavigatorPane.Float();
if( cfg->m_AuiPanels.hierarchy_panel_docked_width > 0 )
{
SetAuiPaneSize( m_auimgr, hierarchy_pane,
cfg->m_AuiPanels.hierarchy_panel_docked_width, -1 );
// If the net navigator is not show, let the heirarchy navigator take all of the vertical
// space.
if( !cfg->m_AuiPanels.show_net_nav_panel )
{
SetAuiPaneSize( m_auimgr, hierarchy_pane,
cfg->m_AuiPanels.hierarchy_panel_docked_width, -1 );
}
else
{
SetAuiPaneSize( m_auimgr, hierarchy_pane,
cfg->m_AuiPanels.hierarchy_panel_docked_width,
cfg->m_AuiPanels.hierarchy_panel_docked_height );
SetAuiPaneSize( m_auimgr, netNavigatorPane,
cfg->m_AuiPanels.net_nav_panel_docked_size.GetWidth(),
cfg->m_AuiPanels.net_nav_panel_docked_size.GetHeight() );
}
// wxAUI hack: force width by setting MinSize() and then Fixed()
// thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
hierarchy_pane.MinSize( cfg->m_AuiPanels.hierarchy_panel_docked_width, -1 );
// thanks to ZenJu https://github.com/wxWidgets/wxWidgets/issues/13180
hierarchy_pane.MinSize( cfg->m_AuiPanels.hierarchy_panel_docked_width, 60 );
hierarchy_pane.Fixed();
netNavigatorPane.MinSize( cfg->m_AuiPanels.net_nav_panel_docked_size.GetWidth(), 60 );
netNavigatorPane.Fixed();
m_auimgr.Update();
// now make it resizable again
hierarchy_pane.Resizable();
netNavigatorPane.Resizable();
m_auimgr.Update();
// Note: DO NOT call m_auimgr.Update() anywhere after this; it will nuke the size
// back to minimum.
hierarchy_pane.MinSize( 120, 60 );
netNavigatorPane.MinSize( 120, 60 );
}
else
{
@ -284,10 +322,11 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
initScreenZoom();
m_hierarchy->Connect( wxEVT_SIZE,
wxSizeEventHandler( SCH_EDIT_FRAME::OnResizeHierarchyNavigator ),
NULL, this );
m_hierarchy->Bind( wxEVT_SIZE, &SCH_EDIT_FRAME::OnResizeHierarchyNavigator, this );
m_netNavigator->Bind( wxEVT_TREE_SEL_CHANGING, &SCH_EDIT_FRAME::onNetNavigatorSelChanging,
this );
m_netNavigator->Bind( wxEVT_TREE_SEL_CHANGED, &SCH_EDIT_FRAME::onNetNavigatorSelection, this );
m_netNavigator->Bind( wxEVT_SIZE, &SCH_EDIT_FRAME::onResizeNetNavigator, this );
// This is used temporarily to fix a client size issue on GTK that causes zoom to fit
// to calculate the wrong zoom size. See SCH_EDIT_FRAME::onSize().
@ -323,9 +362,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SCH_EDIT_FRAME::~SCH_EDIT_FRAME()
{
m_hierarchy->Disconnect( wxEVT_SIZE,
wxSizeEventHandler( SCH_EDIT_FRAME::OnResizeHierarchyNavigator ),
NULL, this );
m_hierarchy->Unbind( wxEVT_SIZE, &SCH_EDIT_FRAME::OnResizeHierarchyNavigator, this );
// Ensure m_canvasType is up to date, to save it in config
m_canvasType = GetCanvas()->GetBackend();
@ -444,6 +481,11 @@ void SCH_EDIT_FRAME::setupUIConditions()
return m_auimgr.GetPane( SchematicHierarchyPaneName() ).IsShown();
};
auto netNavigatorCond =
[ this ] (const SELECTION& aSel )
{
return m_auimgr.GetPane( NetNavigatorPaneName() ).IsShown();
};
#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
#define CHECK( x ) ACTION_CONDITIONS().Check( x )
@ -453,7 +495,7 @@ void SCH_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::redo, ENABLE( cond.RedoAvailable() ) );
mgr->SetConditions( EE_ACTIONS::showHierarchy, CHECK( hierarchyNavigatorCond ) );
mgr->SetConditions( EE_ACTIONS::showNetNavigator, CHECK( netNavigatorCond ) );
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::millimetersUnits,
@ -888,6 +930,10 @@ void SCH_EDIT_FRAME::doCloseWindow()
// Close modeless dialogs. They're trouble when they get destroyed after the frame.
Unbind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &SCH_EDIT_FRAME::onCloseSymbolDiffDialog, this );
Unbind( EDA_EVT_CLOSE_ERC_DIALOG, &SCH_EDIT_FRAME::onCloseErcDialog, this );
m_netNavigator->Unbind( wxEVT_TREE_SEL_CHANGING, &SCH_EDIT_FRAME::onNetNavigatorSelChanging,
this );
m_netNavigator->Unbind( wxEVT_TREE_SEL_CHANGED, &SCH_EDIT_FRAME::onNetNavigatorSelection,
this );
wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_ERC_WINDOW_NAME );
@ -1692,7 +1738,6 @@ void SCH_EDIT_FRAME::initScreenZoom()
void SCH_EDIT_FRAME::RecalculateConnections( SCH_CLEANUP_FLAGS aCleanupFlags )
{
bool highlightedConnChanged = false;
wxString highlightedConn = GetHighlightedConnection();
SCHEMATIC_SETTINGS& settings = Schematic().Settings();
SCH_SHEET_LIST list = Schematic().GetSheets();
@ -1728,7 +1773,7 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_CLEANUP_FLAGS aCleanupFlags )
SCH_CONNECTION* connection = aChangedItem->Connection();
if( connection && ( connection->Name() == highlightedConn ) )
highlightedConnChanged = true;
m_highlightedConnChanged = true;
};
if( !ADVANCED_CFG::GetCfg().m_IncrementalConnectivity || aCleanupFlags == GLOBAL_CLEANUP
@ -1857,10 +1902,11 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_CLEANUP_FLAGS aCleanupFlags )
if( !highlightedConn.IsEmpty() )
{
if( highlightedConnChanged )
wxLogDebug( wxS( "Highlighted connection \"%s\" changed." ), highlightedConn );
else if( !Schematic().ConnectionGraph()->FindFirstSubgraphByName( highlightedConn ) )
wxLogDebug( wxS( "Highlighted connection \"%s\" no longer exists." ), highlightedConn );
if( m_highlightedConnChanged
|| !Schematic().ConnectionGraph()->FindFirstSubgraphByName( highlightedConn ) )
RefreshNetNavigator();
m_highlightedConnChanged = false;
}
}
@ -2307,3 +2353,24 @@ void SCH_EDIT_FRAME::RemoveSchematicChangeListener( wxEvtHandler* aListener )
if( it != m_schematicChangeListeners.end() )
m_schematicChangeListeners.erase( it );
}
wxTreeCtrl* SCH_EDIT_FRAME::createHighlightedNetNavigator()
{
m_netNavigator = new wxTreeCtrl( this, wxID_ANY, wxPoint( 0, 0 ),
FromDIP( wxSize( 160, 250 ) ),
wxTR_DEFAULT_STYLE | wxNO_BORDER );
return m_netNavigator;
}
void SCH_EDIT_FRAME::SetHighlightedConnection( const wxString& aConnection )
{
bool refreshNetNavigator = aConnection != m_highlightedConn;
m_highlightedConn = aConnection;
if( refreshNetNavigator )
RefreshNetNavigator();
}

View File

@ -32,6 +32,7 @@
#include <wx/event.h>
#include <wx/gdicmn.h>
#include <wx/string.h>
#include <wx/treectrl.h>
#include <wx/utils.h>
#include <config_params.h>
@ -95,6 +96,7 @@ enum SCH_CLEANUP_FLAGS
wxDECLARE_EVENT( EDA_EVT_SCHEMATIC_CHANGED, wxCommandEvent );
/**
* Schematic editor (Eeschema) main window.
*/
@ -193,7 +195,7 @@ public:
void KiwayMailIn( KIWAY_EXPRESS& aEvent ) override;
/**
* Refresh the display of any operating points. Called after a .op simulation completes.
* Refresh the display of any operaintg points. Called after a .op simulation completes.
*/
void RefreshOperatingPointDisplay();
@ -309,10 +311,7 @@ public:
return m_highlightedConn;
}
void SetHighlightedConnection( const wxString& aConnection )
{
m_highlightedConn = aConnection;
}
void SetHighlightedConnection( const wxString& aConnection );
/**
* Check if we are ready to write a netlist file for the current schematic.
@ -828,6 +827,8 @@ public:
DIALOG_ERC* GetErcDialog();
wxTreeCtrl* GetNetNavigator() { return m_netNavigator; }
/**
* @return the name of the wxAuiPaneInfo managing the Hierarchy Navigator panel
*/
@ -857,6 +858,17 @@ public:
*/
void RemoveSchematicChangeListener( wxEvtHandler* aListener );
static const wxString NetNavigatorPaneName()
{
return wxS( "NetNavigator" );
}
void RefreshNetNavigator();
void MakeNetNavigatorNode( const wxString& aNetName, wxTreeItemId aParentId );
void ToggleNetNavigator();
DECLARE_EVENT_TABLE()
protected:
@ -886,6 +898,8 @@ private:
// Called when resizing the Hierarchy Navigator panel
void OnResizeHierarchyNavigator( wxSizeEvent& aEvent );
void onResizeNetNavigator( wxSizeEvent& aEvent );
// Sets up the tool framework
void setupTools();
@ -953,6 +967,12 @@ private:
const wxString& getAutoSaveFileName() const;
wxTreeCtrl* createHighlightedNetNavigator();
void onNetNavigatorSelection( wxTreeEvent& aEvent );
void onNetNavigatorSelChanging( wxTreeEvent& aEvent );
private:
// The schematic editor control class should be able to access some internal
// functions of the editor frame.
@ -975,10 +995,14 @@ private:
DIALOG_BOOK_REPORTER* m_diffSymbolDialog;
HIERARCHY_PANE* m_hierarchy;
wxTreeCtrl* m_netNavigator;
bool m_syncingPcbToSchSelection; // Recursion guard when synchronizing selection from PCB
bool m_show_search;
bool m_highlightedConnChanged;
std::vector<wxEvtHandler*> m_schematicChangeListeners;
};

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2022 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2023 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -112,7 +112,12 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_SCREEN* aScreen, SCH_ITEM* aItem,
wxCHECK( aItem, /* void */ );
if( aDirtyConnectivity )
{
if( aItem->Connection() && ( aItem->Connection()->Name() == m_highlightedConn ) )
m_highlightedConnChanged = true;
aItem->SetConnectivityDirty();
}
PICKED_ITEMS_LIST* lastUndo = PopCommandFromUndoList();
@ -209,7 +214,12 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
continue;
if( aDirtyConnectivity )
{
if( sch_item->Connection() && ( sch_item->Connection()->Name() == m_highlightedConn ) )
m_highlightedConnChanged = true;
sch_item->SetConnectivityDirty();
}
UNDO_REDO command = commandToUndo->GetPickedItemStatus( ii );
@ -281,6 +291,7 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
{
continue;
}
if( status == UNDO_REDO::NEWITEM )
{
// If we are removing the current sheet, get out first
@ -290,11 +301,21 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
GetToolManager()->RunAction( EE_ACTIONS::leaveSheet );
}
SCH_ITEM* schItem = static_cast<SCH_ITEM*>( eda_item );
if( schItem && schItem->IsConnectable() )
m_highlightedConnChanged = true;
RemoveFromScreen( eda_item, screen );
aList->SetPickedItemStatus( UNDO_REDO::DELETED, ii );
}
else if( status == UNDO_REDO::DELETED )
{
SCH_ITEM* schItem = static_cast<SCH_ITEM*>( eda_item );
if( schItem && schItem->IsConnectable() )
m_highlightedConnChanged = true;
// deleted items are re-inserted on undo
AddToScreen( eda_item, screen );
aList->SetPickedItemStatus( UNDO_REDO::NEWITEM, ii );
@ -312,6 +333,9 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
}
else if( SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( eda_item ) )
{
if( item->IsConnectable() )
m_highlightedConnChanged = true;
// everything else is modified in place
SCH_ITEM* alt_item = static_cast<SCH_ITEM*>( aList->GetPickedItemLink( ii ) );

View File

@ -254,6 +254,9 @@ void SCH_EDIT_FRAME::ToggleSearch()
void SCH_EDIT_FRAME::ToggleSchematicHierarchy()
{
EESCHEMA_SETTINGS* cfg = eeconfig();
wxCHECK( cfg, /* void */ );
wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
hierarchy_pane.Show( !hierarchy_pane.IsShown() );

View File

@ -597,6 +597,10 @@ TOOL_ACTION EE_ACTIONS::highlightNetTool( "eeschema.EditorControl.highlightNetTo
_( "Highlight Nets" ), _( "Highlight wires and pins of a net" ),
BITMAPS::net_highlight_schematic, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::showNetNavigator( "eeschema.EditorControl.showNetNavigator",
AS_GLOBAL, 0, "",
_( "Show Net Navigator" ), _( "Toggle the net navigator panel visibility" ) );
TOOL_ACTION EE_ACTIONS::editWithLibEdit( "eeschema.EditorControl.editWithSymbolEditor",
AS_GLOBAL,
MD_CTRL + 'E', LEGACY_HK_NAME( "Edit with Symbol Editor" ),

View File

@ -284,6 +284,7 @@ public:
static TOOL_ACTION clearHighlight;
static TOOL_ACTION updateNetHighlighting;
static TOOL_ACTION highlightNetTool;
static TOOL_ACTION showNetNavigator;
// Drag and drop
static TOOL_ACTION ddAppendFile;

View File

@ -71,6 +71,7 @@
#include <wx_filename.h>
#include <sch_sheet_path.h>
#include <wx/filedlg.h>
#include <wx/treectrl.h>
int SCH_EDITOR_CONTROL::New( const TOOL_EVENT& aEvent )
@ -427,7 +428,8 @@ int SCH_EDITOR_CONTROL::ExportSymbolsToLibrary( const TOOL_EVENT& aEvent )
for( SCH_SYMBOL* symbol : symbolMap[it.first] )
{
m_frame->SaveCopyInUndoList( m_frame->GetScreen(), symbol, UNDO_REDO::CHANGED, append, false);
m_frame->SaveCopyInUndoList( m_frame->GetScreen(), symbol, UNDO_REDO::CHANGED,
append, false );
symbol->SetLibId( id );
append = true;
}
@ -500,7 +502,8 @@ int SCH_EDITOR_CONTROL::ExportSymbolsToLibrary( const TOOL_EVENT& aEvent )
int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
{
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
SIMULATOR_FRAME* simFrame = (SIMULATOR_FRAME*) m_frame->Kiway().Player( FRAME_SIMULATOR, false );
SIMULATOR_FRAME* simFrame = (SIMULATOR_FRAME*) m_frame->Kiway().Player( FRAME_SIMULATOR,
false );
if( !simFrame ) // Defensive coding; shouldn't happen.
return 0;
@ -1089,9 +1092,13 @@ int SCH_EDITOR_CONTROL::UpdateNetHighlighting( const TOOL_EVENT& aEvent )
}
if( highlight )
{
item->SetBrightened();
}
else
{
item->ClearBrightened();
}
redraw |= item->IsBrightened();
@ -2084,6 +2091,13 @@ int SCH_EDITOR_CONTROL::ShowHierarchy( const TOOL_EVENT& aEvent )
}
int SCH_EDITOR_CONTROL::ShowNetNavigator( const TOOL_EVENT& aEvent )
{
getEditFrame<SCH_EDIT_FRAME>()->ToggleNetNavigator();
return 0;
}
int SCH_EDITOR_CONTROL::ToggleHiddenPins( const TOOL_EVENT& aEvent )
{
EESCHEMA_SETTINGS* cfg = m_frame->eeconfig();
@ -2369,6 +2383,7 @@ void SCH_EDITOR_CONTROL::setTransitions()
Go( &SCH_EDITOR_CONTROL::ShowSearch, EE_ACTIONS::showSearch.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowHierarchy, EE_ACTIONS::showHierarchy.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowNetNavigator, EE_ACTIONS::showNetNavigator.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleHiddenPins, EE_ACTIONS::toggleHiddenPins.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleHiddenFields, EE_ACTIONS::toggleHiddenFields.MakeEvent() );
@ -2388,6 +2403,8 @@ void SCH_EDITOR_CONTROL::setTransitions()
Go( &SCH_EDITOR_CONTROL::RepairSchematic, EE_ACTIONS::repairSchematic.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ExportSymbolsToLibrary, EE_ACTIONS::exportSymbolsToLibrary.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ExportSymbolsToLibrary, EE_ACTIONS::exportSymbolsToNewLibrary.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ExportSymbolsToLibrary,
EE_ACTIONS::exportSymbolsToLibrary.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ExportSymbolsToLibrary,
EE_ACTIONS::exportSymbolsToNewLibrary.MakeEvent() );
}

View File

@ -125,6 +125,7 @@ public:
int ShowSearch( const TOOL_EVENT& aEvent );
int ShowHierarchy( const TOOL_EVENT& aEvent );
int ShowNetNavigator( const TOOL_EVENT& aEvent );
int ToggleHiddenPins( const TOOL_EVENT& aEvent );
int ToggleHiddenFields( const TOOL_EVENT& aEvent );

View File

@ -0,0 +1,50 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2023 Rivos
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Wayne Stambaugh <stambaughw@gmail.com>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _AUI_SETTINGS_H_
#define _AUI_SETTINGS_H_
#include <settings/json_settings.h>
class wxAuiPaneInfo;
class wxPoint;
class wxRect;
class wxSize;
extern void to_json( nlohmann::json& aJson, const wxPoint& aPoint );
extern void from_json( const nlohmann::json& aJson, wxPoint& aPoint );
extern bool operator<( const wxPoint& aLhs, const wxPoint& aRhs );
extern void to_json( nlohmann::json& aJson, const wxSize& aPoint );
extern void from_json( const nlohmann::json& aJson, wxSize& aPoint );
extern bool operator<( const wxSize& aLhs, const wxSize& aRhs );
extern void to_json( nlohmann::json& aJson, const wxRect& aRect );
extern void from_json( const nlohmann::json& aJson, wxRect& aRect );
extern bool operator<( const wxRect& aLhs, const wxRect& aRhs );
extern void to_json( nlohmann::json& aJson, const wxAuiPaneInfo& aPaneInfo );
extern void from_json( const nlohmann::json& aJson, wxAuiPaneInfo& aPaneInfo );
extern bool operator<( const wxAuiPaneInfo& aLhs, const wxAuiPaneInfo& aRhs );
extern bool operator==( const wxAuiPaneInfo& aLhs, const wxAuiPaneInfo& aRhs );
#endif // _AUI_SETTINGS_H_