class name changes, XOR artifacts

This commit is contained in:
dickelbeck 2008-03-20 01:50:21 +00:00
parent bd77c9f2e6
commit c406eed135
52 changed files with 2677 additions and 2605 deletions

View File

@ -5,6 +5,27 @@ 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-19 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+eeschema
Renamed some classes and their corresponding KICAD_T types so they are both
simpler, shorter and more closely match each other: the type and the classname.
Wedged a class SCH_ITEM underneath most eeschema drawable items, and this
class came from DrawPartStruct which was largely disfunctional. Eeschema
now more closely matches what we have in pcbnew with the BOARD_ITEM base class.
The corresponding class in eeschema is now SCH_ITEM. Put in some of Jonas'
patch for the dragging of a block. Needs testing, especially dragging
text since there is no GetBoundingBox() for that yet. As an interrim solution
we could make SCH_ITEM::GetBoundingBox() return a HUGE rectangle so that any class
not implementing GetBoundingBox() in eeschema will get properly re-drawn,
in theory.
We are currently using XORing for dragging a single object and using full
redraws for dragging a block. I suppose this can be an experiment for a
week or so. I would not expect that dragging a block of labels with no
other object to work currently.
2008-Mar-19 UPDATE Igor Plyatov <plyatov@mail.ru> 2008-Mar-19 UPDATE Igor Plyatov <plyatov@mail.ru>
================================================================================ ================================================================================
* Support for Gnome/KDE menu added. * Support for Gnome/KDE menu added.

View File

@ -805,8 +805,9 @@ EDA_Rect& EDA_Rect::Inflate( wxCoord dx, wxCoord dy )
} }
/** Function Merge /**
* Modify Position and Size of this in order to contain the given rect * Function Merge
* modifies Position and Size of this in order to contain the given rect
* 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
*/ */
@ -840,7 +841,7 @@ void EDA_Rect::Merge( const EDA_Rect& aRect )
/*******************************************************************/ /*******************************************************************/
DrawPickedStruct::DrawPickedStruct( EDA_BaseStruct* pickedstruct ) : DrawPickedStruct::DrawPickedStruct( EDA_BaseStruct* pickedstruct ) :
EDA_BaseStruct( DRAW_PICK_ITEM_STRUCT_TYPE ) SCH_ITEM( NULL, DRAW_PICK_ITEM_STRUCT_TYPE )
/*******************************************************************/ /*******************************************************************/
{ {
m_PickedStruct = pickedstruct; m_PickedStruct = pickedstruct;
@ -851,6 +852,41 @@ DrawPickedStruct::~DrawPickedStruct()
{ {
} }
#if defined(DEBUG)
void DrawPickedStruct::Show( int nestLevel, std::ostream& os )
{
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << "/>\n";
}
#endif
EDA_Rect DrawPickedStruct::GetBoundingBox()
{
if( m_PickedStruct )
return m_PickedStruct->GetBoundingBox();
else
{
return EDA_Rect(); // empty rectangle
}
}
EDA_Rect DrawPickedStruct::GetBoundingBoxUnion()
{
EDA_Rect ret;
DrawPickedStruct* cur = this;
EDA_BaseStruct* item;
while( cur && (item = cur->m_PickedStruct) != NULL )
{
ret.Merge( item->GetBoundingBox() );
cur = cur->Next();
}
return ret;
}
/*********************************************/ /*********************************************/
void DrawPickedStruct::DeleteWrapperList() void DrawPickedStruct::DeleteWrapperList()

View File

@ -27,7 +27,7 @@ void DrawSheetStruct::Display_Infos( WinEDA_DrawFrame* frame )
/***************************************************************/ /***************************************************************/
void EDA_SchComponentStruct::Display_Infos( WinEDA_DrawFrame* frame ) void SCH_COMPONENT::Display_Infos( WinEDA_DrawFrame* frame )
/***************************************************************/ /***************************************************************/
{ {
EDA_LibComponentStruct* Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT );; EDA_LibComponentStruct* Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT );;
@ -37,7 +37,7 @@ void EDA_SchComponentStruct::Display_Infos( WinEDA_DrawFrame* frame )
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
Affiche_1_Parametre( frame, 1, _( "Ref" ), Affiche_1_Parametre( frame, 1, _( "Ref" ),
GetRef(((WinEDA_SchematicFrame*)frame)->GetSheet()), DARKCYAN ); GetRef(((WinEDA_SchematicFrame*)frame)->GetSheet()), DARKCYAN );
if( Entry && Entry->m_Options == ENTRY_POWER ) if( Entry && Entry->m_Options == ENTRY_POWER )
msg = _( "Pwr Symb" ); msg = _( "Pwr Symb" );

View File

@ -90,10 +90,10 @@ void ReAnnotatePowerSymbolsOnly( void )
EDA_BaseStruct* DrawList = sheet->LastDrawList(); EDA_BaseStruct* DrawList = sheet->LastDrawList();
for( ; DrawList != NULL; DrawList = DrawList->Pnext ) for( ; DrawList != NULL; DrawList = DrawList->Pnext )
{ {
if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawList->Type() != TYPE_SCH_COMPONENT )
continue; continue;
EDA_SchComponentStruct* DrawLibItem = SCH_COMPONENT* DrawLibItem =
(EDA_SchComponentStruct*) DrawList; (SCH_COMPONENT*) DrawList;
EDA_LibComponentStruct* Entry = EDA_LibComponentStruct* Entry =
FindLibPart( FindLibPart(
DrawLibItem->m_ChipName.GetData(), wxEmptyString, DrawLibItem->m_ChipName.GetData(), wxEmptyString,
@ -303,14 +303,14 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetPath* sheet )
{ {
int NbrCmp = 0; int NbrCmp = 0;
EDA_BaseStruct* DrawList = sheet->LastDrawList(); EDA_BaseStruct* DrawList = sheet->LastDrawList();
EDA_SchComponentStruct* DrawLibItem; SCH_COMPONENT* DrawLibItem;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
for( ; DrawList; DrawList = DrawList->Pnext ) for( ; DrawList; DrawList = DrawList->Pnext )
{ {
if( DrawList->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawList->Type() == TYPE_SCH_COMPONENT )
{ {
DrawLibItem = (EDA_SchComponentStruct*) DrawList; DrawLibItem = (SCH_COMPONENT*) DrawList;
Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(),
wxEmptyString, wxEmptyString,
FIND_ROOT ); FIND_ROOT );
@ -361,7 +361,7 @@ static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp )
{ {
int ii; int ii;
char* Text; char* Text;
EDA_SchComponentStruct* DrawLibItem; SCH_COMPONENT* DrawLibItem;
/* Reattribution des numeros */ /* Reattribution des numeros */
for( ii = 0; ii < NbOfCmp; ii++ ) for( ii = 0; ii < NbOfCmp; ii++ )

View File

@ -24,7 +24,7 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_
EDA_BaseStruct* DrawStruct ); EDA_BaseStruct* DrawStruct );
static void CollectStructsToDrag( SCH_SCREEN* screen ); static void CollectStructsToDrag( SCH_SCREEN* screen );
static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ); static void AddPickedItem( SCH_SCREEN* screen, wxPoint position );
static LibEDA_BaseStruct* GetNextPinPosition( EDA_SchComponentStruct* DrawLibItem, static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* DrawLibItem,
wxPoint& position ); wxPoint& position );
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static EDA_BaseStruct* SaveStructListForPaste( EDA_BaseStruct* DrawStruct ); static EDA_BaseStruct* SaveStructListForPaste( EDA_BaseStruct* DrawStruct );
@ -555,27 +555,28 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
*****************************************************************************/ *****************************************************************************/
bool MoveStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct ) bool MoveStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct )
{ {
DrawPickedStruct* PickedList = NULL;
if( !DrawStruct ) if( !DrawStruct )
return FALSE; return FALSE;
if( DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
if( DC ) DrawPickedStruct* pickedList = (DrawPickedStruct*) DrawStruct;
RedrawStructList( panel, DC, DrawStruct, g_XorMode );
PlaceStruct( panel->GetScreen(), DrawStruct ); /* Place it in its new position. */
if( DC )
RedrawStructList( panel, DC, DrawStruct, GR_DEFAULT_DRAWMODE );
/* Free the wrapper DrawPickedStruct chain: */ if( DC )
PickedList = (DrawPickedStruct*) DrawStruct; panel->PostDirtyRect( pickedList->GetBoundingBoxUnion() );
PickedList->DeleteWrapperList();
PlaceStruct( panel->GetScreen(), pickedList); // Place it in its new position.
if( DC )
RedrawStructList( panel, DC, pickedList, GR_DEFAULT_DRAWMODE );
// Free the wrapper DrawPickedStruct chain
pickedList->DeleteWrapperList();
} }
else else
{ {
if( DC ) if( DC )
RedrawOneStruct( panel, DC, DrawStruct, g_XorMode ); panel->PostDirtyRect( DrawStruct->GetBoundingBox());
PlaceStruct( panel->GetScreen(), DrawStruct ); /* Place it in its new position. */ PlaceStruct( panel->GetScreen(), DrawStruct ); /* Place it in its new position. */
if( DC ) if( DC )
RedrawOneStruct( panel, DC, DrawStruct, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( panel, DC, DrawStruct, GR_DEFAULT_DRAWMODE );
@ -604,12 +605,12 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
DrawJunctionStruct* DrawConnect; DrawJunctionStruct* DrawConnect;
EDA_DrawLineStruct* DrawSegment; EDA_DrawLineStruct* DrawSegment;
DrawBusEntryStruct* DrawRaccord; DrawBusEntryStruct* DrawRaccord;
EDA_SchComponentStruct* DrawLibItem; SCH_COMPONENT* DrawLibItem;
DrawSheetStruct* DrawSheet; DrawSheetStruct* DrawSheet;
DrawSheetLabelStruct* DrawSheetLabel; DrawSheetLabelStruct* DrawSheetLabel;
DrawMarkerStruct* DrawMarker; DrawMarkerStruct* DrawMarker;
DrawNoConnectStruct* DrawNoConnect; DrawNoConnectStruct* DrawNoConnect;
DrawTextStruct* DrawText; SCH_TEXT* DrawText;
wxPoint px; wxPoint px;
if( !DrawStruct ) if( !DrawStruct )
@ -665,13 +666,13 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
MirrorYPoint( DrawNoConnect->m_Pos, Center ); MirrorYPoint( DrawNoConnect->m_Pos, Center );
break; break;
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
// Text is not really mirrored; it is moved to a suitable position // Text is not really mirrored; it is moved to a suitable position
// which is the closest position for a true mirrored text // which is the closest position for a true mirrored text
// The center position is mirrored and the text is moved for half horizontal len // The center position is mirrored and the text is moved for half horizontal len
DrawText = (DrawTextStruct*) DrawStruct; DrawText = (SCH_TEXT*) DrawStruct;
px = DrawText->m_Pos; px = DrawText->m_Pos;
if( DrawText->m_Orient == 0 ) /* horizontal text */ if( DrawText->m_Orient == 0 ) /* horizontal text */
dx = DrawText->Len_Size() / 2; dx = DrawText->Len_Size() / 2;
@ -687,11 +688,11 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
DrawText->m_Pos.x = px.x; DrawText->m_Pos.x = px.x;
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
// Text is not really mirrored: Orientation is changed // Text is not really mirrored: Orientation is changed
DrawText = (DrawLabelStruct*) DrawStruct; DrawText = (SCH_LABEL*) DrawStruct;
if( DrawText->m_Orient == 0 ) /* horizontal text */ if( DrawText->m_Orient == 0 ) /* horizontal text */
DrawText->m_Orient = 2; DrawText->m_Orient = 2;
else if( DrawText->m_Orient == 2 ) /* invert horizontal text*/ else if( DrawText->m_Orient == 2 ) /* invert horizontal text*/
@ -703,8 +704,8 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
DrawText->m_Pos.x = px.x; DrawText->m_Pos.x = px.x;
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
DrawLibItem = (EDA_SchComponentStruct*) DrawStruct; DrawLibItem = (SCH_COMPONENT*) DrawStruct;
dx = DrawLibItem->m_Pos.x; dx = DrawLibItem->m_Pos.x;
g_EDA_Appl->m_SchematicFrame->CmpRotationMiroir( DrawLibItem, g_EDA_Appl->m_SchematicFrame->CmpRotationMiroir( DrawLibItem,
NULL, CMP_MIROIR_Y ); NULL, CMP_MIROIR_Y );
@ -753,43 +754,42 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
*****************************************************************************/ *****************************************************************************/
bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct, wxPoint& Center ) bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct, wxPoint& Center )
{ {
DrawPickedStruct* PickedList = NULL;
DrawPickedStruct* DrawStructs;
if( !DrawStruct ) if( !DrawStruct )
return FALSE; return FALSE;
if( DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
DrawPickedStruct* pickedList = (DrawPickedStruct*) DrawStruct;
if( DC ) if( DC )
RedrawStructList( panel, DC, DrawStruct, g_XorMode ); panel->PostDirtyRect( pickedList->GetBoundingBoxUnion() );
DrawStructs = (DrawPickedStruct*) DrawStruct;
while( DrawStructs ) for( DrawPickedStruct* cur = pickedList; cur; cur=cur->Next() )
{ {
MirrorOneStruct( DrawStructs->m_PickedStruct, Center ); MirrorOneStruct( cur->m_PickedStruct, Center );
DrawStructs->m_PickedStruct->m_Flags = 0; cur->m_PickedStruct->m_Flags = 0;
DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext;
} }
if( DC ) if( DC )
RedrawStructList( panel, DC, DrawStruct, GR_DEFAULT_DRAWMODE ); RedrawStructList( panel, DC, pickedList, GR_DEFAULT_DRAWMODE );
/* Free the wrapper DrawPickedStruct chain: */ // Free the wrapper DrawPickedStruct chain
PickedList = (DrawPickedStruct*) DrawStruct; pickedList->DeleteWrapperList();
PickedList->DeleteWrapperList();
} }
else else
{ {
if( DC ) if( DC )
RedrawOneStruct( panel, DC, DrawStruct, g_XorMode ); panel->PostDirtyRect( DrawStruct->GetBoundingBox() );
MirrorOneStruct( DrawStruct, Center ); /* Place it in its new position. */
MirrorOneStruct( DrawStruct, Center ); // Place it in its new position.
if( DC ) if( DC )
RedrawOneStruct( panel, DC, DrawStruct, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( panel, DC, DrawStruct, GR_DEFAULT_DRAWMODE );
DrawStruct->m_Flags = 0; DrawStruct->m_Flags = 0;
} }
return true;
return TRUE;
} }
@ -825,10 +825,10 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
switch( Struct->Type() ) switch( Struct->Type() )
{ {
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
{ {
( (EDA_SchComponentStruct*) Struct )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp();
( (EDA_SchComponentStruct*) Struct )->ClearAnnotation(); ( (SCH_COMPONENT*) Struct )->ClearAnnotation();
} }
break; break;
@ -872,10 +872,10 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
case DRAW_BUSENTRY_STRUCT_TYPE: case DRAW_BUSENTRY_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_SHEETLABEL_STRUCT_TYPE: case DRAW_SHEETLABEL_STRUCT_TYPE:
case DRAW_PICK_ITEM_STRUCT_TYPE: case DRAW_PICK_ITEM_STRUCT_TYPE:
case DRAW_MARKER_STRUCT_TYPE: case DRAW_MARKER_STRUCT_TYPE:
@ -891,9 +891,9 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
break; break;
} }
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
( (EDA_SchComponentStruct*) NewDrawStruct )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) NewDrawStruct )->m_TimeStamp = GetTimeStamp();
( (EDA_SchComponentStruct*) NewDrawStruct )->ClearAnnotation(); ( (SCH_COMPONENT*) NewDrawStruct )->ClearAnnotation();
break; break;
} }
@ -924,13 +924,11 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
*/ */
{ {
SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen(); SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen();
DrawPickedStruct* PickedList = NULL;
WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) panel->m_Parent; WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) panel->m_Parent;
if( !DrawStruct ) if( !DrawStruct )
return; return;
if( DrawStruct->Type() == DRAW_SHEETLABEL_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_SHEETLABEL_STRUCT_TYPE )
{ {
/* Cette stucture est rattachee a une feuille, et n'est pas /* Cette stucture est rattachee a une feuille, et n'est pas
@ -942,34 +940,34 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
if( DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
/* Unlink all picked structs from current EEDrawList */ // Unlink all picked structs from current EEDrawList
PickedList = (DrawPickedStruct*) DrawStruct;
while( PickedList ) for( DrawPickedStruct* cur = (DrawPickedStruct*) DrawStruct; cur; cur=cur->Next() )
{ {
screen->RemoveFromDrawList( PickedList->m_PickedStruct ); EDA_BaseStruct* item = cur->m_PickedStruct;
PickedList->m_PickedStruct->Pnext = screen->RemoveFromDrawList( item );
PickedList->m_PickedStruct->Pback = NULL; panel->PostDirtyRect( item->GetBoundingBox() );
PickedList->m_PickedStruct->m_Flags = IS_DELETED; item->Pnext = item->Pback = NULL;
PickedList = PickedList->Next(); item->m_Flags = IS_DELETED;
} }
RedrawStructList( panel, DC, DrawStruct, g_XorMode ); // Removed items are put onto the Undo list
/* Removed items are put to the Undo list */
frame->SaveCopyInUndoList( DrawStruct, IS_DELETED ); frame->SaveCopyInUndoList( DrawStruct, IS_DELETED );
} }
else /* structure classique */ else /* structure classique */
{ {
screen->RemoveFromDrawList( DrawStruct ); screen->RemoveFromDrawList( DrawStruct );
if( (DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE) || switch( DrawStruct->Type() )
(DrawStruct->Type() == DRAW_JUNCTION_STRUCT_TYPE) ||
(DrawStruct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE) )
{ {
case DRAW_SEGMENT_STRUCT_TYPE:
case DRAW_JUNCTION_STRUCT_TYPE:
case TYPE_SCH_COMPONENT:
panel->PostDirtyRect( DrawStruct->GetBoundingBox() ); panel->PostDirtyRect( DrawStruct->GetBoundingBox() );
} break;
else
{ // other classes do not yet have GetBoundingBox() implementations
default:
D( DrawStruct->Show( 0, std::cout ); ) // tell me which classes still need GetBoundingBox support D( DrawStruct->Show( 0, std::cout ); ) // tell me which classes still need GetBoundingBox support
RedrawOneStruct( panel, DC, DrawStruct, g_XorMode ); RedrawOneStruct( panel, DC, DrawStruct, g_XorMode );
} }
@ -1062,10 +1060,10 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
for( PickedList = (DrawPickedStruct*) DrawStruct; PickedList != NULL; ) // Clear annotation for new components for( PickedList = (DrawPickedStruct*) DrawStruct; PickedList != NULL; ) // Clear annotation for new components
{ {
EDA_BaseStruct* Struct = PickedList->m_PickedStruct; EDA_BaseStruct* Struct = PickedList->m_PickedStruct;
if( Struct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) if( Struct->Type() == TYPE_SCH_COMPONENT )
{ {
( (EDA_SchComponentStruct*) Struct )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp();
( (EDA_SchComponentStruct*) Struct )->ClearAnnotation(); ( (SCH_COMPONENT*) Struct )->ClearAnnotation();
SetStructFather( Struct, GetScreen() ); SetStructFather( Struct, GetScreen() );
} }
PickedList = (DrawPickedStruct*) PickedList->Pnext; PickedList = (DrawPickedStruct*) PickedList->Pnext;
@ -1086,10 +1084,10 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
} }
else else
{ {
if( DrawStruct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawStruct->Type() == TYPE_SCH_COMPONENT )
{ {
( (EDA_SchComponentStruct*) DrawStruct )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) DrawStruct )->m_TimeStamp = GetTimeStamp();
( (EDA_SchComponentStruct*) DrawStruct )->ClearAnnotation(); ( (SCH_COMPONENT*) DrawStruct )->ClearAnnotation();
} }
SetStructFather( DrawStruct, GetScreen() ); SetStructFather( DrawStruct, GetScreen() );
RedrawOneStruct( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE );
@ -1135,11 +1133,11 @@ bool PlaceStruct( BASE_SCREEN* screen, EDA_BaseStruct* DrawStruct )
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
case DRAW_BUSENTRY_STRUCT_TYPE: case DRAW_BUSENTRY_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
case DRAW_SHEETLABEL_STRUCT_TYPE: case DRAW_SHEETLABEL_STRUCT_TYPE:
case DRAW_MARKER_STRUCT_TYPE: case DRAW_MARKER_STRUCT_TYPE:
@ -1174,7 +1172,7 @@ void MoveOneStruct( EDA_BaseStruct* DrawStruct, const wxPoint& move_vector )
DrawJunctionStruct* DrawConnect; DrawJunctionStruct* DrawConnect;
EDA_DrawLineStruct* DrawSegment; EDA_DrawLineStruct* DrawSegment;
DrawBusEntryStruct* DrawRaccord; DrawBusEntryStruct* DrawRaccord;
EDA_SchComponentStruct* DrawLibItem; SCH_COMPONENT* DrawLibItem;
DrawSheetStruct* DrawSheet; DrawSheetStruct* DrawSheet;
DrawSheetLabelStruct* DrawSheetLabel; DrawSheetLabelStruct* DrawSheetLabel;
DrawMarkerStruct* DrawMarker; DrawMarkerStruct* DrawMarker;
@ -1231,24 +1229,24 @@ void MoveOneStruct( EDA_BaseStruct* DrawStruct, const wxPoint& move_vector )
DrawNoConnect->m_Pos += move_vector; DrawNoConnect->m_Pos += move_vector;
break; break;
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
#define DrawText ( (DrawTextStruct*) DrawStruct ) #define DrawText ( (SCH_TEXT*) DrawStruct )
DrawText->m_Pos += move_vector; DrawText->m_Pos += move_vector;
break; break;
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
#define DrawLabel ( (DrawLabelStruct*) DrawStruct ) #define DrawLabel ( (SCH_LABEL*) DrawStruct )
DrawLabel->m_Pos += move_vector; DrawLabel->m_Pos += move_vector;
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
#define DrawGHLabel ( (DrawLabelStruct*) DrawStruct ) #define DrawGHLabel ( (SCH_LABEL*) DrawStruct )
DrawGHLabel->m_Pos += move_vector; DrawGHLabel->m_Pos += move_vector;
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
DrawLibItem = (EDA_SchComponentStruct*) DrawStruct; DrawLibItem = (SCH_COMPONENT*) DrawStruct;
DrawLibItem->m_Pos += move_vector; DrawLibItem->m_Pos += move_vector;
for( ii = 0; ii < NUMBER_OF_FIELDS; ii++ ) for( ii = 0; ii < NUMBER_OF_FIELDS; ii++ )
{ {
@ -1325,24 +1323,24 @@ EDA_BaseStruct* DuplicateStruct( EDA_BaseStruct* DrawStruct )
NewDrawStruct = ( (DrawNoConnectStruct*) DrawStruct )->GenCopy(); NewDrawStruct = ( (DrawNoConnectStruct*) DrawStruct )->GenCopy();
break; break;
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
NewDrawStruct = ( (DrawTextStruct*) DrawStruct )->GenCopy(); NewDrawStruct = ( (SCH_TEXT*) DrawStruct )->GenCopy();
break; break;
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
NewDrawStruct = ( (DrawLabelStruct*) DrawStruct )->GenCopy(); NewDrawStruct = ( (SCH_LABEL*) DrawStruct )->GenCopy();
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
NewDrawStruct = ( (DrawHierLabelStruct*) DrawStruct )->GenCopy(); NewDrawStruct = ( (SCH_HIERLABEL*) DrawStruct )->GenCopy();
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
NewDrawStruct = ( (DrawGlobalLabelStruct*) DrawStruct )->GenCopy(); NewDrawStruct = ( (SCH_GLOBALLABEL*) DrawStruct )->GenCopy();
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
NewDrawStruct = ( (EDA_SchComponentStruct*) DrawStruct )->GenCopy(); NewDrawStruct = ( (SCH_COMPONENT*) DrawStruct )->GenCopy();
break; break;
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
@ -1465,11 +1463,11 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
{ {
Struct = DrawStructs->m_PickedStruct; Struct = DrawStructs->m_PickedStruct;
DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext; DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext;
if( Struct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) if( Struct->Type() == TYPE_SCH_COMPONENT )
{ {
LibEDA_BaseStruct* DrawItem; LibEDA_BaseStruct* DrawItem;
wxPoint pos; wxPoint pos;
DrawItem = GetNextPinPosition( (EDA_SchComponentStruct*) Struct, pos ); DrawItem = GetNextPinPosition( (SCH_COMPONENT*) Struct, pos );
while( DrawItem ) while( DrawItem )
{ {
if( (pos.x < ox) || (pos.x > fx) || (pos.y < oy) || (pos.y > fy) ) if( (pos.x < ox) || (pos.x > fx) || (pos.y < oy) || (pos.y > fy) )
@ -1587,12 +1585,12 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
case DRAW_BUSENTRY_STRUCT_TYPE: case DRAW_BUSENTRY_STRUCT_TYPE:
break; break;
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
break; break;
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawLabelStruct*) Struct ) #define STRUCT ( (SCH_LABEL*) Struct )
if( Struct->m_Flags & SELECTED ) if( Struct->m_Flags & SELECTED )
break; /* Already in list */ break; /* Already in list */
if( STRUCT->m_Pos != position ) if( STRUCT->m_Pos != position )
@ -1604,10 +1602,10 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
Struct->m_Flags |= SELECTED; Struct->m_Flags |= SELECTED;
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawLabelStruct*) Struct ) #define STRUCT ( (SCH_LABEL*) Struct )
if( Struct->m_Flags & SELECTED ) if( Struct->m_Flags & SELECTED )
break; /* Already in list */ break; /* Already in list */
if( STRUCT->m_Pos != position ) if( STRUCT->m_Pos != position )
@ -1619,7 +1617,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
Struct->m_Flags |= SELECTED; Struct->m_Flags |= SELECTED;
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
break; break;
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
@ -1668,7 +1666,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
/*********************************************************************************/ /*********************************************************************************/
static LibEDA_BaseStruct* GetNextPinPosition( EDA_SchComponentStruct* DrawLibItem, static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* DrawLibItem,
wxPoint& position ) wxPoint& position )
/*********************************************************************************/ /*********************************************************************************/
{ {

View File

@ -142,8 +142,8 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
if( !newsegment ) /* first point : Create first wire ou bus */ if( !newsegment ) /* first point : Create first wire ou bus */
{ {
s_ConnexionStartPoint = cursorpos; s_ConnexionStartPoint = cursorpos;
s_OldWiresList = ((SCH_SCREEN*)GetScreen())->ExtractWires( TRUE ); s_OldWiresList = ((SCH_SCREEN*)GetScreen())->ExtractWires( TRUE );
((SCH_SCREEN*)GetScreen())->SchematicCleanUp( NULL ); ((SCH_SCREEN*)GetScreen())->SchematicCleanUp( NULL );
switch( type ) switch( type )
{ {
@ -194,7 +194,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
/* Creation du segment suivant ou fin de trac<61> si point sur pin, jonction ...*/ /* Creation du segment suivant ou fin de trac<61> si point sur pin, jonction ...*/
if( IsTerminalPoint( (SCH_SCREEN*)GetScreen(), cursorpos, oldsegment->m_Layer ) ) if( IsTerminalPoint( (SCH_SCREEN*)GetScreen(), cursorpos, oldsegment->m_Layer ) )
{ {
EndSegment( DC ); return; EndSegment( DC ); return;
} }
@ -301,7 +301,7 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
alt_end_point = lastsegment->m_Start; alt_end_point = lastsegment->m_Start;
} }
((SCH_SCREEN*)GetScreen())->SchematicCleanUp( NULL ); ((SCH_SCREEN*)GetScreen())->SchematicCleanUp( NULL );
/* clear flags and find last segment entered, for repeat function */ /* clear flags and find last segment entered, for repeat function */
segment = (EDA_DrawLineStruct*) GetScreen()->EEDrawList; segment = (EDA_DrawLineStruct*) GetScreen()->EEDrawList;
@ -521,7 +521,7 @@ void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC )
Segment_in_Ghost( DrawPanel, DC, FALSE ); /* Effacement du trace en cours */ Segment_in_Ghost( DrawPanel, DC, FALSE ); /* Effacement du trace en cours */
} }
EraseStruct( GetScreen()->GetCurItem(), (SCH_SCREEN*)GetScreen() ); EraseStruct( GetScreen()->GetCurItem(), (SCH_SCREEN*)GetScreen() );
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
} }
@ -642,9 +642,9 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
new_pos = STRUCT->m_Pos; new_pos = STRUCT->m_Pos;
break; break;
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawTextStruct*) g_ItemToRepeat ) #define STRUCT ( (SCH_TEXT*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy(); g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep; STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos; new_pos = STRUCT->m_Pos;
@ -653,9 +653,9 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
break; break;
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawLabelStruct*) g_ItemToRepeat ) #define STRUCT ( (SCH_LABEL*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy(); g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep; STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos; new_pos = STRUCT->m_Pos;
@ -664,9 +664,9 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawHierLabelStruct*) g_ItemToRepeat ) #define STRUCT ( (SCH_HIERLABEL*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy(); g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep; STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos; new_pos = STRUCT->m_Pos;
@ -674,9 +674,9 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
IncrementLabelMember( STRUCT->m_Text ); IncrementLabelMember( STRUCT->m_Text );
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawGlobalLabelStruct*) g_ItemToRepeat ) #define STRUCT ( (SCH_GLOBALLABEL*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy(); g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep; STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos; new_pos = STRUCT->m_Pos;
@ -701,17 +701,17 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
new_pos = STRUCT->m_Pos; new_pos = STRUCT->m_Pos;
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: // In repeat command the new component is put in move mode case TYPE_SCH_COMPONENT: // In repeat command the new component is put in move mode
#undef STRUCT #undef STRUCT
#define STRUCT ( (EDA_SchComponentStruct*) g_ItemToRepeat ) #define STRUCT ( (SCH_COMPONENT*) g_ItemToRepeat )
// Create the duplicate component, position = mouse cursor // Create the duplicate component, position = mouse cursor
g_ItemToRepeat = STRUCT->GenCopy(); g_ItemToRepeat = STRUCT->GenCopy();
new_pos.x = GetScreen()->m_Curseur.x - STRUCT->m_Pos.x; new_pos.x = GetScreen()->m_Curseur.x - STRUCT->m_Pos.x;
new_pos.y = GetScreen()->m_Curseur.y - STRUCT->m_Pos.y; new_pos.y = GetScreen()->m_Curseur.y - STRUCT->m_Pos.y;
STRUCT->m_Pos = GetScreen()->m_Curseur; STRUCT->m_Pos = GetScreen()->m_Curseur;
STRUCT->m_Flags = IS_NEW; STRUCT->m_Flags = IS_NEW;
STRUCT->m_TimeStamp = GetTimeStamp(); STRUCT->m_TimeStamp = GetTimeStamp();
for( int ii = 0; ii < NUMBER_OF_FIELDS; ii++ ) for( int ii = 0; ii < NUMBER_OF_FIELDS; ii++ )
{ {
STRUCT->m_Field[ii].m_Pos += new_pos; STRUCT->m_Field[ii].m_Pos += new_pos;
@ -790,7 +790,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
{ {
EDA_BaseStruct* item; EDA_BaseStruct* item;
LibDrawPin* pin; LibDrawPin* pin;
EDA_SchComponentStruct* LibItem = NULL; SCH_COMPONENT* LibItem = NULL;
DrawSheetLabelStruct* pinsheet; DrawSheetLabelStruct* pinsheet;
wxPoint itempos; wxPoint itempos;
@ -837,9 +837,9 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
return TRUE; return TRUE;
item = PickStruct( pos, screen, LABELITEM ); item = PickStruct( pos, screen, LABELITEM );
if( item && (item->Type() != DRAW_TEXT_STRUCT_TYPE) if( item && (item->Type() != TYPE_SCH_TEXT)
&& ( ( (DrawGlobalLabelStruct*) item )->m_Pos.x == pos.x ) && ( ( (SCH_GLOBALLABEL*) item )->m_Pos.x == pos.x )
&& ( ( (DrawGlobalLabelStruct*) item )->m_Pos.y == pos.y ) ) && ( ( (SCH_GLOBALLABEL*) item )->m_Pos.y == pos.y ) )
return TRUE; return TRUE;
pinsheet = LocateAnyPinSheet( pos, screen ); pinsheet = LocateAnyPinSheet( pos, screen );

View File

@ -184,12 +184,12 @@ void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC )
/* Search Hlabel corresponding to this Pinsheet */ /* Search Hlabel corresponding to this Pinsheet */
EDA_BaseStruct* DrawStruct = m_AssociatedScreen->EEDrawList; EDA_BaseStruct* DrawStruct = m_AssociatedScreen->EEDrawList;
DrawHierLabelStruct* HLabel = NULL; SCH_HIERLABEL* HLabel = NULL;
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
{ {
if( DrawStruct->Type() != DRAW_HIER_LABEL_STRUCT_TYPE ) if( DrawStruct->Type() != TYPE_SCH_HIERLABEL )
continue; continue;
HLabel = (DrawHierLabelStruct*) DrawStruct; HLabel = (SCH_HIERLABEL*) DrawStruct;
if( Pinsheet->m_Text.CmpNoCase( HLabel->m_Text ) == 0 ) if( Pinsheet->m_Text.CmpNoCase( HLabel->m_Text ) == 0 )
break; // Found! break; // Found!
HLabel = NULL; HLabel = NULL;
@ -282,9 +282,9 @@ void DrawSheetStruct::DeleteAnnotation( bool recurse )
EDA_BaseStruct* comp = m_AssociatedScreen->EEDrawList; EDA_BaseStruct* comp = m_AssociatedScreen->EEDrawList;
for( ; comp; comp = comp->Pnext ) for( ; comp; comp = comp->Pnext )
{ {
if( comp->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) if( comp->Type() == TYPE_SCH_COMPONENT )
{ {
( (EDA_SchComponentStruct*) comp )->ClearAnnotation(); ( (SCH_COMPONENT*) comp )->ClearAnnotation();
} }
} }
} }
@ -305,9 +305,9 @@ int DrawSheetStruct::ComponentCount()
EDA_BaseStruct* bs; EDA_BaseStruct* bs;
for( bs = m_AssociatedScreen->EEDrawList; bs != NULL; bs = bs->Pnext ) for( bs = m_AssociatedScreen->EEDrawList; bs != NULL; bs = bs->Pnext )
{ {
if( bs->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) if( bs->Type() == TYPE_SCH_COMPONENT )
{ {
DrawPartStruct* Cmp = (DrawPartStruct*) bs; SCH_COMPONENT* Cmp = (SCH_COMPONENT*) bs;
if( Cmp->m_Field[VALUE].m_Text.GetChar( 0 ) != '#' ) if( Cmp->m_Field[VALUE].m_Text.GetChar( 0 ) != '#' )
n++; n++;
} }
@ -476,8 +476,8 @@ bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame * aFrame, const wxSt
return true; return true;
SCH_SCREEN* Screen_to_use = NULL; SCH_SCREEN* Screen_to_use = NULL;
wxString msg; wxString msg;
bool LoadFromFile = false; bool LoadFromFile = false;
if( g_RootSheet->SearchHierarchy( aFileName, &Screen_to_use ) ) //do we reload the data from the existing hierarchy if( g_RootSheet->SearchHierarchy( aFileName, &Screen_to_use ) ) //do we reload the data from the existing hierarchy
@ -486,10 +486,10 @@ bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame * aFrame, const wxSt
"A Sub Hierarchy named %s exists, Use it (The data in this sheet will be replaced)?" ), "A Sub Hierarchy named %s exists, Use it (The data in this sheet will be replaced)?" ),
aFileName.GetData() ); aFileName.GetData() );
if( ! IsOK( NULL, msg ) ) if( ! IsOK( NULL, msg ) )
{ {
DisplayInfo(NULL, _("Sheet Filename Renaming Aborted")); DisplayInfo(NULL, _("Sheet Filename Renaming Aborted"));
return false; return false;
} }
} }
else if( wxFileExists( aFileName ) ) //do we reload the data from an existing file else if( wxFileExists( aFileName ) ) //do we reload the data from an existing file
@ -498,61 +498,61 @@ bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame * aFrame, const wxSt
"A file named %s exists, load it (otherwise keep current sheet data if possible)?" ), "A file named %s exists, load it (otherwise keep current sheet data if possible)?" ),
aFileName.GetData() ); aFileName.GetData() );
if( IsOK( NULL, msg ) ) if( IsOK( NULL, msg ) )
{ {
LoadFromFile = true; LoadFromFile = true;
m_AssociatedScreen->m_RefCount--; //be careful with these m_AssociatedScreen->m_RefCount--; //be careful with these
if( m_AssociatedScreen->m_RefCount == 0 ) if( m_AssociatedScreen->m_RefCount == 0 )
SAFE_DELETE( m_AssociatedScreen ); SAFE_DELETE( m_AssociatedScreen );
m_AssociatedScreen = NULL; //will be created later m_AssociatedScreen = NULL; //will be created later
} }
} }
// if an associated screen exists, shared between this sheet and others sheets, what we do ? // if an associated screen exists, shared between this sheet and others sheets, what we do ?
if( m_AssociatedScreen && ( m_AssociatedScreen->m_RefCount > 1 )) if( m_AssociatedScreen && ( m_AssociatedScreen->m_RefCount > 1 ))
{ {
msg = _("This sheet uses shared data in a complex hierarchy" ) ; msg = _("This sheet uses shared data in a complex hierarchy" ) ;
msg << wxT("\n"); msg << wxT("\n");
msg << _("Do we convert it in a simple hierarchical sheet (otherwise delete current sheet data)"); msg << _("Do we convert it in a simple hierarchical sheet (otherwise delete current sheet data)");
if( IsOK( NULL, msg ) ) if( IsOK( NULL, msg ) )
{ {
LoadFromFile = true; LoadFromFile = true;
wxString oldfilename = m_AssociatedScreen->m_FileName; wxString oldfilename = m_AssociatedScreen->m_FileName;
m_AssociatedScreen->m_FileName = aFileName; m_AssociatedScreen->m_FileName = aFileName;
aFrame->SaveEEFile( m_AssociatedScreen, FILE_SAVE_AS ); aFrame->SaveEEFile( m_AssociatedScreen, FILE_SAVE_AS );
m_AssociatedScreen->m_FileName = oldfilename; m_AssociatedScreen->m_FileName = oldfilename;
} }
m_AssociatedScreen->m_RefCount--; //be careful with these m_AssociatedScreen->m_RefCount--; //be careful with these
m_AssociatedScreen = NULL; //will be created later m_AssociatedScreen = NULL; //will be created later
} }
SetFileName( aFileName ); SetFileName( aFileName );
// if we use new data (from file or from internal hierarchy), delete the current sheet data // if we use new data (from file or from internal hierarchy), delete the current sheet data
if( m_AssociatedScreen && (LoadFromFile || Screen_to_use) ) if( m_AssociatedScreen && (LoadFromFile || Screen_to_use) )
{ {
m_AssociatedScreen->m_RefCount--; m_AssociatedScreen->m_RefCount--;
if( m_AssociatedScreen->m_RefCount == 0 ) if( m_AssociatedScreen->m_RefCount == 0 )
SAFE_DELETE( m_AssociatedScreen ); SAFE_DELETE( m_AssociatedScreen );
m_AssociatedScreen = NULL; //so that we reload.. m_AssociatedScreen = NULL; //so that we reload..
} }
if ( LoadFromFile ) if ( LoadFromFile )
Load( aFrame ); Load( aFrame );
else if ( Screen_to_use ) else if ( Screen_to_use )
{ {
m_AssociatedScreen = Screen_to_use; m_AssociatedScreen = Screen_to_use;
m_AssociatedScreen->m_RefCount++; m_AssociatedScreen->m_RefCount++;
} }
//just make a new screen if needed. //just make a new screen if needed.
if( !m_AssociatedScreen ) if( !m_AssociatedScreen )
{ {
m_AssociatedScreen = new SCH_SCREEN( SCHEMATIC_FRAME ); m_AssociatedScreen = new SCH_SCREEN( SCHEMATIC_FRAME );
m_AssociatedScreen->m_RefCount++; //be careful with these m_AssociatedScreen->m_RefCount++; //be careful with these
} }
m_AssociatedScreen->m_FileName = aFileName; m_AssociatedScreen->m_FileName = aFileName;
return true; return true;
} }
@ -803,9 +803,9 @@ void DrawSheetPath::UpdateAllScreenReferences()
while( t ) while( t )
{ {
if( t->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) if( t->Type() == TYPE_SCH_COMPONENT )
{ {
EDA_SchComponentStruct* d = (EDA_SchComponentStruct*) t; SCH_COMPONENT* d = (SCH_COMPONENT*) t;
d->m_Field[REFERENCE].m_Text = d->GetRef( this ); d->m_Field[REFERENCE].m_Text = d->GetRef( this );
} }
t = t->Pnext; t = t->Pnext;

View File

@ -19,11 +19,11 @@ void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
{ {
case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_POLYLINE_STRUCT_TYPE:
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
case DRAW_BUSENTRY_STRUCT_TYPE: case DRAW_BUSENTRY_STRUCT_TYPE:
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:

View File

@ -18,15 +18,15 @@
/************************/ /************************/
/* class DrawTextStruct */ /* class SCH_TEXT */
/* class DrawLabelStruct */ /* class SCH_LABEL */
/* class DrawGlobalLabelStruct */ /* class SCH_GLOBALLABEL */
/* class DrawHierLabelStruct */ /* class SCH_HIERLABEL */
/************************/ /************************/
/**************************************************************************/ /**************************************************************************/
DrawTextStruct::DrawTextStruct( const wxPoint& pos, const wxString& text, KICAD_T aType ) : SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
EDA_BaseStruct( aType ) SCH_ITEM( NULL, aType )
, EDA_TextStruct( text ) , EDA_TextStruct( text )
/**************************************************************************/ /**************************************************************************/
{ {
@ -38,28 +38,28 @@ DrawTextStruct::DrawTextStruct( const wxPoint& pos, const wxString& text, KICAD_
/*********************************************/ /*********************************************/
DrawTextStruct* DrawTextStruct::GenCopy() SCH_TEXT* SCH_TEXT::GenCopy()
/*********************************************/ /*********************************************/
{ {
DrawTextStruct* newitem; SCH_TEXT* newitem;
switch( Type() ) switch( Type() )
{ {
default: default:
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
newitem = new DrawTextStruct( m_Pos, m_Text ); newitem = new SCH_TEXT( m_Pos, m_Text );
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
newitem = new DrawGlobalLabelStruct( m_Pos, m_Text ); newitem = new SCH_GLOBALLABEL( m_Pos, m_Text );
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
newitem = new DrawHierLabelStruct( m_Pos, m_Text ); newitem = new SCH_HIERLABEL( m_Pos, m_Text );
break; break;
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
newitem = new DrawLabelStruct( m_Pos, m_Text ); newitem = new SCH_LABEL( m_Pos, m_Text );
break; break;
} }
@ -77,7 +77,7 @@ DrawTextStruct* DrawTextStruct::GenCopy()
/********************************************************/ /********************************************************/
void DrawTextStruct::SwapData( DrawTextStruct* copyitem ) void SCH_TEXT::SwapData( SCH_TEXT* copyitem )
/********************************************************/ /********************************************************/
{ {
EXCHG( m_Text, copyitem->m_Text ); EXCHG( m_Text, copyitem->m_Text );
@ -95,20 +95,20 @@ void DrawTextStruct::SwapData( DrawTextStruct* copyitem )
/***************************************************************/ /***************************************************************/
void DrawTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) void SCH_TEXT::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/***************************************************************/ /***************************************************************/
{ {
/* save old text in undo list */ /* save old text in undo list */
if( g_ItemToUndoCopy && ( (m_Flags & IS_NEW) == 0 ) ) if( g_ItemToUndoCopy && ( (m_Flags & IS_NEW) == 0 ) )
{ {
/* restore old values and save new ones */ /* restore old values and save new ones */
SwapData( (DrawTextStruct*) g_ItemToUndoCopy ); SwapData( (SCH_TEXT*) g_ItemToUndoCopy );
/* save in undo list */ /* save in undo list */
( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_CHANGED ); ( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_CHANGED );
/* restore new values */ /* restore new values */
SwapData( (DrawTextStruct*) g_ItemToUndoCopy ); SwapData( (SCH_TEXT*) g_ItemToUndoCopy );
SAFE_DELETE( g_ItemToUndoCopy ); SAFE_DELETE( g_ItemToUndoCopy );
} }
@ -118,8 +118,8 @@ void DrawTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/****************************************************************************/ /****************************************************************************/
DrawLabelStruct::DrawLabelStruct( const wxPoint& pos, const wxString& text ) : SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) :
DrawTextStruct( pos, text, DRAW_LABEL_STRUCT_TYPE ) SCH_TEXT( pos, text, TYPE_SCH_LABEL )
/****************************************************************************/ /****************************************************************************/
{ {
m_Layer = LAYER_LOCLABEL; m_Layer = LAYER_LOCLABEL;
@ -129,8 +129,8 @@ DrawLabelStruct::DrawLabelStruct( const wxPoint& pos, const wxString& text ) :
/***********************************************************************************/ /***********************************************************************************/
DrawGlobalLabelStruct::DrawGlobalLabelStruct( const wxPoint& pos, const wxString& text ) : SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) :
DrawTextStruct( pos, text, DRAW_GLOBAL_LABEL_STRUCT_TYPE ) SCH_TEXT( pos, text, TYPE_SCH_GLOBALLABEL )
/***********************************************************************************/ /***********************************************************************************/
{ {
m_Layer = LAYER_GLOBLABEL; m_Layer = LAYER_GLOBLABEL;
@ -140,8 +140,8 @@ DrawGlobalLabelStruct::DrawGlobalLabelStruct( const wxPoint& pos, const wxString
/***********************************************************************************/ /***********************************************************************************/
DrawHierLabelStruct::DrawHierLabelStruct( const wxPoint& pos, const wxString& text ) : SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text ) :
DrawTextStruct( pos, text, DRAW_HIER_LABEL_STRUCT_TYPE ) SCH_TEXT( pos, text, TYPE_SCH_HIERLABEL )
/***********************************************************************************/ /***********************************************************************************/
{ {
m_Layer = LAYER_HIERLABEL; m_Layer = LAYER_HIERLABEL;
@ -151,7 +151,7 @@ DrawHierLabelStruct::DrawHierLabelStruct( const wxPoint& pos, const wxString& te
/*******************************************************************************************/ /*******************************************************************************************/
void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color ) int DrawMode, int Color )
/*******************************************************************************************/ /*******************************************************************************************/
@ -211,16 +211,16 @@ void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& off
/*********************************************************************************************/ /*********************************************************************************************/
void DrawLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void SCH_LABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color ) int DrawMode, int Color )
/*********************************************************************************************/ /*********************************************************************************************/
{ {
DrawTextStruct::Draw( panel, DC, offset, DrawMode, Color ); SCH_TEXT::Draw( panel, DC, offset, DrawMode, Color );
} }
/*******************************************************************************************/ /*******************************************************************************************/
void DrawHierLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color ) int DrawMode, int Color )
/******************************************************************************************/ /******************************************************************************************/
@ -288,7 +288,7 @@ void DrawHierLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint
* format list is * format list is
* corner_count, x0, y0, ... xn, yn * corner_count, x0, y0, ... xn, yn
*/ */
void DrawHierLabelStruct::CreateGraphicShape( int* corner_list, const wxPoint& Pos ) void SCH_HIERLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos )
{ {
int* Template = TemplateShape[m_Shape][m_Orient]; int* Template = TemplateShape[m_Shape][m_Orient];
int HalfSize = m_Size.x / 2; int HalfSize = m_Size.x / 2;
@ -307,7 +307,7 @@ void DrawHierLabelStruct::CreateGraphicShape( int* corner_list, const wxPoint& P
/*******************************************************************************************/ /*******************************************************************************************/
void DrawGlobalLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& draw_offset, void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& draw_offset,
int DrawMode, int Color ) int DrawMode, int Color )
/******************************************************************************************/ /******************************************************************************************/
@ -338,9 +338,9 @@ void DrawGlobalLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoi
offset += HalfSize; offset += HalfSize;
break; break;
case NET_OUTPUT: case NET_OUTPUT:
offset += TXTMARGE; offset += TXTMARGE;
break; break;
default: default:
break; break;
@ -392,7 +392,7 @@ void DrawGlobalLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoi
* format list is * format list is
* <corner_count>, x0, y0, ... xn, yn * <corner_count>, x0, y0, ... xn, yn
*/ */
void DrawGlobalLabelStruct::CreateGraphicShape( int* corner_list, const wxPoint& Pos ) void SCH_GLOBALLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos )
{ {
int HalfSize = m_Size.x / 2; int HalfSize = m_Size.x / 2;
int width = MAX( m_Width, g_DrawMinimunLineWidth ); int width = MAX( m_Width, g_DrawMinimunLineWidth );

View File

@ -76,7 +76,7 @@ int* TemplateShape[5][4] =
extern int* TemplateShape[5][4]; extern int* TemplateShape[5][4];
#endif #endif
class DrawTextStruct : public EDA_BaseStruct class SCH_TEXT : public SCH_ITEM
, public EDA_TextStruct , public EDA_TextStruct
{ {
public: public:
@ -85,31 +85,31 @@ public:
bool m_IsDangling; // TRUE si non connect<63> bool m_IsDangling; // TRUE si non connect<63>
public: public:
DrawTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString, SCH_TEXT( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
KICAD_T aType = DRAW_TEXT_STRUCT_TYPE ); KICAD_T aType = TYPE_SCH_TEXT );
~DrawTextStruct() { } ~SCH_TEXT() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "DrawText" ); return wxT( "SCH_TEXT" );
} }
DrawTextStruct* GenCopy(); SCH_TEXT* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 ); int Color = -1 );
void SwapData( DrawTextStruct* copyitem ); void SwapData( SCH_TEXT* copyitem );
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC ); virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
}; };
class DrawLabelStruct : public DrawTextStruct class SCH_LABEL : public SCH_TEXT
{ {
public: public:
DrawLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString ); SCH_LABEL( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
~DrawLabelStruct() { } ~SCH_LABEL() { }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 ); int Color = -1 );
@ -120,12 +120,12 @@ public:
}; };
class DrawGlobalLabelStruct : public DrawTextStruct class SCH_GLOBALLABEL : public SCH_TEXT
{ {
public: public:
DrawGlobalLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ), SCH_GLOBALLABEL( const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString ); const wxString& text = wxEmptyString );
~DrawGlobalLabelStruct() { } ~SCH_GLOBALLABEL() { }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 ); int Color = -1 );
@ -138,21 +138,21 @@ public:
/** function CreateGraphicShape /** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text * Calculates the graphic shape (a polygon) associated to the text
* @param corner_list = coordinates list fill with polygon corners ooordinates (size > 20) * @param corner_list = coordinates list fill with polygon corners ooordinates (size > 20)
* @param Pos = Postion of the shape * @param Pos = Postion of the shape
* format list is * format list is
* <corner_count>, x0, y0, ... xn, yn * <corner_count>, x0, y0, ... xn, yn
*/ */
void CreateGraphicShape( int* corner_list, const wxPoint & Pos ); void CreateGraphicShape( int* corner_list, const wxPoint & Pos );
}; };
class DrawHierLabelStruct : public DrawTextStruct class SCH_HIERLABEL : public SCH_TEXT
{ {
public: public:
DrawHierLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ), SCH_HIERLABEL( const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString ); const wxString& text = wxEmptyString );
~DrawHierLabelStruct() { } ~SCH_HIERLABEL() { }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 ); int Color = -1 );
@ -165,9 +165,9 @@ public:
/** function CreateGraphicShape /** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text * Calculates the graphic shape (a polygon) associated to the text
* @param corner_list = coordinates list fill with polygon corners ooordinates (size >= 14) * @param corner_list = coordinates list fill with polygon corners ooordinates (size >= 14)
* @param Pos = Postion of the shape * @param Pos = Postion of the shape
* format list is * format list is
* <corner_count>, x0, y0, ... xn, yn * <corner_count>, x0, y0, ... xn, yn
*/ */
void CreateGraphicShape( int* corner_list, const wxPoint & Pos ); void CreateGraphicShape( int* corner_list, const wxPoint & Pos );
}; };

View File

@ -105,14 +105,14 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
case DRAW_NOCONNECT_STRUCT_TYPE: case DRAW_NOCONNECT_STRUCT_TYPE:
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
case DRAW_PICK_ITEM_STRUCT_TYPE: case DRAW_PICK_ITEM_STRUCT_TYPE:
case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_POLYLINE_STRUCT_TYPE:
case DRAW_MARKER_STRUCT_TYPE: case DRAW_MARKER_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
case DRAW_SHEETLABEL_STRUCT_TYPE: case DRAW_SHEETLABEL_STRUCT_TYPE:
break; break;

View File

@ -269,7 +269,7 @@ EDA_Rect DrawJunctionStruct::GetBoundingBox()
}; };
EDA_Rect EDA_SchComponentStruct::GetBoundingBox() EDA_Rect SCH_COMPONENT::GetBoundingBox()
{ {
const int PADDING = 40; const int PADDING = 40;

View File

@ -22,28 +22,9 @@
WX_DEFINE_OBJARRAY( ArrayOfSheetLists ); WX_DEFINE_OBJARRAY( ArrayOfSheetLists );
/***************************/ /***************************/
/* class DrawPartStruct */ /* class SCH_COMPONENT */
/* class EDA_SchComponentStruct */
/***************************/ /***************************/
/***********************************************************************************/
DrawPartStruct::DrawPartStruct( KICAD_T struct_type, const wxPoint& pos ) :
EDA_BaseStruct( struct_type )
/***********************************************************************************/
{
m_Layer = 0;
m_Pos = pos;
m_TimeStamp = 0;
}
/************************************/
DrawPartStruct::~DrawPartStruct()
/************************************/
{
}
/****************************************************************/ /****************************************************************/
const wxString& ReturnDefaultFieldName( int aFieldNdx ) const wxString& ReturnDefaultFieldName( int aFieldNdx )
/****************************************************************/ /****************************************************************/
@ -78,7 +59,7 @@ const wxString& ReturnDefaultFieldName( int aFieldNdx )
/****************************************************************/ /****************************************************************/
const wxString& EDA_SchComponentStruct::ReturnFieldName( int aFieldNdx ) const const wxString& SCH_COMPONENT::ReturnFieldName( int aFieldNdx ) const
/****************************************************************/ /****************************************************************/
/* Return the Field name from its index (REFERENCE, VALUE ..) /* Return the Field name from its index (REFERENCE, VALUE ..)
@ -94,7 +75,7 @@ const wxString& EDA_SchComponentStruct::ReturnFieldName( int aFieldNdx ) const
/****************************************************************/ /****************************************************************/
wxString EDA_SchComponentStruct::GetPath( DrawSheetPath* sheet ) wxString SCH_COMPONENT::GetPath( DrawSheetPath* sheet )
/****************************************************************/ /****************************************************************/
{ {
wxString str; wxString str;
@ -105,7 +86,7 @@ wxString EDA_SchComponentStruct::GetPath( DrawSheetPath* sheet )
/********************************************************************/ /********************************************************************/
const wxString EDA_SchComponentStruct::GetRef( DrawSheetPath* sheet ) const wxString SCH_COMPONENT::GetRef( DrawSheetPath* sheet )
/********************************************************************/ /********************************************************************/
{ {
wxString path = GetPath( sheet ); wxString path = GetPath( sheet );
@ -137,7 +118,7 @@ const wxString EDA_SchComponentStruct::GetRef( DrawSheetPath* sheet )
/***********************************************************************/ /***********************************************************************/
void EDA_SchComponentStruct::SetRef( DrawSheetPath* sheet, wxString ref ) void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, wxString ref )
/***********************************************************************/ /***********************************************************************/
{ {
//check to see if it is already there before inserting it //check to see if it is already there before inserting it
@ -176,7 +157,7 @@ void EDA_SchComponentStruct::SetRef( DrawSheetPath* sheet, wxString ref )
/**************************************/ /**************************************/
void EDA_SchComponentStruct::ClearRefs() void SCH_COMPONENT::ClearRefs()
/**************************************/ /**************************************/
{ {
m_Paths.Empty(); m_Paths.Empty();
@ -184,7 +165,7 @@ void EDA_SchComponentStruct::ClearRefs()
} }
const wxString& EDA_SchComponentStruct::GetFieldValue( int aFieldNdx ) const const wxString& SCH_COMPONENT::GetFieldValue( int aFieldNdx ) const
{ {
// avoid unnecessarily copying wxStrings. // avoid unnecessarily copying wxStrings.
static const wxString myEmpty = wxEmptyString; static const wxString myEmpty = wxEmptyString;
@ -197,14 +178,16 @@ const wxString& EDA_SchComponentStruct::GetFieldValue( int aFieldNdx ) const
/*******************************************************************/ /*******************************************************************/
EDA_SchComponentStruct::EDA_SchComponentStruct( const wxPoint& pos ) : SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos ) :
DrawPartStruct( DRAW_LIB_ITEM_STRUCT_TYPE, pos ) SCH_ITEM( NULL, TYPE_SCH_COMPONENT )
/*******************************************************************/ /*******************************************************************/
{ {
int ii; int ii;
m_Multi = 0; /* In multi unit chip - which unit to draw. */ m_Multi = 0; /* In multi unit chip - which unit to draw. */
m_Pos = aPos;
//m_FlagControlMulti = 0; //m_FlagControlMulti = 0;
m_UsedOnSheets.Clear(); m_UsedOnSheets.Clear();
m_Convert = 0; /* Gestion des mutiples representations (conversion De Morgan) */ m_Convert = 0; /* Gestion des mutiples representations (conversion De Morgan) */
@ -234,7 +217,7 @@ EDA_SchComponentStruct::EDA_SchComponentStruct( const wxPoint& pos ) :
/************************************************/ /************************************************/
EDA_Rect EDA_SchComponentStruct::GetBoundaryBox() const EDA_Rect SCH_COMPONENT::GetBoundaryBox() const
/************************************************/ /************************************************/
{ {
EDA_LibComponentStruct* Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); EDA_LibComponentStruct* Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
@ -309,14 +292,14 @@ void PartTextStruct::SwapData( PartTextStruct* copyitem )
/**************************************************************************/ /**************************************************************************/
void EDA_SchComponentStruct::SwapData( EDA_SchComponentStruct* copyitem ) void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem )
/**************************************************************************/ /**************************************************************************/
/* Used if undo / redo command: /* Used if undo / redo command:
* swap data between this and copyitem * swap data between this and copyitem
*/ */
{ {
EXCHG( m_ChipName, copyitem->m_ChipName ); EXCHG( m_ChipName, copyitem->m_ChipName );
EXCHG( m_Pos, copyitem->m_Pos ); EXCHG( m_Pos, copyitem->m_Pos );
EXCHG( m_Multi, copyitem->m_Multi ); EXCHG( m_Multi, copyitem->m_Multi );
EXCHG( m_Convert, copyitem->m_Convert ); EXCHG( m_Convert, copyitem->m_Convert );
@ -332,7 +315,7 @@ void EDA_SchComponentStruct::SwapData( EDA_SchComponentStruct* copyitem )
/***********************************************************************/ /***********************************************************************/
void EDA_SchComponentStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) void SCH_COMPONENT::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/***********************************************************************/ /***********************************************************************/
{ {
/* save old text in undo list */ /* save old text in undo list */
@ -341,13 +324,13 @@ void EDA_SchComponentStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
&& ( (m_Flags & IS_NEW) == 0 ) ) && ( (m_Flags & IS_NEW) == 0 ) )
{ {
/* restore old values and save new ones */ /* restore old values and save new ones */
SwapData( (EDA_SchComponentStruct*) g_ItemToUndoCopy ); SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy );
/* save in undo list */ /* save in undo list */
( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_CHANGED ); ( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_CHANGED );
/* restore new values */ /* restore new values */
SwapData( (EDA_SchComponentStruct*) g_ItemToUndoCopy ); SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy );
SAFE_DELETE( g_ItemToUndoCopy ); SAFE_DELETE( g_ItemToUndoCopy );
} }
@ -357,7 +340,7 @@ void EDA_SchComponentStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/***************************************************/ /***************************************************/
void EDA_SchComponentStruct::ClearAnnotation() void SCH_COMPONENT::ClearAnnotation()
/***************************************************/ /***************************************************/
/* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1) /* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1)
@ -386,16 +369,16 @@ void EDA_SchComponentStruct::ClearAnnotation()
/**************************************************************/ /**************************************************************/
EDA_SchComponentStruct* EDA_SchComponentStruct::GenCopy() SCH_COMPONENT* SCH_COMPONENT::GenCopy()
/**************************************************************/ /**************************************************************/
{ {
EDA_SchComponentStruct* new_item = new EDA_SchComponentStruct( m_Pos ); SCH_COMPONENT* new_item = new SCH_COMPONENT( m_Pos );
int ii; int ii;
new_item->m_Multi = m_Multi; new_item->m_Multi = m_Multi;
new_item->m_ChipName = m_ChipName; new_item->m_ChipName = m_ChipName;
new_item->m_PrefixString = m_PrefixString; new_item->m_PrefixString = m_PrefixString;
//new_item->m_FlagControlMulti = m_FlagControlMulti; //new_item->m_FlagControlMulti = m_FlagControlMulti;
new_item->m_UsedOnSheets = m_UsedOnSheets; new_item->m_UsedOnSheets = m_UsedOnSheets;
@ -418,7 +401,7 @@ EDA_SchComponentStruct* EDA_SchComponentStruct::GenCopy()
/*****************************************************************/ /*****************************************************************/
void EDA_SchComponentStruct::SetRotationMiroir( int type_rotate ) void SCH_COMPONENT::SetRotationMiroir( int type_rotate )
/******************************************************************/ /******************************************************************/
/* Compute the new matrix transform for a schematic component /* Compute the new matrix transform for a schematic component
@ -561,7 +544,7 @@ void EDA_SchComponentStruct::SetRotationMiroir( int type_rotate )
/****************************************************/ /****************************************************/
int EDA_SchComponentStruct::GetRotationMiroir() int SCH_COMPONENT::GetRotationMiroir()
/****************************************************/ /****************************************************/
{ {
int type_rotate = CMP_ORIENT_0; int type_rotate = CMP_ORIENT_0;
@ -626,7 +609,7 @@ int EDA_SchComponentStruct::GetRotationMiroir()
/***********************************************************************/ /***********************************************************************/
wxPoint EDA_SchComponentStruct::GetScreenCoord( const wxPoint& coord ) wxPoint SCH_COMPONENT::GetScreenCoord( const wxPoint& coord )
/***********************************************************************/ /***********************************************************************/
/* Renvoie la coordonn<6E>e du point coord, en fonction de l'orientation /* Renvoie la coordonn<6E>e du point coord, en fonction de l'orientation
@ -651,7 +634,7 @@ wxPoint EDA_SchComponentStruct::GetScreenCoord( const wxPoint& coord )
* of nesting of this object within the overall tree. * of nesting of this object within the overall tree.
* @param os The ostream& to output to. * @param os The ostream& to output to.
*/ */
void EDA_SchComponentStruct::Show( int nestLevel, std::ostream& os ) void SCH_COMPONENT::Show( int nestLevel, std::ostream& os )
{ {
// for now, make it look like XML: // for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
@ -748,7 +731,7 @@ EDA_Rect PartTextStruct::GetBoundaryBox() const
int orient; int orient;
int dx, dy, x1, y1, x2, y2; int dx, dy, x1, y1, x2, y2;
EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*) m_Parent; SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) m_Parent;
orient = m_Orient; orient = m_Orient;
wxPoint pos = DrawLibItem->m_Pos; wxPoint pos = DrawLibItem->m_Pos;

View File

@ -65,36 +65,22 @@ public:
}; };
/* the class DrawPartStruct describes a basic virtual component
* Not used directly:
* used classes are EDA_SchComponentStruct (the "classic" schematic component, below)
* and the Pseudo component DrawSheetStruct
*/
class DrawPartStruct : public EDA_BaseStruct
{
public:
int m_Layer;
wxString m_ChipName; /* Key to look for in the library, i.e. "74LS00". */
PartTextStruct m_Field[NUMBER_OF_FIELDS];
wxPoint m_Pos; /* Exact position of part. */
public:
DrawPartStruct( KICAD_T struct_type, const wxPoint& pos );
~DrawPartStruct();
virtual wxString GetClass() const
{
return wxT( "DrawPart" );
}
};
WX_DECLARE_OBJARRAY( DrawSheetPath, ArrayOfSheetLists ); WX_DECLARE_OBJARRAY( DrawSheetPath, ArrayOfSheetLists );
/* the class EDA_SchComponentStruct describes a real component */
class EDA_SchComponentStruct : public DrawPartStruct /**
* Class SCH_COMPONENT
* describes a real schematic component
*/
class SCH_COMPONENT : public SCH_ITEM
{ {
public: public:
int m_Multi; /* In multi unit chip - which unit to draw. */ int m_Multi; /* In multi unit chip - which unit to draw. */
wxPoint m_Pos;
wxString m_ChipName; /* Key to look for in the library, i.e. "74LS00". */
PartTextStruct m_Field[NUMBER_OF_FIELDS];
//int m_FlagControlMulti; //int m_FlagControlMulti;
ArrayOfSheetLists m_UsedOnSheets; ArrayOfSheetLists m_UsedOnSheets;
int m_Convert; /* Gestion (management) des mutiples representations (ex: conversion De Morgan) */ int m_Convert; /* Gestion (management) des mutiples representations (ex: conversion De Morgan) */
@ -108,16 +94,16 @@ public:
* determined, upon file load, by the first non-digits in the reference fields. */ * determined, upon file load, by the first non-digits in the reference fields. */
public: public:
EDA_SchComponentStruct( const wxPoint& pos = wxPoint( 0, 0 ) ); SCH_COMPONENT( const wxPoint& pos = wxPoint( 0, 0 ) );
~EDA_SchComponentStruct( void ) { } ~SCH_COMPONENT() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "EDA_SchComponent" ); return wxT( "SCH_COMPONENT" );
} }
EDA_SchComponentStruct* GenCopy(); SCH_COMPONENT* GenCopy();
void SetRotationMiroir( int type ); void SetRotationMiroir( int type );
int GetRotationMiroir(); int GetRotationMiroir();
wxPoint GetScreenCoord( const wxPoint& coord ); wxPoint GetScreenCoord( const wxPoint& coord );
@ -143,7 +129,7 @@ public:
const wxPoint& offset, const wxPoint& offset,
int draw_mode, int draw_mode,
int Color = -1 ); int Color = -1 );
void SwapData( EDA_SchComponentStruct* copyitem ); void SwapData( SCH_COMPONENT* copyitem );
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC ); virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );

View File

@ -42,7 +42,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
wxString msg; wxString msg;
wxPoint mouse_position = GetScreen()->m_MousePosition; wxPoint mouse_position = GetScreen()->m_MousePosition;
LibDrawPin* Pin = NULL; LibDrawPin* Pin = NULL;
EDA_SchComponentStruct* LibItem = NULL; SCH_COMPONENT* LibItem = NULL;
DrawStruct = SchematicGeneralLocateAndDisplay( mouse_position, IncludePin ); DrawStruct = SchematicGeneralLocateAndDisplay( mouse_position, IncludePin );
if( !DrawStruct && ( mouse_position != GetScreen()->m_Curseur) ) if( !DrawStruct && ( mouse_position != GetScreen()->m_Curseur) )
@ -57,15 +57,15 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
{ {
case DRAW_PART_TEXT_STRUCT_TYPE: case DRAW_PART_TEXT_STRUCT_TYPE:
case COMPONENT_FIELD_DRAW_TYPE: case COMPONENT_FIELD_DRAW_TYPE:
LibItem = (EDA_SchComponentStruct*) DrawStruct->m_Parent; LibItem = (SCH_COMPONENT*) DrawStruct->m_Parent;
SendMessageToPCBNEW( DrawStruct,LibItem ); SendMessageToPCBNEW( DrawStruct,LibItem );
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
Pin = LocateAnyPin( GetScreen()->EEDrawList, GetScreen()->m_Curseur, &LibItem ); Pin = LocateAnyPin( GetScreen()->EEDrawList, GetScreen()->m_Curseur, &LibItem );
if( Pin ) if( Pin )
break; // Priority is probing a pin first break; // Priority is probing a pin first
LibItem = (EDA_SchComponentStruct*) DrawStruct; LibItem = (SCH_COMPONENT*) DrawStruct;
SendMessageToPCBNEW( DrawStruct, LibItem ); SendMessageToPCBNEW( DrawStruct, LibItem );
break; break;
@ -118,7 +118,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
{ {
EDA_BaseStruct* DrawStruct; EDA_BaseStruct* DrawStruct;
LibDrawPin* Pin; LibDrawPin* Pin;
EDA_SchComponentStruct* LibItem; SCH_COMPONENT* LibItem;
wxString Text; wxString Text;
wxString msg; wxString msg;
int ii; int ii;
@ -175,7 +175,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
if( DrawStruct ) if( DrawStruct )
{ {
PartTextStruct* Field = (PartTextStruct*) DrawStruct; PartTextStruct* Field = (PartTextStruct*) DrawStruct;
LibItem = (EDA_SchComponentStruct*) Field->m_Parent; LibItem = (SCH_COMPONENT*) Field->m_Parent;
LibItem->Display_Infos( this ); LibItem->Display_Infos( this );
return DrawStruct; return DrawStruct;
@ -199,7 +199,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
if( DrawStruct ) if( DrawStruct )
{ {
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
LibItem = (EDA_SchComponentStruct*) DrawStruct; LibItem = (SCH_COMPONENT*) DrawStruct;
LibItem->Display_Infos( this ); LibItem->Display_Infos( this );
return DrawStruct; return DrawStruct;
} }

View File

@ -86,7 +86,7 @@ void RemoteCommand( const char* cmdline )
/*****************************************************************************/ /*****************************************************************************/
void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync, void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
EDA_SchComponentStruct* LibItem ) SCH_COMPONENT* LibItem )
/*****************************************************************************/ /*****************************************************************************/
/** Send a remote command to eeschema via a socket, /** Send a remote command to eeschema via a socket,
@ -116,8 +116,8 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectT
} }
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
LibItem = (EDA_SchComponentStruct*) objectToSync; LibItem = (SCH_COMPONENT*) objectToSync;
sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->m_Field[REFERENCE].m_Text ) ); sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->m_Field[REFERENCE].m_Text ) );
SendCommand( MSG_TO_PCB, Line ); SendCommand( MSG_TO_PCB, Line );
break; break;

View File

@ -47,7 +47,7 @@ DanglingEndHandle* ItemList;
static void TestWireForDangling( EDA_DrawLineStruct* DrawRef, static void TestWireForDangling( EDA_DrawLineStruct* DrawRef,
WinEDA_SchematicFrame* frame, wxDC* DC ); WinEDA_SchematicFrame* frame, wxDC* DC );
void TestLabelForDangling( DrawTextStruct* label, void TestLabelForDangling( SCH_TEXT* label,
WinEDA_SchematicFrame* frame, wxDC* DC ); WinEDA_SchematicFrame* frame, wxDC* DC );
DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ); DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList );
@ -111,11 +111,11 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC
{ {
switch( DrawItem->Type() ) switch( DrawItem->Type() )
{ {
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawLabelStruct*) DrawItem ) #define STRUCT ( (SCH_LABEL*) DrawItem )
TestLabelForDangling( STRUCT, this, DC ); TestLabelForDangling( STRUCT, this, DC );
break; break;
break; break;
@ -155,7 +155,7 @@ LibDrawPin* WinEDA_SchematicFrame::LocatePinEnd( EDA_BaseStruct* DrawList,
* NULL sinon * NULL sinon
*/ */
{ {
EDA_SchComponentStruct* DrawLibItem; SCH_COMPONENT* DrawLibItem;
LibDrawPin* Pin; LibDrawPin* Pin;
wxPoint pinpos; wxPoint pinpos;
@ -223,7 +223,7 @@ void TestWireForDangling( EDA_DrawLineStruct* DrawRef,
/********************************************************/ /********************************************************/
void TestLabelForDangling( DrawTextStruct* label, void TestLabelForDangling( SCH_TEXT* label,
WinEDA_SchematicFrame* frame, wxDC* DC ) WinEDA_SchematicFrame* frame, wxDC* DC )
/********************************************************/ /********************************************************/
{ {
@ -281,7 +281,7 @@ void TestLabelForDangling( DrawTextStruct* label,
/****************************************************/ /****************************************************/
wxPoint ReturnPinPhysicalPosition( LibDrawPin* Pin, wxPoint ReturnPinPhysicalPosition( LibDrawPin* Pin,
EDA_SchComponentStruct* DrawLibItem ) SCH_COMPONENT* DrawLibItem )
/****************************************************/ /****************************************************/
/* Retourne la position physique de la pin, qui d<>pend de l'orientation /* Retourne la position physique de la pin, qui d<>pend de l'orientation
@ -316,13 +316,13 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
{ {
switch( DrawItem->Type() ) switch( DrawItem->Type() )
{ {
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawLabelStruct*) DrawItem ) #define STRUCT ( (SCH_LABEL*) DrawItem )
item = new DanglingEndHandle( LABEL_END ); item = new DanglingEndHandle( LABEL_END );
item->m_Item = DrawItem; item->m_Item = DrawItem;
@ -395,10 +395,10 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
lastitem = item; lastitem = item;
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
{ {
#undef STRUCT #undef STRUCT
#define STRUCT ( (EDA_SchComponentStruct*) DrawItem ) #define STRUCT ( (SCH_COMPONENT*) DrawItem )
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
Entry = FindLibPart( STRUCT->m_ChipName, wxEmptyString, FIND_ROOT ); Entry = FindLibPart( STRUCT->m_ChipName, wxEmptyString, FIND_ROOT );
if( Entry == NULL ) if( Entry == NULL )

View File

@ -280,10 +280,10 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
if( DelStruct->m_Flags & STRUCT_DELETED ) if( DelStruct->m_Flags & STRUCT_DELETED )
continue; continue;
if( DelStruct->Type() != DRAW_LABEL_STRUCT_TYPE ) if( DelStruct->Type() != TYPE_SCH_LABEL )
continue; continue;
GetScreen()->m_Curseur = ( (DrawTextStruct*) DelStruct )->m_Pos; GetScreen()->m_Curseur = ( (SCH_TEXT*) DelStruct )->m_Pos;
EDA_BaseStruct* TstStruct = EDA_BaseStruct* TstStruct =
PickStruct( GetScreen()->m_Curseur, GetScreen(), WIREITEM | BUSITEM ); PickStruct( GetScreen()->m_Curseur, GetScreen(), WIREITEM | BUSITEM );

View File

@ -845,7 +845,7 @@ int GenListeCmp( ListComponent* List )
{ {
int ItemCount = 0; int ItemCount = 0;
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
EDA_SchComponentStruct* DrawLibItem; SCH_COMPONENT* DrawLibItem;
DrawSheetPath* sheet; DrawSheetPath* sheet;
/* Build the sheet (not screen) list */ /* Build the sheet (not screen) list */
@ -858,9 +858,9 @@ int GenListeCmp( ListComponent* List )
{ {
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
ItemCount++; ItemCount++;
DrawLibItem = (EDA_SchComponentStruct*) DrawList; DrawLibItem = (SCH_COMPONENT*) DrawList;
DrawLibItem->m_Parent = sheet->LastScreen(); DrawLibItem->m_Parent = sheet->LastScreen();
if( List ) if( List )
{ {
@ -910,8 +910,8 @@ static int GenListeGLabels( ListLabel* List )
{ {
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
ItemCount++; ItemCount++;
if( List ) if( List )
{ {
@ -1063,12 +1063,12 @@ static int ListTriGLabelByVal( ListLabel* Objet1, ListLabel* Objet2 )
if( Objet1->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE ) if( Objet1->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE )
Text1 = &( (DrawSheetLabelStruct*) Objet1->m_Label )->m_Text; Text1 = &( (DrawSheetLabelStruct*) Objet1->m_Label )->m_Text;
else else
Text1 = &( (DrawTextStruct*) Objet1->m_Label )->m_Text; Text1 = &( (SCH_TEXT*) Objet1->m_Label )->m_Text;
if( Objet2->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE ) if( Objet2->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE )
Text2 = &( (DrawSheetLabelStruct*) Objet2->m_Label )->m_Text; Text2 = &( (DrawSheetLabelStruct*) Objet2->m_Label )->m_Text;
else else
Text2 = &( (DrawTextStruct*) Objet2->m_Label )->m_Text; Text2 = &( (SCH_TEXT*) Objet2->m_Label )->m_Text;
ii = Text1->CmpNoCase( *Text2 ); ii = Text1->CmpNoCase( *Text2 );
@ -1102,12 +1102,12 @@ static int ListTriGLabelBySheet( ListLabel* Objet1, ListLabel* Objet2 )
if( Objet1->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE ) if( Objet1->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE )
Text1 = &( (DrawSheetLabelStruct*) Objet1->m_Label )->m_Text; Text1 = &( (DrawSheetLabelStruct*) Objet1->m_Label )->m_Text;
else else
Text1 = &( (DrawTextStruct*) Objet1->m_Label )->m_Text; Text1 = &( (SCH_TEXT*) Objet1->m_Label )->m_Text;
if( Objet2->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE ) if( Objet2->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE )
Text2 = &( (DrawSheetLabelStruct*) Objet2->m_Label )->m_Text; Text2 = &( (DrawSheetLabelStruct*) Objet2->m_Label )->m_Text;
else else
Text2 = &( (DrawTextStruct*) Objet2->m_Label )->m_Text; Text2 = &( (SCH_TEXT*) Objet2->m_Label )->m_Text;
ii = Text1->CmpNoCase( *Text2 ); ii = Text1->CmpNoCase( *Text2 );
} }
@ -1125,7 +1125,7 @@ static void DeleteSubCmp( ListComponent* List, int NbItems )
*/ */
{ {
int ii; int ii;
EDA_SchComponentStruct* LibItem; SCH_COMPONENT* LibItem;
wxString OldName, CurrName; wxString OldName, CurrName;
for( ii = 0; ii < NbItems; ii++ ) for( ii = 0; ii < NbItems; ii++ )
@ -1149,7 +1149,7 @@ static void DeleteSubCmp( ListComponent* List, int NbItems )
/*******************************************************************************************/ /*******************************************************************************************/
void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, EDA_SchComponentStruct* DrawLibItem, void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
bool CompactForm ) bool CompactForm )
/*******************************************************************************************/ /*******************************************************************************************/
{ {
@ -1198,7 +1198,7 @@ int WinEDA_Build_BOM_Frame::PrintListeCmpByRef( FILE* f, ListComponent* List, in
{ {
int ii, Multi, Unit; int ii, Multi, Unit;
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
EDA_SchComponentStruct* DrawLibItem; SCH_COMPONENT* DrawLibItem;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
char NameCmp[80]; char NameCmp[80];
wxString msg; wxString msg;
@ -1254,10 +1254,10 @@ int WinEDA_Build_BOM_Frame::PrintListeCmpByRef( FILE* f, ListComponent* List, in
if( DrawList == NULL ) if( DrawList == NULL )
continue; continue;
if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawList->Type() != TYPE_SCH_COMPONENT )
continue; continue;
DrawLibItem = (EDA_SchComponentStruct*) DrawList; DrawLibItem = (SCH_COMPONENT*) DrawList;
if( List[ii].m_Ref[0] == '#' ) if( List[ii].m_Ref[0] == '#' )
continue; continue;
@ -1313,7 +1313,7 @@ int WinEDA_Build_BOM_Frame::PrintListeCmpByVal( FILE* f, ListComponent* List, in
int ii, Multi; int ii, Multi;
wxChar Unit; wxChar Unit;
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
EDA_SchComponentStruct* DrawLibItem; SCH_COMPONENT* DrawLibItem;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
wxString msg; wxString msg;
@ -1331,10 +1331,10 @@ int WinEDA_Build_BOM_Frame::PrintListeCmpByVal( FILE* f, ListComponent* List, in
if( DrawList == NULL ) if( DrawList == NULL )
continue; continue;
if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawList->Type() != TYPE_SCH_COMPONENT )
continue; continue;
DrawLibItem = (EDA_SchComponentStruct*) DrawList; DrawLibItem = (SCH_COMPONENT*) DrawList;
if( List[ii].m_Ref[0] == '#' ) if( List[ii].m_Ref[0] == '#' )
continue; continue;
@ -1354,10 +1354,10 @@ int WinEDA_Build_BOM_Frame::PrintListeCmpByVal( FILE* f, ListComponent* List, in
List[ii].m_Ref, Unit ); List[ii].m_Ref, Unit );
// if( s_ListWithSubCmponents ) // if( s_ListWithSubCmponents )
// print the sheet path // print the sheet path
if( m_ListSubCmpItems->GetValue() ) if( m_ListSubCmpItems->GetValue() )
{ {
msg = List[ii].m_SheetList.PathHumanReadable(); msg = List[ii].m_SheetList.PathHumanReadable();
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) ); fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
} }
@ -1377,7 +1377,7 @@ static int PrintListeGLabel( FILE* f, ListLabel* List, int NbItems )
/******************************************************************/ /******************************************************************/
{ {
int ii, jj; int ii, jj;
DrawLabelStruct* DrawTextItem; SCH_LABEL* DrawTextItem;
DrawSheetLabelStruct* DrawSheetLabel; DrawSheetLabelStruct* DrawSheetLabel;
ListLabel* LabelItem; ListLabel* LabelItem;
wxString msg, sheetpath; wxString msg, sheetpath;
@ -1389,14 +1389,14 @@ static int PrintListeGLabel( FILE* f, ListLabel* List, int NbItems )
switch( LabelItem->m_LabelType ) switch( LabelItem->m_LabelType )
{ {
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
DrawTextItem = (DrawLabelStruct*) (LabelItem->m_Label); DrawTextItem = (SCH_LABEL*) (LabelItem->m_Label);
if( LabelItem->m_LabelType == DRAW_HIER_LABEL_STRUCT_TYPE ) if( LabelItem->m_LabelType == TYPE_SCH_HIERLABEL )
labeltype = wxT("Hierarchical"); labeltype = wxT("Hierarchical");
else else
labeltype = wxT("Global "); labeltype = wxT("Global ");
sheetpath = CONV_FROM_UTF8(LabelItem->m_SheetPath); sheetpath = CONV_FROM_UTF8(LabelItem->m_SheetPath);
msg.Printf( msg.Printf(
_( "> %-28.28s %s (Sheet %s) pos: %3.3f, %3.3f\n" ), _( "> %-28.28s %s (Sheet %s) pos: %3.3f, %3.3f\n" ),
DrawTextItem->m_Text.GetData(), DrawTextItem->m_Text.GetData(),

View File

@ -88,11 +88,11 @@ public:
/// Constructors /// Constructors
WinEDA_Build_BOM_Frame( ); WinEDA_Build_BOM_Frame( );
WinEDA_Build_BOM_Frame( WinEDA_DrawFrame* parent, WinEDA_Build_BOM_Frame( WinEDA_DrawFrame* parent,
wxWindowID id = SYMBOL_WINEDA_BUILD_BOM_FRAME_IDNAME, wxWindowID id = SYMBOL_WINEDA_BUILD_BOM_FRAME_IDNAME,
const wxString& caption = SYMBOL_WINEDA_BUILD_BOM_FRAME_TITLE, const wxString& caption = SYMBOL_WINEDA_BUILD_BOM_FRAME_TITLE,
const wxPoint& pos = SYMBOL_WINEDA_BUILD_BOM_FRAME_POSITION, const wxPoint& pos = SYMBOL_WINEDA_BUILD_BOM_FRAME_POSITION,
const wxSize& size = SYMBOL_WINEDA_BUILD_BOM_FRAME_SIZE, const wxSize& size = SYMBOL_WINEDA_BUILD_BOM_FRAME_SIZE,
long style = SYMBOL_WINEDA_BUILD_BOM_FRAME_STYLE ); long style = SYMBOL_WINEDA_BUILD_BOM_FRAME_STYLE );
/// Creation /// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_BUILD_BOM_FRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_BUILD_BOM_FRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_BUILD_BOM_FRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_BUILD_BOM_FRAME_SIZE, long style = SYMBOL_WINEDA_BUILD_BOM_FRAME_STYLE ); bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_BUILD_BOM_FRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_BUILD_BOM_FRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_BUILD_BOM_FRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_BUILD_BOM_FRAME_SIZE, long style = SYMBOL_WINEDA_BUILD_BOM_FRAME_STYLE );
@ -119,7 +119,7 @@ public:
////@end WinEDA_Build_BOM_Frame event handler declarations ////@end WinEDA_Build_BOM_Frame event handler declarations
void GenList(); void GenList();
////@begin WinEDA_Build_BOM_Frame member function declarations ////@begin WinEDA_Build_BOM_Frame member function declarations
@ -129,12 +129,12 @@ public:
/// Retrieves icon resources /// Retrieves icon resources
wxIcon GetIconResource( const wxString& name ); wxIcon GetIconResource( const wxString& name );
////@end WinEDA_Build_BOM_Frame member function declarations ////@end WinEDA_Build_BOM_Frame member function declarations
void GenereListeOfItems(const wxString & FullFileName); void GenereListeOfItems(const wxString & FullFileName);
void CreateExportList(const wxString & FullFileName); void CreateExportList(const wxString & FullFileName);
int PrintListeCmpByRef( FILE * f, ListComponent * List, int NbItems, bool CompactForm = FALSE ); int PrintListeCmpByRef( FILE * f, ListComponent * List, int NbItems, bool CompactForm = FALSE );
int PrintListeCmpByVal( FILE *f, ListComponent * List, int NbItems); int PrintListeCmpByVal( FILE *f, ListComponent * List, int NbItems);
void PrintFieldData(FILE * f, EDA_SchComponentStruct * DrawLibItem, bool CompactForm = FALSE); void PrintFieldData(FILE * f, SCH_COMPONENT * DrawLibItem, bool CompactForm = FALSE);
void SavePreferences(); void SavePreferences();
/// Should we show tooltips? /// Should we show tooltips?
@ -161,9 +161,9 @@ public:
wxCheckBox* m_AddField8; wxCheckBox* m_AddField8;
////@end WinEDA_Build_BOM_Frame member variables ////@end WinEDA_Build_BOM_Frame member variables
WinEDA_DrawFrame * m_Parent; WinEDA_DrawFrame * m_Parent;
wxString m_LibArchiveFileName; wxString m_LibArchiveFileName;
wxString m_ListFileName; wxString m_ListFileName;
}; };
#endif #endif

View File

@ -41,7 +41,7 @@ BEGIN_EVENT_TABLE( WinEDA_ComponentPropertiesFrame, wxDialog )
////@end WinEDA_ComponentPropertiesFrame event table entries ////@end WinEDA_ComponentPropertiesFrame event table entries
EVT_RADIOBOX(ID_ON_SELECT_FIELD, WinEDA_ComponentPropertiesFrame::SelectNewField) EVT_RADIOBOX(ID_ON_SELECT_FIELD, WinEDA_ComponentPropertiesFrame::SelectNewField)
END_EVENT_TABLE() END_EVENT_TABLE()
@ -54,21 +54,21 @@ WinEDA_ComponentPropertiesFrame::WinEDA_ComponentPropertiesFrame( )
} }
WinEDA_ComponentPropertiesFrame::WinEDA_ComponentPropertiesFrame( WinEDA_SchematicFrame* parent, WinEDA_ComponentPropertiesFrame::WinEDA_ComponentPropertiesFrame( WinEDA_SchematicFrame* parent,
EDA_SchComponentStruct * cmp, SCH_COMPONENT * cmp,
wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{ {
m_Parent = parent; m_Parent = parent;
m_Cmp = cmp; m_Cmp = cmp;
m_LibEntry = FindLibPart(m_Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT); m_LibEntry = FindLibPart(m_Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT);
InitBuffers(); InitBuffers();
Create(parent, id, caption, pos, size, style); Create(parent, id, caption, pos, size, style);
if ( m_LibEntry == NULL ) if ( m_LibEntry == NULL )
{ {
SetTitle(_("Component properties (Not found in lib)")); SetTitle(_("Component properties (Not found in lib)"));
} }
} }
/*! /*!
@ -77,7 +77,7 @@ WinEDA_ComponentPropertiesFrame::WinEDA_ComponentPropertiesFrame( WinEDA_Schemat
bool WinEDA_ComponentPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) bool WinEDA_ComponentPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{ {
m_FieldNameCtrl = NULL; m_FieldNameCtrl = NULL;
////@begin WinEDA_ComponentPropertiesFrame member initialisation ////@begin WinEDA_ComponentPropertiesFrame member initialisation
m_GeneralBoxSizer = NULL; m_GeneralBoxSizer = NULL;
m_NoteBook = NULL; m_NoteBook = NULL;
@ -115,7 +115,7 @@ bool WinEDA_ComponentPropertiesFrame::Create( wxWindow* parent, wxWindowID id, c
void WinEDA_ComponentPropertiesFrame::CreateControls() void WinEDA_ComponentPropertiesFrame::CreateControls()
{ {
SetFont(*g_DialogFont); SetFont(*g_DialogFont);
////@begin WinEDA_ComponentPropertiesFrame content construction ////@begin WinEDA_ComponentPropertiesFrame content construction
// Generated by DialogBlocks, 07/11/2007 08:28:00 (unregistered) // Generated by DialogBlocks, 07/11/2007 08:28:00 (unregistered)
@ -242,8 +242,8 @@ void WinEDA_ComponentPropertiesFrame::CreateControls()
itemBoxSizer23->Add(itemButton26, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); itemBoxSizer23->Add(itemButton26, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
////@end WinEDA_ComponentPropertiesFrame content construction ////@end WinEDA_ComponentPropertiesFrame content construction
BuildPanelBasic(); BuildPanelBasic();
BuildPanelFields(); BuildPanelFields();
} }
/*! /*!
@ -295,7 +295,7 @@ void WinEDA_ComponentPropertiesFrame::OnCancelClick( wxCommandEvent& event )
void WinEDA_ComponentPropertiesFrame::OnRestoreCmpDefaultsClick( wxCommandEvent& event ) void WinEDA_ComponentPropertiesFrame::OnRestoreCmpDefaultsClick( wxCommandEvent& event )
{ {
SetInitCmp(event); SetInitCmp(event);
} }
/*! /*!
@ -304,5 +304,5 @@ void WinEDA_ComponentPropertiesFrame::OnRestoreCmpDefaultsClick( wxCommandEvent&
void WinEDA_ComponentPropertiesFrame::OnOkClick( wxCommandEvent& event ) void WinEDA_ComponentPropertiesFrame::OnOkClick( wxCommandEvent& event )
{ {
ComponentPropertiesAccept(event); ComponentPropertiesAccept(event);
} }

View File

@ -76,8 +76,8 @@ public:
/// Constructors /// Constructors
WinEDA_ComponentPropertiesFrame( ); WinEDA_ComponentPropertiesFrame( );
WinEDA_ComponentPropertiesFrame( WinEDA_SchematicFrame* parent, WinEDA_ComponentPropertiesFrame( WinEDA_SchematicFrame* parent,
EDA_SchComponentStruct * cmp, SCH_COMPONENT * cmp,
wxWindowID id = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_STYLE ); wxWindowID id = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_STYLE );
/// Creation /// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_STYLE ); bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_STYLE );
@ -110,14 +110,14 @@ public:
/// Should we show tooltips? /// Should we show tooltips?
static bool ShowToolTips(); static bool ShowToolTips();
void InitBuffers(); void InitBuffers();
void BuildPanelBasic(); void BuildPanelBasic();
void BuildPanelFields(); void BuildPanelFields();
void ComponentPropertiesAccept(wxCommandEvent& event); void ComponentPropertiesAccept(wxCommandEvent& event);
void SetInitCmp( wxCommandEvent& event ); void SetInitCmp( wxCommandEvent& event );
void CopyDataToPanelField(); void CopyDataToPanelField();
void CopyPanelFieldToData(); void CopyPanelFieldToData();
void SelectNewField(wxCommandEvent& event); void SelectNewField(wxCommandEvent& event);
////@begin WinEDA_ComponentPropertiesFrame member variables ////@begin WinEDA_ComponentPropertiesFrame member variables
wxBoxSizer* m_GeneralBoxSizer; wxBoxSizer* m_GeneralBoxSizer;
@ -136,21 +136,21 @@ public:
wxBoxSizer* m_FieldSelectionBoxSizer; wxBoxSizer* m_FieldSelectionBoxSizer;
////@end WinEDA_ComponentPropertiesFrame member variables ////@end WinEDA_ComponentPropertiesFrame member variables
WinEDA_SchematicFrame * m_Parent; WinEDA_SchematicFrame * m_Parent;
EDA_SchComponentStruct * m_Cmp; SCH_COMPONENT * m_Cmp;
EDA_LibComponentStruct * m_LibEntry; EDA_LibComponentStruct * m_LibEntry;
int m_CurrentFieldId; int m_CurrentFieldId;
wxRadioBox * m_FieldSelection; wxRadioBox * m_FieldSelection;
WinEDA_GraphicTextCtrl * m_FieldTextCtrl; WinEDA_GraphicTextCtrl * m_FieldTextCtrl;
WinEDA_EnterText * m_FieldNameCtrl; WinEDA_EnterText * m_FieldNameCtrl;
WinEDA_PositionCtrl * m_FieldPositionCtrl; WinEDA_PositionCtrl * m_FieldPositionCtrl;
wxString m_FieldText[NUMBER_OF_FIELDS]; wxString m_FieldText[NUMBER_OF_FIELDS];
wxString m_FieldName[NUMBER_OF_FIELDS]; wxString m_FieldName[NUMBER_OF_FIELDS];
wxPoint m_FieldPosition[NUMBER_OF_FIELDS]; wxPoint m_FieldPosition[NUMBER_OF_FIELDS];
int m_FieldSize[NUMBER_OF_FIELDS]; int m_FieldSize[NUMBER_OF_FIELDS];
int m_FieldFlags[NUMBER_OF_FIELDS]; int m_FieldFlags[NUMBER_OF_FIELDS];
int m_FieldOrient[NUMBER_OF_FIELDS]; int m_FieldOrient[NUMBER_OF_FIELDS];
}; };
#endif #endif

View File

@ -51,42 +51,42 @@ WinEDA_LabelPropertiesFrame::WinEDA_LabelPropertiesFrame( )
} }
WinEDA_LabelPropertiesFrame::WinEDA_LabelPropertiesFrame( WinEDA_SchematicFrame* parent, WinEDA_LabelPropertiesFrame::WinEDA_LabelPropertiesFrame( WinEDA_SchematicFrame* parent,
DrawTextStruct * CurrentText, SCH_TEXT * CurrentText,
const wxPoint& pos, const wxPoint& pos,
wxWindowID id, const wxString& caption, const wxSize& size, long style ) wxWindowID id, const wxString& caption, const wxSize& size, long style )
{ {
wxString msg; wxString msg;
m_Parent = parent; m_Parent = parent;
m_CurrentText = CurrentText; m_CurrentText = CurrentText;
Create(parent, id, caption, pos, size, style); Create(parent, id, caption, pos, size, style);
m_TextLabel->SetValue(m_CurrentText->m_Text); m_TextLabel->SetValue(m_CurrentText->m_Text);
m_TextLabel->SetFocus(); m_TextLabel->SetFocus();
switch( m_CurrentText->Type() ) switch( m_CurrentText->Type() )
{ {
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
SetTitle(_("Global Label properties")); SetTitle(_("Global Label properties"));
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
SetTitle(_("Hierarchal Label properties")); SetTitle(_("Hierarchal Label properties"));
break; break;
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
SetTitle(_("Label properties")); SetTitle(_("Label properties"));
break; break;
default: default:
SetTitle(_("Text properties")); SetTitle(_("Text properties"));
break; break;
} }
msg = m_SizeTitle->GetLabel() + ReturnUnitSymbol(); msg = m_SizeTitle->GetLabel() + ReturnUnitSymbol();
m_SizeTitle->SetLabel(msg); m_SizeTitle->SetLabel(msg);
msg = ReturnStringFromValue(g_UnitMetric, m_CurrentText->m_Size.x, m_Parent->m_InternalUnits); msg = ReturnStringFromValue(g_UnitMetric, m_CurrentText->m_Size.x, m_Parent->m_InternalUnits);
m_TextSize->SetValue(msg); m_TextSize->SetValue(msg);
} }
/*! /*!
@ -121,7 +121,7 @@ bool WinEDA_LabelPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const
void WinEDA_LabelPropertiesFrame::CreateControls() void WinEDA_LabelPropertiesFrame::CreateControls()
{ {
SetFont(*g_DialogFont); SetFont(*g_DialogFont);
////@begin WinEDA_LabelPropertiesFrame content construction ////@begin WinEDA_LabelPropertiesFrame content construction
// Generated by DialogBlocks, 07/11/2007 12:37:47 (unregistered) // Generated by DialogBlocks, 07/11/2007 12:37:47 (unregistered)
@ -189,8 +189,8 @@ void WinEDA_LabelPropertiesFrame::CreateControls()
m_TextShape->SetValidator( wxGenericValidator(& m_CurrentText->m_Shape) ); m_TextShape->SetValidator( wxGenericValidator(& m_CurrentText->m_Shape) );
////@end WinEDA_LabelPropertiesFrame content construction ////@end WinEDA_LabelPropertiesFrame content construction
if (m_CurrentText->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE || if (m_CurrentText->Type() == TYPE_SCH_GLOBALLABEL ||
m_CurrentText->Type() == DRAW_HIER_LABEL_STRUCT_TYPE) m_CurrentText->Type() == TYPE_SCH_HIERLABEL)
m_TextShape->Show(true); m_TextShape->Show(true);
} }

View File

@ -68,9 +68,9 @@ public:
/// Constructors /// Constructors
WinEDA_LabelPropertiesFrame( ); WinEDA_LabelPropertiesFrame( );
WinEDA_LabelPropertiesFrame( WinEDA_SchematicFrame* parent, WinEDA_LabelPropertiesFrame( WinEDA_SchematicFrame* parent,
DrawTextStruct * CurrentText, SCH_TEXT * CurrentText,
const wxPoint& pos = SYMBOL_WINEDA_LABELPROPERTIESFRAME_POSITION, const wxPoint& pos = SYMBOL_WINEDA_LABELPROPERTIESFRAME_POSITION,
wxWindowID id = SYMBOL_WINEDA_LABELPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_LABELPROPERTIESFRAME_TITLE, const wxSize& size = SYMBOL_WINEDA_LABELPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_LABELPROPERTIESFRAME_STYLE ); wxWindowID id = SYMBOL_WINEDA_LABELPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_LABELPROPERTIESFRAME_TITLE, const wxSize& size = SYMBOL_WINEDA_LABELPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_LABELPROPERTIESFRAME_STYLE );
/// Creation /// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_LABELPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_LABELPROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_LABELPROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_LABELPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_LABELPROPERTIESFRAME_STYLE ); bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_LABELPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_LABELPROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_LABELPROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_LABELPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_LABELPROPERTIESFRAME_STYLE );
@ -99,7 +99,7 @@ public:
/// Should we show tooltips? /// Should we show tooltips?
static bool ShowToolTips(); static bool ShowToolTips();
void TextPropertiesAccept(wxCommandEvent& event); void TextPropertiesAccept(wxCommandEvent& event);
////@begin WinEDA_LabelPropertiesFrame member variables ////@begin WinEDA_LabelPropertiesFrame member variables
wxTextCtrl* m_TextLabel; wxTextCtrl* m_TextLabel;
@ -110,7 +110,7 @@ public:
////@end WinEDA_LabelPropertiesFrame member variables ////@end WinEDA_LabelPropertiesFrame member variables
WinEDA_SchematicFrame * m_Parent; WinEDA_SchematicFrame * m_Parent;
DrawTextStruct * m_CurrentText; SCH_TEXT * m_CurrentText;
}; };

View File

@ -39,14 +39,14 @@ static wxPoint OldPos;
/**********************************************************************/ /**********************************************************************/
void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos, void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
EDA_SchComponentStruct* cmp ) SCH_COMPONENT* cmp )
/*********************************************************************/ /*********************************************************************/
/* Create the dialog box for the current component edition /* Create the dialog box for the current component edition
*/ */
{ {
parent->DrawPanel->m_IgnoreMouseEvents = TRUE; parent->DrawPanel->m_IgnoreMouseEvents = TRUE;
if( cmp->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( cmp->Type() != TYPE_SCH_COMPONENT )
{ {
DisplayError( parent, DisplayError( parent,
wxT( "InstallCmpeditFrame() error: This struct is not a component" ) ); wxT( "InstallCmpeditFrame() error: This struct is not a component" ) );
@ -90,10 +90,10 @@ void WinEDA_ComponentPropertiesFrame::InitBuffers()
for( ii = REFERENCE; ii < NUMBER_OF_FIELDS; ii++ ) for( ii = REFERENCE; ii < NUMBER_OF_FIELDS; ii++ )
{ {
m_FieldName[ii] = m_Cmp->ReturnFieldName( ii ); m_FieldName[ii] = m_Cmp->ReturnFieldName( ii );
if(ii == REFERENCE) if(ii == REFERENCE)
m_FieldText[ii] = m_Cmp->GetRef(m_Parent->GetSheet()); m_FieldText[ii] = m_Cmp->GetRef(m_Parent->GetSheet());
else else
m_FieldText[ii] = m_Cmp->m_Field[ii].m_Text; m_FieldText[ii] = m_Cmp->m_Field[ii].m_Text;
m_FieldSize[ii] = m_Cmp->m_Field[ii].m_Size.x; m_FieldSize[ii] = m_Cmp->m_Field[ii].m_Size.x;
m_FieldFlags[ii] = m_FieldFlags[ii] =
(m_Cmp->m_Field[ii].m_Attributs & TEXT_NO_VISIBLE) ? 0 : 1; (m_Cmp->m_Field[ii].m_Attributs & TEXT_NO_VISIBLE) ? 0 : 1;
@ -122,7 +122,7 @@ void WinEDA_ComponentPropertiesFrame::CopyDataToPanelField()
for( int ii = FIELD1; ii < NUMBER_OF_FIELDS; ii++ ){ for( int ii = FIELD1; ii < NUMBER_OF_FIELDS; ii++ ){
m_FieldSelection->SetString( ii, m_FieldName[ii] ); m_FieldSelection->SetString( ii, m_FieldName[ii] );
} }
if( fieldId == VALUE && m_LibEntry && m_LibEntry->m_Options == ENTRY_POWER ) if( fieldId == VALUE && m_LibEntry && m_LibEntry->m_Options == ENTRY_POWER )
m_FieldTextCtrl->Enable( FALSE ); m_FieldTextCtrl->Enable( FALSE );
@ -394,7 +394,7 @@ void WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept( wxCommandEvent&
if( ii == REFERENCE ) // la reference ne peut etre vide if( ii == REFERENCE ) // la reference ne peut etre vide
{ {
if( !m_FieldText[ii].IsEmpty() ) if( !m_FieldText[ii].IsEmpty() )
m_Cmp->SetRef(m_Parent->GetSheet(), m_FieldText[ii]); m_Cmp->SetRef(m_Parent->GetSheet(), m_FieldText[ii]);
} }
else if( ii == VALUE ) // la valeur ne peut etre vide et ne peut etre change sur un POWER else if( ii == VALUE ) // la valeur ne peut etre vide et ne peut etre change sur un POWER
{ {
@ -427,10 +427,10 @@ void WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept( wxCommandEvent&
m_Cmp->m_Field[ii].m_Pos.y += cmp_pos.y; m_Cmp->m_Field[ii].m_Pos.y += cmp_pos.y;
} }
m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify();
RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, GR_DEFAULT_DRAWMODE );
m_Parent->TestDanglingEnds( m_Parent->GetScreen()->EEDrawList, &dc ); m_Parent->TestDanglingEnds( m_Parent->GetScreen()->EEDrawList, &dc );
EndModal( 0 ); EndModal( 0 );
} }
@ -458,9 +458,9 @@ void WinEDA_SchematicFrame::StartMoveCmpField( PartTextStruct* Field, wxDC* DC )
wxPoint pos, newpos; wxPoint pos, newpos;
int x1, y1; int x1, y1;
EDA_SchComponentStruct* Cmp = (EDA_SchComponentStruct*) CurrentField->m_Parent; SCH_COMPONENT* Cmp = (SCH_COMPONENT*) CurrentField->m_Parent;
SAFE_DELETE( g_ItemToUndoCopy ); SAFE_DELETE( g_ItemToUndoCopy );
g_ItemToUndoCopy = Cmp->GenCopy(); g_ItemToUndoCopy = Cmp->GenCopy();
pos = Cmp->m_Pos; pos = Cmp->m_Pos;
@ -482,7 +482,7 @@ void WinEDA_SchematicFrame::StartMoveCmpField( PartTextStruct* Field, wxDC* DC )
newpos.y = pos.y + Cmp->m_Transform[0][1] * x1 + Cmp->m_Transform[1][1] * y1; newpos.y = pos.y + Cmp->m_Transform[0][1] * x1 + Cmp->m_Transform[1][1] * y1;
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
GetScreen()->m_Curseur = newpos; GetScreen()->m_Curseur = newpos;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
OldPos = Field->m_Pos; OldPos = Field->m_Pos;
@ -519,7 +519,7 @@ void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC )
return; return;
} }
EDA_SchComponentStruct* Cmp = (EDA_SchComponentStruct*) Field->m_Parent; SCH_COMPONENT* Cmp = (SCH_COMPONENT*) Field->m_Parent;
FieldNumber = Field->m_FieldId; FieldNumber = Field->m_FieldId;
if( FieldNumber == VALUE ) if( FieldNumber == VALUE )
@ -567,9 +567,9 @@ void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC )
Field->m_Size.x = Field->m_Size.y = TextFieldSize; Field->m_Size.x = Field->m_Size.y = TextFieldSize;
} }
Field->m_Text = newtext; Field->m_Text = newtext;
if( FieldNumber == REFERENCE ){ if( FieldNumber == REFERENCE ){
Cmp->SetRef(GetSheet(), newtext); Cmp->SetRef(GetSheet(), newtext);
} }
} }
else /* Nouveau texte NULL */ else /* Nouveau texte NULL */
{ {
@ -589,7 +589,7 @@ void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC )
DrawTextField( DrawPanel, DC, Field, flag, g_XorMode ); DrawTextField( DrawPanel, DC, Field, flag, g_XorMode );
Cmp->Display_Infos( this ); Cmp->Display_Infos( this );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
@ -608,14 +608,14 @@ static void MoveCmpField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if( CurrentField == NULL ) if( CurrentField == NULL )
return; return;
EDA_SchComponentStruct* Cmp = (EDA_SchComponentStruct*) CurrentField->m_Parent; SCH_COMPONENT* Cmp = (SCH_COMPONENT*) CurrentField->m_Parent;
FieldNumber = CurrentField->m_FieldId; FieldNumber = CurrentField->m_FieldId;
/* Effacement: */ /* Effacement: */
if( erase ) if( erase )
DrawTextField( panel, DC, CurrentField, Multiflag, g_XorMode ); DrawTextField( panel, DC, CurrentField, Multiflag, g_XorMode );
pos = ( (EDA_SchComponentStruct*) CurrentField->m_Parent )->m_Pos; pos = ( (SCH_COMPONENT*) CurrentField->m_Parent )->m_Pos;
/* Les positions sont caculees par la matrice TRANSPOSEE de la matrice /* Les positions sont caculees par la matrice TRANSPOSEE de la matrice
* de rotation-miroir */ * de rotation-miroir */
@ -642,7 +642,7 @@ static void AbortMoveCmpField( WinEDA_DrawPanel* Panel, wxDC* DC )
DrawTextField( Panel, DC, CurrentField, Multiflag, GR_DEFAULT_DRAWMODE ); DrawTextField( Panel, DC, CurrentField, Multiflag, GR_DEFAULT_DRAWMODE );
} }
CurrentField = NULL; CurrentField = NULL;
SAFE_DELETE( g_ItemToUndoCopy ); SAFE_DELETE( g_ItemToUndoCopy );
} }
@ -658,13 +658,13 @@ void WinEDA_SchematicFrame::RotateCmpField( PartTextStruct* Field, wxDC* DC )
if( Field->m_Text == wxEmptyString ) if( Field->m_Text == wxEmptyString )
return; return;
EDA_SchComponentStruct* Cmp = (EDA_SchComponentStruct*) Field->m_Parent; SCH_COMPONENT* Cmp = (SCH_COMPONENT*) Field->m_Parent;
FieldNumber = Field->m_FieldId; FieldNumber = Field->m_FieldId;
flag = 0; flag = 0;
if( FieldNumber == REFERENCE ) if( FieldNumber == REFERENCE )
{ {
Entry = FindLibPart( ( (EDA_SchComponentStruct*) Field->m_Parent )->m_ChipName.GetData(), Entry = FindLibPart( ( (SCH_COMPONENT*) Field->m_Parent )->m_ChipName.GetData(),
wxEmptyString, FIND_ROOT ); wxEmptyString, FIND_ROOT );
if( Entry != NULL ) if( Entry != NULL )
{ {
@ -699,13 +699,13 @@ void PartTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
frame->DrawPanel->ManageCurseur = NULL; frame->DrawPanel->ManageCurseur = NULL;
frame->DrawPanel->ForceCloseManageCurseur = NULL; frame->DrawPanel->ForceCloseManageCurseur = NULL;
EDA_SchComponentStruct* Cmp = (EDA_SchComponentStruct*) m_Parent; SCH_COMPONENT* Cmp = (SCH_COMPONENT*) m_Parent;
/* save old cmp in undo list */ /* save old cmp in undo list */
if( g_ItemToUndoCopy && ( g_ItemToUndoCopy->Type() == Cmp->Type()) ) if( g_ItemToUndoCopy && ( g_ItemToUndoCopy->Type() == Cmp->Type()) )
{ {
Cmp->SwapData( (EDA_SchComponentStruct*) g_ItemToUndoCopy ); Cmp->SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy );
( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( Cmp, IS_CHANGED ); ( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( Cmp, IS_CHANGED );
Cmp->SwapData( (EDA_SchComponentStruct*) g_ItemToUndoCopy ); Cmp->SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy );
} }
FieldNumber = m_FieldId; FieldNumber = m_FieldId;
@ -730,7 +730,7 @@ void PartTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/**************************************************************************************************/ /**************************************************************************************************/
void WinEDA_SchematicFrame::EditComponentReference( EDA_SchComponentStruct* Cmp, wxDC* DC ) void WinEDA_SchematicFrame::EditComponentReference( SCH_COMPONENT* Cmp, wxDC* DC )
/**************************************************************************************************/ /**************************************************************************************************/
/* Edit the component text reference*/ /* Edit the component text reference*/
{ {
@ -747,7 +747,7 @@ void WinEDA_SchematicFrame::EditComponentReference( EDA_SchComponentStruct* Cmp,
if( Entry->m_UnitCount > 1 ) if( Entry->m_UnitCount > 1 )
flag = 1; flag = 1;
wxString ref = Cmp->GetRef(GetSheet()); wxString ref = Cmp->GetRef(GetSheet());
Get_Message( _( "Reference" ), ref, this ); Get_Message( _( "Reference" ), ref, this );
if( !ref.IsEmpty() ) // New text entered if( !ref.IsEmpty() ) // New text entered
@ -755,10 +755,10 @@ void WinEDA_SchematicFrame::EditComponentReference( EDA_SchComponentStruct* Cmp,
/* save old cmp in undo list if not already in edit, or moving ... */ /* save old cmp in undo list if not already in edit, or moving ... */
if( Cmp->m_Flags == 0 ) if( Cmp->m_Flags == 0 )
SaveCopyInUndoList( Cmp, IS_CHANGED ); SaveCopyInUndoList( Cmp, IS_CHANGED );
Cmp->SetRef(GetSheet(), ref); Cmp->SetRef(GetSheet(), ref);
DrawTextField( DrawPanel, DC, &Cmp->m_Field[REFERENCE], flag, g_XorMode ); DrawTextField( DrawPanel, DC, &Cmp->m_Field[REFERENCE], flag, g_XorMode );
Cmp->SetRef(GetSheet(), ref ); Cmp->SetRef(GetSheet(), ref );
DrawTextField( DrawPanel, DC, &Cmp->m_Field[REFERENCE], flag, DrawTextField( DrawPanel, DC, &Cmp->m_Field[REFERENCE], flag,
Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE ); Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
GetScreen()->SetModify(); GetScreen()->SetModify();
@ -768,7 +768,7 @@ void WinEDA_SchematicFrame::EditComponentReference( EDA_SchComponentStruct* Cmp,
/*****************************************************************************************/ /*****************************************************************************************/
void WinEDA_SchematicFrame::EditComponentValue( EDA_SchComponentStruct* Cmp, wxDC* DC ) void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC )
/*****************************************************************************************/ /*****************************************************************************************/
/* Routine de changement du texte selectionne */ /* Routine de changement du texte selectionne */
{ {
@ -789,7 +789,7 @@ void WinEDA_SchematicFrame::EditComponentValue( EDA_SchComponentStruct* Cmp, wxD
msg = TextField->m_Text; msg = TextField->m_Text;
if( Get_Message( _( "Value" ), msg, this ) ) if( Get_Message( _( "Value" ), msg, this ) )
msg.Empty(); //allow the user to remove the value. msg.Empty(); //allow the user to remove the value.
if( !msg.IsEmpty() && !msg.IsEmpty()) if( !msg.IsEmpty() && !msg.IsEmpty())
{ {
@ -801,20 +801,20 @@ void WinEDA_SchematicFrame::EditComponentValue( EDA_SchComponentStruct* Cmp, wxD
TextField->m_Text = msg; TextField->m_Text = msg;
DrawTextField( DrawPanel, DC, &Cmp->m_Field[VALUE], flag, DrawTextField( DrawPanel, DC, &Cmp->m_Field[VALUE], flag,
Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE ); Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
Cmp->Display_Infos( this ); Cmp->Display_Infos( this );
} }
/*****************************************************************************************/ /*****************************************************************************************/
void WinEDA_SchematicFrame::EditComponentFootprint( EDA_SchComponentStruct* Cmp, wxDC* DC ) void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC )
/*****************************************************************************************/ /*****************************************************************************************/
{ {
wxString msg; wxString msg;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
int flag = 0; int flag = 0;
bool wasEmpty = false; bool wasEmpty = false;
if( Cmp == NULL ) if( Cmp == NULL )
return; return;
@ -828,34 +828,34 @@ void WinEDA_SchematicFrame::EditComponentFootprint( EDA_SchComponentStruct* Cmp,
PartTextStruct* TextField = &Cmp->m_Field[FOOTPRINT]; PartTextStruct* TextField = &Cmp->m_Field[FOOTPRINT];
msg = TextField->m_Text; msg = TextField->m_Text;
if(msg.IsEmpty() ) if(msg.IsEmpty() )
wasEmpty = true; wasEmpty = true;
if( Get_Message( _( "Footprint" ), msg, this ) ) if( Get_Message( _( "Footprint" ), msg, this ) )
msg.Empty(); //allow the user to remove the value. msg.Empty(); //allow the user to remove the value.
/* save old cmp in undo list if not already in edit, or moving ... */ /* save old cmp in undo list if not already in edit, or moving ... */
if( Cmp->m_Flags == 0 ) if( Cmp->m_Flags == 0 )
SaveCopyInUndoList( Cmp, IS_CHANGED ); SaveCopyInUndoList( Cmp, IS_CHANGED );
DrawTextField( DrawPanel, DC, &Cmp->m_Field[FOOTPRINT], flag, g_XorMode ); DrawTextField( DrawPanel, DC, &Cmp->m_Field[FOOTPRINT], flag, g_XorMode );
//move the field if it was new. //move the field if it was new.
if(wasEmpty && !msg.IsEmpty()) if(wasEmpty && !msg.IsEmpty())
{ {
Cmp->m_Field[FOOTPRINT].m_Pos = Cmp->m_Field[REFERENCE].m_Pos; Cmp->m_Field[FOOTPRINT].m_Pos = Cmp->m_Field[REFERENCE].m_Pos;
//add offset here - ? suitable heuristic below? //add offset here - ? suitable heuristic below?
Cmp->m_Field[FOOTPRINT].m_Pos.x += Cmp->m_Field[FOOTPRINT].m_Pos.x +=
(Cmp->m_Field[REFERENCE].m_Pos.x - Cmp->m_Pos.x) > 0 ? (Cmp->m_Field[REFERENCE].m_Pos.x - Cmp->m_Pos.x) > 0 ?
(Cmp->m_Field[REFERENCE].m_Size.x) : (-1*Cmp->m_Field[REFERENCE].m_Size.x); (Cmp->m_Field[REFERENCE].m_Size.x) : (-1*Cmp->m_Field[REFERENCE].m_Size.x);
Cmp->m_Field[FOOTPRINT].m_Pos.y += Cmp->m_Field[FOOTPRINT].m_Pos.y +=
(Cmp->m_Field[REFERENCE].m_Pos.y - Cmp->m_Pos.y) > 0 ? (Cmp->m_Field[REFERENCE].m_Pos.y - Cmp->m_Pos.y) > 0 ?
(Cmp->m_Field[REFERENCE].m_Size.y) : (-1*Cmp->m_Field[REFERENCE].m_Size.y); (Cmp->m_Field[REFERENCE].m_Size.y) : (-1*Cmp->m_Field[REFERENCE].m_Size.y);
Cmp->m_Field[FOOTPRINT].m_Orient = Cmp->m_Field[REFERENCE].m_Orient; Cmp->m_Field[FOOTPRINT].m_Orient = Cmp->m_Field[REFERENCE].m_Orient;
} }
TextField->m_Text = msg; TextField->m_Text = msg;
DrawTextField( DrawPanel, DC, &Cmp->m_Field[FOOTPRINT], flag, DrawTextField( DrawPanel, DC, &Cmp->m_Field[FOOTPRINT], flag,
Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE ); Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
GetScreen()->SetModify(); GetScreen()->SetModify();
Cmp->Display_Infos( this ); Cmp->Display_Infos( this );
} }
@ -903,7 +903,7 @@ void WinEDA_ComponentPropertiesFrame::SetInitCmp( wxCommandEvent& event )
m_Cmp->SetRotationMiroir( CMP_NORMAL ); m_Cmp->SetRotationMiroir( CMP_NORMAL );
m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify();
RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, GR_DEFAULT_DRAWMODE );
EndModal( 1 ); EndModal( 1 );

View File

@ -69,7 +69,7 @@ void WinEDA_LabelPropertiesFrame::TextPropertiesAccept( wxCommandEvent& event )
/********************************************************************************/ /********************************************************************************/
void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC ) void WinEDA_SchematicFrame::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
/********************************************************************************/ /********************************************************************************/
{ {
if( TextStruct == NULL ) if( TextStruct == NULL )
@ -87,10 +87,10 @@ void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC
switch( TextStruct->Type() ) switch( TextStruct->Type() )
{ {
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
ItemInitialPosition = TextStruct->m_Pos; ItemInitialPosition = TextStruct->m_Pos;
OldSize = TextStruct->m_Size; OldSize = TextStruct->m_Size;
OldOrient = TextStruct->m_Orient; OldOrient = TextStruct->m_Orient;
@ -101,13 +101,13 @@ void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC
} }
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
GetScreen()->m_Curseur = ItemInitialPosition; GetScreen()->m_Curseur = ItemInitialPosition;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
GetScreen()->SetModify(); GetScreen()->SetModify();
DrawPanel->ManageCurseur = ShowWhileMoving; DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitMoveTexte; DrawPanel->ForceCloseManageCurseur = ExitMoveTexte;
GetScreen()->SetCurItem( TextStruct ); GetScreen()->SetCurItem( TextStruct );
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE ); DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
DrawPanel->CursorOn( DC ); DrawPanel->CursorOn( DC );
@ -115,7 +115,7 @@ void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC
/*************************************************************************/ /*************************************************************************/
void WinEDA_SchematicFrame::EditSchematicText( DrawTextStruct* TextStruct, void WinEDA_SchematicFrame::EditSchematicText( SCH_TEXT* TextStruct,
wxDC* DC ) wxDC* DC )
/*************************************************************************/ /*************************************************************************/
@ -140,11 +140,11 @@ void WinEDA_SchematicFrame::EditSchematicText( DrawTextStruct* TextStruct,
/***********************************************************************************/ /***********************************************************************************/
void WinEDA_SchematicFrame::ChangeTextOrient( DrawTextStruct* TextStruct, wxDC* DC ) void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
/***********************************************************************************/ /***********************************************************************************/
{ {
if( TextStruct == NULL ) if( TextStruct == NULL )
TextStruct = (DrawTextStruct*) PickStruct( GetScreen()->m_Curseur, TextStruct = (SCH_TEXT*) PickStruct( GetScreen()->m_Curseur,
GetScreen(), TEXTITEM | LABELITEM ); GetScreen(), TEXTITEM | LABELITEM );
if( TextStruct == NULL ) if( TextStruct == NULL )
return; return;
@ -160,10 +160,10 @@ void WinEDA_SchematicFrame::ChangeTextOrient( DrawTextStruct* TextStruct, wxDC*
/* Rotation du texte */ /* Rotation du texte */
switch( TextStruct->Type() ) switch( TextStruct->Type() )
{ {
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
TextStruct->m_Orient++; TextStruct->m_Orient++;
TextStruct->m_Orient &= 3; TextStruct->m_Orient &= 3;
break; break;
@ -187,28 +187,28 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
/* Routine to create new text struct (GraphicText, label or Glabel). /* Routine to create new text struct (GraphicText, label or Glabel).
*/ */
{ {
DrawTextStruct* NewText = NULL; SCH_TEXT* NewText = NULL;
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
switch( type ) switch( type )
{ {
case LAYER_NOTES: case LAYER_NOTES:
NewText = new DrawTextStruct( GetScreen()->m_Curseur ); NewText = new SCH_TEXT( GetScreen()->m_Curseur );
break; break;
case LAYER_LOCLABEL: case LAYER_LOCLABEL:
NewText = new DrawLabelStruct( GetScreen()->m_Curseur ); NewText = new SCH_LABEL( GetScreen()->m_Curseur );
break; break;
case LAYER_HIERLABEL: case LAYER_HIERLABEL:
NewText = new DrawHierLabelStruct(GetScreen()->m_Curseur ); NewText = new SCH_HIERLABEL(GetScreen()->m_Curseur );
NewText->m_Shape = s_DefaultShapeGLabel; NewText->m_Shape = s_DefaultShapeGLabel;
NewText->m_Orient = s_DefaultOrientGLabel; NewText->m_Orient = s_DefaultOrientGLabel;
break; break;
case LAYER_GLOBLABEL: case LAYER_GLOBLABEL:
NewText = new DrawGlobalLabelStruct(GetScreen()->m_Curseur ); NewText = new SCH_GLOBALLABEL(GetScreen()->m_Curseur );
NewText->m_Shape = s_DefaultShapeGLabel; NewText->m_Shape = s_DefaultShapeGLabel;
NewText->m_Orient = s_DefaultOrientGLabel; NewText->m_Orient = s_DefaultOrientGLabel;
break; break;
@ -226,11 +226,11 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
if( NewText->m_Text.IsEmpty() ) if( NewText->m_Text.IsEmpty() )
{ {
SAFE_DELETE( NewText ); SAFE_DELETE( NewText );
return NULL; return NULL;
} }
if( type == LAYER_GLOBLABEL || type == LAYER_HIERLABEL) if( type == LAYER_GLOBLABEL || type == LAYER_HIERLABEL)
{ {
s_DefaultShapeGLabel = NewText->m_Shape; s_DefaultShapeGLabel = NewText->m_Shape;
s_DefaultOrientGLabel = NewText->m_Orient; s_DefaultOrientGLabel = NewText->m_Orient;
@ -240,7 +240,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
DrawPanel->ManageCurseur = ShowWhileMoving; DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitMoveTexte; DrawPanel->ForceCloseManageCurseur = ExitMoveTexte;
GetScreen()->SetCurItem( NewText ); GetScreen()->SetCurItem( NewText );
return NewText; return NewText;
} }
@ -260,11 +260,11 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/* redraw the text */ /* redraw the text */
switch( TextStruct->Type() ) switch( TextStruct->Type() )
{ {
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
( (DrawTextStruct*) TextStruct )->m_Pos = panel->GetScreen()->m_Curseur; ( (SCH_TEXT*) TextStruct )->m_Pos = panel->GetScreen()->m_Curseur;
break; break;
default: default:
@ -297,19 +297,19 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
if( Struct->m_Flags & IS_NEW ) if( Struct->m_Flags & IS_NEW )
{ {
SAFE_DELETE( Struct ); SAFE_DELETE( Struct );
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
} }
else /* this was a move command on an "old" text: restore its old settings. */ else /* this was a move command on an "old" text: restore its old settings. */
{ {
switch( Struct->Type() ) switch( Struct->Type() )
{ {
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
{ {
DrawTextStruct* Text = (DrawTextStruct*) Struct; SCH_TEXT* Text = (SCH_TEXT*) Struct;
Text->m_Pos = ItemInitialPosition; Text->m_Pos = ItemInitialPosition;
Text->m_Size = OldSize; Text->m_Size = OldSize;
Text->m_Orient = OldOrient; Text->m_Orient = OldOrient;
@ -327,7 +327,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
/*****************************************************************************/ /*****************************************************************************/
void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text, void WinEDA_SchematicFrame::ConvertTextType( SCH_TEXT* Text,
wxDC* DC, int newtype ) wxDC* DC, int newtype )
/*****************************************************************************/ /*****************************************************************************/
@ -339,22 +339,22 @@ void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text,
if( Text == NULL ) if( Text == NULL )
return; return;
DrawTextStruct* newtext; SCH_TEXT* newtext;
switch( newtype ) switch( newtype )
{ {
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
newtext = new DrawLabelStruct( Text->m_Pos, Text->m_Text ); newtext = new SCH_LABEL( Text->m_Pos, Text->m_Text );
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
newtext = new DrawGlobalLabelStruct(Text->m_Pos, Text->m_Text ); newtext = new SCH_GLOBALLABEL(Text->m_Pos, Text->m_Text );
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
newtext = new DrawHierLabelStruct(Text->m_Pos, Text->m_Text ); newtext = new SCH_HIERLABEL(Text->m_Pos, Text->m_Text );
break; break;
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
newtext = new DrawTextStruct( Text->m_Pos, Text->m_Text ); newtext = new SCH_TEXT( Text->m_Pos, Text->m_Text );
break; break;
default: default:
@ -395,13 +395,13 @@ void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text,
{ {
Text->m_Flags = 0; Text->m_Flags = 0;
DeleteStruct( DrawPanel, DC, Text ); // old text is really saved in undo list DeleteStruct( DrawPanel, DC, Text ); // old text is really saved in undo list
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
} }
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
SAFE_DELETE( g_ItemToUndoCopy ); SAFE_DELETE( g_ItemToUndoCopy );
DrawPanel->CursorOff( DC ); // Erase schematic cursor DrawPanel->CursorOff( DC ); // Erase schematic cursor
@ -415,15 +415,15 @@ void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text,
SaveCopyInUndoList( newtext, IS_NEW ); SaveCopyInUndoList( newtext, IS_NEW );
} }
else else
{ {
GetScreen()->SetCurItem( newtext ); GetScreen()->SetCurItem( newtext );
newtext->m_Flags = IS_NEW; newtext->m_Flags = IS_NEW;
} }
if( (flags & IS_MOVED) != 0 ) if( (flags & IS_MOVED) != 0 )
{ {
GetScreen()->SetCurItem( newtext ); GetScreen()->SetCurItem( newtext );
StartMoveTexte( newtext, DC ); StartMoveTexte( newtext, DC );
} }

View File

@ -376,9 +376,9 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
STRUCT->m_Pos.y += g_RepeatStep.y; oy = STRUCT->m_Pos.y; STRUCT->m_Pos.y += g_RepeatStep.y; oy = STRUCT->m_Pos.y;
break; break;
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawTextStruct*) g_ItemToRepeat ) #define STRUCT ( (SCH_TEXT*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy(); g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos.x += g_RepeatStep.x; ox = STRUCT->m_Pos.x; STRUCT->m_Pos.x += g_RepeatStep.x; ox = STRUCT->m_Pos.x;
STRUCT->m_Pos.y += g_RepeatStep.y; oy = STRUCT->m_Pos.y; STRUCT->m_Pos.y += g_RepeatStep.y; oy = STRUCT->m_Pos.y;
@ -389,11 +389,11 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
break; break;
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawLabelStruct*) g_ItemToRepeat ) #define STRUCT ( (SCH_LABEL*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy(); g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos.x += g_RepeatStep.x; ox = STRUCT->m_Pos.x; STRUCT->m_Pos.x += g_RepeatStep.x; ox = STRUCT->m_Pos.x;
STRUCT->m_Pos.y += g_RepeatStep.y; oy = STRUCT->m_Pos.y; STRUCT->m_Pos.y += g_RepeatStep.y; oy = STRUCT->m_Pos.y;
@ -528,9 +528,9 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
return TRUE; return TRUE;
item = PickStruct( screen, LABELITEM ); item = PickStruct( screen, LABELITEM );
if( item && (item->Type() != DRAW_TEXT_STRUCT_TYPE) if( item && (item->Type() != TYPE_SCH_TEXT)
&& ( ( (DrawGlobalLabelStruct*) item )->m_Pos.x == pos.x ) && ( ( (SCH_GLOBALLABEL*) item )->m_Pos.x == pos.x )
&& ( ( (DrawGlobalLabelStruct*) item )->m_Pos.y == pos.y ) ) && ( ( (SCH_GLOBALLABEL*) item )->m_Pos.y == pos.y ) )
return TRUE; return TRUE;
pinsheet = LocateAnyPinSheet( pos, screen->EEDrawList ); pinsheet = LocateAnyPinSheet( pos, screen->EEDrawList );

View File

@ -40,7 +40,7 @@ static int s_ItemSelectColor = BROWN;
static EDA_LibComponentStruct* DummyCmp; static EDA_LibComponentStruct* DummyCmp;
static int* Buf_Poly_Drawings, Buf_Poly_Size; // Used fo polyline drawings static int* Buf_Poly_Drawings, Buf_Poly_Size; // Used fo polyline drawings
static void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC, static void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
EDA_SchComponentStruct* Component, SCH_COMPONENT* Component,
EDA_LibComponentStruct* Entry, EDA_LibComponentStruct* Entry,
const wxPoint& Pos, const wxPoint& Pos,
int TransMat[2][2], int TransMat[2][2],
@ -204,7 +204,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
* Routine to draw the given part at given position, transformed/mirror as * * Routine to draw the given part at given position, transformed/mirror as *
* specified, and in the given drawing mode. Only this one is visible... * * specified, and in the given drawing mode. Only this one is visible... *
*****************************************************************************/ *****************************************************************************/
void EDA_SchComponentStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int DrawMode, int Color ) const wxPoint& offset, int DrawMode, int Color )
{ {
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
@ -262,7 +262,7 @@ void DrawTextField( WinEDA_DrawPanel* panel, wxDC* DC,
{ {
int orient, color; int orient, color;
wxPoint pos; /* Position des textes */ wxPoint pos; /* Position des textes */
EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*) Field->m_Parent; SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) Field->m_Parent;
int hjustify, vjustify; int hjustify, vjustify;
int LineWidth = MAX( Field->m_Width, g_DrawMinimunLineWidth ); int LineWidth = MAX( Field->m_Width, g_DrawMinimunLineWidth );
@ -404,7 +404,7 @@ EDA_LibComponentStruct* FindLibPart( const wxChar* Name, const wxString& LibName
*****************************************************************************/ *****************************************************************************/
/* DrawMode = GrXOR, GrOR ..*/ /* DrawMode = GrXOR, GrOR ..*/
void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC, void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
EDA_SchComponentStruct* Component, SCH_COMPONENT* Component,
EDA_LibComponentStruct* Entry, EDA_LibComponentStruct* Entry,
const wxPoint& Pos, const wxPoint& Pos,
int TransMat[2][2], int TransMat[2][2],
@ -896,7 +896,7 @@ bool MapAngles( int* Angle1, int* Angle2, int TransMat[2][2] )
*****************************************************************************/ *****************************************************************************/
void DrawingLibInGhost( WinEDA_DrawPanel* panel, wxDC* DC, void DrawingLibInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
EDA_LibComponentStruct* LibEntry, EDA_LibComponentStruct* LibEntry,
EDA_SchComponentStruct* DrawLibItem, int PartX, int PartY, SCH_COMPONENT* DrawLibItem, int PartX, int PartY,
int multi, int convert, int Color, bool DrawPinText ) int multi, int convert, int Color, bool DrawPinText )
{ {
int DrawMode = g_XorMode; int DrawMode = g_XorMode;

View File

@ -459,22 +459,22 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
break; break;
} }
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
{ {
DrawTextStruct* Struct; SCH_TEXT* Struct;
Struct = (DrawTextStruct*) DrawStruct; Struct = (SCH_TEXT*) DrawStruct;
Struct->m_Pos.x += dx; Struct->m_Pos.y += dy; Struct->m_Pos.x += dx; Struct->m_Pos.y += dy;
Struct->Draw( panel, DC, wxPoint( 0, 0 ), DrawMode, g_GhostColor ); Struct->Draw( panel, DC, wxPoint( 0, 0 ), DrawMode, g_GhostColor );
Struct->m_Pos.x -= dx; Struct->m_Pos.y -= dy; Struct->m_Pos.x -= dx; Struct->m_Pos.y -= dy;
break; break;
} }
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
{ {
DrawLabelStruct* Struct; SCH_LABEL* Struct;
Struct = (DrawLabelStruct*) DrawStruct; Struct = (SCH_LABEL*) DrawStruct;
Struct->m_Pos.x += dx; Struct->m_Pos.y += dy; Struct->m_Pos.x += dx; Struct->m_Pos.y += dy;
Struct->Draw( panel, DC, wxPoint( 0, 0 ), DrawMode, g_GhostColor ); Struct->Draw( panel, DC, wxPoint( 0, 0 ), DrawMode, g_GhostColor );
Struct->m_Pos.x -= dx; Struct->m_Pos.y -= dy; Struct->m_Pos.x -= dx; Struct->m_Pos.y -= dy;
@ -491,11 +491,11 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
break; break;
} }
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
{ {
EDA_LibComponentStruct* LibEntry; EDA_LibComponentStruct* LibEntry;
EDA_SchComponentStruct* Struct; SCH_COMPONENT* Struct;
Struct = (EDA_SchComponentStruct*) DrawStruct; Struct = (SCH_COMPONENT*) DrawStruct;
LibEntry = FindLibPart( Struct->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); LibEntry = FindLibPart( Struct->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( LibEntry == NULL ) if( LibEntry == NULL )
break; break;

View File

@ -53,10 +53,10 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
/******************************************************************************************/ /******************************************************************************************/
//{ //{
// return FALSE; // return FALSE;
//when is this used? and why? //when is this used? and why?
/* /*
//this must be called with a non-null pointer screen pointer, clearly. //this must be called with a non-null pointer screen pointer, clearly.
//also note that this is for reading in a *root* file //also note that this is for reading in a *root* file
wxString FullFileName = filename; wxString FullFileName = filename;
if( FullFileName.IsEmpty() ) if( FullFileName.IsEmpty() )
@ -77,180 +77,180 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
} }
ClearProjectDrawList( screen, TRUE ); ClearProjectDrawList( screen, TRUE );
printf("in LoadOneScreen setting screen filename: %s \n", (const char*) FullFileName.mb_str() ); printf("in LoadOneScreen setting screen filename: %s \n", (const char*) FullFileName.mb_str() );
screen->m_FileName = FullFileName; screen->m_FileName = FullFileName;
LoadDrawSheet( DrawSheetStruct * sheet, filename); LoadDrawSheet( DrawSheetStruct * sheet, filename);
screen->SetModify(); screen->SetModify();
if( GetScreen() == screen ) if( GetScreen() == screen )
Refresh( TRUE ); Refresh( TRUE );
return TRUE; return TRUE;
*/ */
//} //}
/************************************************************************************/ /************************************************************************************/
int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNew ) int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNew )
/************************************************************************************/ /************************************************************************************/
{ {
/* /*
* Load an entire project * Load an entire project
* ( schematic root file and its subhierarchies, the configuration and the libs * ( schematic root file and its subhierarchies, the configuration and the libs
* which are not already loaded) * which are not already loaded)
*/ */
SCH_SCREEN* screen; SCH_SCREEN* screen;
wxString FullFileName, msg; wxString FullFileName, msg;
bool LibCacheExist = FALSE; bool LibCacheExist = FALSE;
EDA_ScreenList ScreenList; EDA_ScreenList ScreenList;
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{ {
if( screen->IsModify() ) if( screen->IsModify() )
break; break;
} }
if( screen ) if( screen )
{ {
if( !IsOK( this, _( "Clear Schematic Hierarchy (modified!)?" ) ) ) if( !IsOK( this, _( "Clear Schematic Hierarchy (modified!)?" ) ) )
return FALSE; return FALSE;
if( g_RootSheet->m_AssociatedScreen->m_FileName != g_DefaultSchematicFileName ) if( g_RootSheet->m_AssociatedScreen->m_FileName != g_DefaultSchematicFileName )
SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName ); SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName );
} }
FullFileName = FileName; FullFileName = FileName;
if( ( FullFileName.IsEmpty() ) && !IsNew ) if( ( FullFileName.IsEmpty() ) && !IsNew )
{ {
wxString mask = wxT( "*" ) + g_SchExtBuffer; wxString mask = wxT( "*" ) + g_SchExtBuffer;
FullFileName = EDA_FileSelector( _( "Schematic files:" ), FullFileName = EDA_FileSelector( _( "Schematic files:" ),
wxEmptyString, /* Chemin par defaut */ wxEmptyString, /* Chemin par defaut */
wxEmptyString, /* nom fichier par defaut */ wxEmptyString, /* nom fichier par defaut */
g_SchExtBuffer, /* extension par defaut */ g_SchExtBuffer, /* extension par defaut */
mask, /* Masque d'affichage */ mask, /* Masque d'affichage */
this, this,
wxFD_OPEN, wxFD_OPEN,
TRUE TRUE
); );
if( FullFileName.IsEmpty() ) if( FullFileName.IsEmpty() )
return FALSE; return FALSE;
} }
if(g_RootSheet){ if(g_RootSheet){
SAFE_DELETE(g_RootSheet); SAFE_DELETE(g_RootSheet);
} }
CreateScreens(); CreateScreens();
screen = (SCH_SCREEN*)GetScreen(); screen = (SCH_SCREEN*)GetScreen();
wxSetWorkingDirectory( wxPathOnly( FullFileName ) ); wxSetWorkingDirectory( wxPathOnly( FullFileName ) );
GetScreen()->m_FileName = FullFileName; GetScreen()->m_FileName = FullFileName;
g_RootSheet->SetFileName(FullFileName); g_RootSheet->SetFileName(FullFileName);
Affiche_Message( wxEmptyString ); Affiche_Message( wxEmptyString );
MsgPanel->EraseMsgBox(); MsgPanel->EraseMsgBox();
memset( &g_EESchemaVar, 0, sizeof(g_EESchemaVar) ); memset( &g_EESchemaVar, 0, sizeof(g_EESchemaVar) );
GetScreen()->ClrModify(); GetScreen()->ClrModify();
//m_CurrentSheet->m_AssociatedScreen->Pnext = NULL; should be by default //m_CurrentSheet->m_AssociatedScreen->Pnext = NULL; should be by default
if( IsNew ) if( IsNew )
{ {
screen->m_CurrentSheetDesc = &g_Sheet_A4; screen->m_CurrentSheetDesc = &g_Sheet_A4;
screen->SetZoom( 32 ); screen->SetZoom( 32 );
screen->m_ScreenNumber = screen->m_NumberOfScreen = 1; screen->m_ScreenNumber = screen->m_NumberOfScreen = 1;
screen->m_Title = wxT( "noname.sch" ); screen->m_Title = wxT( "noname.sch" );
GetScreen()->m_FileName = screen->m_Title; GetScreen()->m_FileName = screen->m_Title;
screen->m_Company.Empty(); screen->m_Company.Empty();
screen->m_Commentaire1.Empty(); screen->m_Commentaire1.Empty();
screen->m_Commentaire2.Empty(); screen->m_Commentaire2.Empty();
screen->m_Commentaire3.Empty(); screen->m_Commentaire3.Empty();
screen->m_Commentaire4.Empty(); screen->m_Commentaire4.Empty();
Read_Config( wxEmptyString, TRUE ); Read_Config( wxEmptyString, TRUE );
Zoom_Automatique( TRUE ); Zoom_Automatique( TRUE );
ReDrawPanel(); ReDrawPanel();
return 1; return 1;
} }
// Rechargement de la configuration: // Rechargement de la configuration:
msg = _( "Ready\nWorking dir: \n" ) + wxGetCwd(); msg = _( "Ready\nWorking dir: \n" ) + wxGetCwd();
PrintMsg( msg ); PrintMsg( msg );
Read_Config( wxEmptyString, FALSE ); Read_Config( wxEmptyString, FALSE );
// Delete old caches. // Delete old caches.
LibraryStruct* nextlib, * lib = g_LibraryList; LibraryStruct* nextlib, * lib = g_LibraryList;
for( ; lib != NULL; lib = nextlib ) for( ; lib != NULL; lib = nextlib )
{ {
nextlib = lib->m_Pnext; nextlib = lib->m_Pnext;
if( lib->m_IsLibCache ) if( lib->m_IsLibCache )
FreeCmpLibrary( this, lib->m_Name ); FreeCmpLibrary( this, lib->m_Name );
} }
if( IsNew ) if( IsNew )
{ {
ReDrawPanel(); ReDrawPanel();
return 1; return 1;
} }
// Loading the project library cache // Loading the project library cache
wxString FullLibName; wxString FullLibName;
wxString shortfilename; wxString shortfilename;
wxSplitPath( g_RootSheet->m_AssociatedScreen->m_FileName, NULL, &shortfilename, NULL ); wxSplitPath( g_RootSheet->m_AssociatedScreen->m_FileName, NULL, &shortfilename, NULL );
FullLibName << wxT( "." ) << STRING_DIR_SEP << shortfilename << wxT( ".cache" ) << FullLibName << wxT( "." ) << STRING_DIR_SEP << shortfilename << wxT( ".cache" ) <<
g_LibExtBuffer; g_LibExtBuffer;
if( wxFileExists( FullLibName ) ) if( wxFileExists( FullLibName ) )
{ {
wxString libname; wxString libname;
libname = FullLibName; libname = FullLibName;
ChangeFileNameExt( libname, wxEmptyString ); ChangeFileNameExt( libname, wxEmptyString );
msg = wxT( "Load " ) + FullLibName; msg = wxT( "Load " ) + FullLibName;
LibraryStruct* LibCache = LoadLibraryName( this, FullLibName, libname ); LibraryStruct* LibCache = LoadLibraryName( this, FullLibName, libname );
if( LibCache ) if( LibCache )
{ {
LibCache->m_IsLibCache = TRUE; LibCache->m_IsLibCache = TRUE;
msg += wxT( " OK" ); msg += wxT( " OK" );
} }
else else
msg += wxT( " ->Error" ); msg += wxT( " ->Error" );
PrintMsg( msg ); PrintMsg( msg );
LibCacheExist = TRUE; LibCacheExist = TRUE;
} }
if( !wxFileExists( g_RootSheet->m_AssociatedScreen->m_FileName ) && !LibCacheExist ) // Nouveau projet prpbablement if( !wxFileExists( g_RootSheet->m_AssociatedScreen->m_FileName ) && !LibCacheExist ) // Nouveau projet prpbablement
{ {
msg.Printf( _( "File %s not found (new project ?)" ), msg.Printf( _( "File %s not found (new project ?)" ),
g_RootSheet->m_AssociatedScreen->m_FileName.GetData() ); g_RootSheet->m_AssociatedScreen->m_FileName.GetData() );
DisplayInfo( this, msg, 20 ); DisplayInfo( this, msg, 20 );
return -1; return -1;
} }
//load the project. //load the project.
SAFE_DELETE(g_RootSheet->m_AssociatedScreen); SAFE_DELETE(g_RootSheet->m_AssociatedScreen);
bool diag = g_RootSheet->Load(this); bool diag = g_RootSheet->Load(this);
/* Reaffichage ecran de base (ROOT) si necessaire */ /* Reaffichage ecran de base (ROOT) si necessaire */
ActiveScreen = GetScreen(); ActiveScreen = GetScreen();
Zoom_Automatique( FALSE ); Zoom_Automatique( FALSE );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
return diag; return diag;
} }
/**********************************************************/ /**********************************************************/
SCH_SCREEN * WinEDA_SchematicFrame::CreateNewScreen( SCH_SCREEN * WinEDA_SchematicFrame::CreateNewScreen(
SCH_SCREEN * OldScreen, int TimeStamp) SCH_SCREEN * OldScreen, int TimeStamp)
/**********************************************************/ /**********************************************************/
/* Routine de creation ( par allocation memoire ) d'un nouvel ecran /* Routine de creation ( par allocation memoire ) d'un nouvel ecran
cet ecran est en chainage arriere avec OldScreen cet ecran est en chainage arriere avec OldScreen
la valeur TimeStamp est attribuee au parametre NewScreen->TimeStamp la valeur TimeStamp est attribuee au parametre NewScreen->TimeStamp
*/ */
{ {
SCH_SCREEN * NewScreen; SCH_SCREEN * NewScreen;
NewScreen = new SCH_SCREEN(SCHEMATIC_FRAME); NewScreen = new SCH_SCREEN(SCHEMATIC_FRAME);
NewScreen->SetRefreshReq(); NewScreen->SetRefreshReq();
if(OldScreen) NewScreen->m_Company = OldScreen->m_Company; if(OldScreen) NewScreen->m_Company = OldScreen->m_Company;
NewScreen->m_TimeStamp = TimeStamp; NewScreen->m_TimeStamp = TimeStamp;
NewScreen->Pback = OldScreen; NewScreen->Pback = OldScreen;
return(NewScreen); return(NewScreen);
} }
/****************************************************/ /****************************************************/
@ -267,9 +267,9 @@ void WinEDA_SchematicFrame::SaveProject( )
EDA_ScreenList ScreenList; EDA_ScreenList ScreenList;
for( screen = ScreenList.GetFirst(); screen != NULL; for( screen = ScreenList.GetFirst(); screen != NULL;
screen = ScreenList.GetNext() ) screen = ScreenList.GetNext() )
{ {
printf("SaveEEFile, %s\n", CONV_TO_UTF8(screen->m_FileName) ); printf("SaveEEFile, %s\n", CONV_TO_UTF8(screen->m_FileName) );
SaveEEFile( screen, FILE_SAVE_AS ); SaveEEFile( screen, FILE_SAVE_AS );
} }
@ -290,8 +290,8 @@ int CountCmpNumber()
/* Routine retournant le nombre de composants dans le schema, /* Routine retournant le nombre de composants dans le schema,
* powers non comprises */ * powers non comprises */
{ {
return g_RootSheet->ComponentCount(); return g_RootSheet->ComponentCount();
/* /*
BASE_SCREEN* Window; BASE_SCREEN* Window;
EDA_BaseStruct* Phead; EDA_BaseStruct* Phead;
int Nb = 0; int Nb = 0;
@ -303,7 +303,7 @@ int CountCmpNumber()
{ {
for( Phead = Window->EEDrawList; Phead != NULL; Phead = Phead->Pnext ) for( Phead = Window->EEDrawList; Phead != NULL; Phead = Phead->Pnext )
{ {
if( Phead->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) if( Phead->Type() == TYPE_SCH_COMPONENT )
{ {
DrawPartStruct* Cmp = (DrawPartStruct*) Phead; DrawPartStruct* Cmp = (DrawPartStruct*) Phead;
if( Cmp->m_Field[VALUE].m_Text.GetChar( 0 ) != '#' ) if( Cmp->m_Field[VALUE].m_Text.GetChar( 0 ) != '#' )
@ -315,5 +315,5 @@ int CountCmpNumber()
} }
return Nb; return Nb;
*/ */
} }

View File

@ -72,7 +72,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
{ {
DrawSheetPath* sheet, * SheetWithComponentFound = NULL; DrawSheetPath* sheet, * SheetWithComponentFound = NULL;
EDA_BaseStruct* DrawList = NULL; EDA_BaseStruct* DrawList = NULL;
EDA_SchComponentStruct* Component = NULL; SCH_COMPONENT* Component = NULL;
wxSize DrawAreaSize = DrawPanel->GetClientSize(); wxSize DrawAreaSize = DrawPanel->GetClientSize();
wxPoint pos, curpos; wxPoint pos, curpos;
bool DoCenterAndRedraw = FALSE; bool DoCenterAndRedraw = FALSE;
@ -91,10 +91,10 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
DrawList = sheet->LastDrawList(); DrawList = sheet->LastDrawList();
for( ; (DrawList != NULL) && (NotFound == true); DrawList = DrawList->Pnext ) for( ; (DrawList != NULL) && (NotFound == true); DrawList = DrawList->Pnext )
{ {
if( DrawList->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawList->Type() == TYPE_SCH_COMPONENT )
{ {
EDA_SchComponentStruct* pSch; SCH_COMPONENT* pSch;
pSch = (EDA_SchComponentStruct*) DrawList; pSch = (SCH_COMPONENT*) DrawList;
if( component_reference.CmpNoCase( pSch->GetRef(sheet) ) == 0 ) if( component_reference.CmpNoCase( pSch->GetRef(sheet) ) == 0 )
{ {
Component = pSch; Component = pSch;
@ -465,9 +465,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
{ {
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
EDA_SchComponentStruct * pSch; SCH_COMPONENT * pSch;
pSch = (EDA_SchComponentStruct*) DrawList; pSch = (SCH_COMPONENT*) DrawList;
if( WildCompareString( WildText, pSch->GetRef(Sheet), FALSE ) ) if( WildCompareString( WildText, pSch->GetRef(Sheet), FALSE ) )
{ {
NotFound = FALSE; NotFound = FALSE;
@ -481,12 +481,12 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
} }
break; break;
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
DrawTextStruct * pDraw; SCH_TEXT * pDraw;
pDraw = (DrawTextStruct*) DrawList; pDraw = (SCH_TEXT*) DrawList;
if( WildCompareString( WildText, pDraw->m_Text, FALSE ) ) if( WildCompareString( WildText, pDraw->m_Text, FALSE ) )
{ {
NotFound = FALSE; NotFound = FALSE;
@ -551,12 +551,12 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
DoCenterAndRedraw = TRUE; DoCenterAndRedraw = TRUE;
} }
/* the struct is a DRAW_LIB_ITEM_STRUCT_TYPE type, /* the struct is a TYPE_SCH_COMPONENT type,
* coordinates must be computed according to its orientation matrix * coordinates must be computed according to its orientation matrix
*/ */
if( Struct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) if( Struct->Type() == TYPE_SCH_COMPONENT )
{ {
EDA_SchComponentStruct* pSch = (EDA_SchComponentStruct*) Struct; SCH_COMPONENT* pSch = (SCH_COMPONENT*) Struct;
pos.x -= pSch->m_Pos.x; pos.x -= pSch->m_Pos.x;
pos.y -= pSch->m_Pos.y; pos.y -= pSch->m_Pos.y;

View File

@ -59,7 +59,7 @@ wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent )
/**************************************************************************/ /**************************************************************************/
EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC, SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
const wxString& libname, const wxString& libname,
wxArrayString& HistoryList, wxArrayString& HistoryList,
bool UseLibBrowser ) bool UseLibBrowser )
@ -73,7 +73,7 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
int ii, CmpCount = 0; int ii, CmpCount = 0;
LibDrawField* Field; LibDrawField* Field;
EDA_LibComponentStruct* Entry = NULL; EDA_LibComponentStruct* Entry = NULL;
EDA_SchComponentStruct* DrawLibItem = NULL; SCH_COMPONENT* DrawLibItem = NULL;
LibraryStruct* Library = NULL; LibraryStruct* Library = NULL;
wxString Name, keys, msg; wxString Name, keys, msg;
bool AllowWildSeach = TRUE; bool AllowWildSeach = TRUE;
@ -180,7 +180,7 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
DrawPanel->ManageCurseur = ShowWhileMoving; DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp; DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp;
DrawLibItem = new EDA_SchComponentStruct( GetScreen()->m_Curseur ); DrawLibItem = new SCH_COMPONENT( GetScreen()->m_Curseur );
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;
@ -257,7 +257,7 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
wxPoint move_vector; wxPoint move_vector;
EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*) SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*)
panel->m_Parent->GetScreen()->GetCurItem(); panel->m_Parent->GetScreen()->GetCurItem();
/* Effacement du composant */ /* Effacement du composant */
@ -276,7 +276,7 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/**************************************************************************/ /**************************************************************************/
void WinEDA_SchematicFrame::CmpRotationMiroir( void WinEDA_SchematicFrame::CmpRotationMiroir(
EDA_SchComponentStruct* DrawComponent, wxDC* DC, int type_rotate ) SCH_COMPONENT* DrawComponent, wxDC* DC, int type_rotate )
/**************************************************************************/ /**************************************************************************/
/* Routine permettant les rotations et les miroirs d'un composant /* Routine permettant les rotations et les miroirs d'un composant
@ -293,7 +293,9 @@ void WinEDA_SchematicFrame::CmpRotationMiroir(
if( DrawComponent->m_Flags ) if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, 0, 0 ); DrawStructsInGhost( DrawPanel, DC, DrawComponent, 0, 0 );
else else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode ); {
DrawPanel->PostDirtyRect( DrawComponent->GetBoundingBox());
}
} }
DrawComponent->SetRotationMiroir( type_rotate ); DrawComponent->SetRotationMiroir( type_rotate );
@ -320,7 +322,7 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
/* Routine de sortie de la fonction de placement de composant /* Routine de sortie de la fonction de placement de composant
*/ */
{ {
EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*) SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*)
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 */
@ -352,7 +354,7 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
/************************************************************************/ /************************************************************************/
void WinEDA_SchematicFrame::SelPartUnit( EDA_SchComponentStruct* DrawComponent, void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent,
int unit, wxDC* DC ) int unit, wxDC* DC )
/************************************************************************/ /************************************************************************/
/* Selection de l'unite dans les boitiers a multiples Parts */ /* Selection de l'unite dans les boitiers a multiples Parts */
@ -400,7 +402,7 @@ void WinEDA_SchematicFrame::SelPartUnit( EDA_SchComponentStruct* DrawComponent,
/************************************************************************/ /************************************************************************/
void WinEDA_SchematicFrame::ConvertPart( EDA_SchComponentStruct* DrawComponent, void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent,
wxDC* DC ) wxDC* DC )
/************************************************************************/ /************************************************************************/
{ {
@ -469,13 +471,13 @@ int LookForConvertPart( EDA_LibComponentStruct* LibEntry )
/***********************************************************************************/ /***********************************************************************************/
void WinEDA_SchematicFrame::StartMovePart( EDA_SchComponentStruct* Component, void WinEDA_SchematicFrame::StartMovePart( SCH_COMPONENT* Component,
wxDC* DC ) wxDC* DC )
/***********************************************************************************/ /***********************************************************************************/
{ {
if( Component == NULL ) if( Component == NULL )
return; return;
if( Component->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( Component->Type() != TYPE_SCH_COMPONENT )
return; return;
if( Component->m_Flags == 0 ) if( Component->m_Flags == 0 )

View File

@ -98,7 +98,7 @@ Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = {
&HkDelete, &HkInsert, &HkMove2Drag, &HkDelete, &HkInsert, &HkMove2Drag,
&HkMoveComponent, &HkDragComponent, &HkAddComponent, &HkMoveComponent, &HkDragComponent, &HkAddComponent,
&HkRotateComponent, &HkMirrorXComponent, &HkMirrorYComponent, &HkOrientNormalComponent, &HkRotateComponent, &HkMirrorXComponent, &HkMirrorYComponent, &HkOrientNormalComponent,
&HkEditComponentValue, &HkEditComponentFootprint, &HkEditComponentValue, &HkEditComponentFootprint,
&HkBeginWire, &HkBeginWire,
NULL NULL
}; };
@ -107,9 +107,9 @@ Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = {
Ki_HotkeyInfo* s_LibEdit_Hotkey_List[] = Ki_HotkeyInfo* s_LibEdit_Hotkey_List[] =
{ {
&HkInsertPin, &HkInsertPin,
&HkEditPin, &HkEditPin,
&HkMovePin, &HkMovePin,
&HkDeletePin, &HkDeletePin,
NULL NULL
}; };
@ -148,13 +148,13 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
*/ */
{ {
bool ItemInEdit = GetScreen()->GetCurItem() bool ItemInEdit = GetScreen()->GetCurItem()
&& GetScreen()->GetCurItem()->m_Flags; && GetScreen()->GetCurItem()->m_Flags;
bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified
if( hotkey == 0 ) if( hotkey == 0 )
return; return;
wxPoint MousePos = GetScreen()->m_MousePosition; wxPoint MousePos = GetScreen()->m_MousePosition;
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...) // Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...)
if( (hotkey & GR_KB_CTRL) != 0 ) if( (hotkey & GR_KB_CTRL) != 0 )
@ -169,7 +169,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
HK_Descr = GetDescriptorFromHotkey( hotkey, s_Schematic_Hotkey_List ); HK_Descr = GetDescriptorFromHotkey( hotkey, s_Schematic_Hotkey_List );
if( HK_Descr == NULL ) return; if( HK_Descr == NULL ) return;
switch( HK_Descr->m_Idcommand ) switch( HK_Descr->m_Idcommand )
{ {
default: default:
case HK_NOT_FOUND: case HK_NOT_FOUND:
@ -181,7 +181,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */ case HK_RESET_LOCAL_COORD: /* Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur; GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
break; break;
case HK_ZOOM_IN: case HK_ZOOM_IN:
@ -219,9 +219,9 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if( ItemInEdit ) if( ItemInEdit )
break; break;
RefreshToolBar = LocateAndDeleteItem( this, DC ); RefreshToolBar = LocateAndDeleteItem( this, DC );
GetScreen()->SetModify(); GetScreen()->SetModify();
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
break; break;
case HK_REPEAT_LAST: case HK_REPEAT_LAST:
@ -281,7 +281,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
GetScreen(), LIBITEM | TEXTITEM | LABELITEM ); GetScreen(), LIBITEM | TEXTITEM | LABELITEM );
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
if( DrawStruct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawStruct->Type() == TYPE_SCH_COMPONENT )
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
@ -289,7 +289,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
{ {
SaveCopyInUndoList( DrawStruct, IS_CHANGED ); SaveCopyInUndoList( DrawStruct, IS_CHANGED );
@ -297,19 +297,19 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
} }
CmpRotationMiroir( CmpRotationMiroir(
(EDA_SchComponentStruct*) DrawStruct, DC, CMP_ROTATE_COUNTERCLOCKWISE ); (SCH_COMPONENT*) DrawStruct, DC, CMP_ROTATE_COUNTERCLOCKWISE );
break; break;
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
{ {
SaveCopyInUndoList( DrawStruct, IS_CHANGED ); SaveCopyInUndoList( DrawStruct, IS_CHANGED );
RefreshToolBar = TRUE; RefreshToolBar = TRUE;
} }
ChangeTextOrient( (DrawTextStruct*) DrawStruct, DC ); ChangeTextOrient( (SCH_TEXT*) DrawStruct, DC );
break; break;
default: default:
@ -320,7 +320,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_MIRROR_Y_COMPONENT: // Mirror Y (Component) case HK_MIRROR_Y_COMPONENT: // Mirror Y (Component)
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if( DrawStruct ) if( DrawStruct )
{ {
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
@ -329,13 +329,13 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
RefreshToolBar = TRUE; RefreshToolBar = TRUE;
} }
CmpRotationMiroir( CmpRotationMiroir(
(EDA_SchComponentStruct*) DrawStruct, DC, CMP_MIROIR_Y ); (SCH_COMPONENT*) DrawStruct, DC, CMP_MIROIR_Y );
} }
break; break;
case HK_MIRROR_X_COMPONENT: // Mirror X (Component) case HK_MIRROR_X_COMPONENT: // Mirror X (Component)
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if( DrawStruct ) if( DrawStruct )
{ {
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
@ -344,13 +344,13 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
RefreshToolBar = TRUE; RefreshToolBar = TRUE;
} }
CmpRotationMiroir( CmpRotationMiroir(
(EDA_SchComponentStruct*) DrawStruct, DC, CMP_MIROIR_X ); (SCH_COMPONENT*) DrawStruct, DC, CMP_MIROIR_X );
} }
break; break;
case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component) case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if( DrawStruct ) if( DrawStruct )
{ {
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
@ -359,8 +359,8 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
RefreshToolBar = TRUE; RefreshToolBar = TRUE;
} }
CmpRotationMiroir( CmpRotationMiroir(
(EDA_SchComponentStruct*) DrawStruct, DC, CMP_NORMAL ); (SCH_COMPONENT*) DrawStruct, DC, CMP_NORMAL );
TestDanglingEnds( (SCH_SCREEN*)GetScreen()->EEDrawList, DC ); TestDanglingEnds( (SCH_SCREEN*)GetScreen()->EEDrawList, DC );
} }
break; break;
@ -369,37 +369,37 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if( ItemInEdit ) if( ItemInEdit )
break; break;
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if( DrawStruct && (DrawStruct->m_Flags ==0) ) if( DrawStruct && (DrawStruct->m_Flags ==0) )
{ {
((SCH_SCREEN*)GetScreen())->SetCurItem( DrawStruct ); ((SCH_SCREEN*)GetScreen())->SetCurItem( DrawStruct );
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent ); wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent );
wxPostEvent( this, event ); wxPostEvent( this, event );
} }
break; break;
case HK_EDIT_COMPONENT_VALUE: case HK_EDIT_COMPONENT_VALUE:
if( ItemInEdit ) if( ItemInEdit )
break; break;
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if(DrawStruct) if(DrawStruct)
{ {
EditComponentValue( EditComponentValue(
(EDA_SchComponentStruct*) DrawStruct, DC ); (SCH_COMPONENT*) DrawStruct, DC );
} }
break; break;
case HK_EDIT_COMPONENT_FOOTPRINT: case HK_EDIT_COMPONENT_FOOTPRINT:
if( ItemInEdit ) if( ItemInEdit )
break; break;
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if(DrawStruct) if(DrawStruct)
{ {
EditComponentFootprint( EditComponentFootprint(
(EDA_SchComponentStruct*) DrawStruct, DC ); (SCH_COMPONENT*) DrawStruct, DC );
} }
break; break;
} }
@ -417,16 +417,16 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
* Commands are case insensitive * Commands are case insensitive
*/ */
{ {
bool ItemInEdit = GetScreen()->GetCurItem() bool ItemInEdit = GetScreen()->GetCurItem()
&& GetScreen()->GetCurItem()->m_Flags; && GetScreen()->GetCurItem()->m_Flags;
bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified
if( hotkey == 0 ) if( hotkey == 0 )
return; return;
wxPoint MousePos = GetScreen()->m_MousePosition; wxPoint MousePos = GetScreen()->m_MousePosition;
LibEDA_BaseStruct* DrawEntry = LocateItemUsingCursor(); LibEDA_BaseStruct* DrawEntry = LocateItemUsingCursor();
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...) // Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...)
if( (hotkey & GR_KB_CTRL) != 0 ) if( (hotkey & GR_KB_CTRL) != 0 )
@ -451,7 +451,7 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */ case HK_RESET_LOCAL_COORD: /* Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur; GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
break; break;
case HK_ZOOM_IN: case HK_ZOOM_IN:
@ -490,36 +490,36 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
else else
wxBell(); wxBell();
break; break;
case HK_EDIT_PIN: case HK_EDIT_PIN:
if(DrawEntry) if(DrawEntry)
CurrentDrawItem = DrawEntry; CurrentDrawItem = DrawEntry;
if(CurrentDrawItem) if(CurrentDrawItem)
{ {
if(CurrentDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE) if(CurrentDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE)
InstallPineditFrame( this, DC, MousePos ); InstallPineditFrame( this, DC, MousePos );
} }
break; break;
case HK_DELETE_PIN: case HK_DELETE_PIN:
if(DrawEntry) if(DrawEntry)
CurrentDrawItem = DrawEntry; CurrentDrawItem = DrawEntry;
if(CurrentDrawItem) if(CurrentDrawItem)
{ {
wxCommandEvent evt; wxCommandEvent evt;
evt.SetId(ID_POPUP_LIBEDIT_DELETE_ITEM); evt.SetId(ID_POPUP_LIBEDIT_DELETE_ITEM);
Process_Special_Functions(evt); Process_Special_Functions(evt);
} }
break; break;
case HK_MOVE_PIN: case HK_MOVE_PIN:
if(DrawEntry) if(DrawEntry)
CurrentDrawItem = DrawEntry; CurrentDrawItem = DrawEntry;
if(CurrentDrawItem) if(CurrentDrawItem)
{ {
wxCommandEvent evt; wxCommandEvent evt;
evt.SetId(ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST); evt.SetId(ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST);
Process_Special_Functions(evt); Process_Special_Functions(evt);
} }
break; break;
} }
if( RefreshToolBar ) if( RefreshToolBar )
SetToolbars(); SetToolbars();
} }

View File

@ -98,7 +98,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
return FALSE; return FALSE;
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
screen->m_FileName = FullFileName; screen->m_FileName = FullFileName;
LineCount = 1; LineCount = 1;
if( ( f = wxFopen( FullFileName, wxT( "rt" ) ) ) == NULL ) if( ( f = wxFopen( FullFileName, wxT( "rt" ) ) ) == NULL )
@ -108,7 +108,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
return FALSE; return FALSE;
} }
MsgDiag = _( "Loading " ) + screen->m_FileName; MsgDiag = _( "Loading " ) + screen->m_FileName;
PrintMsg( MsgDiag ); PrintMsg( MsgDiag );
if( fgets( Line, 1024 - 1, f ) == NULL if( fgets( Line, 1024 - 1, f ) == NULL
@ -120,8 +120,8 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
fclose( f ); fclose( f );
return FALSE; return FALSE;
} }
//get the file version here. //get the file version here.
char version = Line[9 + sizeof(SCHEMATIC_HEAD_STRING)]; char version = Line[9 + sizeof(SCHEMATIC_HEAD_STRING)];
LineCount++; LineCount++;
if( fgets( Line, 1024 - 1, f ) == NULL || strncmp( Line, "LIBS:", 5 ) != 0 ) if( fgets( Line, 1024 - 1, f ) == NULL || strncmp( Line, "LIBS:", 5 ) != 0 )
{ {
@ -188,7 +188,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
wxT( "EESchema file Segment struct error at line %d, aborted" ), wxT( "EESchema file Segment struct error at line %d, aborted" ),
LineCount ); LineCount );
Failed = TRUE; Failed = TRUE;
SAFE_DELETE( SegmentStruct ) ; SAFE_DELETE( SegmentStruct ) ;
break; break;
} }
@ -224,7 +224,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
wxT( "EESchema file Raccord struct error at line %d, aborted" ), wxT( "EESchema file Raccord struct error at line %d, aborted" ),
LineCount ); LineCount );
Failed = TRUE; Failed = TRUE;
SAFE_DELETE( RaccordStruct ) ; SAFE_DELETE( RaccordStruct ) ;
break; break;
} }
@ -268,7 +268,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
wxT( "EESchema file polyline struct error at line %d, aborted" ), wxT( "EESchema file polyline struct error at line %d, aborted" ),
LineCount ); LineCount );
Failed = TRUE; Failed = TRUE;
SAFE_DELETE( PolylineStruct ) ; SAFE_DELETE( PolylineStruct ) ;
break; break;
} }
} }
@ -290,7 +290,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
wxT( "EESchema file connection struct error at line %d, aborted" ), wxT( "EESchema file connection struct error at line %d, aborted" ),
LineCount ); LineCount );
Failed = TRUE; Failed = TRUE;
SAFE_DELETE( ConnectionStruct ) ; SAFE_DELETE( ConnectionStruct ) ;
} }
else else
{ {
@ -378,20 +378,20 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
if( Name1[0] == 'L' ) if( Name1[0] == 'L' )
{ {
DrawLabelStruct* TextStruct = SCH_LABEL* TextStruct =
new DrawLabelStruct( pos, CONV_FROM_UTF8( text ) ); new SCH_LABEL( pos, CONV_FROM_UTF8( text ) );
TextStruct->m_Size.x = TextStruct->m_Size.y = size; TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient; TextStruct->m_Orient = orient;
Struct = (EDA_BaseStruct*) TextStruct; Struct = (EDA_BaseStruct*) TextStruct;
} }
else if( Name1[0] == 'G' && version > '1') else if( Name1[0] == 'G' && version > '1')
{ {
DrawGlobalLabelStruct* TextStruct = SCH_GLOBALLABEL* TextStruct =
new DrawGlobalLabelStruct(pos, CONV_FROM_UTF8( text ) ); new SCH_GLOBALLABEL(pos, CONV_FROM_UTF8( text ) );
Struct = (EDA_BaseStruct*) TextStruct; Struct = (EDA_BaseStruct*) TextStruct;
TextStruct->m_Size.x = TextStruct->m_Size.y = size; TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient; TextStruct->m_Orient = orient;
TextStruct->m_Shape = NET_INPUT; TextStruct->m_Shape = NET_INPUT;
if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 ) if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 )
TextStruct->m_Shape = NET_OUTPUT; TextStruct->m_Shape = NET_OUTPUT;
if( stricmp( Name2, SheetLabelType[NET_BIDI] ) == 0 ) if( stricmp( Name2, SheetLabelType[NET_BIDI] ) == 0 )
@ -401,14 +401,14 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
if( stricmp( Name2, SheetLabelType[NET_UNSPECIFIED] ) == 0 ) if( stricmp( Name2, SheetLabelType[NET_UNSPECIFIED] ) == 0 )
TextStruct->m_Shape = NET_UNSPECIFIED; TextStruct->m_Shape = NET_UNSPECIFIED;
} }
else if( (Name1[0] == 'H') || (Name1[0] == 'G' && version == '1')) else if( (Name1[0] == 'H') || (Name1[0] == 'G' && version == '1'))
{ //in schematic file version 1, glabels were actually hierarchal labels. { //in schematic file version 1, glabels were actually hierarchal labels.
DrawHierLabelStruct* TextStruct = SCH_HIERLABEL* TextStruct =
new DrawHierLabelStruct(pos, CONV_FROM_UTF8( text ) ); new SCH_HIERLABEL(pos, CONV_FROM_UTF8( text ) );
Struct = (EDA_BaseStruct*) TextStruct; Struct = (EDA_BaseStruct*) TextStruct;
TextStruct->m_Size.x = TextStruct->m_Size.y = size; TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient; TextStruct->m_Orient = orient;
TextStruct->m_Shape = NET_INPUT; TextStruct->m_Shape = NET_INPUT;
if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 ) if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 )
TextStruct->m_Shape = NET_OUTPUT; TextStruct->m_Shape = NET_OUTPUT;
if( stricmp( Name2, SheetLabelType[NET_BIDI] ) == 0 ) if( stricmp( Name2, SheetLabelType[NET_BIDI] ) == 0 )
@ -420,8 +420,8 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
} }
else else
{ {
DrawTextStruct* TextStruct = SCH_TEXT* TextStruct =
new DrawTextStruct( pos, CONV_FROM_UTF8( text ) ); new SCH_TEXT( pos, CONV_FROM_UTF8( text ) );
TextStruct->m_Size.x = TextStruct->m_Size.y = size; TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient; TextStruct->m_Orient = orient;
Struct = (EDA_BaseStruct*) TextStruct; Struct = (EDA_BaseStruct*) TextStruct;
@ -470,8 +470,8 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
TestDanglingEnds( screen->EEDrawList, NULL ); TestDanglingEnds( screen->EEDrawList, NULL );
MsgDiag = _( "Done Loading " ) + screen->m_FileName; MsgDiag = _( "Done Loading " ) + screen->m_FileName;
PrintMsg( MsgDiag ); PrintMsg( MsgDiag );
return TRUE; /* Although it may be that file is only partially loaded. */ return TRUE; /* Although it may be that file is only partially loaded. */
} }
@ -489,11 +489,11 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
int ii, fieldref; int ii, fieldref;
char Name1[256], Name2[256], char Name1[256], Name2[256],
Char1[256], Char2[256], Char3[256]; Char1[256], Char2[256], Char3[256];
EDA_SchComponentStruct* LibItemStruct; SCH_COMPONENT* LibItemStruct;
int Failed = 0, newfmt = 0; int Failed = 0, newfmt = 0;
char* ptcar; char* ptcar;
LibItemStruct = new EDA_SchComponentStruct(); LibItemStruct = new SCH_COMPONENT();
LibItemStruct->m_Convert = 1; LibItemStruct->m_Convert = 1;
if( Line[0] == '$' ) if( Line[0] == '$' )
@ -534,29 +534,29 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
if( strcmp( Name2, NULL_STRING ) != 0 ) if( strcmp( Name2, NULL_STRING ) != 0 )
{ {
bool isDigit = false; bool isDigit = false;
for( ii = 0; ii < (int) strlen( Name2 ); ii++ ){ for( ii = 0; ii < (int) strlen( Name2 ); ii++ ){
if( Name2[ii] == '~' ) if( Name2[ii] == '~' )
Name2[ii] = ' '; Name2[ii] = ' ';
//get RefBase from this, too. store in Name1. //get RefBase from this, too. store in Name1.
if(Name2[ii] >= '0' && Name2[ii] <= '9'){ if(Name2[ii] >= '0' && Name2[ii] <= '9'){
isDigit = true; isDigit = true;
Name1[ii] = 0; //null-terminate. Name1[ii] = 0; //null-terminate.
} }
if(!isDigit){ if(!isDigit){
Name1[ii] = Name2[ii]; Name1[ii] = Name2[ii];
} }
} }
Name1[ii] = 0; //just in case Name1[ii] = 0; //just in case
int jj; int jj;
for(jj=0; jj<ii && Name1[jj] == ' '; jj++); for(jj=0; jj<ii && Name1[jj] == ' '; jj++);
if(jj == ii){ if(jj == ii){
//blank string. //blank string.
LibItemStruct->m_PrefixString = wxT("U"); LibItemStruct->m_PrefixString = wxT("U");
}else{ }else{
LibItemStruct->m_PrefixString = CONV_FROM_UTF8(&Name1[jj]); LibItemStruct->m_PrefixString = CONV_FROM_UTF8(&Name1[jj]);
//printf("prefix: %s\n", CONV_TO_UTF8(LibItemStruct->m_PrefixString)); //printf("prefix: %s\n", CONV_TO_UTF8(LibItemStruct->m_PrefixString));
} }
if( !newfmt ) if( !newfmt )
LibItemStruct->m_Field[REFERENCE].m_Text = CONV_FROM_UTF8( Name2 ); LibItemStruct->m_Field[REFERENCE].m_Text = CONV_FROM_UTF8( Name2 );
} }
@ -571,8 +571,8 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
* "P " = position * "P " = position
* "U " = Num Unit, et Conversion * "U " = Num Unit, et Conversion
* "Fn" = Champs ( n = 0.. = numero de champ ) * "Fn" = Champs ( n = 0.. = numero de champ )
* "Ar" = AlternateReference, in the case of multiple sheets * "Ar" = AlternateReference, in the case of multiple sheets
* referring to one schematic file. * referring to one schematic file.
*/ */
/* Lecture des champs */ /* Lecture des champs */
@ -583,7 +583,7 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
return TRUE; return TRUE;
if( (Line[0] != 'F' ) if( (Line[0] != 'F' )
&& (Line[0] != 'P' ) && (Line[0] != 'P' )
&& (Line[0] != 'A' ) && (Line[0] != 'A' )
&& (Line[0] != 'U' ) ) && (Line[0] != 'U' ) )
break; break;
@ -599,32 +599,32 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
sscanf( Line + 1, "%d %d", sscanf( Line + 1, "%d %d",
&LibItemStruct->m_Pos.x, &LibItemStruct->m_Pos.y ); &LibItemStruct->m_Pos.x, &LibItemStruct->m_Pos.y );
} }
if( Line[0] == 'A' && Line[1] == 'R' ) if( Line[0] == 'A' && Line[1] == 'R' )
{ {
/*format: /*format:
AR Path="/9086AF6E/67452AA0" Ref="C99" AR Path="/9086AF6E/67452AA0" Ref="C99"
where 9086AF6E is the unique timestamp of the containing sheet where 9086AF6E is the unique timestamp of the containing sheet
and 67452AA0 is the timestamp of this component. and 67452AA0 is the timestamp of this component.
C99 is the reference given this path. C99 is the reference given this path.
*/ */
int i=2; int i=2;
while(i<256 && Line[i] != '"'){ i++; } i++; while(i<256 && Line[i] != '"'){ i++; } i++;
//copy the path. //copy the path.
int j = 0; int j = 0;
while(i<256 && Line[i] != '"'){Name1[j] = Line[i]; i++; j++;} i++; while(i<256 && Line[i] != '"'){Name1[j] = Line[i]; i++; j++;} i++;
Name1[j] = 0; Name1[j] = 0;
wxString path = CONV_FROM_UTF8(Name1); wxString path = CONV_FROM_UTF8(Name1);
//i should be one after the closing quote, match the next opening quote //i should be one after the closing quote, match the next opening quote
while(i<256 && Line[i] != '"'){ i++; } i++; while(i<256 && Line[i] != '"'){ i++; } i++;
j = 0; j = 0;
while(i<256 && Line[i] != '"'){Name1[j] = Line[i]; i++; j++;} i++; while(i<256 && Line[i] != '"'){Name1[j] = Line[i]; i++; j++;} i++;
Name1[j] = 0; Name1[j] = 0;
wxString ref = CONV_FROM_UTF8(Name1); wxString ref = CONV_FROM_UTF8(Name1);
LibItemStruct->m_Paths.Add(path); LibItemStruct->m_Paths.Add(path);
LibItemStruct->m_References.Add(ref); LibItemStruct->m_References.Add(ref);
LibItemStruct->m_Field[REFERENCE].m_Text = ref; LibItemStruct->m_Field[REFERENCE].m_Text = ref;
} }
if( Line[0] == 'F' ) if( Line[0] == 'F' )
{ {
char FieldUserName[1024]; char FieldUserName[1024];
@ -767,7 +767,7 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
{ {
LibItemStruct->Pnext = Window->EEDrawList; LibItemStruct->Pnext = Window->EEDrawList;
Window->EEDrawList = (EDA_BaseStruct*) LibItemStruct; Window->EEDrawList = (EDA_BaseStruct*) LibItemStruct;
LibItemStruct->m_Parent = Window; LibItemStruct->m_Parent = Window;
} }
return Failed; /* Fin lecture 1 composant */ return Failed; /* Fin lecture 1 composant */
@ -790,12 +790,12 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
char* ptcar; char* ptcar;
SheetStruct = new DrawSheetStruct(); SheetStruct = new DrawSheetStruct();
SheetStruct->m_TimeStamp = GetTimeStamp(); SheetStruct->m_TimeStamp = GetTimeStamp();
//sheets are added to the EEDrawList like other schematic components. //sheets are added to the EEDrawList like other schematic components.
//however, in order to preserve the heirarchy (through m_Parent pointers), //however, in order to preserve the heirarchy (through m_Parent pointers),
//a duplicate of the sheet is added to m_SubSheet array. //a duplicate of the sheet is added to m_SubSheet array.
//must be a duplicate, references just work for a two-layer structure. //must be a duplicate, references just work for a two-layer structure.
//this is accomplished through the Sync() function. //this is accomplished through the Sync() function.
if( Line[0] == '$' ) /* Ligne doit etre "$Sheet" */ if( Line[0] == '$' ) /* Ligne doit etre "$Sheet" */
{ {
@ -826,12 +826,12 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
LineCount++; LineCount++;
if( fgets( Line, 256 - 1, f ) == NULL ) if( fgets( Line, 256 - 1, f ) == NULL )
return TRUE; return TRUE;
if( Line[0] == 'U' ){ if( Line[0] == 'U' ){
sscanf( Line + 1, "%lX", &(SheetStruct->m_TimeStamp) ); sscanf( Line + 1, "%lX", &(SheetStruct->m_TimeStamp) );
if(SheetStruct->m_TimeStamp == 0) //zero is not unique! if(SheetStruct->m_TimeStamp == 0) //zero is not unique!
SheetStruct->m_TimeStamp = GetTimeStamp(); SheetStruct->m_TimeStamp = GetTimeStamp();
continue; continue;
} }
if( Line[0] != 'F' ) if( Line[0] != 'F' )
break; break;
sscanf( Line + 1, "%d", &fieldref ); sscanf( Line + 1, "%d", &fieldref );
@ -887,7 +887,7 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
else else
{ {
SheetStruct->SetFileName(CONV_FROM_UTF8( Name1 )); SheetStruct->SetFileName(CONV_FROM_UTF8( Name1 ));
//printf("in ReadSheetDescr : SheetStruct->m_FileName = %s \n", Name1); //printf("in ReadSheetDescr : SheetStruct->m_FileName = %s \n", Name1);
SheetStruct->m_FileNameSize = size; SheetStruct->m_FileNameSize = size;
} }
} }
@ -949,12 +949,12 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
LineCount ); LineCount );
Failed = TRUE; Failed = TRUE;
} }
if( !Failed ) if( !Failed )
{ {
SheetStruct->Pnext = Window->EEDrawList; SheetStruct->Pnext = Window->EEDrawList;
Window->EEDrawList = (EDA_BaseStruct*)SheetStruct; Window->EEDrawList = (EDA_BaseStruct*)SheetStruct;
SheetStruct->m_Parent = Window; SheetStruct->m_Parent = Window;
} }
return Failed; /* Fin lecture 1 composant */ return Failed; /* Fin lecture 1 composant */
} }

View File

@ -31,14 +31,14 @@ static bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
/*********************************************************************/ /*********************************************************************/
EDA_SchComponentStruct* LocateSmallestComponent( SCH_SCREEN* Screen ) SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
/*********************************************************************/ /*********************************************************************/
/* Search the smaller (considering its area) component under the mouse cursor or the pcb cursor /* Search the smaller (considering its area) component under the mouse cursor or the pcb cursor
* If more than 1 component is found, a pointer to the smaller component is returned * If more than 1 component is found, a pointer to the smaller component is returned
*/ */
{ {
EDA_SchComponentStruct* DrawLibItem = NULL, * LastDrawLibItem = NULL; SCH_COMPONENT* DrawLibItem = NULL, * LastDrawLibItem = NULL;
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
EDA_Rect BoundaryBox; EDA_Rect BoundaryBox;
float sizeref = 0, sizecurr; float sizeref = 0, sizecurr;
@ -54,7 +54,7 @@ EDA_SchComponentStruct* LocateSmallestComponent( SCH_SCREEN* Screen )
DrawList, NULL, Screen->GetZoom() ) ) == FALSE ) DrawList, NULL, Screen->GetZoom() ) ) == FALSE )
break; break;
} }
DrawLibItem = (EDA_SchComponentStruct*) LastSnappedStruct; DrawLibItem = (SCH_COMPONENT*) LastSnappedStruct;
DrawList = DrawLibItem->Pnext; DrawList = DrawLibItem->Pnext;
if( LastDrawLibItem == NULL ) // First time a component is located if( LastDrawLibItem == NULL ) // First time a component is located
{ {
@ -120,9 +120,9 @@ EDA_BaseStruct* PickStruct( const wxPoint& refpos,
*/ */
{ {
bool Snapped; bool Snapped;
EDA_BaseStruct* DrawList = screen->EEDrawList; EDA_BaseStruct* DrawList = screen->EEDrawList;
if( screen==NULL || DrawList == NULL ) if( screen==NULL || DrawList == NULL )
return NULL; return NULL;
if( ( Snapped = SnapPoint2( refpos, SearchMask, if( ( Snapped = SnapPoint2( refpos, SearchMask,
DrawList, NULL, screen->GetZoom() ) ) != FALSE ) DrawList, NULL, screen->GetZoom() ) ) != FALSE )
@ -155,9 +155,9 @@ EDA_BaseStruct* PickStruct( EDA_Rect& block,
if( y < OrigY ) if( y < OrigY )
EXCHG( y, OrigY ); EXCHG( y, OrigY );
EDA_BaseStruct* DrawList = screen->EEDrawList; EDA_BaseStruct* DrawList = screen->EEDrawList;
if( screen==NULL || DrawList == NULL ) if( screen==NULL || DrawList == NULL )
return NULL; return NULL;
for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
{ {
@ -176,7 +176,7 @@ EDA_BaseStruct* PickStruct( EDA_Rect& block,
/* Only one item was picked - convert to scalar form (no list): */ /* Only one item was picked - convert to scalar form (no list): */
PickedItem = PickedList; PickedItem = PickedList;
PickedList = (DrawPickedStruct*) PickedList->m_PickedStruct; PickedList = (DrawPickedStruct*) PickedList->m_PickedStruct;
SAFE_DELETE( PickedItem ) ; SAFE_DELETE( PickedItem ) ;
} }
if( PickedList != NULL ) if( PickedList != NULL )
@ -341,10 +341,10 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
} }
break; break;
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawTextStruct*) DrawList ) #define STRUCT ( (SCH_TEXT*) DrawList )
if( !( SearchMask & (TEXTITEM | LABELITEM) ) ) if( !( SearchMask & (TEXTITEM | LABELITEM) ) )
break; break;
dx = STRUCT->m_Size.x * STRUCT->GetLength(); dx = STRUCT->m_Size.x * STRUCT->GetLength();
@ -379,10 +379,10 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawLabelStruct*) DrawList ) #define STRUCT ( (SCH_LABEL*) DrawList )
if( !(SearchMask & LABELITEM) ) if( !(SearchMask & LABELITEM) )
break; break;
dx = STRUCT->m_Size.x * ( STRUCT->GetLength() + 1 ); /* longueur */ dx = STRUCT->m_Size.x * ( STRUCT->GetLength() + 1 ); /* longueur */
@ -416,14 +416,14 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
} }
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
if( !( SearchMask & (LIBITEM | FIELDCMPITEM) ) ) if( !( SearchMask & (LIBITEM | FIELDCMPITEM) ) )
break; break;
if( SearchMask & FIELDCMPITEM ) if( SearchMask & FIELDCMPITEM )
{ {
PartTextStruct* Field; PartTextStruct* Field;
EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*) DrawList; SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) DrawList;
for( i = REFERENCE; i < NUMBER_OF_FIELDS; i++ ) for( i = REFERENCE; i < NUMBER_OF_FIELDS; i++ )
{ {
Field = &DrawLibItem->m_Field[i]; Field = &DrawLibItem->m_Field[i];
@ -442,7 +442,7 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
else else
{ {
#undef STRUCT #undef STRUCT
#define STRUCT ( (EDA_SchComponentStruct*) DrawList ) #define STRUCT ( (SCH_COMPONENT*) DrawList )
EDA_Rect BoundaryBox = STRUCT->GetBoundaryBox(); EDA_Rect BoundaryBox = STRUCT->GetBoundaryBox();
if( BoundaryBox.Inside( x, y ) ) if( BoundaryBox.Inside( x, y ) )
{ {
@ -564,10 +564,10 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2,
return TRUE; return TRUE;
break; break;
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawTextStruct*) DrawStruct ) #define STRUCT ( (SCH_TEXT*) DrawStruct )
dx = STRUCT->m_Size.x * STRUCT->GetLength(); dx = STRUCT->m_Size.x * STRUCT->GetLength();
dy = STRUCT->m_Size.y; dy = STRUCT->m_Size.y;
xt1 = xt2 = STRUCT->m_Pos.x; xt1 = xt2 = STRUCT->m_Pos.x;
@ -596,10 +596,10 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2,
return TRUE; return TRUE;
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawLabelStruct*) DrawStruct ) #define STRUCT ( (SCH_LABEL*) DrawStruct )
dx = STRUCT->m_Size.x * ( STRUCT->GetLength() + 1); /* longueur totale */ dx = STRUCT->m_Size.x * ( STRUCT->GetLength() + 1); /* longueur totale */
dy = STRUCT->m_Size.y / 2; /* Demi hauteur */ dy = STRUCT->m_Size.y / 2; /* Demi hauteur */
xt1 = xt2 = STRUCT->m_Pos.x; xt1 = xt2 = STRUCT->m_Pos.x;
@ -628,10 +628,10 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2,
return TRUE; return TRUE;
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
{ {
#undef STRUCT #undef STRUCT
#define STRUCT ( (EDA_SchComponentStruct*) DrawStruct ) #define STRUCT ( (SCH_COMPONENT*) DrawStruct )
EDA_Rect BoundaryBox = STRUCT->GetBoundaryBox(); EDA_Rect BoundaryBox = STRUCT->GetBoundaryBox();
xt1 = BoundaryBox.GetX(); xt1 = BoundaryBox.GetX();
yt1 = BoundaryBox.GetY(); yt1 = BoundaryBox.GetY();
@ -1043,7 +1043,7 @@ int distance( int dx, int dy, int spot_cX, int spot_cY, int seuil )
/*******************************************************************/ /*******************************************************************/
LibDrawPin* LocatePinByNumber( const wxString & ePin_Number, LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
EDA_SchComponentStruct* eComponent ) SCH_COMPONENT* eComponent )
/*******************************************************************/ /*******************************************************************/
/** Find a PIN in a component /** Find a PIN in a component
@ -1053,11 +1053,11 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
*/ */
{ {
LibEDA_BaseStruct* DrawItem; LibEDA_BaseStruct* DrawItem;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
LibDrawPin* Pin; LibDrawPin* Pin;
int Unit, Convert; int Unit, Convert;
Entry = FindLibPart(eComponent->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); Entry = FindLibPart(eComponent->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( Entry == NULL ) if( Entry == NULL )
return NULL; return NULL;
@ -1067,8 +1067,8 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
return NULL; return NULL;
} }
Unit = eComponent->m_Multi; Unit = eComponent->m_Multi;
Convert = eComponent->m_Convert; Convert = eComponent->m_Convert;
DrawItem = Entry->m_Drawings; DrawItem = Entry->m_Drawings;
for( ; DrawItem != NULL; DrawItem = DrawItem->Next() ) for( ; DrawItem != NULL; DrawItem = DrawItem->Next() )
@ -1082,10 +1082,10 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
if( Convert && DrawItem->m_Convert && (DrawItem->m_Convert != Convert) ) if( Convert && DrawItem->m_Convert && (DrawItem->m_Convert != Convert) )
continue; continue;
wxString pNumber; wxString pNumber;
Pin->ReturnPinStringNum( pNumber ); Pin->ReturnPinStringNum( pNumber );
if ( ePin_Number == pNumber ) if ( ePin_Number == pNumber )
return Pin; return Pin;
} }
} }
@ -1096,7 +1096,7 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
/*******************************************************************/ /*******************************************************************/
LibEDA_BaseStruct* LocatePin( const wxPoint& RefPos, LibEDA_BaseStruct* LocatePin( const wxPoint& RefPos,
EDA_LibComponentStruct* Entry, EDA_LibComponentStruct* Entry,
int Unit, int convert, EDA_SchComponentStruct* DrawLibItem ) int Unit, int convert, SCH_COMPONENT* DrawLibItem )
/*******************************************************************/ /*******************************************************************/
/* Routine de localisation d'une PIN de la PartLib pointee par Entry /* Routine de localisation d'une PIN de la PartLib pointee par Entry
@ -1198,19 +1198,19 @@ DrawSheetLabelStruct* LocateSheetLabel( DrawSheetStruct* Sheet, const wxPoint& p
/**************************************************************************/ /**************************************************************************/
LibDrawPin* LocateAnyPin( EDA_BaseStruct* DrawList, const wxPoint& RefPos, LibDrawPin* LocateAnyPin( EDA_BaseStruct* DrawList, const wxPoint& RefPos,
EDA_SchComponentStruct** libpart ) SCH_COMPONENT** libpart )
/**************************************************************************/ /**************************************************************************/
{ {
EDA_BaseStruct* DrawStruct; EDA_BaseStruct* DrawStruct;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
EDA_SchComponentStruct* LibItem = NULL; SCH_COMPONENT* LibItem = NULL;
LibDrawPin* Pin = NULL; LibDrawPin* Pin = NULL;
for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
{ {
if( DrawStruct->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawStruct->Type() != TYPE_SCH_COMPONENT )
continue; continue;
LibItem = (EDA_SchComponentStruct*) DrawStruct; LibItem = (SCH_COMPONENT*) DrawStruct;
Entry = FindLibPart( LibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); Entry = FindLibPart( LibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( Entry == NULL ) if( Entry == NULL )
continue; continue;

View File

@ -24,10 +24,10 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet );
static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f, bool use_netnames ); static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f, bool use_netnames );
static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet ); static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet );
static void AddPinToComponentPinList( EDA_SchComponentStruct* Component, static void AddPinToComponentPinList( SCH_COMPONENT* Component,
DrawSheetPath* sheet, DrawSheetPath* sheet,
LibDrawPin* PinEntry ); LibDrawPin* PinEntry );
static void FindOthersUnits( EDA_SchComponentStruct* Component, DrawSheetPath* Sheet_in); static void FindOthersUnits( SCH_COMPONENT* Component, DrawSheetPath* Sheet_in);
static int SortPinsByNum( ObjetNetListStruct** Pin1, ObjetNetListStruct** Pin2 ); static int SortPinsByNum( ObjetNetListStruct** Pin1, ObjetNetListStruct** Pin2 );
static void EraseDuplicatePins( ObjetNetListStruct** TabPin, int NbrPin ); static void EraseDuplicatePins( ObjetNetListStruct** TabPin, int NbrPin );
@ -92,8 +92,8 @@ void WriteNetList( WinEDA_SchematicFrame* frame, const wxString& FileNameNL,
/****************************************************************************/ /****************************************************************************/
static EDA_SchComponentStruct* FindNextComponentAndCreatPinList( static SCH_COMPONENT* FindNextComponentAndCreatPinList(
EDA_BaseStruct* DrawList, DrawSheetPath* sheet) EDA_BaseStruct* DrawList, DrawSheetPath* sheet)
/****************************************************************************/ /****************************************************************************/
/* Find a "suitable" component from the DrawList /* Find a "suitable" component from the DrawList
@ -105,7 +105,7 @@ static EDA_SchComponentStruct* FindNextComponentAndCreatPinList(
* Must be deallocated by the user * Must be deallocated by the user
*/ */
{ {
EDA_SchComponentStruct* Component = NULL; SCH_COMPONENT* Component = NULL;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
LibEDA_BaseStruct* DEntry; LibEDA_BaseStruct* DEntry;
@ -113,23 +113,23 @@ static EDA_SchComponentStruct* FindNextComponentAndCreatPinList(
for( ; DrawList != NULL; DrawList = DrawList->Next() ) for( ; DrawList != NULL; DrawList = DrawList->Next() )
{ {
if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawList->Type() != TYPE_SCH_COMPONENT )
continue; continue;
Component = (EDA_SchComponentStruct*) DrawList; Component = (SCH_COMPONENT*) DrawList;
/* already tested ? : */ /* already tested ? : */
bool found = false; bool found = false;
for(unsigned int i =0; i<Component->m_UsedOnSheets.GetCount(); i++){ for(unsigned int i =0; i<Component->m_UsedOnSheets.GetCount(); i++){
if( Component->m_UsedOnSheets.Item(i) == *sheet ){ if( Component->m_UsedOnSheets.Item(i) == *sheet ){
found = true; found = true;
break; break;
} }
} }
if( found ) continue; if( found ) continue;
//if( Component->m_FlagControlMulti == 1 ) //if( Component->m_FlagControlMulti == 1 )
// continue; /* yes */ // continue; /* yes */
// removed because with multiple instances of one schematic // removed because with multiple instances of one schematic
// (several sheets pointing to 1 screen), this will be erroneously be toggled. // (several sheets pointing to 1 screen), this will be erroneously be toggled.
Entry = FindLibPart( Component->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); Entry = FindLibPart( Component->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( Entry == NULL ) if( Entry == NULL )
@ -137,7 +137,7 @@ static EDA_SchComponentStruct* FindNextComponentAndCreatPinList(
/* Power symbol and other component which have the reference starting by /* Power symbol and other component which have the reference starting by
* "#" are not included in netlist (pseudo components) */ * "#" are not included in netlist (pseudo components) */
wxString str = Component->GetRef(sheet); wxString str = Component->GetRef(sheet);
if( str[0] == '#' ) if( str[0] == '#' )
continue; continue;
@ -164,7 +164,7 @@ static EDA_SchComponentStruct* FindNextComponentAndCreatPinList(
} }
//Component->m_FlagControlMulti = 1; //Component->m_FlagControlMulti = 1;
Component->m_UsedOnSheets.Add(*sheet); Component->m_UsedOnSheets.Add(*sheet);
if( Entry->m_UnitCount > 1 ) if( Entry->m_UnitCount > 1 )
FindOthersUnits( Component, sheet); FindOthersUnits( Component, sheet);
@ -211,7 +211,7 @@ static wxString ReturnPinNetName( ObjetNetListStruct* Pin,
continue; continue;
if( ( g_TabObjNet[jj].m_Type != NET_HIERLABEL) if( ( g_TabObjNet[jj].m_Type != NET_HIERLABEL)
&& ( g_TabObjNet[jj].m_Type != NET_LABEL) && ( g_TabObjNet[jj].m_Type != NET_LABEL)
&& ( g_TabObjNet[jj].m_Type != NET_PINLABEL) ) && ( g_TabObjNet[jj].m_Type != NET_PINLABEL) )
continue; continue;
NetName = *g_TabObjNet[jj].m_Label; NetName = *g_TabObjNet[jj].m_Label;
@ -221,9 +221,9 @@ static wxString ReturnPinNetName( ObjetNetListStruct* Pin,
if( !NetName.IsEmpty() ) if( !NetName.IsEmpty() )
{ {
if( g_TabObjNet[jj].m_Type != NET_PINLABEL ){ if( g_TabObjNet[jj].m_Type != NET_PINLABEL ){
NetName = g_TabObjNet[jj].m_SheetList.PathHumanReadable() NetName = g_TabObjNet[jj].m_SheetList.PathHumanReadable()
+ NetName; + NetName;
} }
//NetName << wxT("_") << g_TabObjNet[jj].m_SheetList.PathHumanReadable(); //NetName << wxT("_") << g_TabObjNet[jj].m_SheetList.PathHumanReadable();
} }
else else
@ -245,9 +245,9 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
*/ */
{ {
wxString Line, FootprintName; wxString Line, FootprintName;
DrawSheetPath* sheet; DrawSheetPath* sheet;
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
EDA_SchComponentStruct* Component; SCH_COMPONENT* Component;
wxString netname; wxString netname;
int ii; int ii;
FILE* tmpfile; FILE* tmpfile;
@ -267,12 +267,12 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
/* Create netlist module section */ /* Create netlist module section */
fprintf( tmpfile, "$BeginComponentList\n" ); fprintf( tmpfile, "$BeginComponentList\n" );
EDA_SheetList SheetList( NULL ); EDA_SheetList SheetList( NULL );
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext ) for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext )
{ {
DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet ); DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet );
if( Component == NULL ) if( Component == NULL )
@ -363,11 +363,11 @@ static void ClearUsedFlags( WinEDA_SchematicFrame* frame )
DrawList = screen->EEDrawList; DrawList = screen->EEDrawList;
while( DrawList ) while( DrawList )
{ {
if( DrawList->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawList->Type() == TYPE_SCH_COMPONENT )
{ {
EDA_SchComponentStruct* Component = (EDA_SchComponentStruct*) DrawList; SCH_COMPONENT* Component = (SCH_COMPONENT*) DrawList;
//Component->m_FlagControlMulti = 0; //Component->m_FlagControlMulti = 0;
Component->m_UsedOnSheets.Clear(); Component->m_UsedOnSheets.Clear();
} }
DrawList = DrawList->Pnext; DrawList = DrawList->Pnext;
} }
@ -394,7 +394,7 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
char Line[1024]; char Line[1024];
DrawSheetPath* sheet; DrawSheetPath* sheet;
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
EDA_SchComponentStruct* Component; SCH_COMPONENT* Component;
int ii, nbitems; int ii, nbitems;
wxString text; wxString text;
wxArrayString SpiceCommandAtBeginFile, SpiceCommandAtEndFile; wxArrayString SpiceCommandAtBeginFile, SpiceCommandAtEndFile;
@ -416,9 +416,9 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext ) for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext )
{ {
wxChar ident; wxChar ident;
if( DrawList->Type() != DRAW_TEXT_STRUCT_TYPE ) if( DrawList->Type() != TYPE_SCH_TEXT )
continue; continue;
#define DRAWTEXT ( (DrawTextStruct*) DrawList ) #define DRAWTEXT ( (SCH_TEXT*) DrawList )
text = DRAWTEXT->m_Text; if( text.IsEmpty() ) text = DRAWTEXT->m_Text; if( text.IsEmpty() )
continue; continue;
ident = text.GetChar( 0 ); ident = text.GetChar( 0 );
@ -536,9 +536,9 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
char Buf[256]; char Buf[256];
DrawSheetPath* sheet; DrawSheetPath* sheet;
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
EDA_SchComponentStruct* Component; SCH_COMPONENT* Component;
int ii; int ii;
ListComponent* CmpList = NULL; ListComponent* CmpList = NULL;
int CmpListCount = 0, CmpListSize = 1000; int CmpListCount = 0, CmpListSize = 1000;
DateAndTime( Buf ); DateAndTime( Buf );
@ -548,7 +548,7 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
fprintf( f, "( { %s created %s }\n", NETLIST_HEAD_STRING, Buf ); fprintf( f, "( { %s created %s }\n", NETLIST_HEAD_STRING, Buf );
/* Create netlist module section */ /* Create netlist module section */
ClearUsedFlags( frame ); /* Reset the flags FlagControlMulti in all schematic files*/ ClearUsedFlags( frame ); /* Reset the flags FlagControlMulti in all schematic files*/
EDA_SheetList SheetList( NULL ); EDA_SheetList SheetList( NULL );
@ -569,18 +569,18 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
if( Entry->m_FootprintList.GetCount() != 0 ) /* Put in list */ if( Entry->m_FootprintList.GetCount() != 0 ) /* Put in list */
{ {
if( CmpList == NULL ){ if( CmpList == NULL ){
CmpList = (ListComponent*) CmpList = (ListComponent*)
MyZMalloc( sizeof(ListComponent) * CmpListSize ); MyZMalloc( sizeof(ListComponent) * CmpListSize );
} }
if( CmpListCount >= CmpListSize ) if( CmpListCount >= CmpListSize )
{ {
CmpListSize += 1000; CmpListSize += 1000;
CmpList = (ListComponent*) realloc( CmpList = (ListComponent*) realloc(
CmpList, CmpList,
sizeof(ListComponent) * CmpListSize ); sizeof(ListComponent) * CmpListSize );
} }
CmpList[CmpListCount].m_Comp = Component; CmpList[CmpListCount].m_Comp = Component;
strcpy(CmpList[CmpListCount].m_Ref, Component->GetRef( sheet ).mb_str()); strcpy(CmpList[CmpListCount].m_Ref, Component->GetRef( sheet ).mb_str());
CmpListCount++; CmpListCount++;
} }
} }
@ -642,13 +642,13 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
{ {
Component = CmpList[ii].m_Comp; Component = CmpList[ii].m_Comp;
Entry = FindLibPart( Component->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); Entry = FindLibPart( Component->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
//Line.Printf(_("%s"), CmpList[ii].m_Ref); //Line.Printf(_("%s"), CmpList[ii].m_Ref);
//Line.Replace( wxT( " " ), wxT( "_" ) ); //Line.Replace( wxT( " " ), wxT( "_" ) );
unsigned int i; unsigned int i;
for(i=0; i<sizeof(CmpList[ii].m_Ref) && CmpList[ii].m_Ref[i]; i++){ for(i=0; i<sizeof(CmpList[ii].m_Ref) && CmpList[ii].m_Ref[i]; i++){
if(CmpList[ii].m_Ref[i] == ' ') if(CmpList[ii].m_Ref[i] == ' ')
CmpList[ii].m_Ref[i] = '_'; CmpList[ii].m_Ref[i] = '_';
} }
fprintf( f, "$component %s\n", CmpList[ii].m_Ref ); fprintf( f, "$component %s\n", CmpList[ii].m_Ref );
/* Write the footprint list */ /* Write the footprint list */
for( unsigned int jj = 0; jj < Entry->m_FootprintList.GetCount(); jj++ ) for( unsigned int jj = 0; jj < Entry->m_FootprintList.GetCount(); jj++ )
@ -675,8 +675,8 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
/*************************************************************************************/ /*************************************************************************************/
static void AddPinToComponentPinList( EDA_SchComponentStruct* Component, static void AddPinToComponentPinList( SCH_COMPONENT* Component,
DrawSheetPath* sheetlist, LibDrawPin* Pin ) DrawSheetPath* sheetlist, LibDrawPin* Pin )
/*************************************************************************************/ /*************************************************************************************/
/* Add a new pin description in the pin list s_SortedComponentPinList /* Add a new pin description in the pin list s_SortedComponentPinList
@ -693,8 +693,8 @@ static void AddPinToComponentPinList( EDA_SchComponentStruct* Component,
continue; continue;
if( g_TabObjNet[ii].m_Link != Component ) if( g_TabObjNet[ii].m_Link != Component )
continue; continue;
if( g_TabObjNet[ii].m_SheetList != *sheetlist ) if( g_TabObjNet[ii].m_SheetList != *sheetlist )
continue; continue;
if( g_TabObjNet[ii].m_PinNum != Pin->m_PinNum ) if( g_TabObjNet[ii].m_PinNum != Pin->m_PinNum )
continue; continue;
{ {
@ -742,7 +742,7 @@ static void EraseDuplicatePins( ObjetNetListStruct** TabPin, int NbrPin )
/**********************************************************************/ /**********************************************************************/
static void FindOthersUnits( EDA_SchComponentStruct* Component_in, DrawSheetPath* Sheet_in) static void FindOthersUnits( SCH_COMPONENT* Component_in, DrawSheetPath* Sheet_in)
/**********************************************************************/ /**********************************************************************/
/* Recherche les autres parts du boitier auquel appartient la part Component, /* Recherche les autres parts du boitier auquel appartient la part Component,
@ -751,15 +751,15 @@ static void FindOthersUnits( EDA_SchComponentStruct* Component_in, DrawSheetPath
*/ */
{ {
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
EDA_SchComponentStruct* Component2; SCH_COMPONENT* Component2;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
LibEDA_BaseStruct* DEntry; LibEDA_BaseStruct* DEntry;
DrawSheetPath* sheet; DrawSheetPath* sheet;
wxString str; wxString str;
EDA_SheetList SheetList( NULL ); EDA_SheetList SheetList( NULL );
unsigned int i; unsigned int i;
bool found; bool found;
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
DrawList = sheet->LastDrawList(); DrawList = sheet->LastDrawList();
@ -767,19 +767,19 @@ static void FindOthersUnits( EDA_SchComponentStruct* Component_in, DrawSheetPath
{ {
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
Component2 = (EDA_SchComponentStruct*) DrawList; Component2 = (SCH_COMPONENT*) DrawList;
found = false; found = false;
for( i =0; i<Component2->m_UsedOnSheets.GetCount(); i++){ for( i =0; i<Component2->m_UsedOnSheets.GetCount(); i++){
if( Component2->m_UsedOnSheets.Item(i) == *Sheet_in ){ if( Component2->m_UsedOnSheets.Item(i) == *Sheet_in ){
found = true; found = true;
} }
} }
if( found ) break; if( found ) break;
//if( Component2->m_FlagControlMulti == 1 ) //has it been used? (on this sheet?) //if( Component2->m_FlagControlMulti == 1 ) //has it been used? (on this sheet?)
// break; // break;
str = Component2->GetRef(sheet); str = Component2->GetRef(sheet);
if( str.CmpNoCase( Component_in->GetRef(Sheet_in) ) != 0 ) if( str.CmpNoCase( Component_in->GetRef(Sheet_in) ) != 0 )
break; break;
@ -808,7 +808,7 @@ static void FindOthersUnits( EDA_SchComponentStruct* Component_in, DrawSheetPath
} }
} }
} }
Component2->m_UsedOnSheets.Add(*Sheet_in); Component2->m_UsedOnSheets.Add(*Sheet_in);
//Component2->m_FlagControlMulti = 1; //mark it as used.. //Component2->m_FlagControlMulti = 1; //mark it as used..
break; break;
@ -830,12 +830,12 @@ static int SortPinsByNum( ObjetNetListStruct** Pin1, ObjetNetListStruct** Pin2 )
* du tableau des pins s_SortedComponentPinList par qsort() * du tableau des pins s_SortedComponentPinList par qsort()
*/ */
{ {
ObjetNetListStruct* Obj1, * Obj2; ObjetNetListStruct* Obj1, * Obj2;
int Num1, Num2; int Num1, Num2;
char Line[5]; char Line[5];
Obj1 = *Pin1; Obj2 = *Pin2; Obj1 = *Pin1; Obj2 = *Pin2;
Num1 = Obj1->m_PinNum; Num2 = Obj2->m_PinNum; Num1 = Obj1->m_PinNum; Num2 = Obj2->m_PinNum;
Line[4] = 0; memcpy( Line, &Num1, 4 ); Num1 = atoi( Line ); Line[4] = 0; memcpy( Line, &Num1, 4 ); Num1 = atoi( Line );
memcpy( Line, &Num2, 4 ); Num2 = atoi( Line ); memcpy( Line, &Num2, 4 ); Num2 = atoi( Line );
return Num1 - Num2; return Num1 - Num2;
@ -853,7 +853,7 @@ static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet )
int ii, jj; int ii, jj;
int NetCode, LastNetCode = -1; int NetCode, LastNetCode = -1;
int SameNetcodeCount = 0; int SameNetcodeCount = 0;
EDA_SchComponentStruct* Cmp; SCH_COMPONENT* Cmp;
wxString NetName, CmpRef; wxString NetName, CmpRef;
wxString NetcodeName; wxString NetcodeName;
char FirstItemInNet[1024]; char FirstItemInNet[1024];
@ -882,12 +882,12 @@ static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet )
{ {
NetcodeName += NetName; NetcodeName += NetName;
if( g_TabObjNet[jj].m_Type != NET_PINLABEL ){ if( g_TabObjNet[jj].m_Type != NET_PINLABEL ){
// usual net name, add in the sheet path // usual net name, add in the sheet path
NetcodeName = g_TabObjNet[jj].m_SheetList.PathHumanReadable() NetcodeName = g_TabObjNet[jj].m_SheetList.PathHumanReadable()
+ NetcodeName; + NetcodeName;
//NetcodeName << wxT("_") << //NetcodeName << wxT("_") <<
// g_TabObjNet[jj].m_SheetList.PathHumanReadable(); // g_TabObjNet[jj].m_SheetList.PathHumanReadable();
} }
} }
NetcodeName += wxT( "\"" ); NetcodeName += wxT( "\"" );
LastNetCode = NetCode; LastNetCode = NetCode;
@ -896,8 +896,8 @@ static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet )
if( ObjNet[ii].m_Type != NET_PIN ) if( ObjNet[ii].m_Type != NET_PIN )
continue; continue;
Cmp = (EDA_SchComponentStruct*) ObjNet[ii].m_Link; Cmp = (SCH_COMPONENT*) ObjNet[ii].m_Link;
CmpRef = Cmp->GetRef(&ObjNet[ii].m_SheetList); //is this correct? CmpRef = Cmp->GetRef(&ObjNet[ii].m_SheetList); //is this correct?
if( CmpRef.StartsWith( wxT( "#" ) ) ) if( CmpRef.StartsWith( wxT( "#" ) ) )
continue; // Pseudo component (Like Power symbol) continue; // Pseudo component (Like Power symbol)
@ -962,7 +962,7 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
char Line[1024]; char Line[1024];
DrawSheetPath* sheet; DrawSheetPath* sheet;
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
EDA_SchComponentStruct* Component; SCH_COMPONENT* Component;
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion(); wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
fprintf( f, "%sHEA\n", CONV_TO_UTF8( StartLine ) ); fprintf( f, "%sHEA\n", CONV_TO_UTF8( StartLine ) );
@ -1031,7 +1031,7 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
wxString NetcodeName, InitNetDescLine; wxString NetcodeName, InitNetDescLine;
int ii, jj, print_ter = 0; int ii, jj, print_ter = 0;
int NetCode, LastNetCode = -1; int NetCode, LastNetCode = -1;
EDA_SchComponentStruct* Cmp; SCH_COMPONENT* Cmp;
wxString NetName; wxString NetName;
for( ii = 0; ii < g_NbrObjNet; ii++ ) for( ii = 0; ii < g_NbrObjNet; ii++ )
@ -1060,11 +1060,11 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
{ {
NetcodeName += NetName; NetcodeName += NetName;
if( g_TabObjNet[jj].m_Type != NET_PINLABEL ){ if( g_TabObjNet[jj].m_Type != NET_PINLABEL ){
NetcodeName = g_TabObjNet[jj].m_SheetList.PathHumanReadable() NetcodeName = g_TabObjNet[jj].m_SheetList.PathHumanReadable()
+ NetcodeName; + NetcodeName;
//NetcodeName << wxT("_") << //NetcodeName << wxT("_") <<
// g_TabObjNet[jj].m_SheetList.PathHumanReadable(); // g_TabObjNet[jj].m_SheetList.PathHumanReadable();
} }
} }
else // this net has no name: create a default name $<net number> else // this net has no name: create a default name $<net number>
NetcodeName << wxT( "$" ) << NetCode; NetcodeName << wxT( "$" ) << NetCode;
@ -1080,8 +1080,8 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
if( ObjNet[ii].m_Flag != 0 ) if( ObjNet[ii].m_Flag != 0 )
continue; continue;
Cmp = (EDA_SchComponentStruct*) ObjNet[ii].m_Link; Cmp = (SCH_COMPONENT*) ObjNet[ii].m_Link;
wxString refstr = Cmp->GetRef(&(ObjNet[ii].m_SheetList)); wxString refstr = Cmp->GetRef(&(ObjNet[ii].m_SheetList));
if( refstr[0] == '#' ) if( refstr[0] == '#' )
continue; // Pseudo composant (symboles d'alims) continue; // Pseudo composant (symboles d'alims)
@ -1127,11 +1127,11 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
break; break;
if( ObjNet[jj].m_Type != NET_PIN ) if( ObjNet[jj].m_Type != NET_PIN )
continue; continue;
EDA_SchComponentStruct* tstcmp = SCH_COMPONENT* tstcmp =
(EDA_SchComponentStruct*) ObjNet[jj].m_Link; (SCH_COMPONENT*) ObjNet[jj].m_Link;
wxString p = Cmp->GetPath( &( ObjNet[ii].m_SheetList ) ); wxString p = Cmp->GetPath( &( ObjNet[ii].m_SheetList ) );
wxString tstp = tstcmp->GetPath( &( ObjNet[jj].m_SheetList ) ); wxString tstp = tstcmp->GetPath( &( ObjNet[jj].m_SheetList ) );
if( p.Cmp(tstp) != 0 ) if( p.Cmp(tstp) != 0 )
continue; continue;
if( ObjNet[jj].m_PinNum == ObjNet[ii].m_PinNum ) if( ObjNet[jj].m_PinNum == ObjNet[ii].m_PinNum )

View File

@ -52,10 +52,10 @@ const char* ShowType( NetObjetType aType )
case NET_JONCTION: ret = "junction"; break; case NET_JONCTION: ret = "junction"; break;
case NET_LABEL: ret = "label"; break; case NET_LABEL: ret = "label"; break;
case NET_HIERLABEL: ret = "hierlabel"; break; case NET_HIERLABEL: ret = "hierlabel"; break;
case NET_GLOBLABEL: ret = "glabel"; break; case NET_GLOBLABEL: ret = "glabel"; break;
case NET_BUSLABELMEMBER: ret = "buslblmember"; break; case NET_BUSLABELMEMBER: ret = "buslblmember"; break;
case NET_HIERBUSLABELMEMBER: ret = "hierbuslblmember"; break; case NET_HIERBUSLABELMEMBER: ret = "hierbuslblmember"; break;
case NET_GLOBBUSLABELMEMBER: ret = "gbuslblmember"; break; case NET_GLOBBUSLABELMEMBER: ret = "gbuslblmember"; break;
case NET_SHEETBUSLABELMEMBER: ret = "sbuslblmember"; break; case NET_SHEETBUSLABELMEMBER: ret = "sbuslblmember"; break;
case NET_SHEETLABEL: ret = "sheetlabel"; break; case NET_SHEETLABEL: ret = "sheetlabel"; break;
case NET_PINLABEL: ret = "pinlabel"; break; case NET_PINLABEL: ret = "pinlabel"; break;
@ -69,7 +69,7 @@ const char* ShowType( NetObjetType aType )
void ObjetNetListStruct::Show( std::ostream& out, int ndx ) void ObjetNetListStruct::Show( std::ostream& out, int ndx )
{ {
wxString path = m_SheetList.PathHumanReadable(); wxString path = m_SheetList.PathHumanReadable();
out << "<netItem ndx=\"" << ndx << '"' << out << "<netItem ndx=\"" << ndx << '"' <<
" type=\"" << ShowType(m_Type) << '"' << " type=\"" << ShowType(m_Type) << '"' <<
" netCode=\"" << GetNet() << '"' << " netCode=\"" << GetNet() << '"' <<
@ -124,17 +124,17 @@ void FreeTabNetList( ObjetNetListStruct* TabNetItems, int NbrNetItems )
case NET_BUS: case NET_BUS:
case NET_LABEL: case NET_LABEL:
case NET_HIERLABEL: case NET_HIERLABEL:
case NET_GLOBLABEL: case NET_GLOBLABEL:
case NET_PINLABEL: case NET_PINLABEL:
case NET_NOCONNECT: case NET_NOCONNECT:
break; break;
case NET_HIERBUSLABELMEMBER: case NET_HIERBUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER: case NET_GLOBBUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER: case NET_SHEETBUSLABELMEMBER:
case NET_BUSLABELMEMBER: case NET_BUSLABELMEMBER:
SAFE_DELETE( TabNetItems[i].m_Label ); SAFE_DELETE( TabNetItems[i].m_Label );
//see the note in ConvertBustToMembers //see the note in ConvertBustToMembers
break; break;
} }
} }
@ -154,7 +154,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
{ {
int NetNumber; int NetNumber;
int i, istart, NetCode; int i, istart, NetCode;
DrawSheetPath* sheet; DrawSheetPath* sheet;
wxString msg; wxString msg;
wxBusyCursor Busy; wxBusyCursor Busy;
@ -166,7 +166,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
/* Build the sheet (not screen) list (flattened)*/ /* Build the sheet (not screen) list (flattened)*/
EDA_SheetList SheetListList( NULL ); EDA_SheetList SheetListList( NULL );
i=0; i=0;
/* 1ere passe : Comptage du nombre d'objet de Net */ /* 1ere passe : Comptage du nombre d'objet de Net */
g_NbrObjNet = 0; g_NbrObjNet = 0;
g_TabObjNet = NULL; /* Init pour le 1er passage dans ListeObjetConnection */ g_TabObjNet = NULL; /* Init pour le 1er passage dans ListeObjetConnection */
@ -191,7 +191,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
return NULL; return NULL;
/* 2eme passe : Remplissage des champs des structures des objets de Net */ /* 2eme passe : Remplissage des champs des structures des objets de Net */
/* second pass: fill the fields of the structures in the Net */ /* second pass: fill the fields of the structures in the Net */
s_PassNumber++; s_PassNumber++;
Affiche_1_Parametre( this, 1, _( "List" ), wxEmptyString, RED ); Affiche_1_Parametre( this, 1, _( "List" ), wxEmptyString, RED );
@ -220,9 +220,9 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
for( i = istart = 0; i<g_NbrObjNet; i++ ) for( i = istart = 0; i<g_NbrObjNet; i++ )
{ {
if( g_TabObjNet[i].m_SheetList != *sheet ) if( g_TabObjNet[i].m_SheetList != *sheet )
{ {
sheet = &(g_TabObjNet[i].m_SheetList); sheet = &(g_TabObjNet[i].m_SheetList);
istart = i; istart = i;
} }
@ -265,7 +265,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
case NET_LABEL: case NET_LABEL:
case NET_HIERLABEL: case NET_HIERLABEL:
case NET_GLOBLABEL: case NET_GLOBLABEL:
/* Controle des connexions type jonction ( Sans BUS ) */ /* Controle des connexions type jonction ( Sans BUS ) */
if( g_TabObjNet[i].GetNet() == 0 ) if( g_TabObjNet[i].GetNet() == 0 )
{ {
@ -291,7 +291,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
case NET_BUSLABELMEMBER: case NET_BUSLABELMEMBER:
case NET_HIERBUSLABELMEMBER: case NET_HIERBUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER: case NET_GLOBBUSLABELMEMBER:
/* Controle des connexions semblables a des sur BUS */ /* Controle des connexions semblables a des sur BUS */
if( g_TabObjNet[i].GetNet() == 0 ) if( g_TabObjNet[i].GetNet() == 0 )
{ {
@ -331,16 +331,16 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
break; break;
case NET_LABEL: case NET_LABEL:
case NET_GLOBLABEL: case NET_GLOBLABEL:
case NET_PINLABEL: case NET_PINLABEL:
case NET_BUSLABELMEMBER: case NET_BUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER: case NET_GLOBBUSLABELMEMBER:
LabelConnect( g_TabObjNet + i ); LabelConnect( g_TabObjNet + i );
break; break;
case NET_SHEETBUSLABELMEMBER: case NET_SHEETBUSLABELMEMBER:
case NET_HIERLABEL: case NET_HIERLABEL:
case NET_HIERBUSLABELMEMBER: case NET_HIERBUSLABELMEMBER:
break; break;
} }
} }
@ -412,7 +412,7 @@ static void SheetLabelConnect( ObjetNetListStruct* SheetLabel )
* pour regroupement des NetCodes */ * pour regroupement des NetCodes */
for( i = 0, ObjetNet = g_TabObjNet; i < g_NbrObjNet; i++ ) for( i = 0, ObjetNet = g_TabObjNet; i < g_NbrObjNet; i++ )
{ {
if( ObjetNet[i].m_SheetList != SheetLabel->m_SheetListInclude ) if( ObjetNet[i].m_SheetList != SheetLabel->m_SheetListInclude )
continue; //use SheetInclude, not the sheet!! continue; //use SheetInclude, not the sheet!!
if( (ObjetNet[i].m_Type != NET_HIERLABEL ) if( (ObjetNet[i].m_Type != NET_HIERLABEL )
@ -449,21 +449,21 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
{ {
int ii, NbrItem = 0; int ii, NbrItem = 0;
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
EDA_SchComponentStruct* DrawLibItem; SCH_COMPONENT* DrawLibItem;
int TransMat[2][2], PartX, PartY, x2, y2; int TransMat[2][2], PartX, PartY, x2, y2;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
LibEDA_BaseStruct* DEntry; LibEDA_BaseStruct* DEntry;
DrawSheetLabelStruct* SheetLabel; DrawSheetLabelStruct* SheetLabel;
DrawSheetPath list; DrawSheetPath list;
DrawList = sheetlist->LastScreen()->EEDrawList; DrawList = sheetlist->LastScreen()->EEDrawList;
for( ; DrawList; DrawList = DrawList->Pnext ) for( ; DrawList; DrawList = DrawList->Pnext )
{ {
if( ObjNet ){ if( ObjNet ){
ObjNet[NbrItem].m_SheetList = *sheetlist; ObjNet[NbrItem].m_SheetList = *sheetlist;
ObjNet[NbrItem].m_SheetListInclude = *sheetlist; ObjNet[NbrItem].m_SheetListInclude = *sheetlist;
//used for DrawSheetLabels //used for DrawSheetLabels
} }
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
@ -517,9 +517,9 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
NbrItem++; NbrItem++;
break; break;
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawLabelStruct*) DrawList ) #define STRUCT ( (SCH_LABEL*) DrawList )
ii = IsBusLabel( STRUCT->m_Text ); ii = IsBusLabel( STRUCT->m_Text );
if( ObjNet ) if( ObjNet )
{ {
@ -528,8 +528,8 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
if( STRUCT->m_Layer == LAYER_GLOBLABEL ) if( STRUCT->m_Layer == LAYER_GLOBLABEL )
ObjNet[NbrItem].m_Type = NET_GLOBLABEL; ObjNet[NbrItem].m_Type = NET_GLOBLABEL;
if( STRUCT->m_Layer == LAYER_HIERLABEL ) if( STRUCT->m_Layer == LAYER_HIERLABEL )
ObjNet[NbrItem].m_Type = NET_HIERLABEL; ObjNet[NbrItem].m_Type = NET_HIERLABEL;
ObjNet[NbrItem].m_Label = &STRUCT->m_Text; ObjNet[NbrItem].m_Label = &STRUCT->m_Text;
ObjNet[NbrItem].m_Start = STRUCT->m_Pos; ObjNet[NbrItem].m_Start = STRUCT->m_Pos;
@ -542,10 +542,10 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
NbrItem += ii + 1; NbrItem += ii + 1;
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawLabelStruct*) DrawList ) #define STRUCT ( (SCH_LABEL*) DrawList )
ii = IsBusLabel( STRUCT->m_Text ); ii = IsBusLabel( STRUCT->m_Text );
if( ObjNet ) if( ObjNet )
{ {
@ -554,8 +554,8 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
if( STRUCT->m_Layer == LAYER_GLOBLABEL ) //this is not the simplest way of doing it if( STRUCT->m_Layer == LAYER_GLOBLABEL ) //this is not the simplest way of doing it
ObjNet[NbrItem].m_Type = NET_GLOBLABEL;// (look at the case statement above). ObjNet[NbrItem].m_Type = NET_GLOBLABEL;// (look at the case statement above).
if( STRUCT->m_Layer == LAYER_HIERLABEL ) if( STRUCT->m_Layer == LAYER_HIERLABEL )
ObjNet[NbrItem].m_Type = NET_HIERLABEL; ObjNet[NbrItem].m_Type = NET_HIERLABEL;
ObjNet[NbrItem].m_Label = &STRUCT->m_Text; ObjNet[NbrItem].m_Label = &STRUCT->m_Text;
ObjNet[NbrItem].m_Start = STRUCT->m_Pos; ObjNet[NbrItem].m_Start = STRUCT->m_Pos;
@ -568,8 +568,8 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
NbrItem += ii + 1; NbrItem += ii + 1;
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
DrawLibItem = (EDA_SchComponentStruct*) DrawList; DrawLibItem = (SCH_COMPONENT*) DrawList;
memcpy( TransMat, DrawLibItem->m_Transform, sizeof(TransMat) ); memcpy( TransMat, DrawLibItem->m_Transform, sizeof(TransMat) );
@ -609,7 +609,7 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
if( ObjNet ) if( ObjNet )
{ {
ObjNet[NbrItem].m_Comp = DEntry; ObjNet[NbrItem].m_Comp = DEntry;
ObjNet[NbrItem].m_SheetList = *sheetlist; ObjNet[NbrItem].m_SheetList = *sheetlist;
ObjNet[NbrItem].m_Type = NET_PIN; ObjNet[NbrItem].m_Type = NET_PIN;
ObjNet[NbrItem].m_Link = DrawLibItem; ObjNet[NbrItem].m_Link = DrawLibItem;
ObjNet[NbrItem].m_ElectricalType = Pin->m_PinType; ObjNet[NbrItem].m_ElectricalType = Pin->m_PinType;
@ -628,7 +628,7 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
if( ObjNet ) if( ObjNet )
{ {
ObjNet[NbrItem].m_Comp = NULL; ObjNet[NbrItem].m_Comp = NULL;
ObjNet[NbrItem].m_SheetList = *sheetlist; ObjNet[NbrItem].m_SheetList = *sheetlist;
ObjNet[NbrItem].m_Type = NET_PINLABEL; ObjNet[NbrItem].m_Type = NET_PINLABEL;
ObjNet[NbrItem].m_Label = &Pin->m_PinName; ObjNet[NbrItem].m_Label = &Pin->m_PinName;
ObjNet[NbrItem].m_Start.x = x2; ObjNet[NbrItem].m_Start.x = x2;
@ -645,14 +645,14 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_POLYLINE_STRUCT_TYPE:
case DRAW_BUSENTRY_STRUCT_TYPE: case DRAW_BUSENTRY_STRUCT_TYPE:
case DRAW_MARKER_STRUCT_TYPE: case DRAW_MARKER_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
break; break;
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawSheetStruct*) DrawList ) #define STRUCT ( (DrawSheetStruct*) DrawList )
list = *sheetlist; list = *sheetlist;
list.Push(STRUCT); list.Push(STRUCT);
SheetLabel = STRUCT->m_Label; SheetLabel = STRUCT->m_Label;
for( ; SheetLabel != NULL; for( ; SheetLabel != NULL;
SheetLabel = (DrawSheetLabelStruct*) SheetLabel->Pnext ) SheetLabel = (DrawSheetLabelStruct*) SheetLabel->Pnext )
@ -661,7 +661,7 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
if( ObjNet ) if( ObjNet )
{ {
ObjNet[NbrItem].m_Comp = SheetLabel; ObjNet[NbrItem].m_Comp = SheetLabel;
ObjNet[NbrItem].m_SheetList = *sheetlist; ObjNet[NbrItem].m_SheetList = *sheetlist;
ObjNet[NbrItem].m_Link = DrawList; ObjNet[NbrItem].m_Link = DrawList;
ObjNet[NbrItem].m_Type = NET_SHEETLABEL; ObjNet[NbrItem].m_Type = NET_SHEETLABEL;
ObjNet[NbrItem].m_ElectricalType = SheetLabel->m_Shape; ObjNet[NbrItem].m_ElectricalType = SheetLabel->m_Shape;
@ -835,8 +835,8 @@ static int ConvertBusToMembers( ObjetNetListStruct* BusLabel )
if( BusLabel->m_Type == NET_HIERLABEL ) if( BusLabel->m_Type == NET_HIERLABEL )
BusLabel->m_Type = NET_HIERBUSLABELMEMBER; BusLabel->m_Type = NET_HIERBUSLABELMEMBER;
else if( BusLabel->m_Type == NET_GLOBLABEL ) else if( BusLabel->m_Type == NET_GLOBLABEL )
BusLabel->m_Type = NET_GLOBBUSLABELMEMBER; BusLabel->m_Type = NET_GLOBBUSLABELMEMBER;
else if( BusLabel->m_Type == NET_SHEETLABEL ) else if( BusLabel->m_Type == NET_SHEETLABEL )
BusLabel->m_Type = NET_SHEETBUSLABELMEMBER; BusLabel->m_Type = NET_SHEETBUSLABELMEMBER;
else else
@ -887,7 +887,7 @@ static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus )
if( OldNetCode == NewNetCode ) if( OldNetCode == NewNetCode )
return; return;
#if defined(NETLIST_DEBUG) && defined(DEBUG) #if defined(NETLIST_DEBUG) && defined(DEBUG)
printf("replacing net %d with %d\n", OldNetCode,NewNetCode); printf("replacing net %d with %d\n", OldNetCode,NewNetCode);
#endif #endif
if( IsBus == 0 ) /* Propagation du NetCode */ if( IsBus == 0 ) /* Propagation du NetCode */
@ -945,7 +945,7 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
for( i = start; i < g_NbrObjNet; i++ ) for( i = start; i < g_NbrObjNet; i++ )
{ {
if( netTable[i].m_SheetList != Ref->m_SheetList ) //used to be > (why?) if( netTable[i].m_SheetList != Ref->m_SheetList ) //used to be > (why?)
continue; continue;
switch( netTable[i].m_Type ) switch( netTable[i].m_Type )
@ -954,7 +954,7 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
case NET_PIN: case NET_PIN:
case NET_LABEL: case NET_LABEL:
case NET_HIERLABEL: case NET_HIERLABEL:
case NET_GLOBLABEL: case NET_GLOBLABEL:
case NET_SHEETLABEL: case NET_SHEETLABEL:
case NET_PINLABEL: case NET_PINLABEL:
case NET_JONCTION: case NET_JONCTION:
@ -975,7 +975,7 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
case NET_BUSLABELMEMBER: case NET_BUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER: case NET_SHEETBUSLABELMEMBER:
case NET_HIERBUSLABELMEMBER: case NET_HIERBUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER: case NET_GLOBBUSLABELMEMBER:
break; break;
} }
} }
@ -995,7 +995,7 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
case NET_PIN: case NET_PIN:
case NET_LABEL: case NET_LABEL:
case NET_HIERLABEL: case NET_HIERLABEL:
case NET_GLOBLABEL: case NET_GLOBLABEL:
case NET_SHEETLABEL: case NET_SHEETLABEL:
case NET_PINLABEL: case NET_PINLABEL:
case NET_NOCONNECT: case NET_NOCONNECT:
@ -1005,7 +1005,7 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
case NET_BUSLABELMEMBER: case NET_BUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER: case NET_SHEETBUSLABELMEMBER:
case NET_HIERBUSLABELMEMBER: case NET_HIERBUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER: case NET_GLOBBUSLABELMEMBER:
case NET_JONCTION: case NET_JONCTION:
if( Ref->m_Start == netTable[i].m_Start if( Ref->m_Start == netTable[i].m_Start
|| Ref->m_Start == netTable[i].m_End || Ref->m_Start == netTable[i].m_End
@ -1098,28 +1098,28 @@ static void LabelConnect( ObjetNetListStruct* LabelRef )
{ {
if( netTable[i].GetNet() == LabelRef->GetNet() ) if( netTable[i].GetNet() == LabelRef->GetNet() )
continue; continue;
if( netTable[i].m_SheetList != LabelRef->m_SheetList ) if( netTable[i].m_SheetList != LabelRef->m_SheetList )
{ {
if( (netTable[i].m_Type != NET_PINLABEL if( (netTable[i].m_Type != NET_PINLABEL
&& netTable[i].m_Type != NET_GLOBLABEL && netTable[i].m_Type != NET_GLOBLABEL
&& netTable[i].m_Type != NET_GLOBBUSLABELMEMBER) ) && netTable[i].m_Type != NET_GLOBBUSLABELMEMBER) )
continue;
if( (netTable[i].m_Type == NET_GLOBLABEL
|| netTable[i].m_Type == NET_GLOBBUSLABELMEMBER)
&& netTable[i].m_Type != LabelRef->m_Type)
//global labels only connect other global labels.
continue; continue;
if( (netTable[i].m_Type == NET_GLOBLABEL
|| netTable[i].m_Type == NET_GLOBBUSLABELMEMBER)
&& netTable[i].m_Type != LabelRef->m_Type)
//global labels only connect other global labels.
continue;
} }
//regular labels are sheet-local; //regular labels are sheet-local;
//NET_HIERLABEL are used to connect sheets. //NET_HIERLABEL are used to connect sheets.
//NET_LABEL is sheet-local (***) //NET_LABEL is sheet-local (***)
//NET_GLOBLABEL is global. //NET_GLOBLABEL is global.
if( netTable[i].m_Type == NET_LABEL if( netTable[i].m_Type == NET_LABEL
|| netTable[i].m_Type == NET_GLOBLABEL || netTable[i].m_Type == NET_GLOBLABEL
|| netTable[i].m_Type == NET_HIERLABEL || netTable[i].m_Type == NET_HIERLABEL
|| netTable[i].m_Type == NET_BUSLABELMEMBER || netTable[i].m_Type == NET_BUSLABELMEMBER
|| netTable[i].m_Type == NET_GLOBBUSLABELMEMBER || netTable[i].m_Type == NET_GLOBBUSLABELMEMBER
|| netTable[i].m_Type == NET_HIERBUSLABELMEMBER || netTable[i].m_Type == NET_HIERBUSLABELMEMBER
|| netTable[i].m_Type == NET_PINLABEL ) || netTable[i].m_Type == NET_PINLABEL )
{ {
if( netTable[i].m_Label->CmpNoCase( *LabelRef->m_Label ) != 0 ) if( netTable[i].m_Label->CmpNoCase( *LabelRef->m_Label ) != 0 )
@ -1157,7 +1157,7 @@ static int TriBySheet( const void* o1, const void* o2 )
{ {
ObjetNetListStruct* Objet1 = (ObjetNetListStruct*) o1; ObjetNetListStruct* Objet1 = (ObjetNetListStruct*) o1;
ObjetNetListStruct* Objet2 = (ObjetNetListStruct*) o2; ObjetNetListStruct* Objet2 = (ObjetNetListStruct*) o2;
return Objet1->m_SheetList.Cmp(Objet2->m_SheetList); return Objet1->m_SheetList.Cmp(Objet2->m_SheetList);
} }
/**********************************************************************/ /**********************************************************************/
@ -1220,14 +1220,14 @@ static void SetUnconnectedFlag( ObjetNetListStruct* ListObj, int NbItems )
case NET_SEGMENT: case NET_SEGMENT:
case NET_LABEL: case NET_LABEL:
case NET_HIERLABEL: case NET_HIERLABEL:
case NET_GLOBLABEL: case NET_GLOBLABEL:
case NET_SHEETLABEL: case NET_SHEETLABEL:
case NET_PINLABEL: case NET_PINLABEL:
case NET_BUS: case NET_BUS:
case NET_BUSLABELMEMBER: case NET_BUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER: case NET_SHEETBUSLABELMEMBER:
case NET_HIERBUSLABELMEMBER: case NET_HIERBUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER: case NET_GLOBBUSLABELMEMBER:
case NET_JONCTION: case NET_JONCTION:
break; break;

View File

@ -26,7 +26,7 @@ typedef enum {
* NET_TYPE_CUSTOM1+CUSTOMPANEL_COUNTMAX-1 * NET_TYPE_CUSTOM1+CUSTOMPANEL_COUNTMAX-1
* is the last id for user netlist format * is the last id for user netlist format
*/ */
NET_TYPE_CUSTOM_MAX = NET_TYPE_CUSTOM1+CUSTOMPANEL_COUNTMAX-1 NET_TYPE_CUSTOM_MAX = NET_TYPE_CUSTOM1+CUSTOMPANEL_COUNTMAX-1
} TypeNetForm; } TypeNetForm;
@ -39,11 +39,11 @@ enum NetObjetType { /* Type des objets de Net */
NET_JONCTION, NET_JONCTION,
NET_LABEL, NET_LABEL,
NET_GLOBLABEL, NET_GLOBLABEL,
NET_HIERLABEL, //on a screen to indicate connection to a higher-level sheet NET_HIERLABEL, //on a screen to indicate connection to a higher-level sheet
NET_SHEETLABEL, //on a drawscreen element to indicate connection to a lower-level sheet. NET_SHEETLABEL, //on a drawscreen element to indicate connection to a lower-level sheet.
NET_BUSLABELMEMBER, NET_BUSLABELMEMBER,
NET_GLOBBUSLABELMEMBER, NET_GLOBBUSLABELMEMBER,
NET_HIERBUSLABELMEMBER, NET_HIERBUSLABELMEMBER,
NET_SHEETBUSLABELMEMBER, NET_SHEETBUSLABELMEMBER,
NET_PINLABEL, NET_PINLABEL,
NET_PIN, NET_PIN,
@ -93,23 +93,23 @@ public:
/* Structures pour memo et liste des elements */ /* Structures pour memo et liste des elements */
typedef struct ListLabel typedef struct ListLabel
{ {
int m_LabelType; int m_LabelType;
void * m_Label; void * m_Label;
char m_SheetPath[64]; char m_SheetPath[64];
} ListLabel; } ListLabel;
typedef struct ListComponent typedef struct ListComponent
{ {
EDA_SchComponentStruct * m_Comp; SCH_COMPONENT * m_Comp;
char m_Ref[32]; char m_Ref[32];
//have to store it here since the object refrerences will be duplicated. //have to store it here since the object refrerences will be duplicated.
DrawSheetPath m_SheetList; //composed of UIDs DrawSheetPath m_SheetList; //composed of UIDs
} ListComponent; } ListComponent;
/* Structure decrivant 1 composant de la schematique (pour *annotation* ) */ /* Structure decrivant 1 composant de la schematique (pour *annotation* ) */
struct CmpListStruct struct CmpListStruct
{ {
public: public:
EDA_SchComponentStruct* m_Cmp; /* Pointeur sur le composant */ SCH_COMPONENT* m_Cmp; /* Pointeur sur le composant */
int m_NbParts; /* Nombre de parts par boitier */ int m_NbParts; /* Nombre de parts par boitier */
bool m_PartsLocked; // For multi part components: True if the part cannot be changed bool m_PartsLocked; // For multi part components: True if the part cannot be changed
int m_Unit; /* Numero de part */ int m_Unit; /* Numero de part */
@ -121,7 +121,7 @@ public:
int m_NumRef; /* Numero de reference */ int m_NumRef; /* Numero de reference */
int m_Flag; /* flag pour calculs internes */ int m_Flag; /* flag pour calculs internes */
wxPoint m_Pos; /* position components */ wxPoint m_Pos; /* position components */
char m_Path[128]; // the 'path' of the object in the sheet hierarchy. char m_Path[128]; // the 'path' of the object in the sheet hierarchy.
}; };

View File

@ -39,15 +39,15 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
case DRAW_SHEETLABEL_STRUCT_TYPE: case DRAW_SHEETLABEL_STRUCT_TYPE:
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
case DRAW_BUSENTRY_STRUCT_TYPE: case DRAW_BUSENTRY_STRUCT_TYPE:
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
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 );
@ -354,16 +354,16 @@ void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
InstallNextScreen( (DrawSheetStruct*) DrawStruct ); InstallNextScreen( (DrawSheetStruct*) DrawStruct );
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
InstallCmpeditFrame( this, pos, (EDA_SchComponentStruct*) DrawStruct ); InstallCmpeditFrame( this, pos, (SCH_COMPONENT*) DrawStruct );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
EditSchematicText( (DrawTextStruct*) DrawStruct, DC ); EditSchematicText( (SCH_TEXT*) DrawStruct, DC );
break; break;
case DRAW_PART_TEXT_STRUCT_TYPE: case DRAW_PART_TEXT_STRUCT_TYPE:

View File

@ -55,11 +55,11 @@ static void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
WinEDA_SchematicFrame* frame ); WinEDA_SchematicFrame* frame );
static void AddMenusForHierchicalSheet( wxMenu* PopMenu, DrawSheetStruct* Sheet ); static void AddMenusForHierchicalSheet( wxMenu* PopMenu, DrawSheetStruct* Sheet );
static void AddMenusForPinSheet( wxMenu* PopMenu, DrawSheetLabelStruct* PinSheet ); static void AddMenusForPinSheet( wxMenu* PopMenu, DrawSheetLabelStruct* PinSheet );
static void AddMenusForText( wxMenu* PopMenu, DrawTextStruct* Text ); static void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text );
static void AddMenusForLabel( wxMenu* PopMenu, DrawLabelStruct* Label ); static void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label );
static void AddMenusForGLabel( wxMenu* PopMenu, DrawGlobalLabelStruct* GLabel ); static void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel );
static void AddMenusForHLabel( wxMenu* PopMenu, DrawHierLabelStruct* GLabel ); static void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* GLabel );
static void AddMenusForComponent( wxMenu* PopMenu, EDA_SchComponentStruct* Component ); static void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component );
static void AddMenusForComponentField( wxMenu* PopMenu, PartTextStruct* Field ); static void AddMenusForComponentField( wxMenu* PopMenu, PartTextStruct* Field );
static void AddMenusForJunction( wxMenu* PopMenu, DrawJunctionStruct* Junction, static void AddMenusForJunction( wxMenu* PopMenu, DrawJunctionStruct* Junction,
WinEDA_SchematicFrame* frame ); WinEDA_SchematicFrame* frame );
@ -90,20 +90,20 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
* Ce menu est ensuite compl<EFBFBD>t<EFBFBD> par la liste des commandes de ZOOM * Ce menu est ensuite compl<EFBFBD>t<EFBFBD> par la liste des commandes de ZOOM
*/ */
{ {
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE); bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu
if( BlockActive ) if( BlockActive )
{ {
AddMenusForBlock( PopMenu, this ); AddMenusForBlock( PopMenu, this );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
return true; return true;
} }
// Simple localisation des elements si possible // Simple localisation des elements si possible
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
DrawStruct = SchematicGeneralLocateAndDisplay( FALSE ); DrawStruct = SchematicGeneralLocateAndDisplay( FALSE );
@ -111,7 +111,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
{ {
DrawSheetLabelStruct* slabel; DrawSheetLabelStruct* slabel;
slabel = LocateSheetLabel( (DrawSheetStruct*) DrawStruct, slabel = LocateSheetLabel( (DrawSheetStruct*) DrawStruct,
GetScreen()->m_Curseur ); GetScreen()->m_Curseur );
if( slabel ) if( slabel )
DrawStruct = slabel; DrawStruct = slabel;
} }
@ -134,8 +134,8 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
{ {
if( DrawStruct && DrawStruct->m_Flags ) if( DrawStruct && DrawStruct->m_Flags )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
} }
} }
@ -149,7 +149,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
return true; return true;
} }
GetScreen()->SetCurItem( DrawStruct ); GetScreen()->SetCurItem( DrawStruct );
int flags = DrawStruct->m_Flags; int flags = DrawStruct->m_Flags;
bool is_new = (flags & IS_NEW) ? TRUE : FALSE; bool is_new = (flags & IS_NEW) ? TRUE : FALSE;
@ -182,20 +182,20 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "delete Marker" ), delete_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "delete Marker" ), delete_xpm );
break; break;
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
AddMenusForText( PopMenu, (DrawTextStruct*) DrawStruct ); AddMenusForText( PopMenu, (SCH_TEXT*) DrawStruct );
break; break;
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
AddMenusForLabel( PopMenu, (DrawLabelStruct*) DrawStruct ); AddMenusForLabel( PopMenu, (SCH_LABEL*) DrawStruct );
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
AddMenusForGLabel( PopMenu, (DrawGlobalLabelStruct*) DrawStruct ); AddMenusForGLabel( PopMenu, (SCH_GLOBALLABEL*) DrawStruct );
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
AddMenusForHLabel( PopMenu, (DrawHierLabelStruct*) DrawStruct ); AddMenusForHLabel( PopMenu, (SCH_HIERLABEL*) DrawStruct );
break; break;
case DRAW_PART_TEXT_STRUCT_TYPE: case DRAW_PART_TEXT_STRUCT_TYPE:
@ -205,17 +205,17 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
break; break;
// Many fields are inside a component. If this is the case, add the component menu // Many fields are inside a component. If this is the case, add the component menu
EDA_SchComponentStruct* Component = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); SCH_COMPONENT* Component = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if( Component ) if( Component )
{ {
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
AddMenusForComponent( PopMenu, (EDA_SchComponentStruct*) DrawStruct ); AddMenusForComponent( PopMenu, (SCH_COMPONENT*) DrawStruct );
} }
} }
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
AddMenusForComponent( PopMenu, (EDA_SchComponentStruct*) DrawStruct ); AddMenusForComponent( PopMenu, (SCH_COMPONENT*) DrawStruct );
break; break;
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
@ -259,7 +259,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
} }
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
return true; return true;
} }
@ -278,7 +278,7 @@ void AddMenusForComponentField( wxMenu* PopMenu, PartTextStruct* Field )
/**************************************************************************/ /**************************************************************************/
void AddMenusForComponent( wxMenu* PopMenu, EDA_SchComponentStruct* Component ) void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
/**************************************************************************/ /**************************************************************************/
/* Add menu commands for a component /* Add menu commands for a component
@ -321,13 +321,13 @@ void AddMenusForComponent( wxMenu* PopMenu, EDA_SchComponentStruct* Component )
if( LibEntry && LibEntry->m_Options != ENTRY_POWER ) if( LibEntry && LibEntry->m_Options != ENTRY_POWER )
{ {
msg = AddHotkeyName( _( "Value " ), s_Schematic_Hokeys_Descr, HK_EDIT_COMPONENT_VALUE ); msg = AddHotkeyName( _( "Value " ), s_Schematic_Hokeys_Descr, HK_EDIT_COMPONENT_VALUE );
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_VALUE_CMP, msg, edit_comp_value_xpm ); ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_VALUE_CMP, msg, edit_comp_value_xpm );
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_REF_CMP, _( "Reference" ), edit_comp_ref_xpm ); ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_REF_CMP, _( "Reference" ), edit_comp_ref_xpm );
msg = AddHotkeyName( _( "Footprint " ), s_Schematic_Hokeys_Descr, HK_EDIT_COMPONENT_FOOTPRINT ); msg = AddHotkeyName( _( "Footprint " ), s_Schematic_Hokeys_Descr, HK_EDIT_COMPONENT_FOOTPRINT );
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_FOOTPRINT_CMP, msg, edit_comp_footprint_xpm ); ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_FOOTPRINT_CMP, msg, edit_comp_footprint_xpm );
} }
if( LibEntry && (LookForConvertPart( LibEntry ) >= 2) ) if( LibEntry && (LookForConvertPart( LibEntry ) >= 2) )
editmenu->Append( ID_POPUP_SCH_EDIT_CONVERT_CMP, _( "Convert" ) ); editmenu->Append( ID_POPUP_SCH_EDIT_CONVERT_CMP, _( "Convert" ) );
@ -363,7 +363,7 @@ void AddMenusForComponent( wxMenu* PopMenu, EDA_SchComponentStruct* Component )
/*******************************************************************/ /*******************************************************************/
void AddMenusForGLabel( wxMenu* PopMenu, DrawGlobalLabelStruct* GLabel ) void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel )
/*******************************************************************/ /*******************************************************************/
/* Add menu commands for a Global Label /* Add menu commands for a Global Label
@ -388,7 +388,7 @@ void AddMenusForGLabel( wxMenu* PopMenu, DrawGlobalLabelStruct* GLabel )
ID_POPUP_SCH_CHANGE_TYPE_TEXT, _( "Change Type" ), gl_change_xpm ); ID_POPUP_SCH_CHANGE_TYPE_TEXT, _( "Change Type" ), gl_change_xpm );
} }
/*******************************************************************/ /*******************************************************************/
void AddMenusForHLabel( wxMenu* PopMenu, DrawHierLabelStruct* HLabel ) void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
/*******************************************************************/ /*******************************************************************/
/* Add menu commands for a hierarchal Label /* Add menu commands for a hierarchal Label
*/ */
@ -414,7 +414,7 @@ void AddMenusForHLabel( wxMenu* PopMenu, DrawHierLabelStruct* HLabel )
/*****************************************************************/ /*****************************************************************/
void AddMenusForLabel( wxMenu* PopMenu, DrawLabelStruct* Label ) void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
/*****************************************************************/ /*****************************************************************/
/* Add menu commands for a Label /* Add menu commands for a Label
@ -441,7 +441,7 @@ void AddMenusForLabel( wxMenu* PopMenu, DrawLabelStruct* Label )
/*****************************************************************/ /*****************************************************************/
void AddMenusForText( wxMenu* PopMenu, DrawTextStruct* Text ) void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
/*****************************************************************/ /*****************************************************************/
/* Add menu commands for a Text (a comment) /* Add menu commands for a Text (a comment)

View File

@ -16,7 +16,7 @@
/* Variables locales : */ /* Variables locales : */
static void PlotSheetLabelStruct( DrawSheetLabelStruct* Struct ); static void PlotSheetLabelStruct( DrawSheetLabelStruct* Struct );
static void PlotTextField( EDA_SchComponentStruct* DrawLibItem, static void PlotTextField( SCH_COMPONENT* DrawLibItem,
int FieldNumber, int IsMulti, int DrawMode ); int FieldNumber, int IsMulti, int DrawMode );
static void PlotPinSymbol( int posX, int posY, int len, int orient, int Shape ); static void PlotPinSymbol( int posX, int posY, int len, int orient, int Shape );
@ -164,7 +164,7 @@ void PlotNoConnectStruct( DrawNoConnectStruct* Struct )
/*************************************************/ /*************************************************/
void PlotLibPart( EDA_SchComponentStruct* DrawLibItem ) void PlotLibPart( SCH_COMPONENT* DrawLibItem )
/*************************************************/ /*************************************************/
/* Genere le trace d'un composant */ /* Genere le trace d'un composant */
{ {
@ -342,7 +342,7 @@ void PlotLibPart( EDA_SchComponentStruct* DrawLibItem )
/*************************************************************/ /*************************************************************/
static void PlotTextField( EDA_SchComponentStruct* DrawLibItem, static void PlotTextField( SCH_COMPONENT* DrawLibItem,
int FieldNumber, int IsMulti, int DrawMode ) int FieldNumber, int IsMulti, int DrawMode )
/**************************************************************/ /**************************************************************/
@ -553,22 +553,22 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
switch( Struct->Type() ) switch( Struct->Type() )
{ {
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
Text = ( (DrawTextStruct*) Struct )->m_Text; Text = ( (SCH_TEXT*) Struct )->m_Text;
Size = ( (DrawTextStruct*) Struct )->m_Size; Size = ( (SCH_TEXT*) Struct )->m_Size;
Orient = ( (DrawTextStruct*) Struct )->m_Orient; Orient = ( (SCH_TEXT*) Struct )->m_Orient;
Shape = ( (DrawTextStruct*) Struct )->m_Shape; Shape = ( (SCH_TEXT*) Struct )->m_Shape;
pX = ( (DrawTextStruct*) Struct )->m_Pos.x; pX = ( (SCH_TEXT*) Struct )->m_Pos.x;
pY = ( (DrawTextStruct*) Struct )->m_Pos.y; pY = ( (SCH_TEXT*) Struct )->m_Pos.y;
offset = TXTMARGE; offset = TXTMARGE;
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE if( Struct->Type() == TYPE_SCH_GLOBALLABEL
|| Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE ) || Struct->Type() == TYPE_SCH_HIERLABEL )
offset += Size.x; // We must draw the Glabel graphic symbol offset += Size.x; // We must draw the Glabel graphic symbol
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
color = ReturnLayerColor( ( (DrawTextStruct*) Struct )->m_Layer ); color = ReturnLayerColor( ( (SCH_TEXT*) Struct )->m_Layer );
break; break;
default: default:
@ -580,31 +580,31 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
SetCurrentLineWidth( -1 ); SetCurrentLineWidth( -1 );
if ( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ) if ( Struct->Type() == TYPE_SCH_GLOBALLABEL )
{ {
offset = ( (DrawGlobalLabelStruct*) Struct )->m_Width; offset = ( (SCH_GLOBALLABEL*) Struct )->m_Width;
switch( Shape ) switch( Shape )
{ {
case NET_INPUT: case NET_INPUT:
case NET_BIDI: case NET_BIDI:
case NET_TRISTATE: case NET_TRISTATE:
offset += Size.x/2; offset += Size.x/2;
break; break;
case NET_OUTPUT: case NET_OUTPUT:
offset += TXTMARGE; offset += TXTMARGE;
break; break;
default: default:
break; break;
} }
} }
switch( Orient ) switch( Orient )
{ {
case 0: /* Orientation horiz normale */ case 0: /* Orientation horiz normale */
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE || Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE ) if( Struct->Type() == TYPE_SCH_GLOBALLABEL || Struct->Type() == TYPE_SCH_HIERLABEL )
PlotGraphicText( g_PlotFormat, wxPoint( pX - offset, pY ), PlotGraphicText( g_PlotFormat, wxPoint( pX - offset, pY ),
color, Text, TEXT_ORIENT_HORIZ, Size, color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER ); GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER );
@ -615,7 +615,7 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
break; break;
case 1: /* Orientation vert UP */ case 1: /* Orientation vert UP */
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE || Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE ) if( Struct->Type() == TYPE_SCH_GLOBALLABEL || Struct->Type() == TYPE_SCH_HIERLABEL )
PlotGraphicText( g_PlotFormat, wxPoint( pX, pY + offset ), PlotGraphicText( g_PlotFormat, wxPoint( pX, pY + offset ),
color, Text, TEXT_ORIENT_VERT, Size, color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP ); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP );
@ -626,7 +626,7 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
break; break;
case 2: /* Horiz Orientation - Right justified */ case 2: /* Horiz Orientation - Right justified */
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE || Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE ) if( Struct->Type() == TYPE_SCH_GLOBALLABEL || Struct->Type() == TYPE_SCH_HIERLABEL )
PlotGraphicText( g_PlotFormat, wxPoint( pX + offset, pY ), PlotGraphicText( g_PlotFormat, wxPoint( pX + offset, pY ),
color, Text, TEXT_ORIENT_HORIZ, Size, color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER ); GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER );
@ -637,7 +637,7 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
break; break;
case 3: /* Orientation vert BOTTOM */ case 3: /* Orientation vert BOTTOM */
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE || Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE ) if( Struct->Type() == TYPE_SCH_GLOBALLABEL || Struct->Type() == TYPE_SCH_HIERLABEL )
PlotGraphicText( g_PlotFormat, wxPoint( pX, pY - offset ), PlotGraphicText( g_PlotFormat, wxPoint( pX, pY - offset ),
color, Text, TEXT_ORIENT_VERT, Size, color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM ); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM );
@ -649,14 +649,14 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
} }
/* Draw graphic symbol for global or hierachical labels */ /* Draw graphic symbol for global or hierachical labels */
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ) if( Struct->Type() == TYPE_SCH_GLOBALLABEL )
{ {
( (DrawGlobalLabelStruct*) Struct )->CreateGraphicShape( Poly, wxPoint(pX, pY) ); ( (SCH_GLOBALLABEL*) Struct )->CreateGraphicShape( Poly, wxPoint(pX, pY) );
PlotPoly( Poly[0], Poly + 1, NOFILL ); PlotPoly( Poly[0], Poly + 1, NOFILL );
} }
if( Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE ) if( Struct->Type() == TYPE_SCH_HIERLABEL )
{ {
( (DrawHierLabelStruct*) Struct )->CreateGraphicShape( Poly, wxPoint(pX, pY) ); ( (SCH_HIERLABEL*) Struct )->CreateGraphicShape( Poly, wxPoint(pX, pY) );
PlotPoly( Poly[0], Poly + 1, NOFILL ); PlotPoly( Poly[0], Poly + 1, NOFILL );
} }
} }

View File

@ -62,34 +62,34 @@ static double Scale_Y = 1;
int HPGL_SizeSelect; int HPGL_SizeSelect;
enum PageFormatReq { enum PageFormatReq {
PAGE_DEFAULT = 0, PAGE_DEFAULT = 0,
PAGE_SIZE_A4, PAGE_SIZE_A4,
PAGE_SIZE_A3, PAGE_SIZE_A3,
PAGE_SIZE_A2, PAGE_SIZE_A2,
PAGE_SIZE_A1, PAGE_SIZE_A1,
PAGE_SIZE_A0, PAGE_SIZE_A0,
PAGE_SIZE_A, PAGE_SIZE_A,
PAGE_SIZE_B, PAGE_SIZE_B,
PAGE_SIZE_C, PAGE_SIZE_C,
PAGE_SIZE_D, PAGE_SIZE_D,
PAGE_SIZE_E PAGE_SIZE_E
}; };
static Ki_PageDescr * Plot_sheet_list[] = static Ki_PageDescr * Plot_sheet_list[] =
{ {
NULL, NULL,
&g_Sheet_A4, &g_Sheet_A4,
&g_Sheet_A3, &g_Sheet_A3,
&g_Sheet_A2, &g_Sheet_A2,
&g_Sheet_A1, &g_Sheet_A1,
&g_Sheet_A0, &g_Sheet_A0,
&g_Sheet_A, &g_Sheet_A,
&g_Sheet_B, &g_Sheet_B,
&g_Sheet_C, &g_Sheet_C,
&g_Sheet_D, &g_Sheet_D,
&g_Sheet_E, &g_Sheet_E,
&g_Sheet_GERBER, &g_Sheet_GERBER,
&g_Sheet_user &g_Sheet_user
}; };
/* Routines Locales */ /* Routines Locales */
@ -101,9 +101,9 @@ static Ki_PageDescr * Plot_sheet_list[] =
void WinEDA_SchematicFrame::ToPlot_HPGL(wxCommandEvent& event) void WinEDA_SchematicFrame::ToPlot_HPGL(wxCommandEvent& event)
/**************************************************************/ /**************************************************************/
{ {
WinEDA_PlotHPGLFrame * HPGL_frame = new WinEDA_PlotHPGLFrame(this); WinEDA_PlotHPGLFrame * HPGL_frame = new WinEDA_PlotHPGLFrame(this);
HPGL_frame->ShowModal(); HPGL_frame->ShowModal();
HPGL_frame->Destroy(); HPGL_frame->Destroy();
} }
/*! /*!
@ -149,9 +149,9 @@ WinEDA_PlotHPGLFrame::WinEDA_PlotHPGLFrame( )
WinEDA_PlotHPGLFrame::WinEDA_PlotHPGLFrame( WinEDA_DrawFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) WinEDA_PlotHPGLFrame::WinEDA_PlotHPGLFrame( WinEDA_DrawFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{ {
m_Parent = parent; m_Parent = parent;
Create(parent, id, caption, pos, size, style); Create(parent, id, caption, pos, size, style);
SetPageOffsetValue(); SetPageOffsetValue();
} }
/*! /*!
@ -188,7 +188,7 @@ bool WinEDA_PlotHPGLFrame::Create( wxWindow* parent, wxWindowID id, const wxStri
void WinEDA_PlotHPGLFrame::CreateControls() void WinEDA_PlotHPGLFrame::CreateControls()
{ {
SetFont(*g_DialogFont); SetFont(*g_DialogFont);
////@begin WinEDA_PlotHPGLFrame content construction ////@begin WinEDA_PlotHPGLFrame content construction
// Generated by DialogBlocks, 04/02/2006 16:54:19 (unregistered) // Generated by DialogBlocks, 04/02/2006 16:54:19 (unregistered)
@ -303,7 +303,7 @@ void WinEDA_PlotHPGLFrame::CreateControls()
void WinEDA_PlotHPGLFrame::OnPlotHpglCurrentExecuteClick( wxCommandEvent& event ) void WinEDA_PlotHPGLFrame::OnPlotHpglCurrentExecuteClick( wxCommandEvent& event )
{ {
HPGL_Plot(event); HPGL_Plot(event);
} }
/*! /*!
@ -312,7 +312,7 @@ void WinEDA_PlotHPGLFrame::OnPlotHpglCurrentExecuteClick( wxCommandEvent& event
void WinEDA_PlotHPGLFrame::OnPlotHpglAllExecuteClick( wxCommandEvent& event ) void WinEDA_PlotHPGLFrame::OnPlotHpglAllExecuteClick( wxCommandEvent& event )
{ {
HPGL_Plot(event); HPGL_Plot(event);
} }
/*! /*!
@ -333,7 +333,7 @@ void WinEDA_PlotHPGLFrame::OnCancelClick( wxCommandEvent& event )
void WinEDA_PlotHPGLFrame::OnPlotAcceptOffsetClick( wxCommandEvent& event ) void WinEDA_PlotHPGLFrame::OnPlotAcceptOffsetClick( wxCommandEvent& event )
{ {
AcceptPlotOffset(event); AcceptPlotOffset(event);
} }
/*! /*!
@ -378,24 +378,24 @@ void WinEDA_PlotHPGLFrame::SetPageOffsetValue()
/***************************************************/ /***************************************************/
{ {
wxString msg; wxString msg;
if ( HPGL_SizeSelect != PAGE_DEFAULT ) if ( HPGL_SizeSelect != PAGE_DEFAULT )
{ {
msg = ReturnStringFromValue(g_UnitMetric, msg = ReturnStringFromValue(g_UnitMetric,
Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x, EESCHEMA_INTERNAL_UNIT); Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x, EESCHEMA_INTERNAL_UNIT);
m_PlotOrgPosition_X->SetValue(msg); m_PlotOrgPosition_X->SetValue(msg);
msg = ReturnStringFromValue(g_UnitMetric, msg = ReturnStringFromValue(g_UnitMetric,
Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y, EESCHEMA_INTERNAL_UNIT); Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y, EESCHEMA_INTERNAL_UNIT);
m_PlotOrgPosition_Y->SetValue(msg); m_PlotOrgPosition_Y->SetValue(msg);
m_PlotOrgPosition_X->Enable(TRUE); m_PlotOrgPosition_X->Enable(TRUE);
m_PlotOrgPosition_Y->Enable(TRUE); m_PlotOrgPosition_Y->Enable(TRUE);
} }
else else
{ {
m_PlotOrgPosition_X->Enable(FALSE); m_PlotOrgPosition_X->Enable(FALSE);
m_PlotOrgPosition_Y->Enable(FALSE); m_PlotOrgPosition_Y->Enable(FALSE);
} }
} }
/*****************************************************************/ /*****************************************************************/
@ -404,18 +404,18 @@ void WinEDA_PlotHPGLFrame::AcceptPlotOffset(wxCommandEvent& event)
{ {
int ii = m_SizeOption->GetSelection(); int ii = m_SizeOption->GetSelection();
if ( ii <= 0 ) HPGL_SizeSelect = 0; if ( ii <= 0 ) HPGL_SizeSelect = 0;
else HPGL_SizeSelect = ii; else HPGL_SizeSelect = ii;
if ( HPGL_SizeSelect != PAGE_DEFAULT) if ( HPGL_SizeSelect != PAGE_DEFAULT)
{ {
wxString msg = m_PlotOrgPosition_X->GetValue(); wxString msg = m_PlotOrgPosition_X->GetValue();
Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x = Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x =
ReturnValueFromString(g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT); ReturnValueFromString(g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT);
msg = m_PlotOrgPosition_Y->GetValue(); msg = m_PlotOrgPosition_Y->GetValue();
Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y = Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y =
ReturnValueFromString(g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT); ReturnValueFromString(g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT);
} }
} }
@ -423,9 +423,9 @@ int ii = m_SizeOption->GetSelection();
void WinEDA_PlotHPGLFrame::SetPenWidth(wxSpinEvent & event) void WinEDA_PlotHPGLFrame::SetPenWidth(wxSpinEvent & event)
/************************************************************/ /************************************************************/
{ {
g_HPGL_Pen_Descr.m_Pen_Diam = m_ButtPenWidth->GetValue(); g_HPGL_Pen_Descr.m_Pen_Diam = m_ButtPenWidth->GetValue();
if ( g_HPGL_Pen_Descr.m_Pen_Diam > 100 ) g_HPGL_Pen_Descr.m_Pen_Diam = 100; if ( g_HPGL_Pen_Descr.m_Pen_Diam > 100 ) g_HPGL_Pen_Descr.m_Pen_Diam = 100;
if ( g_HPGL_Pen_Descr.m_Pen_Diam < 1 ) g_HPGL_Pen_Descr.m_Pen_Diam = 1; if ( g_HPGL_Pen_Descr.m_Pen_Diam < 1 ) g_HPGL_Pen_Descr.m_Pen_Diam = 1;
} }
@ -433,18 +433,18 @@ void WinEDA_PlotHPGLFrame::SetPenWidth(wxSpinEvent & event)
void WinEDA_PlotHPGLFrame::SetPenSpeed(wxSpinEvent& event) void WinEDA_PlotHPGLFrame::SetPenSpeed(wxSpinEvent& event)
/*********************************************************/ /*********************************************************/
{ {
g_HPGL_Pen_Descr.m_Pen_Speed = m_ButtPenSpeed->GetValue(); g_HPGL_Pen_Descr.m_Pen_Speed = m_ButtPenSpeed->GetValue();
if ( g_HPGL_Pen_Descr.m_Pen_Speed > 40 ) g_HPGL_Pen_Descr.m_Pen_Speed = 40; if ( g_HPGL_Pen_Descr.m_Pen_Speed > 40 ) g_HPGL_Pen_Descr.m_Pen_Speed = 40;
if ( g_HPGL_Pen_Descr.m_Pen_Speed < 1 ) g_HPGL_Pen_Descr.m_Pen_Speed = 1; if ( g_HPGL_Pen_Descr.m_Pen_Speed < 1 ) g_HPGL_Pen_Descr.m_Pen_Speed = 1;
} }
/*******************************************************/ /*******************************************************/
void WinEDA_PlotHPGLFrame::SetPenNum(wxSpinEvent& event) void WinEDA_PlotHPGLFrame::SetPenNum(wxSpinEvent& event)
/*******************************************************/ /*******************************************************/
{ {
g_HPGL_Pen_Descr.m_Pen_Num = m_ButtPenNum->GetValue(); g_HPGL_Pen_Descr.m_Pen_Num = m_ButtPenNum->GetValue();
if ( g_HPGL_Pen_Descr.m_Pen_Num > 8 ) g_HPGL_Pen_Descr.m_Pen_Num = 8; if ( g_HPGL_Pen_Descr.m_Pen_Num > 8 ) g_HPGL_Pen_Descr.m_Pen_Num = 8;
if ( g_HPGL_Pen_Descr.m_Pen_Num < 1 ) g_HPGL_Pen_Descr.m_Pen_Num = 1; if ( g_HPGL_Pen_Descr.m_Pen_Num < 1 ) g_HPGL_Pen_Descr.m_Pen_Num = 1;
} }
@ -454,37 +454,37 @@ void WinEDA_PlotHPGLFrame::HPGL_Plot(wxCommandEvent& event)
{ {
int Select_PlotAll = FALSE; int Select_PlotAll = FALSE;
if( event.GetId() == ID_PLOT_HPGL_ALL_EXECUTE ) Select_PlotAll = TRUE; if( event.GetId() == ID_PLOT_HPGL_ALL_EXECUTE ) Select_PlotAll = TRUE;
if ( HPGL_SizeSelect ) if ( HPGL_SizeSelect )
{ {
wxString msg = m_PlotOrgPosition_X->GetValue(); wxString msg = m_PlotOrgPosition_X->GetValue();
Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x = Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x =
ReturnValueFromString(g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT); ReturnValueFromString(g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT);
msg = m_PlotOrgPosition_Y->GetValue(); msg = m_PlotOrgPosition_Y->GetValue();
Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y = Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y =
ReturnValueFromString(g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT); ReturnValueFromString(g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT);
} }
Plot_Schematic_HPGL(Select_PlotAll, HPGL_SizeSelect); Plot_Schematic_HPGL(Select_PlotAll, HPGL_SizeSelect);
} }
/*******************************************************************/ /*******************************************************************/
void WinEDA_PlotHPGLFrame::ReturnSheetDims( BASE_SCREEN * screen, void WinEDA_PlotHPGLFrame::ReturnSheetDims( BASE_SCREEN * screen,
wxSize & SheetSize, wxPoint & SheetOffset) wxSize & SheetSize, wxPoint & SheetOffset)
/*******************************************************************/ /*******************************************************************/
/* Fonction calculant les dims et offsets de trace de la feuille selectionnee /* Fonction calculant les dims et offsets de trace de la feuille selectionnee
retourne: retourne:
*/ */
{ {
Ki_PageDescr * PlotSheet; Ki_PageDescr * PlotSheet;
if( screen == NULL ) screen = m_Parent->GetScreen(); if( screen == NULL ) screen = m_Parent->GetScreen();
PlotSheet = screen->m_CurrentSheetDesc; PlotSheet = screen->m_CurrentSheetDesc;
SheetSize = PlotSheet->m_Size; SheetSize = PlotSheet->m_Size;
SheetOffset = PlotSheet->m_Offset; SheetOffset = PlotSheet->m_Offset;
} }
/***********************************************************************************/ /***********************************************************************************/
@ -498,182 +498,182 @@ wxSize SheetSize;
wxPoint SheetOffset, PlotOffset; wxPoint SheetOffset, PlotOffset;
int margin; int margin;
g_PlotFormat = PLOT_FORMAT_HPGL; g_PlotFormat = PLOT_FORMAT_HPGL;
/* Build the screen list */ /* Build the screen list */
EDA_ScreenList ScreenList; EDA_ScreenList ScreenList;
if ( Select_PlotAll == TRUE ) screen = ScreenList.GetFirst(); if ( Select_PlotAll == TRUE ) screen = ScreenList.GetFirst();
else screen = m_Parent->GetScreen(); else screen = m_Parent->GetScreen();
for ( ; screen != NULL; screen = ScreenList.GetNext() ) for ( ; screen != NULL; screen = ScreenList.GetNext() )
{ {
ReturnSheetDims(screen, SheetSize, SheetOffset); ReturnSheetDims(screen, SheetSize, SheetOffset);
/* Calcul des echelles de conversion */ /* Calcul des echelles de conversion */
g_PlotScaleX = Scale_X * SCALE_HPGL ; g_PlotScaleX = Scale_X * SCALE_HPGL ;
g_PlotScaleY = Scale_Y * SCALE_HPGL ; g_PlotScaleY = Scale_Y * SCALE_HPGL ;
margin = 400; // Margin in mils margin = 400; // Margin in mils
PlotSheet = screen->m_CurrentSheetDesc; PlotSheet = screen->m_CurrentSheetDesc;
g_PlotScaleX = g_PlotScaleX * (SheetSize.x - 2 * margin)/ PlotSheet->m_Size.x; g_PlotScaleX = g_PlotScaleX * (SheetSize.x - 2 * margin)/ PlotSheet->m_Size.x;
g_PlotScaleY = g_PlotScaleY * (SheetSize.y - 2 * margin) / PlotSheet->m_Size.y; g_PlotScaleY = g_PlotScaleY * (SheetSize.y - 2 * margin) / PlotSheet->m_Size.y;
/* calcul des offsets */ /* calcul des offsets */
PlotOffset.x = - (int)(SheetOffset.x * SCALE_HPGL); PlotOffset.x = - (int)(SheetOffset.x * SCALE_HPGL);
PlotOffset.y = (int)( (SheetOffset.y + SheetSize.y) * SCALE_HPGL); PlotOffset.y = (int)( (SheetOffset.y + SheetSize.y) * SCALE_HPGL);
PlotOffset.x -= (int)(margin * SCALE_HPGL); PlotOffset.x -= (int)(margin * SCALE_HPGL);
PlotOffset.y += (int)(margin * SCALE_HPGL); PlotOffset.y += (int)(margin * SCALE_HPGL);
wxSplitPath(screen->m_FileName.GetData(), (wxString*) NULL, wxSplitPath(screen->m_FileName.GetData(), (wxString*) NULL,
&ShortFileName, (wxString*) NULL); &ShortFileName, (wxString*) NULL);
wxString dirbuf = wxGetCwd() + STRING_DIR_SEP; wxString dirbuf = wxGetCwd() + STRING_DIR_SEP;
if( ! ShortFileName.IsEmpty() ) if( ! ShortFileName.IsEmpty() )
PlotFileName = MakeFileName(dirbuf, ShortFileName, wxT(".plt")); PlotFileName = MakeFileName(dirbuf, ShortFileName, wxT(".plt"));
else PlotFileName = MakeFileName(dirbuf, g_DefaultSchematicFileName, wxT(".plt")); else PlotFileName = MakeFileName(dirbuf, g_DefaultSchematicFileName, wxT(".plt"));
setlocale(LC_NUMERIC, "C"); setlocale(LC_NUMERIC, "C");
InitPlotParametresHPGL(PlotOffset, g_PlotScaleX, g_PlotScaleY); InitPlotParametresHPGL(PlotOffset, g_PlotScaleX, g_PlotScaleY);
Plot_1_Page_HPGL(PlotFileName,screen); Plot_1_Page_HPGL(PlotFileName,screen);
setlocale(LC_NUMERIC, ""); setlocale(LC_NUMERIC, "");
screen = (BASE_SCREEN*)screen->Pnext; screen = (BASE_SCREEN*)screen->Pnext;
if ( Select_PlotAll == FALSE ) break; if ( Select_PlotAll == FALSE ) break;
} }
m_MsgBox->AppendText(_("** Plot End **\n")); m_MsgBox->AppendText(_("** Plot End **\n"));
} }
/**************************************************************************/ /**************************************************************************/
void WinEDA_PlotHPGLFrame::Plot_1_Page_HPGL(const wxString & FullFileName, void WinEDA_PlotHPGLFrame::Plot_1_Page_HPGL(const wxString & FullFileName,
BASE_SCREEN * screen) BASE_SCREEN * screen)
/**************************************************************************/ /**************************************************************************/
/* Trace en format HPGL. d'une feuille de dessin /* Trace en format HPGL. d'une feuille de dessin
1 unite HPGL = 0.98 mils ( 1 mil = 1.02041 unite HPGL ) . 1 unite HPGL = 0.98 mils ( 1 mil = 1.02041 unite HPGL ) .
*/ */
{ {
EDA_BaseStruct *DrawList; EDA_BaseStruct *DrawList;
EDA_SchComponentStruct *DrawLibItem; SCH_COMPONENT *DrawLibItem;
int x1=0, y1=0, x2=0, y2=0, layer; int x1=0, y1=0, x2=0, y2=0, layer;
wxString msg; wxString msg;
PlotOutput = wxFopen(FullFileName, wxT("wt")); PlotOutput = wxFopen(FullFileName, wxT("wt"));
if (PlotOutput == 0) if (PlotOutput == 0)
{ {
msg = _("Unable to create ") + FullFileName; msg = _("Unable to create ") + FullFileName;
DisplayError(this, msg); return ; DisplayError(this, msg); return ;
} }
msg = _("Plot ") + FullFileName + wxT("\n"); msg = _("Plot ") + FullFileName + wxT("\n");
m_MsgBox->AppendText(msg); m_MsgBox->AppendText(msg);
/* Init : */ /* Init : */
PrintHeaderHPGL(PlotOutput, g_HPGL_Pen_Descr.m_Pen_Speed, g_HPGL_Pen_Descr.m_Pen_Num); PrintHeaderHPGL(PlotOutput, g_HPGL_Pen_Descr.m_Pen_Speed, g_HPGL_Pen_Descr.m_Pen_Num);
PlotWorkSheet(PLOT_FORMAT_HPGL, screen); PlotWorkSheet(PLOT_FORMAT_HPGL, screen);
DrawList = screen->EEDrawList; DrawList = screen->EEDrawList;
while ( DrawList ) /* tracage */ while ( DrawList ) /* tracage */
{ {
Plume('U'); Plume('U');
layer = LAYER_NOTES; layer = LAYER_NOTES;
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
case DRAW_BUSENTRY_STRUCT_TYPE : case DRAW_BUSENTRY_STRUCT_TYPE :
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawBusEntryStruct*)DrawList) #define STRUCT ((DrawBusEntryStruct*)DrawList)
x1 = STRUCT->m_Pos.x; y1 = STRUCT->m_Pos.y; x1 = STRUCT->m_Pos.x; y1 = STRUCT->m_Pos.y;
x2 = STRUCT->m_End().x; y2 = STRUCT->m_End().y; x2 = STRUCT->m_End().x; y2 = STRUCT->m_End().y;
layer = STRUCT->m_Layer; layer = STRUCT->m_Layer;
case DRAW_SEGMENT_STRUCT_TYPE : case DRAW_SEGMENT_STRUCT_TYPE :
#undef STRUCT #undef STRUCT
#define STRUCT ((EDA_DrawLineStruct*)DrawList) #define STRUCT ((EDA_DrawLineStruct*)DrawList)
if ( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE) if ( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE)
{ {
x1 = STRUCT->m_Start.x; y1 = STRUCT->m_Start.y; x1 = STRUCT->m_Start.x; y1 = STRUCT->m_Start.y;
x2 = STRUCT->m_End.x; y2 = STRUCT->m_End.y; x2 = STRUCT->m_End.x; y2 = STRUCT->m_End.y;
layer = STRUCT->m_Layer; layer = STRUCT->m_Layer;
} }
switch (layer) switch (layer)
{ {
case LAYER_NOTES: /* Trace en pointilles */ case LAYER_NOTES: /* Trace en pointilles */
Move_Plume( wxPoint(x1,y1),'U'); Move_Plume( wxPoint(x1,y1),'U');
fprintf(PlotOutput,"LT 2;\n"); fprintf(PlotOutput,"LT 2;\n");
Move_Plume( wxPoint(x2,y2),'D'); Move_Plume( wxPoint(x2,y2),'D');
fprintf(PlotOutput,"LT;\n"); fprintf(PlotOutput,"LT;\n");
break; break;
case LAYER_BUS: /* Trait large */ case LAYER_BUS: /* Trait large */
{ {
int deltaX = 0, deltaY = 0; double angle; int deltaX = 0, deltaY = 0; double angle;
if( (x2 - x1) == 0 ) deltaX = 8; if( (x2 - x1) == 0 ) deltaX = 8;
else if( (y2 - y1) == 0 ) deltaY = 8; else if( (y2 - y1) == 0 ) deltaY = 8;
else else
{ {
angle = atan2( (double)(x2-x1), (double)(y1-y2) ); angle = atan2( (double)(x2-x1), (double)(y1-y2) );
deltaX = (int)( 8 * sin(angle) ); deltaX = (int)( 8 * sin(angle) );
deltaY = (int)( 8 * cos(angle) ); deltaY = (int)( 8 * cos(angle) );
} }
Move_Plume( wxPoint(x1 + deltaX, y1 - deltaY), 'U'); Move_Plume( wxPoint(x1 + deltaX, y1 - deltaY), 'U');
Move_Plume( wxPoint(x1 - deltaX,y1 + deltaY), 'D'); Move_Plume( wxPoint(x1 - deltaX,y1 + deltaY), 'D');
Move_Plume( wxPoint(x2 - deltaX,y2 + deltaY), 'D'); Move_Plume( wxPoint(x2 - deltaX,y2 + deltaY), 'D');
Move_Plume( wxPoint(x2 + deltaX,y2 - deltaY), 'D'); Move_Plume( wxPoint(x2 + deltaX,y2 - deltaY), 'D');
Move_Plume( wxPoint(x1 + deltaX,y1 - deltaY), 'D'); Move_Plume( wxPoint(x1 + deltaX,y1 - deltaY), 'D');
} }
break; break;
default: default:
Move_Plume( wxPoint(x1,y1), 'U'); Move_Plume( wxPoint(x1,y1), 'U');
Move_Plume( wxPoint(x2,y2), 'D'); Move_Plume( wxPoint(x2,y2), 'D');
break; break;
} }
break; break;
case DRAW_JUNCTION_STRUCT_TYPE : case DRAW_JUNCTION_STRUCT_TYPE :
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawJunctionStruct*)DrawList) #define STRUCT ((DrawJunctionStruct*)DrawList)
x1 = STRUCT->m_Pos.x; y1 = STRUCT->m_Pos.y; x1 = STRUCT->m_Pos.x; y1 = STRUCT->m_Pos.y;
PlotCercle( wxPoint(x1,y1), DRAWJUNCTION_SIZE * 2); PlotCercle( wxPoint(x1,y1), DRAWJUNCTION_SIZE * 2);
break; break;
case DRAW_TEXT_STRUCT_TYPE : case TYPE_SCH_TEXT :
case DRAW_LABEL_STRUCT_TYPE : case TYPE_SCH_LABEL :
case DRAW_GLOBAL_LABEL_STRUCT_TYPE : case TYPE_SCH_GLOBALLABEL :
case DRAW_HIER_LABEL_STRUCT_TYPE : case TYPE_SCH_HIERLABEL :
PlotTextStruct(DrawList); PlotTextStruct(DrawList);
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE : case TYPE_SCH_COMPONENT :
DrawLibItem = (EDA_SchComponentStruct *) DrawList; DrawLibItem = (SCH_COMPONENT *) DrawList;
PlotLibPart( DrawLibItem ); PlotLibPart( DrawLibItem );
break; break;
case DRAW_PICK_ITEM_STRUCT_TYPE : break; case DRAW_PICK_ITEM_STRUCT_TYPE : break;
case DRAW_POLYLINE_STRUCT_TYPE : break; case DRAW_POLYLINE_STRUCT_TYPE : break;
case DRAW_SHEETLABEL_STRUCT_TYPE : break; case DRAW_SHEETLABEL_STRUCT_TYPE : break;
case DRAW_MARKER_STRUCT_TYPE : break; case DRAW_MARKER_STRUCT_TYPE : break;
case DRAW_SHEET_STRUCT_TYPE : case DRAW_SHEET_STRUCT_TYPE :
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawSheetStruct*)DrawList) #define STRUCT ((DrawSheetStruct*)DrawList)
PlotSheetStruct(STRUCT); PlotSheetStruct(STRUCT);
break; break;
case DRAW_NOCONNECT_STRUCT_TYPE: case DRAW_NOCONNECT_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawNoConnectStruct*)DrawList) #define STRUCT ((DrawNoConnectStruct*)DrawList)
PlotNoConnectStruct(STRUCT); PlotNoConnectStruct(STRUCT);
break; break;
default : default :
break; break;
} }
Plume('U'); Plume('U');
DrawList = DrawList->Pnext; DrawList = DrawList->Pnext;
} }
/* fin */ /* fin */
CloseFileHPGL(PlotOutput); CloseFileHPGL(PlotOutput);
} }
/*! /*!
@ -682,8 +682,8 @@ wxString msg;
void WinEDA_PlotHPGLFrame::OnRadioboxSelected( wxCommandEvent& event ) void WinEDA_PlotHPGLFrame::OnRadioboxSelected( wxCommandEvent& event )
{ {
HPGL_SizeSelect = m_SizeOption->GetSelection(); HPGL_SizeSelect = m_SizeOption->GetSelection();
SetPageOffsetValue(); SetPageOffsetValue();
} }
@ -695,7 +695,7 @@ void WinEDA_PlotHPGLFrame::OnRadioboxSelected( wxCommandEvent& event )
void WinEDA_PlotHPGLFrame::OnPenWidthUpdatedUpdated( wxSpinEvent& event ) void WinEDA_PlotHPGLFrame::OnPenWidthUpdatedUpdated( wxSpinEvent& event )
{ {
SetPenWidth(event); SetPenWidth(event);
} }
/*! /*!
@ -704,7 +704,7 @@ void WinEDA_PlotHPGLFrame::OnPenWidthUpdatedUpdated( wxSpinEvent& event )
void WinEDA_PlotHPGLFrame::OnPenSpeedUpdatedUpdated( wxSpinEvent& event ) void WinEDA_PlotHPGLFrame::OnPenSpeedUpdatedUpdated( wxSpinEvent& event )
{ {
SetPenSpeed(event); SetPenSpeed(event);
} }
/*! /*!
@ -713,6 +713,6 @@ void WinEDA_PlotHPGLFrame::OnPenSpeedUpdatedUpdated( wxSpinEvent& event )
void WinEDA_PlotHPGLFrame::OnPenNumberUpdatedUpdated( wxSpinEvent& event ) void WinEDA_PlotHPGLFrame::OnPenNumberUpdatedUpdated( wxSpinEvent& event )
{ {
SetPenNum(event); SetPenNum(event);
} }

View File

@ -47,9 +47,9 @@ extern void Move_Plume( wxPoint pos, int plume );
extern void Plume( int plume ); extern void Plume( int plume );
enum PageFormatReq { enum PageFormatReq {
PAGE_SIZE_AUTO, PAGE_SIZE_AUTO,
PAGE_SIZE_A4, PAGE_SIZE_A4,
PAGE_SIZE_A PAGE_SIZE_A
}; };
@ -76,10 +76,10 @@ void WinEDA_SchematicFrame::ToPlot_PS(wxCommandEvent& event)
{ {
wxPoint pos; wxPoint pos;
pos = GetPosition(); pos = GetPosition();
pos.x += 10; pos.y += 20; pos.x += 10; pos.y += 20;
WinEDA_PlotPSFrame * Ps_frame = new WinEDA_PlotPSFrame(this); WinEDA_PlotPSFrame * Ps_frame = new WinEDA_PlotPSFrame(this);
Ps_frame->ShowModal(); Ps_frame->Destroy(); Ps_frame->ShowModal(); Ps_frame->Destroy();
} }
@ -154,7 +154,7 @@ bool WinEDA_PlotPSFrame::Create( wxWindow* parent, wxWindowID id, const wxString
void WinEDA_PlotPSFrame::CreateControls() void WinEDA_PlotPSFrame::CreateControls()
{ {
SetFont(*g_DialogFont); SetFont(*g_DialogFont);
////@begin WinEDA_PlotPSFrame content construction ////@begin WinEDA_PlotPSFrame content construction
// Generated by DialogBlocks, 22/01/2007 11:32:43 (unregistered) // Generated by DialogBlocks, 22/01/2007 11:32:43 (unregistered)
@ -226,8 +226,8 @@ void WinEDA_PlotPSFrame::CreateControls()
m_Plot_Sheet_Ref->SetValidator( wxGenericValidator(& Plot_Sheet_Ref) ); m_Plot_Sheet_Ref->SetValidator( wxGenericValidator(& Plot_Sheet_Ref) );
////@end WinEDA_PlotPSFrame content construction ////@end WinEDA_PlotPSFrame content construction
m_DefaultLineSizeCtrl = new WinEDA_ValueCtrl(this, _("Default Line Width"), g_PlotPSMinimunLineWidth, m_DefaultLineSizeCtrl = new WinEDA_ValueCtrl(this, _("Default Line Width"), g_PlotPSMinimunLineWidth,
g_UnitMetric, m_DefaultLineSizeCtrlSizer, EESCHEMA_INTERNAL_UNIT ); g_UnitMetric, m_DefaultLineSizeCtrlSizer, EESCHEMA_INTERNAL_UNIT );
} }
@ -273,9 +273,9 @@ void WinEDA_PlotPSFrame::OnPlotPsCurrentExecuteClick( wxCommandEvent& event )
{ {
int Select_PlotAll = FALSE; int Select_PlotAll = FALSE;
InitOptVars(); InitOptVars();
CreatePSFile(Select_PlotAll, PS_SizeSelect); CreatePSFile(Select_PlotAll, PS_SizeSelect);
m_MsgBox->AppendText( wxT("*****\n")); m_MsgBox->AppendText( wxT("*****\n"));
} }
@ -287,9 +287,9 @@ void WinEDA_PlotPSFrame::OnPlotPsAllExecuteClick( wxCommandEvent& event )
{ {
int Select_PlotAll = TRUE; int Select_PlotAll = TRUE;
InitOptVars(); InitOptVars();
CreatePSFile(Select_PlotAll, PS_SizeSelect); CreatePSFile(Select_PlotAll, PS_SizeSelect);
m_MsgBox->AppendText( wxT("*****\n")); m_MsgBox->AppendText( wxT("*****\n"));
} }
@ -299,7 +299,7 @@ int Select_PlotAll = TRUE;
void WinEDA_PlotPSFrame::OnCloseClick( wxCommandEvent& event ) void WinEDA_PlotPSFrame::OnCloseClick( wxCommandEvent& event )
{ {
InitOptVars(); InitOptVars();
Close(TRUE); Close(TRUE);
} }
@ -308,11 +308,11 @@ void WinEDA_PlotPSFrame::OnCloseClick( wxCommandEvent& event )
void WinEDA_PlotPSFrame::InitOptVars() void WinEDA_PlotPSFrame::InitOptVars()
/*****************************************/ /*****************************************/
{ {
Plot_Sheet_Ref = m_Plot_Sheet_Ref->GetValue(); Plot_Sheet_Ref = m_Plot_Sheet_Ref->GetValue();
g_PlotPSColorOpt = m_PlotPSColorOption->GetSelection(); g_PlotPSColorOpt = m_PlotPSColorOption->GetSelection();
PS_SizeSelect = m_SizeOption->GetSelection(); PS_SizeSelect = m_SizeOption->GetSelection();
g_PlotPSMinimunLineWidth = m_DefaultLineSizeCtrl->GetValue(); g_PlotPSMinimunLineWidth = m_DefaultLineSizeCtrl->GetValue();
if ( g_PlotPSMinimunLineWidth < 1 ) g_PlotPSMinimunLineWidth = 1; if ( g_PlotPSMinimunLineWidth < 1 ) g_PlotPSMinimunLineWidth = 1;
} }
@ -327,193 +327,193 @@ Ki_PageDescr * PlotSheet, * RealSheet;
int BBox[4]; int BBox[4];
wxPoint plot_offset; wxPoint plot_offset;
g_PlotFormat = PLOT_FORMAT_POST; g_PlotFormat = PLOT_FORMAT_POST;
/* Build the screen list */ /* Build the screen list */
EDA_ScreenList ScreenList; EDA_ScreenList ScreenList;
if ( AllPages == TRUE ) screen = ScreenList.GetFirst(); if ( AllPages == TRUE ) screen = ScreenList.GetFirst();
else screen = ActiveScreen; else screen = ActiveScreen;
for ( ; screen != NULL; screen = ScreenList.GetNext() ) for ( ; screen != NULL; screen = ScreenList.GetNext() )
{ {
PlotSheet = screen->m_CurrentSheetDesc; PlotSheet = screen->m_CurrentSheetDesc;
RealSheet = &g_Sheet_A4; RealSheet = &g_Sheet_A4;
if ( pagesize == PAGE_SIZE_AUTO ) RealSheet = PlotSheet; if ( pagesize == PAGE_SIZE_AUTO ) RealSheet = PlotSheet;
else if ( pagesize == PAGE_SIZE_A ) RealSheet = &g_Sheet_A; else if ( pagesize == PAGE_SIZE_A ) RealSheet = &g_Sheet_A;
/* Calcul des limites de trace en 1/1000 pouce */ /* Calcul des limites de trace en 1/1000 pouce */
BBox[0] = BBox[1] = g_PlotMargin; // Plot margin in 1/1000 inch BBox[0] = BBox[1] = g_PlotMargin; // Plot margin in 1/1000 inch
BBox[2] = RealSheet->m_Size.x - g_PlotMargin; BBox[2] = RealSheet->m_Size.x - g_PlotMargin;
BBox[3] = RealSheet->m_Size.y - g_PlotMargin; BBox[3] = RealSheet->m_Size.y - g_PlotMargin;
/* Calcul des echelles de conversion */ /* Calcul des echelles de conversion */
g_PlotScaleX = SCALE_PS * g_PlotScaleX = SCALE_PS *
(float) (BBox[2] - BBox[0]) / (float) (BBox[2] - BBox[0]) /
PlotSheet->m_Size.x; PlotSheet->m_Size.x;
g_PlotScaleY = SCALE_PS * g_PlotScaleY = SCALE_PS *
(float) (BBox[3] - BBox[1]) / (float) (BBox[3] - BBox[1]) /
PlotSheet->m_Size.y; PlotSheet->m_Size.y;
plot_offset.x = 0; plot_offset.x = 0;
plot_offset.y = PlotSheet->m_Size.y; plot_offset.y = PlotSheet->m_Size.y;
wxSplitPath(screen->m_FileName.GetData(), (wxString*) NULL, wxSplitPath(screen->m_FileName.GetData(), (wxString*) NULL,
&ShortFileName, (wxString*) NULL); &ShortFileName, (wxString*) NULL);
wxString dirbuf = wxGetCwd() + STRING_DIR_SEP; wxString dirbuf = wxGetCwd() + STRING_DIR_SEP;
if( ! ShortFileName.IsEmpty() ) if( ! ShortFileName.IsEmpty() )
PlotFileName = MakeFileName(dirbuf, ShortFileName, wxT(".ps")); PlotFileName = MakeFileName(dirbuf, ShortFileName, wxT(".ps"));
else PlotFileName = MakeFileName(dirbuf, g_DefaultSchematicFileName, wxT(".ps")); else PlotFileName = MakeFileName(dirbuf, g_DefaultSchematicFileName, wxT(".ps"));
PlotOneSheetPS(PlotFileName,screen, RealSheet, BBox, plot_offset); PlotOneSheetPS(PlotFileName,screen, RealSheet, BBox, plot_offset);
screen = (BASE_SCREEN*)screen->Pnext; screen = (BASE_SCREEN*)screen->Pnext;
if (AllPages == FALSE ) break; if (AllPages == FALSE ) break;
} }
} }
/*****************************************************************************************/ /*****************************************************************************************/
void WinEDA_PlotPSFrame::PlotOneSheetPS(const wxString & FileName, void WinEDA_PlotPSFrame::PlotOneSheetPS(const wxString & FileName,
BASE_SCREEN * screen, Ki_PageDescr * sheet, int BBox[4], wxPoint plot_offset) BASE_SCREEN * screen, Ki_PageDescr * sheet, int BBox[4], wxPoint plot_offset)
/*****************************************************************************************/ /*****************************************************************************************/
/* Trace en format PS. d'une feuille de dessin /* Trace en format PS. d'une feuille de dessin
*/ */
{ {
wxString Line; wxString Line;
EDA_BaseStruct *DrawList; EDA_BaseStruct *DrawList;
EDA_SchComponentStruct *DrawLibItem; SCH_COMPONENT *DrawLibItem;
int layer; int layer;
wxPoint StartPos, EndPos; wxPoint StartPos, EndPos;
PlotOutput = wxFopen(FileName, wxT("wt")); PlotOutput = wxFopen(FileName, wxT("wt"));
if (PlotOutput == NULL) if (PlotOutput == NULL)
{ {
Line = wxT("\n** "); Line = wxT("\n** ");
Line += _("Unable to create ") + FileName + wxT(" **\n\n"); Line += _("Unable to create ") + FileName + wxT(" **\n\n");
m_MsgBox->AppendText(Line); m_MsgBox->AppendText(Line);
wxBell(); wxBell();
return ; return ;
} }
setlocale(LC_NUMERIC, "C"); setlocale(LC_NUMERIC, "C");
Line.Printf(_("Plot: %s\n"), FileName.GetData()) ; Line.Printf(_("Plot: %s\n"), FileName.GetData()) ;
m_MsgBox->AppendText(Line); m_MsgBox->AppendText(Line);
InitPlotParametresPS(plot_offset, sheet, g_PlotScaleX, g_PlotScaleY); InitPlotParametresPS(plot_offset, sheet, g_PlotScaleX, g_PlotScaleY);
SetDefaultLineWidthPS( g_PlotPSMinimunLineWidth); SetDefaultLineWidthPS( g_PlotPSMinimunLineWidth);
/* Init : */ /* Init : */
PrintHeaderPS( PlotOutput, wxT("EESchema-PS"), FileName, 1, BBox, wxLANDSCAPE ); PrintHeaderPS( PlotOutput, wxT("EESchema-PS"), FileName, 1, BBox, wxLANDSCAPE );
InitPlotParametresPS(plot_offset, sheet, 1.0, 1.0); InitPlotParametresPS(plot_offset, sheet, 1.0, 1.0);
if ( m_Plot_Sheet_Ref->GetValue() ) if ( m_Plot_Sheet_Ref->GetValue() )
{ {
if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
SetColorMapPS ( BLACK ); SetColorMapPS ( BLACK );
PlotWorkSheet(PLOT_FORMAT_POST, screen); PlotWorkSheet(PLOT_FORMAT_POST, screen);
} }
DrawList = screen->EEDrawList; DrawList = screen->EEDrawList;
while ( DrawList ) /* tracage */ while ( DrawList ) /* tracage */
{ {
Plume('U'); Plume('U');
layer = LAYER_NOTES; layer = LAYER_NOTES;
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
case DRAW_BUSENTRY_STRUCT_TYPE : /* Struct Raccord et Segment sont identiques */ case DRAW_BUSENTRY_STRUCT_TYPE : /* Struct Raccord et Segment sont identiques */
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawBusEntryStruct*)DrawList) #define STRUCT ((DrawBusEntryStruct*)DrawList)
StartPos = STRUCT->m_Pos; StartPos = STRUCT->m_Pos;
EndPos = STRUCT->m_End(); EndPos = STRUCT->m_End();
layer = STRUCT->m_Layer; layer = STRUCT->m_Layer;
case DRAW_SEGMENT_STRUCT_TYPE : case DRAW_SEGMENT_STRUCT_TYPE :
#undef STRUCT #undef STRUCT
#define STRUCT ((EDA_DrawLineStruct*)DrawList) #define STRUCT ((EDA_DrawLineStruct*)DrawList)
if ( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE) if ( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE)
{ {
StartPos = STRUCT->m_Start; StartPos = STRUCT->m_Start;
EndPos = STRUCT->m_End; EndPos = STRUCT->m_End;
layer = STRUCT->m_Layer; layer = STRUCT->m_Layer;
} }
if ( g_PlotPSColorOpt ) if ( g_PlotPSColorOpt )
SetColorMapPS ( ReturnLayerColor(layer) ); SetColorMapPS ( ReturnLayerColor(layer) );
switch (layer) switch (layer)
{ {
case LAYER_NOTES: /* Trace en pointilles */ case LAYER_NOTES: /* Trace en pointilles */
SetCurrentLineWidth(-1); SetCurrentLineWidth(-1);
fprintf(PlotOutput,"[50 50] 0 setdash\n"); fprintf(PlotOutput,"[50 50] 0 setdash\n");
Move_Plume( StartPos, 'U'); Move_Plume( StartPos, 'U');
Move_Plume( EndPos, 'D'); Move_Plume( EndPos, 'D');
fprintf(PlotOutput,"[] 0 setdash\n"); fprintf(PlotOutput,"[] 0 setdash\n");
break; break;
case LAYER_BUS: /* Trait large */ case LAYER_BUS: /* Trait large */
{ {
fprintf(PlotOutput,"%d setlinewidth\n", g_PlotPSMinimunLineWidth * 3); fprintf(PlotOutput,"%d setlinewidth\n", g_PlotPSMinimunLineWidth * 3);
Move_Plume( StartPos,'U'); Move_Plume( StartPos,'U');
Move_Plume( EndPos,'D'); Move_Plume( EndPos,'D');
fprintf(PlotOutput,"%d setlinewidth\n", g_PlotPSMinimunLineWidth); fprintf(PlotOutput,"%d setlinewidth\n", g_PlotPSMinimunLineWidth);
} }
break; break;
default: default:
SetCurrentLineWidth(-1); SetCurrentLineWidth(-1);
Move_Plume( StartPos,'U'); Move_Plume( StartPos,'U');
Move_Plume( EndPos,'D'); Move_Plume( EndPos,'D');
break; break;
} }
break; break;
case DRAW_JUNCTION_STRUCT_TYPE : case DRAW_JUNCTION_STRUCT_TYPE :
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawJunctionStruct*)DrawList) #define STRUCT ((DrawJunctionStruct*)DrawList)
if ( g_PlotPSColorOpt ) if ( g_PlotPSColorOpt )
SetColorMapPS (ReturnLayerColor(STRUCT->m_Layer) ); SetColorMapPS (ReturnLayerColor(STRUCT->m_Layer) );
PlotCercle( STRUCT->m_Pos, DRAWJUNCTION_SIZE); PlotCercle( STRUCT->m_Pos, DRAWJUNCTION_SIZE);
break; break;
case DRAW_TEXT_STRUCT_TYPE : case TYPE_SCH_TEXT :
case DRAW_LABEL_STRUCT_TYPE : case TYPE_SCH_LABEL :
case DRAW_GLOBAL_LABEL_STRUCT_TYPE : case TYPE_SCH_GLOBALLABEL :
case DRAW_HIER_LABEL_STRUCT_TYPE : case TYPE_SCH_HIERLABEL :
PlotTextStruct(DrawList); PlotTextStruct(DrawList);
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE : case TYPE_SCH_COMPONENT :
DrawLibItem = (EDA_SchComponentStruct *) DrawList; DrawLibItem = (SCH_COMPONENT *) DrawList;
PlotLibPart( DrawLibItem ); PlotLibPart( DrawLibItem );
break; break;
case DRAW_PICK_ITEM_STRUCT_TYPE : break; case DRAW_PICK_ITEM_STRUCT_TYPE : break;
case DRAW_POLYLINE_STRUCT_TYPE : break; case DRAW_POLYLINE_STRUCT_TYPE : break;
case DRAW_SHEETLABEL_STRUCT_TYPE: break; case DRAW_SHEETLABEL_STRUCT_TYPE: break;
case DRAW_MARKER_STRUCT_TYPE : break; case DRAW_MARKER_STRUCT_TYPE : break;
case DRAW_SHEET_STRUCT_TYPE : case DRAW_SHEET_STRUCT_TYPE :
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawSheetStruct*)DrawList) #define STRUCT ((DrawSheetStruct*)DrawList)
PlotSheetStruct(STRUCT); PlotSheetStruct(STRUCT);
break; break;
case DRAW_NOCONNECT_STRUCT_TYPE: case DRAW_NOCONNECT_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawNoConnectStruct*)DrawList) #define STRUCT ((DrawNoConnectStruct*)DrawList)
if ( g_PlotPSColorOpt ) if ( g_PlotPSColorOpt )
SetColorMapPS (ReturnLayerColor(LAYER_NOCONNECT) ); SetColorMapPS (ReturnLayerColor(LAYER_NOCONNECT) );
PlotNoConnectStruct(STRUCT); PlotNoConnectStruct(STRUCT);
break; break;
default: default:
break; break;
} }
Plume('U'); Plume('U');
DrawList = DrawList->Pnext; DrawList = DrawList->Pnext;
} }
/* fin */ /* fin */
CloseFilePS(PlotOutput); CloseFilePS(PlotOutput);
setlocale(LC_NUMERIC, ""); setlocale(LC_NUMERIC, "");
m_MsgBox->AppendText( wxT("Ok\n")); m_MsgBox->AppendText( wxT("Ok\n"));
} }

View File

@ -4,9 +4,9 @@
void FreeLibraryEntry(LibCmpEntry * Entry); void FreeLibraryEntry(LibCmpEntry * Entry);
LibEDA_BaseStruct * LocatePin(const wxPoint & RefPos, LibEDA_BaseStruct * LocatePin(const wxPoint & RefPos,
EDA_LibComponentStruct * Entry, EDA_LibComponentStruct * Entry,
int Unit, int Convert, EDA_SchComponentStruct * DrawItem = NULL); int Unit, int Convert, SCH_COMPONENT * DrawItem = NULL);
/* Routine de localisation d'une PIN de la PartLib pointee par Entry */ /* Routine de localisation d'une PIN de la PartLib pointee par Entry */
const wxString& ReturnDefaultFieldName( int aFieldNdx ); const wxString& ReturnDefaultFieldName( int aFieldNdx );
@ -20,7 +20,7 @@ const wxString& ReturnDefaultFieldName( int aFieldNdx );
/****************/ /****************/
void DisplayCmpDoc(wxString & Name); void DisplayCmpDoc(wxString & Name);
bool DataBaseGetName(WinEDA_DrawFrame * frame, bool DataBaseGetName(WinEDA_DrawFrame * frame,
wxString & Keys, wxString & BufName); wxString & Keys, wxString & BufName);
/*********************/ /*********************/
/* DANGLING_ENDS.CPP */ /* DANGLING_ENDS.CPP */
@ -36,12 +36,12 @@ void IncrementLabelMember(wxString & name);
/* EDITPART.CPP */ /* EDITPART.CPP */
/****************/ /****************/
void InstallCmpeditFrame(WinEDA_SchematicFrame * parent, wxPoint & pos, void InstallCmpeditFrame(WinEDA_SchematicFrame * parent, wxPoint & pos,
EDA_SchComponentStruct * m_Cmp); SCH_COMPONENT * m_Cmp);
/**************/ /**************/
/* EELIBS2.CPP */ /* EELIBS2.CPP */
/**************/ /**************/
/* Functions common to all EELibs?.c modules: */ /* Functions common to all EELibs?.c modules: */
int LibraryEntryCompare(EDA_LibComponentStruct *LE1, EDA_LibComponentStruct *LE2); int LibraryEntryCompare(EDA_LibComponentStruct *LE1, EDA_LibComponentStruct *LE2);
@ -49,162 +49,162 @@ int NumOfLibraries();
EDA_LibComponentStruct *FindLibPart(const wxChar *Name, const wxString & LibName, int Alias); EDA_LibComponentStruct *FindLibPart(const wxChar *Name, const wxString & LibName, int Alias);
void DrawingLibInGhost(WinEDA_DrawPanel * panel, wxDC * DC, EDA_LibComponentStruct *LibEntry, void DrawingLibInGhost(WinEDA_DrawPanel * panel, wxDC * DC, EDA_LibComponentStruct *LibEntry,
EDA_SchComponentStruct * DrawLibItem, int PartX, int PartY, SCH_COMPONENT * DrawLibItem, int PartX, int PartY,
int Multi, int convert, int Multi, int convert,
int Color, bool DrawPinText); int Color, bool DrawPinText);
void DrawLibEntry(WinEDA_DrawPanel * panel, wxDC * DC, void DrawLibEntry(WinEDA_DrawPanel * panel, wxDC * DC,
EDA_LibComponentStruct *LibEntry, int posX, int posY, EDA_LibComponentStruct *LibEntry, int posX, int posY,
int Multi, int convert, int Multi, int convert,
int DrawMode, int Color = -1); int DrawMode, int Color = -1);
void DrawLibraryDrawStruct(WinEDA_DrawPanel * panel, wxDC * DC, void DrawLibraryDrawStruct(WinEDA_DrawPanel * panel, wxDC * DC,
EDA_LibComponentStruct *LibEntry, int PartX, int PartY, EDA_LibComponentStruct *LibEntry, int PartX, int PartY,
LibEDA_BaseStruct *DrawItem, int Multi, LibEDA_BaseStruct *DrawItem, int Multi,
int DrawMode, int Color = -1); int DrawMode, int Color = -1);
bool MapAngles(int *Angle1, int *Angle2, int TransMat[2][2]); bool MapAngles(int *Angle1, int *Angle2, int TransMat[2][2]);
/**************/ /**************/
/* EELIBS1.CPP */ /* EELIBS1.CPP */
/**************/ /**************/
EDA_LibComponentStruct * Read_Component_Definition(WinEDA_DrawFrame * frame, char * Line, EDA_LibComponentStruct * Read_Component_Definition(WinEDA_DrawFrame * frame, char * Line,
FILE *f, int *LineNum); FILE *f, int *LineNum);
/* Routine to Read a DEF/ENDDEF part entry from given open file. */ /* Routine to Read a DEF/ENDDEF part entry from given open file. */
LibraryStruct *FindLibrary(const wxString & Name); LibraryStruct *FindLibrary(const wxString & Name);
int LoadDocLib(WinEDA_DrawFrame * frame, const wxString & FullDocLibName, const wxString & Libname); int LoadDocLib(WinEDA_DrawFrame * frame, const wxString & FullDocLibName, const wxString & Libname);
PriorQue *LoadLibraryAux(WinEDA_DrawFrame * frame, LibraryStruct * library, PriorQue *LoadLibraryAux(WinEDA_DrawFrame * frame, LibraryStruct * library,
FILE *f, int *NumOfParts); FILE *f, int *NumOfParts);
LibraryStruct * LoadLibraryName(WinEDA_DrawFrame * frame, LibraryStruct * LoadLibraryName(WinEDA_DrawFrame * frame,
const wxString & FullLibName, const wxString & LibName); const wxString & FullLibName, const wxString & LibName);
void LoadLibraries(WinEDA_DrawFrame * frame); void LoadLibraries(WinEDA_DrawFrame * frame);
void FreeCmpLibrary(wxWindow * frame, const wxString & LibName); void FreeCmpLibrary(wxWindow * frame, const wxString & LibName);
const wxChar **GetLibNames(); const wxChar **GetLibNames();
void SnapLibItemPoint(int OrigX, int OrigY, int *ClosestX, int *ClosestY, void SnapLibItemPoint(int OrigX, int OrigY, int *ClosestX, int *ClosestY,
EDA_SchComponentStruct *DrawLibItem); SCH_COMPONENT *DrawLibItem);
bool LibItemInBox(int x1, int y1, int x2, int y2, bool LibItemInBox(int x1, int y1, int x2, int y2,
EDA_SchComponentStruct *DrawLibItem); SCH_COMPONENT *DrawLibItem);
void DrawTextField(WinEDA_DrawPanel * panel, wxDC * DC, PartTextStruct * Field, int IsMulti, int DrawMode); void DrawTextField(WinEDA_DrawPanel * panel, wxDC * DC, PartTextStruct * Field, int IsMulti, int DrawMode);
/* Routine de trace des textes type Field du composant. /* Routine de trace des textes type Field du composant.
entree: entree:
Field: champ Field: champ
IsMulti: flag Non Null si il y a plusieurs parts par boitier. IsMulti: flag Non Null si il y a plusieurs parts par boitier.
n'est utile que pour le champ reference pour ajouter a celui ci n'est utile que pour le champ reference pour ajouter a celui ci
l'identification de la part ( A, B ... ) l'identification de la part ( A, B ... )
DrawMode: mode de trace */ DrawMode: mode de trace */
char * StrPurge(char * text); char * StrPurge(char * text);
/* Supprime les caracteres Space en debut de la ligne text /* Supprime les caracteres Space en debut de la ligne text
retourne un pointeur sur le 1er caractere non Space de text */ retourne un pointeur sur le 1er caractere non Space de text */
/************/ /************/
/* BLOCK.CPP */ /* BLOCK.CPP */
/************/ /************/
EDA_BaseStruct * DuplicateStruct(EDA_BaseStruct *DrawStruct); EDA_BaseStruct * DuplicateStruct(EDA_BaseStruct *DrawStruct);
void MoveOneStruct(EDA_BaseStruct *DrawStructs, const wxPoint & move_vector); void MoveOneStruct(EDA_BaseStruct *DrawStructs, const wxPoint & move_vector);
/* Given a structure move it by move_vector.x, move_vector.y. */ /* Given a structure move it by move_vector.x, move_vector.y. */
bool PlaceStruct(BASE_SCREEN * screen, EDA_BaseStruct *DrawStruct); bool PlaceStruct(BASE_SCREEN * screen, EDA_BaseStruct *DrawStruct);
bool MoveStruct(WinEDA_DrawPanel * panel, wxDC * DC, EDA_BaseStruct *DrawStruct); bool MoveStruct(WinEDA_DrawPanel * panel, wxDC * DC, EDA_BaseStruct *DrawStruct);
void DeleteStruct(WinEDA_DrawPanel * panel, wxDC * DC, EDA_BaseStruct *DrawStruct); void DeleteStruct(WinEDA_DrawPanel * panel, wxDC * DC, EDA_BaseStruct *DrawStruct);
bool DrawStructInBox(int x1, int y1, int x2, int y2, bool DrawStructInBox(int x1, int y1, int x2, int y2,
EDA_BaseStruct *DrawStruct); EDA_BaseStruct *DrawStruct);
/*************/ /*************/
/* LOCATE.CPP */ /* LOCATE.CPP */
/*************/ /*************/
LibDrawPin* LocatePinByNumber( const wxString & ePin_Number, LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
EDA_SchComponentStruct* eComponent ); SCH_COMPONENT* eComponent );
EDA_SchComponentStruct * LocateSmallestComponent( SCH_SCREEN * Screen ); SCH_COMPONENT * LocateSmallestComponent( SCH_SCREEN * Screen );
/* Recherche du plus petit (en surface) composant pointe par la souris */ /* Recherche du plus petit (en surface) composant pointe par la souris */
EDA_BaseStruct * PickStruct(EDA_Rect & block, EDA_BaseStruct * PickStruct(EDA_Rect & block,
BASE_SCREEN* screen, int SearchMask ); BASE_SCREEN* screen, int SearchMask );
EDA_BaseStruct * PickStruct(const wxPoint & refpos, EDA_BaseStruct * PickStruct(const wxPoint & refpos,
BASE_SCREEN* screen, int SearchMask); BASE_SCREEN* screen, int SearchMask);
/* 2 functions EDA_BaseStruct * PickStruct: /* 2 functions EDA_BaseStruct * PickStruct:
Search in block, or Serach at location pos Search in block, or Serach at location pos
SearchMask = (bitwise OR): SearchMask = (bitwise OR):
LIBITEM LIBITEM
WIREITEM WIREITEM
BUSITEM BUSITEM
RACCORDITEM RACCORDITEM
JUNCTIONITEM JUNCTIONITEM
DRAWITEM DRAWITEM
TEXTITEM TEXTITEM
LABELITEM LABELITEM
SHEETITEM SHEETITEM
MARKERITEM MARKERITEM
NOCONNECTITEM NOCONNECTITEM
SEARCH_PINITEM SEARCH_PINITEM
SHEETLABELITEM SHEETLABELITEM
FIELDCMPITEM FIELDCMPITEM
if EXCLUDE_WIRE_BUS_ENDPOINTS is set, in wire ou bus search and locate, if EXCLUDE_WIRE_BUS_ENDPOINTS is set, in wire ou bus search and locate,
start and end points are not included in search start and end points are not included in search
if WIRE_BUS_ENDPOINTS_ONLY is set, in wire ou bus search and locate, if WIRE_BUS_ENDPOINTS_ONLY is set, in wire ou bus search and locate,
only start and end points are included in search only start and end points are included in search
Return: Return:
-Bloc searc: -Bloc searc:
pointeur sur liste de pointeurs de structures si Plusieurs pointeur sur liste de pointeurs de structures si Plusieurs
structures selectionnees. structures selectionnees.
pointeur sur la structure si 1 seule pointeur sur la structure si 1 seule
Positon serach: Positon serach:
pointeur sur la structure. pointeur sur la structure.
Si pas de structures selectionnees: retourne NULL */ Si pas de structures selectionnees: retourne NULL */
LibEDA_BaseStruct * LocateDrawItem(SCH_SCREEN * Screen, const wxPoint & refpoint, LibEDA_BaseStruct * LocateDrawItem(SCH_SCREEN * Screen, const wxPoint & refpoint,
EDA_LibComponentStruct * LibEntry, int Unit, int Convert, int masque); EDA_LibComponentStruct * LibEntry, int Unit, int Convert, int masque);
DrawSheetLabelStruct * LocateSheetLabel(DrawSheetStruct *Sheet, const wxPoint & pos); DrawSheetLabelStruct * LocateSheetLabel(DrawSheetStruct *Sheet, const wxPoint & pos);
LibDrawPin * LocateAnyPin(EDA_BaseStruct *DrawList, const wxPoint & RefPos, LibDrawPin * LocateAnyPin(EDA_BaseStruct *DrawList, const wxPoint & RefPos,
EDA_SchComponentStruct ** libpart = NULL ); SCH_COMPONENT ** libpart = NULL );
DrawSheetLabelStruct * LocateAnyPinSheet(const wxPoint & RefPos, DrawSheetLabelStruct * LocateAnyPinSheet(const wxPoint & RefPos,
EDA_BaseStruct *DrawList); EDA_BaseStruct *DrawList);
int distance(int dx, int dy, int spot_cX, int spot_cY, int seuil); int distance(int dx, int dy, int spot_cX, int spot_cY, int seuil);
/* Calcul de la distance du point spot_cx,spot_cy a un segment de droite, /* Calcul de la distance du point spot_cx,spot_cy a un segment de droite,
d'origine 0,0 et d'extremite dx, dy; d'origine 0,0 et d'extremite dx, dy;
retourne: retourne:
0 si distance > seuil 0 si distance > seuil
1 si distance <= seuil 1 si distance <= seuil
Variables utilisees ( sont ramenees au repere centre sur l'origine du segment) Variables utilisees ( sont ramenees au repere centre sur l'origine du segment)
dx, dy = coord de l'extremite segment. dx, dy = coord de l'extremite segment.
spot_cX,spot_cY = coord du curseur souris spot_cX,spot_cY = coord du curseur souris
la recherche se fait selon 4 cas: la recherche se fait selon 4 cas:
segment horizontal segment horizontal
segment vertical segment vertical
segment quelconque */ segment quelconque */
/***************/ /***************/
/* EEREDRAW.CPP */ /* EEREDRAW.CPP */
/***************/ /***************/
void DrawDanglingSymbol(WinEDA_DrawPanel * panel,wxDC * DC, void DrawDanglingSymbol(WinEDA_DrawPanel * panel,wxDC * DC,
const wxPoint & pos, int Color); const wxPoint & pos, int Color);
void Draw_Marqueur(WinEDA_DrawPanel * panel, wxDC * DC, void Draw_Marqueur(WinEDA_DrawPanel * panel, wxDC * DC,
wxPoint pos, char* pt_bitmap, int DrawMode, int Color); wxPoint pos, char* pt_bitmap, int DrawMode, int Color);
void DrawStructsInGhost(WinEDA_DrawPanel * panel, wxDC * DC, void DrawStructsInGhost(WinEDA_DrawPanel * panel, wxDC * DC,
EDA_BaseStruct * DrawStruct, int dx, int dy ); EDA_BaseStruct * DrawStruct, int dx, int dy );
void SetHighLightStruct(EDA_BaseStruct *HighLight); void SetHighLightStruct(EDA_BaseStruct *HighLight);
void RedrawActiveWindow(WinEDA_DrawPanel * panel, wxDC * DC); void RedrawActiveWindow(WinEDA_DrawPanel * panel, wxDC * DC);
void RedrawStructList(WinEDA_DrawPanel * panel, wxDC * DC, EDA_BaseStruct *Structs, int DrawMode, void RedrawStructList(WinEDA_DrawPanel * panel, wxDC * DC, EDA_BaseStruct *Structs, int DrawMode,
int Color = -1); int Color = -1);
void RedrawOneStruct(WinEDA_DrawPanel * panel, wxDC * DC, EDA_BaseStruct *Struct, int DrawMode, void RedrawOneStruct(WinEDA_DrawPanel * panel, wxDC * DC, EDA_BaseStruct *Struct, int DrawMode,
int Color = -1); int Color = -1);
/**************/ /**************/
/* EELAYER.CPP */ /* EELAYER.CPP */
@ -236,53 +236,53 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame * frame, bool verbose );
/**************/ /**************/
LibEDA_BaseStruct * CopyDrawEntryStruct( wxWindow * frame, LibEDA_BaseStruct * DrawItem); LibEDA_BaseStruct * CopyDrawEntryStruct( wxWindow * frame, LibEDA_BaseStruct * DrawItem);
/* Routine de Duplication d'une structure DrawLibItem d'une partlib /* Routine de Duplication d'une structure DrawLibItem d'une partlib
Parametres d'entree: Parametres d'entree:
DrawEntry = pointeur sur la structure a dupliquer DrawEntry = pointeur sur la structure a dupliquer
La structure nouvelle est creee, mais n'est pas inseree dans le La structure nouvelle est creee, mais n'est pas inseree dans le
chainage chainage
Retourne: Retourne:
Pointeur sur la structure creee (ou NULL si impossible) */ Pointeur sur la structure creee (ou NULL si impossible) */
int WriteOneLibEntry(wxWindow * frame, FILE * ExportFile, EDA_LibComponentStruct * LibEntry); int WriteOneLibEntry(wxWindow * frame, FILE * ExportFile, EDA_LibComponentStruct * LibEntry);
/* Routine d'ecriture du composant pointe par LibEntry /* Routine d'ecriture du composant pointe par LibEntry
dans le fichier ExportFile( qui doit etre deja ouvert) dans le fichier ExportFile( qui doit etre deja ouvert)
return: FALSE si Ok, TRUE si err write */ return: FALSE si Ok, TRUE si err write */
EDA_LibComponentStruct * CopyLibEntryStruct (wxWindow * frame, EDA_LibComponentStruct * OldEntry); EDA_LibComponentStruct * CopyLibEntryStruct (wxWindow * frame, EDA_LibComponentStruct * OldEntry);
/* Routine de copie d'une partlib /* Routine de copie d'une partlib
Parametres d'entree: pointeur sur la structure de depart Parametres d'entree: pointeur sur la structure de depart
Parametres de sortie: pointeur sur la structure creee */ Parametres de sortie: pointeur sur la structure creee */
int WriteOneDocLibEntry(FILE * ExportFile, EDA_LibComponentStruct * LibEntry); int WriteOneDocLibEntry(FILE * ExportFile, EDA_LibComponentStruct * LibEntry);
/* Routine d'ecriture de la doc du composant pointe par LibEntry /* Routine d'ecriture de la doc du composant pointe par LibEntry
dans le fichier ExportFile( qui doit etre deja ouvert) dans le fichier ExportFile( qui doit etre deja ouvert)
return: 0 si Ok return: 0 si Ok
1 si err write */ 1 si err write */
int SaveOneLibrary(wxWindow * frame, const wxString & FullFileName, LibraryStruct * Library); int SaveOneLibrary(wxWindow * frame, const wxString & FullFileName, LibraryStruct * Library);
/* Sauvegarde en fichier la librairie pointee par Library, sous le nom /* Sauvegarde en fichier la librairie pointee par Library, sous le nom
FullFileName. FullFileName.
2 fichiers sont crees 2 fichiers sont crees
- La librarie - La librarie
- le fichier de documentation - le fichier de documentation
une sauvegarde .bak de l'ancien fichier librairie est cree une sauvegarde .bak de l'ancien fichier librairie est cree
une sauvegarde .bck de l'ancien fichier documentation est cree une sauvegarde .bck de l'ancien fichier documentation est cree
return: return:
0 si OK 0 si OK
1 si erreur */ 1 si erreur */
/***************/ /***************/
/* SYMBEDIT.CPP */ /* SYMBEDIT.CPP */
/***************/ /***************/
void SuppressDuplicateDrawItem(EDA_LibComponentStruct * LibEntry); void SuppressDuplicateDrawItem(EDA_LibComponentStruct * LibEntry);
/* Routine de suppression des elements de trace dupliques, situation /* Routine de suppression des elements de trace dupliques, situation
frequente lorsque l'on charge des symboles predessines plusieurs fois frequente lorsque l'on charge des symboles predessines plusieurs fois
pour definir un composant */ pour definir un composant */
/***************/ /***************/
/* SYMBTEXT.CPP */ /* SYMBTEXT.CPP */
@ -300,9 +300,9 @@ int IsBusLabel(const wxString & LabelDrawList);
void ReAnnotatePowerSymbolsOnly(); void ReAnnotatePowerSymbolsOnly();
int CheckAnnotate(WinEDA_SchematicFrame * frame, bool OneSheetOnly); int CheckAnnotate(WinEDA_SchematicFrame * frame, bool OneSheetOnly);
/* Retourne le nombre de composants non annotes ou erron<6F>s /* Retourne le nombre de composants non annotes ou erron<6F>s
Si OneSheetOnly : recherche sur le schema courant Si OneSheetOnly : recherche sur le schema courant
else: recherche sur toute la hierarchie */ else: recherche sur toute la hierarchie */
/************/ /************/
@ -315,10 +315,10 @@ void PlotCercle(wxPoint centre, int diametre, int width = -1);
void PlotPoly( int nb, int * coord, int fill, int width = -1); void PlotPoly( int nb, int * coord, int fill, int width = -1);
void PlotNoConnectStruct(DrawNoConnectStruct * Struct); void PlotNoConnectStruct(DrawNoConnectStruct * Struct);
void PlotLibPart( EDA_SchComponentStruct *DrawLibItem ); void PlotLibPart( SCH_COMPONENT *DrawLibItem );
/* Genere le trace d'un composant */ /* Genere le trace d'un composant */
void PlotSheetStruct(DrawSheetStruct *Struct); void PlotSheetStruct(DrawSheetStruct *Struct);
/* Routine de dessin du bloc type hierarchie */ /* Routine de dessin du bloc type hierarchie */
void PlotTextStruct(EDA_BaseStruct *Struct); void PlotTextStruct(EDA_BaseStruct *Struct);
/***************/ /***************/
@ -327,7 +327,7 @@ void PlotTextStruct(EDA_BaseStruct *Struct);
void DeleteSubHierarchy(DrawSheetStruct * Sheet, bool confirm_deletion); void DeleteSubHierarchy(DrawSheetStruct * Sheet, bool confirm_deletion);
bool ClearProjectDrawList(SCH_SCREEN * FirstWindow, bool confirm_deletion); bool ClearProjectDrawList(SCH_SCREEN * FirstWindow, bool confirm_deletion);
/* free the draw list screen->EEDrawList and the subhierarchies /* free the draw list screen->EEDrawList and the subhierarchies
clear the screen datas (filenames ..) clear the screen datas (filenames ..)
*/ */
/*************/ /*************/
@ -337,19 +337,19 @@ bool ClearProjectDrawList(SCH_SCREEN * FirstWindow, bool confirm_deletion);
bool LocateAndDeleteItem(WinEDA_SchematicFrame * frame, wxDC * DC); bool LocateAndDeleteItem(WinEDA_SchematicFrame * frame, wxDC * DC);
void EraseStruct(EDA_BaseStruct *DrawStruct, SCH_SCREEN * Window); void EraseStruct(EDA_BaseStruct *DrawStruct, SCH_SCREEN * Window);
void DeleteAllMarkers(int type); void DeleteAllMarkers(int type);
/* Effacement des marqueurs du type "type" */ /* Effacement des marqueurs du type "type" */
void DeleteOneLibraryDrawStruct(WinEDA_DrawPanel * panel, void DeleteOneLibraryDrawStruct(WinEDA_DrawPanel * panel,
wxDC *DC, EDA_LibComponentStruct * LibEntry, wxDC *DC, EDA_LibComponentStruct * LibEntry,
LibEDA_BaseStruct * DrawItem, int Affiche); LibEDA_BaseStruct * DrawItem, int Affiche);
/* Routine d'effacement d'un "LibraryDrawStruct" /* Routine d'effacement d'un "LibraryDrawStruct"
(d'un element de dessin d'un composant ) (d'un element de dessin d'un composant )
Parametres d'entree Parametres d'entree
Pointeur sur le composant comportant la structure Pointeur sur le composant comportant la structure
(Si NULL la structure a effacer est supposee non rattachee (Si NULL la structure a effacer est supposee non rattachee
a un composant) a un composant)
Pointeur sur la structure a effacer Pointeur sur la structure a effacer
Affiche (si != 0 Efface le graphique correspondant de l'ecran) */ Affiche (si != 0 Efface le graphique correspondant de l'ecran) */
/**************/ /**************/
@ -357,12 +357,12 @@ void DeleteOneLibraryDrawStruct(WinEDA_DrawPanel * panel,
/**************/ /**************/
int LookForConvertPart( EDA_LibComponentStruct * LibEntry ); int LookForConvertPart( EDA_LibComponentStruct * LibEntry );
/* Retourne la plus grande valeur trouvee dans la liste des elements /* Retourne la plus grande valeur trouvee dans la liste des elements
"drawings" du composant LibEntry, pour le membre .Convert "drawings" du composant LibEntry, pour le membre .Convert
Si il n'y a pas de representation type "convert", la valeur Si il n'y a pas de representation type "convert", la valeur
retournee est 0 ou 1 retournee est 0 ou 1
Si il y a une representation type "convert", Si il y a une representation type "convert",
la valeur retournee est > 1 (typiquement 2) */ la valeur retournee est > 1 (typiquement 2) */
/**************/ /**************/
@ -376,66 +376,66 @@ void InstallPineditFrame(WinEDA_LibeditFrame * parent, wxDC * DC, const wxPoint
/**************/ /**************/
int DisplayComponentsNamesInLib(WinEDA_DrawFrame * frame, int DisplayComponentsNamesInLib(WinEDA_DrawFrame * frame,
LibraryStruct *Library, wxString & Buffer, wxString & OldName); LibraryStruct *Library, wxString & Buffer, wxString & OldName);
LibraryStruct * SelectLibraryFromList(WinEDA_DrawFrame * frame); LibraryStruct * SelectLibraryFromList(WinEDA_DrawFrame * frame);
/* Routine pour selectionner une librairie a partir d'une liste */ /* Routine pour selectionner une librairie a partir d'une liste */
int GetNameOfPartToLoad(WinEDA_DrawFrame * frame, LibraryStruct * Lib, int GetNameOfPartToLoad(WinEDA_DrawFrame * frame, LibraryStruct * Lib,
wxString & BufName); wxString & BufName);
/* Routine de selection du nom d'un composant en librairie pour chargement, /* Routine de selection du nom d'un composant en librairie pour chargement,
dans la librairie Library. dans la librairie Library.
Si Library == NULL, il y aura demande de selection d'une librairie Si Library == NULL, il y aura demande de selection d'une librairie
Retourne Retourne
1 si composant selectionne 1 si composant selectionne
0 si commande annulee 0 si commande annulee
place le nom du composant a charger, selectionne a partir d'une liste dans place le nom du composant a charger, selectionne a partir d'une liste dans
BufName */ BufName */
/**************/ /**************/
/* LIBARCH.CPP */ /* LIBARCH.CPP */
/**************/ /**************/
bool LibArchive(wxWindow * frame, const wxString & ArchFullFileName); bool LibArchive(wxWindow * frame, const wxString & ArchFullFileName);
/***************/ /***************/
/* GENLISTE.CPP */ /* GENLISTE.CPP */
/***************/ /***************/
struct ListComponent; struct ListComponent;
int GenListeCmp( ListComponent * List ); int GenListeCmp( ListComponent * List );
/**************/ /**************/
/* CLEANUP.CPP */ /* CLEANUP.CPP */
/**************/ /**************/
void SchematicCleanUp(SCH_SCREEN * screen, wxDC * DC); void SchematicCleanUp(SCH_SCREEN * screen, wxDC * DC);
/* Routine de nettoyage: /* Routine de nettoyage:
- regroupe les segments de fils (ou de bus) alignes en 1 seul segment - regroupe les segments de fils (ou de bus) alignes en 1 seul segment
- Detecte les objets identiques superposes - Detecte les objets identiques superposes
*/ */
void BreakSegmentOnJunction( SCH_SCREEN * Screen ); void BreakSegmentOnJunction( SCH_SCREEN * Screen );
/* Routine creant des debuts / fin de segment (BUS ou WIRES) sur les jonctions /* Routine creant des debuts / fin de segment (BUS ou WIRES) sur les jonctions
et les raccords */ et les raccords */
DrawPickedStruct * BreakSegment(SCH_SCREEN * screen, wxPoint breakpoint, DrawPickedStruct * BreakSegment(SCH_SCREEN * screen, wxPoint breakpoint,
bool PutInUndoList = FALSE); bool PutInUndoList = FALSE);
/* Coupe un segment ( BUS, WIRE ) en 2 au point breakpoint, /* Coupe un segment ( BUS, WIRE ) en 2 au point breakpoint,
- si ce point est sur le segment - si ce point est sur le segment
- extremites non comprises */ - extremites non comprises */
/**************/ /**************/
/* EECLASS.CPP */ /* EECLASS.CPP */
/**************/ /**************/
void SetStructFather(EDA_BaseStruct * Struct, BASE_SCREEN * Screen); void SetStructFather(EDA_BaseStruct * Struct, BASE_SCREEN * Screen);
/***************/ /***************/
/* LIBALIAS.CPP */ /* LIBALIAS.CPP */
/***************/ /***************/
bool BuildAliasData(LibraryStruct * Lib, EDA_LibComponentStruct * component); bool BuildAliasData(LibraryStruct * Lib, EDA_LibComponentStruct * component);
/* Create the alias data for the lib component to edit */ /* Create the alias data for the lib component to edit */
int LocateAlias( const wxArrayString & AliasData, const wxString & Name); int LocateAlias( const wxArrayString & AliasData, const wxString & Name);
/* Return an index in alias data list ( -1 if not found ) */ /* Return an index in alias data list ( -1 if not found ) */
/***************/ /***************/

View File

@ -1,6 +1,6 @@
/*********************************************/ /*********************************************/
/* eesave.cpp Module to Save EESchema files */ /* eesave.cpp Module to Save EESchema files */
/*********************************************/ /*********************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -20,7 +20,7 @@
/* Fonctions externes */ /* Fonctions externes */
/* Fonctions Locales */ /* Fonctions Locales */
static int SavePartDescr( FILE *f, EDA_SchComponentStruct * LibItemStruct); static int SavePartDescr( FILE *f, SCH_COMPONENT * LibItemStruct);
static int SaveSheetDescr( FILE *f, DrawSheetStruct * SheetStruct); static int SaveSheetDescr( FILE *f, DrawSheetStruct * SheetStruct);
static void SaveLayers(FILE *f); static void SaveLayers(FILE *f);
@ -33,510 +33,510 @@ static void SaveLayers(FILE *f);
*****************************************************************************/ *****************************************************************************/
bool WinEDA_SchematicFrame::SaveEEFile(SCH_SCREEN *screen, int FileSave) bool WinEDA_SchematicFrame::SaveEEFile(SCH_SCREEN *screen, int FileSave)
{ {
wxString msg; wxString msg;
wxString Name, BakName; wxString Name, BakName;
const wxChar **LibNames; const wxChar **LibNames;
const char * layer, *width; const char * layer, *width;
int ii, shape; int ii, shape;
bool Failed = FALSE; bool Failed = FALSE;
EDA_BaseStruct *Phead; EDA_BaseStruct *Phead;
Ki_PageDescr * PlotSheet; Ki_PageDescr * PlotSheet;
FILE *f; FILE *f;
wxString dirbuf; wxString dirbuf;
if ( screen == NULL ) screen = (SCH_SCREEN*)GetScreen(); if ( screen == NULL ) screen = (SCH_SCREEN*)GetScreen();
/* If no name exists in the window yet - save as new. */ /* If no name exists in the window yet - save as new. */
if( screen->m_FileName.IsEmpty() ) FileSave = FILE_SAVE_NEW; if( screen->m_FileName.IsEmpty() ) FileSave = FILE_SAVE_NEW;
switch (FileSave) switch (FileSave)
{ {
case FILE_SAVE_AS: case FILE_SAVE_AS:
dirbuf = wxGetCwd() + STRING_DIR_SEP; dirbuf = wxGetCwd() + STRING_DIR_SEP;
Name = MakeFileName(dirbuf, screen->m_FileName, g_SchExtBuffer); Name = MakeFileName(dirbuf, screen->m_FileName, g_SchExtBuffer);
/* Rename the old file to a '.bak' one: */ /* Rename the old file to a '.bak' one: */
BakName = Name; BakName = Name;
if ( wxFileExists(Name) ) if ( wxFileExists(Name) )
{ {
ChangeFileNameExt(BakName, wxT(".bak")); ChangeFileNameExt(BakName, wxT(".bak"));
wxRemoveFile(BakName); /* delete Old .bak file */ wxRemoveFile(BakName); /* delete Old .bak file */
if( ! wxRenameFile(Name, BakName) ){ if( ! wxRenameFile(Name, BakName) ){
DisplayError(this, wxT("Warning: unable to rename old file"), 10); DisplayError(this, wxT("Warning: unable to rename old file"), 10);
} }
} }
break; break;
case FILE_SAVE_NEW: case FILE_SAVE_NEW:
{ {
wxString mask = wxT("*") + g_SchExtBuffer; wxString mask = wxT("*") + g_SchExtBuffer;
Name = EDA_FileSelector(_("Schematic files:"), Name = EDA_FileSelector(_("Schematic files:"),
wxEmptyString, /* Chemin par defaut */ wxEmptyString, /* Chemin par defaut */
screen->m_FileName, /* nom fichier par defaut, et resultat */ screen->m_FileName, /* nom fichier par defaut, et resultat */
g_SchExtBuffer, /* extension par defaut */ g_SchExtBuffer, /* extension par defaut */
mask, /* Masque d'affichage */ mask, /* Masque d'affichage */
this, this,
wxFD_SAVE, wxFD_SAVE,
FALSE FALSE
); );
if ( Name.IsEmpty() ) return FALSE; if ( Name.IsEmpty() ) return FALSE;
screen->m_FileName = Name; screen->m_FileName = Name;
dirbuf = wxGetCwd() + STRING_DIR_SEP; dirbuf = wxGetCwd() + STRING_DIR_SEP;
Name = MakeFileName(dirbuf, Name, g_SchExtBuffer); Name = MakeFileName(dirbuf, Name, g_SchExtBuffer);
break; break;
} }
default: break; default: break;
} }
if ((f = wxFopen(Name, wxT("wt"))) == NULL) if ((f = wxFopen(Name, wxT("wt"))) == NULL)
{ {
msg = _("Failed to create file ") + Name; msg = _("Failed to create file ") + Name;
DisplayError(this, msg); DisplayError(this, msg);
return FALSE; return FALSE;
} }
msg = _("Save file ") + Name; msg = _("Save file ") + Name;
Affiche_Message(msg); Affiche_Message(msg);
LibNames = GetLibNames(); LibNames = GetLibNames();
BakName.Empty(); // temporary buffer! BakName.Empty(); // temporary buffer!
for (ii = 0; LibNames[ii] != NULL; ii++) for (ii = 0; LibNames[ii] != NULL; ii++)
{ {
if (ii > 0) BakName += wxT(","); if (ii > 0) BakName += wxT(",");
BakName += LibNames[ii]; BakName += LibNames[ii];
} }
MyFree( LibNames); MyFree( LibNames);
if (fprintf(f, "%s %s %d\n", EESCHEMA_FILE_STAMP, if (fprintf(f, "%s %s %d\n", EESCHEMA_FILE_STAMP,
SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION) == EOF || SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION) == EOF ||
fprintf(f, "LIBS:%s\n", CONV_TO_UTF8(BakName)) == EOF) fprintf(f, "LIBS:%s\n", CONV_TO_UTF8(BakName)) == EOF)
{ {
DisplayError(this, _("File write operation failed.")); DisplayError(this, _("File write operation failed."));
fclose(f); fclose(f);
return FALSE; return FALSE;
} }
screen->ClrModify(); screen->ClrModify();
SaveLayers(f); SaveLayers(f);
/* Sauvegarde des dimensions du schema, des textes du cartouche.. */ /* Sauvegarde des dimensions du schema, des textes du cartouche.. */
PlotSheet = screen->m_CurrentSheetDesc; PlotSheet = screen->m_CurrentSheetDesc;
fprintf(f,"$Descr %s %d %d\n",CONV_TO_UTF8(PlotSheet->m_Name), fprintf(f,"$Descr %s %d %d\n",CONV_TO_UTF8(PlotSheet->m_Name),
PlotSheet->m_Size.x, PlotSheet->m_Size.y); PlotSheet->m_Size.x, PlotSheet->m_Size.y);
fprintf(f,"Sheet %d %d\n",screen->m_ScreenNumber, screen->m_NumberOfScreen); fprintf(f,"Sheet %d %d\n",screen->m_ScreenNumber, screen->m_NumberOfScreen);
fprintf(f,"Title \"%s\"\n",CONV_TO_UTF8(screen->m_Title)); fprintf(f,"Title \"%s\"\n",CONV_TO_UTF8(screen->m_Title));
fprintf(f,"Date \"%s\"\n",CONV_TO_UTF8(screen->m_Date)); fprintf(f,"Date \"%s\"\n",CONV_TO_UTF8(screen->m_Date));
fprintf(f,"Rev \"%s\"\n",CONV_TO_UTF8(screen->m_Revision)); fprintf(f,"Rev \"%s\"\n",CONV_TO_UTF8(screen->m_Revision));
fprintf(f,"Comp \"%s\"\n",CONV_TO_UTF8(screen->m_Company)); fprintf(f,"Comp \"%s\"\n",CONV_TO_UTF8(screen->m_Company));
fprintf(f,"Comment1 \"%s\"\n", CONV_TO_UTF8(screen->m_Commentaire1)); fprintf(f,"Comment1 \"%s\"\n", CONV_TO_UTF8(screen->m_Commentaire1));
fprintf(f,"Comment2 \"%s\"\n", CONV_TO_UTF8(screen->m_Commentaire2)); fprintf(f,"Comment2 \"%s\"\n", CONV_TO_UTF8(screen->m_Commentaire2));
fprintf(f,"Comment3 \"%s\"\n", CONV_TO_UTF8(screen->m_Commentaire3)); fprintf(f,"Comment3 \"%s\"\n", CONV_TO_UTF8(screen->m_Commentaire3));
fprintf(f,"Comment4 \"%s\"\n", CONV_TO_UTF8(screen->m_Commentaire4)); fprintf(f,"Comment4 \"%s\"\n", CONV_TO_UTF8(screen->m_Commentaire4));
fprintf(f,"$EndDescr\n"); fprintf(f,"$EndDescr\n");
/* Sauvegarde des elements du dessin */ /* Sauvegarde des elements du dessin */
Phead = screen->EEDrawList; Phead = screen->EEDrawList;
while (Phead) while (Phead)
{ {
switch(Phead->Type()) switch(Phead->Type())
{ {
case DRAW_LIB_ITEM_STRUCT_TYPE: /* Its a library item. */ case TYPE_SCH_COMPONENT: /* Its a library item. */
SavePartDescr( f, (EDA_SchComponentStruct *) Phead); SavePartDescr( f, (SCH_COMPONENT *) Phead);
break; break;
case DRAW_SHEET_STRUCT_TYPE: /* Its a Sheet item. */ case DRAW_SHEET_STRUCT_TYPE: /* Its a Sheet item. */
SaveSheetDescr( f, (DrawSheetStruct *) Phead); SaveSheetDescr( f, (DrawSheetStruct *) Phead);
break; break;
case DRAW_SEGMENT_STRUCT_TYPE: /* Its a Segment item. */ case DRAW_SEGMENT_STRUCT_TYPE: /* Its a Segment item. */
#undef STRUCT #undef STRUCT
#define STRUCT ((EDA_DrawLineStruct *) Phead) #define STRUCT ((EDA_DrawLineStruct *) Phead)
layer = "Notes"; width = "Line"; layer = "Notes"; width = "Line";
if (STRUCT->m_Layer == LAYER_WIRE) layer = "Wire"; if (STRUCT->m_Layer == LAYER_WIRE) layer = "Wire";
if (STRUCT->m_Layer == LAYER_BUS) layer = "Bus"; if (STRUCT->m_Layer == LAYER_BUS) layer = "Bus";
if( STRUCT->m_Width != GR_NORM_WIDTH) layer = "Bus"; if( STRUCT->m_Width != GR_NORM_WIDTH) layer = "Bus";
if (fprintf(f, "Wire %s %s\n", layer, width ) == EOF) if (fprintf(f, "Wire %s %s\n", layer, width ) == EOF)
{ {
Failed = TRUE; break; Failed = TRUE; break;
} }
if (fprintf(f, "\t%-4d %-4d %-4d %-4d\n", if (fprintf(f, "\t%-4d %-4d %-4d %-4d\n",
STRUCT->m_Start.x,STRUCT->m_Start.y, STRUCT->m_Start.x,STRUCT->m_Start.y,
STRUCT->m_End.x,STRUCT->m_End.y) == EOF) STRUCT->m_End.x,STRUCT->m_End.y) == EOF)
{ {
Failed = TRUE; break; Failed = TRUE; break;
} }
break; break;
case DRAW_BUSENTRY_STRUCT_TYPE: /* Its a Raccord item. */ case DRAW_BUSENTRY_STRUCT_TYPE: /* Its a Raccord item. */
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawBusEntryStruct *) Phead) #define STRUCT ((DrawBusEntryStruct *) Phead)
layer = "Wire"; width = "Line"; layer = "Wire"; width = "Line";
if (STRUCT->m_Layer == LAYER_BUS) if (STRUCT->m_Layer == LAYER_BUS)
{ {
layer = "Bus"; width = "Bus"; layer = "Bus"; width = "Bus";
} }
if (fprintf(f, "Entry %s %s\n", layer, width) == EOF) if (fprintf(f, "Entry %s %s\n", layer, width) == EOF)
{ {
Failed = TRUE; break; Failed = TRUE; break;
} }
if( fprintf(f, "\t%-4d %-4d %-4d %-4d\n", if( fprintf(f, "\t%-4d %-4d %-4d %-4d\n",
STRUCT->m_Pos.x,STRUCT->m_Pos.y, STRUCT->m_Pos.x,STRUCT->m_Pos.y,
STRUCT->m_End().x,STRUCT->m_End().y) == EOF) STRUCT->m_End().x,STRUCT->m_End().y) == EOF)
{ {
Failed = TRUE; break; Failed = TRUE; break;
} }
break; break;
case DRAW_POLYLINE_STRUCT_TYPE: /* Its a polyline item. */ case DRAW_POLYLINE_STRUCT_TYPE: /* Its a polyline item. */
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawPolylineStruct *) Phead) #define STRUCT ((DrawPolylineStruct *) Phead)
layer = "Notes"; width = "Line"; layer = "Notes"; width = "Line";
if (STRUCT->m_Layer == LAYER_WIRE) layer = "Wire"; if (STRUCT->m_Layer == LAYER_WIRE) layer = "Wire";
if (STRUCT->m_Layer == LAYER_BUS) layer = "Bus"; if (STRUCT->m_Layer == LAYER_BUS) layer = "Bus";
if( STRUCT->m_Width != GR_NORM_WIDTH) width = "Bus"; if( STRUCT->m_Width != GR_NORM_WIDTH) width = "Bus";
if (fprintf(f, "Poly %s %s %d\n", if (fprintf(f, "Poly %s %s %d\n",
width, layer, STRUCT->m_NumOfPoints) == EOF) width, layer, STRUCT->m_NumOfPoints) == EOF)
{ {
Failed = TRUE; break; Failed = TRUE; break;
} }
for (ii = 0; ii < STRUCT->m_NumOfPoints; ii++) for (ii = 0; ii < STRUCT->m_NumOfPoints; ii++)
{ {
if (fprintf(f, "\t%-4d %-4d\n", if (fprintf(f, "\t%-4d %-4d\n",
STRUCT->m_Points[ii*2], STRUCT->m_Points[ii*2],
STRUCT->m_Points[ii*2+1]) == EOF) STRUCT->m_Points[ii*2+1]) == EOF)
{ {
Failed = TRUE; Failed = TRUE;
break; break;
} }
} }
break; break;
case DRAW_JUNCTION_STRUCT_TYPE: /* Its a connection item. */ case DRAW_JUNCTION_STRUCT_TYPE: /* Its a connection item. */
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawJunctionStruct *) Phead) #define STRUCT ((DrawJunctionStruct *) Phead)
if (fprintf(f, "Connection ~ %-4d %-4d\n", if (fprintf(f, "Connection ~ %-4d %-4d\n",
STRUCT->m_Pos.x, STRUCT->m_Pos.y) == EOF) STRUCT->m_Pos.x, STRUCT->m_Pos.y) == EOF)
{ {
Failed = TRUE; Failed = TRUE;
} }
break; break;
case DRAW_NOCONNECT_STRUCT_TYPE: /* Its a NoConnection item. */ case DRAW_NOCONNECT_STRUCT_TYPE: /* Its a NoConnection item. */
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawNoConnectStruct *) Phead) #define STRUCT ((DrawNoConnectStruct *) Phead)
if (fprintf(f, "NoConn ~ %-4d %-4d\n", if (fprintf(f, "NoConn ~ %-4d %-4d\n",
STRUCT->m_Pos.x, STRUCT->m_Pos.y) == EOF) STRUCT->m_Pos.x, STRUCT->m_Pos.y) == EOF)
{ {
Failed = TRUE; Failed = TRUE;
} }
break; break;
case DRAW_TEXT_STRUCT_TYPE: /* Its a text item. */ case TYPE_SCH_TEXT: /* Its a text item. */
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawTextStruct *) Phead) #define STRUCT ((SCH_TEXT *) Phead)
if (fprintf(f, "Text Notes %-4d %-4d %-4d %-4d ~\n%s\n", if (fprintf(f, "Text Notes %-4d %-4d %-4d %-4d ~\n%s\n",
STRUCT->m_Pos.x, STRUCT->m_Pos.y, STRUCT->m_Pos.x, STRUCT->m_Pos.y,
STRUCT->m_Orient, STRUCT->m_Size.x, STRUCT->m_Orient, STRUCT->m_Size.x,
CONV_TO_UTF8(STRUCT->m_Text)) == EOF) CONV_TO_UTF8(STRUCT->m_Text)) == EOF)
Failed = TRUE; Failed = TRUE;
break; break;
case DRAW_LABEL_STRUCT_TYPE: /* Its a label item. */ case TYPE_SCH_LABEL: /* Its a label item. */
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawLabelStruct *) Phead) #define STRUCT ((SCH_LABEL *) Phead)
shape = '~'; shape = '~';
if (fprintf(f, "Text Label %-4d %-4d %-4d %-4d %c\n%s\n", if (fprintf(f, "Text Label %-4d %-4d %-4d %-4d %c\n%s\n",
STRUCT->m_Pos.x, STRUCT->m_Pos.y, STRUCT->m_Pos.x, STRUCT->m_Pos.y,
STRUCT->m_Orient, STRUCT->m_Size.x, shape, STRUCT->m_Orient, STRUCT->m_Size.x, shape,
CONV_TO_UTF8(STRUCT->m_Text)) == EOF) CONV_TO_UTF8(STRUCT->m_Text)) == EOF)
Failed = TRUE; Failed = TRUE;
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: /* Its a Global label item. */ case TYPE_SCH_GLOBALLABEL: /* Its a Global label item. */
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawGlobalLabelStruct *) Phead) #define STRUCT ((SCH_GLOBALLABEL *) Phead)
shape = STRUCT->m_Shape; shape = STRUCT->m_Shape;
if (fprintf(f, "Text GLabel %-4d %-4d %-4d %-4d %s\n%s\n", if (fprintf(f, "Text GLabel %-4d %-4d %-4d %-4d %s\n%s\n",
STRUCT->m_Pos.x, STRUCT->m_Pos.y, STRUCT->m_Pos.x, STRUCT->m_Pos.y,
STRUCT->m_Orient, STRUCT->m_Size.x, STRUCT->m_Orient, STRUCT->m_Size.x,
SheetLabelType[shape], SheetLabelType[shape],
CONV_TO_UTF8(STRUCT->m_Text)) == EOF) CONV_TO_UTF8(STRUCT->m_Text)) == EOF)
Failed = TRUE; Failed = TRUE;
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE: /* Its a Hierarchical label item. */ case TYPE_SCH_HIERLABEL: /* Its a Hierarchical label item. */
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawHierLabelStruct *) Phead) #define STRUCT ((SCH_HIERLABEL *) Phead)
shape = STRUCT->m_Shape; shape = STRUCT->m_Shape;
if (fprintf(f, "Text HLabel %-4d %-4d %-4d %-4d %s\n%s\n", if (fprintf(f, "Text HLabel %-4d %-4d %-4d %-4d %s\n%s\n",
STRUCT->m_Pos.x, STRUCT->m_Pos.y, STRUCT->m_Pos.x, STRUCT->m_Pos.y,
STRUCT->m_Orient, STRUCT->m_Size.x, STRUCT->m_Orient, STRUCT->m_Size.x,
SheetLabelType[shape], SheetLabelType[shape],
CONV_TO_UTF8(STRUCT->m_Text)) == EOF) CONV_TO_UTF8(STRUCT->m_Text)) == EOF)
Failed = TRUE; Failed = TRUE;
break; break;
case DRAW_MARKER_STRUCT_TYPE: /* Its a marker item. */ case DRAW_MARKER_STRUCT_TYPE: /* Its a marker item. */
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawMarkerStruct *) Phead) #define STRUCT ((DrawMarkerStruct *) Phead)
if( STRUCT->GetComment() ) msg = STRUCT->GetComment(); if( STRUCT->GetComment() ) msg = STRUCT->GetComment();
else msg.Empty(); else msg.Empty();
if (fprintf(f, "Kmarq %c %-4d %-4d \"%s\" F=%X\n", if (fprintf(f, "Kmarq %c %-4d %-4d \"%s\" F=%X\n",
(int) STRUCT->m_Type + 'A', (int) STRUCT->m_Type + 'A',
STRUCT->m_Pos.x, STRUCT->m_Pos.y, STRUCT->m_Pos.x, STRUCT->m_Pos.y,
CONV_TO_UTF8(msg), STRUCT->m_MarkFlags) == EOF) CONV_TO_UTF8(msg), STRUCT->m_MarkFlags) == EOF)
{ {
Failed = TRUE; Failed = TRUE;
} }
break; break;
case DRAW_SHEETLABEL_STRUCT_TYPE : case DRAW_SHEETLABEL_STRUCT_TYPE :
case DRAW_PICK_ITEM_STRUCT_TYPE : case DRAW_PICK_ITEM_STRUCT_TYPE :
break; break;
default: default:
break; break;
} }
if (Failed) if (Failed)
{ {
DisplayError(this, _("File write operation failed.")); DisplayError(this, _("File write operation failed."));
break; break;
} }
Phead = Phead->Pnext; Phead = Phead->Pnext;
} }
if (fprintf(f, "$EndSCHEMATC\n") == EOF) Failed = TRUE; if (fprintf(f, "$EndSCHEMATC\n") == EOF) Failed = TRUE;
fclose(f); fclose(f);
if (FileSave == FILE_SAVE_NEW) screen->m_FileName = Name; if (FileSave == FILE_SAVE_NEW) screen->m_FileName = Name;
return !Failed; return !Failed;
} }
/*******************************************************************/ /*******************************************************************/
static int SavePartDescr( FILE *f, EDA_SchComponentStruct * LibItemStruct) static int SavePartDescr( FILE *f, SCH_COMPONENT * LibItemStruct)
/*******************************************************************/ /*******************************************************************/
/* Routine utilisee dans la routine precedente. /* Routine utilisee dans la routine precedente.
Assure la sauvegarde de la structure LibItemStruct Assure la sauvegarde de la structure LibItemStruct
*/ */
{ {
int ii, Failed = FALSE; int ii, Failed = FALSE;
char Name1[256], Name2[256]; char Name1[256], Name2[256];
int hjustify, vjustify; int hjustify, vjustify;
//this is redundant with the AR entries below, but it makes the //this is redundant with the AR entries below, but it makes the
//files backwards-compatible. //files backwards-compatible.
if(LibItemStruct->m_References.GetCount() > 0) if(LibItemStruct->m_References.GetCount() > 0)
strncpy(Name1, CONV_TO_UTF8(LibItemStruct->m_References[0]), sizeof(Name1)); strncpy(Name1, CONV_TO_UTF8(LibItemStruct->m_References[0]), sizeof(Name1));
else{ else{
if(LibItemStruct->m_Field[REFERENCE].m_Text.IsEmpty()) if(LibItemStruct->m_Field[REFERENCE].m_Text.IsEmpty())
strncpy(Name1, CONV_TO_UTF8(LibItemStruct->m_PrefixString),sizeof(Name1)); strncpy(Name1, CONV_TO_UTF8(LibItemStruct->m_PrefixString),sizeof(Name1));
else else
strncpy(Name1, CONV_TO_UTF8(LibItemStruct->m_Field[REFERENCE].m_Text),sizeof(Name1)); strncpy(Name1, CONV_TO_UTF8(LibItemStruct->m_Field[REFERENCE].m_Text),sizeof(Name1));
} }
for (ii = 0; ii < (int)strlen(Name1); ii++){ for (ii = 0; ii < (int)strlen(Name1); ii++){
if (Name1[ii] <= ' ') Name1[ii] = '~'; if (Name1[ii] <= ' ') Name1[ii] = '~';
} }
if ( ! LibItemStruct->m_ChipName.IsEmpty() ) if ( ! LibItemStruct->m_ChipName.IsEmpty() )
{ {
strncpy(Name2, CONV_TO_UTF8(LibItemStruct->m_ChipName),sizeof(Name2)); strncpy(Name2, CONV_TO_UTF8(LibItemStruct->m_ChipName),sizeof(Name2));
for (ii = 0; ii < (int)strlen(Name2); ii++) for (ii = 0; ii < (int)strlen(Name2); ii++)
if (Name2[ii] <= ' ') Name2[ii] = '~'; if (Name2[ii] <= ' ') Name2[ii] = '~';
} }
else strncpy(Name2, NULL_STRING,sizeof(Name2)); else strncpy(Name2, NULL_STRING,sizeof(Name2));
fprintf(f, "$Comp\n"); fprintf(f, "$Comp\n");
if(fprintf (f, "L %s %s\n", Name2, Name1) == EOF) if(fprintf (f, "L %s %s\n", Name2, Name1) == EOF)
{ {
Failed = TRUE; Failed = TRUE;
return(Failed); return(Failed);
} }
/* Generation de numero d'unit, convert et Time Stamp*/ /* Generation de numero d'unit, convert et Time Stamp*/
if(fprintf(f, "U %d %d %8.8lX\n", if(fprintf(f, "U %d %d %8.8lX\n",
LibItemStruct->m_Multi, LibItemStruct->m_Multi,
LibItemStruct->m_Convert, LibItemStruct->m_Convert,
LibItemStruct->m_TimeStamp) == EOF) LibItemStruct->m_TimeStamp) == EOF)
{ {
Failed = TRUE; return(Failed); Failed = TRUE; return(Failed);
} }
/* Sortie de la position */ /* Sortie de la position */
if(fprintf(f, "P %d %d\n", if(fprintf(f, "P %d %d\n",
LibItemStruct->m_Pos.x, LibItemStruct->m_Pos.y) == EOF) LibItemStruct->m_Pos.x, LibItemStruct->m_Pos.y) == EOF)
{ {
Failed = TRUE; return(Failed); Failed = TRUE; return(Failed);
} }
unsigned int i; unsigned int i;
for(i=0; i< LibItemStruct->m_References.GetCount(); i++){ for(i=0; i< LibItemStruct->m_References.GetCount(); i++){
/*format: /*format:
AR Path="/140/2" Ref="C99" AR Path="/140/2" Ref="C99"
where 140 is the uid of the contianing sheet where 140 is the uid of the contianing sheet
and 2 is the timestamp of this component. and 2 is the timestamp of this component.
(timestamps are actually 8 hex chars) (timestamps are actually 8 hex chars)
Ref is the conventional component reference for this 'path' Ref is the conventional component reference for this 'path'
*/ */
/*printf("AR Path=\"%s\" Ref=\"%s\" \n", /*printf("AR Path=\"%s\" Ref=\"%s\" \n",
CONV_TO_UTF8( LibItemStruct->m_Paths[i]), CONV_TO_UTF8( LibItemStruct->m_Paths[i]),
CONV_TO_UTF8( LibItemStruct->m_References[i] ) ); */ CONV_TO_UTF8( LibItemStruct->m_References[i] ) ); */
if( fprintf(f, "AR Path=\"%s\" Ref=\"%s\" \n", if( fprintf(f, "AR Path=\"%s\" Ref=\"%s\" \n",
CONV_TO_UTF8( LibItemStruct->m_Paths[i]), CONV_TO_UTF8( LibItemStruct->m_Paths[i]),
CONV_TO_UTF8( LibItemStruct->m_References[i] ) ) == EOF ) CONV_TO_UTF8( LibItemStruct->m_References[i] ) ) == EOF )
{ {
Failed = TRUE; break; Failed = TRUE; break;
} }
} }
for( ii = 0; ii < NUMBER_OF_FIELDS; ii++ ) for( ii = 0; ii < NUMBER_OF_FIELDS; ii++ )
{ {
PartTextStruct * field = & LibItemStruct->m_Field[ii]; PartTextStruct * field = & LibItemStruct->m_Field[ii];
if( field->m_Text.IsEmpty() ) continue; if( field->m_Text.IsEmpty() ) continue;
hjustify = 'C'; hjustify = 'C';
if ( field->m_HJustify == GR_TEXT_HJUSTIFY_LEFT) if ( field->m_HJustify == GR_TEXT_HJUSTIFY_LEFT)
hjustify = 'L'; hjustify = 'L';
else if ( field->m_HJustify == GR_TEXT_HJUSTIFY_RIGHT) else if ( field->m_HJustify == GR_TEXT_HJUSTIFY_RIGHT)
hjustify = 'R'; hjustify = 'R';
vjustify = 'C'; vjustify = 'C';
if ( field->m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM) if ( field->m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM)
vjustify = 'B'; vjustify = 'B';
else if ( field->m_VJustify == GR_TEXT_VJUSTIFY_TOP) else if ( field->m_VJustify == GR_TEXT_VJUSTIFY_TOP)
vjustify = 'T'; vjustify = 'T';
if( fprintf(f,"F %d \"%s\" %c %-3d %-3d %-3d %4.4X %c %c", ii, if( fprintf(f,"F %d \"%s\" %c %-3d %-3d %-3d %4.4X %c %c", ii,
CONV_TO_UTF8(field->m_Text), CONV_TO_UTF8(field->m_Text),
field->m_Orient == TEXT_ORIENT_HORIZ ? 'H' : 'V', field->m_Orient == TEXT_ORIENT_HORIZ ? 'H' : 'V',
field->m_Pos.x, field->m_Pos.y, field->m_Pos.x, field->m_Pos.y,
field->m_Size.x, field->m_Size.x,
field->m_Attributs, field->m_Attributs,
hjustify, vjustify) == EOF) hjustify, vjustify) == EOF)
{ {
Failed = TRUE; break; Failed = TRUE; break;
} }
// Save field name, if necessary // Save field name, if necessary
if ( ii >= FIELD1 && ! field->m_Name.IsEmpty() ) if ( ii >= FIELD1 && ! field->m_Name.IsEmpty() )
{ {
wxString fieldname = ReturnDefaultFieldName(ii); wxString fieldname = ReturnDefaultFieldName(ii);
if ( fieldname != field->m_Name ) if ( fieldname != field->m_Name )
if( fprintf(f," \"%s\"", CONV_TO_UTF8(field->m_Name) ) == EOF) if( fprintf(f," \"%s\"", CONV_TO_UTF8(field->m_Name) ) == EOF)
{ {
Failed = TRUE; break; Failed = TRUE; break;
} }
} }
if( fprintf(f,"\n") == EOF) if( fprintf(f,"\n") == EOF)
{ {
Failed = TRUE; break; Failed = TRUE; break;
} }
} }
if (Failed) return(Failed); if (Failed) return(Failed);
/* Generation du num unit, position, box ( ancienne norme )*/ /* Generation du num unit, position, box ( ancienne norme )*/
if(fprintf(f, "\t%-4d %-4d %-4d\n", if(fprintf(f, "\t%-4d %-4d %-4d\n",
LibItemStruct->m_Multi, LibItemStruct->m_Multi,
LibItemStruct->m_Pos.x, LibItemStruct->m_Pos.y) == EOF) LibItemStruct->m_Pos.x, LibItemStruct->m_Pos.y) == EOF)
{ {
Failed = TRUE; return(Failed); Failed = TRUE; return(Failed);
} }
if( fprintf(f, "\t%-4d %-4d %-4d %-4d\n", if( fprintf(f, "\t%-4d %-4d %-4d %-4d\n",
LibItemStruct->m_Transform[0][0], LibItemStruct->m_Transform[0][0],
LibItemStruct->m_Transform[0][1], LibItemStruct->m_Transform[0][1],
LibItemStruct->m_Transform[1][0], LibItemStruct->m_Transform[1][0],
LibItemStruct->m_Transform[1][1]) == EOF) LibItemStruct->m_Transform[1][1]) == EOF)
{ {
Failed = TRUE; return(Failed); Failed = TRUE; return(Failed);
} }
fprintf(f, "$EndComp\n"); fprintf(f, "$EndComp\n");
return(Failed); return(Failed);
} }
/*******************************************************************/ /*******************************************************************/
static int SaveSheetDescr( FILE *f, DrawSheetStruct * SheetStruct) static int SaveSheetDescr( FILE *f, DrawSheetStruct * SheetStruct)
/*******************************************************************/ /*******************************************************************/
/* Routine utilisee dans la routine precedente. /* Routine utilisee dans la routine precedente.
Assure la sauvegarde de la structure LibItemStruct Assure la sauvegarde de la structure LibItemStruct
*/ */
{ {
int ii; int ii;
int Failed = FALSE; int Failed = FALSE;
DrawSheetLabelStruct * SheetLabel; DrawSheetLabelStruct * SheetLabel;
fprintf(f, "$Sheet\n"); fprintf(f, "$Sheet\n");
if (fprintf(f, "S %-4d %-4d %-4d %-4d\n", if (fprintf(f, "S %-4d %-4d %-4d %-4d\n",
SheetStruct->m_Pos.x,SheetStruct->m_Pos.y, SheetStruct->m_Pos.x,SheetStruct->m_Pos.y,
SheetStruct->m_Size.x,SheetStruct->m_Size.y) == EOF){ SheetStruct->m_Size.x,SheetStruct->m_Size.y) == EOF){
Failed = TRUE; return(Failed); Failed = TRUE; return(Failed);
} }
//save the unique timestamp, like other shematic parts. //save the unique timestamp, like other shematic parts.
if( fprintf(f, "U %8.8lX\n", SheetStruct->m_TimeStamp) == EOF ){ if( fprintf(f, "U %8.8lX\n", SheetStruct->m_TimeStamp) == EOF ){
Failed = TRUE; return(Failed); Failed = TRUE; return(Failed);
} }
/* Generation de la liste des 2 textes (sheetname et filename) */ /* Generation de la liste des 2 textes (sheetname et filename) */
if ( ! SheetStruct->m_SheetName.IsEmpty()) if ( ! SheetStruct->m_SheetName.IsEmpty())
{ {
if(fprintf(f,"F0 \"%s\" %d\n", CONV_TO_UTF8(SheetStruct->m_SheetName), if(fprintf(f,"F0 \"%s\" %d\n", CONV_TO_UTF8(SheetStruct->m_SheetName),
SheetStruct->m_SheetNameSize) == EOF) SheetStruct->m_SheetNameSize) == EOF)
{ {
Failed = TRUE; return(Failed); Failed = TRUE; return(Failed);
} }
} }
if( ! SheetStruct->GetFileName().IsEmpty()) if( ! SheetStruct->GetFileName().IsEmpty())
{ {
if(fprintf(f,"F1 \"%s\" %d\n", if(fprintf(f,"F1 \"%s\" %d\n",
CONV_TO_UTF8(SheetStruct->GetFileName()), CONV_TO_UTF8(SheetStruct->GetFileName()),
SheetStruct->m_FileNameSize) == EOF) SheetStruct->m_FileNameSize) == EOF)
{ {
Failed = TRUE; return(Failed); Failed = TRUE; return(Failed);
} }
} }
/* Generation de la liste des labels (entrees) de la sous feuille */ /* Generation de la liste des labels (entrees) de la sous feuille */
ii = 2; ii = 2;
SheetLabel = SheetStruct->m_Label; SheetLabel = SheetStruct->m_Label;
while( SheetLabel != NULL ) while( SheetLabel != NULL )
{ {
int type = 'U', side = 'L'; int type = 'U', side = 'L';
if( SheetLabel->m_Text.IsEmpty() ) continue; if( SheetLabel->m_Text.IsEmpty() ) continue;
if( SheetLabel->m_Edge ) side = 'R'; if( SheetLabel->m_Edge ) side = 'R';
switch(SheetLabel->m_Shape) switch(SheetLabel->m_Shape)
{ {
case NET_INPUT: type = 'I'; break; case NET_INPUT: type = 'I'; break;
case NET_OUTPUT: type = 'O'; break; case NET_OUTPUT: type = 'O'; break;
case NET_BIDI: type = 'B'; break; case NET_BIDI: type = 'B'; break;
case NET_TRISTATE: type = 'T'; break; case NET_TRISTATE: type = 'T'; break;
case NET_UNSPECIFIED: type = 'U'; break; case NET_UNSPECIFIED: type = 'U'; break;
} }
if(fprintf(f,"F%d \"%s\" %c %c %-3d %-3d %-3d\n", ii, if(fprintf(f,"F%d \"%s\" %c %c %-3d %-3d %-3d\n", ii,
CONV_TO_UTF8(SheetLabel->m_Text), type, side, CONV_TO_UTF8(SheetLabel->m_Text), type, side,
SheetLabel->m_Pos.x, SheetLabel->m_Pos.y, SheetLabel->m_Pos.x, SheetLabel->m_Pos.y,
SheetLabel->m_Size.x) == EOF) SheetLabel->m_Size.x) == EOF)
{ {
Failed = TRUE; break; Failed = TRUE; break;
} }
ii++; ii++;
SheetLabel = (DrawSheetLabelStruct*)SheetLabel->Pnext; SheetLabel = (DrawSheetLabelStruct*)SheetLabel->Pnext;
} }
fprintf(f, "$EndSheet\n"); fprintf(f, "$EndSheet\n");
return(Failed); return(Failed);
} }
/****************************/ /****************************/
@ -546,8 +546,8 @@ static void SaveLayers(FILE *f)
theses infos are not used in eeschema theses infos are not used in eeschema
*/ */
{ {
fprintf(f,"EELAYER %2d %2d\n", g_LayerDescr.NumberOfLayers,g_LayerDescr.CurrentLayer); fprintf(f,"EELAYER %2d %2d\n", g_LayerDescr.NumberOfLayers,g_LayerDescr.CurrentLayer);
fprintf(f,"EELAYER END\n"); fprintf(f,"EELAYER END\n");
} }

View File

@ -273,36 +273,36 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_SCH_EDIT_TEXT: case ID_POPUP_SCH_EDIT_TEXT:
EditSchematicText( (DrawTextStruct*) GetScreen()->GetCurItem(), &dc ); EditSchematicText( (SCH_TEXT*) GetScreen()->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_ROTATE_TEXT: case ID_POPUP_SCH_ROTATE_TEXT:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ChangeTextOrient( (DrawTextStruct*) GetScreen()->GetCurItem(), &dc ); ChangeTextOrient( (SCH_TEXT*) GetScreen()->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertTextType( (DrawTextStruct*) GetScreen()->GetCurItem(), ConvertTextType( (SCH_TEXT*) GetScreen()->GetCurItem(),
&dc, DRAW_LABEL_STRUCT_TYPE ); &dc, TYPE_SCH_LABEL );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertTextType( (DrawTextStruct*) GetScreen()->GetCurItem(), ConvertTextType( (SCH_TEXT*) GetScreen()->GetCurItem(),
&dc, DRAW_GLOBAL_LABEL_STRUCT_TYPE ); &dc, TYPE_SCH_GLOBALLABEL );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertTextType( (DrawTextStruct*) GetScreen()->GetCurItem(), ConvertTextType( (SCH_TEXT*) GetScreen()->GetCurItem(),
&dc, DRAW_HIER_LABEL_STRUCT_TYPE ); &dc, TYPE_SCH_HIERLABEL );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertTextType( (DrawTextStruct*) GetScreen()->GetCurItem(), ConvertTextType( (SCH_TEXT*) GetScreen()->GetCurItem(),
&dc, DRAW_TEXT_STRUCT_TYPE ); &dc, TYPE_SCH_TEXT );
break; break;
case ID_POPUP_SCH_SET_SHAPE_TEXT: case ID_POPUP_SCH_SET_SHAPE_TEXT:
@ -347,7 +347,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)
GetScreen() ) ); GetScreen() ) );
@ -403,7 +403,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)
GetScreen() ) ); GetScreen() ) );
if( GetScreen()->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
@ -431,13 +431,13 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)
GetScreen() ) ); GetScreen() ) );
if( GetScreen()->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
break; break;
InstallCmpeditFrame( this, pos, InstallCmpeditFrame( this, pos,
(EDA_SchComponentStruct*) GetScreen()->GetCurItem() ); (SCH_COMPONENT*) GetScreen()->GetCurItem() );
break; break;
case ID_POPUP_SCH_MIROR_X_CMP: case ID_POPUP_SCH_MIROR_X_CMP:
@ -448,7 +448,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)
GetScreen() ) ); GetScreen() ) );
if( GetScreen()->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
@ -480,7 +480,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
SaveCopyInUndoList( GetScreen()->GetCurItem(), IS_CHANGED ); SaveCopyInUndoList( GetScreen()->GetCurItem(), IS_CHANGED );
CmpRotationMiroir( CmpRotationMiroir(
(EDA_SchComponentStruct*) GetScreen()->GetCurItem(), (SCH_COMPONENT*) GetScreen()->GetCurItem(),
&dc, option ); &dc, option );
break; break;
} }
@ -493,41 +493,41 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)
GetScreen() ) ); GetScreen() ) );
if( GetScreen()->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
break; break;
EditComponentValue( EditComponentValue(
(EDA_SchComponentStruct*) GetScreen()->GetCurItem(), &dc ); (SCH_COMPONENT*) GetScreen()->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_EDIT_REF_CMP: case ID_POPUP_SCH_EDIT_REF_CMP:
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)
GetScreen() ) ); GetScreen() ) );
if( GetScreen()->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
break; break;
EditComponentReference( EditComponentReference(
(EDA_SchComponentStruct*) GetScreen()->GetCurItem(), &dc ); (SCH_COMPONENT*) GetScreen()->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_EDIT_FOOTPRINT_CMP: case ID_POPUP_SCH_EDIT_FOOTPRINT_CMP:
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)
GetScreen() ) ); GetScreen() ) );
if( GetScreen()->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
break; break;
EditComponentFootprint( EditComponentFootprint(
(EDA_SchComponentStruct*) GetScreen()->GetCurItem(), &dc ); (SCH_COMPONENT*) GetScreen()->GetCurItem(), &dc );
break; break;
@ -535,25 +535,25 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)
GetScreen() ) ); GetScreen() ) );
if( GetScreen()->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertPart( ConvertPart(
(EDA_SchComponentStruct*) GetScreen()->GetCurItem(), (SCH_COMPONENT*) GetScreen()->GetCurItem(),
&dc ); &dc );
break; break;
case ID_POPUP_SCH_COPY_COMPONENT_CMP: case ID_POPUP_SCH_COPY_COMPONENT_CMP:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
{ {
EDA_SchComponentStruct* olditem, * newitem; SCH_COMPONENT* olditem, * newitem;
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)
GetScreen() ) ); GetScreen() ) );
olditem = (EDA_SchComponentStruct*) GetScreen()->GetCurItem(); olditem = (SCH_COMPONENT*) GetScreen()->GetCurItem();
if( olditem == NULL ) if( olditem == NULL )
break; break;
newitem = olditem->GenCopy(); newitem = olditem->GenCopy();
@ -597,14 +597,14 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)
GetScreen() ) ); GetScreen() ) );
if( GetScreen()->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
SelPartUnit( SelPartUnit(
(EDA_SchComponentStruct*) GetScreen()->GetCurItem(), (SCH_COMPONENT*) GetScreen()->GetCurItem(),
id + 1 - ID_POPUP_SCH_SELECT_UNIT1, id + 1 - ID_POPUP_SCH_SELECT_UNIT1,
&dc ); &dc );
break; break;
@ -613,7 +613,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a piece of a // Ensure the struct is a component (could be a piece of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)
GetScreen() ) ); GetScreen() ) );
if( GetScreen()->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
@ -621,7 +621,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
{ {
EDA_LibComponentStruct* LibEntry; EDA_LibComponentStruct* LibEntry;
LibEntry = FindLibPart( LibEntry = FindLibPart(
( (EDA_SchComponentStruct*) GetScreen()->GetCurItem() )->m_ChipName, ( (SCH_COMPONENT*) GetScreen()->GetCurItem() )->m_ChipName,
wxEmptyString, wxEmptyString,
FIND_ALIAS ); FIND_ALIAS );
if( LibEntry && LibEntry->m_DocFile != wxEmptyString ) if( LibEntry && LibEntry->m_DocFile != wxEmptyString )
@ -755,15 +755,15 @@ void WinEDA_SchematicFrame::Process_Move_Item( EDA_BaseStruct* DrawStruct,
StartMoveBusEntry( (DrawBusEntryStruct*) DrawStruct, DC ); StartMoveBusEntry( (DrawBusEntryStruct*) DrawStruct, DC );
break; break;
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
StartMoveTexte( (DrawTextStruct*) DrawStruct, DC ); StartMoveTexte( (SCH_TEXT*) DrawStruct, DC );
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
StartMovePart( (EDA_SchComponentStruct*) DrawStruct, DC ); StartMovePart( (SCH_COMPONENT*) DrawStruct, DC );
break; break;
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:

View File

@ -90,22 +90,22 @@ void SwapData( EDA_BaseStruct* Item )
EXCHG( SOURCE->m_Pos, DEST->m_Pos ); EXCHG( SOURCE->m_Pos, DEST->m_Pos );
break; break;
case DRAW_LABEL_STRUCT_TYPE: case TYPE_SCH_LABEL:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case TYPE_SCH_GLOBALLABEL:
case DRAW_HIER_LABEL_STRUCT_TYPE: case TYPE_SCH_HIERLABEL:
case DRAW_TEXT_STRUCT_TYPE: case TYPE_SCH_TEXT:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ( (DrawTextStruct*) Item ) #define SOURCE ( (SCH_TEXT*) Item )
#define DEST ( (DrawTextStruct*) image ) #define DEST ( (SCH_TEXT*) image )
DEST->SwapData( SOURCE ); DEST->SwapData( SOURCE );
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case TYPE_SCH_COMPONENT:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ( (EDA_SchComponentStruct*) Item ) #define SOURCE ( (SCH_COMPONENT*) Item )
#define DEST ( (EDA_SchComponentStruct*) image ) #define DEST ( (SCH_COMPONENT*) image )
DEST->SwapData( SOURCE ); DEST->SwapData( SOURCE );
break; break;

View File

@ -71,7 +71,7 @@ public:
/* Cross probing with pcbnew */ /* Cross probing with pcbnew */
void SendMessageToPCBNEW( EDA_BaseStruct* objectToSync, void SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
EDA_SchComponentStruct* LibItem ); SCH_COMPONENT* LibItem );
/* netlist generation */ /* netlist generation */
void* BuildNetListBase(); void* BuildNetListBase();
@ -144,10 +144,10 @@ private:
// Text ,label, glabel // Text ,label, glabel
EDA_BaseStruct* CreateNewText( wxDC* DC, int type ); EDA_BaseStruct* CreateNewText( wxDC* DC, int type );
void EditSchematicText( DrawTextStruct* TextStruct, wxDC* DC ); void EditSchematicText( SCH_TEXT* TextStruct, wxDC* DC );
void ChangeTextOrient( DrawTextStruct* TextStruct, wxDC* DC ); void ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC );
void StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC ); void StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC );
void ConvertTextType( DrawTextStruct* Text, wxDC* DC, int newtype ); void ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype );
// Wire, Bus // Wire, Bus
void BeginSegment( wxDC* DC, int type ); void BeginSegment( wxDC* DC, int type );
@ -168,10 +168,10 @@ private:
public: public:
bool EditSheet( DrawSheetStruct* Sheet, wxDC* DC ); bool EditSheet( DrawSheetStruct* Sheet, wxDC* DC );
/** Function UpdateSheetNumberAndDate /** Function UpdateSheetNumberAndDate
* Set a sheet number, the sheet count for sheets in the whole schematic * Set a sheet number, the sheet count for sheets in the whole schematic
* and update the date in all screens * and update the date in all screens
*/ */
void UpdateSheetNumberAndDate(); void UpdateSheetNumberAndDate();
private: private:
@ -188,25 +188,25 @@ public:
private: private:
// Component // Component
EDA_SchComponentStruct* Load_Component( wxDC* DC, SCH_COMPONENT* Load_Component( wxDC* DC,
const wxString& libname, const wxString& libname,
wxArrayString& List, wxArrayString& List,
bool UseLibBrowser ); bool UseLibBrowser );
void StartMovePart( EDA_SchComponentStruct* DrawLibItem, wxDC* DC ); void StartMovePart( SCH_COMPONENT* DrawLibItem, wxDC* DC );
public: public:
void CmpRotationMiroir( EDA_SchComponentStruct* DrawComponent, void CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
wxDC* DC, int type_rotate ); wxDC* DC, int type_rotate );
private: private:
void SelPartUnit( EDA_SchComponentStruct* DrawComponent, void SelPartUnit( SCH_COMPONENT* DrawComponent,
int unit, wxDC* DC ); int unit, wxDC* DC );
void ConvertPart( EDA_SchComponentStruct* DrawComponent, wxDC* DC ); void ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC );
void SetInitCmp( EDA_SchComponentStruct* DrawComponent, wxDC* DC ); void SetInitCmp( SCH_COMPONENT* DrawComponent, wxDC* DC );
void EditComponentReference( EDA_SchComponentStruct* DrawLibItem, void EditComponentReference( SCH_COMPONENT* DrawLibItem,
wxDC* DC ); wxDC* DC );
void EditComponentValue( EDA_SchComponentStruct* DrawLibItem, wxDC* DC ); void EditComponentValue( SCH_COMPONENT* DrawLibItem, wxDC* DC );
void EditComponentFootprint( EDA_SchComponentStruct* DrawLibItem, void EditComponentFootprint( SCH_COMPONENT* DrawLibItem,
wxDC* DC ); wxDC* DC );
void StartMoveCmpField( PartTextStruct* Field, wxDC* DC ); void StartMoveCmpField( PartTextStruct* Field, wxDC* DC );
void EditCmpFieldText( PartTextStruct* Field, wxDC* DC ); void EditCmpFieldText( PartTextStruct* Field, wxDC* DC );

View File

@ -153,7 +153,7 @@ static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
if( SheetLabel->m_Flags & IS_NEW ) if( SheetLabel->m_Flags & IS_NEW )
{ /* Nouveau Placement en cours, on l'efface */ { /* Nouveau Placement en cours, on l'efface */
RedrawOneStruct( Panel, DC, SheetLabel, g_XorMode ); RedrawOneStruct( Panel, DC, SheetLabel, g_XorMode );
SAFE_DELETE( SheetLabel ); SAFE_DELETE( SheetLabel );
} }
else else
{ {
@ -359,16 +359,16 @@ DrawSheetLabelStruct* WinEDA_SchematicFrame::Import_PinSheet( DrawSheetStruct* S
{ {
EDA_BaseStruct* DrawStruct; EDA_BaseStruct* DrawStruct;
DrawSheetLabelStruct* NewSheetLabel, * SheetLabel = NULL; DrawSheetLabelStruct* NewSheetLabel, * SheetLabel = NULL;
DrawHierLabelStruct* HLabel = NULL; SCH_HIERLABEL* HLabel = NULL;
if(!Sheet->m_AssociatedScreen) return NULL; if(!Sheet->m_AssociatedScreen) return NULL;
DrawStruct = Sheet->m_AssociatedScreen->EEDrawList; DrawStruct = Sheet->m_AssociatedScreen->EEDrawList;
HLabel = NULL; HLabel = NULL;
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
{ {
if( DrawStruct->Type() != DRAW_HIER_LABEL_STRUCT_TYPE ) if( DrawStruct->Type() != TYPE_SCH_HIERLABEL )
continue; continue;
HLabel = (DrawHierLabelStruct*) DrawStruct; HLabel = (SCH_HIERLABEL*) DrawStruct;
/* Ici un G-Label a ete trouve: y a t-il un SheetLabel correspondant */ /* Ici un G-Label a ete trouve: y a t-il un SheetLabel correspondant */
SheetLabel = Sheet->m_Label; SheetLabel = Sheet->m_Label;

View File

@ -47,11 +47,11 @@ enum KICAD_T {
// Draw Items in schematic // Draw Items in schematic
DRAW_POLYLINE_STRUCT_TYPE, DRAW_POLYLINE_STRUCT_TYPE,
DRAW_JUNCTION_STRUCT_TYPE, DRAW_JUNCTION_STRUCT_TYPE,
DRAW_TEXT_STRUCT_TYPE, TYPE_SCH_TEXT,
DRAW_LABEL_STRUCT_TYPE, TYPE_SCH_LABEL,
DRAW_GLOBAL_LABEL_STRUCT_TYPE, TYPE_SCH_GLOBALLABEL,
DRAW_HIER_LABEL_STRUCT_TYPE, TYPE_SCH_HIERLABEL,
DRAW_LIB_ITEM_STRUCT_TYPE, TYPE_SCH_COMPONENT,
DRAW_PICK_ITEM_STRUCT_TYPE, DRAW_PICK_ITEM_STRUCT_TYPE,
DRAW_SEGMENT_STRUCT_TYPE, DRAW_SEGMENT_STRUCT_TYPE,
DRAW_BUSENTRY_STRUCT_TYPE, DRAW_BUSENTRY_STRUCT_TYPE,
@ -195,12 +195,12 @@ public:
EDA_Rect& Inflate( wxCoord dx, wxCoord dy ); EDA_Rect& Inflate( wxCoord dx, wxCoord dy );
/** Function Merge /** Function Merge
* Modify Position and Size of this in order to contain the given rect * Modify Position and Size of this in order to contain the given rect
* 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( const EDA_Rect & aRect ); void Merge( const EDA_Rect & aRect );
}; };
@ -357,6 +357,10 @@ public:
*/ */
virtual EDA_Rect GetBoundingBox() virtual EDA_Rect GetBoundingBox()
{ {
#if defined (DEBUG)
printf("Missing GetBoundingBox() -> no good! :-)\n");
Show( 0, std::cout ); // tell me which classes still need GetBoundingBox support
#endif
// return a zero-sized box per default. derived classes should override this // return a zero-sized box per default. derived classes should override this
EDA_Rect ret( wxPoint( 0, 0 ), wxSize( 0, 0 ) ); EDA_Rect ret( wxPoint( 0, 0 ), wxSize( 0, 0 ) );
return ret; return ret;
@ -668,18 +672,44 @@ public:
}; };
/**************************/ /**
/* class DrawPickedStruct */ * Class SCH_ITEM
/**************************/ * is a base class for any item which can be embedded within the SCHEMATIC
* container class, and therefore instances of derived classes should only be
/* Class to hold structures picked by pick events (like block selection) * found in EESCHEMA or other programs that use class SCHEMATIC and its contents.
* This class has only one useful member: .m_PickedStruct, used as a link. * The corresponding class in PCBNEW is BOARD_ITEM.
* It does not describe really an item.
* It is used to create a linked list of selected items (in block selection).
* Each DrawPickedStruct item has is member: .m_PickedStruct pointing the
* real selected item
*/ */
class DrawPickedStruct : public EDA_BaseStruct class SCH_ITEM : public EDA_BaseStruct
{
protected:
int m_Layer;
public:
SCH_ITEM( EDA_BaseStruct* aParent, KICAD_T aType ) :
EDA_BaseStruct( aParent, aType ),
m_Layer( 0 )
{
}
~SCH_ITEM(){}
virtual wxString GetClass() const
{
return wxT( "SCH_ITEM" );
}
};
/**
* Class DrawPickedStruct
* holds structures picked by pick events (like block selection).
* This class has only one useful member: .m_PickedStruct, used as a link.
* It is used to create a linked list of selected items (in block selection).
* Each DrawPickedStruct item has is member: .m_PickedStruct pointing the
* real selected item.
*/
class DrawPickedStruct : public SCH_ITEM
{ {
public: public:
EDA_BaseStruct* m_PickedStruct; EDA_BaseStruct* m_PickedStruct;
@ -691,6 +721,22 @@ public:
void DeleteWrapperList(); void DeleteWrapperList();
DrawPickedStruct* Next() { return (DrawPickedStruct*) Pnext; } DrawPickedStruct* Next() { return (DrawPickedStruct*) Pnext; }
EDA_Rect GetBoundingBox();
/**
* Function GetBoundingBoxUnion
* returns the union of all the BoundingBox rectangles of all held items
* in the picklist whose list head is this DrawPickedStruct.
* @return EDA_Rect - The combined, composite, bounding box.
*/
EDA_Rect GetBoundingBoxUnion();
wxString GetClass() const { return wxT( "DrawPickedStruct" ); }
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os );
#endif
}; };
#endif /* BASE_STRUCT_H */ #endif /* BASE_STRUCT_H */

View File

@ -71,13 +71,13 @@ class EDA_LibComponentStruct;
class LibEDA_BaseStruct; class LibEDA_BaseStruct;
class EDA_BaseStruct; class EDA_BaseStruct;
class DrawBusEntryStruct; class DrawBusEntryStruct;
class DrawGlobalLabelStruct; class SCH_GLOBALLABEL;
class DrawTextStruct; class SCH_TEXT;
class EDA_DrawLineStruct; class EDA_DrawLineStruct;
class DrawSheetStruct; class DrawSheetStruct;
class DrawSheetPath; class DrawSheetPath;
class DrawSheetLabelStruct; class DrawSheetLabelStruct;
class EDA_SchComponentStruct; class SCH_COMPONENT;
class LibDrawField; class LibDrawField;
class PartTextStruct; class PartTextStruct;
class LibDrawPin; class LibDrawPin;
@ -158,7 +158,7 @@ public:
WinEDA_BasicFrame( wxWindow* father, int idtype, WinEDA_App* parent, WinEDA_BasicFrame( wxWindow* father, int idtype, WinEDA_App* parent,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE); long style = KICAD_DEFAULT_DRAWFRAME_STYLE);
#ifdef KICAD_PYTHON #ifdef KICAD_PYTHON
WinEDA_BasicFrame( const WinEDA_BasicFrame& ) { } // Should throw!! WinEDA_BasicFrame( const WinEDA_BasicFrame& ) { } // Should throw!!
WinEDA_BasicFrame() { } // Should throw!! WinEDA_BasicFrame() { } // Should throw!!
@ -230,12 +230,12 @@ public:
WinEDA_DrawFrame( wxWindow* father, int idtype, WinEDA_App* parent, WinEDA_DrawFrame( wxWindow* father, int idtype, WinEDA_App* parent,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_DrawFrame(); ~WinEDA_DrawFrame();
virtual BASE_SCREEN* GetScreen() { return m_CurrentScreen; } virtual BASE_SCREEN* GetScreen() { return m_CurrentScreen; }
virtual wxString GetScreenDesc(); virtual wxString GetScreenDesc();
void OnMenuOpen( wxMenuEvent& event ); void OnMenuOpen( wxMenuEvent& event );
void OnMouseEvent( wxMouseEvent& event ); void OnMouseEvent( wxMouseEvent& event );
@ -279,7 +279,7 @@ public:
virtual int BestZoom() = 0; virtual int BestZoom() = 0;
/* Return the current zoom level */ /* Return the current zoom level */
int GetZoom(void); int GetZoom(void);
void ToPrinter( wxCommandEvent& event ); void ToPrinter( wxCommandEvent& event );
void SVG_Print( wxCommandEvent& event ); void SVG_Print( wxCommandEvent& event );
@ -353,7 +353,7 @@ public:
WinEDA_LibeditFrame( wxWindow* father, WinEDA_App* parent, WinEDA_LibeditFrame( wxWindow* father, WinEDA_App* parent,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_LibeditFrame(); ~WinEDA_LibeditFrame();
@ -422,7 +422,7 @@ private:
void RotateSymbolText( wxDC* DC ); void RotateSymbolText( wxDC* DC );
void DeleteDrawPoly( wxDC* DC ); void DeleteDrawPoly( wxDC* DC );
LibDrawField* LocateField( EDA_LibComponentStruct* LibEntry ); LibDrawField* LocateField( EDA_LibComponentStruct* LibEntry );
LibEDA_BaseStruct* LocateItemUsingCursor(); LibEDA_BaseStruct* LocateItemUsingCursor();
void RotateField( wxDC* DC, LibDrawField* Field ); void RotateField( wxDC* DC, LibDrawField* Field );
void PlaceField( wxDC* DC, LibDrawField* Field ); void PlaceField( wxDC* DC, LibDrawField* Field );
void EditField( wxDC* DC, LibDrawField* Field ); void EditField( wxDC* DC, LibDrawField* Field );

View File

@ -934,7 +934,7 @@ typedef boost::ptr_vector<WINDOW> WINDOWS;
/** /**
* Class KEEPOUT * Class KEEPOUT
* is used for <keepout_descriptor> and <plane_descriptor>. * is used for &lt;keepout_descriptor&gt; and &lt;plane_descriptor&gt;.
*/ */
class KEEPOUT : public ELEM class KEEPOUT : public ELEM
{ {