Schematic object improvements and other minor fixes.

This commit is contained in:
Wayne Stambaugh 2010-12-10 14:47:44 -05:00
parent f64b3a5188
commit adb4ad1a7b
100 changed files with 1445 additions and 1454 deletions

View File

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

View File

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

View File

@ -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,43 +211,39 @@ 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
@ -257,21 +253,22 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine )
{ {
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 )
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 )
} }
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 )
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 )
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 )
end.y = MAX( end.y, aPoint.y ); end.y = MAX( end.y, aPoint.y );
SetEnd( end ); SetEnd( end );
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 )
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 )
/* 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
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
} }
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
} }
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
} }
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
} }
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
} }
/* 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
} }
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
} }
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), SEARCHALL ); DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), SEARCHALL );
if( DrawStruct ) if( DrawStruct )
{ {
return DrawStruct; return DrawStruct;

View File

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

View File

@ -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
#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
{ {
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
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 )
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 )
#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 )
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 )
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 )
{ {
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 )
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 )
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 )
* 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 )
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 )
{ {
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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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()
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
} }
EDA_Rect LIB_CIRCLE::GetBoundingBox() EDA_Rect LIB_CIRCLE::GetBoundingBox() const
{ {
EDA_Rect rect; EDA_Rect rect;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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()
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 )
} }
EDA_Rect LIB_RECTANGLE::GetBoundingBox() EDA_Rect LIB_RECTANGLE::GetBoundingBox() const
{ {
EDA_Rect rect; EDA_Rect rect;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -74,189 +74,146 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
switch( DrawEntry->Type() ) switch( DrawEntry->Type() )
{ {
case COMPONENT_PIN_DRAW_TYPE: case LIB_PIN_T:
AddMenusForPin( PopMenu, (LIB_PIN*) DrawEntry, this ); AddMenusForPin( PopMenu, (LIB_PIN*) DrawEntry, this );
break; break;
case COMPONENT_ARC_DRAW_TYPE: case LIB_ARC_T:
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
msg = AddHotkeyName( _( "Move Arc" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Move Arc" ), s_Libedit_Hokeys_Descr,
HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_arc_xpm );
msg, move_arc_xpm ); msg = AddHotkeyName( _( "Drag Arc Size" ), s_Libedit_Hokeys_Descr, HK_DRAG );
msg = AddHotkeyName( _( "Drag Arc Size" ), s_Libedit_Hokeys_Descr, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, move_arc_xpm );
HK_DRAG );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM,
msg, move_arc_xpm );
} }
msg = AddHotkeyName( _( "Edit Arc Options" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Edit Arc Options" ), s_Libedit_Hokeys_Descr, HK_EDIT );
HK_EDIT ); ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, options_arc_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM,
msg, options_arc_xpm );
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
msg = AddHotkeyName( _( "Delete Arc" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Delete Arc" ), s_Libedit_Hokeys_Descr, HK_DELETE );
HK_DELETE ); ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_arc_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,
msg, delete_arc_xpm );
} }
break; break;
case COMPONENT_CIRCLE_DRAW_TYPE: case LIB_CIRCLE_T:
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
msg = AddHotkeyName( _( "Move Circle" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Move Circle" ), s_Libedit_Hokeys_Descr,
HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_circle_xpm );
msg, move_circle_xpm );
} }
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
msg = AddHotkeyName( _( "Drag Circle Outline" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Drag Circle Outline" ), s_Libedit_Hokeys_Descr, HK_DRAG );
HK_DRAG ); ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, move_rectangle_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM,
msg, move_rectangle_xpm );
} }
msg = AddHotkeyName( _( "Edit Circle Options" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Edit Circle Options" ), s_Libedit_Hokeys_Descr, HK_EDIT );
HK_EDIT ); ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, options_circle_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM,
msg, options_circle_xpm );
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
msg = AddHotkeyName( _( "Delete Circle" ), msg = AddHotkeyName( _( "Delete Circle" ), s_Libedit_Hokeys_Descr, HK_DELETE );
s_Libedit_Hokeys_Descr, HK_DELETE ); ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_circle_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,
msg, delete_circle_xpm );
} }
break; break;
case COMPONENT_RECT_DRAW_TYPE: case LIB_RECTANGLE_T:
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
msg = AddHotkeyName( _( "Move Rectangle" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Move Rectangle" ), s_Libedit_Hokeys_Descr,
HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_rectangle_xpm );
msg, move_rectangle_xpm );
} }
msg = AddHotkeyName( _( "Edit Rectangle Options" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Edit Rectangle Options" ), s_Libedit_Hokeys_Descr, HK_EDIT );
HK_EDIT ); ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, options_rectangle_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM,
msg, options_rectangle_xpm );
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
msg = AddHotkeyName( _( "Drag Rectangle Edge" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Drag Rectangle Edge" ), s_Libedit_Hokeys_Descr, HK_DRAG );
HK_DRAG ); ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, move_rectangle_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM,
msg, move_rectangle_xpm );
} }
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
msg = AddHotkeyName( _( "Delete Rectangle" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Delete Rectangle" ), s_Libedit_Hokeys_Descr, HK_DELETE );
HK_DELETE ); ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_rectangle_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,
msg, delete_rectangle_xpm );
} }
break; break;
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: case LIB_TEXT_T:
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
msg = AddHotkeyName( _( "Move Text" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Move Text" ), s_Libedit_Hokeys_Descr,
HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_text_xpm );
msg, move_text_xpm );
} }
msg = AddHotkeyName( _( "Edit Text" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Edit Text" ), s_Libedit_Hokeys_Descr, HK_EDIT );
HK_EDIT ); ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, edit_text_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM,
msg, edit_text_xpm );
msg = AddHotkeyName( _( "Rotate Text" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Rotate Text" ), s_Libedit_Hokeys_Descr, HK_ROTATE );
HK_ROTATE ); ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT, msg, edit_text_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT,
msg, edit_text_xpm );
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
msg = AddHotkeyName( _( "Delete Text" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Delete Text" ), s_Libedit_Hokeys_Descr, HK_DELETE );
HK_DELETE ); ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_text_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,
msg, delete_text_xpm );
} }
break; break;
case COMPONENT_POLYLINE_DRAW_TYPE: case LIB_POLYLINE_T:
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
msg = AddHotkeyName( _( "Move Line" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Move Line" ), s_Libedit_Hokeys_Descr,
HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_line_xpm );
msg, move_line_xpm ); msg = AddHotkeyName( _( "Drag Edge Point" ), s_Libedit_Hokeys_Descr, HK_DRAG );
msg = AddHotkeyName( _( "Drag Edge Point" ), s_Libedit_Hokeys_Descr, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, move_line_xpm );
HK_DRAG );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM,
msg, move_line_xpm );
} }
if( DrawEntry->m_Flags & IS_NEW ) if( DrawEntry->m_Flags & IS_NEW )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_END_CREATE_ITEM, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_END_CREATE_ITEM, _( "Line End" ), apply_xpm );
_( "Line End" ), apply_xpm );
} }
msg = AddHotkeyName( _( "Edit Line Options" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Edit Line Options" ), s_Libedit_Hokeys_Descr, HK_EDIT );
HK_EDIT ); ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, options_segment_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM,
msg, options_segment_xpm );
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
msg = AddHotkeyName( _( "Delete Line " ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Delete Line " ), s_Libedit_Hokeys_Descr, HK_DELETE );
HK_DELETE ); ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_segment_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,
msg, delete_segment_xpm );
} }
else if( (DrawEntry->m_Flags & IS_NEW) ) else if( (DrawEntry->m_Flags & IS_NEW) )
{ {
if( ( (LIB_POLYLINE*) DrawEntry )->GetCornerCount() > 2 ) if( ( (LIB_POLYLINE*) DrawEntry )->GetCornerCount() > 2 )
{ {
msg = AddHotkeyName( _( "Delete Segment" ), msg = AddHotkeyName( _( "Delete Segment" ), s_Libedit_Hokeys_Descr, HK_DELETE );
s_Libedit_Hokeys_Descr, HK_DELETE ); ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT,
ADD_MENUITEM( PopMenu,
ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT,
msg, delete_segment_xpm ); msg, delete_segment_xpm );
} }
} }
break; break;
case COMPONENT_FIELD_DRAW_TYPE: case LIB_FIELD_T:
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
msg = AddHotkeyName( _( "Move Field" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Move Field" ), s_Libedit_Hokeys_Descr,
HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_field_xpm );
msg, move_field_xpm );
} }
msg = AddHotkeyName( _( "Field Rotate" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Field Rotate" ), s_Libedit_Hokeys_Descr, HK_ROTATE );
HK_ROTATE ); ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_FIELD_ROTATE_ITEM, msg, rotate_field_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_FIELD_ROTATE_ITEM, msg = AddHotkeyName( _( "Field Edit" ), s_Libedit_Hokeys_Descr, HK_EDIT );
msg, rotate_field_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM, msg, edit_text_xpm );
msg = AddHotkeyName( _( "Field Edit" ), s_Libedit_Hokeys_Descr,
HK_EDIT );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM,
msg, edit_text_xpm );
break; break;
@ -284,8 +241,7 @@ void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame )
{ {
msg = AddHotkeyName( _( "Move Pin " ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Move Pin " ), s_Libedit_Hokeys_Descr,
HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_xpm );
msg, move_xpm );
} }
msg = AddHotkeyName( _( "Edit Pin " ), s_Libedit_Hokeys_Descr, HK_EDIT); msg = AddHotkeyName( _( "Edit Pin " ), s_Libedit_Hokeys_Descr, HK_EDIT);
@ -296,11 +252,10 @@ void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame )
if( not_in_move ) if( not_in_move )
{ {
msg = AddHotkeyName( _( "Delete Pin " ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Delete Pin " ), s_Libedit_Hokeys_Descr, HK_DELETE );
HK_DELETE ); ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_pin_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,
msg, delete_pin_xpm );
} }
wxMenu* global_pin_change = new wxMenu; wxMenu* global_pin_change = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( PopMenu, global_pin_change, ADD_MENUITEM_WITH_SUBMENU( PopMenu, global_pin_change,
ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_ITEM, ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_ITEM,
@ -324,8 +279,7 @@ void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame )
void AddMenusForBlock( wxMenu* PopMenu, LIB_EDIT_FRAME* frame ) void AddMenusForBlock( wxMenu* PopMenu, LIB_EDIT_FRAME* frame )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "Cancel Block" ), cancel_xpm );
_( "Cancel Block" ), cancel_xpm );
if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE ) if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
ADD_MENUITEM( PopMenu, ID_POPUP_ZOOM_BLOCK, ADD_MENUITEM( PopMenu, ID_POPUP_ZOOM_BLOCK,
@ -334,18 +288,13 @@ void AddMenusForBlock( wxMenu* PopMenu, LIB_EDIT_FRAME* frame )
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), apply_xpm );
apply_xpm );
if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE ) if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_SELECT_ITEMS_BLOCK, ADD_MENUITEM( PopMenu, ID_POPUP_SELECT_ITEMS_BLOCK, _( "Select Items" ), green_xpm );
_( "Select Items" ), green_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ), copyblock_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK, ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, _( "Mirror Block ||" ), mirror_H_xpm );
_( "Copy Block" ), copyblock_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), delete_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_Y_BLOCK,
_( "Mirror Block ||" ), mirror_H_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK,
_( "Delete Block" ), delete_xpm );
} }
} }

View File

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

View File

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

View File

@ -19,8 +19,6 @@
#include "template_fieldnames.h" #include "template_fieldnames.h"
static bool IsItemInBox(EDA_Rect& aBox, SCH_ITEM* DrawStruct );
static SCH_ITEM* LastSnappedStruct = NULL; static SCH_ITEM* LastSnappedStruct = NULL;
static bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, static bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
SCH_ITEM* DrawList, double aScaleFactor ); SCH_ITEM* DrawList, double aScaleFactor );
@ -56,12 +54,12 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
if( lastcomponent == NULL ) // First time a component is located if( lastcomponent == NULL ) // First time a component is located
{ {
lastcomponent = component; lastcomponent = component;
BoundaryBox = lastcomponent->GetBoundaryBox(); BoundaryBox = lastcomponent->GetBoundingBox();
sizeref = ABS( (float) BoundaryBox.GetWidth() * BoundaryBox.GetHeight() ); sizeref = ABS( (float) BoundaryBox.GetWidth() * BoundaryBox.GetHeight() );
} }
else else
{ {
BoundaryBox = component->GetBoundaryBox(); BoundaryBox = component->GetBoundingBox();
sizecurr = ABS( (float) BoundaryBox.GetWidth() * BoundaryBox.GetHeight() ); sizecurr = ABS( (float) BoundaryBox.GetWidth() * BoundaryBox.GetHeight() );
if( sizeref > sizecurr ) // a smallest component is found if( sizeref > sizecurr ) // a smallest component is found
@ -134,19 +132,18 @@ int PickItemsInBlock( BLOCK_SELECTOR& aBlock, SCH_SCREEN* aScreen )
EDA_Rect area; EDA_Rect area;
area.SetOrigin( aBlock.GetOrigin()); area.SetOrigin( aBlock.GetOrigin());
area.SetSize( aBlock.GetSize() ); area.SetSize( aBlock.GetSize() );
area.Normalize(); area.Normalize();
ITEM_PICKER picker; ITEM_PICKER picker;
SCH_ITEM* DrawStruct = aScreen->GetDrawItems(); SCH_ITEM* item = aScreen->GetDrawItems();
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() ) for( ; item != NULL; item = item->Next() )
{ {
if( IsItemInBox( area, DrawStruct ) ) if( item->HitTest( area ) )
{ {
/* Put this structure in the picked list: */ /* Put this structure in the picked list: */
picker.m_PickedItem = DrawStruct; picker.m_PickedItem = item;
picker.m_PickedItemType = DrawStruct->Type(); picker.m_PickedItemType = item->Type();
aBlock.PushItem( picker ); aBlock.PushItem( picker );
itemcount++; itemcount++;
} }
@ -172,7 +169,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, SCH_ITEM* DrawList, dou
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
case DRAW_POLYLINE_STRUCT_TYPE: case SCH_POLYLINE_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_POLYLINE*) DrawList ) #define STRUCT ( (SCH_POLYLINE*) DrawList )
if( !( SearchMask & (DRAWITEM | WIREITEM | BUSITEM) ) ) if( !( SearchMask & (DRAWITEM | WIREITEM | BUSITEM) ) )
@ -190,7 +187,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, SCH_ITEM* DrawList, dou
break; break;
case DRAW_SEGMENT_STRUCT_TYPE: case SCH_LINE_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_LINE*) DrawList ) #define STRUCT ( (SCH_LINE*) DrawList )
if( !( SearchMask & (DRAWITEM | WIREITEM | BUSITEM) ) ) if( !( SearchMask & (DRAWITEM | WIREITEM | BUSITEM) ) )
@ -198,26 +195,15 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, SCH_ITEM* DrawList, dou
if( TestSegmentHit( aPosRef, STRUCT->m_Start, STRUCT->m_End, 0 ) ) if( TestSegmentHit( aPosRef, STRUCT->m_Start, STRUCT->m_End, 0 ) )
{ {
if( ( ( SearchMask & DRAWITEM ) if( ( ( SearchMask & DRAWITEM ) && ( STRUCT->GetLayer() == LAYER_NOTES ) )
&& ( STRUCT->GetLayer() == LAYER_NOTES ) ) || ( ( SearchMask & WIREITEM ) && ( STRUCT->GetLayer() == LAYER_WIRE ) )
|| ( ( SearchMask & WIREITEM ) || ( ( SearchMask & BUSITEM ) && ( STRUCT->GetLayer() == LAYER_BUS ) ) )
&& ( STRUCT->GetLayer() == LAYER_WIRE ) )
|| ( ( SearchMask & BUSITEM )
&& ( STRUCT->GetLayer() == LAYER_BUS ) )
)
{ {
if( SearchMask & EXCLUDE_WIRE_BUS_ENDPOINTS ) if( SearchMask & EXCLUDE_WIRE_BUS_ENDPOINTS && STRUCT->IsEndPoint( aPosRef ) )
{
if( aPosRef == STRUCT->m_Start
|| aPosRef == STRUCT->m_End )
break; break;
}
if( SearchMask & WIRE_BUS_ENDPOINTS_ONLY ) if( SearchMask & WIRE_BUS_ENDPOINTS_ONLY && !STRUCT->IsEndPoint( aPosRef ) )
{
if( !STRUCT->IsOneEndPointAt( aPosRef ) )
break; break;
}
LastSnappedStruct = DrawList; LastSnappedStruct = DrawList;
return true; return true;
@ -226,21 +212,20 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, SCH_ITEM* DrawList, dou
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 )
if( !( SearchMask & (RACCORDITEM) ) ) if( !( SearchMask & (RACCORDITEM) ) )
break; break;
if( TestSegmentHit( aPosRef, STRUCT->m_Pos, STRUCT->m_End(), if( TestSegmentHit( aPosRef, STRUCT->m_Pos, STRUCT->m_End(), hitminDist ) )
hitminDist ) )
{ {
LastSnappedStruct = DrawList; LastSnappedStruct = DrawList;
return true; return true;
} }
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 )
if( !(SearchMask & JUNCTIONITEM) ) if( !(SearchMask & JUNCTIONITEM) )
@ -252,7 +237,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, SCH_ITEM* DrawList, dou
} }
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 )
if( !(SearchMask & NOCONNECTITEM) ) if( !(SearchMask & NOCONNECTITEM) )
@ -264,7 +249,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, SCH_ITEM* DrawList, dou
} }
break; break;
case TYPE_SCH_MARKER: case SCH_MARKER_T:
{ {
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_MARKER*) DrawList ) #define STRUCT ( (SCH_MARKER*) DrawList )
@ -278,7 +263,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, SCH_ITEM* DrawList, dou
break; break;
} }
case TYPE_SCH_TEXT: case SCH_TEXT_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_TEXT*) DrawList ) #define STRUCT ( (SCH_TEXT*) DrawList )
if( !( SearchMask & TEXTITEM) ) if( !( SearchMask & TEXTITEM) )
@ -291,9 +276,9 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, SCH_ITEM* DrawList, dou
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:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_TEXT*) DrawList ) // SCH_TEXT is the base #define STRUCT ( (SCH_TEXT*) DrawList ) // SCH_TEXT is the base
// class of these labels // class of these labels
@ -306,7 +291,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, SCH_ITEM* DrawList, dou
} }
break; break;
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
if( !( SearchMask & (LIBITEM | FIELDCMPITEM) ) ) if( !( SearchMask & (LIBITEM | FIELDCMPITEM) ) )
break; break;
@ -323,7 +308,8 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, SCH_ITEM* DrawList, dou
if( field->IsVoid() ) if( field->IsVoid() )
continue; continue;
EDA_Rect BoundaryBox = field->GetBoundaryBox(); EDA_Rect BoundaryBox = field->GetBoundingBox();
if( BoundaryBox.Inside( aPosRef ) ) if( BoundaryBox.Inside( aPosRef ) )
{ {
LastSnappedStruct = field; LastSnappedStruct = field;
@ -335,7 +321,8 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, SCH_ITEM* DrawList, dou
{ {
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_COMPONENT*) DrawList ) #define STRUCT ( (SCH_COMPONENT*) DrawList )
EDA_Rect BoundaryBox = STRUCT->GetBoundaryBox(); EDA_Rect BoundaryBox = STRUCT->GetBoundingBox();
if( BoundaryBox.Inside( aPosRef ) ) if( BoundaryBox.Inside( aPosRef ) )
{ {
LastSnappedStruct = DrawList; LastSnappedStruct = DrawList;
@ -344,7 +331,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, SCH_ITEM* DrawList, dou
} }
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 )
if( !(SearchMask & SHEETITEM) ) if( !(SearchMask & SHEETITEM) )
@ -372,92 +359,6 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, SCH_ITEM* DrawList, dou
} }
/*****************************************************************************
* Routine to test if an object has non empty intersection with the box *
* defined by x1/y1 and x2/y2 (x1 < x2, y1 < y2), and return true if so. This *
* routine is used to pick all points in a given box. *
*****************************************************************************/
bool IsItemInBox( EDA_Rect& aBox, SCH_ITEM* DrawStruct )
{
EDA_Rect BoundaryBox;
switch( DrawStruct->Type() )
{
case DRAW_POLYLINE_STRUCT_TYPE:
#undef STRUCT
#define STRUCT ( (SCH_POLYLINE*) DrawStruct )
for( unsigned i = 0; i < STRUCT->GetCornerCount(); i++ )
{
if( aBox.Inside(STRUCT->m_PolyPoints[i]) )
return true;
}
break;
case DRAW_SEGMENT_STRUCT_TYPE:
#undef STRUCT
#define STRUCT ( (SCH_LINE*) DrawStruct )
if( aBox.Inside(STRUCT->m_Start) )
return true;
if( aBox.Inside(STRUCT->m_End) )
return true;
break;
case DRAW_BUSENTRY_STRUCT_TYPE:
#undef STRUCT
#define STRUCT ( (SCH_BUS_ENTRY*) DrawStruct )
if( aBox.Inside(STRUCT->m_Pos) )
return true;
if( aBox.Inside(STRUCT->m_End() ) )
return true;
break;
case DRAW_JUNCTION_STRUCT_TYPE:
#undef STRUCT
#define STRUCT ( (SCH_JUNCTION*) DrawStruct )
if( aBox.Inside(STRUCT->m_Pos) )
return true;
break;
case DRAW_NOCONNECT_STRUCT_TYPE:
case TYPE_SCH_LABEL:
case TYPE_SCH_TEXT:
case TYPE_SCH_HIERLABEL:
case TYPE_SCH_GLOBALLABEL:
case DRAW_SHEET_STRUCT_TYPE:
case TYPE_SCH_MARKER:
BoundaryBox = DrawStruct->GetBoundingBox();
if( aBox.Intersects( BoundaryBox ) )
return true;
break;
case TYPE_SCH_COMPONENT:
// Use a more restrictive area than GetBoundingBox()
// Area is restricted to the body area, excludint fields outside this area
BoundaryBox = ((SCH_COMPONENT*)DrawStruct)->GetBoundaryBox();
if( aBox.Intersects( BoundaryBox ) )
return true;
break;
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
break;
default:
{
wxString msg;
msg.Printf( wxT( "IsItemInBox() Err: unexpected StructType %d (" ),
DrawStruct->Type() );
msg << DrawStruct->GetClass() << wxT( ")" );
wxMessageBox( msg );
break;
}
}
return FALSE;
}
SCH_SHEET_PIN* LocateSheetLabel( SCH_SHEET* Sheet, const wxPoint& pos ) SCH_SHEET_PIN* LocateSheetLabel( SCH_SHEET* Sheet, const wxPoint& pos )
{ {
return Sheet->GetLabel( pos ); return Sheet->GetLabel( pos );
@ -473,7 +374,7 @@ LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos, SCH_COMPONENT*
for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Next() ) for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{ {
if( DrawStruct->Type() != TYPE_SCH_COMPONENT ) if( DrawStruct->Type() != SCH_COMPONENT_T )
continue; continue;
schItem = (SCH_COMPONENT*) DrawStruct; schItem = (SCH_COMPONENT*) DrawStruct;
@ -490,7 +391,7 @@ LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos, SCH_COMPONENT*
wxPoint libPos = RefPos - schItem->m_Pos; wxPoint libPos = RefPos - schItem->m_Pos;
Pin = (LIB_PIN*) Entry->LocateDrawItem( schItem->m_Multi, Pin = (LIB_PIN*) Entry->LocateDrawItem( schItem->m_Multi,
schItem->m_Convert, schItem->m_Convert,
COMPONENT_PIN_DRAW_TYPE, LIB_PIN_T,
libPos, schItem->m_Transform ); libPos, schItem->m_Transform );
if( Pin ) if( Pin )
break; break;
@ -510,7 +411,7 @@ SCH_SHEET_PIN* LocateAnyPinSheet( const wxPoint& RefPos, SCH_ITEM* DrawList )
for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Next() ) for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{ {
if( DrawStruct->Type() != DRAW_SHEET_STRUCT_TYPE ) if( DrawStruct->Type() != SCH_SHEET_T )
continue; continue;
PinSheet = LocateSheetLabel( (SCH_SHEET*) DrawStruct, RefPos ); PinSheet = LocateSheetLabel( (SCH_SHEET*) DrawStruct, RefPos );

View File

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

View File

@ -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,
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,
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,
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,
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,
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,
// 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,
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,
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,
} }
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,
break; break;
} }
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case SCH_SHEET_LABEL_T:
default: default:
{ {
wxString msg; wxString msg;

View File

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

View File

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

View File

@ -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 )
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,
{ {
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,
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 )
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 )
{ {

View File

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

View File

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

View File

@ -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 ) :
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,
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,
/* 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 )
} }
/**
* 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 )
/** /**
* 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;
// This gives a reasonable approximation (but some things are missing so...) if( Entry == NULL )
EDA_Rect bbox = GetBoundaryBox(); 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();
/* 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 );
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() );
bBox.Merge( GetField( ii )->GetBoundingBox() );
} }
// ... add padding return bBox;
bbox.Inflate( PADDING );
return bbox;
} }
@ -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 )
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 )
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
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
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() );
}

View File

@ -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:
* 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:
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:
// 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
@ -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;
}; };

View File

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

View File

@ -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
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:
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:
* 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:
/** /**
* 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:
* 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:
* master class */ * master class */
} }
/** /**
* Compare schematic field text against search string. * Compare schematic field text against search string.
* *
@ -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;
}; };

View File

@ -31,7 +31,7 @@
/***********************/ /***********************/
SCH_BUS_ENTRY::SCH_BUS_ENTRY( const wxPoint& pos, int shape, int id ) : SCH_BUS_ENTRY::SCH_BUS_ENTRY( const wxPoint& pos, int shape, int id ) :
SCH_ITEM( NULL, DRAW_BUSENTRY_STRUCT_TYPE ) SCH_ITEM( NULL, SCH_BUS_ENTRY_T )
{ {
m_Pos = pos; m_Pos = pos;
m_Size.x = 100; m_Size.x = 100;
@ -138,7 +138,7 @@ bool SCH_BUS_ENTRY::Load( LINE_READER& aLine, wxString& aErrorMsg )
} }
EDA_Rect SCH_BUS_ENTRY::GetBoundingBox() EDA_Rect SCH_BUS_ENTRY::GetBoundingBox() const
{ {
EDA_Rect box; EDA_Rect box;
@ -157,7 +157,7 @@ EDA_Rect SCH_BUS_ENTRY::GetBoundingBox()
* 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_BUS_ENTRY::GetPenSize() int SCH_BUS_ENTRY::GetPenSize() const
{ {
int pensize = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; int pensize = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
@ -246,11 +246,30 @@ void SCH_BUS_ENTRY::GetConnectionPoints( vector< wxPoint >& aPoints ) const
} }
bool SCH_BUS_ENTRY::DoHitTest( const wxPoint& aPoint, int aAccuracy ) const
{
return TestSegmentHit( aPoint, m_Pos, m_End(), aAccuracy );
}
bool SCH_BUS_ENTRY::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() );
}
/**********************/ /**********************/
/* class SCH_JUNCTION */ /* class SCH_JUNCTION */
/**********************/ /**********************/
SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos ) : SCH_ITEM( NULL, DRAW_JUNCTION_STRUCT_TYPE ) SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos ) : SCH_ITEM( NULL, SCH_JUNCTION_T )
{ {
#define DRAWJUNCTION_DIAMETER 32 /* Diameter of junction symbol between wires */ #define DRAWJUNCTION_DIAMETER 32 /* Diameter of junction symbol between wires */
m_Pos = pos; m_Pos = pos;
@ -311,7 +330,7 @@ bool SCH_JUNCTION::Load( LINE_READER& aLine, wxString& aErrorMsg )
} }
EDA_Rect SCH_JUNCTION::GetBoundingBox() EDA_Rect SCH_JUNCTION::GetBoundingBox() const
{ {
EDA_Rect rect; EDA_Rect rect;
@ -322,31 +341,6 @@ EDA_Rect SCH_JUNCTION::GetBoundingBox()
} }
/**
* Function HitTest
* @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test
*/
bool SCH_JUNCTION::HitTest( const wxPoint& aPosRef )
{
wxPoint dist = aPosRef - m_Pos;
return sqrt( ( (double) ( dist.x * dist.x ) ) +
( (double) ( dist.y * dist.y ) ) ) < ( m_Size.x / 2 );
}
/**
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
* has no meaning for SCH_JUNCTION
*/
int SCH_JUNCTION::GetPenSize()
{
return 0;
}
/***************************************************************************** /*****************************************************************************
* Routine to redraw connection struct. * * Routine to redraw connection struct. *
*****************************************************************************/ *****************************************************************************/
@ -424,16 +418,37 @@ void SCH_JUNCTION::Show( int nestLevel, std::ostream& os )
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << m_Pos << "/>\n"; NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << m_Pos << "/>\n";
} }
#endif #endif
bool SCH_JUNCTION::DoHitTest( const wxPoint& aPoint, int aAccuracy ) const
{
EDA_Rect rect = GetBoundingBox();
rect.Inflate( aAccuracy );
return rect.Inside( aPoint );
}
bool SCH_JUNCTION::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() );
}
/************************/ /************************/
/* class SCH_NO_CONNECT */ /* class SCH_NO_CONNECT */
/************************/ /************************/
SCH_NO_CONNECT::SCH_NO_CONNECT( const wxPoint& pos ) : SCH_ITEM( NULL, DRAW_NOCONNECT_STRUCT_TYPE ) SCH_NO_CONNECT::SCH_NO_CONNECT( const wxPoint& pos ) : SCH_ITEM( NULL, SCH_NO_CONNECT_T )
{ {
#define DRAWNOCONNECT_SIZE 48 /* No symbol connection range. */ #define DRAWNOCONNECT_SIZE 48 /* No symbol connection range. */
m_Pos = pos; m_Pos = pos;
@ -453,7 +468,7 @@ SCH_NO_CONNECT* SCH_NO_CONNECT::GenCopy()
} }
EDA_Rect SCH_NO_CONNECT::GetBoundingBox() EDA_Rect SCH_NO_CONNECT::GetBoundingBox() const
{ {
int delta = ( GetPenSize() + m_Size.x ) / 2; int delta = ( GetPenSize() + m_Size.x ) / 2;
EDA_Rect box; EDA_Rect box;
@ -465,24 +480,6 @@ EDA_Rect SCH_NO_CONNECT::GetBoundingBox()
} }
/**
* Function HitTest
* @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test
*/
bool SCH_NO_CONNECT::HitTest( const wxPoint& aPosRef )
{
int width = g_DrawDefaultLineThickness;
int delta = ( m_Size.x + width ) / 2;
wxPoint dist = aPosRef - m_Pos;
if( ( ABS( dist.x ) <= delta ) && ( ABS( dist.y ) <= delta ) )
return true;
return false;
}
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.sch" format. * writes the data structures for this object out to a FILE in "*.sch" format.
@ -526,7 +523,7 @@ bool SCH_NO_CONNECT::Load( LINE_READER& aLine, wxString& aErrorMsg )
* 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_NO_CONNECT::GetPenSize() int SCH_NO_CONNECT::GetPenSize() const
{ {
return g_DrawDefaultLineThickness; return g_DrawDefaultLineThickness;
} }
@ -596,12 +593,38 @@ void SCH_NO_CONNECT::GetConnectionPoints( vector< wxPoint >& aPoints ) const
} }
bool SCH_NO_CONNECT::DoHitTest( const wxPoint& aPoint, int aAccuracy ) const
{
int delta = ( ( m_Size.x + g_DrawDefaultLineThickness ) / 2 ) + aAccuracy;
wxPoint dist = aPoint - m_Pos;
if( ( ABS( dist.x ) <= delta ) && ( ABS( dist.y ) <= delta ) )
return true;
return false;
}
bool SCH_NO_CONNECT::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() );
}
/******************/ /******************/
/* Class SCH_LINE */ /* Class SCH_LINE */
/******************/ /******************/
SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) : SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) :
SCH_ITEM( NULL, DRAW_SEGMENT_STRUCT_TYPE ) SCH_ITEM( NULL, SCH_LINE_T )
{ {
m_Start = pos; m_Start = pos;
m_End = pos; m_End = pos;
@ -635,13 +658,19 @@ SCH_LINE* SCH_LINE::GenCopy()
} }
bool SCH_LINE::IsOneEndPointAt( const wxPoint& pos ) void SCH_LINE::Move( const wxPoint& aOffset )
{ {
if( ( pos.x == m_Start.x ) && ( pos.y == m_Start.y ) ) if( (m_Flags & STARTPOINT) == 0 && aOffset != wxPoint( 0, 0 ) )
return TRUE; {
if( ( pos.x == m_End.x ) && ( pos.y == m_End.y ) ) m_Start += aOffset;
return TRUE; SetModified();
return FALSE; }
if( (m_Flags & ENDPOINT) == 0 && aOffset != wxPoint( 0, 0 ) )
{
m_End += aOffset;
SetModified();
}
} }
@ -654,7 +683,7 @@ bool SCH_LINE::IsOneEndPointAt( const wxPoint& pos )
* 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 SCH_LINE::Show( int nestLevel, std::ostream& os ) void SCH_LINE::Show( int nestLevel, std::ostream& os ) const
{ {
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str()
<< " layer=\"" << m_Layer << '"' << " layer=\"" << m_Layer << '"'
@ -671,7 +700,7 @@ void SCH_LINE::Show( int nestLevel, std::ostream& os )
#endif #endif
EDA_Rect SCH_LINE::GetBoundingBox() EDA_Rect SCH_LINE::GetBoundingBox() const
{ {
int width = 25; int width = 25;
@ -703,12 +732,15 @@ bool SCH_LINE::Save( FILE* aFile ) const
if( GetLayer() == LAYER_WIRE ) if( GetLayer() == LAYER_WIRE )
layer = "Wire"; layer = "Wire";
if( GetLayer() == LAYER_BUS ) if( GetLayer() == LAYER_BUS )
layer = "Bus"; layer = "Bus";
if( fprintf( aFile, "Wire %s %s\n", layer, width ) == EOF ) if( fprintf( aFile, "Wire %s %s\n", layer, width ) == EOF )
{ {
success = false; success = false;
} }
if( fprintf( aFile, "\t%-4d %-4d %-4d %-4d\n", m_Start.x, m_Start.y, if( fprintf( aFile, "\t%-4d %-4d %-4d %-4d\n", m_Start.x, m_Start.y,
m_End.x, m_End.y ) == EOF ) m_End.x, m_End.y ) == EOF )
{ {
@ -740,6 +772,7 @@ bool SCH_LINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
if( Name1[0] == 'W' ) if( Name1[0] == 'W' )
m_Layer = LAYER_WIRE; m_Layer = LAYER_WIRE;
if( Name1[0] == 'B' ) if( Name1[0] == 'B' )
m_Layer = LAYER_BUS; m_Layer = LAYER_BUS;
@ -760,7 +793,7 @@ bool SCH_LINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
* 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_LINE::GetPenSize() int SCH_LINE::GetPenSize() const
{ {
int pensize = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; int pensize = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
@ -835,7 +868,7 @@ void SCH_LINE::Rotate( wxPoint rotationPoint )
bool SCH_LINE::MergeOverlap( SCH_LINE* aLine ) bool SCH_LINE::MergeOverlap( SCH_LINE* aLine )
{ {
wxCHECK_MSG( aLine != NULL && aLine->Type() == DRAW_SEGMENT_STRUCT_TYPE, false, wxCHECK_MSG( aLine != NULL && aLine->Type() == SCH_LINE_T, false,
wxT( "Cannot test line segment for overlap." ) ); wxT( "Cannot test line segment for overlap." ) );
if( this == aLine || GetLayer() != aLine->GetLayer() ) if( this == aLine || GetLayer() != aLine->GetLayer() )
@ -974,11 +1007,30 @@ void SCH_LINE::GetConnectionPoints( vector< wxPoint >& aPoints ) const
} }
bool SCH_LINE::DoHitTest( const wxPoint& aPoint, int aAccuracy ) const
{
return TestSegmentHit( aPoint, m_Start, m_End, aAccuracy );
}
bool SCH_LINE::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() );
}
/**********************/ /**********************/
/* Class SCH_POLYLINE */ /* Class SCH_POLYLINE */
/**********************/ /**********************/
SCH_POLYLINE::SCH_POLYLINE( int layer ) : SCH_ITEM( NULL, DRAW_POLYLINE_STRUCT_TYPE ) SCH_POLYLINE::SCH_POLYLINE( int layer ) : SCH_ITEM( NULL, SCH_POLYLINE_T )
{ {
m_Width = 0; m_Width = 0;
@ -1093,7 +1145,7 @@ bool SCH_POLYLINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
* 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_POLYLINE::GetPenSize() int SCH_POLYLINE::GetPenSize() const
{ {
int pensize = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; int pensize = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
@ -1101,18 +1153,18 @@ int SCH_POLYLINE::GetPenSize()
} }
void SCH_POLYLINE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, void SCH_POLYLINE::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset,
const wxPoint& offset, int DrawMode, int Color ) int aDrawMode, int aColor )
{ {
int color; int color;
int width = GetPenSize(); int width = GetPenSize();
if( Color >= 0 ) if( aColor >= 0 )
color = Color; color = aColor;
else else
color = ReturnLayerColor( m_Layer ); color = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( aDC, aDrawMode );
if( m_Layer == LAYER_BUS ) if( m_Layer == LAYER_BUS )
{ {
@ -1124,14 +1176,14 @@ void SCH_POLYLINE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if( m_Layer == LAYER_NOTES ) if( m_Layer == LAYER_NOTES )
{ {
for( unsigned i = 1; i < GetCornerCount(); i++ ) for( unsigned i = 1; i < GetCornerCount(); i++ )
GRDashedLineTo( &panel->m_ClipBox, DC, m_PolyPoints[i].x + offset.x, GRDashedLineTo( &aPanel->m_ClipBox, aDC, m_PolyPoints[i].x + aOffset.x,
m_PolyPoints[i].y + offset.y, width, color ); m_PolyPoints[i].y + aOffset.y, width, color );
} }
else else
{ {
for( unsigned i = 1; i < GetCornerCount(); i++ ) for( unsigned i = 1; i < GetCornerCount(); i++ )
GRLineTo( &panel->m_ClipBox, DC, m_PolyPoints[i].x + offset.x, GRLineTo( &aPanel->m_ClipBox, aDC, m_PolyPoints[i].x + aOffset.x,
m_PolyPoints[i].y + offset.y, width, color ); m_PolyPoints[i].y + aOffset.y, width, color );
} }
} }
@ -1165,3 +1217,28 @@ void SCH_POLYLINE::Rotate( wxPoint rotationPoint )
RotatePoint( &m_PolyPoints[ii], rotationPoint, 900 ); RotatePoint( &m_PolyPoints[ii], rotationPoint, 900 );
} }
} }
bool SCH_POLYLINE::DoHitTest( const wxPoint& aPoint, int aAccuracy ) const
{
for( size_t i = 0; i < m_PolyPoints.size() - 1; i++ )
{
if( TestSegmentHit( aPoint, m_PolyPoints[i], m_PolyPoints[i + 1], aAccuracy ) )
return true;
}
return false;
}
bool SCH_POLYLINE::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() );
}

View File

@ -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:
* 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:
* 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:
* 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:
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:
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:
*/ */
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:
* 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:
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:
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:
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:
* 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:
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:
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:
* 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:
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:
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:
* 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:
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;
}; };

