From 46619e9ff2a33952492cf8d321c01d457c9a39b2 Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 12 Sep 2016 10:46:15 -0300 Subject: [PATCH] Improve RGB/HSB sliders look when they are smaller --- data/skins/default/skin.xml | 12 ++++++------ src/app/ui/color_popup.cpp | 3 +++ src/app/ui/color_sliders.cpp | 6 +++--- src/app/ui/skin/skin_theme.cpp | 17 +++++++++-------- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/data/skins/default/skin.xml b/data/skins/default/skin.xml index 67a2da808..e2e220767 100644 --- a/data/skins/default/skin.xml +++ b/data/skins/default/skin.xml @@ -192,8 +192,8 @@ - - + + @@ -212,10 +212,10 @@ - - - - + + + + diff --git a/src/app/ui/color_popup.cpp b/src/app/ui/color_popup.cpp index 1eab8f158..979f2e108 100644 --- a/src/app/ui/color_popup.cpp +++ b/src/app/ui/color_popup.cpp @@ -70,6 +70,9 @@ ColorPopup::ColorPopup(bool canPin) m_colorPaletteContainer.attachToView(&m_colorPalette); m_colorPaletteContainer.setExpansive(true); + m_rgbSliders.setExpansive(true); + m_hsvSliders.setExpansive(true); + m_graySlider.setExpansive(true); m_topBox.addChild(&m_colorType); m_topBox.addChild(new Separator("", VERTICAL)); diff --git a/src/app/ui/color_sliders.cpp b/src/app/ui/color_sliders.cpp index 102afb438..08adfaf44 100644 --- a/src/app/ui/color_sliders.cpp +++ b/src/app/ui/color_sliders.cpp @@ -164,9 +164,9 @@ void ColorSliders::addSlider(Channel channel, const char* labelText, int min, in box->setMaxSize(sz); entry->setMaxSize(sz); - m_grid.addChildInCell(label, 1, 1, LEFT | MIDDLE); - m_grid.addChildInCell(box, 1, 1, HORIZONTAL | VERTICAL); - m_grid.addChildInCell(entry, 1, 1, LEFT | MIDDLE); + m_grid.addChildInCell(label, 1, 1, LEFT | MIDDLE); + m_grid.addChildInCell(box, 1, 1, HORIZONTAL | VERTICAL); + m_grid.addChildInCell(entry, 1, 1, LEFT | MIDDLE); } void ColorSliders::setAbsSliderValue(int sliderIndex, int value) diff --git a/src/app/ui/skin/skin_theme.cpp b/src/app/ui/skin/skin_theme.cpp index 019fca099..57b6e4718 100644 --- a/src/app/ui/skin/skin_theme.cpp +++ b/src/app/ui/skin/skin_theme.cpp @@ -1315,21 +1315,22 @@ void SkinTheme::paintSlider(PaintEvent& ev) g->fillRect(BGCOLOR, rc); // Draw thumb - g->drawRgbaSurface(thumb, x-thumb->width()/2, rc.y); + int thumb_y = rc.y; + if (rc.h > thumb->height()*3) + rc.shrink(Border(0, thumb->height(), 0, 0)); // Draw borders - rc.shrink(Border( - 3 * guiscale(), - thumb->height(), - 3 * guiscale(), - 1 * guiscale())); - - drawRect(g, rc, nw.get(), gfx::ColorNone); + if (rc.h > 4*guiscale()) { + rc.shrink(Border(3, 0, 3, 1) * guiscale()); + drawRect(g, rc, nw.get(), gfx::ColorNone); + } // Draw background (using the customized ISliderBgPainter implementation) rc.shrink(Border(1, 1, 1, 2) * guiscale()); if (!rc.isEmpty()) bgPainter->paint(widget, g, rc); + + g->drawRgbaSurface(thumb, x-thumb->width()/2, thumb_y); } else { // Draw borders