Commit 5679e675 authored by Dick Hollenbeck's avatar Dick Hollenbeck

1) make PART::Format() omit any defaults for conciseness.

2) switch spec format to *.fodt, and edit it, mentioning lots of defaults.

3) Code pin_merge, but did not test it.
parent 6c89776b
...@@ -11,56 +11,56 @@ REVS="rev1 rev5 rev10" ...@@ -11,56 +11,56 @@ REVS="rev1 rev5 rev10"
REFERENCE=" REFERENCE="
(reference U? (reference U?
(effects (at 12 13 180)(font (size .7 1))(visible yes)) (effects (at 12 13 180)(font (size 7 10))(visible yes))
)" )"
LINE=" LINE="
(line (line
(pts (xy 12 13)(xy 12 20))(line_width 1.5) (pts (xy 12 13)(xy 12 20))(stroke 1.5)
)" )"
RECT=" RECT="
(rectangle (rectangle
(start 4 5)(end 6 8)(line_width 2.3)(fill transparent) (start 4 5)(end 6 8)(stroke 2.3)(fill transparent)
)" )"
CIRCLE=" CIRCLE="
(circle (circle
(center 1 0)(radius 5)(line_width 2.1)(fill none) (center 1 0)(radius 5)(stroke 2.1)(fill none)
)" )"
ARC=" ARC="
(arc (arc
(pos 22 33)(radius 12)(start 2 4)(end 13 33)(line_width 2.3)(fill filled) (pos 22 33)(radius 12)(start 2 4)(end 13 33)(stroke 2.3)(fill filled)
)" )"
BEZIER=" BEZIER="
(bezier (bezier
(fill none)(line_width 2.0)(pts (xy 0 1)(xy 2 4)) (fill none)(stroke 2.0)(pts (xy 0 1)(xy 2 4))
)" )"
TEXT=" TEXT="
(text (at 23 23 90.0) \"This is some text\" (justify left bottom)(visible yes)(fill filled) (text (at 23 23 90.0) \"This is some text\" (justify left bottom)(visible yes)(fill filled)
(font arial (size .8 1.2)) (font arial (size 8 12))
)" )"
PIN1=" PIN1="
(pin output line (at 7 8 90)(length 2)(visible yes) (pin out line (at 7 8 90)
(signal #WE (font (size 0.9 1.1) bold)(visible yes)) (signal #WE (font (size 8 10) bold)(visible no))
(padname A23 (font (size 0.9 1.1) italic bold) (visible yes)) (pad A23 (font (size 9 11) italic bold))
)" )"
PIN2=" PIN2="
(pin input line (at 8 8)(length 2)(visible yes) (pin in line (at 8 8)(visible yes)
(signal #WAIT (font (size 0.9 1.1) bold)(visible yes)) (signal #WAIT (visible yes))
(padname A24 (font (size 0.9 1.1) italic bold) (visible yes)) (pad A24 (visible yes))
)" )"
PIN3=" PIN3="
(pin (padname A25))" (pin (pad A25))"
PINS=" PINS="
(pin (padname Z12))(pin (padname Y14))(pin (padname Z13))(pin (padname Y15))" (pin (pad Z12))(pin (pad Y14))(pin (pad Z13))(pin (pad Y15))"
PIN_SWAP=" PIN_SWAP="
...@@ -70,17 +70,17 @@ PIN_RENUM=" ...@@ -70,17 +70,17 @@ PIN_RENUM="
(pin_renum A24 B24)" (pin_renum A24 B24)"
PIN_RENAME=" PIN_RENAME="
(pin_rename #WE LED)" (pin_rename B24 LED)"
PIN_DELETE=" PIN_DELETE="
(pin_del B24)" (pin_del B24)"
PIN_MERGE="(pin_merge A23 (hide Z12 Y14))(pin_merge A25 (hide Z13 Y15))" PIN_MERGE="(pin_merge A23 (pads Z12 Y14))(pin_merge A25 (pads Z13 Y15))"
PROP1=" PROP1="
(property mWatts 12 (property mWatts 12
(effects (at 1 34 270)(font (size .5 1) italic bold)(visible no)) (effects (at 1 34 270)(font (size 5 9) italic bold)(visible no))
)" )"
KEYWORDS=" KEYWORDS="
......
...@@ -47,7 +47,6 @@ class LIB_TABLE; ...@@ -47,7 +47,6 @@ class LIB_TABLE;
*/ */
class LIB_SOURCE class LIB_SOURCE
{ {
friend class LIBS; ///< the LIB factory is thru LIB_TABLE::LookupPart()
friend class LIB; ///< the LIB uses these functions. friend class LIB; ///< the LIB uses these functions.
protected: ///< derived classes must implement protected: ///< derived classes must implement
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <sch_lpid.h> #include <sch_lpid.h>
#include <sch_lib_table.h> #include <sch_lib_table.h>
#include <macros.h> #include <macros.h>
//#include <richio.h>
/** /**
...@@ -39,9 +38,19 @@ ...@@ -39,9 +38,19 @@
static void formatAt( OUTPUTFORMATTER* out, const POINT& aPos, ANGLE aAngle, int indent=0 ) static void formatAt( OUTPUTFORMATTER* out, const POINT& aPos, ANGLE aAngle, int indent=0 )
throw( IO_ERROR ) throw( IO_ERROR )
{ {
out->Print( indent, aAngle!=0.0 ? "(at %.6g %.6g %.6g)" : "(at %.6g %.6g)", // if( aPos.x || aPos.y || aAngle )
InternalToLogical( aPos.x ), InternalToLogical( aPos.y ), {
double( aAngle ) ); out->Print( indent, aAngle!=0.0 ? "(at %.6g %.6g %.6g)" : "(at %.6g %.6g)",
InternalToLogical( aPos.x ), InternalToLogical( aPos.y ),
double( aAngle ) );
}
}
static void formatStroke( OUTPUTFORMATTER* out, STROKE aStroke, int indent=0 )
throw( IO_ERROR )
{
if( aStroke == STROKE_DEFAULT )
out->Print( indent, "(stroke %.6g)", InternalToWidth( aStroke ) );
} }
...@@ -145,13 +154,13 @@ PROPERTY* PART::FieldLookup( PROP_ID aPropertyId ) ...@@ -145,13 +154,13 @@ PROPERTY* PART::FieldLookup( PROP_ID aPropertyId )
return p; return p;
} }
PINS::iterator PART::pinFindByPadName( const wxString& aPadName ) PINS::iterator PART::pinFindByPad( const wxString& aPad )
{ {
PINS::iterator it; PINS::iterator it;
for( it = pins.begin(); it != pins.end(); ++it ) for( it = pins.begin(); it != pins.end(); ++it )
{ {
if( (*it)->padname.text == aPadName ) if( (*it)->pad.text == aPad )
break; break;
} }
...@@ -159,23 +168,21 @@ PINS::iterator PART::pinFindByPadName( const wxString& aPadName ) ...@@ -159,23 +168,21 @@ PINS::iterator PART::pinFindByPadName( const wxString& aPadName )
} }
PINS::iterator PART::pinFindBySignal( const wxString& aSignal ) void PART::PinsFindBySignal( PIN_LIST* aResults, const wxString& aSignal )
{ {
PINS::iterator it; for( PINS::const_iterator it = pins.begin(); it != pins.end(); ++it )
for( it = pins.begin(); it != pins.end(); ++it )
{ {
if( (*it)->signal.text == aSignal ) if( (*it)->signal.text == aSignal )
break; {
aResults->push_back( *it );
}
} }
return it;
} }
bool PART::PinDelete( const wxString& aPadName ) bool PART::PinDelete( const wxString& aPad )
{ {
PINS::iterator it = pinFindByPadName( aPadName ); PINS::iterator it = pinFindByPad( aPad );
if( it != pins.end() ) if( it != pins.end() )
{ {
delete *it; delete *it;
...@@ -313,7 +320,7 @@ void PART::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const ...@@ -313,7 +320,7 @@ void PART::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
for( MERGE_SETS::const_iterator mit = pin_merges.begin(); mit != pin_merges.end(); ++mit ) for( MERGE_SETS::const_iterator mit = pin_merges.begin(); mit != pin_merges.end(); ++mit )
{ {
out->Print( indent+1, "(pin_merge %s (hide", out->Quotew( mit->first ).c_str() ); out->Print( indent+1, "(pin_merge %s (pads", out->Quotew( mit->first ).c_str() );
const MERGE_SET& mset = *mit->second; const MERGE_SET& mset = *mit->second;
for( MERGE_SET::const_iterator pit = mset.begin(); pit != mset.end(); ++pit ) for( MERGE_SET::const_iterator pit = mset.begin(); pit != mset.end(); ++pit )
...@@ -392,42 +399,58 @@ void TEXT_EFFECTS::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const ...@@ -392,42 +399,58 @@ void TEXT_EFFECTS::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
void FONT::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const void FONT::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
throw( IO_ERROR ) throw( IO_ERROR )
{ {
if( name.IsEmpty() ) if( italic || bold || !name.IsEmpty() || size.height != FONTZ_DEFAULT || size.width != FONTZ_DEFAULT )
out->Print( indent, "(font " ); {
else if( name.IsEmpty() )
out->Print( indent, "(font %s ", out->Quotew( name ).c_str() ); out->Print( indent, "(font " );
else
out->Print( indent, "(font %s ", out->Quotew( name ).c_str() );
out->Print( 0, "(size %.6g %.6g)", out->Print( 0, "(size %.6g %.6g)",
InternalToLogical( size.GetHeight() ), InternalToFontz( size.height ),
InternalToLogical( size.GetWidth() ) ); InternalToFontz( size.width ) );
if( italic ) if( italic )
out->Print( 0, " italic" ); out->Print( 0, " italic" );
if( bold ) if( bold )
out->Print( 0, " bold" ); out->Print( 0, " bold" );
out->Print( 0, ")%s", (ctl & CTL_OMIT_NL) ? "" : "\n" ); out->Print( 0, ")%s", (ctl & CTL_OMIT_NL) ? "" : "\n" );
}
} }
void PIN::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const void PIN::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
throw( IO_ERROR ) throw( IO_ERROR )
{ {
bool hasSignal = !signal.text.IsEmpty(); bool hasSignal = !signal.text.IsEmpty();
bool hasPadName = !padname.text.IsEmpty(); bool hasPad = !pad.text.IsEmpty();
out->Print( indent, "(pin %s %s ", ShowType(), ShowShape() ); out->Print( indent, "(pin" );
formatAt( out, pos, angle ); if( connectionType != PIN_CONN_DEFAULT )
out->Print( 0, "(length %.6g)", InternalToLogical( length ) ); out->Print( 0, " %s", ShowType() );
out->Print( 0, "(visible %s)\n", isVisible ? "yes" : "no" );
if( shape != PIN_SHAPE_DEFAULT )
out->Print( 0, " %s", ShowShape() );
out->Print( 0, " " );
if( pos.x || pos.y || angle )
formatAt( out, pos, angle );
if( length != PIN_LEN_DEFAULT )
out->Print( 0, "(length %.6g)", InternalToLogical( length ) );
if( !isVisible )
out->Print( 0, "(visible %s)", isVisible ? "yes" : "no" );
if( hasSignal ) if( hasSignal )
signal.Format( out, "signal", indent+1, hasPadName ? 0 : CTL_OMIT_NL ); signal.Format( out, "signal", 0, CTL_OMIT_NL );
if( hasPadName ) if( hasPad )
padname.Format( out, "padname", indent+1, CTL_OMIT_NL ); pad.Format( out, "pad", 0, CTL_OMIT_NL );
out->Print( 0, ")\n" ); out->Print( 0, ")\n" );
} }
...@@ -441,11 +464,14 @@ PIN::~PIN() ...@@ -441,11 +464,14 @@ PIN::~PIN()
void PINTEXT::Format( OUTPUTFORMATTER* out, const char* aElement, int indent, int ctl ) const void PINTEXT::Format( OUTPUTFORMATTER* out, const char* aElement, int indent, int ctl ) const
throw( IO_ERROR ) throw( IO_ERROR )
{ {
out->Print( indent, "(%s %s ", aElement, out->Quotew( text ).c_str() ); out->Print( indent, "(%s %s", aElement, out->Quotew( text ).c_str() );
font.Format( out, 0, CTL_OMIT_NL ); font.Format( out, 0, CTL_OMIT_NL );
out->Print( 0, "(visible %s))%s",
isVisible ? "yes" : "no", if( !isVisible )
ctl & CTL_OMIT_NL ? "" : "\n" ); out->Print( 0, " (visible %s)", isVisible ? "yes" : "no" );
out->Print( 0, ")%s", ctl & CTL_OMIT_NL ? "" : "\n" );
} }
...@@ -460,7 +486,7 @@ void POLY_LINE::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const ...@@ -460,7 +486,7 @@ void POLY_LINE::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
void POLY_LINE::formatContents( OUTPUTFORMATTER* out, int indent, int ctl ) const void POLY_LINE::formatContents( OUTPUTFORMATTER* out, int indent, int ctl ) const
throw( IO_ERROR ) throw( IO_ERROR )
{ {
out->Print( 0, "(line_width %.6g)", InternalToWidth( lineWidth ) ); formatStroke( out, stroke );
if( fillType != PR::T_none ) if( fillType != PR::T_none )
out->Print( 0, "(fill %s)", ShowFill( fillType ) ); out->Print( 0, "(fill %s)", ShowFill( fillType ) );
...@@ -506,12 +532,14 @@ void BEZIER::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const ...@@ -506,12 +532,14 @@ void BEZIER::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
void RECTANGLE::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const void RECTANGLE::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
throw( IO_ERROR ) throw( IO_ERROR )
{ {
// (rectangle (start X Y) (end X Y) (line_width WIDTH) (fill FILL_TYPE)) // (rectangle (start X Y) (end X Y) [(stroke WIDTH)] (fill FILL_TYPE))
out->Print( indent, "(rectangle (start %.6g %.6g)(end %.6g %.6g)(line_width %.6g)", out->Print( indent, "(rectangle (start %.6g %.6g)(end %.6g %.6g)",
InternalToLogical( start.x ), InternalToLogical( start.y ), InternalToLogical( start.x ), InternalToLogical( start.y ),
InternalToLogical( end.x ), InternalToLogical( end.y ), InternalToLogical( end.x ), InternalToLogical( end.y )
InternalToWidth( lineWidth ) ); );
formatStroke( out, stroke );
if( fillType != PR::T_none ) if( fillType != PR::T_none )
out->Print( 0, "(fill %s)", ShowFill( fillType ) ); out->Print( 0, "(fill %s)", ShowFill( fillType ) );
...@@ -524,13 +552,14 @@ void CIRCLE::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const ...@@ -524,13 +552,14 @@ void CIRCLE::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
throw( IO_ERROR ) throw( IO_ERROR )
{ {
/* /*
(circle (center X Y)(radius LENGTH)(line_width WIDTH)(fill FILL_TYPE)) (circle (center X Y)(radius LENGTH) [(stroke WIDTH)] (fill FILL_TYPE))
*/ */
out->Print( indent, "(circle (center %.6g %.6g)(radius %.6g)(line_width %.6g)", out->Print( indent, "(circle (center %.6g %.6g)(radius %.6g)",
InternalToLogical( center.x ), InternalToLogical( center.y ), InternalToLogical( center.x ), InternalToLogical( center.y ),
InternalToLogical( radius), InternalToLogical( radius) );
InternalToWidth( lineWidth ) );
formatStroke( out, stroke );
if( fillType != PR::T_none ) if( fillType != PR::T_none )
out->Print( 0, "(fill %s)", ShowFill( fillType ) ); out->Print( 0, "(fill %s)", ShowFill( fillType ) );
...@@ -543,15 +572,17 @@ void ARC::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const ...@@ -543,15 +572,17 @@ void ARC::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
throw( IO_ERROR ) throw( IO_ERROR )
{ {
/* /*
(arc (pos X Y)(radius RADIUS)(start X Y)(end X Y)(line_width WIDTH)(fill FILL_TYPE)) (arc (pos X Y)(radius RADIUS)(start X Y)(end X Y) [(stroke WIDTH)] (fill FILL_TYPE))
*/ */
out->Print( indent, "(arc (pos %.6g %.6g)(radius %.6g)(start %.6g %.6g)(end %.6g %.6g)(line_width %.6g)", out->Print( indent, "(arc (pos %.6g %.6g)(radius %.6g)(start %.6g %.6g)(end %.6g %.6g)",
InternalToLogical( pos.x ), InternalToLogical( pos.y ), InternalToLogical( pos.x ), InternalToLogical( pos.y ),
InternalToLogical( radius), InternalToLogical( radius),
InternalToLogical( start.x ), InternalToLogical( start.y ), InternalToLogical( start.x ), InternalToLogical( start.y ),
InternalToLogical( end.x ), InternalToLogical( end.y ), InternalToLogical( end.x ), InternalToLogical( end.y )
InternalToWidth( lineWidth ) ); );
formatStroke( out, stroke );
if( fillType != PR::T_none ) if( fillType != PR::T_none )
out->Print( 0, "(fill %s)", ShowFill( fillType ) ); out->Print( 0, "(fill %s)", ShowFill( fillType ) );
...@@ -574,11 +605,14 @@ void GR_TEXT::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const ...@@ -574,11 +605,14 @@ void GR_TEXT::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
formatAt( out, pos, angle, indent+1 ); formatAt( out, pos, angle, indent+1 );
out->Print( 0, "(justify %s %s)(visible %s)", if( hjustify != PR::T_left || vjustify != PR::T_bottom )
ShowJustify( hjustify ), ShowJustify( vjustify ), out->Print( 0, "(justify %s %s)",
isVisible ? "yes" : "no" ); ShowJustify( hjustify ), ShowJustify( vjustify ) );
if( fillType != PR::T_none ) if( !isVisible )
out->Print( 0, "(visible %s)", isVisible ? "yes" : "no" );
if( fillType != PR::T_filled )
out->Print( 0, "(fill %s)", ShowFill( fillType ) ); out->Print( 0, "(fill %s)", ShowFill( fillType ) );
font.Format( out, 0, CTL_OMIT_NL ); font.Format( out, 0, CTL_OMIT_NL );
......
...@@ -71,6 +71,18 @@ static inline double InternalToWidth( int aWidth ) ...@@ -71,6 +71,18 @@ static inline double InternalToWidth( int aWidth )
return InternalToLogical( aWidth ) * 100; return InternalToLogical( aWidth ) * 100;
} }
static inline int FontzToInternal( double aFontSize )
{
// sweet font sizes are deci-pins
return LogicalToInternal( aFontSize ) / 10;
}
static inline double InternalToFontz( int aFontSize )
{
// sweet font sizes are deci-pins
return InternalToLogical( aFontSize ) * 10;
}
//-----<temporary home for PART sub objects, move after stable>------------------ //-----<temporary home for PART sub objects, move after stable>------------------
...@@ -113,7 +125,30 @@ public: ...@@ -113,7 +125,30 @@ public:
{} {}
}; };
/**
* Class FONTZ
* is the size of a font, and comes with a constructor which initializes
* height and width to special values which defer font size decision to
* a higher control.
*/
class FONTZ
{
public:
#define FONTZ_DEFAULT -1 ///< when size defers to higher control
FONTZ() :
height( FONTZ_DEFAULT ),
width( FONTZ_DEFAULT )
{}
int height;
int width;
};
typedef float ANGLE; typedef float ANGLE;
typedef int STROKE; ///< will be a class someday, currently only line width
namespace SCH { namespace SCH {
...@@ -125,7 +160,8 @@ class FONT ...@@ -125,7 +160,8 @@ class FONT
protected: protected:
wxString name; ///< name or other id such as number, TBD wxString name; ///< name or other id such as number, TBD
wxSize size; FONTZ size;
bool italic; bool italic;
bool bold; bool bold;
...@@ -161,6 +197,11 @@ struct TEXT_EFFECTS ...@@ -161,6 +197,11 @@ struct TEXT_EFFECTS
}; };
#define STROKE_DEFAULT -1 ///< defer line width decision to higher control
#define FILL_TYPE_DEFAULT PR::T_none ///< fillType defaut
class BASE_GRAPHIC class BASE_GRAPHIC
{ {
friend class PART; friend class PART;
...@@ -200,7 +241,7 @@ class POLY_LINE : public BASE_GRAPHIC ...@@ -200,7 +241,7 @@ class POLY_LINE : public BASE_GRAPHIC
friend class SWEET_PARSER; friend class SWEET_PARSER;
protected: protected:
int lineWidth; STROKE stroke;
int fillType; // T_none, T_filled, or T_transparent int fillType; // T_none, T_filled, or T_transparent
POINTS pts; POINTS pts;
...@@ -210,7 +251,7 @@ protected: ...@@ -210,7 +251,7 @@ protected:
public: public:
POLY_LINE( PART* aOwner ) : POLY_LINE( PART* aOwner ) :
BASE_GRAPHIC( aOwner ), BASE_GRAPHIC( aOwner ),
lineWidth( 1 ), stroke( STROKE_DEFAULT ),
fillType( PR::T_none ) fillType( PR::T_none )
{ {
} }
...@@ -228,7 +269,7 @@ public: ...@@ -228,7 +269,7 @@ public:
BEZIER( PART* aOwner ) : BEZIER( PART* aOwner ) :
POLY_LINE( aOwner ) POLY_LINE( aOwner )
{ {
lineWidth = 1; stroke = STROKE_DEFAULT;
fillType = PR::T_none; fillType = PR::T_none;
} }
...@@ -242,7 +283,7 @@ class RECTANGLE : public BASE_GRAPHIC ...@@ -242,7 +283,7 @@ class RECTANGLE : public BASE_GRAPHIC
friend class SWEET_PARSER; friend class SWEET_PARSER;
protected: protected:
int lineWidth; STROKE stroke;
int fillType; // T_none, T_filled, or T_transparent int fillType; // T_none, T_filled, or T_transparent
POINT start; POINT start;
POINT end; POINT end;
...@@ -250,8 +291,8 @@ protected: ...@@ -250,8 +291,8 @@ protected:
public: public:
RECTANGLE( PART* aOwner ) : RECTANGLE( PART* aOwner ) :
BASE_GRAPHIC( aOwner ), BASE_GRAPHIC( aOwner ),
lineWidth( 1 ), stroke( STROKE_DEFAULT ),
fillType( PR::T_none ) fillType( FILL_TYPE_DEFAULT )
{ {
} }
...@@ -268,15 +309,15 @@ class CIRCLE : public BASE_GRAPHIC ...@@ -268,15 +309,15 @@ class CIRCLE : public BASE_GRAPHIC
protected: protected:
POINT center; POINT center;
int radius; int radius;
int lineWidth; STROKE stroke;
int fillType; // T_none, T_filled, or T_transparent int fillType; // T_none, T_filled, or T_transparent
public: public:
CIRCLE( PART* aOwner ) : CIRCLE( PART* aOwner ) :
BASE_GRAPHIC( aOwner ), BASE_GRAPHIC( aOwner ),
radius( LogicalToInternal( 0.5 ) ), radius( LogicalToInternal( 0.5 ) ),
lineWidth( 1 ), stroke( STROKE_DEFAULT ),
fillType( PR::T_none ) fillType( FILL_TYPE_DEFAULT )
{ {
} }
...@@ -292,7 +333,7 @@ class ARC : public BASE_GRAPHIC ...@@ -292,7 +333,7 @@ class ARC : public BASE_GRAPHIC
protected: protected:
POINT pos; POINT pos;
int lineWidth; STROKE stroke;
int fillType; // T_none, T_filled, or T_transparent int fillType; // T_none, T_filled, or T_transparent
int radius; int radius;
POINT start; POINT start;
...@@ -301,8 +342,8 @@ protected: ...@@ -301,8 +342,8 @@ protected:
public: public:
ARC( PART* aOwner ) : ARC( PART* aOwner ) :
BASE_GRAPHIC( aOwner ), BASE_GRAPHIC( aOwner ),
lineWidth( 1 ), stroke( STROKE_DEFAULT ),
fillType( PR::T_none ), fillType( FILL_TYPE_DEFAULT ),
radius( LogicalToInternal( 0.5 ) ) radius( LogicalToInternal( 0.5 ) )
{ {
} }
...@@ -322,6 +363,7 @@ protected: ...@@ -322,6 +363,7 @@ protected:
ANGLE angle; ANGLE angle;
int fillType; ///< T_none, T_filled, or T_transparent int fillType; ///< T_none, T_filled, or T_transparent
int hjustify; ///< T_center, T_right, or T_left int hjustify; ///< T_center, T_right, or T_left
int vjustify; ///< T_center, T_top, or T_bottom int vjustify; ///< T_center, T_top, or T_bottom
...@@ -413,6 +455,10 @@ struct PINTEXT ...@@ -413,6 +455,10 @@ struct PINTEXT
}; };
#define PIN_LEN_DEFAULT -1 ///< use standard pin length for given type
#define PIN_SHAPE_DEFAULT PR::T_line ///< use standard pin shape
#define PIN_CONN_DEFAULT PR::T_in ///< use standard pin connection type
class PIN : public BASE_GRAPHIC class PIN : public BASE_GRAPHIC
{ {
friend class PART; friend class PART;
...@@ -422,9 +468,9 @@ public: ...@@ -422,9 +468,9 @@ public:
PIN( PART* aOwner ) : PIN( PART* aOwner ) :
BASE_GRAPHIC( aOwner ), BASE_GRAPHIC( aOwner ),
angle( 0 ), angle( 0 ),
connectionType( PR::T_input ), connectionType( PIN_CONN_DEFAULT ),
shape( PR::T_line ), shape( PIN_SHAPE_DEFAULT ),
length( 0 ), length( PIN_LEN_DEFAULT ),
isVisible( true ) isVisible( true )
{} {}
...@@ -447,10 +493,10 @@ protected: ...@@ -447,10 +493,10 @@ protected:
POINT pos; POINT pos;
ANGLE angle; ANGLE angle;
PINTEXT padname; PINTEXT pad;
PINTEXT signal; PINTEXT signal;
int connectionType; ///< T_input, T_output, T_bidirectional, T_tristate, T_passive, T_unspecified, int connectionType; ///< T_in, T_out, T_inout, T_tristate, T_passive, T_unspecified,
///< T_power_in, T_power_out, T_open_collector, T_open_emitter, or T_unconnected. ///< T_power_in, T_power_out, T_open_collector, T_open_emitter, or T_unconnected.
int shape; ///< T_none, T_line, T_inverted, T_clock, T_inverted_clk, T_input_low, T_clock_low, int shape; ///< T_none, T_line, T_inverted, T_clock, T_inverted_clk, T_input_low, T_clock_low,
...@@ -459,7 +505,7 @@ protected: ...@@ -459,7 +505,7 @@ protected:
int length; ///< length of pin in internal units int length; ///< length of pin in internal units
bool isVisible; ///< pin is visible bool isVisible; ///< pin is visible
wxString pin_merge; ///< padname of (pin_merge ...) that I am a member of, else empty if none wxString pin_merge; ///< pad of (pin_merge ...) that I am a member of, else empty if none
}; };
...@@ -526,6 +572,7 @@ typedef std::vector< BASE_GRAPHIC* > GRAPHICS; ...@@ -526,6 +572,7 @@ typedef std::vector< BASE_GRAPHIC* > GRAPHICS;
typedef std::vector< PROPERTY* > PROPERTIES; typedef std::vector< PROPERTY* > PROPERTIES;
typedef std::vector< PIN* > PINS; typedef std::vector< PIN* > PINS;
typedef std::vector< PIN* > PIN_LIST; ///< no ownership, used for searches
class LPID; class LPID;
...@@ -624,29 +671,29 @@ public: ...@@ -624,29 +671,29 @@ public:
PROPERTY* FieldLookup( PROP_ID aPropertyId ); PROPERTY* FieldLookup( PROP_ID aPropertyId );
/** /**
* Function PinFindByPadName * Function PinFindByPad
* finds a PIN based on aPadName or returns NULL if not found. * finds a PIN based on aPad or returns NULL if not found.
* @param aPadName is the pin to find * @param aPad is the pin to find
* @return PIN* - the found PIN or NULL if not found. * @return PIN* - the found PIN or NULL if not found.
*/ */
PIN* PinFindByPadName( const wxString& aPadName ) PIN* PinFindByPad( const wxString& aPad )
{ {
PINS::iterator it = pinFindByPadName( aPadName ); PINS::iterator it = pinFindByPad( aPad );
return it != pins.end() ? *it : NULL; return it != pins.end() ? *it : NULL;
} }
PIN* PinFindBySignal( const wxString& aSignal ) /**
{ * Function PinsFindBySignal
PINS::iterator it = pinFindBySignal( aSignal ); * fetches all the pins matching aSignal into aResults.
return it != pins.end() ? *it : NULL; */
} void PinsFindBySignal( PIN_LIST* aResults, const wxString& aSignal );
/** /**
* Function PinDelete * Function PinDelete
* deletes the pin with aPadName if found and returns true, else false * deletes the pin with aPad if found and returns true, else false
* if not found. * if not found.
*/ */
bool PinDelete( const wxString& aPadName ); bool PinDelete( const wxString& aPad );
/* /*
...@@ -714,13 +761,11 @@ protected: // not likely to have C++ descendants, but protected none-the-le ...@@ -714,13 +761,11 @@ protected: // not likely to have C++ descendants, but protected none-the-le
PROPERTIES::iterator propertyFind( const wxString& aPropertyName ); PROPERTIES::iterator propertyFind( const wxString& aPropertyName );
/** /**
* Function pinFindByPadName * Function pinFindByPad
* searches for a PIN with aPadName and returns a PROPERTIES::iterator which * searches for a PIN with aPad and returns a PROPERTIES::iterator which
* is the found item or pins.end() if not found. * is the found item or pins.end() if not found.
*/ */
PINS::iterator pinFindByPadName( const wxString& aPadName ); PINS::iterator pinFindByPad( const wxString& aPad );
PINS::iterator pinFindBySignal( const wxString& aSignal );
POINT anchor; POINT anchor;
......
This diff is collapsed.
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
class POINT; class POINT;
typedef int STROKE;
namespace SCH { namespace SCH {
...@@ -90,6 +91,7 @@ class SWEET_PARSER : public SWEET_LEXER ...@@ -90,6 +91,7 @@ class SWEET_PARSER : public SWEET_LEXER
void parsePinRenum( PART* me ); void parsePinRenum( PART* me );
void parsePinRename( PART* me ); void parsePinRename( PART* me );
void parsePinMerge( PART* me ); void parsePinMerge( PART* me );
void parseStroke( STROKE* me );
public: public:
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -3,7 +3,7 @@ anchor ...@@ -3,7 +3,7 @@ anchor
arc arc
at at
bezier bezier
bidirectional inout
bold bold
bottom bottom
center center
...@@ -21,7 +21,7 @@ filled ...@@ -21,7 +21,7 @@ filled
font font
footprint footprint
hide hide
input in
input_low input_low
inverted inverted
inverted_clk inverted_clk
...@@ -31,15 +31,15 @@ keywords ...@@ -31,15 +31,15 @@ keywords
left left
length length
line line
line_width
model model
no no
non_logic non_logic
none none
open_collector open_collector
open_emitter open_emitter
output out
padname pad
pads
part part
passive passive
pin pin
...@@ -62,9 +62,11 @@ right ...@@ -62,9 +62,11 @@ right
route_alt_swap route_alt_swap
route_pin_swap route_pin_swap
signal signal
signals
size size
start start
start_angle start_angle
stroke
text text
top top
transparent transparent
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment