code cleaning, and some minor bugs solved

This commit is contained in:
charras 2008-10-25 10:21:46 +00:00
parent 07a39a0397
commit 3c97a45f48
13 changed files with 95 additions and 80 deletions

View File

@ -862,18 +862,16 @@ static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet )
NetcodeName += wxT( "\"" ); NetcodeName += wxT( "\"" );
if( !NetName.IsEmpty() ) if( !NetName.IsEmpty() )
{ {
NetcodeName += NetName;
if( g_TabObjNet[jj].m_Type != NET_PINLABEL ) if( g_TabObjNet[jj].m_Type != NET_PINLABEL )
{ {
// usual net name, add in the sheet path // usual net name, prefix it by the sheet path
NetcodeName = g_TabObjNet[jj].m_SheetList.PathHumanReadable() NetcodeName += g_TabObjNet[jj].m_SheetList.PathHumanReadable();
+ NetcodeName;
//NetcodeName << wxT("_") <<
// g_TabObjNet[jj].m_SheetList.PathHumanReadable();
} }
NetcodeName += NetName;
} }
NetcodeName += wxT( "\"" ); NetcodeName += wxT( "\"" );
// Add the netname without prefix, in cases we need only the "short" netname
NetcodeName += wxT( " \"" ) + NetName + wxT( "\"" );
LastNetCode = NetCode; LastNetCode = NetCode;
} }

View File

@ -11,14 +11,6 @@
#define CONV_FROM_UTF8( utf8string ) (utf8string) #define CONV_FROM_UTF8( utf8string ) (utf8string)
#endif #endif
/* violation of C++ standard, cannot use min() and max(), i.e. in lowercase
#ifndef min
#define min(x, y) ((x) > (y) ? (y) : (x))
#endif
#ifndef max
#define max(x, y) ((x) > (y) ? (x) : (y))
#endif
*/
#ifndef MIN #ifndef MIN
#define MIN( x, y ) ( (x) > (y) ? (y) : (x) ) #define MIN( x, y ) ( (x) > (y) ? (y) : (x) )

View File

@ -62,7 +62,7 @@ SYSWXLIB = `$(WXWIN)/wx-config --libs gl`\
CC = gcc CC = gcc
.cpp.o: .cpp.o:
gcc -c -Wall $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $(EXTRACPPFLAGS) -o $@ $*.cpp g++ -c -Wall $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $(EXTRACPPFLAGS) -o $@ $*.cpp
# Settings for Cyginw/Mingw32 # Settings for Cyginw/Mingw32
# Some versions of windres cannot cope with the --preprocessor # Some versions of windres cannot cope with the --preprocessor

View File

