From 89f14906a429e749b52d8b7c4660b0bbb8b694cf Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Fri, 4 Jul 2014 10:55:51 +0200 Subject: [PATCH] - Added the courtyard/fabrication layer to the layer combo and layer panel - Corrected handling of scrollability in layer panel (fixes 1336996) --- common/lset.cpp | 2 +- common/view/view.cpp | 2 +- pcbnew/class_pcb_layer_widget.cpp | 4 ++ pcbnew/layer_widget.cpp | 71 +++++++------------------------ 4 files changed, 22 insertions(+), 57 deletions(-) diff --git a/common/lset.cpp b/common/lset.cpp index 3ec3607a92..dcb22e3b3d 100644 --- a/common/lset.cpp +++ b/common/lset.cpp @@ -633,7 +633,7 @@ LSET LSET::BackMask() LSEQ LSET::UIOrder() const { - LAYER_ID order[Margin+1]; + LAYER_ID order[LAYER_ID_COUNT]; // Assmuming that the LAYER_ID order is according to preferred UI order, as of // today this is true. When that becomes not true, its easy to change the order diff --git a/common/view/view.cpp b/common/view/view.cpp index 2d8556a916..f877164c5b 100644 --- a/common/view/view.cpp +++ b/common/view/view.cpp @@ -153,7 +153,7 @@ void VIEW::SetRequired( int aLayerId, int aRequiredId, bool aRequired ) } -// stupid C++... python lamda would do this in one line +// stupid C++... python lambda would do this in one line template struct queryVisitor { diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index 4004ca9715..b0e5910a76 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -330,6 +330,10 @@ void PCB_LAYER_WIDGET::ReFill() { Eco2_User, _( "User defined meaning" ) }, { Edge_Cuts, _( "Board's perimeter definition" ) }, { Margin, _( "Board's edge setback outline" ) }, + { F_CrtYd, _( "Footprint courtyards on board's front" ) }, + { B_CrtYd, _( "Footprint courtyards on board's back" ) }, + { F_Fab, _( "Footprint assembly on board's front" ) }, + { B_Fab, _( "Footprint assembly on board's back" ) } }; for( unsigned i=0; iConnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnLeftDownLayers ), NULL, this ); - st->SetToolTip( aSpec.tooltip ); - m_LayersFlexGridSizer->wxSizer::Insert( index+col, st, 0, flags ); - - // column 3 - col = 3; wxCheckBox* cb = new wxCheckBox( m_LayerScrolledWindow, encodeId( col, aSpec.id ), wxEmptyString ); cb->SetValue( aSpec.state ); cb->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( LAYER_WIDGET::OnLayerCheckBox ), NULL, this ); cb->SetToolTip( _( "Enable this for visibility" ) ); m_LayersFlexGridSizer->wxSizer::Insert( index+col, cb, 0, flags ); + + // column 3 + col = 3; + wxStaticText* st = new wxStaticText( m_LayerScrolledWindow, encodeId( col, aSpec.id ), aSpec.rowName ); + shrinkFont( st, m_PointSize ); + st->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnLeftDownLayers ), NULL, this ); + st->SetToolTip( aSpec.tooltip ); + m_LayersFlexGridSizer->wxSizer::Insert( index+col, st, 0, flags ); } @@ -526,7 +526,7 @@ LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, int aPoint m_LayerScrolledWindow->SetScrollRate( 5, 5 ); m_LayersFlexGridSizer = new wxFlexGridSizer( 0, 4, 0, 1 ); m_LayersFlexGridSizer->SetFlexibleDirection( wxHORIZONTAL ); - m_LayersFlexGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + m_LayersFlexGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_NONE ); m_LayerScrolledWindow->SetSizer( m_LayersFlexGridSizer ); m_LayerScrolledWindow->Layout(); @@ -583,16 +583,6 @@ LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, int aPoint wxSize LAYER_WIDGET::GetBestSize() const { -#if 0 - wxSize layerz = m_LayersFlexGridSizer->GetMinSize(); - wxSize renderz = m_RenderFlexGridSizer->GetMinSize(); - - wxSize clientz( std::max(renderz.x,layerz.x), std::max(renderz.y,layerz.y) ); - - return ClientToWindowSize( clientz ); - -#else - // size of m_LayerScrolledWindow -------------- wxArrayInt widths = m_LayersFlexGridSizer->GetColWidths(); int totWidth = 0; @@ -608,20 +598,10 @@ wxSize LAYER_WIDGET::GetBestSize() const totWidth += 10; - wxArrayInt heights = m_LayersFlexGridSizer->GetRowHeights(); - int totHeight = 0; - if( heights.GetCount() ) - { - int rowCount = GetLayerRowCount(); - for( int i=0; iGetVGap(); - // printf("heights[%d]:%d\n", i, heights[i] ); - } - totHeight += 2 * heights[0]; // use 2 row heights to approximate tab height - } - else - totHeight += 20; // not used except before adding rows. + /* The minimum height is a small size to properly force computation + * of the panel's scrollbars (otherwise it will assume it *has* all + * this space) */ + unsigned totHeight = 32; wxSize layerz( totWidth, totHeight ); @@ -642,35 +622,14 @@ wxSize LAYER_WIDGET::GetBestSize() const // account for the parent's frame, this one has void space of 10 PLUS a border: totWidth += 20; - - heights = m_RenderFlexGridSizer->GetRowHeights(); - totHeight = 0; - if( heights.GetCount() ) - { - int rowCount = GetRenderRowCount(); - for( int i=0; iGetVGap(); - // printf("heights[%d]:%d\n", i, heights[i] ); - } - totHeight += 2 * heights[0]; // use 2 row heights to approximate tab height - } - else - totHeight += 20; // not used except before adding rows - + // For totHeight re-use the previous small one wxSize renderz( totWidth, totHeight ); renderz += m_RenderingPanel->GetWindowBorderSize(); wxSize clientz( std::max(renderz.x,layerz.x), std::max(renderz.y,layerz.y) ); -// wxSize diffz( GetSize() - GetClientSize() ); -// clientz += diffz; - return clientz; - -#endif - } @@ -852,6 +811,8 @@ void LAYER_WIDGET::UpdateLayouts() { m_LayersFlexGridSizer->Layout(); m_RenderFlexGridSizer->Layout(); + m_LayerPanel->Layout(); + m_RenderingPanel->Layout(); FitInside(); }