Commit 6de852e8 authored by dickelbeck's avatar dickelbeck

xoring artifacts

parent 9fb2c9fe
......@@ -5,30 +5,43 @@ 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.
added:
/** EDA_Rect::Merge( EDA_Rect & aRect )
* Modify Position and Size of this in order to contains the given rect
* mainly used to calculate bouding boxes
* @param aRect = given rect to merge with this
*/
some code cleaning and comment translations.
added:
/** EDA_Rect::Merge( EDA_Rect & aRect )
* Modify Position and Size of this in order to contains the given rect
* mainly used to calculate bouding boxes
* @param aRect = given rect to merge with this
*/
2008-Mar-14 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew
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:
Bad oblong pad size after drawing a round pad
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:
Bad oblong pad size after drawing a round pad
2008-Mar-13 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew
Dirty rect used in footprint rotation, flip and delete.
Better calculation of the footprint dirty rect.
Dirty rect used in footprint rotation, flip and delete.
Better calculation of the footprint dirty rect.
2008-Mar-13 UPDATE Dick Hollenbeck <dick@softplc.com>
......
......@@ -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;
......@@ -775,8 +775,8 @@ void EDA_Rect::Merge( EDA_Rect& aRect )
wxPoint end = GetEnd();
wxPoint rect_end = rect.GetEnd();
// Change origin and size in order to contain the given rect
m_Pos.x = MIN( m_Pos.x, rect.m_Pos.x );
// Change origin and size in order to contain the given rect
m_Pos.x = MIN( m_Pos.x, rect.m_Pos.x );
m_Pos.y = MIN( m_Pos.y, rect.m_Pos.y );
end.x = MAX( end.x, rect_end.x );
end.y = MAX( end.y, rect_end.y );
......
......@@ -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;
}
......
......@@ -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_Convert = 1;
DrawLibItem->m_ChipName = Name;
DrawLibItem->m_TimeStamp = GetTimeStamp();
DrawLibItem->m_TimeStamp = GetTimeStamp();
DrawLibItem->m_Flags = IS_NEW | IS_MOVED;
/* Init champ Valeur */
......@@ -203,8 +203,9 @@ 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 );
//update the reference -- just the prefix for now.
DrawLibItem->SetRef(GetSheet(), msg );
/* Init champ Reference */
DrawLibItem->m_Field[REFERENCE].m_Pos.x =
......@@ -213,7 +214,7 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
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_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_HJustify = Entry->m_Prefix.m_HJustify;
DrawLibItem->m_Field[REFERENCE].m_VJustify = Entry->m_Prefix.m_VJustify;
......@@ -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 );
......@@ -257,14 +258,16 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
wxPoint move_vector;
EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*)
panel->m_Parent->GetScreen()->GetCurItem();
panel->m_Parent->GetScreen()->GetCurItem();
/* 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;
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;
MoveOneStruct( DrawLibItem, move_vector );
DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 );
......@@ -305,7 +308,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir(
DrawPanel->CursorOn( DC );
}
TestDanglingEnds( GetScreen()->EEDrawList, DC );
TestDanglingEnds( GetScreen()->EEDrawList, DC );
GetScreen()->SetModify();
}
......@@ -318,18 +321,16 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
*/
{
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 */
{
DrawStructsInGhost( Panel, DC, DrawLibItem, 0, 0 );
DrawLibItem->m_Flags = 0;
SAFE_DELETE( DrawLibItem );
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,13 +338,16 @@ 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;
DrawLibItem->m_Flags = 0;
}
D(printf("refresh\n");)
Panel->Refresh( TRUE );
Panel->ManageCurseur = 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,
else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
TestDanglingEnds( GetScreen()->EEDrawList, DC );
TestDanglingEnds( GetScreen()->EEDrawList, DC );
GetScreen()->SetModify();
}
......@@ -431,7 +435,7 @@ void WinEDA_SchematicFrame::ConvertPart( EDA_SchComponentStruct* DrawComponent,
else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
TestDanglingEnds( GetScreen()->EEDrawList, DC );
TestDanglingEnds( GetScreen()->EEDrawList, DC );
GetScreen()->SetModify();
}
......@@ -477,24 +481,41 @@ void WinEDA_SchematicFrame::StartMovePart( EDA_SchComponentStruct* Component,
if( Component->m_Flags == 0 )
{
if( g_ItemToUndoCopy ){
SAFE_DELETE( g_ItemToUndoCopy );
}
SAFE_DELETE( g_ItemToUndoCopy );
}
g_ItemToUndoCopy = Component->GenCopy();
}
DrawPanel->CursorOff( DC );
GetScreen()->m_Curseur = Component->m_Pos;
GetScreen()->m_Curseur = Component->m_Pos;
DrawPanel->MouseToCursorSchema();
DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp;
GetScreen()->SetCurItem( Component );
GetScreen()->SetCurItem( 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 );
......
This diff is collapsed.
......@@ -200,7 +200,7 @@ public:
* mainly used to calculate bounding boxes
* @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