replace hard-coded HUD config dialog with NewGUI dialog
This commit is contained in:
parent
acc0ed22c7
commit
571939e58d
3 changed files with 8 additions and 136 deletions
|
@ -53,7 +53,7 @@
|
||||||
|
|
||||||
#include <Aircraft/aircraft.hxx>
|
#include <Aircraft/aircraft.hxx>
|
||||||
#include <Autopilot/xmlauto.hxx>
|
#include <Autopilot/xmlauto.hxx>
|
||||||
#include <GUI/gui.h>
|
#include <GUI/new_gui.hxx>
|
||||||
#include <Main/globals.hxx>
|
#include <Main/globals.hxx>
|
||||||
#include <Main/fg_props.hxx>
|
#include <Main/fg_props.hxx>
|
||||||
#include <Scenery/scenery.hxx>
|
#include <Scenery/scenery.hxx>
|
||||||
|
@ -84,7 +84,6 @@ float HUD_TextSize = 0;
|
||||||
int HUD_style = 0;
|
int HUD_style = 0;
|
||||||
|
|
||||||
float HUD_matrix[16];
|
float HUD_matrix[16];
|
||||||
static float hud_trans_alpha = 0.67f;
|
|
||||||
|
|
||||||
|
|
||||||
//$$$ begin - added, Neetha, 28 Nov 2k
|
//$$$ begin - added, Neetha, 28 Nov 2k
|
||||||
|
@ -173,8 +172,6 @@ static instr_item * readTBI( const SGPropertyNode * node);
|
||||||
static void drawHUD();
|
static void drawHUD();
|
||||||
static void fgUpdateHUDVirtual();
|
static void fgUpdateHUDVirtual();
|
||||||
|
|
||||||
void fgHUDalphaInit( void );
|
|
||||||
|
|
||||||
class locRECT {
|
class locRECT {
|
||||||
public:
|
public:
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
@ -754,7 +751,6 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
input.close();
|
input.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
fgHUDalphaInit();
|
|
||||||
fgHUDReshape();
|
fgHUDReshape();
|
||||||
|
|
||||||
if ( HUDtext ) {
|
if ( HUDtext ) {
|
||||||
|
@ -878,122 +874,6 @@ void HUD_brightkey( bool incr_bright )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define fgAP_CLAMP(val,min,max) ( (val) = (val) > (max) ? (max) : (val) < (min) ? (min) : (val) )
|
|
||||||
|
|
||||||
static puDialogBox *HUDalphaDialog;
|
|
||||||
static puText *HUDalphaText;
|
|
||||||
static puSlider *HUDalphaHS0;
|
|
||||||
//static puText *HUDtextText;
|
|
||||||
//static puSlider *HUDalphaHS1;
|
|
||||||
static char SliderText[2][ 8 ];
|
|
||||||
|
|
||||||
static void alpha_adj( puObject *hs ) {
|
|
||||||
float val ;
|
|
||||||
|
|
||||||
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 ] ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void fgHUDalphaAdjust( puObject * ) {
|
|
||||||
fgSetBool("/sim/hud/antialiased", true);
|
|
||||||
FG_PUSH_PUI_DIALOG( HUDalphaDialog );
|
|
||||||
}
|
|
||||||
|
|
||||||
static void goAwayHUDalphaAdjust (puObject *)
|
|
||||||
{
|
|
||||||
FG_POP_PUI_DIALOG( HUDalphaDialog );
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cancelHUDalphaAdjust (puObject *)
|
|
||||||
{
|
|
||||||
fgSetBool("/sim/hud/antialiased", false);
|
|
||||||
FG_POP_PUI_DIALOG( HUDalphaDialog );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Done once at system initialization
|
|
||||||
void fgHUDalphaInit( void ) {
|
|
||||||
|
|
||||||
// printf("fgHUDalphaInit\n");
|
|
||||||
#define HORIZONTAL FALSE
|
|
||||||
|
|
||||||
int DialogX = 40;
|
|
||||||
int DialogY = 100;
|
|
||||||
int DialogWidth = 240;
|
|
||||||
|
|
||||||
char Label[] = "HUD Adjuster";
|
|
||||||
char *s;
|
|
||||||
|
|
||||||
int labelX = (DialogWidth / 2) -
|
|
||||||
( puGetDefaultLabelFont().getStringWidth( 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 = HUDalphaLabelFont.getStringHeight() +
|
|
||||||
HUDalphaLabelFont.getStringDescender() +
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void fgHUDReshape(void) {
|
void fgHUDReshape(void) {
|
||||||
#if 0
|
#if 0
|
||||||
if ( HUDtext ) {
|
if ( HUDtext ) {
|
||||||
|
@ -1017,9 +897,13 @@ void fgHUDReshape(void) {
|
||||||
|
|
||||||
|
|
||||||
static void set_hud_color(float r, float g, float b) {
|
static void set_hud_color(float r, float g, float b) {
|
||||||
fgGetBool("/sim/hud/antialiased") ?
|
static SGPropertyNode_ptr alias = fgGetNode("/sim/hud/antialiased", true);
|
||||||
glColor4f(r,g,b,hud_trans_alpha) :
|
static SGPropertyNode_ptr alpha = fgGetNode("/sim/hud/alpha", true);
|
||||||
glColor3f(r,g,b);
|
|
||||||
|
if (alias->getBoolValue())
|
||||||
|
glColor4f(r, g, b, alpha->getFloatValue());
|
||||||
|
else
|
||||||
|
glColor3f(r, g, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -97,8 +97,6 @@
|
||||||
SG_USING_STD(string);
|
SG_USING_STD(string);
|
||||||
SG_USING_STD(cout);
|
SG_USING_STD(cout);
|
||||||
|
|
||||||
extern void fgHUDalphaAdjust( puObject * );
|
|
||||||
|
|
||||||
// from cockpit.cxx
|
// from cockpit.cxx
|
||||||
extern void fgLatLonFormatToggle( puObject *);
|
extern void fgLatLonFormatToggle( puObject *);
|
||||||
|
|
||||||
|
@ -131,7 +129,6 @@ const __fg_gui_fn_t __fg_gui_fn[] = {
|
||||||
|
|
||||||
//View
|
//View
|
||||||
{"guiTogglePanel", guiTogglePanel},
|
{"guiTogglePanel", guiTogglePanel},
|
||||||
{"fgHUDalphaAdjust", fgHUDalphaAdjust},
|
|
||||||
{"prop_pickerView", prop_pickerView},
|
{"prop_pickerView", prop_pickerView},
|
||||||
|
|
||||||
// Environment
|
// Environment
|
||||||
|
|
|
@ -56,14 +56,6 @@ do_print_dialog (const SGPropertyNode * arg)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void fgHUDalphaAdjust (puObject *);
|
|
||||||
static bool
|
|
||||||
do_hud_alpha_dialog (const SGPropertyNode * arg)
|
|
||||||
{
|
|
||||||
fgHUDalphaAdjust(0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern void prop_pickerView (puObject *);
|
extern void prop_pickerView (puObject *);
|
||||||
static bool
|
static bool
|
||||||
do_properties_dialog (const SGPropertyNode * arg)
|
do_properties_dialog (const SGPropertyNode * arg)
|
||||||
|
@ -133,7 +125,6 @@ static struct {
|
||||||
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
|
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
|
||||||
{ "old-print-dialog", do_print_dialog },
|
{ "old-print-dialog", do_print_dialog },
|
||||||
#endif
|
#endif
|
||||||
{ "old-hud-alpha-dialog", do_hud_alpha_dialog },
|
|
||||||
{ "old-properties-dialog", do_properties_dialog },
|
{ "old-properties-dialog", do_properties_dialog },
|
||||||
{ "old-ap-add-waypoint-dialog", do_ap_add_waypoint_dialog },
|
{ "old-ap-add-waypoint-dialog", do_ap_add_waypoint_dialog },
|
||||||
{ "old-ap-pop-waypoint-dialog", do_ap_pop_waypoint_dialog },
|
{ "old-ap-pop-waypoint-dialog", do_ap_pop_waypoint_dialog },
|
||||||
|
|
Loading…
Reference in a new issue