diff options
| author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2025-09-20 19:19:41 +0200 | 
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2025-09-20 19:19:41 +0200 | 
| commit | 63ec5715054be18ac4db5675e067b41c955d03b9 (patch) | |
| tree | 42bb5764b05bd3bc5bffadb55f4375e6dce8a521 /app/bin/ctrain.c | |
| parent | 6c1a798b0302034a7fdcaf93b8f014e2e458c2a0 (diff) | |
| parent | e7d20cf352688bf717a01f4e6d9e6f497c2bea4c (diff) | |
Update upstream source from tag 'upstream/5.3.1Beta2'
Update to upstream version '5.3.1Beta2'
with Debian dir 36e53756d97319b1944d0ea744717abc9326f697
Diffstat (limited to 'app/bin/ctrain.c')
| -rw-r--r-- | app/bin/ctrain.c | 71 | 
1 files changed, 44 insertions, 27 deletions
diff --git a/app/bin/ctrain.c b/app/bin/ctrain.c index 015f9e8..acbaef7 100644 --- a/app/bin/ctrain.c +++ b/app/bin/ctrain.c @@ -31,6 +31,8 @@  #include "track.h"  #include "common-ui.h" +#include "include/toolbar.h" +  long programMode;  long maxCouplingSpeed = 100;  long hideTrainsInTunnels; @@ -47,7 +49,9 @@ typedef struct extraDataCar_t {  	long            state;  	carItem_p       item;  	double          speed; +#ifdef CAR_CLEARANCE  	BOOL_T 			pencils; +#endif  	BOOL_T          direction;  	BOOL_T          autoReverse;  	trainStatus_e   status; @@ -92,7 +96,7 @@ static void ControllerDialogSyncAll(void);  static STATUS_T CmdTrain(wAction_t, coOrd);  static wMenu_p trainPopupM;  static wMenuPush_p trainPopupMI[11]; -static track_p followTrain; +static track_p followTrain = NULL;  static coOrd followCenter;  static BOOL_T trainsTimeoutPending;  static enum { TRAINS_STOP, TRAINS_RUN, TRAINS_IDLE, TRAINS_PAUSE } trainsState; @@ -382,7 +386,10 @@ static void DrawCar(  	CarItemDraw(d, xx->item, color, xx->direction, IsLocoMaster(xx), coupler, -	            xx->pencils, xx->trvTrk.trk); +#ifdef CAR_CLEARANCE +	            xx->pencils, +#endif +	            xx->trvTrk.trk);  } @@ -1376,7 +1383,7 @@ static trainControlDlg_p CreateTrainControlDlg(void)  	sprintf(title, _("Train Control %d"), ++numTrainDlg);  	dlg->trainPGp = &trainPG;  	dlg->win = ParamCreateDialog(dlg->trainPGp, _("Train Control"), NULL, NULL, -	                             NULL, FALSE, NULL, 0, ControllerDialogUpdate); +	                             ParamCancel_Null, FALSE, NULL, 0, ControllerDialogUpdate);  	speedD.size.x = SLIDER_WIDTH/speedD.dpi;  	speedD.size.y = SLIDER_HEIGHT/speedD.dpi;  	return dlg; @@ -1395,7 +1402,6 @@ static struct {  long trainPause = 200; -static track_p followTrain = NULL;  static void DrawAllCars(track_p trk)  {  	track_p car; @@ -2573,8 +2579,10 @@ static BOOL_T TrainOnMovableTrack(  #define DO_MUMASTER		(5)  #define DO_CHANGEDIR	(6)  #define DO_STOP			(7) +#ifdef CAR_CLEARANCE  #define DO_PENCILS_ON   (8)  #define DO_PENCILS_OFF  (9) +#endif  #define DO_DESCRIBE     (10)  static track_p trainFuncCar;  static coOrd trainFuncPos; @@ -2632,7 +2640,7 @@ static STATUS_T CmdTrain(wAction_t action, coOrd pos)  		LocoListInit();  		ControllerDialogSync(curTrainDlg);  		wShow(curTrainDlg->win); -		wControlShow((wControl_p)newcarB, (toolbarSet&(1<<BG_TRAIN))); +		wControlShow((wControl_p)newcarB, ToolbarIsGroupVisible(BG_TRAIN));  		currCarItemPtr = NULL;  		TempRedraw(); // CmdTrain C_START  		return C_CONTINUE; @@ -2668,7 +2676,9 @@ static STATUS_T CmdTrain(wAction_t action, coOrd pos)  			CHECK(currCar != NULL);  			xx = GET_EXTRA_DATA(currCar, T_CAR, extraDataCar_t); +#ifdef CAR_CLEARANCE  			xx->pencils = FALSE; +#endif  			dist = CarItemCoupledLength(xx->item)/2.0;  			Translate(&pos, xx->trvTrk.pos, xx->trvTrk.angle, dist);  			SetTrkEndPoint(currCar, 0, pos, xx->trvTrk.angle); @@ -2857,13 +2867,15 @@ static STATUS_T CmdTrain(wAction_t action, coOrd pos)  		}  		xx = GET_EXTRA_DATA(trainFuncCar, T_CAR, extraDataCar_t); +#ifdef CAR_CLEARANCE  		if (xx->pencils) { -//			wMenuPushEnable(trainPopupMI[DO_PENCILS_OFF], TRUE); -//			wMenuPushEnable(trainPopupMI[DO_PENCILS_ON], FALSE); +			wMenuPushEnable(trainPopupMI[DO_PENCILS_OFF], TRUE); +			wMenuPushEnable(trainPopupMI[DO_PENCILS_ON], FALSE);  		} else { -//			wMenuPushEnable(trainPopupMI[DO_PENCILS_OFF], FALSE); -//			wMenuPushEnable(trainPopupMI[DO_PENCILS_ON], TRUE); +			wMenuPushEnable(trainPopupMI[DO_PENCILS_OFF], FALSE); +			wMenuPushEnable(trainPopupMI[DO_PENCILS_ON], TRUE);  		} +#endif  		trk0 = FindMasterLoco(trainFuncCar,NULL);  		dir = IsAligned(xx->trvTrk.angle, FindAngle(xx->trvTrk.pos, @@ -2956,6 +2968,7 @@ static STATUS_T CmdTrain(wAction_t action, coOrd pos)  } +#ifdef LATER  /*   *   */ @@ -2966,16 +2979,17 @@ static STATUS_T CmdCarDescAction(  {  	return CmdTrain(action, pos);  } +#endif -#include "bitmaps/train.xpm3" -#include "bitmaps/exit.xpm3" -#include "bitmaps/new-car.xpm3" -#include "bitmaps/go.xpm3" -#include "bitmaps/stop.xpm3" +#include "bitmaps/train.image3" +#include "bitmaps/exit.image3" +#include "bitmaps/new-car.image3" +#include "bitmaps/go.image3" +#include "bitmaps/stop.image3" -#include "bitmaps/zero.xpm" -#include "bitmaps/greendot.xpm" -#include "bitmaps/reddot.xpm" +#include "bitmaps/zero.image1" +#include "bitmaps/greendot.image1" +#include "bitmaps/reddot.image1"  static void CmdTrainStopGo(void * unused) @@ -3031,7 +3045,6 @@ static void TrainFunc(  	coOrd pos0, pos1;  	ANGLE_T angle0, angle1;  	EPINX_T ep0, ep1; -	char describe_str[STR_SIZE];  	if (trainFuncCar == NULL) {  		fprintf(stderr, "trainFunc: trainFuncCar==NULL\n"); @@ -3048,6 +3061,7 @@ static void TrainFunc(  		UncoupleCars( trainFuncCar, dir );  		break; +#ifdef CAR_CLEARANCE  	case DO_PENCILS_ON:  		xx->pencils = TRUE;  		break; @@ -3055,6 +3069,7 @@ static void TrainFunc(  	case DO_PENCILS_OFF:  		xx->pencils = FALSE;  		break; +#endif  	case DO_FLIPCAR:  		temp0 = GetTrkEndTrk(trainFuncCar,0); @@ -3196,23 +3211,23 @@ void InitCmdTrain(wMenu_p menu)  {  	log_trainMove = LogFindIndex("trainMove");  	log_trainPlayback = LogFindIndex("trainPlayback"); -	trainPLs[I_ZERO].winLabel = (char*)wIconCreatePixMap(zero_xpm); +	trainPLs[I_ZERO].winLabel = (char*)wIconCreatePixMap(zero_image1);  	ParamRegister(&trainPG);  	trainCmdInx = AddMenuButton(menu, CmdTrain, "cmdTrain", _("Run Trains"), -	                            wIconCreatePixMap(train_xpm3[iconSize]), LEVEL0_50, +	                            wIconCreatePixMap(train_image3[iconSize]), LEVEL0_50,  	                            IC_POPUP3|IC_LCLICK|IC_RCLICK|IC_WANT_MOVE, 0,  	                            NULL); -	stopI = wIconCreatePixMap(reddot); -	goI = wIconCreatePixMap(greendot); -	stopB = wIconCreatePixMap(stop_xpm3[iconSize]); -	goB = wIconCreatePixMap(go_xpm3[iconSize]); +	stopI = wIconCreatePixMap(reddot_image1); +	goI = wIconCreatePixMap(greendot_image1); +	stopB = wIconCreatePixMap(stop_image3[iconSize]); +	goB = wIconCreatePixMap(go_image3[iconSize]);  	trainPauseB = AddToolbarButton("cmdTrainPause", stopB, IC_MODETRAIN_ONLY,  	                               CmdTrainStopGo, NULL); -	AddToolbarButton("cmdTrainExit", wIconCreatePixMap(exit_xpm3[iconSize]), +	AddToolbarButton("cmdTrainExit", wIconCreatePixMap(exit_image3[iconSize]),  	                 IC_MODETRAIN_ONLY,  	                 CmdTrainExit, NULL);  	newcarB = AddToolbarButton("cmdTrainNewCar", -	                           wIconCreatePixMap(new_car_xpm3[iconSize]), +	                           wIconCreatePixMap(new_car_image3[iconSize]),  	                           IC_MODETRAIN_ONLY, CarItemLoadList, NULL);  	T_CAR = InitObject(&carCmds); @@ -3221,15 +3236,17 @@ void InitCmdTrain(wMenu_p menu)  	                              TrainFunc, I2VP(DO_UNCOUPLE));  	trainPopupMI[DO_FLIPCAR]    = wMenuPushCreate(trainPopupM, "", _("Flip Car"), 0,  	                              TrainFunc, I2VP(DO_FLIPCAR)); +#ifdef CAR_CLEARANCE  	trainPopupMI[DO_PENCILS_ON]	= wMenuPushCreate(trainPopupM, "",  	                                  _("Clearance Lines On"), 0,  	                                  TrainFunc, I2VP(DO_PENCILS_ON));  	trainPopupMI[DO_PENCILS_OFF]	= wMenuPushCreate(trainPopupM, "",  	                                  _("Clearance Lines Off"), 0,  	                                  TrainFunc, I2VP(DO_PENCILS_OFF)); +#endif  	trainPopupMI[DO_FLIPTRAIN]  = wMenuPushCreate(trainPopupM, "", _("Flip Train"),  	                              0, TrainFunc, I2VP(DO_FLIPTRAIN)); -	trainPopupMI[DO_DESCRIBE] = wMenuPushCreate(trainPopupM, "", _("Describe"), +	trainPopupMI[DO_DESCRIBE] = wMenuPushCreate(trainPopupM, "", _("Properties"),  	                            0, TrainFunc, I2VP(DO_DESCRIBE));  	trainPopupMI[DO_MUMASTER]   = wMenuPushCreate(trainPopupM, "", _("MU Master"),  	                              0, TrainFunc, I2VP(DO_MUMASTER));  | 
