GUI changes contributed by Norman Vine.
This commit is contained in:
parent
86cc2b162a
commit
bf56b15f7e
2 changed files with 124 additions and 132 deletions
|
@ -63,18 +63,9 @@
|
||||||
|
|
||||||
FG_USING_STD(string);
|
FG_USING_STD(string);
|
||||||
|
|
||||||
// Pui hides low level access to the mouse and menu display states
|
puFont guiFnt = 0;
|
||||||
// so for now we track these in case we want to know about them
|
fntTexFont *guiFntHandle = 0;
|
||||||
puFont guiFnt = 0; // Our High Level Gui Font
|
|
||||||
fntTexFont *guiFntHandle = 0; // lower level access to guiFnt's Font
|
|
||||||
static int _mX = 0; // current mouse x
|
|
||||||
static int _mY = 0; // y
|
|
||||||
static int last_buttons = 0 ; // mouse button state
|
|
||||||
static int mouse_active = 0; // is mouse displayed
|
|
||||||
static int menu_on = 0; // menu displayed
|
|
||||||
|
|
||||||
|
|
||||||
// PUI objects
|
|
||||||
static puMenuBar *mainMenuBar = 0;
|
static puMenuBar *mainMenuBar = 0;
|
||||||
//static puButton *hideMenuButton = 0;
|
//static puButton *hideMenuButton = 0;
|
||||||
|
|
||||||
|
@ -90,7 +81,6 @@ static puText *YNdialogBoxMessage = 0;
|
||||||
static puOneShot *YNdialogBoxOkButton = 0;
|
static puOneShot *YNdialogBoxOkButton = 0;
|
||||||
static puOneShot *YNdialogBoxNoButton = 0;
|
static puOneShot *YNdialogBoxNoButton = 0;
|
||||||
|
|
||||||
// Accessor CallBacks for external PUI Objects
|
|
||||||
// extern void NewAltitude( puObject *cb );
|
// extern void NewAltitude( puObject *cb );
|
||||||
// extern void NewHeading( puObject *cb );
|
// extern void NewHeading( puObject *cb );
|
||||||
extern void fgAPAdjust( puObject * );
|
extern void fgAPAdjust( puObject * );
|
||||||
|
@ -99,6 +89,13 @@ extern void fgLatLonFormatToggle( puObject *);
|
||||||
/* --------------------------------------------------------------------
|
/* --------------------------------------------------------------------
|
||||||
Mouse stuff
|
Mouse stuff
|
||||||
---------------------------------------------------------------------*/
|
---------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
static int _mX = 0;
|
||||||
|
static int _mY = 0;
|
||||||
|
static int last_buttons = 0 ;
|
||||||
|
static int mouse_active = 0;
|
||||||
|
static int menu_on = 0;
|
||||||
|
|
||||||
void guiMotionFunc ( int x, int y )
|
void guiMotionFunc ( int x, int y )
|
||||||
{
|
{
|
||||||
_mX = x;
|
_mX = x;
|
||||||
|
@ -155,11 +152,6 @@ static inline void TurnCursorOff( void )
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the gui isn't active try to hide the mouse
|
|
||||||
// an if the qui requested show the mouse
|
|
||||||
// this can get confused if it rerequesting the gui object
|
|
||||||
// should resync things.
|
|
||||||
// see PUI macros in gui.hxx for normal use
|
|
||||||
void maybeToggleMouse( void )
|
void maybeToggleMouse( void )
|
||||||
{
|
{
|
||||||
static int first_time = ~0;
|
static int first_time = ~0;
|
||||||
|
@ -216,7 +208,6 @@ void mkDialog (char *txt)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Repair any damage done to the Panel by other Gui Items
|
// Repair any damage done to the Panel by other Gui Items
|
||||||
// see PUI macros in gui.hxx for use
|
|
||||||
void guiFixPanel( void )
|
void guiFixPanel( void )
|
||||||
{
|
{
|
||||||
int toggle_pause;
|
int toggle_pause;
|
||||||
|
@ -277,7 +268,6 @@ void hideMenuCb (puObject *cb)
|
||||||
guiToggleMenu();
|
guiToggleMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is the accessor function
|
|
||||||
void goodBye(puObject *)
|
void goodBye(puObject *)
|
||||||
{
|
{
|
||||||
// FG_LOG( FG_INPUT, FG_ALERT,
|
// FG_LOG( FG_INPUT, FG_ALERT,
|
||||||
|
@ -298,10 +288,12 @@ void goAwayCb (puObject *me)
|
||||||
|
|
||||||
void mkDialogInit (void)
|
void mkDialogInit (void)
|
||||||
{
|
{
|
||||||
// printf("mkDialogInit\n");
|
// printf("mkDialogInit\n");
|
||||||
dialogBox = new puDialogBox (150, 50);
|
int x = (current_options.get_xsize()/2 - 400/2);
|
||||||
|
int y = (current_options.get_ysize()/2 - 100/2);
|
||||||
|
dialogBox = new puDialogBox (x, y); // 150, 50
|
||||||
{
|
{
|
||||||
dialogFrame = new puFrame (0,0,400, 100);
|
dialogFrame = new puFrame (0,0,400,100);
|
||||||
dialogBoxMessage = new puText (10, 70);
|
dialogBoxMessage = new puText (10, 70);
|
||||||
dialogBoxMessage -> setLabel ("");
|
dialogBoxMessage -> setLabel ("");
|
||||||
dialogBoxOkButton = new puOneShot (180, 10, 240, 50);
|
dialogBoxOkButton = new puOneShot (180, 10, 240, 50);
|
||||||
|
@ -321,12 +313,16 @@ void goAwayYesNoCb(puObject *me)
|
||||||
|
|
||||||
void ConfirmExitDialogInit(void)
|
void ConfirmExitDialogInit(void)
|
||||||
{
|
{
|
||||||
// printf("ConfirmExitDialogInit\n");
|
// printf("ConfirmExitDialogInit\n");
|
||||||
string Msg("Really Quit");
|
string Msg("Really Quit");
|
||||||
// int len = 350/2 - puGetStringWidth( puGetDefaultLabelFont(), AptLabel )/2;
|
// int len = 350/2 - puGetStringWidth( puGetDefaultLabelFont(), AptLabel )/2;
|
||||||
int len = 200 - puGetStringWidth( puGetDefaultLabelFont(), Msg.c_str() )/2;
|
int len = 200 - puGetStringWidth( puGetDefaultLabelFont(), Msg.c_str() )/2;
|
||||||
|
|
||||||
YNdialogBox = new puDialogBox (150, 50);
|
int x = (current_options.get_xsize()/2 - 400/2);
|
||||||
|
int y = (current_options.get_ysize()/2 - 100/2);
|
||||||
|
|
||||||
|
YNdialogBox = new puDialogBox (x, y); // 150, 50
|
||||||
|
// YNdialogBox = new puDialogBox (150, 50);
|
||||||
{
|
{
|
||||||
YNdialogFrame = new puFrame (0,0,400, 100);
|
YNdialogFrame = new puFrame (0,0,400, 100);
|
||||||
|
|
||||||
|
@ -339,7 +335,7 @@ void ConfirmExitDialogInit(void)
|
||||||
|
|
||||||
YNdialogBoxNoButton = new puOneShot (240, 10, 300, 50);
|
YNdialogBoxNoButton = new puOneShot (240, 10, 300, 50);
|
||||||
YNdialogBoxNoButton -> setLegend ("NO");
|
YNdialogBoxNoButton -> setLegend ("NO");
|
||||||
// YNdialogBoxNoButton -> makeReturnDefault (TRUE );
|
// YNdialogBoxNoButton -> makeReturnDefault (TRUE );
|
||||||
YNdialogBoxNoButton -> setCallback (goAwayYesNoCb);
|
YNdialogBoxNoButton -> setCallback (goAwayYesNoCb);
|
||||||
}
|
}
|
||||||
FG_FINALIZE_PUI_DIALOG( YNdialogBox );
|
FG_FINALIZE_PUI_DIALOG( YNdialogBox );
|
||||||
|
@ -447,8 +443,6 @@ void AptDialog_Reset(puObject *)
|
||||||
AptDialogInput->setCursor( 0 ) ;
|
AptDialogInput->setCursor( 0 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// This is the accessor function
|
|
||||||
void NewAirport(puObject *cb)
|
void NewAirport(puObject *cb)
|
||||||
{
|
{
|
||||||
string AptLabel("Enter New Airport ID");
|
string AptLabel("Enter New Airport ID");
|
||||||
|
@ -465,7 +459,7 @@ static void NewAirportInit(void)
|
||||||
cout << "NewAirportInit" << endl;
|
cout << "NewAirportInit" << endl;
|
||||||
|
|
||||||
string AptLabel("Enter New Airport ID");
|
string AptLabel("Enter New Airport ID");
|
||||||
// int len = 350/2 - puGetStringWidth( puGetDefaultLabelFont(), AptLabel )/2;
|
// int len = 350/2 - puGetStringWidth( puGetDefaultLabelFont(), AptLabel )/2;
|
||||||
int len = 150 - puGetStringWidth( puGetDefaultLabelFont(), AptLabel.c_str() )/2;
|
int len = 150 - puGetStringWidth( puGetDefaultLabelFont(), AptLabel.c_str() )/2;
|
||||||
|
|
||||||
AptDialog = new puDialogBox (150, 50);
|
AptDialog = new puDialogBox (150, 50);
|
||||||
|
@ -492,8 +486,8 @@ static void NewAirportInit(void)
|
||||||
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------
|
/* -----------------------------------------------------------------------
|
||||||
The menu stuff
|
The menu stuff
|
||||||
---------------------------------------------------------------------*/
|
---------------------------------------------------------------------*/
|
||||||
char *fileSubmenu [] = {
|
char *fileSubmenu [] = {
|
||||||
"Exit", "Close", "---------", "Print", "---------", "Save", "Reset", NULL };
|
"Exit", "Close", "---------", "Print", "---------", "Save", "Reset", NULL };
|
||||||
puCallback fileSubmenuCb [] = {
|
puCallback fileSubmenuCb [] = {
|
||||||
|
|
|
@ -50,7 +50,6 @@ extern fntTexFont *guiFntHandle;
|
||||||
// Activate Dialog Box
|
// Activate Dialog Box
|
||||||
#define FG_PUSH_PUI_DIALOG( X ) \
|
#define FG_PUSH_PUI_DIALOG( X ) \
|
||||||
maybeToggleMouse(); \
|
maybeToggleMouse(); \
|
||||||
puPushGroup( (X) ) ; \
|
|
||||||
puPushLiveInterface( (X) ) ; \
|
puPushLiveInterface( (X) ) ; \
|
||||||
( X )->reveal()
|
( X )->reveal()
|
||||||
|
|
||||||
|
@ -58,7 +57,6 @@ extern fntTexFont *guiFntHandle;
|
||||||
#define FG_POP_PUI_DIALOG( X ) \
|
#define FG_POP_PUI_DIALOG( X ) \
|
||||||
(X)->hide(); \
|
(X)->hide(); \
|
||||||
puPopLiveInterface(); \
|
puPopLiveInterface(); \
|
||||||
puPopGroup(); \
|
|
||||||
guiFixPanel(); \
|
guiFixPanel(); \
|
||||||
maybeToggleMouse();
|
maybeToggleMouse();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue