7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-03-30 05:56:55 +00:00

MOVED: fp editor layer names to Display Options.

(It was on Footprint Defaults, which didn't make
any sense.  Probably just ended up there because
there was similar code there.)

Also fixed a bug with accepting the dialog with
a grid cell editor open.

Also fixed a bug where the number of copper layers
would get set back to 2.

Also fixed a bug where the layer names weren't
getting updated in the Appearances tab.
This commit is contained in:
Jeff Young 2025-03-25 10:33:01 +00:00
parent 1c83f0a70b
commit 9a7b82a8c0
17 changed files with 2580 additions and 2479 deletions

View File

@ -33,7 +33,7 @@ wxString LayerName( int aLayer )
switch( aLayer )
{
// PCB_LAYER_ID
case UNDEFINED_LAYER: return _( "undefined" );
case UNDEFINED_LAYER: return _( "undefined" );
// Copper
case PCB_LAYER_ID::F_Cu: return wxT( "F.Cu" );

View File

@ -161,8 +161,8 @@ set( PCBNEW_DIALOGS
dialogs/dialog_multichannel_generate_rule_areas.cpp
dialogs/dialog_multichannel_repeat_layout_base.cpp
dialogs/dialog_multichannel_repeat_layout.cpp
dialogs/panel_pcb_display_options.cpp
dialogs/panel_pcb_display_options_base.cpp
dialogs/panel_display_options.cpp
dialogs/panel_display_options_base.cpp
dialogs/panel_edit_options.cpp
dialogs/panel_edit_options_base.cpp
dialogs/panel_fp_lib_table.cpp

View File

@ -0,0 +1,441 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright The 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 as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <pcbnew_settings.h>
#include <config_map.h>
#include <panel_display_options.h>
#include <widgets/paged_dialog.h>
#include <widgets/gal_options_panel.h>
#include <widgets/std_bitmap_button.h>
#include <grid_tricks.h>
#include <board_design_settings.h>
#include <grid_layer_box_helpers.h>
#include <footprint_editor_settings.h>
static const UTIL::CFG_MAP<TRACK_CLEARANCE_MODE> clearanceModeMap =
{
{ SHOW_WITH_VIA_WHILE_ROUTING, 2 }, // Default
{ DO_NOT_SHOW_CLEARANCE, 0 },
{ SHOW_WHILE_ROUTING, 1 },
{ SHOW_WITH_VIA_WHILE_ROUTING_OR_DRAGGING, 3 },
{ SHOW_WITH_VIA_ALWAYS, 4 },
};
class LAYER_NAMES_GRID_TABLE : public wxGridTableBase
{
std::vector<TEXT_ITEM_INFO> m_items;
public:
LAYER_NAMES_GRID_TABLE() {}
int GetNumberRows() override { return m_items.size(); }
int GetNumberCols() override { return 2; }
wxString GetColLabelValue( int aCol ) override
{
switch( aCol )
{
case 0: return _( "Layer" );
case 1: return _( "Name" );
default: return wxEmptyString;
}
}
bool CanGetValueAs( int aRow, int aCol, const wxString& aTypeName ) override
{
switch( aCol )
{
case 0: return aTypeName == wxGRID_VALUE_NUMBER;
case 1: return aTypeName == wxGRID_VALUE_STRING;
default: wxFAIL; return false;
}
}
bool CanSetValueAs( int aRow, int aCol, const wxString& aTypeName ) override
{
return CanGetValueAs( aRow, aCol, aTypeName );
}
wxString GetValue( int row, int col ) override { return m_items[row].m_Text; }
void SetValue( int row, int col, const wxString& value ) override
{
if( col == 1 )
m_items[row].m_Text = value;
}
long GetValueAsLong( int row, int col ) override { return m_items[row].m_Layer; }
void SetValueAsLong( int row, int col, long value ) override
{
if( col == 0 )
m_items[row].m_Layer = static_cast<PCB_LAYER_ID>( value );
}
bool AppendRows( size_t aNumRows = 1 ) override
{
std::set<int> layers;
int layer = User_1;
for( const TEXT_ITEM_INFO& item : m_items )
layers.insert( item.m_Layer );
for( size_t i = 0; i < aNumRows; ++i )
{
while( layers.contains( layer ) )
layer = layer + 2;
if( IsUserLayer( static_cast<PCB_LAYER_ID>( layer ) ) )
{
layers.insert( layer );
m_items.emplace_back( wxT( "" ), true, static_cast<PCB_LAYER_ID>( layer ) );
}
else
{
return false;
}
}
if( GetView() )
{
wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, aNumRows );
GetView()->ProcessTableMessage( msg );
}
return true;
}
bool DeleteRows( size_t aPos, size_t aNumRows ) override
{
// aPos may be a large positive, e.g. size_t(-1), and the sum of
// aPos+aNumRows may wrap here, so both ends of the range are tested.
if( aPos < m_items.size() && aPos + aNumRows <= m_items.size() )
{
m_items.erase( m_items.begin() + aPos, m_items.begin() + aPos + aNumRows );
if( GetView() )
{
wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aPos, aNumRows );
GetView()->ProcessTableMessage( msg );
}
return true;
}
return false;
}
};
PANEL_DISPLAY_OPTIONS::PANEL_DISPLAY_OPTIONS( wxWindow* aParent, APP_SETTINGS_BASE* aAppSettings ) :
PANEL_DISPLAY_OPTIONS_BASE( aParent ),
m_isPCBEdit( dynamic_cast<PCBNEW_SETTINGS*>( aAppSettings ) != nullptr )
{
m_galOptsPanel = new GAL_OPTIONS_PANEL( this, aAppSettings );
m_galOptionsSizer->Add( m_galOptsPanel, 1, wxEXPAND|wxRIGHT, 15 );
m_optionsBook->SetSelection( m_isPCBEdit ? 1 : 0 );
m_layerNameitemsGrid->SetDefaultRowSize( m_layerNameitemsGrid->GetDefaultRowSize() + 4 );
m_layerNameitemsGrid->SetTable( new LAYER_NAMES_GRID_TABLE(), true );
m_layerNameitemsGrid->PushEventHandler( new GRID_TRICKS( m_layerNameitemsGrid ) );
m_layerNameitemsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
wxGridCellAttr* attr = new wxGridCellAttr;
attr->SetRenderer( new GRID_CELL_LAYER_RENDERER( nullptr ) );
LSET forbiddenLayers = LSET::AllCuMask() | LSET::AllTechMask();
forbiddenLayers.set( Edge_Cuts );
forbiddenLayers.set( Margin );
attr->SetEditor( new GRID_CELL_LAYER_SELECTOR( nullptr, forbiddenLayers ) );
m_layerNameitemsGrid->SetColAttr( 0, attr );
m_bpAddLayer->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
m_bpDeleteLayer->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) );
// I wish I knew why these were needed here and not anywhere else. Something to do with being
// inside a notebook page that starts off hidden? Anyway: no hacky code -> no worky.
m_bpAddLayer->SetSize( m_bpAddLayer->GetMinSize() );
m_bpDeleteLayer->SetSize( m_bpDeleteLayer->GetMinSize() );
Layout();
}
PANEL_DISPLAY_OPTIONS::~PANEL_DISPLAY_OPTIONS()
{
// destroy GRID_TRICKS before grids.
m_layerNameitemsGrid->PopEventHandler( true );
}
void PANEL_DISPLAY_OPTIONS::loadFPSettings( const FOOTPRINT_EDITOR_SETTINGS* aCfg )
{
wxGridTableBase* table = m_layerNameitemsGrid->GetTable();
for( auto& item : aCfg->m_DesignSettings.m_UserLayerNames )
{
wxString orig_name = item.first;
int layer = LSET::NameToLayer( orig_name );
if( !IsUserLayer( static_cast<PCB_LAYER_ID>( layer ) ) )
continue;
int row = m_layerNameitemsGrid->GetNumberRows();
table->AppendRows( 1 );
table->SetValueAsLong( row, 0, layer );
table->SetValue( row, 1, item.second );
}
Layout();
}
void PANEL_DISPLAY_OPTIONS::loadPCBSettings( PCBNEW_SETTINGS* aCfg )
{
int i = UTIL::GetConfigForVal( clearanceModeMap, aCfg->m_Display.m_TrackClearance );
m_OptDisplayTracksClearance->SetSelection( i );
m_OptDisplayPadClearence->SetValue( aCfg->m_Display.m_PadClearance );
m_OptDisplayPadNumber->SetValue( aCfg->m_ViewersDisplay.m_DisplayPadNumbers );
m_ShowNetNamesOption->SetSelection( aCfg->m_Display.m_NetNames );
m_checkForceShowFieldsWhenFPSelected->SetValue( aCfg->m_Display.m_ForceShowFieldsWhenFPSelected );
m_live3Drefresh->SetValue( aCfg->m_Display.m_Live3DRefresh );
m_checkCrossProbeOnSelection->SetValue( aCfg->m_CrossProbing.on_selection );
m_checkCrossProbeCenter->SetValue( aCfg->m_CrossProbing.center_on_items );
m_checkCrossProbeZoom->SetValue( aCfg->m_CrossProbing.zoom_to_fit );
m_checkCrossProbeAutoHighlight->SetValue( aCfg->m_CrossProbing.auto_highlight );
}
bool PANEL_DISPLAY_OPTIONS::Show( bool aShow )
{
bool retVal = wxPanel::Show( aShow );
if( aShow )
{
// These *should* work in the constructor, and indeed they do if this panel is the
// first displayed. However, on OSX 3.0.5 (at least), if another panel is displayed
// first then the icons will be blank unless they're set here.
m_bpAddLayer->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
m_bpDeleteLayer->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) );
Layout();
}
return retVal;
}
bool PANEL_DISPLAY_OPTIONS::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
if( m_isPCBEdit )
{
PCBNEW_SETTINGS* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" );
loadPCBSettings( cfg );
}
else
{
FOOTPRINT_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" );
loadFPSettings( cfg );
}
m_galOptsPanel->TransferDataToWindow();
return true;
}
int PANEL_DISPLAY_OPTIONS::getNextAvailableLayer() const
{
std::set<int> usedLayers;
for( int i = 0; i < m_layerNameitemsGrid->GetNumberRows(); ++i )
usedLayers.insert( (int) m_layerNameitemsGrid->GetTable()->GetValueAsLong( i, 0 ) );
for( int ii = User_1; ii < User_45; ++ii )
{
if( !usedLayers.contains( ii ) )
return ii;
}
return -1;
}
void PANEL_DISPLAY_OPTIONS::onLayerChange( wxGridEvent& event )
{
wxGridTableBase* table = m_layerNameitemsGrid->GetTable();
if( event.GetCol() == 0 )
{
int layer = static_cast<int>( table->GetValueAsLong( event.GetRow(), 0 ) );
for( int i = 0; i < m_layerNameitemsGrid->GetNumberRows(); ++i )
{
if( i != event.GetRow()
&& table->GetValueAsLong( i, 0 ) == layer )
{
table->SetValueAsLong( event.GetRow(), 0, getNextAvailableLayer() );
return;
}
}
}
for( int ii = 0; ii < m_layerNameitemsGrid->GetNumberRows(); ++ii )
{
wxString layerName = table->GetValue( ii, 1 );
if( ii != event.GetRow() && layerName == table->GetValue( event.GetRow(), 1 ) )
{
wxString msg = wxString::Format( _( "Layer name %s already in use." ), layerName );
PAGED_DIALOG::GetDialog( this )->SetError( msg, this, m_layerNameitemsGrid, ii, 1 );
return;
}
}
}
void PANEL_DISPLAY_OPTIONS::OnAddLayerItem( wxCommandEvent& event )
{
if( !m_layerNameitemsGrid->CommitPendingChanges() )
return;
wxGridTableBase* table = m_layerNameitemsGrid->GetTable();
int newRow = m_layerNameitemsGrid->GetNumberRows();
table->AppendRows( 1 );
m_layerNameitemsGrid->MakeCellVisible( newRow, 0 );
m_layerNameitemsGrid->SetGridCursor( newRow, 0 );
}
void PANEL_DISPLAY_OPTIONS::OnDeleteLayerItem( wxCommandEvent& event )
{
wxArrayInt selectedRows = m_layerNameitemsGrid->GetSelectedRows();
if( selectedRows.empty() && m_layerNameitemsGrid->GetGridCursorRow() >= 0 )
selectedRows.push_back( m_layerNameitemsGrid->GetGridCursorRow() );
if( selectedRows.empty() )
return;
if( !m_layerNameitemsGrid->CommitPendingChanges() )
return;
// Reverse sort so deleting a row doesn't change the indexes of the other rows.
selectedRows.Sort(
[]( int* first, int* second )
{
return *second - *first;
} );
for( int row : selectedRows )
{
m_layerNameitemsGrid->GetTable()->DeleteRows( row, 1 );
if( m_layerNameitemsGrid->GetNumberRows() > 0 )
{
m_layerNameitemsGrid->MakeCellVisible( std::max( 0, row - 1 ),
m_layerNameitemsGrid->GetGridCursorCol() );
m_layerNameitemsGrid->SetGridCursor( std::max( 0, row - 1 ),
m_layerNameitemsGrid->GetGridCursorCol() );
}
}
}
/*
* Update variables with new options
*/
bool PANEL_DISPLAY_OPTIONS::TransferDataFromWindow()
{
if( !m_layerNameitemsGrid->CommitPendingChanges() )
return false;
m_galOptsPanel->TransferDataFromWindow();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
if( m_isPCBEdit )
{
PCBNEW_SETTINGS* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" );
int i = m_OptDisplayTracksClearance->GetSelection();
cfg->m_Display.m_TrackClearance = UTIL::GetValFromConfig( clearanceModeMap, i );
cfg->m_Display.m_PadClearance = m_OptDisplayPadClearence->GetValue();
cfg->m_ViewersDisplay.m_DisplayPadNumbers = m_OptDisplayPadNumber->GetValue();
cfg->m_Display.m_NetNames = m_ShowNetNamesOption->GetSelection();
cfg->m_Display.m_ForceShowFieldsWhenFPSelected = m_checkForceShowFieldsWhenFPSelected->GetValue();
cfg->m_Display.m_Live3DRefresh = m_live3Drefresh->GetValue();
cfg->m_CrossProbing.on_selection = m_checkCrossProbeOnSelection->GetValue();
cfg->m_CrossProbing.center_on_items = m_checkCrossProbeCenter->GetValue();
cfg->m_CrossProbing.zoom_to_fit = m_checkCrossProbeZoom->GetValue();
cfg->m_CrossProbing.auto_highlight = m_checkCrossProbeAutoHighlight->GetValue();
}
else
{
FOOTPRINT_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" );
cfg->m_DesignSettings.m_UserLayerNames.clear();
wxGridTableBase* table = m_layerNameitemsGrid->GetTable();
for( int i = 0; i < m_layerNameitemsGrid->GetNumberRows(); ++i )
{
PCB_LAYER_ID layer = static_cast<PCB_LAYER_ID>( table->GetValueAsLong( i, 0 ) );
wxString orig_name = LSET::Name( static_cast<PCB_LAYER_ID>( layer ) );
wxString name = table->GetValue( i, 1 );
if( layer >= 0 && IsUserLayer( layer ) && !name.IsEmpty() )
cfg->m_DesignSettings.m_UserLayerNames.emplace( orig_name.ToStdString(), name );
}
}
return true;
}
void PANEL_DISPLAY_OPTIONS::ResetPanel()
{
if( m_isPCBEdit )
{
PCBNEW_SETTINGS cfg;
cfg.Load(); // Loading without a file will init to defaults
loadPCBSettings( &cfg );
m_galOptsPanel->ResetPanel( &cfg );
}
else
{
FOOTPRINT_EDITOR_SETTINGS cfg;
cfg.Load(); // Loading without a file will init to defaults
loadFPSettings( &cfg );
m_galOptsPanel->ResetPanel( &cfg );
}
}

