Commit 0a3fdeed authored by dickelbeck's avatar dickelbeck

Lorenzo's fix plus tidying

parent 4c2b9e21
...@@ -450,6 +450,11 @@ public: ...@@ -450,6 +450,11 @@ public:
wxString m_Name; /* Field Name */ wxString m_Name; /* Field Name */
public: public:
LibDrawField* Next() { return (LibDrawField*) Pnext; }
LibDrawField* Prev() { return (LibDrawField*) Pback; }
LibDrawField( int idfield = 2 ); LibDrawField( int idfield = 2 );
~LibDrawField(); ~LibDrawField();
virtual wxString GetClass() const virtual wxString GetClass() const
......
...@@ -114,7 +114,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( wxDC* DC ) ...@@ -114,7 +114,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( wxDC* DC )
} }
SuppressDuplicateDrawItem( CurrentLibEntry ); SuppressDuplicateDrawItem( CurrentLibEntry );
GetScreen()->SetModify(); GetScreen()->SetModify();
// Move (and place ) the new draw items: // Move (and place ) the new draw items:
HandleBlockBegin( DC, -1, GetScreen()->m_Curseur ); HandleBlockBegin( DC, -1, GetScreen()->m_Curseur );
...@@ -380,22 +380,24 @@ static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef, ...@@ -380,22 +380,24 @@ static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
void WinEDA_LibeditFrame::PlaceAncre() void WinEDA_LibeditFrame::PlaceAncre()
{ {
int ii, * ptsegm;
int dx, dy; /* Offsets de deplacement */
EDA_LibComponentStruct* LibEntry; EDA_LibComponentStruct* LibEntry;
LibEDA_BaseStruct* DrawEntry; LibEDA_BaseStruct* DrawEntry;
dx = -( GetScreen()->m_Curseur.x );
dy = GetScreen()->m_Curseur.y;
LibEntry = CurrentLibEntry; LibEntry = CurrentLibEntry;
if( LibEntry == NULL ) if( LibEntry == NULL )
return; return;
GetScreen()->SetModify(); 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_Name.m_Pos += offset;
LibEntry->m_Prefix.m_Pos.x += dx; LibEntry->m_Prefix.m_Pos.y += dy; LibEntry->m_Prefix.m_Pos += offset;
for( LibDrawField* field = LibEntry->Fields; field; field = field->Next() )
{
field->m_Pos += offset;
}
DrawEntry = LibEntry->m_Drawings; DrawEntry = LibEntry->m_Drawings;
while( DrawEntry ) while( DrawEntry )
...@@ -405,52 +407,46 @@ void WinEDA_LibeditFrame::PlaceAncre() ...@@ -405,52 +407,46 @@ void WinEDA_LibeditFrame::PlaceAncre()
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (LibDrawArc*) DrawEntry ) #define STRUCT ( (LibDrawArc*) DrawEntry )
STRUCT->m_Pos.x += dx; STRUCT->m_Pos += offset;
STRUCT->m_Pos.y += dy; STRUCT->m_ArcStart += offset;
STRUCT->m_ArcStart.x += dx; STRUCT->m_ArcEnd += offset;
STRUCT->m_ArcStart.y += dy;
STRUCT->m_ArcEnd.x += dx;
STRUCT->m_ArcEnd.y += dy;
break; break;
case COMPONENT_CIRCLE_DRAW_TYPE: case COMPONENT_CIRCLE_DRAW_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (LibDrawCircle*) DrawEntry ) #define STRUCT ( (LibDrawCircle*) DrawEntry )
STRUCT->m_Pos.x += dx; STRUCT->m_Pos += offset;
STRUCT->m_Pos.y += dy;
break; break;
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (LibDrawText*) DrawEntry ) #define STRUCT ( (LibDrawText*) DrawEntry )
STRUCT->m_Pos.x += dx; STRUCT->m_Pos += offset;
STRUCT->m_Pos.y += dy;
break; break;
case COMPONENT_RECT_DRAW_TYPE: case COMPONENT_RECT_DRAW_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (LibDrawSquare*) DrawEntry ) #define STRUCT ( (LibDrawSquare*) DrawEntry )
STRUCT->m_Pos.x += dx; STRUCT->m_Pos += offset;
STRUCT->m_Pos.y += dy; STRUCT->m_End += offset;
STRUCT->m_End.x += dx;
STRUCT->m_End.y += dy;
break; break;
case COMPONENT_PIN_DRAW_TYPE: case COMPONENT_PIN_DRAW_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (LibDrawPin*) DrawEntry ) #define STRUCT ( (LibDrawPin*) DrawEntry )
STRUCT->m_Pos.x += dx; STRUCT->m_Pos += offset;
STRUCT->m_Pos.y += dy;
break; break;
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (LibDrawPolyline*) DrawEntry ) #define STRUCT ( (LibDrawPolyline*) DrawEntry )
ptsegm = STRUCT->m_PolyList; int ii;
for( ii = STRUCT->m_CornersCount; ii > 0; ii-- ) int* ptsegm;
for( ptsegm = STRUCT->m_PolyList,
ii = STRUCT->m_CornersCount; ii > 0; ii-- )
{ {
*ptsegm += dx; ptsegm++; *ptsegm++ += offset.x;
*ptsegm += dy; ptsegm++; *ptsegm++ += offset.y;
} }
break; break;
...@@ -461,7 +457,7 @@ void WinEDA_LibeditFrame::PlaceAncre() ...@@ -461,7 +457,7 @@ void WinEDA_LibeditFrame::PlaceAncre()
} }
/* Redraw the symbol */ /* Redraw the symbol */
GetScreen()->m_Curseur.x = GetScreen()->m_Curseur.y = 0; GetScreen()->m_Curseur.x = GetScreen()->m_Curseur.y = 0;
Recadre_Trace( TRUE ); Recadre_Trace( TRUE );
GetScreen()->SetRefreshReq(); GetScreen()->SetRefreshReq();
} }
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