mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 18:23:15 +02:00
see my 2007-Sep-20 change_log.txt
This commit is contained in:
parent
33939aebd9
commit
664a1f727b
@ -4,6 +4,14 @@ Started 2007-June-11
|
|||||||
Please add newer entries at the top, list the date and your name with
|
Please add newer entries at the top, list the date and your name with
|
||||||
email address.
|
email address.
|
||||||
|
|
||||||
|
2007-Sep-20 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||||
|
================================================================================
|
||||||
|
+ eeschema
|
||||||
|
* beautify, add debug Show() functions, changed ReturnFieldName()
|
||||||
|
to return "const wxString&" for speed, added GetFieldValue().
|
||||||
|
* tracking down questionable behavior (a bug?) in erc regarding pwr_flag, still looking
|
||||||
|
|
||||||
|
|
||||||
2007-sept-20 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
2007-sept-20 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||||
================================================================================
|
================================================================================
|
||||||
+ all
|
+ all
|
||||||
|
@ -555,3 +555,29 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList()
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(DEBUG)
|
||||||
|
/**
|
||||||
|
* Function Show
|
||||||
|
* is used to output the object tree, currently for debugging only.
|
||||||
|
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||||
|
* of nesting of this object within the overall tree.
|
||||||
|
* @param os The ostream& to output to.
|
||||||
|
*/
|
||||||
|
void BASE_SCREEN::Show( int nestLevel, std::ostream& os )
|
||||||
|
{
|
||||||
|
EDA_BaseStruct* item = EEDrawList;
|
||||||
|
|
||||||
|
// for now, make it look like XML, expand on this later.
|
||||||
|
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
|
||||||
|
">\n";
|
||||||
|
|
||||||
|
for( ; item; item = item->Next() )
|
||||||
|
{
|
||||||
|
item->Show( nestLevel+1, os );
|
||||||
|
}
|
||||||
|
|
||||||
|
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
@ -188,11 +188,14 @@ void EDA_BaseStruct::Show( int nestLevel, std::ostream& os )
|
|||||||
// for now, make it look like XML:
|
// for now, make it look like XML:
|
||||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
|
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
|
||||||
|
|
||||||
|
/*
|
||||||
EDA_BaseStruct* kid = m_Son;
|
EDA_BaseStruct* kid = m_Son;
|
||||||
for( ; kid; kid = kid->Pnext )
|
for( ; kid; kid = kid->Pnext )
|
||||||
{
|
{
|
||||||
kid->Show( nestLevel+1, os );
|
kid->Show( nestLevel+1, os );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
NestedSpace( nestLevel+1, os ) << "Need ::Show() override, shown class is using EDA_BaseStruct::Show()\n";
|
||||||
|
|
||||||
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
|
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -90,12 +90,12 @@ class SCH_SCREEN : public BASE_SCREEN
|
|||||||
public:
|
public:
|
||||||
SCH_SCREEN( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE );
|
SCH_SCREEN( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE );
|
||||||
~SCH_SCREEN();
|
~SCH_SCREEN();
|
||||||
|
|
||||||
virtual wxString GetClass() const
|
virtual wxString GetClass() const
|
||||||
{
|
{
|
||||||
return wxT("SCH_SCREEN");
|
return wxT("SCH_SCREEN");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies)
|
void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies)
|
||||||
|
|
||||||
void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { };
|
void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { };
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*********************************/
|
/*********************************/
|
||||||
/* Module de nettoyage du schema */
|
/* Module de nettoyage du schema */
|
||||||
/*********************************/
|
/*********************************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
@ -15,102 +15,107 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Routines locales */
|
/* Routines locales */
|
||||||
static int TstAlignSegment(EDA_DrawLineStruct* RefSegm, EDA_DrawLineStruct* TstSegm);
|
static int TstAlignSegment( EDA_DrawLineStruct* RefSegm, EDA_DrawLineStruct* TstSegm );
|
||||||
|
|
||||||
/* Variable locales */
|
/* Variable locales */
|
||||||
|
|
||||||
|
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
bool SCH_SCREEN::SchematicCleanUp(wxDC * DC)
|
bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
|
|
||||||
/* Routine de nettoyage:
|
/* Routine de nettoyage:
|
||||||
- regroupe les segments de fils (ou de bus) alignes en 1 seul segment
|
* - regroupe les segments de fils (ou de bus) alignes en 1 seul segment
|
||||||
- Detecte les objets identiques superposes
|
* - Detecte les objets identiques superposes
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
EDA_BaseStruct *DrawList, * TstDrawList;
|
EDA_BaseStruct* DrawList, * TstDrawList;
|
||||||
int flag;
|
int flag;
|
||||||
bool Modify = FALSE;
|
bool Modify = FALSE;
|
||||||
|
|
||||||
DrawList = EEDrawList;
|
DrawList = EEDrawList;
|
||||||
for ( ;DrawList != NULL; DrawList = DrawList->Pnext )
|
for( ; DrawList != NULL; DrawList = DrawList->Pnext )
|
||||||
{
|
{
|
||||||
if( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE )
|
if( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
TstDrawList = DrawList->Pnext;
|
TstDrawList = DrawList->Pnext;
|
||||||
while ( TstDrawList )
|
while( TstDrawList )
|
||||||
{
|
{
|
||||||
if( TstDrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE )
|
if( TstDrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
flag = TstAlignSegment( (EDA_DrawLineStruct*)DrawList,
|
flag = TstAlignSegment( (EDA_DrawLineStruct*) DrawList,
|
||||||
(EDA_DrawLineStruct*)TstDrawList);
|
(EDA_DrawLineStruct*) TstDrawList );
|
||||||
if (flag ) /* Suppression de TstSegm */
|
if( flag ) /* Suppression de TstSegm */
|
||||||
{
|
{
|
||||||
/* keep the bits set in .m_Flags, because the deleted segment can be flagged */
|
/* keep the bits set in .m_Flags, because the deleted segment can be flagged */
|
||||||
DrawList->m_Flags |= TstDrawList->m_Flags;
|
DrawList->m_Flags |= TstDrawList->m_Flags;
|
||||||
EraseStruct(TstDrawList, this);
|
EraseStruct( TstDrawList, this );
|
||||||
SetRefreshReq();
|
SetRefreshReq();
|
||||||
TstDrawList = EEDrawList;
|
TstDrawList = EEDrawList;
|
||||||
Modify = TRUE;
|
Modify = TRUE;
|
||||||
}
|
}
|
||||||
else TstDrawList = TstDrawList->Pnext;
|
else
|
||||||
|
TstDrawList = TstDrawList->Pnext;
|
||||||
}
|
}
|
||||||
else TstDrawList = TstDrawList->Pnext;
|
else
|
||||||
|
TstDrawList = TstDrawList->Pnext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EDA_Appl->SchematicFrame->TestDanglingEnds(EEDrawList, DC);
|
|
||||||
|
EDA_Appl->SchematicFrame->TestDanglingEnds( EEDrawList, DC );
|
||||||
return Modify;
|
return Modify;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************/
|
/***********************************************/
|
||||||
void BreakSegmentOnJunction( SCH_SCREEN * Screen )
|
void BreakSegmentOnJunction( SCH_SCREEN* Screen )
|
||||||
/************************************************/
|
/************************************************/
|
||||||
|
|
||||||
/* Routine creant des debuts / fin de segment (BUS ou WIRES) sur les jonctions
|
/* Routine creant des debuts / fin de segment (BUS ou WIRES) sur les jonctions
|
||||||
et les raccords
|
* et les raccords
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
EDA_BaseStruct *DrawList;
|
EDA_BaseStruct* DrawList;
|
||||||
|
|
||||||
if( Screen == NULL )
|
if( Screen == NULL )
|
||||||
{
|
{
|
||||||
DisplayError(NULL, wxT("BreakSegmentOnJunction() error: NULL screen"));
|
DisplayError( NULL, wxT( "BreakSegmentOnJunction() error: NULL screen" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawList = Screen->EEDrawList;
|
DrawList = Screen->EEDrawList;
|
||||||
while ( DrawList )
|
while( DrawList )
|
||||||
{
|
{
|
||||||
switch( DrawList->Type() )
|
switch( DrawList->Type() )
|
||||||
{
|
{
|
||||||
case DRAW_JUNCTION_STRUCT_TYPE :
|
case DRAW_JUNCTION_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ((DrawJunctionStruct*)DrawList)
|
#define STRUCT ( (DrawJunctionStruct*) DrawList )
|
||||||
BreakSegment(Screen, STRUCT->m_Pos);
|
BreakSegment( Screen, STRUCT->m_Pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_BUSENTRY_STRUCT_TYPE :
|
case DRAW_BUSENTRY_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ((DrawBusEntryStruct*)DrawList)
|
#define STRUCT ( (DrawBusEntryStruct*) 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 DRAW_SEGMENT_STRUCT_TYPE:
|
||||||
case DRAW_NOCONNECT_STRUCT_TYPE :
|
case DRAW_NOCONNECT_STRUCT_TYPE:
|
||||||
case DRAW_LABEL_STRUCT_TYPE :
|
case DRAW_LABEL_STRUCT_TYPE:
|
||||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE :
|
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||||
case DRAW_LIB_ITEM_STRUCT_TYPE :
|
case DRAW_LIB_ITEM_STRUCT_TYPE:
|
||||||
case DRAW_PICK_ITEM_STRUCT_TYPE :
|
case DRAW_PICK_ITEM_STRUCT_TYPE:
|
||||||
case DRAW_POLYLINE_STRUCT_TYPE :
|
case DRAW_POLYLINE_STRUCT_TYPE:
|
||||||
case DRAW_MARKER_STRUCT_TYPE :
|
case DRAW_MARKER_STRUCT_TYPE:
|
||||||
case DRAW_TEXT_STRUCT_TYPE :
|
case DRAW_TEXT_STRUCT_TYPE:
|
||||||
case DRAW_SHEET_STRUCT_TYPE :
|
case DRAW_SHEET_STRUCT_TYPE:
|
||||||
case DRAW_SHEETLABEL_STRUCT_TYPE :
|
case DRAW_SHEETLABEL_STRUCT_TYPE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DrawList = DrawList->Pnext;
|
DrawList = DrawList->Pnext;
|
||||||
@ -119,39 +124,44 @@ EDA_BaseStruct *DrawList;
|
|||||||
|
|
||||||
|
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
DrawPickedStruct * BreakSegment(SCH_SCREEN * screen,
|
DrawPickedStruct* BreakSegment( SCH_SCREEN* screen,
|
||||||
wxPoint breakpoint, bool PutInUndoList)
|
wxPoint breakpoint, bool PutInUndoList )
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
|
|
||||||
/* Coupe un segment ( BUS, WIRE ) en 2 au point breakpoint,
|
/* Coupe un segment ( BUS, WIRE ) en 2 au point breakpoint,
|
||||||
- si ce point est sur le segment
|
* - si ce point est sur le segment
|
||||||
- extremites non comprises
|
* - extremites non comprises
|
||||||
If PutInUndoList == TRUE, create a list of modifictions, for undo command
|
* If PutInUndoList == TRUE, create a list of modifictions, for undo command
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
EDA_BaseStruct *DrawList;
|
EDA_BaseStruct* DrawList;
|
||||||
EDA_DrawLineStruct * segment, * NewSegment;
|
EDA_DrawLineStruct* segment, * NewSegment;
|
||||||
int ox, oy, fx, fy;
|
int ox, oy, fx, fy;
|
||||||
DrawPickedStruct * List = NULL;
|
DrawPickedStruct* List = NULL;
|
||||||
|
|
||||||
DrawList = screen->EEDrawList;
|
DrawList = screen->EEDrawList;
|
||||||
while ( DrawList )
|
while( DrawList )
|
||||||
{
|
{
|
||||||
switch( DrawList->Type() )
|
switch( DrawList->Type() )
|
||||||
{
|
{
|
||||||
case DRAW_SEGMENT_STRUCT_TYPE :
|
case DRAW_SEGMENT_STRUCT_TYPE:
|
||||||
segment = (EDA_DrawLineStruct*)DrawList;
|
segment = (EDA_DrawLineStruct*) DrawList;
|
||||||
ox = segment->m_Start.x; oy = segment->m_Start.y;
|
ox = segment->m_Start.x; oy = segment->m_Start.y;
|
||||||
fx = segment->m_End.x; fy = segment->m_End.y;
|
fx = segment->m_End.x; fy = segment->m_End.y;
|
||||||
if( distance( fx - ox, fy - oy, breakpoint.x - ox, breakpoint.y - oy, 0 ) == 0 )
|
if( distance( fx - ox, fy - oy, breakpoint.x - ox, breakpoint.y - oy, 0 ) == 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Segment connecte: doit etre coupe en 2 si px,py n'est
|
/* Segment connecte: doit etre coupe en 2 si px,py n'est
|
||||||
pas une extremite */
|
* pas une extremite */
|
||||||
if( (ox == breakpoint.x) && (oy == breakpoint.y ) ) break;
|
if( (ox == breakpoint.x) && (oy == breakpoint.y ) )
|
||||||
if( (fx == breakpoint.x) && (fy == breakpoint.y ) ) break;
|
break;
|
||||||
|
if( (fx == breakpoint.x) && (fy == breakpoint.y ) )
|
||||||
|
break;
|
||||||
/* Ici il faut couper le segment en 2 */
|
/* Ici il faut couper le segment en 2 */
|
||||||
if ( PutInUndoList ) // First: put copy of the old segment in undo list
|
if( PutInUndoList ) // First: put copy of the old segment in undo list
|
||||||
{
|
{
|
||||||
DrawPickedStruct * wrapper = new DrawPickedStruct();
|
DrawPickedStruct* wrapper = new DrawPickedStruct();
|
||||||
|
|
||||||
wrapper->m_Flags = IS_CHANGED;
|
wrapper->m_Flags = IS_CHANGED;
|
||||||
wrapper->m_PickedStruct = segment->GenCopy();
|
wrapper->m_PickedStruct = segment->GenCopy();
|
||||||
wrapper->m_Image = segment;
|
wrapper->m_Image = segment;
|
||||||
@ -165,9 +175,10 @@ DrawPickedStruct * List = NULL;
|
|||||||
NewSegment->Pnext = segment->Pnext;
|
NewSegment->Pnext = segment->Pnext;
|
||||||
segment->Pnext = NewSegment;
|
segment->Pnext = NewSegment;
|
||||||
DrawList = NewSegment;
|
DrawList = NewSegment;
|
||||||
if ( PutInUndoList )
|
if( PutInUndoList )
|
||||||
{
|
{
|
||||||
DrawPickedStruct * wrapper = new DrawPickedStruct();
|
DrawPickedStruct* wrapper = new DrawPickedStruct();
|
||||||
|
|
||||||
wrapper->m_Flags = IS_NEW;
|
wrapper->m_Flags = IS_NEW;
|
||||||
wrapper->m_Image = NewSegment;
|
wrapper->m_Image = NewSegment;
|
||||||
wrapper->Pnext = List;
|
wrapper->Pnext = List;
|
||||||
@ -175,14 +186,15 @@ DrawPickedStruct * List = NULL;
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_JUNCTION_STRUCT_TYPE :
|
case DRAW_JUNCTION_STRUCT_TYPE:
|
||||||
case DRAW_BUSENTRY_STRUCT_TYPE :
|
case DRAW_BUSENTRY_STRUCT_TYPE:
|
||||||
case DRAW_POLYLINE_STRUCT_TYPE :
|
case DRAW_POLYLINE_STRUCT_TYPE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawList = DrawList->Pnext;
|
DrawList = DrawList->Pnext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,68 +202,67 @@ DrawPickedStruct * List = NULL;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
static int TstAlignSegment( EDA_DrawLineStruct* RefSegm,
|
static int TstAlignSegment( EDA_DrawLineStruct* RefSegm,
|
||||||
EDA_DrawLineStruct* TstSegm)
|
EDA_DrawLineStruct* TstSegm )
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
|
|
||||||
/* Search if the 2 segments RefSegm and TstSegm are on a line.
|
/* Search if the 2 segments RefSegm and TstSegm are on a line.
|
||||||
Retourn 0 if no
|
* Retourn 0 if no
|
||||||
1 if yes, and RefSegm is modified to be the equivalent segment
|
* 1 if yes, and RefSegm is modified to be the equivalent segment
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
if( RefSegm == TstSegm ) return(0);
|
if( RefSegm == TstSegm )
|
||||||
if( RefSegm->m_Layer != TstSegm->m_Layer ) return(0);
|
return 0;
|
||||||
|
if( RefSegm->m_Layer != TstSegm->m_Layer )
|
||||||
|
return 0;
|
||||||
|
|
||||||
// search for a common end, and modify coordinates to ensure RefSegm->m_End == TstSegm->m_Start
|
// search for a common end, and modify coordinates to ensure RefSegm->m_End == TstSegm->m_Start
|
||||||
if ( RefSegm->m_Start == TstSegm->m_Start )
|
if( RefSegm->m_Start == TstSegm->m_Start )
|
||||||
{
|
{
|
||||||
if ( RefSegm->m_End == TstSegm->m_End ) // trivial case: RefSegm and TstSegm are identical
|
if( RefSegm->m_End == TstSegm->m_End ) // trivial case: RefSegm and TstSegm are identical
|
||||||
return 1;
|
return 1;
|
||||||
EXCHG(RefSegm->m_Start, RefSegm->m_End); // at this point, RefSegm->m_End == TstSegm->m_Start
|
EXCHG( RefSegm->m_Start, RefSegm->m_End ); // at this point, RefSegm->m_End == TstSegm->m_Start
|
||||||
}
|
}
|
||||||
else if ( RefSegm->m_Start == TstSegm->m_End )
|
else if( RefSegm->m_Start == TstSegm->m_End )
|
||||||
{
|
{
|
||||||
EXCHG(RefSegm->m_Start, RefSegm->m_End);
|
EXCHG( RefSegm->m_Start, RefSegm->m_End );
|
||||||
EXCHG(TstSegm->m_Start, TstSegm->m_End); // at this point, RefSegm->m_End == TstSegm->m_Start
|
EXCHG( TstSegm->m_Start, TstSegm->m_End ); // at this point, RefSegm->m_End == TstSegm->m_Start
|
||||||
}
|
}
|
||||||
else if ( RefSegm->m_End == TstSegm->m_End )
|
else if( RefSegm->m_End == TstSegm->m_End )
|
||||||
{
|
{
|
||||||
EXCHG(TstSegm->m_Start, TstSegm->m_End); // at this point, RefSegm->m_End == TstSegm->m_Start
|
EXCHG( TstSegm->m_Start, TstSegm->m_End ); // at this point, RefSegm->m_End == TstSegm->m_Start
|
||||||
}
|
}
|
||||||
else if ( RefSegm->m_End != TstSegm->m_Start ) // No common end point, segments cannot be merged
|
else if( RefSegm->m_End != TstSegm->m_Start ) // No common end point, segments cannot be merged
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Test alignment: */
|
/* Test alignment: */
|
||||||
if ( RefSegm->m_Start.y == RefSegm->m_End.y ) // Horizontal segment
|
if( RefSegm->m_Start.y == RefSegm->m_End.y ) // Horizontal segment
|
||||||
{
|
{
|
||||||
if ( TstSegm->m_Start.y == TstSegm->m_End.y )
|
if( TstSegm->m_Start.y == TstSegm->m_End.y )
|
||||||
{
|
{
|
||||||
RefSegm->m_End = TstSegm->m_End;
|
RefSegm->m_End = TstSegm->m_End;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if( RefSegm->m_Start.x == RefSegm->m_End.x ) // Vertical segment
|
||||||
else if ( RefSegm->m_Start.x == RefSegm->m_End.x ) // Vertical segment
|
|
||||||
{
|
{
|
||||||
if ( TstSegm->m_Start.x == TstSegm->m_End.x )
|
if( TstSegm->m_Start.x == TstSegm->m_End.x )
|
||||||
{
|
{
|
||||||
RefSegm->m_End = TstSegm->m_End;
|
RefSegm->m_End = TstSegm->m_End;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (atan2(RefSegm->m_Start.x - RefSegm->m_End.x, RefSegm->m_Start.y - RefSegm->m_End.y) ==
|
if( atan2( RefSegm->m_Start.x - RefSegm->m_End.x, RefSegm->m_Start.y -
|
||||||
atan2(TstSegm->m_Start.x - TstSegm->m_End.x, TstSegm->m_Start.y - TstSegm->m_End.y) )
|
RefSegm->m_End.y ) ==
|
||||||
|
atan2( TstSegm->m_Start.x - TstSegm->m_End.x, TstSegm->m_Start.y - TstSegm->m_End.y ) )
|
||||||
{
|
{
|
||||||
RefSegm->m_End = TstSegm->m_End;
|
RefSegm->m_End = TstSegm->m_End;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,6 +143,23 @@ wxString DrawMarkerStruct::GetComment()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(DEBUG)
|
||||||
|
/**
|
||||||
|
* Function Show
|
||||||
|
* is used to output the object tree, currently for debugging only.
|
||||||
|
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||||
|
* of nesting of this object within the overall tree.
|
||||||
|
* @param os The ostream& to output to.
|
||||||
|
*/
|
||||||
|
void DrawMarkerStruct::Show( int nestLevel, std::ostream& os )
|
||||||
|
{
|
||||||
|
// for now, make it look like XML:
|
||||||
|
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << m_Pos
|
||||||
|
<< "/>\n";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/***************************/
|
/***************************/
|
||||||
/* Class EDA_DrawLineStruct */
|
/* Class EDA_DrawLineStruct */
|
||||||
/***************************/
|
/***************************/
|
||||||
@ -201,6 +218,28 @@ bool EDA_DrawLineStruct::IsOneEndPointAt( const wxPoint& pos )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(DEBUG)
|
||||||
|
/**
|
||||||
|
* Function Show
|
||||||
|
* is used to output the object tree, currently for debugging only.
|
||||||
|
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||||
|
* of nesting of this object within the overall tree.
|
||||||
|
* @param os The ostream& to output to.
|
||||||
|
*/
|
||||||
|
void EDA_DrawLineStruct::Show( int nestLevel, std::ostream& os )
|
||||||
|
{
|
||||||
|
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
|
||||||
|
" layer=\"" << m_Layer << '"' <<
|
||||||
|
" width=\"" << m_Width << '"' <<
|
||||||
|
" startIsDangling=\"" << m_StartIsDangling << '"' <<
|
||||||
|
" endIsDangling=\"" << m_EndIsDangling << '"' << ">" <<
|
||||||
|
" <start" << m_Start << "/>" <<
|
||||||
|
" <end" << m_End << "/>" <<
|
||||||
|
"</" << GetClass().Lower().mb_str() << ">\n";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/****************************/
|
/****************************/
|
||||||
/* Class DrawPolylineStruct */
|
/* Class DrawPolylineStruct */
|
||||||
/****************************/
|
/****************************/
|
||||||
|
@ -17,74 +17,102 @@
|
|||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
|
|
||||||
/***************************/
|
/***************************/
|
||||||
/* class DrawPartStruct */
|
/* class DrawPartStruct */
|
||||||
/* class EDA_SchComponentStruct */
|
/* class EDA_SchComponentStruct */
|
||||||
/***************************/
|
/***************************/
|
||||||
|
|
||||||
/***********************************************************************************/
|
/***********************************************************************************/
|
||||||
DrawPartStruct::DrawPartStruct( KICAD_T struct_type, const wxPoint & pos):
|
DrawPartStruct::DrawPartStruct( KICAD_T struct_type, const wxPoint& pos ) :
|
||||||
EDA_BaseStruct(struct_type)
|
EDA_BaseStruct( struct_type )
|
||||||
/***********************************************************************************/
|
/***********************************************************************************/
|
||||||
{
|
{
|
||||||
|
m_Layer = 0;
|
||||||
m_Pos = pos;
|
m_Pos = pos;
|
||||||
m_TimeStamp = 0;
|
m_TimeStamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************/
|
/************************************/
|
||||||
DrawPartStruct::~DrawPartStruct()
|
DrawPartStruct::~DrawPartStruct()
|
||||||
/************************************/
|
/************************************/
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
wxString ReturnDefaultFieldName(int FieldNumber)
|
const wxString& ReturnDefaultFieldName( int aFieldNdx )
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
/* Return the defult ield name from its number (REFERENCE, VALUE ..)
|
|
||||||
FieldDefaultNameList is not static, because we want the text translation
|
/* Return the default field name from its index (REFERENCE, VALUE ..)
|
||||||
for I18n
|
* FieldDefaultNameList is not static, because we want the text translation
|
||||||
*/
|
* for I18n
|
||||||
|
*/
|
||||||
{
|
{
|
||||||
wxString FieldDefaultNameList[] = {
|
// avoid unnecessarily copying wxStrings.
|
||||||
_("Ref"), /* Reference of part, i.e. "IC21" */
|
static const wxString FieldDefaultNameList[] = {
|
||||||
_("Value"), /* Value of part, i.e. "3.3K" */
|
_( "Ref" ), /* Reference of part, i.e. "IC21" */
|
||||||
_("Footprint"), /* Footprint, used by cvpcb or pcbnew, i.e. "16DIP300" */
|
_( "Value" ), /* Value of part, i.e. "3.3K" */
|
||||||
_("Sheet"), /* for components which are a schematic file, schematic file name, i.e. "cnt16.sch" */
|
_( "Footprint" ), /* Footprint, used by cvpcb or pcbnew, i.e. "16DIP300" */
|
||||||
_("Field") /* User fields (1 to n) have an editable name*/
|
_( "Sheet" ), /* for components which are a schematic file, schematic file name, i.e. "cnt16.sch" */
|
||||||
|
_( "Field1" ), /* User fields (1 to n) have an editable name*/
|
||||||
|
_( "Field2" ),
|
||||||
|
_( "Field3" ),
|
||||||
|
_( "Field4" ),
|
||||||
|
_( "Field5" ),
|
||||||
|
_( "Field6" ),
|
||||||
|
_( "Field7" ),
|
||||||
|
_( "Field8" ),
|
||||||
|
wxT( "badFieldNdx!" ) // error, and "sentinel" value
|
||||||
};
|
};
|
||||||
int ii = FieldNumber;
|
|
||||||
if ( ii > FIELD1 ) ii = FIELD1;
|
|
||||||
wxString FieldName = FieldDefaultNameList[ii];
|
|
||||||
|
|
||||||
if (FieldNumber >= FIELD1 ) FieldName << (FieldNumber - FIELD1 + 1);
|
if( (unsigned) aFieldNdx > FIELD8 ) // catches < 0 also
|
||||||
return FieldName;
|
aFieldNdx = FIELD8+1; // return the sentinel text
|
||||||
|
|
||||||
|
return FieldDefaultNameList[aFieldNdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
wxString EDA_SchComponentStruct::ReturnFieldName(int FieldNumber)
|
const wxString& EDA_SchComponentStruct::ReturnFieldName( int aFieldNdx ) const
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
/* Return the Field name from its number (REFERENCE, VALUE ..)
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
wxString FieldName = m_Field[FieldNumber].m_Name;
|
|
||||||
|
|
||||||
if ( (FieldNumber < FIELD1) || FieldName.IsEmpty() )
|
/* Return the Field name from its index (REFERENCE, VALUE ..)
|
||||||
FieldName = ReturnDefaultFieldName(FieldNumber);
|
*/
|
||||||
return FieldName;
|
{
|
||||||
|
// avoid unnecessarily copying wxStrings.
|
||||||
|
|
||||||
|
if( aFieldNdx < FIELD1 || m_Field[aFieldNdx].m_Name.IsEmpty() )
|
||||||
|
return ReturnDefaultFieldName( aFieldNdx );
|
||||||
|
|
||||||
|
return m_Field[aFieldNdx].m_Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const wxString& EDA_SchComponentStruct::GetFieldValue( int aFieldNdx ) const
|
||||||
|
{
|
||||||
|
// avoid unnecessarily copying wxStrings.
|
||||||
|
static const wxString myEmpty = wxEmptyString;
|
||||||
|
|
||||||
|
if( (unsigned) aFieldNdx > FIELD8 || m_Field[aFieldNdx].m_Text.IsEmpty() )
|
||||||
|
return myEmpty;
|
||||||
|
|
||||||
|
return m_Field[aFieldNdx].m_Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
EDA_SchComponentStruct::EDA_SchComponentStruct(const wxPoint & pos):
|
EDA_SchComponentStruct::EDA_SchComponentStruct( const wxPoint& pos ) :
|
||||||
DrawPartStruct(DRAW_LIB_ITEM_STRUCT_TYPE, pos)
|
DrawPartStruct( DRAW_LIB_ITEM_STRUCT_TYPE, pos )
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
|
|
||||||
m_Multi = 0; /* In multi unit chip - which unit to draw. */
|
m_Multi = 0; /* In multi unit chip - which unit to draw. */
|
||||||
m_RefIdNumber = 0;
|
m_RefIdNumber = 0;
|
||||||
m_FlagControlMulti = 0;
|
m_FlagControlMulti = 0;
|
||||||
m_Convert = 0; /* Gestion des mutiples representations (conversion De Morgan) */
|
m_Convert = 0; /* Gestion des mutiples representations (conversion De Morgan) */
|
||||||
|
|
||||||
/* The rotation/mirror transformation matrix. pos normal*/
|
/* The rotation/mirror transformation matrix. pos normal*/
|
||||||
m_Transform[0][0] = 1;
|
m_Transform[0][0] = 1;
|
||||||
m_Transform[0][1] = 0;
|
m_Transform[0][1] = 0;
|
||||||
@ -92,7 +120,7 @@ int ii;
|
|||||||
m_Transform[1][1] = -1;
|
m_Transform[1][1] = -1;
|
||||||
|
|
||||||
/* initialisation des Fields */
|
/* initialisation des Fields */
|
||||||
for(ii = 0; ii < NUMBER_OF_FIELDS; ii++)
|
for( ii = 0; ii < NUMBER_OF_FIELDS; ii++ )
|
||||||
{
|
{
|
||||||
m_Field[ii].m_Pos = m_Pos;
|
m_Field[ii].m_Pos = m_Pos;
|
||||||
m_Field[ii].m_Layer = LAYER_FIELDS;
|
m_Field[ii].m_Layer = LAYER_FIELDS;
|
||||||
@ -104,7 +132,6 @@ int ii;
|
|||||||
m_Field[REFERENCE].m_Layer = LAYER_REFERENCEPART;
|
m_Field[REFERENCE].m_Layer = LAYER_REFERENCEPART;
|
||||||
|
|
||||||
m_PinIsDangling = NULL;
|
m_PinIsDangling = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -112,19 +139,21 @@ int ii;
|
|||||||
EDA_Rect EDA_SchComponentStruct::GetBoundaryBox()
|
EDA_Rect EDA_SchComponentStruct::GetBoundaryBox()
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
{
|
{
|
||||||
EDA_LibComponentStruct * Entry = FindLibPart(m_ChipName.GetData(), wxEmptyString, FIND_ROOT);
|
EDA_LibComponentStruct* Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
||||||
EDA_Rect BoundaryBox;
|
EDA_Rect BoundaryBox;
|
||||||
int x0, xm, y0, ym;
|
int x0, xm, y0, ym;
|
||||||
|
|
||||||
/* Get the basic Boundary box */
|
/* Get the basic Boundary box */
|
||||||
if ( Entry )
|
if( Entry )
|
||||||
{
|
{
|
||||||
BoundaryBox = Entry->GetBoundaryBox( m_Multi, m_Convert);
|
BoundaryBox = Entry->GetBoundaryBox( m_Multi, m_Convert );
|
||||||
x0 = BoundaryBox.GetX(); xm = BoundaryBox.GetRight();
|
x0 = BoundaryBox.GetX(); xm = BoundaryBox.GetRight();
|
||||||
|
|
||||||
// We must reverse Y values, because matrix orientation
|
// We must reverse Y values, because matrix orientation
|
||||||
// suppose Y axis normal for the library items coordinates,
|
// suppose Y axis normal for the library items coordinates,
|
||||||
// m_Transform reverse Y values, but BoundaryBox ais already reversed!
|
// m_Transform reverse Y values, but BoundaryBox ais already reversed!
|
||||||
y0 = - BoundaryBox.GetY();
|
y0 = -BoundaryBox.GetY();
|
||||||
ym = - BoundaryBox.GetBottom();
|
ym = -BoundaryBox.GetBottom();
|
||||||
}
|
}
|
||||||
else /* if lib Entry not found, give a reasonable size */
|
else /* if lib Entry not found, give a reasonable size */
|
||||||
{
|
{
|
||||||
@ -142,110 +171,123 @@ int x0, xm, y0, ym;
|
|||||||
int y2 = m_Transform[1][0] * xm + m_Transform[1][1] * ym;
|
int y2 = m_Transform[1][0] * xm + m_Transform[1][1] * ym;
|
||||||
|
|
||||||
// H and W must be > 0 for wxRect:
|
// H and W must be > 0 for wxRect:
|
||||||
if ( x2 < x1 ) EXCHG( x2, x1 );
|
if( x2 < x1 )
|
||||||
if ( y2 < y1 ) EXCHG( y2, y1 );
|
EXCHG( x2, x1 );
|
||||||
BoundaryBox.SetX(x1); BoundaryBox.SetY(y1);
|
if( y2 < y1 )
|
||||||
BoundaryBox.SetWidth(x2-x1);
|
EXCHG( y2, y1 );
|
||||||
BoundaryBox.SetHeight(y2-y1);
|
|
||||||
|
|
||||||
BoundaryBox.Offset(m_Pos);
|
BoundaryBox.SetX( x1 ); BoundaryBox.SetY( y1 );
|
||||||
|
BoundaryBox.SetWidth( x2 - x1 );
|
||||||
|
BoundaryBox.SetHeight( y2 - y1 );
|
||||||
|
|
||||||
|
BoundaryBox.Offset( m_Pos );
|
||||||
return BoundaryBox;
|
return BoundaryBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
void PartTextStruct::SwapData(PartTextStruct * copyitem)
|
void PartTextStruct::SwapData( PartTextStruct* copyitem )
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
/* Used if undo / redo command:
|
/* Used if undo / redo command:
|
||||||
swap data between this and copyitem
|
* swap data between this and copyitem
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
EXCHG(m_Text, copyitem->m_Text);
|
EXCHG( m_Text, copyitem->m_Text );
|
||||||
EXCHG(m_Layer, copyitem->m_Layer);
|
EXCHG( m_Layer, copyitem->m_Layer );
|
||||||
EXCHG(m_Pos, copyitem->m_Pos);
|
EXCHG( m_Pos, copyitem->m_Pos );
|
||||||
EXCHG(m_Size, copyitem->m_Size);
|
EXCHG( m_Size, copyitem->m_Size );
|
||||||
EXCHG(m_Width, copyitem->m_Width);
|
EXCHG( m_Width, copyitem->m_Width );
|
||||||
EXCHG(m_Orient, copyitem->m_Orient);
|
EXCHG( m_Orient, copyitem->m_Orient );
|
||||||
EXCHG(m_Miroir, copyitem->m_Miroir);
|
EXCHG( m_Miroir, copyitem->m_Miroir );
|
||||||
EXCHG(m_Attributs, copyitem->m_Attributs);
|
EXCHG( m_Attributs, copyitem->m_Attributs );
|
||||||
EXCHG(m_CharType, copyitem->m_CharType);
|
EXCHG( m_CharType, copyitem->m_CharType );
|
||||||
EXCHG(m_HJustify, copyitem->m_HJustify);
|
EXCHG( m_HJustify, copyitem->m_HJustify );
|
||||||
EXCHG(m_VJustify, copyitem->m_VJustify);
|
EXCHG( m_VJustify, copyitem->m_VJustify );
|
||||||
EXCHG(m_ZoomLevelDrawable, copyitem->m_ZoomLevelDrawable);
|
EXCHG( m_ZoomLevelDrawable, copyitem->m_ZoomLevelDrawable );
|
||||||
EXCHG(m_TextDrawings, copyitem->m_TextDrawings);
|
EXCHG( m_TextDrawings, copyitem->m_TextDrawings );
|
||||||
EXCHG(m_TextDrawingsSize, copyitem->m_TextDrawingsSize);
|
EXCHG( m_TextDrawingsSize, copyitem->m_TextDrawingsSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
void EDA_SchComponentStruct::SwapData(EDA_SchComponentStruct * copyitem)
|
void EDA_SchComponentStruct::SwapData( EDA_SchComponentStruct* copyitem )
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
/* Used if undo / redo command:
|
/* Used if undo / redo command:
|
||||||
swap data between this and copyitem
|
* swap data between this and copyitem
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
EXCHG(m_Pos, copyitem->m_Pos);
|
EXCHG( m_Pos, copyitem->m_Pos );
|
||||||
EXCHG(m_Multi, copyitem->m_Multi);
|
EXCHG( m_Multi, copyitem->m_Multi );
|
||||||
EXCHG(m_Convert, copyitem->m_Convert);
|
EXCHG( m_Convert, copyitem->m_Convert );
|
||||||
EXCHG(m_Transform[0][0], copyitem->m_Transform[0][0]);
|
EXCHG( m_Transform[0][0], copyitem->m_Transform[0][0] );
|
||||||
EXCHG(m_Transform[0][1], copyitem->m_Transform[0][1]);
|
EXCHG( m_Transform[0][1], copyitem->m_Transform[0][1] );
|
||||||
EXCHG(m_Transform[1][0], copyitem->m_Transform[1][0]);
|
EXCHG( m_Transform[1][0], copyitem->m_Transform[1][0] );
|
||||||
EXCHG(m_Transform[1][1], copyitem->m_Transform[1][1]);
|
EXCHG( m_Transform[1][1], copyitem->m_Transform[1][1] );
|
||||||
for ( int ii = 0; ii < NUMBER_OF_FIELDS; ii++ )
|
for( int ii = 0; ii < NUMBER_OF_FIELDS; ii++ )
|
||||||
{
|
{
|
||||||
m_Field[ii].SwapData(©item->m_Field[ii]);
|
m_Field[ii].SwapData( ©item->m_Field[ii] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void EDA_SchComponentStruct::Place(WinEDA_DrawFrame * frame, wxDC * DC)
|
void EDA_SchComponentStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
{
|
{
|
||||||
/* save old text in undo list */
|
/* save old text in undo list */
|
||||||
if ( g_ItemToUndoCopy &&
|
if( g_ItemToUndoCopy
|
||||||
(g_ItemToUndoCopy->Type() == Type()) &&
|
&& ( g_ItemToUndoCopy->Type() == Type() )
|
||||||
((m_Flags & IS_NEW) == 0) )
|
&& ( (m_Flags & IS_NEW) == 0 ) )
|
||||||
{
|
{
|
||||||
/* restore old values and save new ones */
|
/* restore old values and save new ones */
|
||||||
SwapData( (EDA_SchComponentStruct*) g_ItemToUndoCopy);
|
SwapData( (EDA_SchComponentStruct*) g_ItemToUndoCopy );
|
||||||
|
|
||||||
/* save in undo list */
|
/* save in undo list */
|
||||||
((WinEDA_SchematicFrame*)frame)->SaveCopyInUndoList(this, IS_CHANGED);
|
( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_CHANGED );
|
||||||
|
|
||||||
/* restore new values */
|
/* restore new values */
|
||||||
SwapData( (EDA_SchComponentStruct*) g_ItemToUndoCopy);
|
SwapData( (EDA_SchComponentStruct*) g_ItemToUndoCopy );
|
||||||
|
|
||||||
delete g_ItemToUndoCopy;
|
delete g_ItemToUndoCopy;
|
||||||
g_ItemToUndoCopy = NULL;
|
g_ItemToUndoCopy = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
EDA_BaseStruct::Place(frame, DC);
|
EDA_BaseStruct::Place( frame, DC );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
void EDA_SchComponentStruct::ClearAnnotation()
|
void EDA_SchComponentStruct::ClearAnnotation()
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
/* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1)
|
/* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
m_RefIdNumber = 0;
|
m_RefIdNumber = 0;
|
||||||
|
|
||||||
while ( isdigit(m_Field[REFERENCE].m_Text.Last() ) )
|
while( isdigit( m_Field[REFERENCE].m_Text.Last() ) )
|
||||||
m_Field[REFERENCE].m_Text.RemoveLast();
|
m_Field[REFERENCE].m_Text.RemoveLast();
|
||||||
if ( m_Field[REFERENCE].m_Text.Last() != '?' )
|
|
||||||
m_Field[REFERENCE].m_Text.Append('?');
|
|
||||||
|
|
||||||
EDA_LibComponentStruct *Entry;
|
if( m_Field[REFERENCE].m_Text.Last() != '?' )
|
||||||
Entry = FindLibPart(m_ChipName.GetData(),wxEmptyString,FIND_ROOT);
|
m_Field[REFERENCE].m_Text.Append( '?' );
|
||||||
|
|
||||||
if ( !Entry || ! Entry->m_UnitSelectionLocked )
|
EDA_LibComponentStruct* Entry;
|
||||||
|
Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
||||||
|
|
||||||
|
if( !Entry || !Entry->m_UnitSelectionLocked )
|
||||||
m_Multi = 1;
|
m_Multi = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
EDA_SchComponentStruct * EDA_SchComponentStruct::GenCopy()
|
EDA_SchComponentStruct* EDA_SchComponentStruct::GenCopy()
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
{
|
{
|
||||||
EDA_SchComponentStruct * new_item = new EDA_SchComponentStruct( m_Pos );
|
EDA_SchComponentStruct* new_item = new EDA_SchComponentStruct( m_Pos );
|
||||||
int ii;
|
|
||||||
|
int ii;
|
||||||
|
|
||||||
new_item->m_Multi = m_Multi;
|
new_item->m_Multi = m_Multi;
|
||||||
new_item->m_ChipName = m_ChipName;
|
new_item->m_ChipName = m_ChipName;
|
||||||
@ -259,9 +301,9 @@ int ii;
|
|||||||
|
|
||||||
|
|
||||||
/* initialisation des Fields */
|
/* initialisation des Fields */
|
||||||
for(ii = 0; ii < NUMBER_OF_FIELDS; ii++)
|
for( ii = 0; ii < NUMBER_OF_FIELDS; ii++ )
|
||||||
{
|
{
|
||||||
m_Field[ii].PartTextCopy(& new_item->m_Field[ii]);
|
m_Field[ii].PartTextCopy( &new_item->m_Field[ii] );
|
||||||
}
|
}
|
||||||
|
|
||||||
return new_item;
|
return new_item;
|
||||||
@ -271,15 +313,16 @@ int ii;
|
|||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
void EDA_SchComponentStruct::SetRotationMiroir( int type_rotate )
|
void EDA_SchComponentStruct::SetRotationMiroir( int type_rotate )
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
/* Compute the new matrix transform for a schematic component
|
|
||||||
in order to have the requested transform (type_rotate = rot, mirror..)
|
|
||||||
which is applied to the initial transform.
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
int TempMat[2][2];
|
|
||||||
bool Transform = FALSE;
|
|
||||||
|
|
||||||
switch (type_rotate)
|
/* Compute the new matrix transform for a schematic component
|
||||||
|
* in order to have the requested transform (type_rotate = rot, mirror..)
|
||||||
|
* which is applied to the initial transform.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
int TempMat[2][2];
|
||||||
|
bool Transform = FALSE;
|
||||||
|
|
||||||
|
switch( type_rotate )
|
||||||
{
|
{
|
||||||
case CMP_ORIENT_0:
|
case CMP_ORIENT_0:
|
||||||
case CMP_NORMAL: /* Position Initiale */
|
case CMP_NORMAL: /* Position Initiale */
|
||||||
@ -332,61 +375,61 @@ bool Transform = FALSE;
|
|||||||
SetRotationMiroir( CMP_ROTATE_CLOCKWISE );
|
SetRotationMiroir( CMP_ROTATE_CLOCKWISE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (CMP_ORIENT_0+CMP_MIROIR_X):
|
case (CMP_ORIENT_0 + CMP_MIROIR_X):
|
||||||
SetRotationMiroir( CMP_ORIENT_0 );
|
SetRotationMiroir( CMP_ORIENT_0 );
|
||||||
SetRotationMiroir( CMP_MIROIR_X );
|
SetRotationMiroir( CMP_MIROIR_X );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (CMP_ORIENT_0+CMP_MIROIR_Y):
|
case (CMP_ORIENT_0 + CMP_MIROIR_Y):
|
||||||
SetRotationMiroir( CMP_ORIENT_0 );
|
SetRotationMiroir( CMP_ORIENT_0 );
|
||||||
SetRotationMiroir( CMP_MIROIR_Y );
|
SetRotationMiroir( CMP_MIROIR_Y );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (CMP_ORIENT_90+CMP_MIROIR_X):
|
case (CMP_ORIENT_90 + CMP_MIROIR_X):
|
||||||
SetRotationMiroir( CMP_ORIENT_90 );
|
SetRotationMiroir( CMP_ORIENT_90 );
|
||||||
SetRotationMiroir( CMP_MIROIR_X );
|
SetRotationMiroir( CMP_MIROIR_X );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (CMP_ORIENT_90+CMP_MIROIR_Y):
|
case (CMP_ORIENT_90 + CMP_MIROIR_Y):
|
||||||
SetRotationMiroir( CMP_ORIENT_90 );
|
SetRotationMiroir( CMP_ORIENT_90 );
|
||||||
SetRotationMiroir( CMP_MIROIR_Y );
|
SetRotationMiroir( CMP_MIROIR_Y );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (CMP_ORIENT_180+CMP_MIROIR_X):
|
case (CMP_ORIENT_180 + CMP_MIROIR_X):
|
||||||
SetRotationMiroir( CMP_ORIENT_180 );
|
SetRotationMiroir( CMP_ORIENT_180 );
|
||||||
SetRotationMiroir( CMP_MIROIR_X );
|
SetRotationMiroir( CMP_MIROIR_X );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (CMP_ORIENT_180+CMP_MIROIR_Y):
|
case (CMP_ORIENT_180 + CMP_MIROIR_Y):
|
||||||
SetRotationMiroir( CMP_ORIENT_180 );
|
SetRotationMiroir( CMP_ORIENT_180 );
|
||||||
SetRotationMiroir( CMP_MIROIR_Y );
|
SetRotationMiroir( CMP_MIROIR_Y );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (CMP_ORIENT_270+CMP_MIROIR_X):
|
case (CMP_ORIENT_270 + CMP_MIROIR_X):
|
||||||
SetRotationMiroir( CMP_ORIENT_270 );
|
SetRotationMiroir( CMP_ORIENT_270 );
|
||||||
SetRotationMiroir( CMP_MIROIR_X );
|
SetRotationMiroir( CMP_MIROIR_X );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (CMP_ORIENT_270+CMP_MIROIR_Y):
|
case (CMP_ORIENT_270 + CMP_MIROIR_Y):
|
||||||
SetRotationMiroir( CMP_ORIENT_270 );
|
SetRotationMiroir( CMP_ORIENT_270 );
|
||||||
SetRotationMiroir( CMP_MIROIR_Y );
|
SetRotationMiroir( CMP_MIROIR_Y );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Transform = FALSE;
|
Transform = FALSE;
|
||||||
DisplayError(NULL, wxT("SetRotateMiroir() error: ill value") );
|
DisplayError( NULL, wxT( "SetRotateMiroir() error: ill value" ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( Transform )
|
if( Transform )
|
||||||
{/* The new matrix transform is the old matrix transform modified by the
|
{/* The new matrix transform is the old matrix transform modified by the
|
||||||
requested transformation, which is the TempMat transform (rot, mirror ..)
|
* requested transformation, which is the TempMat transform (rot, mirror ..)
|
||||||
in order to have (in term of matrix transform):
|
* in order to have (in term of matrix transform):
|
||||||
transform coord = new_m_Transform * coord
|
* transform coord = new_m_Transform * coord
|
||||||
where transform coord is the coord modified by new_m_Transform from the initial
|
* where transform coord is the coord modified by new_m_Transform from the initial
|
||||||
value coord.
|
* value coord.
|
||||||
new_m_Transform is computed (from old_m_Transform and TempMat) to have:
|
* new_m_Transform is computed (from old_m_Transform and TempMat) to have:
|
||||||
transform coord = old_m_Transform * coord * TempMat
|
* transform coord = old_m_Transform * coord * TempMat
|
||||||
*/
|
*/
|
||||||
int NewMatrix[2][2];
|
int NewMatrix[2][2];
|
||||||
|
|
||||||
@ -414,59 +457,59 @@ bool Transform = FALSE;
|
|||||||
int EDA_SchComponentStruct::GetRotationMiroir()
|
int EDA_SchComponentStruct::GetRotationMiroir()
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
{
|
{
|
||||||
int type_rotate = CMP_ORIENT_0;
|
int type_rotate = CMP_ORIENT_0;
|
||||||
int TempMat[2][2], MatNormal[2][2];
|
int TempMat[2][2], MatNormal[2][2];
|
||||||
int ii;
|
int ii;
|
||||||
bool found = FALSE;
|
bool found = FALSE;
|
||||||
|
|
||||||
memcpy(TempMat, m_Transform, sizeof(TempMat));
|
memcpy( TempMat, m_Transform, sizeof(TempMat) );
|
||||||
SetRotationMiroir(CMP_ORIENT_0);
|
SetRotationMiroir( CMP_ORIENT_0 );
|
||||||
memcpy(MatNormal, m_Transform, sizeof(MatNormal));
|
memcpy( MatNormal, m_Transform, sizeof(MatNormal) );
|
||||||
|
|
||||||
for ( ii = 0; ii < 4; ii++ )
|
for( ii = 0; ii < 4; ii++ )
|
||||||
{
|
{
|
||||||
if ( memcmp(TempMat, m_Transform, sizeof(MatNormal)) == 0)
|
if( memcmp( TempMat, m_Transform, sizeof(MatNormal) ) == 0 )
|
||||||
{
|
{
|
||||||
found = TRUE; break;
|
found = TRUE; break;
|
||||||
}
|
}
|
||||||
SetRotationMiroir(CMP_ROTATE_COUNTERCLOCKWISE);
|
SetRotationMiroir( CMP_ROTATE_COUNTERCLOCKWISE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! found )
|
if( !found )
|
||||||
{
|
{
|
||||||
type_rotate = CMP_MIROIR_X + CMP_ORIENT_0;
|
type_rotate = CMP_MIROIR_X + CMP_ORIENT_0;
|
||||||
SetRotationMiroir(CMP_NORMAL);
|
SetRotationMiroir( CMP_NORMAL );
|
||||||
SetRotationMiroir(CMP_MIROIR_X);
|
SetRotationMiroir( CMP_MIROIR_X );
|
||||||
for ( ii = 0; ii < 4; ii++ )
|
for( ii = 0; ii < 4; ii++ )
|
||||||
{
|
{
|
||||||
if ( memcmp(TempMat, m_Transform, sizeof(MatNormal)) == 0)
|
if( memcmp( TempMat, m_Transform, sizeof(MatNormal) ) == 0 )
|
||||||
{
|
{
|
||||||
found = TRUE; break;
|
found = TRUE; break;
|
||||||
}
|
}
|
||||||
SetRotationMiroir(CMP_ROTATE_COUNTERCLOCKWISE);
|
SetRotationMiroir( CMP_ROTATE_COUNTERCLOCKWISE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! found )
|
if( !found )
|
||||||
{
|
{
|
||||||
type_rotate = CMP_MIROIR_Y + CMP_ORIENT_0;
|
type_rotate = CMP_MIROIR_Y + CMP_ORIENT_0;
|
||||||
SetRotationMiroir(CMP_NORMAL);
|
SetRotationMiroir( CMP_NORMAL );
|
||||||
SetRotationMiroir(CMP_MIROIR_Y);
|
SetRotationMiroir( CMP_MIROIR_Y );
|
||||||
for ( ii = 0; ii < 4; ii++ )
|
for( ii = 0; ii < 4; ii++ )
|
||||||
{
|
{
|
||||||
if ( memcmp(TempMat, m_Transform, sizeof(MatNormal)) == 0)
|
if( memcmp( TempMat, m_Transform, sizeof(MatNormal) ) == 0 )
|
||||||
{
|
{
|
||||||
found = TRUE; break;
|
found = TRUE; break;
|
||||||
}
|
}
|
||||||
SetRotationMiroir(CMP_ROTATE_COUNTERCLOCKWISE);
|
SetRotationMiroir( CMP_ROTATE_COUNTERCLOCKWISE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(m_Transform, TempMat, sizeof(m_Transform));
|
memcpy( m_Transform, TempMat, sizeof(m_Transform) );
|
||||||
|
|
||||||
if ( found )
|
if( found )
|
||||||
{
|
{
|
||||||
return (type_rotate + ii);
|
return type_rotate + ii;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -474,43 +517,87 @@ bool found = FALSE;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
wxPoint EDA_SchComponentStruct::GetScreenCoord(const wxPoint & coord)
|
wxPoint EDA_SchComponentStruct::GetScreenCoord( const wxPoint& coord )
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
/* Renvoie la coordonnée du point coord, en fonction de l'orientation
|
/* Renvoie la coordonnée du point coord, en fonction de l'orientation
|
||||||
du composant (rotation, miroir).
|
* du composant (rotation, miroir).
|
||||||
Les coord sont toujours relatives à l'ancre (coord 0,0) du composant
|
* Les coord sont toujours relatives à l'ancre (coord 0,0) du composant
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxPoint screenpos;
|
wxPoint screenpos;
|
||||||
|
|
||||||
screenpos.x = m_Transform[0][0] * coord.x + m_Transform[0][1] * coord.y;
|
screenpos.x = m_Transform[0][0] * coord.x + m_Transform[0][1] * coord.y;
|
||||||
screenpos.y = m_Transform[1][0] * coord.x + m_Transform[1][1] * coord.y;
|
screenpos.y = m_Transform[1][0] * coord.x + m_Transform[1][1] * coord.y;
|
||||||
return screenpos;
|
return screenpos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(DEBUG)
|
||||||
|
/**
|
||||||
|
* Function Show
|
||||||
|
* is used to output the object tree, currently for debugging only.
|
||||||
|
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||||
|
* of nesting of this object within the overall tree.
|
||||||
|
* @param os The ostream& to output to.
|
||||||
|
*/
|
||||||
|
void EDA_SchComponentStruct::Show( int nestLevel, std::ostream& os )
|
||||||
|
{
|
||||||
|
// for now, make it look like XML:
|
||||||
|
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
|
||||||
|
" ref=\"" << GetReference().mb_str() << '"' <<
|
||||||
|
" chipName=\"" << m_ChipName.mb_str() << '"' <<
|
||||||
|
m_Pos <<
|
||||||
|
" layer=\"" << m_Layer << '"' <<
|
||||||
|
"/>\n";
|
||||||
|
|
||||||
|
// skip the reference, it's been output already.
|
||||||
|
for( int i=1; i<NUMBER_OF_FIELDS; ++i )
|
||||||
|
{
|
||||||
|
wxString value = GetFieldValue( i );
|
||||||
|
|
||||||
|
if( !value.IsEmpty() )
|
||||||
|
{
|
||||||
|
NestedSpace( nestLevel+1, os ) << "<field" <<
|
||||||
|
" name=\"" << ReturnFieldName(i).mb_str() << '"' <<
|
||||||
|
" value=\"" << value.mb_str() << "\"/>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
PartTextStruct::PartTextStruct(const wxPoint & pos, const wxString & text):
|
PartTextStruct::PartTextStruct( const wxPoint& pos, const wxString& text ) :
|
||||||
EDA_BaseStruct(DRAW_PART_TEXT_STRUCT_TYPE),
|
EDA_BaseStruct( DRAW_PART_TEXT_STRUCT_TYPE ), EDA_TextStruct( text )
|
||||||
EDA_TextStruct(text)
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
{
|
{
|
||||||
m_Pos = pos;
|
m_Pos = pos;
|
||||||
m_FieldId = 0;
|
m_FieldId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************/
|
/************************************/
|
||||||
PartTextStruct::~PartTextStruct()
|
PartTextStruct::~PartTextStruct()
|
||||||
/************************************/
|
/************************************/
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
void PartTextStruct::PartTextCopy(PartTextStruct * target)
|
void PartTextStruct::PartTextCopy( PartTextStruct* target )
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
{
|
{
|
||||||
target->m_Text = m_Text;
|
target->m_Text = m_Text;
|
||||||
if ( m_FieldId >= FIELD1 )target->m_Name = m_Name;
|
if( m_FieldId >= FIELD1 )
|
||||||
|
target->m_Name = m_Name;
|
||||||
target->m_Layer = m_Layer;
|
target->m_Layer = m_Layer;
|
||||||
target->m_Pos = m_Pos;
|
target->m_Pos = m_Pos;
|
||||||
target->m_Size = m_Size;
|
target->m_Size = m_Size;
|
||||||
@ -526,11 +613,13 @@ void PartTextStruct::PartTextCopy(PartTextStruct * target)
|
|||||||
/*********************************/
|
/*********************************/
|
||||||
bool PartTextStruct::IsVoid()
|
bool PartTextStruct::IsVoid()
|
||||||
/*********************************/
|
/*********************************/
|
||||||
|
|
||||||
/* return True if The field is void, i.e.:
|
/* return True if The field is void, i.e.:
|
||||||
contains wxEmptyString or "~"
|
* contains wxEmptyString or "~"
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
if ( m_Text.IsEmpty() || m_Text == wxT("~") ) return TRUE;
|
if( m_Text.IsEmpty() || m_Text == wxT( "~" ) )
|
||||||
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,19 +627,20 @@ bool PartTextStruct::IsVoid()
|
|||||||
/********************************************/
|
/********************************************/
|
||||||
EDA_Rect PartTextStruct::GetBoundaryBox()
|
EDA_Rect PartTextStruct::GetBoundaryBox()
|
||||||
/********************************************/
|
/********************************************/
|
||||||
|
|
||||||
/* return
|
/* return
|
||||||
EDA_Rect contains the real (user coordinates) boundary box for a text field,
|
* EDA_Rect contains the real (user coordinates) boundary box for a text field,
|
||||||
according to the component position, rotation, mirror ...
|
* according to the component position, rotation, mirror ...
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
EDA_Rect BoundaryBox;
|
EDA_Rect BoundaryBox;
|
||||||
int hjustify, vjustify;
|
int hjustify, vjustify;
|
||||||
int textlen;
|
int textlen;
|
||||||
int orient;
|
int orient;
|
||||||
int dx, dy, x1, y1, x2, y2;
|
int dx, dy, x1, y1, x2, y2;
|
||||||
|
|
||||||
EDA_SchComponentStruct * DrawLibItem = (EDA_SchComponentStruct *) m_Parent;
|
EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*) m_Parent;
|
||||||
|
|
||||||
orient = m_Orient;
|
orient = m_Orient;
|
||||||
wxPoint pos = DrawLibItem->m_Pos;
|
wxPoint pos = DrawLibItem->m_Pos;
|
||||||
@ -558,12 +648,12 @@ EDA_SchComponentStruct * DrawLibItem = (EDA_SchComponentStruct *) m_Parent;
|
|||||||
y1 = m_Pos.y - pos.y;
|
y1 = m_Pos.y - pos.y;
|
||||||
|
|
||||||
textlen = GetLength();
|
textlen = GetLength();
|
||||||
if ( m_FieldId == REFERENCE ) // Real Text can be U1 or U1A
|
if( m_FieldId == REFERENCE ) // Real Text can be U1 or U1A
|
||||||
{
|
{
|
||||||
EDA_LibComponentStruct *Entry =
|
EDA_LibComponentStruct* Entry =
|
||||||
FindLibPart(DrawLibItem->m_ChipName.GetData(),wxEmptyString,FIND_ROOT);
|
FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
||||||
if ( Entry && (Entry->m_UnitCount > 1) )
|
if( Entry && (Entry->m_UnitCount > 1) )
|
||||||
textlen ++; // because U1 is show as U1A or U1B ...
|
textlen++; // because U1 is show as U1A or U1B ...
|
||||||
}
|
}
|
||||||
dx = m_Size.x * textlen;
|
dx = m_Size.x * textlen;
|
||||||
|
|
||||||
@ -580,54 +670,64 @@ EDA_SchComponentStruct * DrawLibItem = (EDA_SchComponentStruct *) m_Parent;
|
|||||||
+ (DrawLibItem->m_Transform[1][1] * y1);
|
+ (DrawLibItem->m_Transform[1][1] * y1);
|
||||||
|
|
||||||
/* If the component orientation is +/- 90 deg, the text orienation must be changed */
|
/* If the component orientation is +/- 90 deg, the text orienation must be changed */
|
||||||
if(DrawLibItem->m_Transform[0][1])
|
if( DrawLibItem->m_Transform[0][1] )
|
||||||
{
|
{
|
||||||
if ( orient == TEXT_ORIENT_HORIZ) orient = TEXT_ORIENT_VERT;
|
if( orient == TEXT_ORIENT_HORIZ )
|
||||||
else orient = TEXT_ORIENT_HORIZ;
|
orient = TEXT_ORIENT_VERT;
|
||||||
|
else
|
||||||
|
orient = TEXT_ORIENT_HORIZ;
|
||||||
/* is it mirrored (for text justify)*/
|
/* is it mirrored (for text justify)*/
|
||||||
EXCHG(hjustify, vjustify);
|
EXCHG( hjustify, vjustify );
|
||||||
if (DrawLibItem->m_Transform[1][0] < 0 ) vjustify = - vjustify;
|
if( DrawLibItem->m_Transform[1][0] < 0 )
|
||||||
if (DrawLibItem->m_Transform[0][1] > 0 ) hjustify = - hjustify;
|
vjustify = -vjustify;
|
||||||
|
if( DrawLibItem->m_Transform[0][1] > 0 )
|
||||||
|
hjustify = -hjustify;
|
||||||
}
|
}
|
||||||
else /* component horizontal: is it mirrored (for text justify)*/
|
else /* component horizontal: is it mirrored (for text justify)*/
|
||||||
{
|
{
|
||||||
if (DrawLibItem->m_Transform[0][0] < 0 )
|
if( DrawLibItem->m_Transform[0][0] < 0 )
|
||||||
hjustify = - hjustify;
|
hjustify = -hjustify;
|
||||||
if (DrawLibItem->m_Transform[1][1] > 0 )
|
if( DrawLibItem->m_Transform[1][1] > 0 )
|
||||||
vjustify = - vjustify;
|
vjustify = -vjustify;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( orient == TEXT_ORIENT_VERT ) EXCHG(dx, dy);
|
if( orient == TEXT_ORIENT_VERT )
|
||||||
|
EXCHG( dx, dy );
|
||||||
|
|
||||||
switch ( hjustify )
|
switch( hjustify )
|
||||||
{
|
{
|
||||||
case GR_TEXT_HJUSTIFY_CENTER:
|
case GR_TEXT_HJUSTIFY_CENTER:
|
||||||
x1 = x2 - (dx/2);
|
x1 = x2 - (dx / 2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GR_TEXT_HJUSTIFY_RIGHT:
|
case GR_TEXT_HJUSTIFY_RIGHT:
|
||||||
x1 = x2 - dx;
|
x1 = x2 - dx;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
x1 = x2;
|
x1 = x2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch ( vjustify )
|
|
||||||
|
switch( vjustify )
|
||||||
{
|
{
|
||||||
case GR_TEXT_VJUSTIFY_CENTER:
|
case GR_TEXT_VJUSTIFY_CENTER:
|
||||||
y1 = y2 - (dy/2);
|
y1 = y2 - (dy / 2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GR_TEXT_VJUSTIFY_BOTTOM:
|
case GR_TEXT_VJUSTIFY_BOTTOM:
|
||||||
y1 = y2 - dy;
|
y1 = y2 - dy;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
y1 = y2;
|
y1 = y2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
BoundaryBox.SetX(x1);
|
BoundaryBox.SetX( x1 );
|
||||||
BoundaryBox.SetY(y1);
|
BoundaryBox.SetY( y1 );
|
||||||
BoundaryBox.SetWidth(dx);
|
BoundaryBox.SetWidth( dx );
|
||||||
BoundaryBox.SetHeight(dy);
|
BoundaryBox.SetHeight( dy );
|
||||||
|
|
||||||
return BoundaryBox;
|
return BoundaryBox;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
/* Definition de la representation du composant */
|
/* Definition de la representation du composant */
|
||||||
#define NUMBER_OF_FIELDS 12 /* Nombre de champs de texte affectes au composant */
|
#define NUMBER_OF_FIELDS 12 /* Nombre de champs de texte affectes au composant */
|
||||||
typedef enum {
|
enum NumFieldType {
|
||||||
REFERENCE = 0, /* Champ Reference of part, i.e. "IC21" */
|
REFERENCE = 0, /* Champ Reference of part, i.e. "IC21" */
|
||||||
VALUE, /* Champ Value of part, i.e. "3.3K" */
|
VALUE, /* Champ Value of part, i.e. "3.3K" */
|
||||||
FOOTPRINT, /* Champ Name Module PCB, i.e. "16DIP300" */
|
FOOTPRINT, /* Champ Name Module PCB, i.e. "16DIP300" */
|
||||||
@ -28,7 +28,7 @@ typedef enum {
|
|||||||
FIELD6,
|
FIELD6,
|
||||||
FIELD7,
|
FIELD7,
|
||||||
FIELD8
|
FIELD8
|
||||||
} NumFieldType;
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Class to manage component fields.
|
/* Class to manage component fields.
|
||||||
@ -46,9 +46,10 @@ public:
|
|||||||
public:
|
public:
|
||||||
PartTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
|
PartTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
|
||||||
~PartTextStruct();
|
~PartTextStruct();
|
||||||
|
|
||||||
virtual wxString GetClass() const
|
virtual wxString GetClass() const
|
||||||
{
|
{
|
||||||
return wxT( "PartTextStruct" );
|
return wxT( "PartText" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -77,10 +78,18 @@ public:
|
|||||||
public:
|
public:
|
||||||
DrawPartStruct( KICAD_T struct_type, const wxPoint &pos );
|
DrawPartStruct( KICAD_T struct_type, const wxPoint &pos );
|
||||||
~DrawPartStruct();
|
~DrawPartStruct();
|
||||||
|
|
||||||
virtual wxString GetClass() const
|
virtual wxString GetClass() const
|
||||||
{
|
{
|
||||||
return wxT( "DrawPartStruct" );
|
return wxT( "DrawPart" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function GetReference
|
||||||
|
* returns a reference to the Reference
|
||||||
|
*/
|
||||||
|
const wxString& GetReference() { return m_Field[REFERENCE].m_Text; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -101,18 +110,29 @@ public:
|
|||||||
|
|
||||||
virtual wxString GetClass() const
|
virtual wxString GetClass() const
|
||||||
{
|
{
|
||||||
return wxT( "EDA_SchComponentStruct" );
|
return wxT( "EDA_SchComponent" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_SchComponentStruct* GenCopy( void );
|
EDA_SchComponentStruct* GenCopy();
|
||||||
void SetRotationMiroir( int type );
|
void SetRotationMiroir( int type );
|
||||||
int GetRotationMiroir();
|
int GetRotationMiroir();
|
||||||
wxPoint GetScreenCoord( const wxPoint& coord );
|
wxPoint GetScreenCoord( const wxPoint& coord );
|
||||||
void Display_Infos( WinEDA_DrawFrame* frame );
|
void Display_Infos( WinEDA_DrawFrame* frame );
|
||||||
void ClearAnnotation();
|
void ClearAnnotation();
|
||||||
EDA_Rect GetBoundaryBox();
|
EDA_Rect GetBoundaryBox();
|
||||||
wxString ReturnFieldName( int FieldNumber );
|
|
||||||
|
const wxString& ReturnFieldName( int aFieldNdx ) const;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function GetFieldValue
|
||||||
|
* returns a reference to the field value.
|
||||||
|
* @param aFieldNdx An index into the array of fields, 0 - FIELD8
|
||||||
|
* @return const wxString& - the field value or wxEmptyString
|
||||||
|
*/
|
||||||
|
const wxString& GetFieldValue( int aFieldNdx ) const;
|
||||||
|
|
||||||
|
|
||||||
virtual void Draw( WinEDA_DrawPanel* panel,
|
virtual void Draw( WinEDA_DrawPanel* panel,
|
||||||
wxDC* DC,
|
wxDC* DC,
|
||||||
@ -122,6 +142,17 @@ public:
|
|||||||
void SwapData( EDA_SchComponentStruct* copyitem );
|
void SwapData( EDA_SchComponentStruct* copyitem );
|
||||||
|
|
||||||
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
|
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
|
||||||
|
|
||||||
|
#if defined(DEBUG)
|
||||||
|
/**
|
||||||
|
* Function Show
|
||||||
|
* is used to output the object tree, currently for debugging only.
|
||||||
|
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||||
|
* of nesting of this object within the overall tree.
|
||||||
|
* @param os The ostream& to output to.
|
||||||
|
*/
|
||||||
|
void Show( int nestLevel, std::ostream& os );
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
645
eeschema/erc.cpp
645
eeschema/erc.cpp
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -272,8 +272,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
|
|||||||
if( !Failed )
|
if( !Failed )
|
||||||
{
|
{
|
||||||
PolylineStruct->Pnext = screen->EEDrawList;
|
PolylineStruct->Pnext = screen->EEDrawList;
|
||||||
screen->EEDrawList = (EDA_BaseStruct*)
|
screen->EEDrawList = (EDA_BaseStruct*) PolylineStruct;
|
||||||
PolylineStruct;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -441,6 +440,10 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
|
|||||||
|
|
||||||
screen->EEDrawList = Phead;
|
screen->EEDrawList = Phead;
|
||||||
|
|
||||||
|
#if defined(DEBUG)
|
||||||
|
screen->Show( 0, std::cout );
|
||||||
|
#endif
|
||||||
|
|
||||||
fclose( f );
|
fclose( f );
|
||||||
|
|
||||||
TestDanglingEnds( screen->EEDrawList, NULL );
|
TestDanglingEnds( screen->EEDrawList, NULL );
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
/**********************************************/
|
/**********************************************/
|
||||||
/* Module de calcul de la Netliste: netlist.h */
|
/* Module de calcul de la Netliste: netlist.h */
|
||||||
/**********************************************/
|
/**********************************************/
|
||||||
|
|
||||||
#ifndef _NETLIST_H_
|
#ifndef _NETLIST_H_
|
||||||
#define _NETLIST_H_
|
#define _NETLIST_H_
|
||||||
@ -15,8 +15,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Indicateurs de type de netliste generee */
|
/* Indicateurs de type de netliste generee */
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
NET_TYPE_NOT_INIT = 0,
|
NET_TYPE_NOT_INIT = 0,
|
||||||
NET_TYPE_PCBNEW,
|
NET_TYPE_PCBNEW,
|
||||||
NET_TYPE_ORCADPCB2,
|
NET_TYPE_ORCADPCB2,
|
||||||
@ -31,7 +30,7 @@ typedef enum
|
|||||||
NET_TYPE_CUSTOM7,
|
NET_TYPE_CUSTOM7,
|
||||||
NET_TYPE_CUSTOM8,
|
NET_TYPE_CUSTOM8,
|
||||||
NET_TYPE_MAX
|
NET_TYPE_MAX
|
||||||
} TypeNetForm ;
|
} TypeNetForm;
|
||||||
|
|
||||||
|
|
||||||
/* Max pin number per component and footprint */
|
/* Max pin number per component and footprint */
|
||||||
@ -58,34 +57,36 @@ typedef enum { /* Valeur du Flag de connection */
|
|||||||
CONNECT /* connexion normale */
|
CONNECT /* connexion normale */
|
||||||
} IsConnectType;
|
} IsConnectType;
|
||||||
|
|
||||||
|
|
||||||
/* Structure decrivant 1 element de connexion (pour netlist ) */
|
/* Structure decrivant 1 element de connexion (pour netlist ) */
|
||||||
class ObjetNetListStruct
|
class ObjetNetListStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void * m_Comp; /* Pointeur sur la definition de l'objet */
|
void* m_Comp; /* Pointeur sur la definition de l'objet */
|
||||||
void * m_Link; /* Pour SheetLabelStruct: Pointeur sur la feuille de hierarchie
|
void* m_Link; /* Pour SheetLabelStruct: Pointeur sur la feuille de hierarchie
|
||||||
Pour les Pins: pointeur sur le composant */
|
* Pour les Pins: pointeur sur le composant */
|
||||||
int m_Flag; /* flag pour calculs internes */
|
int m_Flag; /* flag pour calculs internes */
|
||||||
SCH_SCREEN * m_Screen; /* Ecran d'appartenance */
|
SCH_SCREEN* m_Screen; /* Ecran d'appartenance */
|
||||||
NetObjetType m_Type;
|
NetObjetType m_Type;
|
||||||
int m_ElectricalType; /* Pour Pins et sheet labels: type electrique */
|
int m_ElectricalType; /* Pour Pins et sheet labels: type electrique */
|
||||||
int m_NetCode; /* pour elements simples */
|
int m_NetCode; /* pour elements simples */
|
||||||
int m_BusNetCode; /* pour connexions type bus */
|
int m_BusNetCode; /* pour connexions type bus */
|
||||||
int m_Member; /* pour les labels type BUSWIRE ( labels de bus eclate )
|
int m_Member; /* pour les labels type BUSWIRE ( labels de bus eclate )
|
||||||
numero de membre */
|
* numero de membre */
|
||||||
IsConnectType m_FlagOfConnection;
|
IsConnectType m_FlagOfConnection;
|
||||||
int m_SheetNumber; /* Sheet number for this item */
|
int m_SheetNumber; /* Sheet number for this item */
|
||||||
int m_NumInclude; /* Numero de sous schema correpondant a la sheet (Gestion des GLabels et Pin Sheet)*/
|
int m_NumInclude; /* Numero de sous schema correpondant a la sheet (Gestion des GLabels et Pin Sheet)*/
|
||||||
long m_PinNum; /* numero de pin( 4 octets -> 4 codes ascii) */
|
long m_PinNum; /* numero de pin( 4 octets -> 4 codes ascii) */
|
||||||
const wxString * m_Label; /* Tous types Labels:pointeur sur la wxString definissant le label */
|
const wxString* m_Label; /* Tous types Labels:pointeur sur la wxString definissant le label */
|
||||||
wxPoint m_Start, m_End;
|
wxPoint m_Start, m_End;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Structure decrivant 1 composant de la schematique (pour annotation ) */
|
/* Structure decrivant 1 composant de la schematique (pour annotation ) */
|
||||||
struct CmpListStruct
|
struct CmpListStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EDA_SchComponentStruct * m_Cmp; /* Pointeur sur le composant */
|
EDA_SchComponentStruct* m_Cmp; /* Pointeur sur le composant */
|
||||||
int m_NbParts; /* Nombre de parts par boitier */
|
int m_NbParts; /* Nombre de parts par boitier */
|
||||||
bool m_PartsLocked; // For multi part components: True if the part cannot be changed
|
bool m_PartsLocked; // For multi part components: True if the part cannot be changed
|
||||||
int m_Unit; /* Numero de part */
|
int m_Unit; /* Numero de part */
|
||||||
@ -102,11 +103,11 @@ public:
|
|||||||
|
|
||||||
/* Global Variables */
|
/* Global Variables */
|
||||||
eda_global int g_NbrObjNet;
|
eda_global int g_NbrObjNet;
|
||||||
eda_global ObjetNetListStruct *g_TabObjNet;
|
eda_global ObjetNetListStruct* g_TabObjNet;
|
||||||
|
|
||||||
/* Prototypes: */
|
/* Prototypes: */
|
||||||
void WriteNetList(WinEDA_SchematicFrame * frame, const wxString & FileNameNL, bool use_netnames);
|
void WriteNetList( WinEDA_SchematicFrame* frame, const wxString& FileNameNL, bool use_netnames );
|
||||||
void FreeTabNetList(ObjetNetListStruct * TabNetItems, int NbrNetItems);
|
void FreeTabNetList( ObjetNetListStruct* TabNetItems, int NbrNetItems );
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -75,9 +75,10 @@ public:
|
|||||||
public:
|
public:
|
||||||
EDA_DrawLineStruct( const wxPoint& pos, int layer );
|
EDA_DrawLineStruct( const wxPoint& pos, int layer );
|
||||||
~EDA_DrawLineStruct() { }
|
~EDA_DrawLineStruct() { }
|
||||||
|
|
||||||
virtual wxString GetClass() const
|
virtual wxString GetClass() const
|
||||||
{
|
{
|
||||||
return wxT( "EDA_DrawLineStruct" );
|
return wxT( "EDA_DrawLine" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -92,6 +93,17 @@ public:
|
|||||||
|
|
||||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
|
||||||
int Color = -1 );
|
int Color = -1 );
|
||||||
|
|
||||||
|
#if defined(DEBUG)
|
||||||
|
/**
|
||||||
|
* Function Show
|
||||||
|
* is used to output the object tree, currently for debugging only.
|
||||||
|
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||||
|
* of nesting of this object within the overall tree.
|
||||||
|
* @param os The ostream& to output to.
|
||||||
|
*/
|
||||||
|
void Show( int nestLevel, std::ostream& os );
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -108,7 +120,7 @@ public:
|
|||||||
~DrawMarkerStruct();
|
~DrawMarkerStruct();
|
||||||
virtual wxString GetClass() const
|
virtual wxString GetClass() const
|
||||||
{
|
{
|
||||||
return wxT( "DrawMarkerStruct" );
|
return wxT( "DrawMarker" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -116,6 +128,16 @@ public:
|
|||||||
wxString GetComment();
|
wxString GetComment();
|
||||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||||
int draw_mode, int Color = -1 );
|
int draw_mode, int Color = -1 );
|
||||||
|
#if defined(DEBUG)
|
||||||
|
/**
|
||||||
|
* Function Show
|
||||||
|
* is used to output the object tree, currently for debugging only.
|
||||||
|
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||||
|
* of nesting of this object within the overall tree.
|
||||||
|
* @param os The ostream& to output to.
|
||||||
|
*/
|
||||||
|
void Show( int nestLevel, std::ostream& os );
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -129,7 +151,7 @@ public:
|
|||||||
~DrawNoConnectStruct() { }
|
~DrawNoConnectStruct() { }
|
||||||
virtual wxString GetClass() const
|
virtual wxString GetClass() const
|
||||||
{
|
{
|
||||||
return wxT( "DrawNoConnectStruct" );
|
return wxT( "DrawNoConnect" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -154,9 +176,10 @@ public:
|
|||||||
public:
|
public:
|
||||||
DrawBusEntryStruct( const wxPoint& pos, int shape, int id );
|
DrawBusEntryStruct( const wxPoint& pos, int shape, int id );
|
||||||
~DrawBusEntryStruct() { }
|
~DrawBusEntryStruct() { }
|
||||||
|
|
||||||
virtual wxString GetClass() const
|
virtual wxString GetClass() const
|
||||||
{
|
{
|
||||||
return wxT( "DrawBusEntryStruct" );
|
return wxT( "DrawBusEntry" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -177,9 +200,10 @@ public:
|
|||||||
public:
|
public:
|
||||||
DrawPolylineStruct( int layer );
|
DrawPolylineStruct( int layer );
|
||||||
~DrawPolylineStruct();
|
~DrawPolylineStruct();
|
||||||
|
|
||||||
virtual wxString GetClass() const
|
virtual wxString GetClass() const
|
||||||
{
|
{
|
||||||
return wxT( "DrawPolylineStruct" );
|
return wxT( "DrawPolyline" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -197,9 +221,10 @@ public:
|
|||||||
public:
|
public:
|
||||||
DrawJunctionStruct( const wxPoint& pos );
|
DrawJunctionStruct( const wxPoint& pos );
|
||||||
~DrawJunctionStruct() { }
|
~DrawJunctionStruct() { }
|
||||||
|
|
||||||
virtual wxString GetClass() const
|
virtual wxString GetClass() const
|
||||||
{
|
{
|
||||||
return wxT( "DrawJunctionStruct" );
|
return wxT( "DrawJunction" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -209,8 +234,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class DrawTextStruct : public EDA_BaseStruct
|
class DrawTextStruct : public EDA_BaseStruct, public EDA_TextStruct
|
||||||
, public EDA_TextStruct
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Layer;
|
int m_Layer;
|
||||||
@ -224,7 +248,7 @@ public:
|
|||||||
|
|
||||||
virtual wxString GetClass() const
|
virtual wxString GetClass() const
|
||||||
{
|
{
|
||||||
return wxT( "DrawTextStruct" );
|
return wxT( "DrawText" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -248,7 +272,7 @@ public:
|
|||||||
|
|
||||||
virtual wxString GetClass() const
|
virtual wxString GetClass() const
|
||||||
{
|
{
|
||||||
return wxT( "DrawLabelStruct" );
|
return wxT( "DrawLabel" );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -264,7 +288,7 @@ public:
|
|||||||
|
|
||||||
virtual wxString GetClass() const
|
virtual wxString GetClass() const
|
||||||
{
|
{
|
||||||
return wxT( "DrawGlobalLabelStruct" );
|
return wxT( "DrawGlobalLabel" );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ LibEDA_BaseStruct * LocatePin(const wxPoint & RefPos,
|
|||||||
int Unit, int Convert, EDA_SchComponentStruct * DrawItem = NULL);
|
int Unit, int Convert, EDA_SchComponentStruct * DrawItem = NULL);
|
||||||
/* Routine de localisation d'une PIN de la PartLib pointee par Entry */
|
/* Routine de localisation d'une PIN de la PartLib pointee par Entry */
|
||||||
|
|
||||||
wxString ReturnDefaultFieldName(int FieldNumber);
|
const wxString& ReturnDefaultFieldName( int aFieldNdx );
|
||||||
|
|
||||||
|
|
||||||
/***************/
|
/***************/
|
||||||
|
@ -215,7 +215,7 @@ private:
|
|||||||
char m_FlagRefreshReq; /* indique que l'ecran doit redessine */
|
char m_FlagRefreshReq; /* indique que l'ecran doit redessine */
|
||||||
char m_FlagModified; // indique modif du PCB,utilise pour eviter une sortie sans sauvegarde
|
char m_FlagModified; // indique modif du PCB,utilise pour eviter une sortie sans sauvegarde
|
||||||
char m_FlagSave; // indique sauvegarde auto faite
|
char m_FlagSave; // indique sauvegarde auto faite
|
||||||
EDA_BaseStruct* m_CurrentItem; ///< Current selected object
|
EDA_BaseStruct* m_CurrentItem; ///< Currently selected object
|
||||||
|
|
||||||
/* Valeurs du pas de grille et du zoom */
|
/* Valeurs du pas de grille et du zoom */
|
||||||
public:
|
public:
|
||||||
@ -260,17 +260,12 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Function SetCurItem
|
* Function SetCurItem
|
||||||
* sets the currently selected object, m_CurrentItem.
|
* sets the currently selected object, m_CurrentItem.
|
||||||
* This is intentionally not inlined so we can set breakpoints on the
|
|
||||||
* activity easier in base_screen.cpp.
|
|
||||||
* @param current Any object derived from EDA_BaseStruct
|
* @param current Any object derived from EDA_BaseStruct
|
||||||
*/
|
*/
|
||||||
void SetCurItem( EDA_BaseStruct* current )
|
void SetCurItem( EDA_BaseStruct* current ) { m_CurrentItem = current; }
|
||||||
{
|
|
||||||
m_CurrentItem = current;
|
|
||||||
}
|
|
||||||
|
|
||||||
EDA_BaseStruct* GetCurItem() const { return m_CurrentItem; }
|
EDA_BaseStruct* GetCurItem() const { return m_CurrentItem; }
|
||||||
|
|
||||||
|
|
||||||
/* fonctions relatives au zoom */
|
/* fonctions relatives au zoom */
|
||||||
int GetZoom(); /* retourne le coeff de zoom */
|
int GetZoom(); /* retourne le coeff de zoom */
|
||||||
void SetZoom( int coeff ); /* ajuste le coeff de zoom a coeff */
|
void SetZoom( int coeff ); /* ajuste le coeff de zoom a coeff */
|
||||||
@ -313,6 +308,18 @@ public:
|
|||||||
{
|
{
|
||||||
return wxT( "BASE_SCREEN" );
|
return wxT( "BASE_SCREEN" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(DEBUG)
|
||||||
|
/**
|
||||||
|
* Function Show
|
||||||
|
* is used to output the object tree, currently for debugging only.
|
||||||
|
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||||
|
* of nesting of this object within the overall tree.
|
||||||
|
* @param os The ostream& to output to.
|
||||||
|
*/
|
||||||
|
void Show( int nestLevel, std::ostream& os );
|
||||||
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -441,10 +441,10 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay()
|
|||||||
{
|
{
|
||||||
wxMenu itemMenu;
|
wxMenu itemMenu;
|
||||||
|
|
||||||
int limit = MIN( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );
|
|
||||||
|
|
||||||
itemMenu.SetTitle( _("Selection Clarification") ); // does this work? not under Linux!
|
itemMenu.SetTitle( _("Selection Clarification") ); // does this work? not under Linux!
|
||||||
|
|
||||||
|
int limit = MIN( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );
|
||||||
|
|
||||||
for( int i=0; i<limit; ++i )
|
for( int i=0; i<limit; ++i )
|
||||||
{
|
{
|
||||||
wxString text;
|
wxString text;
|
||||||
|
@ -124,6 +124,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||||||
DrawPanel->CursorOff( &dc );
|
DrawPanel->CursorOff( &dc );
|
||||||
DrawPanel->m_CanStartBlock = -1; // Avoid to start a block coomand when clicking on menu
|
DrawPanel->m_CanStartBlock = -1; // Avoid to start a block coomand when clicking on menu
|
||||||
|
|
||||||
|
|
||||||
// If command in progress: Put the Cancel command (if needed) and End command
|
// If command in progress: Put the Cancel command (if needed) and End command
|
||||||
if( m_ID_current_state )
|
if( m_ID_current_state )
|
||||||
{
|
{
|
||||||
@ -161,13 +162,11 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Select a proper item */
|
/* Select a proper item */
|
||||||
if( (item == NULL) || (item->m_Flags == 0) )
|
if( !item || !item->m_Flags )
|
||||||
{
|
{
|
||||||
item = PcbGeneralLocateAndDisplay();
|
item = PcbGeneralLocateAndDisplay();
|
||||||
SetCurItem(item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
item = GetCurItem();
|
|
||||||
if( item )
|
if( item )
|
||||||
flags = item->m_Flags;
|
flags = item->m_Flags;
|
||||||
else
|
else
|
||||||
@ -183,10 +182,18 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||||||
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE )
|
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE )
|
||||||
{
|
{
|
||||||
aPopMenu->AppendSeparator();
|
aPopMenu->AppendSeparator();
|
||||||
|
|
||||||
|
if( !((MODULE*)item)->IsLocked() )
|
||||||
|
{
|
||||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE, _( "Lock Module" ),
|
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE, _( "Lock Module" ),
|
||||||
Locked_xpm );
|
Locked_xpm );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, _( "Unlock Module" ),
|
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, _( "Unlock Module" ),
|
||||||
Unlocked_xpm );
|
Unlocked_xpm );
|
||||||
|
}
|
||||||
|
|
||||||
if( !flags )
|
if( !flags )
|
||||||
aPopMenu->Append( ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE,
|
aPopMenu->Append( ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE,
|
||||||
_( "Auto place Module" ) );
|
_( "Auto place Module" ) );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user