@ -65,8 +65,8 @@ public:
int m_physical_connexion; // variable used in rastnest computations int m_physical_connexion; // variable used in rastnest computations
// handle block number in track connection // handle block number in track connection
protected:
int m_zone_connexion; // variable used in rastnest computations int m_ZoneSubnet; // variable used in rastnest computations
// handle block number in zone connection // handle block number in zone connection
public: public:
@ -131,6 +131,12 @@ public:
int GetNet() const { return m_NetCode; } int GetNet() const { return m_NetCode; }
void SetNet( int aNetCode ) { m_NetCode = aNetCode; } void SetNet( int aNetCode ) { m_NetCode = aNetCode; }
/**
* Function GetZoneSubNet
* @return int - the sub net code in zone connections.
*/
int GetZoneSubNet() const { return m_ZoneSubnet; }
void SetZoneSubNet( int aSubNetCode ) { m_ZoneSubnet = aSubNetCode; }
/** /**
* Function Display_Infos * Function Display_Infos

View File

@ -66,6 +66,7 @@ TRACK::TRACK( BOARD_ITEM* StructFather, KICAD_T idtype ) :
start = end = NULL; start = end = NULL;
SetNet( 0 ); SetNet( 0 );
SetSubNet( 0 ); SetSubNet( 0 );
SetZoneSubNet( 0 );
SetDrillDefault(); SetDrillDefault();
m_Param = 0; m_Param = 0;
} }

View File

@ -36,8 +36,10 @@ public:
protected: protected:
int m_NetCode; // Net number int m_NetCode; // Net number
int m_Sous_Netcode; /* In rastnest routines : for the current net, int m_Subnet; /* In rastnest routines : for the current net,
* block number (number common to the current connected items found) */ * 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
TRACK( const TRACK& track ); // protected so Copy() is used instead. TRACK( const TRACK& track ); // protected so Copy() is used instead.
@ -127,9 +129,15 @@ public:
* Function GetSubNet * Function GetSubNet
* @return int - the sub net code. * @return int - the sub net code.
*/ */
int GetSubNet() const { return m_Sous_Netcode; } int GetSubNet() const { return m_Subnet; }
void SetSubNet( int aSubNetCode ) { m_Sous_Netcode = aSubNetCode; } void SetSubNet( int aSubNetCode ) { m_Subnet = aSubNetCode; }
/**
* Function GetZoneSubNet
* @return int - the sub net code in zone connections.
*/
int GetZoneSubNet() const { return m_ZoneSubnet; }
void SetZoneSubNet( int aSubNetCode ) { m_ZoneSubnet = aSubNetCode; }
/** /**
* Function GetLength * Function GetLength

View File

@ -44,6 +44,7 @@ public:
private: private:
int m_NetCode; // Net number for fast comparisons int m_NetCode; // Net number for fast comparisons
int m_ZoneSubnet; // variable used in rastnest computations:handle block number in zone connection calculations
public: public:
ZONE_CONTAINER( BOARD* parent ); ZONE_CONTAINER( BOARD* parent );
@ -130,6 +131,13 @@ public:
} }
/**
* Function GetZoneSubNet
* @return int - the sub net code in zone connections.
*/
int GetZoneSubNet() const { return m_ZoneSubnet; }
void SetZoneSubNet( int aSubNetCode ) { m_ZoneSubnet = aSubNetCode; }
int GetNet( void ) const int GetNet( void ) const
{ {
return m_NetCode; return m_NetCode;

View File

@ -30,7 +30,7 @@ static int change_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn,
* Used by propage_equipot() * Used by propage_equipot()
* Change a subnet value to a new value, for tracks ans pads which are connected to corresponding track * Change a subnet value to a new value, for tracks ans pads which are connected to corresponding track
* for pads, this is the .m_physical_connexion member which is tested and modified * for pads, this is the .m_physical_connexion member which is tested and modified
* for tracks, this is the .m_Sous_Netcode member which is tested and modified * for tracks, this is the .m_Subnet member which is tested and modified
* these members are block numbers (or cluster numbers) for a given net * these members are block numbers (or cluster numbers) for a given net
* @return modification count * @return modification count
* @param old_val = subnet value to modify * @param old_val = subnet value to modify
@ -93,7 +93,7 @@ static void propage_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn )
* the track list must be sorted by nets, and all segments from pt_start_conn to pt_end_conn have the save net * the track list must be sorted by nets, and all segments from pt_start_conn to pt_end_conn have the save net
* When 2 items are connected (a track to a pad, or a track to an other track) they are grouped in a cluster. * When 2 items are connected (a track to a pad, or a track to an other track) they are grouped in a cluster.
* for pads, this is the .m_physical_connexion member which is a cluster identifier * for pads, this is the .m_physical_connexion member which is a cluster identifier
* for tracks, this is the .m_Sous_Netcode member which is a cluster identifier * for tracks, this is the .m_Subnet member which is a cluster identifier
* For a given net, if all tracks are created, there is only one cluster. * For a given net, if all tracks are created, there is only one cluster.
* but if not all tracks are created, there are are more than one cluster, and some ratsnets will be shown. * but if not all tracks are created, there are are more than one cluster, and some ratsnets will be shown.
* @param pt_start_conn = first track to test * @param pt_start_conn = first track to test

View File

@ -1,6 +1,6 @@
/****************************************************/ /**********************************************************************/
/* class_module.cpp : fonctions de la classe MODULE */ /* Import functions to import footprints from a gpcb (Newlib) library */
/****************************************************/ /**********************************************************************/
#include "fctsys.h" #include "fctsys.h"
@ -227,7 +227,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
// Calculate size: default is 40 mils (400 pcb units) // Calculate size: default is 40 mils (400 pcb units)
// real size is: default * ibuf[5] / 100 (size in gpcb is given in percent of defalut size // real size is: default * ibuf[5] / 100 (size in gpcb is given in percent of defalut size
ibuf[5] *= TEXT_DEFAULT_SIZE; ibuf[5] /= 100; ibuf[5] *= TEXT_DEFAULT_SIZE; ibuf[5] /= 100;
m_Reference->m_Size.x = m_Reference->m_Size.y = max( 20, ibuf[5] ); m_Reference->m_Size.x = m_Reference->m_Size.y = MAX( 20, ibuf[5] );
m_Reference->m_Width = m_Reference->m_Size.x / 10; m_Reference->m_Width = m_Reference->m_Size.x / 10;
m_Value->m_Orient = m_Reference->m_Orient; m_Value->m_Orient = m_Reference->m_Orient;
m_Value->m_Size = m_Reference->m_Size; m_Value->m_Size = m_Reference->m_Size;

View File

@ -42,8 +42,11 @@ void WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer
bool PlotOriginIsAuxAxis ) bool PlotOriginIsAuxAxis )
/********************************************************************************/ /********************************************************************************/
/* Genere les divers fichiers de trace: /* Creates the output files, one per board layer:
* Pour chaque couche 1 fichier xxxc.PHO au format RS274X * filenames are like xxxc.PHO and use the RS274X format
* Units = inches
* format 3.4, Leading zero omitted, Abs format
* format 3.4 uses the native pcbnew units (1/10000 inch).
*/ */
{ {
int tracevia = 1; int tracevia = 1;
@ -142,7 +145,8 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
int garde, int tracevia ) int garde, int tracevia )
/***********************************************************************/ /***********************************************************************/
/* Trace en format GERBER. d'une couche cuivre ou masque /* Creates one GERBER file for a copper layer or a technical layer
* the silkscreen layers are plotted by Plot_Serigraphie() because they have special features
*/ */
{ {
wxPoint pos; wxPoint pos;
@ -156,7 +160,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
// (Following command has been superceded by new command on lines 93 and 94.) // (Following command has been superceded by new command on lines 93 and 94.)
// masque_layer |= EDGE_LAYER; /* Les elements de la couche EDGE sont tj traces */ // masque_layer |= EDGE_LAYER; /* Les elements de la couche EDGE sont tj traces */
/* trace des elements type Drawings Pcb : */ /* Draw items type Drawings Pcb : */
PtStruct = m_Pcb->m_Drawings; PtStruct = m_Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
{ {
@ -191,7 +195,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
} }
} }
/* Trace des Elements des modules autres que pads */ /* Draw footprints shapes without pads (pads will plotted later) */
nb_items = 0; nb_items = 0;
Affiche_1_Parametre( this, 38, wxT( "DrawMod" ), wxEmptyString, GREEN ); Affiche_1_Parametre( this, 38, wxT( "DrawMod" ), wxEmptyString, GREEN );
Module = m_Pcb->m_Modules; Module = m_Pcb->m_Modules;
@ -213,7 +217,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
} }
} }
/* Trace des Elements des modules : Pastilles */ /* Plot footprint pads */
nb_items = 0; nb_items = 0;
Affiche_1_Parametre( this, 48, wxT( "Pads" ), wxEmptyString, GREEN ); Affiche_1_Parametre( this, 48, wxT( "Pads" ), wxEmptyString, GREEN );
Module = m_Pcb->m_Modules; Module = m_Pcb->m_Modules;
@ -271,7 +275,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
} }
} }
/* trace des VIAS : */ /* Plot vias : */
if( tracevia ) if( tracevia )
{ {
nb_items = 0; nb_items = 0;
@ -304,7 +308,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
Affiche_1_Parametre( this, 56, wxEmptyString, msg, RED ); Affiche_1_Parametre( this, 56, wxEmptyString, msg, RED );
} }
} }
/* trace des pistes : */ /* Plot tracks (not vias) : */
nb_items = 0; nb_items = 0;
Affiche_1_Parametre( this, 64, wxT( "Tracks" ), wxEmptyString, YELLOW ); Affiche_1_Parametre( this, 64, wxT( "Tracks" ), wxEmptyString, YELLOW );
@ -328,7 +332,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
Affiche_1_Parametre( this, 64, wxEmptyString, msg, YELLOW ); Affiche_1_Parametre( this, 64, wxEmptyString, msg, YELLOW );
} }
/* trace des zones: */ /* Plot zones: */
nb_items = 0; nb_items = 0;
if( m_Pcb->m_Zone ) if( m_Pcb->m_Zone )
Affiche_1_Parametre( this, 72, wxT( "Zones " ), wxEmptyString, YELLOW ); Affiche_1_Parametre( this, 72, wxT( "Zones " ), wxEmptyString, YELLOW );
@ -452,11 +456,10 @@ void Plot_1_CIRCLE_pad_GERBER( wxPoint pos, int diametre )
void PlotRectangularPad_GERBER( wxPoint pos, wxSize size, int orient ) void PlotRectangularPad_GERBER( wxPoint pos, wxSize size, int orient )
/**************************************************************************/ /**************************************************************************/
/* Trace 1 pad rectangulaire d'orientation quelconque /* Plot 1 rectangular pad
* donne par son centre, ses dimensions, et son orientation * donne par son centre, ses dimensions, et son orientation
* Pour une orientation verticale ou horizontale, la forme est flashee * For a vertical or horizontal shape, the shape is an aperture (Dcode) and it is flashed
* Pour une orientation quelconque la forme est tracee par 4 segments * For others orientations the shape is plotted as a polygon
* de largeur 1/2 largeur pad
*/ */
{ {
D_CODE* dcode_ptr; D_CODE* dcode_ptr;
@ -487,7 +490,7 @@ void PlotRectangularPad_GERBER( wxPoint pos, wxSize size, int orient )
fputs( cbuf, dest ); fputs( cbuf, dest );
break; break;
default: /* Forme tracee par remplissage */ default: /* plot pad shape as polygon */
trace_1_pad_TRAPEZE_GERBER( pos, size, wxSize( 0, 0 ), orient, FILLED ); trace_1_pad_TRAPEZE_GERBER( pos, size, wxSize( 0, 0 ), orient, FILLED );
break; break;
} }
@ -587,7 +590,7 @@ void trace_1_pad_TRAPEZE_GERBER( wxPoint pos, wxSize size, wxSize delta,
{ {
int ii, jj; int ii, jj;
int dx, dy; int dx, dy;
wxPoint polygone[4]; /* coord sommets */ wxPoint polygon[4]; /* polygon corners */
int coord[8]; int coord[8];
int ddx, ddy; int ddx, ddy;
@ -600,33 +603,33 @@ void trace_1_pad_TRAPEZE_GERBER( wxPoint pos, wxSize size, wxSize delta,
ddx = delta.x / 2; ddx = delta.x / 2;
ddy = delta.y / 2; ddy = delta.y / 2;
polygone[0].x = -dx - ddy; polygon[0].x = -dx - ddy;
polygone[0].y = +dy + ddx; polygon[0].y = +dy + ddx;
polygone[1].x = -dx + ddy; polygon[1].x = -dx + ddy;
polygone[1].y = -dy - ddx; polygon[1].y = -dy - ddx;
polygone[2].x = +dx - ddy; polygon[2].x = +dx - ddy;
polygone[2].y = -dy + ddx; polygon[2].y = -dy + ddx;
polygone[3].x = +dx + ddy; polygon[3].x = +dx + ddy;
polygone[3].y = +dy - ddx; polygon[3].y = +dy - ddx;
/* Dessin du polygone et Remplissage eventuel de l'interieur */ /* Dessin du polygone et Remplissage eventuel de l'interieur */
for( ii = 0, jj = 0; ii < 4; ii++ ) for( ii = 0, jj = 0; ii < 4; ii++ )
{ {
RotatePoint( &polygone[ii].x, &polygone[ii].y, orient ); RotatePoint( &polygon[ii].x, &polygon[ii].y, orient );
coord[jj] = polygone[ii].x += pos.x; coord[jj] = polygon[ii].x += pos.x;
jj++; jj++;
coord[jj] = polygone[ii].y += pos.y; coord[jj] = polygon[ii].y += pos.y;
jj++; jj++;
} }
if( modetrace != FILLED ) if( modetrace != FILLED )
{ {
int plotLine_width = (int) (10 * g_PlotLine_Width * Gerb_scale_plot); int plotLine_width = (int) (10 * g_PlotLine_Width * Gerb_scale_plot);
PlotGERBERLine( polygone[0], polygone[1], plotLine_width ); PlotGERBERLine( polygon[0], polygon[1], plotLine_width );
PlotGERBERLine( polygone[1], polygone[2], plotLine_width ); PlotGERBERLine( polygon[1], polygon[2], plotLine_width );
PlotGERBERLine( polygone[2], polygone[3], plotLine_width ); PlotGERBERLine( polygon[2], polygon[3], plotLine_width );
PlotGERBERLine( polygone[3], polygone[0], plotLine_width ); PlotGERBERLine( polygon[3], polygon[0], plotLine_width );
} }
else else
PlotPolygon_GERBER( 4, coord, TRUE ); PlotPolygon_GERBER( 4, coord, TRUE );
@ -664,7 +667,7 @@ void PlotGERBERLine( wxPoint start, wxPoint end, int width )
void PlotCircle_GERBER( wxPoint centre, int rayon, int epaisseur ) void PlotCircle_GERBER( wxPoint centre, int rayon, int epaisseur )
/********************************************************************/ /********************************************************************/
/* routine de trace de 1 cercle de centre centre par approximation de segments /* Plot one cercle as segments (6 to 16 depending on its radius
*/ */
{ {
int ii; int ii;
@ -702,7 +705,7 @@ void PlotPolygon_GERBER( int nb_segm, int* coord, bool fill )
/***************************************************************/ /***************************************************************/
{ {
int ii; int ii;
wxPoint pos; wxPoint pos, startpos;
fputs( "G36*\n", dest ); fputs( "G36*\n", dest );
pos.x = *coord; pos.x = *coord;
@ -710,6 +713,7 @@ void PlotPolygon_GERBER( int nb_segm, int* coord, bool fill )
pos.y = *coord; pos.y = *coord;
coord++; coord++;
UserToDeviceCoordinate( pos ); UserToDeviceCoordinate( pos );
startpos = pos;
fprintf( dest, "X%5.5dY%5.5dD02*\n", pos.x, pos.y ); fprintf( dest, "X%5.5dY%5.5dD02*\n", pos.x, pos.y );
for( ii = 1; ii < nb_segm; ii++ ) for( ii = 1; ii < nb_segm; ii++ )
{ {
@ -721,6 +725,7 @@ void PlotPolygon_GERBER( int nb_segm, int* coord, bool fill )
fprintf( dest, "X%5.5dY%5.5dD01*\n", pos.x, pos.y ); fprintf( dest, "X%5.5dY%5.5dD01*\n", pos.x, pos.y );
} }
fprintf( dest, "X%5.5dY%5.5dD01*\n", startpos.x, startpos.y );
fputs( "G37*\n", dest ); fputs( "G37*\n", dest );
} }
@ -915,9 +920,6 @@ int WinEDA_BasePcbFrame::Gen_D_CODE_File( FILE* penfile )
break; break;
} }
// compensation localisation printf (float x.y généré x,y)
to_point( text + 2 );
fputs( cbuf, penfile ); fputs( cbuf, penfile );
ptr_tool = ptr_tool->m_Pnext; ptr_tool = ptr_tool->m_Pnext;
nb_dcodes++; nb_dcodes++;

View File

@ -344,7 +344,7 @@ int CPolyLine::MakeKboolPoly( int aStart_contour, int aEnd_contour, std::vector<
// style is ARC_CW or ARC_CCW // style is ARC_CW or ARC_CCW
int n; // number of steps for arcs int n; // number of steps for arcs
n = ( abs( x2 - x1 ) + abs( y2 - y1 ) ) / (CArc::MAX_STEP); n = ( abs( x2 - x1 ) + abs( y2 - y1 ) ) / (CArc::MAX_STEP);
n = max( n, CArc::MIN_STEPS ); // or at most 5 degrees of arc n = MAX( n, CArc::MIN_STEPS ); // or at most 5 degrees of arc
n_vertices += n; n_vertices += n;
n_arcs++; n_arcs++;
} }
@ -378,7 +378,7 @@ int CPolyLine::MakeKboolPoly( int aStart_contour, int aEnd_contour, std::vector<
// style is arc_cw or arc_ccw // style is arc_cw or arc_ccw
int n; // number of steps for arcs int n; // number of steps for arcs
n = ( abs( x2 - x1 ) + abs( y2 - y1 ) ) / (CArc::MAX_STEP); n = ( abs( x2 - x1 ) + abs( y2 - y1 ) ) / (CArc::MAX_STEP);
n = max( n, CArc::MIN_STEPS ); // or at most 5 degrees of arc n = MAX( n, CArc::MIN_STEPS ); // or at most 5 degrees of arc
double xo, yo, theta1, theta2, a, b; double xo, yo, theta1, theta2, a, b;
a = fabs( (double) (x1 - x2) ); a = fabs( (double) (x1 - x2) );
b = fabs( (double) (y1 - y2) ); b = fabs( (double) (y1 - y2) );
@ -966,10 +966,10 @@ CRect CPolyLine::GetCornerBounds()
r.right = r.top = INT_MIN; r.right = r.top = INT_MIN;
for( unsigned i = 0; i<corner.size(); i++ ) for( unsigned i = 0; i<corner.size(); i++ )
{ {
r.left = min( r.left, corner[i].x ); r.left = MIN( r.left, corner[i].x );
r.right = max( r.right, corner[i].x ); r.right = MAX( r.right, corner[i].x );
r.bottom = min( r.bottom, corner[i].y ); r.bottom = MIN( r.bottom, corner[i].y );
r.top = max( r.top, corner[i].y ); r.top = MAX( r.top, corner[i].y );
} }
return r; return r;
@ -986,10 +986,10 @@ CRect CPolyLine::GetCornerBounds( int icont )
int iend = GetContourEnd( icont ); int iend = GetContourEnd( icont );
for( int i = istart; i<=iend; i++ ) for( int i = istart; i<=iend; i++ )
{ {
r.left = min( r.left, corner[i].x ); r.left = MIN( r.left, corner[i].x );
r.right = max( r.right, corner[i].x ); r.right = MAX( r.right, corner[i].x );
r.bottom = min( r.bottom, corner[i].y ); r.bottom = MIN( r.bottom, corner[i].y );
r.top = max( r.top, corner[i].y ); r.top = MAX( r.top, corner[i].y );
} }
return r; return r;

View File

@ -46,11 +46,11 @@ void ArmBoolEng( Bool_Engine* aBooleng, bool aConvertHoles = false );
#define NM_PER_MIL 10 // 25400 #define NM_PER_MIL 10 // 25400
#define to_int( x ) (int) round( (x) ) #define to_int( x ) (int) round( (x) )
#ifndef min #ifndef MIN
#define min( x1, x2 ) ( (x1) > (x2) ? (x2) : (x1) ) #define MIN( x1, x2 ) ( (x1) > (x2) ? (x2) : (x1) )
#endif #endif
#ifndef max #ifndef MAX
#define max( x1, x2 ) ( (x1) > (x2) ? (x1) : (x2) ) #define MAX( x1, x2 ) ( (x1) > (x2) ? (x1) : (x2) )
#endif #endif
class CRect class CRect

View File

@ -38,10 +38,10 @@ public:
my_rect(){}; my_rect(){};
my_rect( int xi, int yi, int xf, int yf ) my_rect( int xi, int yi, int xf, int yf )
{ {
xlo = min(xi,xf); xlo = MIN(xi,xf);
xhi = max(xi,xf); xhi = MAX(xi,xf);
ylo = min(yi,yf); ylo = MIN(yi,yf);
yhi = max(yi,yf); yhi = MAX(yi,yf);
}; };
int xlo, ylo, xhi, yhi; int xlo, ylo, xhi, yhi;
}; };