View File

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

View File

@ -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:
*/ */
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:
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:
* 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):

View File

@ -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 )
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 )
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 )
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 )
while( strct ) while( strct )
{ {
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( strct->Type() == SCH_SHEET_T )
{ {
BuildScreenList( strct ); BuildScreenList( strct );
} }

View File

@ -29,7 +29,7 @@
#include "sch_component.h" #include "sch_component.h"
SCH_SHEET::SCH_SHEET( const wxPoint& pos ) : SCH_ITEM( NULL, DRAW_SHEET_STRUCT_TYPE ) SCH_SHEET::SCH_SHEET( const wxPoint& pos ) : SCH_ITEM( NULL, SCH_SHEET_T )
{ {
m_Layer = LAYER_SHEET; m_Layer = LAYER_SHEET;
m_Pos = pos; m_Pos = pos;
@ -280,6 +280,7 @@ SCH_SHEET* SCH_SHEET::GenCopy()
/* don't copy screen data - just reference it. */ /* don't copy screen data - just reference it. */
newitem->m_AssociatedScreen = m_AssociatedScreen; newitem->m_AssociatedScreen = m_AssociatedScreen;
if( m_AssociatedScreen ) if( m_AssociatedScreen )
m_AssociatedScreen->m_RefCount++; m_AssociatedScreen->m_RefCount++;
@ -316,7 +317,7 @@ void SCH_SHEET::SwapData( SCH_SHEET* copyitem )
void SCH_SHEET::AddLabel( SCH_SHEET_PIN* aLabel ) void SCH_SHEET::AddLabel( SCH_SHEET_PIN* aLabel )
{ {
wxASSERT( aLabel != NULL ); wxASSERT( aLabel != NULL );
wxASSERT( aLabel->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ); wxASSERT( aLabel->Type() == SCH_SHEET_LABEL_T );
m_labels.push_back( aLabel ); m_labels.push_back( aLabel );
renumberLabels(); renumberLabels();
@ -326,7 +327,7 @@ void SCH_SHEET::AddLabel( SCH_SHEET_PIN* aLabel )
void SCH_SHEET::RemoveLabel( SCH_SHEET_PIN* aLabel ) void SCH_SHEET::RemoveLabel( SCH_SHEET_PIN* aLabel )
{ {
wxASSERT( aLabel != NULL ); wxASSERT( aLabel != NULL );
wxASSERT( aLabel->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ); wxASSERT( aLabel->Type() == SCH_SHEET_LABEL_T );
SCH_SHEET_PIN_LIST::iterator i; SCH_SHEET_PIN_LIST::iterator i;
@ -356,6 +357,7 @@ bool SCH_SHEET::HasLabel( const wxString& aName )
return false; return false;
} }
bool SCH_SHEET::IsVerticalOrientation() bool SCH_SHEET::IsVerticalOrientation()
{ {
BOOST_FOREACH( SCH_SHEET_PIN label, m_labels ) BOOST_FOREACH( SCH_SHEET_PIN label, m_labels )
@ -377,7 +379,7 @@ bool SCH_SHEET::HasUndefinedLabels()
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{ {
if( DrawStruct->Type() != TYPE_SCH_HIERLABEL ) if( DrawStruct->Type() != SCH_HIERARCHICAL_LABEL_T )
continue; continue;
HLabel = (SCH_HIERLABEL*) DrawStruct; HLabel = (SCH_HIERLABEL*) DrawStruct;
@ -454,7 +456,7 @@ void SCH_SHEET::CleanupSheet()
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{ {
if( DrawStruct->Type() != TYPE_SCH_HIERLABEL ) if( DrawStruct->Type() != SCH_HIERARCHICAL_LABEL_T )
continue; continue;
HLabel = (SCH_HIERLABEL*) DrawStruct; HLabel = (SCH_HIERLABEL*) DrawStruct;
@ -489,7 +491,7 @@ SCH_SHEET_PIN* SCH_SHEET::GetLabel( const wxPoint& aPosition )
* 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::GetPenSize() int SCH_SHEET::GetPenSize() const
{ {
return g_DrawDefaultLineThickness; return g_DrawDefaultLineThickness;
} }
@ -561,6 +563,7 @@ void SCH_SHEET::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
color = aColor; color = aColor;
else else
color = ReturnLayerColor( m_Layer ); color = ReturnLayerColor( m_Layer );
GRSetDrawMode( aDC, aDrawMode ); GRSetDrawMode( aDC, aDrawMode );
GRRect( &aPanel->m_ClipBox, aDC, pos.x, pos.y, GRRect( &aPanel->m_ClipBox, aDC, pos.x, pos.y,
@ -592,6 +595,7 @@ void SCH_SHEET::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
txtcolor = aColor; txtcolor = aColor;
else else
txtcolor = ReturnLayerColor( LAYER_SHEETFILENAME ); txtcolor = ReturnLayerColor( LAYER_SHEETFILENAME );
Text = wxT( "File: " ) + m_FileName; Text = wxT( "File: " ) + m_FileName;
DrawGraphicText( aPanel, aDC, pos_filename, DrawGraphicText( aPanel, aDC, pos_filename,
(EDA_Colors) txtcolor, Text, name_orientation, (EDA_Colors) txtcolor, Text, name_orientation,
@ -613,7 +617,7 @@ void SCH_SHEET::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
* Function GetBoundingBox * Function GetBoundingBox
* @return an EDA_Rect giving the bounding box of the sheet * @return an EDA_Rect giving the bounding box of the sheet
*/ */
EDA_Rect SCH_SHEET::GetBoundingBox() EDA_Rect SCH_SHEET::GetBoundingBox() const
{ {
int dx, dy; int dx, dy;
@ -633,19 +637,6 @@ EDA_Rect SCH_SHEET::GetBoundingBox()
} }
/**
* Function HitTest
* @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test
*/
bool SCH_SHEET::HitTest( const wxPoint& aPosRef )
{
EDA_Rect rect = GetBoundingBox();
return rect.Inside( aPosRef );
}
/** /**
* Function ComponentCount * Function ComponentCount
* count our own components, without the power components. * count our own components, without the power components.
@ -661,14 +652,15 @@ int SCH_SHEET::ComponentCount()
for( bs = m_AssociatedScreen->GetDrawItems(); bs != NULL; bs = bs->Next() ) for( bs = m_AssociatedScreen->GetDrawItems(); bs != NULL; bs = bs->Next() )
{ {
if( bs->Type() == TYPE_SCH_COMPONENT ) if( bs->Type() == SCH_COMPONENT_T )
{ {
SCH_COMPONENT* Cmp = (SCH_COMPONENT*) bs; SCH_COMPONENT* Cmp = (SCH_COMPONENT*) bs;
if( Cmp->GetField( VALUE )->m_Text.GetChar( 0 ) != '#' ) if( Cmp->GetField( VALUE )->m_Text.GetChar( 0 ) != '#' )
n++; n++;
} }
if( bs->Type() == DRAW_SHEET_STRUCT_TYPE )
if( bs->Type() == SCH_SHEET_T )
{ {
SCH_SHEET* sheet = (SCH_SHEET*) bs; SCH_SHEET* sheet = (SCH_SHEET*) bs;
n += sheet->ComponentCount(); n += sheet->ComponentCount();
@ -695,7 +687,7 @@ bool SCH_SHEET::SearchHierarchy( wxString aFilename, SCH_SCREEN** aScreen )
while( strct ) while( strct )
{ {
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( strct->Type() == SCH_SHEET_T )
{ {
SCH_SHEET* ss = (SCH_SHEET*) strct; SCH_SHEET* ss = (SCH_SHEET*) strct;
if( ss->m_AssociatedScreen if( ss->m_AssociatedScreen
@ -740,7 +732,7 @@ bool SCH_SHEET::LocatePathOfScreen( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aList )
while( strct ) while( strct )
{ {
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( strct->Type() == SCH_SHEET_T )
{ {
SCH_SHEET* ss = (SCH_SHEET*) strct; SCH_SHEET* ss = (SCH_SHEET*) strct;
@ -774,6 +766,7 @@ bool SCH_SHEET::Load( SCH_EDIT_FRAME* aFrame )
{ {
SCH_SCREEN* screen = NULL; SCH_SCREEN* screen = NULL;
g_RootSheet->SearchHierarchy( m_FileName, &screen ); g_RootSheet->SearchHierarchy( m_FileName, &screen );
if( screen ) if( screen )
{ {
m_AssociatedScreen = screen; m_AssociatedScreen = screen;
@ -793,7 +786,7 @@ bool SCH_SHEET::Load( SCH_EDIT_FRAME* aFrame )
while( bs ) while( bs )
{ {
if( bs->Type() == DRAW_SHEET_STRUCT_TYPE ) if( bs->Type() == SCH_SHEET_T )
{ {
SCH_SHEET* sheetstruct = (SCH_SHEET*) bs; SCH_SHEET* sheetstruct = (SCH_SHEET*) bs;
@ -827,7 +820,7 @@ int SCH_SHEET::CountSheets()
for( ; strct; strct = strct->Next() ) for( ; strct; strct = strct->Next() )
{ {
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( strct->Type() == SCH_SHEET_T )
{ {
SCH_SHEET* subsheet = (SCH_SHEET*) strct; SCH_SHEET* subsheet = (SCH_SHEET*) strct;
count += subsheet->CountSheets(); count += subsheet->CountSheets();
@ -864,7 +857,6 @@ bool SCH_SHEET::ChangeFileName( SCH_EDIT_FRAME* aFrame, const wxString& aFileNam
wxString msg; wxString msg;
bool LoadFromFile = false; bool LoadFromFile = false;
// do we reload the data from the existing hierarchy // do we reload the data from the existing hierarchy
if( g_RootSheet->SearchHierarchy( aFileName, &Screen_to_use ) ) if( g_RootSheet->SearchHierarchy( aFileName, &Screen_to_use ) )
{ {
@ -875,18 +867,17 @@ data in this sheet will be replaced)?" ),
GetChars( aFileName ) ); GetChars( aFileName ) );
if( !IsOK( NULL, msg ) ) if( !IsOK( NULL, msg ) )
{ {
DisplayInfoMessage( (wxWindow*) NULL, DisplayInfoMessage( (wxWindow*) NULL, _( "Sheet Filename Renaming Aborted" ) );
_( "Sheet Filename Renaming Aborted" ) );
return false; return false;
} }
} }
} }
else if( wxFileExists( aFileName ) ) // do we reload the data from else if( wxFileExists( aFileName ) ) // do we reload the data from an existing file
// an existing file
{ {
msg.Printf( _( "A file named %s exists, load it (otherwise keep \ msg.Printf( _( "A file named %s exists, load it (otherwise keep \
current sheet data if possible)?" ), current sheet data if possible)?" ),
GetChars( aFileName ) ); GetChars( aFileName ) );
if( IsOK( NULL, msg ) ) if( IsOK( NULL, msg ) )
{ {
LoadFromFile = true; LoadFromFile = true;
@ -895,8 +886,10 @@ current sheet data if possible)?" ),
if( m_AssociatedScreen ) if( m_AssociatedScreen )
{ {
m_AssociatedScreen->m_RefCount--; // be careful with these m_AssociatedScreen->m_RefCount--; // be careful with these
if( m_AssociatedScreen->m_RefCount == 0 ) if( m_AssociatedScreen->m_RefCount == 0 )
SAFE_DELETE( m_AssociatedScreen ); SAFE_DELETE( m_AssociatedScreen );
m_AssociatedScreen = NULL; // will be created later m_AssociatedScreen = NULL; // will be created later
} }
} }
@ -923,7 +916,6 @@ otherwise delete current sheet data)" );
m_AssociatedScreen = NULL; //will be created later m_AssociatedScreen = NULL; //will be created later
} }
SetFileName( aFileName ); SetFileName( aFileName );
// if we use new data (from file or from internal hierarchy), delete the // if we use new data (from file or from internal hierarchy), delete the
@ -931,8 +923,10 @@ otherwise delete current sheet data)" );
if( m_AssociatedScreen && (LoadFromFile || Screen_to_use) ) if( m_AssociatedScreen && (LoadFromFile || Screen_to_use) )
{ {
m_AssociatedScreen->m_RefCount--; m_AssociatedScreen->m_RefCount--;
if( m_AssociatedScreen->m_RefCount == 0 ) if( m_AssociatedScreen->m_RefCount == 0 )
SAFE_DELETE( m_AssociatedScreen ); SAFE_DELETE( m_AssociatedScreen );
m_AssociatedScreen = NULL; // so that we reload.. m_AssociatedScreen = NULL; // so that we reload..
} }
@ -944,13 +938,13 @@ otherwise delete current sheet data)" );
m_AssociatedScreen->m_RefCount++; m_AssociatedScreen->m_RefCount++;
} }
//just make a new screen if needed. //just make a new screen if needed.
if( !m_AssociatedScreen ) if( !m_AssociatedScreen )
{ {
m_AssociatedScreen = new SCH_SCREEN(); m_AssociatedScreen = new SCH_SCREEN();
m_AssociatedScreen->m_RefCount++; // be careful with these m_AssociatedScreen->m_RefCount++; // be careful with these
} }
m_AssociatedScreen->m_FileName = aFileName; m_AssociatedScreen->m_FileName = aFileName;
return true; return true;
@ -995,6 +989,7 @@ void SCH_SHEET::Mirror_X( int aXaxis_position )
NEGATE( m_Pos.y ); NEGATE( m_Pos.y );
m_Pos.y += aXaxis_position; m_Pos.y += aXaxis_position;
m_Pos.y -= m_Size.y; m_Pos.y -= m_Size.y;
BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, m_labels ) BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, m_labels )
{ {
sheetPin.Mirror_X( aXaxis_position ); sheetPin.Mirror_X( aXaxis_position );
@ -1012,7 +1007,6 @@ void SCH_SHEET::Mirror_Y( int aYaxis_position )
m_Pos.x -= aYaxis_position; m_Pos.x -= aYaxis_position;
NEGATE( m_Pos.x ); NEGATE( m_Pos.x );
m_Pos.x += aYaxis_position; m_Pos.x += aYaxis_position;
m_Pos.x -= m_Size.x; m_Pos.x -= m_Size.x;
BOOST_FOREACH( SCH_SHEET_PIN& label, m_labels ) BOOST_FOREACH( SCH_SHEET_PIN& label, m_labels )
@ -1050,6 +1044,7 @@ bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData,
{ {
if( aFindLocation ) if( aFindLocation )
*aFindLocation = GetFileNamePosition(); *aFindLocation = GetFileNamePosition();
return true; return true;
} }
@ -1057,6 +1052,7 @@ bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData,
{ {
if( aFindLocation ) if( aFindLocation )
*aFindLocation = GetSheetNamePosition(); *aFindLocation = GetSheetNamePosition();
return true; return true;
} }
@ -1084,7 +1080,7 @@ void SCH_SHEET::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
{ {
SCH_SHEET_PIN &pinsheet = GetSheetPins()[ii]; SCH_SHEET_PIN &pinsheet = GetSheetPins()[ii];
wxCHECK2_MSG( pinsheet.Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE, continue, wxCHECK2_MSG( pinsheet.Type() == SCH_SHEET_LABEL_T, continue,
wxT( "Invalid item in schematic sheet pin list. Bad programmer!" ) ); wxT( "Invalid item in schematic sheet pin list. Bad programmer!" ) );
pinsheet.GetEndPoints( aItemList ); pinsheet.GetEndPoints( aItemList );
@ -1140,6 +1136,29 @@ void SCH_SHEET::GetConnectionPoints( vector< wxPoint >& aPoints ) const
} }
bool SCH_SHEET::DoHitTest( const wxPoint& aPoint, int aAccuracy ) const
{
EDA_Rect rect = GetBoundingBox();
rect.Inflate( aAccuracy );
return rect.Inside( aPoint );
}
bool SCH_SHEET::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() );
}
#if defined(DEBUG) #if defined(DEBUG)
void SCH_SHEET::Show( int nestLevel, std::ostream& os ) void SCH_SHEET::Show( int nestLevel, std::ostream& os )

View File

@ -146,7 +146,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;
/** /**
* Function CreateGraphicShape * Function CreateGraphicShape
@ -235,12 +235,12 @@ public:
public: public:
SCH_SHEET( const wxPoint& pos = wxPoint( 0, 0 ) ); SCH_SHEET( const wxPoint& pos = wxPoint( 0, 0 ) );
~SCH_SHEET(); ~SCH_SHEET();
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "SCH_SHEET" ); return wxT( "SCH_SHEET" );
} }
/** /**
* 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"
@ -260,7 +260,9 @@ public:
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
void Place( SCH_EDIT_FRAME* frame, wxDC* DC ); void Place( SCH_EDIT_FRAME* frame, wxDC* DC );
SCH_SHEET* GenCopy(); SCH_SHEET* GenCopy();
void DisplayInfo( WinEDA_DrawFrame* frame ); void DisplayInfo( WinEDA_DrawFrame* frame );
/* there is no member for orientation in sch_sheet, to preserve file /* there is no member for orientation in sch_sheet, to preserve file
@ -332,7 +334,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;
/** /**
* Function Draw * Function Draw
@ -350,18 +352,11 @@ public:
int aDrawMode, int aDrawMode,
int aColor = -1 ); int aColor = -1 );
/**
* 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
* @return an EDA_Rect giving the bounding box of the sheet * @return an EDA_Rect giving the bounding box of the sheet
*/ */
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox() const;
void SwapData( SCH_SHEET* copyitem ); void SwapData( SCH_SHEET* copyitem );
@ -379,8 +374,7 @@ public:
* m_AssociatedScreen point on the screen, and its m_RefCount is * m_AssociatedScreen point on the screen, and its m_RefCount is
* incremented * incremented
* else creates a new associated screen and load the data file. * else creates a new associated screen and load the data file.
* @param aFrame = a SCH_EDIT_FRAME pointer to the maim schematic * @param aFrame = a SCH_EDIT_FRAME pointer to the maim schematic frame
* frame
* @return true if OK * @return true if OK
*/ */
bool Load( SCH_EDIT_FRAME* aFrame ); bool Load( SCH_EDIT_FRAME* aFrame );
@ -389,8 +383,7 @@ public:
* Function SearchHierarchy * Function SearchHierarchy
* search the existing hierarchy for an instance of screen "FileName". * search the existing hierarchy for an instance of screen "FileName".
* @param aFilename = the filename to find * @param aFilename = the filename to find
* @param aFilename = a location to return a pointer to the screen (if * @param aFilename = a location to return a pointer to the screen (if found)
* found)
* @return bool if found, and a pointer to the screen * @return bool if found, and a pointer to the screen
*/ */
bool SearchHierarchy( wxString aFilename, SCH_SCREEN** aScreen ); bool SearchHierarchy( wxString aFilename, SCH_SCREEN** aScreen );
@ -406,8 +399,7 @@ public:
* @param aList = the SCH_SHEET_PATH* that must be used * @param aList = the SCH_SHEET_PATH* that must be used
* @return true if found * @return true if found
*/ */
bool LocatePathOfScreen( SCH_SCREEN* aScreen, bool LocatePathOfScreen( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aList );
SCH_SHEET_PATH* aList );
/** /**
* Function CountSheets * Function CountSheets
@ -430,7 +422,6 @@ public:
m_FileName = aFilename; m_FileName = aFilename;
} }
/** /**
* Function ChangeFileName * Function ChangeFileName
* Set a new filename and manage data and associated screen * Set a new filename and manage data and associated screen
@ -464,7 +455,6 @@ public:
} }
} }
/** 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
@ -532,6 +522,10 @@ protected:
* label is added or removed. * label is added or removed.
*/ */
void renumberLabels(); void renumberLabels();
private:
virtual bool DoHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual bool DoHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const;
}; };
#endif /* CLASS_DRAWSHEET_H */ #endif /* CLASS_DRAWSHEET_H */

View File

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

View File

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

View File

@ -87,17 +87,6 @@ SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
} }
/**
* Function HitTest
* @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test
*/
bool SCH_TEXT::HitTest( const wxPoint& aPosRef )
{
return TextHitTest( aPosRef );
}
SCH_TEXT* SCH_TEXT::GenCopy() SCH_TEXT* SCH_TEXT::GenCopy()
{ {
SCH_TEXT* newitem; SCH_TEXT* newitem;
@ -105,19 +94,19 @@ SCH_TEXT* SCH_TEXT::GenCopy()
switch( Type() ) switch( Type() )
{ {
default: default:
case TYPE_SCH_TEXT: case SCH_TEXT_T:
newitem = new SCH_TEXT( m_Pos, m_Text ); newitem = new SCH_TEXT( m_Pos, m_Text );
break; break;
case TYPE_SCH_GLOBALLABEL: case SCH_GLOBAL_LABEL_T:
newitem = new SCH_GLOBALLABEL( m_Pos, m_Text ); newitem = new SCH_GLOBALLABEL( m_Pos, m_Text );
break; break;
case TYPE_SCH_HIERLABEL: case SCH_HIERARCHICAL_LABEL_T:
newitem = new SCH_HIERLABEL( m_Pos, m_Text ); newitem = new SCH_HIERLABEL( m_Pos, m_Text );
break; break;
case TYPE_SCH_LABEL: case SCH_LABEL_T:
newitem = new SCH_LABEL( m_Pos, m_Text ); newitem = new SCH_LABEL( m_Pos, m_Text );
break; break;
} }
@ -403,7 +392,7 @@ void SCH_TEXT::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
* 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_TEXT::GetPenSize() int SCH_TEXT::GetPenSize() const
{ {
int pensize = m_Thickness; int pensize = m_Thickness;
@ -443,6 +432,7 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aOffset,
EXCHG( linewidth, m_Thickness ); // Set the minimum width EXCHG( linewidth, m_Thickness ); // Set the minimum width
EDA_TextStruct::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR ); EDA_TextStruct::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
EXCHG( linewidth, m_Thickness ); // set initial value EXCHG( linewidth, m_Thickness ); // set initial value
if( m_IsDangling ) if( m_IsDangling )
DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color ); DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color );
@ -475,6 +465,7 @@ bool SCH_TEXT::Save( FILE* aFile ) const
for( ; ; ) for( ; ; )
{ {
int i = text.find( '\n' ); int i = text.find( '\n' );
if( i == wxNOT_FOUND ) if( i == wxNOT_FOUND )
break; break;
@ -545,6 +536,7 @@ bool SCH_TEXT::Load( LINE_READER& aLine, wxString& aErrorMsg )
if( i == wxNOT_FOUND ) if( i == wxNOT_FOUND )
break; break;
val.erase( i, 2 ); val.erase( i, 2 );
val.insert( i, wxT( "\n" ) ); val.insert( i, wxT( "\n" ) );
} }
@ -570,7 +562,7 @@ bool SCH_TEXT::Load( LINE_READER& aLine, wxString& aErrorMsg )
void SCH_TEXT::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ) void SCH_TEXT::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
{ {
// Normal text labels cannot be tested for dangling ends. // Normal text labels cannot be tested for dangling ends.
if( Type() == TYPE_SCH_TEXT ) if( Type() == SCH_TEXT_T )
return; return;
DANGLING_END_ITEM item( LABEL_END, this ); DANGLING_END_ITEM item( LABEL_END, this );
@ -582,7 +574,7 @@ void SCH_TEXT::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
bool SCH_TEXT::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList ) bool SCH_TEXT::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList )
{ {
// Normal text labels cannot be tested for dangling ends. // Normal text labels cannot be tested for dangling ends.
if( Type() == TYPE_SCH_TEXT ) if( Type() == SCH_TEXT_T )
return false; return false;
bool previousState = m_IsDangling; bool previousState = m_IsDangling;
@ -647,23 +639,22 @@ bool SCH_TEXT::IsSelectStateChanged( const wxRect& aRect )
void SCH_TEXT::GetConnectionPoints( vector< wxPoint >& aPoints ) const void SCH_TEXT::GetConnectionPoints( vector< wxPoint >& aPoints ) const
{ {
// Normal text labels do not have connection points. All others do. // Normal text labels do not have connection points. All others do.
if( Type() == TYPE_SCH_TEXT ) if( Type() == SCH_TEXT_T )
return; return;
aPoints.push_back( m_Pos ); aPoints.push_back( m_Pos );
} }
EDA_Rect SCH_TEXT::GetBoundingBox() EDA_Rect SCH_TEXT::GetBoundingBox() const
{ {
// We must pass the effective text thickness to GetTextBox // We must pass the effective text thickness to GetTextBox
// when calculating the bounding box // when calculating the bounding box
int linewidth = ( m_Thickness == 0 ) ? g_DrawDefaultLineThickness : m_Thickness; int linewidth = ( m_Thickness == 0 ) ? g_DrawDefaultLineThickness : m_Thickness;
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold ); linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
EXCHG( linewidth, m_Thickness ); // Set the real width
EDA_Rect rect = GetTextBox( -1 ); EDA_Rect rect = GetTextBox( -1, linewidth );
EXCHG( linewidth, m_Thickness ); // set initial value
if( m_Orient ) // Rotate rect if( m_Orient ) // Rotate rect
{ {
@ -680,6 +671,18 @@ EDA_Rect SCH_TEXT::GetBoundingBox()
} }
bool SCH_TEXT::DoHitTest( const wxPoint& aPoint, int aAccuracy ) const
{
return TextHitTest( aPoint, aAccuracy );
}
bool SCH_TEXT::DoHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const
{
return TextHitTest( aRect, aContained, aAccuracy );
}
#if defined(DEBUG) #if defined(DEBUG)
void SCH_TEXT::Show( int nestLevel, std::ostream& os ) void SCH_TEXT::Show( int nestLevel, std::ostream& os )
@ -733,7 +736,7 @@ void SCH_LABEL::SetSchematicTextOrientation( int aSchematicOrientation )
SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) : SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) :
SCH_TEXT( pos, text, TYPE_SCH_LABEL ) SCH_TEXT( pos, text, SCH_LABEL_T )
{ {
m_Layer = LAYER_LOCLABEL; m_Layer = LAYER_LOCLABEL;
m_Shape = NET_INPUT; m_Shape = NET_INPUT;
@ -867,7 +870,7 @@ void SCH_LABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
} }
EDA_Rect SCH_LABEL::GetBoundingBox() EDA_Rect SCH_LABEL::GetBoundingBox() const
{ {
int x, y, dx, dy, length, height; int x, y, dx, dy, length, height;
@ -916,7 +919,7 @@ EDA_Rect SCH_LABEL::GetBoundingBox()
SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) : SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) :
SCH_TEXT( pos, text, TYPE_SCH_GLOBALLABEL ) SCH_TEXT( pos, text, SCH_GLOBAL_LABEL_T )
{ {
m_Layer = LAYER_GLOBLABEL; m_Layer = LAYER_GLOBLABEL;
m_Shape = NET_BIDI; m_Shape = NET_BIDI;
@ -1014,19 +1017,6 @@ bool SCH_GLOBALLABEL::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 SCH_GLOBALLABEL::HitTest( const wxPoint& aPosRef )
{
EDA_Rect rect = GetBoundingBox();
return rect.Inside( aPosRef );
}
/** /**
* Function Mirror_Y (virtual) * Function Mirror_Y (virtual)
* mirror item relative to an Y axis * mirror item relative to an Y axis
@ -1317,7 +1307,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
} }
EDA_Rect SCH_GLOBALLABEL::GetBoundingBox() EDA_Rect SCH_GLOBALLABEL::GetBoundingBox() const
{ {
int x, y, dx, dy, length, height; int x, y, dx, dy, length, height;
@ -1467,19 +1457,6 @@ bool SCH_HIERLABEL::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 SCH_HIERLABEL::HitTest( const wxPoint& aPosRef )
{
EDA_Rect rect = GetBoundingBox();
return rect.Inside( aPosRef );
}
/** /**
* Function SetTextOrientAndJustifyParmeters * Function SetTextOrientAndJustifyParmeters
* Set m_SchematicOrientation, and initialize * Set m_SchematicOrientation, and initialize
@ -1598,7 +1575,7 @@ void SCH_HIERLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
} }
} }
EDA_Rect SCH_HIERLABEL::GetBoundingBox() EDA_Rect SCH_HIERLABEL::GetBoundingBox() const
{ {
int x, y, dx, dy, length, height; int x, y, dx, dy, length, height;

View File

@ -31,7 +31,6 @@ extern const char* SheetLabelType[]; /* names of types of labels */
class SCH_TEXT : public SCH_ITEM, public EDA_TextStruct class SCH_TEXT : public SCH_ITEM, public EDA_TextStruct
{ {
public: public:
int m_Layer;
int m_Shape; int m_Shape;
bool m_IsDangling; // true if not connected (used to draw the "not bool m_IsDangling; // true if not connected (used to draw the "not
// connected" symbol // connected" symbol
@ -56,7 +55,7 @@ protected:
public: public:
SCH_TEXT( const wxPoint& pos = wxPoint( 0, 0 ), SCH_TEXT( const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString, const wxString& text = wxEmptyString,
KICAD_T aType = TYPE_SCH_TEXT ); KICAD_T aType = SCH_TEXT_T );
~SCH_TEXT() { } ~SCH_TEXT() { }
virtual wxString GetClass() const virtual wxString GetClass() const
@ -93,6 +92,7 @@ public:
virtual wxPoint GetSchematicTextOffset(); virtual wxPoint GetSchematicTextOffset();
SCH_TEXT* GenCopy(); SCH_TEXT* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, virtual void Draw( WinEDA_DrawPanel* panel,
wxDC* DC, wxDC* DC,
const wxPoint& offset, const wxPoint& offset,
@ -107,22 +107,15 @@ public:
* for texts and labels: do nothing * for texts and labels: do nothing
* Mainly for derived classes (SCH_SHEET_PIN and Hierarchical labels) * Mainly for derived classes (SCH_SHEET_PIN and Hierarchical labels)
*/ */
virtual void CreateGraphicShape( std::vector <wxPoint>& aCorner_list, virtual void CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& Pos )
const wxPoint& Pos )
{ {
aCorner_list.clear(); aCorner_list.clear();
} }
void SwapData( SCH_TEXT* copyitem ); void SwapData( SCH_TEXT* copyitem );
void Place( SCH_EDIT_FRAME* frame, wxDC* DC ); void Place( SCH_EDIT_FRAME* frame, wxDC* DC );
/**
* 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 purposes. * returns the orthogonal, bounding box of this object for display purposes.
@ -130,7 +123,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;
/** /**
* Function Save * Function Save
@ -155,7 +148,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
*/ */
int GetPenSize(); int GetPenSize() const;
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
@ -200,17 +193,20 @@ public:
#if defined(DEBUG) #if defined(DEBUG)
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;
}; };
class SCH_LABEL : public SCH_TEXT class SCH_LABEL : public SCH_TEXT
{ {
public: public:
SCH_LABEL( const wxPoint& pos = wxPoint( 0, 0 ), SCH_LABEL( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
const wxString& text = wxEmptyString );
~SCH_LABEL() { } ~SCH_LABEL() { }
virtual void Draw( WinEDA_DrawPanel* panel, virtual void Draw( WinEDA_DrawPanel* panel,
wxDC* DC, wxDC* DC,
const wxPoint& offset, const wxPoint& offset,
@ -257,7 +253,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;
/** /**
* Function Save * Function Save
@ -283,9 +279,9 @@ public:
class SCH_GLOBALLABEL : public SCH_TEXT class SCH_GLOBALLABEL : public SCH_TEXT
{ {
public: public:
SCH_GLOBALLABEL( const wxPoint& pos = wxPoint( 0, 0 ), SCH_GLOBALLABEL( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
const wxString& text = wxEmptyString );
~SCH_GLOBALLABEL() { } ~SCH_GLOBALLABEL() { }
virtual void Draw( WinEDA_DrawPanel* panel, virtual void Draw( WinEDA_DrawPanel* panel,
wxDC* DC, wxDC* DC,
const wxPoint& offset, const wxPoint& offset,
@ -342,13 +338,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 purposes. * returns the orthogonal, bounding box of this object for display purposes.
@ -356,7 +345,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;
/** /**
* Function CreateGraphicShape (virual) * Function CreateGraphicShape (virual)
@ -381,7 +370,9 @@ class SCH_HIERLABEL : public SCH_TEXT
{ {
public: public:
SCH_HIERLABEL( const wxPoint& pos = wxPoint( 0, 0 ), SCH_HIERLABEL( const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString, KICAD_T aType = TYPE_SCH_HIERLABEL ); const wxString& text = wxEmptyString,
KICAD_T aType = SCH_HIERARCHICAL_LABEL_T );
~SCH_HIERLABEL() { } ~SCH_HIERLABEL() { }
virtual void Draw( WinEDA_DrawPanel* panel, virtual void Draw( WinEDA_DrawPanel* panel,
wxDC* DC, wxDC* DC,
@ -448,13 +439,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 purposes. * returns the orthogonal, bounding box of this object for display purposes.
@ -462,7 +446,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;
/** virtual function Mirror_Y /** virtual function Mirror_Y
* mirror item relative to an Y axis * mirror item relative to an Y axis

View File

@ -277,22 +277,22 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, TYPE_SCH_LABEL ); ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_LABEL_T );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, TYPE_SCH_GLOBALLABEL ); ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_GLOBAL_LABEL_T );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, TYPE_SCH_HIERLABEL ); ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_HIERARCHICAL_LABEL_T );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, TYPE_SCH_TEXT ); ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_TEXT_T );
break; break;
case ID_POPUP_SCH_SET_SHAPE_TEXT: case ID_POPUP_SCH_SET_SHAPE_TEXT:
@ -338,7 +338,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != SCH_COMPONENT_T )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
case ID_POPUP_SCH_DELETE: case ID_POPUP_SCH_DELETE:
@ -378,12 +378,12 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_IMPORT_GLABEL: case ID_POPUP_IMPORT_GLABEL:
if( screen->GetCurItem() && screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE ) if( screen->GetCurItem() && screen->GetCurItem()->Type() == SCH_SHEET_T )
GetScreen()->SetCurItem( Import_PinSheet( (SCH_SHEET*) screen->GetCurItem(), &dc ) ); GetScreen()->SetCurItem( Import_PinSheet( (SCH_SHEET*) screen->GetCurItem(), &dc ) );
break; break;
case ID_POPUP_SCH_CLEANUP_SHEET: case ID_POPUP_SCH_CLEANUP_SHEET:
if( screen->GetCurItem() && screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE ) if( screen->GetCurItem() && screen->GetCurItem()->Type() == SCH_SHEET_T )
{ {
SCH_SHEET* sheet = (SCH_SHEET*) screen->GetCurItem(); SCH_SHEET* sheet = (SCH_SHEET*) screen->GetCurItem();
@ -420,11 +420,11 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) or a hierachical sheet // component, like Field, text..) or a hierachical sheet
// or a label // or a label
if( (screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT) if( (screen->GetCurItem()->Type() != SCH_COMPONENT_T)
&& (screen->GetCurItem()->Type() != TYPE_SCH_LABEL) && (screen->GetCurItem()->Type() != SCH_LABEL_T)
&& (screen->GetCurItem()->Type() != TYPE_SCH_GLOBALLABEL) && (screen->GetCurItem()->Type() != SCH_GLOBAL_LABEL_T)
&& (screen->GetCurItem()->Type() != TYPE_SCH_HIERLABEL) && (screen->GetCurItem()->Type() != SCH_HIERARCHICAL_LABEL_T)
&& (screen->GetCurItem()->Type() != DRAW_SHEET_STRUCT_TYPE) ) && (screen->GetCurItem()->Type() != SCH_SHEET_T) )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
@ -487,7 +487,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != SCH_COMPONENT_T )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
@ -504,7 +504,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != SCH_COMPONENT_T )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
@ -548,7 +548,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != SCH_COMPONENT_T )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
@ -561,7 +561,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != SCH_COMPONENT_T )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
@ -574,7 +574,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != SCH_COMPONENT_T )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
@ -588,7 +588,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != SCH_COMPONENT_T )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
@ -627,7 +627,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != SCH_COMPONENT_T )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
@ -642,7 +642,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a piece of a // Ensure the struct is a component (could be a piece of a
// component, like Field, text..) // component, like Field, text..)
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != SCH_COMPONENT_T )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
@ -664,7 +664,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{ {
EDA_ITEM* DrawStruct = screen->GetCurItem(); EDA_ITEM* DrawStruct = screen->GetCurItem();
if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) ) if( DrawStruct && (DrawStruct->Type() == SCH_SHEET_T) )
{ {
InstallNextScreen( (SCH_SHEET*) DrawStruct ); InstallNextScreen( (SCH_SHEET*) DrawStruct );
} }
@ -744,7 +744,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_SCH_GETINFO_MARKER: case ID_POPUP_SCH_GETINFO_MARKER:
if( screen->GetCurItem() && screen->GetCurItem()->Type() == TYPE_SCH_MARKER ) if( screen->GetCurItem() && screen->GetCurItem()->Type() == SCH_MARKER_T )
( (SCH_MARKER*) screen->GetCurItem() )->DisplayMarkerInfo( this ); ( (SCH_MARKER*) screen->GetCurItem() )->DisplayMarkerInfo( this );
break; break;
@ -772,40 +772,40 @@ void SCH_EDIT_FRAME::Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC )
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {
case DRAW_JUNCTION_STRUCT_TYPE: case SCH_JUNCTION_T:
break; break;
case DRAW_BUSENTRY_STRUCT_TYPE: case SCH_BUS_ENTRY_T:
StartMoveBusEntry( (SCH_BUS_ENTRY*) DrawStruct, DC ); StartMoveBusEntry( (SCH_BUS_ENTRY*) DrawStruct, DC );
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:
case TYPE_SCH_TEXT: case SCH_TEXT_T:
StartMoveTexte( (SCH_TEXT*) DrawStruct, DC ); StartMoveTexte( (SCH_TEXT*) DrawStruct, DC );
break; break;
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
StartMovePart( (SCH_COMPONENT*) DrawStruct, DC ); StartMovePart( (SCH_COMPONENT*) DrawStruct, DC );
break; break;
case DRAW_SEGMENT_STRUCT_TYPE: case SCH_LINE_T:
break; break;
case DRAW_SHEET_STRUCT_TYPE: case SCH_SHEET_T:
StartMoveSheet( (SCH_SHEET*) DrawStruct, DC ); StartMoveSheet( (SCH_SHEET*) DrawStruct, DC );
break; break;
case DRAW_NOCONNECT_STRUCT_TYPE: case SCH_NO_CONNECT_T:
break; break;
case DRAW_PART_TEXT_STRUCT_TYPE: case SCH_FIELD_T:
StartMoveCmpField( (SCH_FIELD*) DrawStruct, DC ); StartMoveCmpField( (SCH_FIELD*) DrawStruct, DC );
break; break;
case TYPE_SCH_MARKER: case SCH_MARKER_T:
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case SCH_SHEET_LABEL_T:
default: default:
wxString msg; wxString msg;
msg.Printf( wxT( "SCH_EDIT_FRAME::Move_Item Error: Bad DrawType %d" ), msg.Printf( wxT( "SCH_EDIT_FRAME::Move_Item Error: Bad DrawType %d" ),

View File

@ -88,14 +88,14 @@ void SwapData( EDA_ITEM* aItem, EDA_ITEM* aImage )
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case DRAW_POLYLINE_STRUCT_TYPE: case SCH_POLYLINE_T:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ( (SCH_POLYLINE*) aItem ) #define SOURCE ( (SCH_POLYLINE*) aItem )
#define DEST ( (SCH_POLYLINE*) aImage ) #define DEST ( (SCH_POLYLINE*) aImage )
break; break;
case DRAW_JUNCTION_STRUCT_TYPE: case SCH_JUNCTION_T:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ( (SCH_JUNCTION*) aItem ) #define SOURCE ( (SCH_JUNCTION*) aItem )
@ -103,10 +103,10 @@ void SwapData( EDA_ITEM* aItem, EDA_ITEM* aImage )
EXCHG( SOURCE->m_Pos, DEST->m_Pos ); EXCHG( SOURCE->m_Pos, DEST->m_Pos );
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:
case TYPE_SCH_TEXT: case SCH_TEXT_T:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ( (SCH_TEXT*) aItem ) #define SOURCE ( (SCH_TEXT*) aItem )
@ -114,7 +114,7 @@ void SwapData( EDA_ITEM* aItem, EDA_ITEM* aImage )
DEST->SwapData( SOURCE ); DEST->SwapData( SOURCE );
break; break;
case TYPE_SCH_COMPONENT: case SCH_COMPONENT_T:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ( (SCH_COMPONENT*) aItem ) #define SOURCE ( (SCH_COMPONENT*) aItem )
@ -122,7 +122,7 @@ void SwapData( EDA_ITEM* aItem, EDA_ITEM* aImage )
DEST->SwapData( SOURCE ); DEST->SwapData( SOURCE );
break; break;
case DRAW_SEGMENT_STRUCT_TYPE: case SCH_LINE_T:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ( (SCH_LINE*) aItem ) #define SOURCE ( (SCH_LINE*) aItem )
@ -131,7 +131,7 @@ void SwapData( EDA_ITEM* aItem, EDA_ITEM* aImage )
EXCHG( SOURCE->m_End, DEST->m_End ); EXCHG( SOURCE->m_End, DEST->m_End );
break; break;
case DRAW_BUSENTRY_STRUCT_TYPE: case SCH_BUS_ENTRY_T:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ( (SCH_BUS_ENTRY*) aItem ) #define SOURCE ( (SCH_BUS_ENTRY*) aItem )
@ -140,7 +140,7 @@ void SwapData( EDA_ITEM* aItem, EDA_ITEM* aImage )
EXCHG( SOURCE->m_Size, DEST->m_Size ); EXCHG( SOURCE->m_Size, DEST->m_Size );
break; break;
case DRAW_SHEET_STRUCT_TYPE: case SCH_SHEET_T:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ( (SCH_SHEET*) aItem ) #define SOURCE ( (SCH_SHEET*) aItem )
@ -148,7 +148,7 @@ void SwapData( EDA_ITEM* aItem, EDA_ITEM* aImage )
DEST->SwapData( SOURCE ); DEST->SwapData( SOURCE );
break; break;
case TYPE_SCH_MARKER: case SCH_MARKER_T:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ( (SCH_MARKER*) aItem ) #define SOURCE ( (SCH_MARKER*) aItem )
@ -156,7 +156,7 @@ void SwapData( EDA_ITEM* aItem, EDA_ITEM* aImage )
EXCHG( SOURCE->m_Pos, DEST->m_Pos ); EXCHG( SOURCE->m_Pos, DEST->m_Pos );
break; break;
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case SCH_SHEET_LABEL_T:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ( (SCH_SHEET_PIN*) aItem ) #define SOURCE ( (SCH_SHEET_PIN*) aItem )
@ -164,7 +164,7 @@ void SwapData( EDA_ITEM* aItem, EDA_ITEM* aImage )
DEST->SwapData( SOURCE ); DEST->SwapData( SOURCE );
break; break;
case DRAW_NOCONNECT_STRUCT_TYPE: case SCH_NO_CONNECT_T:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ( (SCH_NO_CONNECT*) aItem ) #define SOURCE ( (SCH_NO_CONNECT*) aItem )
@ -172,7 +172,7 @@ void SwapData( EDA_ITEM* aItem, EDA_ITEM* aImage )
EXCHG( SOURCE->m_Pos, DEST->m_Pos ); EXCHG( SOURCE->m_Pos, DEST->m_Pos );
break; break;
case DRAW_PART_TEXT_STRUCT_TYPE: case SCH_FIELD_T:
break; break;
// not directly used in schematic: // not directly used in schematic:

View File

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

View File

@ -65,7 +65,7 @@ void SCH_SHEET_PIN::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
{ {
SCH_SHEET* Sheet = (SCH_SHEET*) GetParent(); SCH_SHEET* Sheet = (SCH_SHEET*) GetParent();
wxASSERT( Sheet != NULL && Sheet->Type() == DRAW_SHEET_STRUCT_TYPE ); wxASSERT( Sheet != NULL && Sheet->Type() == SCH_SHEET_T );
SAFE_DELETE( g_ItemToUndoCopy ); SAFE_DELETE( g_ItemToUndoCopy );
int flags = m_Flags; int flags = m_Flags;
@ -213,7 +213,7 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::Import_PinSheet( SCH_SHEET* Sheet, wxDC* DC )
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{ {
if( DrawStruct->Type() != TYPE_SCH_HIERLABEL ) if( DrawStruct->Type() != SCH_HIERARCHICAL_LABEL_T )
continue; continue;
HLabel = (SCH_HIERLABEL*) DrawStruct; HLabel = (SCH_HIERLABEL*) DrawStruct;
@ -260,7 +260,7 @@ void SCH_EDIT_FRAME::DeleteSheetLabel( bool aRedraw, SCH_SHEET_PIN* aSheetLabelT
SCH_SHEET* parent = (SCH_SHEET*) aSheetLabelToDel->GetParent(); SCH_SHEET* parent = (SCH_SHEET*) aSheetLabelToDel->GetParent();
wxASSERT( parent ); wxASSERT( parent );
wxASSERT( parent->Type() == DRAW_SHEET_STRUCT_TYPE ); wxASSERT( parent->Type() == SCH_SHEET_T );
#if 0 && defined(DEBUG) #if 0 && defined(DEBUG)
std::cout << "\n\nbefore deleting:\n" << std::flush; std::cout << "\n\nbefore deleting:\n" << std::flush;

View File

@ -90,7 +90,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol( void )
BOOST_FOREACH( LIB_DRAW_ITEM& item, drawList ) BOOST_FOREACH( LIB_DRAW_ITEM& item, drawList )
{ {
if( item.Type() == COMPONENT_FIELD_DRAW_TYPE ) if( item.Type() == LIB_FIELD_T )
continue; continue;
if( item.GetUnit() ) if( item.GetUnit() )
item.SetUnit( m_unit ); item.SetUnit( m_unit );
@ -200,11 +200,13 @@ void LIB_EDIT_FRAME::SaveOneSymbol()
BOOST_FOREACH( LIB_DRAW_ITEM& item, drawList ) BOOST_FOREACH( LIB_DRAW_ITEM& item, drawList )
{ {
if( item.Type() == COMPONENT_FIELD_DRAW_TYPE ) if( item.Type() == LIB_FIELD_T )
continue; continue;
/* Don't save unused parts or alternate body styles. */ /* Don't save unused parts or alternate body styles. */
if( m_unit && item.GetUnit() && ( item.GetUnit() != m_unit ) ) if( m_unit && item.GetUnit() && ( item.GetUnit() != m_unit ) )
continue; continue;
if( m_convert && item.GetConvert() && ( item.GetConvert() != m_convert ) ) if( m_convert && item.GetConvert() && ( item.GetConvert() != m_convert ) )
continue; continue;
@ -212,8 +214,7 @@ void LIB_EDIT_FRAME::SaveOneSymbol()
return; return;
} }
if( !file.Write( wxT( "ENDDRAW\n" ) ) if( !file.Write( wxT( "ENDDRAW\n" ) ) || !file.Write( wxT( "ENDDEF\n" ) ) )
|| !file.Write( wxT( "ENDDEF\n" ) ) )
return; return;
} }

View File

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

View File

@ -113,7 +113,7 @@ GERBER_DRAW_ITEM* GERBER_DRAW_ITEM::Copy() const
* @return const wxPoint& - The position in A,B axis. * @return const wxPoint& - The position in A,B axis.
* Because draw axis is top to bottom, the final y coordinates is negated * Because draw axis is top to bottom, the final y coordinates is negated
*/ */
wxPoint GERBER_DRAW_ITEM::GetABPosition( const wxPoint& aXYPosition ) wxPoint GERBER_DRAW_ITEM::GetABPosition( const wxPoint& aXYPosition ) const
{ {
/* Note: RS274Xrevd_e is obscure about the order of transforms: /* Note: RS274Xrevd_e is obscure about the order of transforms:
* For instance: Rotation must be made after or before mirroring ? * For instance: Rotation must be made after or before mirroring ?
@ -255,7 +255,7 @@ D_CODE* GERBER_DRAW_ITEM::GetDcodeDescr()
} }
EDA_Rect GERBER_DRAW_ITEM::GetBoundingBox() EDA_Rect GERBER_DRAW_ITEM::GetBoundingBox() const
{ {
// return a rectangle which is (pos,dim) in nature. therefore the +1 // return a rectangle which is (pos,dim) in nature. therefore the +1
EDA_Rect bbox( m_Start, wxSize( 1, 1 ) ); EDA_Rect bbox( m_Start, wxSize( 1, 1 ) );

View File

@ -168,7 +168,7 @@ public:
* @param aXYPosition = position in X,Y gerber axis * @param aXYPosition = position in X,Y gerber axis
* @return const wxPoint - The given position in plotter A,B axis. * @return const wxPoint - The given position in plotter A,B axis.
*/ */
wxPoint GetABPosition(const wxPoint& aXYPosition ); wxPoint GetABPosition( const wxPoint& aXYPosition ) const;
/** /**
* Function GetXYPosition * Function GetXYPosition
@ -187,7 +187,7 @@ public:
*/ */
D_CODE* GetDcodeDescr(); D_CODE* GetDcodeDescr();
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox() const;
/* Display on screen: */ /* Display on screen: */
void Draw( WinEDA_DrawPanel* aPanel, void Draw( WinEDA_DrawPanel* aPanel,

View File

@ -44,23 +44,23 @@ enum KICAD_T {
TYPE_BOARD_ITEM_LIST, // a list of board items TYPE_BOARD_ITEM_LIST, // a list of board items
// Draw Items in schematic // Draw Items in schematic
DRAW_POLYLINE_STRUCT_TYPE, SCH_POLYLINE_T,
DRAW_JUNCTION_STRUCT_TYPE, SCH_JUNCTION_T,
TYPE_SCH_TEXT, SCH_TEXT_T,
TYPE_SCH_LABEL, SCH_LABEL_T,
TYPE_SCH_GLOBALLABEL, SCH_GLOBAL_LABEL_T,
TYPE_SCH_HIERLABEL, SCH_HIERARCHICAL_LABEL_T,
TYPE_SCH_COMPONENT, SCH_COMPONENT_T,
DRAW_SEGMENT_STRUCT_TYPE, SCH_LINE_T,
DRAW_BUSENTRY_STRUCT_TYPE, SCH_BUS_ENTRY_T,
DRAW_SHEET_STRUCT_TYPE, SCH_SHEET_T,
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE, SCH_SHEET_LABEL_T,
TYPE_SCH_MARKER, SCH_MARKER_T,
DRAW_NOCONNECT_STRUCT_TYPE, SCH_NO_CONNECT_T,
DRAW_PART_TEXT_STRUCT_TYPE, SCH_FIELD_T,
// General // General
SCREEN_STRUCT_TYPE, SCH_SCREEN_T,
BLOCK_LOCATE_STRUCT_TYPE, BLOCK_LOCATE_STRUCT_TYPE,
/* /*
@ -73,20 +73,19 @@ enum KICAD_T {
*/ */
LIB_COMPONENT_T, LIB_COMPONENT_T,
LIB_ALIAS_T, LIB_ALIAS_T,
COMPONENT_ARC_DRAW_TYPE, LIB_ARC_T,
COMPONENT_CIRCLE_DRAW_TYPE, LIB_CIRCLE_T,
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE, LIB_TEXT_T,
COMPONENT_RECT_DRAW_TYPE, LIB_RECTANGLE_T,
COMPONENT_POLYLINE_DRAW_TYPE, LIB_POLYLINE_T,
COMPONENT_LINE_DRAW_TYPE, LIB_BEZIER_T,
COMPONENT_BEZIER_DRAW_TYPE, LIB_PIN_T,
COMPONENT_PIN_DRAW_TYPE,
/* /*
* Fields are not saved inside the "DRAW/ENDDRAW". Add new draw item * Fields are not saved inside the "DRAW/ENDDRAW". Add new draw item
* types before this line. * types before this line.
*/ */
COMPONENT_FIELD_DRAW_TYPE, LIB_FIELD_T,
/* /*
* For Gerbview: items type: * For Gerbview: items type:
@ -175,14 +174,15 @@ public:
void Move( const wxPoint& aMoveVector ); void Move( const wxPoint& aMoveVector );
void Normalize(); // Ensure the height and width are >= 0 void Normalize(); // Ensure the height and width are >= 0
bool Inside( const wxPoint& point ); // Return TRUE if point is in Rect bool Inside( const wxPoint& point ) const; // Return TRUE if point is in Rect
bool Inside( int x, int y ) { return Inside( wxPoint( x, y ) ); } bool Inside( int x, int y ) const { return Inside( wxPoint( x, y ) ); }
wxSize GetSize() { return m_Size; } bool Inside( const EDA_Rect& aRect ) const;
wxSize GetSize() const { return m_Size; }
int GetX() const { return m_Pos.x; } int GetX() const { return m_Pos.x; }
int GetY() const { return m_Pos.y; } int GetY() const { return m_Pos.y; }
wxPoint GetOrigin() { return m_Pos; } wxPoint GetOrigin() const { return m_Pos; }
wxPoint GetPosition() { return m_Pos; } wxPoint GetPosition() const { return m_Pos; }
wxPoint GetEnd() const { return wxPoint( GetRight(), GetBottom() ); } wxPoint GetEnd() const { return wxPoint( GetRight(), GetBottom() ); }
int GetWidth() const { return m_Size.x; } int GetWidth() const { return m_Size.x; }
int GetHeight() const { return m_Size.y; } int GetHeight() const { return m_Size.y; }
@ -427,12 +427,11 @@ public:
* system. * 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
{ {
#if defined(DEBUG) #if defined(DEBUG)
printf( "Missing GetBoundingBox()\n" ); printf( "Missing GetBoundingBox()\n" );
Show( 0, std::cout ); // tell me which classes still need Show( 0, std::cout ); // tell me which classes still need GetBoundingBox support
// GetBoundingBox support
#endif #endif
// return a zero-sized box per default. derived classes should override // return a zero-sized box per default. derived classes should override
@ -502,7 +501,7 @@ public:
* 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.
*/ */
virtual void Show( int nestLevel, std::ostream& os ); virtual void Show( int nestLevel, std::ostream& os ) const;
/** /**
@ -634,20 +633,23 @@ public:
/** /**
* Function TextHitTest * Function TextHitTest
* tests if the given wxPoint is within the bounds of this object. * Test if \a aPoint is within the bounds of this object.
* @param ref_pos A wxPoint to test * @param aPoint- A wxPoint to test
* @param aAccuracy - Amount to inflate the bounding box.
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
bool TextHitTest( const wxPoint& ref_pos ); bool TextHitTest( const wxPoint& aPoint, int aAccuracy = 0 ) const;
/** /**
* Function TextHitTest (overloaded) * Function TextHitTest (overloaded)
* tests if the given EDA_Rect intersect this object. * Tests if object bounding box is contained within or intersects \a aRect.
* For now, the anchor must be inside this rect. *
* @param refArea : the given EDA_Rect * @param aRect - Rect to test against.
* @param aContains - Test for containment instead of intersection if true.
* @param aAccuracy - Amount to inflate the bounding box.
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
bool TextHitTest( EDA_Rect& refArea ); bool TextHitTest( const EDA_Rect& aRect, bool aContains = false, int aAccuracy = 0 ) const;
/** /**
* Function LenSize * Function LenSize
@ -668,15 +670,17 @@ public:
* @param aLine : the line of text to consider. * @param aLine : the line of text to consider.
* for single line text, aLine is unused * for single line text, aLine is unused
* If aLine == -1, the full area (considering all lines) is returned * If aLine == -1, the full area (considering all lines) is returned
* @param aThickness - Overrides the current thickness when greater than 0.
* @param aInvertY - Invert the Y axis when calculating bounding box.
*/ */
EDA_Rect GetTextBox( int aLine = -1 ); EDA_Rect GetTextBox( int aLine = -1, int aThickness = -1, bool aInvertY = false ) const;
/** /**
* Function GetInterline * Function GetInterline
* return the distance between 2 text lines * return the distance between 2 text lines
* has meaning only for multiline texts * has meaning only for multiline texts
*/ */
int GetInterline() int GetInterline() const
{ {
return (( m_Size.y * 14 ) / 10) + m_Thickness; return (( m_Size.y * 14 ) / 10) + m_Thickness;
} }

View File

@ -146,7 +146,7 @@ public:
bool m_IsPrinting; bool m_IsPrinting;
public: public:
BASE_SCREEN( KICAD_T aType = SCREEN_STRUCT_TYPE ); BASE_SCREEN( KICAD_T aType = TYPE_SCREEN );
~BASE_SCREEN(); ~BASE_SCREEN();
/** /**

View File

@ -187,7 +187,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 GetBoundingBoxMarker(); EDA_Rect GetBoundingBoxMarker() const;
}; };

View File

@ -20,7 +20,7 @@ public:
int m_RefCount; ///< Number of sheets referencing this screen. int m_RefCount; ///< Number of sheets referencing this screen.
///< Delete when it goes to zero. ///< Delete when it goes to zero.
SCH_SCREEN( KICAD_T aType = SCREEN_STRUCT_TYPE ); SCH_SCREEN( KICAD_T aType = SCH_SCREEN_T );
~SCH_SCREEN(); ~SCH_SCREEN();
/** /**

View File

@ -89,20 +89,20 @@ public:
* Function GetPenSize virtual pure * Function GetPenSize virtual pure
* @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( ) = 0; virtual int GetPenSize() const { return 0; }
/** /**
* Function Draw * Function Draw
*/ */
virtual void Draw( WinEDA_DrawPanel* panel, virtual void Draw( WinEDA_DrawPanel* aPanel,
wxDC* DC, wxDC* aDC,
const wxPoint& offset, const wxPoint& aOffset,
int draw_mode, int aDrawMode,
int Color = -1 ) = 0; int aColor = -1 ) = 0;
/* Place function */ /* Place function */
virtual void Place( SCH_EDIT_FRAME* frame, wxDC* DC ); virtual void Place( SCH_EDIT_FRAME* aFrame, wxDC* aDC );
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** virtual function Move /** virtual function Move
@ -222,6 +222,46 @@ public:
* Do not use the vector erase method on the connection list. * Do not use the vector erase method on the connection list.
*/ */
void ClearConnections() { m_connections.release(); } void ClearConnections() { m_connections.release(); }
/**
* Function HitTest().
* Test if \a aPoint is contained within the bounding box or on an item.
*
* @param aPoint - Point to test.
* @param aAccuracy - Increase the item bounding box by this amount.
* @return True if \aPoint is within the item.
*/
bool HitTest( const wxPoint& aPoint, int aAccuracy = 0 ) const
{
return DoHitTest( aPoint, aAccuracy );
}
/**
* Function HitTest().
* Test if \a aRect intersects or is contained within the bounding box of an item.
*
* @param aRect - Rectangle to test.
* @param aContained - Set to true to test for containment instead of an intersection.
* @param aAccuracy - Increase the item bounding box by this amount.
* @return True if \aRect contains or intersects the item bounding box.
*/
bool HitTest( const EDA_Rect& aRect, bool aContained = false, int aAccuracy = 0 ) const
{
return DoHitTest( aRect, aContained, aAccuracy );
}
/**
* @note - The DoXXX() functions below are used to enforce the interface while retaining
* the ability of change the implementation behavior of derived classes. See
* Herb Sutters explanation of virtuality as to why you might want to do this at:
* http://www.gotw.ca/publications/mill18.htm.
*/
private:
virtual bool DoHitTest( const wxPoint& aPoint, int aAccuracy ) const { return false; }
virtual bool DoHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const
{
return false;
}
}; };
#endif /* SCH_ITEM_STRUCT_H */ #endif /* SCH_ITEM_STRUCT_H */

View File

@ -62,7 +62,7 @@ void EDGE_MODULE::Copy( EDGE_MODULE* source )
* 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 EDGE_MODULE::GetBoundingBox() EDA_Rect EDGE_MODULE::GetBoundingBox() const
{ {
EDA_Rect bbox; EDA_Rect bbox;

View File

@ -80,7 +80,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;
/** /**
* Function HitTest * Function HitTest

View File

@ -714,6 +714,31 @@ void MODULE::Set_Rectangle_Encadrement()
} }
EDA_Rect MODULE::GetFootPrintRect() const
{
EDA_Rect area;
area.m_Pos = m_Pos;
area.SetEnd( m_Pos );
area.Inflate( 500 ); // Give a min size
for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings.GetFirst(); edge; edge = edge->Next() )
{
if( edge->Type() != TYPE_EDGE_MODULE ) // Shoud not occur
continue;
area.Merge( edge->GetBoundingBox() );
}
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{
area.Merge( pad->GetBoundingBox() );
}
return area;
}
/* Equivalent to Module::Set_Rectangle_Encadrement() but in board coordinates: /* Equivalent to Module::Set_Rectangle_Encadrement() but in board coordinates:
* Updates the module bounding box on the board * Updates the module bounding box on the board
* The rectangle is the rectangle with outlines and pads, but not the fields * The rectangle is the rectangle with outlines and pads, but not the fields
@ -721,29 +746,9 @@ void MODULE::Set_Rectangle_Encadrement()
*/ */
void MODULE::SetRectangleExinscrit() void MODULE::SetRectangleExinscrit()
{ {
m_RealBoundaryBox.m_Pos = m_Pos; m_RealBoundaryBox = GetFootPrintRect();
m_RealBoundaryBox.SetEnd( m_Pos );
m_RealBoundaryBox.Inflate( 500 ); // Give a min size
for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings.GetFirst(); m_Surface = ABS( (double) m_RealBoundaryBox.GetWidth() * m_RealBoundaryBox.GetHeight() );
edge; edge = edge->Next() )
{
if( edge->Type() != TYPE_EDGE_MODULE ) // Shoud not occur
continue;
EDA_Rect rect = edge->GetBoundingBox();
m_RealBoundaryBox.Merge( rect );
}
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{
EDA_Rect rect = pad->GetBoundingBox();
m_RealBoundaryBox.Merge( rect );
}
m_Surface = ABS( (double) m_RealBoundaryBox.GetWidth()
* m_RealBoundaryBox.GetHeight() );
} }
@ -752,11 +757,9 @@ void MODULE::SetRectangleExinscrit()
* returns the full bounding box of this Footprint, including fields * returns the full bounding box of this Footprint, including fields
* Mainly used to redraw the screen area occupied by the footprint * Mainly used to redraw the screen area occupied by the footprint
*/ */
EDA_Rect MODULE::GetBoundingBox() EDA_Rect MODULE::GetBoundingBox() const
{ {
// Calculate area without text fields: EDA_Rect area = GetFootPrintRect();;
SetRectangleExinscrit();
EDA_Rect area = m_RealBoundaryBox;
// Calculate extended area including text field: // Calculate extended area including text field:
EDA_Rect text_area; EDA_Rect text_area;
@ -766,11 +769,11 @@ EDA_Rect MODULE::GetBoundingBox()
text_area = m_Value->GetBoundingBox(); text_area = m_Value->GetBoundingBox();
area.Merge( text_area ); area.Merge( text_area );
for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings.GetFirst(); edge; for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings.GetFirst(); edge; edge = edge->Next() )
edge = edge->Next() )
{ {
if( edge->Type() != TYPE_TEXTE_MODULE ) if( edge->Type() != TYPE_TEXTE_MODULE )
continue; continue;
text_area = ( (TEXTE_MODULE*) edge )->GetBoundingBox(); text_area = ( (TEXTE_MODULE*) edge )->GetBoundingBox();
area.Merge( text_area ); area.Merge( text_area );
} }
@ -797,11 +800,11 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame )
BOARD* board = GetBoard(); BOARD* board = GetBoard();
frame->EraseMsgBox(); frame->EraseMsgBox();
if( frame->m_Ident != PCB_FRAME ) if( frame->m_Ident != PCB_FRAME )
flag = TRUE; flag = TRUE;
frame->AppendMsgPanel( m_Reference->m_Text, m_Value->m_Text, frame->AppendMsgPanel( m_Reference->m_Text, m_Value->m_Text, DARKCYAN );
DARKCYAN );
if( flag ) // Display last date the component was edited( useful in Module Editor) if( flag ) // Display last date the component was edited( useful in Module Editor)
{ {

View File

@ -123,12 +123,18 @@ public:
*/ */
void SetRectangleExinscrit(); void SetRectangleExinscrit();
/**
* Function GetFootPrintRect()
* Returns the area of the module footprint excluding any text.
*/
EDA_Rect GetFootPrintRect() const;
/** /**
* Function GetBoundingBox * Function GetBoundingBox
* returns the bounding box of this Footprint * returns the bounding box of this Footprint
* Mainly used to redraw the screen area occupied by the footprint * Mainly used to redraw the screen area occupied by the footprint
*/ */
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox() const;
/** /**
* Function GetPosition * Function GetPosition

View File

@ -55,32 +55,41 @@ D_PAD::~D_PAD()
/* Calculate the radius of the circle containing the pad. /* Calculate the radius of the circle containing the pad.
*/ */
void D_PAD::ComputeShapeMaxRadius() int D_PAD::GetMaxRadius() const
{ {
int x, y, radius;
switch( m_PadShape & 0x7F ) switch( m_PadShape & 0x7F )
{ {
case PAD_CIRCLE: case PAD_CIRCLE:
m_ShapeMaxRadius = m_Size.x / 2; radius = m_Size.x / 2;
break; break;
case PAD_OVAL: case PAD_OVAL:
m_ShapeMaxRadius = MAX( m_Size.x, m_Size.y ) / 2; radius = MAX( m_Size.x, m_Size.y ) / 2;
break; break;
case PAD_RECT: case PAD_RECT:
m_ShapeMaxRadius = 1 + (int) ( sqrt( (double) m_Size.y * m_Size.y radius = 1 + (int) ( sqrt( (double) m_Size.y * m_Size.y
+ (double) m_Size.x * m_Size.x ) / 2 ); + (double) m_Size.x * m_Size.x ) / 2 );
break; break;
case PAD_TRAPEZOID: case PAD_TRAPEZOID:
{ wxSize fullsize = m_Size; x = m_Size.x + ABS( m_DeltaSize.y ); // Remember: m_DeltaSize.y is the m_Size.x change
fullsize.x += ABS(m_DeltaSize.y); // Remember: m_DeltaSize.y is the m_Size.x change y = m_Size.y + ABS( m_DeltaSize.x ); // Remember: m_DeltaSize.x is the m_Size.y change
fullsize.y += ABS(m_DeltaSize.x); // Remember: m_DeltaSize.x is the m_Size.y change radius = 1 + (int) ( sqrt( (double) y * y + (double) x * x ) / 2 );
m_ShapeMaxRadius = 1 + (int) ( sqrt( (double) m_Size.y * m_Size.y
+ (double) m_Size.x * m_Size.x ) / 2 );
}
break; break;
} }
return radius;
}
/* Calculate the radius of the circle containing the pad.
*/
void D_PAD::ComputeShapeMaxRadius()
{
m_ShapeMaxRadius = GetMaxRadius();
} }
@ -89,14 +98,13 @@ void D_PAD::ComputeShapeMaxRadius()
* returns the bounding box of this pad * returns the bounding box of this pad
* Mainly used to redraw the screen area occupied by the pad * Mainly used to redraw the screen area occupied by the pad
*/ */
EDA_Rect D_PAD::GetBoundingBox() EDA_Rect D_PAD::GetBoundingBox() const
{ {
// Calculate area:
ComputeShapeMaxRadius(); // calculate the radius of the area, considered as a
// circle
EDA_Rect area; EDA_Rect area;
int radius = GetMaxRadius(); // Calculate the radius of the area, considered as a circle
area.SetOrigin( m_Pos ); area.SetOrigin( m_Pos );
area.Inflate( m_ShapeMaxRadius, m_ShapeMaxRadius ); area.Inflate( radius );
return area; return area;
} }

View File

@ -271,6 +271,9 @@ public:
wxString ReturnStringPadName(); // Return pad name as string in a wxString wxString ReturnStringPadName(); // Return pad name as string in a wxString
void ReturnStringPadName( wxString& text ); // Return pad name as string in a buffer void ReturnStringPadName( wxString& text ); // Return pad name as string in a buffer
void ComputeShapeMaxRadius(); // compute radius void ComputeShapeMaxRadius(); // compute radius
int GetMaxRadius() const;
const wxPoint ReturnShapePos(); const wxPoint ReturnShapePos();
@ -321,13 +324,12 @@ public:
return wxT( "PAD" ); return wxT( "PAD" );
} }
/** /**
* Function GetBoundingBox * Function GetBoundingBox
* returns the bounding box of this pad * returns the bounding box of this pad
* Mainly used to redraw the screen area occupied by the pad * Mainly used to redraw the screen area occupied by the pad
*/ */
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox() const;
/** /**
* Function Compare * Function Compare

View File

@ -194,7 +194,7 @@ void TEXTE_MODULE::Copy( TEXTE_MODULE* source )
} }
int TEXTE_MODULE:: GetLength() int TEXTE_MODULE:: GetLength() const
{ {
return m_Text.Len(); return m_Text.Len();
} }
@ -250,7 +250,7 @@ void TEXTE_MODULE:: SetLocalCoord()
* @return an EDA_Rect which gives the position and size of the text area * @return an EDA_Rect which gives the position and size of the text area
* (for the footprint orientation) * (for the footprint orientation)
*/ */
EDA_Rect TEXTE_MODULE::GetTextRect( void ) EDA_Rect TEXTE_MODULE::GetTextRect( void ) const
{ {
EDA_Rect area; EDA_Rect area;
@ -303,7 +303,7 @@ bool TEXTE_MODULE::HitTest( const wxPoint& refPos )
* returns the bounding box of this Text (according to text and footprint * returns the bounding box of this Text (according to text and footprint
* orientation) * orientation)
*/ */
EDA_Rect TEXTE_MODULE::GetBoundingBox() EDA_Rect TEXTE_MODULE::GetBoundingBox() const
{ {
// Calculate area without text fields: // Calculate area without text fields:
EDA_Rect text_area; EDA_Rect text_area;
@ -438,12 +438,13 @@ void TEXTE_MODULE::DrawUmbilical( WinEDA_DrawPanel* aPanel,
/* Return text rotation for drawings and plotting /* Return text rotation for drawings and plotting
*/ */
int TEXTE_MODULE::GetDrawRotation() int TEXTE_MODULE::GetDrawRotation() const
{ {
int rotation; int rotation;
MODULE* Module = (MODULE*) m_Parent; MODULE* Module = (MODULE*) m_Parent;
rotation = m_Orient; rotation = m_Orient;
if( Module ) if( Module )
rotation += Module->m_Orient; rotation += Module->m_Orient;

View File

@ -47,23 +47,24 @@ public: TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS );
/* Gestion du texte */ /* Gestion du texte */
void SetWidth( int new_width ); void SetWidth( int new_width );
int GetLength(); /* text length */
int GetDrawRotation(); // Return text rotation for drawings and int GetLength() const; /* text length */
// plotting
int GetDrawRotation() const; // Return text rotation for drawings and plotting
/** /**
* Function GetTextRect * Function GetTextRect
* @return an EDA_Rect which gives the position and size of the text area * @return an EDA_Rect which gives the position and size of the text area
* (for the 0 orient text and footprint) * (for the 0 orient text and footprint)
*/ */
EDA_Rect GetTextRect( void ); EDA_Rect GetTextRect( void ) const;
/** /**
* Function GetBoundingBox * Function GetBoundingBox
* returns the bounding box of this Text (according to text and footprint * returns the bounding box of this Text (according to text and footprint
* orientation) * orientation)
*/ */
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox() const;
void SetDrawCoord(); // Set absolute coordinates. void SetDrawCoord(); // Set absolute coordinates.

View File

@ -212,7 +212,7 @@ int TRACK::IsPointOnEnds( const wxPoint& point, int min_dist )
} }
EDA_Rect TRACK::GetBoundingBox() EDA_Rect TRACK::GetBoundingBox() const
{ {
// end of track is round, this is its radius, rounded up // end of track is round, this is its radius, rounded up
int radius = ( m_Width + 1 ) / 2; int radius = ( m_Width + 1 ) / 2;

View File

@ -97,9 +97,7 @@ public:
return m_Start; // it had to be start or end. return m_Start; // it had to be start or end.
} }
EDA_Rect GetBoundingBox() const;
EDA_Rect GetBoundingBox();
/** /**
* Function Save * Function Save

View File

@ -641,18 +641,19 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
{ {
wxPoint start = m_FillSegmList[ic].m_Start + offset; wxPoint start = m_FillSegmList[ic].m_Start + offset;
wxPoint end = m_FillSegmList[ic].m_End + offset; wxPoint end = m_FillSegmList[ic].m_End + offset;
if( !DisplayOpt.DisplayPcbTrackFill || GetState( FORCE_SKETCH ) ) if( !DisplayOpt.DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
GRCSegm( &panel->m_ClipBox, DC, start.x, start.y, end.x, end.y, m_ZoneMinThickness, color ); GRCSegm( &panel->m_ClipBox, DC, start.x, start.y, end.x, end.y,
m_ZoneMinThickness, color );
else else
GRFillCSegm( &panel->m_ClipBox, DC, start.x, start.y, end.x, end.y, m_ZoneMinThickness, color ); GRFillCSegm( &panel->m_ClipBox, DC, start.x, start.y, end.x, end.y,
m_ZoneMinThickness, color );
} }
} }
} }
/****************************************/ EDA_Rect ZONE_CONTAINER::GetBoundingBox() const
EDA_Rect ZONE_CONTAINER::GetBoundingBox()
/****************************************/
{ {
const int PRELOAD = 0x7FFFFFFF; // Biggest integer (32 bits) const int PRELOAD = 0x7FFFFFFF; // Biggest integer (32 bits)

View File

@ -124,7 +124,7 @@ public:
/* Function GetBoundingBox /* Function GetBoundingBox
* @return an EDA_Rect that is the bounding box of the zone outline * @return an EDA_Rect that is the bounding box of the zone outline
*/ */
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox() const;
/** /**
* Function Test_For_Copper_Island_And_Remove__Insulated_Islands * Function Test_For_Copper_Island_And_Remove__Insulated_Islands
@ -324,7 +324,7 @@ public:
/** Acces to m_Poly parameters /** Acces to m_Poly parameters
*/ */
int GetNumCorners( void ) int GetNumCorners( void ) const
{ {
return m_Poly->GetNumCorners(); return m_Poly->GetNumCorners();
} }
@ -336,7 +336,7 @@ public:
} }
wxPoint GetCornerPosition( int aCornerIndex ) wxPoint GetCornerPosition( int aCornerIndex ) const
{ {
return wxPoint( m_Poly->GetX( aCornerIndex ), m_Poly->GetY( aCornerIndex ) ); return wxPoint( m_Poly->GetX( aCornerIndex ), m_Poly->GetY( aCornerIndex ) );
} }