Commit 6de852e8 authored by dickelbeck's avatar dickelbeck
Browse files

xoring artifacts

parent 9fb2c9fe
Loading
Loading
Loading
Loading
+25 −12
Original line number Diff line number Diff line
@@ -5,6 +5,19 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.

2008-Mar-14 UPDATE   Dick Hollenbeck <dick@softplc.com>
================================================================================
+eeschema
  * cleaned up some xor artifacts, see eeschema/getpart.cpp's comment:
    // switch from normal mode to xor mode for the duration of the move, first
    // by erasing fully any "normal drawing mode" primitives with the PostDirtyRect(),
    // then by drawing the first time in xor mode so that subsequent xor
    // drawing will fully erase this first copy and then the previous copy.
  * redraw the entire screen at end of a component move.
  * added many calls to Refresh() to eeschema/onleftclick.cpp and in such cases
    I now pass a NULL DC to TestDanglingEnds()


2008-Mar-14 UPDATE  Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
    some code cleaning and comment translations.
+3 −3
Original line number Diff line number Diff line
@@ -767,7 +767,7 @@ EDA_Rect& EDA_Rect::Inflate( wxCoord dx, wxCoord dy )
 * mainly used to calculate bounding boxes
 * @param aRect = given rect to merge with this
 */
void EDA_Rect::Merge( EDA_Rect& aRect )
void EDA_Rect::Merge( const EDA_Rect& aRect )
{
    Normalize();        // ensure width and height >= 0
    EDA_Rect rect = aRect;
+6 −15
Original line number Diff line number Diff line
@@ -272,32 +272,23 @@ EDA_Rect DrawJunctionStruct::GetBoundingBox()
EDA_Rect EDA_SchComponentStruct::GetBoundingBox()
{
    const int PADDING = 40;
    int                xmin, xmax, ymin, ymax;

    // This gives a reasonable approximation (but some things are missing so...
    EDA_Rect ret = GetBoundaryBox();
    xmin = ret.m_Pos.x;
    ymin = ret.m_Pos.y;
    xmax = ret.m_Pos.x + ret.m_Size.x;
    ymax = ret.m_Pos.y + ret.m_Size.y;

    // Include BoundingBoxes of fields
    for( int i = REFERENCE; i < NUMBER_OF_FIELDS; i++ )
    {
        EDA_Rect box = m_Field[i].GetBoundaryBox();
        xmin = MIN( xmin, box.m_Pos.x);
        ymin = MIN( ymin, box.m_Pos.y);
        xmax = MAX( xmax, box.m_Pos.x + box.m_Size.x);
        ymax = MAX( ymax, box.m_Pos.y + box.m_Size.y);
        ret.Merge( m_Field[i].GetBoundaryBox() );
    }

    // ... add padding TODO: improve this
    ret.m_Pos.x = xmin - PADDING;
    ret.m_Pos.y = ymin - PADDING;
    ret.m_Size.x = xmax - xmin + 2*PADDING;
    ret.m_Size.y = ymax - ymin + 2*PADDING;
    ret.m_Pos.x -= PADDING;
    ret.m_Pos.y -= PADDING;
    ret.m_Size.x += 2*PADDING;
    ret.m_Size.y += 2*PADDING;

    D( printf("final box: %d,%d, %d,%d\n", ret.m_Pos.x, ret.m_Pos.y, ret.m_Size.x, ret.m_Size.y); )
//     D( printf("final box: %d,%d, %d,%d\n", ret.m_Pos.x, ret.m_Pos.y, ret.m_Size.x, ret.m_Size.y); )
    return ret;
}

+44 −23
Original line number Diff line number Diff line
@@ -203,6 +203,7 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
    if( msg.IsEmpty() )
        msg = wxT( "U" );
    msg += wxT( "?" );

    //update the reference -- just the prefix for now.
    DrawLibItem->SetRef(GetSheet(), msg );

@@ -239,8 +240,8 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
        DrawLibItem->m_Field[ii].m_VJustify = Field->m_VJustify;
    }

    /* Trace du composant */
    DrawStructsInGhost( DrawPanel, DC, DrawLibItem, 0, 0 );

    MsgPanel->EraseMsgBox();
    DrawLibItem->Display_Infos( this );

@@ -261,7 +262,9 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )

    /* Effacement du composant */
    if( erase )
    {
        DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 );
    }

    move_vector.x = panel->m_Parent->GetScreen()->m_Curseur.x - DrawLibItem->m_Pos.x;
    move_vector.y = panel->m_Parent->GetScreen()->m_Curseur.y - DrawLibItem->m_Pos.y;
@@ -322,14 +325,12 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )

    if( DrawLibItem->m_Flags & IS_NEW )    /* Nouveau Placement en cours, on l'efface */
    {
        DrawStructsInGhost( Panel, DC, DrawLibItem, 0, 0 );
        DrawLibItem->m_Flags = 0;
        SAFE_DELETE( DrawLibItem );
    }
    else if( DrawLibItem )   /* Deplacement ancien composant en cours */
    {
        wxPoint move_vector;
        DrawStructsInGhost( Panel, DC, DrawLibItem, 0, 0 );

        move_vector.x = OldPos.x - DrawLibItem->m_Pos.x;
        move_vector.y = OldPos.y - DrawLibItem->m_Pos.y;
@@ -337,10 +338,13 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
        MoveOneStruct( DrawLibItem, move_vector );

        memcpy( DrawLibItem->m_Transform, OldTransMat, sizeof(OldTransMat) );
        DrawLibItem->Draw( Panel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );

        DrawLibItem->m_Flags = 0;
    }

    D(printf("refresh\n");)
    Panel->Refresh( TRUE );

    Panel->ManageCurseur = NULL;
    Panel->ForceCloseManageCurseur = NULL;
    Panel->m_Parent->GetScreen()->SetCurItem( NULL );
@@ -492,9 +496,26 @@ void WinEDA_SchematicFrame::StartMovePart( EDA_SchComponentStruct* Component,
    OldPos = Component->m_Pos;
    memcpy( OldTransMat, Component->m_Transform, sizeof(OldTransMat) );

#if 1
    // switch from normal mode to xor mode for the duration of the move, first
    // by erasing fully any "normal drawing mode" primitives with the PostDirtyRect(),
    // then by drawing the first time in xor mode so that subsequent xor
    // drawing modes will fully erase this first copy.

    Component->m_Flags |= IS_MOVED; // omit redrawing the component, erase only
    DrawPanel->PostDirtyRect( Component->GetBoundingBox() );

    DrawStructsInGhost( DrawPanel, DC, Component, 0, 0 );

#else

    RedrawOneStruct( DrawPanel, DC, Component, g_XorMode );

    Component->m_Flags |= IS_MOVED;

    DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
#endif

    DrawPanel->m_AutoPAN_Request = TRUE;

    DrawPanel->CursorOn( DC );
+60 −48
Original line number Diff line number Diff line
@@ -51,7 +51,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
            case DRAW_PART_TEXT_STRUCT_TYPE:
                DrawStruct->Place( this, DC );
                GetScreen()->SetCurItem( NULL );
				TestDanglingEnds( GetScreen()->EEDrawList, DC );
                TestDanglingEnds( GetScreen()->EEDrawList, NULL );    // don't draw here
                DrawPanel->Refresh( TRUE );
                return;

            case SCREEN_STRUCT_TYPE:
@@ -109,7 +110,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
            DrawStruct->Place( this, DC );
            DrawPanel->m_AutoPAN_Request = FALSE;
        }
		TestDanglingEnds( GetScreen()->EEDrawList, DC );
        TestDanglingEnds( GetScreen()->EEDrawList, NULL );
        DrawPanel->Refresh( TRUE );
        break;

    case ID_JUNCTION_BUTT:
