summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorBen Millwood <thebenmachine@gmail.com>2009-10-03 13:06:39 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:16:28 +0000
commit11e37d5354d6945e2a4cbdc73ba650c78ade89a5 (patch)
tree087b29b098bb5d2ae2faa78d6d228054b5f89328 /src/ui
parentb8ba914fd60591858ab6e6177ba23d37e8cd2898 (diff)
* Get rid of uselessly-named itemDef_t->special and replace with
feederID or window.borderSize where applicable.
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/ui_main.c11
-rw-r--r--src/ui/ui_shared.c69
-rw-r--r--src/ui/ui_shared.h6
3 files changed, 39 insertions, 47 deletions
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c
index 00cc23f2..441ce79a 100644
--- a/src/ui/ui_main.c
+++ b/src/ui/ui_main.c
@@ -1889,9 +1889,10 @@ static void UI_DrawGLInfo( rectDef_t *rect, float scale, int textalign, int text
static void UI_OwnerDraw( float x, float y, float w, float h,
float text_x, float text_y, int ownerDraw,
int ownerDrawFlags, int align,
- int textalign, int textvalign, float special,
+ int textalign, int textvalign, float borderSize,
float scale, vec4_t foreColor, vec4_t backColor,
- qhandle_t shader, int textStyle )
+ qhandle_t shader,
+ int textStyle )
{
rectDef_t rect;
@@ -2065,7 +2066,7 @@ static qboolean UI_OwnerDrawVisible( int flags )
return vis;
}
-static qboolean UI_NetSource_HandleKey( int flags, float *special, int key )
+static qboolean UI_NetSource_HandleKey( int key )
{
if( key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER )
{
@@ -2101,12 +2102,12 @@ static qboolean UI_NetSource_HandleKey( int flags, float *special, int key )
return qfalse;
}
-static qboolean UI_OwnerDrawHandleKey( int ownerDraw, int flags, float *special, int key )
+static qboolean UI_OwnerDrawHandleKey( int ownerDraw, int key )
{
switch( ownerDraw )
{
case UI_NETSOURCE:
- UI_NetSource_HandleKey( flags, special, key );
+ UI_NetSource_HandleKey( key );
break;
default:
diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c
index 4befa326..7868a959 100644
--- a/src/ui/ui_shared.c
+++ b/src/ui/ui_shared.c
@@ -1775,7 +1775,7 @@ void Script_Reset( itemDef_t *item, char **args )
{
resetItem->cursorPos = 0;
resetItem->typeData.list->startPos = 0;
- DC->feederSelection( resetItem->special, 0 );
+ DC->feederSelection( resetItem->feederID, 0 );
}
}
}
@@ -2668,7 +2668,7 @@ qboolean Item_SetFocus( itemDef_t *item, float x, float y )
int Item_ListBox_MaxScroll( itemDef_t *item )
{
listBoxDef_t *listPtr = item->typeData.list;
- int count = DC->feederCount( item->special );
+ int count = DC->feederCount( item->feederID );
int max;
if( item->window.flags & WINDOW_HORIZONTAL )
@@ -2806,7 +2806,7 @@ int Item_ListBox_OverLB( itemDef_t *item, float x, float y )
int thumbstart;
int count;
- count = DC->feederCount( item->special );
+ count = DC->feederCount( item->feederID );
if( item->window.flags & WINDOW_HORIZONTAL )
{
@@ -3033,7 +3033,7 @@ void Item_SetMouseOver( itemDef_t *item, qboolean focus )
qboolean Item_OwnerDraw_HandleKey( itemDef_t *item, int key )
{
if( item && DC->ownerDrawHandleKey )
- return DC->ownerDrawHandleKey( item->window.ownerDraw, item->window.ownerDrawFlags, &item->special, key );
+ return DC->ownerDrawHandleKey( item->window.ownerDraw, key );
return qfalse;
}
@@ -3041,7 +3041,7 @@ qboolean Item_OwnerDraw_HandleKey( itemDef_t *item, int key )
qboolean Item_ListBox_HandleKey( itemDef_t *item, int key, qboolean down, qboolean force )
{
listBoxDef_t *listPtr = item->typeData.list;
- int count = DC->feederCount( item->special );
+ int count = DC->feederCount( item->feederID );
int max, viewmax;
if( force || ( Rect_ContainsPoint( &item->window.rect, DC->cursorx, DC->cursory ) &&
@@ -3069,7 +3069,7 @@ qboolean Item_ListBox_HandleKey( itemDef_t *item, int key, qboolean down, qboole
listPtr->startPos = listPtr->cursorPos - viewmax + 1;
item->cursorPos = listPtr->cursorPos;
- DC->feederSelection( item->special, item->cursorPos );
+ DC->feederSelection( item->feederID, item->cursorPos );
}
else
{
@@ -3098,7 +3098,7 @@ qboolean Item_ListBox_HandleKey( itemDef_t *item, int key, qboolean down, qboole
listPtr->startPos = listPtr->cursorPos - viewmax + 1;
item->cursorPos = listPtr->cursorPos;
- DC->feederSelection( item->special, item->cursorPos );
+ DC->feederSelection( item->feederID, item->cursorPos );
}
else
{
@@ -3131,7 +3131,7 @@ qboolean Item_ListBox_HandleKey( itemDef_t *item, int key, qboolean down, qboole
listPtr->startPos = listPtr->cursorPos - viewmax + 1;
item->cursorPos = listPtr->cursorPos;
- DC->feederSelection( item->special, item->cursorPos );
+ DC->feederSelection( item->feederID, item->cursorPos );
}
else
{
@@ -3160,7 +3160,7 @@ qboolean Item_ListBox_HandleKey( itemDef_t *item, int key, qboolean down, qboole
listPtr->startPos = listPtr->cursorPos - viewmax + 1;
item->cursorPos = listPtr->cursorPos;
- DC->feederSelection( item->special, item->cursorPos );
+ DC->feederSelection( item->feederID, item->cursorPos );
}
else
{
@@ -3219,7 +3219,7 @@ qboolean Item_ListBox_HandleKey( itemDef_t *item, int key, qboolean down, qboole
if( item->cursorPos != listPtr->cursorPos )
{
item->cursorPos = listPtr->cursorPos;
- DC->feederSelection( item->special, item->cursorPos );
+ DC->feederSelection( item->feederID, item->cursorPos );
}
if( DC->realTime < lastListBoxClickTime && listPtr->doubleClick )
@@ -3293,7 +3293,7 @@ qboolean Item_ListBox_HandleKey( itemDef_t *item, int key, qboolean down, qboole
listPtr->startPos = listPtr->cursorPos - viewmax + 1;
item->cursorPos = listPtr->cursorPos;
- DC->feederSelection( item->special, item->cursorPos );
+ DC->feederSelection( item->feederID, item->cursorPos );
}
else
{
@@ -3324,7 +3324,7 @@ qboolean Item_ListBox_HandleKey( itemDef_t *item, int key, qboolean down, qboole
listPtr->startPos = listPtr->cursorPos - viewmax + 1;
item->cursorPos = listPtr->cursorPos;
- DC->feederSelection( item->special, item->cursorPos );
+ DC->feederSelection( item->feederID, item->cursorPos );
}
else
{
@@ -3433,7 +3433,7 @@ qboolean Item_Combobox_HandleKey( itemDef_t *item, int key )
{
comboBoxDef_t *comboPtr = item->typeData.combo;
qboolean mouseOver = Rect_ContainsPoint( &item->window.rect, DC->cursorx, DC->cursory );
- int count = DC->feederCount( item->special );
+ int count = DC->feederCount( item->feederID );
if( comboPtr )
{
@@ -3445,7 +3445,7 @@ qboolean Item_Combobox_HandleKey( itemDef_t *item, int key )
if( count > 0 )
comboPtr->cursorPos = ( comboPtr->cursorPos + 1 ) % count;
- DC->feederSelection( item->special, comboPtr->cursorPos );
+ DC->feederSelection( item->feederID, comboPtr->cursorPos );
return qtrue;
}
@@ -3455,7 +3455,7 @@ qboolean Item_Combobox_HandleKey( itemDef_t *item, int key )
if( count > 0 )
comboPtr->cursorPos = ( count + comboPtr->cursorPos - 1 ) % count;
- DC->feederSelection( item->special, comboPtr->cursorPos );
+ DC->feederSelection( item->feederID, comboPtr->cursorPos );
return qtrue;
}
@@ -4144,12 +4144,12 @@ void Menus_Activate( menuDef_t *menu )
{
menu->items[ i ]->cursorPos = 0;
menu->items[ i ]->typeData.list->startPos = 0;
- DC->feederSelection( menu->items[ i ]->special, 0 );
+ DC->feederSelection( menu->items[ i ]->feederID, 0 );
}
else if( menu->items[ i ]->type == ITEM_TYPE_COMBO )
{
menu->items[ i ]->typeData.combo->cursorPos =
- DC->feederInitialise( menu->items[ i ]->special );
+ DC->feederInitialise( menu->items[ i ]->feederID );
}
}
@@ -5087,7 +5087,7 @@ void Item_Combobox_Paint( itemDef_t *item )
memcpy( &newColor, &item->window.foreColor, sizeof( vec4_t ) );
if( item->typeData.combo )
- text = DC->feederItemText( item->special, item->typeData.combo->cursorPos,
+ text = DC->feederItemText( item->feederID, item->typeData.combo->cursorPos,
0, NULL );
if( item->text )
@@ -5659,7 +5659,7 @@ void Item_ListBox_Paint( itemDef_t *item )
// elements are enumerated from the DC and either text or image handles are acquired from the DC as well
// textscale is used to size the text, textalignx and textaligny are used to size image elements
// there is no clipping available so only the last completely visible item is painted
- count = DC->feederCount( item->special );
+ count = DC->feederCount( item->feederID );
// default is vertical if horizontal flag is not here
if( item->window.flags & WINDOW_HORIZONTAL )
@@ -5703,7 +5703,7 @@ void Item_ListBox_Paint( itemDef_t *item )
{
// always draw at least one
// which may overdraw the box if it is too small for the element
- image = DC->feederItemImage( item->special, i );
+ image = DC->feederItemImage( item->feederID, i );
if( image )
DC->drawHandlePic( x + 1, y + 1, listPtr->elementWidth - 2, listPtr->elementHeight - 2, image );
@@ -5765,7 +5765,7 @@ void Item_ListBox_Paint( itemDef_t *item )
{
// always draw at least one
// which may overdraw the box if it is too small for the element
- image = DC->feederItemImage( item->special, i );
+ image = DC->feederItemImage( item->feederID, i );
if( image )
DC->drawHandlePic( x + one, y + 1, listPtr->elementWidth - two, listPtr->elementHeight - 2, image );
@@ -5823,7 +5823,7 @@ void Item_ListBox_Paint( itemDef_t *item )
height = listPtr->columnInfo[ j ].width;
- Q_strncpyz( text, DC->feederItemText( item->special, i, j, &optionalImage ), sizeof( text ) );
+ Q_strncpyz( text, DC->feederItemText( item->feederID, i, j, &optionalImage ), sizeof( text ) );
if( optionalImage >= 0 )
{
@@ -5878,7 +5878,7 @@ void Item_ListBox_Paint( itemDef_t *item )
else
offset = 4.0f;
- Q_strncpyz( text, DC->feederItemText( item->special, i, 0, &optionalImage ), sizeof( text ) );
+ Q_strncpyz( text, DC->feederItemText( item->feederID, i, 0, &optionalImage ), sizeof( text ) );
if( optionalImage >= 0 )
DC->drawHandlePic( x + offset, y, listPtr->elementHeight, listPtr->elementHeight, optionalImage );
@@ -5987,7 +5987,7 @@ void Item_OwnerDraw_Paint( itemDef_t *item )
item->textalignx, item->textaligny,
item->window.ownerDraw, item->window.ownerDrawFlags,
item->alignment, item->textalignment, item->textvalignment,
- item->special, item->textscale, color, item->window.backColor,
+ item->window.borderSize, item->textscale, color, item->window.backColor,
item->window.background, item->textStyle );
}
}
@@ -6288,7 +6288,7 @@ void Menu_ScrollFeeder( menuDef_t *menu, int feeder, qboolean down )
for( i = 0; i < menu->itemCount; i++ )
{
- if( menu->items[i]->special == feeder )
+ if( menu->items[i]->feederID == feeder )
{
Item_ListBox_HandleKey( menu->items[i], ( down ) ? K_DOWNARROW : K_UPARROW, qtrue, qtrue );
return;
@@ -6315,16 +6315,16 @@ void Menu_SetFeederSelection( menuDef_t *menu, int feeder, int index, const char
for( i = 0; i < menu->itemCount; i++ )
{
- if( menu->items[i]->special == feeder )
+ if( menu->items[i]->feederID == feeder )
{
- if( index == 0 )
+ if( menu->items[i]->type == ITEM_TYPE_LISTBOX && index == 0 )
{
menu->items[ i ]->typeData.list->cursorPos = 0;
menu->items[ i ]->typeData.list->startPos = 0;
}
menu->items[i]->cursorPos = index;
- DC->feederSelection( menu->items[i]->special, menu->items[i]->cursorPos );
+ DC->feederSelection( menu->items[i]->feederID, menu->items[i]->cursorPos );
return;
}
}
@@ -6832,10 +6832,10 @@ qboolean ItemParse_elementheight( itemDef_t *item, int handle )
return PC_Float_Parse( handle, &item->typeData.list->elementHeight );
}
-// feeder <float>
+// feeder <int>
qboolean ItemParse_feeder( itemDef_t *item, int handle )
{
- if( !PC_Float_Parse( handle, &item->special ) )
+ if( !PC_Int_Parse( handle, &item->feederID ) )
return qfalse;
return qtrue;
@@ -7124,14 +7124,6 @@ qboolean ItemParse_action( itemDef_t *item, int handle )
return qtrue;
}
-qboolean ItemParse_special( itemDef_t *item, int handle )
-{
- if( !PC_Float_Parse( handle, &item->special ) )
- return qfalse;
-
- return qtrue;
-}
-
qboolean ItemParse_cvarTest( itemDef_t *item, int handle )
{
if( !PC_String_Parse( handle, &item->cvarTest ) )
@@ -7433,7 +7425,6 @@ keywordHash_t itemParseKeywords[] = {
{"mouseExitText", ItemParse_mouseExitText, NULL},
{"onTextEntry", ItemParse_onTextEntry, NULL},
{"action", ItemParse_action, NULL},
- {"special", ItemParse_special, NULL},
{"cvar", ItemParse_cvar, NULL},
{"maxChars", ItemParse_maxChars, NULL},
{"maxPaintChars", ItemParse_maxPaintChars, NULL},
diff --git a/src/ui/ui_shared.h b/src/ui/ui_shared.h
index 3a8ee74f..3c1472b9 100644
--- a/src/ui/ui_shared.h
+++ b/src/ui/ui_shared.h
@@ -280,7 +280,7 @@ typedef struct itemDef_s
sfxHandle_t focusSound;
int numColors; // number of color ranges
colorRangeDef_t colorRanges[MAX_COLOR_RANGES];
- float special; // used for feeder id's etc.. diff per type
+ int feederID; // where to get data for this item
int cursorPos; // cursor position in characters
union
{
@@ -382,7 +382,7 @@ typedef struct
void ( *ownerDrawItem ) ( float x, float y, float w, float h, float text_x,
float text_y, int ownerDraw, int ownerDrawFlags,
int align, int textalign, int textvalign,
- float special, float scale, vec4_t foreColor,
+ float borderSize, float scale, vec4_t foreColor,
vec4_t backColor, qhandle_t shader, int textStyle );
float ( *getValue ) ( int ownerDraw );
qboolean ( *ownerDrawVisible ) ( int flags );
@@ -394,7 +394,7 @@ typedef struct
void ( *setOverstrikeMode )( qboolean b );
qboolean ( *getOverstrikeMode )( void );
void ( *startLocalSound )( sfxHandle_t sfx, int channelNum );
- qboolean ( *ownerDrawHandleKey )( int ownerDraw, int flags, float *special, int key );
+ qboolean ( *ownerDrawHandleKey )( int ownerDraw, int key );
int ( *feederCount )( float feederID );
const char *( *feederItemText )( float feederID, int index, int column, qhandle_t *handle );
qhandle_t ( *feederItemImage )( float feederID, int index );