1
0
Fork 0
Commit graph

360 commits

Author SHA1 Message Date
mfranz
e1a5398e4f - add gui color support: maintain color map with default colors and all
colors from /sim/gui/colors/ into map;
- set default color scheme
- handle fonts
- implement color class
- close all dialogs on reinit, set up style again, and then reopen all
  (non-nasal generated) dialogs again
2005-07-07 21:28:15 +00:00
mfranz
9b47b1b15b add fonts.cxx file 2005-07-07 21:24:28 +00:00
mfranz
9946347fa7 contains two fntBitmap fonts with iso8859-1 character set; this was
generated by freeglut's genfont utility. That application also generates
a copyright message that I did not copy into this file, because it is
wrong: the author of genfont claims copyright for data that *I* generated
using his program; this doesn't fly. Of course, the copyright will remain
in the (heavily edited) version of *his* code. I'll commit that, too.
2005-07-07 21:23:42 +00:00
mfranz
cac0a9b326 - abstract out reading colors from the property tree into a routine.
This could also be used to read the default foreground/background color
  from a definition in preferences.xml or gui/color.xml.
2005-07-04 07:27:17 +00:00
mfranz
11138e3739 - make menubar reloadable ... again. This was lost because FGBindings does
no longer save inaccessible bindings copies, but only pointer to the
  bindings in the property tree (which was desirable to get accurate
  error messages for Nasal bindings).
2005-07-03 14:43:47 +00:00
mfranz
e73dffb99f - fix <hrule>
- add <vrule>
- allow elements to default to foreground color (black)
- remove redundant  if (foo) delete foo;

The rules do currently need a dummy child for the layouter to work correctly,
(<hrule><foo/></hrule>). The goal is to make a simple <hrule/> work.
2005-07-02 20:49:38 +00:00
mfranz
550352c0b6 keep panel and gui bindings nicely separated; useful for debugging,
especially now that the property path is shown in nasal error messages
2005-06-24 14:07:15 +00:00
mfranz
19b09cef28 FGBindings doesn't create its own, detached copy of the bindings property
subtree. Keeping bindings available is in the responsibility of the caller.
2005-06-24 13:44:22 +00:00
mfranz
c70e5f20de - layout frames like groups (I forgot to commit that yesterday :-) 2005-06-21 12:13:07 +00:00
mfranz
0636ebfc86 - fix "frame" (the old code was broken and ... strange)
- add "hrule" (horizontal rule; accepts color and "pref-height" for thickness)
2005-06-20 20:54:47 +00:00
ehofman
70fe768e5c Revert the previous patch. 2005-05-17 09:56:52 +00:00
ehofman
a75c0859bd Oops, I didn't test compile the latest code and this is what happens. 2005-05-16 09:05:17 +00:00
ehofman
d4b8a81a44 Make the dialogs work again. 2005-05-16 08:37:18 +00:00
ehofman
48f45296ce Add support for altering the border thickness of objects and add a 'frame' object as a visual representation of a group. 2005-05-06 11:46:52 +00:00
ehofman
a760869475 Fix a couple of stupid mistakes, I'm off to find a brown paper bag now. 2005-05-03 12:48:31 +00:00
ehofman
a4eebe4277 Shoot, I removed a bit of crucial information just before committing it. 2005-05-03 12:20:17 +00:00
ehofman
2c3b8e075c Make it possible to define a different font for the labels 2005-05-03 11:58:33 +00:00
ehofman
c3ba52d821 Allow for defining the label color. 2005-05-02 14:45:04 +00:00
ehofman
0c61e0dae1 Make it optional whether a dialog can be dragged or not. 2005-05-02 12:14:12 +00:00
ehofman
cc3eacb88e Melchior: Make line wrapping in textboxes configurable, and enable it by default 2005-04-19 13:15:04 +00:00
ehofman
3f6536fee6 Allow for recolloring the dialogs. 2005-04-13 11:39:53 +00:00
ehofman
019a7a186b Melchior FRANZ:
showDialog() is careful not to create a new FGDialog() if a dialog with the
same name is already open (active). But at this point it is already too late:
newDialog(), which was called shortly before, has already overwritten the
dialog properties. This leads to animated garbage in the best case, and a
segfault in format_callback() in the worst case.