View File

@ -18,17 +18,21 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "panel_pcb_display_options_base.h"
#include "panel_display_options_base.h"
class PCBNEW_SETTINGS;
class FOOTPRINT_EDITOR_SETTINGS;
class APP_SETTINGS_BASE;
class GAL_OPTIONS_PANEL;
class PANEL_PCB_DISPLAY_OPTIONS : public PANEL_PCB_DISPLAY_OPTIONS_BASE
class PANEL_DISPLAY_OPTIONS : public PANEL_DISPLAY_OPTIONS_BASE
{
public:
PANEL_PCB_DISPLAY_OPTIONS( wxWindow* aParent, APP_SETTINGS_BASE* aAppSettings );
PANEL_DISPLAY_OPTIONS( wxWindow* aParent, APP_SETTINGS_BASE* aAppSettings );
~PANEL_DISPLAY_OPTIONS() override;
bool Show( bool aShow ) override;
bool TransferDataFromWindow() override;
bool TransferDataToWindow() override;
@ -36,7 +40,14 @@ public:
void ResetPanel() override;
private:
void OnAddLayerItem( wxCommandEvent& event ) override;
void OnDeleteLayerItem( wxCommandEvent& event ) override;
void onLayerChange( wxGridEvent& event ) override;
void loadPCBSettings( PCBNEW_SETTINGS* aCfg );
void loadFPSettings( const FOOTPRINT_EDITOR_SETTINGS* aCfg );
int getNextAvailableLayer() const;
private:
bool m_isPCBEdit;

View File

@ -1,15 +1,18 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "panel_pcb_display_options_base.h"
#include "widgets/std_bitmap_button.h"
#include "widgets/wx_grid.h"
#include "panel_display_options_base.h"
///////////////////////////////////////////////////////////////////////////
PANEL_PCB_DISPLAY_OPTIONS_BASE::PANEL_PCB_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : RESETTABLE_PANEL( parent, id, pos, size, style, name )
PANEL_DISPLAY_OPTIONS_BASE::PANEL_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : RESETTABLE_PANEL( parent, id, pos, size, style, name )
{
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
@ -23,9 +26,70 @@ PANEL_PCB_DISPLAY_OPTIONS_BASE::PANEL_PCB_DISPLAY_OPTIONS_BASE( wxWindow* parent
bupperSizer->Add( m_galOptionsSizer, 0, wxEXPAND|wxRIGHT, 10 );
m_optionsBook = new wxSimplebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
wxPanel* emptyPage;
emptyPage = new wxPanel( m_optionsBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_optionsBook->AddPage( emptyPage, _("a page"), false );
wxPanel* fpEditorPage;
fpEditorPage = new wxPanel( m_optionsBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* fpEditorOptionsSizer;
fpEditorOptionsSizer = new wxBoxSizer( wxVERTICAL );
m_layerNamesLabel = new wxStaticText( fpEditorPage, wxID_ANY, _("Layer Names"), wxDefaultPosition, wxDefaultSize, 0 );
m_layerNamesLabel->Wrap( -1 );
fpEditorOptionsSizer->Add( m_layerNamesLabel, 0, wxTOP|wxRIGHT|wxLEFT, 13 );
fpEditorOptionsSizer->Add( 0, 3, 0, 0, 5 );
m_layerNameitemsGrid = new WX_GRID( fpEditorPage, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxTAB_TRAVERSAL );
// Grid
m_layerNameitemsGrid->CreateGrid( 0, 2 );
m_layerNameitemsGrid->EnableEditing( true );
m_layerNameitemsGrid->EnableGridLines( true );
m_layerNameitemsGrid->EnableDragGridSize( false );
m_layerNameitemsGrid->SetMargins( 0, 0 );
// Columns
m_layerNameitemsGrid->SetColSize( 0, 200 );
m_layerNameitemsGrid->SetColSize( 1, 220 );
m_layerNameitemsGrid->EnableDragColMove( false );
m_layerNameitemsGrid->EnableDragColSize( true );
m_layerNameitemsGrid->SetColLabelValue( 0, _("Layer") );
m_layerNameitemsGrid->SetColLabelValue( 1, _("Name") );
m_layerNameitemsGrid->SetColLabelSize( wxGRID_AUTOSIZE );
m_layerNameitemsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_layerNameitemsGrid->EnableDragRowSize( false );
m_layerNameitemsGrid->SetRowLabelSize( 0 );
m_layerNameitemsGrid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_layerNameitemsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
m_layerNameitemsGrid->SetMinSize( wxSize( -1,140 ) );
fpEditorOptionsSizer->Add( m_layerNameitemsGrid, 0, wxEXPAND|wxLEFT, 10 );
wxBoxSizer* bButtonSize1;
bButtonSize1 = new wxBoxSizer( wxHORIZONTAL );
m_bpAddLayer = new STD_BITMAP_BUTTON( fpEditorPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bButtonSize1->Add( m_bpAddLayer, 0, wxBOTTOM|wxLEFT|wxTOP, 5 );
bButtonSize1->Add( 20, 0, 0, 0, 5 );
m_bpDeleteLayer = new STD_BITMAP_BUTTON( fpEditorPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bButtonSize1->Add( m_bpDeleteLayer, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxTOP, 5 );
fpEditorOptionsSizer->Add( bButtonSize1, 0, wxLEFT, 5 );
fpEditorPage->SetSizer( fpEditorOptionsSizer );
fpEditorPage->Layout();
fpEditorOptionsSizer->Fit( fpEditorPage );
m_optionsBook->AddPage( fpEditorPage, _("a page"), false );
wxPanel* pcbPage;
pcbPage = new wxPanel( m_optionsBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* pcbOptionsSizer;
@ -175,8 +239,20 @@ PANEL_PCB_DISPLAY_OPTIONS_BASE::PANEL_PCB_DISPLAY_OPTIONS_BASE( wxWindow* parent
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
m_layerNameitemsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( PANEL_DISPLAY_OPTIONS_BASE::onLayerChange ), NULL, this );
m_layerNameitemsGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_DISPLAY_OPTIONS_BASE::OnGridSize ), NULL, this );
m_bpAddLayer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_DISPLAY_OPTIONS_BASE::OnAddLayerItem ), NULL, this );
m_bpDeleteLayer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_DISPLAY_OPTIONS_BASE::OnDeleteLayerItem ), NULL, this );
}
PANEL_PCB_DISPLAY_OPTIONS_BASE::~PANEL_PCB_DISPLAY_OPTIONS_BASE()
PANEL_DISPLAY_OPTIONS_BASE::~PANEL_DISPLAY_OPTIONS_BASE()
{
// Disconnect Events
m_layerNameitemsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( PANEL_DISPLAY_OPTIONS_BASE::onLayerChange ), NULL, this );
m_layerNameitemsGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_DISPLAY_OPTIONS_BASE::OnGridSize ), NULL, this );
m_bpAddLayer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_DISPLAY_OPTIONS_BASE::OnAddLayerItem ), NULL, this );
m_bpDeleteLayer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_DISPLAY_OPTIONS_BASE::OnDeleteLayerItem ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -10,15 +10,24 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class STD_BITMAP_BUTTON;
class WX_GRID;
#include "widgets/resettable_panel.h"
#include <wx/sizer.h>
#include <wx/gdicmn.h>
#include <wx/panel.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/grid.h>
#include <wx/bmpbuttn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/panel.h>
#include <wx/statline.h>
#include <wx/choice.h>
#include <wx/checkbox.h>
@ -28,15 +37,19 @@
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_PCB_DISPLAY_OPTIONS_BASE
/// Class PANEL_DISPLAY_OPTIONS_BASE
///////////////////////////////////////////////////////////////////////////////
class PANEL_PCB_DISPLAY_OPTIONS_BASE : public RESETTABLE_PANEL
class PANEL_DISPLAY_OPTIONS_BASE : public RESETTABLE_PANEL
{
private:
protected:
wxBoxSizer* m_galOptionsSizer;
wxSimplebook* m_optionsBook;
wxStaticText* m_layerNamesLabel;
WX_GRID* m_layerNameitemsGrid;
STD_BITMAP_BUTTON* m_bpAddLayer;
STD_BITMAP_BUTTON* m_bpDeleteLayer;
wxStaticText* m_annotationsLabel;
wxStaticLine* m_staticline1;
wxStaticText* m_netNamesLabel;
@ -58,11 +71,18 @@ class PANEL_PCB_DISPLAY_OPTIONS_BASE : public RESETTABLE_PANEL
wxCheckBox* m_checkCrossProbeAutoHighlight;
wxCheckBox* m_live3Drefresh;
// Virtual event handlers, override them in your derived class
virtual void onLayerChange( wxGridEvent& event ) { event.Skip(); }
virtual void OnGridSize( wxSizeEvent& event ) { event.Skip(); }
virtual void OnAddLayerItem( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteLayerItem( wxCommandEvent& event ) { event.Skip(); }
public:
PANEL_PCB_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
PANEL_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_PCB_DISPLAY_OPTIONS_BASE();
~PANEL_DISPLAY_OPTIONS_BASE();
};

View File

@ -36,109 +36,6 @@
#include <confirm.h>
class LAYER_NAMES_GRID_TABLE : public wxGridTableBase
{
std::vector<TEXT_ITEM_INFO> m_items;
public:
LAYER_NAMES_GRID_TABLE() {}
int GetNumberRows() override { return m_items.size(); }
int GetNumberCols() override { return 2; }
wxString GetColLabelValue( int aCol ) override
{
switch( aCol )
{
case 0: return _( "Layer" );
case 1: return _( "Name" );
default: return wxEmptyString;
}
}
bool CanGetValueAs( int aRow, int aCol, const wxString& aTypeName ) override
{
switch( aCol )
{
case 0: return aTypeName == wxGRID_VALUE_NUMBER;
case 1: return aTypeName == wxGRID_VALUE_STRING;
default: wxFAIL; return false;
}
}
bool CanSetValueAs( int aRow, int aCol, const wxString& aTypeName ) override
{
return CanGetValueAs( aRow, aCol, aTypeName );
}
wxString GetValue( int row, int col ) override { return m_items[row].m_Text; }
void SetValue( int row, int col, const wxString& value ) override
{
if( col == 1 )
m_items[row].m_Text = value;
}
long GetValueAsLong( int row, int col ) override { return m_items[row].m_Layer; }
void SetValueAsLong( int row, int col, long value ) override
{
if( col == 0 )
m_items[row].m_Layer = static_cast<PCB_LAYER_ID>( value );
}
bool AppendRows( size_t aNumRows = 1 ) override
{
std::set<int> layers;
int layer = User_1;
for( const TEXT_ITEM_INFO& item : m_items )
layers.insert( item.m_Layer );
for( size_t i = 0; i < aNumRows; ++i )
{
while( layers.contains( layer ) )
layer = layer + 2;
if( IsUserLayer( static_cast<PCB_LAYER_ID>( layer ) ) )
{
layers.insert( layer );
m_items.emplace_back( wxT( "" ), true, static_cast<PCB_LAYER_ID>( layer ) );
}
else
{
return false;
}
}
if( GetView() )
{
wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, aNumRows );
GetView()->ProcessTableMessage( msg );
}
return true;
}
bool DeleteRows( size_t aPos, size_t aNumRows ) override
{
// aPos may be a large positive, e.g. size_t(-1), and the sum of
// aPos+aNumRows may wrap here, so both ends of the range are tested.
if( aPos < m_items.size() && aPos + aNumRows <= m_items.size() )
{
m_items.erase( m_items.begin() + aPos, m_items.begin() + aPos + aNumRows );
if( GetView() )
{
wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aPos, aNumRows );
GetView()->ProcessTableMessage( msg );
}
return true;
}
return false;
}
};
class TEXT_ITEMS_GRID_TABLE : public wxGridTableBase
{
bool m_forFieldProps;
@ -308,22 +205,6 @@ PANEL_FP_EDITOR_FIELD_DEFAULTS::PANEL_FP_EDITOR_FIELD_DEFAULTS( wxWindow*
attr->SetRenderer( new GRID_CELL_LAYER_RENDERER( nullptr ) );
attr->SetEditor( new GRID_CELL_LAYER_SELECTOR( nullptr, {} ) );
m_textItemsGrid->SetColAttr( 1, attr );
m_layerNameitemsGrid->SetDefaultRowSize( m_layerNameitemsGrid->GetDefaultRowSize() + 4 );
m_layerNameitemsGrid->SetTable( new LAYER_NAMES_GRID_TABLE(), true );
m_layerNameitemsGrid->PushEventHandler( new GRID_TRICKS( m_layerNameitemsGrid ) );
m_layerNameitemsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
attr = new wxGridCellAttr;
attr->SetRenderer( new GRID_CELL_LAYER_RENDERER( nullptr ) );
LSET forbiddenLayers = LSET::AllCuMask() | LSET::AllTechMask();
forbiddenLayers.set( Edge_Cuts );
forbiddenLayers.set( Margin );
attr->SetEditor( new GRID_CELL_LAYER_SELECTOR( nullptr, forbiddenLayers ) );
m_layerNameitemsGrid->SetColAttr( 0, attr );
}
@ -332,7 +213,6 @@ PANEL_FP_EDITOR_FIELD_DEFAULTS::~PANEL_FP_EDITOR_FIELD_DEFAULTS()
// destroy GRID_TRICKS before grids.
m_fieldPropsGrid->PopEventHandler( true );
m_textItemsGrid->PopEventHandler( true );
m_layerNameitemsGrid->PopEventHandler( true );
}
@ -370,22 +250,6 @@ void PANEL_FP_EDITOR_FIELD_DEFAULTS::loadFPSettings( const FOOTPRINT_EDITOR_SETT
table->SetValueAsLong( i - 2, 1, item.m_Layer );
}
table = m_layerNameitemsGrid->GetTable();
for( auto& item : aCfg->m_DesignSettings.m_UserLayerNames )
{
wxString orig_name = item.first;
int layer = LSET::NameToLayer( orig_name );
if( !IsUserLayer( static_cast<PCB_LAYER_ID>( layer ) ) )
continue;
int row = m_layerNameitemsGrid->GetNumberRows();
table->AppendRows( 1 );
table->SetValueAsLong( row, 0, layer );
table->SetValue( row, 1, item.second );
}
Layout();
}
@ -411,8 +275,6 @@ bool PANEL_FP_EDITOR_FIELD_DEFAULTS::Show( bool aShow )
// first then the icons will be blank unless they're set here.
m_bpAdd->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
m_bpDelete->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) );
m_bpAddLayer->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
m_bpDeleteLayer->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) );
}
return retVal;
@ -450,85 +312,10 @@ bool PANEL_FP_EDITOR_FIELD_DEFAULTS::TransferDataFromWindow()
cfg.m_DefaultFPTextItems.emplace_back( text, true, layer );
}
cfg.m_UserLayerNames.clear();
table = m_layerNameitemsGrid->GetTable();
for( int i = 0; i < m_layerNameitemsGrid->GetNumberRows(); ++i )
{
PCB_LAYER_ID layer = static_cast<PCB_LAYER_ID>( table->GetValueAsLong( i, 0 ) );
wxString orig_name = LSET::Name( static_cast<PCB_LAYER_ID>( layer ) );
wxString name = table->GetValue( i, 1 );
if( layer >= 0 && IsUserLayer( layer ) && !name.IsEmpty() )
cfg.m_UserLayerNames.emplace( orig_name.ToStdString(), name );
}
return true;
}
bool PANEL_FP_EDITOR_FIELD_DEFAULTS::isLayerAvailable( int aLayer ) const
{
for( int i = 0; i < m_layerNameitemsGrid->GetNumberRows(); ++i )
{
if( m_layerNameitemsGrid->GetTable()->GetValueAsLong( i, 0 ) == aLayer )
return false;
}
return true;
}
int PANEL_FP_EDITOR_FIELD_DEFAULTS::getNextAvailableLayer() const
{
std::set<int> usedLayers;
for( int i = 0; i < m_layerNameitemsGrid->GetNumberRows(); ++i )
usedLayers.insert( m_layerNameitemsGrid->GetTable()->GetValueAsLong( i, 0 ) );
for( int ii = User_1; ii < User_45; ++ii )
{
if( !usedLayers.contains( ii ) )
return ii;
}
return -1;
}
void PANEL_FP_EDITOR_FIELD_DEFAULTS::onLayerChange( wxGridEvent& event )
{
wxGridTableBase* table = m_layerNameitemsGrid->GetTable();
if( event.GetCol() == 0 )
{
int layer = static_cast<int>( table->GetValueAsLong( event.GetRow(), 0 ) );
for( int i = 0; i < m_layerNameitemsGrid->GetNumberRows(); ++i )
{
if( i != event.GetRow()
&& table->GetValueAsLong( i, 0 ) == layer )
{
table->SetValueAsLong( event.GetRow(), 0, getNextAvailableLayer() );
return;
}
}
}
for( int ii = 0; ii < m_layerNameitemsGrid->GetNumberRows(); ++ii )
{
wxString layerName = table->GetValue( ii, 1 );
if( ii != event.GetRow() && layerName == table->GetValue( event.GetRow(), 1 ) )
{
wxString msg = wxString::Format( _( "Layer name %s already in use." ), layerName );
PAGED_DIALOG::GetDialog( this )->SetError( msg, this, m_layerNameitemsGrid, ii, 1 );
return;
}
}
}
void PANEL_FP_EDITOR_FIELD_DEFAULTS::OnAddTextItem( wxCommandEvent& event )
{
if( !m_textItemsGrid->CommitPendingChanges() )
@ -548,24 +335,6 @@ void PANEL_FP_EDITOR_FIELD_DEFAULTS::OnAddTextItem( wxCommandEvent& event )
}
void PANEL_FP_EDITOR_FIELD_DEFAULTS::OnAddLayerItem( wxCommandEvent& event )
{
if( !m_layerNameitemsGrid->CommitPendingChanges() )
return;
wxGridTableBase* table = m_layerNameitemsGrid->GetTable();
int newRow = m_layerNameitemsGrid->GetNumberRows();
table->AppendRows( 1 );
m_layerNameitemsGrid->MakeCellVisible( newRow, 0 );
m_layerNameitemsGrid->SetGridCursor( newRow, 0 );
m_layerNameitemsGrid->EnableCellEditControl( true );
m_layerNameitemsGrid->ShowCellEditControl();
}
void PANEL_FP_EDITOR_FIELD_DEFAULTS::OnDeleteTextItem( wxCommandEvent& event )
{
wxArrayInt selectedRows = m_textItemsGrid->GetSelectedRows();
@ -601,41 +370,6 @@ void PANEL_FP_EDITOR_FIELD_DEFAULTS::OnDeleteTextItem( wxCommandEvent& event )
}
void PANEL_FP_EDITOR_FIELD_DEFAULTS::OnDeleteLayerItem( wxCommandEvent& event )
{
wxArrayInt selectedRows = m_layerNameitemsGrid->GetSelectedRows();
if( selectedRows.empty() && m_layerNameitemsGrid->GetGridCursorRow() >= 0 )
selectedRows.push_back( m_layerNameitemsGrid->GetGridCursorRow() );
if( selectedRows.empty() )
return;
if( !m_layerNameitemsGrid->CommitPendingChanges() )
return;
// Reverse sort so deleting a row doesn't change the indexes of the other rows.
selectedRows.Sort(
[]( int* first, int* second )
{
return *second - *first;
} );
for( int row : selectedRows )
{
m_layerNameitemsGrid->GetTable()->DeleteRows( row, 1 );
if( m_layerNameitemsGrid->GetNumberRows() > 0 )
{
m_layerNameitemsGrid->MakeCellVisible( std::max( 0, row - 1 ),
m_layerNameitemsGrid->GetGridCursorCol() );
m_layerNameitemsGrid->SetGridCursor( std::max( 0, row - 1 ),
m_layerNameitemsGrid->GetGridCursorCol() );
}
}
}
void PANEL_FP_EDITOR_FIELD_DEFAULTS::ResetPanel()
{
FOOTPRINT_EDITOR_SETTINGS cfg;

View File

@ -35,26 +35,19 @@ public:
PANEL_FP_EDITOR_FIELD_DEFAULTS( wxWindow* aParent, UNITS_PROVIDER* aUnitsProvider );
~PANEL_FP_EDITOR_FIELD_DEFAULTS() override;
bool Show( bool aShow ) override;
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void ResetPanel() override;
private:
virtual void OnAddTextItem( wxCommandEvent& event ) override;
virtual void OnDeleteTextItem( wxCommandEvent& event ) override;
virtual void OnAddLayerItem( wxCommandEvent& event ) override;
virtual void OnDeleteLayerItem( wxCommandEvent& event ) override;
virtual void onLayerChange( wxGridEvent& event ) override;
bool Show( bool aShow ) override;
void OnAddTextItem( wxCommandEvent& event ) override;
void OnDeleteTextItem( wxCommandEvent& event ) override;
void loadFPSettings( const FOOTPRINT_EDITOR_SETTINGS* aCfg );
bool isLayerAvailable( int aLayerId ) const;
int getNextAvailableLayer() const;
private:
UNITS_PROVIDER* m_unitProvider;
BOARD_DESIGN_SETTINGS& m_designSettings;

View File

@ -140,73 +140,6 @@ PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE( wxWind
bSizerMargins->Add( 5, 25, 0, wxEXPAND, 5 );
defaultValuesLabel = new wxStaticText( this, wxID_ANY, _("Default Values"), wxDefaultPosition, wxDefaultSize, 0 );
defaultValuesLabel->Wrap( -1 );
bSizerMargins->Add( defaultValuesLabel, 0, wxEXPAND|wxLEFT|wxTOP, 8 );
bSizerMargins->Add( 0, 4, 0, wxEXPAND, 5 );
wxBoxSizer* defaultFieldsSizer;
defaultFieldsSizer = new wxBoxSizer( wxVERTICAL );
m_layerNameitemsGrid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxTAB_TRAVERSAL );
// Grid
m_layerNameitemsGrid->CreateGrid( 0, 2 );
m_layerNameitemsGrid->EnableEditing( true );
m_layerNameitemsGrid->EnableGridLines( true );
m_layerNameitemsGrid->EnableDragGridSize( false );
m_layerNameitemsGrid->SetMargins( 0, 0 );
// Columns
m_layerNameitemsGrid->SetColSize( 0, 200 );
m_layerNameitemsGrid->SetColSize( 1, 380 );
m_layerNameitemsGrid->EnableDragColMove( false );
m_layerNameitemsGrid->EnableDragColSize( true );
m_layerNameitemsGrid->SetColLabelValue( 0, _("Layer") );
m_layerNameitemsGrid->SetColLabelValue( 1, _("Name") );
m_layerNameitemsGrid->SetColLabelSize( wxGRID_AUTOSIZE );
m_layerNameitemsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_layerNameitemsGrid->EnableDragRowSize( false );
m_layerNameitemsGrid->SetRowLabelSize( 0 );
m_layerNameitemsGrid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_layerNameitemsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
m_layerNameitemsGrid->SetMinSize( wxSize( -1,140 ) );
defaultFieldsSizer->Add( m_layerNameitemsGrid, 0, wxEXPAND, 5 );
wxBoxSizer* bButtonSize1;
bButtonSize1 = new wxBoxSizer( wxHORIZONTAL );
m_bpAddLayer = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_bpAddLayer->SetMinSize( wxSize( 30,29 ) );
bButtonSize1->Add( m_bpAddLayer, 0, wxBOTTOM|wxLEFT|wxTOP, 5 );
bButtonSize1->Add( 20, 0, 0, wxEXPAND, 5 );
m_bpDeleteLayer = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_bpDeleteLayer->SetMinSize( wxSize( 30,29 ) );
bButtonSize1->Add( m_bpDeleteLayer, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxTOP, 5 );
bButtonSize1->Add( 0, 0, 1, wxEXPAND, 5 );
defaultFieldsSizer->Add( bButtonSize1, 1, wxEXPAND, 5 );
bSizerMargins->Add( defaultFieldsSizer, 1, wxEXPAND, 20 );
bSizerMain->Add( bSizerMargins, 1, wxEXPAND, 5 );
@ -220,10 +153,6 @@ PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE( wxWind
m_textItemsGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnGridSize ), NULL, this );
m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnAddTextItem ), NULL, this );
m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnDeleteTextItem ), NULL, this );
m_layerNameitemsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::onLayerChange ), NULL, this );
m_layerNameitemsGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnGridSize ), NULL, this );
m_bpAddLayer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnAddLayerItem ), NULL, this );
m_bpDeleteLayer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnDeleteLayerItem ), NULL, this );
}
PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::~PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE()
@ -233,9 +162,5 @@ PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::~PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE()
m_textItemsGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnGridSize ), NULL, this );
m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnAddTextItem ), NULL, this );
m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnDeleteTextItem ), NULL, this );
m_layerNameitemsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::onLayerChange ), NULL, this );
m_layerNameitemsGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnGridSize ), NULL, this );
m_bpAddLayer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnAddLayerItem ), NULL, this );
m_bpDeleteLayer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnDeleteLayerItem ), NULL, this );
}

