mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-07 22:05:32 +00:00
Make the PCB layerbox not needed in pcbcommon
This commit is contained in:
parent
9e9db8bd4d
commit
04ab369a49
@ -398,8 +398,6 @@ public:
|
||||
void OnFpChangeDebounceTimer( wxTimerEvent& aEvent );
|
||||
|
||||
protected:
|
||||
void configureToolbars() override;
|
||||
|
||||
bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;
|
||||
|
||||
void handleActivateEvent( wxActivateEvent& aEvent ) override;
|
||||
@ -435,10 +433,6 @@ protected:
|
||||
PCB_DISPLAY_OPTIONS m_displayOptions;
|
||||
PCB_ORIGIN_TRANSFORMS m_originTransforms;
|
||||
|
||||
PCB_LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer
|
||||
|
||||
const std::string m_tbPcbLayerSelectorName = "control.PCBLayerSelector";
|
||||
|
||||
private:
|
||||
std::unique_ptr<NL_PCBNEW_PLUGIN> m_spaceMouse;
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <board_design_settings.h>
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <pcb_dimension.h>
|
||||
#include <pcb_layer_box_selector.h>
|
||||
#include <footprint.h>
|
||||
#include <footprint_info_impl.h>
|
||||
#include <layer_pairs.h>
|
||||
@ -58,6 +59,7 @@ PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||
m_appearancePanel( nullptr ),
|
||||
m_tabbedPanel( nullptr )
|
||||
{
|
||||
m_SelLayerBox = nullptr;
|
||||
m_darkMode = KIPLATFORM::UI::IsDarkTheme();
|
||||
|
||||
Bind( wxEVT_IDLE,
|
||||
@ -353,3 +355,57 @@ void PCB_BASE_EDIT_FRAME::GetContextualTextVars( BOARD_ITEM* aSourceItem, const
|
||||
}
|
||||
|
||||
|
||||
void PCB_BASE_EDIT_FRAME::configureToolbars()
|
||||
{
|
||||
// Load the toolbar configuration and base controls
|
||||
PCB_BASE_FRAME::configureToolbars();
|
||||
|
||||
// Layer selector
|
||||
auto layerSelectorFactory =
|
||||
[this]( ACTION_TOOLBAR* aToolbar )
|
||||
{
|
||||
if( !m_SelLayerBox )
|
||||
{
|
||||
m_SelLayerBox = new PCB_LAYER_BOX_SELECTOR( aToolbar, wxID_ANY );
|
||||
m_SelLayerBox->SetBoardFrame( this );
|
||||
}
|
||||
|
||||
// In the footprint editor, some layers cannot be select (they are shown in the layer
|
||||
// manager only to set the color and visibility, but not for selection)
|
||||
// Disable them in layer box
|
||||
if( IsType( FRAME_FOOTPRINT_EDITOR ) )
|
||||
m_SelLayerBox->SetNotAllowedLayerSet( LSET::ForbiddenFootprintLayers() );
|
||||
|
||||
m_SelLayerBox->SetToolTip( _( "+/- to switch" ) );
|
||||
m_SelLayerBox->Resync();
|
||||
|
||||
aToolbar->Add( m_SelLayerBox );
|
||||
|
||||
// UI update handler for the control
|
||||
aToolbar->Bind( wxEVT_UPDATE_UI,
|
||||
[this]( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
if( m_SelLayerBox->GetCount()
|
||||
&& ( m_SelLayerBox->GetLayerSelection() != 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 );
|
||||
}
|
@ -232,6 +232,8 @@ public:
|
||||
wxArrayString* aTokens );
|
||||
|
||||
protected:
|
||||
void configureToolbars() override;
|
||||
|
||||
/**
|
||||
* Prompts a user to select global or project library tables
|
||||
*
|
||||
@ -262,6 +264,9 @@ protected:
|
||||
APPEARANCE_CONTROLS* m_appearancePanel;
|
||||
std::unique_ptr<LAYER_PAIR_SETTINGS> m_layerPairSettings;
|
||||
|
||||
PCB_LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer
|
||||
const std::string m_tbPcbLayerSelectorName = "control.PCBLayerSelector";
|
||||
|
||||
wxAuiNotebook* m_tabbedPanel; /// Panel with Layers and Object Inspector tabs
|
||||
|
||||
bool m_darkMode;
|
||||
|
@ -54,7 +54,6 @@
|
||||
#include <project_pcb.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <zoom_defines.h>
|
||||
#include <pcb_layer_box_selector.h>
|
||||
|
||||
#include <math/vector2d.h>
|
||||
#include <math/vector2wx.h>
|
||||
@ -84,7 +83,6 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
||||
m_pcb( nullptr ),
|
||||
m_originTransforms( *this )
|
||||
{
|
||||
m_SelLayerBox = nullptr;
|
||||
m_watcherDebounceTimer.Bind( wxEVT_TIMER, &PCB_BASE_FRAME::OnFpChangeDebounceTimer, this );
|
||||
}
|
||||
|
||||
@ -1270,59 +1268,3 @@ void PCB_BASE_FRAME::OnFpChangeDebounceTimer( wxTimerEvent& aEvent )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PCB_BASE_FRAME::configureToolbars()
|
||||
{
|
||||
// Load the toolbar configuration and base controls
|
||||
EDA_DRAW_FRAME::configureToolbars();
|
||||
|
||||
// Layer selector
|
||||
auto layerSelectorFactory =
|
||||
[this]( ACTION_TOOLBAR* aToolbar )
|
||||
{
|
||||
if( !m_SelLayerBox )
|
||||
{
|
||||
m_SelLayerBox = new PCB_LAYER_BOX_SELECTOR( aToolbar, wxID_ANY );
|
||||
m_SelLayerBox->SetBoardFrame( this );
|
||||
}
|
||||
|
||||
// In the footprint editor, some layers cannot be select (they are shown in the layer
|
||||
// manager only to set the color and visibility, but not for selection)
|
||||
// Disable them in layer box
|
||||
if( IsType( FRAME_FOOTPRINT_EDITOR ) )
|
||||
m_SelLayerBox->SetNotAllowedLayerSet( LSET::ForbiddenFootprintLayers() );
|
||||
|
||||
m_SelLayerBox->SetToolTip( _( "+/- to switch" ) );
|
||||
m_SelLayerBox->Resync();
|
||||
|
||||
aToolbar->Add( m_SelLayerBox );
|
||||
|
||||
// UI update handler for the control
|
||||
aToolbar->Bind( wxEVT_UPDATE_UI,
|
||||
[this]( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
if( m_SelLayerBox->GetCount()
|
||||
&& ( m_SelLayerBox->GetLayerSelection() != 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 );
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ std::optional<TOOLBAR_CONFIGURATION> PCB_EDIT_FRAME::DefaultTopAuxToolbarConfig(
|
||||
|
||||
void PCB_EDIT_FRAME::configureToolbars()
|
||||
{
|
||||
PCB_BASE_FRAME::configureToolbars();
|
||||
PCB_BASE_EDIT_FRAME::configureToolbars();
|
||||
|
||||
// Box to display and choose track widths
|
||||
auto trackWidthSelectorFactory =
|
||||
|
Loading…
Reference in New Issue
Block a user