Toggle LIB_TABLE_ROW enabled/disabled in grid editor
- Checkbox editor for enabled / disabled status
This commit is contained in:
parent
7cdb78e852
commit
f85ce87e44
|
@ -211,7 +211,8 @@ bool LIB_TABLE_ROW::operator==( const LIB_TABLE_ROW& r ) const
|
|||
return nickName == r.nickName
|
||||
&& uri_user == r.uri_user
|
||||
&& options == r.options
|
||||
&& description == r.description;
|
||||
&& description == r.description
|
||||
&& enabled == r.enabled;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -168,27 +168,30 @@ DIALOG_SYMBOL_LIB_TABLE::DIALOG_SYMBOL_LIB_TABLE( wxTopLevelWindow* aParent,
|
|||
// pluginChoices.Add( SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_KICAD ) );
|
||||
pluginChoices.Add( SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_LEGACY ) );
|
||||
|
||||
wxGridCellAttr* attr;
|
||||
|
||||
attr = new wxGridCellAttr;
|
||||
attr->SetEditor( new wxGridCellChoiceEditor( pluginChoices ) );
|
||||
m_project_grid->SetColAttr( COL_TYPE, attr );
|
||||
|
||||
attr = new wxGridCellAttr;
|
||||
attr->SetEditor( new wxGridCellChoiceEditor( pluginChoices ) );
|
||||
m_global_grid->SetColAttr( COL_TYPE, attr );
|
||||
|
||||
populateEnvironReadOnlyTable();
|
||||
|
||||
for( int i=0; i<2; ++i )
|
||||
{
|
||||
wxGrid* g = i==0 ? m_global_grid : m_project_grid;
|
||||
|
||||
// Set special attributes
|
||||
wxGridCellAttr* attr;
|
||||
|
||||
attr = new wxGridCellAttr;
|
||||
attr->SetEditor( new wxGridCellChoiceEditor( pluginChoices ) );
|
||||
g->SetColAttr( COL_TYPE, attr );
|
||||
|
||||
attr = new wxGridCellAttr;
|
||||
attr->SetEditor( new wxGridCellBoolEditor() );
|
||||
attr->SetRenderer( new wxGridCellBoolRenderer() );
|
||||
g->SetColAttr( COL_ENABLED, attr );
|
||||
|
||||
// all but COL_OPTIONS, which is edited with Option Editor anyways.
|
||||
g->AutoSizeColumn( COL_NICKNAME, false );
|
||||
g->AutoSizeColumn( COL_TYPE, false );
|
||||
g->AutoSizeColumn( COL_URI, false );
|
||||
g->AutoSizeColumn( COL_DESCR, false );
|
||||
g->AutoSizeColumn( COL_ENABLED, false );
|
||||
|
||||
// would set this to width of title, if it was easily known.
|
||||
g->SetColSize( COL_OPTIONS, 80 );
|
||||
|
|
|
@ -32,6 +32,8 @@ enum COL_ORDER
|
|||
COL_TYPE,
|
||||
COL_OPTIONS,
|
||||
COL_DESCR,
|
||||
COL_ENABLED,
|
||||
|
||||
COL_COUNT // keep as last
|
||||
};
|
||||
|
||||
|
@ -62,6 +64,8 @@ public:
|
|||
case COL_TYPE: return r->GetType();
|
||||
case COL_OPTIONS: return r->GetOptions();
|
||||
case COL_DESCR: return r->GetDescr();
|
||||
// Render a boolean value as its text equivalent
|
||||
case COL_ENABLED: return r->GetIsEnabled() ? "1" : "";
|
||||
default:
|
||||
; // fall thru to wxEmptyString
|
||||
}
|
||||
|
@ -83,6 +87,10 @@ public:
|
|||
case COL_TYPE: r->SetType( aValue ); break;
|
||||
case COL_OPTIONS: r->SetOptions( aValue ); break;
|
||||
case COL_DESCR: r->SetDescr( aValue ); break;
|
||||
case COL_ENABLED:
|
||||
// Any non-empty string will set enabled to true
|
||||
r->SetEnabled( !aValue.IsEmpty() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -172,6 +180,8 @@ public:
|
|||
case COL_TYPE: return _( "Plugin Type" );
|
||||
case COL_OPTIONS: return _( "Options" );
|
||||
case COL_DESCR: return _( "Description" );
|
||||
case COL_ENABLED: return _( "Enabled" );
|
||||
|
||||
default: return wxEmptyString;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -195,22 +195,23 @@ public:
|
|||
choices.Add( IO_MGR::ShowType( IO_MGR::GITHUB ) );
|
||||
*/
|
||||
|
||||
wxGridCellAttr* attr;
|
||||
|
||||
attr = new wxGridCellAttr;
|
||||
attr->SetEditor( new wxGridCellChoiceEditor( choices ) );
|
||||
m_project_grid->SetColAttr( COL_TYPE, attr );
|
||||
|
||||
attr = new wxGridCellAttr;
|
||||
attr->SetEditor( new wxGridCellChoiceEditor( choices ) );
|
||||
m_global_grid->SetColAttr( COL_TYPE, attr );
|
||||
|
||||
populateEnvironReadOnlyTable();
|
||||
|
||||
for( int i=0; i<2; ++i )
|
||||
{
|
||||
wxGrid* g = i==0 ? m_global_grid : m_project_grid;
|
||||
|
||||
wxGridCellAttr* attr;
|
||||
|
||||
attr = new wxGridCellAttr;
|
||||
attr->SetEditor( new wxGridCellChoiceEditor( choices ) );
|
||||
g->SetColAttr( COL_TYPE, attr );
|
||||
|
||||
attr = new wxGridCellAttr;
|
||||
attr->SetEditor( new wxGridCellBoolEditor() );
|
||||
attr->SetRenderer( new wxGridCellBoolRenderer() );
|
||||
g->SetColAttr( COL_ENABLED, attr );
|
||||
|
||||
// all but COL_OPTIONS, which is edited with Option Editor anyways.
|
||||
g->AutoSizeColumn( COL_NICKNAME, false );
|
||||
g->AutoSizeColumn( COL_TYPE, false );
|
||||
|
|
Loading…
Reference in New Issue