Preference setting to use sketch mode while dragging

Bug #1787499 reported by Franck78 on 2018-08-16
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Jeff Young

Bug Description

while moving something


Open the attachment.

J1 is being moved.

As you can see, you don't see under the footprint's holes. The two axle big lines are helping but not so much.

Just **don't** paint in black the hole selected as anchor. Leave the void empty or really transparent. Omit the pin number/net name as well.
Seeing a little anchor for the center of the hole and all the points of the grid is just what we need.
The grid is useless when a hundred invisible points are attracting.

Probably also apply to other objects. Transparency while moving.

Application: kicad
Version: 5.0.0, release build
    wxWidgets 3.0.2
    libcurl/7.37.0 OpenSSL/1.0.2j zlib/1.2.8 libidn/1.28 libssh2/1.4.3
Platform: Linux 4.4.140-62-default x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.2 (wchar_t,STL containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.61.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.37.0
    Compiler: GCC 4.8.5 with C++ ABI 1002

Build settings:

Franck78 (fbourdonnec) wrote :
Jeff Young (jeyjey) wrote :

I looked into this. The holes are drawn on a separate layer which is then composited to the canvas. The pads themselves are drawn "full" (that is, without regard to their holes).

It would probably only be 4 or 5 hours work to knock-out the holes from the pad layer, and then suppress drawing of the holes layer when dragging, but it would also complicate the code, and incur some (perhaps minimal) performance penalty.

I'll leave this open for a while to see if it gathers any more requests, but at present I don't think the bang is worth the buck.

Changed in kicad:
importance: Undecided → Wishlist
status: New → Triaged
Franck78 (fbourdonnec) wrote :

And dragging a simplified (no text) footprint in transparent mode ?

You have no problem doing it for a Dimensions object.

Jeff Young (jeyjey) wrote :
Download full text (11.4 KiB)

Actually text is easy because it's stroked. Same for silk and courtyard outlines. It's the pads that are hard because they're filled shapes (ie: a circle, not a ring).

This is the code that draws a pad:

void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
    PAD_SHAPE_T shape;
    double m, n;
    double orientation = aPad->GetOrientation();

    // Draw description layer
    if( IsNetnameLayer( aLayer ) )
        VECTOR2D position( aPad->ShapePos() );

        // Is anything that we can display enabled?
        if( m_pcbSettings.m_netNamesOnPads || m_pcbSettings.m_padNumbers )
            bool displayNetname = ( m_pcbSettings.m_netNamesOnPads && !aPad->GetNetname().empty() );
            VECTOR2D padsize = VECTOR2D( aPad->GetSize() );
            double maxSize = PCB_RENDER_SETTINGS::MAX_FONT_SIZE;
            double size = padsize.y;

            // Keep the size ratio for the font, but make it smaller
            if( padsize.x < padsize.y )
                orientation += 900.0;
                size = padsize.x;
                std::swap( padsize.x, padsize.y );
            else if( padsize.x == padsize.y )
                // If the text is displayed on a symmetrical pad, do not rotate it
                orientation = 0.0;

            // Font size limits
            if( size > maxSize )
                size = maxSize;

            m_gal->Translate( position );

            // do not display descriptions upside down
            NORMALIZE_ANGLE_90( orientation );
            m_gal->Rotate( DECIDEG2RAD( -orientation ) );

            // Default font settings
            m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
            m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
            m_gal->SetFontBold( false );
            m_gal->SetFontItalic( false );
            m_gal->SetTextMirrored( false );
            m_gal->SetStrokeColor( m_pcbSettings.GetColor( NULL, aLayer ) );
            m_gal->SetIsStroke( true );
            m_gal->SetIsFill( false );

            // Set the text position to the pad shape position (the pad position is not the best place)
            VECTOR2D textpos( 0.0, 0.0 );

            // Divide the space, to display both pad numbers and netnames
            // and set the Y text position to display 2 lines
            if( displayNetname && m_pcbSettings.m_padNumbers )
                size = size / 2.0;
                textpos.y = size / 2.0;

            if( displayNetname )
                // calculate the size of net name text:
                double tsize = 1.5 * padsize.x / aPad->GetShortNetname().Length();
                tsize = std::min( tsize, size );
                // Use a smaller text size to handle interline, pen size..
                tsize *= 0.7;
                VECTOR2D namesize( tsize, tsize );

                m_gal->SetGlyphSize( namesize );
                m_gal->SetLineWidth( namesize.x / 12.0 );
                m_gal->BitmapText( aPad->GetShortNetname(), textpos, 0.0 );

            if( m_pcbSettings.m_padNumbers )

Franck78 (fbourdonnec) wrote :

I learned it the hard way : don't trust grep to locate a piece of code (legacy/accelerated tools).

The legacy draw pad function handles this more or less.

This is just a suggestion:

add a field into D_PAD definition type, 'transparent_hole'
set it correctly to true or false on calling draw pad

This is 'support' for future use, all the job unrelated is done.
The day someone decides to solve it, he will only concentrate on the problem 'transparent hole'

Also in the code from your comment#4

between line 02 and 13, nothing changes that if susceptible to affect the return of GetColor(). Line #13 is doing nothing.

01 // Pad drawing
02 COLOR4D color = m_pcbSettings.GetColor( aPad, aLayer );
04 // Pad holes color is specific
06 {
07 // Hole color is the background color for plated holes, but a specific color
08 // for not plated holes (LAYER_NON_PLATEDHOLES color layer )
09 if( aPad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED )
10 color = m_pcbSettings.GetColor( nullptr, LAYER_NON_PLATEDHOLES );
11 // Don't let pads that *should* be NPTH get lost
12 else if( aPad->PadShouldBeNPTH() )
13 color = m_pcbSettings.GetColor( aPad, aLayer );
14 else
15 color = m_pcbSettings.GetBackgroundColor();
16 }

Franck78 (fbourdonnec) wrote :


The outline drawing mode is perfect.

Just enforce it for the single pad selected by the algorithm to magnet to the grid
It also clearly set focus on the selected pad.

Also force skip labels drawing for that pad.

Jeff Young (jeyjey) wrote :

@Franck, the Legacy code won't work with hardware acceleration on graphics cards, so it's a non starter.

The outline mode is an interesting idea though....

Jeff Young (jeyjey) wrote :

I looked into this some more and I think a "Use sketch mode when dragging" option in the PcbNew preferences might be a good compromise.

Changed in kicad:
milestone: none → 6.0.0-rc1
assignee: nobody → Jeff Young (jeyjey)
summary: - more transparency while moving footprints
+ Preference setting to use sketch mode while dragging
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments