1
0
Fork 0

make <Esc> key close/cancel/dismiss dialogs; some material.nas tweaking

(Reminder: --aircraft=bo105 ... press Ctrl-C  :-)
This commit is contained in:
mfranz 2005-11-05 14:19:53 +00:00
parent 9c49dccd5b
commit a3984ccabd
2 changed files with 31 additions and 13 deletions

View file

@ -169,6 +169,7 @@ showWeightDialog = func {
ok = buttonBar.addChild("button"); ok = buttonBar.addChild("button");
ok.set("legend", "OK"); ok.set("legend", "OK");
ok.set("keynum", 27);
ok.prop().getNode("binding[0]/command", 1).setValue("dialog-apply"); ok.prop().getNode("binding[0]/command", 1).setValue("dialog-apply");
ok.prop().getNode("binding[1]/command", 1).setValue("dialog-close"); ok.prop().getNode("binding[1]/command", 1).setValue("dialog-close");
@ -350,6 +351,7 @@ showHelpDialog = func {
w.set("pref-height", 16); w.set("pref-height", 16);
w.set("legend", ""); w.set("legend", "");
w.set("default", 1); w.set("default", 1);
w.set("keynum", 27);
w.prop().getNode("binding[0]/command", 1).setValue("nasal"); w.prop().getNode("binding[0]/command", 1).setValue("nasal");
w.prop().getNode("binding[0]/script", 1).setValue("delete(gui.dialog, \"" ~ name ~ "\")"); w.prop().getNode("binding[0]/script", 1).setValue("delete(gui.dialog, \"" ~ name ~ "\")");
w.prop().getNode("binding[1]/command", 1).setValue("dialog-close"); w.prop().getNode("binding[1]/command", 1).setValue("dialog-close");

View file

@ -57,16 +57,22 @@ colorgroup = func {
undef = func { props.globals.getNode(base ~ name ~ "/" ~ arg[0]) == nil }; undef = func { props.globals.getNode(base ~ name ~ "/" ~ arg[0]) == nil };
if (undef("red") and undef("green") and undef("blue")) { if (undef("red") and undef("green") and undef("blue")) {
return; return 0;
} }
if (arg[3] != nil) {
parent.addChild("hrule").setColor(1, 1, 1, 0.5);
}
grp = parent.addChild("group"); grp = parent.addChild("group");
grp.set("layout", "hbox"); grp.set("layout", "vbox");
grp.addChild("text").set("label", "_______" ~ name ~ "_______"); grp.addChild("text").set("label", name);
foreach (color; ["red", "green", "blue", "factor"]) { foreach (color; ["red", "green", "blue", "factor"]) {
mat(parent, color, base ~ name ~ "/" ~ color, "%.3f"); mat(parent, color, base ~ name ~ "/" ~ color, "%.3f");
} }
mat(parent, "offset", base ~ name ~ "/" ~ "offset", "%.3f", -1.0, 1.0); mat(parent, "offset", base ~ name ~ "/" ~ "offset", "%.3f", -1.0, 1.0);
return 1;
} }
@ -128,8 +134,7 @@ showDialog = func {
titlebar = dialog.addChild("group"); titlebar = dialog.addChild("group");
titlebar.set("layout", "hbox"); titlebar.set("layout", "hbox");
w = titlebar.addChild("text"); w = titlebar.addChild("text");
w.set("label", "[" ~ title ~ "]"); w.set("label", "object \"" ~ title ~ "\"");
w.setFont("Helvetica", 17);
titlebar.addChild("empty").set("stretch", 1); titlebar.addChild("empty").set("stretch", 1);
w = titlebar.addChild("button"); w = titlebar.addChild("button");
@ -137,31 +142,40 @@ showDialog = func {
w.set("pref-height", 16); w.set("pref-height", 16);
w.set("legend", ""); w.set("legend", "");
w.set("default", 1); w.set("default", 1);
w.set("keynum", 27);
w.set("border", 1); w.set("border", 1);
w.prop().getNode("binding[0]/command", 1).setValue("dialog-close"); w.prop().getNode("binding[0]/command", 1).setValue("dialog-close");
dialog.setColor(1.0, 0.95, 0.7, 0.5); h = 0;
h += colorgroup(dialog, "diffuse", base, h);
colorgroup(dialog, "diffuse", base); h += colorgroup(dialog, "ambient", base, h);
colorgroup(dialog, "ambient", base); h += colorgroup(dialog, "emission", base, h);
colorgroup(dialog, "emission", base); h += colorgroup(dialog, "specular", base, h);
colorgroup(dialog, "specular", base);
undef = func { props.globals.getNode(base ~ arg[0]) == nil }; undef = func { props.globals.getNode(base ~ arg[0]) == nil };
if (!(undef("shininess") and undef("transparency/alpha") and undef("threshold"))) { if (!(undef("shininess") and undef("transparency/alpha") and undef("threshold"))) {
if (h) {
dialog.addChild("hrule").setColor(1, 1, 1, 0.5);
}
w = dialog.addChild("group"); w = dialog.addChild("group");
w.set("layout", "hbox"); w.set("layout", "hbox");
w.addChild("text").set("label", "_________misc_________"); w.addChild("text").set("label", "misc");
mat(dialog, "shi", base ~ "shininess", "%.0f", 0.0, 128.0); mat(dialog, "shi", base ~ "shininess", "%.0f", 0.0, 128.0);
mat(dialog, "alpha", base ~ "transparency/alpha", "%.3f"); mat(dialog, "alpha", base ~ "transparency/alpha", "%.3f");
mat(dialog, "thresh", base ~ "threshold", "%.3f"); mat(dialog, "thresh", base ~ "threshold", "%.3f");
h += 1;
} }
if (!undef("texture")) { if (!undef("texture")) {
if (h) {
dialog.addChild("hrule").setColor(1, 1, 1, 0.5);
}
w = dialog.addChild("group"); w = dialog.addChild("group");
w.set("layout", "hbox"); w.set("layout", "hbox");
w.addChild("text").set("label", "_______texture_______"); w.addChild("text").set("label", "texture");
w = dialog.addChild("input"); w = dialog.addChild("input");
w.set("live", 1); w.set("live", 1);
@ -171,6 +185,8 @@ showDialog = func {
} }
dialog.addChild("empty").set("pref-height", "3"); dialog.addChild("empty").set("pref-height", "3");
dialog.setColor(0.6, 0.6, 0.6, 0.6);
fgcommand("dialog-new", dialog.prop()); fgcommand("dialog-new", dialog.prop());
gui.showDialog(name); gui.showDialog(name);
} }