kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #31730
Re: [PATCH] LIB_TABLE tweaks
Wayne
Please find updated patch set attached. I have rebased and built from
commit b6884d and it all works fine.
Thanks
On Sun, Nov 19, 2017 at 4:42 AM, Wayne Stambaugh <stambaughw@xxxxxxxxx>
wrote:
> Oliver,
>
> I just tried to apply your patches and ran into some issues. Patch 1
> applies but patch 2 fails. Would you please rebase your patches so I
> can get them merged as soon as possible.
>
> Thanks,
>
> Wayne
>
> On 11/15/2017 06:41 AM, Oliver Walters wrote:
> > Wayne, et al,
> >
> > I am really liking the way that the new symbol table works! Thanks for
> > the huge effort that has gone into this.
> >
> > One thing that I have noticed is that when opening (for e.g.) the
> > component chooser, the UI hangs while all the libraries load. Previously
> > there was a progress dialog which at least informed the user what was
> > going on.
> >
> > I have re-implemented this dialog in the attached patch set.
> >
> > Further, I have also implemented a way to individually enable / disable
> > each row in the library tables (this works for SYMBOL_LIB and FP_LIB).
> >
> > This is based on the idea by Tomasz. Example screenshot below:
> >
> > Inline image 1
> >
> > I have tweaked the base LIB_TABLE_GRID code such that disabled entries
> > are greyed out and made italic. The enabled / disabled status is
> > persistent in the sym/fp_lib_table files. Older version of xxx_lib_table
> > files are read with all rows enabled by default.
> >
> > Please find patch set attached.
> >
> > Regards,
> > Oliver
> >
> >
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~kicad-developers
> > Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~kicad-developers
> > More help : https://help.launchpad.net/ListHelp
> >
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
>
From 7031b7262c1afe7efa6dcd8c171a18ecbf5ca952 Mon Sep 17 00:00:00 2001
From: Oliver <oliver.henry.walters@xxxxxxxxx>
Date: Wed, 15 Nov 2017 22:32:23 +1100
Subject: [PATCH 6/6] Improved LIB_TABLE rendering
- Moved "Active" to first column
- Changed text attributes for disabled rows
---
include/lib_table_grid.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 46 insertions(+), 2 deletions(-)
diff --git a/include/lib_table_grid.h b/include/lib_table_grid.h
index c35c4f4..94726b5 100644
--- a/include/lib_table_grid.h
+++ b/include/lib_table_grid.h
@@ -24,15 +24,18 @@
#include <wx/grid.h>
+const wxColour COLOUR_ROW_ENABLED( 0, 0, 0 );
+const wxColour COLOUR_ROW_DISABLED( 100, 100, 100 );
+
/// The library table grid column order is established by this sequence.
enum COL_ORDER
{
+ COL_ENABLED,
COL_NICKNAME,
COL_URI,
COL_TYPE,
COL_OPTIONS,
COL_DESCR,
- COL_ENABLED,
COL_COUNT // keep as last
};
@@ -180,12 +183,53 @@ public:
case COL_TYPE: return _( "Plugin Type" );
case COL_OPTIONS: return _( "Options" );
case COL_DESCR: return _( "Description" );
- case COL_ENABLED: return _( "Enabled" );
+ case COL_ENABLED: return _( "Active" );
default: return wxEmptyString;
}
}
+ /**
+ * Customize the appearance of LIB_TABLE_ROW entries
+ * - If not enabled, greyed out and italic
+ */
+ virtual wxGridCellAttr* GetAttr( int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind) override
+ {
+ auto* attr = wxGridTableBase::GetAttr( aRow, aCol, aKind );
+
+ if( aRow < (int) size() )
+ {
+ if( !attr )
+ {
+ attr = new wxGridCellAttr();
+ }
+
+ wxFont font;
+
+ if( attr->HasFont() )
+ {
+ font = attr->GetFont();
+ }
+
+ LIB_TABLE_ROW* r = at( (size_t) aRow );
+
+ if( r && r->GetIsEnabled() )
+ {
+ font.SetStyle( wxFONTSTYLE_NORMAL );
+ attr->SetTextColour( COLOUR_ROW_ENABLED );
+ }
+ else
+ {
+ font.SetStyle( wxFONTSTYLE_ITALIC );
+ attr->SetTextColour( COLOUR_ROW_DISABLED );
+ }
+
+ attr->SetFont( font );
+ }
+
+ return attr;
+ }
+
protected:
virtual LIB_TABLE_ROW* at( size_t aIndex ) = 0;
--
2.7.4
From 7694084a6d0930c8500d9215f824f957688e72d7 Mon Sep 17 00:00:00 2001
From: Oliver <oliver.henry.walters@xxxxxxxxx>
Date: Wed, 15 Nov 2017 21:48:38 +1100
Subject: [PATCH 5/6] Add progress dialog when loading symbol libraries
- Provides UX feedback for user
---
eeschema/cmp_tree_model_adapter.cpp | 22 +++++++++++++++++++++-
eeschema/cmp_tree_model_adapter.h | 12 ++++++++++++
eeschema/getpart.cpp | 7 ++-----
eeschema/viewlibs.cpp | 10 ++--------
4 files changed, 37 insertions(+), 14 deletions(-)
diff --git a/eeschema/cmp_tree_model_adapter.cpp b/eeschema/cmp_tree_model_adapter.cpp
index d88119b..d9b8cd6 100644
--- a/eeschema/cmp_tree_model_adapter.cpp
+++ b/eeschema/cmp_tree_model_adapter.cpp
@@ -24,7 +24,7 @@
#include <eda_pattern_match.h>
#include <wx/tokenzr.h>
#include <symbol_lib_table.h>
-
+#include <wx/progdlg.h>
CMP_TREE_MODEL_ADAPTER::WIDTH_CACHE CMP_TREE_MODEL_ADAPTER::m_width_cache;
@@ -135,6 +135,26 @@ void CMP_TREE_MODEL_ADAPTER::AddLibrary( wxString const& aLibNickname )
}
+void CMP_TREE_MODEL_ADAPTER::AddLibrariesWithProgress( const std::vector<wxString>& aNicknames, EDA_DRAW_FRAME* aParent )
+{
+ auto* prg = new wxProgressDialog(
+ _( "Loading symbol libraries" ),
+ wxEmptyString,
+ aNicknames.size(),
+ aParent );
+
+ unsigned int ii = 0;
+
+ for( auto nickname : aNicknames )
+ {
+ prg->Update( ii++, wxString::Format( _( "Loading library '%s'" ), nickname ) );
+ AddLibrary( nickname );
+ }
+
+ prg->Destroy();
+}
+
+
void CMP_TREE_MODEL_ADAPTER::AddAliasList(
wxString const& aNodeName,
wxArrayString const& aAliasNameList )
diff --git a/eeschema/cmp_tree_model_adapter.h b/eeschema/cmp_tree_model_adapter.h
index bb96d0b..06f6c68 100644
--- a/eeschema/cmp_tree_model_adapter.h
+++ b/eeschema/cmp_tree_model_adapter.h
@@ -24,6 +24,7 @@
#include <lib_id.h>
+#include <draw_frame.h>
#include <cmp_tree_model.h>
#include <wx/hashmap.h>
@@ -155,6 +156,17 @@ public:
*/
void AddLibrary( wxString const& aLibNickname );
+
+ /**
+ * Add all the libraries in a SYMBOL_LIB_TABLE to the model,
+ * displaying a progress dialog attached to the parent frame
+ *
+ * @param aNicknames is the list of library nicknames
+ * @param aParent is the parent window to display the progress dialog
+ */
+ void AddLibrariesWithProgress( const std::vector<wxString>& aNicknames, EDA_DRAW_FRAME* aParent );
+
+
/**
* Add the given list of components, by name. To be called in the setup
* phase.
diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp
index 2648012..4ece335 100644
--- a/eeschema/getpart.cpp
+++ b/eeschema/getpart.cpp
@@ -148,14 +148,11 @@ SCH_BASE_FRAME::COMPONENT_SELECTION SCH_BASE_FRAME::SelectComponentFromLibrary(
adapter->SetPreselectNode( aHistoryList[0].LibId, aHistoryList[0].Unit );
}
- std::vector< wxString > libNicknames = libs->GetLogicalLibs();
+ const std::vector< wxString > libNicknames = libs->GetLogicalLibs();
if( !loaded )
{
- for( auto nickname : libNicknames )
- {
- adapter->AddLibrary( nickname );
- }
+ adapter->AddLibrariesWithProgress( libNicknames, this );
}
if( aHighlight && aHighlight->IsValid() )
diff --git a/eeschema/viewlibs.cpp b/eeschema/viewlibs.cpp
index fce60b5..3d1de7c 100644
--- a/eeschema/viewlibs.cpp
+++ b/eeschema/viewlibs.cpp
@@ -44,7 +44,6 @@
#include <cmp_tree_model_adapter.h>
#include <symbol_lib_table.h>
-
void LIB_VIEW_FRAME::OnSelectSymbol( wxCommandEvent& aEvent )
{
wxString dialogTitle;
@@ -53,14 +52,9 @@ void LIB_VIEW_FRAME::OnSelectSymbol( wxCommandEvent& aEvent )
// Container doing search-as-you-type.
auto adapter( CMP_TREE_MODEL_ADAPTER::Create( libs ) );
- std::vector< wxString > libNicknames;
-
- libNicknames = libs->GetLogicalLibs();
+ const auto libNicknames = libs->GetLogicalLibs();
- for( auto nickname : libNicknames )
- {
- adapter->AddLibrary( nickname );
- }
+ adapter->AddLibrariesWithProgress( libNicknames, this );
dialogTitle.Printf( _( "Choose Component (%d items loaded)" ),
adapter->GetComponentsCount() );
--
2.7.4
From ff3391c4437f14757a70fc9784310757d250bdc3 Mon Sep 17 00:00:00 2001
From: Oliver <oliver.henry.walters@xxxxxxxxx>
Date: Wed, 15 Nov 2017 20:41:19 +1100
Subject: [PATCH 4/6] Only enumerate active libraries
---
common/lib_table_base.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/common/lib_table_base.cpp b/common/lib_table_base.cpp
index b78d8d7..0dbff32 100644
--- a/common/lib_table_base.cpp
+++ b/common/lib_table_base.cpp
@@ -368,7 +368,10 @@ std::vector<wxString> LIB_TABLE::GetLogicalLibs()
{
for( LIB_TABLE_ROWS_CITER it = cur->rows.begin(); it!=cur->rows.end(); ++it )
{
- unique.insert( it->GetNickName() );
+ if( it->GetIsEnabled() )
+ {
+ unique.insert( it->GetNickName() );
+ }
}
} while( ( cur = cur->fallBack ) != 0 );
--
2.7.4
From 54ae9b3ab8b44492edc481938f25fa170f7a413c Mon Sep 17 00:00:00 2001
From: Oliver <oliver.henry.walters@xxxxxxxxx>
Date: Wed, 15 Nov 2017 20:30:32 +1100
Subject: [PATCH 3/6] Load "disabled" for footprint libraries
---
common/fp_lib_table.cpp | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/common/fp_lib_table.cpp b/common/fp_lib_table.cpp
index 99a2afc..8eff009 100644
--- a/common/fp_lib_table.cpp
+++ b/common/fp_lib_table.cpp
@@ -109,10 +109,11 @@ void FP_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
// After (name), remaining (lib) elements are order independent, and in
// some cases optional.
- bool sawType = false;
- bool sawOpts = false;
- bool sawDesc = false;
- bool sawUri = false;
+ bool sawType = false;
+ bool sawOpts = false;
+ bool sawDesc = false;
+ bool sawUri = false;
+ bool sawDisabled = false;
while( ( tok = in->NextTok() ) != T_RIGHT )
{
@@ -158,6 +159,13 @@ void FP_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
row->SetDescr( in->FromUTF8() );
break;
+ case T_disabled:
+ if( sawDisabled )
+ in->Duplicate( tok );
+ sawDisabled = true;
+ row->SetEnabled( false );
+ break;
+
default:
in->Unexpected( tok );
}
--
2.7.4
From 61580e66e8e807c535d427135dc013ab7783fc67 Mon Sep 17 00:00:00 2001
From: Oliver <oliver.henry.walters@xxxxxxxxx>
Date: Wed, 15 Nov 2017 17:56:38 +1100
Subject: [PATCH 2/6] Toggle LIB_TABLE_ROW enabled/disabled in grid editor
- Checkbox editor for enabled / disabled status
---
common/lib_table_base.cpp | 3 ++-
eeschema/dialogs/dialog_sym_lib_table.cpp | 25 +++++++++++++++----------
include/lib_table_grid.h | 10 ++++++++++
pcbnew/dialogs/dialog_fp_lib_table.cpp | 21 +++++++++++----------
4 files changed, 38 insertions(+), 21 deletions(-)
diff --git a/common/lib_table_base.cpp b/common/lib_table_base.cpp
index 8c3e46f..b78d8d7 100644
--- a/common/lib_table_base.cpp
+++ b/common/lib_table_base.cpp
@@ -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;
}
diff --git a/eeschema/dialogs/dialog_sym_lib_table.cpp b/eeschema/dialogs/dialog_sym_lib_table.cpp
index 0868b47..ca4b8ec 100644
--- a/eeschema/dialogs/dialog_sym_lib_table.cpp
+++ b/eeschema/dialogs/dialog_sym_lib_table.cpp
@@ -166,27 +166,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 );
@@ -350,6 +353,8 @@ void DIALOG_SYMBOL_LIB_TABLE::appendRowHandler( wxCommandEvent& event )
m_cur_grid->MakeCellVisible( last_row, 0 );
m_cur_grid->SetGridCursor( last_row, 0 );
m_cur_grid->SelectRow( m_cur_grid->GetGridCursorRow() );
+
+ printf("Made row %i\n", last_row );
}
}
diff --git a/include/lib_table_grid.h b/include/lib_table_grid.h
index 64c2f90..c35c4f4 100644
--- a/include/lib_table_grid.h
+++ b/include/lib_table_grid.h
@@ -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;
}
}
diff --git a/pcbnew/dialogs/dialog_fp_lib_table.cpp b/pcbnew/dialogs/dialog_fp_lib_table.cpp
index eb8b905..ee80d9c 100644
--- a/pcbnew/dialogs/dialog_fp_lib_table.cpp
+++ b/pcbnew/dialogs/dialog_fp_lib_table.cpp
@@ -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 );
--
2.7.4
From 396e11cc1af04fbce98063a3a7272c4f4a62fea2 Mon Sep 17 00:00:00 2001
From: Oliver <oliver.henry.walters@xxxxxxxxx>
Date: Wed, 15 Nov 2017 16:48:31 +1100
Subject: [PATCH 1/6] Added "enabled" parameter for LIB_TABLE_ROW
- Read and write from lib-table working
---
common/lib_table.keywords | 1 +
common/lib_table_base.cpp | 12 ++++++++++--
eeschema/symbol_lib_table.cpp | 18 ++++++++++++++----
eeschema/symbol_lib_table.h | 3 +++
include/lib_table_base.h | 18 ++++++++++++++++--
5 files changed, 44 insertions(+), 8 deletions(-)
diff --git a/common/lib_table.keywords b/common/lib_table.keywords
index feeea0e..fd679ff 100644
--- a/common/lib_table.keywords
+++ b/common/lib_table.keywords
@@ -6,3 +6,4 @@ type
uri
options
descr
+disabled
\ No newline at end of file
diff --git a/common/lib_table_base.cpp b/common/lib_table_base.cpp
index 99e0fc1..8c3e46f 100644
--- a/common/lib_table_base.cpp
+++ b/common/lib_table_base.cpp
@@ -87,12 +87,20 @@ void LIB_TABLE_ROW::Format( OUTPUTFORMATTER* out, int nestLevel ) const
wxString uri = GetFullURI();
uri.Replace( '\\', '/' );
- out->Print( nestLevel, "(lib (name %s)(type %s)(uri %s)(options %s)(descr %s))\n",
+ wxString extraOptions;
+
+ if( !GetIsEnabled() )
+ {
+ extraOptions += "(disabled)";
+ }
+
+ out->Print( nestLevel, "(lib (name %s)(type %s)(uri %s)(options %s)(descr %s)%s)\n",
out->Quotew( GetNickName() ).c_str(),
out->Quotew( GetType() ).c_str(),
out->Quotew( uri ).c_str(),
out->Quotew( GetOptions() ).c_str(),
- out->Quotew( GetDescr() ).c_str()
+ out->Quotew( GetDescr() ).c_str(),
+ extraOptions.ToStdString().c_str()
);
}
diff --git a/eeschema/symbol_lib_table.cpp b/eeschema/symbol_lib_table.cpp
index 1019310..d31162a 100644
--- a/eeschema/symbol_lib_table.cpp
+++ b/eeschema/symbol_lib_table.cpp
@@ -124,10 +124,11 @@ void SYMBOL_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
// After (name), remaining (lib) elements are order independent, and in
// some cases optional.
- bool sawType = false;
- bool sawOpts = false;
- bool sawDesc = false;
- bool sawUri = false;
+ bool sawType = false;
+ bool sawOpts = false;
+ bool sawDesc = false;
+ bool sawUri = false;
+ bool sawDisabled = false;
while( ( tok = in->NextTok() ) != T_RIGHT )
{
@@ -173,6 +174,13 @@ void SYMBOL_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
row->SetDescr( in->FromUTF8() );
break;
+ case T_disabled:
+ if( sawDisabled )
+ in->Duplicate( tok );
+ sawDisabled = true;
+ row->SetEnabled( false );
+ break;
+
default:
in->Unexpected( tok );
}
@@ -219,7 +227,9 @@ void SYMBOL_LIB_TABLE::Format( OUTPUTFORMATTER* aOutput, int aIndentLevel ) cons
aOutput->Print( aIndentLevel, "(sym_lib_table\n" );
for( LIB_TABLE_ROWS_CITER it = rows.begin(); it != rows.end(); ++it )
+ {
it->Format( aOutput, aIndentLevel+1 );
+ }
aOutput->Print( aIndentLevel, ")\n" );
}
diff --git a/eeschema/symbol_lib_table.h b/eeschema/symbol_lib_table.h
index 63cfe6c..4f0c2b1 100644
--- a/eeschema/symbol_lib_table.h
+++ b/eeschema/symbol_lib_table.h
@@ -51,11 +51,13 @@ public:
LIB_TABLE_ROW( aNick, aURI, aOptions, aDescr )
{
SetType( aType );
+ SetEnabled( true );
}
SYMBOL_LIB_TABLE_ROW() :
type( SCH_IO_MGR::SCH_KICAD )
{
+ SetEnabled( true );
}
bool operator==( const SYMBOL_LIB_TABLE_ROW& aRow ) const;
@@ -77,6 +79,7 @@ protected:
LIB_TABLE_ROW( aRow ),
type( aRow.type )
{
+ SetEnabled( aRow.GetIsEnabled() );
}
private:
diff --git a/include/lib_table_base.h b/include/lib_table_base.h
index c8c3e84..20433ad 100644
--- a/include/lib_table_base.h
+++ b/include/lib_table_base.h
@@ -78,7 +78,8 @@ public:
LIB_TABLE_ROW( const wxString& aNick, const wxString& aURI, const wxString& aOptions,
const wxString& aDescr = wxEmptyString ) :
nickName( aNick ),
- description( aDescr )
+ description( aDescr ),
+ enabled( true )
{
properties.reset();
SetOptions( aOptions );
@@ -100,6 +101,16 @@ public:
void SetNickName( const wxString& aNickName ) { nickName = aNickName; }
/**
+ * @return the enabled status of this library row
+ */
+ bool GetIsEnabled() const { return enabled; }
+
+ /**
+ * Change the enabled status of this library
+ */
+ void SetEnabled( bool aEnabled = true ) { enabled = aEnabled; }
+
+ /**
* Return the type of library represented by this row.
*/
virtual const wxString GetType() const = 0;
@@ -175,7 +186,8 @@ protected:
uri_expanded( aRow.uri_expanded ),
#endif
options( aRow.options ),
- description( aRow.description )
+ description( aRow.description ),
+ enabled( aRow.enabled )
{
if( aRow.properties )
properties.reset( new PROPERTIES( *aRow.properties.get() ) );
@@ -200,6 +212,8 @@ private:
wxString options;
wxString description;
+ bool enabled = true; ///< Whether the LIB_TABLE_ROW is enabled
+
std::unique_ptr< PROPERTIES > properties;
};
--
2.7.4
Follow ups
References