merge from testing, new work

This commit is contained in:
Dick Hollenbeck 2010-12-28 10:45:05 -06:00
commit dc35a18c85
34 changed files with 312 additions and 159 deletions

View File

@ -4,6 +4,20 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
email address.
2010-Dec-28 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++new:
Completed a good portion of /new class LIB_TABLE.
Starting LPID.
++common:
Tricked xnode.h into not issuing deprecation warnings.
++richio:
* Added support of DSNLEXER( LINE_READER* ) to TokenList2DsnLexer.cmake, which
allows the chaining of different grammars on top of a common LINE_READER.
* Changed OUTPUT_FORMATTER::Quoted() to return a std::string and not modify
its input parameter.
2010-dec-21 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++all

View File

@ -223,8 +223,9 @@ using namespace DSN; // enum ${enum} is in this namespace
class ${RESULT}_LEXER : public DSNLEXER
{
public:
/**
* Constructor ${RESULT}_LEXER
* Constructor ( const std::string&, const wxString& )
* @param aSExpression is (utf8) text possibly from the clipboard that you want to parse.
* @param aSource is a description of the origin of @a aSExpression, such as a filename.
* If left empty, then _("clipboard") is used.
@ -236,7 +237,7 @@ public:
}
/**
* Constructor ${RESULT}_LEXER
* Constructor ( FILE* )
* takes @a aFile already opened for reading and @a aFilename as parameters.
* The opened file is assumed to be positioned at the beginning of the file
* for purposes of accurate line number reporting in error messages. The
@ -245,11 +246,28 @@ public:
* @param aFilename is the name of the opened file, needed for error reporting.
*/
${RESULT}_LEXER( FILE* aFile, const wxString& aFilename ) :
DSNLEXER( DSN::${result}_keywords, DSN::${result}_keyword_count,
DSNLEXER( DSN::${result}_keywords, DSN::${result}_keyword_count,
aFile, aFilename )
{
}
/**
* Constructor ( LINE_READER* )
* intializes a lexer and prepares to read from @a aLineReader which
* is assumed ready, and may be in use by other DSNLEXERs also. No ownership
* is taken of @a aLineReader. This enables it to be used by other lexers also.
* The transition between grammars in such a case, must happen on a text
* line boundary, not within the same line of text.
*
* @param aLineReader is any subclassed instance of LINE_READER, such as
* STRING_LINE_READER or FILE_LINE_READER. No ownership is taken of aLineReader.
*/
${RESULT}_LEXER( LINE_READER* aLineReader ) :
DSNLEXER( DSN::${result}_keywords, DSN::${result}_keyword_count,
aLineReader )
{
}
/**
* Function NextTok
* returns the next token found in the input file or T_EOF when reaching

View File

@ -6,7 +6,7 @@
#endif
#ifndef KICAD_BUILD_VERSION
#define KICAD_BUILD_VERSION "(2010-12-22 BZR 2676)"
#define KICAD_BUILD_VERSION "(2010-12-23 BZR 2682)"
#endif
//#define VERSION_STABILITY "stable"

View File

@ -170,29 +170,27 @@ void DXF_PLOTTER::pen_to( wxPoint pos, char plume )
void DXF_PLOTTER::set_dash( bool dashed )
{
/* NOP for now */
wxASSERT( output_file );
}
/**
* Function Plot a filled segment (track)
* @param start = starting point
* @param end = ending point
* Function thick_segment
* Plot a filled segment (track)
* @param aStart = starting point
* @param aEnd = ending point
* @param aWidth = segment width (thickness)
* @param aPlotMode = FILLED, SKETCH ..
*/
void DXF_PLOTTER::thick_segment( wxPoint start, wxPoint end, int width,
GRTraceMode tracemode )
void DXF_PLOTTER::thick_segment( wxPoint aStart, wxPoint aEnd, int aWidth,
GRTraceMode aPlotMode )
{
wxASSERT( output_file );
if( tracemode == FILAIRE ) /* just a line is Ok */
if( aPlotMode == FILAIRE ) /* just a line is Ok */
{
move_to( start );
finish_to( end );
move_to( aStart );
finish_to( aEnd );
}
else
segment_as_oval( start, end, width, tracemode );
segment_as_oval( aStart, aEnd, aWidth, aPlotMode );
}

View File

@ -157,21 +157,21 @@ static void DrawGraphicTextPline(
wxDC* aDC,
EDA_Colors aColor,
int aWidth,
bool sketch_mode,
bool aSketchMode,
int point_count,
wxPoint* coord,
void (* aCallback)(int x0, int y0, int xf, int yf ),
PLOTTER* plotter )
PLOTTER* aPlotter )
{
if( plotter )
if( aPlotter )
{
plotter->move_to( coord[0] );
aPlotter->move_to( coord[0] );
for( int ik = 1; ik < point_count; ik++ )
{
plotter->line_to( coord[ik] );
aPlotter->line_to( coord[ik] );
}
plotter->pen_finish();
aPlotter->pen_finish();
}
else if( aCallback )
{
@ -181,7 +181,7 @@ static void DrawGraphicTextPline(
coord[ik + 1].x, coord[ik + 1].y );
}
}
else if( sketch_mode )
else if( aSketchMode )
{
for( int ik = 0; ik < (point_count - 1); ik++ )
GRCSegm( aClipBox, aDC, coord[ik].x, coord[ik].y,
@ -218,8 +218,11 @@ static int overbar_position( int size_v, int thickness )
* Use a value min(aSize.x, aSize.y) / 5 for a bold text
* @param aItalic = true to simulate an italic font
* @param aBold = true to use a bold font. Useful only with default width value (aWidth = 0)
* @param aCallback() = function called (if non null) to draw each segment.
* used to draw 3D texts or for plotting, NULL for normal drawings
* @param aPlotter = a pointer to a PLOTTER instance, when this function is used to plot
* the text. NULL to draw this text.
*/
/****************************************************************************************************/
void DrawGraphicText( WinEDA_DrawPanel* aPanel,
wxDC* aDC,
const wxPoint& aPos,
@ -233,8 +236,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
bool aItalic,
bool aBold,
void (* aCallback)( int x0, int y0, int xf, int yf ),
PLOTTER* plotter )
/****************************************************************************************************/
PLOTTER* aPlotter )
{
int AsciiCode;
int x0, y0;
@ -353,10 +355,10 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
RotatePoint( &current_char_pos, aPos, aOrient );
RotatePoint( &end, aPos, aOrient );
if( plotter )
if( aPlotter )
{
plotter->move_to( current_char_pos );
plotter->finish_to( end );
aPlotter->move_to( current_char_pos );
aPlotter->finish_to( end );
}
else if( aCallback )
{
@ -410,7 +412,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
coord[1] = overbar_pos;
/* Plot the overbar segment */
DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
sketch_mode, 2, coord, aCallback, plotter );
sketch_mode, 2, coord, aCallback, aPlotter );
}
continue; /* Skip ~ processing */
}
@ -450,7 +452,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
aWidth = 0;
DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
sketch_mode, point_count, coord,
aCallback, plotter );
aCallback, aPlotter );
}
point_count = 0;
}
@ -492,7 +494,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
coord[1] = overbar_pos;
/* Plot the overbar segment */
DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
sketch_mode, 2, coord, aCallback, plotter );
sketch_mode, 2, coord, aCallback, aPlotter );
}
}

