summaryrefslogtreecommitdiff
path: root/plugingui/slider.cc
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2017-04-16 17:34:30 +0200
committerAndré Nusser <andre.nusser@googlemail.com>2017-04-16 17:34:30 +0200
commitb4ad2a3b4eb808081fccef26482508db552a914e (patch)
tree3742e34b832cd5c8062a1cce5d80cf13472ae8f1 /plugingui/slider.cc
parent730597ff95d5dcfa924bc0bb951c02873ccffa8c (diff)
Style fixes in slider.h/slider.cc
Diffstat (limited to 'plugingui/slider.cc')
-rw-r--r--plugingui/slider.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/plugingui/slider.cc b/plugingui/slider.cc
index 439e104..78877b2 100644
--- a/plugingui/slider.cc
+++ b/plugingui/slider.cc
@@ -62,14 +62,15 @@ void Slider::repaintEvent(RepaintEvent* repaintEvent)
auto inner_offset = (current_value / maximum) * getControlWidth();
auto button_x = button_offset + inner_offset - (button.width() / 2);
- auto button_y = (height() - button.height())/2;
+ auto button_y = (height() - button.height()) / 2;
// draw bar
bar.setSize(width(), height());
p.drawImage(0, 0, bar);
// draw inner bar
- inner_bar_green.setSize(button_x - bar_boundary, height() - 2*bar_boundary);
+ inner_bar_green.setSize(
+ button_x - bar_boundary, height() - 2 * bar_boundary);
p.drawImage(bar_boundary, bar_boundary, inner_bar_green);
// draw button
@@ -146,22 +147,24 @@ void Slider::mouseMoveEvent(MouseMoveEvent* mouseMoveEvent)
std::size_t Slider::getControlWidth() const
{
- if (width() < 2*button_offset) {
+ if(width() < 2 * button_offset)
+ {
return 0;
}
- return width() - 2*button_offset;
+ return width() - 2 * button_offset;
}
void Slider::recomputeCurrentValue(float x)
{
- if (x < button_offset) {
+ if(x < button_offset)
+ {
current_value = 0;
}
- else {
+ else
+ {
current_value = (maximum / getControlWidth()) * (x - button_offset);
}
-
}
} // GUI::