diff --git a/common/properties/pg_editors.cpp b/common/properties/pg_editors.cpp index 1401291fee..001324c918 100644 --- a/common/properties/pg_editors.cpp +++ b/common/properties/pg_editors.cpp @@ -35,6 +35,8 @@ PG_UNIT_EDITOR::PG_UNIT_EDITOR( EDA_DRAW_FRAME* aFrame ) : { m_unitBinder = std::make_unique( m_frame ); m_unitBinder->SetUnits( m_frame->GetUserUnits() ); + + m_editorName = BuildEditorName( m_frame ); } @@ -43,6 +45,12 @@ PG_UNIT_EDITOR::~PG_UNIT_EDITOR() } +wxString PG_UNIT_EDITOR::BuildEditorName( EDA_DRAW_FRAME* aFrame ) +{ + return EDITOR_NAME + aFrame->GetName(); +} + + void PG_UNIT_EDITOR::UpdateFrame( EDA_DRAW_FRAME* aFrame ) { m_frame = aFrame; diff --git a/common/properties/pg_properties.cpp b/common/properties/pg_properties.cpp index e6fa7917ae..34e7856bcd 100644 --- a/common/properties/pg_properties.cpp +++ b/common/properties/pg_properties.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -76,7 +77,7 @@ wxAnyValueTypeScopedPtr wxAnyToEDA_ANGLE_VARIANTRegistrationImpl::s_instance( ne static wxAnyToEDA_ANGLE_VARIANTRegistrationImpl s_wxAnyToEDA_ANGLE_VARIANTRegistration( &EDA_ANGLE_VARIANT_DATA::VariantDataFactory ); -wxPGProperty* PGPropertyFactory( const PROPERTY_BASE* aProperty ) +wxPGProperty* PGPropertyFactory( const PROPERTY_BASE* aProperty, EDA_DRAW_FRAME* aFrame ) { wxPGProperty* ret = nullptr; PROPERTY_DISPLAY display = aProperty->Display(); @@ -85,13 +86,13 @@ wxPGProperty* PGPropertyFactory( const PROPERTY_BASE* aProperty ) { case PROPERTY_DISPLAY::PT_SIZE: ret = new PGPROPERTY_SIZE(); - ret->SetEditor( PG_UNIT_EDITOR::EDITOR_NAME ); + ret->SetEditor( PG_UNIT_EDITOR::BuildEditorName( aFrame ) ); break; case PROPERTY_DISPLAY::PT_COORD: ret = new PGPROPERTY_COORD(); static_cast( ret )->SetCoordType( aProperty->CoordType() ); - ret->SetEditor( PG_UNIT_EDITOR::EDITOR_NAME ); + ret->SetEditor( PG_UNIT_EDITOR::BuildEditorName( aFrame ) ); break; case PROPERTY_DISPLAY::PT_DECIDEGREE: @@ -103,7 +104,7 @@ wxPGProperty* PGPropertyFactory( const PROPERTY_BASE* aProperty ) prop->SetScale( 10.0 ); ret = prop; - ret->SetEditor( PG_UNIT_EDITOR::EDITOR_NAME ); + ret->SetEditor( PG_UNIT_EDITOR::BuildEditorName( aFrame ) ); break; } diff --git a/common/properties/property_mgr.cpp b/common/properties/property_mgr.cpp index f81aa27e69..37aca025d2 100644 --- a/common/properties/property_mgr.cpp +++ b/common/properties/property_mgr.cpp @@ -348,8 +348,9 @@ void PROPERTY_MANAGER::CLASS_DESC::collectPropsRecur( PROPERTY_LIST& aResult, aResult.push_back( property ); } - for( const std::reference_wrapper& base : m_bases ) - base.get().collectPropsRecur( aResult, aReplaced, aDisplayOrder, aMasked ); + // Iterate backwards so that replaced properties appear before base properties + for( auto it = m_bases.rbegin(); it != m_bases.rend(); ++it ) + it->get().collectPropsRecur( aResult, aReplaced, aDisplayOrder, aMasked ); } diff --git a/common/widgets/properties_panel.cpp b/common/widgets/properties_panel.cpp index 84d7173fcc..32b10f08c3 100644 --- a/common/widgets/properties_panel.cpp +++ b/common/widgets/properties_panel.cpp @@ -62,8 +62,11 @@ PROPERTIES_PANEL::PROPERTIES_PANEL( wxWindow* aParent, EDA_BASE_FRAME* aFrame ) wxPGEditor_DatePickerCtrl = nullptr; } - delete wxPGGlobalVars->m_defaultRenderer; - wxPGGlobalVars->m_defaultRenderer = new PG_CELL_RENDERER(); + if( !dynamic_cast( wxPGGlobalVars->m_defaultRenderer ) ) + { + delete wxPGGlobalVars->m_defaultRenderer; + wxPGGlobalVars->m_defaultRenderer = new PG_CELL_RENDERER(); + } m_caption = new wxStaticText( this, wxID_ANY, _( "No objects selected" ) ); mainSizer->Add( m_caption, 0, wxALL | wxEXPAND, 5 ); @@ -201,6 +204,7 @@ void PROPERTIES_PANEL::rebuildProperties( const SELECTION& aSelection ) } EDA_ITEM* firstItem = aSelection.Front(); + bool isFootprintEditor = m_frame->IsType( FRAME_FOOTPRINT_EDITOR ); // Find a set of properties that is common to all selected items for( PROPERTY_BASE* property : commonProps ) @@ -208,6 +212,9 @@ void PROPERTIES_PANEL::rebuildProperties( const SELECTION& aSelection ) if( property->IsInternal() ) continue; + if( isFootprintEditor && property->IsHiddenFromLibraryEditors() ) + continue; + if( propMgr.IsAvailableFor( TYPE_HASH( *firstItem ), property, firstItem ) ) availableProps.insert( property ); } diff --git a/include/footprint_editor_settings.h b/include/footprint_editor_settings.h index 43d133e7be..28b60a9398 100644 --- a/include/footprint_editor_settings.h +++ b/include/footprint_editor_settings.h @@ -35,6 +35,9 @@ public: int appearance_panel_tab; int right_panel_width; bool show_layer_manager; + bool show_properties; + int properties_panel_width; + float properties_splitter_proportion; }; struct USER_GRID diff --git a/include/properties/pg_editors.h b/include/properties/pg_editors.h index f8c35ca3bd..9770186937 100644 --- a/include/properties/pg_editors.h +++ b/include/properties/pg_editors.h @@ -37,7 +37,7 @@ public: virtual ~PG_UNIT_EDITOR(); - wxString GetName() const override { return EDITOR_NAME; } + wxString GetName() const override { return m_editorName; } wxPGWindowList CreateControls( wxPropertyGrid* aPropGrid, wxPGProperty* aProperty, const wxPoint& aPos, const wxSize& aSize ) const override; @@ -58,10 +58,14 @@ public: */ void UpdateFrame( EDA_DRAW_FRAME* aFrame ); + static wxString BuildEditorName( EDA_DRAW_FRAME* aFrame ); + protected: EDA_DRAW_FRAME* m_frame; std::unique_ptr m_unitBinder; + + wxString m_editorName; }; diff --git a/include/properties/pg_properties.h b/include/properties/pg_properties.h index 59caf55c6c..c8119bc19d 100644 --- a/include/properties/pg_properties.h +++ b/include/properties/pg_properties.h @@ -29,8 +29,9 @@ class PROPERTY_BASE; class REGEX_VALIDATOR; +class EDA_DRAW_FRAME; -wxPGProperty* PGPropertyFactory( const PROPERTY_BASE* aProperty ); +wxPGProperty* PGPropertyFactory( const PROPERTY_BASE* aProperty, EDA_DRAW_FRAME* aFrame ); ///> Customized abstract wxPGProperty class to handle coordinate/size units class PGPROPERTY_DISTANCE diff --git a/include/properties/property.h b/include/properties/property.h index e668f8da3d..a6129271b4 100644 --- a/include/properties/property.h +++ b/include/properties/property.h @@ -187,6 +187,7 @@ PROPERTY_BASE( const wxString& aName, PROPERTY_DISPLAY aDisplay = PT_DEFAULT, m_coordType( aCoordType ), m_isInternal( false ), m_isDeprecated( false ), + m_hideFromLibraryEditors( false ), m_availFunc( [](INSPECTABLE*)->bool { return true; } ), m_writeableFunc( [](INSPECTABLE*)->bool { return true; } ), m_validator( NullValidator ) @@ -293,6 +294,13 @@ PROPERTY_BASE( const wxString& aName, PROPERTY_DISPLAY aDisplay = PT_DEFAULT, return *this; } + bool IsHiddenFromLibraryEditors() const { return m_hideFromLibraryEditors; } + PROPERTY_BASE& SetIsHiddenFromLibraryEditors( bool aIsHidden = true ) + { + m_hideFromLibraryEditors = aIsHidden; + return *this; + } + wxString Group() const { return m_group; } PROPERTY_BASE& SetGroup( const wxString& aGroup ) { m_group = aGroup; return *this; } @@ -375,6 +383,9 @@ private: /// Deprecated properties are hidden from the GUI and rules editor autocomplete bool m_isDeprecated; + /// This property should only be shown in the design editor, not the library editor + bool m_hideFromLibraryEditors; + /// Optional group identifier wxString m_group; diff --git a/pcbnew/board_commit.cpp b/pcbnew/board_commit.cpp index b0c0ee0cd1..19955ff1f1 100644 --- a/pcbnew/board_commit.cpp +++ b/pcbnew/board_commit.cpp @@ -263,6 +263,17 @@ void BOARD_COMMIT::Push( const wxString& aMessage, int aCommitFlags ) if( boardItem->IsSelected() ) selectedModified = true; + // If we're the footprint editor, the boardItem will always be the containing footprint + if( m_isFootprintEditor && boardItem->Type() == PCB_FOOTPRINT_T ) + { + static_cast( boardItem )->RunOnChildren( + [&selectedModified]( BOARD_ITEM* aItem ) + { + if( aItem->HasFlag( IS_MODIFIED_CHILD ) ) + selectedModified = true; + } ); + } + switch( changeType ) { case CHT_ADD: diff --git a/pcbnew/board_connected_item.cpp b/pcbnew/board_connected_item.cpp index 8369397169..062c7f2852 100644 --- a/pcbnew/board_connected_item.cpp +++ b/pcbnew/board_connected_item.cpp @@ -169,28 +169,32 @@ static struct BOARD_CONNECTED_ITEM_DESC layer->SetChoices( layerEnum.Choices() ); propMgr.ReplaceProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Layer" ), layer ); - auto netCode = new PROPERTY_ENUM( _HKI( "Net" ), - &BOARD_CONNECTED_ITEM::SetNetCode, &BOARD_CONNECTED_ITEM::GetNetCode ); - netCode->SetIsDeprecated(); // Not really, but hide from rule editor suggestions - propMgr.AddProperty( netCode ); + // Not really deprecated, but hidden from rule editor suggestions + propMgr.AddProperty( new PROPERTY_ENUM( _HKI( "Net" ), + &BOARD_CONNECTED_ITEM::SetNetCode, + &BOARD_CONNECTED_ITEM::GetNetCode ) ) + .SetIsDeprecated() + .SetIsHiddenFromLibraryEditors(); - auto netClass = new PROPERTY( _HKI( "Net Class" ), - NO_SETTER( BOARD_CONNECTED_ITEM, wxString ), - &BOARD_CONNECTED_ITEM::GetNetClassName ); - netClass->SetIsDeprecated(); // Not really, but hide from rule editor suggestions - propMgr.AddProperty( netClass ); + // Not really deprecated, but hidden from rule editor suggestions + propMgr.AddProperty( new PROPERTY( _HKI( "Net Class" ), + NO_SETTER( BOARD_CONNECTED_ITEM, wxString ), + &BOARD_CONNECTED_ITEM::GetNetClassName ) ) + .SetIsDeprecated() + .SetIsHiddenFromLibraryEditors(); // Compatibility alias for DRC engine - auto oldNetClass = new PROPERTY( _HKI( "NetClass" ), - NO_SETTER( BOARD_CONNECTED_ITEM, wxString ), - &BOARD_CONNECTED_ITEM::GetNetClassName ); - oldNetClass->SetIsInternal(); - propMgr.AddProperty( oldNetClass ); + propMgr.AddProperty( new PROPERTY( _HKI( "NetClass" ), + NO_SETTER( BOARD_CONNECTED_ITEM, wxString ), + &BOARD_CONNECTED_ITEM::GetNetClassName ) ) + .SetIsInternal() + .SetIsHiddenFromLibraryEditors(); // Used only in DRC engine - auto oldNetName = new PROPERTY( _HKI( "NetName" ), - NO_SETTER( BOARD_CONNECTED_ITEM, wxString ), &BOARD_CONNECTED_ITEM::GetNetname ); - oldNetName->SetIsInternal(); - propMgr.AddProperty( oldNetName ); + propMgr.AddProperty( new PROPERTY( _HKI( "NetName" ), + NO_SETTER( BOARD_CONNECTED_ITEM, wxString ), + &BOARD_CONNECTED_ITEM::GetNetname ) ) + .SetIsInternal() + .SetIsHiddenFromLibraryEditors(); } } _BOARD_CONNECTED_ITEM_DESC; diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index da749f85e4..07a4ee4f64 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -31,6 +31,7 @@ #include "tools/placement_tool.h" #include "tools/pcb_point_editor.h" #include "tools/pcb_selection_tool.h" +#include "tools/properties_tool.h" #include #include <3d_viewer/eda_3d_viewer_frame.h> #include @@ -68,6 +69,7 @@ #include #include #include +#include #include #include #include @@ -176,12 +178,16 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_selectionFilterPanel = new PANEL_SELECTION_FILTER( this ); m_appearancePanel = new APPEARANCE_CONTROLS( this, GetCanvas(), true ); + m_propertiesPanel = new PCB_PROPERTIES_PANEL( this, this ); // LoadSettings() *after* creating m_LayersManager, because LoadSettings() initialize // parameters in m_LayersManager // NOTE: KifaceSettings() will return PCBNEW_SETTINGS if we started from pcbnew LoadSettings( GetSettings() ); + float proportion = GetFootprintEditorSettings()->m_AuiPanels.properties_splitter_proportion; + m_propertiesPanel->SetSplitterProportion( proportion ); + // Must be set after calling LoadSettings() to be sure these parameters are not dependent // on what is read in stored settings. Enable one internal layer, because footprints // support keepout areas that can be on internal layers only (therefore on the first internal @@ -214,9 +220,12 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : // Columns; layers 1 - 3 m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "Footprints" ) - .Left().Layer( 3 ) + .Left().Layer( 4 ) .Caption( _( "Libraries" ) ) .MinSize( 250, -1 ).BestSize( 250, -1 ) ); + m_auimgr.AddPane( m_propertiesPanel, EDA_PANE().Name( wxS( "PropertiesManager" ) ) + .Left().Layer( 3 ).Caption( _( "Properties" ) ) + .PaneBorder( false ).MinSize( 240, -1 ).BestSize( 300, -1 ) ); m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ) .Left().Layer( 2 ) ); @@ -237,6 +246,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools ); m_auimgr.GetPane( "SelectionFilter" ).Show( m_show_layer_manager_tools ); + m_auimgr.GetPane( "PropertiesManager" ).Show( m_show_properties ); // The selection filter doesn't need to grow in the vertical direction when docked m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0; @@ -605,6 +615,7 @@ void FOOTPRINT_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg ) m_displayOptions = cfg->m_Display; m_show_layer_manager_tools = cfg->m_AuiPanels.show_layer_manager; + m_show_properties = cfg->m_AuiPanels.show_properties; GetToolManager()->GetTool()->GetFilter() = cfg->m_SelectionFilter; m_selectionFilterPanel->SetCheckboxesFromFilter( cfg->m_SelectionFilter ); @@ -630,6 +641,12 @@ void FOOTPRINT_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) cfg->m_AuiPanels.show_layer_manager = m_show_layer_manager_tools; cfg->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x; cfg->m_AuiPanels.appearance_panel_tab = m_appearancePanel->GetTabIndex(); + + cfg->m_AuiPanels.show_properties = m_show_properties; + cfg->m_AuiPanels.properties_panel_width = m_propertiesPanel->GetSize().x; + + cfg->m_AuiPanels.properties_splitter_proportion = + m_propertiesPanel->SplitterProportion(); } @@ -1071,6 +1088,7 @@ void FOOTPRINT_EDIT_FRAME::setupTools() m_toolManager->RegisterTool( new GROUP_TOOL ); m_toolManager->RegisterTool( new CONVERT_TOOL ); m_toolManager->RegisterTool( new SCRIPTING_TOOL ); + m_toolManager->RegisterTool( new PROPERTIES_TOOL ); for( TOOL_BASE* tool : m_toolManager->Tools() ) { @@ -1177,6 +1195,12 @@ void FOOTPRINT_EDIT_FRAME::setupUIConditions() return m_auimgr.GetPane( "LayersManager" ).IsShown(); }; + auto propertiesCond = + [this] ( const SELECTION& ) + { + return m_auimgr.GetPane( "PropertiesManager" ).IsShown(); + }; + mgr->SetConditions( PCB_ACTIONS::toggleHV45Mode, CHECK( constrainedDrawingModeCond ) ); mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastCond ) ); mgr->SetConditions( PCB_ACTIONS::flipBoard, CHECK( boardFlippedCond ) ); @@ -1184,6 +1208,7 @@ void FOOTPRINT_EDIT_FRAME::setupUIConditions() mgr->SetConditions( PCB_ACTIONS::showFootprintTree, CHECK( footprintTreeCond ) ); mgr->SetConditions( PCB_ACTIONS::showLayersManager, CHECK( layerManagerCond ) ); + mgr->SetConditions( PCB_ACTIONS::showProperties, CHECK( propertiesCond ) ); mgr->SetConditions( ACTIONS::print, ENABLE( haveFootprintCond ) ); mgr->SetConditions( PCB_ACTIONS::exportFootprint, ENABLE( haveFootprintCond ) ); diff --git a/pcbnew/footprint_editor_settings.cpp b/pcbnew/footprint_editor_settings.cpp index 9b000f0c53..c7d15a70d4 100644 --- a/pcbnew/footprint_editor_settings.cpp +++ b/pcbnew/footprint_editor_settings.cpp @@ -71,6 +71,15 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() : m_params.emplace_back( new PARAM( "aui.appearance_panel_tab", &m_AuiPanels.appearance_panel_tab, 0, 0, 2 ) ); + m_params.emplace_back( new PARAM( "aui.properties_panel_width", + &m_AuiPanels.properties_panel_width, -1 ) ); + + m_params.emplace_back( new PARAM( "aui.properties_splitter_proportion", + &m_AuiPanels.properties_splitter_proportion, 0.5f ) ); + + m_params.emplace_back( new PARAM( "aui.show_properties", + &m_AuiPanels.show_properties, false ) ); + m_params.emplace_back( new PARAM( "system.last_import_export_path", &m_LastImportExportPath, "" ) ); diff --git a/pcbnew/fp_shape.cpp b/pcbnew/fp_shape.cpp index d7614055e2..015076326f 100644 --- a/pcbnew/fp_shape.cpp +++ b/pcbnew/fp_shape.cpp @@ -428,6 +428,7 @@ static struct FP_SHAPE_DESC propMgr.InheritsAfter( TYPE_HASH( FP_SHAPE ), TYPE_HASH( PCB_SHAPE ) ); propMgr.AddProperty( new PROPERTY( _HKI( "Parent" ), - NO_SETTER( FP_SHAPE, wxString ), &FP_SHAPE::GetParentAsString ) ); + NO_SETTER( FP_SHAPE, wxString ), &FP_SHAPE::GetParentAsString ) ) + .SetIsHiddenFromLibraryEditors(); } } _FP_SHAPE_DESC; diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index 52c16007fc..f41bbb6792 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -1790,9 +1790,11 @@ static struct PAD_DESC propMgr.AddProperty( padNumber, groupPad ); propMgr.AddProperty( new PROPERTY( _HKI( "Pin Name" ), - NO_SETTER( PAD, wxString ), &PAD::GetPinFunction ), groupPad ); + NO_SETTER( PAD, wxString ), &PAD::GetPinFunction ), groupPad ) + .SetIsHiddenFromLibraryEditors(); propMgr.AddProperty( new PROPERTY( _HKI( "Pin Type" ), - NO_SETTER( PAD, wxString ), &PAD::GetPinType ), groupPad ); + NO_SETTER( PAD, wxString ), &PAD::GetPinType ), groupPad ) + .SetIsHiddenFromLibraryEditors(); propMgr.AddProperty( new PROPERTY( _HKI( "Size X" ), &PAD::SetSizeX, &PAD::GetSizeX, diff --git a/pcbnew/pcb_base_edit_frame.cpp b/pcbnew/pcb_base_edit_frame.cpp index e4e4348aef..4fc78938a9 100644 --- a/pcbnew/pcb_base_edit_frame.cpp +++ b/pcbnew/pcb_base_edit_frame.cpp @@ -42,6 +42,7 @@ #include #include #include +#include PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, @@ -53,7 +54,8 @@ PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, m_selectionFilterPanel( nullptr ), m_appearancePanel( nullptr ), m_propertiesPanel( nullptr ), - m_tabbedPanel( nullptr ) + m_tabbedPanel( nullptr ), + m_show_properties( false ) { m_darkMode = KIPLATFORM::UI::IsDarkTheme(); @@ -300,3 +302,27 @@ void PCB_BASE_EDIT_FRAME::UpdateProperties() m_propertiesPanel->UpdateData(); } + +void PCB_BASE_EDIT_FRAME::ToggleProperties() +{ + if( !m_propertiesPanel ) + return; + + PCBNEW_SETTINGS* settings = GetPcbNewSettings(); + + m_show_properties = !m_show_properties; + + wxAuiPaneInfo& propertiesPaneInfo = m_auimgr.GetPane( "PropertiesManager" ); + propertiesPaneInfo.Show( m_show_properties ); + + if( m_show_properties ) + { + SetAuiPaneSize( m_auimgr, propertiesPaneInfo, + settings->m_AuiPanels.properties_panel_width, -1 ); + } + else + { + settings->m_AuiPanels.properties_panel_width = m_propertiesPanel->GetSize().x; + m_auimgr.Update(); + } +} diff --git a/pcbnew/pcb_base_edit_frame.h b/pcbnew/pcb_base_edit_frame.h index 563bb66fae..92b63cd80c 100644 --- a/pcbnew/pcb_base_edit_frame.h +++ b/pcbnew/pcb_base_edit_frame.h @@ -221,6 +221,8 @@ public: void UpdateProperties(); + void ToggleProperties(); + protected: /** * Prompts a user to select global or project library tables @@ -255,6 +257,7 @@ protected: wxAuiNotebook* m_tabbedPanel; /// Panel with Layers and Object Inspector tabs bool m_darkMode; + bool m_show_properties; }; #endif diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index e8a1892e59..e83f04e22f 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -304,7 +304,6 @@ public: void PrepareLayerIndicator( bool aForceRebuild = false ); void ToggleLayersManager(); - void ToggleProperties(); void ToggleSearch(); /** @@ -814,7 +813,6 @@ public: wxChoice* m_SelViaSizeBox; // a choice box to display and select current via diameter bool m_show_layer_manager_tools; - bool m_show_properties; bool m_show_search; bool m_ZoneFillsDirty; // Board has been modified since last zone fill. diff --git a/pcbnew/toolbars_footprint_editor.cpp b/pcbnew/toolbars_footprint_editor.cpp index a098435be2..a49bd4ff2b 100644 --- a/pcbnew/toolbars_footprint_editor.cpp +++ b/pcbnew/toolbars_footprint_editor.cpp @@ -249,6 +249,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar() m_optionsToolBar->AddScaledSeparator( this ); m_optionsToolBar->Add( PCB_ACTIONS::showFootprintTree, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( PCB_ACTIONS::showLayersManager, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::showProperties, ACTION_TOOLBAR::TOGGLE ); PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool(); std::unique_ptr gridMenu = std::make_unique( false, selTool ); diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp index d7daaabf37..7435727dc1 100644 --- a/pcbnew/toolbars_pcb_editor.cpp +++ b/pcbnew/toolbars_pcb_editor.cpp @@ -797,31 +797,6 @@ void PCB_EDIT_FRAME::ToggleLayersManager() } -void PCB_EDIT_FRAME::ToggleProperties() -{ - if( !m_propertiesPanel ) - return; - - PCBNEW_SETTINGS* settings = GetPcbNewSettings(); - - m_show_properties = !m_show_properties; - - wxAuiPaneInfo& propertiesPaneInfo = m_auimgr.GetPane( "PropertiesManager" ); - propertiesPaneInfo.Show( m_show_properties ); - - if( m_show_properties ) - { - SetAuiPaneSize( m_auimgr, propertiesPaneInfo, - settings->m_AuiPanels.properties_panel_width, -1 ); - } - else - { - settings->m_AuiPanels.properties_panel_width = m_propertiesPanel->GetSize().x; - m_auimgr.Update(); - } -} - - void PCB_EDIT_FRAME::ToggleSearch() { PCBNEW_SETTINGS* settings = GetPcbNewSettings(); diff --git a/pcbnew/tools/footprint_editor_control.cpp b/pcbnew/tools/footprint_editor_control.cpp index f26a252fa5..83f3a38837 100644 --- a/pcbnew/tools/footprint_editor_control.cpp +++ b/pcbnew/tools/footprint_editor_control.cpp @@ -591,6 +591,13 @@ int FOOTPRINT_EDITOR_CONTROL::ToggleLayersManager( const TOOL_EVENT& aEvent ) } +int FOOTPRINT_EDITOR_CONTROL::ToggleProperties( const TOOL_EVENT& aEvent ) +{ + m_frame->ToggleProperties(); + return 0; +} + + int FOOTPRINT_EDITOR_CONTROL::Properties( const TOOL_EVENT& aEvent ) { FOOTPRINT* footprint = m_frame->GetBoard()->GetFirstFootprint(); @@ -768,4 +775,5 @@ void FOOTPRINT_EDITOR_CONTROL::setTransitions() Go( &FOOTPRINT_EDITOR_CONTROL::Properties, PCB_ACTIONS::footprintProperties.MakeEvent() ); Go( &FOOTPRINT_EDITOR_CONTROL::DefaultPadProperties, PCB_ACTIONS::defaultPadProperties.MakeEvent() ); Go( &FOOTPRINT_EDITOR_CONTROL::ToggleLayersManager, PCB_ACTIONS::showLayersManager.MakeEvent() ); + Go( &FOOTPRINT_EDITOR_CONTROL::ToggleProperties, PCB_ACTIONS::showProperties.MakeEvent() ); } diff --git a/pcbnew/tools/footprint_editor_control.h b/pcbnew/tools/footprint_editor_control.h index 05fb7a919b..bb0df4f8d0 100644 --- a/pcbnew/tools/footprint_editor_control.h +++ b/pcbnew/tools/footprint_editor_control.h @@ -68,6 +68,7 @@ public: int UnpinLibrary( const TOOL_EVENT& aEvent ); int ToggleFootprintTree( const TOOL_EVENT& aEvent ); int ToggleLayersManager( const TOOL_EVENT& aEvent ); + int ToggleProperties( const TOOL_EVENT& aEvent ); int Properties( const TOOL_EVENT& aEvent ); int EditTextAndGraphics( const TOOL_EVENT& aEvent ); diff --git a/pcbnew/tools/properties_tool.cpp b/pcbnew/tools/properties_tool.cpp index bad1677183..5d1c6131d9 100644 --- a/pcbnew/tools/properties_tool.cpp +++ b/pcbnew/tools/properties_tool.cpp @@ -25,7 +25,7 @@ int PROPERTIES_TOOL::UpdateProperties( const TOOL_EVENT& aEvent ) { - PCB_EDIT_FRAME* editFrame = getEditFrame(); + PCB_BASE_EDIT_FRAME* editFrame = getEditFrame(); if( editFrame ) editFrame->UpdateProperties(); diff --git a/pcbnew/widgets/pcb_properties_panel.cpp b/pcbnew/widgets/pcb_properties_panel.cpp index c9c11a0630..c0af5ef21f 100644 --- a/pcbnew/widgets/pcb_properties_panel.cpp +++ b/pcbnew/widgets/pcb_properties_panel.cpp @@ -21,7 +21,7 @@ #include "pcb_properties_panel.h" -#include +#include #include #include #include @@ -36,7 +36,7 @@ #include -PCB_PROPERTIES_PANEL::PCB_PROPERTIES_PANEL( wxWindow* aParent, PCB_EDIT_FRAME* aFrame ) : +PCB_PROPERTIES_PANEL::PCB_PROPERTIES_PANEL( wxWindow* aParent, PCB_BASE_EDIT_FRAME* aFrame ) : PROPERTIES_PANEL( aParent, aFrame ), m_frame( aFrame ), m_propMgr( PROPERTY_MANAGER::Instance() ) @@ -46,7 +46,9 @@ PCB_PROPERTIES_PANEL::PCB_PROPERTIES_PANEL( wxWindow* aParent, PCB_EDIT_FRAME* a wxASSERT( wxPGGlobalVars ); - auto it = wxPGGlobalVars->m_mapEditorClasses.find( PG_UNIT_EDITOR::EDITOR_NAME ); + wxString editorKey = PG_UNIT_EDITOR::BuildEditorName( m_frame ); + + auto it = wxPGGlobalVars->m_mapEditorClasses.find( editorKey ); if( it != wxPGGlobalVars->m_mapEditorClasses.end() ) { @@ -144,7 +146,7 @@ wxPGProperty* PCB_PROPERTIES_PANEL::createPGProperty( const PROPERTY_BASE* aProp return ret; } - return PGPropertyFactory( aProperty ); + return PGPropertyFactory( aProperty, m_frame ); } diff --git a/pcbnew/widgets/pcb_properties_panel.h b/pcbnew/widgets/pcb_properties_panel.h index 69c3ad97ad..c467b1a5a8 100644 --- a/pcbnew/widgets/pcb_properties_panel.h +++ b/pcbnew/widgets/pcb_properties_panel.h @@ -25,7 +25,7 @@ class SELECTION; class BOARD; -class PCB_EDIT_FRAME; +class PCB_BASE_EDIT_FRAME; class PROPERTY_MANAGER; class PG_UNIT_EDITOR; class PG_CHECKBOX_EDITOR; @@ -33,7 +33,7 @@ class PG_CHECKBOX_EDITOR; class PCB_PROPERTIES_PANEL : public PROPERTIES_PANEL { public: - PCB_PROPERTIES_PANEL( wxWindow* aParent, PCB_EDIT_FRAME* aFrame ); + PCB_PROPERTIES_PANEL( wxWindow* aParent, PCB_BASE_EDIT_FRAME* aFrame ); virtual ~PCB_PROPERTIES_PANEL(); @@ -52,7 +52,7 @@ protected: ///> Regenerates caches storing layer and net names void updateLists( const BOARD* aBoard ); - PCB_EDIT_FRAME* m_frame; + PCB_BASE_EDIT_FRAME* m_frame; PROPERTY_MANAGER& m_propMgr; PG_UNIT_EDITOR* m_unitEditorInstance; PG_CHECKBOX_EDITOR* m_checkboxEditorInstance;