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

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

  panel
- Corrected handling of scrollability in layer panel (fixes 1336996)
parent eb396a5e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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>
struct queryVisitor
{
+4 −0
Original line number Diff line number Diff line
@@ -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;  i<DIM(non_cu_seq);  ++i )
+16 −55
Original line number Diff line number Diff line
@@ -428,19 +428,19 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec )

    // column 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 );
    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; 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.
    /* 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; 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

    // 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();
}