From 245c3ba6e4a746a0576affa21ada247bef882ac6 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 9 May 2023 11:10:09 +0100 Subject: [PATCH] CLang can't do a dynamic_cast across the KiWay. Rely on DRC for text readability instead. (Fixes Sentry KICAD-R4 on Mac, and the assert when opening Preferences from a non-PCBNew-module window.) --- pcbnew/dialogs/panel_fp_editor_defaults.cpp | 31 +-------------------- pcbnew/dialogs/panel_fp_editor_defaults.h | 5 +--- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/pcbnew/dialogs/panel_fp_editor_defaults.cpp b/pcbnew/dialogs/panel_fp_editor_defaults.cpp index 502f15b43d..60bc7beddb 100644 --- a/pcbnew/dialogs/panel_fp_editor_defaults.cpp +++ b/pcbnew/dialogs/panel_fp_editor_defaults.cpp @@ -174,9 +174,6 @@ PANEL_FP_EDITOR_DEFAULTS::PANEL_FP_EDITOR_DEFAULTS( wxWindow* aParent, UNITS_PROVIDER* aUnitsProvider ) : PANEL_FP_EDITOR_DEFAULTS_BASE( aParent ) { - m_parent = dynamic_cast( aParent->GetParent()->GetParent() ); - wxASSERT_MSG( m_parent, wxS( "Incorrect parent window passed" ) ); - m_textItemsGrid->SetDefaultRowSize( m_textItemsGrid->GetDefaultRowSize() + 4 ); m_textItemsGrid->SetTable( new TEXT_ITEMS_GRID_TABLE(), true ); @@ -321,35 +318,9 @@ bool PANEL_FP_EDITOR_DEFAULTS::Show( bool aShow ) } -bool PANEL_FP_EDITOR_DEFAULTS::validateData() -{ - if( !m_textItemsGrid->CommitPendingChanges() || !m_graphicsGrid->CommitPendingChanges() ) - return false; - - // Test text parameters. - for( int row : { ROW_SILK, ROW_COPPER, ROW_FAB, ROW_OTHERS } ) - { - int textSize = std::min( m_graphicsGrid->GetUnitValue( row, COL_TEXT_WIDTH ), - m_graphicsGrid->GetUnitValue( row, COL_TEXT_HEIGHT ) ); - - int thickness = m_graphicsGrid->GetUnitValue( row, COL_TEXT_THICKNESS ); - - if( thickness > textSize / 4 ) - { - wxString msg = _( "Text will not be readable with a thickness greater than\n" - "1/4 its width or height." ); - m_parent->SetError( msg, this, m_graphicsGrid, row, COL_TEXT_THICKNESS ); - return false; - } - } - - return true; -} - - bool PANEL_FP_EDITOR_DEFAULTS::TransferDataFromWindow() { - if( !validateData() ) + if( !m_textItemsGrid->CommitPendingChanges() || !m_graphicsGrid->CommitPendingChanges() ) return false; SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); diff --git a/pcbnew/dialogs/panel_fp_editor_defaults.h b/pcbnew/dialogs/panel_fp_editor_defaults.h index 4b6c7e22bf..6989e534c6 100644 --- a/pcbnew/dialogs/panel_fp_editor_defaults.h +++ b/pcbnew/dialogs/panel_fp_editor_defaults.h @@ -43,13 +43,10 @@ private: bool Show( bool aShow ) override; - bool validateData(); - void loadFPSettings( FOOTPRINT_EDITOR_SETTINGS* aCfg ); private: - PAGED_DIALOG* m_parent; - bool m_firstShow = true; + bool m_firstShow = true; };