View File

@ -62,6 +62,7 @@ void DSNLEXER::init()
DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
FILE* aFile, const wxString& aFilename ) :
iOwnReaders( true ),
keywords( aKeywordTable ),
keywordCount( aKeywordCount )
{
@ -73,6 +74,7 @@ DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
const std::string& aClipboardTxt, const wxString& aSource ) :
iOwnReaders( true ),
keywords( aKeywordTable ),
keywordCount( aKeywordCount )
{
@ -83,6 +85,28 @@ DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
}
DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
LINE_READER* aLineReader ) :
iOwnReaders( false ),
keywords( aKeywordTable ),
keywordCount( aKeywordCount )
{
PushReader( aLineReader );
init();
}
DSNLEXER::~DSNLEXER()
{
if( iOwnReaders )
{
// delete the LINE_READERs from the stack, since I own them.
for( READER_STACK::iterator it = readerStack.begin(); it!=readerStack.end(); ++it )
delete *it;
}
}
void DSNLEXER::PushReader( LINE_READER* aLineReader )
{
readerStack.push_back( aLineReader );
@ -102,7 +126,7 @@ bool DSNLEXER::PopReader()
{
readerStack.pop_back();
reader = &readerStack.back();
reader = readerStack.back();
start = (char*) (*reader);
// force a new readLine() as first thing.

View File

@ -278,30 +278,32 @@ int OUTPUTFORMATTER::Print( int nestLevel, const char* fmt, ... ) throw( IO_ERRO
}
const char* OUTPUTFORMATTER::Quoted( std::string* aWrapee ) throw( IO_ERROR )
std::string OUTPUTFORMATTER::Quoted( const std::string& aWrapee ) throw( IO_ERROR )
{
// derived class's notion of what a quote character is
char quote = *GetQuoteChar( "(" );
// Will the string be wrapped based on its interior content?
const char* squote = GetQuoteChar( aWrapee->c_str() );
const char* squote = GetQuoteChar( aWrapee.c_str() );
std::string wrapee = aWrapee; // return this
// Search the interior of the string for 'quote' chars
// and replace them as found with duplicated quotes.
// Note that necessarily any string which has internal quotes will
// also be wrapped in quotes later in this function.
for( unsigned i=0; i<aWrapee->size(); ++i )
for( unsigned i=0; i<wrapee.size(); ++i )
{
if( (*aWrapee)[i] == quote )
if( wrapee[i] == quote )
{
aWrapee->insert( aWrapee->begin()+i, quote );
wrapee.insert( wrapee.begin()+i, quote );
++i;
}
else if( (*aWrapee)[0]=='\r' || (*aWrapee)[0]=='\n' )
else if( wrapee[i]=='\r' || wrapee[i]=='\n' )
{
// In a desire to maintain accurate line number reporting within DSNLEXER
// a decision was made to make all S-expression strings be on a single
// line. You can embedd \n (human readable) in the text but not
// line. You can embed \n (human readable) in the text but not
// '\n' which is 0x0a.
throw IO_ERROR( _( "S-expression string has newline" ) );
}
@ -310,11 +312,11 @@ const char* OUTPUTFORMATTER::Quoted( std::string* aWrapee ) throw( IO_ERROR )
if( *squote )
{
// wrap the beginning and end of the string in a quote.
aWrapee->insert( aWrapee->begin(), quote );
aWrapee->insert( aWrapee->end(), quote );
wrapee.insert( wrapee.begin(), quote );
wrapee.insert( wrapee.end(), quote );
}
return aWrapee->c_str();
return wrapee;
}

View File

@ -50,17 +50,14 @@ void XNODE::Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IO_ERROR )
void XNODE::FormatContents( OUTPUTFORMATTER* out, int nestLevel ) throw( IO_ERROR )
{
std::string utf8;
// output attributes first if they exist
for( XATTR* attr = (XATTR*) GetAttributes(); attr; attr = (XATTR*) attr->GetNext() )
{
utf8 = CONV_TO_UTF8( attr->GetValue() ); // capture the content
out->Print( 0, " (%s %s)",
// attr names should never need quoting, no spaces, we designed the file.
CONV_TO_UTF8( attr->GetName() ),
out->Quoted( &utf8 ) );
out->Quoted( CONV_TO_UTF8( attr->GetValue() ) ).c_str()
);
}
// we only expect to have used one of two types here:
@ -85,8 +82,9 @@ void XNODE::FormatContents( OUTPUTFORMATTER* out, int nestLevel ) throw( IO_ERRO
break;
case wxXML_TEXT_NODE:
utf8 = CONV_TO_UTF8( GetContent() );
out->Print( 0, " %s", out->Quoted( &utf8 ) );
out->Print( 0, " %s",
out->Quoted( CONV_TO_UTF8( GetContent() ) ).c_str()
);
break;
default:

View File

@ -859,13 +859,14 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
}
/** GetNextPinPosition()
/**
* Function GetNextPinPosition()
* calculate position of the "next" pin of the aDrawLibItem component
* @param aComponent = component to test.
* @param aPosition = the calculated pin position, according to the component
* @param aPosition = the actual next pin position in schematic, according to the component
* orientation and position
* @param aSearchFirst = if true, search for the first pin
* @return a pointer to the pin
* @param aPin = search for the next pin after aPin. aPin = NULL to find the first pin in list
* @return a pointer to the next pin found or NULL
*/
static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aComponent,
wxPoint& aPosition,

View File

@ -1,5 +1,5 @@
/**
* @file sch_item.h
* @file sch_items.h
*
*/

View File

@ -662,10 +662,10 @@ public:
* @param aPanel = the current DrawPanel
* @param aDC = the current Device Context
* @param aOffset = draw offset (usually (0,0))
* @param EDA_Colors aColor = text color
* @param aColor = text color
* @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode.
* @param GRTraceMode aDisplay_mode = FILAIRE, FILLED or SKETCH
* @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do
* @param aDisplay_mode = FILAIRE, FILLED or SKETCH
* @param aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do
* not draw anchor ).
*/
void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
@ -682,13 +682,13 @@ private:
* @param aPanel = the current DrawPanel
* @param aDC = the current Device Context
* @param aOffset = draw offset (usually (0,0))
* @param EDA_Colors aColor = text color
* @param aColor = text color
* @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode.
* @param aFillMode = FILAIRE, FILLED or SKETCH
* @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do
* @param aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do
* not draw anchor ).
* @param EDA_Colors aText = the single line of text to draw.
* @param EDA_Colors aPos = the position of this line ).
* @param aText = the single line of text to draw.
* @param aPos = the position of this line ).
*/
void DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_Colors aColor,

View File

@ -270,7 +270,7 @@ public:
/**
* Function SetScalingFactor
* @param the the current scale used to draw items on screen
* @param aScale = the the current scale used to draw items on screen
* draw coordinates are user coordinates * GetScalingFactor( )
*/
void SetScalingFactor( double aScale );

View File

@ -200,7 +200,7 @@ public:
/**
* Function Rotate
* Rotate this object.
* @param const wxPoint& aRotCentre - the rotation point.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
*/
virtual void Rotate(const wxPoint& aRotCentre, int aAngle)
@ -211,7 +211,7 @@ public:
/**
* Function Flip
* Flip this object, i.e. change the board side for this object
* @param const wxPoint& aCentre - the rotation point.
* @param aCentre - the rotation point.
*/
virtual void Flip(const wxPoint& aCentre )
{

View File

@ -115,10 +115,20 @@ public:
* Function DrawAuxiliaryAxis
* Draw the Auxiliary Axis, used in pcbnew which as origin coordinates
* for gerber and excellon files
* @param DC = current Device Context
* @param aDC = current Device Context
* @param aDrawMode = draw mode (GR_COPY, GR_OR ..)
*/
void DrawAuxiliaryAxis( wxDC* DC, int drawmode );
void DrawGridAxis( wxDC* DC, int drawmode );
void DrawAuxiliaryAxis( wxDC* aDC, int aDrawMode );
/**
* Function DrawGridAxis
* Draw on auxiliary axis, used in pcbnew to show grid origin, when
* the grid origin is set by user, and is not (0,0)
* @param aDC = current Device Context
* @param aDrawMode = draw mode (GR_COPY, GR_OR ..)
*/
void DrawGridAxis( wxDC* aDC, int aDrawMode );
void OnEraseBackground( wxEraseEvent& event );
void OnActivate( wxActivateEvent& event );

View File

@ -65,6 +65,8 @@ int NegableTextLength( const wxString& aText );
* @param aBold = true to use a bold font
* @param aCallback() = function called (if non null) to draw each segment.
* used to draw 3D texts or for plotting, NULL for normal drawings
* @param aPlotter = a pointer to a PLOTTER instance, when this function is used to plot
* the text. NULL to draw this text.
*/
void DrawGraphicText( WinEDA_DrawPanel * aPanel,
wxDC * aDC,
@ -79,7 +81,7 @@ void DrawGraphicText( WinEDA_DrawPanel * aPanel,
bool aItalic,
bool aBold,
void (*aCallback)( int x0, int y0, int xf, int yf ) = NULL,
PLOTTER * plotter = NULL );
PLOTTER * aPlotter = NULL );
#endif /* __INCLUDE__DRAWTXT_H__ */

View File

@ -27,9 +27,7 @@
#include <cstdio>
#include <string>
#include <boost/ptr_container/ptr_vector.hpp>
//#include "fctsys.h"
#include <vector>
#include "richio.h"
@ -78,14 +76,15 @@ enum DSN_SYNTAX_T {
*/
class DSNLEXER
{
bool iOwnReaders; ///< on readerStack, should I delete them?
char* start;
char* next;
char* limit;
typedef boost::ptr_vector<LINE_READER> READER_STACK;
typedef std::vector<LINE_READER*> READER_STACK;
READER_STACK readerStack; ///< owns all the LINE_READERs by pointer.
LINE_READER* reader; ///< no ownership. ownership is via readerStack.
READER_STACK readerStack; ///< all the LINE_READERs by pointer.
LINE_READER* reader; ///< no ownership. ownership is via readerStack, maybe, if iOwnReaders
int stringDelimiter;
bool space_in_quoted_tokens; ///< blank spaces within quoted strings
bool commentsAreTokens; ///< true if should return comments as tokens
@ -155,7 +154,7 @@ class DSNLEXER
public:
/**
* Constructor DSNLEXER
* Constructor ( FILE*, const wxString& )
* intializes a DSN lexer and prepares to read from aFile which
* is already open and has aFilename.
*
@ -168,12 +167,35 @@ public:
DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
FILE* aFile, const wxString& aFileName );
/**
* Constructor ( std::string&*, const wxString& )
* intializes a DSN lexer and prepares to read from @a aSExpression.
*
* @param aKeywordTable is an array of KEYWORDS holding \a aKeywordCount. This
* token table need not contain the lexer separators such as '(' ')', etc.
* @param aKeywordTable is the count of tokens in aKeywordTable.
* @param aSExpression is text to feed through a STRING_LINE_READER
* @param aSource is a description of aSExpression, used for error reporting.
*/
DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
const std::string& aClipboardTxt, const wxString& aSource = wxEmptyString );
const std::string& aSExpression, const wxString& aSource = wxEmptyString );
~DSNLEXER()
{
}
/**
* Constructor ( LINE_READER* )
* intializes a DSN lexer and prepares to read from @a aLineReader which
* is already open, and may be in use by other DSNLEXERs also. No ownership
* is taken of @a aLineReader. This enables it to be used by other DSNLEXERs also.
*
* @param aKeywordTable is an array of KEYWORDS holding \a aKeywordCount. This
* token table need not contain the lexer separators such as '(' ')', etc.
* @param aKeywordTable is the count of tokens in aKeywordTable.
* @param aLineReader is any subclassed instance of LINE_READER, such as
* STRING_LINE_READER or FILE_LINE_READER.
*/
DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
LINE_READER* aLineReader );
virtual ~DSNLEXER();
/**
* Function PushReader

View File

@ -96,7 +96,6 @@ void GRBezier( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
* @param aDC the device context into which drawing should occur.
* @param aPointCount the number of points in the array \a aPoints.
* @param aPoints The points to draw.
* @param aPointArray an array holding the wxPoints in the polygon.
* @param doFill true if polygon is to be filled, else false and only the boundary is drawn.
* @param aPenColor the color index of the border.
* @param aFillColor the fill color of the polygon's interior.
@ -120,7 +119,6 @@ void GRClosedPoly( EDA_Rect* ClipBox,
* @param aDC the device context into which drawing should occur.
* @param aPointCount the number of points in the array \a aPointArray.
* @param aPoints the points to draw.
* @param aPointArray an array holding the wxPoints in the polygon.
* @param doFill true if polygon is to be filled, else false and only the boundary is drawn.
* @param aPenWidth is the width of the pen to use on the perimeter, can be zero.
* @param aPenColor the color index of the border.
@ -144,7 +142,7 @@ void GRClosedPoly( EDA_Rect* ClipBox,
* @param ClipBox defines a rectangular boundary outside of which no drawing will occur.
* @param aDC the device context into which drawing should occur.
* @param x The x coordinate in user space of the center of the circle.
* @param x The y coordinate in user space of the center of the circle.
* @param y The y coordinate in user space of the center of the circle.
* @param aRadius is the radius of the circle.
* @param aColor is an index into our color table of RGB colors.
* @see EDA_Colors and colors.h

View File

@ -108,7 +108,7 @@ wxString AddHotkeyName( const wxString& aText, Ki_HotkeyInfo** aList,
* Function AddHotkeyName
* Add the key name from the Command id value ( m_Idcommand member value)
* @param aText = a wxString. returns aText + key name
* @param aList = pointer to a Ki_HotkeyInfoSectionDescriptor DescrList of commands
* @param aDescrList = pointer to a Ki_HotkeyInfoSectionDescriptor DescrList of commands
* @param aCommandId = Command Id value
* @param aIsShortCut = true to add &lttab&gt&ltkeyname&gt (active shortcuts in menus)
* = false to add &ltspaces&gt&lt(keyname)&gt

View File

@ -42,6 +42,10 @@ struct IO_ERROR
{
wxString errorText;
/**
* Constructor ( const wxChar* )
* handles the case where _() is passed as aMsg.
*/
IO_ERROR( const wxChar* aMsg ) :
errorText( aMsg )
{

View File

@ -336,15 +336,14 @@ public:
*
* @param aWrapee is a string that might need wraping in double quotes,
* and it might need to have its internal quotes doubled up, or not.
* Caller's copy may be modified, or not.
*
* @return const char* - useful for passing to printf() style functions that
* must output utf8 streams.
* @return std::string - whose c_str() function can be called for passing
* to printf() style functions that must output utf8 encoded s-expression streams.
* @throw IO_ERROR, if aWrapee has any \r or \n bytes in it which is
* illegal according to the DSNLEXER who does not ever want them
* within a string.
*/
virtual const char* Quoted( std::string* aWrapee ) throw( IO_ERROR );
virtual std::string Quoted( const std::string& aWrapee ) throw( IO_ERROR );
//-----</interface functions>-----------------------------------------
};

