Commit 89f14906 authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio

- Added the courtyard/fabrication layer to the layer combo and layer

  panel
- Corrected handling of scrollability in layer panel (fixes 1336996)
parent eb396a5e
...@@ -633,7 +633,7 @@ LSET LSET::BackMask() ...@@ -633,7 +633,7 @@ LSET LSET::BackMask()
LSEQ LSET::UIOrder() const 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 // 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 // today this is true. When that becomes not true, its easy to change the order
......
...@@ -153,7 +153,7 @@ void VIEW::SetRequired( int aLayerId, int aRequiredId, bool aRequired ) ...@@ -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 <class Container> template <class Container>
struct queryVisitor struct queryVisitor
{ {
......
...@@ -330,6 +330,10 @@ void PCB_LAYER_WIDGET::ReFill() ...@@ -330,6 +330,10 @@ void PCB_LAYER_WIDGET::ReFill()
{ Eco2_User, _( "User defined meaning" ) }, { Eco2_User, _( "User defined meaning" ) },
{ Edge_Cuts, _( "Board's perimeter definition" ) }, { Edge_Cuts, _( "Board's perimeter definition" ) },
{ Margin, _( "Board's edge setback outline" ) }, { 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; i<DIM(non_cu_seq); ++i ) for( unsigned i=0; i<DIM(non_cu_seq); ++i )
......
...@@ -428,19 +428,19 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec ) ...@@ -428,19 +428,19 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec )
// column 2 // column 2
col = 2; col = 2;
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 );
// column 3
col = 3;
wxCheckBox* cb = new wxCheckBox( m_LayerScrolledWindow, encodeId( col, aSpec.id ), wxEmptyString ); wxCheckBox* cb = new wxCheckBox( m_LayerScrolledWindow, encodeId( col, aSpec.id ), wxEmptyString );
cb->SetValue( aSpec.state ); cb->SetValue( aSpec.state );
cb->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( LAYER_WIDGET::OnLayerCheckBox ), NULL, this ); cb->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( LAYER_WIDGET::OnLayerCheckBox ), NULL, this );
cb->SetToolTip( _( "Enable this for visibility" ) ); cb->SetToolTip( _( "Enable this for visibility" ) );
m_LayersFlexGridSizer->wxSizer::Insert( index+col, cb, 0, flags ); 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 ...@@ -526,7 +526,7 @@ LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, int aPoint
m_LayerScrolledWindow->SetScrollRate( 5, 5 ); m_LayerScrolledWindow->SetScrollRate( 5, 5 );
m_LayersFlexGridSizer = new wxFlexGridSizer( 0, 4, 0, 1 ); m_LayersFlexGridSizer = new wxFlexGridSizer( 0, 4, 0, 1 );
m_LayersFlexGridSizer->SetFlexibleDirection( wxHORIZONTAL ); m_LayersFlexGridSizer->SetFlexibleDirection( wxHORIZONTAL );
m_LayersFlexGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); m_LayersFlexGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_NONE );
m_LayerScrolledWindow->SetSizer( m_LayersFlexGridSizer ); m_LayerScrolledWindow->SetSizer( m_LayersFlexGridSizer );
m_LayerScrolledWindow->Layout(); m_LayerScrolledWindow->Layout();
...@@ -583,16 +583,6 @@ LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, int aPoint ...@@ -583,16 +583,6 @@ LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, int aPoint
wxSize LAYER_WIDGET::GetBestSize() const 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 -------------- // size of m_LayerScrolledWindow --------------
wxArrayInt widths = m_LayersFlexGridSizer->GetColWidths(); wxArrayInt widths = m_LayersFlexGridSizer->GetColWidths();
int totWidth = 0; int totWidth = 0;
...@@ -608,20 +598,10 @@ wxSize LAYER_WIDGET::GetBestSize() const ...@@ -608,20 +598,10 @@ wxSize LAYER_WIDGET::GetBestSize() const
totWidth += 10; totWidth += 10;
wxArrayInt heights = m_LayersFlexGridSizer->GetRowHeights(); /* The minimum height is a small size to properly force computation
int totHeight = 0; * of the panel's scrollbars (otherwise it will assume it *has* all
if( heights.GetCount() ) * this space) */
{ unsigned totHeight = 32;
int rowCount = GetLayerRowCount();
for( int i=0; i<rowCount; ++i )
{
totHeight += heights[i] + m_LayersFlexGridSizer->GetVGap();
// 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.
wxSize layerz( totWidth, totHeight ); wxSize layerz( totWidth, totHeight );
...@@ -642,35 +622,14 @@ wxSize LAYER_WIDGET::GetBestSize() const ...@@ -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: // account for the parent's frame, this one has void space of 10 PLUS a border:
totWidth += 20; totWidth += 20;
// For totHeight re-use the previous small one
heights = m_RenderFlexGridSizer->GetRowHeights();
totHeight = 0;
if( heights.GetCount() )
{
int rowCount = GetRenderRowCount();
for( int i=0; i<rowCount && i<(int)heights.GetCount(); ++i )
{
totHeight += heights[i] + m_RenderFlexGridSizer->GetVGap();
// 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
wxSize renderz( totWidth, totHeight ); wxSize renderz( totWidth, totHeight );
renderz += m_RenderingPanel->GetWindowBorderSize(); renderz += m_RenderingPanel->GetWindowBorderSize();
wxSize clientz( std::max(renderz.x,layerz.x), std::max(renderz.y,layerz.y) ); wxSize clientz( std::max(renderz.x,layerz.x), std::max(renderz.y,layerz.y) );
// wxSize diffz( GetSize() - GetClientSize() );
// clientz += diffz;
return clientz; return clientz;
#endif
} }
...@@ -852,6 +811,8 @@ void LAYER_WIDGET::UpdateLayouts() ...@@ -852,6 +811,8 @@ void LAYER_WIDGET::UpdateLayouts()
{ {
m_LayersFlexGridSizer->Layout(); m_LayersFlexGridSizer->Layout();
m_RenderFlexGridSizer->Layout(); m_RenderFlexGridSizer->Layout();
m_LayerPanel->Layout();
m_RenderingPanel->Layout();
FitInside(); FitInside();
} }
......
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