Use a list dialog that can be parented by the Board Setup dialog.
(The current one keeps pulling the Kicad Manager window to the front on OSX.) I also removed the UpdateUI stuff which was probably causing: Fixes https://gitlab.com/kicad/code/kicad/issues/5049
This commit is contained in:
parent
0dfb5fcaf9
commit
0f27618125
|
@ -32,21 +32,22 @@
|
|||
// wxWidgets spends *far* too long calcuating column widths (most of it, believe it or
|
||||
// not, in repeatedly creating/destroying a wxDC to do the measurement in).
|
||||
// Use default column widths instead.
|
||||
static int DEFAULT_SINGLE_COL_WIDTH = 260;
|
||||
static int DEFAULT_COL_WIDTHS[] = { 200, 600 };
|
||||
|
||||
|
||||
|
||||
EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle,
|
||||
EDA_LIST_DIALOG::EDA_LIST_DIALOG( wxWindow* aParent, const wxString& aTitle,
|
||||
const wxArrayString& aItemHeaders,
|
||||
const std::vector<wxArrayString>& aItemList,
|
||||
const wxString& aSelection ) :
|
||||
const wxString& aPreselectText ) :
|
||||
EDA_LIST_DIALOG_BASE( aParent, wxID_ANY, aTitle )
|
||||
{
|
||||
m_itemsList = &aItemList;
|
||||
|
||||
m_filterBox->SetHint( _( "Filter" ) );
|
||||
|
||||
initDialog( aItemHeaders, aSelection );
|
||||
initDialog( aItemHeaders, aPreselectText );
|
||||
|
||||
// DIALOG_SHIM needs a unique hash_key because classname is not sufficient
|
||||
// because so many dialogs share this same class, with different numbers of
|
||||
|
@ -65,10 +66,18 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
|
|||
|
||||
void EDA_LIST_DIALOG::initDialog( const wxArrayString& aItemHeaders, const wxString& aSelection )
|
||||
{
|
||||
for( unsigned i = 0; i < aItemHeaders.Count(); i++ )
|
||||
if( aItemHeaders.Count() == 1 )
|
||||
{
|
||||
m_listBox->InsertColumn( i, aItemHeaders.Item( i ),
|
||||
wxLIST_FORMAT_LEFT, DEFAULT_COL_WIDTHS[ i ] );
|
||||
m_listBox->InsertColumn( 0, aItemHeaders.Item( 0 ), wxLIST_FORMAT_LEFT,
|
||||
DEFAULT_SINGLE_COL_WIDTH );
|
||||
}
|
||||
else
|
||||
{
|
||||
for( unsigned i = 0; i < aItemHeaders.Count(); i++ )
|
||||
{
|
||||
m_listBox->InsertColumn( i, aItemHeaders.Item( i ), wxLIST_FORMAT_LEFT,
|
||||
DEFAULT_COL_WIDTHS[ i ] );
|
||||
}
|
||||
}
|
||||
|
||||
InsertItems( *m_itemsList, 0 );
|
||||
|
@ -103,6 +112,12 @@ void EDA_LIST_DIALOG::SetOKLabel( const wxString& aLabel )
|
|||
}
|
||||
|
||||
|
||||
void EDA_LIST_DIALOG::HideFilter()
|
||||
{
|
||||
m_filterBox->Hide();
|
||||
}
|
||||
|
||||
|
||||
void EDA_LIST_DIALOG::textChangeInFilterBox( wxCommandEvent& event )
|
||||
{
|
||||
wxString filter;
|
||||
|
@ -124,6 +139,12 @@ void EDA_LIST_DIALOG::textChangeInFilterBox( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
long EDA_LIST_DIALOG::GetSelection()
|
||||
{
|
||||
return m_listBox->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
|
||||
}
|
||||
|
||||
|
||||
wxString EDA_LIST_DIALOG::GetTextSelection( int aColumn )
|
||||
{
|
||||
wxCHECK_MSG( unsigned( aColumn ) < unsigned( m_listBox->GetColumnCount() ), wxEmptyString,
|
||||
|
|
|
@ -23,8 +23,8 @@ EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, con
|
|||
m_listLabel->Wrap( -1 );
|
||||
bMargins->Add( m_listLabel, 0, wxALL, 5 );
|
||||
|
||||
m_listBox = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES|wxALWAYS_SHOW_SB|wxBORDER_SIMPLE|wxVSCROLL );
|
||||
m_listBox->SetMinSize( wxSize( -1,200 ) );
|
||||
m_listBox = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES|wxBORDER_SIMPLE|wxVSCROLL );
|
||||
m_listBox->SetMinSize( wxSize( 280,150 ) );
|
||||
|
||||
bMargins->Add( m_listBox, 3, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
|
@ -32,7 +32,7 @@ EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, con
|
|||
bMargins->Add( m_filterBox, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( bMargins, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
bSizerMain->Add( bMargins, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_sdbSizer = new wxStdDialogButtonSizer();
|
||||
m_sdbSizerOK = new wxButton( this, wxID_OK );
|
||||
|
@ -41,7 +41,7 @@ EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, con
|
|||
m_sdbSizer->AddButton( m_sdbSizerCancel );
|
||||
m_sdbSizer->Realize();
|
||||
|
||||
bSizerMain->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 );
|
||||
bSizerMain->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizerMain );
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -165,7 +165,7 @@
|
|||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">-1,200</property>
|
||||
<property name="minimum_size">280,150</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_listBox</property>
|
||||
<property name="pane_border">1</property>
|
||||
|
@ -187,7 +187,7 @@
|
|||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxALWAYS_SHOW_SB|wxBORDER_SIMPLE|wxVSCROLL</property>
|
||||
<property name="window_style">wxBORDER_SIMPLE|wxVSCROLL</property>
|
||||
<event name="OnListItemActivated">onListItemActivated</event>
|
||||
</object>
|
||||
</object>
|
||||
|
@ -260,7 +260,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStdDialogButtonSizer" expanded="1">
|
||||
<property name="Apply">0</property>
|
||||
|
|
|
@ -55,15 +55,15 @@ public:
|
|||
* @param aTitle The title shown on top.
|
||||
* @param aItemHeaders an optional array containing the column header names for the dialog.
|
||||
* @param aItemList A wxArrayString of the list of elements.
|
||||
* @param aRefText An item name if an item must be preselected.
|
||||
* @param aPreselectText An item name if an item must be preselected.
|
||||
*/
|
||||
EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle,
|
||||
const wxArrayString& aItemHeaders,
|
||||
EDA_LIST_DIALOG( wxWindow* aParent, const wxString& aTitle, const wxArrayString& aItemHeaders,
|
||||
const std::vector<wxArrayString>& aItemList,
|
||||
const wxString& aRefText );
|
||||
const wxString& aPreselectText = wxEmptyString );
|
||||
|
||||
void SetListLabel( const wxString& aLabel );
|
||||
void SetOKLabel( const wxString& aLabel );
|
||||
void HideFilter();
|
||||
|
||||
void Append( const wxArrayString& aItemStr );
|
||||
void InsertItems( const std::vector<wxArrayString>& aItemList, int aPosition = 0 );
|
||||
|
@ -76,6 +76,8 @@ public:
|
|||
*/
|
||||
wxString GetTextSelection( int aColumn = 0 );
|
||||
|
||||
long GetSelection();
|
||||
|
||||
private:
|
||||
void onListItemActivated( wxListEvent& event ) override;
|
||||
void textChangeInFilterBox(wxCommandEvent& event) override;
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <convert_to_biu.h>
|
||||
#include <macros.h> // arrayDim definition
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <board.h>
|
||||
|
@ -43,11 +42,11 @@
|
|||
#include "dialog_dielectric_list_manager.h"
|
||||
#include <wx/wupdlock.h>
|
||||
#include <wx/richmsgdlg.h>
|
||||
#include <wx/choicdlg.h>
|
||||
#include <wx/dcclient.h>
|
||||
#include <wx/treebook.h>
|
||||
|
||||
#include <locale_io.h>
|
||||
#include <dialog_helpers.h>
|
||||
|
||||
// Some wx widget ID to know what widget has fired a event:
|
||||
#define ID_INCREMENT 256 // space between 2 ID type. Bigger than the layer count max
|
||||
|
@ -96,12 +95,12 @@ PANEL_SETUP_BOARD_STACKUP::PANEL_SETUP_BOARD_STACKUP( PAGED_DIALOG* aParent, PCB
|
|||
|
||||
// Calculates a good size for wxTextCtrl to enter Epsilon R and Loss tan
|
||||
// ("0.000000" + margins)
|
||||
m_numericFieldsSize = dc.GetTextExtent( "X.XXXXXXX" );
|
||||
m_numericFieldsSize = dc.GetTextExtent( "X.XXXXXX" );
|
||||
m_numericFieldsSize.y = -1; // Use default for the vertical size
|
||||
|
||||
// Calculates a minimal size for wxTextCtrl to enter a dim with units
|
||||
// ("000.0000000 mils" + margins)
|
||||
m_numericTextCtrlSize = dc.GetTextExtent( "XXX.XXXXXXX mils" );
|
||||
m_numericTextCtrlSize = dc.GetTextExtent( "XXX.XXXXXX mils" );
|
||||
m_numericTextCtrlSize.y = -1; // Use default for the vertical size
|
||||
|
||||
// The grid column containing the lock checkbox is kept to a minimal
|
||||
|
@ -143,33 +142,42 @@ void PANEL_SETUP_BOARD_STACKUP::disconnectEvents()
|
|||
wxBitmapComboBox* cb = dynamic_cast<wxBitmapComboBox*>( item );
|
||||
|
||||
if( cb )
|
||||
{
|
||||
cb->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED,
|
||||
wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP::onColorSelected ),
|
||||
NULL, this );
|
||||
}
|
||||
|
||||
wxButton* matButt = dynamic_cast<wxButton*>( item );
|
||||
|
||||
if( matButt )
|
||||
{
|
||||
matButt->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED,
|
||||
wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP::onMaterialChange ),
|
||||
NULL, this );
|
||||
}
|
||||
|
||||
wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( item );
|
||||
|
||||
if( textCtrl )
|
||||
{
|
||||
textCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED,
|
||||
wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP::onThicknessChange ),
|
||||
NULL, this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PANEL_SETUP_BOARD_STACKUP::onAddDielectricLayer( wxCommandEvent& event )
|
||||
{
|
||||
wxArrayString headers;
|
||||
headers.Add( _( "Layers" ) );
|
||||
|
||||
// Build Dielectric layers list:
|
||||
wxArrayString d_list;
|
||||
std::vector<int> rows; // indexes of row values for each selectable item
|
||||
int row = -1;
|
||||
std::vector<wxArrayString> d_list;
|
||||
std::vector<int> rows; // indexes of row values for each selectable item
|
||||
int row = -1;
|
||||
|
||||
for( BOARD_STACKUP_ROW_UI_ITEM& item : m_rowUiItemsList )
|
||||
{
|
||||
|
@ -182,49 +190,56 @@ void PANEL_SETUP_BOARD_STACKUP::onAddDielectricLayer( wxCommandEvent& event )
|
|||
|
||||
if( brd_stackup_item->GetType() == BS_ITEM_TYPE_DIELECTRIC )
|
||||
{
|
||||
wxArrayString d_item;
|
||||
|
||||
if( brd_stackup_item->GetSublayersCount() > 1 )
|
||||
{
|
||||
d_list.Add( wxString::Format( _( "Layer \"%s\" (sublayer %d/%d)" ),
|
||||
brd_stackup_item->FormatDielectricLayerName(),
|
||||
item.m_SubItem+1, brd_stackup_item->GetSublayersCount() ) );
|
||||
d_item.Add( wxString::Format( _( "Layer '%s' (sublayer %d/%d)" ),
|
||||
brd_stackup_item->FormatDielectricLayerName(),
|
||||
item.m_SubItem+1,
|
||||
brd_stackup_item->GetSublayersCount() ) );
|
||||
}
|
||||
else
|
||||
d_list.Add( brd_stackup_item->FormatDielectricLayerName() );
|
||||
{
|
||||
d_item.Add( brd_stackup_item->FormatDielectricLayerName() );
|
||||
}
|
||||
|
||||
d_list.emplace_back( d_item );
|
||||
rows.push_back( row );
|
||||
}
|
||||
}
|
||||
|
||||
// Show list
|
||||
int index = wxGetSingleChoiceIndex( _( "Select dielectric layer to add to board stack up." ),
|
||||
_("Dielectric Layers List"),
|
||||
d_list);
|
||||
EDA_LIST_DIALOG dlg( m_parentDialog, _( "Add Dielectric Layer" ), headers, d_list );
|
||||
dlg.SetListLabel( _( "Select layer to add:" ) );
|
||||
dlg.HideFilter();
|
||||
|
||||
if( index < 0 )
|
||||
return;
|
||||
if( dlg.ShowModal() == wxID_OK && dlg.GetSelection() >= 0 )
|
||||
{
|
||||
row = rows[ dlg.GetSelection() ];
|
||||
|
||||
row = rows[index];
|
||||
BOARD_STACKUP_ITEM* brd_stackup_item = m_rowUiItemsList[row].m_Item;
|
||||
int new_sublayer = m_rowUiItemsList[row].m_SubItem;
|
||||
|
||||
BOARD_STACKUP_ITEM* brd_stackup_item = m_rowUiItemsList[row].m_Item;
|
||||
int new_sublayer = m_rowUiItemsList[row].m_SubItem;
|
||||
// Insert a new item after the selected item
|
||||
brd_stackup_item->AddDielectricPrms( new_sublayer+1 );
|
||||
|
||||
// Insert a new item after the selected item
|
||||
brd_stackup_item->AddDielectricPrms( new_sublayer+1 );
|
||||
|
||||
rebuildLayerStackPanel();
|
||||
computeBoardThickness();
|
||||
rebuildLayerStackPanel();
|
||||
computeBoardThickness();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PANEL_SETUP_BOARD_STACKUP::onRemoveDielectricLayer( wxCommandEvent& event )
|
||||
{
|
||||
wxArrayString headers;
|
||||
headers.Add( _( "Layers" ) );
|
||||
|
||||
// Build deletable Dielectric layers list.
|
||||
// A layer can be deleted if there are 2 (or more) dielectric sub-layers
|
||||
// between 2 copper layers
|
||||
wxArrayString d_list;
|
||||
std::vector<int> rows; // indexes of row values for each selectable item
|
||||
|
||||
int ui_row = 0; // The row index in m_rowUiItemsList of items in choice list
|
||||
std::vector<wxArrayString> d_list;
|
||||
std::vector<int> rows; // indexes of row values for each selectable item
|
||||
int row = 0; // row index in m_rowUiItemsList of items in choice list
|
||||
|
||||
// Build the list of dielectric layers:
|
||||
for( BOARD_STACKUP_ITEM* item : m_stackup.GetList() )
|
||||
|
@ -232,38 +247,40 @@ void PANEL_SETUP_BOARD_STACKUP::onRemoveDielectricLayer( wxCommandEvent& event )
|
|||
if( !item->IsEnabled() || item->GetType() != BS_ITEM_TYPE_DIELECTRIC ||
|
||||
item->GetSublayersCount() <= 1 )
|
||||
{
|
||||
ui_row++;
|
||||
row++;
|
||||
continue;
|
||||
}
|
||||
|
||||
for( int ii = 0; ii < item->GetSublayersCount(); ii++ )
|
||||
{
|
||||
d_list.Add( wxString::Format( "Layer \"%s\" sublayer %d/%d",
|
||||
item->FormatDielectricLayerName(), ii+1,
|
||||
item->GetSublayersCount() ) );
|
||||
wxArrayString d_item;
|
||||
|
||||
rows.push_back( ui_row++ );
|
||||
d_item.Add( wxString::Format( _( "Layer '%s' sublayer %d/%d" ),
|
||||
item->FormatDielectricLayerName(),
|
||||
ii+1,
|
||||
item->GetSublayersCount() ) );
|
||||
|
||||
d_list.emplace_back( d_item );
|
||||
rows.push_back( row++ );
|
||||
}
|
||||
}
|
||||
|
||||
// Show choice list
|
||||
int index = wxGetSingleChoiceIndex( _( "Select dielectric layer to remove from board stack up." ),
|
||||
_( "Dielectric Layers" ),
|
||||
d_list );
|
||||
EDA_LIST_DIALOG dlg( m_parentDialog, _( "Remove Dielectric Layer" ), headers, d_list );
|
||||
dlg.SetListLabel( _( "Select layer to remove:" ) );
|
||||
dlg.HideFilter();
|
||||
|
||||
if( index < 0 )
|
||||
return;
|
||||
if( dlg.ShowModal() == wxID_OK && dlg.GetSelection() >= 0 )
|
||||
{
|
||||
row = rows[ dlg.GetSelection() ];
|
||||
BOARD_STACKUP_ITEM* brd_stackup_item = m_rowUiItemsList[ row ].m_Item;
|
||||
int sublayer = m_rowUiItemsList[ row ].m_SubItem;
|
||||
|
||||
ui_row = rows[index];
|
||||
// Remove the selected sub item for the selected dielectric layer
|
||||
brd_stackup_item->RemoveDielectricPrms( sublayer );
|
||||
|
||||
BOARD_STACKUP_ITEM* brd_stackup_item = m_rowUiItemsList[ui_row].m_Item;
|
||||
int sublayer = m_rowUiItemsList[ui_row].m_SubItem;
|
||||
|
||||
// Remove the selected sub item for the selected dielectric layer
|
||||
brd_stackup_item->RemoveDielectricPrms( sublayer );
|
||||
|
||||
rebuildLayerStackPanel();
|
||||
computeBoardThickness();
|
||||
rebuildLayerStackPanel();
|
||||
computeBoardThickness();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,10 +42,10 @@ PANEL_SETUP_BOARD_STACKUP_BASE::PANEL_SETUP_BOARD_STACKUP_BASE( wxWindow* parent
|
|||
|
||||
bTopSizer->Add( 40, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_buttonAddDielectricLayer = new wxButton( this, wxID_ANY, _("Add Dielectric Layer"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_buttonAddDielectricLayer = new wxButton( this, wxID_ANY, _("Add Dielectric Layer..."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bTopSizer->Add( m_buttonAddDielectricLayer, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_buttonRemoveDielectricLayer = new wxButton( this, wxID_ANY, _("Remove Dielectric Layer"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_buttonRemoveDielectricLayer = new wxButton( this, wxID_ANY, _("Remove Dielectric Layer..."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bTopSizer->Add( m_buttonRemoveDielectricLayer, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
|
|
|
@ -309,7 +309,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Add Dielectric Layer</property>
|
||||
<property name="label">Add Dielectric Layer...</property>
|
||||
<property name="margins"></property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
|
@ -382,7 +382,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Remove Dielectric Layer</property>
|
||||
<property name="label">Remove Dielectric Layer...</property>
|
||||
<property name="margins"></property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include <wx/choicdlg.h>
|
||||
#include <wx/treebook.h>
|
||||
#include <dialog_helpers.h>
|
||||
|
||||
|
||||
// some define to choose how copper layers widgets are shown
|
||||
|
@ -790,20 +791,44 @@ bool PANEL_SETUP_LAYERS::CheckCopperLayerCount( BOARD* aWorkingBoard, BOARD* aIm
|
|||
|
||||
void PANEL_SETUP_LAYERS::addUserDefinedLayer( wxCommandEvent& aEvent )
|
||||
{
|
||||
LSEQ seq;
|
||||
wxArrayString availableUserDefinedLayers = getAvailableUserDefinedLayers();
|
||||
wxArrayString headers;
|
||||
headers.Add( _( "Layers" ) );
|
||||
|
||||
wxCHECK( !availableUserDefinedLayers.IsEmpty(), /* void */ );
|
||||
// Build the available user-defined layers list:
|
||||
std::vector<wxArrayString> list;
|
||||
|
||||
wxSingleChoiceDialog dlg( this, _( "Select user defined layer to add to board layer set" ),
|
||||
_( "Select Layer" ), availableUserDefinedLayers );
|
||||
for( LSEQ seq = LSET::UserDefinedLayers().Seq(); seq; ++seq )
|
||||
{
|
||||
wxCheckBox* checkBox = getCheckBox( *seq );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL || dlg.GetStringSelection().IsEmpty() )
|
||||
if( checkBox && checkBox->IsShown() )
|
||||
continue;
|
||||
|
||||
wxArrayString available_user_layer;
|
||||
available_user_layer.Add( LayerName( *seq ) );
|
||||
|
||||
list.emplace_back( available_user_layer );
|
||||
}
|
||||
|
||||
if( list.empty() )
|
||||
{
|
||||
DisplayErrorMessage( m_parentDialog,
|
||||
_( "All user-defined layers have already been added." ) );
|
||||
return;
|
||||
}
|
||||
|
||||
EDA_LIST_DIALOG dlg( m_parentDialog, _( "Add User-defined Layer" ), headers, list );
|
||||
dlg.SetListLabel( _( "Select layer to add:" ) );
|
||||
dlg.HideFilter();
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL || dlg.GetTextSelection().IsEmpty() )
|
||||
return;
|
||||
|
||||
LSEQ seq;
|
||||
|
||||
for( seq = LSET::UserDefinedLayers().Seq(); seq; ++seq )
|
||||
{
|
||||
if( LayerName( *seq ) == dlg.GetStringSelection() )
|
||||
if( LayerName( *seq ) == dlg.GetTextSelection() )
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -830,27 +855,3 @@ void PANEL_SETUP_LAYERS::addUserDefinedLayer( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void PANEL_SETUP_LAYERS::onUpdateAddUserDefinedLayer( wxUpdateUIEvent& event )
|
||||
{
|
||||
wxArrayString availableUserDefinedLayers = getAvailableUserDefinedLayers();
|
||||
|
||||
event.Enable( !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;
|
||||
}
|
||||
|
|
|
@ -110,8 +110,6 @@ private:
|
|||
bool TransferDataFromWindow() override;
|
||||
virtual void addUserDefinedLayer( wxCommandEvent& aEvent ) override;
|
||||
|
||||
virtual void onUpdateAddUserDefinedLayer( wxUpdateUIEvent& event ) override;
|
||||
|
||||
bool testLayerNames();
|
||||
|
||||
/**
|
||||
|
@ -124,8 +122,6 @@ private:
|
|||
*/
|
||||
LSEQ getNonRemovableLayers();
|
||||
|
||||
wxArrayString getAvailableUserDefinedLayers();
|
||||
|
||||
PANEL_SETUP_LAYERS_CTLs getCTLs( LAYER_NUM aLayerNumber );
|
||||
wxControl* getName( LAYER_NUM aLayer );
|
||||
wxCheckBox* getCheckBox( LAYER_NUM aLayer );
|
||||
|
|
|
@ -23,7 +23,7 @@ PANEL_SETUP_LAYERS_BASE::PANEL_SETUP_LAYERS_BASE( wxWindow* parent, wxWindowID i
|
|||
|
||||
bSizerLayerCnt->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_addUserDefinedLayerButton = new wxButton( this, wxID_ANY, _("Add User Defined Layer"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_addUserDefinedLayerButton = new wxButton( this, wxID_ANY, _("Add User Defined Layer..."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerLayerCnt->Add( m_addUserDefinedLayerButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
|
||||
|
@ -46,6 +46,8 @@ PANEL_SETUP_LAYERS_BASE::PANEL_SETUP_LAYERS_BASE( wxWindow* parent, wxWindowID i
|
|||
m_LayerListFlexGridSizer->Add( m_CrtYdFrontCheckBox, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxLEFT, 5 );
|
||||
|
||||
m_CrtYdFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, _("CrtYd_Front"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_CrtYdFrontName->SetMinSize( wxSize( 160,-1 ) );
|
||||
|
||||
m_LayerListFlexGridSizer->Add( m_CrtYdFrontName, 0, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
m_CrtYdFrontStaticText = new wxStaticText( m_LayersListPanel, ID_CRTYDFRONTCHOICE, _("Off-board, testing"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
@ -814,7 +816,6 @@ PANEL_SETUP_LAYERS_BASE::PANEL_SETUP_LAYERS_BASE( wxWindow* parent, wxWindowID i
|
|||
|
||||
// Connect Events
|
||||
m_addUserDefinedLayerButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::addUserDefinedLayer ), NULL, this );
|
||||
m_addUserDefinedLayerButton->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SETUP_LAYERS_BASE::onUpdateAddUserDefinedLayer ), NULL, this );
|
||||
m_CrtYdFrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
|
||||
m_FabFrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_AdhesFrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
|
@ -880,7 +881,6 @@ PANEL_SETUP_LAYERS_BASE::~PANEL_SETUP_LAYERS_BASE()
|
|||
{
|
||||
// Disconnect Events
|
||||
m_addUserDefinedLayerButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::addUserDefinedLayer ), NULL, this );
|
||||
m_addUserDefinedLayerButton->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SETUP_LAYERS_BASE::onUpdateAddUserDefinedLayer ), NULL, this );
|
||||
m_CrtYdFrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
|
||||
m_FabFrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
m_AdhesFrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
|
||||
|
|
|
@ -119,7 +119,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Add User Defined Layer</property>
|
||||
<property name="label">Add User Defined Layer...</property>
|
||||
<property name="margins"></property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
|
@ -153,7 +153,6 @@
|
|||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">addUserDefinedLayer</event>
|
||||
<event name="OnUpdateUI">onUpdateAddUserDefinedLayer</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
@ -388,7 +387,7 @@
|
|||
<property name="maxlength"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="minimum_size">160,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_CrtYdFrontName</property>
|
||||
<property name="pane_border">1</property>
|
||||
|
|
|
@ -353,7 +353,6 @@ class PANEL_SETUP_LAYERS_BASE : public wxPanel
|
|||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void addUserDefinedLayer( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onUpdateAddUserDefinedLayer( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
virtual void DenyChangeCheckBox( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnCheckBox( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
|
|
@ -2359,7 +2359,7 @@ void APPEARANCE_CONTROLS::onLayerPresetChanged( wxCommandEvent& aEvent )
|
|||
}
|
||||
}
|
||||
|
||||
EDA_LIST_DIALOG dlg( m_frame, _( "Delete Preset" ), headers, items, wxEmptyString );
|
||||
EDA_LIST_DIALOG dlg( m_frame, _( "Delete Preset" ), headers, items );
|
||||
dlg.SetListLabel( _( "Select preset:" ) );
|
||||
|
||||
if( dlg.ShowModal() == wxID_OK )
|
||||
|
|
Loading…
Reference in New Issue