Hidden footprint libraries are not yet supported.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18183
This commit is contained in:
Jeff Young 2024-06-12 16:58:20 +01:00
parent 73a3b880a6
commit b7161181e8
7 changed files with 52 additions and 8 deletions

View File

@ -43,6 +43,9 @@ void DIALOG_EDIT_LIBRARY_TABLES::InstallPanel( wxPanel* aPanel )
auto mainSizer = new wxBoxSizer( wxVERTICAL );
SetSizer( mainSizer );
m_infoBar = new WX_INFOBAR( this );
mainSizer->Add( m_infoBar, 0, wxEXPAND, 0 );
mainSizer->Add( m_contentPanel, 1, wxEXPAND|wxLEFT|wxTOP|wxRIGHT, 5 );
m_contentPanel->SetMinSize( FromDIP( wxSize( 1000, 600 ) ) );

View File

@ -21,7 +21,8 @@
#include "lib_table_grid.h"
LIB_TABLE_GRID_TRICKS::LIB_TABLE_GRID_TRICKS( WX_GRID* aGrid ) : GRID_TRICKS( aGrid )
LIB_TABLE_GRID_TRICKS::LIB_TABLE_GRID_TRICKS( WX_GRID* aGrid ) :
GRID_TRICKS( aGrid )
{
}
@ -65,11 +66,14 @@ void LIB_TABLE_GRID_TRICKS::showPopupMenu( wxMenu& menu, wxGridEvent& aEvent )
if( showDeactivate )
menu.Append( LIB_TABLE_GRID_TRICKS_DEACTIVATE_SELECTED, _( "Deactivate selected" ) );
if( supportsVisibilityColumn() )
{
if( showSetVisible )
menu.Append( LIB_TABLE_GRID_TRICKS_SET_VISIBLE, _( "Set visible flag" ) );
if( showUnsetVisible )
menu.Append( LIB_TABLE_GRID_TRICKS_UNSET_VISIBLE, _( "Unset visible flag" ) );
}
bool showSettings = false;

View File

@ -228,6 +228,11 @@ protected:
m_grid->AutoSizeColumns( false );
}
}
bool supportsVisibilityColumn() override
{
return true;
}
};

View File

@ -23,6 +23,7 @@
#include <dialog_shim.h>
#include <wx/panel.h>
#include <widgets/wx_infobar.h>
class DIALOG_EDIT_LIBRARY_TABLES : public DIALOG_SHIM
@ -39,7 +40,19 @@ public:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void ShowInfoBarError( const wxString& aErrorMsg, bool aShowCloseButton = false,
WX_INFOBAR::MESSAGE_TYPE aType = WX_INFOBAR::MESSAGE_TYPE::GENERIC )
{
m_infoBar->RemoveAllButtons();
if( aShowCloseButton )
m_infoBar->AddCloseButton();
m_infoBar->ShowMessageFor( aErrorMsg, 8000, wxICON_ERROR, aType );
}
protected:
WX_INFOBAR* m_infoBar;
wxPanel* m_contentPanel;
};

View File

@ -114,7 +114,7 @@ protected:
bool isCheckbox( int aRow, int aCol );
bool isReadOnly( int aRow, int aCol );
bool toggleCell( int aRow, int aCol, bool aPreserveSelection = false );
virtual bool toggleCell( int aRow, int aCol, bool aPreserveSelection = false );
bool showEditor( int aRow, int aCol );
virtual void paste_clipboard();

View File

@ -42,4 +42,6 @@ public:
protected:
virtual void optionsEditor( int aRow ) = 0;
bool handleDoubleClick( wxGridEvent& aEvent ) override;
virtual bool supportsVisibilityColumn() { return false; }
};

View File

@ -218,7 +218,8 @@ class FP_GRID_TRICKS : public LIB_TABLE_GRID_TRICKS
{
public:
FP_GRID_TRICKS( DIALOG_EDIT_LIBRARY_TABLES* aParent, WX_GRID* aGrid ) :
LIB_TABLE_GRID_TRICKS( aGrid ), m_dialog( aParent )
LIB_TABLE_GRID_TRICKS( aGrid ),
m_dialog( aParent )
{ }
protected:
@ -297,6 +298,18 @@ protected:
m_grid->AutoSizeColumns( false );
}
}
bool toggleCell( int aRow, int aCol, bool aPreserveSelection ) override
{
if( aCol == COL_VISIBLE )
{
m_dialog->ShowInfoBarError( _( "Hidden footprint libraries are not yet supported." ) );
return true;
}
return LIB_TABLE_GRID_TRICKS::toggleCell( aRow, aCol, aPreserveSelection );
}
};
@ -349,6 +362,10 @@ void PANEL_FP_LIB_TABLE::setupGrid( WX_GRID* aGrid )
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
aGrid->SetColAttr( COL_ENABLED, attr );
attr = new wxGridCellAttr;
attr->SetRenderer( new wxGridCellBoolRenderer() );
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
aGrid->SetColAttr( COL_VISIBLE, attr );
// No visibility control for footprint libraries yet; this feature is primarily
// useful for database libraries and it's only implemented for schematic symbols
// at the moment.