Commit 6de852e8 authored by dickelbeck's avatar dickelbeck

xoring artifacts

parent 9fb2c9fe
...@@ -5,30 +5,43 @@ Started 2007-June-11 ...@@ -5,30 +5,43 @@ 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.
added: added:
/** EDA_Rect::Merge( EDA_Rect & aRect ) /** EDA_Rect::Merge( EDA_Rect & aRect )
* Modify Position and Size of this in order to contains the given rect * Modify Position and Size of this in order to contains the given rect
* mainly used to calculate bouding boxes * mainly used to calculate bouding boxes
* @param aRect = given rect to merge with this * @param aRect = given rect to merge with this
*/ */
2008-Mar-14 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-Mar-14 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+pcbnew +pcbnew
Added a tool to the upper toolbar which gives and easy access to freeroute Added a tool to the upper toolbar which gives and easy access to freeroute
Solved a bug in plot postscript format when drawing oblong pads: Solved a bug in plot postscript format when drawing oblong pads:
Bad oblong pad size after drawing a round pad Bad oblong pad size after drawing a round pad
2008-Mar-13 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-Mar-13 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+pcbnew +pcbnew
Dirty rect used in footprint rotation, flip and delete. Dirty rect used in footprint rotation, flip and delete.
Better calculation of the footprint dirty rect. Better calculation of the footprint dirty rect.
2008-Mar-13 UPDATE Dick Hollenbeck <dick@softplc.com> 2008-Mar-13 UPDATE Dick Hollenbeck <dick@softplc.com>
......
...@@ -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;
...@@ -775,8 +775,8 @@ void EDA_Rect::Merge( EDA_Rect& aRect ) ...@@ -775,8 +775,8 @@ void EDA_Rect::Merge( EDA_Rect& aRect )
wxPoint end = GetEnd(); wxPoint end = GetEnd();
wxPoint rect_end = rect.GetEnd(); wxPoint rect_end = rect.GetEnd();
// Change origin and size in order to contain the given rect // Change origin and size in order to contain the given rect
m_Pos.x = MIN( m_Pos.x, rect.m_Pos.x ); m_Pos.x = MIN( m_Pos.x, rect.m_Pos.x );
m_Pos.y = MIN( m_Pos.y, rect.m_Pos.y ); m_Pos.y = MIN( m_Pos.y, rect.m_Pos.y );
end.x = MAX( end.x, rect_end.x ); end.x = MAX( end.x, rect_end.x );
end.y = MAX( end.y, rect_end.y ); end.y = MAX( end.y, rect_end.y );
......
...@@ -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;
} }
......
...@@ -184,7 +184,7 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -184,7 +184,7 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
DrawLibItem->m_Multi = 1;/* Selection de l'unite 1 dans le boitier */ DrawLibItem->m_Multi = 1;/* Selection de l'unite 1 dans le boitier */
DrawLibItem->m_Convert = 1; DrawLibItem->m_Convert = 1;
DrawLibItem->m_ChipName = Name; DrawLibItem->m_ChipName = Name;
DrawLibItem->m_TimeStamp = GetTimeStamp(); DrawLibItem->m_TimeStamp = GetTimeStamp();
DrawLibItem->m_Flags = IS_NEW | IS_MOVED; DrawLibItem->m_Flags = IS_NEW | IS_MOVED;
/* Init champ Valeur */ /* Init champ Valeur */
...@@ -203,8 +203,9 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -203,8 +203,9 @@ 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.
DrawLibItem->SetRef(GetSheet(), msg ); //update the reference -- just the prefix for now.
DrawLibItem->SetRef(GetSheet(), msg );
/* Init champ Reference */ /* Init champ Reference */
DrawLibItem->m_Field[REFERENCE].m_Pos.x = DrawLibItem->m_Field[REFERENCE].m_Pos.x =
...@@ -213,7 +214,7 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -213,7 +214,7 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
Entry->m_Prefix.m_Pos.y + DrawLibItem->m_Pos.y; Entry->m_Prefix.m_Pos.y + DrawLibItem->m_Pos.y;
DrawLibItem->m_Field[REFERENCE].m_Orient = Entry->m_Prefix.m_Orient; DrawLibItem->m_Field[REFERENCE].m_Orient = Entry->m_Prefix.m_Orient;
DrawLibItem->m_Field[REFERENCE].m_Size = Entry->m_Prefix.m_Size; DrawLibItem->m_Field[REFERENCE].m_Size = Entry->m_Prefix.m_Size;
DrawLibItem->m_PrefixString = Entry->m_Prefix.m_Text; DrawLibItem->m_PrefixString = Entry->m_Prefix.m_Text;
DrawLibItem->m_Field[REFERENCE].m_Attributs = Entry->m_Prefix.m_Attributs; DrawLibItem->m_Field[REFERENCE].m_Attributs = Entry->m_Prefix.m_Attributs;
DrawLibItem->m_Field[REFERENCE].m_HJustify = Entry->m_Prefix.m_HJustify; DrawLibItem->m_Field[REFERENCE].m_HJustify = Entry->m_Prefix.m_HJustify;
DrawLibItem->m_Field[REFERENCE].m_VJustify = Entry->m_Prefix.m_VJustify; DrawLibItem->m_Field[REFERENCE].m_VJustify = Entry->m_Prefix.m_VJustify;
...@@ -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 );
...@@ -257,14 +258,16 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -257,14 +258,16 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
wxPoint move_vector; wxPoint move_vector;
EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*) EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*)
panel->m_Parent->GetScreen()->GetCurItem(); panel->m_Parent->GetScreen()->GetCurItem();
/* 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;
MoveOneStruct( DrawLibItem, move_vector ); MoveOneStruct( DrawLibItem, move_vector );
DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 ); DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 );
...@@ -305,7 +308,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( ...@@ -305,7 +308,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir(
DrawPanel->CursorOn( DC ); DrawPanel->CursorOn( DC );
} }
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
...@@ -318,18 +321,16 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -318,18 +321,16 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
*/ */
{ {
EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*) EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*)
Panel->m_Parent->GetScreen()->GetCurItem(); Panel->m_Parent->GetScreen()->GetCurItem();
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,13 +338,16 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -337,13 +338,16 @@ 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 );
} }
...@@ -390,7 +394,7 @@ void WinEDA_SchematicFrame::SelPartUnit( EDA_SchComponentStruct* DrawComponent, ...@@ -390,7 +394,7 @@ void WinEDA_SchematicFrame::SelPartUnit( EDA_SchComponentStruct* DrawComponent,
else else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
...@@ -431,7 +435,7 @@ void WinEDA_SchematicFrame::ConvertPart( EDA_SchComponentStruct* DrawComponent, ...@@ -431,7 +435,7 @@ void WinEDA_SchematicFrame::ConvertPart( EDA_SchComponentStruct* DrawComponent,
else else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
...@@ -477,24 +481,41 @@ void WinEDA_SchematicFrame::StartMovePart( EDA_SchComponentStruct* Component, ...@@ -477,24 +481,41 @@ void WinEDA_SchematicFrame::StartMovePart( EDA_SchComponentStruct* Component,
if( Component->m_Flags == 0 ) if( Component->m_Flags == 0 )
{ {
if( g_ItemToUndoCopy ){ if( g_ItemToUndoCopy ){
SAFE_DELETE( g_ItemToUndoCopy ); SAFE_DELETE( g_ItemToUndoCopy );
} }
g_ItemToUndoCopy = Component->GenCopy(); g_ItemToUndoCopy = Component->GenCopy();
} }
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
GetScreen()->m_Curseur = Component->m_Pos; GetScreen()->m_Curseur = Component->m_Pos;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DrawPanel->ManageCurseur = ShowWhileMoving; DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp; DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp;
GetScreen()->SetCurItem( Component ); GetScreen()->SetCurItem( 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 );
......
This diff is collapsed.
...@@ -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