1
0
Fork 0

- add gui.Widget.setFont(name, size=13, slant=0) method, and use it in

material.nas (fly the bo105 and press Ctrl-c to see font & color changes)
- use new Nasal feature:  i=i+1 --> i+=1
This commit is contained in:
mfranz 2005-05-03 13:45:33 +00:00
parent c40d8da9fb
commit 4d185f250c
2 changed files with 11 additions and 7 deletions

View file

@ -81,8 +81,11 @@ Widget = {
newnode = me.node.getNode(name, 1);
return { parents : [Widget], node : newnode };
},
setColor : func(R, G, B, A = 1) {
me.node.setValues( { color : { red : R, green : G, blue : B, alpha : A } } );
setColor : func(r, g, b, a = 1) {
me.node.setValues({ color : { red:r, green:g, blue:b, alpha:a } });
},
setFont : func(n, s = 13, t = 0) {
me.node.setValues({ font : { name:n, "size":s, slant:t } });
},
};
@ -163,7 +166,7 @@ showWeightDialog = func {
tcell(fuelTable, "text", 0, 4).set("label", "Gallons");
tanks = props.globals.getNode("/consumables/fuel").getChildren("tank");
for(i=0; i<size(tanks); i=i+1) {
for(i=0; i<size(tanks); i+=1) {
t = tanks[i];
tname = i ~ "";
@ -217,7 +220,7 @@ showWeightDialog = func {
tcell(weightTable, "text", 0, 2).set("label", "Pounds");
wgts = props.globals.getNode("/sim").getChildren("weight");
for(i=0; i<size(wgts); i=i+1) {
for(i=0; i<size(wgts); i+=1) {
w = wgts[i];
wname = w.getNode("name", 1).getValue();
max = w.getNode("max-lb", 1).getValue();
@ -329,7 +332,7 @@ showHelpDialog = func {
row = col = 0;
foreach (key; keydefs) {
if (n >= 60 and row >= n / 3 or n >= 16 and row >= n / 2) {
col = col + 1;
col += 1;
row = 0;
}

View file

@ -127,10 +127,11 @@ showDialog = func {
titlebar = dialog.addChild("group");
titlebar.set("layout", "hbox");
titlebar.addChild("text").set("label", "[" ~ title ~ "]");
w = titlebar.addChild("text");
w.set("label", "[" ~ title ~ "]");
w.setFont("Helvetica", 17);
titlebar.addChild("empty").set("stretch", 1);
w = titlebar.addChild("button");
w.set("pref-width", 16);
w.set("pref-height", 16);