Pcbnew: fix user defined layer bugs.
This commit is contained in:
parent
5ad76a237e
commit
564f363c57
|
@ -242,6 +242,15 @@ LSEQ LSET::Users() const
|
|||
Eco2_User,
|
||||
Edge_Cuts,
|
||||
Margin,
|
||||
User_1,
|
||||
User_2,
|
||||
User_3,
|
||||
User_4,
|
||||
User_5,
|
||||
User_6,
|
||||
User_7,
|
||||
User_8,
|
||||
User_9
|
||||
};
|
||||
|
||||
return Seq( sequence, arrayDim( sequence ) );
|
||||
|
@ -269,6 +278,15 @@ LSEQ LSET::TechAndUserUIOrder() const
|
|||
B_CrtYd,
|
||||
F_Fab,
|
||||
B_Fab,
|
||||
User_1,
|
||||
User_2,
|
||||
User_3,
|
||||
User_4,
|
||||
User_5,
|
||||
User_6,
|
||||
User_7,
|
||||
User_8,
|
||||
User_9
|
||||
};
|
||||
|
||||
return Seq( sequence, arrayDim( sequence ) );
|
||||
|
|
|
@ -195,6 +195,15 @@ COLOR_SETTINGS::COLOR_SETTINGS( wxString aFilename ) :
|
|||
CLR( "board.f_crtyd", F_CrtYd, COLOR4D( LIGHTGRAY ) );
|
||||
CLR( "board.b_fab", B_Fab, COLOR4D( BLUE ) );
|
||||
CLR( "board.f_fab", F_Fab, COLOR4D( DARKGRAY ) );
|
||||
CLR( "board.user_1", User_1, COLOR4D( BLUE ) );
|
||||
CLR( "board.user_2", User_2, COLOR4D( BLUE ) );
|
||||
CLR( "board.user_3", User_3, COLOR4D( BLUE ) );
|
||||
CLR( "board.user_4", User_4, COLOR4D( BLUE ) );
|
||||
CLR( "board.user_5", User_5, COLOR4D( BLUE ) );
|
||||
CLR( "board.user_6", User_6, COLOR4D( BLUE ) );
|
||||
CLR( "board.user_7", User_7, COLOR4D( BLUE ) );
|
||||
CLR( "board.user_8", User_8, COLOR4D( BLUE ) );
|
||||
CLR( "board.user_9", User_9, COLOR4D( BLUE ) );
|
||||
|
||||
// Colors for 3D viewer, which are used as defaults unless overridden by the board
|
||||
CLR( "3d_viewer.background_bottom", LAYER_3D_BACKGROUND_BOTTOM, COLOR4D( 0.4, 0.4, 0.5, 1.0 ) );
|
||||
|
|
|
@ -848,17 +848,7 @@ bool PANEL_SETUP_LAYERS::CheckCopperLayerCount( BOARD* aWorkingBoard, BOARD* aIm
|
|||
void PANEL_SETUP_LAYERS::addUserDefinedLayer( wxCommandEvent& aEvent )
|
||||
{
|
||||
LSEQ seq;
|
||||
wxArrayString availableUserDefinedLayers;
|
||||
|
||||
for( seq = LSET::UserDefinedLayers().Seq(); seq; ++seq )
|
||||
{
|
||||
wxCheckBox* checkBox = getCheckBox( *seq );
|
||||
|
||||
if( checkBox && checkBox->IsChecked() )
|
||||
continue;
|
||||
|
||||
availableUserDefinedLayers.Add( LayerName( *seq ) );
|
||||
}
|
||||
wxArrayString availableUserDefinedLayers = getAvailableUserDefinedLayers();
|
||||
|
||||
wxCHECK( !availableUserDefinedLayers.IsEmpty(), /* void */ );
|
||||
|
||||
|
@ -899,6 +889,25 @@ void PANEL_SETUP_LAYERS::addUserDefinedLayer( wxCommandEvent& aEvent )
|
|||
|
||||
void PANEL_SETUP_LAYERS::onUpdateAddUserDefinedLayer( wxUpdateUIEvent& event )
|
||||
{
|
||||
event.Enable( m_PresetsChoice->GetSelection() == 0 );
|
||||
wxArrayString availableUserDefinedLayers = getAvailableUserDefinedLayers();
|
||||
|
||||
event.Enable( m_PresetsChoice->GetSelection() == 0 && !availableUserDefinedLayers.IsEmpty() );
|
||||
}
|
||||
|
||||
|
||||
wxArrayString PANEL_SETUP_LAYERS::getAvailableUserDefinedLayers()
|
||||
{
|
||||
wxArrayString availableUserDefinedLayers;
|
||||
|
||||
for( LSEQ seq = LSET::UserDefinedLayers().Seq(); seq; ++seq )
|
||||
{
|
||||
wxCheckBox* checkBox = getCheckBox( *seq );
|
||||
|
||||
if( checkBox && checkBox->IsShown() )
|
||||
continue;
|
||||
|
||||
availableUserDefinedLayers.Add( LayerName( *seq ) );
|
||||
}
|
||||
|
||||
return availableUserDefinedLayers;
|
||||
}
|
||||
|
|
|
@ -120,6 +120,8 @@ private:
|
|||
*/
|
||||
LSEQ getNonRemovableLayers();
|
||||
|
||||
wxArrayString getAvailableUserDefinedLayers();
|
||||
|
||||
PANEL_SETUP_LAYERS_CTLs getCTLs( LAYER_NUM aLayerNumber );
|
||||
wxControl* getName( LAYER_NUM aLayer );
|
||||
wxCheckBox* getCheckBox( LAYER_NUM aLayer );
|
||||
|
|
|
@ -886,6 +886,15 @@ PANEL_SETUP_LAYERS_BASE::PANEL_SETUP_LAYERS_BASE( wxWindow* parent, wxWindowID i
|
|||
m_Eco2CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_CommentsCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_DrawingsCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_User1CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_User2CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_User3CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_User4CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_User5CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_User6CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_User7CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_User8CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_User9CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
}
|
||||
|
||||
PANEL_SETUP_LAYERS_BASE::~PANEL_SETUP_LAYERS_BASE()
|
||||
|
@ -945,5 +954,14 @@ PANEL_SETUP_LAYERS_BASE::~PANEL_SETUP_LAYERS_BASE()
|
|||
m_Eco2CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_CommentsCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_DrawingsCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_User1CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_User2CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_User3CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_User4CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_User5CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_User6CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_User7CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_User8CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_User9CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
|
@ -10147,6 +10147,7 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnCheckBox">OnCheckBox</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
|
@ -10336,6 +10337,7 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnCheckBox">OnCheckBox</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
|
@ -10525,6 +10527,7 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnCheckBox">OnCheckBox</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
|
@ -10714,6 +10717,7 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnCheckBox">OnCheckBox</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
|
@ -10903,6 +10907,7 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnCheckBox">OnCheckBox</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
|
@ -11092,6 +11097,7 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnCheckBox">OnCheckBox</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
|
@ -11281,6 +11287,7 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnCheckBox">OnCheckBox</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
|
@ -11470,6 +11477,7 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnCheckBox">OnCheckBox</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
|
@ -11659,6 +11667,7 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnCheckBox">OnCheckBox</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2004-2017 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
|
||||
* Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2010-2017 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2010-2020 KiCad Developers, see change_log.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
|
||||
|
@ -509,9 +509,6 @@ void PCB_LAYER_WIDGET::ReFill()
|
|||
}
|
||||
}
|
||||
|
||||
UpdateLayouts();
|
||||
|
||||
|
||||
// technical layers are shown in this order:
|
||||
// Because they are static, wxGetTranslation must be explicitly
|
||||
// called for tooltips.
|
||||
|
@ -536,7 +533,7 @@ void PCB_LAYER_WIDGET::ReFill()
|
|||
{ F_CrtYd, _( "Footprint courtyards on board's front" ) },
|
||||
{ B_CrtYd, _( "Footprint courtyards on board's back" ) },
|
||||
{ F_Fab, _( "Footprint assembly on board's front" ) },
|
||||
{ B_Fab, _( "Footprint assembly on board's back" ) }
|
||||
{ B_Fab, _( "Footprint assembly on board's back" ) },
|
||||
};
|
||||
|
||||
for( unsigned i=0; i<arrayDim( non_cu_seq ); ++i )
|
||||
|
@ -544,7 +541,10 @@ void PCB_LAYER_WIDGET::ReFill()
|
|||
PCB_LAYER_ID layer = non_cu_seq[i].layerId;
|
||||
|
||||
if( !enabled[layer] )
|
||||
{
|
||||
wxLogDebug( "Layer widget: layer %s not enabled.", LSET::Name( layer ) );
|
||||
continue;
|
||||
}
|
||||
|
||||
AppendLayerRow( LAYER_WIDGET::ROW( brd->GetLayerName( layer ), layer,
|
||||
myframe->GetColorSettings()->GetColor( layer ),
|
||||
|
@ -557,6 +557,8 @@ void PCB_LAYER_WIDGET::ReFill()
|
|||
getLayerComp( GetLayerRowCount()-1, COLUMN_COLORBM )->SetToolTip( wxEmptyString );
|
||||
}
|
||||
}
|
||||
|
||||
UpdateLayouts();
|
||||
}
|
||||
|
||||
|
||||
|
@ -640,8 +642,10 @@ void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( myframe->GetCanvas() )
|
||||
myframe->GetCanvas()->GetView()->SetLayerVisible( aLayer, isVisible );
|
||||
}
|
||||
|
||||
if( isFinal )
|
||||
myframe->GetCanvas()->Refresh();
|
||||
|
@ -671,7 +675,6 @@ void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor )
|
|||
|
||||
myframe->ReCreateHToolbar();
|
||||
myframe->GetCanvas()->ForceRefresh();
|
||||
myframe->GetCanvas()->Refresh();
|
||||
}
|
||||
|
||||
|
||||
|
@ -703,7 +706,6 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
|
|||
myframe->GetCanvas()->GetView()->SetLayerVisible( aId, isEnabled );
|
||||
|
||||
myframe->GetCanvas()->Refresh();
|
||||
myframe->GetCanvas()->Refresh();
|
||||
}
|
||||
|
||||
//-----</LAYER_WIDGET callbacks>------------------------------------------
|
||||
|
|
|
@ -1340,7 +1340,16 @@ void APPEARANCE_CONTROLS::rebuildLayers()
|
|||
{ F_CrtYd, _( "Footprint courtyards on board's front" ) },
|
||||
{ B_CrtYd, _( "Footprint courtyards on board's back" ) },
|
||||
{ F_Fab, _( "Footprint assembly on board's front" ) },
|
||||
{ B_Fab, _( "Footprint assembly on board's back" ) }
|
||||
{ B_Fab, _( "Footprint assembly on board's back" ) },
|
||||
{ User_1, _( "User defined layer 1" ) },
|
||||
{ User_2, _( "User defined layer 2" ) },
|
||||
{ User_3, _( "User defined layer 3" ) },
|
||||
{ User_4, _( "User defined layer 4" ) },
|
||||
{ User_5, _( "User defined layer 5" ) },
|
||||
{ User_6, _( "User defined layer 6" ) },
|
||||
{ User_7, _( "User defined layer 7" ) },
|
||||
{ User_8, _( "User defined layer 8" ) },
|
||||
{ User_9, _( "User defined layer 9" ) },
|
||||
};
|
||||
|
||||
for( const auto& entry : non_cu_seq )
|
||||
|
|
Loading…
Reference in New Issue