From d7abed2d6084b4f780e37e012480dc37750abe13 Mon Sep 17 00:00:00 2001 From: aris-kimi Date: Sat, 23 Mar 2024 09:48:15 +0000 Subject: [PATCH] Footprint Chooser dialog: Allow toggle buttons to work simultaneously --- common/dialog_about/AboutDialog_main.cpp | 1 + eeschema/tools/ee_actions.cpp | 4 +- pcbnew/dialogs/dialog_cleanup_graphics.cpp | 2 +- pcbnew/footprint_chooser_frame.cpp | 80 ++++++++++++---------- pcbnew/footprint_chooser_frame.h | 10 +-- 5 files changed, 51 insertions(+), 46 deletions(-) diff --git a/common/dialog_about/AboutDialog_main.cpp b/common/dialog_about/AboutDialog_main.cpp index e7fb966656..be38f57b34 100644 --- a/common/dialog_about/AboutDialog_main.cpp +++ b/common/dialog_about/AboutDialog_main.cpp @@ -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 ); diff --git a/eeschema/tools/ee_actions.cpp b/eeschema/tools/ee_actions.cpp index e9a51b08dc..b1b767b287 100644 --- a/eeschema/tools/ee_actions.cpp +++ b/eeschema/tools/ee_actions.cpp @@ -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 ) ); diff --git a/pcbnew/dialogs/dialog_cleanup_graphics.cpp b/pcbnew/dialogs/dialog_cleanup_graphics.cpp index e23dae1c5f..7274410d75 100644 --- a/pcbnew/dialogs/dialog_cleanup_graphics.cpp +++ b/pcbnew/dialogs/dialog_cleanup_graphics.cpp @@ -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 ); } } diff --git a/pcbnew/footprint_chooser_frame.cpp b/pcbnew/footprint_chooser_frame.cpp index d6d4db1e05..d2be6fb0d9 100644 --- a/pcbnew/footprint_chooser_frame.cpp +++ b/pcbnew/footprint_chooser_frame.cpp @@ -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(); } diff --git a/pcbnew/footprint_chooser_frame.h b/pcbnew/footprint_chooser_frame.h index c188b02e6d..661f79c60e 100644 --- a/pcbnew/footprint_chooser_frame.h +++ b/pcbnew/footprint_chooser_frame.h @@ -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;