1
0
Fork 0
Commit graph

482 commits

Author SHA1 Message Date
mfranz
b08a588fb1 ok, now I know why the destructor was commented out in prop_picker.cxx:
there's a bug that I had copied: update() checks each list node: if it
has no children, then a listener is attached. Later, when freeing the
children list, it assumed again that each node without children would
have a listener attached. This caused a crash when a node had children
before, but lost them in the meantime. Now we tried to remove a listener
where there never was one.
2006-05-24 09:42:10 +00:00
mfranz
6465141ac2 - don't jump to top after bool toggling 2006-05-23 21:35:38 +00:00
mfranz
91a367379c catch non-existent nodes, too 2006-05-23 20:48:01 +00:00
mfranz
9c98766700 treat widget input correctly 2006-05-23 20:24:56 +00:00
mfranz
fdb9e94af3 ugly "fix": the constructor was commented out in prop_picker.cxx since
*many* years, so the property browser always leaked memory. I activated
this line in property_list.cxx and ... got a crash right there. So this
was the reason for it being commented out? Doing the same for now, until
I know the exact reason and can really fix it.
2006-05-23 16:49:32 +00:00
mfranz
4c940a55f9 fix for broken plib 1.8.4 2006-05-23 16:44:10 +00:00
mfranz
e2c195f3a6 - move the ID stuff to dialog.hxx
- add an identifier to fgPropertyList(), which is also PUCLASS_LIST based
2006-05-22 16:14:50 +00:00
mfranz
9ff339332c make new widget available as <property-list> 2006-05-22 14:35:39 +00:00
mfranz
0007098aac add property_list.[ch]xx 2006-05-22 14:34:59 +00:00
mfranz
3610680095 new property browser widget 2006-05-22 14:34:20 +00:00
mfranz
7b4238fe8c - backport plib/cvs (transparency feature; never tried that :-)
- backport submissions for plib 1.8.5:
  * set slider size correctly
  * remove slider/arrow when all entries fit into the view
  * don't allow to scroll off the list
2006-05-22 14:33:01 +00:00
mfranz
dfdb7f8107 the last patch fixed the AirportList ... and broke all other PUCLASS_LIST.;
Unfortunately, there's no simple way to distinguish them. plib has no
user defined widget classes, and getTypeString() -- which could be used
for that -- isn't virtual. Sigh. I'll discuss the problem on the plib list.
For now I can only offer an ugly workaround. (Don't look closely!)
2006-05-21 22:14:18 +00:00
mfranz
24981fd043 - replace string methods with property methods The class was originally adapted
from plib's file-picker, where it made some sense to keep the current path as
  string, and to chop off elements when leaving a dir, and adding them when
  entering. But it doesn't make the least sense in SGPropertyNode space, where
  we already have everything to move in a tree.

- add R & W flags for TRACE_READ and TRACE_WRITE. Remember: lower case letters:
  disabled (rw ... reading/writing), upper case letters: enabled (RWAUT)

- remove some verbosity & further cleanup ... to make further work easier :-)
2006-05-20 15:25:38 +00:00
mfranz
368349aa58 fix "airport list" crash: I had wrongly assumed that now all PUCLASS_LIST
would actually be an fgList class. The airport list is a PUCLASS_LIST, too,
so we have to check for that. -> Use getTypeString() for identification.
2006-05-20 11:35:28 +00:00
mfranz
53572823bc - unify several indentation and coding styles (and no, this is not my
preferred style, but the most sane of those used :-)
- remove trailing spaces
- cleanup

(all of this will make further work on the files easier)
2006-05-19 10:59:04 +00:00
mfranz
ee0d288e32 show attributes if /sim/gui/dialogs/property-browser/show-flags == true:
r ... read protected
w ... write protected (untested; does probably not work for obvious reasons ;-)
A ... archive
U ... userarchive
T ... tied
2006-05-18 14:46:42 +00:00
mfranz
865a1c037e unselect entry after editing process has been finished 2006-05-18 13:09:34 +00:00
mfranz
7512553a9a don't reset list to top after having changed a value 2006-05-18 12:51:32 +00:00
mfranz
6d24d7496e Ctrl-Click on bool entry toggles property 2006-05-18 12:12:10 +00:00
mfranz
5a38a9d071 - undefine PUCLASS_LIST, as we have our own (old_warning--)
- PropertyObject: remove additional "values" member again
- don't create entry lists for <list>, <select>, and <combo> at dialog
  creation and delete them on dialog close, but let a separate class
  fgValueList handle this. The three widgets are now subclassed and the
  derived widget lets fgValueList manage the lists
- make <select> consistent with <list>. This breaks backwards
  compatibility, but not a single dialog in fgfs uses it and did so
  since ... forever. (Shoot me!)

Rationale: now that dialogs are a bit more dynamic than they used to be
(thanks to embedded Nasal), we have to delete and recreate entry lists
during dialog use. Deleting only at dialog closing doesn't cut it anymore.
Especially list widgets that are updated several times per second would
use up a lot of memory otherwise. The route-manager doesn't update that
often, but it did already leak. One TODO less.  :-)
2006-05-16 12:45:38 +00:00
fredb
b30d903a56 Use puAux widgets available in plib 1.8.4 instead of using pui deprecated widgets now removed from CVS 2006-05-14 09:03:50 +00:00
mfranz
d409d5dbbe add "signals" for start and end of screenshot capturing. Like the other
signals, this is meant for attaching listeners. The ufo will use that to
hide/reveal the status line in screenshots. The following signal properties
are now available:

  /sim/signals/exit       ... set to 1 right before quitting
  /sim/signals/reinit     ... set to 1 on re-init  (Shift-Esc)
  /sim/signals/screenshot ... set to 1 before and to 0 after screenshot
  /sim/signals/click      ... set to 1 after mouse clicks at terrain, signalling
                              that the geo coords in /sim/input/click/ were updated
2006-05-09 09:39:28 +00:00
mfranz
95a97dbee4 remove obsolete menu functions 2006-05-08 15:00:10 +00:00
mfranz
30a38b2c3a remove obsolete fgcommands 2006-05-08 14:56:46 +00:00
mfranz
f9959b7f2c - move auto_gui's addWaypoint to routemgr.cxx
- add command interface property (monitored by listener)
- remove all traces of auto_gui.[ch]xx
- remove some trailing spaces, fix indentation
2006-05-08 14:35:29 +00:00
mfranz
ff52ed5072 add an optional property node pointer to ObjectProperty. This is currently
only used by the <list> widget. It allows to "dialog-update" the list,
which rescans the <value> children and redraws the list widget with new
contents. The old contents are only freed at dialog close, which should
eventually get changed.
2006-04-28 15:55:41 +00:00
mfranz
5b1dd6c8ae empty names aren't names 2006-04-28 12:56:11 +00:00
mfranz
ce8e28f1f5 what about using the right variable? 2006-04-28 12:14:23 +00:00
mfranz
29ff85142b - merge FGDialog::{update,apply}Value{,s} ... there's really no need to have
two almost identical functions for these methods. It only forces to repeat
  the redundancy for every small change to either.
- abstract out generation and destruction of plib string arrays
- abstract out generation of lists from <value> children
2006-04-28 11:49:11 +00:00
mfranz
eb19c2650d newgui.[ch]xx: implement FGDialog *NewGUI::getDialog(cont string&)
fg_command.cxx: add possibility to "dialog-apply" or "dialog-update"
                an arbitrary active (= open) dialog or widget
2006-04-28 10:27:54 +00:00
mfranz
ca46e8d5d5 rename NewGUI::getDialog() to NewGUI::getDialogProperties()
getDialog wrongly implies that it returns an FGDialog, and we might later
need a real getDialog.
2006-04-28 09:59:31 +00:00
mfranz
52306b9093 add optional SGPropertyNode* argument to NasalSys::createModule. This is
used in dialog.cxx to allow XML dialogs access to their own prop tree via
Nasal's cmdarg(). That way dialogs can generate dynamic content, such as
list entries.
2006-04-27 15:56:51 +00:00
mfranz
e354b810fa - work around plib bug that crashes fgfs if no airport was found (empty
list) and the arrows are clicked  (patch sent to plib; workaround it to
  be removed once fgfs officially depends on a plib version that includes
  the fix)
- fix (very unlikely) crash in case the widget is redrawn between list
  destruction and setting of the new list.
2006-04-18 15:21:19 +00:00
mfranz
2e7cab820b make headers include headers they depend on, don't rely on the c(xx)
file to do that. (This is a requirement for header precompiling.)
2006-04-17 13:40:20 +00:00
mfranz
fe78690623 allow to not only set a general widget <color>, but also specific element
colors:  <color-{{back,fore}ground,highlight,label,legend,misc,editfield}>
<input-misc>, for example, sets the input field cursor color, <input-legend>
the input field text color. (This feature was always planned as part of the
'theming' capabilities, and most code is already in place. Only this line
was apparently fogotten. :-)
2006-04-14 10:17:09 +00:00
mfranz
86d606f87a <input> elements that are <live> always update their input field from the
<property>, except if they are activated, in which case the user input
should, of course, not get overwritten. But if such an input was active and
the user selected a different widget, then its contents were dropped.
Fix that by setting the "DownCallback" for live input fields.
2006-04-03 15:00:33 +00:00
mfranz
bff4c3fe22 support filtering to show only a subset of entries 2006-03-31 10:17:43 +00:00
fredb
0abca6be34 Don't restore initial screen geometry because there is nothing in fg_os* to resize an existing window.
Old behavior was to just resize the GL viewport, which doesn't necessarily match the fg window size.
2006-03-30 20:37:34 +00:00
mfranz
8d9f8e5761 - don't crash if user clicked "Apply" but hasn't selected an airport
- re-order information from  "LOXT  Tulln"  to  "Tulln  (LOXT)".
  The list is sorted by airport name and columns aren't aligned, so this
  looks way cleaner.
2006-03-25 08:47:53 +00:00
mfranz
651db1845b - make aircraft list no longer stick out from its dialog box
- cosmetics: consistent coding style (and "if" is not a function :-)
2006-03-25 07:45:50 +00:00
mfranz
bf53d2b117 - set size, otherwise the widget doesn't expand to the size that the layouter
found desirable
- set slider width default correctly (parentHeight? Huh?)
2006-03-23 23:02:48 +00:00
mfranz
b650e86e74 - implement setSize(): We can't just use puObject::setSize() -- we do, of
course, have to re-layout all sub-widgets on resizing
- make slider size configurable, like it's done for the close relative
  puLargeInput
2006-03-23 23:00:31 +00:00
mfranz
d6af5da0a8 - abstract out box slider width (should probably be settable)
- reduce it to 20 (30 is excessive and didn't match the property brower look)
- call puSlider with this size explicitly (otherwise its size is derived
  from the font size, unlike the arrow buttons!)
2006-03-23 19:51:38 +00:00
mfranz
2726cda057 make puList actually useful: call back on list entry selection.
(again: I'll submit all the changes to plib's puaList as soon as
possibe. Just needs a few more fixes first ... :-)
2006-03-23 19:03:31 +00:00
mfranz
a7bab83cc8 make puListBox inherit puList colors (otherwise the GUI style isn't
respected, and black text on dark grey is a bit hard to read).
TODO: - submit that for inclusion in plib's puAuxList
      - drop custom version and use plib's (after 0.9.10)
2006-03-23 17:44:10 +00:00
mfranz
a04aad7a99 puList.cxx: _list_box->getIntegerValue() returns -1 as long as no list
entry was selected. Return 0 in this case, not an invalid string address
  (causing segfaults).
dialogs.cxx: don't set property if no list entry was chosen.
2006-03-22 10:56:49 +00:00
mfranz
9604277484 create /sim/gui if it doesn't exist 2006-03-19 07:10:10 +00:00
mfranz
e4f08637f7 move gui styles from /sim/gui[n] to /sim/gui/style[n] to make /sim/gui
free for other gui related properties
2006-03-09 23:04:41 +00:00
mfranz
b0b5c2dda9 remove useless test 2006-03-08 20:23:31 +00:00
mfranz
2de4fd5d8e add support for <nasal> blocks <open> and <close> in XML dialogs:
<nasal>
      <open>print("I'm called on dialog open")</open>
      <close>print("I'm called on dialog close")</close>
  </nasal>

All Nasal runs in a dialog namespace, so that variables and functions
defined in the <open> block can be used in <binding>s, etc. This is
especially useful for <radio> button handling. See "location-in-air.xml".
2006-03-08 10:44:46 +00:00
mfranz
ef70c9cf41 backspace accelerator 2006-03-01 14:26:17 +00:00
mfranz
c9813d1b5d new FSF address 2006-02-21 01:16:04 +00:00
mfranz
dc1cf77804 make sure the dialog property tree can't disappear until we wrote the
last position back
2006-02-19 08:48:30 +00:00
fredb
36e4045810 Add missing include files needed by the new math code under windows 2006-02-18 13:58:09 +00:00
mfranz
f5469ba9fe only user specified negative coords are interpreted as relative to the upper
right corner, not those that are result of centering a dialog if no x/y are
given. This centers screen.log messages correctly. But maybe we have to
rethink that special meaning of negative coords altogether.
2006-02-12 19:43:53 +00:00
mfranz
e51cd8eaf5 make room for more font specifications in style files 2006-02-04 13:06:47 +00:00
mfranz
aec1d580c2 on closing a dialog write the last position back, so that the caller can
open it there again next time
2006-01-29 21:21:56 +00:00
mfranz
129813e0aa set the /sim/signals/reinit property on reinit, so that aircraft code can
attach listeners. Other relevant stuff should go here, too. (/sim/crashed
could be one.)
2006-01-29 16:20:31 +00:00
mfranz
cabf53537a allow top level <font> definition that applies to text in the whole dialog
and makes the layouter use this font's metrics
2006-01-27 12:57:13 +00:00
mfranz
54ee68291b fonts are now delivered by FGFontCache (except for the splash screen,
because this comes way before the gui subsystem is ready)
2006-01-27 08:01:31 +00:00
mfranz
f729ec6013 cosmetics 2006-01-26 22:22:37 +00:00
mfranz
e2016f9568 fix FGFontCache and make use of it (this allows to assign bitmap fonts
in dialogs)
2006-01-26 21:40:37 +00:00
ehofman
619226e9d0 Integrate a large part of John Wojnaroski's 747 cockpit project.
Erik Hofman:
This patch contains an update to net_ctrls.hxx that adds an extra 100 bytes
(or an equivalent of 25 (u)int32_t types) of reserved space. This could be
used to make the protocol forward and backward compatibel within a certain
scope. Be sure to read the instructions at the begining of the header file
when addinf new variables.
2006-01-20 17:19:01 +00:00
ehofman
fcfe5d2010 Don't display the menubar in e highres screenshot. 2006-01-11 10:53:04 +00:00
ehofman
0b3164c312 Try to prevent a potential buffer overflow for WIN33. 2006-01-04 13:25:56 +00:00
mfranz
f6225f5cb7 remove a few unused vars
menubar: cosmetics of the day
2005-12-15 20:07:14 +00:00
mfranz
98081d9243 don't check for subsequent indices (n), but for child positions; This way
it's also possible to enable/disable menu/item entries with higher numbers.
This can be useful for adding entries from other config files (aircraft
specific or local). I'd say aircraft files can use indices starting with
[100] and local files starting with [1000]. Such high number will never
collide with an entry in menubar.xml, even if entries are added/removed
there.
2005-12-14 07:45:47 +00:00
mfranz
688bcb579f final cosmetics (s/_entries/_objects/ and comments) 2005-12-09 10:43:09 +00:00
mfranz
1990db9ca5 yet more cleanup; clearer warning messages 2005-12-06 21:03:15 +00:00
mfranz
c10f583c11 removal of yet more stuff, left over from development; further simplification;
requires to remove some constness, though (we are adding listeners!);
If I continue like that, nothing will be left.  :-)
2005-12-06 19:51:31 +00:00
mfranz
eb68e9ad36 remove two checks that were only useful during development; fix typo 2005-12-06 18:46:39 +00:00
mfranz
ac2c1fcd43 allow disabling/enabling of menu entries via "enabled" property;
Unfortunately, we don't have an easy way to access the puObjects
only by knowing the respective XML property node, because the
menu structure was built by plib from string lists. That's why
we walk the puMenuBar tree and store {property node}->{puObject*}
pairs in a map. With this infrastructure in place we can now
easily enable/disable entries, but we can also make other changes
to menu buttons as we see need. The structure of puMenuBar is
described in the pui documentation, so it's less of a hack than
it looks.  :-)
2005-12-06 17:56:17 +00:00
mfranz
8d681fd6de "nine" (via IRC):
don't crash if gui subsystem isn't available yet
2005-11-12 11:40:57 +00:00
mfranz
5299ab0304 distinguish editable and non editable textboxes; the former will usually
be colored like input fields, while the others will be colored like normal
text
2005-11-09 18:23:55 +00:00
mfranz
feb555b087 prepare for pending plib change: set combobox/selectbox input field colors
to other color than "Yeukky Pink"; #undef'ed for older plib versions; plib
patch will be made available in case fgfs 0.9.9 is released before plib 0.8.5
2005-11-09 17:59:53 +00:00
mfranz
cff9e51840 reinit(): destroy, reload and re-open dialogs (menu: Debug -> GUI Reload)
redraw(): redraw gui without distroying dialogs (fgcommand "gui-redaw"/Shift-F10)

