56 case 1:
return _(
"Show" );
57 case 2:
return _(
"Layer" );
58 default:
return wxEmptyString;
66 case 0:
return _(
"Reference designator" );
67 case 1:
return _(
"Value" );
68 default:
return wxEmptyString;
72 bool CanGetValueAs(
int aRow,
int aCol,
const wxString& aTypeName )
override
76 case 0:
return aTypeName == wxGRID_VALUE_STRING;
77 case 1:
return aTypeName == wxGRID_VALUE_BOOL;
78 case 2:
return aTypeName == wxGRID_VALUE_NUMBER;
79 default: wxFAIL;
return false;
83 bool CanSetValueAs(
int aRow,
int aCol,
const wxString& aTypeName )
override
92 void SetValue(
int row,
int col,
const wxString& value )
override
105 m_items[row].m_Visible = value;
115 m_items[row].m_Layer = (int) value;
120 for(
size_t i = 0; i < aNumRows; ++i )
125 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, aNumRows );
126 GetView()->ProcessTableMessage( msg );
142 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aPos, aNumRows );
143 GetView()->ProcessTableMessage( msg );
187 wxGridCellAttr* attr =
new wxGridCellAttr;
188 attr->SetRenderer(
new wxGridCellBoolRenderer() );
190 attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
193 attr =
new wxGridCellAttr;
204 attr =
new wxGridCellAttr;
205 attr->SetRenderer(
new wxGridCellBoolRenderer() );
207 attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
210 attr =
new wxGridCellAttr;
243 wxColour disabledColour = wxSystemSettings::GetColour( wxSYS_COLOUR_FRAMEBK );
246 [&](
int row,
int col )
249 m_graphicsGrid->SetCellBackgroundColour( row, col, disabledColour );
270 auto attr =
new wxGridCellAttr;
271 attr->SetRenderer(
new wxGridCellBoolRenderer() );
273 attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
332 bool retVal = wxPanel::Show( aShow );
370 bool badParam =
false;
374 if( lineWidth < minWidth || lineWidth > maxWidth )
376 if( !errorsMsg.IsEmpty() )
377 errorsMsg += wxT(
"\n\n" );
379 errorsMsg += wxString::Format(
_(
"%s: Incorrect line width.\n"
380 "It must be between %s and %s" ),
399 || textWidth > maxSize || textHeight > maxSize )
401 if( !errorsMsg.IsEmpty() )
402 errorsMsg += wxT(
"\n\n" );
404 errorsMsg += wxString::Format(
_(
"%s: Text size is incorrect.\n"
405 "Size must be between %s and %s" ),
413 int textMinDim = std::min( textWidth, textHeight );
414 int textMaxThickness = std::min( maxWidth, textMinDim /4);
416 if( !badParam && ( textThickness < minWidth || textThickness > textMaxThickness ) )
418 if( !errorsMsg.IsEmpty() )
419 errorsMsg += wxT(
"\n\n" );
421 if( textThickness > textMaxThickness )
422 errorsMsg += wxString::Format(
_(
"%s: Text thickness is too large.\n"
423 "It will be truncated to %s" ),
427 else if( textThickness < minWidth )
428 errorsMsg += wxString::Format(
_(
"%s: Text thickness is too small.\n"
429 "It will be truncated to %s" ),
433 textThickness = std::min( textThickness, textMaxThickness );
434 textThickness = std::max( textThickness, minWidth );
445 cfg.
m_TextItalic[ i ] = wxGridCellBoolEditor::IsTrueValue( msg );
455 wxString
text = table->GetValue( i, 0 );
456 bool visible = table->GetValueAsBool( i, 1 );
457 int layer = (int) table->GetValueAsLong( i, 2 );
466 wxString
text = table->GetValue( i, 0 );
467 bool visible = table->GetValueAsBool( i, 1 );
468 int layer = (int) table->GetValueAsLong( i, 2 );
473 if( errorsMsg.IsEmpty() )
477 _(
"Parameter error" ) );
492 table->AppendRows( 1 );
493 table->SetValueAsBool( newRow, 1, table->GetValueAsBool( newRow - 1, 1 ) );
494 table->SetValueAsLong( newRow, 2, table->GetValueAsLong( newRow - 1, 2 ) );
511 if( selectedRows.empty() )
514 for(
int row : selectedRows )
518 DisplayError(
nullptr,
_(
"Reference and value are mandatory." ) );
527 selectedRows.Sort( [](
int* first,
int* second ) {
return *second - *first; } );
529 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)
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.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
This file is part of the common library.
const int minSize
Push and Shove router track width and via size dialog.
Base window classes and related definitions.
#define TEXT_MIN_SIZE_MILS
Minimum text size in mils.
#define TEXT_MAX_SIZE_MILS
Maximum text size in mils (10 inches)
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
constexpr int MilsToIU(int mils) const
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".