47 std::vector<EMBEDDED_FILES*> aFilesStack ) :
69 m_boolColAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
101 m_eval = std::make_unique<NUMERIC_EVALUATOR>(
m_frame->GetUserUnits() );
124 int mandatoryRows = 0;
132 return mandatoryRows;
139 GetView()->ForceRefresh();
163 default: wxFAIL;
return wxEmptyString;
180 return aTypeName == wxGRID_VALUE_STRING;
187 return aTypeName == wxGRID_VALUE_BOOL;
190 return aTypeName == wxGRID_VALUE_NUMBER;
206 wxGridCellAttr::wxAttrKind aKind )
208 const PCB_FIELD& field = this->at( (
size_t) aRow );
273 wxGrid*
grid = GetView();
274 const PCB_FIELD& field = this->at( (
size_t) aRow );
276 if(
grid->GetGridCursorRow() == aRow &&
grid->GetGridCursorCol() == aCol
277 &&
grid->IsCellEditControlShown() )
297 return m_frame->StringFromValue( angle,
true );
306 return wxT(
"bad wxWidgets!" );
313 PCB_FIELD& field = this->at( (
size_t) aRow );
324 wxFAIL_MSG( wxString::Format( wxT(
"column %d doesn't hold a bool value" ), aCol ) );
332 PCB_FIELD& field = this->at( (
size_t) aRow );
339 wxFAIL_MSG( wxString::Format( wxT(
"column %d doesn't hold a long value" ), aCol ) );
347 PCB_FIELD& field = this->at( (
size_t) aRow );
349 wxString value = aValue;
352 value.Trim(
true ).Trim(
false );
362 if(
m_eval->Process( value ) )
387 pos.
x =
m_frame->ValueFromString( value );
389 pos.
y =
m_frame->ValueFromString( value );
395 wxFAIL_MSG( wxString::Format( wxT(
"column %d doesn't hold a string value" ), aCol ) );
399 GetView()->Refresh();
406 PCB_FIELD& field = this->at( (
size_t) aRow );
417 wxFAIL_MSG( wxString::Format( wxT(
"column %d doesn't hold a bool value" ), aCol ) );
427 PCB_FIELD& field = this->at( (
size_t) aRow );
442 wxFAIL_MSG( wxString::Format( wxT(
"column %d doesn't hold a long value" ), aCol ) );
453 if( aPos >= size() || aNumRows > size() - aPos )
456 std::map<std::pair<int, int>, wxString> rebasedEvalOriginal;
461 if( cell.first <
static_cast<int>( aPos ) )
463 rebasedEvalOriginal[cell] = expression;
466 else if( cell.first >=
static_cast<int>( aPos + aNumRows ) )
468 rebasedEvalOriginal[{ cell.first -
static_cast<int>( aNumRows ), cell.second }] = expression;
476 erase( begin() + aPos, begin() + aPos + aNumRows );
480 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aPos, aNumRows );
481 GetView()->ProcessTableMessage( msg );
virtual bool IsKnockout() const
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual void SetIsKnockout(bool aKnockout)
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
FOOTPRINT * GetParentFootprint() const
VECTOR2I GetFPRelativePosition() const
void SetFPRelativePosition(const VECTOR2I &aPos)
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
Information pertinent to a Pcbnew printed circuit board.
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
virtual const wxString & GetText() const
Return the string associated with the text object.
bool IsKeepUpright() const
virtual bool IsVisible() const
virtual int GetTextHeight() const
void SetMirrored(bool isMirrored)
virtual int GetTextWidth() const
virtual void SetTextWidth(int aWidth)
virtual void SetVisible(bool aVisible)
virtual void SetTextHeight(int aHeight)
void SetKeepUpright(bool aKeepUpright)
virtual void SetText(const wxString &aText)
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
This class works around a bug in wxGrid where the first keystroke doesn't get sent through the valida...
virtual void SetValidator(const wxValidator &validator) override
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
wxGridCellAttr * m_referenceAttr
void onUnitsChanged(wxCommandEvent &aEvent)
void SetValue(int aRow, int aCol, const wxString &aValue) override
bool GetValueAsBool(int aRow, int aCol) override
wxString GetColLabelValue(int aCol) override
bool CanGetValueAs(int aRow, int aCol, const wxString &aTypeName) override
std::map< std::pair< int, int >, wxString > m_evalOriginal
FIELD_VALIDATOR m_nonUrlValidator
PCB_FIELDS_GRID_TABLE(PCB_BASE_FRAME *aFrame, DIALOG_SHIM *aDialog, std::vector< EMBEDDED_FILES * > aFilesStack)
long GetValueAsLong(int aRow, int aCol) override
wxGridCellAttr * m_readOnlyAttr
FIELD_VALIDATOR m_urlValidator
FIELD_VALIDATOR m_valueValidator
wxString GetValue(int aRow, int aCol) override
wxGridCellAttr * GetAttr(int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind) override
std::unique_ptr< NUMERIC_EVALUATOR > m_eval
void SetValueAsBool(int aRow, int aCol, bool aValue) override
int GetMandatoryRowCount() const
wxGridCellAttr * m_urlAttr
wxGridCellAttr * m_fieldNameAttr
FIELD_VALIDATOR m_referenceValidator
bool CanSetValueAs(int aRow, int aCol, const wxString &aTypeName) override
FIELD_VALIDATOR m_fieldNameValidator
bool DeleteRows(size_t aPos=0, size_t aNumRows=1) override
wxGridCellAttr * m_boolColAttr
wxGridCellAttr * m_layerColAttr
wxGridCellAttr * m_orientationColAttr
wxGridCellAttr * m_valueAttr
void SetValueAsLong(int aRow, int aCol, long aValue) override
bool HasHypertext() const
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
void SetName(const wxString &aName)
void SetTextThickness(int aWidth) override
The TextThickness is that set by the user.
EDA_ANGLE GetTextAngle() const override
int GetTextThickness() const override
void SetTextAngle(const EDA_ANGLE &aAngle) override
wxGridCellAttr * enhanceAttr(wxGridCellAttr *aInputAttr, int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind)
@ USER
The main config directory (e.g. ~/.config/kicad/)
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
KICOMMON_API wxString GetText(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
wxArrayString g_menuOrientations
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
@ DATASHEET
name of datasheet
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
VECTOR2< int32_t > VECTOR2I