From a552ac1c828f3175addf2332f6c9d1383b890744 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Sat, 29 Jun 2013 11:44:53 +0200 Subject: [PATCH] Add option to resize the VolumeBar - Minimum height: Height of NEUTRINO_ICON_VOLUME + 2 pixels - Maximum height: 50 pixels - Setting can be changed with: Menu -> Settings -> OSD -> Volume -> Height of display Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/0a0035c2ae80cdb601813687787ecc6eedb93a79 Author: Michael Liebmann Date: 2013-06-29 (Sat, 29 Jun 2013) Origin message was: ------------------ Add option to resize the VolumeBar - Minimum height: Height of NEUTRINO_ICON_VOLUME + 2 pixels - Maximum height: 50 pixels - Setting can be changed with: Menu -> Settings -> OSD -> Volume -> Height of display ------------------ This commit was generated by Migit --- data/locale/deutsch.locale | 2 ++ data/locale/english.locale | 2 ++ src/gui/osd_setup.cpp | 12 ++++++++++++ src/gui/volumebar.cpp | 25 +++++++++++++------------ src/gui/volumebar.h | 3 ++- src/neutrino.cpp | 2 ++ src/system/locals.h | 2 ++ src/system/locals_intern.h | 2 ++ src/system/settings.h | 1 + 9 files changed, 38 insertions(+), 13 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 44b194b00..b435fc01c 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -420,6 +420,7 @@ extra.update_dir Lokales Update-Verzeichnis extra.use_gotoxx Benutze gotoXX extra.volume_digits Lautstärkeanzeige Ziffern extra.volume_pos Lautstärkeanzeige +extra.volume_size Höhe der Anzeige extra.west Westen extra.zap_cycle Zap nur in Bouquet extra.zapit_fe_timeout Tuning Timeout (1=10ms) @@ -1132,6 +1133,7 @@ menu.hint_video_scart_mode Wählen Sie den Modus des Ausgangssignals für den SC menu.hint_volume Wählen Sie die Anzeigeoptionen für die Lautstärke menu.hint_volume_digits Zifferndarstellung der Lautstärkeanzeige ein- oder ausschalten menu.hint_volume_pos Wählen Sie die Position der Lautstärkeanzeige aus +menu.hint_volume_size Wählen Sie die Höhe der Lautstärkeanzeige menu.hint_ytplay Wiedergabe von ausgewählten Youtube Feeds menu.hint_zap_cycle Wählen Sie, ob nur innerhalb des aktiven Bouquets umgeschaltet werden kann menu.next Weiter (Menü zum Beenden) diff --git a/data/locale/english.locale b/data/locale/english.locale index 543e34983..13e3856c7 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -420,6 +420,7 @@ extra.update_dir Local update directory extra.use_gotoxx Use gotoXX extra.volume_digits Volumebar digits extra.volume_pos Volumebar +extra.volume_size Height of display extra.west West extra.zap_cycle Zap cycle extra.zapit_fe_timeout Tune timeout (1 = 10 msec) @@ -1135,6 +1136,7 @@ menu.hint_video_scart_mode Select analog output mode for SCART connectors menu.hint_volume Configure Volume GUI options menu.hint_volume_digits Numeric display of the volumebar on/off menu.hint_volume_pos Select volume indicator position +menu.hint_volume_size Select volume indicator height menu.hint_ytplay Play selected youtube feeds menu.hint_zap_cycle When swithing channels, stay in current bouquet menu.next Next (press Menu to quit) diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 511e53ea3..dcfd32b9d 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -521,8 +521,13 @@ int COsdSetup::showOsdSetup() mc->setHint("", LOCALE_MENU_HINT_SUBCHANNEL_POS); osd_menu->addItem(mc); + int oldVolumeSize = g_settings.volume_size; + int res = osd_menu->exec(NULL, ""); + if (oldVolumeSize != g_settings.volume_size) + CVolumeHelper::getInstance()->refresh(); + delete osd_menu; return res; } @@ -891,6 +896,13 @@ void COsdSetup::showOsdVolumeSetup(CMenuWidget *menu_volume) mc->setHint("", LOCALE_MENU_HINT_VOLUME_POS); menu_volume->addItem(mc); + // volume size + int vMin = CVolumeHelper::getInstance()->getVolIconHeight(); + g_settings.volume_size = max(g_settings.volume_size, vMin); + CMenuOptionNumberChooser * nc = new CMenuOptionNumberChooser(LOCALE_EXTRA_VOLUME_SIZE, &g_settings.volume_size, true, vMin, 50); + nc->setHint("", LOCALE_MENU_HINT_VOLUME_SIZE); + menu_volume->addItem(nc); + // volume digits mc = new CMenuOptionChooser(LOCALE_EXTRA_VOLUME_DIGITS, &g_settings.volume_digits, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this); mc->setHint("", LOCALE_MENU_HINT_VOLUME_DIGITS); diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index e8aa2384e..b28e1b3cb 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -320,23 +320,24 @@ void CVolumeHelper::initMuteIcon() void CVolumeHelper::initVolBarSize() { - vol_height = 26; - icon_width = 0; - digit_width = 0; - int tmp_h = 0; - frameBuffer->getIconSize(NEUTRINO_ICON_VOLUME, &icon_width, &tmp_h); - tmp_h += 2; - icon_width += 8; - vol_height = max(vol_height, tmp_h); + icon_width = 0; + icon_height = 0; + digit_width = 0; + frameBuffer->getIconSize(NEUTRINO_ICON_VOLUME, &icon_width, &icon_height); + icon_height = max(icon_height, 16); // if no icon available + icon_height += 2; + icon_width += 8; + g_settings.volume_size = max(g_settings.volume_size, icon_height); + vol_height = g_settings.volume_size; if (g_settings.volume_digits) { 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); + int tmp_h = vol_height; + digit_width = 0; + vb_font = cnf->getDynFont(digit_width, tmp_h, "100", CNeutrinoFonts::FONT_STYLE_REGULAR, CNeutrinoFonts::FONT_ID_VOLBAR); digit_width += 6; - vol_height = max(vol_height, tmp_h); + vol_height = max(vol_height, tmp_h); } } diff --git a/src/gui/volumebar.h b/src/gui/volumebar.h index aa10b8e2f..3903d4ac8 100644 --- a/src/gui/volumebar.h +++ b/src/gui/volumebar.h @@ -104,7 +104,7 @@ class CVolumeHelper int x, y, sw, sh; int mute_ax, mute_ay, mute_dx, mute_dy, mute_corrY; int clock_ax, clock_ay, clock_dx, clock_dy, digit_h, digit_offset; - int icon_width, digit_width; + int icon_width, icon_height, digit_width; int h_spacer, v_spacer; int vol_ay, vol_height; CFrameBuffer *frameBuffer; @@ -122,6 +122,7 @@ class CVolumeHelper Font** vb_font; void getSpacer(int *h, int *v) { *h = h_spacer; *v = v_spacer; } + int getVolIconHeight() {return icon_height;} 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; } void getInfoClockDimensions(int *_x, int *_y, int *w, int *h, int *d_h, int *d_o) { *_x = clock_ax; *_y = clock_ay; *w = clock_dx; *h = clock_dy, *d_h = digit_h, *d_o = digit_offset; } diff --git a/src/neutrino.cpp b/src/neutrino.cpp index c14d8f6a3..a37f5d23e 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -396,6 +396,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.scrambled_message = configfile.getBool("scrambled_message", true ); g_settings.volume_pos = configfile.getInt32("volume_pos", CVolumeBar::VOLUMEBAR_POS_TOP_RIGHT ); g_settings.volume_digits = configfile.getBool("volume_digits", true); + g_settings.volume_size = configfile.getInt32("volume_size", 26 ); g_settings.menu_pos = configfile.getInt32("menu_pos", CMenuWidget::MENU_POS_CENTER); g_settings.show_menu_hints = configfile.getBool("show_menu_hints", true); g_settings.infobar_show_sysfs_hdd = configfile.getBool("infobar_show_sysfs_hdd" , true ); @@ -877,6 +878,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setBool("scrambled_message" , g_settings.scrambled_message ); configfile.setInt32("volume_pos" , g_settings.volume_pos ); configfile.setBool("volume_digits", g_settings.volume_digits); + configfile.setInt32("volume_size" , g_settings.volume_size); configfile.setInt32("menu_pos" , g_settings.menu_pos); configfile.setBool("show_menu_hints" , g_settings.show_menu_hints); configfile.setInt32("infobar_show_sysfs_hdd" , g_settings.infobar_show_sysfs_hdd ); diff --git a/src/system/locals.h b/src/system/locals.h index cbb7a3396..8aa0adbfb 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -447,6 +447,7 @@ typedef enum LOCALE_EXTRA_USE_GOTOXX, LOCALE_EXTRA_VOLUME_DIGITS, LOCALE_EXTRA_VOLUME_POS, + LOCALE_EXTRA_VOLUME_SIZE, LOCALE_EXTRA_WEST, LOCALE_EXTRA_ZAP_CYCLE, LOCALE_EXTRA_ZAPIT_FE_TIMEOUT, @@ -1162,6 +1163,7 @@ typedef enum LOCALE_MENU_HINT_VOLUME, LOCALE_MENU_HINT_VOLUME_DIGITS, LOCALE_MENU_HINT_VOLUME_POS, + LOCALE_MENU_HINT_VOLUME_SIZE, LOCALE_MENU_HINT_YTPLAY, LOCALE_MENU_HINT_ZAP_CYCLE, LOCALE_MENU_NEXT, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 472cddbf9..1c2c2d49b 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -447,6 +447,7 @@ const char * locale_real_names[] = "extra.use_gotoxx", "extra.volume_digits", "extra.volume_pos", + "extra.volume_size", "extra.west", "extra.zap_cycle", "extra.zapit_fe_timeout", @@ -1162,6 +1163,7 @@ const char * locale_real_names[] = "menu.hint_volume", "menu.hint_volume_digits", "menu.hint_volume_pos", + "menu.hint_volume_size", "menu.hint_ytplay", "menu.hint_zap_cycle", "menu.next", diff --git a/src/system/settings.h b/src/system/settings.h index 1ce6f1566..0da0bda86 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -84,6 +84,7 @@ struct SNeutrinoSettings int scrambled_message; int volume_pos; int volume_digits; + int volume_size; int show_mute_icon; int menu_pos; int show_menu_hints;