View File

@ -234,10 +234,11 @@ public:
* Second = VALUE: "VAL**"
* the new module is added to the board module list
* @param aModuleName = name of the new footprint
* (will the component reference in board)
* (will be the component reference in board)
* @return a pointer to the new module
*/
MODULE* Create_1_Module( const wxString& module_name );
MODULE* Create_1_Module( const wxString& aModuleName );
void Edit_Module( MODULE* module, wxDC* DC );
void Rotate_Module( wxDC* DC,
MODULE* module,
@ -285,11 +286,11 @@ public:
*
* Read active libraries or one library to find and load a given module
* If found the module is linked to the tail of linked list of modules
* @param aLibraryFullFileName - the full filename of the library to read. If empty,
* @param aLibraryFullFilename - the full filename of the library to read. If empty,
* all active libraries are read
* @param aModuleName = module name to load
* @param aDisplayMessageError = true to display an error message if any.
* @return a MODULE * pointer to the new module, or NULL
* @return a pointer to the new module, or NULL
*
*/
MODULE* Get_Librairie_Module( const wxString& aLibraryFullFilename,
@ -299,6 +300,7 @@ public:
/**
* Function Select_1_Module_From_List
* Display a list of modules found in active libraries or a given library
* @param active_window = the current window ( parent window )
* @param aLibraryFullFilename = library to list (if aLibraryFullFilename
* == void, list all modules)
* @param aMask = Display filter (wildcart)( Mask = wxEmptyString if not

View File

@ -540,10 +540,10 @@ public:
* sub-hierarchy will be deleted. If it is only a copy, the GetDrawItems() and the
* sub-hierarchy must NOT be deleted.
*
* @Note
* @note
* Edit wires and buses is a bit complex.
* because when a new wire is added, modifications in wire list
* (wire concatenation) there are modified items, deleted items and new items
* because when a new wire is added, a lot of modifications in wire list is made
* (wire concatenation): modified items, deleted items and new items
* so flag_type_command is UR_WIRE_IMAGE: the struct ItemToCopy is a list of
* wires saved in Undo List (for Undo or Redo commands, saved wires will be
* exchanged with current wire list

View File

@ -157,7 +157,7 @@ public:
* @param aFilename = file name to read.
* @param aDescList = current hotkey list descr. to initialise.
*/
int ReadHotkeyConfigFile( const wxString& Filename,
int ReadHotkeyConfigFile( const wxString& aFilename,
struct Ki_HotkeyInfoSectionDescriptor* aDescList );
/**

View File

@ -26,6 +26,12 @@
*/
#include "richio.h"
// quiet the deprecated warnings with 3 lines:
#include <wx/defs.h>
#undef wxDEPRECATED
#define wxDEPRECATED(x) x
#include <wx/xml/xml.h>

View File

@ -25,6 +25,7 @@
#include <sch_lib_table.h>
#include <sch_lib_table_lexer.h>
#include <set>
using namespace std;
using namespace SCH;
@ -156,21 +157,59 @@ void LIB_TABLE::Format( OUTPUTFORMATTER* out, int nestLevel ) const
out->Print( nestLevel, ")\n" );
}
void LIB_TABLE::ROW::Format( OUTPUTFORMATTER* out, int nestLevel ) const
throw( IO_ERROR )
{
out->Print( nestLevel, "(lib (logical \"%s\")(type \"%s\")(full_uri \"%s\")(options \"%s\"))\n",
logicalName.c_str(), libType.c_str(), fullURI.c_str(), options.c_str() );
out->Print( nestLevel, "(lib (logical %s)(type %s)(full_uri %s)(options %s))\n",
out->Quoted( logicalName ).c_str(),
out->Quoted( libType ).c_str(),
out->Quoted( fullURI ).c_str(),
out->Quoted( options ).c_str()
);
}
const LIB_TABLE::ROW* LIB_TABLE::FindRow( const STRING& aLogicalName )
STRINGS LIB_TABLE::GetLogicalLibs()
{
// only return unique logical library names. Use std::set::insert() to
// quietly reject any duplicates, which can happen in the fall back table(s).
set<STRING> unique;
STRINGS ret;
const LIB_TABLE* cur = this;
do
{
for( ROWS_CITER it = cur->rows.begin(); it!=cur->rows.end(); ++it )
{
unique.insert( it->second->logicalName );
}
} while( ( cur = cur->fallBack ) != 0 );
// return a sorted, unique set of STRINGS to caller
for( set<STRING>::const_iterator it = unique.begin(); it!=unique.end(); ++it )
ret.push_back( *it );
return ret;
}
PART* LIB_TABLE::GetPart( const LPID& aLogicalPartID ) throw( IO_ERROR )
{
// need LIPD done.
return 0;
}
const LIB_TABLE::ROW* LIB_TABLE::FindRow( const STRING& aLogicalName ) const
{
// this function must be *super* fast, so therefore should not instantiate
// anything which would require using the heap. This function is the reason
// ptr_map<> was used instead of ptr_set<>, which would have required
// instantiating a ROW just to find a ROW.
LIB_TABLE* cur = this;
const LIB_TABLE* cur = this;
do
{
@ -203,7 +242,8 @@ bool LIB_TABLE::InsertRow( auto_ptr<ROW>& aRow, bool doReplace )
rows.insert( key, aRow );
return true;
}
else if( doReplace )
if( doReplace )
{
rows.erase( aRow->logicalName );
@ -229,9 +269,10 @@ void LIB_TABLE::Test()
// To pass an empty string, we can pass " " to (options " ")
SCH_LIB_TABLE_LEXER slr(
"(lib_table \n"
" (lib (logical www) (type http) (full_uri http://kicad.org/libs) (options \" \"))\n"
" (lib (logical meparts) (type dir) (full_uri /tmp/eeschema-lib) (options \" \"))\n"
" (lib (logical old-project) (type schematic)(full_uri /tmp/old-schematic.sch) (options \" \"))\n"
" (lib (logical www) (type http) (full_uri http://kicad.org/libs) (options \" \"))\n",
,
wxT( "inline text" ) // source
);
@ -258,6 +299,7 @@ void LIB_TABLE::Test()
STRING_FORMATTER sf;
// format this whole table into sf, it will be sorted by logicalName.
Format( &sf, 0 );
printf( "test 'Parse() <-> Format()' round tripping:\n" );
@ -275,6 +317,14 @@ void LIB_TABLE::Test()
}
else
printf( "not found\n" );
printf( "\nlist of logical libraries:\n" );
STRINGS logNames = GetLogicalLibs();
for( STRINGS::const_iterator it = logNames.begin(); it!=logNames.end(); ++it )
{
printf( "logicalName: %s\n", it->c_str() );
}
}

View File

@ -58,13 +58,6 @@ public:
public:
/* was needed for ptr_set<> but not ptr_map<>
bool operator<( const ROW& other ) const
{
return logicalName < other.logicalName;
}
*/
/**
* Function GetLogicalName
* returns the logical name of this library table entry.
@ -223,46 +216,54 @@ public:
*/
PART* GetPart( const LPID& aLogicalPartID ) throw( IO_ERROR );
#if 0 // moved here from LPID
/**
* Function GetLogicalLibraries
* returns the logical library names, all of them that are in the
* library table.
* Function GetLogicalLibs
* returns the logical library names, all of them that are in pertinent to
* a lookup done on this LIB_TABLE.
*/
STRINGS GetLogicalLibraries();
STRINGS GetLogicalLibs();
//----<read accessors>----------------------------------------------------
// the returning of a const STRING* tells if not found, but might be too
// promiscuous?
/**
* Function GetLibraryURI
* Function GetLibURI
* returns the full library path from a logical library name.
* @param aLogicalLibraryName is the short name for the library of interest.
* @param aSchematic provides access to the full library table inclusive
* of the schematic contribution, or may be NULL to exclude the schematic rows.
* @return const STRING* - or NULL if not found.
*/
STRING GetLibraryURI( const STRING& aLogicalLibraryName,
SCHEMATIC* aSchematic=NULL ) const;
const STRING* GetLibURI( const STRING& aLogicalLibraryName ) const
{
const ROW* row = FindRow( aLogicalLibraryName );
return row ? &row->fullURI : 0;
}
/**
* Function GetLibraryType
* Function GetLibType
* returns the type of a logical library.
* @param aLogicalLibraryName is the short name for the library of interest.
* @param aSchematic provides access to the full library table inclusive
* of the schematic contribution, or may be NULL to exclude the schematic rows.
* @return const STRING* - or NULL if not found.
*/
STRING GetLibraryType( const STRING& aLogicalLibraryName,
SCHEMATIC* aSchematic=NULL ) const;
const STRING* GetLibType( const STRING& aLogicalLibraryName ) const
{
const ROW* row = FindRow( aLogicalLibraryName );
return row ? &row->libType : 0;
}
/**
* Function GetOptions
* Function GetLibOptions
* returns the options string for \a aLogicalLibraryName.
* @param aLogicalLibraryName is the short name for the library of interest.
* @param aSchematic provides access to the full library table inclusive
* of the schematic contribution, or may be NULL to exclude the schematic rows.
* @return const STRING* - or NULL if not found.
*/
STRING GetOptions( const STRING& aLogicalLibraryName,
SCHEMATIC* aSchematic=NULL ) const;
#endif
const STRING* GetLibOptions( const STRING& aLogicalLibraryName ) const
{
const ROW* row = FindRow( aLogicalLibraryName );
return row ? &row->options : 0;
}
//----</read accessors>---------------------------------------------------
#if defined(DEBUG)
/// implement the tests in here so we can honor the priviledge levels of the
@ -276,9 +277,10 @@ protected: // only a table editor can use these
* Function InsertRow
* adds aRow if it does not already exist or if doReplace is true. If doReplace
* is not true and the key for aRow already exists, the function fails and returns false.
* The key for the table is the logicalName, and all in this table must be unique.
* @param aRow is the new row to insert, or to forcibly add if doReplace is true.
* @param doReplace if true, means insert regardless if aRow's key already exists. If false, then fail
* if the key already exists.
* @param doReplace if true, means insert regardless of whether aRow's key already
* exists. If false, then fail if the key already exists.
* @return bool - true if the operation succeeded.
*/
bool InsertRow( std::auto_ptr<ROW>& aRow, bool doReplace = false );
@ -287,7 +289,7 @@ protected: // only a table editor can use these
* Function FindRow
* returns a ROW* if aLogicalName is found in this table or in fallBack, else NULL.
*/
const ROW* FindRow( const STRING& aLogicalName );
const ROW* FindRow( const STRING& aLogicalName ) const;
private:

View File

@ -71,7 +71,7 @@ BOARD_ITEM* DuplicateStruct( BOARD_ITEM* aItem );
* - if a call to SaveCopyInUndoList was forgotten in pcbnew
* - in zones outlines, when a change in one zone merges this zone with an other
* This function avoids a pcbnew crash
* @param aBoard = board to test
* @param aPcb = board to test
* @param aItem = item to find
*/
static bool TestForExistingItem( BOARD* aPcb, BOARD_ITEM* aItem )

View File

@ -277,7 +277,7 @@ EDA_Rect TEXTE_MODULE::GetTextRect( void ) const
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
* @param refPos A wxPoint to test
* @return bool - true if a hit, else false
* @return true if a hit, else false
*/
bool TEXTE_MODULE::HitTest( const wxPoint& refPos )
{
@ -419,6 +419,8 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
size, m_HJustify, m_VJustify, width, m_Italic, m_Bold );
}
/* Rraws a line from the TEXTE_MODULE origin to parent MODULE origin.
*/
void TEXTE_MODULE::DrawUmbilical( WinEDA_DrawPanel* aPanel,
wxDC* aDC,
int aDrawMode,
@ -430,9 +432,7 @@ void TEXTE_MODULE::DrawUmbilical( WinEDA_DrawPanel* aPanel,
GRSetDrawMode( aDC, GR_XOR );
GRLine( &aPanel->m_ClipBox, aDC,
parent->GetPosition().x, parent->GetPosition().y,
GetPosition().x + aOffset.x,
GetPosition().y + aOffset.y,
parent->GetPosition(), GetPosition() + aOffset,
0, UMBILICAL_COLOR);
}

View File

@ -154,7 +154,7 @@ public: TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS );
/**
* Function GetClass
* returns the class name.
* @return wxString
* @return wxString = "MTEXT"
*/
virtual wxString GetClass() const
{

View File

@ -242,11 +242,12 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
/** Creates the drill map aFile in HPGL or POSTSCRIPT format
* @param aPcb BOARD
* @param aPcb = the BOARD
* @param aPlotter = a PLOTTER instance (HPGL or POSTSCRIPT plotter).
* @param aHoleListBuffer = std::vector<HOLE_INFO> list of holes descriptors
* @param aToolListBuffer = std::vector<DRILL_TOOL> drill list buffer
*/
void Gen_Drill_PcbMap( BOARD* aPcb, PLOTTER* plotter,
void Gen_Drill_PcbMap( BOARD* aPcb, PLOTTER* aPlotter,
std::vector<HOLE_INFO>& aHoleListBuffer,
std::vector<DRILL_TOOL>& aToolListBuffer )
{
@ -269,14 +270,14 @@ void Gen_Drill_PcbMap( BOARD* aPcb, PLOTTER* plotter,
/* Always plot the drill symbol (for slots identifies the needed
* cutter!) */
plotter->marker( pos, aHoleListBuffer[ii].m_Hole_Diameter,
aPlotter->marker( pos, aHoleListBuffer[ii].m_Hole_Diameter,
aHoleListBuffer[ii].m_Tool_Reference - 1 );
if( aHoleListBuffer[ii].m_Hole_Shape != 0 )
{
wxSize oblong_size;
oblong_size.x = aHoleListBuffer[ii].m_Hole_SizeX;
oblong_size.y = aHoleListBuffer[ii].m_Hole_SizeY;
plotter->flash_pad_oval( pos, oblong_size,
aPlotter->flash_pad_oval( pos, oblong_size,
aHoleListBuffer[ii].m_Hole_Orient, FILAIRE );
}
}

View File

@ -35,7 +35,7 @@ static bool CmpHoleDiameterValue( const HOLE_INFO& a, const HOLE_INFO& b )
* Create the list of holes and tools for a given board
* The list is sorted by increasing drill values
* Only holes from aFirstLayer to aLastLayer copper layers are listed (for vias, because pad holes are always through holes)
* @param Pcb : the given board
* @param aPcb : the given board
* @param aHoleListBuffer : the std::vector<HOLE_INFO> to fill with pcb holes info
* @param aToolListBuffer : the std::vector<DRILL_TOOL> to fill with tools to use
* @param aFirstLayer = first layer to consider. if < 0 aFirstLayer is ignored (used to creates report file)

View File

@ -137,7 +137,7 @@ public: EXCELLON_WRITER( BOARD* aPcb, FILE* aFile,
/**
* SetFormat
* Function SetFormat
* Initialize internal parameters to match the given format
* @param aMetric = true for metric coordinates, false for imperial units
* @param aZerosFmt = DECIMAL_FORMAT, SUPPRESS_LEADING, SUPPRESS_TRAILING, KEEP_ZEROS
@ -147,12 +147,11 @@ public: EXCELLON_WRITER( BOARD* aPcb, FILE* aFile,
void SetFormat( bool aMetric, zeros_fmt aZerosFmt, int aLeftDigits, int aRightDigits );
/**
* SetOptions
* Function SetOptions
* Initialize internal parameters to match drill options
* @param aMetric = true for metric coordinates, false for imperial units
* @param aZerosFmt = DECIMAL_FORMAT, SUPPRESS_LEADING, SUPPRESS_TRAILING, KEEP_ZEROS
* @param aLeftDigits = number of digits for integer part of coordinates
* @param aRightDigits = number of digits for mantissa part of coordinates
* @param aMirror = true to create mirrored coordinates (Y coordinates negated)
* @param aMinimalHeader = true to use a minimal header (no comments, no info)
* @param aOffset = drill coordinates offset
*/
void SetOptions( bool aMirror, bool aMinimalHeader, wxPoint aOffset )
{
@ -163,7 +162,7 @@ public: EXCELLON_WRITER( BOARD* aPcb, FILE* aFile,
/**
* CreateDrillFile
* Function CreateDrillFile
* Creates an Excellon drill file
* @return hole count
*/
@ -180,14 +179,14 @@ private:
* Create the list of holes and tools for a given board
* The list is sorted by increasing drill values
* Only holes from aFirstLayer to aLastLayer copper layers are listed (for vias, because pad holes are always through holes)
* @param Pcb : the given board
* @param aPcb : the given board
* @param aHoleListBuffer : the std::vector<HOLE_INFO> to fill with pcb holes info
* @param aToolListBuffer : the std::vector<DRILL_TOOL> to fill with tools to use
* @param aFirstLayer = first layer to consider. if < 0 aFirstLayer is ignored
* @param aLastLayer = last layer to consider. if < 0 aLastLayer is ignored
* @param aExcludeThroughHoles : if true, exclude through holes ( pads and vias through )
*/
void Build_Holes_List( BOARD* Pcb, std::vector<HOLE_INFO>& aHoleListBuffer,
void Build_Holes_List( BOARD* aPcb, std::vector<HOLE_INFO>& aHoleListBuffer,
std::vector<DRILL_TOOL>& aToolListBuffer,
int aFirstLayer, int aLastLayer, bool aExcludeThroughHoles );

View File

@ -509,9 +509,9 @@ bool TestFlags( const wxString& flg_string, long flg_mask, const wxChar* flg_nam
* Test flag flg_mask or flg_name.
* @param flg_string = flsg list to test: can be a bit field flag or a list name flsg
* a bit field flag is an hexadecimal value: Ox00020000
* a list name flsg is a string list of flags, comma separated like square,option1
* @param flg_mask = flsg list to test
* @param flg_mask = flsg list to test
* a list name flag is a string list of flags, comma separated like square,option1
* @param flg_mask = flag list to test
* @param flg_name = flag name to find in list
* @return true if found
*/
{

View File

@ -342,10 +342,11 @@ static void gen_arc( std::vector <wxPoint>& aBuffer,
/**
* Function BuildCornersList_S_Shape
* Create a path like a S-shaped coil
* @param aBuffer = a vector <wxPoint>& buffer where to put points
* @param aBuffer = a buffer where to store points (ends of segments)
* @param aStartPoint = starting point of the path
* @param aEndPoint = ending point of the path
* @param aLength = full lenght of the path
* @param aWidth = witdth of lines
* @param aWidth = segment width
*/
int BuildCornersList_S_Shape( std::vector <wxPoint>& aBuffer,
wxPoint aStartPoint, wxPoint aEndPoint,