mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 00:21:25 +00:00
Cleanup PCB/fpeditor layer box handling
This commit is contained in:
parent
7ad1103f55
commit
f0a76f62b6
@ -60,13 +60,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case ID_TOOLBARH_PCB_SELECT_LAYER:
|
||||
SetActiveLayer( ToLAYER_ID( m_SelLayerBox->GetLayerSelection() ) );
|
||||
|
||||
if( displ_opts.m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL )
|
||||
GetCanvas()->Refresh();
|
||||
break;
|
||||
|
||||
case ID_MENU_EXPORT_FOOTPRINTS_TO_LIBRARY:
|
||||
ExportFootprintsToLibrary( false );
|
||||
break;
|
||||
|
@ -93,9 +93,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
|
||||
EVT_TOOL( ID_LOAD_FOOTPRINT_FROM_BOARD, FOOTPRINT_EDIT_FRAME::OnLoadFootprintFromBoard )
|
||||
EVT_TOOL( ID_ADD_FOOTPRINT_TO_BOARD, FOOTPRINT_EDIT_FRAME::OnSaveFootprintToBoard )
|
||||
|
||||
// Horizontal toolbar
|
||||
EVT_COMBOBOX( ID_TOOLBARH_PCB_SELECT_LAYER, FOOTPRINT_EDIT_FRAME::SelectLayer )
|
||||
|
||||
// UI update events.
|
||||
EVT_UPDATE_UI( ID_LOAD_FOOTPRINT_FROM_BOARD,
|
||||
FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard )
|
||||
|
@ -129,8 +129,6 @@ public:
|
||||
*/
|
||||
void ReCreateLayerBox( bool aForceResizeToolbar = true );
|
||||
|
||||
void SelectLayer( wxCommandEvent& event );
|
||||
|
||||
// The Tool Framework initialization, for GAL mode
|
||||
void setupTools();
|
||||
|
||||
|
@ -115,16 +115,6 @@ void FOOTPRINT_EDIT_FRAME::centerItemIdleHandler( wxIdleEvent& aEvent )
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::SelectLayer( wxCommandEvent& event )
|
||||
{
|
||||
SetActiveLayer( ToLAYER_ID( m_SelLayerBox->GetLayerSelection() ) );
|
||||
|
||||
if( GetDisplayOptions().m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL )
|
||||
GetCanvas()->Refresh();
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::OnSaveFootprintToBoard( wxCommandEvent& event )
|
||||
{
|
||||
SaveFootprintToBoard( true );
|
||||
|
@ -1282,8 +1282,7 @@ void PCB_BASE_FRAME::configureToolbars()
|
||||
{
|
||||
if( !m_SelLayerBox )
|
||||
{
|
||||
m_SelLayerBox = new PCB_LAYER_BOX_SELECTOR( aToolbar,
|
||||
ID_TOOLBARH_PCB_SELECT_LAYER );
|
||||
m_SelLayerBox = new PCB_LAYER_BOX_SELECTOR( aToolbar, wxID_ANY );
|
||||
m_SelLayerBox->SetBoardFrame( this );
|
||||
}
|
||||
|
||||
@ -1293,6 +1292,7 @@ void PCB_BASE_FRAME::configureToolbars()
|
||||
if( IsType( FRAME_FOOTPRINT_EDITOR ) )
|
||||
m_SelLayerBox->SetNotAllowedLayerSet( LSET::ForbiddenFootprintLayers() );
|
||||
|
||||
m_SelLayerBox->SetToolTip( _( "+/- to switch" ) );
|
||||
m_SelLayerBox->Resync();
|
||||
|
||||
aToolbar->Add( m_SelLayerBox );
|
||||
@ -1301,16 +1301,27 @@ void PCB_BASE_FRAME::configureToolbars()
|
||||
aToolbar->Bind( wxEVT_UPDATE_UI,
|
||||
[this]( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
if( m_SelLayerBox->GetCount() )
|
||||
if( m_SelLayerBox->GetCount()
|
||||
&& ( m_SelLayerBox->GetLayerSelection() != GetActiveLayer() ) )
|
||||
{
|
||||
if( m_SelLayerBox->GetSelection() != GetActiveLayer() )
|
||||
m_SelLayerBox->SetSelection( GetActiveLayer() );
|
||||
m_SelLayerBox->SetLayerSelection( GetActiveLayer() );
|
||||
}
|
||||
},
|
||||
m_SelLayerBox->GetId() );
|
||||
|
||||
// Event handler to respond to the user interacting with the control
|
||||
aToolbar->Bind( wxEVT_COMBOBOX,
|
||||
[this]( wxCommandEvent& aEvent )
|
||||
{
|
||||
SetActiveLayer( ToLAYER_ID( m_SelLayerBox->GetLayerSelection() ) );
|
||||
|
||||
if( GetDisplayOptions().m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL )
|
||||
GetCanvas()->Refresh();
|
||||
},
|
||||
m_SelLayerBox->GetId() );
|
||||
};
|
||||
|
||||
RegisterCustomToolbarControlFactory( m_tbPcbLayerSelectorName, _( "Layer selector" ),
|
||||
_( "Control to select the layer" ),
|
||||
layerSelectorFactory );
|
||||
}
|
||||
}
|
||||
|
@ -175,7 +175,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
||||
|
||||
// Horizontal toolbar
|
||||
EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
|
||||
EVT_COMBOBOX( ID_TOOLBARH_PCB_SELECT_LAYER, PCB_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_CHOICE( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
|
||||
EVT_CHOICE( ID_AUX_TOOLBAR_PCB_VIA_SIZE, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
|
||||
|
||||
|
@ -93,8 +93,6 @@ enum pcbnew_ids
|
||||
ID_PCB_GEN_CMP_FILE,
|
||||
ID_PCB_GEN_BOM_FILE_FROM_BOARD,
|
||||
|
||||
ID_TOOLBARH_PCB_SELECT_LAYER,
|
||||
|
||||
ID_FPEDIT_SAVE_PNG,
|
||||
|
||||
ID_MODVIEW_LIB_FILTER,
|
||||
|
Loading…
Reference in New Issue
Block a user