|
|
|
@ -7,8 +7,9 @@ const LOCO_F_CARGO = 0x0010;
|
|
|
|
const LOCO_F_CANREVERSE = 0x0020;
|
|
|
|
const LOCO_F_CANREVERSE = 0x0020;
|
|
|
|
const LOCO_F_SHORTTRAIN = 0x0040;
|
|
|
|
const LOCO_F_SHORTTRAIN = 0x0040;
|
|
|
|
const LOCO_F_AUTO = 0x0100;
|
|
|
|
const LOCO_F_AUTO = 0x0100;
|
|
|
|
const LOCO_F_RANDOM = 0x0200;
|
|
|
|
const LOCO_F_AUTOSHED = 0x0200;
|
|
|
|
const LOCO_F_AUTOSTOP = 0x0400;
|
|
|
|
const LOCO_F_AUTORANDOM = 0x0400;
|
|
|
|
|
|
|
|
const LOCO_F_AUTOSTOP = 0x0800;
|
|
|
|
|
|
|
|
|
|
|
|
var locomotives = [];
|
|
|
|
var locomotives = [];
|
|
|
|
|
|
|
|
|
|
|
|
@ -150,7 +151,7 @@ function locodetail_show(loconame) {
|
|
|
|
|
|
|
|
|
|
|
|
if (!win) {
|
|
|
|
if (!win) {
|
|
|
|
console.log ("loco_showdetail create window");
|
|
|
|
console.log ("loco_showdetail create window");
|
|
|
|
win = gWindowCreate("locodetail", "Locomotive", 450, 500,
|
|
|
|
win = gWindowCreate("locodetail", "Locomotive", 450, 550,
|
|
|
|
"<div style=\"float: left\"> \
|
|
|
|
"<div style=\"float: left\"> \
|
|
|
|
Name: <input id=\"locodet_name\" style=\"width: 100\"> \
|
|
|
|
Name: <input id=\"locodet_name\" style=\"width: 100\"> \
|
|
|
|
</div> <div style=\"float: right\"> \
|
|
|
|
</div> <div style=\"float: right\"> \
|
|
|
|
@ -164,7 +165,8 @@ function locodetail_show(loconame) {
|
|
|
|
</div> <hr>\
|
|
|
|
</div> <hr>\
|
|
|
|
<div><table><tr><td> \
|
|
|
|
<div><table><tr><td> \
|
|
|
|
<label><input id=\"locodet_auto\" type=\"checkbox\" value=\"\" disabled>Auto</label><br> \
|
|
|
|
<label><input id=\"locodet_auto\" type=\"checkbox\" value=\"\" disabled>Auto</label><br> \
|
|
|
|
<label><input id=\"locodet_random\" type=\"checkbox\" value=\"\" disabled>Random</label><br> \
|
|
|
|
<label><input id=\"locodet_autoshed\" type=\"checkbox\" value=\"\" disabled>Sheduler</label><br> \
|
|
|
|
|
|
|
|
<label><input id=\"locodet_autorandom\" type=\"checkbox\" value=\"\" disabled>Random</label><br> \
|
|
|
|
</td><td> \
|
|
|
|
</td><td> \
|
|
|
|
<label><input id=\"locodet_short\" type=\"checkbox\" value=\"\">Short Train</label><br> \
|
|
|
|
<label><input id=\"locodet_short\" type=\"checkbox\" value=\"\">Short Train</label><br> \
|
|
|
|
<label><input id=\"locodet_canreverse\" type=\"checkbox\" value=\"\">Can Reverse</label><br> \
|
|
|
|
<label><input id=\"locodet_canreverse\" type=\"checkbox\" value=\"\">Can Reverse</label><br> \
|
|
|
|
@ -461,7 +463,8 @@ function locodetail_setData(elm) {
|
|
|
|
var loco_short = document.getElementById("locodet_short");
|
|
|
|
var loco_short = document.getElementById("locodet_short");
|
|
|
|
var loco_cargo = document.getElementById("locodet_cargo");
|
|
|
|
var loco_cargo = document.getElementById("locodet_cargo");
|
|
|
|
var loco_auto = document.getElementById("locodet_auto");
|
|
|
|
var loco_auto = document.getElementById("locodet_auto");
|
|
|
|
var loco_random = document.getElementById("locodet_random");
|
|
|
|
var loco_autorandom = document.getElementById("locodet_autorandom");
|
|
|
|
|
|
|
|
var loco_autoshed = document.getElementById("locodet_autoshed");
|
|
|
|
var loco_blockassign = document.getElementById("locodet_blockassign");
|
|
|
|
var loco_blockassign = document.getElementById("locodet_blockassign");
|
|
|
|
var loco_blockdest = document.getElementById("locodet_blockdest");
|
|
|
|
var loco_blockdest = document.getElementById("locodet_blockdest");
|
|
|
|
var loco_blocknext = document.getElementById("locodet_blocknext");
|
|
|
|
var loco_blocknext = document.getElementById("locodet_blocknext");
|
|
|
|
@ -500,16 +503,20 @@ function locodetail_setData(elm) {
|
|
|
|
if (Number(elm.flags) & LOCO_F_AUTO) loco_auto.checked = true;
|
|
|
|
if (Number(elm.flags) & LOCO_F_AUTO) loco_auto.checked = true;
|
|
|
|
else loco_auto.checked = false;
|
|
|
|
else loco_auto.checked = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (loco_random) {
|
|
|
|
if (loco_autorandom) {
|
|
|
|
if (Number(elm.flags) & LOCO_F_RANDOM) loco_random.checked = true;
|
|
|
|
if (Number(elm.flags) & LOCO_F_AUTORANDOM) loco_autorandom.checked = true;
|
|
|
|
else loco_random.checked = false;
|
|
|
|
else loco_autorandom.checked = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (loco_autoshed) {
|
|
|
|
|
|
|
|
if (Number(elm.flags) & LOCO_F_AUTOSHED) loco_autoshed.checked = true;
|
|
|
|
|
|
|
|
else loco_autoshed.checked = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (loco_blockassign) loco_blockassign.value = elm.blockassign;
|
|
|
|
if (loco_blockassign) loco_blockassign.value = elm.blockassign;
|
|
|
|
if (loco_blockdest) loco_blockdest.value = elm.blockdest;
|
|
|
|
if (loco_blockdest) loco_blockdest.value = elm.blockdest;
|
|
|
|
if (loco_blocknext) loco_blocknext.value = elm.blocknext;
|
|
|
|
if (loco_blocknext) loco_blocknext.value = elm.blocknext;
|
|
|
|
if (loco_blockprev) loco_blockprev.value = elm.blockprev;
|
|
|
|
if (loco_blockprev) loco_blockprev.value = elm.blockprev;
|
|
|
|
if (loco_schedway && elm.schedway) loco_schedway.value = elm.schedway;
|
|
|
|
if (loco_schedway && elm.schedway) loco_schedway.value = elm.schedway;
|
|
|
|
else loco_schedway.value = "";
|
|
|
|
else if (loco_shedway) loco_schedway.value = "";
|
|
|
|
if (loco_auto_way) loco_auto_way.value = elm.auto_way;
|
|
|
|
if (loco_auto_way) loco_auto_way.value = elm.auto_way;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -675,8 +682,11 @@ function lococtrl_show(name) {
|
|
|
|
<td align=center><input id=\"lococtrl_"+name+"_cbauto\" type=\"checkbox\" value=\"\" disabled></td>\
|
|
|
|
<td align=center><input id=\"lococtrl_"+name+"_cbauto\" type=\"checkbox\" value=\"\" disabled></td>\
|
|
|
|
<td><button id=\"lococtrl_"+name+"_btnauto\" type=\"button\" value=\"vstop\">AUTO</button></td> \
|
|
|
|
<td><button id=\"lococtrl_"+name+"_btnauto\" type=\"button\" value=\"vstop\">AUTO</button></td> \
|
|
|
|
</tr><tr> \
|
|
|
|
</tr><tr> \
|
|
|
|
<td align=center><input id=\"lococtrl_"+name+"_cbrand\" type=\"checkbox\" value=\"\" disabled></td>\
|
|
|
|
<td align=center><input id=\"lococtrl_"+name+"_cbautoshed\" type=\"checkbox\" value=\"\" disabled></td>\
|
|
|
|
<td><button id=\"lococtrl_"+name+"_btnrand\" type=\"button\" value=\"vstop\">RAND</button></td> \
|
|
|
|
<td><button id=\"lococtrl_"+name+"_btnautoshed\" type=\"button\" value=\"vstop\">SHED</button></td> \
|
|
|
|
|
|
|
|
</tr><tr> \
|
|
|
|
|
|
|
|
<td align=center><input id=\"lococtrl_"+name+"_cbautorand\" type=\"checkbox\" value=\"\" disabled></td>\
|
|
|
|
|
|
|
|
<td><button id=\"lococtrl_"+name+"_btnautorand\" type=\"button\" value=\"vstop\">RAND</button></td> \
|
|
|
|
</tr> \
|
|
|
|
</tr> \
|
|
|
|
</table></fieldset> \
|
|
|
|
</table></fieldset> \
|
|
|
|
</td><tr></table>\
|
|
|
|
</td><tr></table>\
|
|
|
|
@ -697,7 +707,8 @@ function lococtrl_show(name) {
|
|
|
|
gAddEventListener("lococtrl_"+name+"_btnman", 'click', lococtrl_cb_btnman);
|
|
|
|
gAddEventListener("lococtrl_"+name+"_btnman", 'click', lococtrl_cb_btnman);
|
|
|
|
gAddEventListener("lococtrl_"+name+"_btnstopman", 'click', lococtrl_cb_btnstopman);
|
|
|
|
gAddEventListener("lococtrl_"+name+"_btnstopman", 'click', lococtrl_cb_btnstopman);
|
|
|
|
gAddEventListener("lococtrl_"+name+"_btnauto", 'click', lococtrl_cb_btnauto);
|
|
|
|
gAddEventListener("lococtrl_"+name+"_btnauto", 'click', lococtrl_cb_btnauto);
|
|
|
|
gAddEventListener("lococtrl_"+name+"_btnrand", 'click', lococtrl_cb_btnrand);
|
|
|
|
gAddEventListener("lococtrl_"+name+"_btnautorand", 'click', lococtrl_cb_btnautorand);
|
|
|
|
|
|
|
|
gAddEventListener("lococtrl_"+name+"_btnautoshed", 'click', lococtrl_cb_btnautoshed);
|
|
|
|
|
|
|
|
|
|
|
|
gAddEventListener("lococtrl_"+name+"_RANGE", 'click', lococtrl_speed);
|
|
|
|
gAddEventListener("lococtrl_"+name+"_RANGE", 'click', lococtrl_speed);
|
|
|
|
gAddEventListener("lococtrl_"+name+"_REVBTN", 'click', lococtrl_reverse);
|
|
|
|
gAddEventListener("lococtrl_"+name+"_REVBTN", 'click', lococtrl_reverse);
|
|
|
|
@ -710,7 +721,6 @@ function lococtrl_show(name) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function lococtrl_cb_btnreset() {
|
|
|
|
function lococtrl_cb_btnreset() {
|
|
|
|
var name = getTextBetween(this.id, "lococtrl_", "_btnreset");
|
|
|
|
var name = getTextBetween(this.id, "lococtrl_", "_btnreset");
|
|
|
|
var request = { command: "locomotivereset", locomotive: name };
|
|
|
|
var request = { command: "locomotivereset", locomotive: name };
|
|
|
|
@ -742,13 +752,20 @@ function lococtrl_cb_btnauto() {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function lococtrl_cb_btnrand() {
|
|
|
|
function lococtrl_cb_btnautorand() {
|
|
|
|
var name = getTextBetween(this.id, "lococtrl_", "_btnauto");
|
|
|
|
var name = getTextBetween(this.id, "lococtrl_", "_btnautorand");
|
|
|
|
var request = { command: "locomotivesetautorand", locomotive: name };
|
|
|
|
var request = { command: "locomotivesetautorand", locomotive: name };
|
|
|
|
serverinout (request, serverinout_defaultCallback);
|
|
|
|
serverinout (request, serverinout_defaultCallback);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function lococtrl_cb_btnautoshed() {
|
|
|
|
|
|
|
|
var name = getTextBetween(this.id, "lococtrl_", "_btnautoshed");
|
|
|
|
|
|
|
|
var request = { command: "locomotivesetautoshed", locomotive: name };
|
|
|
|
|
|
|
|
serverinout (request, serverinout_defaultCallback);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function lococtrl_reverse() {
|
|
|
|
function lococtrl_reverse() {
|
|
|
|
var name = getTextBetween(this.id, "lococtrl_", "_REVBTN");
|
|
|
|
var name = getTextBetween(this.id, "lococtrl_", "_REVBTN");
|
|
|
|
var reverse;
|
|
|
|
var reverse;
|
|
|
|
@ -813,12 +830,14 @@ function lococtrl_setData(data) {
|
|
|
|
var range = document.getElementById("lococtrl_"+data.name+"_RANGE");
|
|
|
|
var range = document.getElementById("lococtrl_"+data.name+"_RANGE");
|
|
|
|
var reverse = document.getElementById("lococtrl_"+data.name+"_REVBTN");
|
|
|
|
var reverse = document.getElementById("lococtrl_"+data.name+"_REVBTN");
|
|
|
|
var cbauto = document.getElementById("lococtrl_"+data.name+"_cbauto");
|
|
|
|
var cbauto = document.getElementById("lococtrl_"+data.name+"_cbauto");
|
|
|
|
var cbrand = document.getElementById("lococtrl_"+data.name+"_cbrand");
|
|
|
|
var cbautorand = document.getElementById("lococtrl_"+data.name+"_cbautorand");
|
|
|
|
|
|
|
|
var cbautoshed = document.getElementById("lococtrl_"+data.name+"_cbautoshed");
|
|
|
|
var cbmanstop = document.getElementById("lococtrl_"+data.name+"_cbstopman");
|
|
|
|
var cbmanstop = document.getElementById("lococtrl_"+data.name+"_cbstopman");
|
|
|
|
var btnman = document.getElementById("lococtrl_"+data.name+"_btnman");
|
|
|
|
var btnman = document.getElementById("lococtrl_"+data.name+"_btnman");
|
|
|
|
var btnautostop = document.getElementById("lococtrl_"+data.name+"_btnstopman");
|
|
|
|
var btnautostop = document.getElementById("lococtrl_"+data.name+"_btnstopman");
|
|
|
|
var btnauto = document.getElementById("lococtrl_"+data.name+"_btnauto");
|
|
|
|
var btnauto = document.getElementById("lococtrl_"+data.name+"_btnauto");
|
|
|
|
var btnautorand = document.getElementById("lococtrl_"+data.name+"_btnrand");
|
|
|
|
var btnautorand = document.getElementById("lococtrl_"+data.name+"_btnautorand");
|
|
|
|
|
|
|
|
var btnautoshed = document.getElementById("lococtrl_"+data.name+"_btnautoshed");
|
|
|
|
|
|
|
|
|
|
|
|
if (range && reverse) {
|
|
|
|
if (range && reverse) {
|
|
|
|
console.log ("lococtrl: " + data.name + " speed:" + data.speed + " vmax:" +
|
|
|
|
console.log ("lococtrl: " + data.name + " speed:" + data.speed + " vmax:" +
|
|
|
|
@ -827,24 +846,28 @@ function lococtrl_setData(data) {
|
|
|
|
else reverse.innerHTML = "FWD";
|
|
|
|
else reverse.innerHTML = "FWD";
|
|
|
|
|
|
|
|
|
|
|
|
cbauto.checked = (data.flags & LOCO_F_AUTO);
|
|
|
|
cbauto.checked = (data.flags & LOCO_F_AUTO);
|
|
|
|
cbrand.checked = (data.flags & LOCO_F_RANDOM);
|
|
|
|
cbautorand.checked = (data.flags & LOCO_F_AUTORANDOM);
|
|
|
|
|
|
|
|
cbautoshed.checked = (data.flags & LOCO_F_AUTOSHED);
|
|
|
|
cbmanstop.checked = (data.flags & LOCO_F_AUTOSTOP);
|
|
|
|
cbmanstop.checked = (data.flags & LOCO_F_AUTOSTOP);
|
|
|
|
|
|
|
|
|
|
|
|
if (data.flags & LOCO_F_AUTOSTOP) {
|
|
|
|
if (data.flags & LOCO_F_AUTOSTOP) {
|
|
|
|
btnman.disabled = false;
|
|
|
|
btnman.disabled = false;
|
|
|
|
btnauto.disabled = true;
|
|
|
|
btnauto.disabled = true;
|
|
|
|
btnautorand.disabled = true;
|
|
|
|
btnautorand.disabled = true;
|
|
|
|
|
|
|
|
btnautoshed.disabled = true;
|
|
|
|
btnautostop.disabled = true;
|
|
|
|
btnautostop.disabled = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (data.flags & LOCO_F_AUTO) {
|
|
|
|
else if (data.flags & LOCO_F_AUTO) {
|
|
|
|
btnman.disabled = true;
|
|
|
|
btnman.disabled = true;
|
|
|
|
btnautorand.disabled = false;
|
|
|
|
btnautorand.disabled = false;
|
|
|
|
|
|
|
|
btnautoshed.disabled = false;
|
|
|
|
btnautostop.disabled = false;
|
|
|
|
btnautostop.disabled = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
btnman.disabled = true;
|
|
|
|
btnman.disabled = true;
|
|
|
|
btnautorand.disabled = true;
|
|
|
|
btnautorand.disabled = true;
|
|
|
|
btnautostop.disabled = true;
|
|
|
|
btnautostop.disabled = true;
|
|
|
|
|
|
|
|
btnautoshed.disabled = true;
|
|
|
|
btnauto.disabled = false;
|
|
|
|
btnauto.disabled = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|