Commit 00f8994e authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Eeschema: Fix a (minor but annoying) bug detected by coverity which prevent...

Eeschema: Fix a (minor but annoying) bug detected by coverity which prevent Eeschema to draw components in "fast mode" (i;e. without pin texts) when they are moved, due to a draw parameter which was incorrectly used.
Move items rework: enhancements: for some items (sheets, components, bus entries) the mouse cursor is no more wrapped to the anchor. For large symbols, this is better: they are more easy to place.
There is also a change when starting a move item command: the full screen is redraw, and therefore there is no artifact due to the XOR draw mode.
Some other minor coverity fixes (uninitialized members).
parent 21013246
Loading
Loading
Loading
Loading
+15 −5
Original line number Original line Diff line number Diff line
/*
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 *
 * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
 * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
 * Copyright (C) 2009-2011 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 2009-2015 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
 * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
 *
 *
 * This program is free software; you can redistribute it and/or
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * modify it under the terms of the GNU General Public License
@@ -397,6 +397,11 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
        for( unsigned ii = 0; ii < block->GetCount(); ii++ )
        for( unsigned ii = 0; ii < block->GetCount(); ii++ )
        {
        {
            schitem = (SCH_ITEM*) block->GetItem( ii );
            schitem = (SCH_ITEM*) block->GetItem( ii );

            if( schitem->Type() == SCH_COMPONENT_T )
                ((SCH_COMPONENT*)schitem)->Draw( aPanel, aDC, block->GetMoveVector(),
                                                 g_XorMode, g_GhostColor, false );
            else
                schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
                schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
        }
        }
    }
    }
@@ -408,6 +413,11 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
    for( unsigned ii = 0; ii < block->GetCount(); ii++ )
    for( unsigned ii = 0; ii < block->GetCount(); ii++ )
    {
    {
        schitem = (SCH_ITEM*) block->GetItem( ii );
        schitem = (SCH_ITEM*) block->GetItem( ii );

            if( schitem->Type() == SCH_COMPONENT_T )
                ((SCH_COMPONENT*)schitem)->Draw( aPanel, aDC, block->GetMoveVector(),
                                                 g_XorMode, g_GhostColor, false );
            else
                schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
                schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
    }
    }
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -442,7 +442,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
        ( (SCH_COMPONENT*) my_clone )->SetTimeStamp( GetNewTimeStamp() );
        ( (SCH_COMPONENT*) my_clone )->SetTimeStamp( GetNewTimeStamp() );
        my_clone->Move( pos );
        my_clone->Move( pos );
        my_clone->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode );
        my_clone->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode );
        MoveItem( my_clone, DC );
        PrepareMoveItem( my_clone, DC );
    }
    }
    else
    else
    {
    {
+11 −3
Original line number Original line Diff line number Diff line
@@ -4,11 +4,11 @@
/*
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 *
 * Copyright (C) 1992-2012 Jean-Pierre Charras <jp.charras at wanadoo.fr
 * Copyright (C) 1992-2015 Jean-Pierre Charras jp.charras at wanadoo.fr
 * Copyright (C) 1992-2010 Lorenzo Marcantonio
 * Copyright (C) 1992-2010 Lorenzo Marcantonio
 * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
 *
 *
 * Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
 * Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors.
 *
 *
 * This program is free software; you can redistribute it and/or
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * modify it under the terms of the GNU General Public License
@@ -343,7 +343,15 @@ wxFileName DIALOG_PLOT_SCHEMATIC::createPlotFileName( wxTextCtrl* aOutputDirecto


    wxString plotFileName = Prj().AbsolutePath( aPlotFileName + wxT(".") + aExtension);
    wxString plotFileName = Prj().AbsolutePath( aPlotFileName + wxT(".") + aExtension);


    EnsureFileDirectoryExists( &outputDir, plotFileName, aReporter );
    if( !EnsureFileDirectoryExists( &outputDir, plotFileName, aReporter ) )
    {
        wxString msg;
        msg.Printf( _( "Could not write plot files to folder \"%s\"." ),
                    GetChars( outputDir.GetPath() ) );
        msg << wxT( "\n" );
        aReporter->Report( msg );
    }

    wxFileName fn( plotFileName );
    wxFileName fn( plotFileName );
    fn.SetPath( outputDir.GetFullPath() );
    fn.SetPath( outputDir.GetFullPath() );
    return fn;
    return fn;
+1 −1
Original line number Original line Diff line number Diff line
@@ -123,7 +123,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )


    // Prepare display to move the new item
    // Prepare display to move the new item
    textItem->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
    textItem->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
    MoveItem( (SCH_ITEM*) textItem, aDC );
    PrepareMoveItem( (SCH_ITEM*) textItem, aDC );


    return textItem;
    return textItem;
}
}
+2 −2
Original line number Original line Diff line number Diff line
@@ -56,7 +56,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
        newitem->SetFlags( IS_NEW );
        newitem->SetFlags( IS_NEW );
        // Draw the new part, MoveItem() expects it to be already on screen.
        // Draw the new part, MoveItem() expects it to be already on screen.
        newitem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode );
        newitem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode );
        MoveItem( newitem, &dc );
        PrepareMoveItem( newitem, &dc );
    }
    }
    break;
    break;


@@ -69,7 +69,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
        newitem->SetFlags( IS_NEW );
        newitem->SetFlags( IS_NEW );
        // Draw the new item, MoveItem() expects it to be already on screen.
        // Draw the new item, MoveItem() expects it to be already on screen.
        newitem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode );
        newitem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode );
        MoveItem( newitem, &dc );
        PrepareMoveItem( newitem, &dc );
    }
    }
        break;
        break;


Loading