55 case 1:
return _(
"Show" );
56 case 2:
return _(
"Layer" );
57 default:
return wxEmptyString;
65 case 0:
return _(
"Reference designator" );
66 case 1:
return _(
"Value" );
67 default:
return wxEmptyString;
71 bool CanGetValueAs(
int aRow,
int aCol,
const wxString& aTypeName )
override
75 case 0:
return aTypeName == wxGRID_VALUE_STRING;
76 case 1:
return aTypeName == wxGRID_VALUE_BOOL;
77 case 2:
return aTypeName == wxGRID_VALUE_NUMBER;
78 default: wxFAIL;
return false;
82 bool CanSetValueAs(
int aRow,
int aCol,
const wxString& aTypeName )
override
91 void SetValue(
int row,
int col,
const wxString& value )
override
104 m_items[row].m_Visible = value;
114 m_items[row].m_Layer = (int) value;
119 for(
size_t i = 0; i < aNumRows; ++i )
124 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, aNumRows );
125 GetView()->ProcessTableMessage( msg );
141 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aPos, aNumRows );
142 GetView()->ProcessTableMessage( msg );
186 wxGridCellAttr* attr =
new wxGridCellAttr;
187 attr->SetRenderer(
new wxGridCellBoolRenderer() );
189 attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
192 attr =
new wxGridCellAttr;
203 attr =
new wxGridCellAttr;
204 attr->SetRenderer(
new wxGridCellBoolRenderer() );
206 attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
209 attr =
new wxGridCellAttr;
242 wxColour disabledColour = wxSystemSettings::GetColour( wxSYS_COLOUR_FRAMEBK );
245 [&](
int row,
int col )
248 m_graphicsGrid->SetCellBackgroundColour( row, col, disabledColour );
269 auto attr =
new wxGridCellAttr;
270 attr->SetRenderer(
new wxGridCellBoolRenderer() );
272 attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
331 bool retVal = wxPanel::Show( aShow );
369 bool badParam =
false;
373 if( lineWidth < minWidth || lineWidth > maxWidth )
375 if( !errorsMsg.IsEmpty() )
376 errorsMsg += wxT(
"\n\n" );
378 errorsMsg += wxString::Format(
_(
"%s: Incorrect line width.\n"
379 "It must be between %s and %s" ),
398 || textWidth > maxSize || textHeight > maxSize )
400 if( !errorsMsg.IsEmpty() )
401 errorsMsg += wxT(
"\n\n" );
403 errorsMsg += wxString::Format(
_(
"%s: Text size is incorrect.\n"
404 "Size must be between %s and %s" ),
412 int textMinDim = std::min( textWidth, textHeight );
413 int textMaxThickness = std::min( maxWidth, textMinDim /4);
415 if( !badParam && ( textThickness < minWidth || textThickness > textMaxThickness ) )
417 if( !errorsMsg.IsEmpty() )
418 errorsMsg += wxT(
"\n\n" );
420 if( textThickness > textMaxThickness )
421 errorsMsg += wxString::Format(
_(
"%s: Text thickness is too large.\n"
422 "It will be truncated to %s" ),
426 else if( textThickness < minWidth )
427 errorsMsg += wxString::Format(
_(
"%s: Text thickness is too small.\n"
428 "It will be truncated to %s" ),
432 textThickness = std::min( textThickness, textMaxThickness );
433 textThickness = std::max( textThickness, minWidth );
444 cfg.
m_TextItalic[ i ] = wxGridCellBoolEditor::IsTrueValue( msg );
454 wxString
text = table->GetValue( i, 0 );
455 bool visible = table->GetValueAsBool( i, 1 );
456 int layer = (int) table->GetValueAsLong( i, 2 );
465 wxString
text = table->GetValue( i, 0 );
466 bool visible = table->GetValueAsBool( i, 1 );
467 int layer = (int) table->GetValueAsLong( i, 2 );
472 if( errorsMsg.IsEmpty() )
476 _(
"Parameter error" ) );
491 table->AppendRows( 1 );
492 table->SetValueAsBool( newRow, 1, table->GetValueAsBool( newRow - 1, 1 ) );
493 table->SetValueAsLong( newRow, 2, table->GetValueAsLong( newRow - 1, 2 ) );
510 if( selectedRows.empty() )
517 selectedRows.Sort( [](
int* first,
int* second ) {
return *second - *first; } );
519 for(
int row : selectedRows )
constexpr EDA_IU_SCALE pcbIUScale
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
#define MINIMUM_LINE_WIDTH_MM
#define MAXIMUM_LINE_WIDTH_MM
Container for design settings for a BOARD object.
std::vector< TEXT_ITEM_INFO > m_DefaultFPTextItems
int m_TextThickness[LAYER_CLASS_COUNT]
int m_LineThickness[LAYER_CLASS_COUNT]
VECTOR2I m_TextSize[LAYER_CLASS_COUNT]
bool m_TextItalic[LAYER_CLASS_COUNT]
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.
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Class PANEL_FP_EDITOR_DEFAULTS_BASE.
WX_GRID * m_textItemsGrid
STD_BITMAP_BUTTON * m_bpAdd
WX_GRID * m_fieldPropsGrid
STD_BITMAP_BUTTON * m_bpDelete
virtual void OnAddTextItem(wxCommandEvent &event) override
bool TransferDataFromWindow() override
void ResetPanel() override
Reset the contents of this panel.
bool TransferDataToWindow() override
~PANEL_FP_EDITOR_DEFAULTS() override
bool Show(bool aShow) override
UNITS_PROVIDER * m_unitProvider
PANEL_FP_EDITOR_DEFAULTS(wxWindow *aParent, UNITS_PROVIDER *aUnitsProvider)
virtual void OnDeleteTextItem(wxCommandEvent &event) override
void loadFPSettings(FOOTPRINT_EDITOR_SETTINGS *aCfg)
virtual SETTINGS_MANAGER & GetSettingsManager() const
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
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
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aValue in internal units into a united string.
int GetVisibleWidth(int aCol, bool aHeader=true, bool aContents=true, bool aKeep=false)
Calculates the specified column based on the actual size of the text on screen.
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...
void SetUnitValue(int aRow, int aCol, int aValue)
Set a unitized cell's value.
int GetUnitValue(int aRow, int aCol)
Apply standard KiCad unit and eval services to a numeric cell.
void SetAutoEvalCols(const std::vector< int > &aCols)
void SetUnitsProvider(UNITS_PROVIDER *aProvider, int aCol=0)
Set a UNITS_PROVIDER to enable use of unit- and eval-based Getters.
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
This file is part of the common library.
const int minSize
Push and Shove router track width and via size dialog.
#define TEXT_MIN_SIZE_MM
Minimum text size (1 micron).
#define TEXT_MAX_SIZE_MM
Maximum text size in mm (~10 inches)
This file is part of the common library.
PGM_BASE & Pgm()
The global Program "get" accessor.
constexpr int mmToIU(double mm) const
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
VECTOR2< int32_t > VECTOR2I