From 33854d9f6a6d4af84eef9244ef79773bb2f9e395 Mon Sep 17 00:00:00 2001 From: curt Date: Wed, 24 Oct 2001 21:24:53 +0000 Subject: [PATCH] Fixes to remove dependencies on depricated plib code (that just happened to be removed in the latest plib CVS.) --- src/Autopilot/auto_gui.cxx | 14 +++++++------- src/Cockpit/hud.cxx | 6 +++--- src/Cockpit/hud.hxx | 8 ++++---- src/GUI/apt_dlg.cxx | 4 ++-- src/GUI/gui.cxx | 10 +++++----- src/GUI/sgVec3Slider.cxx | 6 +++--- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Autopilot/auto_gui.cxx b/src/Autopilot/auto_gui.cxx index c8aefa19c..43c63b84a 100644 --- a/src/Autopilot/auto_gui.cxx +++ b/src/Autopilot/auto_gui.cxx @@ -220,7 +220,7 @@ void NewHeadingInit(void) float heading = fgGetDouble("/orientation/heading-deg"); int len = 260/2 - - (puGetStringWidth( puGetDefaultLabelFont(), NewHeadingLabel ) /2 ); + (puGetDefaultLabelFont().getStringWidth( NewHeadingLabel ) / 2 ); ApHeadingDialog = new puDialogBox (150, 50); { @@ -297,7 +297,7 @@ void NewAltitudeInit(void) } int len = 260/2 - - (puGetStringWidth( puGetDefaultLabelFont(), NewAltitudeLabel )/2); + (puGetDefaultLabelFont().getStringWidth( NewAltitudeLabel ) / 2); // ApAltitudeDialog = new puDialogBox (150, 50); ApAltitudeDialog = new puDialogBox (150, 200); @@ -439,7 +439,7 @@ void fgAPAdjustInit( void ) { char *s; int labelX = (DialogWidth / 2) - - (puGetStringWidth( puGetDefaultLabelFont(), Label ) / 2); + (puGetDefaultLabelFont().getStringWidth( Label ) / 2); labelX -= 30; // KLUDGEY int nSliders = 4; @@ -468,8 +468,8 @@ void fgAPAdjustInit( void ) { puGetDefaultFonts ( &APAdjustLegendFont, &APAdjustLabelFont ); APAdjustDialog = new puDialogBox ( DialogX, DialogY ); { - int horiz_slider_height = puGetStringHeight (APAdjustLabelFont) + - puGetStringDescender (APAdjustLabelFont) + + int horiz_slider_height = APAdjustLabelFont.getStringHeight() + + APAdjustLabelFont.getStringDescender() + PUSTR_TGAP + PUSTR_BGAP + 5; APAdjustFrame = new puFrame ( 0, 0, @@ -677,8 +677,8 @@ void NewTgtAirportInit(void) sprintf( NewTgtAirportId, "%s", fgGetString("/sim/startup/airport-id").c_str() ); SG_LOG( SG_AUTOPILOT, SG_INFO, " NewTgtAirportId " << NewTgtAirportId ); - int len = 150 - puGetStringWidth( puGetDefaultLabelFont(), - NewTgtAirportLabel ) / 2; + int len = 150 + - puGetDefaultLabelFont().getStringWidth( NewTgtAirportLabel ) / 2; TgtAptDialog = new puDialogBox (150, 50); { diff --git a/src/Cockpit/hud.cxx b/src/Cockpit/hud.cxx index 92183ba18..4b6933e76 100644 --- a/src/Cockpit/hud.cxx +++ b/src/Cockpit/hud.cxx @@ -931,7 +931,7 @@ void fgHUDalphaInit( void ) { char *s; int labelX = (DialogWidth / 2) - - (puGetStringWidth( puGetDefaultLabelFont(), Label ) / 2); + ( puGetDefaultLabelFont().getStringWidth( Label ) / 2); int nSliders = 1; int slider_x = 10; @@ -946,8 +946,8 @@ void fgHUDalphaInit( void ) { puGetDefaultFonts ( &HUDalphaLegendFont, &HUDalphaLabelFont ); HUDalphaDialog = new puDialogBox ( DialogX, DialogY ); { - int horiz_slider_height = puGetStringHeight (HUDalphaLabelFont) + - puGetStringDescender (HUDalphaLabelFont) + + int horiz_slider_height = HUDalphaLabelFont.getStringHeight() + + HUDalphaLabelFont.getStringDescender() + PUSTR_TGAP + PUSTR_BGAP + 5; /* puFrame * diff --git a/src/Cockpit/hud.hxx b/src/Cockpit/hud.hxx index 336a4497b..a5ccd24bf 100644 --- a/src/Cockpit/hud.hxx +++ b/src/Cockpit/hud.hxx @@ -358,7 +358,7 @@ public: fnt->puts(tmp1); fnt->setPointSize(12); - char tmp2[p1+1]; + char tmp2[64]; strncpy(tmp2,msg,p1); tmp2[p1]='\0'; @@ -380,7 +380,7 @@ public: void Draw() { - puDrawString ( guiFnt, msg, FloatToInt(x), FloatToInt(y) ); + guiFnt.drawString( msg, FloatToInt(x), FloatToInt(y) ); } }; @@ -566,8 +566,8 @@ public: { glBegin(GL_LINE_LOOP); // Use polygon to approximate a circle for(int count=0; count<25; count++) { - float cosine = r * cos(count * 2 * M_PI/10.0); - float sine = r * sin(count * 2 * M_PI/10.0); + float cosine = r * cos(count * 2 * SG_PI/10.0); + float sine = r * sin(count * 2 * SG_PI/10.0); glVertex2f(cosine+x1, sine+y1); } glEnd(); diff --git a/src/GUI/apt_dlg.cxx b/src/GUI/apt_dlg.cxx index da16ba6cb..e064e390a 100644 --- a/src/GUI/apt_dlg.cxx +++ b/src/GUI/apt_dlg.cxx @@ -131,8 +131,8 @@ void NewAirport(puObject *cb) void NewAirportInit(void) { sprintf( NewAirportId, "%s", fgGetString("/sim/startup/airport-id").c_str() ); - int len = 150 - puGetStringWidth( puGetDefaultLabelFont(), - NewAirportLabel ) / 2; + int len = 150 + - puGetDefaultLabelFont().getStringWidth( NewAirportLabel ) / 2; AptDialog = new puDialogBox (150, 50); { diff --git a/src/GUI/gui.cxx b/src/GUI/gui.cxx index 6d4e28168..7c62c3f56 100644 --- a/src/GUI/gui.cxx +++ b/src/GUI/gui.cxx @@ -249,8 +249,8 @@ static void saveFlight(puObject *cv) { SaveDialog = new puDialogBox (150, 50); { SaveDialogFrame = new puFrame (0,0,350, 150); - SaveDialogMessage = new puText ( - (150 - puGetStringWidth( puGetDefaultLabelFont(), "File Name:" ) / 2), 110); + SaveDialogMessage + = new puText( (150 - puGetDefaultLabelFont().getStringWidth( "File Name:" ) / 2), 110 ); SaveDialogMessage -> setLabel ("File Name:"); SaveDialogInput = new puInput (50, 70, 300, 100); @@ -314,8 +314,8 @@ static void loadFlight(puObject *cb) LoadDialog = new puDialogBox (150, 50); { LoadDialogFrame = new puFrame (0,0,350, 150); - LoadDialogMessage = new puText ( - (150 - puGetStringWidth( puGetDefaultLabelFont(), "File Name:" ) / 2), 110); + LoadDialogMessage + = new puText( (150 - puGetDefaultLabelFont().getStringWidth( "File Name:" ) / 2), 110 ); LoadDialogMessage -> setLabel ("File Name:"); LoadDialogInput = new puInput (50, 70, 300, 100); @@ -412,7 +412,7 @@ void ConfirmExitDialogInit(void) char *s; // printf("ConfirmExitDialogInit\n"); - int len = 200 - puGetStringWidth( puGetDefaultLabelFont(), msg )/2; + int len = 200 - puGetDefaultLabelFont().getStringWidth ( msg ) / 2; int x = (fgGetInt("/sim/startup/xsize")/2 - 400/2); int y = (fgGetInt("/sim/startup/ysize")/2 - 100/2); diff --git a/src/GUI/sgVec3Slider.cxx b/src/GUI/sgVec3Slider.cxx index 89204ac1c..769ae628b 100644 --- a/src/GUI/sgVec3Slider.cxx +++ b/src/GUI/sgVec3Slider.cxx @@ -164,9 +164,9 @@ sgVec3Slider::sgVec3Slider ( int x, int y, sgVec3 vec, const char *title, int slider_y = 55; int slider_width = 240; - int horiz_slider_height = puGetStringHeight (&LabelFont) + - puGetStringDescender (&LabelFont) + - PUSTR_TGAP + PUSTR_BGAP + 5; + int horiz_slider_height = LabelFont.getStringHeight() + + LabelFont.getStringDescender() + + PUSTR_TGAP + PUSTR_BGAP + 5; // HACKS setUserData( this ); -- 2.39.5