Re-enable library configuration dialog
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "lib_table_grid_tricks.h"
|
||||
#include "lib_table_grid.h"
|
||||
#include <libraries/library_manager.h>
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/log.h>
|
||||
|
||||
@@ -89,16 +90,18 @@ void LIB_TABLE_GRID_TRICKS::showPopupMenu( wxMenu& menu, wxGridEvent& aEvent )
|
||||
|
||||
bool showSettings = false;
|
||||
|
||||
// TODO(JE) library tables
|
||||
#if 0
|
||||
if( m_sel_row_count == 1 && tbl->At( m_sel_row_start )->SupportsSettingsDialog() )
|
||||
if( LIBRARY_MANAGER_ADAPTER* adapter = tbl->Adapter() )
|
||||
{
|
||||
showSettings = true;
|
||||
menu.Append( LIB_TABLE_GRID_TRICKS_LIBRARY_SETTINGS,
|
||||
wxString::Format( _( "Library settings for %s..." ),
|
||||
tbl->GetValue( m_sel_row_start, 2 ) ) );
|
||||
wxString nickname = tbl->GetValue( m_sel_row_start, COL_NICKNAME );
|
||||
|
||||
if( m_sel_row_count == 1 && adapter->SupportsConfigurationDialog( nickname ) )
|
||||
{
|
||||
showSettings = true;
|
||||
menu.Append( LIB_TABLE_GRID_TRICKS_LIBRARY_SETTINGS,
|
||||
wxString::Format( _( "Library settings for %s..." ), nickname ) );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if( showActivate || showDeactivate || showSetVisible || showUnsetVisible || showSettings )
|
||||
menu.AppendSeparator();
|
||||
|
||||
|
||||
@@ -93,8 +93,8 @@ class SYMBOL_LIB_TABLE_GRID : public LIB_TABLE_GRID
|
||||
friend class SYMBOL_GRID_TRICKS;
|
||||
|
||||
public:
|
||||
SYMBOL_LIB_TABLE_GRID( const LIBRARY_TABLE& aTableToEdit ) :
|
||||
LIB_TABLE_GRID( aTableToEdit )
|
||||
SYMBOL_LIB_TABLE_GRID( const LIBRARY_TABLE& aTableToEdit, SYMBOL_LIBRARY_ADAPTER* aAdapter ) :
|
||||
LIB_TABLE_GRID( aTableToEdit, aAdapter )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -418,9 +418,12 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, P
|
||||
std::optional<LIBRARY_TABLE*> table =
|
||||
Pgm().GetLibraryManager().Table( LIBRARY_TABLE_TYPE::SYMBOL, LIBRARY_TABLE_SCOPE::GLOBAL );
|
||||
wxASSERT( table );
|
||||
|
||||
SYMBOL_LIBRARY_ADAPTER* adapter = PROJECT_SCH::SymbolLibAdapter( m_project );
|
||||
|
||||
// wxGrid only supports user owned tables if they exist past end of ~wxGrid(),
|
||||
// so make it a grid owned table.
|
||||
m_global_grid->SetTable( new SYMBOL_LIB_TABLE_GRID( *table.value() ) );
|
||||
m_global_grid->SetTable( new SYMBOL_LIB_TABLE_GRID( *table.value(), adapter ) );
|
||||
|
||||
// TODO(JE) should use translated string here but type is stored as untranslated string
|
||||
// Maybe type storage needs to be enum?
|
||||
@@ -452,7 +455,7 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, P
|
||||
|
||||
if( projectTable )
|
||||
{
|
||||
m_project_grid->SetTable( new SYMBOL_LIB_TABLE_GRID( *projectTable.value() ), true );
|
||||
m_project_grid->SetTable( new SYMBOL_LIB_TABLE_GRID( *projectTable.value(), adapter ), true );
|
||||
setupGrid( m_project_grid );
|
||||
}
|
||||
else
|
||||
@@ -918,7 +921,9 @@ void PANEL_SYM_LIB_TABLE::onReset( wxCommandEvent& event )
|
||||
LIBRARY_TABLE_SCOPE::GLOBAL );
|
||||
wxASSERT( newTable );
|
||||
|
||||
m_global_grid->SetTable( new SYMBOL_LIB_TABLE_GRID( *newTable.value() ) );
|
||||
SYMBOL_LIBRARY_ADAPTER* adapter = PROJECT_SCH::SymbolLibAdapter( &m_parent->Kiway().Prj() );
|
||||
|
||||
m_global_grid->SetTable( new SYMBOL_LIB_TABLE_GRID( *newTable.value(), adapter ) );
|
||||
m_global_grid->PopEventHandler( true );
|
||||
setupGrid( m_global_grid );
|
||||
m_parent->m_GlobalTableChanged = true;
|
||||
|
||||
@@ -77,9 +77,9 @@ public:
|
||||
|
||||
std::vector<SUB_LIBRARY> GetSubLibraries( const wxString& aNickname ) const;
|
||||
|
||||
bool SupportsConfigurationDialog( const wxString& aNickname ) const;
|
||||
bool SupportsConfigurationDialog( const wxString& aNickname ) const override;
|
||||
|
||||
void ShowConfigurationDialog( const wxString& aNickname, wxWindow* aParent ) const;
|
||||
void ShowConfigurationDialog( const wxString& aNickname, wxWindow* aParent ) const override;
|
||||
|
||||
enum class SYMBOL_TYPE
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <wx/grid.h>
|
||||
|
||||
class LIB_TABLE_GRID_TRICKS;
|
||||
class LIBRARY_MANAGER_ADAPTER;
|
||||
|
||||
/// The library table grid column order is established by this sequence.
|
||||
enum COL_ORDER
|
||||
@@ -50,8 +51,9 @@ class KICOMMON_API LIB_TABLE_GRID : public wxGridTableBase
|
||||
friend class LIB_TABLE_GRID_TRICKS;
|
||||
|
||||
public:
|
||||
LIB_TABLE_GRID( const LIBRARY_TABLE& aTableToEdit ) :
|
||||
m_table( aTableToEdit )
|
||||
LIB_TABLE_GRID( const LIBRARY_TABLE& aTableToEdit, LIBRARY_MANAGER_ADAPTER* aAdapter = nullptr ) :
|
||||
m_table( aTableToEdit ),
|
||||
m_adapter( aAdapter )
|
||||
{}
|
||||
|
||||
//-----<wxGridTableBase overloads>-------------------------------------------
|
||||
@@ -92,6 +94,8 @@ public:
|
||||
|
||||
LIBRARY_TABLE& Table() { return m_table; }
|
||||
|
||||
LIBRARY_MANAGER_ADAPTER* Adapter() const { return m_adapter; }
|
||||
|
||||
protected:
|
||||
virtual LIBRARY_TABLE_ROW& at( size_t aIndex );
|
||||
|
||||
@@ -111,6 +115,9 @@ protected:
|
||||
|
||||
/// Working copy of a table
|
||||
LIBRARY_TABLE m_table;
|
||||
|
||||
/// Handle to the adapter for the type of table this grid represents (may be null)
|
||||
LIBRARY_MANAGER_ADAPTER* m_adapter;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -266,6 +266,10 @@ public:
|
||||
/// Return true if the given nickname exists and is not a read-only library
|
||||
virtual bool IsWritable( const wxString& aNickname ) const { return false; }
|
||||
|
||||
virtual bool SupportsConfigurationDialog( const wxString& aNickname ) const { return false; }
|
||||
|
||||
virtual void ShowConfigurationDialog( const wxString& aNickname, wxWindow* aParent ) const {};
|
||||
|
||||
protected:
|
||||
virtual std::map<wxString, LIB_DATA>& globalLibs() = 0;
|
||||
virtual std::map<wxString, LIB_DATA>& globalLibs() const = 0;
|
||||
|
||||
Reference in New Issue
Block a user