menue.h/cpp: add method to override menu position from user settings

This commit is contained in:
2019-06-20 20:41:19 +02:00
parent 851c8d16e0
commit d46645ec93
2 changed files with 10 additions and 3 deletions

View File

@@ -640,6 +640,7 @@ void CMenuWidget::Init(const std::string &NameString, const std::string &Icon, c
//pos
x = y = 0;
height = 0;
w_pos_mode = MENU_POS_PRESET;
//caption and icon
nameString = NameString;
@@ -1459,8 +1460,10 @@ void CMenuWidget::setMenuPos(const int& menu_width)
int real_h = full_height + hint_h; // full_height includes footer_height : see calcSize
int x_old = x;
int y_old = y;
//configured positions
switch(g_settings.menu_pos)
//configured/custom positions
int menu_pos = w_pos_mode == MENU_POS_PRESET ? g_settings.menu_pos : w_pos_mode;
switch(menu_pos)
{
case MENU_POS_CENTER:
x = offx + scr_x + ((scr_w - menu_width ) >> 1 );