Commit adb4ad1a authored by Wayne Stambaugh's avatar Wayne Stambaugh

Schematic object improvements and other minor fixes.

parent f64b3a51
...@@ -4,6 +4,26 @@ KiCad ChangeLog 2010 ...@@ -4,6 +4,26 @@ KiCad ChangeLog 2010
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.
2010-dec-10 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++All
* Make a whole bunch of object methods const in order to make HitTest() const.
* Lots of coding policy fixes.
++common
* Add Inside override to EDA_Rect to test if another EDA_Rect is inside.
* Add additional parameter to EDA_TextStruct GetTextBox method to support
Y axis inversion and non-default thickness.
* Add accuracy parameter to EDA_TextStruct TextHitTest method.
++EESchema
* Refactor schematic object hit testing to provide coherent object interface.
* Remove redundant GetBoundaryBox from schematic component object.
* Remove redundant layer member from schematic text object.
* Create hit test override to check for rectangle intersection and
containment.
* Simplify schematic block selection hit testing.
* Make schematic and component library object enum naming consistent.
2010-dec-08 UPDATE Wayne Stambaugh <stambaughw@verizon.net> 2010-dec-08 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================ ================================================================================
++All ++All
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "base_struct.h" #include "base_struct.h"
#include "sch_item_struct.h"
#include "class_base_screen.h" #include "class_base_screen.h"
#include "id.h" #include "id.h"
......
...@@ -143,7 +143,7 @@ std::ostream& operator<<( std::ostream& out, const wxPoint& pt ) ...@@ -143,7 +143,7 @@ std::ostream& operator<<( std::ostream& out, const wxPoint& pt )
* 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_ITEM::Show( int nestLevel, std::ostream& os ) void EDA_ITEM::Show( int nestLevel, std::ostream& os ) const
{ {
// XML output: // XML output:
wxString s = GetClass(); wxString s = GetClass();
...@@ -211,67 +211,64 @@ int EDA_TextStruct::LenSize( const wxString& aLine ) const ...@@ -211,67 +211,64 @@ int EDA_TextStruct::LenSize( const wxString& aLine ) const
} }
/** EDA_Rect EDA_TextStruct::GetTextBox( int aLine, int aThickness, bool aInvertY ) const
* Function GetTextBox
* useful in multiline texts to calculate the full text or a line area (for zones filling, locate functions....)
* @return the rect containing the line of text (i.e. the position and the size of one line)
* this rectangle is calculated for 0 orient text. if orient is not 0 the rect must be rotated to match the physical area
* @param aLine : the line of text to consider.
* for single line text, aLine is unused
* If aLine == -1, the full area (considering all lines) is returned
*/
EDA_Rect EDA_TextStruct::GetTextBox( int aLine )
{ {
EDA_Rect rect; EDA_Rect rect;
wxPoint pos; wxPoint pos;
wxArrayString* list = NULL; wxArrayString* list = NULL;
wxString text = m_Text;
wxString* text = &m_Text; int thickness = ( aThickness < 0 ) ? m_Thickness : aThickness;
if( m_MultilineAllowed ) if( m_MultilineAllowed )
{ {
list = wxStringSplit( m_Text, '\n' ); list = wxStringSplit( m_Text, '\n' );
if ( list->GetCount() ) // GetCount() == 0 for void strings if ( list->GetCount() ) // GetCount() == 0 for void strings
{ {
if( aLine >= 0 && (aLine < (int)list->GetCount()) ) if( aLine >= 0 && (aLine < (int)list->GetCount()) )
text = &list->Item( aLine ); text = list->Item( aLine );
else else
text = &list->Item( 0 ); text = list->Item( 0 );
} }
} }
// calculate the H and V size // calculate the H and V size
int dx = LenSize( *text ); int dx = LenSize( text );
int dy = GetInterline(); int dy = GetInterline();
/* Creates bounding box (rectangle) for an horizontal text */ /* Creates bounding box (rectangle) for an horizontal text */
wxSize textsize = wxSize( dx, dy ); wxSize textsize = wxSize( dx, dy );
if( aInvertY )
rect.SetOrigin( m_Pos.x, -m_Pos.y );
else
rect.SetOrigin( m_Pos ); rect.SetOrigin( m_Pos );
// extra dy interval for letters like j and y and ] // extra dy interval for letters like j and y and ]
int extra_dy = dy - m_Size.y; int extra_dy = dy - m_Size.y;
rect.Move(wxPoint(0, -extra_dy/2 ) ); // move origin by the half extra interval rect.Move( wxPoint( 0, -extra_dy / 2 ) ); // move origin by the half extra interval
// for multiline texts and aLine < 0, merge all rectangles // for multiline texts and aLine < 0, merge all rectangles
if( m_MultilineAllowed && list && aLine < 0 ) if( m_MultilineAllowed && list && aLine < 0 )
{ {
for( unsigned ii = 1; ii < list->GetCount(); ii++ ) for( unsigned ii = 1; ii < list->GetCount(); ii++ )
{ {
text = &list->Item( ii ); text = list->Item( ii );
dx = LenSize( *text ); dx = LenSize( text );
textsize.x = MAX( textsize.x, dx ); textsize.x = MAX( textsize.x, dx );
textsize.y += dy; textsize.y += dy;
} }
} }
delete list; delete list;
rect.SetSize( textsize ); rect.SetSize( textsize );
rect.Inflate( m_Thickness/2 ); // ensure a small margin rect.Inflate( thickness / 2 ); // ensure a small margin
/* Now, calculate the rect origin, according to text justification /* Now, calculate the rect origin, according to text justification
* At this point the rectangle origin is the text origin (m_Pos). * At this point the rectangle origin is the text origin (m_Pos).
* This is true only for left and top text justified texts (using top to bottom Y axis orientation). * This is true only for left and top text justified texts (using top to bottom Y axis
* and must be recalculated for others justifications * orientation). and must be recalculated for others justifications
* also, note the V justification is relative to the first line * also, note the V justification is relative to the first line
*/ */
switch( m_HJustify ) switch( m_HJustify )
...@@ -288,7 +285,8 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine ) ...@@ -288,7 +285,8 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine )
break; break;
} }
dy = m_Size.y + m_Thickness; dy = m_Size.y + thickness;
switch( m_VJustify ) switch( m_VJustify )
{ {
case GR_TEXT_VJUSTIFY_TOP: case GR_TEXT_VJUSTIFY_TOP:
...@@ -304,46 +302,36 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine ) ...@@ -304,46 +302,36 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine )
} }
rect.Normalize(); // Make h and v sizes always >= 0 rect.Normalize(); // Make h and v sizes always >= 0
return rect; return rect;
} }
/*************************************************/ bool EDA_TextStruct::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
bool EDA_TextStruct::TextHitTest( const wxPoint& posref )
/*************************************************/
/**
* Function TextHitTest (overlayed)
* tests if the given point is inside this object.
* @param posref point to test
* @return bool - true if a hit, else false
*/
{ {
EDA_Rect rect = GetTextBox( -1 ); // Get the full text area. EDA_Rect rect = GetTextBox( -1 ); // Get the full text area.
wxPoint location = aPoint;
/* Is the ref point inside the text area ? */ rect.Inflate( aAccuracy );
wxPoint location = posref;
RotatePoint( &location, m_Pos, -m_Orient ); RotatePoint( &location, m_Pos, -m_Orient );
return rect.Inside ( location); return rect.Inside( location );
} }
/** bool EDA_TextStruct::TextHitTest( const EDA_Rect& aRect, bool aContains, int aAccuracy ) const
* Function TextHitTest (overlayed)
* tests if the given EDA_Rect intersect this object.
* @param refArea the given EDA_Rect to test
* @return bool - true if a hit, else false
*/
/*********************************************************/
bool EDA_TextStruct::TextHitTest( EDA_Rect& refArea )
/*********************************************************/
{ {
if( refArea.Inside( m_Pos ) ) EDA_Rect rect = aRect;
return true;
return false; rect.Inflate( aAccuracy );
if( aContains )
return rect.Inside( GetTextBox( -1 ) );
return rect.Intersects( GetTextBox( -1 ) );
} }
/***************************************************************/ /***************************************************************/
void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_Colors aColor, const wxPoint& aOffset, EDA_Colors aColor,
...@@ -523,13 +511,11 @@ void EDA_Rect::Move( const wxPoint& aMoveVector ) ...@@ -523,13 +511,11 @@ void EDA_Rect::Move( const wxPoint& aMoveVector )
m_Pos += aMoveVector; m_Pos += aMoveVector;
} }
/*******************************************/
bool EDA_Rect::Inside( const wxPoint& point )
/*******************************************/
/* Return TRUE if point is in Rect /* Return TRUE if point is in Rect
* Accept rect size < 0 * Accept rect size < 0
*/ */
bool EDA_Rect::Inside( const wxPoint& point ) const
{ {
int rel_posx = point.x - m_Pos.x; int rel_posx = point.x - m_Pos.x;
int rel_posy = point.y - m_Pos.y; int rel_posy = point.y - m_Pos.y;
...@@ -547,10 +533,16 @@ bool EDA_Rect::Inside( const wxPoint& point ) ...@@ -547,10 +533,16 @@ bool EDA_Rect::Inside( const wxPoint& point )
rel_posy += size.y; rel_posy += size.y;
} }
return (rel_posx >= 0) && (rel_posy >= 0) return (rel_posx >= 0) && (rel_posy >= 0) && ( rel_posy <= size.y) && ( rel_posx <= size.x);
&& ( rel_posy <= size.y) }
&& ( rel_posx <= size.x)
;
bool EDA_Rect::Inside( const EDA_Rect& aRect ) const
{
wxRect rect = aRect;
wxRect me = wxRect();
return me.Contains( rect );
} }
...@@ -710,4 +702,3 @@ void EDA_Rect::Merge( const wxPoint& aPoint ) ...@@ -710,4 +702,3 @@ void EDA_Rect::Merge( const wxPoint& aPoint )
end.y = MAX( end.y, aPoint.y ); end.y = MAX( end.y, aPoint.y );
SetEnd( end ); SetEnd( end );
} }
...@@ -130,7 +130,7 @@ bool MARKER_BASE::HitTestMarker( const wxPoint& refPos ) ...@@ -130,7 +130,7 @@ bool MARKER_BASE::HitTestMarker( const wxPoint& refPos )
* object, and the units should be in the pcb or schematic coordinate system. * object, and the units should be in the pcb or schematic coordinate system.
* It is OK to overestimate the size by a few counts. * It is OK to overestimate the size by a few counts.
*/ */
EDA_Rect MARKER_BASE::GetBoundingBoxMarker() EDA_Rect MARKER_BASE::GetBoundingBoxMarker() const
{ {
wxSize realsize = m_ShapeBoundingBox.GetSize(); wxSize realsize = m_ShapeBoundingBox.GetSize();
wxPoint realposition = m_ShapeBoundingBox.GetPosition(); wxPoint realposition = m_ShapeBoundingBox.GetPosition();
...@@ -139,7 +139,7 @@ EDA_Rect MARKER_BASE::GetBoundingBoxMarker() ...@@ -139,7 +139,7 @@ EDA_Rect MARKER_BASE::GetBoundingBoxMarker()
realposition.x *= m_ScalingFactor; realposition.x *= m_ScalingFactor;
realposition.y *= m_ScalingFactor; realposition.y *= m_ScalingFactor;
realposition += m_Pos; realposition += m_Pos;
return EDA_Rect( m_Pos,realsize ); return EDA_Rect( m_Pos, realsize );
} }
/**********************************************************************/ /**********************************************************************/
......
...@@ -73,7 +73,7 @@ void ReAnnotatePowerSymbolsOnly( void ) ...@@ -73,7 +73,7 @@ void ReAnnotatePowerSymbolsOnly( void )
for( ; DrawList != NULL; DrawList = DrawList->Next() ) for( ; DrawList != NULL; DrawList = DrawList->Next() )
{ {
if( DrawList->Type() != TYPE_SCH_COMPONENT ) if( DrawList->Type() != SCH_COMPONENT_T )
continue; continue;
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) DrawList; SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) DrawList;
...@@ -226,7 +226,7 @@ void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly, bool aRedraw ) ...@@ -226,7 +226,7 @@ void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly, bool aRedraw )
for( ; strct; strct = strct->Next() ) for( ; strct; strct = strct->Next() )
{ {
if( strct->Type() == TYPE_SCH_COMPONENT ) if( strct->Type() == SCH_COMPONENT_T )
{ {
if( aCurrentSheetOnly ) if( aCurrentSheetOnly )
( (SCH_COMPONENT*) strct )->ClearAnnotation( m_CurrentSheet ); ( (SCH_COMPONENT*) strct )->ClearAnnotation( m_CurrentSheet );
...@@ -368,7 +368,7 @@ int AddComponentsInSheetToList( std::vector <OBJ_CMP_TO_LIST>& aComponentsList, ...@@ -368,7 +368,7 @@ int AddComponentsInSheetToList( std::vector <OBJ_CMP_TO_LIST>& aComponentsList,
for( ; DrawList != NULL; DrawList = DrawList->Next() ) for( ; DrawList != NULL; DrawList = DrawList->Next() )
{ {
if( DrawList->Type() == TYPE_SCH_COMPONENT ) if( DrawList->Type() == SCH_COMPONENT_T )
{ {
DrawLibItem = (SCH_COMPONENT*) DrawList; DrawLibItem = (SCH_COMPONENT*) DrawList;
Entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
...@@ -981,7 +981,7 @@ static bool SortItemByTimeStamp( const SCH_ITEM* item1, const SCH_ITEM* item2 ) ...@@ -981,7 +981,7 @@ static bool SortItemByTimeStamp( const SCH_ITEM* item1, const SCH_ITEM* item2 )
*/ */
if( ii == 0 && ( item1->Type() != item2->Type() ) ) if( ii == 0 && ( item1->Type() != item2->Type() ) )
if( item1->Type() == DRAW_SHEET_STRUCT_TYPE ) if( item1->Type() == SCH_SHEET_T )
ii = -1; ii = -1;
return ii < 0; return ii < 0;
...@@ -1014,8 +1014,8 @@ int ReplaceDuplicatedTimeStamps() ...@@ -1014,8 +1014,8 @@ int ReplaceDuplicatedTimeStamps()
while( item ) while( item )
{ {
if( ( item->Type() == DRAW_SHEET_STRUCT_TYPE ) if( ( item->Type() == SCH_SHEET_T )
|| ( item->Type() == TYPE_SCH_COMPONENT ) ) || ( item->Type() == SCH_COMPONENT_T ) )
itemlist.push_back( item ); itemlist.push_back( item );
item = item->Next(); item = item->Next();
...@@ -1036,7 +1036,7 @@ int ReplaceDuplicatedTimeStamps() ...@@ -1036,7 +1036,7 @@ int ReplaceDuplicatedTimeStamps()
// for a component, update its Time stamp and its paths // for a component, update its Time stamp and its paths
// (m_PathsAndReferences field) // (m_PathsAndReferences field)
if( item->Type() == TYPE_SCH_COMPONENT ) if( item->Type() == SCH_COMPONENT_T )
( (SCH_COMPONENT*) item )->SetTimeStamp( GetTimeStamp() ); ( (SCH_COMPONENT*) item )->SetTimeStamp( GetTimeStamp() );
// for a sheet, update only its time stamp (annotation of its // for a sheet, update only its time stamp (annotation of its
......
...@@ -49,7 +49,7 @@ bool SCH_EDIT_FRAME::FillFootprintFieldForAllInstancesofComponent( const wxStrin ...@@ -49,7 +49,7 @@ bool SCH_EDIT_FRAME::FillFootprintFieldForAllInstancesofComponent( const wxStrin
DrawList = (SCH_ITEM*) sheet->LastDrawList(); DrawList = (SCH_ITEM*) sheet->LastDrawList();
for( ; (DrawList != NULL); DrawList = DrawList->Next() ) for( ; (DrawList != NULL); DrawList = DrawList->Next() )
{ {
if( DrawList->Type() != TYPE_SCH_COMPONENT ) if( DrawList->Type() != SCH_COMPONENT_T )
continue; continue;
Cmp = (SCH_COMPONENT*) DrawList; Cmp = (SCH_COMPONENT*) DrawList;
......
...@@ -233,7 +233,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -233,7 +233,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
break; break;
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG: /* Drag */
BreakSegmentOnJunction( (SCH_SCREEN*) GetScreen() ); BreakSegmentOnJunction( GetScreen() );
case BLOCK_ROTATE: case BLOCK_ROTATE:
case BLOCK_MIRROR_X: case BLOCK_MIRROR_X:
...@@ -371,7 +371,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -371,7 +371,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
if( block->GetCount() ) if( block->GetCount() )
{ {
blockCmdFinished = false; blockCmdFinished = false;
CollectStructsToDrag( (SCH_SCREEN*) GetScreen() ); CollectStructsToDrag( GetScreen() );
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, false );
block->m_State = STATE_BLOCK_MOVE; block->m_State = STATE_BLOCK_MOVE;
...@@ -571,7 +571,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC ) ...@@ -571,7 +571,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
picklist.PushItem( picker ); picklist.PushItem( picker );
// Clear annotation and init new time stamp for the new components: // Clear annotation and init new time stamp for the new components:
if( Struct->Type() == TYPE_SCH_COMPONENT ) if( Struct->Type() == SCH_COMPONENT_T )
{ {
( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) Struct )->ClearAnnotation( NULL ); ( (SCH_COMPONENT*) Struct )->ClearAnnotation( NULL );
...@@ -625,7 +625,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -625,7 +625,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ ) for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
{ {
Struct = (SCH_ITEM*)(SCH_ITEM*) pickedlist->GetPickedItem( ii ); Struct = (SCH_ITEM*)(SCH_ITEM*) pickedlist->GetPickedItem( ii );
if( Struct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) if( Struct->Type() == SCH_LINE_T )
{ {
SegmStruct = (SCH_LINE*) Struct; SegmStruct = (SCH_LINE*) Struct;
if( !screen->m_BlockLocate.Inside( SegmStruct->m_Start ) ) if( !screen->m_BlockLocate.Inside( SegmStruct->m_Start ) )
...@@ -646,9 +646,9 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -646,9 +646,9 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ ) for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
{ {
Struct = (SCH_ITEM*)(SCH_ITEM*) pickedlist->GetPickedItem( ii ); Struct = (SCH_ITEM*)(SCH_ITEM*) pickedlist->GetPickedItem( ii );
if( ( Struct->Type() == TYPE_SCH_LABEL ) if( ( Struct->Type() == SCH_LABEL_T )
|| ( Struct->Type() == TYPE_SCH_GLOBALLABEL ) || ( Struct->Type() == SCH_GLOBAL_LABEL_T )
|| ( Struct->Type() == TYPE_SCH_HIERLABEL ) ) || ( Struct->Type() == SCH_HIERARCHICAL_LABEL_T ) )
{ {
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_TEXT*) Struct ) #define STRUCT ( (SCH_TEXT*) Struct )
...@@ -658,7 +658,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -658,7 +658,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
} }
} }
if( Struct->Type() == TYPE_SCH_COMPONENT ) if( Struct->Type() == SCH_COMPONENT_T )
{ {
// Add all pins of the selected component to list // Add all pins of the selected component to list
LIB_PIN* pin; LIB_PIN* pin;
...@@ -678,7 +678,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -678,7 +678,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
} }
} }
if( Struct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( Struct->Type() == SCH_SHEET_T )
{ {
SCH_SHEET* sheet = (SCH_SHEET*) Struct; SCH_SHEET* sheet = (SCH_SHEET*) Struct;
...@@ -689,7 +689,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -689,7 +689,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
} }
} }
if( Struct->Type() == DRAW_BUSENTRY_STRUCT_TYPE ) if( Struct->Type() == SCH_BUS_ENTRY_T )
{ {
SCH_BUS_ENTRY* item = (SCH_BUS_ENTRY*) Struct; SCH_BUS_ENTRY* item = (SCH_BUS_ENTRY*) Struct;
AddPickedItem( screen, item->m_Pos ); AddPickedItem( screen, item->m_Pos );
...@@ -718,7 +718,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -718,7 +718,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
switch( Struct->Type() ) switch( Struct->Type() )
{ {
case DRAW_SEGMENT_STRUCT_TYPE: case SCH_LINE_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_LINE*) Struct ) #define STRUCT ( (SCH_LINE*) Struct )
if( STRUCT->m_Start == position ) if( STRUCT->m_Start == position )
...@@ -750,12 +750,12 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -750,12 +750,12 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
case TYPE_NOT_INIT: case TYPE_NOT_INIT:
break; break;
case DRAW_POLYLINE_STRUCT_TYPE: case SCH_POLYLINE_T:
if( Struct->m_Flags & SELECTED ) if( Struct->m_Flags & SELECTED )
break; break;
break; break;
case DRAW_JUNCTION_STRUCT_TYPE: case SCH_JUNCTION_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_JUNCTION*) Struct ) #define STRUCT ( (SCH_JUNCTION*) Struct )
if( Struct->m_Flags & SELECTED ) if( Struct->m_Flags & SELECTED )
...@@ -765,7 +765,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -765,7 +765,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
pickedlist->PushItem( picker ); pickedlist->PushItem( picker );
break; break;
case DRAW_SEGMENT_STRUCT_TYPE: case SCH_LINE_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_LINE*) Struct ) #define STRUCT ( (SCH_LINE*) Struct )
if( Struct->m_Flags & SELECTED ) if( Struct->m_Flags & SELECTED )
...@@ -790,13 +790,13 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -790,13 +790,13 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
} }
break; break;
case DRAW_BUSENTRY_STRUCT_TYPE: case SCH_BUS_ENTRY_T:
break; break;
case TYPE_SCH_TEXT: case SCH_TEXT_T:
break; break;
case TYPE_SCH_LABEL: case SCH_LABEL_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_LABEL*) Struct ) #define STRUCT ( (SCH_LABEL*) Struct )
if( Struct->m_Flags & SELECTED ) if( Struct->m_Flags & SELECTED )
...@@ -807,8 +807,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -807,8 +807,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
pickedlist->PushItem( picker ); pickedlist->PushItem( picker );
break; break;
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_LABEL*) Struct ) #define STRUCT ( (SCH_LABEL*) Struct )
if( Struct->m_Flags & SELECTED ) if( Struct->m_Flags & SELECTED )
...@@ -819,12 +819,12 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -819,12 +819,12 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
pickedlist->PushItem( picker ); pickedlist->PushItem( picker );
break; break;
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
case DRAW_SHEET_STRUCT_TYPE: case SCH_SHEET_T:
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case SCH_SHEET_LABEL_T:
break; break;
case TYPE_SCH_MARKER: case SCH_MARKER_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_MARKER*) Struct ) #define STRUCT ( (SCH_MARKER*) Struct )
if( Struct->m_Flags & SELECTED ) if( Struct->m_Flags & SELECTED )
...@@ -835,7 +835,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -835,7 +835,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
pickedlist->PushItem( picker ); pickedlist->PushItem( picker );
break; break;
case DRAW_NOCONNECT_STRUCT_TYPE: case SCH_NO_CONNECT_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_NO_CONNECT*) Struct ) #define STRUCT ( (SCH_NO_CONNECT*) Struct )
if( Struct->m_Flags & SELECTED ) if( Struct->m_Flags & SELECTED )
...@@ -890,11 +890,12 @@ static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem, ...@@ -890,11 +890,12 @@ static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
for( ; Pin != NULL; Pin = Entry->GetNextPin( Pin ) ) for( ; Pin != NULL; Pin = Entry->GetNextPin( Pin ) )
{ {
wxASSERT( Pin->Type() == COMPONENT_PIN_DRAW_TYPE ); wxASSERT( Pin->Type() == LIB_PIN_T );
/* Skip items not used for this part */ /* Skip items not used for this part */
if( Multi && Pin->GetUnit() && ( Pin->GetUnit() != Multi ) ) if( Multi && Pin->GetUnit() && ( Pin->GetUnit() != Multi ) )
continue; continue;
if( convert && Pin->GetConvert() && ( Pin->GetConvert() != convert ) ) if( convert && Pin->GetConvert() && ( Pin->GetConvert() != convert ) )
continue; continue;
......
...@@ -43,7 +43,7 @@ void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList ) ...@@ -43,7 +43,7 @@ void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList )
{ {
for( EDA_ITEM* schItem = path->LastDrawList(); schItem; schItem = schItem->Next() ) for( EDA_ITEM* schItem = path->LastDrawList(); schItem; schItem = schItem->Next() )
{ {
if( schItem->Type() != TYPE_SCH_COMPONENT ) if( schItem->Type() != SCH_COMPONENT_T )
continue; continue;
SCH_COMPONENT* comp = (SCH_COMPONENT*) schItem; SCH_COMPONENT* comp = (SCH_COMPONENT*) schItem;
...@@ -87,21 +87,21 @@ void GenListeGLabels( std::vector <LABEL_OBJECT>& aList ) ...@@ -87,21 +87,21 @@ void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
{ {
switch( schItem->Type() ) switch( schItem->Type() )
{ {
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
lable.m_LabelType = schItem->Type(); lable.m_LabelType = schItem->Type();
lable.m_SheetPath = *path; lable.m_SheetPath = *path;
lable.m_Label = schItem; lable.m_Label = schItem;
aList.push_back( lable ); aList.push_back( lable );
break; break;
case DRAW_SHEET_STRUCT_TYPE: case SCH_SHEET_T:
{ {
SCH_SHEET* sheet = (SCH_SHEET*) schItem; SCH_SHEET* sheet = (SCH_SHEET*) schItem;
BOOST_FOREACH( SCH_SHEET_PIN sheetLabel, sheet->GetSheetPins() ) BOOST_FOREACH( SCH_SHEET_PIN sheetLabel, sheet->GetSheetPins() )
{ {
lable.m_LabelType = DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE; lable.m_LabelType = SCH_SHEET_LABEL_T;
lable.m_SheetPath = *path; lable.m_SheetPath = *path;
lable.m_Label = &sheetLabel; lable.m_Label = &sheetLabel;
aList.push_back( lable ); aList.push_back( lable );
...@@ -187,12 +187,12 @@ bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 ) ...@@ -187,12 +187,12 @@ bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
int ii; int ii;
wxString* Text1, * Text2; wxString* Text1, * Text2;
if( obj1.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ) if( obj1.m_LabelType == SCH_SHEET_LABEL_T )
Text1 = &( (SCH_SHEET_PIN*)(obj1.m_Label) )->m_Text; Text1 = &( (SCH_SHEET_PIN*)(obj1.m_Label) )->m_Text;
else else
Text1 = &( (SCH_TEXT*)(obj1.m_Label) )->m_Text; Text1 = &( (SCH_TEXT*)(obj1.m_Label) )->m_Text;
if( obj2.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ) if( obj2.m_LabelType == SCH_SHEET_LABEL_T )
Text2 = &( (SCH_SHEET_PIN*)(obj2.m_Label) )->m_Text; Text2 = &( (SCH_SHEET_PIN*)(obj2.m_Label) )->m_Text;
else else
Text2 = &( (SCH_TEXT*)(obj2.m_Label) )->m_Text; Text2 = &( (SCH_TEXT*)(obj2.m_Label) )->m_Text;
...@@ -221,12 +221,12 @@ bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 ) ...@@ -221,12 +221,12 @@ bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
if( ii == 0 ) if( ii == 0 )
{ {
if( obj1.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ) if( obj1.m_LabelType == SCH_SHEET_LABEL_T )
Text1 = ( (SCH_SHEET_PIN*) obj1.m_Label )->m_Text; Text1 = ( (SCH_SHEET_PIN*) obj1.m_Label )->m_Text;
else else
Text1 = ( (SCH_TEXT*) obj1.m_Label )->m_Text; Text1 = ( (SCH_TEXT*) obj1.m_Label )->m_Text;
if( obj2.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ) if( obj2.m_LabelType == SCH_SHEET_LABEL_T )
Text2 = ( (SCH_SHEET_PIN*) obj2.m_Label )->m_Text; Text2 = ( (SCH_SHEET_PIN*) obj2.m_Label )->m_Text;
else else
Text2 = ( (SCH_TEXT*) obj2.m_Label )->m_Text; Text2 = ( (SCH_TEXT*) obj2.m_Label )->m_Text;
...@@ -282,11 +282,11 @@ int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList ) ...@@ -282,11 +282,11 @@ int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
{ {
switch( aList[ii].m_LabelType ) switch( aList[ii].m_LabelType )
{ {
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
DrawTextItem = (SCH_LABEL*)(aList[ii].m_Label); DrawTextItem = (SCH_LABEL*)(aList[ii].m_Label);
if( aList[ii].m_LabelType == TYPE_SCH_HIERLABEL ) if( aList[ii].m_LabelType == SCH_HIERARCHICAL_LABEL_T )
labeltype = wxT( "Hierarchical" ); labeltype = wxT( "Hierarchical" );
else else
labeltype = wxT( "Global " ); labeltype = wxT( "Global " );
...@@ -302,7 +302,7 @@ int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList ) ...@@ -302,7 +302,7 @@ int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
fputs( CONV_TO_UTF8( msg ), f ); fputs( CONV_TO_UTF8( msg ), f );
break; break;
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case SCH_SHEET_LABEL_T:
{ {
DrawSheetLabel = (SCH_SHEET_PIN*) aList[ii].m_Label; DrawSheetLabel = (SCH_SHEET_PIN*) aList[ii].m_Label;
int jj = DrawSheetLabel->m_Shape; int jj = DrawSheetLabel->m_Shape;
......
...@@ -46,8 +46,8 @@ static void RestoreOldWires( SCH_SCREEN* screen ) ...@@ -46,8 +46,8 @@ static void RestoreOldWires( SCH_SCREEN* screen )
switch( item->Type() ) switch( item->Type() )
{ {
case DRAW_JUNCTION_STRUCT_TYPE: case SCH_JUNCTION_T:
case DRAW_SEGMENT_STRUCT_TYPE: case SCH_LINE_T:
screen->RemoveFromDrawList( item ); screen->RemoveFromDrawList( item );
delete item; delete item;
break; break;
...@@ -133,8 +133,8 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type ) ...@@ -133,8 +133,8 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
{ {
switch( GetScreen()->GetCurItem()->Type() ) switch( GetScreen()->GetCurItem()->Type() )
{ {
case DRAW_SEGMENT_STRUCT_TYPE: case SCH_LINE_T:
case DRAW_POLYLINE_STRUCT_TYPE: case SCH_POLYLINE_T:
break; break;
default: default:
...@@ -147,8 +147,8 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type ) ...@@ -147,8 +147,8 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
if( !newsegment ) /* first point : Create first wire or bus */ if( !newsegment ) /* first point : Create first wire or bus */
{ {
s_ConnexionStartPoint = cursorpos; s_ConnexionStartPoint = cursorpos;
s_OldWiresList = ( (SCH_SCREEN*) GetScreen() )->ExtractWires( TRUE ); s_OldWiresList = GetScreen()->ExtractWires( TRUE );
( (SCH_SCREEN*) GetScreen() )->SchematicCleanUp( NULL ); GetScreen()->SchematicCleanUp( NULL );
switch( type ) switch( type )
{ {
...@@ -320,7 +320,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC ) ...@@ -320,7 +320,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
alt_end_point = lastsegment->m_Start; alt_end_point = lastsegment->m_Start;
} }
( (SCH_SCREEN*) GetScreen() )->SchematicCleanUp( NULL ); GetScreen()->SchematicCleanUp( NULL );
/* clear flags and find last segment entered, for repeat function */ /* clear flags and find last segment entered, for repeat function */
segment = (SCH_LINE*) GetScreen()->GetDrawItems(); segment = (SCH_LINE*) GetScreen()->GetDrawItems();
...@@ -360,8 +360,8 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC ) ...@@ -360,8 +360,8 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
{ {
switch( item->Type() ) switch( item->Type() )
{ {
case DRAW_JUNCTION_STRUCT_TYPE: case SCH_JUNCTION_T:
case DRAW_SEGMENT_STRUCT_TYPE: case SCH_LINE_T:
DrawPanel->PostDirtyRect( item->GetBoundingBox() ); DrawPanel->PostDirtyRect( item->GetBoundingBox() );
break; break;
...@@ -474,7 +474,7 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC ) ...@@ -474,7 +474,7 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
} }
/* Cancel trace in progress */ /* Cancel trace in progress */
if( GetScreen()->GetCurItem()->Type() == DRAW_POLYLINE_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() == SCH_POLYLINE_T )
{ {
Show_Polyline_in_Ghost( DrawPanel, DC, FALSE ); Show_Polyline_in_Ghost( DrawPanel, DC, FALSE );
} }
...@@ -483,7 +483,7 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC ) ...@@ -483,7 +483,7 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
DrawSegment( DrawPanel, DC, FALSE ); DrawSegment( DrawPanel, DC, FALSE );
} }
EraseStruct( (SCH_ITEM*) GetScreen()->GetCurItem(), (SCH_SCREEN*) GetScreen() ); EraseStruct( (SCH_ITEM*) GetScreen()->GetCurItem(), GetScreen() );
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
} }
...@@ -578,7 +578,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC ) ...@@ -578,7 +578,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
switch( g_ItemToRepeat->Type() ) switch( g_ItemToRepeat->Type() )
{ {
case DRAW_JUNCTION_STRUCT_TYPE: case SCH_JUNCTION_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_JUNCTION*) g_ItemToRepeat ) #define STRUCT ( (SCH_JUNCTION*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy(); g_ItemToRepeat = STRUCT->GenCopy();
...@@ -586,7 +586,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC ) ...@@ -586,7 +586,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
new_pos = STRUCT->m_Pos; new_pos = STRUCT->m_Pos;
break; break;
case DRAW_NOCONNECT_STRUCT_TYPE: case SCH_NO_CONNECT_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_NO_CONNECT*) g_ItemToRepeat ) #define STRUCT ( (SCH_NO_CONNECT*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy(); g_ItemToRepeat = STRUCT->GenCopy();
...@@ -594,7 +594,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC ) ...@@ -594,7 +594,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
new_pos = STRUCT->m_Pos; new_pos = STRUCT->m_Pos;
break; break;
case TYPE_SCH_TEXT: case SCH_TEXT_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_TEXT*) g_ItemToRepeat ) #define STRUCT ( (SCH_TEXT*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy(); g_ItemToRepeat = STRUCT->GenCopy();
...@@ -604,7 +604,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC ) ...@@ -604,7 +604,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
break; break;
case TYPE_SCH_LABEL: case SCH_LABEL_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_LABEL*) g_ItemToRepeat ) #define STRUCT ( (SCH_LABEL*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy(); g_ItemToRepeat = STRUCT->GenCopy();
...@@ -614,7 +614,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC ) ...@@ -614,7 +614,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
break; break;
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_HIERLABEL*) g_ItemToRepeat ) #define STRUCT ( (SCH_HIERLABEL*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy(); g_ItemToRepeat = STRUCT->GenCopy();
...@@ -623,7 +623,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC ) ...@@ -623,7 +623,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
IncrementLabelMember( STRUCT->m_Text ); IncrementLabelMember( STRUCT->m_Text );
break; break;
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_GLOBALLABEL*) g_ItemToRepeat ) #define STRUCT ( (SCH_GLOBALLABEL*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy(); g_ItemToRepeat = STRUCT->GenCopy();
...@@ -632,7 +632,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC ) ...@@ -632,7 +632,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
IncrementLabelMember( STRUCT->m_Text ); IncrementLabelMember( STRUCT->m_Text );
break; break;
case DRAW_SEGMENT_STRUCT_TYPE: case SCH_LINE_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_LINE*) g_ItemToRepeat ) #define STRUCT ( (SCH_LINE*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy(); g_ItemToRepeat = STRUCT->GenCopy();
...@@ -641,7 +641,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC ) ...@@ -641,7 +641,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
STRUCT->m_End += g_RepeatStep; STRUCT->m_End += g_RepeatStep;
break; break;
case DRAW_BUSENTRY_STRUCT_TYPE: case SCH_BUS_ENTRY_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_BUS_ENTRY*) g_ItemToRepeat ) #define STRUCT ( (SCH_BUS_ENTRY*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy(); g_ItemToRepeat = STRUCT->GenCopy();
...@@ -649,7 +649,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC ) ...@@ -649,7 +649,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
new_pos = STRUCT->m_Pos; new_pos = STRUCT->m_Pos;
break; break;
case TYPE_SCH_COMPONENT: // In repeat command the new component is put case SCH_COMPONENT_T: // In repeat command the new component is put
// in move mode // in move mode
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_COMPONENT*) g_ItemToRepeat ) #define STRUCT ( (SCH_COMPONENT*) g_ItemToRepeat )
...@@ -787,7 +787,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) ...@@ -787,7 +787,7 @@ 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() != TYPE_SCH_TEXT) if( item && (item->Type() != SCH_TEXT_T)
&& ( ( (SCH_GLOBALLABEL*) item )->m_Pos.x == pos.x ) && ( ( (SCH_GLOBALLABEL*) item )->m_Pos.x == pos.x )
&& ( ( (SCH_GLOBALLABEL*) item )->m_Pos.y == pos.y ) ) && ( ( (SCH_GLOBALLABEL*) item )->m_Pos.y == pos.y ) )
return TRUE; return TRUE;
......
...@@ -111,7 +111,7 @@ void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY* BusEntry, int en ...@@ -111,7 +111,7 @@ void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY* BusEntry, int en
if( BusEntry == NULL ) if( BusEntry == NULL )
return; return;
if( BusEntry->Type() != DRAW_BUSENTRY_STRUCT_TYPE ) if( BusEntry->Type() != SCH_BUS_ENTRY_T )
{ {
DisplayError( this, wxT( "SetBusEntryType: Bad StructType" ) ); DisplayError( this, wxT( "SetBusEntryType: Bad StructType" ) );
return; return;
......
...@@ -313,10 +313,10 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDc, const wxPoint& aO ...@@ -313,10 +313,10 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDc, const wxPoint& aO
if( aConvert && drawItem.m_Convert && ( drawItem.m_Convert != aConvert ) ) if( aConvert && drawItem.m_Convert && ( drawItem.m_Convert != aConvert ) )
continue; continue;
if( drawItem.Type() == COMPONENT_FIELD_DRAW_TYPE ) if( drawItem.Type() == LIB_FIELD_T )
continue; continue;
if( drawItem.Type() == COMPONENT_FIELD_DRAW_TYPE ) if( drawItem.Type() == LIB_FIELD_T )
{ {
drawItem.Draw( aPanel, aDc, aOffset, aColor, aDrawMode, (void*) NULL, aTransform ); drawItem.Draw( aPanel, aDc, aOffset, aColor, aDrawMode, (void*) NULL, aTransform );
} }
...@@ -343,15 +343,15 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDc, const wxPoint& aO ...@@ -343,15 +343,15 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDc, const wxPoint& aO
if( aConvert && drawItem.m_Convert && ( drawItem.m_Convert != aConvert ) ) if( aConvert && drawItem.m_Convert && ( drawItem.m_Convert != aConvert ) )
continue; continue;
if( !aDrawFields && drawItem.Type() == COMPONENT_FIELD_DRAW_TYPE ) if( !aDrawFields && drawItem.Type() == LIB_FIELD_T )
continue; continue;
if( drawItem.Type() == COMPONENT_PIN_DRAW_TYPE ) if( drawItem.Type() == LIB_PIN_T )
{ {
drawItem.Draw( aPanel, aDc, aOffset, aColor, aDrawMode, (void*) aShowPinText, drawItem.Draw( aPanel, aDc, aOffset, aColor, aDrawMode, (void*) aShowPinText,
aTransform ); aTransform );
} }
else if( drawItem.Type() == COMPONENT_FIELD_DRAW_TYPE ) else if( drawItem.Type() == LIB_FIELD_T )
{ {
drawItem.Draw( aPanel, aDc, aOffset, aColor, aDrawMode, (void*) NULL, aTransform ); drawItem.Draw( aPanel, aDc, aOffset, aColor, aDrawMode, (void*) NULL, aTransform );
} }
...@@ -380,7 +380,7 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDc, const wxPoint& aO ...@@ -380,7 +380,7 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDc, const wxPoint& aO
/* Enable this to draw the bounding box around the component to validate /* Enable this to draw the bounding box around the component to validate
* the bounding box calculations. */ * the bounding box calculations. */
#if 0 #if 0
EDA_Rect bBox = GetBoundaryBox( aMulti, aConvert ); EDA_Rect bBox = GetBoundingBox( aMulti, aConvert );
GRRect( &aPanel->m_ClipBox, aDc, bBox.GetOrigin().x, bBox.GetOrigin().y, GRRect( &aPanel->m_ClipBox, aDc, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA ); bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
#endif #endif
...@@ -413,7 +413,7 @@ void LIB_COMPONENT::RemoveDrawItem( LIB_DRAW_ITEM* aItem, WinEDA_DrawPanel* aPan ...@@ -413,7 +413,7 @@ void LIB_COMPONENT::RemoveDrawItem( LIB_DRAW_ITEM* aItem, WinEDA_DrawPanel* aPan
// none of the MANDATOR_FIELDS may be removed in RAM, but they may be // none of the MANDATOR_FIELDS may be removed in RAM, but they may be
// omitted when saving to disk. // omitted when saving to disk.
if( aItem->Type() == COMPONENT_FIELD_DRAW_TYPE ) if( aItem->Type() == LIB_FIELD_T )
{ {
LIB_FIELD* field = (LIB_FIELD*) aItem; LIB_FIELD* field = (LIB_FIELD*) aItem;
...@@ -498,7 +498,7 @@ void LIB_COMPONENT::GetPins( LIB_PIN_LIST& aList, int aUnit, int aConvert ) ...@@ -498,7 +498,7 @@ void LIB_COMPONENT::GetPins( LIB_PIN_LIST& aList, int aUnit, int aConvert )
*/ */
BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings ) BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
{ {
if( item.Type() != COMPONENT_PIN_DRAW_TYPE ) // we search pins only if( item.Type() != LIB_PIN_T ) // we search pins only
continue; continue;
// Unit filtering: // Unit filtering:
...@@ -523,7 +523,7 @@ LIB_PIN* LIB_COMPONENT::GetPin( const wxString& aNumber, int aUnit, int aConvert ...@@ -523,7 +523,7 @@ LIB_PIN* LIB_COMPONENT::GetPin( const wxString& aNumber, int aUnit, int aConvert
for( size_t i = 0; i < pinList.size(); i++ ) for( size_t i = 0; i < pinList.size(); i++ )
{ {
wxASSERT( pinList[i]->Type() == COMPONENT_PIN_DRAW_TYPE ); wxASSERT( pinList[i]->Type() == LIB_PIN_T );
pinList[i]->ReturnPinStringNum( pNumber ); pinList[i]->ReturnPinStringNum( pNumber );
...@@ -661,7 +661,7 @@ bool LIB_COMPONENT::Save( FILE* aFile ) ...@@ -661,7 +661,7 @@ bool LIB_COMPONENT::Save( FILE* aFile )
BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings ) BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
{ {
if( item.Type() == COMPONENT_FIELD_DRAW_TYPE ) if( item.Type() == LIB_FIELD_T )
continue; continue;
if( !item.Save( aFile ) ) if( !item.Save( aFile ) )
...@@ -970,11 +970,11 @@ bool LIB_COMPONENT::LoadFootprints( FILE* aFile, char* aLine, ...@@ -970,11 +970,11 @@ bool LIB_COMPONENT::LoadFootprints( FILE* aFile, char* aLine,
* Invisible fields are not take in account * Invisible fields are not take in account
**/ **/
/**********************************************************************/ /**********************************************************************/
EDA_Rect LIB_COMPONENT::GetBoundaryBox( int aUnit, int aConvert ) EDA_Rect LIB_COMPONENT::GetBoundingBox( int aUnit, int aConvert ) const
{ {
EDA_Rect bBox( wxPoint( 0, 0 ), wxSize( 0, 0 ) ); EDA_Rect bBox( wxPoint( 0, 0 ), wxSize( 0, 0 ) );
BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings ) BOOST_FOREACH( const LIB_DRAW_ITEM& item, drawings )
{ {
if( ( item.m_Unit > 0 ) && ( ( m_unitCount > 1 ) && ( aUnit > 0 ) if( ( item.m_Unit > 0 ) && ( ( m_unitCount > 1 ) && ( aUnit > 0 )
&& ( aUnit != item.m_Unit ) ) ) && ( aUnit != item.m_Unit ) ) )
...@@ -983,7 +983,7 @@ EDA_Rect LIB_COMPONENT::GetBoundaryBox( int aUnit, int aConvert ) ...@@ -983,7 +983,7 @@ EDA_Rect LIB_COMPONENT::GetBoundaryBox( int aUnit, int aConvert )
if( item.m_Convert > 0 && ( ( aConvert > 0 ) && ( aConvert != item.m_Convert ) ) ) if( item.m_Convert > 0 && ( ( aConvert > 0 ) && ( aConvert != item.m_Convert ) ) )
continue; continue;
if ( ( item.Type() == COMPONENT_FIELD_DRAW_TYPE ) && !( ( LIB_FIELD& ) item ).IsVisible() ) if ( ( item.Type() == LIB_FIELD_T ) && !( ( LIB_FIELD& ) item ).IsVisible() )
continue; continue;
bBox.Merge( item.GetBoundingBox() ); bBox.Merge( item.GetBoundingBox() );
...@@ -999,7 +999,7 @@ void LIB_COMPONENT::deleteAllFields() ...@@ -999,7 +999,7 @@ void LIB_COMPONENT::deleteAllFields()
for( it = drawings.begin(); it!=drawings.end(); /* deleting */ ) for( it = drawings.begin(); it!=drawings.end(); /* deleting */ )
{ {
if( it->Type() != COMPONENT_FIELD_DRAW_TYPE ) if( it->Type() != LIB_FIELD_T )
{ {
++it; ++it;
continue; continue;
...@@ -1051,7 +1051,7 @@ void LIB_COMPONENT::GetFields( LIB_FIELD_LIST& aList ) ...@@ -1051,7 +1051,7 @@ void LIB_COMPONENT::GetFields( LIB_FIELD_LIST& aList )
// Now grab all the rest of fields. // Now grab all the rest of fields.
BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings ) BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
{ {
if( item.Type() != COMPONENT_FIELD_DRAW_TYPE ) if( item.Type() != LIB_FIELD_T )
continue; continue;
field = ( LIB_FIELD* ) &item; field = ( LIB_FIELD* ) &item;
...@@ -1067,7 +1067,7 @@ LIB_FIELD* LIB_COMPONENT::GetField( int aId ) ...@@ -1067,7 +1067,7 @@ LIB_FIELD* LIB_COMPONENT::GetField( int aId )
{ {
BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings ) BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
{ {
if( item.Type() != COMPONENT_FIELD_DRAW_TYPE ) if( item.Type() != LIB_FIELD_T )
continue; continue;
LIB_FIELD* field = ( LIB_FIELD* ) &item; LIB_FIELD* field = ( LIB_FIELD* ) &item;
...@@ -1084,7 +1084,7 @@ LIB_FIELD* LIB_COMPONENT::FindField( const wxString& aFieldName ) ...@@ -1084,7 +1084,7 @@ LIB_FIELD* LIB_COMPONENT::FindField( const wxString& aFieldName )
{ {
BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings ) BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
{ {
if( item.Type() != COMPONENT_FIELD_DRAW_TYPE ) if( item.Type() != LIB_FIELD_T )
continue; continue;
LIB_FIELD* field = ( LIB_FIELD* ) &item; LIB_FIELD* field = ( LIB_FIELD* ) &item;
...@@ -1205,7 +1205,7 @@ int LIB_COMPONENT::SelectItems( EDA_Rect& aRect, int aUnit, int aConvert, bool a ...@@ -1205,7 +1205,7 @@ int LIB_COMPONENT::SelectItems( EDA_Rect& aRect, int aUnit, int aConvert, bool a
if( ( item.m_Unit && item.m_Unit != aUnit ) if( ( item.m_Unit && item.m_Unit != aUnit )
|| ( item.m_Convert && item.m_Convert != aConvert ) ) || ( item.m_Convert && item.m_Convert != aConvert ) )
{ {
if( item.Type() != COMPONENT_PIN_DRAW_TYPE ) if( item.Type() != LIB_PIN_T )
continue; continue;
// Specific rules for pins. // Specific rules for pins.
...@@ -1258,7 +1258,7 @@ void LIB_COMPONENT::DeleteSelectedItems() ...@@ -1258,7 +1258,7 @@ void LIB_COMPONENT::DeleteSelectedItems()
// because they are not really graphic items // because they are not really graphic items
while( item != drawings.end() ) while( item != drawings.end() )
{ {
if( item->Type() == COMPONENT_FIELD_DRAW_TYPE ) if( item->Type() == LIB_FIELD_T )
{ {
#if 0 // Set to 1 to allows fields deletion on block delete or other global command #if 0 // Set to 1 to allows fields deletion on block delete or other global command
LIB_FIELD& field = ( LIB_FIELD& ) *item; LIB_FIELD& field = ( LIB_FIELD& ) *item;
...@@ -1289,7 +1289,7 @@ void LIB_COMPONENT::CopySelectedItems( const wxPoint& aOffset ) ...@@ -1289,7 +1289,7 @@ void LIB_COMPONENT::CopySelectedItems( const wxPoint& aOffset )
LIB_DRAW_ITEM& item = drawings[ii]; LIB_DRAW_ITEM& item = drawings[ii];
// We *do not* copy fields because they are unique for the whole component // We *do not* copy fields because they are unique for the whole component
// so skip them (do not duplicate) if they are flagged selected. // so skip them (do not duplicate) if they are flagged selected.
if( item.Type() == COMPONENT_FIELD_DRAW_TYPE ) if( item.Type() == LIB_FIELD_T )
item.m_Selected = 0; item.m_Selected = 0;
if( item.m_Selected == 0 ) if( item.m_Selected == 0 )
...@@ -1455,7 +1455,7 @@ void LIB_COMPONENT::SetConversion( bool aSetConvert ) ...@@ -1455,7 +1455,7 @@ void LIB_COMPONENT::SetConversion( bool aSetConvert )
BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings ) BOOST_FOREACH( LIB_DRAW_ITEM& item, drawings )
{ {
/* Only pins are duplicated. */ /* Only pins are duplicated. */
if( item.Type() != COMPONENT_PIN_DRAW_TYPE ) if( item.Type() != LIB_PIN_T )
continue; continue;
if( item.m_Convert == 1 ) if( item.m_Convert == 1 )
{ {
......
...@@ -233,7 +233,7 @@ public: ...@@ -233,7 +233,7 @@ public:
wxArrayString& GetFootPrints() { return m_FootprintList; } wxArrayString& GetFootPrints() { return m_FootprintList; }
EDA_Rect GetBoundaryBox( int aUnit, int aConvert ); EDA_Rect GetBoundingBox( int aUnit, int aConvert ) const;
bool SaveDateAndTime( FILE* aFile ); bool SaveDateAndTime( FILE* aFile );
bool LoadDateAndTime( char* aLine ); bool LoadDateAndTime( char* aLine );
...@@ -385,7 +385,7 @@ public: ...@@ -385,7 +385,7 @@ public:
*/ */
LIB_PIN* GetNextPin( LIB_PIN* aItem = NULL ) LIB_PIN* GetNextPin( LIB_PIN* aItem = NULL )
{ {
return (LIB_PIN*) GetNextDrawItem( (LIB_DRAW_ITEM*) aItem, COMPONENT_PIN_DRAW_TYPE ); return (LIB_PIN*) GetNextDrawItem( (LIB_DRAW_ITEM*) aItem, LIB_PIN_T );
} }
......
...@@ -34,30 +34,30 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen ) ...@@ -34,30 +34,30 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
{ {
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
case DRAW_JUNCTION_STRUCT_TYPE: case SCH_JUNCTION_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_JUNCTION*) DrawList ) #define STRUCT ( (SCH_JUNCTION*) DrawList )
BreakSegment( Screen, STRUCT->m_Pos ); BreakSegment( Screen, STRUCT->m_Pos );
break; break;
case DRAW_BUSENTRY_STRUCT_TYPE: case SCH_BUS_ENTRY_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_BUS_ENTRY*) DrawList ) #define STRUCT ( (SCH_BUS_ENTRY*) DrawList )
BreakSegment( Screen, STRUCT->m_Pos ); BreakSegment( Screen, STRUCT->m_Pos );
BreakSegment( Screen, STRUCT->m_End() ); BreakSegment( Screen, STRUCT->m_End() );
break; break;
case DRAW_SEGMENT_STRUCT_TYPE: case SCH_LINE_T:
case DRAW_NOCONNECT_STRUCT_TYPE: case SCH_NO_CONNECT_T:
case TYPE_SCH_LABEL: case SCH_LABEL_T:
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
case DRAW_POLYLINE_STRUCT_TYPE: case SCH_POLYLINE_T:
case TYPE_SCH_MARKER: case SCH_MARKER_T:
case TYPE_SCH_TEXT: case SCH_TEXT_T:
case DRAW_SHEET_STRUCT_TYPE: case SCH_SHEET_T:
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case SCH_SHEET_LABEL_T:
break; break;
default: default:
...@@ -79,7 +79,7 @@ void BreakSegment( SCH_SCREEN* aScreen, wxPoint aBreakpoint ) ...@@ -79,7 +79,7 @@ void BreakSegment( SCH_SCREEN* aScreen, wxPoint aBreakpoint )
for( SCH_ITEM* DrawList = aScreen->GetDrawItems(); DrawList; DrawList = DrawList->Next() ) for( SCH_ITEM* DrawList = aScreen->GetDrawItems(); DrawList; DrawList = DrawList->Next() )
{ {
if( DrawList->Type() != DRAW_SEGMENT_STRUCT_TYPE ) if( DrawList->Type() != SCH_LINE_T )
continue; continue;
segment = (SCH_LINE*) DrawList; segment = (SCH_LINE*) DrawList;
......
...@@ -59,13 +59,13 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( bool IncludePin ) ...@@ -59,13 +59,13 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( bool IncludePin )
/* Cross probing to pcbnew if a pin or a component is found */ /* Cross probing to pcbnew if a pin or a component is found */
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {
case DRAW_PART_TEXT_STRUCT_TYPE: case SCH_FIELD_T:
case COMPONENT_FIELD_DRAW_TYPE: case LIB_FIELD_T:
LibItem = (SCH_COMPONENT*) DrawStruct->GetParent(); LibItem = (SCH_COMPONENT*) DrawStruct->GetParent();
SendMessageToPCBNEW( DrawStruct, LibItem ); SendMessageToPCBNEW( DrawStruct, LibItem );
break; break;
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
Pin = LocateAnyPin( GetScreen()->GetDrawItems(), GetScreen()->m_Curseur, &LibItem ); Pin = LocateAnyPin( GetScreen()->GetDrawItems(), GetScreen()->m_Curseur, &LibItem );
if( Pin ) if( Pin )
break; // Priority is probing a pin first break; // Priority is probing a pin first
...@@ -77,7 +77,7 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( bool IncludePin ) ...@@ -77,7 +77,7 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( bool IncludePin )
Pin = LocateAnyPin( GetScreen()->GetDrawItems(), GetScreen()->m_Curseur, &LibItem ); Pin = LocateAnyPin( GetScreen()->GetDrawItems(), GetScreen()->m_Curseur, &LibItem );
break; break;
case COMPONENT_PIN_DRAW_TYPE: case LIB_PIN_T:
Pin = (LIB_PIN*) DrawStruct; Pin = (LIB_PIN*) DrawStruct;
break; break;
} }
...@@ -87,6 +87,7 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( bool IncludePin ) ...@@ -87,6 +87,7 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( bool IncludePin )
/* Force display pin information (the previous display could be a /* Force display pin information (the previous display could be a
* component info) */ * component info) */
Pin->DisplayInfo( this ); Pin->DisplayInfo( this );
if( LibItem ) if( LibItem )
AppendMsgPanel( LibItem->GetRef( GetSheet() ), AppendMsgPanel( LibItem->GetRef( GetSheet() ),
LibItem->GetField( VALUE )->m_Text, DARKCYAN ); LibItem->GetField( VALUE )->m_Text, DARKCYAN );
...@@ -127,6 +128,7 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpo ...@@ -127,6 +128,7 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpo
wxString msg; wxString msg;
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), MARKERITEM ); DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), MARKERITEM );
if( DrawStruct ) if( DrawStruct )
{ {
DrawStruct->DisplayInfo( this ); DrawStruct->DisplayInfo( this );
...@@ -134,6 +136,7 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpo ...@@ -134,6 +136,7 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpo
} }
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), NOCONNECTITEM ); DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), NOCONNECTITEM );
if( DrawStruct ) if( DrawStruct )
{ {
ClearMsgPanel(); ClearMsgPanel();
...@@ -141,23 +144,24 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpo ...@@ -141,23 +144,24 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpo
} }
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), JUNCTIONITEM ); DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), JUNCTIONITEM );
if( DrawStruct ) if( DrawStruct )
{ {
ClearMsgPanel(); ClearMsgPanel();
return DrawStruct; return DrawStruct;
} }
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(),
GetScreen(), WIREITEM | BUSITEM | WIREITEM | BUSITEM | RACCORDITEM );
RACCORDITEM );
if( DrawStruct ) // We have found a wire: Search for a connected pin at if( DrawStruct ) // We have found a wire: Search for a connected pin at the same location
// the same location
{ {
Pin = LocateAnyPin( (SCH_ITEM*) m_CurrentSheet->LastDrawList(), Pin = LocateAnyPin( (SCH_ITEM*) m_CurrentSheet->LastDrawList(), refpoint, &LibItem );
refpoint, &LibItem );
if( Pin ) if( Pin )
{ {
Pin->DisplayInfo( this ); Pin->DisplayInfo( this );
if( LibItem ) if( LibItem )
AppendMsgPanel( LibItem->GetRef( GetSheet() ), AppendMsgPanel( LibItem->GetRef( GetSheet() ),
LibItem->GetField( VALUE )->m_Text, DARKCYAN ); LibItem->GetField( VALUE )->m_Text, DARKCYAN );
...@@ -169,6 +173,7 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpo ...@@ -169,6 +173,7 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpo
} }
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), FIELDCMPITEM ); DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), FIELDCMPITEM );
if( DrawStruct ) if( DrawStruct )
{ {
SCH_FIELD* Field = (SCH_FIELD*) DrawStruct; SCH_FIELD* Field = (SCH_FIELD*) DrawStruct;
...@@ -179,6 +184,7 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpo ...@@ -179,6 +184,7 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpo
} }
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), LABELITEM | TEXTITEM ); DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), LABELITEM | TEXTITEM );
if( DrawStruct ) if( DrawStruct )
{ {
ClearMsgPanel(); ClearMsgPanel();
...@@ -186,11 +192,12 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpo ...@@ -186,11 +192,12 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpo
} }
/* search for a pin */ /* search for a pin */
Pin = LocateAnyPin( (SCH_ITEM*) m_CurrentSheet->LastDrawList(), refpoint, Pin = LocateAnyPin( (SCH_ITEM*) m_CurrentSheet->LastDrawList(), refpoint, &LibItem );
&LibItem );
if( Pin ) if( Pin )
{ {
Pin->DisplayInfo( this ); Pin->DisplayInfo( this );
if( LibItem ) if( LibItem )
AppendMsgPanel( LibItem->GetRef( GetSheet() ), AppendMsgPanel( LibItem->GetRef( GetSheet() ),
LibItem->GetField( VALUE )->m_Text, DARKCYAN ); LibItem->GetField( VALUE )->m_Text, DARKCYAN );
...@@ -199,15 +206,17 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpo ...@@ -199,15 +206,17 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpo
} }
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), LIBITEM ); DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), LIBITEM );
if( DrawStruct ) if( DrawStruct )
{ {
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*) GetScreen() ); DrawStruct = LocateSmallestComponent( GetScreen() );
LibItem = (SCH_COMPONENT*) DrawStruct; LibItem = (SCH_COMPONENT*) DrawStruct;
LibItem->DisplayInfo( this ); LibItem->DisplayInfo( this );
return DrawStruct; return DrawStruct;
} }
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), SHEETITEM ); DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), SHEETITEM );
if( DrawStruct ) if( DrawStruct )
{ {
( (SCH_SHEET*) DrawStruct )->DisplayInfo( this ); ( (SCH_SHEET*) DrawStruct )->DisplayInfo( this );
...@@ -215,6 +224,7 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpo ...@@ -215,6 +224,7 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpo
} }
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), SEARCHALL ); DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), SEARCHALL );
if( DrawStruct ) if( DrawStruct )
{ {
return DrawStruct; return DrawStruct;
......
...@@ -46,6 +46,7 @@ void RemoteCommand( const char* cmdline ) ...@@ -46,6 +46,7 @@ void RemoteCommand( const char* cmdline )
idcmd = strtok( line, " \n\r" ); idcmd = strtok( line, " \n\r" );
text = strtok( NULL, "\"\n\r" ); text = strtok( NULL, "\"\n\r" );
if( (idcmd == NULL) || (text == NULL) ) if( (idcmd == NULL) || (text == NULL) )
return; return;
...@@ -56,6 +57,7 @@ void RemoteCommand( const char* cmdline ) ...@@ -56,6 +57,7 @@ void RemoteCommand( const char* cmdline )
/* look for a complement */ /* look for a complement */
idcmd = strtok( NULL, " \n\r" ); idcmd = strtok( NULL, " \n\r" );
if( idcmd == NULL ) // component only if( idcmd == NULL ) // component only
{ {
frame->FindComponentAndItem( part_ref, true, 0, wxEmptyString, false ); frame->FindComponentAndItem( part_ref, true, 0, wxEmptyString, false );
...@@ -63,6 +65,7 @@ void RemoteCommand( const char* cmdline ) ...@@ -63,6 +65,7 @@ void RemoteCommand( const char* cmdline )
} }
text = strtok( NULL, "\"\n\r" ); text = strtok( NULL, "\"\n\r" );
if( text == NULL ) if( text == NULL )
return; return;
...@@ -103,8 +106,8 @@ void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT* ...@@ -103,8 +106,8 @@ void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT*
/* Cross probing to pcbnew if a pin or a component is found */ /* Cross probing to pcbnew if a pin or a component is found */
switch( objectToSync->Type() ) switch( objectToSync->Type() )
{ {
case DRAW_PART_TEXT_STRUCT_TYPE: case SCH_FIELD_T:
case COMPONENT_FIELD_DRAW_TYPE: case LIB_FIELD_T:
{ {
if( LibItem == NULL ) if( LibItem == NULL )
break; break;
...@@ -114,13 +117,13 @@ void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT* ...@@ -114,13 +117,13 @@ void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT*
} }
break; break;
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
LibItem = (SCH_COMPONENT*) objectToSync; LibItem = (SCH_COMPONENT*) objectToSync;
sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) ); sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
SendCommand( MSG_TO_PCB, Line ); SendCommand( MSG_TO_PCB, Line );
break; break;
case COMPONENT_PIN_DRAW_TYPE: case LIB_PIN_T:
if( LibItem == NULL ) if( LibItem == NULL )
break; break;
......
...@@ -44,7 +44,7 @@ static int CountConnectedItems( SCH_EDIT_FRAME* frame, SCH_ITEM* ListStruct, wxP ...@@ -44,7 +44,7 @@ static int CountConnectedItems( SCH_EDIT_FRAME* frame, SCH_ITEM* ListStruct, wxP
continue; continue;
if( TstJunction && ( Struct->Type() == DRAW_JUNCTION_STRUCT_TYPE ) ) if( TstJunction && ( Struct->Type() == SCH_JUNCTION_T ) )
{ {
#define JUNCTION ( (SCH_JUNCTION*) Struct ) #define JUNCTION ( (SCH_JUNCTION*) Struct )
if( JUNCTION->m_Pos == pos ) if( JUNCTION->m_Pos == pos )
...@@ -52,11 +52,11 @@ static int CountConnectedItems( SCH_EDIT_FRAME* frame, SCH_ITEM* ListStruct, wxP ...@@ -52,11 +52,11 @@ static int CountConnectedItems( SCH_EDIT_FRAME* frame, SCH_ITEM* ListStruct, wxP
#undef JUNCTION #undef JUNCTION
} }
if( Struct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) if( Struct->Type() != SCH_LINE_T )
continue; continue;
#define SEGM ( (SCH_LINE*) Struct ) #define SEGM ( (SCH_LINE*) Struct )
if( SEGM->IsOneEndPointAt( pos ) ) if( SEGM->IsEndPoint( pos ) )
count++; count++;
#undef SEGM #undef SEGM
} }
...@@ -81,20 +81,20 @@ static bool MarkConnected( SCH_EDIT_FRAME* frame, SCH_ITEM* ListStruct, SCH_LINE ...@@ -81,20 +81,20 @@ static bool MarkConnected( SCH_EDIT_FRAME* frame, SCH_ITEM* ListStruct, SCH_LINE
{ {
if( Struct->m_Flags ) if( Struct->m_Flags )
continue; continue;
if( Struct->Type() == DRAW_JUNCTION_STRUCT_TYPE ) if( Struct->Type() == SCH_JUNCTION_T )
{ {
#define JUNCTION ( (SCH_JUNCTION*) Struct ) #define JUNCTION ( (SCH_JUNCTION*) Struct )
if( segment->IsOneEndPointAt( JUNCTION->m_Pos ) ) if( segment->IsEndPoint( JUNCTION->m_Pos ) )
Struct->m_Flags |= CANDIDATE; Struct->m_Flags |= CANDIDATE;
continue; continue;
#undef JUNCTION #undef JUNCTION
} }
if( Struct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) if( Struct->Type() != SCH_LINE_T )
continue; continue;
#define SEGM ( (SCH_LINE*) Struct ) #define SEGM ( (SCH_LINE*) Struct )
if( segment->IsOneEndPointAt( SEGM->m_Start ) ) if( segment->IsEndPoint( SEGM->m_Start ) )
{ {
if( !frame->LocatePinEnd( ListStruct, SEGM->m_Start ) ) if( !frame->LocatePinEnd( ListStruct, SEGM->m_Start ) )
{ {
...@@ -102,7 +102,7 @@ static bool MarkConnected( SCH_EDIT_FRAME* frame, SCH_ITEM* ListStruct, SCH_LINE ...@@ -102,7 +102,7 @@ static bool MarkConnected( SCH_EDIT_FRAME* frame, SCH_ITEM* ListStruct, SCH_LINE
MarkConnected( frame, ListStruct, SEGM ); MarkConnected( frame, ListStruct, SEGM );
} }
} }
if( segment->IsOneEndPointAt( SEGM->m_End ) ) if( segment->IsEndPoint( SEGM->m_End ) )
{ {
if( !frame->LocatePinEnd( ListStruct, SEGM->m_End ) ) if( !frame->LocatePinEnd( ListStruct, SEGM->m_End ) )
{ {
...@@ -131,13 +131,13 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection ) ...@@ -131,13 +131,13 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection )
for( DelStruct = GetScreen()->GetDrawItems(); DelStruct != NULL; DelStruct = DelStruct->Next() ) for( DelStruct = GetScreen()->GetDrawItems(); DelStruct != NULL; DelStruct = DelStruct->Next() )
DelStruct->m_Flags = 0; DelStruct->m_Flags = 0;
BreakSegmentOnJunction( (SCH_SCREEN*) GetScreen() ); BreakSegmentOnJunction( GetScreen() );
/* Locate all the wires, bus or junction under the mouse cursor, and put /* Locate all the wires, bus or junction under the mouse cursor, and put
* them in a list of items to delete * them in a list of items to delete
*/ */
ITEM_PICKER picker(NULL, UR_DELETED); ITEM_PICKER picker(NULL, UR_DELETED);
SCH_SCREEN* screen = (SCH_SCREEN*) GetScreen(); SCH_SCREEN* screen = GetScreen();
// Save the list entry point of this screen // Save the list entry point of this screen
SCH_ITEM* savedItems = screen->GetDrawItems(); SCH_ITEM* savedItems = screen->GetDrawItems();
DelStruct = GetScreen()->GetDrawItems(); DelStruct = GetScreen()->GetDrawItems();
...@@ -171,7 +171,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection ) ...@@ -171,7 +171,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection )
#define SEGM ( (SCH_LINE*) DelStruct ) #define SEGM ( (SCH_LINE*) DelStruct )
if( DelStruct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) if( DelStruct->Type() != SCH_LINE_T )
continue; continue;
MarkConnected( this, GetScreen()->GetDrawItems(), SEGM ); MarkConnected( this, GetScreen()->GetDrawItems(), SEGM );
...@@ -190,7 +190,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection ) ...@@ -190,7 +190,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection )
if( !(DelStruct->m_Flags & CANDIDATE) ) if( !(DelStruct->m_Flags & CANDIDATE) )
continue; // Already seen continue; // Already seen
if( DelStruct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) if( DelStruct->Type() != SCH_LINE_T )
continue; continue;
DelStruct->m_Flags |= SKIP_STRUCT; DelStruct->m_Flags |= SKIP_STRUCT;
...@@ -207,11 +207,11 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection ) ...@@ -207,11 +207,11 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection )
if( ( removed_struct->m_Flags & STRUCT_DELETED ) == 0 ) if( ( removed_struct->m_Flags & STRUCT_DELETED ) == 0 )
continue; continue;
if( removed_struct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) if( removed_struct->Type() != SCH_LINE_T )
continue; continue;
#define WIRE ( (SCH_LINE*) removed_struct ) #define WIRE ( (SCH_LINE*) removed_struct )
if( WIRE->IsOneEndPointAt( SEGM->m_Start ) ) if( WIRE->IsEndPoint( SEGM->m_Start ) )
break; break;
} }
...@@ -228,9 +228,9 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection ) ...@@ -228,9 +228,9 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection )
{ {
if( ( removed_struct->m_Flags & STRUCT_DELETED ) == 0 ) if( ( removed_struct->m_Flags & STRUCT_DELETED ) == 0 )
continue; continue;
if( removed_struct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) if( removed_struct->Type() != SCH_LINE_T )
continue; continue;
if( WIRE->IsOneEndPointAt( SEGM->m_End ) ) if( WIRE->IsEndPoint( SEGM->m_End ) )
break; break;
} }
...@@ -265,7 +265,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection ) ...@@ -265,7 +265,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection )
if( !(DelStruct->m_Flags & CANDIDATE) ) if( !(DelStruct->m_Flags & CANDIDATE) )
continue; continue;
if( DelStruct->Type() == DRAW_JUNCTION_STRUCT_TYPE ) if( DelStruct->Type() == SCH_JUNCTION_T )
{ {
#define JUNCTION ( (SCH_JUNCTION*) DelStruct ) #define JUNCTION ( (SCH_JUNCTION*) DelStruct )
count = CountConnectedItems( this, GetScreen()->GetDrawItems(), count = CountConnectedItems( this, GetScreen()->GetDrawItems(),
...@@ -291,7 +291,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection ) ...@@ -291,7 +291,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection )
if( DelStruct->m_Flags & STRUCT_DELETED ) if( DelStruct->m_Flags & STRUCT_DELETED )
continue; continue;
if( DelStruct->Type() != TYPE_SCH_LABEL ) if( DelStruct->Type() != SCH_LABEL_T )
continue; continue;
GetScreen()->m_Curseur = ( (SCH_TEXT*) DelStruct )->m_Pos; GetScreen()->m_Curseur = ( (SCH_TEXT*) DelStruct )->m_Pos;
...@@ -383,7 +383,7 @@ bool LocateAndDeleteItem( SCH_EDIT_FRAME* frame, wxDC* DC ) ...@@ -383,7 +383,7 @@ bool LocateAndDeleteItem( SCH_EDIT_FRAME* frame, wxDC* DC )
* Screen = pointer on the screen of belonging * Screen = pointer on the screen of belonging
* *
* Note: * Note:
* DRAW_SHEET_STRUCT_TYPE structures for the screen and structures * SCH_SHEET_T structures for the screen and structures
* Corresponding keys are not. * Corresponding keys are not.
* They must be treated separately * They must be treated separately
*/ */
...@@ -399,7 +399,7 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen ) ...@@ -399,7 +399,7 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
Screen->SetModify(); Screen->SetModify();
if( DrawStruct->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ) if( DrawStruct->Type() == SCH_SHEET_LABEL_T )
{ {
// This structure is attached to a sheet, get the parent sheet object. // This structure is attached to a sheet, get the parent sheet object.
SCH_SHEET_PIN* sheetLabel = (SCH_SHEET_PIN*) DrawStruct; SCH_SHEET_PIN* sheetLabel = (SCH_SHEET_PIN*) DrawStruct;
...@@ -448,7 +448,7 @@ void DeleteAllMarkers( int type ) ...@@ -448,7 +448,7 @@ void DeleteAllMarkers( int type )
{ {
NextStruct = DrawStruct->Next(); NextStruct = DrawStruct->Next();
if( DrawStruct->Type() != TYPE_SCH_MARKER ) if( DrawStruct->Type() != SCH_MARKER_T )
continue; continue;
Marker = (SCH_MARKER*) DrawStruct; Marker = (SCH_MARKER*) DrawStruct;
......
...@@ -30,7 +30,7 @@ void DeleteSubHierarchy( SCH_SHEET* FirstSheet, bool confirm_deletion ) ...@@ -30,7 +30,7 @@ void DeleteSubHierarchy( SCH_SHEET* FirstSheet, bool confirm_deletion )
if( FirstSheet == NULL ) if( FirstSheet == NULL )
return; return;
if( FirstSheet->Type() != DRAW_SHEET_STRUCT_TYPE ) if( FirstSheet->Type() != SCH_SHEET_T )
{ {
DisplayError( NULL, wxT( "DeleteSubHierarchy error(): NOT a Sheet" ) ); DisplayError( NULL, wxT( "DeleteSubHierarchy error(): NOT a Sheet" ) );
return; return;
...@@ -58,7 +58,7 @@ void DeleteSubHierarchy( SCH_SHEET* FirstSheet, bool confirm_deletion ) ...@@ -58,7 +58,7 @@ void DeleteSubHierarchy( SCH_SHEET* FirstSheet, bool confirm_deletion )
DrawStruct = EEDrawList; DrawStruct = EEDrawList;
EEDrawList = EEDrawList->Next(); EEDrawList = EEDrawList->Next();
if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( DrawStruct->Type() == SCH_SHEET_T )
{ {
DeleteSubHierarchy( (SCH_SHEET*) DrawStruct, confirm_deletion ); DeleteSubHierarchy( (SCH_SHEET*) DrawStruct, confirm_deletion );
} }
......
...@@ -628,7 +628,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( ...@@ -628,7 +628,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
if( item == NULL ) if( item == NULL )
continue; continue;
if( item->Type() != TYPE_SCH_COMPONENT ) if( item->Type() != SCH_COMPONENT_T )
continue; continue;
SCH_COMPONENT* comp = (SCH_COMPONENT*) item; SCH_COMPONENT* comp = (SCH_COMPONENT*) item;
...@@ -882,7 +882,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( ...@@ -882,7 +882,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal(
if( schItem == NULL ) if( schItem == NULL )
continue; continue;
if( schItem->Type() != TYPE_SCH_COMPONENT ) if( schItem->Type() != SCH_COMPONENT_T )
continue; continue;
DrawLibItem = (SCH_COMPONENT*) schItem; DrawLibItem = (SCH_COMPONENT*) schItem;
......
...@@ -32,7 +32,8 @@ void InstallCmpeditFrame( SCH_EDIT_FRAME* parent, wxPoint& pos, SCH_COMPONENT* a ...@@ -32,7 +32,8 @@ void InstallCmpeditFrame( SCH_EDIT_FRAME* parent, wxPoint& pos, SCH_COMPONENT* a
return; return;
parent->DrawPanel->m_IgnoreMouseEvents = TRUE; parent->DrawPanel->m_IgnoreMouseEvents = TRUE;
if( aComponent->Type() != TYPE_SCH_COMPONENT )
if( aComponent->Type() != SCH_COMPONENT_T )
{ {
DisplayError( parent, DisplayError( parent,
wxT( "InstallCmpeditFrame() error: This item is not a component" ) ); wxT( "InstallCmpeditFrame() error: This item is not a component" ) );
......
...@@ -72,15 +72,15 @@ void DialogLabelEditor::InitDialog() ...@@ -72,15 +72,15 @@ void DialogLabelEditor::InitDialog()
switch( m_CurrentText->Type() ) switch( m_CurrentText->Type() )
{ {
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
SetTitle( _( "Global Label Properties" ) ); SetTitle( _( "Global Label Properties" ) );
break; break;
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
SetTitle( _( "Hierarchal Label Properties" ) ); SetTitle( _( "Hierarchal Label Properties" ) );
break; break;
case TYPE_SCH_LABEL: case SCH_LABEL_T:
SetTitle( _( "Label Properties" ) ); SetTitle( _( "Label Properties" ) );
break; break;
...@@ -150,8 +150,8 @@ void DialogLabelEditor::InitDialog() ...@@ -150,8 +150,8 @@ void DialogLabelEditor::InitDialog()
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
m_TextSize->SetValue( msg ); m_TextSize->SetValue( msg );
if( m_CurrentText->Type() != TYPE_SCH_GLOBALLABEL if( m_CurrentText->Type() != SCH_GLOBAL_LABEL_T
&& m_CurrentText->Type() != TYPE_SCH_HIERLABEL ) && m_CurrentText->Type() != SCH_HIERARCHICAL_LABEL_T )
{ {
m_TextShape->Show( false ); m_TextShape->Show( false );
} }
......
...@@ -319,7 +319,7 @@ void DIALOG_ERC::DisplayERC_MarkersList() ...@@ -319,7 +319,7 @@ void DIALOG_ERC::DisplayERC_MarkersList()
SCH_ITEM* DrawStruct = Sheet->LastDrawList(); SCH_ITEM* DrawStruct = Sheet->LastDrawList();
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{ {
if( DrawStruct->Type() != TYPE_SCH_MARKER ) if( DrawStruct->Type() != SCH_MARKER_T )
continue; continue;
SCH_MARKER* Marker = (SCH_MARKER*) DrawStruct; SCH_MARKER* Marker = (SCH_MARKER*) DrawStruct;
......
...@@ -48,10 +48,10 @@ void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC ) ...@@ -48,10 +48,10 @@ void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
switch( TextStruct->Type() ) switch( TextStruct->Type() )
{ {
case TYPE_SCH_LABEL: case SCH_LABEL_T:
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
case TYPE_SCH_TEXT: case SCH_TEXT_T:
ItemInitialPosition = TextStruct->m_Pos; ItemInitialPosition = TextStruct->m_Pos;
OldSize = TextStruct->m_Size; OldSize = TextStruct->m_Size;
OldOrient = TextStruct->GetSchematicTextOrientation(); OldOrient = TextStruct->GetSchematicTextOrientation();
...@@ -95,10 +95,10 @@ void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC ) ...@@ -95,10 +95,10 @@ void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
switch( TextStruct->Type() ) switch( TextStruct->Type() )
{ {
case TYPE_SCH_LABEL: case SCH_LABEL_T:
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
case TYPE_SCH_TEXT: case SCH_TEXT_T:
orient = TextStruct->GetSchematicTextOrientation() + 1; orient = TextStruct->GetSchematicTextOrientation() + 1;
orient &= 3; orient &= 3;
TextStruct->SetSchematicTextOrientation( orient ); TextStruct->SetSchematicTextOrientation( orient );
...@@ -195,10 +195,10 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -195,10 +195,10 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/* redraw the text */ /* redraw the text */
switch( TextStruct->Type() ) switch( TextStruct->Type() )
{ {
case TYPE_SCH_LABEL: case SCH_LABEL_T:
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
case TYPE_SCH_TEXT: case SCH_TEXT_T:
( (SCH_TEXT*) TextStruct )->m_Pos = panel->GetScreen()->m_Curseur; ( (SCH_TEXT*) TextStruct )->m_Pos = panel->GetScreen()->m_Curseur;
break; break;
...@@ -238,10 +238,10 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -238,10 +238,10 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
switch( Struct->Type() ) switch( Struct->Type() )
{ {
case TYPE_SCH_LABEL: case SCH_LABEL_T:
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
case TYPE_SCH_TEXT: case SCH_TEXT_T:
{ {
SCH_TEXT* Text = (SCH_TEXT*) Struct; SCH_TEXT* Text = (SCH_TEXT*) Struct;
Text->m_Pos = ItemInitialPosition; Text->m_Pos = ItemInitialPosition;
...@@ -273,19 +273,19 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype ) ...@@ -273,19 +273,19 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype )
switch( newtype ) switch( newtype )
{ {
case TYPE_SCH_LABEL: case SCH_LABEL_T:
newtext = new SCH_LABEL( Text->m_Pos, Text->m_Text ); newtext = new SCH_LABEL( Text->m_Pos, Text->m_Text );
break; break;
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
newtext = new SCH_GLOBALLABEL( Text->m_Pos, Text->m_Text ); newtext = new SCH_GLOBALLABEL( Text->m_Pos, Text->m_Text );
break; break;
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
newtext = new SCH_HIERLABEL( Text->m_Pos, Text->m_Text ); newtext = new SCH_HIERLABEL( Text->m_Pos, Text->m_Text );
break; break;
case TYPE_SCH_TEXT: case SCH_TEXT_T:
newtext = new SCH_TEXT( Text->m_Pos, Text->m_Text ); newtext = new SCH_TEXT( Text->m_Pos, Text->m_Text );
break; break;
......
...@@ -182,7 +182,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel, ...@@ -182,7 +182,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case DRAW_POLYLINE_STRUCT_TYPE: case SCH_POLYLINE_T:
{ {
SCH_POLYLINE* Struct = (SCH_POLYLINE*) aItem; SCH_POLYLINE* Struct = (SCH_POLYLINE*) aItem;
GRMoveTo( Struct->m_PolyPoints[0].x + aOffset.x, GRMoveTo( Struct->m_PolyPoints[0].x + aOffset.x,
...@@ -198,7 +198,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel, ...@@ -198,7 +198,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
break; break;
} }
case DRAW_SEGMENT_STRUCT_TYPE: case SCH_LINE_T:
{ {
SCH_LINE* Struct; SCH_LINE* Struct;
Struct = (SCH_LINE*) aItem; Struct = (SCH_LINE*) aItem;
...@@ -224,7 +224,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel, ...@@ -224,7 +224,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
break; break;
} }
case DRAW_BUSENTRY_STRUCT_TYPE: case SCH_BUS_ENTRY_T:
{ {
SCH_BUS_ENTRY* Struct = (SCH_BUS_ENTRY*) aItem; SCH_BUS_ENTRY* Struct = (SCH_BUS_ENTRY*) aItem;
wxPoint start = Struct->m_Pos + aOffset; wxPoint start = Struct->m_Pos + aOffset;
...@@ -234,7 +234,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel, ...@@ -234,7 +234,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
break; break;
} }
case DRAW_JUNCTION_STRUCT_TYPE: case SCH_JUNCTION_T:
{ {
SCH_JUNCTION* Struct; SCH_JUNCTION* Struct;
Struct = (SCH_JUNCTION*) aItem; Struct = (SCH_JUNCTION*) aItem;
...@@ -242,7 +242,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel, ...@@ -242,7 +242,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
break; break;
} }
case TYPE_SCH_TEXT: case SCH_TEXT_T:
{ {
SCH_TEXT* Struct; SCH_TEXT* Struct;
Struct = (SCH_TEXT*) aItem; Struct = (SCH_TEXT*) aItem;
...@@ -250,9 +250,9 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel, ...@@ -250,9 +250,9 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
break; break;
} }
case TYPE_SCH_LABEL: case SCH_LABEL_T:
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
{ {
SCH_LABEL* Struct; SCH_LABEL* Struct;
Struct = (SCH_LABEL*) aItem; Struct = (SCH_LABEL*) aItem;
...@@ -260,7 +260,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel, ...@@ -260,7 +260,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
break; break;
} }
case DRAW_NOCONNECT_STRUCT_TYPE: case SCH_NO_CONNECT_T:
{ {
SCH_NO_CONNECT* Struct; SCH_NO_CONNECT* Struct;
Struct = (SCH_NO_CONNECT*) aItem; Struct = (SCH_NO_CONNECT*) aItem;
...@@ -268,7 +268,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel, ...@@ -268,7 +268,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
break; break;
} }
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
{ {
SCH_COMPONENT* Component = (SCH_COMPONENT*) aItem; SCH_COMPONENT* Component = (SCH_COMPONENT*) aItem;
...@@ -279,7 +279,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel, ...@@ -279,7 +279,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
break; break;
} }
case DRAW_SHEET_STRUCT_TYPE: case SCH_SHEET_T:
{ {
SCH_SHEET* Struct = (SCH_SHEET*) aItem; SCH_SHEET* Struct = (SCH_SHEET*) aItem;
GRRect( &aPanel->m_ClipBox, GRRect( &aPanel->m_ClipBox,
...@@ -293,8 +293,8 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel, ...@@ -293,8 +293,8 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
break; break;
} }
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case SCH_SHEET_LABEL_T:
case TYPE_SCH_MARKER: case SCH_MARKER_T:
break; break;
default: default:
......
...@@ -174,13 +174,13 @@ int TestDuplicateSheetNames( bool aCreateMarker ) ...@@ -174,13 +174,13 @@ int TestDuplicateSheetNames( bool aCreateMarker )
ref_item = ref_item->Next() ) ref_item = ref_item->Next() )
{ {
// search for a sheet; // search for a sheet;
if( ref_item->Type() != DRAW_SHEET_STRUCT_TYPE ) if( ref_item->Type() != SCH_SHEET_T )
continue; continue;
for( SCH_ITEM* item_to_test = ref_item->Next(); for( SCH_ITEM* item_to_test = ref_item->Next();
item_to_test != NULL; item_to_test != NULL;
item_to_test = item_to_test->Next() ) item_to_test = item_to_test->Next() )
{ {
if( item_to_test->Type() != DRAW_SHEET_STRUCT_TYPE ) if( item_to_test->Type() != SCH_SHEET_T )
continue; continue;
// We have found a second sheet: compare names // We have found a second sheet: compare names
...@@ -532,7 +532,7 @@ bool WriteDiagnosticERC( const wxString& FullFileName ) ...@@ -532,7 +532,7 @@ bool WriteDiagnosticERC( const wxString& FullFileName )
DrawStruct = Sheet->LastDrawList(); DrawStruct = Sheet->LastDrawList();
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{ {
if( DrawStruct->Type() != TYPE_SCH_MARKER ) if( DrawStruct->Type() != SCH_MARKER_T )
continue; continue;
Marker = (SCH_MARKER*) DrawStruct; Marker = (SCH_MARKER*) DrawStruct;
......
...@@ -31,7 +31,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event ) ...@@ -31,7 +31,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
switch( curr_item->Type() ) switch( curr_item->Type() )
{ {
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
{ {
SCH_COMPONENT* newitem; SCH_COMPONENT* newitem;
newitem = ((SCH_COMPONENT*) curr_item)->GenCopy(); newitem = ((SCH_COMPONENT*) curr_item)->GenCopy();
...@@ -46,10 +46,10 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event ) ...@@ -46,10 +46,10 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
} }
break; break;
case TYPE_SCH_TEXT: case SCH_TEXT_T:
case TYPE_SCH_LABEL: case SCH_LABEL_T:
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
{ {
SCH_TEXT* newitem = ((SCH_TEXT*) curr_item)->GenCopy(); SCH_TEXT* newitem = ((SCH_TEXT*) curr_item)->GenCopy();
newitem->m_Flags = IS_NEW; newitem->m_Flags = IS_NEW;
......
...@@ -30,7 +30,7 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* screen, int FileSave ) ...@@ -30,7 +30,7 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* screen, int FileSave )
FILE* f; FILE* f;
if( screen == NULL ) if( screen == NULL )
screen = (SCH_SCREEN*) GetScreen(); 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() ) if( screen->m_FileName.IsEmpty() )
...@@ -169,10 +169,12 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& FileName, bool IsNew ) ...@@ -169,10 +169,12 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& FileName, bool IsNew )
{ {
SAFE_DELETE( g_RootSheet ); SAFE_DELETE( g_RootSheet );
} }
CreateScreens(); CreateScreens();
screen = (SCH_SCREEN*) GetScreen(); screen = GetScreen();
wxFileName fn = FullFileName; wxFileName fn = FullFileName;
if( fn.IsRelative() ) if( fn.IsRelative() )
{ {
fn.MakeAbsolute(); fn.MakeAbsolute();
......
...@@ -46,12 +46,12 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event ) ...@@ -46,12 +46,12 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
if( event.GetFlags() & FR_CURRENT_SHEET_ONLY ) if( event.GetFlags() & FR_CURRENT_SHEET_ONLY )
{ {
sheetFoundIn = m_CurrentSheet; sheetFoundIn = m_CurrentSheet;
lastMarker = (SCH_MARKER*) m_CurrentSheet->FindNextItem( TYPE_SCH_MARKER, lastMarker = (SCH_MARKER*) m_CurrentSheet->FindNextItem( SCH_MARKER_T,
lastMarker, wrap ); lastMarker, wrap );
} }
else else
{ {
lastMarker = (SCH_MARKER*) schematic.FindNextItem( TYPE_SCH_MARKER, &sheetFoundIn, lastMarker = (SCH_MARKER*) schematic.FindNextItem( SCH_MARKER_T, &sheetFoundIn,
lastMarker, wrap ); lastMarker, wrap );
} }
...@@ -126,7 +126,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere ...@@ -126,7 +126,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere
for( ; ( DrawList != NULL ) && ( NotFound == true ); for( ; ( DrawList != NULL ) && ( NotFound == true );
DrawList = DrawList->Next() ) DrawList = DrawList->Next() )
{ {
if( DrawList->Type() == TYPE_SCH_COMPONENT ) if( DrawList->Type() == SCH_COMPONENT_T )
{ {
SCH_COMPONENT* pSch; SCH_COMPONENT* pSch;
pSch = (SCH_COMPONENT*) DrawList; pSch = (SCH_COMPONENT*) DrawList;
......
...@@ -411,7 +411,7 @@ void SCH_EDIT_FRAME::StartMovePart( SCH_COMPONENT* Component, wxDC* DC ) ...@@ -411,7 +411,7 @@ void SCH_EDIT_FRAME::StartMovePart( SCH_COMPONENT* Component, wxDC* DC )
if( Component == NULL ) if( Component == NULL )
return; return;
if( Component->Type() != TYPE_SCH_COMPONENT ) if( Component->Type() != SCH_COMPONENT_T )
return; return;
if( Component->m_Flags == 0 ) if( Component->m_Flags == 0 )
......
...@@ -201,7 +201,7 @@ void WinEDA_HierFrame::BuildSheetsTree( SCH_SHEET_PATH* list, ...@@ -201,7 +201,7 @@ void WinEDA_HierFrame::BuildSheetsTree( SCH_SHEET_PATH* list,
SCH_ITEM* schitem = list->LastDrawList(); SCH_ITEM* schitem = list->LastDrawList();
while( schitem && m_nbsheets < NB_MAX_SHEET ) while( schitem && m_nbsheets < NB_MAX_SHEET )
{ {
if( schitem->Type() == DRAW_SHEET_STRUCT_TYPE ) if( schitem->Type() == SCH_SHEET_T )
{ {
SCH_SHEET* sheet = (SCH_SHEET*) schitem; SCH_SHEET* sheet = (SCH_SHEET*) schitem;
m_nbsheets++; m_nbsheets++;
......
...@@ -507,7 +507,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) ...@@ -507,7 +507,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
} }
if( DrawStruct && DrawStruct->IsNew() && ( m_ID_current_state == ID_BUS_BUTT ) ) if( DrawStruct && DrawStruct->IsNew() && ( m_ID_current_state == ID_BUS_BUTT ) )
{ {
if( DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) if( DrawStruct->Type() == SCH_LINE_T )
{ {
SCH_LINE* segment = (SCH_LINE*) DrawStruct; SCH_LINE* segment = (SCH_LINE*) DrawStruct;
if( segment->GetLayer() != LAYER_BUS ) if( segment->GetLayer() != LAYER_BUS )
...@@ -530,7 +530,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) ...@@ -530,7 +530,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
} }
if( DrawStruct && DrawStruct->IsNew() && ( m_ID_current_state == ID_WIRE_BUTT ) ) if( DrawStruct && DrawStruct->IsNew() && ( m_ID_current_state == ID_WIRE_BUTT ) )
{ {
if( DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) if( DrawStruct->Type() == SCH_LINE_T )
{ {
SCH_LINE* segment = (SCH_LINE*) DrawStruct; SCH_LINE* segment = (SCH_LINE*) DrawStruct;
if( segment->GetLayer() != LAYER_WIRE ) if( segment->GetLayer() != LAYER_WIRE )
...@@ -564,7 +564,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) ...@@ -564,7 +564,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
if( DrawStruct->Type() == TYPE_SCH_COMPONENT ) if( DrawStruct->Type() == SCH_COMPONENT_T )
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( GetScreen() );
if( DrawStruct == NULL ) if( DrawStruct == NULL )
...@@ -585,21 +585,21 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) ...@@ -585,21 +585,21 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {
case DRAW_SHEET_STRUCT_TYPE: //TODO allow sheet rotate on hotkey case SCH_SHEET_T: //TODO allow sheet rotate on hotkey
//wxPostEvent( this, eventRotateSheet ); //wxPostEvent( this, eventRotateSheet );
break; break;
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
wxPostEvent( this, eventRotateComponent ); wxPostEvent( this, eventRotateComponent );
break; break;
case TYPE_SCH_TEXT: case SCH_TEXT_T:
case TYPE_SCH_LABEL: case SCH_LABEL_T:
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
wxPostEvent( this, eventRotateText ); wxPostEvent( this, eventRotateText );
break; break;
case DRAW_PART_TEXT_STRUCT_TYPE: case SCH_FIELD_T:
wxPostEvent( this, eventRotateField ); wxPostEvent( this, eventRotateField );
default: default:
...@@ -616,7 +616,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) ...@@ -616,7 +616,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
break; break;
} }
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*) GetScreen() ); DrawStruct = LocateSmallestComponent( GetScreen() );
if( DrawStruct ) if( DrawStruct )
{ {
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
...@@ -675,11 +675,11 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) ...@@ -675,11 +675,11 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
if( DrawStruct->Type() == TYPE_SCH_COMPONENT ) if( DrawStruct->Type() == SCH_COMPONENT_T )
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( GetScreen() );
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( DrawStruct->Type() == SCH_SHEET_T )
{ {
// If it's a sheet, then check if a pinsheet is under the cursor // If it's a sheet, then check if a pinsheet is under the cursor
SCH_SHEET_PIN* slabel = LocateSheetLabel( (SCH_SHEET*) DrawStruct, SCH_SHEET_PIN* slabel = LocateSheetLabel( (SCH_SHEET*) DrawStruct,
...@@ -687,7 +687,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) ...@@ -687,7 +687,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
if( slabel ) if( slabel )
DrawStruct = slabel; DrawStruct = slabel;
} }
if( DrawStruct->Type() == DRAW_JUNCTION_STRUCT_TYPE ) if( DrawStruct->Type() == SCH_JUNCTION_T )
{ {
// If it's a junction, pick the underlying wire instead // If it's a junction, pick the underlying wire instead
DrawStruct = PickStruct( GetScreen()->m_Curseur, GetScreen(), WIREITEM ); DrawStruct = PickStruct( GetScreen()->m_Curseur, GetScreen(), WIREITEM );
...@@ -723,30 +723,30 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) ...@@ -723,30 +723,30 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
{ {
// select the correct event for moving an schematic object // select the correct event for moving an schematic object
// and add it to the event queue // and add it to the event queue
case DRAW_SHEET_STRUCT_TYPE: case SCH_SHEET_T:
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
wxPostEvent( this, eventMoveOrDragComponent ); wxPostEvent( this, eventMoveOrDragComponent );
break; break;
case TYPE_SCH_LABEL: case SCH_LABEL_T:
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
wxPostEvent( this, eventMoveOrDragComponent ); wxPostEvent( this, eventMoveOrDragComponent );
break; break;
case TYPE_SCH_TEXT: case SCH_TEXT_T:
case DRAW_PART_TEXT_STRUCT_TYPE: case SCH_FIELD_T:
case DRAW_BUSENTRY_STRUCT_TYPE: case SCH_BUS_ENTRY_T:
if( HK_Descr->m_Idcommand != HK_DRAG ) if( HK_Descr->m_Idcommand != HK_DRAG )
wxPostEvent( this, eventMoveItem ); wxPostEvent( this, eventMoveItem );
break; break;
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case SCH_SHEET_LABEL_T:
if( HK_Descr->m_Idcommand != HK_DRAG ) if( HK_Descr->m_Idcommand != HK_DRAG )
wxPostEvent( this, eventMovePinsheet ); wxPostEvent( this, eventMovePinsheet );
break; break;
case DRAW_SEGMENT_STRUCT_TYPE: case SCH_LINE_T:
if( ( (SCH_ITEM*) DrawStruct )->GetLayer() == LAYER_WIRE ) if( ( (SCH_ITEM*) DrawStruct )->GetLayer() == LAYER_WIRE )
wxPostEvent( this, eventDragWire ); wxPostEvent( this, eventDragWire );
break; break;
...@@ -768,7 +768,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) ...@@ -768,7 +768,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
LIBITEM | TEXTITEM | LABELITEM | SHEETITEM ); LIBITEM | TEXTITEM | LABELITEM | SHEETITEM );
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
if( DrawStruct->Type() == TYPE_SCH_COMPONENT ) if( DrawStruct->Type() == SCH_COMPONENT_T )
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( GetScreen() );
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
...@@ -781,19 +781,19 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) ...@@ -781,19 +781,19 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
InstallCmpeditFrame( this, MousePos, (SCH_COMPONENT*) DrawStruct ); InstallCmpeditFrame( this, MousePos, (SCH_COMPONENT*) DrawStruct );
break; break;
case DRAW_SHEET_STRUCT_TYPE: case SCH_SHEET_T:
GetScreen()->SetCurItem( (SCH_ITEM*) DrawStruct ); GetScreen()->SetCurItem( (SCH_ITEM*) DrawStruct );
wxPostEvent( this, eventEditPinsheet ); wxPostEvent( this, eventEditPinsheet );
break; break;
case TYPE_SCH_TEXT: case SCH_TEXT_T:
case TYPE_SCH_LABEL: case SCH_LABEL_T:
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
EditSchematicText( (SCH_TEXT*) DrawStruct ); EditSchematicText( (SCH_TEXT*) DrawStruct );
break; break;
...@@ -917,7 +917,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) ...@@ -917,7 +917,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
case HK_REPEAT_LAST: case HK_REPEAT_LAST:
if( m_lastDrawItem && (m_lastDrawItem->m_Flags == 0) if( m_lastDrawItem && (m_lastDrawItem->m_Flags == 0)
&& ( m_lastDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE ) ) && ( m_lastDrawItem->Type() == LIB_PIN_T ) )
RepeatPinItem( DC, (LIB_PIN*) m_lastDrawItem ); RepeatPinItem( DC, (LIB_PIN*) m_lastDrawItem );
break; break;
...@@ -928,21 +928,21 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) ...@@ -928,21 +928,21 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
{ {
switch( m_drawItem->Type() ) switch( m_drawItem->Type() )
{ {
case COMPONENT_PIN_DRAW_TYPE: case LIB_PIN_T:
cmd.SetId( ID_LIBEDIT_EDIT_PIN ); cmd.SetId( ID_LIBEDIT_EDIT_PIN );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
break; break;
case COMPONENT_ARC_DRAW_TYPE: case LIB_ARC_T:
case COMPONENT_CIRCLE_DRAW_TYPE: case LIB_CIRCLE_T:
case COMPONENT_RECT_DRAW_TYPE: case LIB_RECTANGLE_T:
case COMPONENT_POLYLINE_DRAW_TYPE: case LIB_POLYLINE_T:
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: case LIB_TEXT_T:
cmd.SetId( ID_POPUP_LIBEDIT_BODY_EDIT_ITEM ); cmd.SetId( ID_POPUP_LIBEDIT_BODY_EDIT_ITEM );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
break; break;
case COMPONENT_FIELD_DRAW_TYPE: case LIB_FIELD_T:
cmd.SetId( ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM ); cmd.SetId( ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
break; break;
...@@ -960,17 +960,17 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) ...@@ -960,17 +960,17 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
{ {
switch( m_drawItem->Type() ) switch( m_drawItem->Type() )
{ {
case COMPONENT_PIN_DRAW_TYPE: case LIB_PIN_T:
cmd.SetId( ID_LIBEDIT_ROTATE_PIN ); cmd.SetId( ID_LIBEDIT_ROTATE_PIN );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
break; break;
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: case LIB_TEXT_T:
cmd.SetId( ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT ); cmd.SetId( ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
break; break;
case COMPONENT_FIELD_DRAW_TYPE: case LIB_FIELD_T:
cmd.SetId( ID_POPUP_LIBEDIT_FIELD_ROTATE_ITEM ); cmd.SetId( ID_POPUP_LIBEDIT_FIELD_ROTATE_ITEM );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
break; break;
......
...@@ -53,7 +53,7 @@ static wxPoint calcCenter( const wxPoint& A, const wxPoint& B, const wxPoint& C ...@@ -53,7 +53,7 @@ static wxPoint calcCenter( const wxPoint& A, const wxPoint& B, const wxPoint& C
} }
LIB_ARC::LIB_ARC( LIB_COMPONENT* aParent ) : LIB_DRAW_ITEM( COMPONENT_ARC_DRAW_TYPE, aParent ) LIB_ARC::LIB_ARC( LIB_COMPONENT* aParent ) : LIB_DRAW_ITEM( LIB_ARC_T, aParent )
{ {
m_Radius = 0; m_Radius = 0;
m_t1 = 0; m_t1 = 0;
...@@ -246,7 +246,7 @@ LIB_DRAW_ITEM* LIB_ARC::DoGenCopy() ...@@ -246,7 +246,7 @@ LIB_DRAW_ITEM* LIB_ARC::DoGenCopy()
int LIB_ARC::DoCompare( const LIB_DRAW_ITEM& aOther ) const int LIB_ARC::DoCompare( const LIB_DRAW_ITEM& aOther ) const
{ {
wxASSERT( aOther.Type() == COMPONENT_ARC_DRAW_TYPE ); wxASSERT( aOther.Type() == LIB_ARC_T );
const LIB_ARC* tmp = ( LIB_ARC* ) &aOther; const LIB_ARC* tmp = ( LIB_ARC* ) &aOther;
...@@ -427,7 +427,7 @@ void LIB_ARC::drawGraphic( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& a ...@@ -427,7 +427,7 @@ void LIB_ARC::drawGraphic( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& a
} }
EDA_Rect LIB_ARC::GetBoundingBox() EDA_Rect LIB_ARC::GetBoundingBox() const
{ {
int minX, minY, maxX, maxY, angleStart, angleEnd; int minX, minY, maxX, maxY, angleStart, angleEnd;
EDA_Rect rect; EDA_Rect rect;
......
...@@ -96,7 +96,7 @@ public: ...@@ -96,7 +96,7 @@ public:
*/ */
virtual bool HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTransform ); virtual bool HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTransform );
virtual EDA_Rect GetBoundingBox(); virtual EDA_Rect GetBoundingBox() const;
virtual void DisplayInfo( WinEDA_DrawFrame* frame ); virtual void DisplayInfo( WinEDA_DrawFrame* frame );
/** /**
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
LIB_BEZIER::LIB_BEZIER( LIB_COMPONENT* aParent ) : LIB_BEZIER::LIB_BEZIER( LIB_COMPONENT* aParent ) :
LIB_DRAW_ITEM( COMPONENT_BEZIER_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( LIB_BEZIER_T, aParent )
{ {
m_Fill = NO_FILL; m_Fill = NO_FILL;
m_Width = 0; m_Width = 0;
...@@ -129,7 +129,7 @@ LIB_DRAW_ITEM* LIB_BEZIER::DoGenCopy() ...@@ -129,7 +129,7 @@ LIB_DRAW_ITEM* LIB_BEZIER::DoGenCopy()
int LIB_BEZIER::DoCompare( const LIB_DRAW_ITEM& aOther ) const int LIB_BEZIER::DoCompare( const LIB_DRAW_ITEM& aOther ) const
{ {
wxASSERT( aOther.Type() == COMPONENT_BEZIER_DRAW_TYPE ); wxASSERT( aOther.Type() == LIB_BEZIER_T );
const LIB_BEZIER* tmp = ( LIB_BEZIER* ) &aOther; const LIB_BEZIER* tmp = ( LIB_BEZIER* ) &aOther;
...@@ -340,7 +340,7 @@ bool LIB_BEZIER::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTra ...@@ -340,7 +340,7 @@ bool LIB_BEZIER::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTra
* Function GetBoundingBox * Function GetBoundingBox
* @return the boundary box for this, in library coordinates * @return the boundary box for this, in library coordinates
*/ */
EDA_Rect LIB_BEZIER::GetBoundingBox() EDA_Rect LIB_BEZIER::GetBoundingBox() const
{ {
EDA_Rect rect; EDA_Rect rect;
int xmin, xmax, ymin, ymax; int xmin, xmax, ymin, ymax;
......
...@@ -67,7 +67,7 @@ public: ...@@ -67,7 +67,7 @@ public:
/** /**
* @return the boundary box for this, in library coordinates * @return the boundary box for this, in library coordinates
*/ */
virtual EDA_Rect GetBoundingBox(); virtual EDA_Rect GetBoundingBox() const;
/** /**
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
LIB_CIRCLE::LIB_CIRCLE( LIB_COMPONENT* aParent ) : LIB_CIRCLE::LIB_CIRCLE( LIB_COMPONENT* aParent ) :
LIB_DRAW_ITEM( COMPONENT_CIRCLE_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( LIB_CIRCLE_T, aParent )
{ {
m_Radius = 0; m_Radius = 0;
m_Fill = NO_FILL; m_Fill = NO_FILL;
...@@ -124,7 +124,7 @@ LIB_DRAW_ITEM* LIB_CIRCLE::DoGenCopy() ...@@ -124,7 +124,7 @@ LIB_DRAW_ITEM* LIB_CIRCLE::DoGenCopy()
int LIB_CIRCLE::DoCompare( const LIB_DRAW_ITEM& aOther ) const int LIB_CIRCLE::DoCompare( const LIB_DRAW_ITEM& aOther ) const
{ {
wxASSERT( aOther.Type() == COMPONENT_CIRCLE_DRAW_TYPE ); wxASSERT( aOther.Type() == LIB_CIRCLE_T );
const LIB_CIRCLE* tmp = ( LIB_CIRCLE* ) &aOther; const LIB_CIRCLE* tmp = ( LIB_CIRCLE* ) &aOther;
...@@ -239,7 +239,7 @@ void LIB_CIRCLE::drawGraphic( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint ...@@ -239,7 +239,7 @@ void LIB_CIRCLE::drawGraphic( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint
} }
EDA_Rect LIB_CIRCLE::GetBoundingBox() EDA_Rect LIB_CIRCLE::GetBoundingBox() const
{ {
EDA_Rect rect; EDA_Rect rect;
......
...@@ -69,7 +69,7 @@ public: ...@@ -69,7 +69,7 @@ public:
*/ */
virtual int GetPenSize( ); virtual int GetPenSize( );
virtual EDA_Rect GetBoundingBox(); virtual EDA_Rect GetBoundingBox() const;
virtual void DisplayInfo( WinEDA_DrawFrame* aFrame ); virtual void DisplayInfo( WinEDA_DrawFrame* aFrame );
/** /**
......
...@@ -227,10 +227,7 @@ public: ...@@ -227,10 +227,7 @@ public:
/** /**
* @return the boundary box for this, in library coordinates * @return the boundary box for this, in library coordinates
*/ */
virtual EDA_Rect GetBoundingBox() virtual EDA_Rect GetBoundingBox() const { return EDA_ITEM::GetBoundingBox(); }
{
return EDA_ITEM::GetBoundingBox();
}
/** /**
* Displays basic info (type, part and convert) about item * Displays basic info (type, part and convert) about item
......
...@@ -41,13 +41,13 @@ ...@@ -41,13 +41,13 @@
* others = free fields * others = free fields
*/ */
LIB_FIELD::LIB_FIELD(LIB_COMPONENT * aParent, int idfield ) : LIB_FIELD::LIB_FIELD(LIB_COMPONENT * aParent, int idfield ) :
LIB_DRAW_ITEM( COMPONENT_FIELD_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( LIB_FIELD_T, aParent )
{ {
Init( idfield ); Init( idfield );
} }
LIB_FIELD::LIB_FIELD( int idfield ) : LIB_DRAW_ITEM( COMPONENT_FIELD_DRAW_TYPE, NULL ) LIB_FIELD::LIB_FIELD( int idfield ) : LIB_DRAW_ITEM( LIB_FIELD_T, NULL )
{ {
Init( idfield ); Init( idfield );
} }
...@@ -444,7 +444,7 @@ void LIB_FIELD::Copy( LIB_FIELD* Target ) const ...@@ -444,7 +444,7 @@ void LIB_FIELD::Copy( LIB_FIELD* Target ) const
int LIB_FIELD::DoCompare( const LIB_DRAW_ITEM& other ) const int LIB_FIELD::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_FIELD_DRAW_TYPE ); wxASSERT( other.Type() == LIB_FIELD_T );
const LIB_FIELD* tmp = ( LIB_FIELD* ) &other; const LIB_FIELD* tmp = ( LIB_FIELD* ) &other;
...@@ -529,7 +529,7 @@ wxString LIB_FIELD::GetFullText( int unit ) ...@@ -529,7 +529,7 @@ wxString LIB_FIELD::GetFullText( int unit )
} }
EDA_Rect LIB_FIELD::GetBoundingBox() EDA_Rect LIB_FIELD::GetBoundingBox() const
{ {
EDA_Rect rect = GetTextBox(); EDA_Rect rect = GetTextBox();
rect.m_Pos.y *= -1; rect.m_Pos.y *= -1;
......
...@@ -119,7 +119,7 @@ public: ...@@ -119,7 +119,7 @@ public:
* Return the bounding rectangle of the field text. * Return the bounding rectangle of the field text.
* @return Bounding rectangle. * @return Bounding rectangle.
*/ */
virtual EDA_Rect GetBoundingBox(); virtual EDA_Rect GetBoundingBox() const;
/** /**
* Displays info (type, part convert filed name and value) * Displays info (type, part convert filed name and value)
......
...@@ -160,7 +160,7 @@ extern void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos, ...@@ -160,7 +160,7 @@ extern void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos,
LIB_PIN::LIB_PIN( LIB_COMPONENT * aParent ) : LIB_PIN::LIB_PIN( LIB_COMPONENT * aParent ) :
LIB_DRAW_ITEM( COMPONENT_PIN_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( LIB_PIN_T, aParent )
{ {
m_length = 300; /* default Pin len */ m_length = 300; /* default Pin len */
m_orientation = PIN_RIGHT; /* Pin orient: Up, Down, Left, Right */ m_orientation = PIN_RIGHT; /* Pin orient: Up, Down, Left, Right */
...@@ -1640,7 +1640,7 @@ LIB_DRAW_ITEM* LIB_PIN::DoGenCopy() ...@@ -1640,7 +1640,7 @@ LIB_DRAW_ITEM* LIB_PIN::DoGenCopy()
int LIB_PIN::DoCompare( const LIB_DRAW_ITEM& other ) const int LIB_PIN::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_PIN_DRAW_TYPE ); wxASSERT( other.Type() == LIB_PIN_T );
const LIB_PIN* tmp = ( LIB_PIN* ) &other; const LIB_PIN* tmp = ( LIB_PIN* ) &other;
...@@ -1771,7 +1771,7 @@ void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -1771,7 +1771,7 @@ void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame )
* Function GetBoundingBox * Function GetBoundingBox
* @return the boundary box for this, in schematic coordinates * @return the boundary box for this, in schematic coordinates
*/ */
EDA_Rect LIB_PIN::GetBoundingBox() EDA_Rect LIB_PIN::GetBoundingBox() const
{ {
wxPoint pt = m_position; wxPoint pt = m_position;
......
...@@ -153,7 +153,9 @@ public: ...@@ -153,7 +153,9 @@ public:
virtual bool HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTransform ); virtual bool HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTransform );
virtual void DisplayInfo( WinEDA_DrawFrame* frame ); virtual void DisplayInfo( WinEDA_DrawFrame* frame );
virtual EDA_Rect GetBoundingBox();
virtual EDA_Rect GetBoundingBox() const;
wxPoint ReturnPinEndPoint() const; wxPoint ReturnPinEndPoint() const;
int ReturnPinDrawOrient( const TRANSFORM& aTransform ); int ReturnPinDrawOrient( const TRANSFORM& aTransform );
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
LIB_POLYLINE::LIB_POLYLINE( LIB_COMPONENT* aParent ) : LIB_POLYLINE::LIB_POLYLINE( LIB_COMPONENT* aParent ) :
LIB_DRAW_ITEM( COMPONENT_POLYLINE_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( LIB_POLYLINE_T, aParent )
{ {
m_Fill = NO_FILL; m_Fill = NO_FILL;
m_Width = 0; m_Width = 0;
...@@ -132,7 +132,7 @@ LIB_DRAW_ITEM* LIB_POLYLINE::DoGenCopy() ...@@ -132,7 +132,7 @@ LIB_DRAW_ITEM* LIB_POLYLINE::DoGenCopy()
int LIB_POLYLINE::DoCompare( const LIB_DRAW_ITEM& aOther ) const int LIB_POLYLINE::DoCompare( const LIB_DRAW_ITEM& aOther ) const
{ {
wxASSERT( aOther.Type() == COMPONENT_POLYLINE_DRAW_TYPE ); wxASSERT( aOther.Type() == LIB_POLYLINE_T );
const LIB_POLYLINE* tmp = ( LIB_POLYLINE* ) &aOther; const LIB_POLYLINE* tmp = ( LIB_POLYLINE* ) &aOther;
...@@ -358,7 +358,7 @@ bool LIB_POLYLINE::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aT ...@@ -358,7 +358,7 @@ bool LIB_POLYLINE::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aT
* Function GetBoundingBox * Function GetBoundingBox
* @return the boundary box for this, in library coordinates * @return the boundary box for this, in library coordinates
*/ */
EDA_Rect LIB_POLYLINE::GetBoundingBox() EDA_Rect LIB_POLYLINE::GetBoundingBox() const
{ {
EDA_Rect rect; EDA_Rect rect;
int xmin, xmax, ymin, ymax; int xmin, xmax, ymin, ymax;
......
...@@ -81,7 +81,7 @@ public: ...@@ -81,7 +81,7 @@ public:
/** /**
* @return the boundary box for this, in library coordinates * @return the boundary box for this, in library coordinates
*/ */
virtual EDA_Rect GetBoundingBox(); virtual EDA_Rect GetBoundingBox() const;
/** /**
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
LIB_RECTANGLE::LIB_RECTANGLE( LIB_COMPONENT* aParent ) : LIB_RECTANGLE::LIB_RECTANGLE( LIB_COMPONENT* aParent ) :
LIB_DRAW_ITEM( COMPONENT_RECT_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( LIB_RECTANGLE_T, aParent )
{ {
m_Width = 0; m_Width = 0;
m_Fill = NO_FILL; m_Fill = NO_FILL;
...@@ -90,7 +90,7 @@ LIB_DRAW_ITEM* LIB_RECTANGLE::DoGenCopy() ...@@ -90,7 +90,7 @@ LIB_DRAW_ITEM* LIB_RECTANGLE::DoGenCopy()
int LIB_RECTANGLE::DoCompare( const LIB_DRAW_ITEM& aOther ) const int LIB_RECTANGLE::DoCompare( const LIB_DRAW_ITEM& aOther ) const
{ {
wxASSERT( aOther.Type() == COMPONENT_RECT_DRAW_TYPE ); wxASSERT( aOther.Type() == LIB_RECTANGLE_T );
const LIB_RECTANGLE* tmp = ( LIB_RECTANGLE* ) &aOther; const LIB_RECTANGLE* tmp = ( LIB_RECTANGLE* ) &aOther;
...@@ -229,7 +229,7 @@ void LIB_RECTANGLE::DisplayInfo( WinEDA_DrawFrame* aFrame ) ...@@ -229,7 +229,7 @@ void LIB_RECTANGLE::DisplayInfo( WinEDA_DrawFrame* aFrame )
} }
EDA_Rect LIB_RECTANGLE::GetBoundingBox() EDA_Rect LIB_RECTANGLE::GetBoundingBox() const
{ {
EDA_Rect rect; EDA_Rect rect;
......
...@@ -74,7 +74,8 @@ public: ...@@ -74,7 +74,8 @@ public:
*/ */
virtual int GetPenSize( ); virtual int GetPenSize( );
virtual EDA_Rect GetBoundingBox(); virtual EDA_Rect GetBoundingBox() const;
virtual void DisplayInfo( WinEDA_DrawFrame* aFrame ); virtual void DisplayInfo( WinEDA_DrawFrame* aFrame );
/** /**
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
LIB_TEXT::LIB_TEXT(LIB_COMPONENT * aParent) : LIB_TEXT::LIB_TEXT(LIB_COMPONENT * aParent) :
LIB_DRAW_ITEM( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE, aParent ), LIB_DRAW_ITEM( LIB_TEXT_T, aParent ),
EDA_TextStruct() EDA_TextStruct()
{ {
m_Size = wxSize( 50, 50 ); m_Size = wxSize( 50, 50 );
...@@ -198,7 +198,7 @@ LIB_DRAW_ITEM* LIB_TEXT::DoGenCopy() ...@@ -198,7 +198,7 @@ LIB_DRAW_ITEM* LIB_TEXT::DoGenCopy()
int LIB_TEXT::DoCompare( const LIB_DRAW_ITEM& other ) const int LIB_TEXT::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ); wxASSERT( other.Type() == LIB_TEXT_T );
const LIB_TEXT* tmp = ( LIB_TEXT* ) &other; const LIB_TEXT* tmp = ( LIB_TEXT* ) &other;
...@@ -378,15 +378,12 @@ void LIB_TEXT::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -378,15 +378,12 @@ void LIB_TEXT::DisplayInfo( WinEDA_DrawFrame* frame )
/** /**
* @return the boundary box for this, in schematic coordinates * @return the boundary box for this, in schematic coordinates
*/ */
EDA_Rect LIB_TEXT::GetBoundingBox() EDA_Rect LIB_TEXT::GetBoundingBox() const
{ {
/* remenber Y coordinates in lib are bottom to top, so we must /* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when
* negate the Y position befire calling GetTextBox() that works using top to bottom * calling GetTextBox() that works using top to bottom Y axis orientation.
* Y axis orientation
*/ */
NEGATE(m_Pos.y ); EDA_Rect rect = GetTextBox( -1, -1, true );
EDA_Rect rect = GetTextBox();
NEGATE(m_Pos.y ); // restore Y cooordinate for the graphic text
wxPoint orig = rect.GetOrigin(); wxPoint orig = rect.GetOrigin();
wxPoint end = rect.GetEnd(); wxPoint end = rect.GetEnd();
......
...@@ -98,7 +98,7 @@ public: ...@@ -98,7 +98,7 @@ public:
virtual void DisplayInfo( WinEDA_DrawFrame* aFrame ); virtual void DisplayInfo( WinEDA_DrawFrame* aFrame );
virtual EDA_Rect GetBoundingBox(); virtual EDA_Rect GetBoundingBox() const;
void Rotate(); void Rotate();
......
...@@ -40,7 +40,7 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName ) ...@@ -40,7 +40,7 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName )
{ {
for( SCH_ITEM* SchItem = screen->GetDrawItems(); SchItem; SchItem = SchItem->Next() ) for( SCH_ITEM* SchItem = screen->GetDrawItems(); SchItem; SchItem = SchItem->Next() )
{ {
if( SchItem->Type() != TYPE_SCH_COMPONENT ) if( SchItem->Type() != SCH_COMPONENT_T )
continue; continue;
SCH_COMPONENT* component = (SCH_COMPONENT*) SchItem; SCH_COMPONENT* component = (SCH_COMPONENT*) SchItem;
......
...@@ -31,7 +31,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -31,7 +31,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
switch( DrawEntry->Type() ) switch( DrawEntry->Type() )
{ {
case COMPONENT_PIN_DRAW_TYPE: case LIB_PIN_T:
PlacePin( DC ); PlacePin( DC );
DrawEntry = NULL; DrawEntry = NULL;
break; break;
...@@ -113,7 +113,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -113,7 +113,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
if( DrawEntry->Type() == COMPONENT_PIN_DRAW_TYPE ) if( DrawEntry->Type() == LIB_PIN_T )
DeletePin( DC, m_component, (LIB_PIN*) DrawEntry ); DeletePin( DC, m_component, (LIB_PIN*) DrawEntry );
else else
m_component->RemoveDrawItem( DrawEntry, DrawPanel, DC ); m_component->RemoveDrawItem( DrawEntry, DrawPanel, DC );
...@@ -175,7 +175,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -175,7 +175,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
switch( m_drawItem->Type() ) switch( m_drawItem->Type() )
{ {
case COMPONENT_PIN_DRAW_TYPE: case LIB_PIN_T:
if( m_drawItem->m_Flags == 0 ) if( m_drawItem->m_Flags == 0 )
{ {
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
...@@ -184,17 +184,16 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -184,17 +184,16 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
} }
break; break;
case COMPONENT_ARC_DRAW_TYPE: case LIB_ARC_T:
case COMPONENT_CIRCLE_DRAW_TYPE: case LIB_CIRCLE_T:
case COMPONENT_RECT_DRAW_TYPE: case LIB_RECTANGLE_T:
if( m_drawItem->m_Flags == 0 ) if( m_drawItem->m_Flags == 0 )
{ {
EditGraphicSymbol( DC, m_drawItem ); EditGraphicSymbol( DC, m_drawItem );
} }
break; break;
case COMPONENT_LINE_DRAW_TYPE: case LIB_POLYLINE_T:
case COMPONENT_POLYLINE_DRAW_TYPE:
if( m_drawItem->m_Flags == 0 ) if( m_drawItem->m_Flags == 0 )
{ {
EditGraphicSymbol( DC, m_drawItem ); EditGraphicSymbol( DC, m_drawItem );
...@@ -205,14 +204,14 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -205,14 +204,14 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
} }
break; break;
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: case LIB_TEXT_T:
if( m_drawItem->m_Flags == 0 ) if( m_drawItem->m_Flags == 0 )
{ {
EditSymbolText( DC, m_drawItem ); EditSymbolText( DC, m_drawItem );
} }
break; break;
case COMPONENT_FIELD_DRAW_TYPE: case LIB_FIELD_T:
if( m_drawItem->m_Flags == 0 ) if( m_drawItem->m_Flags == 0 )
{ {
EditField( DC, (LIB_FIELD*) m_drawItem ); EditField( DC, (LIB_FIELD*) m_drawItem );
......
This diff is collapsed.
...@@ -77,8 +77,8 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event ) ...@@ -77,8 +77,8 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
* the margin is 10% the size of the component size * the margin is 10% the size of the component size
*/ */
wxSize pagesize = GetScreen()->ReturnPageSize( ); wxSize pagesize = GetScreen()->ReturnPageSize( );
wxSize componentSize = wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).m_Size;
m_component->GetBoundaryBox(m_unit, m_convert).m_Size;
// Add a small margin to the plot bounding box // Add a small margin to the plot bounding box
componentSize.x = (int)(componentSize.x * 1.2); componentSize.x = (int)(componentSize.x * 1.2);
componentSize.y = (int)(componentSize.y * 1.2); componentSize.y = (int)(componentSize.y * 1.2);
......
...@@ -344,7 +344,7 @@ int LIB_EDIT_FRAME::BestZoom() ...@@ -344,7 +344,7 @@ int LIB_EDIT_FRAME::BestZoom()
if( m_component ) if( m_component )
{ {
BoundaryBox = m_component->GetBoundaryBox( m_unit, m_convert ); BoundaryBox = m_component->GetBoundingBox( m_unit, m_convert );
dx = BoundaryBox.GetWidth(); dx = BoundaryBox.GetWidth();
dy = BoundaryBox.GetHeight(); dy = BoundaryBox.GetHeight();
GetScreen()->m_Curseur = BoundaryBox.Centre(); GetScreen()->m_Curseur = BoundaryBox.Centre();
...@@ -729,15 +729,14 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -729,15 +729,14 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
switch( m_drawItem->Type() ) switch( m_drawItem->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case LIB_ARC_T:
case COMPONENT_CIRCLE_DRAW_TYPE: case LIB_CIRCLE_T:
case COMPONENT_RECT_DRAW_TYPE: case LIB_RECTANGLE_T:
case COMPONENT_POLYLINE_DRAW_TYPE: case LIB_POLYLINE_T:
case COMPONENT_LINE_DRAW_TYPE:
EditGraphicSymbol( &dc, m_drawItem ); EditGraphicSymbol( &dc, m_drawItem );
break; break;
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: case LIB_TEXT_T:
EditSymbolText( &dc, m_drawItem ); EditSymbolText( &dc, m_drawItem );
break; break;
...@@ -782,7 +781,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -782,7 +781,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOff( &dc ); DrawPanel->CursorOff( &dc );
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
if( m_drawItem->Type() == COMPONENT_PIN_DRAW_TYPE ) if( m_drawItem->Type() == LIB_PIN_T )
{ {
DeletePin( &dc, m_component, (LIB_PIN*) m_drawItem ); DeletePin( &dc, m_component, (LIB_PIN*) m_drawItem );
} }
...@@ -803,7 +802,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -803,7 +802,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( m_drawItem == NULL ) if( m_drawItem == NULL )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if( m_drawItem->Type() == COMPONENT_PIN_DRAW_TYPE ) if( m_drawItem->Type() == LIB_PIN_T )
StartMovePin( &dc ); StartMovePin( &dc );
else else
StartMoveDrawSymbol( &dc ); StartMoveDrawSymbol( &dc );
...@@ -815,10 +814,10 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -815,10 +814,10 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if( m_drawItem->Type() == COMPONENT_RECT_DRAW_TYPE if( m_drawItem->Type() == LIB_RECTANGLE_T
|| m_drawItem->Type() == COMPONENT_CIRCLE_DRAW_TYPE || m_drawItem->Type() == LIB_CIRCLE_T
|| m_drawItem->Type() == COMPONENT_POLYLINE_DRAW_TYPE || m_drawItem->Type() == LIB_POLYLINE_T
|| m_drawItem->Type() == COMPONENT_ARC_DRAW_TYPE || m_drawItem->Type() == LIB_ARC_T
) )
{ {
StartModifyDrawSymbol( &dc ); StartModifyDrawSymbol( &dc );
...@@ -827,7 +826,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -827,7 +826,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT: case ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT:
if( m_drawItem == NULL && m_drawItem->Type() != COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) if( m_drawItem == NULL && m_drawItem->Type() != LIB_TEXT_T )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if( !m_drawItem->InEditMode() ) if( !m_drawItem->InEditMode() )
...@@ -842,7 +841,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -842,7 +841,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_LIBEDIT_FIELD_ROTATE_ITEM: case ID_POPUP_LIBEDIT_FIELD_ROTATE_ITEM:
{ {
if( m_drawItem == NULL || ( m_drawItem->Type() != COMPONENT_FIELD_DRAW_TYPE ) ) if( m_drawItem == NULL || ( m_drawItem->Type() != LIB_FIELD_T ) )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
...@@ -861,7 +860,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -861,7 +860,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( m_drawItem == NULL ) if( m_drawItem == NULL )
break; break;
DrawPanel->CursorOff( &dc ); DrawPanel->CursorOff( &dc );
if( m_drawItem->Type() == COMPONENT_FIELD_DRAW_TYPE ) if( m_drawItem->Type() == LIB_FIELD_T )
{ {
EditField( &dc, (LIB_FIELD*) m_drawItem ); EditField( &dc, (LIB_FIELD*) m_drawItem );
} }
...@@ -873,7 +872,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -873,7 +872,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM: case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM:
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM: case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM:
if( (m_drawItem == NULL ) if( (m_drawItem == NULL )
|| (m_drawItem->Type() != COMPONENT_PIN_DRAW_TYPE) ) || (m_drawItem->Type() != LIB_PIN_T) )
break; break;
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
GlobalSetPins( &dc, (LIB_PIN*) m_drawItem, id ); GlobalSetPins( &dc, (LIB_PIN*) m_drawItem, id );
...@@ -986,8 +985,10 @@ void LIB_EDIT_FRAME::RestoreComponent() ...@@ -986,8 +985,10 @@ void LIB_EDIT_FRAME::RestoreComponent()
{ {
if( m_tempCopyComponent == NULL ) if( m_tempCopyComponent == NULL )
return; return;
if( m_component ) if( m_component )
delete m_component; delete m_component;
m_component = m_tempCopyComponent; m_component = m_tempCopyComponent;
m_tempCopyComponent = NULL; m_tempCopyComponent = NULL;
} }
...@@ -1013,14 +1014,13 @@ void LIB_EDIT_FRAME::SVG_Print_Component( const wxString& FullFileName ) ...@@ -1013,14 +1014,13 @@ void LIB_EDIT_FRAME::SVG_Print_Component( const wxString& FullFileName )
void LIB_EDIT_FRAME::EditSymbolText( wxDC* DC, LIB_DRAW_ITEM* DrawItem ) void LIB_EDIT_FRAME::EditSymbolText( wxDC* DC, LIB_DRAW_ITEM* DrawItem )
{ {
if ( ( DrawItem == NULL ) || ( DrawItem->Type() != COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) ) if ( ( DrawItem == NULL ) || ( DrawItem->Type() != LIB_TEXT_T ) )
return; return;
/* Deleting old text. */ /* Deleting old text. */
if( DC && !DrawItem->InEditMode() ) if( DC && !DrawItem->InEditMode() )
DrawItem->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform ); DrawItem->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform );
DIALOG_LIB_EDIT_TEXT* frame = new DIALOG_LIB_EDIT_TEXT( this, (LIB_TEXT*) DrawItem ); DIALOG_LIB_EDIT_TEXT* frame = new DIALOG_LIB_EDIT_TEXT( this, (LIB_TEXT*) DrawItem );
frame->ShowModal(); frame->ShowModal();
frame->Destroy(); frame->Destroy();
......
This diff is collapsed.
...@@ -494,7 +494,7 @@ SCH_COMPONENT* EXPORT_HELP::findNextComponent( EDA_ITEM* aItem, SCH_SHEET_PATH* ...@@ -494,7 +494,7 @@ SCH_COMPONENT* EXPORT_HELP::findNextComponent( EDA_ITEM* aItem, SCH_SHEET_PATH*
// continue searching from the middle of a linked list (the draw list) // continue searching from the middle of a linked list (the draw list)
for( ; aItem; aItem = aItem->Next() ) for( ; aItem; aItem = aItem->Next() )
{ {
if( aItem->Type() != TYPE_SCH_COMPONENT ) if( aItem->Type() != SCH_COMPONENT_T )
continue; continue;
// found next component // found next component
...@@ -544,7 +544,7 @@ SCH_COMPONENT* EXPORT_HELP::findNextComponentAndCreatPinList( EDA_ITEM* aI ...@@ -544,7 +544,7 @@ SCH_COMPONENT* EXPORT_HELP::findNextComponentAndCreatPinList( EDA_ITEM* aI
// continue searching from the middle of a linked list (the draw list) // continue searching from the middle of a linked list (the draw list)
for( ; aItem; aItem = aItem->Next() ) for( ; aItem; aItem = aItem->Next() )
{ {
if( aItem->Type() != TYPE_SCH_COMPONENT ) if( aItem->Type() != SCH_COMPONENT_T )
continue; continue;
// found next component // found next component
...@@ -591,7 +591,7 @@ SCH_COMPONENT* EXPORT_HELP::findNextComponentAndCreatPinList( EDA_ITEM* aI ...@@ -591,7 +591,7 @@ SCH_COMPONENT* EXPORT_HELP::findNextComponentAndCreatPinList( EDA_ITEM* aI
{ {
LIB_PIN* pin = pins[i]; LIB_PIN* pin = pins[i];
wxASSERT( pin->Type() == COMPONENT_PIN_DRAW_TYPE ); wxASSERT( pin->Type() == LIB_PIN_T );
addPinToComponentPinList( comp, aSheetPath, pin ); addPinToComponentPinList( comp, aSheetPath, pin );
} }
...@@ -1203,7 +1203,7 @@ bool EXPORT_HELP::WriteNetListPspice( SCH_EDIT_FRAME* frame, FILE* f, bool use_n ...@@ -1203,7 +1203,7 @@ bool EXPORT_HELP::WriteNetListPspice( SCH_EDIT_FRAME* frame, FILE* f, bool use_n
for( EDA_ITEM* item = sheet->LastDrawList(); item; item = item->Next() ) for( EDA_ITEM* item = sheet->LastDrawList(); item; item = item->Next() )
{ {
wxChar ident; wxChar ident;
if( item->Type() != TYPE_SCH_TEXT ) if( item->Type() != SCH_TEXT_T )
continue; continue;
SCH_TEXT* drawText = (SCH_TEXT*) item; SCH_TEXT* drawText = (SCH_TEXT*) item;
...@@ -1570,7 +1570,7 @@ void EXPORT_HELP::findAllInstancesOfComponent( SCH_COMPONENT* aComponent, ...@@ -1570,7 +1570,7 @@ void EXPORT_HELP::findAllInstancesOfComponent( SCH_COMPONENT* aComponent,
{ {
for( EDA_ITEM* item = sheet->LastDrawList(); item; item = item->Next() ) for( EDA_ITEM* item = sheet->LastDrawList(); item; item = item->Next() )
{ {
if( item->Type() != TYPE_SCH_COMPONENT ) if( item->Type() != SCH_COMPONENT_T )
continue; continue;
SCH_COMPONENT* comp2 = (SCH_COMPONENT*) item; SCH_COMPONENT* comp2 = (SCH_COMPONENT*) item;
...@@ -1583,7 +1583,7 @@ void EXPORT_HELP::findAllInstancesOfComponent( SCH_COMPONENT* aComponent, ...@@ -1583,7 +1583,7 @@ void EXPORT_HELP::findAllInstancesOfComponent( SCH_COMPONENT* aComponent,
for( LIB_PIN* pin = aEntry->GetNextPin(); pin; pin = aEntry->GetNextPin( pin ) ) for( LIB_PIN* pin = aEntry->GetNextPin(); pin; pin = aEntry->GetNextPin( pin ) )
{ {
wxASSERT( pin->Type() == COMPONENT_PIN_DRAW_TYPE ); wxASSERT( pin->Type() == LIB_PIN_T );
if( pin->GetUnit() && pin->GetUnit() != unit2 ) if( pin->GetUnit() && pin->GetUnit() != unit2 )
continue; continue;
......
...@@ -514,7 +514,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist, ...@@ -514,7 +514,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
{ {
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
case DRAW_SEGMENT_STRUCT_TYPE: case SCH_LINE_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_LINE*) DrawList ) #define STRUCT ( (SCH_LINE*) DrawList )
if( (STRUCT->GetLayer() != LAYER_BUS) if( (STRUCT->GetLayer() != LAYER_BUS)
...@@ -539,7 +539,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist, ...@@ -539,7 +539,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
aNetItemBuffer.push_back( new_item ); aNetItemBuffer.push_back( new_item );
break; break;
case DRAW_JUNCTION_STRUCT_TYPE: case SCH_JUNCTION_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_JUNCTION*) DrawList ) #define STRUCT ( (SCH_JUNCTION*) DrawList )
new_item = new NETLIST_OBJECT(); new_item = new NETLIST_OBJECT();
...@@ -553,7 +553,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist, ...@@ -553,7 +553,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
aNetItemBuffer.push_back( new_item ); aNetItemBuffer.push_back( new_item );
break; break;
case DRAW_NOCONNECT_STRUCT_TYPE: case SCH_NO_CONNECT_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_NO_CONNECT*) DrawList ) #define STRUCT ( (SCH_NO_CONNECT*) DrawList )
new_item = new NETLIST_OBJECT(); new_item = new NETLIST_OBJECT();
...@@ -567,7 +567,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist, ...@@ -567,7 +567,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
aNetItemBuffer.push_back( new_item ); aNetItemBuffer.push_back( new_item );
break; break;
case TYPE_SCH_LABEL: case SCH_LABEL_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_LABEL*) DrawList ) #define STRUCT ( (SCH_LABEL*) DrawList )
ii = IsBusLabel( STRUCT->m_Text ); ii = IsBusLabel( STRUCT->m_Text );
...@@ -578,9 +578,9 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist, ...@@ -578,9 +578,9 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
new_item->m_Comp = STRUCT; new_item->m_Comp = STRUCT;
new_item->m_Type = NET_LABEL; new_item->m_Type = NET_LABEL;
if( STRUCT->m_Layer == LAYER_GLOBLABEL ) if( STRUCT->GetLayer() == LAYER_GLOBLABEL )
new_item->m_Type = NET_GLOBLABEL; new_item->m_Type = NET_GLOBLABEL;
if( STRUCT->m_Layer == LAYER_HIERLABEL ) if( STRUCT->GetLayer() == LAYER_HIERLABEL )
new_item->m_Type = NET_HIERLABEL; new_item->m_Type = NET_HIERLABEL;
new_item->m_Label = STRUCT->m_Text; new_item->m_Label = STRUCT->m_Text;
...@@ -594,8 +594,8 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist, ...@@ -594,8 +594,8 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
break; break;
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_LABEL*) DrawList ) #define STRUCT ( (SCH_LABEL*) DrawList )
ii = IsBusLabel( STRUCT->m_Text ); ii = IsBusLabel( STRUCT->m_Text );
...@@ -607,9 +607,9 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist, ...@@ -607,9 +607,9 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
// this is not the simplest way of doing it // this is not the simplest way of doing it
// (look at the case statement above). // (look at the case statement above).
if( STRUCT->m_Layer == LAYER_GLOBLABEL ) if( STRUCT->GetLayer() == LAYER_GLOBLABEL )
new_item->m_Type = NET_GLOBLABEL; new_item->m_Type = NET_GLOBLABEL;
if( STRUCT->m_Layer == LAYER_HIERLABEL ) if( STRUCT->GetLayer() == LAYER_HIERLABEL )
new_item->m_Type = NET_HIERLABEL; new_item->m_Type = NET_HIERLABEL;
new_item->m_Label = STRUCT->m_Text; new_item->m_Label = STRUCT->m_Text;
...@@ -623,7 +623,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist, ...@@ -623,7 +623,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
break; break;
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
DrawLibItem = (SCH_COMPONENT*) DrawList; DrawLibItem = (SCH_COMPONENT*) DrawList;
Entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
...@@ -632,7 +632,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist, ...@@ -632,7 +632,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
for( LIB_PIN* pin = Entry->GetNextPin(); pin; pin = Entry->GetNextPin( pin ) ) for( LIB_PIN* pin = Entry->GetNextPin(); pin; pin = Entry->GetNextPin( pin ) )
{ {
wxASSERT( pin->Type() == COMPONENT_PIN_DRAW_TYPE ); wxASSERT( pin->Type() == LIB_PIN_T );
if( pin->GetUnit() && if( pin->GetUnit() &&
( pin->GetUnit() != DrawLibItem->GetUnitSelection( sheetlist ) ) ) ( pin->GetUnit() != DrawLibItem->GetUnitSelection( sheetlist ) ) )
...@@ -674,13 +674,13 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist, ...@@ -674,13 +674,13 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
} }
break; break;
case DRAW_POLYLINE_STRUCT_TYPE: case SCH_POLYLINE_T:
case DRAW_BUSENTRY_STRUCT_TYPE: case SCH_BUS_ENTRY_T:
case TYPE_SCH_MARKER: case SCH_MARKER_T:
case TYPE_SCH_TEXT: case SCH_TEXT_T:
break; break;
case DRAW_SHEET_STRUCT_TYPE: case SCH_SHEET_T:
{ {
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_SHEET*) DrawList ) #define STRUCT ( (SCH_SHEET*) DrawList )
...@@ -710,7 +710,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist, ...@@ -710,7 +710,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
break; break;
} }
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case SCH_SHEET_LABEL_T:
default: default:
{ {
wxString msg; wxString msg;
......
...@@ -39,29 +39,28 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -39,29 +39,28 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {
case TYPE_SCH_LABEL: case SCH_LABEL_T:
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
case TYPE_SCH_TEXT: case SCH_TEXT_T:
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case SCH_SHEET_LABEL_T:
case DRAW_SHEET_STRUCT_TYPE: case SCH_SHEET_T:
case DRAW_BUSENTRY_STRUCT_TYPE: case SCH_BUS_ENTRY_T:
case DRAW_JUNCTION_STRUCT_TYPE: case SCH_JUNCTION_T:
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
case DRAW_PART_TEXT_STRUCT_TYPE: case SCH_FIELD_T:
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
TestDanglingEnds( GetScreen()->GetDrawItems(), NULL ); TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
return; return;
case SCREEN_STRUCT_TYPE: case SCH_SCREEN_T:
DisplayError( this, DisplayError( this, wxT( "OnLeftClick err: unexpected type for Place" ) );
wxT( "OnLeftClick err: unexpected type for Place" ) );
DrawStruct->m_Flags = 0; DrawStruct->m_Flags = 0;
break; break;
case DRAW_SEGMENT_STRUCT_TYPE: // May already be drawing segment. case SCH_LINE_T: // May already be drawing segment.
break; break;
default: default:
...@@ -93,7 +92,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -93,7 +92,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( DrawStruct && DrawStruct->m_Flags ) if( DrawStruct && DrawStruct->m_Flags )
break; break;
DrawStruct = SchematicGeneralLocateAndDisplay(); DrawStruct = SchematicGeneralLocateAndDisplay();
if( DrawStruct && ( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE ) ) if( DrawStruct && ( DrawStruct->Type() == SCH_SHEET_T ) )
{ {
InstallNextScreen( (SCH_SHEET*) DrawStruct ); InstallNextScreen( (SCH_SHEET*) DrawStruct );
} }
...@@ -120,9 +119,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -120,9 +119,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_JUNCTION_BUTT: case ID_JUNCTION_BUTT:
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) ) if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
{ {
g_ItemToRepeat = CreateNewJunctionStruct( DC, g_ItemToRepeat = CreateNewJunctionStruct( DC, GetScreen()->m_Curseur, TRUE );
GetScreen()->m_Curseur,
TRUE );
GetScreen()->SetCurItem( g_ItemToRepeat ); GetScreen()->SetCurItem( g_ItemToRepeat );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
...@@ -139,8 +136,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -139,8 +136,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_BUSTOBUS_ENTRY_BUTT: case ID_BUSTOBUS_ENTRY_BUTT:
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) ) if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
{ {
DrawStruct = DrawStruct = CreateBusEntry( DC,
CreateBusEntry( DC,
(m_ID_current_state == ID_WIRETOBUS_ENTRY_BUTT) ? (m_ID_current_state == ID_WIRETOBUS_ENTRY_BUTT) ?
WIRE_TO_BUS : BUS_TO_BUS ); WIRE_TO_BUS : BUS_TO_BUS );
GetScreen()->SetCurItem( DrawStruct ); GetScreen()->SetCurItem( DrawStruct );
...@@ -249,18 +245,15 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -249,18 +245,15 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
if( (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) if( (DrawStruct->Type() == SCH_SHEET_T)
&& (DrawStruct->m_Flags == 0) ) && (DrawStruct->m_Flags == 0) )
{ {
if( m_ID_current_state == ID_IMPORT_HLABEL_BUTT ) if( m_ID_current_state == ID_IMPORT_HLABEL_BUTT )
GetScreen()->SetCurItem( GetScreen()->SetCurItem( Import_PinSheet( (SCH_SHEET*) DrawStruct, DC ) );
Import_PinSheet( (SCH_SHEET*) DrawStruct, DC ) );
else else
GetScreen()->SetCurItem( GetScreen()->SetCurItem( Create_PinSheet( (SCH_SHEET*) DrawStruct, DC ) );
Create_PinSheet( (SCH_SHEET*) DrawStruct, DC ) );
} }
else if( (DrawStruct->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE) else if( (DrawStruct->Type() == SCH_SHEET_LABEL_T) && (DrawStruct->m_Flags != 0) )
&& (DrawStruct->m_Flags != 0) )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
TestDanglingEnds( GetScreen()->GetDrawItems(), NULL ); TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
...@@ -271,8 +264,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -271,8 +264,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_COMPONENT_BUTT: case ID_COMPONENT_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
GetScreen()->SetCurItem( Load_Component( DC, wxEmptyString, GetScreen()->SetCurItem( Load_Component( DC, wxEmptyString, s_CmpNameList, TRUE ) );
s_CmpNameList, TRUE ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else else
...@@ -287,8 +279,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -287,8 +279,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_PLACE_POWER_BUTT: case ID_PLACE_POWER_BUTT:
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) ) if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
{ {
GetScreen()->SetCurItem( GetScreen()->SetCurItem( Load_Component( DC, wxT( "power" ), s_PowerNameList, FALSE ) );
Load_Component( DC, wxT( "power" ), s_PowerNameList, FALSE ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else else
...@@ -340,28 +331,28 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -340,28 +331,28 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {
case DRAW_SHEET_STRUCT_TYPE: case SCH_SHEET_T:
InstallNextScreen( (SCH_SHEET*) DrawStruct ); InstallNextScreen( (SCH_SHEET*) DrawStruct );
break; break;
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
InstallCmpeditFrame( this, pos, (SCH_COMPONENT*) DrawStruct ); InstallCmpeditFrame( this, pos, (SCH_COMPONENT*) DrawStruct );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case TYPE_SCH_TEXT: case SCH_TEXT_T:
case TYPE_SCH_LABEL: case SCH_LABEL_T:
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
EditSchematicText( (SCH_TEXT*) DrawStruct ); EditSchematicText( (SCH_TEXT*) DrawStruct );
break; break;
case DRAW_PART_TEXT_STRUCT_TYPE: case SCH_FIELD_T:
EditCmpFieldText( (SCH_FIELD*) DrawStruct, DC ); EditCmpFieldText( (SCH_FIELD*) DrawStruct, DC );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case TYPE_SCH_MARKER: case SCH_MARKER_T:
( (SCH_MARKER*) DrawStruct )->DisplayMarkerInfo( this ); ( (SCH_MARKER*) DrawStruct )->DisplayMarkerInfo( this );
break; break;
......
...@@ -65,7 +65,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) ...@@ -65,7 +65,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
{ {
DrawStruct = SchematicGeneralLocateAndDisplay( false ); DrawStruct = SchematicGeneralLocateAndDisplay( false );
if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) ) if( DrawStruct && (DrawStruct->Type() == SCH_SHEET_T) )
{ {
SCH_SHEET_PIN* slabel; SCH_SHEET_PIN* slabel;
slabel = LocateSheetLabel( (SCH_SHEET*) DrawStruct, GetScreen()->m_Curseur ); slabel = LocateSheetLabel( (SCH_SHEET*) DrawStruct, GetScreen()->m_Curseur );
...@@ -113,16 +113,16 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) ...@@ -113,16 +113,16 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {
case DRAW_NOCONNECT_STRUCT_TYPE: case SCH_NO_CONNECT_T:
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Noconn" ), delete_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Noconn" ), delete_xpm );
break; break;
case DRAW_JUNCTION_STRUCT_TYPE: case SCH_JUNCTION_T:
AddMenusForJunction( PopMenu, (SCH_JUNCTION*) DrawStruct, this ); AddMenusForJunction( PopMenu, (SCH_JUNCTION*) DrawStruct, this );
break; break;
case DRAW_BUSENTRY_STRUCT_TYPE: case SCH_BUS_ENTRY_T:
if( !flags ) if( !flags )
{ {
wxString msg = AddHotkeyName( _( "Move Bus Entry" ), s_Schematic_Hokeys_Descr, wxString msg = AddHotkeyName( _( "Move Bus Entry" ), s_Schematic_Hokeys_Descr,
...@@ -137,36 +137,36 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) ...@@ -137,36 +137,36 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Bus Entry" ), delete_bus_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Bus Entry" ), delete_bus_xpm );
break; break;
case TYPE_SCH_MARKER: case SCH_MARKER_T:
AddMenusForMarkers( PopMenu, (SCH_MARKER*) DrawStruct, this ); AddMenusForMarkers( PopMenu, (SCH_MARKER*) DrawStruct, this );
break; break;
case TYPE_SCH_TEXT: case SCH_TEXT_T:
AddMenusForText( PopMenu, (SCH_TEXT*) DrawStruct ); AddMenusForText( PopMenu, (SCH_TEXT*) DrawStruct );
break; break;
case TYPE_SCH_LABEL: case SCH_LABEL_T:
AddMenusForLabel( PopMenu, (SCH_LABEL*) DrawStruct ); AddMenusForLabel( PopMenu, (SCH_LABEL*) DrawStruct );
break; break;
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
AddMenusForGLabel( PopMenu, (SCH_GLOBALLABEL*) DrawStruct ); AddMenusForGLabel( PopMenu, (SCH_GLOBALLABEL*) DrawStruct );
break; break;
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
AddMenusForHLabel( PopMenu, (SCH_HIERLABEL*) DrawStruct ); AddMenusForHLabel( PopMenu, (SCH_HIERLABEL*) DrawStruct );
break; break;
case DRAW_PART_TEXT_STRUCT_TYPE: case SCH_FIELD_T:
{ {
AddMenusForComponentField( PopMenu, (SCH_FIELD*) DrawStruct ); AddMenusForComponentField( PopMenu, (SCH_FIELD*) DrawStruct );
if( flags ) if( flags )
break; break;
// Many fields are inside a component. If this is the case, add the // Many fields are inside a component. If this is the case, add the
// component menu // component menu
SCH_COMPONENT* Component = SCH_COMPONENT* Component = LocateSmallestComponent( GetScreen() );
LocateSmallestComponent( (SCH_SCREEN*) GetScreen() );
if( Component ) if( Component )
{ {
...@@ -176,11 +176,11 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) ...@@ -176,11 +176,11 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
} }
break; break;
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
AddMenusForComponent( PopMenu, (SCH_COMPONENT*) DrawStruct ); AddMenusForComponent( PopMenu, (SCH_COMPONENT*) DrawStruct );
break; break;
case DRAW_SEGMENT_STRUCT_TYPE: case SCH_LINE_T:
// if( !flags ) PopMenu->Append(ID_POPUP_SCH_MOVE_ITEM_REQUEST, "Move"); // if( !flags ) PopMenu->Append(ID_POPUP_SCH_MOVE_ITEM_REQUEST, "Move");
switch( DrawStruct->GetLayer() ) switch( DrawStruct->GetLayer() )
...@@ -202,11 +202,11 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) ...@@ -202,11 +202,11 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
break; break;
case DRAW_SHEET_STRUCT_TYPE: case SCH_SHEET_T:
AddMenusForHierchicalSheet( PopMenu, (SCH_SHEET*) DrawStruct ); AddMenusForHierchicalSheet( PopMenu, (SCH_SHEET*) DrawStruct );
break; break;
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case SCH_SHEET_LABEL_T:
AddMenusForPinSheet( PopMenu, (SCH_SHEET_PIN*) DrawStruct ); AddMenusForPinSheet( PopMenu, (SCH_SHEET_PIN*) DrawStruct );
break; break;
...@@ -243,7 +243,7 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field ) ...@@ -243,7 +243,7 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field )
void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component ) void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
{ {
if( Component->Type() != TYPE_SCH_COMPONENT ) if( Component->Type() != SCH_COMPONENT_T )
{ {
wxASSERT( 0 ); wxASSERT( 0 );
return; return;
......
...@@ -92,11 +92,11 @@ void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList ) ...@@ -92,11 +92,11 @@ void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList )
itemWrapper.m_PickedItem = item; itemWrapper.m_PickedItem = item;
itemWrapper.m_UndoRedoStatus = UR_DELETED; itemWrapper.m_UndoRedoStatus = UR_DELETED;
if( item->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ) if( item->Type() == SCH_SHEET_LABEL_T )
{ {
/* this item is depending on a sheet, and is not in global list */ /* this item is depending on a sheet, and is not in global list */
wxMessageBox( wxT("DeleteItemsInList() err: unexpected \ wxMessageBox( wxT("DeleteItemsInList() err: unexpected \
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE" ) ); SCH_SHEET_LABEL_T" ) );
} }
else else
{ {
...@@ -124,7 +124,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct ) ...@@ -124,7 +124,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
if( !DrawStruct ) if( !DrawStruct )
return; return;
if( DrawStruct->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ) if( DrawStruct->Type() == SCH_SHEET_LABEL_T )
{ {
/* This structure is attached to a node, and is not accessible by /* This structure is attached to a node, and is not accessible by
* the global list directly. */ * the global list directly. */
...@@ -168,21 +168,21 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList, ...@@ -168,21 +168,21 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
{ {
switch( newitem->Type() ) switch( newitem->Type() )
{ {
case DRAW_POLYLINE_STRUCT_TYPE: case SCH_POLYLINE_T:
case DRAW_JUNCTION_STRUCT_TYPE: case SCH_JUNCTION_T:
case DRAW_SEGMENT_STRUCT_TYPE: case SCH_LINE_T:
case DRAW_BUSENTRY_STRUCT_TYPE: case SCH_BUS_ENTRY_T:
case TYPE_SCH_TEXT: case SCH_TEXT_T:
case TYPE_SCH_LABEL: case SCH_LABEL_T:
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case SCH_SHEET_LABEL_T:
case TYPE_SCH_MARKER: case SCH_MARKER_T:
case DRAW_NOCONNECT_STRUCT_TYPE: case SCH_NO_CONNECT_T:
default: default:
break; break;
case DRAW_SHEET_STRUCT_TYPE: case SCH_SHEET_T:
{ {
SCH_SHEET* sheet = (SCH_SHEET*) newitem; SCH_SHEET* sheet = (SCH_SHEET*) newitem;
sheet->m_TimeStamp = GetTimeStamp(); sheet->m_TimeStamp = GetTimeStamp();
...@@ -190,7 +190,7 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList, ...@@ -190,7 +190,7 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
break; break;
} }
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
( (SCH_COMPONENT*) newitem )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) newitem )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) newitem )->ClearAnnotation( NULL ); ( (SCH_COMPONENT*) newitem )->ClearAnnotation( NULL );
break; break;
...@@ -228,51 +228,51 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* aDrawStruct, bool aClone ) ...@@ -228,51 +228,51 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* aDrawStruct, bool aClone )
switch( aDrawStruct->Type() ) switch( aDrawStruct->Type() )
{ {
case DRAW_POLYLINE_STRUCT_TYPE: case SCH_POLYLINE_T:
NewDrawStruct = ( (SCH_POLYLINE*) aDrawStruct )->GenCopy(); NewDrawStruct = ( (SCH_POLYLINE*) aDrawStruct )->GenCopy();
break; break;
case DRAW_SEGMENT_STRUCT_TYPE: case SCH_LINE_T:
NewDrawStruct = ( (SCH_LINE*) aDrawStruct )->GenCopy(); NewDrawStruct = ( (SCH_LINE*) aDrawStruct )->GenCopy();
break; break;
case DRAW_BUSENTRY_STRUCT_TYPE: case SCH_BUS_ENTRY_T:
NewDrawStruct = ( (SCH_BUS_ENTRY*) aDrawStruct )->GenCopy(); NewDrawStruct = ( (SCH_BUS_ENTRY*) aDrawStruct )->GenCopy();
break; break;
case DRAW_JUNCTION_STRUCT_TYPE: case SCH_JUNCTION_T:
NewDrawStruct = ( (SCH_JUNCTION*) aDrawStruct )->GenCopy(); NewDrawStruct = ( (SCH_JUNCTION*) aDrawStruct )->GenCopy();
break; break;
case TYPE_SCH_MARKER: case SCH_MARKER_T:
NewDrawStruct = ( (SCH_MARKER*) aDrawStruct )->GenCopy(); NewDrawStruct = ( (SCH_MARKER*) aDrawStruct )->GenCopy();
break; break;
case DRAW_NOCONNECT_STRUCT_TYPE: case SCH_NO_CONNECT_T:
NewDrawStruct = ( (SCH_NO_CONNECT*) aDrawStruct )->GenCopy(); NewDrawStruct = ( (SCH_NO_CONNECT*) aDrawStruct )->GenCopy();
break; break;
case TYPE_SCH_TEXT: case SCH_TEXT_T:
NewDrawStruct = ( (SCH_TEXT*) aDrawStruct )->GenCopy(); NewDrawStruct = ( (SCH_TEXT*) aDrawStruct )->GenCopy();
break; break;
case TYPE_SCH_LABEL: case SCH_LABEL_T:
NewDrawStruct = ( (SCH_LABEL*) aDrawStruct )->GenCopy(); NewDrawStruct = ( (SCH_LABEL*) aDrawStruct )->GenCopy();
break; break;
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
NewDrawStruct = ( (SCH_HIERLABEL*) aDrawStruct )->GenCopy(); NewDrawStruct = ( (SCH_HIERLABEL*) aDrawStruct )->GenCopy();
break; break;
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
NewDrawStruct = ( (SCH_GLOBALLABEL*) aDrawStruct )->GenCopy(); NewDrawStruct = ( (SCH_GLOBALLABEL*) aDrawStruct )->GenCopy();
break; break;
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
NewDrawStruct = ( (SCH_COMPONENT*) aDrawStruct )->GenCopy(); NewDrawStruct = ( (SCH_COMPONENT*) aDrawStruct )->GenCopy();
break; break;
case DRAW_SHEET_STRUCT_TYPE: case SCH_SHEET_T:
NewDrawStruct = ( (SCH_SHEET*) aDrawStruct )->GenCopy(); NewDrawStruct = ( (SCH_SHEET*) aDrawStruct )->GenCopy();
if( aClone ) if( aClone )
{ {
......
...@@ -43,7 +43,7 @@ void LIB_EDIT_FRAME::OnRotatePin( wxCommandEvent& event ) ...@@ -43,7 +43,7 @@ void LIB_EDIT_FRAME::OnRotatePin( wxCommandEvent& event )
{ {
// Check, if the item is a pin, else return // Check, if the item is a pin, else return
if( m_drawItem == NULL || m_drawItem->Type() != COMPONENT_PIN_DRAW_TYPE ) if( m_drawItem == NULL || m_drawItem->Type() != LIB_PIN_T )
return; return;
// save flags to restore them after rotating // save flags to restore them after rotating
...@@ -77,7 +77,7 @@ void LIB_EDIT_FRAME::OnRotatePin( wxCommandEvent& event ) ...@@ -77,7 +77,7 @@ void LIB_EDIT_FRAME::OnRotatePin( wxCommandEvent& event )
void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
{ {
if( m_drawItem == NULL || m_drawItem->Type() != COMPONENT_PIN_DRAW_TYPE ) if( m_drawItem == NULL || m_drawItem->Type() != LIB_PIN_T )
return; return;
int item_flags = m_drawItem->m_Flags; // save flags to restore them after editing int item_flags = m_drawItem->m_Flags; // save flags to restore them after editing
...@@ -186,7 +186,7 @@ static void AbortPinMove( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -186,7 +186,7 @@ static void AbortPinMove( WinEDA_DrawPanel* Panel, wxDC* DC )
LIB_PIN* CurrentPin = (LIB_PIN*) parent->GetDrawItem(); LIB_PIN* CurrentPin = (LIB_PIN*) parent->GetDrawItem();
if( CurrentPin == NULL || CurrentPin->Type() != COMPONENT_PIN_DRAW_TYPE ) if( CurrentPin == NULL || CurrentPin->Type() != LIB_PIN_T )
return; return;
if( CurrentPin->m_Flags & IS_NEW ) if( CurrentPin->m_Flags & IS_NEW )
...@@ -215,7 +215,7 @@ void LIB_EDIT_FRAME::PlacePin( wxDC* DC ) ...@@ -215,7 +215,7 @@ void LIB_EDIT_FRAME::PlacePin( wxDC* DC )
bool status; bool status;
// Some tests // Some tests
if( (CurrentPin == NULL) || (CurrentPin->Type() != COMPONENT_PIN_DRAW_TYPE) ) if( (CurrentPin == NULL) || (CurrentPin->Type() != LIB_PIN_T) )
{ {
wxMessageBox( wxT("LIB_EDIT_FRAME::PlacePin() error") ); wxMessageBox( wxT("LIB_EDIT_FRAME::PlacePin() error") );
return; return;
...@@ -346,7 +346,7 @@ static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -346,7 +346,7 @@ static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
LIB_PIN* CurrentPin = (LIB_PIN*) parent->GetDrawItem(); LIB_PIN* CurrentPin = (LIB_PIN*) parent->GetDrawItem();
if( CurrentPin == NULL || CurrentPin->Type() != COMPONENT_PIN_DRAW_TYPE ) if( CurrentPin == NULL || CurrentPin->Type() != LIB_PIN_T )
return; return;
wxPoint pinpos = CurrentPin->GetPosition(); wxPoint pinpos = CurrentPin->GetPosition();
...@@ -543,7 +543,7 @@ void LIB_EDIT_FRAME::GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id ) ...@@ -543,7 +543,7 @@ void LIB_EDIT_FRAME::GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id )
if( ( m_component == NULL ) || ( MasterPin == NULL ) ) if( ( m_component == NULL ) || ( MasterPin == NULL ) )
return; return;
if( MasterPin->Type() != COMPONENT_PIN_DRAW_TYPE ) if( MasterPin->Type() != LIB_PIN_T )
return; return;
OnModify( ); OnModify( );
...@@ -588,7 +588,7 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin ) ...@@ -588,7 +588,7 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
LIB_PIN* Pin; LIB_PIN* Pin;
wxString msg; wxString msg;
if( m_component == NULL || SourcePin == NULL || SourcePin->Type() != COMPONENT_PIN_DRAW_TYPE ) if( m_component == NULL || SourcePin == NULL || SourcePin->Type() != LIB_PIN_T )
return; return;
Pin = (LIB_PIN*) SourcePin->GenCopy(); Pin = (LIB_PIN*) SourcePin->GenCopy();
......
...@@ -108,7 +108,7 @@ static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem, ...@@ -108,7 +108,7 @@ static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
* so the more easily way is to use no justifications ( Centered text ) * so the more easily way is to use no justifications ( Centered text )
* and use GetBoundaryBox to know the text coordinate considered as centered * and use GetBoundaryBox to know the text coordinate considered as centered
*/ */
EDA_Rect BoundaryBox = field->GetBoundaryBox(); EDA_Rect BoundaryBox = field->GetBoundingBox();
GRTextHorizJustifyType hjustify = GR_TEXT_HJUSTIFY_CENTER; GRTextHorizJustifyType hjustify = GR_TEXT_HJUSTIFY_CENTER;
GRTextVertJustifyType vjustify = GR_TEXT_VJUSTIFY_CENTER; GRTextVertJustifyType vjustify = GR_TEXT_VJUSTIFY_CENTER;
wxPoint textpos = BoundaryBox.Centre(); wxPoint textpos = BoundaryBox.Centre();
...@@ -246,11 +246,11 @@ static void PlotTextStruct( PLOTTER* plotter, SCH_TEXT* aSchText ) ...@@ -246,11 +246,11 @@ static void PlotTextStruct( PLOTTER* plotter, SCH_TEXT* aSchText )
switch( aSchText->Type() ) switch( aSchText->Type() )
{ {
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case SCH_SHEET_LABEL_T:
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
case TYPE_SCH_LABEL: case SCH_LABEL_T:
case TYPE_SCH_TEXT: case SCH_TEXT_T:
break; break;
default: default:
...@@ -258,7 +258,7 @@ static void PlotTextStruct( PLOTTER* plotter, SCH_TEXT* aSchText ) ...@@ -258,7 +258,7 @@ static void PlotTextStruct( PLOTTER* plotter, SCH_TEXT* aSchText )
} }
EDA_Colors color = UNSPECIFIED_COLOR; EDA_Colors color = UNSPECIFIED_COLOR;
color = ReturnLayerColor( aSchText->m_Layer ); color = ReturnLayerColor( aSchText->GetLayer() );
wxPoint textpos = aSchText->m_Pos + aSchText->GetSchematicTextOffset(); wxPoint textpos = aSchText->m_Pos + aSchText->GetSchematicTextOffset();
int thickness = aSchText->GetPenSize(); int thickness = aSchText->GetPenSize();
...@@ -387,9 +387,9 @@ void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* aDrawlist ) ...@@ -387,9 +387,9 @@ void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* aDrawlist )
plotter->set_current_line_width( aDrawlist->GetPenSize() ); plotter->set_current_line_width( aDrawlist->GetPenSize() );
switch( aDrawlist->Type() ) switch( aDrawlist->Type() )
{ {
case DRAW_BUSENTRY_STRUCT_TYPE: case SCH_BUS_ENTRY_T:
case DRAW_SEGMENT_STRUCT_TYPE: case SCH_LINE_T:
if( aDrawlist->Type() == DRAW_BUSENTRY_STRUCT_TYPE ) if( aDrawlist->Type() == SCH_BUS_ENTRY_T )
{ {
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_BUS_ENTRY*) aDrawlist ) #define STRUCT ( (SCH_BUS_ENTRY*) aDrawlist )
...@@ -417,39 +417,39 @@ void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* aDrawlist ) ...@@ -417,39 +417,39 @@ void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* aDrawlist )
break; break;
case DRAW_JUNCTION_STRUCT_TYPE: case SCH_JUNCTION_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_JUNCTION*) aDrawlist ) #define STRUCT ( (SCH_JUNCTION*) aDrawlist )
plotter->set_color( ReturnLayerColor( STRUCT->GetLayer() ) ); plotter->set_color( ReturnLayerColor( STRUCT->GetLayer() ) );
plotter->circle( STRUCT->m_Pos, STRUCT->m_Size.x, FILLED_SHAPE ); plotter->circle( STRUCT->m_Pos, STRUCT->m_Size.x, FILLED_SHAPE );
break; break;
case TYPE_SCH_TEXT: case SCH_TEXT_T:
case TYPE_SCH_LABEL: case SCH_LABEL_T:
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
PlotTextStruct( plotter, (SCH_TEXT*) aDrawlist ); PlotTextStruct( plotter, (SCH_TEXT*) aDrawlist );
break; break;
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
DrawLibItem = (SCH_COMPONENT*) aDrawlist; DrawLibItem = (SCH_COMPONENT*) aDrawlist;
PlotLibPart( plotter, DrawLibItem ); PlotLibPart( plotter, DrawLibItem );
break; break;
case DRAW_POLYLINE_STRUCT_TYPE: case SCH_POLYLINE_T:
break; break;
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case SCH_SHEET_LABEL_T:
break; break;
case TYPE_SCH_MARKER: case SCH_MARKER_T:
break; break;
case DRAW_SHEET_STRUCT_TYPE: case SCH_SHEET_T:
PlotSheetStruct( plotter, (SCH_SHEET*) aDrawlist ); PlotSheetStruct( plotter, (SCH_SHEET*) aDrawlist );
break; break;
case DRAW_NOCONNECT_STRUCT_TYPE: case SCH_NO_CONNECT_T:
plotter->set_color( ReturnLayerColor( LAYER_NOCONNECT ) ); plotter->set_color( ReturnLayerColor( LAYER_NOCONNECT ) );
PlotNoConnectStruct( plotter, (SCH_NO_CONNECT*) aDrawlist ); PlotNoConnectStruct( plotter, (SCH_NO_CONNECT*) aDrawlist );
break; break;
......
...@@ -64,7 +64,7 @@ void CreateDummyCmp() ...@@ -64,7 +64,7 @@ void CreateDummyCmp()
SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) : SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
SCH_ITEM( aParent, TYPE_SCH_COMPONENT ) SCH_ITEM( aParent, SCH_COMPONENT_T )
{ {
Init( aPos ); Init( aPos );
} }
...@@ -73,7 +73,7 @@ SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) : ...@@ -73,7 +73,7 @@ SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent,
SCH_SHEET_PATH* sheet, int unit, int convert, SCH_SHEET_PATH* sheet, int unit, int convert,
const wxPoint& pos, bool setNewItemFlag ) : const wxPoint& pos, bool setNewItemFlag ) :
SCH_ITEM( NULL, TYPE_SCH_COMPONENT ) SCH_ITEM( NULL, SCH_COMPONENT_T )
{ {
Init( pos ); Init( pos );
...@@ -132,7 +132,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, ...@@ -132,7 +132,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent,
SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aTemplate ) : SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aTemplate ) :
SCH_ITEM( NULL, TYPE_SCH_COMPONENT ) SCH_ITEM( NULL, SCH_COMPONENT_T )
{ {
/* assignment of all fields, including field vector elements, and linked /* assignment of all fields, including field vector elements, and linked
* list pointers */ * list pointers */
...@@ -237,18 +237,18 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -237,18 +237,18 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
/* Draw the component boundary box */ /* Draw the component boundary box */
{ {
EDA_Rect BoundaryBox; EDA_Rect BoundaryBox;
BoundaryBox = GetBoundaryBox(); BoundaryBox = GetBoundingBox();
GRRect( &panel->m_ClipBox, DC, BoundaryBox, BROWN ); GRRect( &panel->m_ClipBox, DC, BoundaryBox, BROWN );
#if 1 #if 1
if( GetField( REFERENCE )->IsVisible() ) if( GetField( REFERENCE )->IsVisible() )
{ {
BoundaryBox = GetField( REFERENCE )->GetBoundaryBox(); BoundaryBox = GetField( REFERENCE )->GetBoundingBox();
GRRect( &panel->m_ClipBox, DC, BoundaryBox, BROWN ); GRRect( &panel->m_ClipBox, DC, BoundaryBox, BROWN );
} }
if( GetField( VALUE )->IsVisible() ) if( GetField( VALUE )->IsVisible() )
{ {
BoundaryBox = GetField( VALUE )->GetBoundaryBox(); BoundaryBox = GetField( VALUE )->GetBoundingBox();
GRRect( &panel->m_ClipBox, DC, BoundaryBox, BROWN ); GRRect( &panel->m_ClipBox, DC, BoundaryBox, BROWN );
} }
#endif #endif
...@@ -549,60 +549,6 @@ LIB_PIN* SCH_COMPONENT::GetPin( const wxString& number ) ...@@ -549,60 +549,6 @@ LIB_PIN* SCH_COMPONENT::GetPin( const wxString& number )
} }
/**
* Function GetBoundaryBox
* returns the orthogonal, bounding box of this object for display purposes.
* This box should be an enclosing perimeter for graphic items and pins.
* this include only fields defined in library
* use GetBoundingBox() to include fields in schematic
*/
EDA_Rect SCH_COMPONENT::GetBoundaryBox() const
{
LIB_COMPONENT* Entry = CMP_LIBRARY::FindLibraryComponent( m_ChipName );
EDA_Rect BoundaryBox;
int x0, xm, y0, ym;
/* Get the basic Boundary box */
if( Entry )
{
BoundaryBox = Entry->GetBoundaryBox( m_Multi, m_Convert );
x0 = BoundaryBox.GetX();
xm = BoundaryBox.GetRight();
// We must reverse Y values, because matrix orientation
// suppose Y axis normal for the library items coordinates,
// m_Transform reverse Y values, but BoundaryBox is already reversed!
y0 = -BoundaryBox.GetY();
ym = -BoundaryBox.GetBottom();
}
else /* if lib Entry not found, give a reasonable size */
{
x0 = y0 = -50;
xm = ym = 50;
}
/* Compute the real Boundary box (rotated, mirrored ...)*/
int x1 = m_Transform.x1 * x0 + m_Transform.y1 * y0;
int y1 = m_Transform.x2 * x0 + m_Transform.y2 * y0;
int x2 = m_Transform.x1 * xm + m_Transform.y1 * ym;
int y2 = m_Transform.x2 * xm + m_Transform.y2 * ym;
// H and W must be > 0:
if( x2 < x1 )
EXCHG( x2, x1 );
if( y2 < y1 )
EXCHG( y2, y1 );
BoundaryBox.SetX( x1 );
BoundaryBox.SetY( y1 );
BoundaryBox.SetWidth( x2 - x1 );
BoundaryBox.SetHeight( y2 - y1 );
BoundaryBox.Offset( m_Pos );
return BoundaryBox;
}
/* Used in undo / redo command: /* Used in undo / redo command:
* swap data between this and copyitem * swap data between this and copyitem
*/ */
...@@ -1416,31 +1362,61 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -1416,31 +1362,61 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
/** /**
* Function GetBoundingBox * Function GetBoundaryBox
* returns the orthogonal, bounding box of this object for display purposes. * returns the orthogonal, bounding box of this object for display purposes.
* This box should be an enclosing perimeter for visible components of this * This box should be an enclosing perimeter for graphic items and pins.
* object, and the units should be in the pcb or schematic coordinate system. * this include only fields defined in library
* It is OK to overestimate the size by a few counts. * use GetBoundingBox() to include fields in schematic
*/ */
EDA_Rect SCH_COMPONENT::GetBoundingBox() EDA_Rect SCH_COMPONENT::GetBoundingBox() const
{ {
const int PADDING = 40; LIB_COMPONENT* Entry = CMP_LIBRARY::FindLibraryComponent( m_ChipName );
EDA_Rect bBox;
int x0, xm, y0, ym;
if( Entry == NULL )
return EDA_Rect( wxPoint( 0, 0 ), wxSize( 0, 0 ) );
/* Get the basic Boundary box */
bBox = Entry->GetBoundingBox( m_Multi, m_Convert );
x0 = bBox.GetX();
xm = bBox.GetRight();
// We must reverse Y values, because matrix orientation
// suppose Y axis normal for the library items coordinates,
// m_Transform reverse Y values, but bBox is already reversed!
y0 = -bBox.GetY();
ym = -bBox.GetBottom();
// This gives a reasonable approximation (but some things are missing so...) /* Compute the real Boundary box (rotated, mirrored ...)*/
EDA_Rect bbox = GetBoundaryBox(); int x1 = m_Transform.x1 * x0 + m_Transform.y1 * y0;
int y1 = m_Transform.x2 * x0 + m_Transform.y2 * y0;
int x2 = m_Transform.x1 * xm + m_Transform.y1 * ym;
int y2 = m_Transform.x2 * xm + m_Transform.y2 * ym;
// H and W must be > 0:
if( x2 < x1 )
EXCHG( x2, x1 );
if( y2 < y1 )
EXCHG( y2, y1 );
bBox.SetX( x1 );
bBox.SetY( y1 );
bBox.SetWidth( x2 - x1 );
bBox.SetHeight( y2 - y1 );
bBox.Offset( m_Pos );
// Include BoundingBoxes of fields // Include BoundingBoxes of fields
for( int ii = 0; ii < GetFieldCount(); ii++ ) for( int ii = 0; ii < GetFieldCount(); ii++ )
{ {
if( !GetField( ii )->IsVisible() ) if( !GetField( ii )->IsVisible() )
continue; continue;
bbox.Merge( GetField( ii )->GetBoundaryBox() );
}
// ... add padding bBox.Merge( GetField( ii )->GetBoundingBox() );
bbox.Inflate( PADDING ); }
return bbox; return bBox;
} }
...@@ -1546,7 +1522,8 @@ void SCH_COMPONENT::Rotate( wxPoint rotationPoint ) ...@@ -1546,7 +1522,8 @@ void SCH_COMPONENT::Rotate( wxPoint rotationPoint )
} }
bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint * aFindLocation ) bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData, void* aAuxData,
wxPoint* aFindLocation )
{ {
// Search reference. // Search reference.
// reference is a special field because a part identifier is added // reference is a special field because a part identifier is added
...@@ -1622,7 +1599,7 @@ void SCH_COMPONENT::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ) ...@@ -1622,7 +1599,7 @@ void SCH_COMPONENT::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
for( LIB_PIN* Pin = Entry->GetNextPin(); Pin != NULL; Pin = Entry->GetNextPin( Pin ) ) for( LIB_PIN* Pin = Entry->GetNextPin(); Pin != NULL; Pin = Entry->GetNextPin( Pin ) )
{ {
wxASSERT( Pin->Type() == COMPONENT_PIN_DRAW_TYPE ); wxASSERT( Pin->Type() == LIB_PIN_T );
if( Pin->GetUnit() && m_Multi && ( m_Multi != Pin->GetUnit() ) ) if( Pin->GetUnit() && m_Multi && ( m_Multi != Pin->GetUnit() ) )
continue; continue;
...@@ -1639,7 +1616,7 @@ void SCH_COMPONENT::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ) ...@@ -1639,7 +1616,7 @@ void SCH_COMPONENT::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
wxPoint SCH_COMPONENT::GetPinPhysicalPosition( LIB_PIN* Pin ) wxPoint SCH_COMPONENT::GetPinPhysicalPosition( LIB_PIN* Pin )
{ {
wxCHECK_MSG( Pin != NULL && Pin->Type() == COMPONENT_PIN_DRAW_TYPE, wxPoint( 0, 0 ), wxCHECK_MSG( Pin != NULL && Pin->Type() == LIB_PIN_T, wxPoint( 0, 0 ),
wxT( "Cannot get physical position of pin." ) ); wxT( "Cannot get physical position of pin." ) );
return m_Transform.TransformCoordinate( Pin->GetPosition() ) + m_Pos; return m_Transform.TransformCoordinate( Pin->GetPosition() ) + m_Pos;
...@@ -1672,7 +1649,7 @@ void SCH_COMPONENT::GetConnectionPoints( vector< wxPoint >& aPoints ) const ...@@ -1672,7 +1649,7 @@ void SCH_COMPONENT::GetConnectionPoints( vector< wxPoint >& aPoints ) const
for( pin = component->GetNextPin(); pin != NULL; pin = component->GetNextPin( pin ) ) for( pin = component->GetNextPin(); pin != NULL; pin = component->GetNextPin( pin ) )
{ {
wxCHECK_RET( pin->Type() == COMPONENT_PIN_DRAW_TYPE, wxCHECK_RET( pin->Type() == LIB_PIN_T,
wxT( "GetNextPin() did not return a pin object. Bad programmer!" ) ); wxT( "GetNextPin() did not return a pin object. Bad programmer!" ) );
// Skip items not used for this part. // Skip items not used for this part.
...@@ -1685,3 +1662,26 @@ void SCH_COMPONENT::GetConnectionPoints( vector< wxPoint >& aPoints ) const ...@@ -1685,3 +1662,26 @@ void SCH_COMPONENT::GetConnectionPoints( vector< wxPoint >& aPoints ) const
aPoints.push_back( m_Transform.TransformCoordinate( pin->GetPosition() ) + m_Pos ); aPoints.push_back( m_Transform.TransformCoordinate( pin->GetPosition() ) + m_Pos );
} }
} }
bool SCH_COMPONENT::DoHitTest( const wxPoint& aPoint, int aAccuracy ) const
{
EDA_Rect rect = GetBoundingBox();
rect.Inflate( aAccuracy );
return rect.Inside( aPoint );
}
bool SCH_COMPONENT::DoHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const
{
EDA_Rect rect = aRect;
rect.Inflate( aAccuracy );
if( aContained )
return rect.Inside( GetBoundingBox() );
return rect.Intersects( GetBoundingBox() );
}
...@@ -159,12 +159,11 @@ public: ...@@ -159,12 +159,11 @@ public:
* set to NULL. * set to NULL.
* @return SCH_COMPONENT* - a copy of me. * @return SCH_COMPONENT* - a copy of me.
*/ */
SCH_COMPONENT* GenCopy() SCH_COMPONENT* GenCopy() const
{ {
return new SCH_COMPONENT( *this ); return new SCH_COMPONENT( *this );
} }
void SetOrientation( int aOrientation ); void SetOrientation( int aOrientation );
/** /**
...@@ -217,7 +216,7 @@ public: ...@@ -217,7 +216,7 @@ public:
* object, and the units should be in the pcb or schematic coordinate system. * object, and the units should be in the pcb or schematic coordinate system.
* It is OK to overestimate the size by a few counts. * It is OK to overestimate the size by a few counts.
*/ */
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox() const;
//-----<Fields>----------------------------------------------------------- //-----<Fields>-----------------------------------------------------------
...@@ -283,7 +282,6 @@ public: ...@@ -283,7 +282,6 @@ public:
Draw( panel, DC, offset, draw_mode, Color, true ); Draw( panel, DC, offset, draw_mode, Color, true );
} }
void Draw( WinEDA_DrawPanel* panel, void Draw( WinEDA_DrawPanel* panel,
wxDC* DC, wxDC* DC,
const wxPoint& offset, const wxPoint& offset,
...@@ -326,14 +324,6 @@ public: ...@@ -326,14 +324,6 @@ public:
// Set the unit selection, for the given sheet path. // Set the unit selection, for the given sheet path.
void SetUnitSelection( SCH_SHEET_PATH* aSheet, int aUnitSelection ); void SetUnitSelection( SCH_SHEET_PATH* aSheet, int aUnitSelection );
/**
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
* for a component, has no meaning, but it is necessary to satisfy the
* SCH_ITEM class requirements.
*/
virtual int GetPenSize() { return 0; }
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** virtual function Move /** virtual function Move
...@@ -377,7 +367,7 @@ public: ...@@ -377,7 +367,7 @@ public:
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const; virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
#if defined(DEBUG) #if defined(DEBUG)
/** /**
* Function Show * Function Show
...@@ -389,6 +379,10 @@ public: ...@@ -389,6 +379,10 @@ public:
void Show( int nestLevel, std::ostream& os ); void Show( int nestLevel, std::ostream& os );
#endif #endif
private:
virtual bool DoHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual bool DoHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const;
}; };
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId,
SCH_COMPONENT* aParent, wxString aName ) : SCH_COMPONENT* aParent, wxString aName ) :
SCH_ITEM( aParent, DRAW_PART_TEXT_STRUCT_TYPE ), SCH_ITEM( aParent, SCH_FIELD_T ),
EDA_TextStruct() EDA_TextStruct()
{ {
m_Pos = aPos; m_Pos = aPos;
...@@ -53,7 +53,7 @@ SCH_FIELD::~SCH_FIELD() ...@@ -53,7 +53,7 @@ SCH_FIELD::~SCH_FIELD()
* Function GetPenSize * Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int SCH_FIELD::GetPenSize() int SCH_FIELD::GetPenSize() const
{ {
int pensize = m_Thickness; int pensize = m_Thickness;
...@@ -122,7 +122,7 @@ void SCH_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -122,7 +122,7 @@ void SCH_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
* so the more easily way is to use no justifications ( Centered text ) * so the more easily way is to use no justifications ( Centered text )
* and use GetBoundaryBox to know the text coordinate considered as centered * and use GetBoundaryBox to know the text coordinate considered as centered
*/ */
EDA_Rect BoundaryBox = GetBoundaryBox(); EDA_Rect BoundaryBox = GetBoundingBox();
GRTextHorizJustifyType hjustify = GR_TEXT_HJUSTIFY_CENTER; GRTextHorizJustifyType hjustify = GR_TEXT_HJUSTIFY_CENTER;
GRTextVertJustifyType vjustify = GR_TEXT_VJUSTIFY_CENTER; GRTextVertJustifyType vjustify = GR_TEXT_VJUSTIFY_CENTER;
textpos = BoundaryBox.Centre(); textpos = BoundaryBox.Centre();
...@@ -226,11 +226,10 @@ void SCH_FIELD::SwapData( SCH_FIELD* copyitem ) ...@@ -226,11 +226,10 @@ void SCH_FIELD::SwapData( SCH_FIELD* copyitem )
/** /**
* Function GetBoundaryBox * Function GetBoundaryBox
* @return an EDA_Rect contains the real (user coordinates) boundary box for * @return an EDA_Rect contains the real (user coordinates) boundary box for a text field.
* a text field,
* according to the component position, rotation, mirror ... * according to the component position, rotation, mirror ...
*/ */
EDA_Rect SCH_FIELD::GetBoundaryBox() const EDA_Rect SCH_FIELD::GetBoundingBox() const
{ {
EDA_Rect BoundaryBox; EDA_Rect BoundaryBox;
int hjustify, vjustify; int hjustify, vjustify;
...@@ -251,8 +250,7 @@ EDA_Rect SCH_FIELD::GetBoundaryBox() const ...@@ -251,8 +250,7 @@ EDA_Rect SCH_FIELD::GetBoundaryBox() const
pos2 = pos + parentComponent->m_Transform.TransformCoordinate( pos1 ); pos2 = pos + parentComponent->m_Transform.TransformCoordinate( pos1 );
/* Calculate the text orientation, according to the component // Calculate the text orientation, according to the component orientation/mirror.
* orientation/mirror */
if( parentComponent->m_Transform.y1 ) if( parentComponent->m_Transform.y1 )
{ {
if( orient == TEXT_ORIENT_HORIZ ) if( orient == TEXT_ORIENT_HORIZ )
...@@ -261,14 +259,15 @@ EDA_Rect SCH_FIELD::GetBoundaryBox() const ...@@ -261,14 +259,15 @@ EDA_Rect SCH_FIELD::GetBoundaryBox() const
orient = TEXT_ORIENT_HORIZ; orient = TEXT_ORIENT_HORIZ;
} }
/* Calculate the text justification, according to the component // Calculate the text justification, according to the component orientation/mirror.
* orientation/mirror */
if( parentComponent->m_Transform.y1 ) if( parentComponent->m_Transform.y1 )
{ {
/* is it mirrored (for text justify)*/ /* is it mirrored (for text justify)*/
EXCHG( hjustify, vjustify ); EXCHG( hjustify, vjustify );
if( parentComponent->m_Transform.x2 < 0 ) if( parentComponent->m_Transform.x2 < 0 )
NEGATE( vjustify ); NEGATE( vjustify );
if( parentComponent->m_Transform.y1 > 0 ) if( parentComponent->m_Transform.y1 > 0 )
NEGATE( hjustify ); NEGATE( hjustify );
} }
...@@ -276,6 +275,7 @@ EDA_Rect SCH_FIELD::GetBoundaryBox() const ...@@ -276,6 +275,7 @@ EDA_Rect SCH_FIELD::GetBoundaryBox() const
{ {
if( parentComponent->m_Transform.x1 < 0 ) if( parentComponent->m_Transform.x1 < 0 )
NEGATE( hjustify ); NEGATE( hjustify );
if( parentComponent->m_Transform.y2 > 0 ) if( parentComponent->m_Transform.y2 > 0 )
NEGATE( vjustify ); NEGATE( vjustify );
} }
...@@ -334,6 +334,7 @@ bool SCH_FIELD::Save( FILE* aFile ) const ...@@ -334,6 +334,7 @@ bool SCH_FIELD::Save( FILE* aFile ) const
hjustify = 'R'; hjustify = 'R';
char vjustify = 'C'; char vjustify = 'C';
if( m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM ) if( m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM )
vjustify = 'B'; vjustify = 'B';
else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP ) else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP )
...@@ -391,9 +392,11 @@ void SCH_FIELD::Place( SCH_EDIT_FRAME* frame, wxDC* DC ) ...@@ -391,9 +392,11 @@ void SCH_FIELD::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
fieldNdx = m_FieldId; fieldNdx = m_FieldId;
m_AddExtraText = 0; m_AddExtraText = 0;
if( fieldNdx == REFERENCE ) if( fieldNdx == REFERENCE )
{ {
Entry = CMP_LIBRARY::FindLibraryComponent( component->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( component->m_ChipName );
if( Entry != NULL ) if( Entry != NULL )
{ {
if( Entry->GetPartCount() > 1 ) if( Entry->GetPartCount() > 1 )
...@@ -412,6 +415,7 @@ void SCH_FIELD::Place( SCH_EDIT_FRAME* frame, wxDC* DC ) ...@@ -412,6 +415,7 @@ void SCH_FIELD::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint * aFindLocation ) bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint * aFindLocation )
{ {
bool match; bool match;
if( aAuxData && m_FieldId == REFERENCE ) if( aAuxData && m_FieldId == REFERENCE )
{ {
// reference is a special field because: // reference is a special field because:
...@@ -421,6 +425,7 @@ bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint ...@@ -421,6 +425,7 @@ bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint
SCH_COMPONENT* pSch = (SCH_COMPONENT*) m_Parent; SCH_COMPONENT* pSch = (SCH_COMPONENT*) m_Parent;
SCH_SHEET_PATH* sheet = (SCH_SHEET_PATH*) aAuxData; SCH_SHEET_PATH* sheet = (SCH_SHEET_PATH*) aAuxData;
wxString fulltext = pSch->GetRef( sheet ); wxString fulltext = pSch->GetRef( sheet );
if( m_AddExtraText ) if( m_AddExtraText )
{ {
/* For more than one part per package, we must add the part selection /* For more than one part per package, we must add the part selection
...@@ -428,18 +433,22 @@ bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint ...@@ -428,18 +433,22 @@ bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint
int part_id = pSch->GetUnitSelection( sheet ); int part_id = pSch->GetUnitSelection( sheet );
fulltext << LIB_COMPONENT::ReturnSubReference( part_id ); fulltext << LIB_COMPONENT::ReturnSubReference( part_id );
} }
match = SCH_ITEM::Matches( fulltext, aSearchData ); match = SCH_ITEM::Matches( fulltext, aSearchData );
} }
else else
match = SCH_ITEM::Matches( m_Text, aSearchData ); match = SCH_ITEM::Matches( m_Text, aSearchData );
if( match ) if( match )
{ {
EDA_Rect BoundaryBox = GetBoundaryBox(); EDA_Rect BoundaryBox = GetBoundingBox();
if( aFindLocation ) if( aFindLocation )
*aFindLocation = GetBoundaryBox().Centre(); *aFindLocation = GetBoundingBox().Centre();
return true; return true;
} }
return false; return false;
} }
...@@ -448,3 +457,34 @@ void SCH_FIELD::Rotate( wxPoint rotationPoint ) ...@@ -448,3 +457,34 @@ void SCH_FIELD::Rotate( wxPoint rotationPoint )
{ {
RotatePoint( &m_Pos, rotationPoint, 900 ); RotatePoint( &m_Pos, rotationPoint, 900 );
} }
bool SCH_FIELD::DoHitTest( const wxPoint& aPoint, int aAccuracy ) const
{
// Do not hit test hidden fields.
if( !IsVisible() )
return false;
EDA_Rect rect = GetBoundingBox();
rect.Inflate( aAccuracy );
return rect.Inside( aPoint );
}
bool SCH_FIELD::DoHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const
{
// Do not hit test hidden fields.
if( !IsVisible() )
return false;
EDA_Rect rect = aRect;
rect.Inflate( aAccuracy );
if( aContained )
return rect.Inside( GetBoundingBox() );
return rect.Intersects( GetBoundingBox() );
}
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "sch_item_struct.h" #include "sch_item_struct.h"
#include "general.h" #include "general.h"
...@@ -36,7 +35,6 @@ class SCH_FIELD : public SCH_ITEM, public EDA_TextStruct ...@@ -36,7 +35,6 @@ class SCH_FIELD : public SCH_ITEM, public EDA_TextStruct
public: public:
int m_FieldId; ///< Field index, @see enum NumFieldType int m_FieldId; ///< Field index, @see enum NumFieldType
wxString m_Name; wxString m_Name;
bool m_AddExtraText; /**< for REFERENCE, add extra info bool m_AddExtraText; /**< for REFERENCE, add extra info
...@@ -53,16 +51,15 @@ public: ...@@ -53,16 +51,15 @@ public:
return wxT( "SCH_FIELD" ); return wxT( "SCH_FIELD" );
} }
void Place( SCH_EDIT_FRAME* frame, wxDC* DC ); void Place( SCH_EDIT_FRAME* frame, wxDC* DC );
EDA_Rect GetBoundaryBox() const; EDA_Rect GetBoundingBox() const;
/** /**
* Function IsVoid * Function IsVoid
* returns true if the field is either empty or holds "~". * returns true if the field is either empty or holds "~".
*/ */
bool IsVoid() bool IsVoid() const
{ {
size_t len = m_Text.Len(); size_t len = m_Text.Len();
...@@ -84,13 +81,13 @@ public: ...@@ -84,13 +81,13 @@ public:
* Function GetPenSize * Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int GetPenSize(); int GetPenSize() const;
/** /**
* Function IsVisible * Function IsVisible
* @return true is this field is visible, false if flagged invisible * @return true is this field is visible, false if flagged invisible
*/ */
bool IsVisible() bool IsVisible() const
{ {
return (m_Attributs & TEXT_NO_VISIBLE) == 0 ? true : false; return (m_Attributs & TEXT_NO_VISIBLE) == 0 ? true : false;
} }
...@@ -99,11 +96,11 @@ public: ...@@ -99,11 +96,11 @@ public:
/** /**
* Function Draw * Function Draw
*/ */
void Draw( WinEDA_DrawPanel* panel, void Draw( WinEDA_DrawPanel* aPanel,
wxDC* DC, wxDC* aDC,
const wxPoint& offset, const wxPoint& aOffset,
int draw_mode, int aDrawMode,
int Color = -1 ); int aColor = -1 );
/** /**
* Function Save * Function Save
...@@ -136,7 +133,6 @@ public: ...@@ -136,7 +133,6 @@ public:
* master class */ * master class */
} }
/** virtual function Mirror_Y /** virtual function Mirror_Y
* mirror item relative to an Y axis * mirror item relative to an Y axis
* @param aYaxis_position = the y axis position * @param aYaxis_position = the y axis position
...@@ -149,7 +145,6 @@ public: ...@@ -149,7 +145,6 @@ public:
* master class */ * master class */
} }
/** /**
* Compare schematic field text against search string. * Compare schematic field text against search string.
* *
...@@ -163,6 +158,10 @@ public: ...@@ -163,6 +158,10 @@ public:
*/ */
virtual bool Matches( wxFindReplaceData& aSearchData, virtual bool Matches( wxFindReplaceData& aSearchData,
void* aAuxData, wxPoint * aFindLocation ); void* aAuxData, wxPoint * aFindLocation );
private:
virtual bool DoHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual bool DoHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const;
}; };
......
This diff is collapsed.
...@@ -43,15 +43,14 @@ public: ...@@ -43,15 +43,14 @@ public:
return wxT( "SCH_LINE" ); return wxT( "SCH_LINE" );
} }
bool IsEndPoint( const wxPoint& aPoint ) const
bool IsOneEndPointAt( const wxPoint& pos );
SCH_LINE* GenCopy();
bool IsNull()
{ {
return m_Start == m_End; return aPoint == m_Start || aPoint == m_End;
} }
SCH_LINE* GenCopy();
bool IsNull() const { return m_Start == m_End; }
/** /**
* Function GetBoundingBox * Function GetBoundingBox
...@@ -60,15 +59,14 @@ public: ...@@ -60,15 +59,14 @@ public:
* object, and the units should be in the pcb or schematic coordinate system. * object, and the units should be in the pcb or schematic coordinate system.
* It is OK to overestimate the size by a few counts. * It is OK to overestimate the size by a few counts.
*/ */
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox() const;
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, virtual void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset,
int draw_mode, int Color = -1 ); int aDrawMode, int aColor = -1 );
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.sch" * writes the data structures for this object out to a FILE in "*.sch" format.
* format.
* @param aFile The FILE to write to. * @param aFile The FILE to write to.
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
...@@ -88,7 +86,7 @@ public: ...@@ -88,7 +86,7 @@ public:
* Function GetPenSize * Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
virtual int GetPenSize(); virtual int GetPenSize() const;
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
...@@ -96,14 +94,7 @@ public: ...@@ -96,14 +94,7 @@ public:
* move item to a new position. * move item to a new position.
* @param aMoveVector = the displacement vector * @param aMoveVector = the displacement vector
*/ */
virtual void Move( const wxPoint& aMoveVector ) virtual void Move( const wxPoint& aMoveVector );
{
if( (m_Flags & STARTPOINT) == 0 )
m_Start += aMoveVector;
if( (m_Flags & ENDPOINT) == 0 )
m_End += aMoveVector;
}
/** virtual function Mirror_Y /** virtual function Mirror_Y
* mirror item relative to an Y axis * mirror item relative to an Y axis
...@@ -136,9 +127,12 @@ public: ...@@ -136,9 +127,12 @@ public:
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const; virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ); void Show( int nestLevel, std::ostream& os ) const;
#endif #endif
private:
virtual bool DoHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual bool DoHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const;
}; };
...@@ -151,23 +145,22 @@ public: ...@@ -151,23 +145,22 @@ public:
public: public:
SCH_NO_CONNECT( const wxPoint& pos = wxPoint( 0, 0 ) ); SCH_NO_CONNECT( const wxPoint& pos = wxPoint( 0, 0 ) );
~SCH_NO_CONNECT() { } ~SCH_NO_CONNECT() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "SCH_NO_CONNECT" ); return wxT( "SCH_NO_CONNECT" );
} }
SCH_NO_CONNECT* GenCopy(); SCH_NO_CONNECT* GenCopy();
/** /**
* Function GetPenSize * Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
virtual int GetPenSize(); virtual int GetPenSize() const;
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, virtual void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& affset,
const wxPoint& offset, int draw_mode, int aDrawMode, int aColor = -1 );
int Color = -1 );
/** /**
* Function Save * Function Save
...@@ -188,13 +181,6 @@ public: ...@@ -188,13 +181,6 @@ public:
*/ */
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/**
* Function HitTest
* @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test
*/
bool HitTest( const wxPoint& aPosRef );
/** /**
* Function GetBoundingBox * Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display * returns the orthogonal, bounding box of this object for display
...@@ -203,7 +189,7 @@ public: ...@@ -203,7 +189,7 @@ public:
* schematic coordinate system. It is OK to overestimate the size * schematic coordinate system. It is OK to overestimate the size
* by a few counts. * by a few counts.
*/ */
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox() const;
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
...@@ -216,7 +202,6 @@ public: ...@@ -216,7 +202,6 @@ public:
m_Pos += aMoveVector; m_Pos += aMoveVector;
} }
/** virtual function Mirror_Y /** virtual function Mirror_Y
* mirror item relative to an Y axis * mirror item relative to an Y axis
* @param aYaxis_position = the y axis position * @param aYaxis_position = the y axis position
...@@ -228,6 +213,10 @@ public: ...@@ -228,6 +213,10 @@ public:
virtual bool IsSelectStateChanged( const wxRect& aRect ); virtual bool IsSelectStateChanged( const wxRect& aRect );
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const; virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
private:
virtual bool DoHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual bool DoHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const;
}; };
...@@ -254,10 +243,11 @@ public: ...@@ -254,10 +243,11 @@ public:
SCH_BUS_ENTRY* GenCopy(); SCH_BUS_ENTRY* GenCopy();
wxPoint m_End() const; wxPoint m_End() const;
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int draw_mode, virtual void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset,
int Color = -1 ); int aDrawMode, int aColor = -1 );
/** /**
* Function Save * Function Save
...@@ -286,13 +276,13 @@ public: ...@@ -286,13 +276,13 @@ public:
* schematic coordinate system. It is OK to overestimate the size * schematic coordinate system. It is OK to overestimate the size
* by a few counts. * by a few counts.
*/ */
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox() const;
/** /**
* Function GetPenSize * Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
virtual int GetPenSize(); virtual int GetPenSize() const;
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
...@@ -319,6 +309,10 @@ public: ...@@ -319,6 +309,10 @@ public:
virtual bool IsSelectStateChanged( const wxRect& aRect ); virtual bool IsSelectStateChanged( const wxRect& aRect );
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const; virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
private:
virtual bool DoHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual bool DoHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const;
}; };
class SCH_POLYLINE : public SCH_ITEM class SCH_POLYLINE : public SCH_ITEM
...@@ -338,9 +332,9 @@ public: ...@@ -338,9 +332,9 @@ public:
SCH_POLYLINE* GenCopy(); SCH_POLYLINE* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int draw_mode, virtual void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset,
int Color = -1 ); int aDrawMode, int aColor = -1 );
/** /**
* Function Save * Function Save
...@@ -382,7 +376,7 @@ public: ...@@ -382,7 +376,7 @@ public:
* Function GetPenSize * Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
virtual int GetPenSize(); virtual int GetPenSize() const;
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
...@@ -404,6 +398,10 @@ public: ...@@ -404,6 +398,10 @@ public:
virtual void Mirror_Y( int aYaxis_position ); virtual void Mirror_Y( int aYaxis_position );
virtual void Mirror_X( int aXaxis_position ); virtual void Mirror_X( int aXaxis_position );
virtual void Rotate( wxPoint rotationPoint ); virtual void Rotate( wxPoint rotationPoint );
private:
virtual bool DoHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual bool DoHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const;
}; };
...@@ -422,14 +420,6 @@ public: ...@@ -422,14 +420,6 @@ public:
return wxT( "SCH_JUNCTION" ); return wxT( "SCH_JUNCTION" );
} }
/**
* Function HitTest
* @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test
*/
bool HitTest( const wxPoint& aPosRef );
/** /**
* Function GetBoundingBox * Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display * returns the orthogonal, bounding box of this object for display
...@@ -438,18 +428,12 @@ public: ...@@ -438,18 +428,12 @@ public:
* schematic coordinate system. It is OK to overestimate the size * schematic coordinate system. It is OK to overestimate the size
* by a few counts. * by a few counts.
*/ */
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox() const;
SCH_JUNCTION* GenCopy(); SCH_JUNCTION* GenCopy();
/** virtual void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset,
* Function GetPenSize int aDrawMode, int aColor = -1 );
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int draw_mode, int Color = -1 );
/** /**
* Function Save * Function Save
...@@ -500,6 +484,10 @@ public: ...@@ -500,6 +484,10 @@ public:
void Show( int nestLevel, std::ostream& os ); void Show( int nestLevel, std::ostream& os );
#endif #endif
private:
virtual bool DoHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual bool DoHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const;
}; };
......
...@@ -32,13 +32,13 @@ const wxChar* NameMarqueurType[] = ...@@ -32,13 +32,13 @@ const wxChar* NameMarqueurType[] =
/* class SCH_MARKER */ /* class SCH_MARKER */
/**************************/ /**************************/
SCH_MARKER::SCH_MARKER() : SCH_ITEM( NULL, TYPE_SCH_MARKER ), MARKER_BASE() SCH_MARKER::SCH_MARKER() : SCH_ITEM( NULL, SCH_MARKER_T ), MARKER_BASE()
{ {
} }
SCH_MARKER::SCH_MARKER( const wxPoint& pos, const wxString& text ) : SCH_MARKER::SCH_MARKER( const wxPoint& pos, const wxString& text ) :
SCH_ITEM( NULL, TYPE_SCH_MARKER ), SCH_ITEM( NULL, SCH_MARKER_T ),
MARKER_BASE( 0, pos, text, pos ) MARKER_BASE( 0, pos, text, pos )
{ {
} }
...@@ -140,7 +140,7 @@ bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData, wxPoint * aFindLocatio ...@@ -140,7 +140,7 @@ bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData, wxPoint * aFindLocatio
* object, and the units should be in the pcb or schematic coordinate system. * object, and the units should be in the pcb or schematic coordinate system.
* It is OK to overestimate the size by a few counts. * It is OK to overestimate the size by a few counts.
*/ */
EDA_Rect SCH_MARKER::GetBoundingBox() EDA_Rect SCH_MARKER::GetBoundingBox() const
{ {
return GetBoundingBoxMarker(); return GetBoundingBoxMarker();
} }
......
...@@ -31,19 +31,18 @@ public: ...@@ -31,19 +31,18 @@ public:
SCH_MARKER(); SCH_MARKER();
SCH_MARKER( const wxPoint& aPos, const wxString& aText ); SCH_MARKER( const wxPoint& aPos, const wxString& aText );
~SCH_MARKER(); ~SCH_MARKER();
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "SCH_MARKER" ); return wxT( "SCH_MARKER" );
} }
SCH_MARKER* GenCopy(); SCH_MARKER* GenCopy();
virtual void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, virtual void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aDraw_mode, const wxPoint& aOffset, int aDraw_mode,
int aColor = -1 ); int aColor = -1 );
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.sch" * writes the data structures for this object out to a FILE in "*.sch"
...@@ -53,14 +52,6 @@ public: ...@@ -53,14 +52,6 @@ public:
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/**
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
* for a marker, has no meaning, but it is necessary to satisfy the
* SCH_ITEM class requirements
*/
virtual int GetPenSize() { return 0; };
/** /**
* Function HitTest * Function HitTest
* @return true if the point aPosRef is within item area * @return true if the point aPosRef is within item area
...@@ -71,7 +62,6 @@ public: ...@@ -71,7 +62,6 @@ public:
return HitTestMarker( aPosRef ); return HitTestMarker( aPosRef );
} }
/** /**
* Function GetBoundingBox * Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display purposes. * returns the orthogonal, bounding box of this object for display purposes.
...@@ -79,8 +69,7 @@ public: ...@@ -79,8 +69,7 @@ public:
* object, and the units should be in the pcb or schematic coordinate system. * object, and the units should be in the pcb or schematic coordinate system.
* It is OK to overestimate the size by a few counts. * It is OK to overestimate the size by a few counts.
*/ */
virtual EDA_Rect GetBoundingBox(); virtual EDA_Rect GetBoundingBox() const;
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
......
...@@ -23,22 +23,22 @@ void SetaParent( SCH_ITEM* Struct, SCH_SCREEN* Screen ) ...@@ -23,22 +23,22 @@ void SetaParent( SCH_ITEM* Struct, SCH_SCREEN* Screen )
{ {
switch( Struct->Type() ) switch( Struct->Type() )
{ {
case DRAW_POLYLINE_STRUCT_TYPE: case SCH_POLYLINE_T:
case DRAW_JUNCTION_STRUCT_TYPE: case SCH_JUNCTION_T:
case TYPE_SCH_TEXT: case SCH_TEXT_T:
case TYPE_SCH_LABEL: case SCH_LABEL_T:
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
case DRAW_SEGMENT_STRUCT_TYPE: case SCH_LINE_T:
case DRAW_BUSENTRY_STRUCT_TYPE: case SCH_BUS_ENTRY_T:
case DRAW_SHEET_STRUCT_TYPE: case SCH_SHEET_T:
case TYPE_SCH_MARKER: case SCH_MARKER_T:
case DRAW_NOCONNECT_STRUCT_TYPE: case SCH_NO_CONNECT_T:
Struct->SetParent( Screen ); Struct->SetParent( Screen );
break; break;
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case SCH_SHEET_LABEL_T:
break; break;
default: default:
...@@ -194,15 +194,15 @@ SCH_ITEM* SCH_SCREEN::ExtractWires( bool CreateCopy ) ...@@ -194,15 +194,15 @@ SCH_ITEM* SCH_SCREEN::ExtractWires( bool CreateCopy )
switch( item->Type() ) switch( item->Type() )
{ {
case DRAW_JUNCTION_STRUCT_TYPE: case SCH_JUNCTION_T:
case DRAW_SEGMENT_STRUCT_TYPE: case SCH_LINE_T:
RemoveFromDrawList( item ); RemoveFromDrawList( item );
item->SetNext( List ); item->SetNext( List );
List = item; List = item;
if( CreateCopy ) if( CreateCopy )
{ {
if( item->Type() == DRAW_JUNCTION_STRUCT_TYPE ) if( item->Type() == SCH_JUNCTION_T )
new_item = ( (SCH_JUNCTION*) item )->GenCopy(); new_item = ( (SCH_JUNCTION*) item )->GenCopy();
else else
new_item = ( (SCH_LINE*) item )->GenCopy(); new_item = ( (SCH_LINE*) item )->GenCopy();
...@@ -234,13 +234,13 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC ) ...@@ -234,13 +234,13 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
for( ; DrawList != NULL; DrawList = DrawList->Next() ) for( ; DrawList != NULL; DrawList = DrawList->Next() )
{ {
if( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE ) if( DrawList->Type() == SCH_LINE_T )
{ {
TstDrawList = DrawList->Next(); TstDrawList = DrawList->Next();
while( TstDrawList ) while( TstDrawList )
{ {
if( TstDrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE ) if( TstDrawList->Type() == SCH_LINE_T )
{ {
SCH_LINE* line = (SCH_LINE*) DrawList; SCH_LINE* line = (SCH_LINE*) DrawList;
...@@ -438,13 +438,13 @@ void SCH_SCREENS::AddScreenToList( SCH_SCREEN* aScreen ) ...@@ -438,13 +438,13 @@ void SCH_SCREENS::AddScreenToList( SCH_SCREEN* aScreen )
void SCH_SCREENS::BuildScreenList( EDA_ITEM* aItem ) void SCH_SCREENS::BuildScreenList( EDA_ITEM* aItem )
{ {
if( aItem && aItem->Type() == DRAW_SHEET_STRUCT_TYPE ) if( aItem && aItem->Type() == SCH_SHEET_T )
{ {
SCH_SHEET* ds = (SCH_SHEET*) aItem; SCH_SHEET* ds = (SCH_SHEET*) aItem;
aItem = ds->m_AssociatedScreen; aItem = ds->m_AssociatedScreen;
} }
if( aItem && aItem->Type() == SCREEN_STRUCT_TYPE ) if( aItem && aItem->Type() == SCH_SCREEN_T )
{ {
SCH_SCREEN* screen = (SCH_SCREEN*) aItem; SCH_SCREEN* screen = (SCH_SCREEN*) aItem;
AddScreenToList( screen ); AddScreenToList( screen );
...@@ -452,7 +452,7 @@ void SCH_SCREENS::BuildScreenList( EDA_ITEM* aItem ) ...@@ -452,7 +452,7 @@ void SCH_SCREENS::BuildScreenList( EDA_ITEM* aItem )
while( strct ) while( strct )
{ {
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( strct->Type() == SCH_SHEET_T )
{ {
BuildScreenList( strct ); BuildScreenList( strct );
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -57,7 +57,7 @@ bool SCH_SHEET_PATH::BuildSheetPathInfoFromSheetPathValue( const wxString& aPath ...@@ -57,7 +57,7 @@ bool SCH_SHEET_PATH::BuildSheetPathInfoFromSheetPathValue( const wxString& aPath
SCH_ITEM* schitem = LastDrawList(); SCH_ITEM* schitem = LastDrawList();
while( schitem && GetSheetsCount() < NB_MAX_SHEET ) while( schitem && GetSheetsCount() < NB_MAX_SHEET )
{ {
if( schitem->Type() == DRAW_SHEET_STRUCT_TYPE ) if( schitem->Type() == SCH_SHEET_T )
{ {
SCH_SHEET* sheet = (SCH_SHEET*) schitem; SCH_SHEET* sheet = (SCH_SHEET*) schitem;
Push( sheet ); Push( sheet );
...@@ -259,7 +259,7 @@ void SCH_SHEET_PATH::UpdateAllScreenReferences() ...@@ -259,7 +259,7 @@ void SCH_SHEET_PATH::UpdateAllScreenReferences()
while( t ) while( t )
{ {
if( t->Type() == TYPE_SCH_COMPONENT ) if( t->Type() == SCH_COMPONENT_T )
{ {
SCH_COMPONENT* component = (SCH_COMPONENT*) t; SCH_COMPONENT* component = (SCH_COMPONENT*) t;
component->GetField( REFERENCE )->m_Text = component->GetRef( this ); component->GetField( REFERENCE )->m_Text = component->GetRef( this );
...@@ -536,7 +536,7 @@ void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet ) ...@@ -536,7 +536,7 @@ void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet )
while( strct ) while( strct )
{ {
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( strct->Type() == SCH_SHEET_T )
{ {
SCH_SHEET* sheet = (SCH_SHEET*) strct; SCH_SHEET* sheet = (SCH_SHEET*) strct;
BuildSheetList( sheet ); BuildSheetList( sheet );
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
*/ */
SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent, const wxPoint& pos, const wxString& text ) : SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent, const wxPoint& pos, const wxString& text ) :
SCH_HIERLABEL( pos, text, DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ) SCH_HIERLABEL( pos, text, SCH_SHEET_LABEL_T )
{ {
SetParent( parent ); SetParent( parent );
wxASSERT( parent ); wxASSERT( parent );
...@@ -103,7 +103,7 @@ bool SCH_SHEET_PIN::operator==( const SCH_SHEET_PIN* aPin ) const ...@@ -103,7 +103,7 @@ bool SCH_SHEET_PIN::operator==( const SCH_SHEET_PIN* aPin ) const
* Function GetPenSize * Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int SCH_SHEET_PIN::GetPenSize() int SCH_SHEET_PIN::GetPenSize() const
{ {
return g_DrawDefaultLineThickness; return g_DrawDefaultLineThickness;
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -244,7 +244,7 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -244,7 +244,7 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
if( aSheet == NULL || aSheet->m_Flags & IS_NEW ) if( aSheet == NULL || aSheet->m_Flags & IS_NEW )
return; return;
if( aSheet->Type() != DRAW_SHEET_STRUCT_TYPE ) if( aSheet->Type() != SCH_SHEET_T )
{ {
DisplayError( this, wxT( "SCH_EDIT_FRAME::ReSizeSheet: Bad SructType" ) ); DisplayError( this, wxT( "SCH_EDIT_FRAME::ReSizeSheet: Bad SructType" ) );
return; return;
...@@ -280,7 +280,7 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -280,7 +280,7 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC ) void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC )
{ {
if( ( aSheet == NULL ) || ( aSheet->Type() != DRAW_SHEET_STRUCT_TYPE ) ) if( ( aSheet == NULL ) || ( aSheet->Type() != SCH_SHEET_T ) )
return; return;
DrawPanel->CursorOff( aDC ); DrawPanel->CursorOff( aDC );
......
This diff is collapsed.
This diff is collapsed.
...@@ -347,10 +347,11 @@ int LIB_VIEW_FRAME::BestZoom() ...@@ -347,10 +347,11 @@ int LIB_VIEW_FRAME::BestZoom()
{ {
if( m_clientSize == wxSize( -1, -1 ) ) if( m_clientSize == wxSize( -1, -1 ) )
m_clientSize = DrawPanel->GetClientSize(); m_clientSize = DrawPanel->GetClientSize();
size = m_clientSize; size = m_clientSize;
} }
EDA_Rect BoundaryBox = component->GetBoundaryBox( m_unit, m_convert ); EDA_Rect BoundaryBox = component->GetBoundingBox( m_unit, m_convert );
// Reserve a 25 mils margin around component bounding box. // Reserve a 25 mils margin around component bounding box.
size -= wxSize( 25, 25 ); size -= wxSize( 25, 25 );
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment