diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 214af034d5..53522cca1a 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 +================================================================================ +++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 ================================================================================ ++all diff --git a/CMakeModules/TokenList2DsnLexer.cmake b/CMakeModules/TokenList2DsnLexer.cmake index f89d009244..4eefa003e8 100644 --- a/CMakeModules/TokenList2DsnLexer.cmake +++ b/CMakeModules/TokenList2DsnLexer.cmake @@ -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 diff --git a/common/build_version.cpp b/common/build_version.cpp index 8f2d5182aa..2751740a1b 100644 --- a/common/build_version.cpp +++ b/common/build_version.cpp @@ -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" diff --git a/common/common_plotDXF_functions.cpp b/common/common_plotDXF_functions.cpp index 48081278f9..4b9ea18809 100644 --- a/common/common_plotDXF_functions.cpp +++ b/common/common_plotDXF_functions.cpp @@ -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 ); } diff --git a/common/drawtxt.cpp b/common/drawtxt.cpp index c22eb1fa41..fe66eb1248 100644 --- a/common/drawtxt.cpp +++ b/common/drawtxt.cpp @@ -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( ¤t_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 ); } } diff --git a/common/dsnlexer.cpp b/common/dsnlexer.cpp index f5703d2855..8c91bed4d3 100644 --- a/common/dsnlexer.cpp +++ b/common/dsnlexer.cpp @@ -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. diff --git a/common/richio.cpp b/common/richio.cpp index ccbcc5d0e1..0a526b5460 100644 --- a/common/richio.cpp +++ b/common/richio.cpp @@ -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; isize(); ++i ) + for( unsigned i=0; iinsert( 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; } diff --git a/common/xnode.cpp b/common/xnode.cpp index cf26f0e850..f0758bc603 100644 --- a/common/xnode.cpp +++ b/common/xnode.cpp @@ -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: diff --git a/eeschema/block.cpp b/eeschema/block.cpp index 55390faf32..cc0bcea493 100644 --- a/eeschema/block.cpp +++ b/eeschema/block.cpp @@ -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, diff --git a/eeschema/sch_items.h b/eeschema/sch_items.h index 223cde7763..f82cf692fa 100644 --- a/eeschema/sch_items.h +++ b/eeschema/sch_items.h @@ -1,5 +1,5 @@ /** - * @file sch_item.h + * @file sch_items.h * */ diff --git a/include/base_struct.h b/include/base_struct.h index bcd64fb119..e4b8153fb4 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -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, diff --git a/include/class_base_screen.h b/include/class_base_screen.h index 80bf0ecad5..3583fd7c34 100644 --- a/include/class_base_screen.h +++ b/include/class_base_screen.h @@ -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 ); diff --git a/include/class_board_item.h b/include/class_board_item.h index 3a166a15b7..df542f82df 100644 --- a/include/class_board_item.h +++ b/include/class_board_item.h @@ -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 ) { diff --git a/include/class_drawpanel.h b/include/class_drawpanel.h index 517c72d2c2..c447044ced 100644 --- a/include/class_drawpanel.h +++ b/include/class_drawpanel.h @@ -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 ); diff --git a/include/drawtxt.h b/include/drawtxt.h index f5e7037bf5..0337d95841 100644 --- a/include/drawtxt.h +++ b/include/drawtxt.h @@ -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__ */ diff --git a/include/dsnlexer.h b/include/dsnlexer.h index e1900bd31d..232b386c0f 100644 --- a/include/dsnlexer.h +++ b/include/dsnlexer.h @@ -27,9 +27,7 @@ #include #include -#include - -//#include "fctsys.h" +#include #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 READER_STACK; + typedef std::vector 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 diff --git a/include/gr_basic.h b/include/gr_basic.h index 178bc87ae3..3a562bc159 100644 --- a/include/gr_basic.h +++ b/include/gr_basic.h @@ -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 diff --git a/include/hotkeys_basic.h b/include/hotkeys_basic.h index a54cffaa5a..cc9ac11e50 100644 --- a/include/hotkeys_basic.h +++ b/include/hotkeys_basic.h @@ -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 <tab><keyname> (active shortcuts in menus) * = false to add <spaces><(keyname)> diff --git a/include/kicad_exceptions.h b/include/kicad_exceptions.h index e220e87835..a05dbf268b 100644 --- a/include/kicad_exceptions.h +++ b/include/kicad_exceptions.h @@ -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 ) { diff --git a/include/richio.h b/include/richio.h index e6c32fa5da..fac82ed820 100644 --- a/include/richio.h +++ b/include/richio.h @@ -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 ); //---------------------------------------------- }; diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index db2826b0e8..ae4b2bbce4 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -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 diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h index 62c339bee5..26f5123f50 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -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 diff --git a/include/wxstruct.h b/include/wxstruct.h index 4be9cf67f1..3678626fb3 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -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 ); /** diff --git a/include/xnode.h b/include/xnode.h index 4ec00e1178..de5b5988bd 100644 --- a/include/xnode.h +++ b/include/xnode.h @@ -26,6 +26,12 @@ */ #include "richio.h" + +// quiet the deprecated warnings with 3 lines: +#include +#undef wxDEPRECATED +#define wxDEPRECATED(x) x + #include diff --git a/new/sch_lib_table.cpp b/new/sch_lib_table.cpp index 3c6f39005f..ad1913b274 100644 --- a/new/sch_lib_table.cpp +++ b/new/sch_lib_table.cpp @@ -25,6 +25,7 @@ #include #include +#include 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 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::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& 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() ); + } } diff --git a/new/sch_lib_table.h b/new/sch_lib_table.h index 69c93ab5da..7e42b4e3b0 100644 --- a/new/sch_lib_table.h +++ b/new/sch_lib_table.h @@ -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(); + + //-------------------------------------------------------- + // 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; + } + //------------------------------------------------------- #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& 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: diff --git a/pcbnew/board_undo_redo.cpp b/pcbnew/board_undo_redo.cpp index f1c9b7511e..164656dd56 100644 --- a/pcbnew/board_undo_redo.cpp +++ b/pcbnew/board_undo_redo.cpp @@ -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 ) diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 1c6229281b..47908f2733 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -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); } diff --git a/pcbnew/class_text_mod.h b/pcbnew/class_text_mod.h index dba6a82dcf..a28533ce18 100644 --- a/pcbnew/class_text_mod.h +++ b/pcbnew/class_text_mod.h @@ -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 { diff --git a/pcbnew/gen_drill_report_files.cpp b/pcbnew/gen_drill_report_files.cpp index e5a65084f2..d7a631922a 100644 --- a/pcbnew/gen_drill_report_files.cpp +++ b/pcbnew/gen_drill_report_files.cpp @@ -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 list of holes descriptors * @param aToolListBuffer = std::vector drill list buffer */ -void Gen_Drill_PcbMap( BOARD* aPcb, PLOTTER* plotter, +void Gen_Drill_PcbMap( BOARD* aPcb, PLOTTER* aPlotter, std::vector& aHoleListBuffer, std::vector& 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 ); } } diff --git a/pcbnew/gen_holes_and_tools_lists_for_drill.cpp b/pcbnew/gen_holes_and_tools_lists_for_drill.cpp index 5ee07fc7ff..b07e143105 100644 --- a/pcbnew/gen_holes_and_tools_lists_for_drill.cpp +++ b/pcbnew/gen_holes_and_tools_lists_for_drill.cpp @@ -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 to fill with pcb holes info * @param aToolListBuffer : the std::vector to fill with tools to use * @param aFirstLayer = first layer to consider. if < 0 aFirstLayer is ignored (used to creates report file) diff --git a/pcbnew/gendrill.h b/pcbnew/gendrill.h index f5c3167a92..6edf9f77ea 100644 --- a/pcbnew/gendrill.h +++ b/pcbnew/gendrill.h @@ -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 to fill with pcb holes info * @param aToolListBuffer : the std::vector 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& aHoleListBuffer, +void Build_Holes_List( BOARD* aPcb, std::vector& aHoleListBuffer, std::vector& aToolListBuffer, int aFirstLayer, int aLastLayer, bool aExcludeThroughHoles ); diff --git a/pcbnew/gpcb_exchange.cpp b/pcbnew/gpcb_exchange.cpp index 75b95fdf9a..57c539b3a2 100644 --- a/pcbnew/gpcb_exchange.cpp +++ b/pcbnew/gpcb_exchange.cpp @@ -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 */ { diff --git a/pcbnew/muonde.cpp b/pcbnew/muonde.cpp index 1512d3495e..87a3ca5bd6 100644 --- a/pcbnew/muonde.cpp +++ b/pcbnew/muonde.cpp @@ -342,10 +342,11 @@ static void gen_arc( std::vector & aBuffer, /** * Function BuildCornersList_S_Shape * Create a path like a S-shaped coil - * @param aBuffer = a vector & 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 & aBuffer, wxPoint aStartPoint, wxPoint aEndPoint,