diff --git a/bitmaps_png/CMakeLists.txt b/bitmaps_png/CMakeLists.txt index a4f6a6167a..fa57403fdc 100644 --- a/bitmaps_png/CMakeLists.txt +++ b/bitmaps_png/CMakeLists.txt @@ -505,6 +505,7 @@ set( BMAPS_MID rotate_neg_z rotate_pos_z save_as + save_fp_to_board save_gerber save_library save_project diff --git a/bitmaps_png/cpp_26/save_fp_to_board.cpp b/bitmaps_png/cpp_26/save_fp_to_board.cpp new file mode 100644 index 0000000000..9b89a8957b --- /dev/null +++ b/bitmaps_png/cpp_26/save_fp_to_board.cpp @@ -0,0 +1,79 @@ + +/* Do not modify this file, it was automatically generated by the + * PNG2cpp CMake script, using a *.png file as input. + */ + +#include + +static const unsigned char png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa9, 0x4a, 0x4c, + 0xce, 0x00, 0x00, 0x03, 0xd9, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xed, 0x94, 0x6d, 0x4c, 0x53, + 0x57, 0x18, 0xc7, 0xcb, 0x2e, 0xa5, 0xef, 0xb4, 0x34, 0x60, 0x06, 0xf2, 0x12, 0x07, 0x73, 0x61, + 0x44, 0x1d, 0xa2, 0x08, 0x42, 0x9d, 0xa6, 0xd9, 0xe4, 0x45, 0x47, 0xd8, 0xc2, 0x3e, 0x98, 0x09, + 0x08, 0xed, 0xbd, 0x58, 0x2a, 0x58, 0x98, 0x34, 0xe0, 0x60, 0x30, 0xf0, 0x85, 0x36, 0x22, 0x63, + 0x20, 0x64, 0x2e, 0x7b, 0x83, 0x69, 0x9c, 0x08, 0x6a, 0xe4, 0xa5, 0x15, 0x4b, 0xd5, 0xe9, 0xe6, + 0x94, 0x31, 0xd3, 0xe2, 0x34, 0x03, 0x09, 0x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0x61, 0xed, 0xb7, 0x82, 0xe6, 0xff, 0x93, 0x1c, 0x4b, 0x72, 0xe1, 0xa2, + 0xa2, 0x40, 0xa3, 0x1c, 0x86, 0x76, 0x0e, 0x76, 0xbb, 0x9d, 0xef, 0x38, 0xad, 0x41, 0x8e, 0x5d, + 0x37, 0x03, 0x51, 0xec, 0x0e, 0x42, 0x91, 0x2b, 0x10, 0xf9, 0x4e, 0x35, 0xd4, 0x61, 0x12, 0x14, + 0xec, 0x64, 0x61, 0x73, 0xdb, 0xc0, 0xb0, 0xcc, 0xa3, 0x8b, 0x64, 0x3b, 0x45, 0xf8, 0xed, 0xde, + 0x10, 0x1a, 0xdf, 0x6f, 0x84, 0x48, 0x2a, 0xc4, 0xb6, 0x53, 0x2a, 0x98, 0x6e, 0x2f, 0x21, 0xc2, + 0x20, 0x44, 0xc4, 0x4b, 0x91, 0x90, 0x14, 0x8f, 0x91, 0x7b, 0x23, 0x50, 0x15, 0xa9, 0xe6, 0x95, + 0xfc, 0x2b, 0xd1, 0xb8, 0xc3, 0x8a, 0x1b, 0x3f, 0x5e, 0x06, 0x57, 0xc0, 0x22, 0x20, 0x44, 0x02, + 0x1d, 0x79, 0x93, 0x95, 0x6f, 0xca, 0xc8, 0xaf, 0x27, 0x18, 0x93, 0x93, 0xf7, 0x71, 0x75, 0xc0, + 0x8a, 0x8c, 0xba, 0x58, 0x18, 0x0f, 0x6b, 0x31, 0xd4, 0xf3, 0x2e, 0x9f, 0xfb, 0x20, 0x77, 0x07, + 0x2c, 0x1a, 0xef, 0x44, 0x64, 0x9e, 0xd7, 0xa0, 0x85, 0xfb, 0x27, 0x37, 0x34, 0x1b, 0x93, 0xa0, + 0x0c, 0x11, 0x42, 0x22, 0x13, 0x63, 0x78, 0x78, 0x18, 0x5b, 0x9b, 0xd2, 0x61, 0x6e, 0x4e, 0x43, + 0xc7, 0x31, 0x3d, 0xcf, 0x91, 0x4f, 0xb7, 0x23, 0xa1, 0x3a, 0x06, 0x29, 0x96,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 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, + 0x60, 0x82, +}; + +const BITMAP_OPAQUE save_fp_to_board_xpm[1] = {{ png, sizeof( png ), "save_fp_to_board_xpm" }}; + +//EOF diff --git a/bitmaps_png/sources/save_fp_to_board.svg b/bitmaps_png/sources/save_fp_to_board.svg new file mode 100644 index 0000000000..d34622aceb --- /dev/null +++ b/bitmaps_png/sources/save_fp_to_board.svg @@ -0,0 +1,535 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bitmaps_png/sources/tune_diff_pair_length_legend.svg b/bitmaps_png/sources/tune_diff_pair_length_legend.svg new file mode 100644 index 0000000000..6d70d6ef74 --- /dev/null +++ b/bitmaps_png/sources/tune_diff_pair_length_legend.svg @@ -0,0 +1,422 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + Amax + Amin + S + r + + + + + + + + + + diff --git a/include/bitmaps.h b/include/bitmaps.h index 2ed1e76925..a4238ac2a0 100644 --- a/include/bitmaps.h +++ b/include/bitmaps.h @@ -467,6 +467,7 @@ EXTERN_BITMAP( rotate_neg_z_xpm ) EXTERN_BITMAP( rotate_pos_z_xpm ) EXTERN_BITMAP( save_as_xpm ) EXTERN_BITMAP( save_gerber_xpm ) +EXTERN_BITMAP( save_fp_to_board_xpm ) EXTERN_BITMAP( save_library_xpm ) EXTERN_BITMAP( save_project_xpm ) EXTERN_BITMAP( save_setup_xpm ) diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index 3dffd81ff1..91c28926df 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -182,6 +182,8 @@ void FOOTPRINT_EDIT_FRAME::LoadModuleFromBoard( wxCommandEvent& event ) void FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary( LIB_ID aFPID) { + bool is_last_fp_from_brd = IsCurrentFPFromBoard(); + MODULE* module = LoadFootprint( aFPID ); if( !module ) @@ -225,6 +227,10 @@ void FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary( LIB_ID aFPID) updateView(); m_canvas->Refresh(); + // Update the bitmap of the ID_MODEDIT_SAVE tool if needed. + if( is_last_fp_from_brd ) + ReCreateHToolbar(); + m_treePane->GetLibTree()->ExpandLibId( aFPID ); m_treePane->GetLibTree()->CenterLibId( aFPID ); m_treePane->GetLibTree()->Refresh(); // update highlighting diff --git a/pcbnew/load_select_footprint.cpp b/pcbnew/load_select_footprint.cpp index c3c5bb4c62..f14a930f1c 100644 --- a/pcbnew/load_select_footprint.cpp +++ b/pcbnew/load_select_footprint.cpp @@ -89,9 +89,12 @@ static void clearModuleItemFlags( BOARD_ITEM* aItem ) aItem->ClearFlags(); } - +#include "pcbnew_id.h" +#include bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule ) { + bool is_last_fp_from_brd = IsCurrentFPFromBoard(); + MODULE* newModule; PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, false ); @@ -150,10 +153,15 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule ) GetScreen()->ClearUndoRedoList(); GetScreen()->ClrModify(); + // Update the bitmap of the ID_MODEDIT_SAVE tool if needed. + if( !is_last_fp_from_brd ) + ReCreateHToolbar(); + Update3DView(); if( IsGalCanvasActive() ) updateView(); + m_canvas->Refresh(); m_treePane->GetLibTree()->Refresh(); // update any previously-highlighted items diff --git a/pcbnew/tool_footprint_editor.cpp b/pcbnew/tool_footprint_editor.cpp index faee12d229..336c01d411 100644 --- a/pcbnew/tool_footprint_editor.cpp +++ b/pcbnew/tool_footprint_editor.cpp @@ -22,7 +22,7 @@ /** * @file tool_footprint_editor.cpp - * @brief Footprint editor tool bars + * @brief methods to build Footprint Editor toolbars */ #include @@ -37,6 +37,13 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar() { + // Note: + // To rebuild the aui toolbar, the more easy way is to clear ( calling m_mainToolBar.Clear() ) + // all wxAuiToolBarItems. + // However the wxAuiToolBarItems are not the owners of controls managed by + // them ( m_zoomSelectBox and m_gridSelectBox ), and therefore do not delete them + // So we do not recreate them after clearing the tools. + if( m_mainToolBar ) m_mainToolBar->Clear(); else @@ -57,8 +64,10 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar() #endif m_mainToolBar->AddTool( ID_MODEDIT_SAVE, wxEmptyString, - KiScaledBitmap( save_xpm, this ), - _( "Save changes" ) ); + KiScaledBitmap( IsCurrentFPFromBoard() ? open_brd_file_xpm : save_xpm, + this ), + IsCurrentFPFromBoard() ? + _( "Save changes to board" ) : _( "Save changes to library" ) ); KiScaledSeparator( m_mainToolBar, this ); m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, @@ -115,16 +124,19 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar() KiScaledSeparator( m_mainToolBar, this ); // Grid selection choice box. - m_gridSelectBox = new wxComboBox( m_mainToolBar, ID_ON_GRID_SELECT, wxEmptyString, - wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY ); + if( m_gridSelectBox == nullptr ) + m_gridSelectBox = new wxComboBox( m_mainToolBar, ID_ON_GRID_SELECT, wxEmptyString, + wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY ); UpdateGridSelectBox(); m_mainToolBar->AddControl( m_gridSelectBox ); KiScaledSeparator( m_mainToolBar, this ); // Zoom selection choice box. - m_zoomSelectBox = new wxComboBox( m_mainToolBar, ID_ON_ZOOM_SELECT, wxEmptyString, - wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY ); + if( m_zoomSelectBox == nullptr ) + m_zoomSelectBox = new wxComboBox( m_mainToolBar, ID_ON_ZOOM_SELECT, wxEmptyString, + wxDefaultPosition, wxDefaultSize, 0, nullptr, + wxCB_READONLY ); updateZoomSelectBox(); m_mainToolBar->AddControl( m_zoomSelectBox ); diff --git a/pcbnew/tool_footprint_viewer.cpp b/pcbnew/tool_footprint_viewer.cpp index 856ca53deb..ad7de6a138 100644 --- a/pcbnew/tool_footprint_viewer.cpp +++ b/pcbnew/tool_footprint_viewer.cpp @@ -39,6 +39,13 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar() { + // Note: + // To rebuild the aui toolbar, the more easy way is to clear ( calling m_mainToolBar.Clear() ) + // all wxAuiToolBarItems. + // However the wxAuiToolBarItems are not the owners of controls managed by + // them ( m_zoomSelectBox and m_gridSelectBox ), and therefore do not delete them + // So we do not recreate them after clearing the tools. + wxString msg; if( m_mainToolBar ) @@ -102,16 +109,20 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar() KiScaledSeparator( m_mainToolBar, this ); // Grid selection choice box. - m_gridSelectBox = new wxComboBox( m_mainToolBar, ID_ON_GRID_SELECT, wxEmptyString, - wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY ); + if( m_gridSelectBox == nullptr ) + m_gridSelectBox = new wxComboBox( m_mainToolBar, ID_ON_GRID_SELECT, wxEmptyString, + wxDefaultPosition, wxDefaultSize, 0, nullptr, + wxCB_READONLY ); UpdateGridSelectBox(); m_mainToolBar->AddControl( m_gridSelectBox ); KiScaledSeparator( m_mainToolBar, this ); // Zoom selection choice box. - m_zoomSelectBox = new wxComboBox( m_mainToolBar, ID_ON_ZOOM_SELECT, wxEmptyString, - wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY ); + if( m_zoomSelectBox == nullptr ) + m_zoomSelectBox = new wxComboBox( m_mainToolBar, ID_ON_ZOOM_SELECT, wxEmptyString, + wxDefaultPosition, wxDefaultSize, 0, nullptr, + wxCB_READONLY ); updateZoomSelectBox(); m_mainToolBar->AddControl( m_zoomSelectBox ); diff --git a/pcbnew/tool_pcb_editor.cpp b/pcbnew/tool_pcb_editor.cpp index 67976b464e..838616dc99 100644 --- a/pcbnew/tool_pcb_editor.cpp +++ b/pcbnew/tool_pcb_editor.cpp @@ -232,6 +232,13 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator() void PCB_EDIT_FRAME::ReCreateHToolbar() { + // Note: + // To rebuild the aui toolbar, the more easy way is to clear ( calling m_mainToolBar.Clear() ) + // all wxAuiToolBarItems. + // However the wxAuiToolBarItems are not the owners of controls managed by + // them and therefore do not delete them + // So we do not recreate them after clearing the tools. + wxString msg; wxWindowUpdateLocker dummy( this ); @@ -296,7 +303,7 @@ void PCB_EDIT_FRAME::ReCreateHToolbar() KiScaledSeparator( m_mainToolBar, this ); - if( m_SelLayerBox == NULL ) + if( m_SelLayerBox == nullptr ) { m_SelLayerBox = new PCB_LAYER_BOX_SELECTOR( m_mainToolBar, ID_TOOLBARH_PCB_SELECT_LAYER ); m_SelLayerBox->SetBoardFrame( this ); @@ -337,6 +344,13 @@ void PCB_EDIT_FRAME::ReCreateHToolbar() void PCB_EDIT_FRAME::ReCreateOptToolbar() { + // Note: + // To rebuild the aui toolbar, the more easy way is to clear ( calling m_mainToolBar.Clear() ) + // all wxAuiToolBarItems. + // However the wxAuiToolBarItems are not the owners of controls managed by + // them and therefore do not delete them + // So we do not recreate them after clearing the tools. + wxWindowUpdateLocker dummy( this ); if( m_optionsToolBar ) @@ -583,16 +597,20 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar() /* Set up toolbar items */ // Creates box to display and choose tracks widths: - m_SelTrackWidthBox = new wxComboBox( m_auxiliaryToolBar, + if( m_SelTrackWidthBox == nullptr ) + m_SelTrackWidthBox = new wxComboBox( m_auxiliaryToolBar, ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY ); + UpdateTrackWidthSelectBox( m_SelTrackWidthBox ); m_auxiliaryToolBar->AddControl( m_SelTrackWidthBox ); // Creates box to display and choose vias diameters: - m_SelViaSizeBox = new wxComboBox( m_auxiliaryToolBar, + if( m_SelViaSizeBox == nullptr ) + m_SelViaSizeBox = new wxComboBox( m_auxiliaryToolBar, ID_AUX_TOOLBAR_PCB_VIA_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY ); + UpdateViaSizeSelectBox( m_SelViaSizeBox ); m_auxiliaryToolBar->AddControl( m_SelViaSizeBox ); KiScaledSeparator( m_auxiliaryToolBar, this ); @@ -607,17 +625,23 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar() // Add the box to display and select the current grid size: KiScaledSeparator( m_auxiliaryToolBar, this ); - m_gridSelectBox = new wxComboBox( m_auxiliaryToolBar, ID_ON_GRID_SELECT, wxEmptyString, + + if( m_gridSelectBox == nullptr ) + m_gridSelectBox = new wxComboBox( m_auxiliaryToolBar, ID_ON_GRID_SELECT, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY ); + UpdateGridSelectBox(); m_auxiliaryToolBar->AddControl( m_gridSelectBox ); // Add the box to display and select the current Zoom KiScaledSeparator( m_auxiliaryToolBar, this ); - m_zoomSelectBox = new wxComboBox( m_auxiliaryToolBar, + + if( m_zoomSelectBox == nullptr ) + m_zoomSelectBox = new wxComboBox( m_auxiliaryToolBar, ID_ON_ZOOM_SELECT, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY ); + updateZoomSelectBox(); m_auxiliaryToolBar->AddControl( m_zoomSelectBox );