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
85 m_items[row].m_Layer =
static_cast<int>( value );
94 layers.insert( item.m_Layer );
97 for(
size_t i = 0; i < aNumRows; ++i )
99 while( layers.contains( layer ) )
104 layers.insert( layer );
105 m_items.emplace_back( wxT(
"" ),
true, layer );
115 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, aNumRows );
116 GetView()->ProcessTableMessage( msg );
132 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aPos, aNumRows );
133 GetView()->ProcessTableMessage( msg );
158 case 1:
return _(
"Show" );
159 case 2:
return _(
"Layer" );
160 default:
return wxEmptyString;
168 case 0:
return _(
"Reference designator" );
169 case 1:
return _(
"Value" );
170 default:
return wxEmptyString;
174 bool CanGetValueAs(
int aRow,
int aCol,
const wxString& aTypeName )
override
178 case 0:
return aTypeName == wxGRID_VALUE_STRING;
179 case 1:
return aTypeName == wxGRID_VALUE_BOOL;
180 case 2:
return aTypeName == wxGRID_VALUE_NUMBER;
181 default: wxFAIL;
return false;
185 bool CanSetValueAs(
int aRow,
int aCol,
const wxString& aTypeName )
override
191 void SetValue(
int row,
int col,
const wxString& value )
override
201 m_items[row].m_Visible = value;
208 m_items[row].m_Layer = (int) value;
213 for(
size_t i = 0; i < aNumRows; ++i )
218 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, aNumRows );
219 GetView()->ProcessTableMessage( msg );
235 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aPos, aNumRows );
236 GetView()->ProcessTableMessage( msg );
264 wxGridCellAttr* attr =
new wxGridCellAttr;
265 attr->SetRenderer(
new wxGridCellBoolRenderer() );
267 attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
270 attr =
new wxGridCellAttr;
281 attr =
new wxGridCellAttr;
282 attr->SetRenderer(
new wxGridCellBoolRenderer() );
284 attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
287 attr =
new wxGridCellAttr;
298 attr =
new wxGridCellAttr;
346 wxString orig_name = item.first;
376 bool retVal = wxPanel::Show( aShow );
407 wxString
text = table->GetValue( i, 0 );
408 bool visible = table->GetValueAsBool( i, 1 );
409 int layer = (int) table->GetValueAsLong( i, 2 );
418 wxString
text = table->GetValue( i, 0 );
419 bool visible = table->GetValueAsBool( i, 1 );
420 int layer = (int) table->GetValueAsLong( i, 2 );
432 wxString
name = table->GetValue( i, 1 );
456 std::set<int> usedLayers;
463 if( !usedLayers.contains( ii ) )
475 if( event.GetCol() == 0 )
477 int layer =
static_cast<int>( table->GetValueAsLong( event.GetRow(), 0 ) );
481 if( i != event.GetRow()
482 && table->GetValueAsLong( i, 0 ) == layer )
492 wxString layerName = table->GetValue( ii, 1 );
494 if( ii != event.GetRow() && layerName == table->GetValue( event.GetRow(), 1 ) )
496 wxString msg = wxString::Format(
_(
"Layer name %s already in use." ), layerName );
512 table->AppendRows( 1 );
513 table->SetValueAsBool( newRow, 1, table->GetValueAsBool( newRow - 1, 1 ) );
514 table->SetValueAsLong( newRow, 2, table->GetValueAsLong( newRow - 1, 2 ) );
532 table->AppendRows( 1 );
549 if( selectedRows.empty() )
557 [](
int* first,
int* second )
559 return *second - *first;
562 for(
int row : selectedRows )
584 if( selectedRows.empty() )
592 [](
int* first,
int* second )
594 return *second - *first;
597 for(
int row : selectedRows )
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Container for design settings for a BOARD object.
std::vector< TEXT_ITEM_INFO > m_DefaultFPTextItems
std::map< std::string, wxString > m_UserLayerNames
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
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static int NameToLayer(wxString &aName)
Return the layer number from a layer name.
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)
Class PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE.
STD_BITMAP_BUTTON * m_bpAddLayer
STD_BITMAP_BUTTON * m_bpAdd
WX_GRID * m_textItemsGrid
WX_GRID * m_layerNameitemsGrid
STD_BITMAP_BUTTON * m_bpDeleteLayer
WX_GRID * m_fieldPropsGrid
STD_BITMAP_BUTTON * m_bpDelete
BOARD_DESIGN_SETTINGS & m_designSettings
bool TransferDataFromWindow() override
bool isLayerAvailable(int aLayerId) const
PANEL_FP_EDITOR_FIELD_DEFAULTS(wxWindow *aParent, UNITS_PROVIDER *aUnitsProvider)
virtual void onLayerChange(wxGridEvent &event) override
virtual void OnAddTextItem(wxCommandEvent &event) override
virtual void OnDeleteTextItem(wxCommandEvent &event) override
~PANEL_FP_EDITOR_FIELD_DEFAULTS() override
void loadFPSettings(const FOOTPRINT_EDITOR_SETTINGS *aCfg)
int getNextAvailableLayer() const
void ResetPanel() override
Reset the contents of this panel.
virtual void OnAddLayerItem(wxCommandEvent &event) override
virtual void OnDeleteLayerItem(wxCommandEvent &event) override
bool TransferDataToWindow() override
bool Show(bool aShow) override
virtual SETTINGS_MANAGER & GetSettingsManager() const
T * GetAppSettings(const wxString &aFilename)
Return a handle to the a given settings by type.
std::vector< TEXT_ITEM_INFO > m_items
bool DeleteRows(size_t aPos, size_t aNumRows) override
int GetNumberCols() override
wxString GetRowLabelValue(int aRow) override
TEXT_ITEMS_GRID_TABLE(bool aForFieldProps)
void SetValueAsLong(int row, int col, long value) override
void SetValue(int row, int col, const wxString &value) override
wxString GetValue(int row, int col) override
void SetValueAsBool(int row, int col, bool value) override
wxString GetColLabelValue(int aCol) override
bool CanSetValueAs(int aRow, int aCol, const wxString &aTypeName) override
int GetNumberRows() override
bool GetValueAsBool(int row, int col) override
bool AppendRows(size_t aNumRows=1) override
bool CanGetValueAs(int aRow, int aCol, const wxString &aTypeName) override
long GetValueAsLong(int row, int col) override
void SetTable(wxGridTableBase *table, bool aTakeOwnership=false)
Hide wxGrid's SetTable() method with one which doesn't mess up the grid column widths when setting th...
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
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()
PGM_BASE & Pgm()
The global program "get" accessor.
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".