xoring artifacts

This commit is contained in:
dickelbeck 2008-03-16 04:47:43 +00:00
parent 9fb2c9fe23
commit 6de852e8a6
6 changed files with 139 additions and 102 deletions

View File

@ -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>

View File

@ -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 )
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 );

View File

@ -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;
} }

View File

@ -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,
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,
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,
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 )
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(
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 )
*/ */
{ {
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 )
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,
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,
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,
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 );

View File

@ -28,7 +28,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
* quand un outil est deja selectionn<EFBFBD> * quand un outil est deja selectionn<EFBFBD>
*/ */
{ {
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) ) if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) )
{ {
@ -41,7 +41,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE: case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
case DRAW_SHEETLABEL_STRUCT_TYPE: case DRAW_SHEETLABEL_STRUCT_TYPE:
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
@ -50,8 +50,9 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
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:
@ -101,7 +102,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
g_ItemToRepeat = CreateNewNoConnectStruct( DC ); g_ItemToRepeat = CreateNewNoConnectStruct( DC );
GetScreen()->SetCurItem( g_ItemToRepeat ); GetScreen()->SetCurItem( g_ItemToRepeat );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else else
@ -109,14 +110,15 @@ 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:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
g_ItemToRepeat = CreateNewJunctionStruct( DC, GetScreen()->m_Curseur, TRUE ); g_ItemToRepeat = CreateNewJunctionStruct( DC, GetScreen()->m_Curseur, TRUE );
GetScreen()->SetCurItem( g_ItemToRepeat ); GetScreen()->SetCurItem( g_ItemToRepeat );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else else
@ -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:
@ -135,23 +138,25 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
CreateBusEntry( DC, CreateBusEntry( DC,
(m_ID_current_state == ID_WIRETOBUS_ENTRY_BUTT) ? (m_ID_current_state == ID_WIRETOBUS_ENTRY_BUTT) ?
WIRE_TO_BUS : BUS_TO_BUS ); WIRE_TO_BUS : BUS_TO_BUS );
GetScreen()->SetCurItem( DrawStruct ); GetScreen()->SetCurItem( DrawStruct );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else else
{ {
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;
case ID_SCHEMATIC_DELETE_ITEM_BUTT: case ID_SCHEMATIC_DELETE_ITEM_BUTT:
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:
@ -172,7 +177,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_TEXT_COMMENT_BUTT: case ID_TEXT_COMMENT_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
GetScreen()->SetCurItem( CreateNewText( DC, LAYER_NOTES ) ); GetScreen()->SetCurItem( CreateNewText( DC, LAYER_NOTES ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else else
@ -185,59 +190,63 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_LABEL_BUTT: case ID_LABEL_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
GetScreen()->SetCurItem( CreateNewText( DC, LAYER_LOCLABEL ) ); GetScreen()->SetCurItem( CreateNewText( DC, LAYER_LOCLABEL ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else else
{ {
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_GLABEL_BUTT: case ID_GLABEL_BUTT:
case ID_HIERLABEL_BUTT: case ID_HIERLABEL_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
if(m_ID_current_state == ID_GLABEL_BUTT) if(m_ID_current_state == ID_GLABEL_BUTT)
GetScreen()->SetCurItem( CreateNewText( DC, LAYER_GLOBLABEL ) ); GetScreen()->SetCurItem( CreateNewText( DC, LAYER_GLOBLABEL ) );
if(m_ID_current_state == ID_HIERLABEL_BUTT) if(m_ID_current_state == ID_HIERLABEL_BUTT)
GetScreen()->SetCurItem( CreateNewText( DC, LAYER_HIERLABEL ) ); GetScreen()->SetCurItem( CreateNewText( DC, LAYER_HIERLABEL ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else else
{ {
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;
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
GetScreen()->SetCurItem( CreateNewText( DC, LAYER_HIERLABEL ) );
DrawPanel->m_AutoPAN_Request = TRUE;
}
else
{
DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE;
TestDanglingEnds( GetScreen()->EEDrawList, NULL );
DrawPanel->Refresh( TRUE );
} }
break; break;
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
GetScreen()->SetCurItem( CreateNewText( DC, LAYER_HIERLABEL ) );
DrawPanel->m_AutoPAN_Request = TRUE;
}
else
{
DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE;
TestDanglingEnds( GetScreen()->EEDrawList, DC );
}
break;
case ID_SHEET_SYMBOL_BUTT: case ID_SHEET_SYMBOL_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
GetScreen()->SetCurItem( CreateSheet( DC ) ); GetScreen()->SetCurItem( CreateSheet( DC ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else else
{ {
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;
@ -253,24 +262,25 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
&& (DrawStruct->m_Flags == 0) ) && (DrawStruct->m_Flags == 0) )
{ {
if( m_ID_current_state == ID_IMPORT_GLABEL_BUTT ) if( m_ID_current_state == ID_IMPORT_GLABEL_BUTT )
GetScreen()->SetCurItem( GetScreen()->SetCurItem(
Import_PinSheet( (DrawSheetStruct*) DrawStruct, DC ) ); Import_PinSheet( (DrawSheetStruct*) DrawStruct, DC ) );
else else
GetScreen()->SetCurItem( GetScreen()->SetCurItem(
Create_PinSheet( (DrawSheetStruct*) DrawStruct, DC ) ); Create_PinSheet( (DrawSheetStruct*) DrawStruct, DC ) );
} }
else if( (DrawStruct->Type() == DRAW_SHEETLABEL_STRUCT_TYPE) else if( (DrawStruct->Type() == DRAW_SHEETLABEL_STRUCT_TYPE)
&& (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;
case ID_COMPONENT_BUTT: case ID_COMPONENT_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
GetScreen()->SetCurItem( Load_Component( DC, wxEmptyString, GetScreen()->SetCurItem( Load_Component( DC, wxEmptyString,
s_CmpNameList, TRUE ) ); s_CmpNameList, TRUE ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
@ -278,14 +288,15 @@ 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_PLACE_POWER_BUTT: case ID_PLACE_POWER_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
GetScreen()->SetCurItem( GetScreen()->SetCurItem(
Load_Component( DC, wxT( "power" ), s_PowerNameList, FALSE ) ); Load_Component( DC, wxT( "power" ), s_PowerNameList, FALSE ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
@ -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;
@ -321,7 +333,7 @@ void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
* termine la connexion * termine la connexion
*/ */
{ {
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
wxPoint pos = GetPosition(); wxPoint pos = GetPosition();
switch( m_ID_current_state ) switch( m_ID_current_state )
@ -350,7 +362,7 @@ void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE: case DRAW_HIER_LABEL_STRUCT_TYPE:
EditSchematicText( (DrawTextStruct*) DrawStruct, DC ); EditSchematicText( (DrawTextStruct*) DrawStruct, DC );
break; break;

View File

@ -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 );
}; };