diff --git a/src/driver/neutrinofonts.h b/src/driver/neutrinofonts.h index 53b6952df..1aefa4fcd 100644 --- a/src/driver/neutrinofonts.h +++ b/src/driver/neutrinofonts.h @@ -87,7 +87,7 @@ class CNeutrinoFonts FONT_ID_SHARE = -1 }; enum { - FONT_ID_xxx, + FONT_ID_VOLBAR, FONT_ID_MAX }; diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index b2287efb2..e8aa2384e 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -32,6 +32,7 @@ #include #include +#include using namespace std; @@ -68,7 +69,6 @@ void CVolumeBar::initVarVolumeBar() vb_digit = NULL; vb_digit_mode = CTextBox::CENTER ; VolumeFont = SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO; - vb_font = g_Font[VolumeFont]; initVolumeBarSize(); initVolumeBarPosition(); @@ -200,7 +200,7 @@ void CVolumeBar::initVolumeBarScale() //set digit text with current volume value void CVolumeBar::initVolumeBarDigitValue() { - vb_digit->setText(*vb_vol ,vb_digit_mode, vb_font); + vb_digit->setText(*vb_vol ,vb_digit_mode, *(CVolumeHelper::getInstance()->vb_font)); } //create digit @@ -277,6 +277,7 @@ void CVolumeHelper::Init() y = frameBuffer->getScreenY() + v_spacer; sw = g_settings.screen_EndX - h_spacer; sh = frameBuffer->getScreenHeight(); + vb_font = NULL; initVolBarSize(); initMuteIcon(); @@ -319,7 +320,7 @@ void CVolumeHelper::initMuteIcon() void CVolumeHelper::initVolBarSize() { - vol_height = 18; + vol_height = 26; icon_width = 0; digit_width = 0; int tmp_h = 0; @@ -329,9 +330,13 @@ void CVolumeHelper::initVolBarSize() vol_height = max(vol_height, tmp_h); if (g_settings.volume_digits) { - tmp_h = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getDigitHeight() + (g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getDigitOffset() * 18) / 10; + CNeutrinoFonts *cnf = CNeutrinoFonts::getInstance(); + cnf->setFontUseDigitHeight(true); + tmp_h = vol_height; + digit_width = 200; + vb_font = cnf->getDynFont(digit_width, tmp_h, "100", CNeutrinoFonts::FONT_STYLE_REGULAR); + digit_width += 6; vol_height = max(vol_height, tmp_h); - digit_width = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getRenderWidth("100"); } } diff --git a/src/gui/volumebar.h b/src/gui/volumebar.h index af44efef0..aa10b8e2f 100644 --- a/src/gui/volumebar.h +++ b/src/gui/volumebar.h @@ -40,7 +40,6 @@ class CVolumeBar : public CComponentsForm CComponentsPicture *vb_icon; CComponentsLabel *vb_digit; int vb_digit_mode; - Font* vb_font; int VolumeFont; int sy, sw, sh; int mute_ax, mute_ay, mute_dx, mute_dy, mute_ay_old; @@ -120,6 +119,8 @@ class CVolumeHelper CVolumeHelper(); static CVolumeHelper* getInstance(); + Font** vb_font; + void getSpacer(int *h, int *v) { *h = h_spacer; *v = v_spacer; } void getDimensions(int *_x, int *_y, int *_sw, int *_sh, int *_iw, int *_dw) { *_x = x; *_y = y; *_sw = sw; *_sh = sh; *_iw = icon_width; *_dw = digit_width; } void getMuteIconDimensions(int *_x, int *_y, int *w, int *h) { *_x = mute_ax; *_y = mute_ay+mute_corrY; *w = mute_dx; *h = mute_dy; }