Hidden footprint libraries are not yet supported.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18183

(cherry picked from commit b7161181e8)
This commit is contained in:
Jeff Young 2024-06-12 16:58:20 +01:00
parent b19a47fa2a
commit 4ee2a007eb
7 changed files with 53 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( showSetVisible )
menu.Append( LIB_TABLE_GRID_TRICKS_SET_VISIBLE, _( "Set visible flag" ) );
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" ) );
if( showUnsetVisible )
menu.Append( LIB_TABLE_GRID_TRICKS_UNSET_VISIBLE, _( "Unset visible flag" ) );
}
bool showSettings = false;

View File

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

View File

@ -22,6 +22,8 @@
#define DIALOG_EDIT_LIBRARY_TABLES_H
#include <dialog_shim.h>
#include <wx/panel.h>
#include <widgets/wx_infobar.h>
class DIALOG_EDIT_LIBRARY_TABLES : public DIALOG_SHIM
@ -38,8 +40,20 @@ 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:
wxPanel* m_contentPanel;
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

@ -215,7 +215,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:
@ -294,6 +295,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 );
}
};
@ -376,6 +389,10 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, PRO
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.