Commit ea06ad14 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: fix Bug #1373468 (Non Copper Zones Properties dialog "Layer...

Pcbnew: fix Bug #1373468 (Non Copper Zones Properties  dialog "Layer selection" empty) (Linux specific)
parent 980ffac1
...@@ -284,11 +284,11 @@ void DIALOG_COPPER_ZONE::initDialog() ...@@ -284,11 +284,11 @@ void DIALOG_COPPER_ZONE::initDialog()
// unfortunately this option does not work well both on // unfortunately this option does not work well both on
// wxWidgets 2.8 ( column witdth too small), and // wxWidgets 2.8 ( column witdth too small), and
// wxWidgets 2.9 ( column witdth too large) // wxWidgets 2.9 ( column witdth too large)
ctrlWidth += LAYER_BITMAP_SIZE_X + 16; // Add bitmap width + margin between bitmap and text ctrlWidth += LAYER_BITMAP_SIZE_X + 25; // Add bitmap width + margin between bitmap and text
m_LayerSelectionCtrl->SetColumnWidth( 0, ctrlWidth ); m_LayerSelectionCtrl->SetColumnWidth( 0, ctrlWidth );
ctrlWidth += 4; // add small margin between text and window borders ctrlWidth += 25; // add small margin between text and window borders
// and room for vertical scroll bar
m_LayerSelectionCtrl->SetMinSize( wxSize( ctrlWidth, -1 ) ); m_LayerSelectionCtrl->SetMinSize( wxSize( ctrlWidth, -1 ) );
wxString netNameDoNotShowFilter = wxT( "Net-*" ); wxString netNameDoNotShowFilter = wxT( "Net-*" );
......
...@@ -143,13 +143,15 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::Init() ...@@ -143,13 +143,15 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL ); m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );
int ii = 0;
int lyrSelect = ( (PCB_SCREEN*) m_parent->GetScreen() )->m_Active_Layer; int lyrSelect = ( (PCB_SCREEN*) m_parent->GetScreen() )->m_Active_Layer;
if( m_zone ) if( m_zone )
lyrSelect = m_zone->GetLayer(); lyrSelect = m_zone->GetLayer();
for( LSEQ seq = LSET::AllNonCuMask().Seq(); seq; ++seq, ++ii ) int ctrlWidth = 0; // Min width for m_LayerSelectionCtrl to show the layers names
int imgIdx = 0;
for( LSEQ seq = LSET::AllNonCuMask().Seq(); seq; ++seq, ++imgIdx )
{ {
LAYER_ID layer = *seq; LAYER_ID layer = *seq;
...@@ -160,11 +162,25 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::Init() ...@@ -160,11 +162,25 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
msg.Trim(); msg.Trim();
int itemIndex = m_LayerSelectionCtrl->InsertItem( int itemIndex = m_LayerSelectionCtrl->InsertItem(
m_LayerSelectionCtrl->GetItemCount(), msg, ii ); m_LayerSelectionCtrl->GetItemCount(), msg, imgIdx );
if(lyrSelect == layer ) if(lyrSelect == layer )
m_LayerSelectionCtrl->Select( itemIndex ); m_LayerSelectionCtrl->Select( itemIndex );
wxSize tsize( GetTextSize( msg, m_LayerSelectionCtrl ) );
ctrlWidth = std::max( ctrlWidth, tsize.x );
} }
// The most easy way to ensure the right size is to use wxLIST_AUTOSIZE
// unfortunately this option does not work well both on
// wxWidgets 2.8 ( column witdth too small), and
// wxWidgets 2.9 ( column witdth too large)
ctrlWidth += LAYER_BITMAP_SIZE_X + 25; // Add bitmap width + margin between bitmap and text
m_LayerSelectionCtrl->SetColumnWidth( 0, ctrlWidth );
ctrlWidth += 25; // add small margin between text and window borders
// and room for vertical scroll bar
m_LayerSelectionCtrl->SetMinSize( wxSize( ctrlWidth, -1 ) );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment