Commit 6de852e8 authored by dickelbeck's avatar dickelbeck

xoring artifacts

parent 9fb2c9fe
...@@ -5,6 +5,19 @@ Started 2007-June-11 ...@@ -5,6 +5,19 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. 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> 2008-Mar-14 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
some code cleaning and comment translations. some code cleaning and comment translations.
......
...@@ -767,7 +767,7 @@ EDA_Rect& EDA_Rect::Inflate( wxCoord dx, wxCoord dy ) ...@@ -767,7 +767,7 @@ EDA_Rect& EDA_Rect::Inflate( wxCoord dx, wxCoord dy )
* mainly used to calculate bounding boxes * mainly used to calculate bounding boxes
* @param aRect = given rect to merge with this * @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 Normalize(); // ensure width and height >= 0
EDA_Rect rect = aRect; EDA_Rect rect = aRect;
......
...@@ -272,32 +272,23 @@ EDA_Rect DrawJunctionStruct::GetBoundingBox() ...@@ -272,32 +272,23 @@ EDA_Rect DrawJunctionStruct::GetBoundingBox()
EDA_Rect EDA_SchComponentStruct::GetBoundingBox() EDA_Rect EDA_SchComponentStruct::GetBoundingBox()
{ {
const int PADDING = 40; const int PADDING = 40;
int xmin, xmax, ymin, ymax;
// This gives a reasonable approximation (but some things are missing so... // This gives a reasonable approximation (but some things are missing so...
EDA_Rect ret = GetBoundaryBox(); 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 // Include BoundingBoxes of fields
for( int i = REFERENCE; i < NUMBER_OF_FIELDS; i++ ) for( int i = REFERENCE; i < NUMBER_OF_FIELDS; i++ )
{ {
EDA_Rect box = m_Field[i].GetBoundaryBox(); ret.Merge( 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);
} }
// ... add padding TODO: improve this // ... add padding TODO: improve this
ret.m_Pos.x = xmin - PADDING; ret.m_Pos.x -= PADDING;
ret.m_Pos.y = ymin - PADDING; ret.m_Pos.y -= PADDING;
ret.m_Size.x = xmax - xmin + 2*PADDING; ret.m_Size.x += 2*PADDING;
ret.m_Size.y = ymax - ymin + 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; return ret;
} }
......
...@@ -203,6 +203,7 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -203,6 +203,7 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
if( msg.IsEmpty() ) if( msg.IsEmpty() )
msg = wxT( "U" ); msg = wxT( "U" );
msg += wxT( "?" ); msg += wxT( "?" );
//update the reference -- just the prefix for now. //update the reference -- just the prefix for now.
DrawLibItem->SetRef(GetSheet(), msg ); DrawLibItem->SetRef(GetSheet(), msg );
...@@ -239,8 +240,8 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -239,8 +240,8 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
DrawLibItem->m_Field[ii].m_VJustify = Field->m_VJustify; DrawLibItem->m_Field[ii].m_VJustify = Field->m_VJustify;
} }
/* Trace du composant */
DrawStructsInGhost( DrawPanel, DC, DrawLibItem, 0, 0 ); DrawStructsInGhost( DrawPanel, DC, DrawLibItem, 0, 0 );
MsgPanel->EraseMsgBox(); MsgPanel->EraseMsgBox();
DrawLibItem->Display_Infos( this ); DrawLibItem->Display_Infos( this );
...@@ -261,7 +262,9 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -261,7 +262,9 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/* Effacement du composant */ /* Effacement du composant */
if( erase ) if( erase )
{
DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 ); DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 );
}
move_vector.x = panel->m_Parent->GetScreen()->m_Curseur.x - DrawLibItem->m_Pos.x; 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; 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 ) ...@@ -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 */ if( DrawLibItem->m_Flags & IS_NEW ) /* Nouveau Placement en cours, on l'efface */
{ {
DrawStructsInGhost( Panel, DC, DrawLibItem, 0, 0 );
DrawLibItem->m_Flags = 0; DrawLibItem->m_Flags = 0;
SAFE_DELETE( DrawLibItem ); SAFE_DELETE( DrawLibItem );
} }
else if( DrawLibItem ) /* Deplacement ancien composant en cours */ else if( DrawLibItem ) /* Deplacement ancien composant en cours */
{ {
wxPoint move_vector; wxPoint move_vector;
DrawStructsInGhost( Panel, DC, DrawLibItem, 0, 0 );
move_vector.x = OldPos.x - DrawLibItem->m_Pos.x; move_vector.x = OldPos.x - DrawLibItem->m_Pos.x;
move_vector.y = OldPos.y - DrawLibItem->m_Pos.y; move_vector.y = OldPos.y - DrawLibItem->m_Pos.y;
...@@ -337,10 +338,13 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -337,10 +338,13 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
MoveOneStruct( DrawLibItem, move_vector ); MoveOneStruct( DrawLibItem, move_vector );
memcpy( DrawLibItem->m_Transform, OldTransMat, sizeof(OldTransMat) ); memcpy( DrawLibItem->m_Transform, OldTransMat, sizeof(OldTransMat) );
DrawLibItem->Draw( Panel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawLibItem->m_Flags = 0; DrawLibItem->m_Flags = 0;
} }
D(printf("refresh\n");)
Panel->Refresh( TRUE );
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
Panel->m_Parent->GetScreen()->SetCurItem( NULL ); Panel->m_Parent->GetScreen()->SetCurItem( NULL );
...@@ -492,9 +496,26 @@ void WinEDA_SchematicFrame::StartMovePart( EDA_SchComponentStruct* Component, ...@@ -492,9 +496,26 @@ void WinEDA_SchematicFrame::StartMovePart( EDA_SchComponentStruct* Component,
OldPos = Component->m_Pos; OldPos = Component->m_Pos;
memcpy( OldTransMat, Component->m_Transform, sizeof(OldTransMat) ); 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 ); RedrawOneStruct( DrawPanel, DC, Component, g_XorMode );
Component->m_Flags |= IS_MOVED; Component->m_Flags |= IS_MOVED;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
#endif
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
DrawPanel->CursorOn( DC ); DrawPanel->CursorOn( DC );
......
...@@ -51,7 +51,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -51,7 +51,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case DRAW_PART_TEXT_STRUCT_TYPE: case DRAW_PART_TEXT_STRUCT_TYPE:
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, NULL ); // don't draw here
DrawPanel->Refresh( TRUE );
return; return;
case SCREEN_STRUCT_TYPE: case SCREEN_STRUCT_TYPE:
...@@ -109,7 +110,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -109,7 +110,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
} }
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, NULL );
DrawPanel->Refresh( TRUE );
break; break;
case ID_JUNCTION_BUTT: case ID_JUNCTION_BUTT:
...@@ -124,7 +126,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -124,7 +126,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
} }
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, NULL );
DrawPanel->Refresh( TRUE );
break; break;
case ID_WIRETOBUS_ENTRY_BUTT: case ID_WIRETOBUS_ENTRY_BUTT:
...@@ -142,7 +145,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -142,7 +145,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, NULL );
DrawPanel->Refresh( TRUE );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
} }
break; break;
...@@ -151,7 +155,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -151,7 +155,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
LocateAndDeleteItem( this, DC ); LocateAndDeleteItem( this, DC );
GetScreen()->SetModify(); GetScreen()->SetModify();
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, NULL );
DrawPanel->Refresh( TRUE );
break; break;
case ID_WIRE_BUTT: case ID_WIRE_BUTT:
...@@ -192,7 +197,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -192,7 +197,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, NULL );
DrawPanel->Refresh( TRUE );
} }
break; break;
...@@ -210,7 +216,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -210,7 +216,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, NULL );
DrawPanel->Refresh( TRUE );
} }
break; break;
...@@ -223,7 +230,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -223,7 +230,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, NULL );
DrawPanel->Refresh( TRUE );
} }
break; break;
...@@ -237,7 +245,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -237,7 +245,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, NULL );
DrawPanel->Refresh( TRUE );
} }
break; break;
...@@ -263,7 +272,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -263,7 +272,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
&& (DrawStruct->m_Flags != 0) ) && (DrawStruct->m_Flags != 0) )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, NULL );
DrawPanel->Refresh( TRUE );
} }
break; break;
...@@ -278,7 +288,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -278,7 +288,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, NULL );
DrawPanel->Refresh( TRUE );
} }
break; break;
...@@ -293,7 +304,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -293,7 +304,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, NULL );
DrawPanel->Refresh( TRUE );
} }
break; break;
......
...@@ -200,7 +200,7 @@ public: ...@@ -200,7 +200,7 @@ public:
* mainly used to calculate bounding boxes * mainly used to calculate bounding boxes
* @param aRect = given rect to merge with this * @param aRect = given rect to merge with this
*/ */
void Merge( EDA_Rect & aRect ); void Merge( const EDA_Rect & aRect );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment