mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-06 13:18:27 +02:00
menue.cpp/h: modify move behavior of menu window for custom position
MENU_POS_PRESET is replaced with MENU_POS_CUSTOM. This allows
with methode setPos() to any position on screen without preset offset.
Old behavior is untouched.
Origin commit data
------------------
Commit: 8174f094e6
Author: Thilo Graf <dbt@novatux.de>
Date: 2022-03-27 (Sun, 27 Mar 2022)
This commit is contained in:
@@ -642,7 +642,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;
|
||||
w_pos_mode = g_settings.menu_pos;
|
||||
|
||||
//caption and icon
|
||||
nameString = NameString;
|
||||
@@ -718,6 +718,13 @@ void CMenuWidget::move(int xoff, int yoff)
|
||||
offy = yoff;
|
||||
}
|
||||
|
||||
void CMenuWidget::setPos(int X, int Y)
|
||||
{
|
||||
x = X;
|
||||
y = Y;
|
||||
w_pos_mode = MENU_POS_CUSTOM;
|
||||
}
|
||||
|
||||
CMenuWidget::~CMenuWidget()
|
||||
{
|
||||
resetWidget(true);
|
||||
@@ -1489,32 +1496,34 @@ void CMenuWidget::setMenuPos(const int& menu_width)
|
||||
int y_old = y;
|
||||
|
||||
//configured/custom positions
|
||||
int menu_pos = w_pos_mode == MENU_POS_PRESET ? g_settings.menu_pos : w_pos_mode;
|
||||
int menu_pos = g_settings.menu_pos;
|
||||
if (w_pos_mode == MENU_POS_CUSTOM)
|
||||
menu_pos = MENU_POS_CUSTOM;
|
||||
|
||||
switch(menu_pos)
|
||||
{
|
||||
case MENU_POS_CUSTOM:
|
||||
x += DETAILSLINE_WIDTH;
|
||||
break;
|
||||
case MENU_POS_CENTER:
|
||||
x = offx + scr_x + ((scr_w - menu_width ) >> 1 );
|
||||
y = offy + scr_y + ((scr_h - real_h) >> 1 );
|
||||
//x += DETAILSLINE_WIDTH;
|
||||
break;
|
||||
|
||||
case MENU_POS_TOP_LEFT:
|
||||
y = offy + scr_y + OFFSET_INNER_MID;
|
||||
x = offx + scr_x + OFFSET_INNER_MID;
|
||||
x += g_settings.show_menu_hints_line ? DETAILSLINE_WIDTH : 0; //NI
|
||||
break;
|
||||
|
||||
case MENU_POS_TOP_RIGHT:
|
||||
y = offy + scr_y + OFFSET_INNER_MID;
|
||||
x = /*offx +*/ scr_x + scr_w - menu_width - OFFSET_INNER_MID;
|
||||
break;
|
||||
|
||||
case MENU_POS_BOTTOM_LEFT:
|
||||
y = /*offy +*/ scr_y + scr_h - real_h - OFFSET_INNER_MID;
|
||||
x = offx + scr_x + OFFSET_INNER_MID;
|
||||
x += g_settings.show_menu_hints_line ? DETAILSLINE_WIDTH : 0; //NI
|
||||
break;
|
||||
|
||||
case MENU_POS_BOTTOM_RIGHT:
|
||||
y = /*offy +*/ scr_y + scr_h - real_h - OFFSET_INNER_MID;
|
||||
x = /*offx +*/ scr_x + scr_w - menu_width - OFFSET_INNER_MID;
|
||||
|
Reference in New Issue
Block a user