Lorenzo's fix plus tidying

This commit is contained in:
dickelbeck 2008-11-21 21:17:15 +00:00
parent 4c2b9e2199
commit 0a3fdeedf6
2 changed files with 33 additions and 32 deletions

View File

@ -450,6 +450,11 @@ public:
wxString m_Name; /* Field Name */
public:
LibDrawField* Next() { return (LibDrawField*) Pnext; }
LibDrawField* Prev() { return (LibDrawField*) Pback; }
LibDrawField( int idfield = 2 );
~LibDrawField();
virtual wxString GetClass() const

View File

@ -380,22 +380,24 @@ static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
void WinEDA_LibeditFrame::PlaceAncre()
{
int ii, * ptsegm;
int dx, dy; /* Offsets de deplacement */
EDA_LibComponentStruct* LibEntry;
LibEDA_BaseStruct* DrawEntry;
dx = -( GetScreen()->m_Curseur.x );
dy = GetScreen()->m_Curseur.y;
LibEntry = CurrentLibEntry;
if( LibEntry == NULL )
return;
wxSize offset( -GetScreen()->m_Curseur.x, GetScreen()->m_Curseur.y );
GetScreen()->SetModify();
LibEntry->m_Name.m_Pos.x += dx; LibEntry->m_Name.m_Pos.y += dy;
LibEntry->m_Prefix.m_Pos.x += dx; LibEntry->m_Prefix.m_Pos.y += dy;
LibEntry->m_Name.m_Pos += offset;
LibEntry->m_Prefix.m_Pos += offset;
for( LibDrawField* field = LibEntry->Fields; field; field = field->Next() )
{
field->m_Pos += offset;
}
DrawEntry = LibEntry->m_Drawings;
while( DrawEntry )
@ -405,52 +407,46 @@ void WinEDA_LibeditFrame::PlaceAncre()
case COMPONENT_ARC_DRAW_TYPE:
#undef STRUCT
#define STRUCT ( (LibDrawArc*) DrawEntry )
STRUCT->m_Pos.x += dx;
STRUCT->m_Pos.y += dy;
STRUCT->m_ArcStart.x += dx;
STRUCT->m_ArcStart.y += dy;
STRUCT->m_ArcEnd.x += dx;
STRUCT->m_ArcEnd.y += dy;
STRUCT->m_Pos += offset;
STRUCT->m_ArcStart += offset;
STRUCT->m_ArcEnd += offset;
break;
case COMPONENT_CIRCLE_DRAW_TYPE:
#undef STRUCT
#define STRUCT ( (LibDrawCircle*) DrawEntry )
STRUCT->m_Pos.x += dx;
STRUCT->m_Pos.y += dy;
STRUCT->m_Pos += offset;
break;
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
#undef STRUCT
#define STRUCT ( (LibDrawText*) DrawEntry )
STRUCT->m_Pos.x += dx;
STRUCT->m_Pos.y += dy;
STRUCT->m_Pos += offset;
break;
case COMPONENT_RECT_DRAW_TYPE:
#undef STRUCT
#define STRUCT ( (LibDrawSquare*) DrawEntry )
STRUCT->m_Pos.x += dx;
STRUCT->m_Pos.y += dy;
STRUCT->m_End.x += dx;
STRUCT->m_End.y += dy;
STRUCT->m_Pos += offset;
STRUCT->m_End += offset;
break;
case COMPONENT_PIN_DRAW_TYPE:
#undef STRUCT
#define STRUCT ( (LibDrawPin*) DrawEntry )
STRUCT->m_Pos.x += dx;
STRUCT->m_Pos.y += dy;
STRUCT->m_Pos += offset;
break;
case COMPONENT_POLYLINE_DRAW_TYPE:
#undef STRUCT
#define STRUCT ( (LibDrawPolyline*) DrawEntry )
ptsegm = STRUCT->m_PolyList;
for( ii = STRUCT->m_CornersCount; ii > 0; ii-- )
int ii;
int* ptsegm;
for( ptsegm = STRUCT->m_PolyList,
ii = STRUCT->m_CornersCount; ii > 0; ii-- )
{
*ptsegm += dx; ptsegm++;
*ptsegm += dy; ptsegm++;
*ptsegm++ += offset.x;
*ptsegm++ += offset.y;
}
break;