53 case 0:
return _(
"Layer" );
54 case 1:
return _(
"Name" );
55 default:
return wxEmptyString;
59 bool CanGetValueAs(
int aRow,
int aCol,
const wxString& aTypeName )
override
63 case 0:
return aTypeName == wxGRID_VALUE_NUMBER;
64 case 1:
return aTypeName == wxGRID_VALUE_STRING;
65 default: wxFAIL;
return false;
69 bool CanSetValueAs(
int aRow,
int aCol,
const wxString& aTypeName )
override
75 void SetValue(
int row,
int col,
const wxString& value )
override
94 layers.insert( item.m_Layer );
96 for(
size_t i = 0; i < aNumRows; ++i )
98 while( layers.contains( layer ) )
103 layers.insert( layer );
114 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, aNumRows );
115 GetView()->ProcessTableMessage( msg );
131 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aPos, aNumRows );
132 GetView()->ProcessTableMessage( msg );
159 wxGridCellAttr* attr =
new wxGridCellAttr;
167 attr =
new wxGridCellAttr;
195 wxString orig_name = canonicalName;
202 table->AppendRows( 1 );
203 table->SetValueAsLong( row, 0, layer );
204 table->SetValue( row, 1, userName );
223 bool retVal = wxPanel::Show( aShow );
272 if( event.GetCol() == 0 )
274 int layer =
static_cast<int>(
table->GetValueAsLong( event.GetRow(), 0 ) );
278 if( i != event.GetRow() &&
table->GetValueAsLong( i, 0 ) == layer )
288 wxString layerName =
table->GetValue( ii, 1 );
290 if( ii != event.GetRow() && layerName ==
table->GetValue( event.GetRow(), 1 ) )
292 wxString msg = wxString::Format(
_(
"Layer name %s already in use." ), layerName );
302 std::set<int> usedLayers;
305 usedLayers.insert( (
int)
m_layerNamesGrid->GetTable()->GetValueAsLong( i, 0 ) );
309 if( !usedLayers.contains( ii ) )
320 [&]() -> std::pair<int, int>
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
BASE_SET & set(size_t pos)
Container for design settings for a BOARD object.
std::map< std::string, wxString > m_UserLayerNames
void SetUserDefinedLayerCount(int aNewLayerCount)
Set the number of user defined layers to aNewLayerCount.
int GetUserDefinedLayerCount() const
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
int GetNumberCols() override
bool DeleteRows(size_t aPos, size_t aNumRows) override
void SetValue(int row, int col, const wxString &value) override
std::vector< TEXT_ITEM_INFO > m_items
bool CanGetValueAs(int aRow, int aCol, const wxString &aTypeName) override
wxString GetColLabelValue(int aCol) override
bool AppendRows(size_t aNumRows=1) override
wxString GetValue(int row, int col) override
bool CanSetValueAs(int aRow, int aCol, const wxString &aTypeName) override
void SetValueAsLong(int row, int col, long value) override
long GetValueAsLong(int row, int col) override
int GetNumberRows() override
LSET is a set of PCB_LAYER_IDs.
static int NameToLayer(wxString &aName)
Return the layer number from a layer name.
static const LSET & AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
static LSET AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
static PAGED_DIALOG * GetDialog(wxWindow *aWindow)
void SetError(const wxString &aMessage, const wxString &aPageName, int aCtrlId, int aRow=-1, int aCol=-1)
WX_GRID * m_layerNamesGrid
STD_BITMAP_BUTTON * m_bpAdd
STD_BITMAP_BUTTON * m_bpDelete
PANEL_FP_USER_LAYER_NAMES_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)
wxChoice * m_choiceUserLayers
int getNextAvailableLayer() const
bool TransferDataToWindow() override
void onUserLayerCountChange(wxCommandEvent &event) override
~PANEL_FP_USER_LAYER_NAMES() override
BOARD_DESIGN_SETTINGS & m_designSettings
PANEL_FP_USER_LAYER_NAMES(wxWindow *aParent)
void ResetPanel() override
Reset the contents of this panel.
void onLayerChange(wxGridEvent &event) override
void OnAddLayerItem(wxCommandEvent &event) override
bool TransferDataFromWindow() override
void loadFPSettings(const FOOTPRINT_EDITOR_SETTINGS *aCfg)
bool Show(bool aShow) override
void OnDeleteLayerItem(wxCommandEvent &event) override
This file is part of the common library.
bool IsUserLayer(PCB_LAYER_ID aLayerId)
Test whether a layer is a non copper and a non tech layer.
PCB_LAYER_ID
A quick note on layer IDs:
static FOOTPRINT_EDITOR_SETTINGS & GetPgmSettings()
static FOOTPRINT_EDITOR_SETTINGS & GetPgmSettings()
T * GetAppSettings(const char *aFilename)