From 1ca349373a9340e87073f7a8f6e4c529b2f7b21a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 11 Apr 2018 11:35:22 +0200 Subject: [PATCH] CColorChooser: use unified variable vor window font --- src/gui/widget/colorchooser.cpp | 11 ++++++----- src/gui/widget/colorchooser.h | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gui/widget/colorchooser.cpp b/src/gui/widget/colorchooser.cpp index f7007af6c..45f197ea4 100644 --- a/src/gui/widget/colorchooser.cpp +++ b/src/gui/widget/colorchooser.cpp @@ -57,7 +57,8 @@ CColorChooser::CColorChooser(const neutrino_locale_t Name, unsigned char *R, uns { frameBuffer = CFrameBuffer::getInstance(); header_height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); - item_height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); + font = g_Font[SNeutrinoSettings::FONT_TYPE_WINDOW_GENERAL]; + item_height = font->getHeight(); observer = Observer; name = Name; @@ -65,7 +66,7 @@ CColorChooser::CColorChooser(const neutrino_locale_t Name, unsigned char *R, uns text_width = 0; for (int i = 0; i < VALUES; i++) { - int tmp_text_width = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(g_Locale->getText(colorchooser_names[i])); + int tmp_text_width = font->getRenderWidth(g_Locale->getText(colorchooser_names[i])); if (tmp_text_width > text_width) text_width = tmp_text_width; } @@ -300,7 +301,7 @@ void CColorChooser::paintSlider(int px, int py, unsigned char *spos, const neutr So long we paint a simple frame. This is more save on higher resolutions. */ //frameBuffer->paintIcon(NEUTRINO_ICON_SLIDER_BODY, px + text_width + 2*OFFSET_INNER_MID + bar_offset, py, item_height); - int w_col_rate = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("100"); + int w_col_rate = font->getRenderWidth("100"); int w_bar = bar_width - w_col_rate; int x_bar = px + text_width + 2*OFFSET_INNER_MID + bar_offset; frameBuffer->paintBoxFrame(x_bar, py + item_height/3, w_bar, item_height/3, 1, COL_FRAME_PLUS_0); @@ -309,7 +310,7 @@ void CColorChooser::paintSlider(int px, int py, unsigned char *spos, const neutr frameBuffer->paintIcon(selected ? iconname : NEUTRINO_ICON_SLIDER_INACTIVE, px + text_width + 2*OFFSET_INNER_MID + ((*spos)*w_bar / 100), py, item_height); // paint color name - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(px + OFFSET_INNER_MID, py + item_height, text_width, g_Locale->getText(text), COL_MENUCONTENT_TEXT); + font->RenderString(px + OFFSET_INNER_MID, py + item_height, text_width, g_Locale->getText(text), COL_MENUCONTENT_TEXT); // paint color rate - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x_bar + w_bar + OFFSET_INNER_MID, py + item_height, w_col_rate, to_string(*spos), COL_MENUCONTENT_TEXT); + font->RenderString(x_bar + w_bar + OFFSET_INNER_MID, py + item_height, w_col_rate, to_string(*spos), COL_MENUCONTENT_TEXT); } diff --git a/src/gui/widget/colorchooser.h b/src/gui/widget/colorchooser.h index 02c8d9536..06b32fcf7 100644 --- a/src/gui/widget/colorchooser.h +++ b/src/gui/widget/colorchooser.h @@ -66,6 +66,7 @@ class CColorChooser : public CMenuTarget neutrino_locale_t name; CChangeObserver* observer; + Font * font; void paint(); void setColor();