Add layer selector to Footprint Editor for consistency.
Fixes: lp:1850858 * https://bugs.launchpad.net/kicad/+bug/1850858
This commit is contained in:
parent
fae86d4dd0
commit
ddf887d24a
|
@ -28,32 +28,20 @@
|
|||
#include <pgm_base.h>
|
||||
#include <kiface_i.h>
|
||||
#include <confirm.h>
|
||||
#include <eda_doc.h>
|
||||
#include <gestfich.h>
|
||||
#include <pcb_edit_frame.h>
|
||||
|
||||
#include <pcbnew_id.h>
|
||||
#include <pcbnew.h>
|
||||
#include <footprint_edit_frame.h>
|
||||
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
#include <class_track.h>
|
||||
#include <class_zone.h>
|
||||
#include <class_pcb_text.h>
|
||||
#include <class_pcb_target.h>
|
||||
#include <class_dimension.h>
|
||||
#include <footprint_viewer_frame.h>
|
||||
#include <pcb_layer_box_selector.h>
|
||||
#include <dialog_drc.h>
|
||||
#include <invoke_pcb_dialog.h>
|
||||
#include <array_creator.h>
|
||||
#include <connectivity/connectivity_data.h>
|
||||
|
||||
#include <zone_filler.h>
|
||||
|
||||
#include <dialog_move_exact.h>
|
||||
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <dialogs/dialog_text_properties.h>
|
||||
|
|
|
@ -83,15 +83,16 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
EVT_TOOL( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, FOOTPRINT_EDIT_FRAME::LoadModuleFromBoard )
|
||||
EVT_TOOL( ID_ADD_FOOTPRINT_TO_BOARD, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||
|
||||
// popup commands
|
||||
// Horizontal toolbar
|
||||
EVT_MENU( ID_GRID_SETTINGS, FOOTPRINT_EDIT_FRAME::OnGridSettings )
|
||||
EVT_COMBOBOX( ID_TOOLBARH_PCB_SELECT_LAYER, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||
|
||||
// UI update events.
|
||||
EVT_UPDATE_UI( ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
|
||||
FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard )
|
||||
EVT_UPDATE_UI( ID_ADD_FOOTPRINT_TO_BOARD,
|
||||
FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard )
|
||||
|
||||
EVT_UPDATE_UI( ID_TOOLBARH_PCB_SELECT_LAYER, FOOTPRINT_EDIT_FRAME::OnUpdateLayerSelectBox )
|
||||
EVT_UPDATE_UI( ID_GEN_IMPORT_GRAPHICS_FILE, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected )
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
@ -108,6 +109,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
|||
m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs
|
||||
m_canvasType = aBackend;
|
||||
m_AboutTitle = "ModEdit";
|
||||
m_selLayerBox = nullptr;
|
||||
|
||||
// Give an icon
|
||||
wxIcon icon;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <config_params.h>
|
||||
#include <fp_tree_synchronizing_adapter.h>
|
||||
|
||||
class PCB_LAYER_BOX_SELECTOR;
|
||||
class PCB_LAYER_WIDGET;
|
||||
class FP_LIB_TABLE;
|
||||
class EDGE_MODULE;
|
||||
|
@ -123,6 +124,17 @@ public:
|
|||
*/
|
||||
void ReCreateMenuBar() override;
|
||||
|
||||
/**
|
||||
* Re create the layer Box by clearing the old list, and building
|
||||
* le new one, from the new layers names and cole layers
|
||||
* @param aForceResizeToolbar = true to resize the parent toolbar
|
||||
* false if not needed (mainly in parent toolbar creation,
|
||||
* or when the layers names are not modified)
|
||||
*/
|
||||
void ReCreateLayerBox( bool aForceResizeToolbar = true );
|
||||
|
||||
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
|
||||
|
||||
// The Tool Framework initalization, for GAL mode
|
||||
void setupTools();
|
||||
|
||||
|
@ -342,14 +354,12 @@ public:
|
|||
DECLARE_EVENT_TABLE()
|
||||
|
||||
protected:
|
||||
|
||||
/// protected so only friend PCB::IFACE::CreateWindow() can act as sole factory.
|
||||
FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, EDA_DRAW_PANEL_GAL::GAL_TYPE aBackend );
|
||||
|
||||
PCB_LAYER_WIDGET* m_Layers; ///< the layer manager
|
||||
|
||||
/// List of footprint editor configuration parameters.
|
||||
PARAM_CFG_ARRAY m_configParams;
|
||||
PCB_LAYER_BOX_SELECTOR* m_selLayerBox; // a combo box to display and select active layer
|
||||
PCB_LAYER_WIDGET* m_Layers; // the layer manager
|
||||
PARAM_CFG_ARRAY m_configParams; // List of footprint editor configuration parameters.
|
||||
|
||||
/**
|
||||
* Make sure the footprint info list is loaded (with a progress dialog) and then initialize
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -21,10 +21,6 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file footprint_editor_utils.cpp
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <kiface_i.h>
|
||||
#include <kiway.h>
|
||||
|
@ -43,7 +39,7 @@
|
|||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
#include <class_edge_mod.h>
|
||||
|
||||
#include <pcb_layer_box_selector.h>
|
||||
#include <ratsnest_data.h>
|
||||
#include <pcbnew.h>
|
||||
#include <pcbnew_id.h>
|
||||
|
@ -55,7 +51,6 @@
|
|||
#include <collectors.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
|
||||
#include <dialog_edit_footprint_for_fp_editor.h>
|
||||
#include <dialog_move_exact.h>
|
||||
#include <dialog_create_array.h>
|
||||
|
@ -313,6 +308,13 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
SaveFootprintToBoard( true );
|
||||
break;
|
||||
|
||||
case ID_TOOLBARH_PCB_SELECT_LAYER:
|
||||
SetActiveLayer( ToLAYER_ID( m_selLayerBox->GetLayerSelection() ) );
|
||||
|
||||
if( static_cast<PCB_DISPLAY_OPTIONS*>( GetDisplayOptions() )->m_ContrastModeDisplay )
|
||||
GetCanvas()->Refresh();
|
||||
break;
|
||||
|
||||
case ID_MODEDIT_CHECK:
|
||||
// Currently: not implemented
|
||||
break;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <bitmaps.h>
|
||||
#include <tool/action_toolbar.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <pcb_layer_box_selector.h>
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
|
||||
{
|
||||
|
@ -113,6 +114,18 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
|
|||
updateZoomSelectBox();
|
||||
m_mainToolBar->AddControl( m_zoomSelectBox );
|
||||
|
||||
KiScaledSeparator( m_mainToolBar, this );
|
||||
|
||||
// Layer selection choice box.
|
||||
if( m_selLayerBox == nullptr )
|
||||
{
|
||||
m_selLayerBox = new PCB_LAYER_BOX_SELECTOR( m_mainToolBar, ID_TOOLBARH_PCB_SELECT_LAYER );
|
||||
m_selLayerBox->SetBoardFrame( this );
|
||||
}
|
||||
|
||||
ReCreateLayerBox( false );
|
||||
m_mainToolBar->AddControl( m_selLayerBox );
|
||||
|
||||
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
|
||||
m_mainToolBar->Realize();
|
||||
}
|
||||
|
@ -173,6 +186,29 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar()
|
|||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::ReCreateLayerBox( bool aForceResizeToolbar )
|
||||
{
|
||||
if( m_selLayerBox == NULL || m_mainToolBar == NULL )
|
||||
return;
|
||||
|
||||
m_selLayerBox->SetToolTip( _( "+/- to switch" ) );
|
||||
m_selLayerBox->Resync();
|
||||
|
||||
if( aForceResizeToolbar )
|
||||
{
|
||||
// the layer box can have its size changed
|
||||
// Update the aui manager, to take in account the new size
|
||||
m_auimgr.Update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
m_selLayerBox->SetLayerSelection( GetActiveLayer() );
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::SyncToolbars()
|
||||
{
|
||||
#define TOGGLE_TOOL( toolbar, tool ) toolbar->Toggle( tool, IsCurrentTool( tool ) )
|
||||
|
|
Loading…
Reference in New Issue