diff --git a/include/class_board_item.h b/include/class_board_item.h index 14bcbe9b20..40b61df5d8 100644 --- a/include/class_board_item.h +++ b/include/class_board_item.h @@ -11,13 +11,13 @@ /* Shapes for segments (graphic segments and tracks) ( .m_Shape member ) */ enum Track_Shapes { - S_SEGMENT = 0, /* usual segment : line with rounded ends */ - S_RECT, /* segment with non rounded ends */ - S_ARC, /* Arcs (with rounded ends)*/ - S_CIRCLE, /* ring*/ - S_POLYGON, /* polygonal shape (not yet used for tracks, but could be in microwave apps) */ - S_CURVE, /* Bezier Curve*/ - S_LAST /* last value for this list */ + S_SEGMENT = 0, /* usual segment : line with rounded ends */ + S_RECT, /* segment with non rounded ends */ + S_ARC, /* Arcs (with rounded ends) */ + S_CIRCLE, /* ring */ + S_POLYGON, /* polygon (not yet used for tracks, but could be in microwave apps) */ + S_CURVE, /* Bezier Curve */ + S_LAST /* last value for this list */ }; @@ -60,7 +60,7 @@ public: /** * A value of wxPoint(0,0) which can be passed to the Draw() functions. */ - static wxPoint ZeroOffset; + static wxPoint ZeroOffset; BOARD_ITEM* Next() const { return (BOARD_ITEM*) Pnext; } BOARD_ITEM* Back() const { return (BOARD_ITEM*) Pback; } @@ -69,8 +69,7 @@ public: /** * Function GetPosition * returns the position of this object. - * @return wxPoint& - The position of this object, non-const so it - * can be changed + * @return wxPoint& - The position of this object, non-const so it can be changed */ virtual wxPoint& GetPosition() = 0; @@ -85,9 +84,9 @@ public: * sets the layer this item is on. * @param aLayer The layer number. * is virtual because some items (in fact: class DIMENSION) - * have a slightly different initialisation + * have a slightly different initialization */ - virtual void SetLayer( int aLayer ) { m_Layer = aLayer; } + virtual void SetLayer( int aLayer ) { m_Layer = aLayer; } /** @@ -117,9 +116,9 @@ public: * form of testing. * @return bool - true if a track or via, else false. */ - bool IsTrack( ) const + bool IsTrack() const { - return (Type() == TYPE_TRACK) || (Type() == TYPE_VIA); + return ( Type() == TYPE_TRACK ) || ( Type() == TYPE_VIA ); } /** @@ -139,7 +138,6 @@ public: */ virtual void UnLink(); - /** * Function DeleteStructure * deletes this object after UnLink()ing it from its owner. @@ -151,39 +149,29 @@ public: } - /** - * Function MenuIcon - * @return const char** - The XPM to use in any UI control which can help - * identify this item. - * @todo: make this virtual and split into each derived class - */ - const char** MenuIcon() const; - - /** * Function ShowShape * converts the enum Track_Shapes integer value to a wxString. */ static wxString ShowShape( Track_Shapes aShape ); - /** * Function Save * writes the data structures for this object out to a FILE in "*.brd" format. * @param aFile The FILE to write to. * @return bool - true if success writing else false. */ - virtual bool Save( FILE* aFile ) const = 0; + virtual bool Save( FILE* aFile ) const = 0; - // Some geometric transforms, that must be rewrittem for derived classes + // Some geometric transforms, that must be rewritten for derived classes /** * Function Move * move this object. * @param aMoveVector - the move vector for this object. */ - virtual void Move(const wxPoint& aMoveVector) + virtual void Move( const wxPoint& aMoveVector ) { - wxMessageBox(wxT("virtual BOARD_ITEM::Move used, should not occur"), GetClass()); + wxMessageBox( wxT( "virtual BOARD_ITEM::Move used, should not occur" ), GetClass() ); } /** @@ -192,9 +180,9 @@ public: * @param aRotCentre - the rotation point. * @param aAngle - the rotation angle in 0.1 degree. */ - virtual void Rotate(const wxPoint& aRotCentre, int aAngle) + virtual void Rotate( const wxPoint& aRotCentre, int aAngle ) { - wxMessageBox(wxT("virtual BOARD_ITEM::Rotate used, should not occur"), GetClass()); + wxMessageBox( wxT( "virtual BOARD_ITEM::Rotate used, should not occur" ), GetClass() ); } /** @@ -202,9 +190,9 @@ public: * Flip this object, i.e. change the board side for this object * @param aCentre - the rotation point. */ - virtual void Flip(const wxPoint& aCentre ) + virtual void Flip( const wxPoint& aCentre ) { - wxMessageBox(wxT("virtual BOARD_ITEM::Flip used, should not occur"), GetClass()); + wxMessageBox( wxT( "virtual BOARD_ITEM::Flip used, should not occur" ), GetClass() ); } @@ -236,14 +224,14 @@ class NETCLASS; class BOARD_CONNECTED_ITEM : public BOARD_ITEM { protected: - int m_NetCode; // Net number + int m_NetCode; // Net number - int m_Subnet; /* In rastnest routines : for the current net, - * block number (number common to the current connected items found) - */ + int m_Subnet; /* In rastnest routines : for the current net, block number + * (number common to the current connected items found) + */ - int m_ZoneSubnet; // variable used in rastnest computations : for the current net, - // handle block number in zone connection + int m_ZoneSubnet; // variable used in rastnest computations : for the current net, + // handle block number in zone connection public: BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ); @@ -270,7 +258,6 @@ public: int GetZoneSubNet() const; void SetZoneSubNet( int aSubNetCode ); - /** * Function GetClearance * returns the clearance in 1/10000 inches. If \a aItem is not NULL then the @@ -292,14 +279,14 @@ public: * Function GetNetClassName * @return the Net Class name of this item */ - wxString GetNetClassName( ) const; + wxString GetNetClassName() const; }; /* * class BOARD_ITEM_LIST * Handles a collection of BOARD_ITEM elements -*/ + */ class BOARD_ITEM_LIST : public BOARD_ITEM { typedef boost::ptr_vector ITEM_ARRAY; @@ -358,29 +345,29 @@ public: return myItems.size(); } - void Append( BOARD_ITEM* aItem ) + void Append( BOARD_ITEM* aItem ) { myItems.push_back( aItem ); } - BOARD_ITEM* Replace( int aIndex, BOARD_ITEM* aItem ) + BOARD_ITEM* Replace( int aIndex, BOARD_ITEM* aItem ) { ITEM_ARRAY::auto_type ret = myItems.replace( aIndex, aItem ); return ret.release(); } - BOARD_ITEM* Remove( int aIndex ) + BOARD_ITEM* Remove( int aIndex ) { ITEM_ARRAY::auto_type ret = myItems.release( myItems.begin()+aIndex ); return ret.release(); } - void Insert( int aIndex, BOARD_ITEM* aItem ) + void Insert( int aIndex, BOARD_ITEM* aItem ) { myItems.insert( myItems.begin()+aIndex, aItem ); } - BOARD_ITEM* At( int aIndex ) const + BOARD_ITEM* At( int aIndex ) const { // we have varying sized objects and are using polymorphism, so we // must return a pointer not a reference. @@ -392,7 +379,7 @@ public: return At( aIndex ); } - void Delete( int aIndex ) + void Delete( int aIndex ) { myItems.erase( myItems.begin()+aIndex ); } @@ -406,10 +393,10 @@ public: { if( GetCount() ) return Remove( GetCount()-1 ); + return NULL; } }; #endif /* BOARD_ITEM_STRUCT_H */ - diff --git a/pcbnew/class_board_item.cpp b/pcbnew/class_board_item.cpp index 6fd1c60f8d..2899fc97a6 100644 --- a/pcbnew/class_board_item.cpp +++ b/pcbnew/class_board_item.cpp @@ -3,16 +3,9 @@ /******************************************/ #include "fctsys.h" -#include "gr_basic.h" - #include "common.h" #include "pcbnew.h" -#include "pcbnew_id.h" -#include "collectors.h" - -#include "bitmaps.h" - wxString BOARD_ITEM::ShowShape( Track_Shapes aShape ) { @@ -23,85 +16,17 @@ wxString BOARD_ITEM::ShowShape( Track_Shapes aShape ) case S_ARC: return _( "Arc" ); case S_CIRCLE: return _( "Circle" ); case S_CURVE: return _( "Bezier Curve" ); - case S_POLYGON: return wxT( "polygon" ); + case S_POLYGON: return _( "Polygon" ); default: return wxT( "??" ); } } - -/** return a specific icon pointer (an xpm icon) for "this". Used in pop up menus - * @return an icon pointer (can be NULL) - */ -const char** BOARD_ITEM::MenuIcon() const -{ - const char** xpm; - const BOARD_ITEM* item = this; - - switch( item->Type() ) - { - case TYPE_MODULE: - xpm = module_xpm; - break; - - case TYPE_PAD: - xpm = pad_xpm; - break; - - case TYPE_DRAWSEGMENT: - xpm = add_dashed_line_xpm; - break; - - case TYPE_TEXTE: - xpm = add_text_xpm; - break; - - case TYPE_TEXTE_MODULE: - xpm = footprint_text_xpm; - break; - - case TYPE_EDGE_MODULE: - xpm = show_mod_edge_xpm; - break; - - case TYPE_TRACK: - xpm = showtrack_xpm; - break; - - case TYPE_ZONE_CONTAINER: - case TYPE_ZONE: - xpm = add_zone_xpm; - break; - - case TYPE_VIA: - xpm = via_sketch_xpm; - break; - - case TYPE_MARKER_PCB: - xpm = pad_xpm; // @todo: create and use marker xpm - break; - - case TYPE_DIMENSION: - xpm = add_dimension_xpm; - break; - - case TYPE_MIRE: - xpm = add_mires_xpm; - break; - - default: - xpm = 0; - break; - } - - return (const char**) xpm; -} - - void BOARD_ITEM::UnLink() { DLIST* list = (DLIST*) GetList(); wxASSERT( list ); + if( list ) list->Remove( this ); } diff --git a/pcbnew/class_dimension.h b/pcbnew/class_dimension.h index 66d43e45d9..b90ab4878a 100644 --- a/pcbnew/class_dimension.h +++ b/pcbnew/class_dimension.h @@ -1,12 +1,14 @@ -/*****************************/ +/******************************/ /* DIMENSION class definition */ -/*****************************/ +/******************************/ + #ifndef DIMENSION_H #define DIMENSION_H #include "base_struct.h" #include "richio.h" + class DIMENSION : public BOARD_ITEM { public: @@ -39,16 +41,16 @@ public: * sets the layer this item is on. * @param aLayer The layer number. */ - void SetLayer( int aLayer ); + void SetLayer( int aLayer ); /** * Function AdjustDimensionDetails * Calculate coordinates of segments used to draw the dimension. * @param aDoNotChangeText (bool) if false, the dimension text is initialized */ - void AdjustDimensionDetails( bool aDoNotChangeText = false); + void AdjustDimensionDetails( bool aDoNotChangeText = false ); - bool ReadDimensionDescr( LINE_READER* aReader ); + bool ReadDimensionDescr( LINE_READER* aReader ); /** * Function Save @@ -58,19 +60,19 @@ public: */ bool Save( FILE* aFile ) const; - void SetText( const wxString& NewText ); + void SetText( const wxString& NewText ); wxString GetText( void ) const; - void Copy( DIMENSION* source ); + void Copy( DIMENSION* source ); - void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, - int aColorMode, const wxPoint& offset = ZeroOffset ); + void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, + int aColorMode, const wxPoint& offset = ZeroOffset ); /** * Function Move * @param offset : moving vector */ - void Move(const wxPoint& offset); + void Move(const wxPoint& offset); /** * Function Rotate @@ -78,14 +80,14 @@ public: * @param aRotCentre - the rotation point. * @param aAngle - the rotation angle in 0.1 degree. */ - virtual void Rotate(const wxPoint& aRotCentre, int aAngle); + virtual void Rotate( const wxPoint& aRotCentre, int aAngle ); /** * Function Flip * Flip this object, i.e. change the board side for this object * @param aCentre - the rotation point. */ - virtual void Flip(const wxPoint& aCentre ); + virtual void Flip( const wxPoint& aCentre ); /** * Function Mirror @@ -94,7 +96,7 @@ public: * the layer is not changed * @param axis_pos : vertical axis position */ - void Mirror(const wxPoint& axis_pos); + void Mirror( const wxPoint& axis_pos ); /** * Function DisplayInfo @@ -103,7 +105,7 @@ public: * Is virtual from EDA_ITEM. * @param frame A EDA_DRAW_FRAME in which to print status information. */ - void DisplayInfo( EDA_DRAW_FRAME* frame ); + void DisplayInfo( EDA_DRAW_FRAME* frame ); /** * Function HitTest @@ -111,7 +113,7 @@ public: * @param ref_pos A wxPoint to test * @return bool - true if a hit, else false */ - bool HitTest( const wxPoint& ref_pos ); + bool HitTest( const wxPoint& ref_pos ); /** * Function HitTest (overlaid) @@ -120,7 +122,7 @@ public: * @param refArea : the given EDA_RECT * @return bool - true if a hit, else false */ - bool HitTest( EDA_RECT& refArea ); + bool HitTest( EDA_RECT& refArea ); /** @@ -136,6 +138,8 @@ public: EDA_RECT GetBoundingBox() const; virtual wxString GetSelectMenuText() const; + + virtual const char** GetMenuImage() const { return (const char**) add_dimension_xpm; } }; #endif // #define DIMENSION_H diff --git a/pcbnew/class_drawsegment.h b/pcbnew/class_drawsegment.h index 6ad47d2070..ad0b2d2adc 100644 --- a/pcbnew/class_drawsegment.h +++ b/pcbnew/class_drawsegment.h @@ -4,9 +4,11 @@ #ifndef CLASS_DRAWSEGMENT_H #define CLASS_DRAWSEGMENT_H + #include "PolyLine.h" #include "richio.h" + class DRAWSEGMENT : public BOARD_ITEM { public: @@ -60,7 +62,7 @@ public: int GetRadius() const { double radius = hypot( (double) (m_End.x - m_Start.x), (double) (m_End.y - m_Start.y) ); - return wxRound(radius); + return wxRound( radius ); } /** @@ -166,7 +168,7 @@ public: * @param aClearanceValue = the clearance around the pad * @param aCircleToSegmentsCount = the number of segments to approximate a circle * @param aCorrectionFactor = the correction to apply to circles radius to keep - * clearance when the circle is approxiamted by segment bigger or equal + * clearance when the circle is approximated by segment bigger or equal * to the real clearance value (usually near from 1.0) */ void TransformShapeWithClearanceToPolygon( std::vector & aCornerBuffer, @@ -176,6 +178,8 @@ public: virtual wxString GetSelectMenuText() const; + virtual const char** GetMenuImage() const { return (const char**) add_dashed_line_xpm; } + #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ); diff --git a/pcbnew/class_edge_mod.h b/pcbnew/class_edge_mod.h index 96a49c7ec6..7047179e1d 100644 --- a/pcbnew/class_edge_mod.h +++ b/pcbnew/class_edge_mod.h @@ -2,6 +2,9 @@ /* class_edge_module.h : EDGE_MODULE class definition. */ /*******************************************************/ +#ifndef CLASS_DRAWSEGMENT_H +#define _CLASS_EDGE_MOD_H_ + #include "richio.h" class Pcb3D_GLCanvas; @@ -64,7 +67,7 @@ public: int GetRadius() const { double radius = hypot( (double) (m_End.x - m_Start.x), (double) (m_End.y - m_Start.y) ); - return wxRound(radius); + return wxRound( radius ); } void Copy( EDGE_MODULE* source ); // copy structure @@ -155,6 +158,8 @@ public: virtual wxString GetSelectMenuText() const; + virtual const char** GetMenuImage() const { return (const char**) show_mod_edge_xpm; } + #if defined(DEBUG) /** @@ -168,3 +173,5 @@ public: #endif }; + +#endif // _CLASS_EDGE_MOD_H_ diff --git a/pcbnew/class_marker_pcb.h b/pcbnew/class_marker_pcb.h index a20cea4e12..b2124b16f6 100644 --- a/pcbnew/class_marker_pcb.h +++ b/pcbnew/class_marker_pcb.h @@ -25,8 +25,8 @@ public: * @param bPos The position of the second of two objects */ MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos, - const wxString& aText, const wxPoint& aPos, - const wxString& bText, const wxPoint& bPos ); + const wxString& aText, const wxPoint& aPos, + const wxString& bText, const wxPoint& bPos ); /** * Constructor @@ -36,7 +36,7 @@ public: * @param aPos The position of the object */ MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos, - const wxString& aText, const wxPoint& aPos ); + const wxString& aText, const wxPoint& aPos ); ~MARKER_PCB(); @@ -56,14 +56,14 @@ public: * @param aRotCentre - the rotation point. * @param aAngle - the rotation angle in 0.1 degree. */ - virtual void Rotate(const wxPoint& aRotCentre, int aAngle); + virtual void Rotate( const wxPoint& aRotCentre, int aAngle ); /** * Function Flip * Flip this object, i.e. change the board side for this object * @param aCentre - the rotation point. */ - virtual void Flip(const wxPoint& aCentre ); + virtual void Flip( const wxPoint& aCentre ); /** * Function Draw @@ -116,6 +116,8 @@ public: } virtual wxString GetSelectMenuText() const; + + virtual const char** GetMenuImage() const { return (const char**) drc_xpm; } }; diff --git a/pcbnew/class_mire.h b/pcbnew/class_mire.h index ff972472c5..20cb7cf074 100644 --- a/pcbnew/class_mire.h +++ b/pcbnew/class_mire.h @@ -1,6 +1,7 @@ /****************************************************/ /* MIREPCB class definition. (targets for photos) */ /****************************************************/ + #ifndef MIRE_H #define MIRE_H @@ -34,7 +35,7 @@ public: * move this object. * @param aMoveVector - the move vector for this object. */ - virtual void Move(const wxPoint& aMoveVector) + virtual void Move( const wxPoint& aMoveVector ) { m_Pos += aMoveVector; } @@ -45,14 +46,14 @@ public: * @param aRotCentre - the rotation point. * @param aAngle - the rotation angle in 0.1 degree. */ - virtual void Rotate(const wxPoint& aRotCentre, int aAngle); + virtual void Rotate( const wxPoint& aRotCentre, int aAngle ); /** * Function Flip * Flip this object, i.e. change the board side for this object * @param aCentre - the rotation point. */ - virtual void Flip(const wxPoint& aCentre ); + virtual void Flip( const wxPoint& aCentre ); /** * Function Save @@ -90,6 +91,8 @@ public: EDA_RECT GetBoundingBox() const; virtual wxString GetSelectMenuText() const; + + virtual const char** GetMenuImage() const { return (const char**) add_mires_xpm; } }; diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index a515828e60..304352ff34 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -3,11 +3,16 @@ /*******************************************************/ +#ifndef _MODULE_H_ +#define _MODULE_H_ + + class Pcb3D_GLCanvas; class S3D_MASTER; #include "richio.h" + /************************************/ /* Modules (footprints) description */ /* pad are in class_pad.xx */ @@ -330,6 +335,8 @@ public: virtual wxString GetSelectMenuText() const; + virtual const char** GetMenuImage() const { return (const char**) module_xpm; } + #if defined(DEBUG) /** @@ -343,3 +350,6 @@ public: #endif }; + + +#endif // _MODULE_H_ diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index 1e4c27ee10..1b38d36185 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -2,6 +2,10 @@ /* class_pad.h : Pads description */ /**********************************/ +#ifndef _PAD_H_ +#define _PAD_H_ + + class Pcb3D_GLCanvas; #include "pad_shapes.h" @@ -13,8 +17,8 @@ class Pcb3D_GLCanvas; */ // PAD_STANDARD: -#define PAD_STANDARD_DEFAULT_LAYERS ALL_CU_LAYERS | SILKSCREEN_LAYER_FRONT | SOLDERMASK_LAYER_BACK | \ - SOLDERMASK_LAYER_FRONT +#define PAD_STANDARD_DEFAULT_LAYERS ALL_CU_LAYERS | SILKSCREEN_LAYER_FRONT | \ + SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT // PAD_CONN: #define PAD_CONN_DEFAULT_LAYERS LAYER_FRONT | SOLDERPASTE_LAYER_FRONT | SOLDERMASK_LAYER_FRONT @@ -26,13 +30,15 @@ class Pcb3D_GLCanvas; #define PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS LAYER_BACK | SILKSCREEN_LAYER_FRONT | \ SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT + // Helper class to store parameters used to draw a pad class PAD_DRAWINFO { public: EDA_DRAW_PANEL * m_DrawPanel; // the EDA_DRAW_PANEL used to draw a PAD ; can be null int m_DrawMode; // the draw mode - int m_Color; // color used to draw the pad shape , from pad layers and visible layers + int m_Color; // color used to draw the pad shape , from pad layers and + // visible layers int m_HoleColor; // color used to draw the pad hole int m_PadClearance; // clearance value, used to draw the pad area outlines wxSize m_Mask_margin; // margin, used to draw solder paste when only one layer is shown @@ -60,8 +66,8 @@ public: union { unsigned long m_NumPadName; - char m_Padname[4]; /* Pad name (4 char) or a long identifier - * (used in pad name comparisons because this is faster than string comparison) + char m_Padname[4]; /* Pad name (4 char) or a long identifier (used in pad name + * comparisons because this is faster than string comparison) */ }; @@ -72,8 +78,9 @@ public: int m_PadShape; // Shape: PAD_CIRCLE, PAD_RECT, PAD_OVAL, PAD_TRAPEZOID int m_DrillShape; // Shape PAD_CIRCLE, PAD_OVAL - wxSize m_Drill; // Drill diam (drill shape = PAD_CIRCLE) or drill size(shape = OVAL) - // for drill shape = PAD_CIRCLE, drill diam = m_Drill.x + wxSize m_Drill; // Drill diam (drill shape = PAD_CIRCLE) or drill size + // (shape = OVAL) for drill shape = PAD_CIRCLE, drill + // diam = m_Drill.x wxSize m_Offset; /* This parameter is useful only for oblong pads (it can be used for other * shapes, but without any interest). @@ -92,7 +99,8 @@ public: wxSize m_DeltaSize; // delta on rectangular shapes - wxPoint m_Pos0; // Initial Pad position (i.e. pas position relative to the module anchor, orientation 0 + wxPoint m_Pos0; // Initial Pad position (i.e. pas position relative to the + // module anchor, orientation 0 int m_ShapeMaxRadius; // radius of the circle containing the pad shape int m_Attribut; // NORMAL, PAD_SMD, PAD_CONN @@ -109,9 +117,9 @@ public: int m_LocalClearance; // Local mask margins: when NULL, the parent footprint design values are used - int m_LocalSolderMaskMargin; // Local solder mask margin - int m_LocalSolderPasteMargin; // Local solder paste margin absolute value - double m_LocalSolderPasteMarginRatio; // Local solder mask margin ratio value of pad size + int m_LocalSolderMaskMargin; // Local solder mask margin + int m_LocalSolderPasteMargin; // Local solder paste margin absolute value + double m_LocalSolderPasteMarginRatio; // Local solder mask margin ratio value of pad size // The final margin is the sum of these 2 values private: @@ -181,7 +189,9 @@ public: * to the real clearance value (usually near from 1.0) */ void TransformShapeWithClearanceToPolygon( std::vector & aCornerBuffer, - int aClearanceValue, int aCircleToSegmentsCount, double aCorrectionFactor ); + int aClearanceValue, + int aCircleToSegmentsCount, + double aCorrectionFactor ); /** * Function GetClearance @@ -256,7 +266,8 @@ public: * Build the Corner list of the polygonal shape, * depending on shape, extra size (clearance ...) and orientation * @param aCoord = a buffer to fill (4 corners). - * @param aInflateValue = wxSize: the clearance or margin value. value > 0: inflate, < 0 deflate + * @param aInflateValue = wxSize: the clearance or margin value. value > 0: + * inflate, < 0 deflate * @param aRotation = full rotation of the polygon */ void BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotation ) const; @@ -267,12 +278,13 @@ public: * Build an equivalent segment having the same shape as the OVAL shape, * Useful in draw function and in DRC and HitTest functions, * because segments are already well handled by track tests - * @param aSegStart = the starting point of the equivalent segment, relative to the shape position. + * @param aSegStart = the starting point of the equivalent segment relative to the shape + * position. * @param aSegEnd = the ending point of the equivalent segment, relative to the shape position * @param aRotation = full rotation of the segment * @return the width of the segment */ - int BuildSegmentFromOvalShape(wxPoint& aSegStart, wxPoint& aSegEnd, int aRotation) const; + int BuildSegmentFromOvalShape( wxPoint& aSegStart, wxPoint& aSegEnd, int aRotation ) const; // others void SetPadName( const wxString& name ); // Change pad name @@ -284,7 +296,6 @@ public: const wxPoint ReturnShapePos(); - /** * Function GetNet * @return int - the netcode @@ -302,7 +313,6 @@ public: */ void DisplayInfo( EDA_DRAW_FRAME* frame ); - /** * Function IsOnLayer * tests to see if this object is on the given layer. Is virtual so @@ -313,7 +323,6 @@ public: */ bool IsOnLayer( int aLayer ) const; - /** * Function HitTest * tests if the given wxPoint is within the bounds of this object. @@ -359,6 +368,8 @@ public: virtual wxString GetSelectMenuText() const; + virtual const char** GetMenuImage() const { return (const char**) pad_xpm; } + /** * Function ShowPadShape * @return the name of the shape @@ -386,3 +397,10 @@ public: }; typedef class D_PAD* LISTE_PAD; + + +/* LocalWords: eeschema vout + */ + + +#endif // _PAD_H_ diff --git a/pcbnew/class_pcb_text.h b/pcbnew/class_pcb_text.h index 0ffad3ac0b..2630b587f9 100644 --- a/pcbnew/class_pcb_text.h +++ b/pcbnew/class_pcb_text.h @@ -1,6 +1,7 @@ /********************************/ /* TEXTE_PCB class definition. */ /********************************/ + #ifndef CLASS_PCB_TEXT_H #define CLASS_PCB_TEXT_H @@ -8,6 +9,7 @@ #include "PolyLine.h" #include "richio.h" + class TEXTE_PCB : public BOARD_ITEM, public EDA_TEXT { public: @@ -19,7 +21,7 @@ public: * Function GetPosition * returns the position of this object. * @return wxPoint& - The position of this object, non-const so it - * can be changed + * can be changed */ wxPoint& GetPosition() { @@ -31,7 +33,7 @@ public: * move this object. * @param aMoveVector - the move vector for this object. */ - virtual void Move(const wxPoint& aMoveVector) + virtual void Move( const wxPoint& aMoveVector ) { m_Pos += aMoveVector; } @@ -42,14 +44,14 @@ public: * @param aRotCentre - the rotation point. * @param aAngle - the rotation angle in 0.1 degree. */ - virtual void Rotate(const wxPoint& aRotCentre, int aAngle); + virtual void Rotate( const wxPoint& aRotCentre, int aAngle ); /** * Function Flip * Flip this object, i.e. change the board side for this object * @param aCentre - the rotation point. */ - virtual void Flip(const wxPoint& aCentre ); + virtual void Flip( const wxPoint& aCentre ); /* duplicate structure */ void Copy( TEXTE_PCB* source ); @@ -131,6 +133,8 @@ public: virtual wxString GetSelectMenuText() const; + virtual const char** GetMenuImage() const { return (const char**) add_text_xpm; } + #if defined(DEBUG) /** * Function Show diff --git a/pcbnew/class_text_mod.h b/pcbnew/class_text_mod.h index 114e93a086..d5cfc11495 100644 --- a/pcbnew/class_text_mod.h +++ b/pcbnew/class_text_mod.h @@ -14,6 +14,7 @@ #define UMBILICAL_COLOR LIGHTBLUE + class TEXTE_MODULE : public BOARD_ITEM, public EDA_TEXT { /* Note: orientation in 1/10 deg relative to the footprint @@ -21,7 +22,7 @@ class TEXTE_MODULE : public BOARD_ITEM, public EDA_TEXT */ public: wxPoint m_Pos0; // text coordinates relatives to the footprint - // ancre, orient 0 + // anchor, orient 0 // Text coordinate ref point is the text centre char m_Type; // 0: ref,1: val, others = 2..255 bool m_NoShow; // true = invisible @@ -46,8 +47,6 @@ public: TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS ); void Copy( TEXTE_MODULE* source ); // copy structure - /* Gestion du texte */ - int GetLength() const; /* text length */ int GetDrawRotation() const; // Return text rotation for drawings and plotting @@ -161,6 +160,8 @@ public: TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS ); virtual wxString GetSelectMenuText() const; + virtual const char** GetMenuImage() const { return (const char**) footprint_text_xpm; } + #if defined(DEBUG) /** diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index 2e13f5935a..c36cb08ef5 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -12,7 +12,8 @@ // Via attributes (m_Shape parameter) #define VIA_THROUGH 3 /* Always a through hole via */ #define VIA_BLIND_BURIED 2 /* this via can be on internal layers */ -#define VIA_MICROVIA 1 /* this via which connect from an external layer to the near neighbor internal layer */ +#define VIA_MICROVIA 1 /* this via which connect from an external layer + * to the near neighbor internal layer */ #define VIA_NOT_DEFINED 0 /* not yet used */ /***/ @@ -65,7 +66,7 @@ public: * move this object. * @param aMoveVector - the move vector for this object. */ - virtual void Move(const wxPoint& aMoveVector) + virtual void Move( const wxPoint& aMoveVector ) { m_Start += aMoveVector; m_End += aMoveVector; @@ -77,14 +78,14 @@ public: * @param aRotCentre - the rotation point. * @param aAngle - the rotation angle in 0.1 degree. */ - virtual void Rotate(const wxPoint& aRotCentre, int aAngle); + virtual void Rotate( const wxPoint& aRotCentre, int aAngle ); /** * Function Flip * Flip this object, i.e. change the board side for this object * @param aCentre - the rotation point. */ - virtual void Flip(const wxPoint& aCentre ); + virtual void Flip( const wxPoint& aCentre ); /** * Function GetPosition @@ -168,19 +169,19 @@ public: * Set the drill value for vias * @param drill_value = new drill value */ - void SetDrillValue(int drill_value) { m_Drill = drill_value; } + void SetDrillValue( int drill_value ) { m_Drill = drill_value; } /** * Function SetDrillDefault * Set the drill value for vias at default value (-1) */ - void SetDrillDefault(void) { m_Drill = -1; } + void SetDrillDefault( void ) { m_Drill = -1; } /** * Function IsDrillDefault * @return true if the drill value is default value (-1) */ - bool IsDrillDefault(void) { return m_Drill <= 0; } + bool IsDrillDefault( void ) { return m_Drill <= 0; } /** * Function GetDrillValue @@ -287,6 +288,8 @@ public: virtual wxString GetSelectMenuText() const; + virtual const char** GetMenuImage() const { return (const char**) showtrack_xpm; } + #if defined (DEBUG) /** @@ -330,6 +333,7 @@ public: virtual wxString GetSelectMenuText() const; + virtual const char** GetMenuImage() const { return (const char**) add_zone_xpm; } }; @@ -386,6 +390,8 @@ public: virtual wxString GetSelectMenuText() const; + virtual const char** GetMenuImage() const { return (const char**) via_sketch_xpm; } + #if defined (DEBUG) /** diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index c23cac5830..d2d234d6f5 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -11,6 +11,7 @@ #include "richio.h" #include "class_zone_setting.h" + /* a small class used when filling areas with segments */ class SEGMENT { @@ -26,6 +27,7 @@ public: } }; + /************************/ /* class ZONE_CONTAINER */ /************************/ @@ -427,6 +429,7 @@ public: virtual wxString GetSelectMenuText() const; + virtual const char** GetMenuImage() const { return (const char**) add_zone_xpm; } }; diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index b478ee4127..48424243b2 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -1,8 +1,6 @@ -/********************************************************/ -/* Routines generales de gestion des commandes usuelles */ -/********************************************************/ - +/****************/ /* controle.cpp */ +/****************/ #include "fctsys.h" #include "common.h" @@ -14,7 +12,7 @@ #include "collectors.h" -//external funtions used here: +//external functions used here: extern bool Magnetize( BOARD* m_Pcb, PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize grid, wxPoint on_grid, wxPoint* curpos ); @@ -165,7 +163,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode ) item = (*m_Collector)[0]; SetCurItem( item ); } - // if all are modules, find the smallest one amoung the primary choices + // if all are modules, find the smallest one among the primary choices else if( ( item = AllAreModulesAndReturnSmallestIfSo( m_Collector ) ) != NULL ) { SetCurItem( item ); @@ -198,7 +196,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode ) item = (*m_Collector)[i]; text = item->GetSelectMenuText(); - xpm = item->MenuIcon(); + xpm = item->GetMenuImage(); ADD_MENUITEM( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + i, text, xpm ); } @@ -270,25 +268,25 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH switch( aHotKey ) { - case WXK_NUMPAD8: /* Deplacement curseur vers le haut */ + case WXK_NUMPAD8: case WXK_UP: pos.y -= wxRound( gridSize.y ); DrawPanel->MoveCursor( pos ); break; - case WXK_NUMPAD2: /* Deplacement curseur vers le bas */ + case WXK_NUMPAD2: case WXK_DOWN: pos.y += wxRound( gridSize.y ); DrawPanel->MoveCursor( pos ); break; - case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */ + case WXK_NUMPAD4: case WXK_LEFT: pos.x -= wxRound( gridSize.x ); DrawPanel->MoveCursor( pos ); break; - case WXK_NUMPAD6: /* Deplacement curseur vers la droite */ + case WXK_NUMPAD6: case WXK_RIGHT: pos.x += wxRound( gridSize.x ); DrawPanel->MoveCursor( pos ); diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index 396e73fa36..3e171164e0 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -100,7 +100,7 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode ) item = (*m_Collector)[ii]; text = item->GetSelectMenuText(); - xpm = item->MenuIcon(); + xpm = item->GetMenuImage(); ADD_MENUITEM( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + ii,