View File

@ -616,361 +616,6 @@
<property name="width">5</property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">8</property>
<property name="flag">wxEXPAND|wxLEFT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Default Values</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">defaultValuesLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="true">
<property name="height">4</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">20</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">defaultFieldsSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxGrid" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="autosize_cols">0</property>
<property name="autosize_rows">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="cell_bg"></property>
<property name="cell_font"></property>
<property name="cell_horiz_alignment">wxALIGN_LEFT</property>
<property name="cell_text"></property>
<property name="cell_vert_alignment">wxALIGN_CENTER</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
<property name="col_label_size">wxGRID_AUTOSIZE</property>
<property name="col_label_values">&quot;Layer&quot; &quot;Name&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">2</property>
<property name="column_sizes">200,380</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="drag_col_move">0</property>
<property name="drag_col_size">1</property>
<property name="drag_grid_size">0</property>
<property name="drag_row_size">0</property>
<property name="editing">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="grid_line_color"></property>
<property name="grid_lines">1</property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label_bg"></property>
<property name="label_font"></property>
<property name="label_text"></property>
<property name="margin_height">0</property>
<property name="margin_width">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">-1,140</property>
<property name="moveable">1</property>
<property name="name">m_layerNameitemsGrid</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="row_label_horiz_alignment">wxALIGN_LEFT</property>
<property name="row_label_size">0</property>
<property name="row_label_values"></property>
<property name="row_label_vert_alignment">wxALIGN_CENTER</property>
<property name="row_sizes"></property>
<property name="rows">0</property>
<property name="show">1</property>
<property name="size">-1,-1</property>
<property name="subclass">WX_GRID; widgets/wx_grid.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<event name="OnGridCellChange">onLayerChange</event>
<event name="OnSize">OnGridSize</event>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">bButtonSize1</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Add Field</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">30,29</property>
<property name="moveable">1</property>
<property name="name">m_bpAddLayer</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnAddLayerItem</event>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="true">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">20</property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Delete Field</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">30,29</property>
<property name="moveable">1</property>
<property name="name">m_bpDeleteLayer</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnDeleteLayerItem</event>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="true">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>