This change makes sure that Nasal-generated and dynamic dialogs can be
re-opened correctly when cycling through themes.
2005-11-09 17:16:59 +00:00
mfranz
571939e58d replace hard-coded HUD config dialog with NewGUI dialog 2005-11-09 10:47:40 +00:00
mfranz
c6a1ba7f97 don't destroy iterated map entries; delete _menubar; restore closed
non-nasal dialogs
2005-11-08 18:18:55 +00:00
mfranz
4cc3beff42 Don't use the [] notation here to test for the existence of a map member,
because this creates an empty entry if it didn't exist. This made the
activation of the dialog mandatory before the next gui subsystem update()
happened. Otherwise fgfs segfaulted.
2005-11-08 11:05:50 +00:00
mfranz
e4929c1dc1 interpret negative dialog <x> and <y> coordinates as distance from the
right/upper screen edge (analogous to the --geometry spec), assuming
that we never want to draw outside the screen area; for this to work
we need to write the original x/y coords back to overwrite the absolute,
positive values that the layouter stored there
2005-11-06 23:53:30 +00:00
mfranz
63f5947afc backing out all changes to non-depreciated symbols/functions: plib's cvs
isn't tagged, so we can't easily say what was added after the last stable
release
2005-11-06 14:27:17 +00:00
mfranz
47f90a7976 backing out all changes to non-depreciated symbols/functions: plib's cvs
isn't tagged, so we can't easily say what was added after the last stable
release
2005-11-06 14:22:02 +00:00
mfranz
2aceb0e63f PUCLASS_LIST is already defined in <plib/puAux.h>. 2005-11-06 13:38:21 +00:00
mfranz
30f5e63f81 implement <key> property for key names: <keynum>27</keynum> == <key>Esc</key> 2005-11-05 18:41:43 +00:00
mfranz
e7d2718e15 switch from depreciated pui functions to the "new", supported ones
(OK'ed by Curt)
2005-11-05 09:51:01 +00:00
mfranz
533201c7a0 replace depreciated plib symbols with their new forms 2005-11-04 22:20:35 +00:00
mfranz
7f3cd89be5 return correct input object 2005-11-03 20:15:05 +00:00
mfranz
add06e613d cleanup 2005-11-02 13:52:01 +00:00
mfranz
fd5ed5a8fa allow to trigger widgets via accelerator key, which is defined via "keynum"
property (e.g. <keynum>49</keynum>). The numbers are the same as in
keyboard.xml. (Could later be replaced/enhanced with <key>Ctrl-a</key>
notation.) This does, of course, only work for widgets with assigned
bindings.
2005-11-02 13:11:19 +00:00
ehofman
029dda3297 In the process of changing, adding and removing files the last few years
there was the situation where four directories contained jst two files,
of which three directories were aircraft related, and one directory contained
test code from Curt that might be better of in SimGear anyhow.

This is just a patch to move a bunch of files to new locations. In case of
local changes to any of them you can do the following:

move replay.[ch]xx from src/Replay to src/Aircraft
move control.[ch]xx from src/Control to src/Aircraft
move ssgEntityArray.[ch]xx from src/Objects to simgear/screen

In addition it has been decided only to use .[ch]xx files in all directories
unless it's contained within an FDM specific directory, in which case the
author is free to do whatever (s)he wants.

In this repspect the following files have been renamed in src/Multiplayer:

tiny_xdr.[ch]pp has become tiny_xdr.[ch]xx
multiplaymgr.[ch]pp has become multiplaymgr.[ch]xx
2005-11-01 13:41:49 +00:00
mfranz
ec2ff6ae50 We never want to know if a dialog is there or not. If we ask for one and
it isn't there, this is a bug. Thus centralize the error message so that it
doesn't have to be repeated everywhere. Of course, the calling code should
still consider that a returned property node may be 0.
2005-10-22 16:51:27 +00:00
ehofman
12fc19080b Ima Sudonim:
CygWin/gcc-3.4.4 updates.

I replaced my cygwin compiler with 3.4.4, did a make clean of plib, simgear,
and flightgear, then did a make install of all three. With the included changes,
everything builds fine, and runs fine.
2005-10-22 11:22:05 +00:00
mfranz
08744c015f - spelling
- write file name in quotes
2005-10-21 19:34:51 +00:00
mfranz
affa6b8a38 Fix <text> alignment. Because our <text> widget is an empty puObject's
label, we need to compensate for the gap in-between: PUSTR_RGAP (pu.h).
Without that, all text appears shifted right.
2005-10-21 18:50:58 +00:00
mfranz
58179758af add support for a <hide> property, which hides whole XML groups (widgets
or data blocks) from layouter and dialog creator. This is required for
dynamically generated/modified dialogs. Parts in the XML file can be
hidden and turned on by the C++ code. Other hidden parts can be used
as templates that are multiply used. Hidden datablocks can contain
strings that are used in dialog context, that are easier to translate
or modify in the XML file.
2005-10-21 17:47:48 +00:00
mfranz
8e1ae97d3d Replace hard-coded message boxes by ones managed by the gui subsystem.
Remove obsolete functions.
2005-10-20 13:05:02 +00:00
mfranz
685076e9ce Add method to get the property root node of named dialogs. This is
necessary to edit dialog contents from C++, and will allow us to
finally let all the hardcoded dialogs be handled by the "gui"
subsystem.
2005-10-20 11:15:00 +00:00
andy
37b9a23122 Must include config.h before plib headers to prevent them from default
to glut (which breaks SDL builds).
2005-10-19 18:40:19 +00:00
ehofman
dafa6ced1b Mathias Fröhlich:
I have done a valgrind run in flightgear. Just start it up and close it at the
fist change I had about half an hour later.

source-leak.diff:
   Also two minor ones, but leaks ...
2005-10-14 16:25:14 +00:00
ehofman
1c3e2d4942 Vivian Meazza:
This adds a TACAN instrument to the inventory. Range and bearing are calculated
to the TACAN or VORTAC beacon selected by means of the Channel Selector in the E
quipment/Radio pull-down menu.

A TACAN beacon has also been added to the aircraft carrier Nimitz (channel #029Y
).
2005-10-01 09:56:53 +00:00