diff options
Diffstat (limited to 'app/bin/track.h')
-rw-r--r-- | app/bin/track.h | 71 |
1 files changed, 44 insertions, 27 deletions
diff --git a/app/bin/track.h b/app/bin/track.h index 4e24280..32626c5 100644 --- a/app/bin/track.h +++ b/app/bin/track.h @@ -23,10 +23,7 @@ #ifndef TRACK_H #define TRACK_H -#include <string.h> #include "common.h" -#include "draw.h" -#include "misc2.h" extern TRKTYP_T T_NOTRACK; @@ -35,6 +32,7 @@ typedef struct track_t * track_p; typedef struct track_t * track_cp; extern track_p tempTrack; extern wIndex_t trackCount; +extern wBool_t bFreeTrack; extern long colorTrack; extern long colorDraw; extern long drawTunnel; @@ -48,7 +46,6 @@ extern unsigned int curTrackLayer; extern coOrd descriptionOff; extern DIST_T roadbedWidth; extern DIST_T roadbedLineWidth; -extern long printCenterLines; extern long drawElevations; extern wDrawColor elevColorIgnore; extern wDrawColor elevColorDefined; @@ -137,13 +134,14 @@ typedef struct { #define Q_IS_TURNOUT (31) #define Q_GET_NODES (32) -typedef struct { +typedef struct traverseTrack_t { track_p trk; // IN Current Track OUT Next Track DIST_T length; // IN How far to go DIST_T dist; // OUT how far left = 0 if found coOrd pos; // IN/OUT - where we are, where we will be // IN/OUT - where we are now ANGLE_T angle; // IN/OUT - angle now - } traverseTrack_t, *traverseTrack_p; + } traverseTrack_t; +typedef struct traverseTrack_t *traverseTrack_p; typedef struct { @@ -151,7 +149,7 @@ typedef struct { void (*draw)( track_p, drawCmd_p, wDrawColor ); DIST_T (*distance)( track_p, coOrd * ); void (*describe)( track_p, char * line, CSIZE_T len ); - void (*delete)( track_p ); + void (*deleteTrk)( track_p ); BOOL_T (*write)( track_p, FILE * ); BOOL_T (*read)( char * ); void (*move)( track_p, coOrd ); @@ -198,17 +196,18 @@ typedef struct { } u; BOOL_T cacheSet; double cachedElev; - double cachedLength; + double cachedGrade; } elev_t; #define EPOPT_GAPPED (1L<<0) -typedef struct { +typedef struct trkEndPt_t { coOrd pos; ANGLE_T angle; TRKINX_T index; track_p track; elev_t elev; long option; - } trkEndPt_t, * trkEndPt_p; + } trkEndPt_t; +typedef struct trkEndPt_t * trkEndPt_p; extern dynArr_t tempEndPts_da; #define tempEndPts(N) DYNARR_N( trkEndPt_t, tempEndPts_da, N ) @@ -217,7 +216,7 @@ typedef enum { FREEFORM, RECTANGLE, POLYLINE } PolyType_e; -typedef struct { +typedef struct trkSeg_t { char type; wDrawColor color; DIST_T width; @@ -267,7 +266,8 @@ typedef struct { PolyType_e polyType; } p; } u; - } trkSeg_t, * trkSeg_p; + } trkSeg_t; +typedef struct trkSeg_t * trkSeg_p; #define SEG_STRTRK ('S') #define SEG_CRVTRK ('C') @@ -423,6 +423,8 @@ wBool_t CompareSegs( trkSeg_p, int, trkSeg_p, int ); /* debug.c */ void SetDebug( char * ); + +/*Remember to add bits to trackx.h if adding here */ #define TB_SELECTED (1<<0) #define TB_VISIBLE (1<<1) #define TB_PROFILEPATH (1<<2) @@ -435,7 +437,8 @@ void SetDebug( char * ); #define TB_BRIDGE (1<<9) #define TB_SELREDRAW (1<<10) // Track has been undrawn, don't draw it on Redraw -#define TB_UNDRAWN (1<<11) +#define TB_UNDRAWN (1<<11) +#define TB_DETAILDESC (1<<12) #define TB_TEMPBITS (TB_PROFILEPATH|TB_PROCESSED|TB_UNDRAWN) /* track.c */ @@ -464,10 +467,10 @@ void SetDebug( char * ); #define GetTrkEndAngle( T, I ) ((T)->endPt[I].angle) #define GetTrkEndOption( T, I ) ((T)->endPt[I].option) #define SetTrkEndOption( T, I, O ) ((T)->endPt[I].option=O) -#define GetTrkExtraData( T ) ((T)->extraData) +#define GetTrkExtraData( T, TT ) ((T)->extraData) #define GetTrkWidth( T ) (int)((T)->width) #define SetTrkWidth( T, W ) (T)->width = (unsigned int)(W) -#define GetTrkBits(T) ((T)->bits) +#define GetTrkBits(T) ((T)?((T)->bits):0) #define SetTrkBits(T,V) ((T)->bits|=(V)) #define ClrTrkBits(T,V) ((T)->bits&=~(V)) #define IsTrackDeleted(T) ((T)->deleted) @@ -490,7 +493,7 @@ coOrd GetTrkEndPos( track_p, EPINX_T ); ANGLE_T GetTrkEndAngle( track_p, EPINX_T ); long GetTrkEndOption( track_p, EPINX_T ); long SetTrkEndOption( track_p, EPINX_T, long ); -struct extraData * GetTrkExtraData( track_p ); +struct extraDataBase_t * GetTrkExtraData( track_p, TRKTYP_T ); int GetTrkWidth( track_p ); void SetTrkWidth( track_p, int ); int GetTrkBits( track_p ); @@ -502,7 +505,7 @@ BOOL_T IsTrackDeleted( track_p ); #define GetTrkSelected(T) (GetTrkBits(T)&TB_SELECTED) #define GetTrkVisible(T) (GetTrkBits(T)&TB_VISIBLE) #define GetTrkNoTies(T) (GetTrkBits(T)&TB_NOTIES) -#define GetTrkBridge(T) (GetTrkBits(T)&TB_BRIDGE) +#define GetTrkBridge(T) ((T)?GetTrkBits(T)&TB_BRIDGE:0) #define SetTrkVisible(T,V) ((V)?SetTrkBits(T,TB_VISIBLE):ClrTrkBits(T,TB_VISIBLE)) #define SetTrkNoTies(T,V) ((V)?SetTrkBits(T,TB_NOTIES):ClrTrkBits(T,TB_NOTIES)) #define SetTrkBridge(T,V) ((V)?SetTrkBits(T,TB_BRIDGE):ClrTrkBits(T,TB_BRIDGE)) @@ -514,8 +517,8 @@ void SetTrkEndElev( track_p, EPINX_T, int, DIST_T, char * ); int GetTrkEndElevMode( track_p, EPINX_T ); int GetTrkEndElevUnmaskedMode( track_p, EPINX_T ); DIST_T GetTrkEndElevHeight( track_p, EPINX_T ); -BOOL_T GetTrkEndElevCachedHeight (track_p trk, EPINX_T e, DIST_T *height, DIST_T *length); -void SetTrkEndElevCachedHeight ( track_p trk, EPINX_T e, DIST_T height, DIST_T length); +BOOL_T GetTrkEndElevCachedHeight (track_p trk, EPINX_T e, DIST_T *height, DIST_T *grade); +void SetTrkEndElevCachedHeight ( track_p trk, EPINX_T e, DIST_T height, DIST_T grade); char * GetTrkEndElevStation( track_p, EPINX_T ); #define EndPtIsDefinedElev( T, E ) (GetTrkEndElevMode(T,E)==ELEV_DEF) #define EndPtIsIgnoredElev( T, E ) (GetTrkEndElevMode(T,E)==ELEV_IGNORE) @@ -613,10 +616,15 @@ BOOL_T ComputeElev( track_p trk, EPINX_T ep, BOOL_T on_path, DIST_T * elev, DIST #define DTS_DASH (1<<8) #define DTS_DASHDOT (1<<9) #define DTS_DASHDOTDOT (1<<10) +#define DTS_CENTERONLY (1<<11) -void DrawCurvedTrack( drawCmd_p, coOrd, DIST_T, ANGLE_T, ANGLE_T, coOrd, coOrd, track_cp, wDrawColor, long ); +void DrawCurvedTrack( drawCmd_p, coOrd, DIST_T, ANGLE_T, ANGLE_T, track_cp, wDrawColor, long ); void DrawStraightTrack( drawCmd_p, coOrd, coOrd, ANGLE_T, track_cp, wDrawColor, long ); +void DrawStraightTies( drawCmd_p d, SCALEINX_T scaleInx, coOrd p0, coOrd p1, wDrawColor color ); +wBool_t DoDrawTies(drawCmd_p d, track_cp trk); +void DrawTie(drawCmd_p d, coOrd pos, ANGLE_T angle, DIST_T length, DIST_T width, wDrawColor color, BOOL_T solid); + ANGLE_T GetAngleAtPoint( track_p, coOrd, EPINX_T *, EPINX_T * ); DIST_T GetTrkDistance( track_cp, coOrd *); track_p OnTrack( coOrd *, INT_T, BOOL_T ); @@ -652,7 +660,7 @@ void FreeTrack( track_p ); void ClearTracks( void ); BOOL_T TrackIterate( track_p * ); -void LoosenTracks( void ); +void LoosenTracks( void * unused ); void SaveTrackState( void ); void RestoreTrackState( void ); @@ -686,9 +694,10 @@ BOOL_T ReplayTrackData(track_p, void *, long); DIST_T GetFlexLength( track_p, EPINX_T, coOrd * ); void LabelLengths( drawCmd_p, track_p, wDrawColor ); DIST_T GetTrkLength( track_p, EPINX_T, EPINX_T ); +void AddTrkDetails(drawCmd_p d, track_p trk, coOrd pos, DIST_T length, wDrawColor color); -void SelectAbove( void ); -void SelectBelow( void ); +void SelectAbove( void * unused ); +void SelectBelow( void * unused ); void FlipPoint( coOrd*, coOrd, ANGLE_T ); void FlipTrack( track_p, coOrd, ANGLE_T ); @@ -698,8 +707,16 @@ void AdvancePositionIndicator( track_p, coOrd, coOrd *, ANGLE_T * ); BOOL_T MakeParallelTrack( track_p, coOrd, DIST_T, DIST_T, track_p *, coOrd *, coOrd * , BOOL_T); +/*tstraight.c*/ +DIST_T StraightDescriptionDistance(coOrd pos, track_p trk, coOrd * dpos, BOOL_T show_hidden, BOOL_T * hidden); +STATUS_T StraightDescriptionMove(track_p trk,wAction_t action,coOrd pos ); + +/*tease.c*/ +DIST_T JointDescriptionDistance(coOrd pos,track_p trk,coOrd * dpos,BOOL_T show_hidden,BOOL_T * hidden); +STATUS_T JointDescriptionMove(track_p trk,wAction_t action,coOrd pos ); + /* cmisc.c */ -wIndex_t describeCmdInx; +extern wIndex_t describeCmdInx; typedef enum { DESC_NULL, DESC_POS, DESC_FLOAT, DESC_ANGLE, DESC_LONG, DESC_COLOR, DESC_DIM, DESC_PIVOT, DESC_LAYER, DESC_STRING, DESC_TEXT, DESC_LIST, DESC_EDITABLELIST, DESC_BOXED } descType; #define DESC_RO (1<<0) #define DESC_IGNORE (1<<1) @@ -720,7 +737,7 @@ typedef struct { int mode; wControl_p control0; wControl_p control1; - wPos_t posy; + wWinPix_t posy; } descData_t, * descData_p; typedef void (*descUpdate_t)( track_p, int, descData_p, BOOL_T ); void DoDescribe( char *, track_p, descData_p, descUpdate_t ); @@ -743,7 +760,7 @@ extern long oldElevationEvaluation; EPINX_T GetNextTrkOnPath( track_p trk, EPINX_T ep ); int FindDefinedElev( track_p, EPINX_T, int, BOOL_T, DIST_T *, DIST_T * ); BOOL_T ComputeElev( track_p, EPINX_T, BOOL_T, DIST_T *, DIST_T *, BOOL_T ); -void RecomputeElevations( void ); +void RecomputeElevations( void * unused ); void UpdateAllElevations( void ); DIST_T GetElevation( track_p ); void ClrTrkElev( track_p ); @@ -767,7 +784,7 @@ BOOL_T GetClosestEndPt( track_p, coOrd * ); BOOL_T ReadTableEdge( char * ); BOOL_T ReadText( char * ); void SetLineType( track_p trk, int width ); -void MenuMode(int ); +void MenuMode( void * moveVP ); /* chotbar.c */ extern DIST_T curBarScale; |