From 4d37d50f57e93f89bd0589cce816310ec7ab26df Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 16 Feb 2026 17:34:17 +0000 Subject: [PATCH] Handle visibility flag where it is supported. (This got lost when merging separate routines into shared code.) Fixes https://gitlab.com/kicad/code/kicad/-/issues/23078 --- common/dialogs/panel_design_block_lib_table.cpp | 12 +++++++++++- common/lib_table_grid_tricks.cpp | 10 +++++++--- eeschema/dialogs/panel_sym_lib_table.cpp | 9 +++++++-- include/lib_table_grid_tricks.h | 5 +++-- pcbnew/dialogs/panel_fp_lib_table.cpp | 12 +++++++++++- 5 files changed, 39 insertions(+), 9 deletions(-) diff --git a/common/dialogs/panel_design_block_lib_table.cpp b/common/dialogs/panel_design_block_lib_table.cpp index e114ef51fc..42c1512ea5 100644 --- a/common/dialogs/panel_design_block_lib_table.cpp +++ b/common/dialogs/panel_design_block_lib_table.cpp @@ -217,6 +217,11 @@ public: SetTooltipEnable( COL_STATUS ); } + static bool SupportsVisibilityColumn() + { + return false; + } + protected: void optionsEditor( int aRow ) override { @@ -257,6 +262,11 @@ protected: return wxT( "(design_block_lib_table" ); } + bool supportsVisibilityColumn() override + { + return DESIGN_BLOCK_GRID_TRICKS::SupportsVisibilityColumn(); + } + protected: PANEL_DESIGN_BLOCK_LIB_TABLE* m_panel; }; @@ -491,7 +501,7 @@ bool PANEL_DESIGN_BLOCK_LIB_TABLE::verifyTables() { WX_GRID* grid = get_grid( page ); - if( !LIB_TABLE_GRID_TRICKS::VerifyTable( grid, + if( !DESIGN_BLOCK_GRID_TRICKS::VerifyTable( grid, DESIGN_BLOCK_GRID_TRICKS::SupportsVisibilityColumn(), [&]( int aRow, int aCol ) { // show the tabbed panel holding the grid we have flunked: diff --git a/common/lib_table_grid_tricks.cpp b/common/lib_table_grid_tricks.cpp index 3771b1030b..c05593263d 100644 --- a/common/lib_table_grid_tricks.cpp +++ b/common/lib_table_grid_tricks.cpp @@ -459,7 +459,8 @@ void LIB_TABLE_GRID_TRICKS::MoveDownHandler( WX_GRID* aGrid ) } -bool LIB_TABLE_GRID_TRICKS::VerifyTable( WX_GRID* aGrid, std::function aErrorHandler ) +bool LIB_TABLE_GRID_TRICKS::VerifyTable( WX_GRID* aGrid, bool aSupportsVisibilityColumn, + std::function aErrorHandler ) { wxWindow* topLevelParent = wxGetTopLevelParent( aGrid ); LIB_TABLE_GRID_DATA_MODEL* model = static_cast( aGrid->GetTable() ); @@ -495,8 +496,11 @@ bool LIB_TABLE_GRID_TRICKS::VerifyTable( WX_GRID* aGrid, std::functionSetValue( r, COL_NICKNAME, nick ); model->SetValue( r, COL_URI, uri ); - // Make sure to not save a hidden flag - model->SetValue( r, COL_VISIBLE, wxS( "1" ) ); + if( !aSupportsVisibilityColumn ) + { + // Make sure to not save an inappropriate hidden flag + model->SetValue( r, COL_VISIBLE, wxS( "1" ) ); + } ++r; // this row was OK. } diff --git a/eeschema/dialogs/panel_sym_lib_table.cpp b/eeschema/dialogs/panel_sym_lib_table.cpp index c4b86a69fd..5b70832510 100644 --- a/eeschema/dialogs/panel_sym_lib_table.cpp +++ b/eeschema/dialogs/panel_sym_lib_table.cpp @@ -159,6 +159,11 @@ public: SetTooltipEnable( COL_STATUS ); } + static bool SupportsVisibilityColumn() + { + return true; + } + protected: void optionsEditor( int aRow ) override { @@ -201,7 +206,7 @@ protected: bool supportsVisibilityColumn() override { - return true; + return SYMBOL_GRID_TRICKS::SupportsVisibilityColumn(); } protected: @@ -470,7 +475,7 @@ bool PANEL_SYM_LIB_TABLE::verifyTables() { WX_GRID* grid = get_grid( page ); - if( !LIB_TABLE_GRID_TRICKS::VerifyTable( grid, + if( !SYMBOL_GRID_TRICKS::VerifyTable( grid, SYMBOL_GRID_TRICKS::SupportsVisibilityColumn(), [&]( int aRow, int aCol ) { // show the tabbed panel holding the grid we have flunked: diff --git a/include/lib_table_grid_tricks.h b/include/lib_table_grid_tricks.h index 846d167b43..b5c4b8493b 100644 --- a/include/lib_table_grid_tricks.h +++ b/include/lib_table_grid_tricks.h @@ -52,7 +52,8 @@ public: static void MoveUpHandler( WX_GRID* aGrid ); static void MoveDownHandler( WX_GRID* aGrid ); - static bool VerifyTable( WX_GRID* aGrid, std::function aErrorHandler ); + static bool VerifyTable( WX_GRID* aGrid, bool aSupportsVisibilityColumn, + std::function aErrorHandler ); protected: virtual void optionsEditor( int aRow ) = 0; @@ -69,6 +70,6 @@ protected: */ void paste_text( const wxString& cb_text ) override; - virtual bool supportsVisibilityColumn() { return false; } + virtual bool supportsVisibilityColumn() = 0; virtual wxString getTablePreamble() = 0; }; diff --git a/pcbnew/dialogs/panel_fp_lib_table.cpp b/pcbnew/dialogs/panel_fp_lib_table.cpp index e5e2a2e5ea..9c2808f51e 100644 --- a/pcbnew/dialogs/panel_fp_lib_table.cpp +++ b/pcbnew/dialogs/panel_fp_lib_table.cpp @@ -151,6 +151,11 @@ public: SetTooltipEnable( COL_STATUS ); } + static bool SupportsVisibilityColumn() + { + return false; + } + protected: void optionsEditor( int aRow ) override { @@ -191,6 +196,11 @@ protected: return wxT( "(fp_lib_table" ); } + bool supportsVisibilityColumn() override + { + return FP_GRID_TRICKS::SupportsVisibilityColumn(); + } + protected: PANEL_FP_LIB_TABLE* m_panel; }; @@ -436,7 +446,7 @@ bool PANEL_FP_LIB_TABLE::verifyTables() { WX_GRID* grid = get_grid( page ); - if( !LIB_TABLE_GRID_TRICKS::VerifyTable( grid, + if( !FP_GRID_TRICKS::VerifyTable( grid, FP_GRID_TRICKS::SupportsVisibilityColumn(), [&]( int aRow, int aCol ) { // show the tabbed panel holding the grid we have flunked: