Commit f60c9823 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Refactor PCBNew selection clarification menu icon code.

* Move clarification menu icon code from base board item object to the appropriate
  object.
* Remove left over French comments.
* Coding policy fixes.
parent 81ddf0bb
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
enum Track_Shapes { enum Track_Shapes {
S_SEGMENT = 0, /* usual segment : line with rounded ends */ S_SEGMENT = 0, /* usual segment : line with rounded ends */
S_RECT, /* segment with non rounded ends */ S_RECT, /* segment with non rounded ends */
S_ARC, /* Arcs (with rounded ends)*/ S_ARC, /* Arcs (with rounded ends) */
S_CIRCLE, /* ring*/ S_CIRCLE, /* ring */
S_POLYGON, /* polygonal shape (not yet used for tracks, but could be in microwave apps) */ S_POLYGON, /* polygon (not yet used for tracks, but could be in microwave apps) */
S_CURVE, /* Bezier Curve*/ S_CURVE, /* Bezier Curve */
S_LAST /* last value for this list */ S_LAST /* last value for this list */
}; };
...@@ -69,8 +69,7 @@ public: ...@@ -69,8 +69,7 @@ public:
/** /**
* Function GetPosition * Function GetPosition
* returns the position of this object. * returns the position of this object.
* @return wxPoint& - The position of this object, non-const so it * @return wxPoint& - The position of this object, non-const so it can be changed
* can be changed
*/ */
virtual wxPoint& GetPosition() = 0; virtual wxPoint& GetPosition() = 0;
...@@ -85,7 +84,7 @@ public: ...@@ -85,7 +84,7 @@ public:
* sets the layer this item is on. * sets the layer this item is on.
* @param aLayer The layer number. * @param aLayer The layer number.
* is virtual because some items (in fact: class DIMENSION) * 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: ...@@ -117,9 +116,9 @@ public:
* form of testing. * form of testing.
* @return bool - true if a track or via, else false. * @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: ...@@ -139,7 +138,6 @@ public:
*/ */
virtual void UnLink(); virtual void UnLink();
/** /**
* Function DeleteStructure * Function DeleteStructure
* deletes this object after UnLink()ing it from its owner. * deletes this object after UnLink()ing it from its owner.
...@@ -151,22 +149,12 @@ public: ...@@ -151,22 +149,12 @@ 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 * Function ShowShape
* converts the enum Track_Shapes integer value to a wxString. * converts the enum Track_Shapes integer value to a wxString.
*/ */
static wxString ShowShape( Track_Shapes aShape ); static wxString ShowShape( Track_Shapes aShape );
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.brd" format. * writes the data structures for this object out to a FILE in "*.brd" format.
...@@ -175,15 +163,15 @@ public: ...@@ -175,15 +163,15 @@ public:
*/ */
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 * Function Move
* move this object. * move this object.
* @param aMoveVector - the move vector for 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: ...@@ -192,9 +180,9 @@ public:
* @param aRotCentre - the rotation point. * @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree. * @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: ...@@ -202,9 +190,9 @@ public:
* Flip this object, i.e. change the board side for this object * Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point. * @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() );
} }
...@@ -238,8 +226,8 @@ class BOARD_CONNECTED_ITEM : public BOARD_ITEM ...@@ -238,8 +226,8 @@ class BOARD_CONNECTED_ITEM : public BOARD_ITEM
protected: protected:
int m_NetCode; // Net number int m_NetCode; // Net number
int m_Subnet; /* In rastnest routines : for the current net, int m_Subnet; /* In rastnest routines : for the current net, block number
* block number (number common to the current connected items found) * (number common to the current connected items found)
*/ */
int m_ZoneSubnet; // variable used in rastnest computations : for the current net, int m_ZoneSubnet; // variable used in rastnest computations : for the current net,
...@@ -270,7 +258,6 @@ public: ...@@ -270,7 +258,6 @@ public:
int GetZoneSubNet() const; int GetZoneSubNet() const;
void SetZoneSubNet( int aSubNetCode ); void SetZoneSubNet( int aSubNetCode );
/** /**
* Function GetClearance * Function GetClearance
* returns the clearance in 1/10000 inches. If \a aItem is not NULL then the * returns the clearance in 1/10000 inches. If \a aItem is not NULL then the
...@@ -292,14 +279,14 @@ public: ...@@ -292,14 +279,14 @@ public:
* Function GetNetClassName * Function GetNetClassName
* @return the Net Class name of this item * @return the Net Class name of this item
*/ */
wxString GetNetClassName( ) const; wxString GetNetClassName() const;
}; };
/* /*
* class BOARD_ITEM_LIST * class BOARD_ITEM_LIST
* Handles a collection of BOARD_ITEM elements * Handles a collection of BOARD_ITEM elements
*/ */
class BOARD_ITEM_LIST : public BOARD_ITEM class BOARD_ITEM_LIST : public BOARD_ITEM
{ {
typedef boost::ptr_vector<BOARD_ITEM> ITEM_ARRAY; typedef boost::ptr_vector<BOARD_ITEM> ITEM_ARRAY;
...@@ -406,10 +393,10 @@ public: ...@@ -406,10 +393,10 @@ public:
{ {
if( GetCount() ) if( GetCount() )
return Remove( GetCount()-1 ); return Remove( GetCount()-1 );
return NULL; return NULL;
} }
}; };
#endif /* BOARD_ITEM_STRUCT_H */ #endif /* BOARD_ITEM_STRUCT_H */
...@@ -3,16 +3,9 @@ ...@@ -3,16 +3,9 @@
/******************************************/ /******************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "pcbnew_id.h"
#include "collectors.h"
#include "bitmaps.h"
wxString BOARD_ITEM::ShowShape( Track_Shapes aShape ) wxString BOARD_ITEM::ShowShape( Track_Shapes aShape )
{ {
...@@ -23,85 +16,17 @@ 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_ARC: return _( "Arc" );
case S_CIRCLE: return _( "Circle" ); case S_CIRCLE: return _( "Circle" );
case S_CURVE: return _( "Bezier Curve" ); case S_CURVE: return _( "Bezier Curve" );
case S_POLYGON: return wxT( "polygon" ); case S_POLYGON: return _( "Polygon" );
default: return wxT( "??" ); 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() void BOARD_ITEM::UnLink()
{ {
DLIST<BOARD_ITEM>* list = (DLIST<BOARD_ITEM>*) GetList(); DLIST<BOARD_ITEM>* list = (DLIST<BOARD_ITEM>*) GetList();
wxASSERT( list ); wxASSERT( list );
if( list ) if( list )
list->Remove( this ); list->Remove( this );
} }
......
/*****************************/ /******************************/
/* DIMENSION class definition */ /* DIMENSION class definition */
/*****************************/ /******************************/
#ifndef DIMENSION_H #ifndef DIMENSION_H
#define DIMENSION_H #define DIMENSION_H
#include "base_struct.h" #include "base_struct.h"
#include "richio.h" #include "richio.h"
class DIMENSION : public BOARD_ITEM class DIMENSION : public BOARD_ITEM
{ {
public: public:
...@@ -46,7 +48,7 @@ public: ...@@ -46,7 +48,7 @@ public:
* Calculate coordinates of segments used to draw the dimension. * Calculate coordinates of segments used to draw the dimension.
* @param aDoNotChangeText (bool) if false, the dimension text is initialized * @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 );
...@@ -78,14 +80,14 @@ public: ...@@ -78,14 +80,14 @@ public:
* @param aRotCentre - the rotation point. * @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree. * @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 * Function Flip
* Flip this object, i.e. change the board side for this object * Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point. * @param aCentre - the rotation point.
*/ */
virtual void Flip(const wxPoint& aCentre ); virtual void Flip( const wxPoint& aCentre );
/** /**
* Function Mirror * Function Mirror
...@@ -94,7 +96,7 @@ public: ...@@ -94,7 +96,7 @@ public:
* the layer is not changed * the layer is not changed
* @param axis_pos : vertical axis position * @param axis_pos : vertical axis position
*/ */
void Mirror(const wxPoint& axis_pos); void Mirror( const wxPoint& axis_pos );
/** /**
* Function DisplayInfo * Function DisplayInfo
...@@ -136,6 +138,8 @@ public: ...@@ -136,6 +138,8 @@ public:
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
virtual const char** GetMenuImage() const { return (const char**) add_dimension_xpm; }
}; };
#endif // #define DIMENSION_H #endif // #define DIMENSION_H
...@@ -4,9 +4,11 @@ ...@@ -4,9 +4,11 @@
#ifndef CLASS_DRAWSEGMENT_H #ifndef CLASS_DRAWSEGMENT_H
#define CLASS_DRAWSEGMENT_H #define CLASS_DRAWSEGMENT_H
#include "PolyLine.h" #include "PolyLine.h"
#include "richio.h" #include "richio.h"
class DRAWSEGMENT : public BOARD_ITEM class DRAWSEGMENT : public BOARD_ITEM
{ {
public: public:
...@@ -60,7 +62,7 @@ public: ...@@ -60,7 +62,7 @@ public:
int GetRadius() const int GetRadius() const
{ {
double radius = hypot( (double) (m_End.x - m_Start.x), (double) (m_End.y - m_Start.y) ); 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: ...@@ -166,7 +168,7 @@ public:
* @param aClearanceValue = the clearance around the pad * @param aClearanceValue = the clearance around the pad
* @param aCircleToSegmentsCount = the number of segments to approximate a circle * @param aCircleToSegmentsCount = the number of segments to approximate a circle
* @param aCorrectionFactor = the correction to apply to circles radius to keep * @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) * to the real clearance value (usually near from 1.0)
*/ */
void TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer, void TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer,
...@@ -176,6 +178,8 @@ public: ...@@ -176,6 +178,8 @@ public:
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
virtual const char** GetMenuImage() const { return (const char**) add_dashed_line_xpm; }
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ); void Show( int nestLevel, std::ostream& os );
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
/* class_edge_module.h : EDGE_MODULE class definition. */ /* class_edge_module.h : EDGE_MODULE class definition. */
/*******************************************************/ /*******************************************************/
#ifndef CLASS_DRAWSEGMENT_H
#define _CLASS_EDGE_MOD_H_
#include "richio.h" #include "richio.h"
class Pcb3D_GLCanvas; class Pcb3D_GLCanvas;
...@@ -64,7 +67,7 @@ public: ...@@ -64,7 +67,7 @@ public:
int GetRadius() const int GetRadius() const
{ {
double radius = hypot( (double) (m_End.x - m_Start.x), (double) (m_End.y - m_Start.y) ); 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 void Copy( EDGE_MODULE* source ); // copy structure
...@@ -155,6 +158,8 @@ public: ...@@ -155,6 +158,8 @@ public:
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
virtual const char** GetMenuImage() const { return (const char**) show_mod_edge_xpm; }
#if defined(DEBUG) #if defined(DEBUG)
/** /**
...@@ -168,3 +173,5 @@ public: ...@@ -168,3 +173,5 @@ public:
#endif #endif
}; };
#endif // _CLASS_EDGE_MOD_H_
...@@ -56,14 +56,14 @@ public: ...@@ -56,14 +56,14 @@ public:
* @param aRotCentre - the rotation point. * @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree. * @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 * Function Flip
* Flip this object, i.e. change the board side for this object * Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point. * @param aCentre - the rotation point.
*/ */
virtual void Flip(const wxPoint& aCentre ); virtual void Flip( const wxPoint& aCentre );
/** /**
* Function Draw * Function Draw
...@@ -116,6 +116,8 @@ public: ...@@ -116,6 +116,8 @@ public:
} }
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
virtual const char** GetMenuImage() const { return (const char**) drc_xpm; }
}; };
......
/****************************************************/ /****************************************************/
/* MIREPCB class definition. (targets for photos) */ /* MIREPCB class definition. (targets for photos) */
/****************************************************/ /****************************************************/
#ifndef MIRE_H #ifndef MIRE_H
#define MIRE_H #define MIRE_H
...@@ -34,7 +35,7 @@ public: ...@@ -34,7 +35,7 @@ public:
* move this object. * move this object.
* @param aMoveVector - the move vector for 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; m_Pos += aMoveVector;
} }
...@@ -45,14 +46,14 @@ public: ...@@ -45,14 +46,14 @@ public:
* @param aRotCentre - the rotation point. * @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree. * @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 * Function Flip
* Flip this object, i.e. change the board side for this object * Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point. * @param aCentre - the rotation point.
*/ */
virtual void Flip(const wxPoint& aCentre ); virtual void Flip( const wxPoint& aCentre );
/** /**
* Function Save * Function Save
...@@ -90,6 +91,8 @@ public: ...@@ -90,6 +91,8 @@ public:
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
virtual const char** GetMenuImage() const { return (const char**) add_mires_xpm; }
}; };
......
...@@ -3,11 +3,16 @@ ...@@ -3,11 +3,16 @@
/*******************************************************/ /*******************************************************/
#ifndef _MODULE_H_
#define _MODULE_H_
class Pcb3D_GLCanvas; class Pcb3D_GLCanvas;
class S3D_MASTER; class S3D_MASTER;
#include "richio.h" #include "richio.h"
/************************************/ /************************************/
/* Modules (footprints) description */ /* Modules (footprints) description */
/* pad are in class_pad.xx */ /* pad are in class_pad.xx */
...@@ -330,6 +335,8 @@ public: ...@@ -330,6 +335,8 @@ public:
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
virtual const char** GetMenuImage() const { return (const char**) module_xpm; }
#if defined(DEBUG) #if defined(DEBUG)
/** /**
...@@ -343,3 +350,6 @@ public: ...@@ -343,3 +350,6 @@ public:
#endif #endif
}; };
#endif // _MODULE_H_
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
/* class_pad.h : Pads description */ /* class_pad.h : Pads description */
/**********************************/ /**********************************/
#ifndef _PAD_H_
#define _PAD_H_
class Pcb3D_GLCanvas; class Pcb3D_GLCanvas;
#include "pad_shapes.h" #include "pad_shapes.h"
...@@ -13,8 +17,8 @@ class Pcb3D_GLCanvas; ...@@ -13,8 +17,8 @@ class Pcb3D_GLCanvas;
*/ */
// PAD_STANDARD: // PAD_STANDARD:
#define PAD_STANDARD_DEFAULT_LAYERS ALL_CU_LAYERS | SILKSCREEN_LAYER_FRONT | SOLDERMASK_LAYER_BACK | \ #define PAD_STANDARD_DEFAULT_LAYERS ALL_CU_LAYERS | SILKSCREEN_LAYER_FRONT | \
SOLDERMASK_LAYER_FRONT SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT
// PAD_CONN: // PAD_CONN:
#define PAD_CONN_DEFAULT_LAYERS LAYER_FRONT | SOLDERPASTE_LAYER_FRONT | SOLDERMASK_LAYER_FRONT #define PAD_CONN_DEFAULT_LAYERS LAYER_FRONT | SOLDERPASTE_LAYER_FRONT | SOLDERMASK_LAYER_FRONT
...@@ -26,13 +30,15 @@ class Pcb3D_GLCanvas; ...@@ -26,13 +30,15 @@ class Pcb3D_GLCanvas;
#define PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS LAYER_BACK | SILKSCREEN_LAYER_FRONT | \ #define PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS LAYER_BACK | SILKSCREEN_LAYER_FRONT | \
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT
// Helper class to store parameters used to draw a pad // Helper class to store parameters used to draw a pad
class PAD_DRAWINFO class PAD_DRAWINFO
{ {
public: public:
EDA_DRAW_PANEL * m_DrawPanel; // the EDA_DRAW_PANEL used to draw a PAD ; can be null 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_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_HoleColor; // color used to draw the pad hole
int m_PadClearance; // clearance value, used to draw the pad area outlines 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 wxSize m_Mask_margin; // margin, used to draw solder paste when only one layer is shown
...@@ -60,8 +66,8 @@ public: ...@@ -60,8 +66,8 @@ public:
union union
{ {
unsigned long m_NumPadName; unsigned long m_NumPadName;
char m_Padname[4]; /* Pad name (4 char) or a long identifier char m_Padname[4]; /* Pad name (4 char) or a long identifier (used in pad name
* (used in pad name comparisons because this is faster than string comparison) * comparisons because this is faster than string comparison)
*/ */
}; };
...@@ -72,8 +78,9 @@ public: ...@@ -72,8 +78,9 @@ public:
int m_PadShape; // Shape: PAD_CIRCLE, PAD_RECT, PAD_OVAL, PAD_TRAPEZOID int m_PadShape; // Shape: PAD_CIRCLE, PAD_RECT, PAD_OVAL, PAD_TRAPEZOID
int m_DrillShape; // Shape PAD_CIRCLE, PAD_OVAL int m_DrillShape; // Shape PAD_CIRCLE, PAD_OVAL
wxSize m_Drill; // Drill diam (drill shape = PAD_CIRCLE) or drill size(shape = OVAL) wxSize m_Drill; // Drill diam (drill shape = PAD_CIRCLE) or drill size
// for drill shape = PAD_CIRCLE, drill diam = m_Drill.x // (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 wxSize m_Offset; /* This parameter is useful only for oblong pads (it can be used for other
* shapes, but without any interest). * shapes, but without any interest).
...@@ -92,7 +99,8 @@ public: ...@@ -92,7 +99,8 @@ public:
wxSize m_DeltaSize; // delta on rectangular shapes 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_ShapeMaxRadius; // radius of the circle containing the pad shape
int m_Attribut; // NORMAL, PAD_SMD, PAD_CONN int m_Attribut; // NORMAL, PAD_SMD, PAD_CONN
...@@ -181,7 +189,9 @@ public: ...@@ -181,7 +189,9 @@ public:
* to the real clearance value (usually near from 1.0) * to the real clearance value (usually near from 1.0)
*/ */
void TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer, void TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer,
int aClearanceValue, int aCircleToSegmentsCount, double aCorrectionFactor ); int aClearanceValue,
int aCircleToSegmentsCount,
double aCorrectionFactor );
/** /**
* Function GetClearance * Function GetClearance
...@@ -256,7 +266,8 @@ public: ...@@ -256,7 +266,8 @@ public:
* Build the Corner list of the polygonal shape, * Build the Corner list of the polygonal shape,
* depending on shape, extra size (clearance ...) and orientation * depending on shape, extra size (clearance ...) and orientation
* @param aCoord = a buffer to fill (4 corners). * @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 * @param aRotation = full rotation of the polygon
*/ */
void BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotation ) const; void BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotation ) const;
...@@ -267,12 +278,13 @@ public: ...@@ -267,12 +278,13 @@ public:
* Build an equivalent segment having the same shape as the OVAL shape, * Build an equivalent segment having the same shape as the OVAL shape,
* Useful in draw function and in DRC and HitTest functions, * Useful in draw function and in DRC and HitTest functions,
* because segments are already well handled by track tests * 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 aSegEnd = the ending point of the equivalent segment, relative to the shape position
* @param aRotation = full rotation of the segment * @param aRotation = full rotation of the segment
* @return the width 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 // others
void SetPadName( const wxString& name ); // Change pad name void SetPadName( const wxString& name ); // Change pad name
...@@ -284,7 +296,6 @@ public: ...@@ -284,7 +296,6 @@ public:
const wxPoint ReturnShapePos(); const wxPoint ReturnShapePos();
/** /**
* Function GetNet * Function GetNet
* @return int - the netcode * @return int - the netcode
...@@ -302,7 +313,6 @@ public: ...@@ -302,7 +313,6 @@ public:
*/ */
void DisplayInfo( EDA_DRAW_FRAME* frame ); void DisplayInfo( EDA_DRAW_FRAME* frame );
/** /**
* Function IsOnLayer * Function IsOnLayer
* tests to see if this object is on the given layer. Is virtual so * tests to see if this object is on the given layer. Is virtual so
...@@ -313,7 +323,6 @@ public: ...@@ -313,7 +323,6 @@ public:
*/ */
bool IsOnLayer( int aLayer ) const; bool IsOnLayer( int aLayer ) const;
/** /**
* Function HitTest * Function HitTest
* tests if the given wxPoint is within the bounds of this object. * tests if the given wxPoint is within the bounds of this object.
...@@ -359,6 +368,8 @@ public: ...@@ -359,6 +368,8 @@ public:
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
virtual const char** GetMenuImage() const { return (const char**) pad_xpm; }
/** /**
* Function ShowPadShape * Function ShowPadShape
* @return the name of the shape * @return the name of the shape
...@@ -386,3 +397,10 @@ public: ...@@ -386,3 +397,10 @@ public:
}; };
typedef class D_PAD* LISTE_PAD; typedef class D_PAD* LISTE_PAD;
/* LocalWords: eeschema vout
*/
#endif // _PAD_H_
/********************************/ /********************************/
/* TEXTE_PCB class definition. */ /* TEXTE_PCB class definition. */
/********************************/ /********************************/
#ifndef CLASS_PCB_TEXT_H #ifndef CLASS_PCB_TEXT_H
#define CLASS_PCB_TEXT_H #define CLASS_PCB_TEXT_H
...@@ -8,6 +9,7 @@ ...@@ -8,6 +9,7 @@
#include "PolyLine.h" #include "PolyLine.h"
#include "richio.h" #include "richio.h"
class TEXTE_PCB : public BOARD_ITEM, public EDA_TEXT class TEXTE_PCB : public BOARD_ITEM, public EDA_TEXT
{ {
public: public:
...@@ -31,7 +33,7 @@ public: ...@@ -31,7 +33,7 @@ public:
* move this object. * move this object.
* @param aMoveVector - the move vector for 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; m_Pos += aMoveVector;
} }
...@@ -42,14 +44,14 @@ public: ...@@ -42,14 +44,14 @@ public:
* @param aRotCentre - the rotation point. * @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree. * @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 * Function Flip
* Flip this object, i.e. change the board side for this object * Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point. * @param aCentre - the rotation point.
*/ */
virtual void Flip(const wxPoint& aCentre ); virtual void Flip( const wxPoint& aCentre );
/* duplicate structure */ /* duplicate structure */
void Copy( TEXTE_PCB* source ); void Copy( TEXTE_PCB* source );
...@@ -131,6 +133,8 @@ public: ...@@ -131,6 +133,8 @@ public:
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
virtual const char** GetMenuImage() const { return (const char**) add_text_xpm; }
#if defined(DEBUG) #if defined(DEBUG)
/** /**
* Function Show * Function Show
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#define UMBILICAL_COLOR LIGHTBLUE #define UMBILICAL_COLOR LIGHTBLUE
class TEXTE_MODULE : public BOARD_ITEM, public EDA_TEXT class TEXTE_MODULE : public BOARD_ITEM, public EDA_TEXT
{ {
/* Note: orientation in 1/10 deg relative to the footprint /* Note: orientation in 1/10 deg relative to the footprint
...@@ -21,7 +22,7 @@ class TEXTE_MODULE : public BOARD_ITEM, public EDA_TEXT ...@@ -21,7 +22,7 @@ class TEXTE_MODULE : public BOARD_ITEM, public EDA_TEXT
*/ */
public: public:
wxPoint m_Pos0; // text coordinates relatives to the footprint wxPoint m_Pos0; // text coordinates relatives to the footprint
// ancre, orient 0 // anchor, orient 0
// Text coordinate ref point is the text centre // Text coordinate ref point is the text centre
char m_Type; // 0: ref,1: val, others = 2..255 char m_Type; // 0: ref,1: val, others = 2..255
bool m_NoShow; // true = invisible bool m_NoShow; // true = invisible
...@@ -46,8 +47,6 @@ public: TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS ); ...@@ -46,8 +47,6 @@ public: TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS );
void Copy( TEXTE_MODULE* source ); // copy structure void Copy( TEXTE_MODULE* source ); // copy structure
/* Gestion du texte */
int GetLength() const; /* text length */ int GetLength() const; /* text length */
int GetDrawRotation() const; // Return text rotation for drawings and plotting 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 ); ...@@ -161,6 +160,8 @@ public: TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS );
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
virtual const char** GetMenuImage() const { return (const char**) footprint_text_xpm; }
#if defined(DEBUG) #if defined(DEBUG)
/** /**
......
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
// Via attributes (m_Shape parameter) // Via attributes (m_Shape parameter)
#define VIA_THROUGH 3 /* Always a through hole via */ #define VIA_THROUGH 3 /* Always a through hole via */
#define VIA_BLIND_BURIED 2 /* this via can be on internal layers */ #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 */ #define VIA_NOT_DEFINED 0 /* not yet used */
/***/ /***/
...@@ -65,7 +66,7 @@ public: ...@@ -65,7 +66,7 @@ public:
* move this object. * move this object.
* @param aMoveVector - the move vector for 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_Start += aMoveVector;
m_End += aMoveVector; m_End += aMoveVector;
...@@ -77,14 +78,14 @@ public: ...@@ -77,14 +78,14 @@ public:
* @param aRotCentre - the rotation point. * @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree. * @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 * Function Flip
* Flip this object, i.e. change the board side for this object * Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point. * @param aCentre - the rotation point.
*/ */
virtual void Flip(const wxPoint& aCentre ); virtual void Flip( const wxPoint& aCentre );
/** /**
* Function GetPosition * Function GetPosition
...@@ -168,19 +169,19 @@ public: ...@@ -168,19 +169,19 @@ public:
* Set the drill value for vias * Set the drill value for vias
* @param drill_value = new drill value * @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 * Function SetDrillDefault
* Set the drill value for vias at default value (-1) * Set the drill value for vias at default value (-1)
*/ */
void SetDrillDefault(void) { m_Drill = -1; } void SetDrillDefault( void ) { m_Drill = -1; }
/** /**
* Function IsDrillDefault * Function IsDrillDefault
* @return true if the drill value is default value (-1) * @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 * Function GetDrillValue
...@@ -287,6 +288,8 @@ public: ...@@ -287,6 +288,8 @@ public:
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
virtual const char** GetMenuImage() const { return (const char**) showtrack_xpm; }
#if defined (DEBUG) #if defined (DEBUG)
/** /**
...@@ -330,6 +333,7 @@ public: ...@@ -330,6 +333,7 @@ public:
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
virtual const char** GetMenuImage() const { return (const char**) add_zone_xpm; }
}; };
...@@ -386,6 +390,8 @@ public: ...@@ -386,6 +390,8 @@ public:
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
virtual const char** GetMenuImage() const { return (const char**) via_sketch_xpm; }
#if defined (DEBUG) #if defined (DEBUG)
/** /**
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "richio.h" #include "richio.h"
#include "class_zone_setting.h" #include "class_zone_setting.h"
/* a small class used when filling areas with segments */ /* a small class used when filling areas with segments */
class SEGMENT class SEGMENT
{ {
...@@ -26,6 +27,7 @@ public: ...@@ -26,6 +27,7 @@ public:
} }
}; };
/************************/ /************************/
/* class ZONE_CONTAINER */ /* class ZONE_CONTAINER */
/************************/ /************************/
...@@ -427,6 +429,7 @@ public: ...@@ -427,6 +429,7 @@ public:
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
virtual const char** GetMenuImage() const { return (const char**) add_zone_xpm; }
}; };
......
/********************************************************/ /****************/
/* Routines generales de gestion des commandes usuelles */
/********************************************************/
/* controle.cpp */ /* controle.cpp */
/****************/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
...@@ -14,7 +12,7 @@ ...@@ -14,7 +12,7 @@
#include "collectors.h" #include "collectors.h"
//external funtions used here: //external functions used here:
extern bool Magnetize( BOARD* m_Pcb, PCB_EDIT_FRAME* frame, extern bool Magnetize( BOARD* m_Pcb, PCB_EDIT_FRAME* frame,
int aCurrentTool, wxSize grid, wxPoint on_grid, wxPoint* curpos ); int aCurrentTool, wxSize grid, wxPoint on_grid, wxPoint* curpos );
...@@ -165,7 +163,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode ) ...@@ -165,7 +163,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
item = (*m_Collector)[0]; item = (*m_Collector)[0];
SetCurItem( item ); 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 ) else if( ( item = AllAreModulesAndReturnSmallestIfSo( m_Collector ) ) != NULL )
{ {
SetCurItem( item ); SetCurItem( item );
...@@ -198,7 +196,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode ) ...@@ -198,7 +196,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
item = (*m_Collector)[i]; item = (*m_Collector)[i];
text = item->GetSelectMenuText(); text = item->GetSelectMenuText();
xpm = item->MenuIcon(); xpm = item->GetMenuImage();
ADD_MENUITEM( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + i, text, xpm ); 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 ...@@ -270,25 +268,25 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
switch( aHotKey ) switch( aHotKey )
{ {
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */ case WXK_NUMPAD8:
case WXK_UP: case WXK_UP:
pos.y -= wxRound( gridSize.y ); pos.y -= wxRound( gridSize.y );
DrawPanel->MoveCursor( pos ); DrawPanel->MoveCursor( pos );
break; break;
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */ case WXK_NUMPAD2:
case WXK_DOWN: case WXK_DOWN:
pos.y += wxRound( gridSize.y ); pos.y += wxRound( gridSize.y );
DrawPanel->MoveCursor( pos ); DrawPanel->MoveCursor( pos );
break; break;
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */ case WXK_NUMPAD4:
case WXK_LEFT: case WXK_LEFT:
pos.x -= wxRound( gridSize.x ); pos.x -= wxRound( gridSize.x );
DrawPanel->MoveCursor( pos ); DrawPanel->MoveCursor( pos );
break; break;
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */ case WXK_NUMPAD6:
case WXK_RIGHT: case WXK_RIGHT:
pos.x += wxRound( gridSize.x ); pos.x += wxRound( gridSize.x );
DrawPanel->MoveCursor( pos ); DrawPanel->MoveCursor( pos );
......
...@@ -100,7 +100,7 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode ) ...@@ -100,7 +100,7 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
item = (*m_Collector)[ii]; item = (*m_Collector)[ii];
text = item->GetSelectMenuText(); text = item->GetSelectMenuText();
xpm = item->MenuIcon(); xpm = item->GetMenuImage();
ADD_MENUITEM( &itemMenu, ADD_MENUITEM( &itemMenu,
ID_POPUP_PCB_ITEM_SELECTION_START + ii, ID_POPUP_PCB_ITEM_SELECTION_START + ii,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment