49 case 0:
return _(
"Layer" );
50 case 1:
return _(
"Name" );
51 default:
return wxEmptyString;
55 bool CanGetValueAs(
int aRow,
int aCol,
const wxString& aTypeName )
override
59 case 0:
return aTypeName == wxGRID_VALUE_NUMBER;
60 case 1:
return aTypeName == wxGRID_VALUE_STRING;
61 default: wxFAIL;
return false;
65 bool CanSetValueAs(
int aRow,
int aCol,
const wxString& aTypeName )
override
71 void SetValue(
int row,
int col,
const wxString& value )
override
90 layers.insert( item.m_Layer );
92 for(
size_t i = 0; i < aNumRows; ++i )
94 while( layers.contains( layer ) )
99 layers.insert( layer );
110 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, aNumRows );
111 GetView()->ProcessTableMessage( msg );
127 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aPos, aNumRows );
128 GetView()->ProcessTableMessage( msg );
155 wxGridCellAttr* attr =
new wxGridCellAttr;
163 attr =
new wxGridCellAttr;
191 wxString orig_name = canonicalName;
198 table->AppendRows( 1 );
199 table->SetValueAsLong( row, 0, layer );
200 table->SetValue( row, 1, userName );
219 bool retVal = wxPanel::Show( aShow );
268 if( event.GetCol() == 0 )
270 int layer =
static_cast<int>(
table->GetValueAsLong( event.GetRow(), 0 ) );
274 if( i != event.GetRow() &&
table->GetValueAsLong( i, 0 ) == layer )
284 wxString layerName =
table->GetValue( ii, 1 );
286 if( ii != event.GetRow() && layerName ==
table->GetValue( event.GetRow(), 1 ) )
288 wxString msg = wxString::Format(
_(
"Layer name %s already in use." ), layerName );
298 std::set<int> usedLayers;
301 usedLayers.insert( (
int)
m_layerNamesGrid->GetTable()->GetValueAsLong( i, 0 ) );
305 if( !usedLayers.contains( ii ) )
316 [&]() -> 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 const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
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 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)
std::vector< std::vector< std::string > > table