View File

@ -45,18 +45,11 @@ class PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE : public RESETTABLE_PANEL
WX_GRID* m_textItemsGrid;
STD_BITMAP_BUTTON* m_bpAdd;
STD_BITMAP_BUTTON* m_bpDelete;
wxStaticText* defaultValuesLabel;
WX_GRID* m_layerNameitemsGrid;
STD_BITMAP_BUTTON* m_bpAddLayer;
STD_BITMAP_BUTTON* m_bpDeleteLayer;
// Virtual event handlers, override them in your derived class
virtual void OnGridSize( wxSizeEvent& event ) { event.Skip(); }
virtual void OnAddTextItem( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteTextItem( wxCommandEvent& event ) { event.Skip(); }
virtual void onLayerChange( wxGridEvent& event ) { event.Skip(); }
virtual void OnAddLayerItem( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteLayerItem( wxCommandEvent& event ) { event.Skip(); }
public:

View File

@ -1,124 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright The 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 as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <pcbnew_settings.h>
#include <config_map.h>
#include <panel_pcb_display_options.h>
#include <widgets/gal_options_panel.h>
static const UTIL::CFG_MAP<TRACK_CLEARANCE_MODE> clearanceModeMap =
{
{ SHOW_WITH_VIA_WHILE_ROUTING, 2 }, // Default
{ DO_NOT_SHOW_CLEARANCE, 0 },
{ SHOW_WHILE_ROUTING, 1 },
{ SHOW_WITH_VIA_WHILE_ROUTING_OR_DRAGGING, 3 },
{ SHOW_WITH_VIA_ALWAYS, 4 },
};
PANEL_PCB_DISPLAY_OPTIONS::PANEL_PCB_DISPLAY_OPTIONS( wxWindow* aParent, APP_SETTINGS_BASE* aAppSettings ) :
PANEL_PCB_DISPLAY_OPTIONS_BASE( aParent ),
m_isPCBEdit( dynamic_cast<PCBNEW_SETTINGS*>( aAppSettings ) != nullptr )
{
m_galOptsPanel = new GAL_OPTIONS_PANEL( this, aAppSettings );
m_galOptionsSizer->Add( m_galOptsPanel, 1, wxEXPAND|wxRIGHT, 15 );
m_optionsBook->SetSelection( m_isPCBEdit ? 1 : 0 );
}
void PANEL_PCB_DISPLAY_OPTIONS::loadPCBSettings( PCBNEW_SETTINGS* aCfg )
{
int i = UTIL::GetConfigForVal( clearanceModeMap, aCfg->m_Display.m_TrackClearance );
m_OptDisplayTracksClearance->SetSelection( i );
m_OptDisplayPadClearence->SetValue( aCfg->m_Display.m_PadClearance );
m_OptDisplayPadNumber->SetValue( aCfg->m_ViewersDisplay.m_DisplayPadNumbers );
m_ShowNetNamesOption->SetSelection( aCfg->m_Display.m_NetNames );
m_checkForceShowFieldsWhenFPSelected->SetValue( aCfg->m_Display.m_ForceShowFieldsWhenFPSelected );
m_live3Drefresh->SetValue( aCfg->m_Display.m_Live3DRefresh );
m_checkCrossProbeOnSelection->SetValue( aCfg->m_CrossProbing.on_selection );
m_checkCrossProbeCenter->SetValue( aCfg->m_CrossProbing.center_on_items );
m_checkCrossProbeZoom->SetValue( aCfg->m_CrossProbing.zoom_to_fit );
m_checkCrossProbeAutoHighlight->SetValue( aCfg->m_CrossProbing.auto_highlight );
}
bool PANEL_PCB_DISPLAY_OPTIONS::TransferDataToWindow()
{
if( m_isPCBEdit )
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
PCBNEW_SETTINGS* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" );
loadPCBSettings( cfg );
}
m_galOptsPanel->TransferDataToWindow();
return true;
}
/*
* Update variables with new options
*/
bool PANEL_PCB_DISPLAY_OPTIONS::TransferDataFromWindow()
{
m_galOptsPanel->TransferDataFromWindow();
if( m_isPCBEdit )
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
PCBNEW_SETTINGS* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" );
int i = m_OptDisplayTracksClearance->GetSelection();
cfg->m_Display.m_TrackClearance = UTIL::GetValFromConfig( clearanceModeMap, i );
cfg->m_Display.m_PadClearance = m_OptDisplayPadClearence->GetValue();
cfg->m_ViewersDisplay.m_DisplayPadNumbers = m_OptDisplayPadNumber->GetValue();
cfg->m_Display.m_NetNames = m_ShowNetNamesOption->GetSelection();
cfg->m_Display.m_ForceShowFieldsWhenFPSelected = m_checkForceShowFieldsWhenFPSelected->GetValue();
cfg->m_Display.m_Live3DRefresh = m_live3Drefresh->GetValue();
cfg->m_CrossProbing.on_selection = m_checkCrossProbeOnSelection->GetValue();
cfg->m_CrossProbing.center_on_items = m_checkCrossProbeCenter->GetValue();
cfg->m_CrossProbing.zoom_to_fit = m_checkCrossProbeZoom->GetValue();
cfg->m_CrossProbing.auto_highlight = m_checkCrossProbeAutoHighlight->GetValue();
}
return true;
}
void PANEL_PCB_DISPLAY_OPTIONS::ResetPanel()
{
PCBNEW_SETTINGS cfg;
cfg.Load(); // Loading without a file will init to defaults
if( m_isPCBEdit )
loadPCBSettings( &cfg );
m_galOptsPanel->ResetPanel( &cfg );
}

