Browse Source

Work around annoying wxWidgets assert.

6.0.7
Jeff Young 4 years ago
parent
commit
c536a4c4f2
  1. 4
      common/dialogs/dialog_configure_paths.cpp
  2. 7
      common/dialogs/panel_setup_netclasses.cpp
  3. 2
      common/dialogs/panel_text_variables.cpp
  4. 2
      eeschema/dialogs/dialog_edit_symbols_libid.cpp
  5. 4
      eeschema/dialogs/panel_eeschema_template_fieldnames.cpp
  6. 2
      eeschema/dialogs/panel_sym_lib_table.cpp
  7. 11
      include/widgets/wx_grid.h
  8. 2
      pcbnew/dialogs/panel_fp_lib_table.cpp
  9. 2
      pcbnew/dialogs/panel_fp_properties_3d_model.cpp
  10. 3
      pcbnew/dialogs/panel_pcbnew_action_plugins.cpp
  11. 11
      pcbnew/dialogs/panel_setup_tracks_and_vias.cpp
  12. 4
      pcbnew/footprint_wizard_frame.cpp

4
common/dialogs/dialog_configure_paths.cpp

@ -71,7 +71,7 @@ DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS( wxWindow* aParent, FILENAME_RESO
m_btnMoveUp->SetBitmap( KiBitmap( BITMAPS::small_up ) );
m_btnMoveDown->SetBitmap( KiBitmap( BITMAPS::small_down ) );
m_EnvVars->DeleteRows( 0, m_EnvVars->GetNumberRows() );
m_EnvVars->ClearRows();
m_EnvVars->AppendCols( 1 ); // for the isExternal flags
m_EnvVars->HideCol( TV_FLAG_COL );
m_EnvVars->UseNativeColHeader( true );
@ -96,7 +96,7 @@ DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS( wxWindow* aParent, FILENAME_RESO
if( m_resolver )
{
m_SearchPaths->DeleteRows( 0, m_SearchPaths->GetNumberRows() );
m_SearchPaths->ClearRows();
m_SearchPaths->UseNativeColHeader( true );
// prohibit these characters in the alias names: []{}()%~<>"='`;:.,&?/\|$

7
common/dialogs/panel_setup_netclasses.cpp

@ -241,9 +241,7 @@ bool PANEL_SETUP_NETCLASSES::TransferDataToWindow()
for( const wxString& candidate : m_netNames )
netToNetclassMap[ candidate ] = wxEmptyString;
if( m_netclassGrid->GetNumberRows() )
m_netclassGrid->DeleteRows( 0, m_netclassGrid->GetNumberRows() );
m_netclassGrid->ClearRows();
m_netclassGrid->AppendRows((int) m_netclasses->GetCount() + 1 ); // + 1 for default netclass
// enter the Default NETCLASS.
@ -272,8 +270,7 @@ bool PANEL_SETUP_NETCLASSES::TransferDataToWindow()
}
}
if( m_membershipGrid->GetNumberRows() )
m_membershipGrid->DeleteRows( 0, m_membershipGrid->GetNumberRows() );
m_membershipGrid->ClearRows();
// add currently-assigned and candidate netnames to membership lists
for( const std::pair<const wxString, wxString>& ii : netToNetclassMap )

2
common/dialogs/panel_text_variables.cpp

@ -48,7 +48,7 @@ PANEL_TEXT_VARIABLES::PANEL_TEXT_VARIABLES( wxWindow* aParent, PROJECT* aProject
m_btnAddTextVar->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
m_btnDeleteTextVar->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
m_TextVars->DeleteRows( 0, m_TextVars->GetNumberRows() );
m_TextVars->ClearRows();
// prohibit these characters in the alias names: []{}()%~<>"='`;:.,&?/\|$
m_nameValidator.SetStyle( wxFILTER_EXCLUDE_CHAR_LIST );

2
eeschema/dialogs/dialog_edit_symbols_libid.cpp

@ -380,7 +380,7 @@ static bool sort_by_libid( const SYMBOL_CANDIDATE& candidate1, const SYMBOL_CAND
void DIALOG_EDIT_SYMBOLS_LIBID::initDlg()
{
// Clear the FormBuilder rows
m_grid->DeleteRows( 0, m_grid->GetNumberRows() );
m_grid->ClearRows();
m_isModified = false;

4
eeschema/dialogs/panel_eeschema_template_fieldnames.cpp

@ -107,9 +107,7 @@ bool PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataToGrid()
{
m_grid->Freeze();
if( m_grid->GetNumberRows() )
m_grid->DeleteRows( 0, m_grid->GetNumberRows() );
m_grid->ClearRows();
m_grid->AppendRows( m_fields.size() );
for( int row = 0; row < m_grid->GetNumberRows(); ++row )

2
eeschema/dialogs/panel_sym_lib_table.cpp

@ -903,7 +903,7 @@ void PANEL_SYM_LIB_TABLE::populateEnvironReadOnlyTable()
std::set< wxString > unique;
// clear the table
m_path_subs_grid->DeleteRows( 0, m_path_subs_grid->GetNumberRows() );
m_path_subs_grid->ClearRows();
for( SYMBOL_LIB_TABLE_GRID* tbl : { global_model(), project_model() } )
{

11
include/widgets/wx_grid.h

@ -98,6 +98,17 @@ public:
*/
void ShowEditorOnMouseUp() { m_waitForSlowClick = true; }
/**
* wxWidgets recently added an ASSERT which fires if the position is greater than or equal
* to the number of rows (even if the delete count is 0). Needless to say, this makes using
* DeleteRows for clearing a lot more cumbersome so we add a helper here.
*/
void ClearRows()
{
if( GetNumberRows() )
DeleteRows( 0, GetNumberRows() );
}
protected:
/**
* A re-implementation of wxGrid::DrawColLabel which left-aligns the first column when

2
pcbnew/dialogs/panel_fp_lib_table.cpp

@ -1007,7 +1007,7 @@ void PANEL_FP_LIB_TABLE::populateEnvironReadOnlyTable()
std::set< wxString > unique;
// clear the table
m_path_subs_grid->DeleteRows( 0, m_path_subs_grid->GetNumberRows() );
m_path_subs_grid->ClearRows();
for( FP_LIB_TABLE_GRID* tbl : { global_model(), project_model() } )
{

2
pcbnew/dialogs/panel_fp_properties_3d_model.cpp

@ -147,7 +147,7 @@ void PANEL_FP_PROPERTIES_3D_MODEL::ReloadModelsFromFootprint()
#endif
m_shapes3D_list.clear();
m_modelsGrid->DeleteRows( 0, m_modelsGrid->GetNumberRows() );
m_modelsGrid->ClearRows();
wxString origPath, alias, shortPath;
FILENAME_RESOLVER* res = m_frame->Prj().Get3DCacheManager()->GetResolver();

3
pcbnew/dialogs/panel_pcbnew_action_plugins.cpp

@ -172,8 +172,7 @@ bool PANEL_PCBNEW_ACTION_PLUGINS::TransferDataToWindow()
{
m_grid->Freeze();
if( m_grid->GetNumberRows() != 0 )
m_grid->DeleteRows( 0, m_grid->GetNumberRows() );
m_grid->ClearRows();
const auto& orderedPlugins = m_frame->GetOrderedActionPlugins();
m_grid->AppendRows( orderedPlugins.size() );

11
pcbnew/dialogs/panel_setup_tracks_and_vias.cpp

@ -112,14 +112,9 @@ PANEL_SETUP_TRACKS_AND_VIAS::~PANEL_SETUP_TRACKS_AND_VIAS()
bool PANEL_SETUP_TRACKS_AND_VIAS::TransferDataToWindow()
{
if( m_trackWidthsGrid->GetNumberRows() > 0 )
m_trackWidthsGrid->DeleteRows( 0, m_trackWidthsGrid->GetNumberRows() );
if( m_viaSizesGrid->GetNumberRows() > 0 )
m_viaSizesGrid->DeleteRows( 0, m_viaSizesGrid->GetNumberRows() );
if( m_diffPairsGrid->GetNumberRows() > 0 )
m_diffPairsGrid->DeleteRows( 0, m_diffPairsGrid->GetNumberRows() );
m_trackWidthsGrid->ClearRows();
m_viaSizesGrid->ClearRows();
m_diffPairsGrid->ClearRows();
// Skip the first item, which is the current netclass value
for( unsigned ii = 1; ii < m_BrdSettings->m_TrackWidthList.size(); ii++ )

4
pcbnew/footprint_wizard_frame.cpp

@ -400,9 +400,7 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
wxArrayString hintsList = footprintWizard->GetParameterHints( m_parameterGridPage );
// Dimension the wxGrid
if( m_parameterGrid->GetNumberRows() > 0 )
m_parameterGrid->DeleteRows( 0, m_parameterGrid->GetNumberRows() );
m_parameterGrid->ClearRows();
m_parameterGrid->AppendRows( namesList.size() );
wxString designator, name, value, units, hint;

Loading…
Cancel
Save