*neutrino menu classes: add member and numerations to manage menu position

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1954 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
thilo
2011-12-06 19:55:38 +00:00
parent 19e2c186c2
commit 27af698792
3 changed files with 54 additions and 26 deletions

View File

@@ -802,10 +802,8 @@ void CMenuWidget::calcSize()
// shrink menu if less items // shrink menu if less items
if(hheight+itemHeightTotal < height) if(hheight+itemHeightTotal < height)
height=hheight+itemHeightTotal; height=hheight+itemHeightTotal;
x = offx + frameBuffer->getScreenX() + ((frameBuffer->getScreenWidth() - width ) >> 1 ); //scrollbar width
y = offy + frameBuffer->getScreenY() + ((frameBuffer->getScreenHeight() - height) >> 1 );
sb_width=0; sb_width=0;
if(total_pages > 1) if(total_pages > 1)
sb_width=15; sb_width=15;
@@ -813,26 +811,7 @@ void CMenuWidget::calcSize()
full_width = width+sb_width+SHADOW_OFFSET; full_width = width+sb_width+SHADOW_OFFSET;
full_height = height+RADIUS_LARGE-2+SHADOW_OFFSET; full_height = height+RADIUS_LARGE-2+SHADOW_OFFSET;
switch(g_settings.menu_pos) { setMenuPos(width - sb_width);
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;
}
} }
void CMenuWidget::paint(bool save) void CMenuWidget::paint(bool save)
@@ -864,6 +843,45 @@ void CMenuWidget::paint(bool save)
paintItems(); 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() void CMenuWidget::paintItems()
{ {
int item_height=height-(item_start_y-y); int item_height=height-(item_start_y-y);

View File

@@ -426,6 +426,8 @@ class CMenuWidget : public CMenuTarget
void calcSize(); void calcSize();
void saveScreen(); void saveScreen();
void restoreScreen(); void restoreScreen();
void setMenuPos(const int& menu_width);
public: public:
CMenuWidget(); CMenuWidget();
/* mwidth (minimum width) in percent of screen width */ /* mwidth (minimum width) in percent of screen width */
@@ -458,9 +460,17 @@ class CMenuWidget : public CMenuTarget
virtual int getSelected(){ return selected; }; virtual int getSelected(){ return selected; };
void move(int xoff, int yoff); void move(int xoff, int yoff);
int getSelectedLine(void){return exit_pressed ? -1 : selected;}; 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 enableFade(bool _enable) { fade = _enable; };
void enableSaveScreen(bool 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 class CPINProtection

View File

@@ -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.casystem_display = configfile.getInt32("casystem_display", 2 );//mini ca mode default
g_settings.scrambled_message = configfile.getBool("scrambled_message", true ); g_settings.scrambled_message = configfile.getBool("scrambled_message", true );
g_settings.volume_pos = configfile.getInt32("volume_pos", 0 ); 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.infobar_show_var_hdd = configfile.getBool("infobar_show_var_hdd" , true );
g_settings.show_infomenu = configfile.getInt32("show_infomenu", 0 ); g_settings.show_infomenu = configfile.getInt32("show_infomenu", 0 );
g_settings.show_mute_icon = configfile.getInt32("show_mute_icon" ,0); g_settings.show_mute_icon = configfile.getInt32("show_mute_icon" ,0);