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
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -459,7 +459,8 @@ void LIB_TABLE_GRID_TRICKS::MoveDownHandler( WX_GRID* aGrid )
|
||||
}
|
||||
|
||||
|
||||
bool LIB_TABLE_GRID_TRICKS::VerifyTable( WX_GRID* aGrid, std::function<void( int aRow, int aCol )> aErrorHandler )
|
||||
bool LIB_TABLE_GRID_TRICKS::VerifyTable( WX_GRID* aGrid, bool aSupportsVisibilityColumn,
|
||||
std::function<void( int aRow, int aCol )> aErrorHandler )
|
||||
{
|
||||
wxWindow* topLevelParent = wxGetTopLevelParent( aGrid );
|
||||
LIB_TABLE_GRID_DATA_MODEL* model = static_cast<LIB_TABLE_GRID_DATA_MODEL*>( aGrid->GetTable() );
|
||||
@@ -495,8 +496,11 @@ bool LIB_TABLE_GRID_TRICKS::VerifyTable( WX_GRID* aGrid, std::function<void( int
|
||||
model->SetValue( 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.
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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<void( int aRow, int aCol )> aErrorHandler );
|
||||
static bool VerifyTable( WX_GRID* aGrid, bool aSupportsVisibilityColumn,
|
||||
std::function<void( int aRow, int aCol )> 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;
|
||||
};
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user