aboutsummaryrefslogtreecommitdiff
path: root/lib/gui/eslider.cpp
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2009-02-11 12:52:48 +0100
committerFelix Domke <tmbinc@elitedvb.net>2009-02-11 12:52:48 +0100
commitbbfcb7ea1f040d030277e2b6f2efa9ea0967bf2b (patch)
treec5945c791698c14723e989449e6b4bfcc275c05d /lib/gui/eslider.cpp
parent4f7990ff2a55874b9eb65e3c9cd47dacb9f76deb (diff)
parent5e6f814d005a01caa437a532e61f4b338617ff67 (diff)
downloadenigma2-bbfcb7ea1f040d030277e2b6f2efa9ea0967bf2b.tar.gz
enigma2-bbfcb7ea1f040d030277e2b6f2efa9ea0967bf2b.zip
Merge branch 'master' of /home/tmbinc/enigma2-git into tmbinc/FixTimingBugs
Conflicts: lib/dvb/decoder.cpp
Diffstat (limited to 'lib/gui/eslider.cpp')
-rw-r--r--lib/gui/eslider.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/gui/eslider.cpp b/lib/gui/eslider.cpp
index dd2aac9e..19097ad4 100644
--- a/lib/gui/eslider.cpp
+++ b/lib/gui/eslider.cpp
@@ -1,7 +1,7 @@
#include <lib/gui/eslider.h>
eSlider::eSlider(eWidget *parent)
- :eWidget(parent), m_have_border_color(false), m_start(0), m_orientation(orHorizontal), m_border_width(0)
+ :eWidget(parent), m_have_border_color(false), m_start(0), m_orientation(orHorizontal), m_orientation_swapped(0), m_border_width(0)
{
}
@@ -70,10 +70,14 @@ int eSlider::event(int event, void *data, void *data2)
if (m_min < m_max)
{
- num_pix = pixsize * (m_value - m_start) / (m_max - m_min);
- start_pix = pixsize * m_start / (m_max - m_min);
+ int val_range = m_max - m_min;
+ num_pix = (pixsize * (m_value - m_start) + val_range - 1) / val_range; /* properly round up */
+ start_pix = (pixsize * m_start + val_range - 1) / val_range;
+
+ if (m_orientation_swapped)
+ start_pix = pixsize - num_pix - start_pix;
}
-
+
if (start_pix < 0)
{
num_pix += start_pix;
@@ -113,9 +117,10 @@ void eSlider::setStartEnd(int start, int end)
event(evtChangedSlider);
}
-void eSlider::setOrientation(int orientation)
+void eSlider::setOrientation(int orientation, int swapped)
{
m_orientation = orientation;
+ m_orientation_swapped = swapped;
event(evtChangedSlider);
}