summaryrefslogtreecommitdiff
path: root/app/bin/doption.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-22 14:05:41 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-22 14:05:41 +0200
commitb55285a77da0e0b829e4ce8d7e09debaabc68e15 (patch)
treef622559ef65bbdd3e1c5bdb06098a8f89eec0563 /app/bin/doption.c
parentd3897ce090dbeb220ed2c782f095597e417cf3cc (diff)
parentd1ae75703e1ed81d65ea16946dcdb77e7a13adc9 (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'app/bin/doption.c')
-rw-r--r--app/bin/doption.c90
1 files changed, 66 insertions, 24 deletions
diff --git a/app/bin/doption.c b/app/bin/doption.c
index ae36d21..3b9ed02 100644
--- a/app/bin/doption.c
+++ b/app/bin/doption.c
@@ -35,6 +35,7 @@ static paramIntegerRange_t i1_64 = { 1, 64 };
static paramIntegerRange_t i1_100 = { 1, 100 };
static paramIntegerRange_t i1_256 = { 1, 256 };
static paramIntegerRange_t i0_10000 = { 0, 10000 };
+static paramIntegerRange_t i0_99 = { 0, 99};
static paramIntegerRange_t i1_1000 = { 1, 1000 };
static paramIntegerRange_t i10_1000 = { 10, 1000 };
static paramIntegerRange_t i10_100 = { 10, 100 };
@@ -45,11 +46,15 @@ static paramFloatRange_t r0_180 = { 0, 180 };
static void UpdatePrefD( void );
static void UpdateMeasureFmt(void);
+static void UpdateAutoSaveInterval(long);
+static void UpdateChkPtInterval(long);
static wIndex_t distanceFormatInx;
EXPORT long enableBalloonHelp = 1;
+EXPORT long showFlexTrack = 1;
+
long GetChanges( paramGroup_p pg )
{
long changes;
@@ -62,21 +67,18 @@ long GetChanges( paramGroup_p pg )
return changes;
}
+static paramGroup_t prefPG;
+
+
static void OptionDlgUpdate(
paramGroup_p pg,
int inx,
void * valueP )
{
- int quickMoveOld;
if ( inx < 0 ) return;
if ( pg->paramPtr[inx].valueP == &enableBalloonHelp ) {
wEnableBalloonHelp((wBool_t)*(long*)valueP);
- } else if ( pg->paramPtr[inx].valueP == &quickMove ) {
- quickMoveOld = (int)quickMove;
- quickMove = *(long*)valueP;
- UpdateQuickMove(NULL);
- quickMove = quickMoveOld;
} else {
if (pg->paramPtr[inx].valueP == &units) {
UpdatePrefD();
@@ -84,6 +86,28 @@ static void OptionDlgUpdate(
if (pg->paramPtr[inx].valueP == &distanceFormatInx) {
UpdateMeasureFmt();
}
+ if (pg->paramPtr[inx].valueP == &showFlexTrack) {
+ DoChangeNotification(CHANGE_PARAMS|CHANGE_TOOLBAR);
+ }
+ if (pg->paramPtr[inx].valueP == &checkPtInterval) {
+ checkPtInterval = *(long *)valueP;
+ if (checkPtInterval == 0 ) {
+ wControlSetBalloon( pg->paramPtr[inx].control, 0, -5, _("Turning off AutoSave") );
+ UpdateAutoSaveInterval(0);
+ } else {
+ wControlSetBalloon( pg->paramPtr[inx].control, 0, -5, NULL );
+ }
+ }
+ if (pg->paramPtr[inx].valueP == &autosaveChkPoints) {
+ autosaveChkPoints = *(long *)valueP;
+ if (checkPtInterval == 0 && autosaveChkPoints>0 ) {
+ wControlSetBalloon( pg->paramPtr[inx].control, 0, -5, _("Turning on CheckPointing") );
+ UpdateChkPtInterval(10);
+ } else {
+ wControlSetBalloon( pg->paramPtr[inx].control, 0, -5, NULL );
+ }
+
+ }
}
}
@@ -91,7 +115,6 @@ static void OptionDlgCancel(
wWin_p win )
{
wEnableBalloonHelp( (int)enableBalloonHelp );
- UpdateQuickMove(NULL);
wHide( win );
}
@@ -113,15 +136,19 @@ static char * drawCenterCircle[] = { N_("Off"), N_("On"), NULL };
static char * labelEnableLabels[] = { N_("Track Descriptions"), N_("Lengths"), N_("EndPt Elevations"), N_("Track Elevations"), N_("Cars"), NULL };
static char * hotBarLabelsLabels[] = { N_("Part No"), N_("Descr"), NULL };
static char * listLabelsLabels[] = { N_("Manuf"), N_("Part No"), N_("Descr"), NULL };
-static char * colorLayersLabels[] = { N_("Tracks"), N_("Other"), NULL };
+static char * colorTrackLabels[] = { N_("Object"), N_("Layer"), NULL };
+static char * colorDrawLabels[] = { N_("Object"), N_("Layer"), NULL };
static char * liveMapLabels[] = { N_("Live Map"), NULL };
static char * hideTrainsInTunnelsLabels[] = { N_("Hide Trains On Hidden Track"), NULL };
-static char * zoomCornerLabels[] = {N_("Zoom keeps lower corner in view"), NULL};
+static char * constrainMainLabels[] = {N_("Constrain Drawing Area to Room boundaries"), NULL};
extern long trainPause;
+
+
static paramData_t displayPLs[] = {
- { PD_TOGGLE, &colorLayers, "color-layers", PDO_NOPSHUPD|PDO_DRAW, colorLayersLabels, N_("Color Layers"), BC_HORZ, (void*)(CHANGE_MAIN) },
+ { PD_RADIO, &colorTrack, "color-track", PDO_NOPSHUPD|PDO_DRAW, colorTrackLabels, N_("Color Track"), BC_HORZ, (void*)(CHANGE_MAIN) },
+ { PD_RADIO, &colorDraw, "color-draw", PDO_NOPSHUPD|PDO_DRAW, colorDrawLabels, N_("Color Draw"), BC_HORZ, (void*)(CHANGE_MAIN) },
{ PD_RADIO, &drawTunnel, "tunnels", PDO_NOPSHUPD|PDO_DRAW, drawTunnelLabels, N_("Draw Tunnel"), BC_HORZ, (void*)(CHANGE_MAIN) },
{ PD_RADIO, &drawEndPtV, "endpt", PDO_NOPSHUPD|PDO_DRAW, drawEndPtLabels3, N_("Draw EndPts"), BC_HORZ, (void*)(CHANGE_MAIN) },
{ PD_RADIO, &drawUnconnectedEndPt, "unconnected-endpt", PDO_NOPSHUPD|PDO_DRAW, drawEndPtUnconnectedSize, N_("Draw Unconnected EndPts"), BC_HORZ, (void*)(CHANGE_MAIN) },
@@ -129,7 +156,7 @@ static paramData_t displayPLs[] = {
{ PD_RADIO, &centerDrawMode, "centerdraw", PDO_NOPSHUPD|PDO_DRAW, drawCenterCircle, N_("Draw Centers"), BC_HORZ, (void*)(CHANGE_MAIN | CHANGE_MAP) },
{ PD_LONG, &twoRailScale, "tworailscale", PDO_NOPSHUPD, &i1_64, N_("Two Rail Scale"), 0, (void*)(CHANGE_MAIN) },
{ PD_LONG, &mapScale, "mapscale", PDO_NOPSHUPD, &i1_256, N_("Map Scale"), 0, (void*)(CHANGE_MAP) },
- { PD_TOGGLE, &zoomCorner, "zoom-corner", PDO_NOPSHUPD, zoomCornerLabels, "", BC_HORZ },
+ { PD_TOGGLE, &constrainMain, "constrainmain", PDO_NOPSHUPD, constrainMainLabels, "", BC_HORZ },
{ PD_TOGGLE, &liveMap, "livemap", PDO_NOPSHUPD, liveMapLabels, "", BC_HORZ },
{ PD_TOGGLE, &autoPan, "autoPan", PDO_NOPSHUPD, autoPanLabels, "", BC_HORZ },
{ PD_TOGGLE, &labelEnable, "labelenable", PDO_NOPSHUPD, labelEnableLabels, N_("Label Enable"), 0, (void*)(CHANGE_MAIN) },
@@ -139,7 +166,7 @@ static paramData_t displayPLs[] = {
{ PD_TOGGLE, &layoutLabels, "layoutlabels", PDO_NOPSHUPD, listLabelsLabels, N_("Layout Labels"), BC_HORZ, (void*)(CHANGE_MAIN) },
{ PD_TOGGLE, &listLabels, "listlabels", PDO_NOPSHUPD, listLabelsLabels, N_("List Labels"), BC_HORZ, (void*)(CHANGE_PARAMS) },
/* ATTENTION: update the define below if you add entries above */
-#define I_HOTBARLABELS (17)
+#define I_HOTBARLABELS (18)
{ PD_DROPLIST, &carHotbarModeInx, "carhotbarlabels", PDO_NOPSHUPD|PDO_DLGUNDERCMDBUTT|PDO_LISTINDEX, (void*)250, N_("Car Labels"), 0, (void*)CHANGE_SCALE },
{ PD_LONG, &trainPause, "trainpause", PDO_NOPSHUPD, &i10_1000 , N_("Train Update Delay"), 0, 0 },
{ PD_TOGGLE, &hideTrainsInTunnels, "hideTrainsInTunnels", PDO_NOPSHUPD, hideTrainsInTunnelsLabels, "", BC_HORZ }
@@ -178,6 +205,7 @@ static void DoDisplay( void * junk )
wListAddValue( (wList_p)displayPLs[I_HOTBARLABELS].control, _("Manuf/Proto/Part Number"), NULL, (void*)0x0321 );
wListAddValue( (wList_p)displayPLs[I_HOTBARLABELS].control, _("Manuf/Proto/Partno/Item"), NULL, (void*)0x4321 );
}
+
ParamLoadControls( &displayPG );
wShow( displayW );
#ifdef LATER
@@ -204,13 +232,9 @@ EXPORT addButtonCallBack_t DisplayInit( void )
static wWin_p cmdoptW;
-static char * moveQlabels[] = {
- N_("Normal"),
- N_("Simple"),
- N_("End-Points"),
- NULL };
-
static char * preSelectLabels[] = { N_("Properties"), N_("Select"), NULL };
+static char * selectLabels[] = { N_("Single item selected, +Ctrl Add to selection"), N_("Add to selection, +Ctrl Single item selected"), NULL };
+static char * selectZeroLabels[] = { N_("Deselect all on select nothing"), NULL };
#ifdef HIDESELECTIONWINDOW
static char * hideSelectionWindowLabels[] = { N_("Hide"), NULL };
@@ -218,17 +242,16 @@ static char * hideSelectionWindowLabels[] = { N_("Hide"), NULL };
static char * rightClickLabels[] = {N_("Normal: Command List, Shift: Command Options"), N_("Normal: Command Options, Shift: Command List"), NULL };
EXPORT paramData_t cmdoptPLs[] = {
- { PD_RADIO, &quickMove, "move-quick", PDO_NOPSHUPD, moveQlabels, N_("Draw Moving Tracks"), BC_HORZ },
{ PD_RADIO, &preSelect, "preselect", PDO_NOPSHUPD, preSelectLabels, N_("Default Command"), BC_HORZ },
#ifdef HIDESELECTIONWINDOW
{ PD_TOGGLE, &hideSelectionWindow, PDO_NOPSHUPD, hideSelectionWindowLabels, N_("Hide Selection Window"), BC_HORZ },
#endif
- { PD_RADIO, &rightClickMode, "rightclickmode", PDO_NOPSHUPD, rightClickLabels, N_("Right Click"), 0 }
+ { PD_RADIO, &rightClickMode, "rightclickmode", PDO_NOPSHUPD, rightClickLabels, N_("Right Click"), 0 },
+ { PD_RADIO, &selectMode, "selectmode", PDO_NOPSHUPD, selectLabels, N_("Select Mode"), 0},
+ { PD_TOGGLE, &selectZero, "selectzero", PDO_NOPSHUPD, selectZeroLabels, "", 0 }
};
static paramGroup_t cmdoptPG = { "cmdopt", PGO_RECORD|PGO_PREFMISC, cmdoptPLs, sizeof cmdoptPLs/sizeof cmdoptPLs[0] };
-EXPORT paramData_p moveQuickPD = &cmdoptPLs[0];
-
static void CmdoptOk( void * junk )
{
long changes;
@@ -275,6 +298,7 @@ static long displayUnits;
static char * unitsLabels[] = { N_("English"), N_("Metric"), NULL };
static char * angleSystemLabels[] = { N_("Polar"), N_("Cartesian"), NULL };
static char * enableBalloonHelpLabels[] = { N_("Balloon Help"), NULL };
+static char * enableFlexTrackLabels[] = { N_("Show FlexTrack in HotBar"), NULL };
static char * startOptions[] = { N_("Load Last Layout"), N_("Start New Layout"), NULL };
static paramData_t prefPLs[] = {
@@ -288,10 +312,14 @@ static paramData_t prefPLs[] = {
{ PD_FLOAT, &turntableAngle, "turntable-angle", PDO_NOPSHUPD, &r0_180, N_("Turntable Angle") },
{ PD_LONG, &maxCouplingSpeed, "coupling-speed-max", PDO_NOPSHUPD, &i10_100, N_("Max Coupling Speed"), 0 },
{ PD_TOGGLE, &enableBalloonHelp, "balloonhelp", PDO_NOPSHUPD, enableBalloonHelpLabels, "", BC_HORZ },
+ { PD_TOGGLE, &showFlexTrack, "showflextrack", PDO_NOPSHUPD, enableFlexTrackLabels, "", BC_HORZ},
{ PD_LONG, &dragPixels, "dragpixels", PDO_NOPSHUPD|PDO_DRAW, &i1_1000, N_("Drag Distance") },
{ PD_LONG, &dragTimeout, "dragtimeout", PDO_NOPSHUPD|PDO_DRAW, &i1_1000, N_("Drag Timeout") },
{ PD_LONG, &minGridSpacing, "mingridspacing", PDO_NOPSHUPD|PDO_DRAW, &i1_100, N_("Min Grid Spacing"), 0, 0 },
- { PD_LONG, &checkPtInterval, "checkpoint", PDO_NOPSHUPD|PDO_FILE, &i0_10000, N_("Check Point") },
+#define I_CHKPT (13)
+ { PD_LONG, &checkPtInterval, "checkpoint", PDO_NOPSHUPD|PDO_FILE, &i0_10000, N_("Check Point Frequency") },
+#define I_AUTOSAVE (14)
+ { PD_LONG, &autosaveChkPoints, "autosave", PDO_NOPSHUPD|PDO_FILE, &i0_99, N_("Autosave Checkpoint Frequency") },
{ PD_RADIO, &onStartup, "onstartup", PDO_NOPSHUPD, startOptions, N_("On Program Startup"), 0, NULL }
};
static paramGroup_t prefPG = { "pref", PGO_RECORD|PGO_PREFMISC, prefPLs, sizeof prefPLs/sizeof prefPLs[0] };
@@ -302,6 +330,7 @@ typedef struct {
long fmt;
} dstFmts_t;
static dstFmts_t englishDstFmts[] = {
+ { N_("999.999"), DISTFMT_FMT_NONE|DISTFMT_FRACT_NUM|3 },
{ N_("999.999999"), DISTFMT_FMT_NONE|DISTFMT_FRACT_NUM|6 },
{ N_("999.99999"), DISTFMT_FMT_NONE|DISTFMT_FRACT_NUM|5 },
{ N_("999.9999"), DISTFMT_FMT_NONE|DISTFMT_FRACT_NUM|4 },
@@ -339,10 +368,23 @@ static dstFmts_t metricDstFmts[] = {
{ NULL, 0 },
{ NULL, 0 },
{ NULL, 0 },
- { NULL, 0 },
{ NULL, 0 } };
static dstFmts_t *dstFmts[] = { englishDstFmts, metricDstFmts };
+void UpdateAutoSaveInterval(long value)
+{
+ autosaveChkPoints = value;
+ ParamLoadControl(&prefPG, I_AUTOSAVE);
+ ParamLoadControl(&prefPG, I_CHKPT);
+}
+
+void UpdateChkPtInterval(long value)
+{
+ checkPtInterval = value;
+ ParamLoadControl(&prefPG, I_AUTOSAVE);
+ ParamLoadControl(&prefPG, I_CHKPT);
+}
+
/**
* Load the selection list for number formats with the appropriate list of variants.
*/