34 #include <wx/treebook.h> 52 case 0:
return _(
"Text Items" );
53 case 1:
return _(
"Show" );
54 case 2:
return _(
"Layer" );
55 default:
return wxEmptyString;
63 case 0:
return _(
"Reference designator" );
64 case 1:
return _(
"Value" );
65 default:
return wxEmptyString;
69 bool CanGetValueAs(
int aRow,
int aCol,
const wxString& aTypeName )
override 73 case 0:
return aTypeName == wxGRID_VALUE_STRING;
74 case 1:
return aTypeName == wxGRID_VALUE_BOOL;
75 case 2:
return aTypeName == wxGRID_VALUE_NUMBER;
76 default: wxFAIL;
return false;
80 bool CanSetValueAs(
int aRow,
int aCol,
const wxString& aTypeName )
override 89 void SetValue(
int row,
int col,
const wxString& value )
override 102 m_items[row].m_Visible = value;
112 m_items[row].m_Layer = (int) value;
117 for(
size_t i = 0; i < aNumRows; ++i )
122 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, aNumRows );
123 GetView()->ProcessTableMessage( msg );
139 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aPos, aNumRows );
140 GetView()->ProcessTableMessage( msg );
176 m_brdSettings( aFrame->GetDesignSettings() ),
187 wxGridCellAttr* attr =
new wxGridCellAttr;
188 attr->SetRenderer(
new wxGridCellBoolRenderer() );
190 attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
193 attr =
new wxGridCellAttr;
219 wxColour disabledColour = wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND );
221 #define SET_MILS_CELL( row, col, val ) \ 222 m_graphicsGrid->SetCellValue( row, col, StringFromValue( m_frame->GetUserUnits(), val, true ) ) 224 #define DISABLE_CELL( row, col ) \ 225 m_graphicsGrid->SetReadOnly( row, col ); \ 226 m_graphicsGrid->SetCellBackgroundColour( row, col, disabledColour ); 246 auto attr =
new wxGridCellAttr;
247 attr->SetRenderer(
new wxGridCellBoolRenderer() );
249 attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
286 bool retVal = wxPanel::Show( aShow );
327 wxString msg =
_(
"Text will not be readable with a thickness greater than\n" 328 "1/4 its width or height." );
364 wxString
text = table->GetValue( i, 0 );
365 bool visible = table->GetValueAsBool( i, 1 );
366 int layer = (int) table->GetValueAsLong( i, 2 );
388 table->AppendRows( 1 );
389 table->SetValueAsBool( newRow, 1, table->GetValueAsBool( newRow - 1, 1 ) );
390 table->SetValueAsLong( newRow, 2, table->GetValueAsLong( newRow - 1, 2 ) );
407 if( selectedRows.empty() )
410 for(
int row : selectedRows )
414 DisplayError(
nullptr,
_(
"Reference and value are mandatory." ) );
423 selectedRows.Sort( [](
int* first,
int* second ) {
return *second - *first; } );
425 for(
int row : selectedRows )
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
wxStaticText * m_staticTextInfo
int GetNumberCols() override
std::vector< TEXT_ITEM_INFO > m_DefaultFPTextItems
This file is part of the common library.
wxBitmapButton * m_bpDelete
bool AppendRows(size_t aNumRows=1) override
wxFont GetInfoFont(wxWindow *aWindow)
bool GetValueAsBool(int row, int col) override
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
bool CanSetValueAs(int aRow, int aCol, const wxString &aTypeName) override
BOARD_DESIGN_SETTINGS m_brdSettings
void SetError(const wxString &aMessage, const wxString &aPageName, int aCtrlId, int aRow=-1, int aCol=-1)
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 DeleteRows(size_t aPos, size_t aNumRows) override
int GetNumberRows() override
int GetVisibleWidth(int aCol, bool aHeader=true, bool aContents=false, bool aKeep=true)
Calculates the specified column based on the actual size of the text on screen.
void SetValueAsLong(int row, int col, long value) override
bool TransferDataFromWindow() override
wxSize m_TextSize[LAYER_CLASS_COUNT]
bool Show(bool aShow) override
void SetValue(int row, int col, const wxString &value) override
int m_TextThickness[LAYER_CLASS_COUNT]
long long int ValueFromString(EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application.
wxString GetColLabelValue(int aCol) override
virtual void OnDeleteTextItem(wxCommandEvent &event) override
wxString GetRowLabelValue(int aRow) override
PANEL_FP_EDITOR_DEFAULTS(FOOTPRINT_EDIT_FRAME *aFrame, PAGED_DIALOG *aParent)
bool m_TextItalic[LAYER_CLASS_COUNT]
bool TransferDataToWindow() override
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
int m_LineThickness[LAYER_CLASS_COUNT]
~PANEL_FP_EDITOR_DEFAULTS() override
#define SET_MILS_CELL(row, col, val)
std::vector< TEXT_ITEM_INFO > m_items
virtual void OnAddTextItem(wxCommandEvent &event) override
int getGridValue(int aRow, int aCol)
Class PANEL_FP_EDITOR_DEFAULTS_BASE.
#define DISABLE_CELL(row, col)
long GetValueAsLong(int row, int col) override
bool CanGetValueAs(int aRow, int aCol, const wxString &aTypeName) override
FOOTPRINT_EDIT_FRAME * m_frame
void SetValueAsBool(int row, int col, bool value) override
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
wxString GetValue(int row, int col) override
WX_GRID * m_textItemsGrid