Browse Source
Add net navigator panel to schematic editor.
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.
newinvert
22 changed files with 893 additions and 38 deletions
-
1common/CMakeLists.txt
-
255common/settings/aui_settings.cpp
-
14common/settings/json_settings.cpp
-
1common/settings/parameters.cpp
-
1eeschema/CMakeLists.txt
-
14eeschema/connection_graph.cpp
-
6eeschema/connection_graph.h
-
46eeschema/eeschema_settings.cpp
-
13eeschema/eeschema_settings.h
-
15eeschema/menubar.cpp
-
298eeschema/net_navigator.cpp
-
16eeschema/sch_connection.cpp
-
2eeschema/sch_connection.h
-
105eeschema/sch_edit_frame.cpp
-
34eeschema/sch_edit_frame.h
-
26eeschema/schematic_undo_redo.cpp
-
3eeschema/toolbars_sch_editor.cpp
-
4eeschema/tools/ee_actions.cpp
-
1eeschema/tools/ee_actions.h
-
25eeschema/tools/sch_editor_control.cpp
-
1eeschema/tools/sch_editor_control.h
-
50include/settings/aui_settings.h
@ -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; |
|||
} |
|||
@ -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; |
|||
} |
|||
} |
|||
} |
|||
@ -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_ |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue