Footprint Chooser dialog: Allow toggle buttons to work simultaneously

This commit is contained in:
aris-kimi 2024-03-23 09:48:15 +00:00 committed by jean-pierre charras
parent 2a6a29830d
commit d7abed2d60
5 changed files with 51 additions and 46 deletions

View File

@ -392,6 +392,7 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
ADD_DEV( wxT( "Eldar Khayrullin" ), CONTRIB_DEV ); ADD_DEV( wxT( "Eldar Khayrullin" ), CONTRIB_DEV );
ADD_DEV( wxT( "Georges Khaznadar" ), CONTRIB_DEV ); ADD_DEV( wxT( "Georges Khaznadar" ), CONTRIB_DEV );
ADD_DEV( wxT( "Gary Kim" ), CONTRIB_DEV ); ADD_DEV( wxT( "Gary Kim" ), CONTRIB_DEV );
ADD_DEV( wxT( "Aristeidis Kimirtzis" ), CONTRIB_DEV );
ADD_DEV( wxT( "Ingo Kletti" ), CONTRIB_DEV ); ADD_DEV( wxT( "Ingo Kletti" ), CONTRIB_DEV );
ADD_DEV( wxT( "Kliment" ), CONTRIB_DEV ); ADD_DEV( wxT( "Kliment" ), CONTRIB_DEV );
ADD_DEV( wxT( "Sylwester Kocjan" ), CONTRIB_DEV ); ADD_DEV( wxT( "Sylwester Kocjan" ), CONTRIB_DEV );

View File

@ -522,7 +522,7 @@ TOOL_ACTION EE_ACTIONS::syncSheetPins( TOOL_ACTION_ARGS()
.Name( "eeschema.InteractiveDrawing.syncSheetPins" ) .Name( "eeschema.InteractiveDrawing.syncSheetPins" )
.Scope( AS_GLOBAL ) .Scope( AS_GLOBAL )
.FriendlyName( _( "Sync Sheet Pins" ) ) .FriendlyName( _( "Sync Sheet Pins" ) )
.Tooltip( _( "Synchronize sheet pins and hierarchical labels" ) ) .Tooltip( _( "Synchronize sheet pins and hierarchical labels" ) )
.Icon( BITMAPS::import_hierarchical_label ) .Icon( BITMAPS::import_hierarchical_label )
.Flags( AF_ACTIVATE ) ); .Flags( AF_ACTIVATE ) );
@ -530,7 +530,7 @@ TOOL_ACTION EE_ACTIONS::syncAllSheetsPins( TOOL_ACTION_ARGS()
.Name( "eeschema.InteractiveDrawing.syncAllSheetsPins" ) .Name( "eeschema.InteractiveDrawing.syncAllSheetsPins" )
.Scope( AS_GLOBAL ) .Scope( AS_GLOBAL )
.FriendlyName( _( "Sync Sheet Pins" ) ) .FriendlyName( _( "Sync Sheet Pins" ) )
.Tooltip( _( "Synchronize sheet pins and hierarchical labels" ) ) .Tooltip( _( "Synchronize sheet pins and hierarchical labels" ) )
.Icon( BITMAPS::import_hierarchical_label ) .Icon( BITMAPS::import_hierarchical_label )
.Flags( AF_ACTIVATE ) ); .Flags( AF_ACTIVATE ) );

View File

@ -131,7 +131,7 @@ void DIALOG_CLEANUP_GRAPHICS::doCleanup( bool aDryRun )
else if( !commit.Empty() ) else if( !commit.Empty() )
{ {
// Clear undo and redo lists to avoid inconsistencies between lists // Clear undo and redo lists to avoid inconsistencies between lists
commit.Push( _( "Graphics Cleanup" ) ); commit.Push( _( "Cleanup Graphics" ) );
m_parentFrame->GetCanvas()->Refresh( true ); m_parentFrame->GetCanvas()->Refresh( true );
} }
} }

View File

@ -88,6 +88,7 @@ FOOTPRINT_CHOOSER_FRAME::FOOTPRINT_CHOOSER_FRAME( KIWAY* aKiway, wxWindow* aPare
SetModal( true ); SetModal( true );
m_showFpMode = true; m_showFpMode = true;
m_show3DMode = false;
m_messagePanel->Hide(); m_messagePanel->Hide();
wxPanel* bottomPanel = new wxPanel( this ); wxPanel* bottomPanel = new wxPanel( this );
@ -549,13 +550,6 @@ void FOOTPRINT_CHOOSER_FRAME::closeFootprintChooser( wxCommandEvent& aEvent )
void FOOTPRINT_CHOOSER_FRAME::onFpChanged( wxCommandEvent& event ) void FOOTPRINT_CHOOSER_FRAME::onFpChanged( wxCommandEvent& event )
{ {
// Ensure a 3D display is activated if a 3D view is needed
if( !displayFootprintPanel() && !m_preview3DCanvas->IsShown() )
{
wxCommandEvent dummy_event;
on3DviewReq( dummy_event );
}
updateViews(); updateViews();
} }
@ -582,7 +576,7 @@ void FOOTPRINT_CHOOSER_FRAME::build3DCanvas()
m_boardAdapter, m_currentCamera, m_boardAdapter, m_currentCamera,
PROJECT_PCB::Get3DCacheManager( &Prj() ) ); PROJECT_PCB::Get3DCacheManager( &Prj() ) );
m_chooserPanel->m_RightPanelSizer->Add( m_preview3DCanvas, 1, wxEXPAND, 5 ); m_chooserPanel->m_RightPanelSizer->Add( m_preview3DCanvas, 1, wxALL | wxEXPAND, 5 );
m_chooserPanel->m_RightPanel->Layout(); m_chooserPanel->m_RightPanel->Layout();
BOARD_DESIGN_SETTINGS& dummy_bds = m_dummyBoard->GetDesignSettings(); BOARD_DESIGN_SETTINGS& dummy_bds = m_dummyBoard->GetDesignSettings();
@ -596,37 +590,53 @@ void FOOTPRINT_CHOOSER_FRAME::build3DCanvas()
void FOOTPRINT_CHOOSER_FRAME::on3DviewReq( wxCommandEvent& event ) void FOOTPRINT_CHOOSER_FRAME::on3DviewReq( wxCommandEvent& event )
{ {
m_showFpMode = false; if( m_show3DMode == true )
m_grButtonFpView->Check( m_showFpMode ); {
m_grButton3DView->Check( !m_showFpMode ); if( m_showFpMode == true )
{
if( m_show3DViewer->IsChecked() ) m_show3DMode = false;
Show3DViewerFrame(); m_grButton3DView->Check( m_show3DMode );
updatePanelsVisibility(); updatePanelsVisibility();
} }
}
else
{
if( m_show3DViewer->IsChecked() )
{
Show3DViewerFrame();
}
else
{
// Close 3D viewer frame, if it is still enabled
EDA_3D_VIEWER_FRAME* viewer3D = Get3DViewerFrame();
if( viewer3D )
viewer3D->Close( true );
}
m_show3DMode = true;
m_grButton3DView->Check( m_show3DMode );
updatePanelsVisibility();
}
}
void FOOTPRINT_CHOOSER_FRAME::onFpViewReq( wxCommandEvent& event ) void FOOTPRINT_CHOOSER_FRAME::onFpViewReq( wxCommandEvent& event )
{ {
// Close 3D viewer frame, if it is still enabled if( m_showFpMode == true )
EDA_3D_VIEWER_FRAME* viewer3D = Get3DViewerFrame(); {
if( m_show3DMode == true )
if( viewer3D ) {
viewer3D->Close( true ); m_showFpMode = false;
m_showFpMode = true;
m_grButtonFpView->Check( m_showFpMode ); m_grButtonFpView->Check( m_showFpMode );
m_grButton3DView->Check( !m_showFpMode );
updatePanelsVisibility(); updatePanelsVisibility();
} }
}
else
bool FOOTPRINT_CHOOSER_FRAME::displayFootprintPanel()
{ {
return Get3DViewerFrame() || m_showFpMode; m_showFpMode = true;
m_grButtonFpView->Check( m_showFpMode );
updatePanelsVisibility();
}
} }
@ -662,8 +672,8 @@ void FOOTPRINT_CHOOSER_FRAME::updateViews()
void FOOTPRINT_CHOOSER_FRAME::updatePanelsVisibility() void FOOTPRINT_CHOOSER_FRAME::updatePanelsVisibility()
{ {
FOOTPRINT_PREVIEW_WIDGET* viewFpPanel = m_chooserPanel->GetViewerPanel(); FOOTPRINT_PREVIEW_WIDGET* viewFpPanel = m_chooserPanel->GetViewerPanel();
viewFpPanel->Show( displayFootprintPanel() ); viewFpPanel->Show( m_showFpMode );
m_preview3DCanvas->Show( !displayFootprintPanel() ); m_preview3DCanvas->Show( m_show3DMode );
updateViews(); updateViews();
} }

View File

@ -75,13 +75,6 @@ private:
bool filterFootprint( LIB_TREE_NODE& aNode ); bool filterFootprint( LIB_TREE_NODE& aNode );
void Show3DViewerFrame(); void Show3DViewerFrame();
/**
* @return true if the footprint must be displayed to the footprint panel
* when returning false, the 3D panel is displayed.
* true is returnned in footprint mode or in 3D mode using a separate 3D viewer frame
*/
bool displayFootprintPanel();
/// @copydoc PCB_BASE_FRAME::Update3DView /// @copydoc PCB_BASE_FRAME::Update3DView
void Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle = nullptr ) override; void Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle = nullptr ) override;
@ -120,7 +113,8 @@ private:
private: private:
PANEL_FOOTPRINT_CHOOSER* m_chooserPanel; PANEL_FOOTPRINT_CHOOSER* m_chooserPanel;
bool m_showFpMode; // True to show the footprint, false for 3D model bool m_showFpMode; // True to show the footprint
bool m_show3DMode; // True to show the 3D model
wxCheckBox* m_filterByPinCount; wxCheckBox* m_filterByPinCount;
wxCheckBox* m_filterByFPFilters; wxCheckBox* m_filterByFPFilters;
wxCheckBox* m_show3DViewer; wxCheckBox* m_show3DViewer;