Apply MenuFont_t.zoom to margins and indentations.

git-svn-id: https://svn.eduke32.com/eduke32@6197 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-06-19 23:06:33 +00:00
parent 72b7e30b19
commit 6221b0e74d
2 changed files with 16 additions and 8 deletions

View file

@ -3996,7 +3996,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
y += height;
totalHeight = y;
y += (!calculatedentryspacing || calculatedentryspacing > entry->format->marginBottom) ? entry->format->marginBottom : calculatedentryspacing;
y += (!calculatedentryspacing || calculatedentryspacing > entry->getMarginBottom()) ? entry->getMarginBottom() : calculatedentryspacing;
}
y = 0;
@ -4022,7 +4022,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
if (entry == NULL)
continue;
x = menu->format->pos.x + entry->format->indent;
x = menu->format->pos.x + entry->getIndent();
if (e == menu->currentEntry)
status |= MT_Selected;
@ -4583,7 +4583,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
}
// prepare for the next line
y += height;
y += (!calculatedentryspacing || calculatedentryspacing > entry->format->marginBottom) ? entry->format->marginBottom : calculatedentryspacing;
y += (!calculatedentryspacing || calculatedentryspacing > entry->getMarginBottom()) ? entry->getMarginBottom() : calculatedentryspacing;
}
// draw indicators if applicable
@ -4599,7 +4599,7 @@ static void Menu_RunOptionList(Menu_t *cm, MenuEntry_t *entry, MenuOption_t *obj
int32_t e, y = 0;
const int32_t y_upper = object->options->menuFormat->pos.y;
const int32_t y_lower = object->options->menuFormat->bottomcutoff;
int32_t calculatedentryspacing = object->options->entryFormat->marginBottom;
int32_t calculatedentryspacing = object->options->getMarginBottom();
// assumes height == font->get_yline()!
if (calculatedentryspacing < 0)
@ -4888,7 +4888,7 @@ static void Menu_Run(Menu_t *cm, const vec2_t origin)
{
y += object->font[i]->get_yline();
totalHeight = y;
y += object->marginBottom[i];
y += object->getMarginBottom(i);
}
y = 0;
@ -4945,7 +4945,7 @@ static void Menu_Run(Menu_t *cm, const vec2_t origin)
}
}
y += object->font[i]->get_yline() + object->marginBottom[i];
y += object->font[i]->get_yline() + object->getMarginBottom(i);
}
Menu_RunScrollbar(cm, object->format[i], y_upper + totalHeight, &object->scrollPos[i], MenuFileSelect_scrollbar_rightedge[i], origin);
@ -5115,7 +5115,7 @@ static void Menu_RunInput_EntryOptionList_MovementVerify(MenuOption_t *object)
{
const int32_t listytop = object->options->menuFormat->pos.y;
// assumes height == font->get_yline()!
const int32_t unitheight = object->options->entryFormat->marginBottom < 0 ? (-object->options->entryFormat->marginBottom - object->options->font->get_yline()) / object->options->numOptions : (object->options->font->get_yline() + object->options->entryFormat->marginBottom);
const int32_t unitheight = object->options->getMarginBottom() < 0 ? (-object->options->getMarginBottom() - object->options->font->get_yline()) / object->options->numOptions : (object->options->font->get_yline() + object->options->getMarginBottom());
const int32_t ytop = listytop + object->options->currentEntry * unitheight;
const int32_t ybottom = ytop + object->options->font->get_yline();
@ -5431,7 +5431,7 @@ static void Menu_RunInput_FileSelect_MovementVerify(MenuFileSelect_t *object)
{
const int32_t listytop = object->format[object->currentList]->pos.y;
const int32_t listybottom = klabs(object->format[object->currentList]->bottomcutoff);
const int32_t ytop = listytop + object->findhigh[object->currentList]->type * (object->font[object->currentList]->get_yline() + object->marginBottom[object->currentList]);
const int32_t ytop = listytop + object->findhigh[object->currentList]->type * (object->font[object->currentList]->get_yline() + object->getMarginBottom(object->currentList));
const int32_t ybottom = ytop + object->font[object->currentList]->get_yline();
if (ybottom - object->scrollPos[object->currentList] > listybottom)

View file

@ -186,6 +186,9 @@ typedef struct MenuOptionSet_t
// appearance
uint8_t features; // bit 1 = disable left/right arrows, bit 2 = disable list
int32_t getMarginBottom() const { return scale(entryFormat->marginBottom, font->zoom, 65536); }
int32_t getIndent() const { return scale(entryFormat->indent, font->zoom, 65536); }
} MenuOptionSet_t;
typedef struct MenuOption_t
{
@ -318,6 +321,9 @@ typedef struct MenuEntry_t
// state
int32_t flags;
int32_t ytop, ybottom;
int32_t getMarginBottom() const { return scale(format->marginBottom, font->zoom, 65536); }
int32_t getIndent() const { return scale(format->indent, font->zoom, 65536); }
} MenuEntry_t;
@ -403,6 +409,8 @@ typedef struct MenuFileSelect_t
// state
fnlist_t fnlist;
int32_t currentList;
int32_t getMarginBottom(size_t index) const { return scale(marginBottom[index], font[index]->zoom, 65536); }
} MenuFileSelect_t;
typedef struct Menu_t