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.
This commit is contained in:
parent
6c89776bfd
commit
5679e675d2
Binary file not shown.
Binary file not shown.
|
@ -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="
|
||||||
(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;
|
||||||
*/
|
*/
|
||||||
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
|
||||||
|
|
124
new/sch_part.cpp
124
new/sch_part.cpp
|
@ -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>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,11 +37,21 @@
|
||||||
*/
|
*/
|
||||||
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 )
|
||||||
|
{
|
||||||
|
// if( aPos.x || aPos.y || aAngle )
|
||||||
{
|
{
|
||||||
out->Print( indent, aAngle!=0.0 ? "(at %.6g %.6g %.6g)" : "(at %.6g %.6g)",
|
out->Print( indent, aAngle!=0.0 ? "(at %.6g %.6g %.6g)" : "(at %.6g %.6g)",
|
||||||
InternalToLogical( aPos.x ), InternalToLogical( aPos.y ),
|
InternalToLogical( aPos.x ), InternalToLogical( aPos.y ),
|
||||||
double( aAngle ) );
|
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 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
using namespace SCH;
|
using namespace SCH;
|
||||||
|
@ -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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
return it;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool PART::PinDelete( const wxString& aPadName )
|
|
||||||
{
|
{
|
||||||
PINS::iterator it = pinFindByPadName( aPadName );
|
aResults->push_back( *it );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PART::PinDelete( const wxString& aPad )
|
||||||
|
{
|
||||||
|
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
|
||||||
|
|
||||||
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 )
|
||||||
|
@ -391,6 +398,8 @@ 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( italic || bold || !name.IsEmpty() || size.height != FONTZ_DEFAULT || size.width != FONTZ_DEFAULT )
|
||||||
{
|
{
|
||||||
if( name.IsEmpty() )
|
if( name.IsEmpty() )
|
||||||
out->Print( indent, "(font " );
|
out->Print( indent, "(font " );
|
||||||
|
@ -398,8 +407,8 @@ void FONT::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
|
||||||
out->Print( indent, "(font %s ", out->Quotew( name ).c_str() );
|
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" );
|
||||||
|
@ -409,25 +418,39 @@ void FONT::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
|
||||||
|
|
||||||
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" );
|
||||||
|
|
||||||
|
if( connectionType != PIN_CONN_DEFAULT )
|
||||||
|
out->Print( 0, " %s", ShowType() );
|
||||||
|
|
||||||
|
if( shape != PIN_SHAPE_DEFAULT )
|
||||||
|
out->Print( 0, " %s", ShowShape() );
|
||||||
|
|
||||||
|
out->Print( 0, " " );
|
||||||
|
|
||||||
|
if( pos.x || pos.y || angle )
|
||||||
formatAt( out, pos, angle );
|
formatAt( out, pos, angle );
|
||||||
|
|
||||||
|
if( length != PIN_LEN_DEFAULT )
|
||||||
out->Print( 0, "(length %.6g)", InternalToLogical( length ) );
|
out->Print( 0, "(length %.6g)", InternalToLogical( length ) );
|
||||||
out->Print( 0, "(visible %s)\n", isVisible ? "yes" : "no" );
|
|
||||||
|
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" );
|
||||||
}
|
}
|
||||||
|
@ -442,10 +465,13 @@ void PINTEXT::Format( OUTPUTFORMATTER* out, const char* aElement, int indent, in
|
||||||
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
|
||||||
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
|
||||||
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
|
||||||
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
|
||||||
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
|
||||||
|
|
||||||
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 );
|
||||||
|
|
119
new/sch_part.h
119
new/sch_part.h
|
@ -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:
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
|
||||||
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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#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
|
||||||
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:
|
||||||
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:
|
||||||
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
|
||||||
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:
|
||||||
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
|
||||||
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
|
||||||
|
|
||||||
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:
|
||||||
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:
|
||||||
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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#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:
|
||||||
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:
|
||||||
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:
|
||||||
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;
|
||||||
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:
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
PIN* PinFindBySignal( const wxString& aSignal )
|
|
||||||
{
|
|
||||||
PINS::iterator it = pinFindBySignal( aSignal );
|
|
||||||
return it != pins.end() ? *it : NULL;
|
return it != pins.end() ? *it : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function PinsFindBySignal
|
||||||
|
* fetches all the pins matching aSignal into aResults.
|
||||||
|
*/
|
||||||
|
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
|
||||||
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;
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,11 @@ static inline int fromWidth( const STRING& aWidth )
|
||||||
return WidthToInternal( strtod( aWidth.c_str(), NULL ) );
|
return WidthToInternal( strtod( aWidth.c_str(), NULL ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int fromFontz( const STRING& aFontSize )
|
||||||
|
{
|
||||||
|
return FontzToInternal( strtod( aFontSize.c_str(), NULL ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum PartBit
|
* Enum PartBit
|
||||||
|
@ -265,6 +270,7 @@ void SWEET_PARSER::Parse( PART* me, LIB_TABLE* aTable ) throw( IO_ERROR, PARSE_E
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_pin:
|
case T_pin:
|
||||||
|
// @todo PADNAMEs must be unique
|
||||||
PIN* pin;
|
PIN* pin;
|
||||||
pin = new PIN( me );
|
pin = new PIN( me );
|
||||||
me->pins.push_back( pin );
|
me->pins.push_back( pin );
|
||||||
|
@ -447,10 +453,10 @@ void SWEET_PARSER::parseFont( FONT* me )
|
||||||
sawSize = true;
|
sawSize = true;
|
||||||
|
|
||||||
NeedNUMBER( "size height" );
|
NeedNUMBER( "size height" );
|
||||||
me->size.SetHeight( internal( CurText() ) );
|
me->size.height = fromFontz( CurText() );
|
||||||
|
|
||||||
NeedNUMBER( "size width" );
|
NeedNUMBER( "size width" );
|
||||||
me->size.SetWidth( internal( CurText() ) );
|
me->size.width = fromFontz( CurText() );
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -500,18 +506,32 @@ void SWEET_PARSER::parseBool( bool* aBool )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SWEET_PARSER::parseStroke( STROKE* me )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
(stroke [WIDTH] [(style [(dashed...)]...)])
|
||||||
|
|
||||||
|
future place holder for arrow heads, dashed lines, all line glamour
|
||||||
|
*/
|
||||||
|
|
||||||
|
NeedNUMBER( "stroke" );
|
||||||
|
*me = fromWidth( CurText() );
|
||||||
|
NeedRIGHT();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SWEET_PARSER::parsePinText( PINTEXT* me )
|
void SWEET_PARSER::parsePinText( PINTEXT* me )
|
||||||
{
|
{
|
||||||
/* either:
|
/* either:
|
||||||
(signal SIGNAL (font [FONT] (size HEIGHT WIDTH) [italic] [bold])(visible YES))
|
(signal SIGNAL (font [FONT] (size HEIGHT WIDTH) [italic] [bold])(visible YES))
|
||||||
or
|
or
|
||||||
(padname PADNAME (font [FONT] (size HEIGHT WIDTH) [italic] [bold])(visible YES))
|
(pad PADNAME (font [FONT] (size HEIGHT WIDTH) [italic] [bold])(visible YES))
|
||||||
*/
|
*/
|
||||||
T tok;
|
T tok;
|
||||||
bool sawFont = false;
|
bool sawFont = false;
|
||||||
bool sawVis = false;
|
bool sawVis = false;
|
||||||
|
|
||||||
// padname or signal text
|
// pad or signal text
|
||||||
NeedSYMBOLorNUMBER();
|
NeedSYMBOLorNUMBER();
|
||||||
me->text = FromUTF8();
|
me->text = FromUTF8();
|
||||||
|
|
||||||
|
@ -562,7 +582,7 @@ void SWEET_PARSER::parsePin( PIN* me )
|
||||||
(at X Y [ANGLE])
|
(at X Y [ANGLE])
|
||||||
(length LENGTH)
|
(length LENGTH)
|
||||||
(signal NAME (font [FONT] (size HEIGHT WIDTH) [italic] [bold])(visible YES))
|
(signal NAME (font [FONT] (size HEIGHT WIDTH) [italic] [bold])(visible YES))
|
||||||
(padname NUMBER (font [FONT] (size HEIGHT WIDTH) [italic] [bold] (visible YES))
|
(pad NUMBER (font [FONT] (size HEIGHT WIDTH) [italic] [bold] (visible YES))
|
||||||
(visible YES)
|
(visible YES)
|
||||||
)
|
)
|
||||||
*/
|
*/
|
||||||
|
@ -573,7 +593,7 @@ void SWEET_PARSER::parsePin( PIN* me )
|
||||||
bool sawAt = false;
|
bool sawAt = false;
|
||||||
bool sawLen = false;
|
bool sawLen = false;
|
||||||
bool sawSignal = false;
|
bool sawSignal = false;
|
||||||
bool sawPadName = false;
|
bool sawPad = false;
|
||||||
bool sawVis = false;
|
bool sawVis = false;
|
||||||
|
|
||||||
while( ( tok = NextTok() ) != T_RIGHT )
|
while( ( tok = NextTok() ) != T_RIGHT )
|
||||||
|
@ -607,11 +627,11 @@ void SWEET_PARSER::parsePin( PIN* me )
|
||||||
parsePinText( &me->signal );
|
parsePinText( &me->signal );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_padname:
|
case T_pad:
|
||||||
if( sawPadName )
|
if( sawPad )
|
||||||
Duplicate( tok );
|
Duplicate( tok );
|
||||||
sawPadName = true;
|
sawPad = true;
|
||||||
parsePinText( &me->padname );
|
parsePinText( &me->pad );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_visible:
|
case T_visible:
|
||||||
|
@ -631,9 +651,9 @@ void SWEET_PARSER::parsePin( PIN* me )
|
||||||
{
|
{
|
||||||
switch( tok )
|
switch( tok )
|
||||||
{
|
{
|
||||||
case T_input:
|
case T_in:
|
||||||
case T_output:
|
case T_out:
|
||||||
case T_bidirectional:
|
case T_inout:
|
||||||
case T_tristate:
|
case T_tristate:
|
||||||
case T_passive:
|
case T_passive:
|
||||||
case T_unspecified:
|
case T_unspecified:
|
||||||
|
@ -673,17 +693,17 @@ void SWEET_PARSER::parsePin( PIN* me )
|
||||||
|
|
||||||
void SWEET_PARSER::parsePinDel( PART* me )
|
void SWEET_PARSER::parsePinDel( PART* me )
|
||||||
{
|
{
|
||||||
wxString padName;
|
wxString pad;
|
||||||
|
|
||||||
// we do this somewhat unorthodoxically because we want to avoid doing two lookups,
|
// we do this somewhat unorthodoxically because we want to avoid doing two lookups,
|
||||||
// which would need to be done to 1) find pin, and 2) delete pin. Only one
|
// which would need to be done to 1) find pin, and 2) delete pin. Only one
|
||||||
// lookup is needed with this scheme.
|
// lookup is needed with this scheme.
|
||||||
|
|
||||||
NeedSYMBOLorNUMBER();
|
NeedSYMBOLorNUMBER();
|
||||||
padName = FromUTF8();
|
pad = FromUTF8();
|
||||||
|
|
||||||
// lookup now while CurOffset() is still meaningful.
|
// lookup now while CurOffset() is still meaningful.
|
||||||
PINS::iterator it = me->pinFindByPadName( padName );
|
PINS::iterator it = me->pinFindByPad( pad );
|
||||||
if( it == me->pins.end() )
|
if( it == me->pins.end() )
|
||||||
{
|
{
|
||||||
THROW_PARSE_ERROR( _("undefined pin"),
|
THROW_PARSE_ERROR( _("undefined pin"),
|
||||||
|
@ -716,13 +736,13 @@ void SWEET_PARSER::parsePinSwap( PART* me )
|
||||||
PIN* pin1;
|
PIN* pin1;
|
||||||
PIN* pin2;
|
PIN* pin2;
|
||||||
|
|
||||||
wxString padName;
|
wxString pad;
|
||||||
|
|
||||||
NeedSYMBOLorNUMBER();
|
NeedSYMBOLorNUMBER();
|
||||||
padName = FromUTF8();
|
pad = FromUTF8();
|
||||||
|
|
||||||
// lookup now while CurOffset() is still meaningful.
|
// lookup now while CurOffset() is still meaningful.
|
||||||
pin1 = me->PinFindByPadName( padName );
|
pin1 = me->PinFindByPad( pad );
|
||||||
if( !pin1 )
|
if( !pin1 )
|
||||||
{
|
{
|
||||||
THROW_PARSE_ERROR( _("undefined pin"),
|
THROW_PARSE_ERROR( _("undefined pin"),
|
||||||
|
@ -733,9 +753,9 @@ void SWEET_PARSER::parsePinSwap( PART* me )
|
||||||
}
|
}
|
||||||
|
|
||||||
NeedSYMBOLorNUMBER();
|
NeedSYMBOLorNUMBER();
|
||||||
padName = FromUTF8();
|
pad = FromUTF8();
|
||||||
|
|
||||||
pin2 = me->PinFindByPadName( padName );
|
pin2 = me->PinFindByPad( pad );
|
||||||
if( !pin2 )
|
if( !pin2 )
|
||||||
{
|
{
|
||||||
THROW_PARSE_ERROR( _("undefined pin"),
|
THROW_PARSE_ERROR( _("undefined pin"),
|
||||||
|
@ -748,8 +768,8 @@ void SWEET_PARSER::parsePinSwap( PART* me )
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
|
|
||||||
// swap only the text, but might want to swap entire PIN_TEXTs
|
// swap only the text, but might want to swap entire PIN_TEXTs
|
||||||
pin2->padname.text = pin1->padname.text;
|
pin2->pad.text = pin1->pad.text;
|
||||||
pin1->padname.text = padName;
|
pin1->pad.text = pad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -757,14 +777,14 @@ void SWEET_PARSER::parsePinRenum( PART* me )
|
||||||
{
|
{
|
||||||
PIN* pin;
|
PIN* pin;
|
||||||
|
|
||||||
wxString oldPadName;
|
wxString oldPad;
|
||||||
wxString newPadName;
|
wxString newPad;
|
||||||
|
|
||||||
NeedSYMBOLorNUMBER();
|
NeedSYMBOLorNUMBER();
|
||||||
oldPadName = FromUTF8();
|
oldPad = FromUTF8();
|
||||||
|
|
||||||
// lookup now while CurOffset() is still meaningful.
|
// lookup now while CurOffset() is still meaningful.
|
||||||
pin = me->PinFindByPadName( oldPadName );
|
pin = me->PinFindByPad( oldPad );
|
||||||
if( !pin )
|
if( !pin )
|
||||||
{
|
{
|
||||||
THROW_PARSE_ERROR( _("undefined pin"),
|
THROW_PARSE_ERROR( _("undefined pin"),
|
||||||
|
@ -775,12 +795,12 @@ void SWEET_PARSER::parsePinRenum( PART* me )
|
||||||
}
|
}
|
||||||
|
|
||||||
NeedSYMBOLorNUMBER();
|
NeedSYMBOLorNUMBER();
|
||||||
newPadName = FromUTF8();
|
newPad = FromUTF8();
|
||||||
|
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
|
|
||||||
// @todo: check for padname legalities
|
// @todo: check for pad legalities
|
||||||
pin->padname.text = newPadName;
|
pin->pad.text = newPad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -788,14 +808,14 @@ void SWEET_PARSER::parsePinRename( PART* me )
|
||||||
{
|
{
|
||||||
PIN* pin;
|
PIN* pin;
|
||||||
|
|
||||||
wxString oldSignal;
|
wxString pad;
|
||||||
wxString newSignal;
|
wxString newSignal;
|
||||||
|
|
||||||
NeedSYMBOLorNUMBER();
|
NeedSYMBOLorNUMBER();
|
||||||
oldSignal = FromUTF8();
|
pad = FromUTF8();
|
||||||
|
|
||||||
// lookup now while CurOffset() is still meaningful.
|
// lookup now while CurOffset() is still meaningful.
|
||||||
pin = me->PinFindBySignal( oldSignal );
|
pin = me->PinFindByPad( pad );
|
||||||
if( !pin )
|
if( !pin )
|
||||||
{
|
{
|
||||||
THROW_PARSE_ERROR( _("undefined pin"),
|
THROW_PARSE_ERROR( _("undefined pin"),
|
||||||
|
@ -817,18 +837,19 @@ void SWEET_PARSER::parsePinRename( PART* me )
|
||||||
void SWEET_PARSER::parsePinMerge( PART* me )
|
void SWEET_PARSER::parsePinMerge( PART* me )
|
||||||
{
|
{
|
||||||
T tok;
|
T tok;
|
||||||
wxString padName;
|
wxString pad;
|
||||||
|
wxString signal;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
NeedSYMBOLorNUMBER();
|
NeedSYMBOLorNUMBER();
|
||||||
|
|
||||||
wxString anchorPadName = FromUTF8();
|
wxString anchorPad = FromUTF8();
|
||||||
|
|
||||||
// lookup now while CurOffset() is still good.
|
// lookup now while CurOffset() is still good.
|
||||||
PINS::iterator pit = me->pinFindByPadName( anchorPadName );
|
PINS::iterator pit = me->pinFindByPad( anchorPad );
|
||||||
if( pit == me->pins.end() )
|
if( pit == me->pins.end() )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "undefined pin %s" ), anchorPadName.GetData() );
|
msg.Printf( _( "undefined pin %s" ), anchorPad.GetData() );
|
||||||
THROW_PARSE_ERROR( msg,
|
THROW_PARSE_ERROR( msg,
|
||||||
CurSource(),
|
CurSource(),
|
||||||
CurLine(),
|
CurLine(),
|
||||||
|
@ -836,10 +857,10 @@ void SWEET_PARSER::parsePinMerge( PART* me )
|
||||||
CurOffset() );
|
CurOffset() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !(*pit)->pin_merge.IsEmpty() && anchorPadName != (*pit)->pin_merge )
|
if( !(*pit)->pin_merge.IsEmpty() && anchorPad != (*pit)->pin_merge )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "pin %s already in pin_merge group %s" ),
|
msg.Printf( _( "pin %s already in pin_merge group %s" ),
|
||||||
anchorPadName.GetData(), (*pit)->pin_merge.GetData() );
|
anchorPad.GetData(), (*pit)->pin_merge.GetData() );
|
||||||
|
|
||||||
THROW_PARSE_ERROR( msg,
|
THROW_PARSE_ERROR( msg,
|
||||||
CurSource(),
|
CurSource(),
|
||||||
|
@ -848,34 +869,38 @@ void SWEET_PARSER::parsePinMerge( PART* me )
|
||||||
CurOffset() );
|
CurOffset() );
|
||||||
}
|
}
|
||||||
|
|
||||||
NeedLEFT();
|
|
||||||
|
|
||||||
tok = NextTok();
|
|
||||||
if( tok != T_hide )
|
|
||||||
Expecting( T_hide );
|
|
||||||
|
|
||||||
(*pit)->isVisible = true;
|
(*pit)->isVisible = true;
|
||||||
(*pit)->pin_merge = anchorPadName;
|
(*pit)->pin_merge = anchorPad;
|
||||||
|
|
||||||
// allocate or find a MERGE_SET;
|
// allocate or find a MERGE_SET;
|
||||||
MERGE_SET& ms = me->pin_merges[anchorPadName];
|
MERGE_SET& ms = me->pin_merges[anchorPad];
|
||||||
|
|
||||||
|
while( ( tok = NextTok() ) != T_RIGHT )
|
||||||
|
{
|
||||||
|
if( tok == T_LEFT )
|
||||||
|
{
|
||||||
|
tok = NextTok();
|
||||||
|
|
||||||
|
switch( tok )
|
||||||
|
{
|
||||||
|
case T_signals:
|
||||||
|
{
|
||||||
|
PINS sigPins; // no ownership
|
||||||
|
|
||||||
while( ( tok = NextTok() ) != T_RIGHT )
|
while( ( tok = NextTok() ) != T_RIGHT )
|
||||||
{
|
{
|
||||||
if( !IsSymbol( tok ) && tok != T_NUMBER )
|
if( !IsSymbol( tok ) && tok != T_NUMBER )
|
||||||
Expecting( "padname" );
|
Expecting( "signal" );
|
||||||
|
|
||||||
padName = FromUTF8();
|
signal = FromUTF8();
|
||||||
|
|
||||||
D(printf("padName=%s\n", TO_UTF8( padName ) );)
|
sigPins.clear();
|
||||||
|
|
||||||
// find the PIN and mark it as being in this MERGE_SET or throw
|
me->PinsFindBySignal( &sigPins, signal );
|
||||||
// error if already in another MERGET_SET.
|
|
||||||
|
|
||||||
pit = me->pinFindByPadName( padName );
|
if( !sigPins.size() )
|
||||||
if( pit == me->pins.end() )
|
|
||||||
{
|
{
|
||||||
msg.Printf( _( "undefined pin %s" ), padName.GetData() );
|
msg.Printf( _( "no pins with signal %s" ), signal.GetData() );
|
||||||
THROW_PARSE_ERROR( msg,
|
THROW_PARSE_ERROR( msg,
|
||||||
CurSource(),
|
CurSource(),
|
||||||
CurLine(),
|
CurLine(),
|
||||||
|
@ -883,10 +908,56 @@ void SWEET_PARSER::parsePinMerge( PART* me )
|
||||||
CurOffset() );
|
CurOffset() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !(*pit)->pin_merge.IsEmpty() && anchorPadName != (*pit)->pin_merge )
|
for( pit = sigPins.begin(); pit != sigPins.end(); ++pit )
|
||||||
|
{
|
||||||
|
if( !(*pit)->pin_merge.IsEmpty() && anchorPad != (*pit)->pin_merge )
|
||||||
|
{
|
||||||
|
msg.Printf( _( "signal pin %s already in pin_merge group %s" ),
|
||||||
|
pad.GetData(), (*pit)->pin_merge.GetData() );
|
||||||
|
|
||||||
|
THROW_PARSE_ERROR( msg,
|
||||||
|
CurSource(),
|
||||||
|
CurLine(),
|
||||||
|
CurLineNumber(),
|
||||||
|
CurOffset() );
|
||||||
|
}
|
||||||
|
|
||||||
|
(*pit)->isVisible = true;
|
||||||
|
(*pit)->pin_merge = anchorPad;
|
||||||
|
ms.insert( pad );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_pads:
|
||||||
|
while( ( tok = NextTok() ) != T_RIGHT )
|
||||||
|
{
|
||||||
|
if( !IsSymbol( tok ) && tok != T_NUMBER )
|
||||||
|
Expecting( "pad" );
|
||||||
|
|
||||||
|
pad = FromUTF8();
|
||||||
|
|
||||||
|
D(printf("pad=%s\n", TO_UTF8( pad ) );)
|
||||||
|
|
||||||
|
// find the PIN and mark it as being in this MERGE_SET or throw
|
||||||
|
// error if already in another MERGET_SET.
|
||||||
|
|
||||||
|
pit = me->pinFindByPad( pad );
|
||||||
|
if( pit == me->pins.end() )
|
||||||
|
{
|
||||||
|
msg.Printf( _( "undefined pin %s" ), pad.GetData() );
|
||||||
|
THROW_PARSE_ERROR( msg,
|
||||||
|
CurSource(),
|
||||||
|
CurLine(),
|
||||||
|
CurLineNumber(),
|
||||||
|
CurOffset() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !(*pit)->pin_merge.IsEmpty() /* && anchorPad != (*pit)->pin_merge */ )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "pin %s already in pin_merge group %s" ),
|
msg.Printf( _( "pin %s already in pin_merge group %s" ),
|
||||||
padName.GetData(), (*pit)->pin_merge.GetData() );
|
pad.GetData(), (*pit)->pin_merge.GetData() );
|
||||||
|
|
||||||
THROW_PARSE_ERROR( msg,
|
THROW_PARSE_ERROR( msg,
|
||||||
CurSource(),
|
CurSource(),
|
||||||
|
@ -896,12 +967,22 @@ void SWEET_PARSER::parsePinMerge( PART* me )
|
||||||
}
|
}
|
||||||
|
|
||||||
(*pit)->isVisible = false;
|
(*pit)->isVisible = false;
|
||||||
(*pit)->pin_merge = anchorPadName;
|
(*pit)->pin_merge = anchorPad;
|
||||||
|
|
||||||
ms.insert( padName );
|
ms.insert( pad );
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
NeedRIGHT();
|
default:
|
||||||
|
Expecting( "pads|signals" );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Expecting( T_LEFT );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -998,8 +1079,9 @@ void SWEET_PARSER::parsePolyLine( POLY_LINE* me )
|
||||||
(polyline|line
|
(polyline|line
|
||||||
(pts (xy X Y) (xy X Y) (xy X Y) (xy X Y) (xy X Y))
|
(pts (xy X Y) (xy X Y) (xy X Y) (xy X Y) (xy X Y))
|
||||||
|
|
||||||
# Line widths are in units as defined above.
|
# Line widths are in percent of a pin delta
|
||||||
(line_width WIDTH)
|
[(stroke [WIDTH] [(style [(dashed...)]...)])]
|
||||||
|
|
||||||
|
|
||||||
# Valid fill types are none, filled, and transparent.
|
# Valid fill types are none, filled, and transparent.
|
||||||
(fill FILL_TYPE)
|
(fill FILL_TYPE)
|
||||||
|
@ -1008,7 +1090,7 @@ void SWEET_PARSER::parsePolyLine( POLY_LINE* me )
|
||||||
|
|
||||||
T tok;
|
T tok;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
bool sawWidth = false;
|
bool sawStroke = false;
|
||||||
bool sawFill = false;
|
bool sawFill = false;
|
||||||
|
|
||||||
while( ( tok = NextTok() ) != T_RIGHT )
|
while( ( tok = NextTok() ) != T_RIGHT )
|
||||||
|
@ -1020,13 +1102,11 @@ void SWEET_PARSER::parsePolyLine( POLY_LINE* me )
|
||||||
|
|
||||||
switch( tok )
|
switch( tok )
|
||||||
{
|
{
|
||||||
case T_line_width:
|
case T_stroke:
|
||||||
if( sawWidth )
|
if( sawStroke )
|
||||||
Duplicate( tok );
|
Duplicate( tok );
|
||||||
NeedNUMBER( "line_width" );
|
sawStroke = true;
|
||||||
me->lineWidth = fromWidth( CurText() );
|
parseStroke( &me->stroke );
|
||||||
NeedRIGHT();
|
|
||||||
sawWidth = true;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_pts:
|
case T_pts:
|
||||||
|
@ -1074,7 +1154,7 @@ void SWEET_PARSER::parsePolyLine( POLY_LINE* me )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Expecting( "pts|line_width|fill" );
|
Expecting( "pts|stroke|fill" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1089,13 +1169,13 @@ void SWEET_PARSER::parseBezier( BEZIER* me )
|
||||||
void SWEET_PARSER::parseRectangle( RECTANGLE* me )
|
void SWEET_PARSER::parseRectangle( RECTANGLE* me )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
(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))
|
||||||
*/
|
*/
|
||||||
|
|
||||||
T tok;
|
T tok;
|
||||||
bool sawStart = false;
|
bool sawStart = false;
|
||||||
bool sawEnd = false;
|
bool sawEnd = false;
|
||||||
bool sawWidth = false;
|
bool sawStroke = false;
|
||||||
bool sawFill = false;
|
bool sawFill = false;
|
||||||
|
|
||||||
while( ( tok = NextTok() ) != T_RIGHT )
|
while( ( tok = NextTok() ) != T_RIGHT )
|
||||||
|
@ -1107,13 +1187,11 @@ void SWEET_PARSER::parseRectangle( RECTANGLE* me )
|
||||||
|
|
||||||
switch( tok )
|
switch( tok )
|
||||||
{
|
{
|
||||||
case T_line_width:
|
case T_stroke:
|
||||||
if( sawWidth )
|
if( sawStroke )
|
||||||
Duplicate( tok );
|
Duplicate( tok );
|
||||||
sawWidth = true;
|
sawStroke = true;
|
||||||
NeedNUMBER( "line_width" );
|
parseStroke( &me->stroke );
|
||||||
me->lineWidth = fromWidth( CurText() );
|
|
||||||
NeedRIGHT();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_fill:
|
case T_fill:
|
||||||
|
@ -1157,7 +1235,7 @@ void SWEET_PARSER::parseRectangle( RECTANGLE* me )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Expecting( "start|end|line_width|fill" );
|
Expecting( "start|end|stroke|fill" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1169,7 +1247,7 @@ void SWEET_PARSER::parseCircle( CIRCLE* me )
|
||||||
(circle (center X Y)
|
(circle (center X Y)
|
||||||
# Radius length is in units if defined or mils.
|
# Radius length is in units if defined or mils.
|
||||||
(radius LENGTH)
|
(radius LENGTH)
|
||||||
(line_width WIDTH)
|
(stroke WIDTH)
|
||||||
(fill FILL_TYPE)
|
(fill FILL_TYPE)
|
||||||
)
|
)
|
||||||
*/
|
*/
|
||||||
|
@ -1177,7 +1255,7 @@ void SWEET_PARSER::parseCircle( CIRCLE* me )
|
||||||
T tok;
|
T tok;
|
||||||
bool sawCenter = false;
|
bool sawCenter = false;
|
||||||
bool sawRadius = false;
|
bool sawRadius = false;
|
||||||
bool sawWidth = false;
|
bool sawStroke = false;
|
||||||
bool sawFill = false;
|
bool sawFill = false;
|
||||||
|
|
||||||
while( ( tok = NextTok() ) != T_RIGHT )
|
while( ( tok = NextTok() ) != T_RIGHT )
|
||||||
|
@ -1189,13 +1267,11 @@ void SWEET_PARSER::parseCircle( CIRCLE* me )
|
||||||
|
|
||||||
switch( tok )
|
switch( tok )
|
||||||
{
|
{
|
||||||
case T_line_width:
|
case T_stroke:
|
||||||
if( sawWidth )
|
if( sawStroke )
|
||||||
Duplicate( tok );
|
Duplicate( tok );
|
||||||
sawWidth = true;
|
sawStroke = true;
|
||||||
NeedNUMBER( "line_width" );
|
parseStroke( &me->stroke );
|
||||||
me->lineWidth = fromWidth( CurText() );
|
|
||||||
NeedRIGHT();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_fill:
|
case T_fill:
|
||||||
|
@ -1237,7 +1313,7 @@ void SWEET_PARSER::parseCircle( CIRCLE* me )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Expecting( "center|radius|line_width|fill" );
|
Expecting( "center|radius|stroke|fill" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1247,7 +1323,7 @@ void SWEET_PARSER::parseArc( ARC* me )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
(arc (pos X Y) (radius RADIUS) (start X Y) (end X Y)
|
(arc (pos X Y) (radius RADIUS) (start X Y) (end X Y)
|
||||||
(line_width WIDTH)
|
(stroke WIDTH)
|
||||||
(fill FILL_TYPE)
|
(fill FILL_TYPE)
|
||||||
)
|
)
|
||||||
*/
|
*/
|
||||||
|
@ -1257,7 +1333,7 @@ void SWEET_PARSER::parseArc( ARC* me )
|
||||||
bool sawStart = false;
|
bool sawStart = false;
|
||||||
bool sawEnd = false;
|
bool sawEnd = false;
|
||||||
bool sawRadius = false;
|
bool sawRadius = false;
|
||||||
bool sawWidth = false;
|
bool sawStroke = false;
|
||||||
bool sawFill = false;
|
bool sawFill = false;
|
||||||
|
|
||||||
while( ( tok = NextTok() ) != T_RIGHT )
|
while( ( tok = NextTok() ) != T_RIGHT )
|
||||||
|
@ -1269,13 +1345,11 @@ void SWEET_PARSER::parseArc( ARC* me )
|
||||||
|
|
||||||
switch( tok )
|
switch( tok )
|
||||||
{
|
{
|
||||||
case T_line_width:
|
case T_stroke:
|
||||||
if( sawWidth )
|
if( sawStroke )
|
||||||
Duplicate( tok );
|
Duplicate( tok );
|
||||||
sawWidth = true;
|
sawStroke = true;
|
||||||
NeedNUMBER( "line_width" );
|
parseStroke( &me->stroke );
|
||||||
me->lineWidth = fromWidth( CurText() );
|
|
||||||
NeedRIGHT();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_fill:
|
case T_fill:
|
||||||
|
@ -1339,7 +1413,7 @@ void SWEET_PARSER::parseArc( ARC* me )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Expecting( "center|radius|line_width|fill" );
|
Expecting( "center|radius|stroke|fill" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
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:
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,7 @@ anchor
|
||||||
arc
|
arc
|
||||||
at
|
at
|
||||||
bezier
|
bezier
|
||||||
bidirectional
|
inout
|
||||||
bold
|
bold
|
||||||
bottom
|
bottom
|
||||||
center
|
center
|
||||||
|
@ -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
|
||||||
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
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue