From 726d97be3cf42d0c0346428dd7142dc049882f54 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 1 Apr 2003 15:50:51 +0000 Subject: [PATCH] Removed old menubar option. --- configure.ac | 16 ------ src/GUI/gui.cxx | 113 ------------------------------------------ src/GUI/gui.h | 3 -- src/GUI/gui_funcs.cxx | 62 ----------------------- src/GUI/new_gui.cxx | 2 - 5 files changed, 196 deletions(-) diff --git a/configure.ac b/configure.ac index 1046369af..5c861dec5 100644 --- a/configure.ac +++ b/configure.ac @@ -92,16 +92,6 @@ else 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 @@ -656,12 +646,6 @@ elif test "x$with_network_olk" != "xno"; 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 diff --git a/src/GUI/gui.cxx b/src/GUI/gui.cxx index 425f4c066..e853760b1 100644 --- a/src/GUI/gui.cxx +++ b/src/GUI/gui.cxx @@ -62,108 +62,6 @@ extern void ConfirmExitDialogInit(void); 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(); - - vectorsubmenu = 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++) { - - vectoroption = 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 - /* ------------------------------------------------------------------------- @@ -237,15 +135,4 @@ void guiInit() #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 } diff --git a/src/GUI/gui.h b/src/GUI/gui.h index c0653673d..69d0026c6 100644 --- a/src/GUI/gui.h +++ b/src/GUI/gui.h @@ -44,9 +44,6 @@ // 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); diff --git a/src/GUI/gui_funcs.cxx b/src/GUI/gui_funcs.cxx index 4d72f2434..8c17c1ebf 100644 --- a/src/GUI/gui_funcs.cxx +++ b/src/GUI/gui_funcs.cxx @@ -118,10 +118,6 @@ extern void fgUpdateHUD( GLfloat x_start, GLfloat y_start, 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; @@ -246,28 +242,6 @@ void guiErrorMessage (const char *txt, const sg_throwable &throwable) 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) { @@ -427,14 +401,6 @@ void guiTogglePanel(puObject *cb) 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, @@ -590,13 +556,6 @@ void fgHiResDump() 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(); @@ -757,11 +716,6 @@ void fgHiResDump() delete [] filename; -#if defined(FG_OLD_MENUBAR) - if( show_menu ) - guiToggleMenu(); -#endif - if ( show_pu_cursor ) { puShowCursor(); } @@ -820,9 +774,6 @@ void printScreen ( puObject *obj ) { puHideCursor(); } // BusyCursor( 0 ); -#if defined(FG_OLD_MENUBAR) - mainMenuBar->hide(); -#endif CGlPrinter p( CGlPrinter::PRINT_BITMAP ); int cur_width = fgGetInt("/sim/startup/xsize"); @@ -830,11 +781,6 @@ void printScreen ( puObject *obj ) { 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(); @@ -869,9 +815,6 @@ void fgDumpSnapShot () { fgSetBool("/sim/freeze/master", true); } -#if defined(FG_OLD_MENUBAR) - mainMenuBar->hide(); -#endif TurnCursorOff(); if ( !puCursorIsHidden() ) { show_pu_cursor = true; @@ -915,11 +858,6 @@ void fgDumpSnapShot () { } TurnCursorOn(); -#if defined(FG_OLD_MENUBAR) - if( gui_menu_on ) { - mainMenuBar->reveal(); - } -#endif if ( !freeze ) { fgSetBool("/sim/freeze/master", false); diff --git a/src/GUI/new_gui.cxx b/src/GUI/new_gui.cxx index d5b86c2fc..67edea609 100644 --- a/src/GUI/new_gui.cxx +++ b/src/GUI/new_gui.cxx @@ -37,9 +37,7 @@ NewGUI::init () ulMakePath(path1, globals->get_fg_root().c_str(), "gui"); ulMakePath(path2, path1, "dialogs"); readDir(path2); -#if !defined(FG_OLD_MENUBAR) _menubar->init(); -#endif } void