diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 8679b46ed..8067b4ea1 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -802,10 +802,8 @@ void CMenuWidget::calcSize() // shrink menu if less items if(hheight+itemHeightTotal < height) height=hheight+itemHeightTotal; - - x = offx + frameBuffer->getScreenX() + ((frameBuffer->getScreenWidth() - width ) >> 1 ); - y = offy + frameBuffer->getScreenY() + ((frameBuffer->getScreenHeight() - height) >> 1 ); - + + //scrollbar width sb_width=0; if(total_pages > 1) sb_width=15; @@ -813,26 +811,7 @@ void CMenuWidget::calcSize() full_width = width+sb_width+SHADOW_OFFSET; full_height = height+RADIUS_LARGE-2+SHADOW_OFFSET; - switch(g_settings.menu_pos) { - case 0: //DEFAULT_CENTER - break; - case 1: //TOP_LEFT - y = offy + frameBuffer->getScreenY() + 10; - x = offx + frameBuffer->getScreenX() + 10; - break; - case 2: //TOP_RIGHT - y = offy + frameBuffer->getScreenY() + 10; - x = offx + frameBuffer->getScreenX() + frameBuffer->getScreenWidth() - width - sb_width - 10; - break; - case 3: //BOTTOM_LEFT - y = offy + frameBuffer->getScreenY() + frameBuffer->getScreenHeight() - height - 10; - x = offx + frameBuffer->getScreenX() + 10; - break; - case 4: //BOTTOM_RIGHT - y = offy + frameBuffer->getScreenY() + frameBuffer->getScreenHeight() - height - 10; - x = offx + frameBuffer->getScreenX() + frameBuffer->getScreenWidth() - width - sb_width - 10; - break; - } + setMenuPos(width - sb_width); } void CMenuWidget::paint(bool save) @@ -864,6 +843,45 @@ void CMenuWidget::paint(bool save) paintItems(); } +void CMenuWidget::setMenuPos(const int& menu_width) +{ + int mn_width = menu_width; + + int scr_x = frameBuffer->getScreenX(); + int scr_y = frameBuffer->getScreenY(); + int scr_w = frameBuffer->getScreenWidth(); + int scr_h = frameBuffer->getScreenHeight(); + + //configured positions + switch(g_settings.menu_pos) + { + case MENU_POS_CENTER: + x = offx + scr_x + ((scr_w - mn_width ) >> 1 ); + y = offy + scr_y + ((scr_h - height) >> 1 ); + break; + + case MENU_POS_TOP_LEFT: + y = offy + scr_y + 10; + x = offx + scr_x + 10; + break; + + case MENU_POS_TOP_RIGHT: + y = offy + scr_y + 10; + x = offx + scr_x + scr_w - mn_width - 10; + break; + + case MENU_POS_BOTTOM_LEFT: + y = offy + scr_y + scr_h - height - 10; + x = offx + scr_x + 10; + break; + + case MENU_POS_BOTTOM_RIGHT: + y = offy + scr_y + scr_h - height - 10; + x = offx + scr_x + scr_w - mn_width - 10; + break; + } +} + void CMenuWidget::paintItems() { int item_height=height-(item_start_y-y); diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index dc501fa6a..892cdec78 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -426,6 +426,8 @@ class CMenuWidget : public CMenuTarget void calcSize(); void saveScreen(); void restoreScreen(); + void setMenuPos(const int& menu_width); + public: CMenuWidget(); /* mwidth (minimum width) in percent of screen width */ @@ -458,9 +460,17 @@ class CMenuWidget : public CMenuTarget virtual int getSelected(){ return selected; }; void move(int xoff, int yoff); int getSelectedLine(void){return exit_pressed ? -1 : selected;}; - void setWizardMode(bool _from_wizard) { from_wizard = _from_wizard;}; + void setWizardMode(bool _from_wizard) { from_wizard = _from_wizard;}; void enableFade(bool _enable) { fade = _enable; }; void enableSaveScreen(bool enable); + enum + { + MENU_POS_CENTER , + MENU_POS_TOP_LEFT , + MENU_POS_TOP_RIGHT , + MENU_POS_BOTTOM_LEFT , + MENU_POS_BOTTOM_RIGHT , + }; }; class CPINProtection diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 84025f44c..838dcc899 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -452,7 +452,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.casystem_display = configfile.getInt32("casystem_display", 2 );//mini ca mode default g_settings.scrambled_message = configfile.getBool("scrambled_message", true ); g_settings.volume_pos = configfile.getInt32("volume_pos", 0 ); - g_settings.menu_pos = configfile.getInt32("menu_pos", 0 ); + g_settings.menu_pos = configfile.getInt32("menu_pos", CMenuWidget::MENU_POS_CENTER); g_settings.infobar_show_var_hdd = configfile.getBool("infobar_show_var_hdd" , true ); g_settings.show_infomenu = configfile.getInt32("show_infomenu", 0 ); g_settings.show_mute_icon = configfile.getInt32("show_mute_icon" ,0);