File diff suppressed because it is too large Load Diff

View File

@ -1447,6 +1447,8 @@ void FOOTPRINT_EDIT_FRAME::CommonSettingsChanged( int aFlags )
GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
GetBoard()->GetDesignSettings() = cfg->m_DesignSettings;
GetBoard()->SetCopperLayerCount( 3 );
GetBoard()->SetLayerName( In1_Cu, _( "Inner layers" ) );
GetCanvas()->GetView()->UpdateAllLayersColor();
GetCanvas()->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );

View File

@ -49,7 +49,7 @@
#include <dialogs/dialog_configure_paths.h>
#include <dialogs/panel_grid_settings.h>
#include <dialog_global_fp_lib_table_config.h>
#include <panel_pcb_display_options.h>
#include <panel_display_options.h>
#include <panel_edit_options.h>
#include <panel_fp_editor_field_defaults.h>
#include <panel_fp_editor_graphics_defaults.h>
@ -157,7 +157,7 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
FOOTPRINT_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" );
return new PANEL_PCB_DISPLAY_OPTIONS( aParent, cfg );
return new PANEL_DISPLAY_OPTIONS( aParent, cfg );
}
case PANEL_FP_GRIDS:
@ -260,7 +260,7 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
PCBNEW_SETTINGS* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" );
return new PANEL_PCB_DISPLAY_OPTIONS( aParent, cfg );
return new PANEL_DISPLAY_OPTIONS( aParent, cfg );
}
case PANEL_PCB_GRIDS:

