31 const wxArrayString& aPluginChoices,
32 wxString* aMRUDirectory,
const wxString& aProjectPath ) :
39 [
this](
WX_GRID* aCurrGrid,
int aRow ) -> wxString
41 return getFileTypes( aCurrGrid, aRow );
45 m_typesEditor->SetEditor(
new wxGridCellChoiceEditor( aPluginChoices ) );
48 m_boolAttr->SetRenderer(
new wxGridCellBoolRenderer() );
50 m_boolAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
55 m_warningAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
87 if( aRow < 0 || aRow >= (
int)
size() )
100 return wxEmptyString;
118 if( std::optional<LIBRARY_ERROR> error =
m_adapter->LibraryError( r.
Nickname() ) )
119 return error->message;
122 return _(
"Edit settings" );
124 return _(
"Open library table" );
126 return wxEmptyString;
129 return wxEmptyString;
157 if( !tableRow.
IsOk() )
163 if( std::optional<LIBRARY_ERROR> error =
m_adapter->LibraryError( tableRow.
Nickname() ) )
201 return aTypeName == wxGRID_VALUE_BOOL;
204 return aTypeName == wxGRID_VALUE_STRING;
244 GetView()->CallAfter(
276 for(
size_t i = 0; i < aNumRows; i++ )
282 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_INSERTED, aPos, aNumRows );
283 GetView()->ProcessTableMessage( msg );
296 for(
int i = aNumRows; i; --i )
301 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, aNumRows );
302 GetView()->ProcessTableMessage( msg );
313 if( aPos <
size() && aPos + aNumRows <=
size() )
316 erase( start, start + aNumRows );
320 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aPos, aNumRows );
321 GetView()->ProcessTableMessage( msg );
336 case COL_URI:
return _(
"Library Path" );
339 case COL_TYPE:
return _(
"Library Format" );
346 default:
return wxEmptyString;
353 for(
size_t i = 0; i <
size(); ++i )
366 return m_table.Rows().at( aIndex );
391 return m_table.Rows().insert( aIterator, aRow );
397 m_table.Rows().push_back( aRow );
404 return m_table.Rows().erase( aFirst, aLast );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Editor for wxGrid cells that adds a file/folder browser to the grid input field.
The interface used by the classes that actually can load IO plugins for the different parts of KiCad ...
void SetOptions(const wxString &aOptions)
void SetNickname(const wxString &aNickname)
void SetType(const wxString &aType)
const wxString & ErrorDescription() const
void SetDescription(const wxString &aDescription)
const wxString & Type() const
static const wxString TABLE_TYPE_NAME
void SetURI(const wxString &aUri)
const wxString & Description() const
void SetDisabled(bool aDisabled=true)
void SetHidden(bool aHidden=true)
const wxString & URI() const
const wxString & Nickname() const
const wxString & Options() const
virtual LIBRARY_TABLE_ROWS_ITER begin()
wxGridCellAttr * m_editSettingsAttr
bool AppendRows(size_t aNumRows=1) override
wxGridCellAttr * m_warningAttr
virtual LIBRARY_TABLE_ROW & at(size_t aIndex)
wxGridCellAttr * m_noStatusAttr
bool ContainsNickname(const wxString &aNickname)
virtual LIBRARY_TABLE_ROWS_ITER erase(LIBRARY_TABLE_ROWS_ITER aFirst, LIBRARY_TABLE_ROWS_ITER aLast)
~LIB_TABLE_GRID_DATA_MODEL() override
void SetValueAsBool(int aRow, int aCol, bool aValue) override
virtual size_t size() const
virtual LIBRARY_TABLE_ROWS_ITER insert(LIBRARY_TABLE_ROWS_ITER aIterator, const LIBRARY_TABLE_ROW &aRow)
wxString GetValue(int aRow, int aCol) override
wxString GetColLabelValue(int aCol) override
wxGridCellAttr * m_uriEditor
wxGridCellAttr * GetAttr(int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind) override
bool CanGetValueAs(int aRow, int aCol, const wxString &aTypeName) override
bool GetValueAsBool(int aRow, int aCol) override
wxGridCellAttr * m_boolAttr
bool DeleteRows(size_t aPos, size_t aNumRows) override
virtual void push_back(const LIBRARY_TABLE_ROW &aRow)
bool InsertRows(size_t aPos=0, size_t aNumRows=1) override
LIBRARY_MANAGER_ADAPTER * m_adapter
Handle to the adapter for the type of table this grid represents (may be null)
void SetValue(int aRow, int aCol, const wxString &aValue) override
LIBRARY_TABLE m_table
Working copy of a table.
wxGridCellAttr * m_typesEditor
wxGridCellAttr * m_openTableAttr
bool badCoords(int aRow, int aCol)
LIB_TABLE_GRID_DATA_MODEL(DIALOG_SHIM *aParent, WX_GRID *aGrid, const LIBRARY_TABLE &aTableToEdit, LIBRARY_MANAGER_ADAPTER *aAdapter, const wxArrayString &aPluginChoices, wxString *aMRUDirectory, const wxString &aProjectPath)
virtual LIBRARY_TABLE_ROW makeNewRow()
int GetNumberCols() override
wxGridCellAttr * enhanceAttr(wxGridCellAttr *aInputAttr, int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind)
std::vector< LIBRARY_TABLE_ROW >::iterator LIBRARY_TABLE_ROWS_ITER
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...