]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/hud.cxx
Sep 8, 2000 panel updates from David Megginson.
[flightgear.git] / src / Cockpit / hud.cxx
index c8124619e5d608415f965fdcc0e149e191994ab3..75af7a76797a442435fc36ea66ffa0d0cb5d377e 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
-#ifdef HAVE_VALUES_H
-#  include <values.h>  // for MAXINT
-#endif
-
-#include <simgear/logstream.hxx>
 #include <simgear/constants.h>
-#include <simgear/fg_random.h>
-#include <simgear/mat3.h>
-#include <simgear/polar3d.hxx>
+#include <simgear/debug/logstream.hxx>
+//#include <simgear/math/fg_random.h>
+//#include <simgear/math/polar3d.hxx>
 
 #include <Aircraft/aircraft.hxx>
+#include <Autopilot/newauto.hxx>
 #include <GUI/gui.h>
 #include <Main/options.hxx>
 #ifdef FG_NETWORK_OLK
 #include <NetworkOLK/network.h>
 #endif
 #include <Scenery/scenery.hxx>
-#include <Time/fg_timer.hxx>
+//#include <Time/fg_timer.hxx>
 
 #if defined ( __sun__ ) || defined ( __sgi )
 extern "C" {
@@ -78,6 +74,15 @@ fgTextList         HUD_TextList;
 fgLineList         HUD_LineList;
 fgLineList         HUD_StippleLineList;
 
+fntRenderer *HUDtext = 0;
+float  HUD_TextSize = 0;
+int HUD_style = 0;
+
+float HUD_matrix[16];
+static float hud_trans_alpha = 0.67f;
+
+void fgHUDalphaInit( void );
+
 class locRECT {
   public:
     RECT rect;
@@ -96,6 +101,7 @@ locRECT :: locRECT( UINT left, UINT top, UINT right, UINT bottom)
 }
 // #define DEBUG
 
+#ifdef OLD_CODE
 void drawOneLine( UINT x1, UINT y1, UINT x2, UINT y2)
 {
   glBegin(GL_LINES);
@@ -122,7 +128,6 @@ void textString( int x, int y, char *msg, void *font ){
     if(*msg)
     {
 //      puDrawString (  NULL, msg, x, y );
-        
         glRasterPos2f(x, y);
         while (*msg) {
             glutBitmapCharacter(font, *msg);
@@ -168,6 +173,7 @@ int getStringWidth ( char *str )
     }
     return 0 ;
 }
+#endif // OLD_CODE
 
 //========================= End of Class Implementations===================
 // fgHUDInit
@@ -185,7 +191,6 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
 {
   instr_item *HIptr;
 //  int index;
-  int font_size;
 
 //  int off = 50;
   int min_x = 25; //off/2;
@@ -201,7 +206,8 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
   int compass_w = 200;
   int gap = 10;
 
-  font_size = (current_options.get_xsize() > 1000) ? LARGE : SMALL;
+//  int font_size = current_options.get_xsize() / 60;
+  int font_size = (current_options.get_xsize() > 1000) ? LARGE : SMALL;
   
   HUD_style = 1;
 
@@ -654,7 +660,9 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
 //    }
 //  while( HIptr );
 
-  return 0;  // For now. Later we may use this for an error code.
+  fgHUDalphaInit();
+  fgHUDReshape();
+   return 0;  // For now. Later we may use this for an error code.
 
 }
 
@@ -662,7 +670,6 @@ int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ )
 {
 //    instr_item *HIptr;
 //    int index;
-    int font_size;
 
     int off = 50;
 //  int min_x = off;
@@ -678,7 +685,8 @@ int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ )
     int compass_w = 200;
 //  int gap = 10;
 
-    font_size = (current_options.get_xsize() > 1000) ? LARGE : SMALL;
+//     int font_size = current_options.get_xsize() / 60;
+    int font_size = (current_options.get_xsize() > 1000) ? LARGE : SMALL;
 
     HUD_style = 2;
 
@@ -949,220 +957,213 @@ int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ )
 
 int global_day_night_switch = DAY;
 
-void HUD_brightkey( bool incr_bright )
+void HUD_masterswitch( bool incr )
 {
-instr_item *pHUDInstr = HUD_deque[0];
-int brightness        = pHUDInstr->get_brightness();
-
-  if( current_options.get_hud_status() ) {
-    if( incr_bright ) {
-      switch (brightness) {
-        case BRT_LIGHT:
-          current_options.set_hud_status(0);
-          break;
-
-        case BRT_MEDIUM:
-          brightness = BRT_LIGHT;
-          break;
-
-        case BRT_DARK:
-          brightness = BRT_MEDIUM;
-          break;
-
-        case BRT_BLACK:
-          brightness = BRT_DARK;
-          break;
-
-        default:
-          brightness = BRT_BLACK;
-        }
-      }
-    else {
-      switch (brightness) {
-        case BRT_LIGHT:
-          brightness = BRT_MEDIUM;
-          break;
-
-        case BRT_MEDIUM:
-          brightness = BRT_DARK;
-          break;
-
-        case BRT_DARK:
-          brightness = BRT_BLACK;
-          break;
-
-        case BRT_BLACK:
-        default:
-          current_options.set_hud_status(0);
-        }
-      }
-    }
-  else {
-    current_options.set_hud_status(1);
-    if( incr_bright ) {
-      if( DAY == global_day_night_switch ) {
-        brightness = BRT_BLACK;
-        }
-      else {
-        brightness = BRT_DARK;
-        global_day_night_switch = DAY;
-        }
-      }
-    else {
-      if( NIGHT == global_day_night_switch ) {
-        brightness = BRT_DARK;
-        }
-      else {
-        brightness = BRT_MEDIUM;
-        global_day_night_switch = NIGHT;
-        }
-      }
-    }
-  pHUDInstr->SetBrightness( brightness );
+    if ( current_options.get_hud_status() ) {
+       if ( global_day_night_switch == DAY ) {
+           global_day_night_switch = NIGHT;
+       } else {
+           current_options.set_hud_status( false );
+       }
+    } else {
+       current_options.set_hud_status( true );
+       global_day_night_switch = DAY;
+    }  
 }
 
-#if 0
-// fgUpdateHUD
-//
-// Performs a once around the list of calls to instruments installed in
-// the HUD object with requests for redraw. Kinda. It will when this is
-// all C++.
-//
-void fgUpdateHUD( void ) {
-  int brightness;
-//  int day_night_sw = current_aircraft.controls->day_night_switch;
-  int day_night_sw = global_day_night_switch;
-  int hud_displays = HUD_deque.size();
-  instr_item *pHUDInstr;
-  float line_width;
-
-  if( !hud_displays ) {  // Trust everyone, but ALWAYS cut the cards!
-    return;
+void HUD_brightkey( bool incr_bright )
+{
+    instr_item *pHUDInstr = HUD_deque[0];
+    int brightness        = pHUDInstr->get_brightness();
+
+    if( current_options.get_hud_status() ) {
+       if( incr_bright ) {
+           switch (brightness)
+               {
+               case BRT_LIGHT:
+                   brightness = BRT_BLACK;
+                   break;
+
+               case BRT_MEDIUM:
+                   brightness = BRT_LIGHT;
+                   break;
+
+               case BRT_DARK:
+                   brightness = BRT_MEDIUM;
+                   break;
+
+               case BRT_BLACK:
+                   brightness = BRT_DARK;
+                   break;
+
+               default:
+                   brightness = BRT_BLACK;
+               }
+       } else {
+           switch (brightness)
+               {
+               case BRT_LIGHT:
+                   brightness = BRT_MEDIUM;
+                   break;
+
+               case BRT_MEDIUM:
+                   brightness = BRT_DARK;
+                   break;
+
+               case BRT_DARK:
+                   brightness = BRT_BLACK;
+                   break;
+
+               case BRT_BLACK:
+                   brightness = BRT_LIGHT;
+                   break;
+
+               default:
+                   current_options.set_hud_status(0);
+               }
+       }
+    } else {
+       current_options.set_hud_status(true);
     }
 
-  HUD_TextList.erase();
-  HUD_LineList.erase();
-//  HUD_StippleLineList.erase();
-  
-  pHUDInstr = HUD_deque[0];
-  brightness = pHUDInstr->get_brightness();
-//  brightness = HUD_deque.at(0)->get_brightness();
+    pHUDInstr->SetBrightness( brightness );
+}
 
-  glMatrixMode(GL_PROJECTION);
-  glPushMatrix();
 
-  glLoadIdentity();
-  gluOrtho2D(0, 640, 0, 480);
-  glMatrixMode(GL_MODELVIEW);
-  glPushMatrix();
-  glLoadIdentity();
-
-  glColor3f(1.0, 1.0, 1.0);
-  glIndexi(7);
+#define fgAP_CLAMP(val,min,max) ( (val) = (val) > (max) ? (max) : (val) < (min) ? (min) : (val) )
 
-  glDisable(GL_DEPTH_TEST);
-  glDisable(GL_LIGHTING);
+static puDialogBox *HUDalphaDialog;
+static puText      *HUDalphaText;
+static puSlider    *HUDalphaHS0;
+//static puText      *HUDtextText;
+//static puSlider    *HUDalphaHS1;
+static char         SliderText[2][ 8 ];
 
-  // We can do translucency, so why not. :-)
-//  glEnable    ( GL_BLEND ) ;
-//  glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
-  
-  if( day_night_sw == DAY) {
-      switch (brightness) {
-          case BRT_LIGHT:
-//            glColor4f (0.1, 0.9, 0.1, 0.75);
-            glColor3f (0.1, 0.9, 0.1);
-            break;
+static void alpha_adj( puObject *hs ) {
+       float val ;
 
-          case BRT_MEDIUM:
-//            glColor4f (0.1, 0.7, 0.0, 0.75);
-            glColor3f (0.1, 0.7, 0.0);
-            break;
+       hs-> getValue ( &val ) ;
+       fgAP_CLAMP ( val, 0.1, 1.0 ) ;
+       //    printf ( "maxroll_adj( %p ) %f %f\n", hs, val, MaxRollAdjust * val ) ;
+       hud_trans_alpha = val;
+       sprintf( SliderText[ 0 ], "%05.2f", hud_trans_alpha );
+       HUDalphaText -> setLabel ( SliderText[ 0 ] ) ;
+}
 
-          case BRT_DARK:
-//            glColor4f (0.0, 0.6, 0.0, 0.75);
-            glColor3f(0.0, 0.6, 0.0);
-            break;
+void fgHUDalphaAdjust( puObject * ) {
+       current_options.set_anti_alias_hud(1);
+       FG_PUSH_PUI_DIALOG( HUDalphaDialog );
+}
 
-          case BRT_BLACK:
-//            glColor4f( 0.0, 0.0, 0.0, 0.75);
-            glColor3f( 0.0, 0.0, 0.0);
-            break;
+static void goAwayHUDalphaAdjust (puObject *)
+{
+       FG_POP_PUI_DIALOG( HUDalphaDialog );
+}
 
-          default:;
-      }
-  }
-  else {
-      if( day_night_sw == NIGHT) {
-          switch (brightness) {
-              case BRT_LIGHT:
-//                glColor4f (0.9, 0.1, 0.1, 0.75);
-                glColor3f (0.9, 0.1, 0.1);
-                break;
+static void cancelHUDalphaAdjust (puObject *)
+{
+       current_options.set_anti_alias_hud(0);
+       FG_POP_PUI_DIALOG( HUDalphaDialog );
+}
 
-              case BRT_MEDIUM:
-//                glColor4f (0.7, 0.0, 0.1, 0.75);
-                glColor3f (0.7, 0.0, 0.1);
-                break;
-
-              case BRT_DARK:
-              default:
-//                glColor4f (0.6, 0.0, 0.0, 0.75);
-                  glColor3f (0.6, 0.0, 0.0);
-          }
-      }
-          else {     // Just in case default
-//            glColor4f (0.1, 0.9, 0.1, 0.75);
-              glColor3f (0.1, 0.9, 0.1);
-          }
-  }
+// Done once at system initialization
+void fgHUDalphaInit( void ) {
 
-  deque < instr_item * > :: iterator current = HUD_deque.begin();
-  deque < instr_item * > :: iterator last = HUD_deque.end();
+       //      printf("fgHUDalphaInit\n");
+#define HORIZONTAL  FALSE
 
-  for ( ; current != last; ++current ) {
-      pHUDInstr = *current;
-
-      if( pHUDInstr->enabled()) {
-          //  fgPrintf( FG_COCKPIT, FG_DEBUG, "HUD Code %d  Status %d\n",
-          //            hud->code, hud->status );
-          pHUDInstr->draw();
-//        HUD_deque.at(i)->draw(); // Responsible for broken or fixed variants.
-                              // No broken displays honored just now.
-      }
-  }
+       int DialogX = 40;
+       int DialogY = 100;
+       int DialogWidth = 240;
 
-  char *gmt_str = get_formated_gmt_time();
-  HUD_TextList.add( fgText( 40, 10, gmt_str) );
+       char Label[] =  "HUD Adjuster";
+       char *s;
 
-#ifdef FG_NETWORK_OLK
-  if ( net_hud_display ) {
-      net_hud_update();
-  }
-#endif
+       int labelX = (DialogWidth / 2) -
+                                (puGetStringWidth( puGetDefaultLabelFont(), Label ) / 2);
+       
+       int nSliders = 1;
+       int slider_x = 10;
+       int slider_y = 55;
+       int slider_width = 220;
+       int slider_title_x = 15;
+       int slider_value_x = 160;
+       float slider_delta = 0.05f;
+
+       puFont HUDalphaLegendFont;
+       puFont HUDalphaLabelFont;
+       puGetDefaultFonts ( &HUDalphaLegendFont, &HUDalphaLabelFont );
+       
+       HUDalphaDialog = new puDialogBox ( DialogX, DialogY ); {
+               int horiz_slider_height = puGetStringHeight (HUDalphaLabelFont) +
+                                                                 puGetStringDescender (HUDalphaLabelFont) +
+                                                                 PUSTR_TGAP + PUSTR_BGAP + 5;
+
+               puFrame *
+               HUDalphaFrame = new puFrame ( 0, 0,
+                                                                         DialogWidth,
+                                                                         85 + nSliders * horiz_slider_height );
+               
+               puText *
+               HUDalphaDialogMessage = new puText ( labelX,
+                                                                                        52 + nSliders
+                                                                                        * horiz_slider_height );
+               HUDalphaDialogMessage -> setDefaultValue ( Label );
+               HUDalphaDialogMessage -> getDefaultValue ( &s );
+               HUDalphaDialogMessage -> setLabel        ( s );
+
+               HUDalphaHS0 = new puSlider ( slider_x, slider_y,
+                                                                        slider_width, HORIZONTAL ) ;
+               HUDalphaHS0->     setDelta ( slider_delta ) ;
+               HUDalphaHS0->     setValue ( hud_trans_alpha ) ;
+               HUDalphaHS0->    setCBMode ( PUSLIDER_DELTA ) ;
+               HUDalphaHS0->  setCallback ( alpha_adj ) ;
+
+               puText *
+               HUDalphaTitle =      new puText ( slider_title_x, slider_y ) ;
+               HUDalphaTitle-> setDefaultValue ( "Alpha" ) ;
+               HUDalphaTitle-> getDefaultValue ( &s ) ;
+               HUDalphaTitle->        setLabel ( s ) ;
+               
+               HUDalphaText = new puText ( slider_value_x, slider_y ) ;
+               sprintf( SliderText[ 0 ], "%05.2f", hud_trans_alpha );
+               HUDalphaText-> setLabel ( SliderText[ 0 ] ) ;
+
+
+               puOneShot *
+               HUDalphaOkButton =     new puOneShot ( 10, 10, 60, 45 );
+               HUDalphaOkButton->         setLegend ( gui_msg_OK );
+               HUDalphaOkButton-> makeReturnDefault ( TRUE );
+               HUDalphaOkButton->       setCallback ( goAwayHUDalphaAdjust );
+               
+               puOneShot *
+               HUDalphaNoButton = new puOneShot ( 160, 10, 230, 45 );
+               HUDalphaNoButton->     setLegend ( gui_msg_CANCEL );
+               HUDalphaNoButton->   setCallback ( cancelHUDalphaAdjust );
+       }
+       FG_FINALIZE_PUI_DIALOG( HUDalphaDialog );
+
+#undef HORIZONTAL
+}
 
-  HUD_TextList.draw();
+void fgHUDReshape(void) {
+       if ( HUDtext )
+               delete HUDtext;
 
-  line_width = (current_options.get_xsize() > 1000) ? 1.0 : 0.5;
-  glLineWidth(line_width);
-  HUD_LineList.draw();
+       HUD_TextSize = current_options.get_xsize() / 60;
+        HUD_TextSize = 10;
+       HUDtext = new fntRenderer();
+       HUDtext -> setFont      ( guiFntHandle ) ;
+       HUDtext -> setPointSize ( HUD_TextSize ) ;
+       HUD_TextList.setFont( HUDtext );
+}
 
-//  glEnable(GL_LINE_STIPPLE);
-//  glLineStipple( 1, 0x00FF );
-//  HUD_StippleLineList.draw();
-//  glDisable(GL_LINE_STIPPLE);
 
-//  glDisable( GL_BLEND );
-  
-  glEnable(GL_DEPTH_TEST);
-  glEnable(GL_LIGHTING);
-  glMatrixMode(GL_PROJECTION);
-  glPopMatrix();
-  glMatrixMode(GL_MODELVIEW);
-  glPopMatrix();
+static void set_hud_color(float r, float g, float b) {
+       current_options.get_anti_alias_hud() ?
+                       glColor4f(r,g,b,hud_trans_alpha) :
+                       glColor3f(r,g,b);
 }
-#endif
-
 
 // fgUpdateHUD
 //
@@ -1199,64 +1200,67 @@ void fgUpdateHUD( void ) {
   glPushMatrix();
   glLoadIdentity();
 
-  glColor3f(1.0, 1.0, 1.0);
-  glIndexi(7);
-
   glDisable(GL_DEPTH_TEST);
   glDisable(GL_LIGHTING);
 
-  // We can do translucency, so why not. :-)
-//  glEnable    ( GL_BLEND ) ;
-//  glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
-  
+  if( current_options.get_anti_alias_hud() ) {
+         glEnable(GL_LINE_SMOOTH);
+//       glEnable(GL_BLEND);
+         glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+         glHint(GL_LINE_SMOOTH_HINT,GL_DONT_CARE);
+         glLineWidth(1.5);
+  } else {
+         glLineWidth(1.0);
+  }
+
   if( day_night_sw == DAY) {
-         switch (brightness) {
-                 case BRT_LIGHT:
-//            glColor4f (0.1, 0.9, 0.1, 0.75);
-            glColor3f (0.1, 0.9, 0.1);
-            break;
+      switch (brightness)
+         {
+         case BRT_LIGHT:
+             set_hud_color (0.1f, 0.9f, 0.1f);
+             break;
 
           case BRT_MEDIUM:
-//            glColor4f (0.1, 0.7, 0.0, 0.75);
-            glColor3f (0.1, 0.7, 0.0);
-            break;
+             set_hud_color (0.1f, 0.7f, 0.0f);
+             break;
 
           case BRT_DARK:
-//            glColor4f (0.0, 0.6, 0.0, 0.75);
-            glColor3f(0.0, 0.6, 0.0);
-            break;
+             set_hud_color (0.0f, 0.6f, 0.0f);
+             break;
 
           case BRT_BLACK:
-//            glColor4f( 0.0, 0.0, 0.0, 0.75);
-            glColor3f( 0.0, 0.0, 0.0);
-            break;
+             set_hud_color( 0.0f, 0.0f, 0.0f);
+             break;
 
-          default:;
+          default:
+             set_hud_color (0.1f, 0.9f, 0.1f);
          }
-  }
-  else {
-         if( day_night_sw == NIGHT) {
-                 switch (brightness) {
-                         case BRT_LIGHT:
-//                glColor4f (0.9, 0.1, 0.1, 0.75);
-                glColor3f (0.9, 0.1, 0.1);
-                break;
+  } else {
+      if( day_night_sw == NIGHT) {
+         switch (brightness)
+             {
+             case BRT_LIGHT:
+                 set_hud_color (0.9f, 0.1f, 0.1f);
+                 break;
 
               case BRT_MEDIUM:
-//                glColor4f (0.7, 0.0, 0.1, 0.75);
-                glColor3f (0.7, 0.0, 0.1);
-                break;
-
-                         case BRT_DARK:
-                         default:
-//                               glColor4f (0.6, 0.0, 0.0, 0.75);
-                                 glColor3f (0.6, 0.0, 0.0);
-                 }
-         }
-          else {     // Just in case default
-//                       glColor4f (0.1, 0.9, 0.1, 0.75);
-                         glColor3f (0.1, 0.9, 0.1);
-                 }
+                 set_hud_color (0.7f, 0.0f, 0.1f);
+                 break;
+
+             case BRT_DARK:
+                 set_hud_color (0.6f, 0.0f, 0.0f);
+                 break;
+
+             case BRT_BLACK:
+                 set_hud_color( 0.0f, 0.0f, 0.0f);
+                 break;
+
+             default:
+                 set_hud_color (0.6f, 0.0f, 0.0f);
+             }
+      } else {     // Just in case default
+         set_hud_color (0.1f, 0.9f, 0.1f);
+      }
   }
 
   deque < instr_item * > :: iterator current = HUD_deque.begin();
@@ -1269,8 +1273,6 @@ void fgUpdateHUD( void ) {
                  //  fgPrintf( FG_COCKPIT, FG_DEBUG, "HUD Code %d  Status %d\n",
                  //            hud->code, hud->status );
                  pHUDInstr->draw();
-//           HUD_deque.at(i)->draw(); // Responsible for broken or fixed variants.
-                              // No broken displays honored just now.
          }
   }
 
@@ -1285,37 +1287,40 @@ void fgUpdateHUD( void ) {
 
 
   // temporary
-  extern bool fgAPAltitudeEnabled( void );
-  extern bool fgAPHeadingEnabled( void );
-  extern bool fgAPWayPointEnabled( void );
-  extern char *fgAPget_TargetDistanceStr( void );
-  extern char *fgAPget_TargetHeadingStr( void );
-  extern char *fgAPget_TargetAltitudeStr( void );
-  extern char *fgAPget_TargetLatLonStr( void );
+  // extern bool fgAPAltitudeEnabled( void );
+  // extern bool fgAPHeadingEnabled( void );
+  // extern bool fgAPWayPointEnabled( void );
+  // extern char *fgAPget_TargetDistanceStr( void );
+  // extern char *fgAPget_TargetHeadingStr( void );
+  // extern char *fgAPget_TargetAltitudeStr( void );
+  // extern char *fgAPget_TargetLatLonStr( void );
 
   int apY = 480 - 80;
 //  char scratch[128];
 //  HUD_TextList.add( fgText( "AUTOPILOT", 20, apY) );
 //  apY -= 15;
-  if( fgAPHeadingEnabled() ) {
-         HUD_TextList.add( fgText( 40, apY, fgAPget_TargetHeadingStr()) );       
+  if( current_autopilot->get_HeadingEnabled() ) {
+         HUD_TextList.add( fgText( 40, apY, 
+                           current_autopilot->get_TargetHeadingStr()) );
          apY -= 15;
   }
-  if( fgAPAltitudeEnabled() ) {
-         HUD_TextList.add( fgText( 40, apY, fgAPget_TargetAltitudeStr()) );      
+  if( current_autopilot->get_AltitudeEnabled() ) {
+         HUD_TextList.add( fgText( 40, apY, 
+                           current_autopilot->get_TargetAltitudeStr()) );
          apY -= 15;
   }
-  if( fgAPWayPointEnabled() ) {
-         HUD_TextList.add( fgText( 40, apY, fgAPget_TargetLatLonStr()) );
+  if( current_autopilot->get_HeadingMode() == 
+      FGAutopilot::FG_HEADING_WAYPOINT ) {
+         HUD_TextList.add( fgText( 40, apY, 
+                           current_autopilot->get_TargetLatLonStr()) );
          apY -= 15;
-         HUD_TextList.add( fgText( 40, apY, fgAPget_TargetDistanceStr() ) );     
+         HUD_TextList.add( fgText( 40, apY,
+                           current_autopilot->get_TargetDistanceStr() ) );
          apY -= 15;
   }
   
   HUD_TextList.draw();
 
-  line_width = (current_options.get_xsize() > 1000) ? 1.0 : 0.5;
-  glLineWidth(line_width);
   HUD_LineList.draw();
 
 //  glEnable(GL_LINE_STIPPLE);
@@ -1323,8 +1328,12 @@ void fgUpdateHUD( void ) {
 //  HUD_StippleLineList.draw();
 //  glDisable(GL_LINE_STIPPLE);
 
-//  glDisable( GL_BLEND );
-  
+  if( current_options.get_anti_alias_hud() ) {
+//       glDisable(GL_BLEND);
+         glDisable(GL_LINE_SMOOTH);
+         glLineWidth(1.0);
+  }
+
   glEnable(GL_DEPTH_TEST);
   glEnable(GL_LIGHTING);
   glMatrixMode(GL_PROJECTION);