diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-12-28 20:24:50 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-12-28 20:24:50 +0100 |
commit | 09795a01ef859f072920de9df974d1b03b9ab9a4 (patch) | |
tree | 4d05907fc37f1bd781e506f5e196f7435aeec0ab /app/bin/trkseg.c | |
parent | 5b4163d8c76b03f0d31b09866aa4bd06b4d8d804 (diff) |
New upstream version 4.2.4aupstream/4.2.4a
Diffstat (limited to 'app/bin/trkseg.c')
-rw-r--r-- | app/bin/trkseg.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/app/bin/trkseg.c b/app/bin/trkseg.c index ff3725c..972463f 100644 --- a/app/bin/trkseg.c +++ b/app/bin/trkseg.c @@ -1,5 +1,5 @@ -/* - * $Header: /home/dmarkle/xtrkcad-fork-cvs/xtrkcad/app/bin/trkseg.c,v 1.2 2006-05-30 16:11:55 m_fischer Exp $ +/** \file trkseg.c + * Modification and drawing of track segments */ /* XTrkCad - Model Railroad CAD @@ -123,7 +123,7 @@ EXPORT coOrd GetSegEndPt( } /** - * Caclulate the bounding box for a string. + * Caclulate the bounding box for a string. * * \param coOrd IN position of text * \param angle IN text angle @@ -149,15 +149,15 @@ EXPORT void GetTextBounds( int i; DrawTextSize2( &mainD, str, NULL, fs, FALSE, &size, &descent ); - + // set up the corners of the rectangle p[0].x = p[3].x = 0.0; p[1].x = p[2].x = size.x; p[0].y = p[1].y = -descent; p[2].y = p[3].y = size.y; - + lo = hi = zero; - + // rotate each point for ( i=1; i<4; i++ ) { Rotate( &p[i], zero, angle ); @@ -166,7 +166,7 @@ EXPORT void GetTextBounds( if ( p[i].x > hi.x ) hi.x = p[i].x; if ( p[i].y > hi.y ) hi.y = p[i].y; } - + // now recaclulate the corners loR->x = pos.x + lo.x; loR->y = pos.y + lo.y; @@ -199,17 +199,17 @@ static void Get1SegBounds( trkSeg_p segPtr, coOrd xlat, ANGLE_T angle, coOrd *lo REORIGIN( p1, GetSegEndPt( segPtr, 1, FALSE, NULL ), angle, xlat ) if (p0.x < p1.x) { lo->x = p0.x; - hi->x = p1.x; + hi->x = p1.x; } else { lo->x = p1.x; - hi->x = p0.x; + hi->x = p0.x; } if (p0.y < p1.y) { lo->y = p0.y; - hi->y = p1.y; + hi->y = p1.y; } else { lo->y = p1.y; - hi->y = p0.y; + hi->y = p0.y; } if ( segPtr->type == SEG_CRVTRK || segPtr->type == SEG_CRVLIN ) { @@ -761,7 +761,7 @@ EXPORT ANGLE_T GetAngleSegs( * * Color * - ****************************************************************************/ + ****************************************************************************/ typedef struct { FLOAT_T h, s, v; @@ -948,7 +948,7 @@ EXPORT void RecolorSegs( * * Input/Output * - ****************************************************************************/ + ****************************************************************************/ static void AppendPath( signed char c ) @@ -970,7 +970,7 @@ EXPORT BOOL_T ReadSegs( void ) BOOL_T rc=FALSE; trkSeg_p s; trkEndPt_p e; - long rgb; + unsigned long rgb; int i; DIST_T elev0, elev1; BOOL_T hasElev; @@ -984,7 +984,7 @@ EXPORT BOOL_T ReadSegs( void ) DYNARR_RESET( trkEndPt_t, tempEndPts_da ); pathCnt = 0; while ( (cp = GetNextLine()) != NULL ) { - while (isspace(*cp)) cp++; + while (isspace((unsigned char)*cp)) cp++; hasElev = FALSE; if ( strncmp( cp, "END", 3 ) == 0 ) { rc = TRUE; @@ -1005,7 +1005,7 @@ EXPORT BOOL_T ReadSegs( void ) DYNARR_APPEND( trkSeg_t, tempSegs_da, 10 ); s = &tempSegs(tempSegs_da.cnt-1); s->type = type; - if ( !GetArgs( cp, hasElev?"lwpfpf":"lwpYpY", + if ( !GetArgs( cp, hasElev?"uwpfpf":"uwpYpY", &rgb, &s->width, &s->u.l.pos[0], &elev0, &s->u.l.pos[1], &elev1 ) ) { rc = FALSE; break; @@ -1018,7 +1018,7 @@ EXPORT BOOL_T ReadSegs( void ) DYNARR_APPEND( trkSeg_t, tempSegs_da, 10 ); s = &tempSegs(tempSegs_da.cnt-1); s->type = type; - if ( !GetArgs( cp, hasElev?"lwpfpfl":"lwpYpYZ", + if ( !GetArgs( cp, hasElev?"uwpfpfl":"uwpYpYZ", &rgb, &s->width, &s->u.l.pos[0], &elev0, &s->u.l.pos[1], &elev1, &option ) ) { rc = FALSE; break; @@ -1033,7 +1033,7 @@ EXPORT BOOL_T ReadSegs( void ) DYNARR_APPEND( trkSeg_t, tempSegs_da, 10 ); s = &tempSegs(tempSegs_da.cnt-1); s->type = SEG_CRVLIN; - if ( !GetArgs( cp, hasElev?"lwfpfff":"lwfpYff", + if ( !GetArgs( cp, hasElev?"uwfpfff":"uwfpYff", &rgb, &s->width, &s->u.c.radius, &s->u.c.center, @@ -1048,7 +1048,7 @@ EXPORT BOOL_T ReadSegs( void ) DYNARR_APPEND( trkSeg_t, tempSegs_da, 10 ); s = &tempSegs(tempSegs_da.cnt-1); s->type = SEG_STRTRK; - if ( !GetArgs( cp, hasElev?"lwpfpf":"lwpYpY", + if ( !GetArgs( cp, hasElev?"uwpfpf":"uwpYpY", &rgb, &s->width, &s->u.l.pos[0], &elev0, &s->u.l.pos[1], &elev1 ) ) { @@ -1061,7 +1061,7 @@ EXPORT BOOL_T ReadSegs( void ) DYNARR_APPEND( trkSeg_t, tempSegs_da, 10 ); s = &tempSegs(tempSegs_da.cnt-1); s->type = SEG_CRVTRK; - if ( !GetArgs( cp, hasElev?"lwfpfff":"lwfpYff", + if ( !GetArgs( cp, hasElev?"uwfpfff":"uwfpYff", &rgb, &s->width, &s->u.c.radius, &s->u.c.center, @@ -1076,7 +1076,7 @@ EXPORT BOOL_T ReadSegs( void ) DYNARR_APPEND( trkSeg_t, tempSegs_da, 10 ); s = &tempSegs(tempSegs_da.cnt-1); s->type = SEG_JNTTRK; - if ( !GetArgs( cp, hasElev?"lwpffffffl":"lwpYfffffl", + if ( !GetArgs( cp, hasElev?"uwpffffffl":"uwpYfffffl", &rgb, &s->width, &s->u.j.pos, &elev0, @@ -1098,7 +1098,7 @@ EXPORT BOOL_T ReadSegs( void ) DYNARR_APPEND( trkSeg_t, tempSegs_da, 10 ); s = &tempSegs(tempSegs_da.cnt-1); s->type = SEG_FILCRCL; - if ( !GetArgs( cp, hasElev?"lwfpf":"lwfpY", + if ( !GetArgs( cp, hasElev?"uwfpf":"uwfpY", &rgb, &s->width, &s->u.c.radius, &s->u.c.center, @@ -1115,7 +1115,7 @@ EXPORT BOOL_T ReadSegs( void ) DYNARR_APPEND( trkSeg_t, tempSegs_da, 10 ); s = &tempSegs(tempSegs_da.cnt-1); s->type = type; - if ( !GetArgs( cp, "lwd", + if ( !GetArgs( cp, "uwd", &rgb, &s->width, &s->u.p.cnt ) ) { rc = FALSE; @@ -1138,7 +1138,7 @@ EXPORT BOOL_T ReadSegs( void ) s = &tempSegs(tempSegs_da.cnt-1); s->type = type; s->u.t.fontP = NULL; - if ( !GetArgs( cp, "lpf0fq", &rgb, &s->u.t.pos, &s->u.t.angle, &s->u.t.fontSize, &s->u.t.string ) ) { + if ( !GetArgs( cp, "upf0fq", &rgb, &s->u.t.pos, &s->u.t.angle, &s->u.t.fontSize, &s->u.t.string ) ) { rc = FALSE; /*??*/break; } @@ -1188,7 +1188,7 @@ EXPORT BOOL_T ReadSegs( void ) } break; case SEG_PATH: - while (isspace(*cp)) cp++; + while (isspace((unsigned char)*cp)) cp++; if (*cp == '\"') cp++; while ( *cp != '\"') AppendPath((signed char)*cp++); AppendPath(0); @@ -1455,7 +1455,7 @@ EXPORT void DrawDimLine( p.y += fy*y; DrawLine( d, p, p1, 0, color ); } - + EXPORT void DrawSegsO( drawCmd_p d, track_p trk, |