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( "Georges Khaznadar" ), 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( "Kliment" ), 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" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Sync Sheet Pins" ) )
.Tooltip( _( "Synchronize sheet pins and hierarchical labels" ) )
.Tooltip( _( "Synchronize sheet pins and hierarchical labels" ) )
.Icon( BITMAPS::import_hierarchical_label )
.Flags( AF_ACTIVATE ) );
@ -530,7 +530,7 @@ TOOL_ACTION EE_ACTIONS::syncAllSheetsPins( TOOL_ACTION_ARGS()
.Name( "eeschema.InteractiveDrawing.syncAllSheetsPins" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Sync Sheet Pins" ) )
.Tooltip( _( "Synchronize sheet pins and hierarchical labels" ) )
.Tooltip( _( "Synchronize sheet pins and hierarchical labels" ) )
.Icon( BITMAPS::import_hierarchical_label )
.Flags( AF_ACTIVATE ) );

View File

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

View File

@ -88,6 +88,7 @@ FOOTPRINT_CHOOSER_FRAME::FOOTPRINT_CHOOSER_FRAME( KIWAY* aKiway, wxWindow* aPare
SetModal( true );
m_showFpMode = true;
m_show3DMode = false;
m_messagePanel->Hide();
wxPanel* bottomPanel = new wxPanel( this );
@ -549,13 +550,6 @@ void FOOTPRINT_CHOOSER_FRAME::closeFootprintChooser( wxCommandEvent& aEvent )
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();
}
@ -582,7 +576,7 @@ void FOOTPRINT_CHOOSER_FRAME::build3DCanvas()
m_boardAdapter, m_currentCamera,
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();
BOARD_DESIGN_SETTINGS& dummy_bds = m_dummyBoard->GetDesignSettings();
@ -596,37 +590,53 @@ void FOOTPRINT_CHOOSER_FRAME::build3DCanvas()
void FOOTPRINT_CHOOSER_FRAME::on3DviewReq( wxCommandEvent& event )
{
m_showFpMode = false;
m_grButtonFpView->Check( m_showFpMode );
m_grButton3DView->Check( !m_showFpMode );
if( m_show3DMode == true )
{
if( m_showFpMode == true )
{
m_show3DMode = false;
m_grButton3DView->Check( m_show3DMode );
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 );
}
if( m_show3DViewer->IsChecked() )
Show3DViewerFrame();
updatePanelsVisibility();
m_show3DMode = true;
m_grButton3DView->Check( m_show3DMode );
updatePanelsVisibility();
}
}
void FOOTPRINT_CHOOSER_FRAME::onFpViewReq( wxCommandEvent& event )
{
// Close 3D viewer frame, if it is still enabled
EDA_3D_VIEWER_FRAME* viewer3D = Get3DViewerFrame();
if( viewer3D )
viewer3D->Close( true );
m_showFpMode = true;
m_grButtonFpView->Check( m_showFpMode );
m_grButton3DView->Check( !m_showFpMode );
updatePanelsVisibility();
}
bool FOOTPRINT_CHOOSER_FRAME::displayFootprintPanel()
{
return Get3DViewerFrame() || m_showFpMode;
if( m_showFpMode == true )
{
if( m_show3DMode == true )
{
m_showFpMode = false;
m_grButtonFpView->Check( m_showFpMode );
updatePanelsVisibility();
}
}
else
{
m_showFpMode = true;
m_grButtonFpView->Check( m_showFpMode );
updatePanelsVisibility();
}
}
@ -662,8 +672,8 @@ void FOOTPRINT_CHOOSER_FRAME::updateViews()
void FOOTPRINT_CHOOSER_FRAME::updatePanelsVisibility()
{
FOOTPRINT_PREVIEW_WIDGET* viewFpPanel = m_chooserPanel->GetViewerPanel();
viewFpPanel->Show( displayFootprintPanel() );
m_preview3DCanvas->Show( !displayFootprintPanel() );
viewFpPanel->Show( m_showFpMode );
m_preview3DCanvas->Show( m_show3DMode );
updateViews();
}

View File

@ -75,13 +75,6 @@ private:
bool filterFootprint( LIB_TREE_NODE& aNode );
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
void Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle = nullptr ) override;
@ -120,7 +113,8 @@ private:
private:
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_filterByFPFilters;
wxCheckBox* m_show3DViewer;