Add some debugging statements to find out what's up with GTK.

This commit is contained in:
Jeff Young 2018-07-21 23:17:46 +01:00
parent 07a665f4fd
commit 7dfc4e30e4
4 changed files with 14 additions and 28 deletions

View File

@ -112,7 +112,6 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS*
m_ptr = aSettings;
m_settings = *aSettings;
m_settings.SetupLayersList( m_layers, m_Parent, true );
int layersWidth = m_layers->GetColumn( 0 )->GetWidth() + m_layers->GetColumn( 1 )->GetWidth();
m_settingsExported = false;
@ -121,13 +120,7 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS*
m_sdbSizerOK->SetDefault();
GetSizer()->SetSizeHints( this );
// Must be done after SetSizeHints() else GTK will overwrite it
m_layers->SetMinSize( wxSize( layersWidth + 4, m_layers->GetMinSize().y ) );
// the default position, when calling the first time the dlg
Center();
FinishDialogSettings();
}

View File

@ -70,17 +70,10 @@ DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES( PCB_BASE_FRAME*
m_ptr = aSettings;
m_zonesettings = *aSettings;
m_zonesettings.SetupLayersList( m_layers, m_parent, true );
int layersWidth = m_layers->GetColumn( 0 )->GetWidth() + m_layers->GetColumn( 1 )->GetWidth();
m_sdbSizerButtonsOK->SetDefault();
GetSizer()->SetSizeHints( this );
// Must be done after SetSizeHints() else GTK will overwrite it
m_layers->SetMinSize( wxSize( layersWidth + 4, m_layers->GetMinSize().y ) );
// the default position, when calling the first time the dlg
Center();
FinishDialogSettings();
}

View File

@ -73,15 +73,8 @@ DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME*
m_ptr = aSettings;
m_settings = *aSettings;
m_settings.SetupLayersList( m_layers, m_parent, false );
int layersWidth = m_layers->GetColumn( 0 )->GetWidth() + m_layers->GetColumn( 1 )->GetWidth();
GetSizer()->SetSizeHints( this );
// Must be done after SetSizeHints() else GTK will overwrite it
m_layers->SetMinSize( wxSize( layersWidth + 4, m_layers->GetMinSize().y ) );
// the default position, when calling the first time the dlg
Center();
FinishDialogSettings();
}

View File

@ -172,7 +172,7 @@ void ZONE_SETTINGS::SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME*
wxDataViewColumn* layerIDColumn = aList->AppendTextColumn( wxEmptyString );
layerIDColumn->SetHidden( true );
int minWidth = 0;
int textWidth = 0;
for( LSEQ layer = layers.UIOrder(); layer; ++layer )
{
@ -180,7 +180,7 @@ void ZONE_SETTINGS::SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME*
wxString layerName = board->GetLayerName( layerID );
// wxCOL_WIDTH_AUTOSIZE doesn't work on all platforms, so we calculate width here
minWidth = std::max( minWidth, GetTextSize( layerName, aList ).x );
textWidth = std::max( textWidth, GetTextSize( layerName, aList ).x );
COLOR4D layerColor = aFrame->Settings().Colors().GetLayerColor( layerID );
auto bitmap = COLOR_SWATCH::MakeBitmap( layerColor, backgroundColor, LAYER_BITMAP_SIZE );
@ -197,12 +197,19 @@ void ZONE_SETTINGS::SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME*
aList->SetToggleValue( true, (unsigned) aList->GetItemCount() - 1, 0 );
}
checkColumn->SetWidth( 25 );
layerColumn->SetWidth( minWidth + LAYER_BITMAP_SIZE.x + 25 );
int checkColWidth = 22;
int layerColWidth = textWidth + LAYER_BITMAP_SIZE.x + 12;
// You'd think the fact that m_layers is a list would encourage wxWidgets not to save room
// for the tree expanders... but you'd be wrong. Force indent to 0.
aList->SetIndent( 0 );
aList->SetMinClientSize( wxSize( checkColWidth + layerColWidth, aList->GetMinClientSize().y ) );
checkColumn->SetWidth( checkColWidth );
layerColumn->SetWidth( layerColWidth );
int afterCheckColWidth = checkColumn->GetWidth();
int afterLayerColWidth = layerColumn->GetWidth();
}