| 1 |
FlightGear GUI Mini-HOWTO |
| 2 |
|
| 3 |
David Megginson |
| 4 |
Started: 2003-01-20 |
| 5 |
Last revised: 2003-01-20 |
| 6 |
|
| 7 |
|
| 8 |
FlightGear creates its drop-down menubar and dialog boxes from XML |
| 9 |
configuration files under $FG_ROOT/gui. This document gives a quick |
| 10 |
explanation of how to create or modify the menubar and dialogs. The |
| 11 |
toolkit for the FlightGear GUI is PUI, which is part of plib. |
| 12 |
|
| 13 |
All of the XML files use the standard FlightGear PropertyList format. |
| 14 |
|
| 15 |
|
| 16 |
MENUBAR |
| 17 |
------- |
| 18 |
|
| 19 |
FlightGear reads the configuration for its menubar from |
| 20 |
$FG_ROOT/gui/menubar.xml. The file consists of a series of top-level |
| 21 |
elements named "menu", each of which defines on of the drop-down |
| 22 |
menus, from left to right. Each menu contains a series of items, |
| 23 |
representing the actual items a user can select from the menu, and |
| 24 |
each item has a series of bindings that FlightGear will activate when |
| 25 |
the user selects the item. |
| 26 |
|
| 27 |
Here's a simplified grammar: |
| 28 |
|
| 29 |
[menubar] : menu* |
| 30 |
|
| 31 |
menu : label, item* |
| 32 |
|
| 33 |
item : label, enabled, binding* |
| 34 |
|
| 35 |
The bindings are standard FlightGear bindings, the same as the ones |
| 36 |
used for the keyboard, mouse, joysticks, and the instrument panel. |
| 37 |
Any commands allowed in those bindings are allowed here as well. |
| 38 |
|
| 39 |
Here's an example of a simple menubar with a "File" drop-down menu and |
| 40 |
a single "Quit" item: |
| 41 |
|
| 42 |
<PropertyList> |
| 43 |
|
| 44 |
<menu> |
| 45 |
<label>File</label> |
| 46 |
|
| 47 |
<item> |
| 48 |
<label>Quit</label> |
| 49 |
<binding> |
| 50 |
<command>exit</command> |
| 51 |
</binding> |
| 52 |
</item> |
| 53 |
|
| 54 |
</PropertyList> |
| 55 |
|
| 56 |
PUI menus do not allow advanced features like submenus or checkmarks. |
| 57 |
The most common command to include in a menu item binding is the |
| 58 |
'dialog-show' command, which will open a user-defined dialog box as |
| 59 |
described in the next section. |
| 60 |
|
| 61 |
|
| 62 |
DIALOGS |
| 63 |
------- |
| 64 |
|
| 65 |
The configuration files for XML dialogs use a nested structure to set |
| 66 |
up dialog boxes. The top-level always describes a dialog box, and the |
| 67 |
lower levels describe the groups and widgets that make it up. Here is |
| 68 |
a simple, "hello world" dialog: |
| 69 |
|
| 70 |
<PropertyList> |
| 71 |
|
| 72 |
<name>hello</name> |
| 73 |
|
| 74 |
<width>150</width> |
| 75 |
<height>100</height> |
| 76 |
<modal>false</modal> |
| 77 |
<draggable>true</draggable> |
| 78 |
<resizable>true</resizable> |
| 79 |
|
| 80 |
<text> |
| 81 |
<x>10</x> |
| 82 |
<y>50</y> |
| 83 |
<label>Hello, world</label> |
| 84 |
<color> |
| 85 |
<red>1.0</red> |
| 86 |
<green>0.0</green> |
| 87 |
<blue>0.0</blue> |
| 88 |
</color> |
| 89 |
</text> |
| 90 |
|
| 91 |
<button> |
| 92 |
<x>40</x> |
| 93 |
<y>10</y> |
| 94 |
<legend>Close</legend> |
| 95 |
<binding> |
| 96 |
<command>dialog-close</command> |
| 97 |
</binding> |
| 98 |
</button> |
| 99 |
|
| 100 |
</PropertyList> |
| 101 |
|
| 102 |
The dialog contains two sub-objects: a text field and a button. The |
| 103 |
button contains one binding, which closes the active dialog when the |
| 104 |
user clicks on the button. |
| 105 |
|
| 106 |
Coordinates are pseudo-pixels. The screen is always assumed to be |
| 107 |
1024x768, no matter what the actual resolution is. The origin is the |
| 108 |
bottom left corner of the screen (or parent dialog or group); x goes |
| 109 |
from left to right, and y goes from bottom to top. |
| 110 |
|
| 111 |
All objects, including the top-level dialog, accept the following |
| 112 |
properties, though they will ignore any that are not relevant: |
| 113 |
|
| 114 |
x - the X position of the bottom left corner of the object, in |
| 115 |
pseudo-pixels. The default is to center the dialog. |
| 116 |
|
| 117 |
y - the Y position of the bottom left corner of the object, in |
| 118 |
pseudo-pixels. The default is to center the dialog. |
| 119 |
|
| 120 |
width - the width of the object, in pseudo-pixels. The default is |
| 121 |
the width of the parent container. |
| 122 |
|
| 123 |
height - the height of the object, in pseudo-pixels. The default is |
| 124 |
the width of the parent container. |
| 125 |
|
| 126 |
border - the border thickness, in pseudo-pixels. The default is 2. |
| 127 |
|
| 128 |
color - a subgroup to specify the dialogs color: |
| 129 |
red - specify the red color component of the color scheme. |
| 130 |
green - specify the green color component of the color scheme. |
| 131 |
blue - specify the blue color component of the color scheme. |
| 132 |
alpha - specify the alpha color component of the color scheme. |
| 133 |
|
| 134 |
font - a subgroup to specify a specific font type |
| 135 |
name - the name of the font (excluding it's .txf extension) |
| 136 |
size - size of the font |
| 137 |
slant - the slant of the font (in pseudo-pixels) |
| 138 |
|
| 139 |
legend - the text legend to display in the object. |
| 140 |
|
| 141 |
label - the text label to display near the object. |
| 142 |
|
| 143 |
property - the name of the FlightGear property whose value will |
| 144 |
be displayed in the object (and possibly modified through it). |
| 145 |
|
| 146 |
binding - a FlightGear command binding that will be fired when the |
| 147 |
user activates this object (more than one allowed). |
| 148 |
|
| 149 |
keynum - the key code of a key that can be used to trigger the |
| 150 |
widget bindings via keyboard (e.g. <keynum>97</keynum> for |
| 151 |
the "a" key. |
| 152 |
|
| 153 |
key - like "keynum", but takes a character ("a", "A", "Shift-a", |
| 154 |
"Shift-A", "Ctrl-a", "%", etc.), or symbolic key name ("Tab", |
| 155 |
"Return" = "Enter", "Esc" = "Escape", "Space", "&" = "and", |
| 156 |
"<", ">", "F1" -- "F12", "Left", "Up", "Right", "Down", |
| 157 |
"PageUp", "PageDn", "Home", "End", "Insert"). Note that you |
| 158 |
can't use "<", ">", and "&" directly. |
| 159 |
|
| 160 |
default - true if this is the default object for when the user |
| 161 |
presses the [RETURN] key. |
| 162 |
|
| 163 |
visible - if set to false, hides the whole widget that it is used |
| 164 |
in, along with its children. There's no empty space reserved |
| 165 |
for such widgets. The "visible" property can also be used to hide |
| 166 |
other XML groups from the layouter. |
| 167 |
|
| 168 |
Objects may appear nested within the top-level dialog or a "group" |
| 169 |
or a "frame" object. Here are all the object types allowed, with their |
| 170 |
special properties: |
| 171 |
|
| 172 |
|
| 173 |
dialog |
| 174 |
------ |
| 175 |
|
| 176 |
The top-level dialog box; the name does not actually appear in the |
| 177 |
file, since the root element is named PropertyList. |
| 178 |
|
| 179 |
name - (REQUIRED) the unique name of the dialog for use with the |
| 180 |
"dialog-show" command. |
| 181 |
|
| 182 |
modal - true if the dialog is modal (it blocks the rest of the |
| 183 |
program), false otherwise. The default is false. |
| 184 |
|
| 185 |
draggable - false if the dialog is not draggable. The default is true. |
| 186 |
|
| 187 |
resizable - false if the dialog is not resizable. The default is false. |
| 188 |
|
| 189 |
nasal - Nasal definition block |
| 190 |
open - Nasal script to be executed on dialog open |
| 191 |
close - Nasal script to be executed on dialog close |
| 192 |
|
| 193 |
All Nasal code runs in a dialog namespace. Nasal bindings can |
| 194 |
directly access variables and functions defined in an <open> block. |
| 195 |
settimer() and setlistener() functions have to be removed manually |
| 196 |
in the <close> block if they shouldn't remain active. |
| 197 |
|
| 198 |
|
| 199 |
Example: |
| 200 |
|
| 201 |
<PropertyList> |
| 202 |
|
| 203 |
<name>sample</name> |
| 204 |
<width>500</width> |
| 205 |
<height>210</height> |
| 206 |
<modal>false</modal> |
| 207 |
|
| 208 |
<text> |
| 209 |
... |
| 210 |
</text> |
| 211 |
|
| 212 |
<button> |
| 213 |
... |
| 214 |
</button> |
| 215 |
|
| 216 |
</PropertyList> |
| 217 |
|
| 218 |
|
| 219 |
group and frame |
| 220 |
--------------- |
| 221 |
|
| 222 |
A group of subobjects. This object does not draw anything on the |
| 223 |
screen, but all of its children specify their coordinates relative to |
| 224 |
the group; using groups makes it easy to move parts of a dialog |
| 225 |
around. |
| 226 |
|
| 227 |
A frame is a visual representation of a group and has a border and an |
| 228 |
adjustable background color. |
| 229 |
|
| 230 |
Example: |
| 231 |
|
| 232 |
<group> |
| 233 |
<x>0</x> |
| 234 |
<y>50</y> |
| 235 |
|
| 236 |
<text> |
| 237 |
... |
| 238 |
</text> |
| 239 |
|
| 240 |
<input> |
| 241 |
... |
| 242 |
</input> |
| 243 |
|
| 244 |
<button> |
| 245 |
... |
| 246 |
</button> |
| 247 |
|
| 248 |
</group> |
| 249 |
|
| 250 |
|
| 251 |
input |
| 252 |
----- |
| 253 |
|
| 254 |
A simple editable text field. |
| 255 |
|
| 256 |
Example: |
| 257 |
|
| 258 |
<input> |
| 259 |
<x>10</x> |
| 260 |
<y>60</y> |
| 261 |
<width>200</width> |
| 262 |
<height>25</height> |
| 263 |
<label>sea-level temperature (degC)</label> |
| 264 |
<property>/environment/temperature-sea-level-degc</property> |
| 265 |
</input> |
| 266 |
|
| 267 |
|
| 268 |
text |
| 269 |
---- |
| 270 |
|
| 271 |
A non-editable text label. |
| 272 |
|
| 273 |
Example: |
| 274 |
|
| 275 |
<text> |
| 276 |
<x>10</x> |
| 277 |
<y>200</y> |
| 278 |
<label>Heading</label> |
| 279 |
</text> |
| 280 |
|
| 281 |
<text> |
| 282 |
<x>10</x> |
| 283 |
<y>200</y> |
| 284 |
<label>-9.9999</label> <!-- placeholder for width --> |
| 285 |
<format>%-0.4f m</format> |
| 286 |
<property>/foo/altitude</property> |
| 287 |
</text> |
| 288 |
|
| 289 |
|
| 290 |
checkbox |
| 291 |
-------- |
| 292 |
|
| 293 |
A checkbox, useful for linking to boolean properties. |
| 294 |
|
| 295 |
Example: |
| 296 |
|
| 297 |
<checkbox> |
| 298 |
<x>150</x> |
| 299 |
<y>200</y> |
| 300 |
<width>12</width> |
| 301 |
<height>12</height> |
| 302 |
<property>/autopilot/locks/heading</property> |
| 303 |
</checkbox> |
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
button |
| 308 |
------ |
| 309 |
|
| 310 |
A push button, useful for firing command bindings. |
| 311 |
|
| 312 |
one-shot - true if the button should pop up again after it is |
| 313 |
pushed, false otherwise. The default is true. |
| 314 |
|
| 315 |
<button> |
| 316 |
<x>0</x> |
| 317 |
<y>0</y> |
| 318 |
<legend>OK</legend> |
| 319 |
<binding> |
| 320 |
<command>dialog-apply</command> |
| 321 |
</binding> |
| 322 |
<binding> |
| 323 |
<command>dialog-close</command> |
| 324 |
</binding> |
| 325 |
<default>true</default> |
| 326 |
</button> |
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
combo |
| 331 |
----- |
| 332 |
|
| 333 |
A pop-up list of selections. |
| 334 |
|
| 335 |
value - one of the selections available for the combo. There may be |
| 336 |
any number of "value" fields. |
| 337 |
|
| 338 |
Example: |
| 339 |
|
| 340 |
<combo> |
| 341 |
<x>10</x> |
| 342 |
<y>50</y> |
| 343 |
<width>200</width> |
| 344 |
<height>25</height> |
| 345 |
<property>/environment/clouds/layer[0]/type</property> |
| 346 |
<value>clear</value> |
| 347 |
<value>mostly-sunny</value> |
| 348 |
<value>mostly-cloudy</value> |
| 349 |
<value>overcast</value> |
| 350 |
<value>cirrus</value> |
| 351 |
</combo> |
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
list |
| 356 |
---- |
| 357 |
|
| 358 |
like "combo", but displays all values in a scrollable list box with |
| 359 |
slider on the right side. Updates the <property> to the selected |
| 360 |
entry. On <dialog-update> re-scans the <value> nodes and updates |
| 361 |
the list. |
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
airport-list |
| 366 |
------------ |
| 367 |
|
| 368 |
like "list", but fills the list automatically with all airports known |
| 369 |
to FlightGear. Calls bindings on airport selection and returns the |
| 370 |
selected entry in <property> on dialog-apply. Interprets <property> |
| 371 |
as search term on dialog-update. |
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
property-list |
| 376 |
------------- |
| 377 |
|
| 378 |
like "list", but shows a list of properties from the global property |
| 379 |
tree. The widget handles navigation in the property tree. It calls its |
| 380 |
bindings on property selection and returns the path of the selected |
| 381 |
property in <property> on dialog-apply. It's up to the caller to check |
| 382 |
if the path belongs to a dir node or a value node. The widget shows |
| 383 |
the contents of the dir property given in <property> on dialog-apply. |
| 384 |
It does *not* handle setting of property values! Clicking on some |
| 385 |
entries with the "control" or "shift" key pressed has a special meaning: |
| 386 |
|
| 387 |
Ctrl + |
| 388 |
"." -> toggle verbose mode (shows flags, listeners, dir-values) |
| 389 |
".." -> go to root node |
| 390 |
(bool) -> toggle bool value |
| 391 |
|
| 392 |
Shift + |
| 393 |
"." -> dump contents of that tree level to the terminal |
| 394 |
|
| 395 |
The flags printed after the node type have the following meaning: |
| 396 |
|
| 397 |
r -> read protected |
| 398 |
w -> write protected |
| 399 |
R -> trace read operations (in the terminal window) |
| 400 |
W -> trace write operations |
| 401 |
A -> archive bit set |
| 402 |
U -> user archive bit set |
| 403 |
P -> preserved bit set (value is preserved on sim-reset) |
| 404 |
T -> property is "tied" |
| 405 |
|
| 406 |
Ln -> number of listeners attached to this node |
| 407 |
|
| 408 |
|
| 409 |
|
| 410 |
select |
| 411 |
------ |
| 412 |
|
| 413 |
A box with arrow buttons that cycle through a list of values. |
| 414 |
|
| 415 |
Example: |
| 416 |
|
| 417 |
<select> |
| 418 |
<x>10</x> |
| 419 |
<y>50</y> |
| 420 |
<width>200</width> |
| 421 |
<height>25</height> |
| 422 |
<property>/sim/aircraft</property> |
| 423 |
<value>bo105</value> |
| 424 |
<value>ufo</value> |
| 425 |
</select> |
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
slider |
| 430 |
------ |
| 431 |
|
| 432 |
A horizontal or vertical slider for setting a value. |
| 433 |
|
| 434 |
vertical - true if the slider should be vertical, false if it should |
| 435 |
be horizontal. The default is false. |
| 436 |
|
| 437 |
min - the minimum value for the slider. The default is 0.0. |
| 438 |
|
| 439 |
max - the maximum value for the slider. The default is 1.0. |
| 440 |
|
| 441 |
step - set to non-null if slider should move in steps. The default is 0.0 (off). |
| 442 |
|
| 443 |
pagestep - set to non-null to enable page-stepping. The default is 0.0 (off). |
| 444 |
|
| 445 |
fraction - size of the slider handle. Range: 0..1. The default is 0.0 (minimum). |
| 446 |
|
| 447 |
Example: |
| 448 |
|
| 449 |
<slider> |
| 450 |
<x>10</x> |
| 451 |
<y>50</y> |
| 452 |
<width>200</width> |
| 453 |
<property>/environment/visibility-m</property> |
| 454 |
<min>5</min> |
| 455 |
<max>50000</max> |
| 456 |
</slider> |
| 457 |
|
| 458 |
|
| 459 |
dial |
| 460 |
---- |
| 461 |
|
| 462 |
A circular dial for choosing a direction. |
| 463 |
|
| 464 |
wrap - true if the dial should wrap around, false otherwise. The |
| 465 |
default is true. |
| 466 |
|
| 467 |
min - the minimum value for the dial. The default is 0.0. |
| 468 |
|
| 469 |
max - the maximum value for the dial. The default is 1.0. |
| 470 |
|
| 471 |
Example: |
| 472 |
|
| 473 |
<dial> |
| 474 |
<x>10</x> |
| 475 |
<y>50</y> |
| 476 |
<width>20</width> |
| 477 |
<property>/environment/wind-from-direction-deg</property> |
| 478 |
<min>0</min> |
| 479 |
<max>360</max> |
| 480 |
</dial> |
| 481 |
|
| 482 |
|
| 483 |
textbox |
| 484 |
------- |
| 485 |
|
| 486 |
The text will be retrieved/buffered from/within a specified |
| 487 |
property tree, like: |
| 488 |
|
| 489 |
<textbox> |
| 490 |
<!-- position --> |
| 491 |
<x>100</x> |
| 492 |
<y>100</y> |
| 493 |
|
| 494 |
<!-- dimensions --> |
| 495 |
<width>200</width> |
| 496 |
<height>400</height> |
| 497 |
|
| 498 |
<property>/gui/path-to-text-node/contents</property> |
| 499 |
|
| 500 |
<slider>15</slider> <!--width for slider --> |
| 501 |
<wrap>false</wrap> <!-- don't wrap text; default: true --> |
| 502 |
<top-line>0</top-line <!-- line to show at top, -ve numbers: show last line --> |
| 503 |
|
| 504 |
<editable>true</editable> <!-- if the puLargeInput is supposed to be editable --> |
| 505 |
</textbox> |
| 506 |
|
| 507 |
|
| 508 |
hrule/vrule |
| 509 |
----------- |
| 510 |
|
| 511 |
Draws a horizontal/vertical line that, by default, expands to full width/height. |
| 512 |
Its thickness can be set with <pref-height>/<pref-width>. |
| 513 |
|
| 514 |
<hrule> |
| 515 |
<color> |
| 516 |
<red>1.0</red> |
| 517 |
<green>0.0</green> |
| 518 |
<blue>0.0</blue> |
| 519 |
</color> |
| 520 |
<pref-height>2</pref-height> |
| 521 |
</hrule> |
| 522 |
|
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
GLOBAL SETTINGS ("THEMES") |
| 527 |
-------------------------- |
| 528 |
|
| 529 |
FlightGear reads GUI style information from /sim/gui/, which is by default |
| 530 |
loaded from file $FG_ROOT/gui/style.xml. This file contains one <font> and |
| 531 |
one <colors> group: |
| 532 |
|
| 533 |
|
| 534 |
global font settings |
| 535 |
-------------------- |
| 536 |
|
| 537 |
<sim> |
| 538 |
<gui> |
| 539 |
<font> |
| 540 |
<name type="string">Helvetica.txf</name> |
| 541 |
<size type="float">15</size> |
| 542 |
<slant type="float">0</slant> |
| 543 |
</font> |
| 544 |
</gui> |
| 545 |
<sim> |
| 546 |
|
| 547 |
<name> can either be the name of a built-in bitmap font (one of: |
| 548 |
"FIXED_8x13", "FIXED_9x15", "TIMES_10", "TIMES_24", "HELVETICA_10", |
| 549 |
"HELVETICA_12", "HELVETICA_14", "HELVETICA_18", "SANS_12B"), or the |
| 550 |
name of a texture font in the $FG_FONT directory. $FG_FONT is by |
| 551 |
default set to $FG_ROOT/Fonts/. Properties <size> and <slant> are |
| 552 |
only applied to texture fonts, and otherwise ignored. |
| 553 |
|
| 554 |
|
| 555 |
global color settings |
| 556 |
--------------------- |
| 557 |
|
| 558 |
These define the color of the splash screen font, and the color of the |
| 559 |
GUI elements. All colors are in /sim/gui/colors/ and follow the same |
| 560 |
pattern: |
| 561 |
|
| 562 |
<sim> |
| 563 |
<gui> |
| 564 |
<colors> |
| 565 |
<!-- splash screen font color; ignores <alpha> value --> |
| 566 |
<splash> |
| 567 |
<red type="float">1.0</red> |
| 568 |
<green type="float">0.9</green> |
| 569 |
<blue type="float">0.0</blue> |
| 570 |
</splash> |
| 571 |
</colors> |
| 572 |
</gui> |
| 573 |
</sim> |
| 574 |
|
| 575 |
|
| 576 |
|
| 577 |
As listed above, FlightGear implements several GUI elements: |
| 578 |
|
| 579 |
(1) "dialog" "group" "frame" "hrule" "vrule" |
| 580 |
"list" "airport-list" "input" "text" "checkbox" |
| 581 |
"radio" "button" "combo" "slider" "dial" |
| 582 |
"textbox" "select" |
| 583 |
|
| 584 |
|
| 585 |
The underlying plib library uses six colors for each GUI element. |
| 586 |
These are: |
| 587 |
|
| 588 |
(2) "background" "foreground" "highlight" |
| 589 |
"label" "legend" "misc" |
| 590 |
|
| 591 |
|
| 592 |
"button", for example, uses the first four colors from (2), while it |
| 593 |
ignores "legend" and "misc" color. "text" only uses "label", and ignores |
| 594 |
the rest. In some cases the use of colors isn't obvious and you have to |
| 595 |
try or look up the plib sources to be sure. GUI colors can be defined |
| 596 |
for each of the categories from (1) and (2), and for combinations of |
| 597 |
them: |
| 598 |
|
| 599 |
(3) "button-legend" "input-misc" etc. |
| 600 |
|
| 601 |
|
| 602 |
FlightGear has default colors for (2) built-in. Let's call them (0). |
| 603 |
And this is how colors for individual GUI elements are determined, |
| 604 |
if, for example, a button is to be drawn: |
| 605 |
|
| 606 |
For the button's background: |
| 607 |
a. read the hard-coded default "background" color from (0) as base |
| 608 |
b. merge the global "background" color from (2) in (if defined) |
| 609 |
c. merge a global color "button-background" from (3) in (if defined) |
| 610 |
d. merge a specific <color> from the dialog's XML file in (if defined) |
| 611 |
|
| 612 |
Repeat the four steps for the button's "foreground", "highlight", |
| 613 |
etc. color. |
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
If you write a style file, you'll most likely start with the colors |
| 619 |
from (2): |
| 620 |
|
| 621 |
<sim> |
| 622 |
<gui> |
| 623 |
<colors> |
| 624 |
<background> |
| 625 |
<red type="float">0.6</red> |
| 626 |
<green type="float">0.0</green> |
| 627 |
<blue type="float">0.0</blue> |
| 628 |
<alpha type="float">1.0</alpha> |
| 629 |
</background> |
| 630 |
|
| 631 |
<foreground> |
| 632 |
... |
| 633 |
|
| 634 |
This makes all dialogs dark red. But you don't, for example, want buttons |
| 635 |
to be red, but yellow. So you define another color for buttons: |
| 636 |
|
| 637 |
<button> |
| 638 |
<red type="float">1.0</red> |
| 639 |
<green type="float">0.9</green> |
| 640 |
<blue type="float">0.0</blue> |
| 641 |
<alpha type="float">1.0</alpha> |
| 642 |
</button> |
| 643 |
... |
| 644 |
|
| 645 |
This sets all of a button's six colors (2) to some shades of red. plib |
| 646 |
does this automatically. The lower and right border ("foreground") will |
| 647 |
be darker, the upper and left border will be lighter ("highlight"). |
| 648 |
If you aren't happy with plib's choice, you can set each of the colors |
| 649 |
explicitly. Let's say, we want the text on the button blue (3): |
| 650 |
|
| 651 |
<button-legend> |
| 652 |
<red type="float">0.3</red> |
| 653 |
<green type="float">0.3</green> |
| 654 |
<blue type="float">1.0</blue> |
| 655 |
<alpha type="float">1.0</alpha> |
| 656 |
</button-legend> |
| 657 |
... |
| 658 |
|
| 659 |
To set the cursor color from input fields, you'd define "input-misc", |
| 660 |
etc. |
| 661 |
|
| 662 |
|
| 663 |
You can change colors and font at runtime. Just open the property |
| 664 |
browser, go to /sim/gui/colors and change whatever you like. The |
| 665 |
new color will only take effect, though, if you re-init the GUI. |
| 666 |
There's a menu entry for that, and you can define a key binding |
| 667 |
for it: |
| 668 |
|
| 669 |
<key n="99"> |
| 670 |
<name>c</name> |
| 671 |
<desc>Re-init GUI</desc> |
| 672 |
<binding> |
| 673 |
<command>reinit</command> |
| 674 |
<subsystem>gui</subsystem> |
| 675 |
</binding> |
| 676 |
</key> |
| 677 |
|
| 678 |
Note that this will currently close all open dialogs! |
| 679 |
|
| 680 |
|
| 681 |
__end__ |