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 );
82 wxCHECK( aRow >= 0, wxEmptyString );
83 size_t row =
static_cast<size_t>( aRow );
103 if( std::optional<LIBRARY_ERROR> error =
m_adapter->LibraryError( r.
Nickname() ) )
104 return error->message;
107 return _(
"Edit settings" );
109 return _(
"Open library table" );
111 return wxEmptyString;
114 return wxEmptyString;
118 return wxEmptyString;
142 if( !tableRow.
IsOk() )
148 if( std::optional<LIBRARY_ERROR> error =
m_adapter->LibraryError( tableRow.
Nickname() ) )
178 if( aRow <
static_cast<int>(
size() ) )
184 return aTypeName == wxGRID_VALUE_BOOL;
187 return aTypeName == wxGRID_VALUE_STRING;
197 wxCHECK( aRow >= 0,
false );
198 size_t row =
static_cast<size_t>( aRow );
211 wxCHECK( aRow >= 0, );
212 size_t row =
static_cast<size_t>( aRow );
234 wxCHECK( aRow >= 0, );
235 size_t row =
static_cast<size_t>( aRow );
248 for(
size_t i = 0; i < aNumRows; i++ )
254 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_INSERTED, aPos, aNumRows );
255 GetView()->ProcessTableMessage( msg );
268 for(
int i = aNumRows; i; --i )
273 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, aNumRows );
274 GetView()->ProcessTableMessage( msg );
285 if( aPos <
size() && aPos + aNumRows <=
size() )
288 erase( start, start + aNumRows );
292 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aPos, aNumRows );
293 GetView()->ProcessTableMessage( msg );
308 case COL_URI:
return _(
"Library Path" );
311 case COL_TYPE:
return _(
"Library Format" );
318 default:
return wxEmptyString;
325 for(
size_t i = 0; i <
size(); ++i )
338 return m_table.Rows().at( aIndex );
362 return m_table.Rows().insert( aIterator, aRow );
368 m_table.Rows().push_back( aRow );
374 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)
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
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()
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:...