@@ -124,7 +126,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
            DrawStruct->Place( this, DC );
            DrawPanel->m_AutoPAN_Request = FALSE;
        }
		TestDanglingEnds( GetScreen()->EEDrawList, DC );
        TestDanglingEnds( GetScreen()->EEDrawList, NULL );
        DrawPanel->Refresh( TRUE );
        break;

    case ID_WIRETOBUS_ENTRY_BUTT:
@@ -142,7 +145,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
        {
            DrawStruct->Place( this, DC );
            GetScreen()->SetCurItem( NULL );
			TestDanglingEnds( GetScreen()->EEDrawList, DC );
            TestDanglingEnds( GetScreen()->EEDrawList, NULL );
            DrawPanel->Refresh( TRUE );
            DrawPanel->m_AutoPAN_Request = FALSE;
        }
        break;
@@ -151,7 +155,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
        LocateAndDeleteItem( this, DC );
        GetScreen()->SetModify();
        GetScreen()->SetCurItem( NULL );
		TestDanglingEnds( GetScreen()->EEDrawList, DC );
        TestDanglingEnds( GetScreen()->EEDrawList, NULL );
        DrawPanel->Refresh( TRUE );
        break;

    case ID_WIRE_BUTT:
@@ -192,7 +197,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
        {
            DrawStruct->Place( this, DC );
            DrawPanel->m_AutoPAN_Request = FALSE;
			TestDanglingEnds( GetScreen()->EEDrawList, DC );
            TestDanglingEnds( GetScreen()->EEDrawList, NULL );
            DrawPanel->Refresh( TRUE );
        }
        break;

@@ -210,7 +216,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
        {
            DrawStruct->Place( this, DC );
            DrawPanel->m_AutoPAN_Request = FALSE;
			TestDanglingEnds( GetScreen()->EEDrawList, DC );
            TestDanglingEnds( GetScreen()->EEDrawList, NULL );
            DrawPanel->Refresh( TRUE );
        }
        break;

@@ -223,7 +230,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
        {
            DrawStruct->Place( this, DC );
            DrawPanel->m_AutoPAN_Request = FALSE;
			TestDanglingEnds( GetScreen()->EEDrawList, DC );
            TestDanglingEnds( GetScreen()->EEDrawList, NULL );
            DrawPanel->Refresh( TRUE );
        }
        break;

@@ -237,7 +245,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
        {
            DrawStruct->Place( this, DC );
            DrawPanel->m_AutoPAN_Request = FALSE;
			TestDanglingEnds( GetScreen()->EEDrawList, DC );
            TestDanglingEnds( GetScreen()->EEDrawList, NULL );
            DrawPanel->Refresh( TRUE );
        }
        break;

@@ -263,7 +272,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
                && (DrawStruct->m_Flags != 0) )
        {
            DrawStruct->Place( this, DC );
			TestDanglingEnds( GetScreen()->EEDrawList, DC );
            TestDanglingEnds( GetScreen()->EEDrawList, NULL );
            DrawPanel->Refresh( TRUE );
        }
        break;

@@ -278,7 +288,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
        {
            DrawStruct->Place( this, DC );
            DrawPanel->m_AutoPAN_Request = FALSE;
			TestDanglingEnds( GetScreen()->EEDrawList, DC );
            TestDanglingEnds( GetScreen()->EEDrawList, NULL );
            DrawPanel->Refresh( TRUE );
        }
        break;

@@ -293,7 +304,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
        {
            DrawStruct->Place( this, DC );
            DrawPanel->m_AutoPAN_Request = FALSE;
			TestDanglingEnds( GetScreen()->EEDrawList, DC );
            TestDanglingEnds( GetScreen()->EEDrawList, NULL );
            DrawPanel->Refresh( TRUE );
        }
        break;

Loading