- GUI::newDialog(): Don't you overwrite properties of an active dialog!
- GUI::readDir(): You may do that, but delete the old dialog first!
  (necessary for reloading the GUI)

- FGDialog::makeObject(): only set format_callback() with setRenderCallback()
  if the property is "live". Otherwise, only call it once at construction
  time. This isn't only a performance improvement. Without this the label
  was growing until it hit the limit (256).
2005-03-29 08:35:13 +00:00
ehofman
71dd0f8f96 Melchior FRANZ:
The previous message wasn't totally correct. Strings are now allowed, too. And
the pattern is now '[ -+#]?\d*(\.\d*)?l?[fs]' and *may* be embedded in a string.
There may only be one %s or %f, though. %% is allowed in the preamble/postamble.
(Yes, %ls is allowed, too, and treated as %s.)

Also, "end" is superfluous now.
2005-03-26 10:45:00 +00:00
ehofman
db989269b8 Melchior FRANZ:
Printing floats in dialogs with 8 digits after the comma is inappropriate
for most cases.

- implement a "format" property for "text" gui elements (a.k.a. pui label).
  Number formats are set by strtod/snprintf, while formats on non-numbers
  are replaced by "%s". Practical example in the upcoming material.nas update.
  Valid formats regex:  '%[ -]?\d*(\.\d*)?l?f' (IOW: the format must begin
  with '%' and end with 'f').

  # Nasal:
  number = dialog.addChild("text");
  number.set("label", "3.1415926");
  number.set("format", "%.3f");
2005-03-26 10:09:34 +00:00
ehofman
4b116a1196 Melchior FRANZ:
The dialog handling has been written at a time when only one dialog was
shown at the same time, and dialogs were shallow -- with only children, but
no grand-children. This makes finding a draggable spot on modern, dialogs
with nested objects quite a challenge. The patches fixes this, and other things:

- check full object tree on button press, not only the outmost layer;
  and don't give up just because we are in *something* (which could well be
  something harmless, like a group); only ignore a few, sensible objects
  (we don't want to drag after a click on a button or into an input field)

- don't lose dialogs as easily when dragging too fast (it does still happen
  if one manages to enter an editable field while dragging, but this is
  a plib problem and I don't feel like fixing that now  :-)

- don't "live"-update input fields while they are in edit mode

- remove some "if (foo) delete foo;" redundancy
2005-03-24 13:41:43 +00:00
curt
40170cb722 The view frustum is defined in plib apps using calls to ssgSetFOV() and
ssgSetNearFar().  This by default creates a symmetric view frustum which is
typically what an application wants.

However, to get control of the view frustum in order to build support for
asymmetric view frustums, we need to wrap these calls with a bit of our own
logic.

This set of changes wraps all calls to ssgSetFOV() and ssgSetNearFar() with
FGRenderer methods.

I also standardized how the FGRenderer class is handled in globals.[ch]xx.
This led to some cascading changes in a variety of source files.

As I was working my way through the changes, I fixed a few warnings along
the way.
2005-02-25 19:41:53 +00:00
ehofman
5bc15d7a69 Durk Talsma:
I just heard from John Wojnaroski that you and he are going to work on getting
a flightgear demo machine up for the linux expo thursday and Friday. John
indicated that he would very much like to get a CVS version with the new
traffic code up and running before the expo.
2005-02-10 09:01:51 +00:00
ehofman
964349e401 Andrew Midson:
I have made the
'Select Airport from List' option in FlightGear work
(I think) properly. I have some concerns about the
solution, which could be broken by changes to plib (if
they re-use the value I have assigned to
PUCLASS_LIST), but for the moment it seems to work OK.

Erik Hofman:
A request has been sent to John Fay to include the puList
code in the puAux subdirectory of plib so expect some
changes for future version of FlightGear.
2005-01-31 10:36:59 +00:00
curt
3ad6d87576 FGIO::shutdown_all() is called from the FGIO destructor so we don't want
a seperate explicite call or the io channels will be forced to try to shutdown
twice which could cause problems for some IO modules (i.e. attempting to
close an invalid file descriptor the second time ...)
2004-12-29 20:38:17 +00:00
curt
222446df29 Replace the data/Airports/basic.dat.gz and data/Airports/runways.dat.gz with
a single apt.dat.gz file which is in the native X-Plane format.

To do this I wrote a front end loader than builds the airport and runway
list.  Some of the changes I needed to make had a cascading effect, so there
are minor naming changes scattered throughout the code.
2004-12-22 23:57:07 +00:00
curt
d05121ef46 Fix my mailing address by replacing it with my web page. 2004-11-19 22:10:41 +00:00
curt
4214cd6c10 Migrate FlightGear code to use "#include SG_GL*" defined in
"#include <simgear/compiler.h>".
2004-11-18 19:53:00 +00:00
ehofman
a938b5b0df Boris Koenig:
This will modify menubar.cxx/hxx so that it exports the
entire menubar (from menubar.xml) to the property tree, so that it can
now be changed dynamically  using Nasal's setprop() instruction and
afterwards running a newly added fgcommand to update the menubar
based on those changes using the appropriate menubar path within
the property tree.

By default the menubar from menubar.xml will be stored within:

    /sim/menubar/default


Erik:

I have moved the loading of menubar.xml into preferences.xml and
made sure that the menubar is destroyed every time a new menubar
is created.
2004-10-22 09:26:51 +00:00
curt
41e217fb9a Continued work to clean up the hires screen shot code and move it back towards
a working state.  I still see an anomoly when taking a screen shot from inside
a 3d cockpit, but external (chase/tower) views seem to work well.  I also
added a property to control how many screen-res tiles are generated in the
output.  Theoretically, you can now generate unlimited resolution screen shots,
or limited only by your disk space and patience.

Today I successfully generated a 20*1024 x 20*768 (20480x15360) resolution
screen shot.  If you rendered that at 100 dpi it would cover a poster of
about 17 feet by 12.8 feet.

Good luck trying to display something that big or convert it to anything
useful on a typical PC. :-)
2004-10-06 03:29:14 +00:00
ehofman
6f8cae6b87 Boris Koenig:
I'm attaching a small change to Andy's dialog.cxx that I needed
to make so that it enables XML/Nasal-dialogs to also contain
puLargeInput boxes.

The text will be retrieved/buffered from/within a specified
property tree, like:

<textbox>
    <x>100</x>
    <y>100</y>

    <width>200</width>
    <height>100</height>

    <property>/gui/path-to-text-node/contents</property>

    <slider>15</slider>

    <editable>true</editable>
</textbox>
2004-09-27 14:40:31 +00:00
ehofman
06bead966b Cache the renderer in a local pointer. 2004-09-27 09:13:12 +00:00
curt
cc66c8fdca Activate the hi res screen capture functionality again, however it is no
longer working 100% correctly. :-(
2004-09-27 02:39:54 +00:00
ehofman
986492d72d Finish what was committed in a broken state yesterday.
Split up main.cxx into a program manegement part (which remains in
main.cxx) and a render part (the new renderer.?xx files). Also turn
the renderer into a small class of it's own. At this time not really
exctining because most of the stuff is still global, but it allows us
to slowly migrate some of the global definitions into the new class.

The FGRenderer class is now managed by globals, so to get the renderer
just call gloabals->get_renderer()

At some pijt it might be a good idea to also turn the remaining code in
main into a class of it's own. With a bit of luck we end up with a more
robust, and better maintainable code.
2004-09-20 13:21:51 +00:00
ehofman
3b3600fd21 Make it compile, link and run again (pfew\!) 2004-09-19 18:34:47 +00:00
ehofman
de47d1a7d8 Revert to CVS as of 5000 seconds ago. 2004-09-19 17:59:40 +00:00
ehofman
88b8990409 Fix some link errors. 2004-09-19 17:29:07 +00:00
ehofman
887c0c0f65 Fix some link errors. 2004-09-19 17:27:44 +00:00
ehofman
db3bbd25e9 Fix some compile errors. 2004-09-19 17:18:11 +00:00
ehofman
cbdeb3be16 Remove unnecessary inclusions of sg.h ans ssg.h 2004-09-19 16:47:00 +00:00
ehofman
1a87ef23f5 Jim Wilson:
This is a workaround for an issue where the xml dialogs were shrinking on
subsequent pops.

Andy Ross says:

That looks like it should be fine for a release-time workaround.  The
2 pixel border on dialogs is at best a minor feature, and probably
invisible since the sub-frames all have their own padding.

Clearly the right fix would be to find out where the code is getting
confused by the previous layout.  In principle, the layout should be
idempotent: if you don't change the layout constraints, it shouldn't
change its layout.  There's still a bug in there somewhere.
2004-07-23 07:36:32 +00:00
david
2bcec1fbbc Ignore generated files. 2004-06-15 12:48:22 +00:00
andy
4c2f5ce59e Don't set values on "live" text objects to prevent confusion when a
dialog-apply happens.
2004-05-15 21:41:42 +00:00
andy
bc22a50cde Fix the slider to request a non-zero length, and make its width a
little larger.

The text widget can now be meaningfully associated with a property; in
PUI, it's "value" isn't the same thing as its label, but we can hack
things to treat them symmetrically.

Commit an experimental "live" property that can be set on widgets to
cause them to update their values every frame.  This works great for
text widgets, as above.  Note that this synchronization is input-only:
no support is provided (or needed -- the GUI only changes when the
user does something) for writing those properties out every frame.
2004-05-14 17:16:35 +00:00
andy
269134465a Oops, need config.h before pu.h or else the build will fail on
glut-less systems.
2004-05-12 20:51:47 +00:00
andy
eeeee3a53e GUI layout management and a few visual/eye-candy modifications. See
DOCS/README.layout in the base package for details, along with the
modified dialog files.
2004-05-12 15:36:07 +00:00
andy
09d4176e96 GUI windows are now draggable. This missing feature has annoyed me
for a while, it turned out to be pretty easy to implement.  Also, the
property picker is now non-modal, I presume the modality wasn't an
intentional feature.
2004-05-03 00:40:50 +00:00
ehofman
2a4fd79bb4 Remove the references to fg_os.hxx since the UL_USE_XXX variable is located in the config.h file since the changes for confgure.ac. 2004-04-30 08:44:35 +00:00
andy
7ceb85d454 Changes to get FlightGear (well, the src directory at least) to
configure and compile out-of-the-box on a MinGW target:

Use -lSDL instead of -lglut32 on windows builds when --enable-sdl
is set.

Link against alut.dll in addition to openal32.dll.

Replace BSD bcopy() with ANSI C memmove() in a few places.  This is
simpler than trying to abstract it out as a platform dependency in a
header file; bcopy() has never been standard.

The ENABLE_THREADS handling has changed to be set to 0 when threads
are not in use.  This breaks expressions like #ifdef ENABLE_THREADS.
Replace with a slightly more complicated expression.  It might have
been better to fix the configure.ac script, but I didn't know how and
this whole setting is likely to go away soon anyway.

The MinGW C runtime actually does include snprintf, so only MSVC
builds (and not all WIN32 ones) need _snprintf in JSBSim/FGState.cpp

Building on a platform with no glut at all exposed some spots where
plib/pu.h was being included without a toolkit setting (it defaults to
glut).  Include fg_os.hxx first.

And when still using glut, glut.h has a bizarre dependency on a
_WCHAR_T_DEFINED symbol.  It it's not defined, it tries to redefine
(!!) wchar_t to disasterous effect.
2004-04-30 00:52:11 +00:00
ehofman
e83af4e235 Make sure pu.h doesn't include glut by accident. 2004-04-29 09:36:27 +00:00
ehofman
70cb759ea8 Frederic Bouvier discovered a buffer overflow in the airport select dialog. 2004-04-24 21:25:54 +00:00
andy
897cc6295c Need to include fg_os.hxx, so the PUI initialization picks the right library. 2004-04-05 21:51:16 +00:00
ehofman
e30112a5ca Frederic Bouvier:
this patch is to clear a problem that I sometimes
encounter : FG locks when hitting the cancel button
of a dialog. In fact, an interator is always invalid
when it was used to erase a member of a collection.
The braces are here to help my debugger, and I also
removed a warning about unused variable.
2004-04-05 11:29:12 +00:00
andy
db79413b6e Win32 typos crept in during the patch. Fix from Frederic Bouvier. 2004-04-01 15:14:34 +00:00
curt
a3b6a593d6 Don't include an unnecessary header. 2004-03-31 23:53:51 +00:00
andy
c0b4531d04 Yank out all the glut dependencies and concentrate them in a (easily
reimplementable) Main/fg_os.cxx file.
2004-03-31 21:10:32 +00:00
curt
7f3a870b03 Fix a type mismatch error introduced with the latest changes to
src/Airports/simple.[ch]xx
2004-02-23 11:42:49 +00:00
curt
348d3e26ce Comment out some unused references and left over debugging output. 2004-02-03 19:34:23 +00:00
curt
da5ea10d5d Curt Olson:
Autopilot overhaul.
2004-01-31 19:47:45 +00:00
curt
9c49534907 Attempt #1 to sort out confusion between left / right / parking brake
controls in the cockpit vs. which wheels they apply to.  FlightGear now
sets /controls/gear/brake-left, /controls/gear/brake-right, and
/controls/gear/brake-parking.  It should be up to the FDM to sort out
which wheels under which circumstances are affected by these controls
and ultimately what happens to the physical motion of the aircraft.
2004-01-12 17:39:41 +00:00
andy
0b3159ec0c Add a new command, "dialog-new", allowing external code (e.g. Nasal
scripts) to create dialogs at runtime.  Augment "dialog-close" to take
a name argument, allowing code other than PUI callbacks to close
dialogs.

The changes to the GUI directory to enable this are actually minor,
basically amounting to using SGPropertyNode_ptr reference counting
(the GUI subsystem no longer "controls" the dialog property trees, so
it can't delete them).
2003-12-08 02:05:10 +00:00
ehofman
4a68c2ffb0 Use strndup() replacement code that doesn't cause a segmentation fault. 2003-11-28 20:25:50 +00:00
ehofman
378a4ba0f7 Make room for the terminatig '\0' and prevent a potential buffer overflow. 2003-11-28 17:56:36 +00:00
ehofman
cd0c447b43 Add David Culp's AI model manager code which is derived from David Luff's AI/ATC code. 2003-11-28 15:48:05 +00:00
ehofman
06ce7ae928 IRIX/MipsPro 7.2 doesn't have strndup. Work around it. 2003-11-28 10:25:33 +00:00
david
8b2cfb515b Add a scrolling list widget for selecting airports. 2003-11-27 23:41:00 +00:00
ehofman
e322c70f52 Depreciate NetworkOLK. A big thanks goes to Oliver Delise for implementing it in the first place. 2003-11-13 14:42:47 +00:00
david
81d86fbe27 Started a README. 2003-10-01 21:09:39 +00:00
ehofman
980012e168 Move FGEventMgr and FGSubsystemMgr over to SimGear, add SGEventMgr to FlightGear's globals structre and some small code cleanups 2003-09-24 17:20:55 +00:00
ehofman
a33ad90ed7 Convert fgLIGHT to FGLight and make it FGSubsystem compatible. Let the subsystem manager handle it and let FGLight::update() handle the repositioning of the sun and the moon. 2003-09-20 09:38:32 +00:00
ehofman
6f8aa7b331 Change GLUT_H to FG_GLUT_H to prevent a naming clash with freeglut. 2003-08-21 09:12:12 +00:00
ehofman
5ae096b225 Reorganization of main.cxx 2003-08-17 09:54:41 +00:00
curt
bcb10efa50 Remove several unneeded glut dependencies. Note, this doesn't signal an
immediate end to glut, only that I'm going through and cleaning up (and
taking inventory of the actual glut dependencies in case I want to investigate
SDL.)
2003-08-11 21:50:22 +00:00
curt
383c91b818 Add a missing source file. 2003-06-05 03:43:43 +00:00
ehofman
c8f9fc0ae4 from the C++ FAQ:
TITLE: Using delete [] versus delete

The extra "[]" warns the compiler that there is a whole array of objects here so that P's destructor must be called on each element of the array rather than just on P itself (which would be equivalent to the first element only).
2003-05-22 08:42:38 +00:00
curt
56db994994 Moved src/Model/loader.[ch]xx and src/Model/model.[ch]xx to
simgear/scene/model/
2003-05-09 20:40:59 +00:00
curt
51c04e9e4c - Added "SG" prefix to sound classes that recently moved to SimGear.
- Cleaned up some minor compiler warnings.
- Moved src/Model/placement.[ch]xx over into simgear/scene/model/
2003-05-09 19:39:48 +00:00
curt
2119db35c3 This is step "1" of probably "many" in the process of separating out the
scene management code and organizing it within simgear.  My strategy is
to identify the code I want to move, and break it's direct flightgear
dependencies.  Then it will be free to move over into the simgear package.

- Moved some property specific code into simgear/props/
- Split out the condition code from fgfs/src/Main/fg_props and put it
  in it's own source file in simgear/props/
- Created a scene subdirectory for scenery, model, and material property
  related code.
- Moved location.[ch]xx into simgear/scene/model/
- The location and condition code had dependencies on flightgear's global
  state (all the globals-> stuff, the flightgear property tree, etc.)  SimGear
  code can't depend on it so that data has to be passed as parameters to the
  functions/methods/constructors.
- This need to pass data as function parameters had a dramatic cascading
  effect throughout the FlightGear code.
2003-05-06 23:46:24 +00:00
ehofman
ea24640f96 MSVC6 updates 2003-04-13 21:25:46 +00:00
david
726d97be3c Removed old menubar option. 2003-04-01 15:50:51 +00:00
ehofman
7de4466897 Change some cerr messages into SG_LOG messages 2003-03-31 09:36:49 +00:00
ehofman
7948238156 Declare fgReshape into gui.h 2003-03-30 19:40:43 +00:00
ehofman
4b62426109 Move current_panel to globals 2003-03-30 12:46:08 +00:00
ehofman
37c427558a A first stab at an aircraft selection dialog 2003-03-29 15:04:52 +00:00
curt
f4ccd7dfe2 Remove some compiler warnings. 2003-03-21 20:39:27 +00:00
ehofman
df2ce45ab7 Change cout and cerr in SG_LOG() where appropriate, otherwise comment it out 2003-03-20 10:43:02 +00:00
david
648f1208f8 Patch from Frederic Bouvier:
arrays of insufficient size are allocated in prop_picker.cxx ( size()
don't count the null char ) and strcpy is writing outside the allocated
array. A patch follow.
2003-03-02 16:37:48 +00:00
david
9864453259 GUI style changes suggested by Erik Hofman and Curtis Olson. 2003-02-05 02:17:08 +00:00
curt
23668a2a08 Rephrased some comments to avoid /* in a comment warnings. 2003-02-04 22:28:48 +00:00
curt
b6e4238dfa Clean up a compiler warning. 2003-02-04 22:28:19 +00:00
curt
e8b6077c79 James Turner:
Here's a change to the GUI property picker I did a few weeks back.
It makes the values in the property pick 'live' (and also re-factors
the picker code to use less arrays, this should be obvious from the
diffs). A good demo is to open up the engine node and observe the rpm,
cylinder head temp, oil pressure and so on while playing with the
throttle and airspeed. It's pretty rough (some rounding of digits would
help) but useful for testing (at least I think so). I'm not sure about
the performance implications either, but it seems fine for me.
2003-02-04 22:27:58 +00:00
david
269c83b86a Correct old-reinit_dialog to old-reinit-dialog. 2003-01-27 15:39:41 +00:00
david
c8f775c103 Switch to opaque dialogs and menu (with a heavy heart). 2003-01-26 20:19:15 +00:00
david
980eae6187 Remove old-preset-* commands; replaced with a general, XML presets
dialog.
2003-01-24 02:49:30 +00:00
david
8e659f84fa No longer recursively search $FG_ROOT/gui/dialogs/ for configuration
files; all of them must be at the top level.

Do not attempt to parse a configuration file unless it ends with
".xml".
2003-01-24 02:43:52 +00:00
david
d819c42184 Remove another deprecated command, and fix things up so that dialogs
reload properly on a reinit.
2003-01-21 15:44:21 +00:00