Commit 5f297726 authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Module anchors are visible in GAL canvas.

parent 6f772c90
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -830,6 +830,21 @@ void MODULE::ViewUpdate( int aUpdateFlags )
}


void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
{
    aCount = 1;
    aLayers[0] = ITEM_GAL_LAYER( ANCHOR_VISIBLE );
}


unsigned int MODULE::ViewGetLOD( int aLayer ) const
{
    // Currently there is only one layer, so there is nothing to check
//    if( aLayer == ITEM_GAL_LAYER( ANCHOR_VISIBLE ) )
        return 30;
}


/* Test for validity of the name in a library of the footprint
 * ( no spaces, dir separators ... )
 * return true if the given name is valid
+6 −0
Original line number Diff line number Diff line
@@ -483,6 +483,12 @@ public:
    /// @copydoc VIEW_ITEM::ViewUpdate()
    void ViewUpdate( int aUpdateFlags = KIGFX::VIEW_ITEM::ALL );

    /// @copydoc VIEW_ITEM::ViewGetLayers()
    virtual void ViewGetLayers( int aLayers[], int& aCount ) const;

    /// @copydoc VIEW_ITEM::ViewGetLOD()
    virtual unsigned int ViewGetLOD( int aLayer ) const;

    /**
     * Function CopyNetlistSettings
     * copies the netlist settings to \a aModule.
+3 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ const LAYER_NUM GAL_LAYER_ORDER[] =
    ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ),
    ITEM_GAL_LAYER( MOD_REFERENCES_VISIBLE), ITEM_GAL_LAYER( MOD_VALUES_VISIBLE ),

    ITEM_GAL_LAYER( RATSNEST_VISIBLE ),
    ITEM_GAL_LAYER( RATSNEST_VISIBLE ), ITEM_GAL_LAYER( ANCHOR_VISIBLE ),
    ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ),
    ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),

@@ -141,6 +141,8 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aGalType )
        }
    }

    m_view->SetLayerTarget( ITEM_GAL_LAYER( ANCHOR_VISIBLE ), KIGFX::TARGET_NONCACHED );

    // Some more required layers settings
    m_view->SetRequired( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ) );
    m_view->SetRequired( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );
+24 −2
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( const COLORS_DESIGN_SETTINGS* aSet
    m_layerColors[NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE )]      = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
    m_layerColors[NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE )]    = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
    m_layerColors[NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE )]    = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
    m_layerColors[ITEM_GAL_LAYER( ANCHOR_VISIBLE )]                 = COLOR4D( 0.3, 0.3, 1.0, 0.9 );
    m_layerColors[ITEM_GAL_LAYER( RATSNEST_VISIBLE )]               = COLOR4D( 0.4, 0.4, 0.4, 0.8 );
    m_layerColors[ITEM_GAL_LAYER( WORKSHEET )]                      = COLOR4D( 0.5, 0.0, 0.0, 0.8 );
    m_layerColors[ITEM_GAL_LAYER( DRC_VISIBLE )]                    = COLOR4D( 1.0, 0.0, 0.0, 0.8 );
@@ -233,6 +234,10 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
        draw( (TEXTE_MODULE*) item, aLayer );
        break;

    case PCB_MODULE_T:
        draw( (MODULE*) item );
        break;

    case PCB_ZONE_AREA_T:
        draw( (ZONE_CONTAINER*) item );
        break;
@@ -284,7 +289,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )

            // Set a proper color for the label
            const COLOR4D& color = m_pcbSettings.GetColor( aTrack, aTrack->GetLayer() );
            COLOR4D labelColor = m_pcbSettings.GetColor( NULL, aLayer );
            const COLOR4D labelColor = m_pcbSettings.GetColor( NULL, aLayer );

            if( color.GetBrightness() > 0.5 )
                m_gal->SetStrokeColor( labelColor.Inverted() );
@@ -421,7 +426,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )

            // Set a proper color for the label
            const COLOR4D& color  = m_pcbSettings.GetColor( aPad, aPad->GetLayer() );
            COLOR4D labelColor = m_pcbSettings.GetColor( NULL, aLayer );
            const COLOR4D labelColor = m_pcbSettings.GetColor( NULL, aLayer );

            if( color.GetBrightness() > 0.5 )
                m_gal->SetStrokeColor( labelColor.Inverted() );
@@ -726,6 +731,23 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
}


void PCB_PAINTER::draw( const MODULE* aModule )
{
    const COLOR4D color = m_pcbSettings.GetColor( aModule, ITEM_GAL_LAYER( ANCHOR_VISIBLE ) );

    // Draw anchor
    m_gal->SetStrokeColor( color );
    m_gal->SetLineWidth( 1.0 );

    // Keep the size constant, not related to the scale
    double anchorSize = 5.0 / m_gal->GetWorldScale();

    VECTOR2D center = aModule->GetPosition();
    m_gal->DrawLine( center - VECTOR2D( anchorSize, 0 ), center + VECTOR2D( anchorSize, 0 ) );
    m_gal->DrawLine( center - VECTOR2D( 0, anchorSize ), center + VECTOR2D( 0, anchorSize ) );
}


void PCB_PAINTER::draw( const ZONE_CONTAINER* aZone )
{
    const COLOR4D& color = m_pcbSettings.GetColor( aZone, aZone->GetLayer() );
+1 −0
Original line number Diff line number Diff line
@@ -213,6 +213,7 @@ protected:
    void draw( const DRAWSEGMENT* aSegment );
    void draw( const TEXTE_PCB* aText, int aLayer );
    void draw( const TEXTE_MODULE* aText, int aLayer );
    void draw( const MODULE* aModule );
    void draw( const ZONE_CONTAINER* aZone );
    void draw( const DIMENSION* aDimension, int aLayer );
    void draw( const PCB_TARGET* aTarget );