# include <windows.h>
#endif
-#include <simgear/misc/props.hxx>
-#include <simgear/misc/props_io.hxx>
#include <simgear/misc/exception.hxx>
#include <simgear/misc/sg_path.hxx>
+#include <simgear/props/props.hxx>
+#include <simgear/props/props_io.hxx>
#include <plib/pu.h>
#include "gui.h"
#include "gui_local.hxx"
-#include "apt_dlg.hxx"
#include "net_dlg.hxx"
+#include "preset_dlg.hxx"
// main.cxx hack, should come from an include someplace
extern void fgInitVisuals( void );
-extern void fgReshape( int width, int height );
extern void fgRenderFrame( void );
extern void initDialog (void);
puFont guiFnt = 0;
fntTexFont *guiFntHandle = 0;
-int gui_menu_on = 0;
-puMenuBar *mainMenuBar = 0;
-//static puButton *hideMenuButton = 0;
-
-
-struct fg_gui_t {
- char *name;
- char **submenu;
- puCallback *cb;
-} *Menu;
-unsigned int Menu_size;
-
-void initMenu()
-{
- SGPropertyNode main;
- SGPath spath( globals->get_fg_root() );
- spath.append( "menu.xml" );
-
- try {
- readProperties(spath.c_str(), &main);
- } catch (const sg_exception &ex) {
- SG_LOG(SG_GENERAL, SG_ALERT, "Error processing the menu file.");
- return;
- }
-
- SG_LOG(SG_GENERAL, SG_INFO, "Reading menu entries.");
-
- // Make the menu bar
- mainMenuBar = new puMenuBar ();
-
- SGPropertyNode *menu = main.getChild("menu");
-
- vector<SGPropertyNode_ptr>submenu = menu->getChildren("submenu");
-
- Menu_size = 1+submenu.size();
- Menu = (fg_gui_t *)calloc(Menu_size, sizeof(fg_gui_t));
-
- for (unsigned int h = 0; h < submenu.size(); h++) {
-
- vector<SGPropertyNode_ptr>option = submenu[h]->getChildren("option");
-
- //
- // Make sure all entries will fit into allocated memory
- //
- Menu[h].submenu = (char **)calloc(1+option.size(), sizeof(char *));
- Menu[h].cb = (puCallback *)calloc(1+option.size(), sizeof(puCallback));
-
- for (unsigned int i = 0; i < option.size(); i++) {
-
- SGPropertyNode *name = option[i]->getNode("name");
- SGPropertyNode *call = option[i]->getNode("call");
- SGPropertyNode *sep = option[i]->getNode("seperator");
-
- if (sep)
- Menu[h].submenu[i] = strdup("----------");
-
- else if (call && strcmp(call->getStringValue(), ""))
- Menu[h].submenu[i] = strdup(name->getStringValue());
-
- else
- Menu[h].submenu[i] = strdup("not specified");
-
- Menu[h].cb[i] = NULL;
- for (unsigned int j=0; __fg_gui_fn[j].fn; j++)
- if (call &&
- !strcmp(call->getStringValue(), __fg_gui_fn[j].name) )
- {
- Menu[h].cb[i] = __fg_gui_fn[j].fn;
- break;
- }
- }
-
- SGPropertyNode *name = submenu[h]->getNode("name");
-
- Menu[h].name = strdup(name->getStringValue());
- mainMenuBar->add_submenu(Menu[h].name, Menu[h].submenu, Menu[h].cb);
-
- }
-
- mainMenuBar->close();
-}
-
-
-// FIXME: Has to be called from somewhere
-// or better yet, turn the menu into a class of its own
-void destroyMenu(void) {
- for(unsigned int i=0; i < Menu_size; i++) {
-
- free(Menu[i].name);
-
- // FIXME: don't use strdup/free
- for(unsigned int j=0; Menu[i].submenu[j] != NULL; j++)
- free(Menu[i].submenu[j]);
- }
-}
-
-
/* -------------------------------------------------------------------------
// Initialize PUI
puInit();
puSetDefaultStyle ( PUSTYLE_SMALL_BEVELLED ); //PUSTYLE_DEFAULT
- puSetDefaultColourScheme (0.8, 0.8, 0.8, 0.4);
+ puSetDefaultColourScheme (0.8, 0.8, 0.9, 0.8);
initDialog();
}
// Install our fast fonts
- fntpath.append( "typewriter.txf" );
+ SGPropertyNode *locale = globals->get_locale();
+ fntpath.append(locale->getStringValue("font", "typewriter.txf"));
guiFntHandle = new fntTexFont ;
guiFntHandle -> load ( (char *)fntpath.c_str() ) ;
puFont GuiFont ( guiFntHandle, 15 ) ;
// Set up our Dialog Boxes
ConfirmExitDialogInit();
- NewAirportInit();
+ fgPresetInit();
#ifdef FG_NETWORK_OLK
NewNetIdInit();
#endif
mkDialogInit();
-
- initMenu();
-
- // Set up menu bar toggle
- gui_menu_on = ~0;
-
- if (!strcmp(fgGetString("/sim/flight-model"), "ada")) {
- guiToggleMenu(); // Menu off by default
- }
}