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.)
(cherry picked from commit 245c3ba6e4
)
This commit is contained in:
parent
e59867d479
commit
97be02356f
|
@ -174,9 +174,6 @@ PANEL_FP_EDITOR_DEFAULTS::PANEL_FP_EDITOR_DEFAULTS( wxWindow* aParent,
|
||||||
UNITS_PROVIDER* aUnitsProvider ) :
|
UNITS_PROVIDER* aUnitsProvider ) :
|
||||||
PANEL_FP_EDITOR_DEFAULTS_BASE( aParent )
|
PANEL_FP_EDITOR_DEFAULTS_BASE( aParent )
|
||||||
{
|
{
|
||||||
m_parent = dynamic_cast<PAGED_DIALOG*>( aParent->GetParent()->GetParent() );
|
|
||||||
wxASSERT_MSG( m_parent, wxS( "Incorrect parent window passed" ) );
|
|
||||||
|
|
||||||
m_textItemsGrid->SetDefaultRowSize( m_textItemsGrid->GetDefaultRowSize() + 4 );
|
m_textItemsGrid->SetDefaultRowSize( m_textItemsGrid->GetDefaultRowSize() + 4 );
|
||||||
|
|
||||||
m_textItemsGrid->SetTable( new TEXT_ITEMS_GRID_TABLE(), true );
|
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()
|
bool PANEL_FP_EDITOR_DEFAULTS::TransferDataFromWindow()
|
||||||
{
|
{
|
||||||
if( !validateData() )
|
if( !m_textItemsGrid->CommitPendingChanges() || !m_graphicsGrid->CommitPendingChanges() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||||
|
|
|
@ -43,13 +43,10 @@ private:
|
||||||
|
|
||||||
bool Show( bool aShow ) override;
|
bool Show( bool aShow ) override;
|
||||||
|
|
||||||
bool validateData();
|
|
||||||
|
|
||||||
void loadFPSettings( FOOTPRINT_EDITOR_SETTINGS* aCfg );
|
void loadFPSettings( FOOTPRINT_EDITOR_SETTINGS* aCfg );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PAGED_DIALOG* m_parent;
|
bool m_firstShow = true;
|
||||||
bool m_firstShow = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue