fi
AM_CONDITIONAL(ENABLE_WEATHERCM, test "x$with_weathercm" = "xyes")
-dnl Specify if we want the old menubar; default to the new one
-AC_ARG_WITH(old-menubar, [ --with-old-menubar Use the old menu bar])
-if test "x$with_old_menubar" = "xyes" ; then
- echo "Building with old menubar"
- AC_DEFINE([FG_OLD_MENUBAR], 1,
- [Define to build with old menubar])
-else
- echo "Building with new menubar"
-fi
-
dnl Thread related checks
AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=no]])
if test "x$with_threads" = "xyes"; then
echo "Using Oliver's multi-pilot network support"
fi
-if test "x$with_old_menubar" != "x"; then
- echo "Using old menubar"
-else
- echo "Defaulting to new XML-configurable menubar"
-fi
-
if test "x$with_threads" = "xyes"; then
echo "threads: yes"
else
puFont guiFnt = 0;
fntTexFont *guiFntHandle = 0;
-#if defined(FG_OLD_MENUBAR)
-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;
-
- try {
- fgLoadProps("menu.xml", &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");
- SGPropertyNode *locale = globals->get_locale();
-
- 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");
-
- int pos = option.size()-i-1;
- if (sep) {
- Menu[h].submenu[pos] = strdup("----------");
- } else if (call && strcmp(call->getStringValue(), "")) {
- string text = locale->getStringValue( name->getStringValue(),
- "strings/null" );
- Menu[h].submenu[pos]
- = strdup(text.c_str());
- } else {
- Menu[h].submenu[pos] = strdup("not specified");
- }
-
- Menu[h].cb[pos] = 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[pos] = __fg_gui_fn[j].fn;
- break;
- }
- }
-
- SGPropertyNode *name = submenu[h]->getNode("name");
- string text = locale->getStringValue( name->getStringValue(),
- "strings/null" );
-
- Menu[h].name = strdup(text.c_str());
- 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]);
- }
-}
-#endif
-
/* -------------------------------------------------------------------------
#endif
mkDialogInit();
-
-#if defined(FG_OLD_MENUBAR)
- initMenu();
-
- // Set up menu bar toggle
- gui_menu_on = ~0;
-
- if (!strcmp(fgGetString("/sim/flight-model"), "ada")) {
- guiToggleMenu(); // Menu off by default
- }
-#endif
}
// gui.cxx
extern void guiInit();
-#if defined (FG_OLD_MENUBAR)
-extern void guiToggleMenu(void);
-#endif
extern void mkDialog(const char *txt);
extern void guiErrorMessage(const char *txt);
extern void guiErrorMessage(const char *txt, const sg_throwable &throwable);
GLfloat x_end, GLfloat y_end );
#endif
-#if defined(FG_OLD_MENUBAR)
-extern puMenuBar *mainMenuBar;
-#endif
-
puDialogBox *dialogBox = 0;
puFrame *dialogFrame = 0;
puText *dialogBoxMessage = 0;
mkDialog(msg.c_str());
}
-#if defined(FG_OLD_MENUBAR)
-// Toggle the Menu and Mouse display state
-void guiToggleMenu(void)
-{
- if( gui_menu_on ) {
- // printf("Hiding Menu\n");
- mainMenuBar->hide ();
-#if defined(WIN32_CURSOR_TWEAKS_OFF)
- if( mouse_mode == MOUSE_POINTER )
- TurnCursorOff();
-#endif // WIN32_CURSOR_TWEAKS_OFF
- } else {
- // printf("Showing Menu\n");
- mainMenuBar->reveal();
-#ifdef WIN32
- TurnCursorOn();
-#endif // WIN32
- }
- gui_menu_on = ~gui_menu_on;
-}
-#endif // FG_OLD_MENUBAR
-
// Intercept the Escape Key
void ConfirmExitDialog(void)
{
fgGetInt("/sim/startup/ysize"));
}
-#if defined(FG_OLD_MENUBAR)
-//void MenuHideMenuCb(puObject *cb)
-void hideMenuCb (puObject *cb)
-{
- guiToggleMenu();
-}
-#endif
-
void goodBye(puObject *)
{
// SG_LOG( SG_INPUT, SG_ALERT,
fgSetBool("/sim/freeze/master", true);
}
-#if defined(FG_OLD_MENUBAR)
- if(gui_menu_on) {
- show_menu = true;
- guiToggleMenu();
- }
-#endif
-
if ( !puCursorIsHidden() ) {
show_pu_cursor = true;
puHideCursor();
delete [] filename;
-#if defined(FG_OLD_MENUBAR)
- if( show_menu )
- guiToggleMenu();
-#endif
-
if ( show_pu_cursor ) {
puShowCursor();
}
puHideCursor();
}
// BusyCursor( 0 );
-#if defined(FG_OLD_MENUBAR)
- mainMenuBar->hide();
-#endif
CGlPrinter p( CGlPrinter::PRINT_BITMAP );
int cur_width = fgGetInt("/sim/startup/xsize");
p.Begin( "FlightGear", cur_width*3, cur_height*3 );
p.End( hiResScreenCapture(3) );
-#if defined(FG_OLD_MENUBAR)
- if( gui_menu_on ) {
- mainMenuBar->reveal();
- }
-#endif
// BusyCursor(1);
if ( show_pu_cursor ) {
puShowCursor();
fgSetBool("/sim/freeze/master", true);
}
-#if defined(FG_OLD_MENUBAR)
- mainMenuBar->hide();
-#endif
TurnCursorOff();
if ( !puCursorIsHidden() ) {
show_pu_cursor = true;
}
TurnCursorOn();
-#if defined(FG_OLD_MENUBAR)
- if( gui_menu_on ) {
- mainMenuBar->reveal();
- }
-#endif
if ( !freeze ) {
fgSetBool("/sim/freeze/master", false);
ulMakePath(path1, globals->get_fg_root().c_str(), "gui");
ulMakePath(path2, path1, "dialogs");
readDir(path2);
-#if !defined(FG_OLD_MENUBAR)
_menubar->init();
-#endif
}
void