Menu structure revision. Structs reordered to eliminate slop. MenuGroup_t eliminated. MenuPos_t split into MenuMenuFormat_t and MenuEntryFormat_t. DROIDMENU build fixed. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4778 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2014-11-30 02:04:36 +00:00
parent 058c3727e3
commit 4f1f23c566
2 changed files with 772 additions and 1010 deletions

File diff suppressed because it is too large Load diff

View file

@ -110,7 +110,7 @@ typedef enum MenuAnimationType_t
// a subset of screentext parameters, restricted because menus require accessibility // a subset of screentext parameters, restricted because menus require accessibility
typedef struct MenuTextType_t typedef struct MenuFont_t
{ {
int32_t tilenum; int32_t tilenum;
int32_t shade_deselected; // selected entries are mandated to glow int32_t shade_deselected; // selected entries are mandated to glow
@ -118,7 +118,7 @@ typedef struct MenuTextType_t
int32_t xspace, yline; int32_t xspace, yline;
int32_t xbetween, ybetween; int32_t xbetween, ybetween;
int32_t textflags; int32_t textflags;
} MenuTextType_t; } MenuFont_t;
@ -132,21 +132,24 @@ typedef enum MenuEntryType_t
RangeFloat, RangeFloat,
RangeDouble, RangeDouble,
String, String,
Spacer,
} MenuEntryType_t; } MenuEntryType_t;
typedef struct MenuEntryFormat_t
typedef struct MenuPos_t
{ {
vec2_t pos; int32_t marginBottom;
int32_t indent;
int32_t groupspacing;
int32_t entryspacing; // if bottomcutoff < 0, this becomes the *maximum* entry spacing
int32_t width; // 0: center, >0: width of the label column (left-aligned options), <0: -width of everything (right-aligned) int32_t width; // 0: center, >0: width of the label column (left-aligned options), <0: -width of everything (right-aligned)
int32_t bottomcutoff; // >0: the bottom edge of the menu before automatic scrolling kicks in, <0: -total height for vertical justification
int32_t cursorPosition, cursorScale; int32_t cursorPosition, cursorScale;
} MenuPos_t; } MenuEntryFormat_t;
typedef struct MenuMenuFormat_t
{
vec2_t pos;
int32_t bottomcutoff; // >0: the bottom edge of the menu before automatic scrolling kicks in, <0: -total height for vertical justification
} MenuMenuFormat_t;
typedef struct MenuLink_t typedef struct MenuLink_t
{ {
@ -156,22 +159,29 @@ typedef struct MenuLink_t
} MenuLink_t; } MenuLink_t;
typedef struct MenuOptionSet_t typedef struct MenuOptionSet_t
{ {
uint8_t features; // bit 1 = disable left/right arrows, bit 2 = disable list
// traits // traits
char **optionNames; char **optionNames;
int32_t *optionValues; // If NULL, the identity of currentOption is assumed. int32_t *optionValues; // If NULL, the identity of currentOption is assumed.
// pop-up list appearance
MenuMenuFormat_t *menuFormat;
MenuEntryFormat_t *entryFormat;
MenuFont_t *font;
// traits
int32_t numOptions; int32_t numOptions;
// specifically for a pop-up list // pop-up list state
MenuPos_t *list;
int32_t currentEntry; int32_t currentEntry;
int32_t scrollPos; int32_t scrollPos;
// appearance
uint8_t features; // bit 1 = disable left/right arrows, bit 2 = disable list
} MenuOptionSet_t; } MenuOptionSet_t;
typedef struct MenuOption_t typedef struct MenuOption_t
{ {
// appearance // appearance
MenuTextType_t *font; MenuFont_t *font;
// traits // traits
MenuOptionSet_t *options; // so that common sets such as Yes/No, On/Off can be reused MenuOptionSet_t *options; // so that common sets such as Yes/No, On/Off can be reused
@ -184,89 +194,102 @@ typedef struct MenuOption_t
} MenuOption_t; } MenuOption_t;
typedef struct MenuCustom2Col_t typedef struct MenuCustom2Col_t
{ {
// appearance // effect
MenuTextType_t *font; uint8_t *column[2];
int32_t columnWidth;
char **key; char **key;
// appearance
MenuFont_t *font;
// effect
size_t numvalid; size_t numvalid;
uint8_t *column[2]; // appearance
int32_t columnWidth;
// state // state
int8_t screenOpen; int8_t screenOpen;
} MenuCustom2Col_t; } MenuCustom2Col_t;
typedef struct MenuRangeInt32_t typedef struct MenuRangeInt32_t
{ {
// effect
int32_t *variable;
// appearance // appearance
MenuTextType_t *font; MenuFont_t *font;
uint8_t displaytype; // 0 = none, 1 = integer, 2 = percent, 3 = normalized decimal
// traits // traits
int32_t min; int32_t min;
int32_t max; int32_t max;
int32_t steps;
int32_t onehundredpercent; // 0 implies max int32_t onehundredpercent; // 0 implies max
int32_t steps;
// effect uint8_t displaytype; // 0 = none, 1 = integer, 2 = percent, 3 = normalized decimal
int32_t* variable;
} MenuRangeInt32_t; } MenuRangeInt32_t;
typedef struct MenuRangeFloat_t typedef struct MenuRangeFloat_t
{ {
// effect
float *variable;
// appearance // appearance
MenuTextType_t *font; MenuFont_t *font;
uint8_t displaytype; // 0 = none, 1 = decimal, 2 = percent, 3 = normalized decimal
// traits // traits
float min; float min;
float max; float max;
int32_t steps;
float onehundredpercent; // 0 implies 1.0 float onehundredpercent; // 0 implies 1.0
int32_t steps;
// effect uint8_t displaytype; // 0 = none, 1 = decimal, 2 = percent, 3 = normalized decimal
float* variable;
} MenuRangeFloat_t; } MenuRangeFloat_t;
typedef struct MenuRangeDouble_t typedef struct MenuRangeDouble_t
{ {
// effect
double *variable;
// appearance // appearance
MenuTextType_t *font; MenuFont_t *font;
uint8_t displaytype; // 0 = none, 1 = decimal, 2 = percent
// traits // traits
double min; double min;
double max; double max;
int32_t steps;
double onehundredpercent; // 0 implies 1.0 double onehundredpercent; // 0 implies 1.0
int32_t steps;
// effect uint8_t displaytype; // 0 = none, 1 = decimal, 2 = percent
double* variable;
} MenuRangeDouble_t; } MenuRangeDouble_t;
typedef struct MenuString_t typedef struct MenuString_t
{ {
// appearance // state
MenuTextType_t *font; char* editfield;
// effect // effect
char* variable; char* variable;
// appearance
MenuFont_t *font;
// effect
int32_t maxlength; int32_t maxlength;
int32_t flags; int32_t flags;
// state
char* editfield;
} MenuString_t; } MenuString_t;
typedef struct MenuSpacer_t
{
int32_t height;
} MenuSpacer_t;
typedef struct MenuEntry_t typedef struct MenuEntry_t
{ {
// appearance
MenuTextType_t *font;
// traits // traits
const char *name; const char *name;
MenuEntryType_t type; // appearance
MenuFont_t *font;
MenuEntryFormat_t *format;
void *entry; void *entry;
MenuEntryType_t type;
// state // state
int32_t disabled; int32_t disabled;
@ -275,18 +298,6 @@ typedef struct MenuEntry_t
} MenuEntry_t; } MenuEntry_t;
typedef struct MenuGroup_t
{
MenuEntry_t **entrylist;
int32_t numEntries;
MenuPos_t *position;
int32_t currentEntry;
int32_t currentColumn; // a little hackish but not too bad
} MenuGroup_t;
typedef enum MenuType_t typedef enum MenuType_t
{ {
Menu, Menu,
@ -299,14 +310,16 @@ typedef enum MenuType_t
typedef struct MenuMenu_t typedef struct MenuMenu_t
{ {
MenuGroup_t **grouplist;
int32_t numGroups;
const char *title; const char *title;
MenuMenuFormat_t *format;
MenuEntry_t **entrylist;
int32_t numEntries;
// state // state
int32_t currentGroup; int32_t currentEntry, currentColumn;
int32_t ytop, bottomcutoff, totalHeight, scrollPos; int32_t totalHeight, scrollPos;
} MenuMenu_t; } MenuMenu_t;
typedef struct MenuPanel_t typedef struct MenuPanel_t
{ {
@ -333,36 +346,37 @@ typedef struct MenuMessage_t
} MenuMessage_t; } MenuMessage_t;
typedef struct MenuPassword_t typedef struct MenuPassword_t
{ {
// traits
int32_t maxlength;
// state // state
char *input; char *input;
// traits
int32_t maxlength;
} MenuPassword_t; } MenuPassword_t;
typedef struct MenuFileSelect_t typedef struct MenuFileSelect_t
{ {
const char *title; const char *title;
// appearance // appearance
MenuTextType_t *font[2]; MenuFont_t *font[2];
// traits // traits
const char *pattern; const char *pattern;
char *destination; char *destination;
// state // state
fnlist_t fnlist;
CACHE1D_FIND_REC *findhigh[2]; CACHE1D_FIND_REC *findhigh[2];
int32_t currentList, scrollPos[2]; int32_t scrollPos[2];
fnlist_t fnlist;
int32_t currentList;
} MenuFileSelect_t; } MenuFileSelect_t;
typedef struct Menu_t typedef struct Menu_t
{ {
void *object;
MenuID_t menuID; MenuID_t menuID;
MenuID_t parentID; MenuID_t parentID;
MenuAnimationType_t parentAnimation; MenuAnimationType_t parentAnimation;
MenuType_t type; MenuType_t type;
void *object;
} Menu_t; } Menu_t;