From f9cdecc4f11ba5df46d65580f9abb9cdbadca538 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 11 Apr 2018 23:58:14 +0200 Subject: [PATCH] color setup: Visualize color rate Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/7a51a392f19a77b00d09713f146cb2c7edf9831d Author: Thilo Graf Date: 2018-04-11 (Wed, 11 Apr 2018) --- src/gui/widget/colorchooser.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gui/widget/colorchooser.cpp b/src/gui/widget/colorchooser.cpp index 9253752cb..f7007af6c 100644 --- a/src/gui/widget/colorchooser.cpp +++ b/src/gui/widget/colorchooser.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -299,9 +300,16 @@ 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); - frameBuffer->paintBoxFrame(px + text_width + 2*OFFSET_INNER_MID + bar_offset, py + item_height/3, bar_width, item_height/3, 1, COL_FRAME_PLUS_0); - // paint slider - frameBuffer->paintIcon(selected ? iconname : NEUTRINO_ICON_SLIDER_INACTIVE, px + text_width + 2*OFFSET_INNER_MID + ((*spos)*bar_width / 100), py, item_height); + int w_col_rate = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->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); + // paint slider + 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); + // 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); }