View File

@ -33,6 +33,7 @@
#include <pcb_edit_frame.h>
#include <pcb_painter.h>
#include <pcbnew_settings.h>
#include <footprint_editor_settings.h>
#include <project.h>
#include <project/project_local_settings.h>
#include <settings/color_settings.h>
@ -60,6 +61,7 @@
#include <wx/textdlg.h>
#include <wx/bmpbuttn.h> // needed on wxMSW for OnSetFocus()
#include <core/profile.h>
#include <pgm_base.h>
NET_GRID_TABLE::NET_GRID_TABLE( PCB_BASE_FRAME* aFrame, wxColor aBackgroundColor ) :
@ -1549,6 +1551,9 @@ void APPEARANCE_CONTROLS::rebuildLayers()
COLOR4D bgColor = theme->GetColor( LAYER_PCB_BACKGROUND );
bool readOnly = theme->IsReadOnly();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
FOOTPRINT_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" );
#ifdef __WXMAC__
wxSizerItem* m_windowLayersSizerItem = m_panelLayersSizer->GetItem( m_windowLayers );
m_windowLayersSizerItem->SetFlag( m_windowLayersSizerItem->GetFlag() & ~wxTOP );
@ -1578,9 +1583,10 @@ void APPEARANCE_CONTROLS::rebuildLayers()
swatch->SetToolTip( _( "Double click or middle click for color change, "
"right click for menu" ) );
BITMAP_TOGGLE* btn_visible = new BITMAP_TOGGLE(
panel, layer, KiBitmapBundle( BITMAPS::visibility ),
KiBitmapBundle( BITMAPS::visibility_off ), aSetting->visible );
BITMAP_TOGGLE* btn_visible = new BITMAP_TOGGLE( panel, layer,
KiBitmapBundle( BITMAPS::visibility ),
KiBitmapBundle( BITMAPS::visibility_off ),
aSetting->visible );
btn_visible->SetToolTip( _( "Show or hide this layer" ) );
wxStaticText* label = new wxStaticText( panel, layer, aSetting->label );
@ -1799,7 +1805,20 @@ void APPEARANCE_CONTROLS::rebuildLayers()
std::unique_ptr<APPEARANCE_SETTING>& setting = *layer_it;
setting->label = board->GetLayerName( layer );
if( m_isFpEditor )
{
wxString canonicalName = LSET::Name( static_cast<PCB_LAYER_ID>( layer ) );
if( cfg->m_DesignSettings.m_UserLayerNames.contains( canonicalName.ToStdString() ) )
setting->label = cfg->m_DesignSettings.m_UserLayerNames[canonicalName.ToStdString()];
else
setting->label = board->GetStandardLayerName( layer );
}
else
{
setting->label = board->GetLayerName( layer );
}
setting->id = layer;
// Because non_cu_seq is created static, we must explicitly call wxGetTranslation for
// texts which are internationalized