X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_menu.c;h=33d82a2dbda0415e57cc782e96ed99c355b48676;hb=c4ffff1de4b14af7f0efb231f476961c21f3f552;hp=0d00ae085fdbb68ea6274dd12fed140c2d99d81a;hpb=1fcc6b80990394c277a4c2ddeafab948ada650cd;p=freeglut diff --git a/src/freeglut_menu.c b/src/freeglut_menu.c index 0d00ae0..33d82a2 100644 --- a/src/freeglut_menu.c +++ b/src/freeglut_menu.c @@ -29,7 +29,7 @@ #include "config.h" #endif -#include "../include/GL/freeglut.h" +#include #include "freeglut_internal.h" /* -- DEFINITIONS ---------------------------------------------------------- */ @@ -56,7 +56,7 @@ * that that wasn't the original intent...if not, perhaps we need another * symbolic constant, FREEGLUT_MENU_ITEM_BORDER, or such.) */ -#if TARGET_HOST_WIN32 +#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE #define FREEGLUT_MENU_FONT GLUT_BITMAP_8_BY_13 #else #define FREEGLUT_MENU_FONT GLUT_BITMAP_HELVETICA_18 @@ -75,7 +75,7 @@ * too. These variables should be stuffed into global state and initialized * via the glutInit*() system. */ -#if TARGET_HOST_WIN32 +#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE static float menu_pen_fore [4] = {0.0f, 0.0f, 0.0f, 1.0f}; static float menu_pen_back [4] = {0.85f, 0.85f, 0.85f, 1.0f}; static float menu_pen_hfore [4] = {1.0f, 1.0f, 1.0f, 1.0f}; @@ -124,10 +124,10 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu ) menuEntry; menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next ) { - if( menuEntry->SubMenu && ( menuEntry->IsActive == TRUE ) ) + if( menuEntry->SubMenu && menuEntry->IsActive ) { /* - * OK, have the sub-menu checked, too. If it returns TRUE, it + * OK, have the sub-menu checked, too. If it returns GL_TRUE, it * will mean that it caught the mouse cursor and we do not need * to regenerate the activity list, and so our parents do... */ @@ -138,9 +138,9 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu ) * Reactivate the submenu as the checkMenuStatus may have turned * it off if the mouse is in its parent menu entry. */ - menuEntry->SubMenu->IsActive = TRUE; - if ( return_status == TRUE ) - return TRUE; + menuEntry->SubMenu->IsActive = GL_TRUE; + if ( return_status ) + return GL_TRUE; } } @@ -153,9 +153,9 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu ) for( menuEntry = (SFG_MenuEntry *)menu->Entries.First; menuEntry; menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next ) - menuEntry->IsActive = FALSE; + menuEntry->IsActive = GL_FALSE; - menu->IsActive = FALSE; + menu->IsActive = GL_FALSE; /* * Check if the mouse cursor is contained within the current menu box @@ -174,7 +174,7 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu ) menuEntry = fghFindMenuEntry( menu, menuID + 1 ); assert( menuEntry ); - menuEntry->IsActive = TRUE; + menuEntry->IsActive = GL_TRUE; menuEntry->Ordinal = menuID; /* @@ -187,7 +187,7 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu ) fgDeactivateSubMenu( menu->ActiveEntry ); menu->ActiveEntry = menuEntry; - menu->IsActive = TRUE; + menu->IsActive = GL_TRUE; /* * OKi, we have marked that entry as active, but it would be also @@ -203,7 +203,7 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu ) /* * Set up the initial menu position now... */ - menuEntry->SubMenu->IsActive = TRUE; + menuEntry->SubMenu->IsActive = GL_TRUE; /* * Set up the initial submenu position now: @@ -239,19 +239,19 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu ) /* * Activate it because its parent entry is active */ - menuEntry->SubMenu->IsActive = TRUE; + menuEntry->SubMenu->IsActive = GL_TRUE; } /* * Report back that we have caught the menu cursor */ - return TRUE; + return GL_TRUE; } /* * Looks like the menu cursor is somewhere else... */ - return FALSE; + return GL_FALSE; } /* @@ -289,7 +289,7 @@ static void fghDisplayMenuBox( SFG_Menu* menu ) glVertex2i( menu->Width - border, border); glEnd( ); - glColor4fv( menu_pen_back ) ; + glColor4fv( menu_pen_back ); glBegin( GL_QUADS ); glVertex2i( border, border); glVertex2i( menu->Width - border, border); @@ -307,7 +307,7 @@ static void fghDisplayMenuBox( SFG_Menu* menu ) /* * Has the menu been marked as active, maybe? */ - if( menuEntry->IsActive == TRUE ) + if( menuEntry->IsActive ) { /* * That's truly right, and we need to have it highlighted. @@ -362,7 +362,8 @@ static void fghDisplayMenuBox( SFG_Menu* menu ) /* * Have the label drawn, character after character: */ - glutBitmapString( FREEGLUT_MENU_FONT, menuEntry->Text); + glutBitmapString( FREEGLUT_MENU_FONT, + (unsigned char *)menuEntry->Text); /* * If it's a submenu, draw a right arrow @@ -397,7 +398,7 @@ static void fghDisplayMenuBox( SFG_Menu* menu ) /* * Is that an active sub menu by any case? */ - if( menuEntry->SubMenu && ( menuEntry->IsActive == TRUE ) ) + if( menuEntry->SubMenu && menuEntry->IsActive ) { /* * Yeah, indeed. Have it redrawn now: @@ -495,7 +496,7 @@ void fgActivateMenu( SFG_Window* window, int button ) * Mark the menu as active, so that it gets displayed: */ window->ActiveMenu = menu; - menu->IsActive = TRUE; + menu->IsActive = GL_TRUE; fgState.ActiveMenus++; /* @@ -552,7 +553,7 @@ void fgExecuteMenuCallback( SFG_Menu* menu ) menuEntry; menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next) { - if( menuEntry->IsActive == TRUE ) + if( menuEntry->IsActive ) { if( menuEntry->SubMenu ) fgExecuteMenuCallback( menuEntry->SubMenu ); @@ -593,7 +594,7 @@ void fgDeactivateMenu( SFG_Window *window ) */ menu->Window->ActiveMenu = NULL; menu->ParentWindow->ActiveMenu = NULL; - menu->IsActive = FALSE; + menu->IsActive = GL_FALSE; fgState.ActiveMenus--; @@ -631,7 +632,7 @@ void fgDeactivateSubMenu( SFG_MenuEntry *menuEntry ) * Forget about having that menu active anymore, now: */ menuEntry->SubMenu->Window->ActiveMenu = NULL; - menuEntry->SubMenu->IsActive = FALSE; + menuEntry->SubMenu->IsActive = GL_FALSE; /* * Hide all submenu windows, and the root menu's window. @@ -674,15 +675,20 @@ void fghCalculateMenuBoxSize( void ) /* * Update the menu entry's width value */ - menuEntry->Width = glutBitmapLength( FREEGLUT_MENU_FONT, - menuEntry->Text ); + menuEntry->Width = glutBitmapLength( + FREEGLUT_MENU_FONT, + (unsigned char *)menuEntry->Text + ); /* * If the entry is a submenu, then it needs to be wider to * accomodate the arrow. JCJ 31 July 2003 */ if (menuEntry->SubMenu ) - menuEntry->Width += glutBitmapLength( FREEGLUT_MENU_FONT, "_" ); + menuEntry->Width += glutBitmapLength( + FREEGLUT_MENU_FONT, + (unsigned char *)"_" + ); /* * Check if it's the biggest we've found