X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/6db80bf969c97136e1d83db775b6f6cb68b2a614..fb9f72903bf23e2b9a63e882398c12dbb6d495f0:/lib/gui/epositiongauge.cpp diff --git a/lib/gui/epositiongauge.cpp b/lib/gui/epositiongauge.cpp index 75b592d2..4785d7af 100644 --- a/lib/gui/epositiongauge.cpp +++ b/lib/gui/epositiongauge.cpp @@ -5,19 +5,24 @@ ePositionGauge::ePositionGauge(eWidget *parent) : eWidget(parent) { m_point_widget = new ePixmap(this); + m_seek_point_widget = new ePixmap(this); + m_seek_point_widget->hide(); m_point_widget->setAlphatest(1); + m_seek_point_widget->setAlphatest(1); m_position = 0; m_length = 0; + m_have_foreground_color = 0; + m_seek_position = 0; } ePositionGauge::~ePositionGauge() { delete m_point_widget; + delete m_seek_point_widget; } void ePositionGauge::setLength(const pts_t &len) { - eDebug("set len: %llx", len); if (m_length == len) return; m_length = len; @@ -27,7 +32,6 @@ void ePositionGauge::setLength(const pts_t &len) void ePositionGauge::setPosition(const pts_t &pos) { - eDebug("set position: %llx", pos); if (m_position == pos) return; m_position = pos; @@ -39,15 +43,28 @@ void ePositionGauge::setInColor(const gRGB &color) invalidate(); } -void ePositionGauge::setPointer(gPixmap *pixmap, const ePoint ¢er) +void ePositionGauge::setPointer(int which, ePtr &pixmap, const ePoint ¢er) { - m_point_center = center; - m_point_widget->setPixmap(pixmap); - m_point_widget->resize(pixmap->size()); + setPointer(which, pixmap.operator->(), center); +} + +void ePositionGauge::setPointer(int which, gPixmap *pixmap, const ePoint ¢er) +{ + if (which == 0) + { + m_point_center = center; + m_point_widget->setPixmap(pixmap); + m_point_widget->resize(pixmap->size()); + } else + { + m_seek_point_center = center; + m_seek_point_widget->setPixmap(pixmap); + m_seek_point_widget->resize(pixmap->size()); + } updatePosition(); } -void ePositionGauge::setInOutList(PyObject *list) +void ePositionGauge::setInOutList(ePyObject list) { if (!PyList_Check(list)) return; @@ -58,14 +75,14 @@ void ePositionGauge::setInOutList(PyObject *list) for (i=0; ipaintBackground(painter, ePoint(0,0), s); + + eWidget::event(evtPaint, data, data2); + style->setStyle(painter, eWindowStyle::styleLabel); // TODO - own style // painter.fill(eRect(0, 10, s.width(), s.height()-20)); @@ -117,18 +136,26 @@ int ePositionGauge::event(int event, void *data, void *data2) } } - painter.setForegroundColor(gRGB(0x225b7395)); - int xi = scale(in), xo = scale(out); - painter.fill(eRect(xi, 10, xo-xi, s.height()-14)); + if (m_have_foreground_color) + { + painter.setForegroundColor(gRGB(m_foreground_color)); + int xi = scale(in), xo = scale(out); + painter.fill(eRect(xi, 10, xo-xi, s.height()-14)); + } + in = m_length; if (i == m_cue_entries.end()) break; } // painter.setForegroundColor(gRGB(0x00000000)); - painter.setForegroundColor(gRGB(0x225b7395)); - painter.fill(eRect(s.width() - 2, 2, s.width() - 1, s.height() - 4)); - painter.fill(eRect(0, 2, 2, s.height() - 4)); + + if (m_have_foreground_color) + { + painter.setForegroundColor(gRGB(0x225b7395)); + painter.fill(eRect(s.width() - 2, 2, s.width() - 1, s.height() - 4)); + painter.fill(eRect(0, 2, 2, s.height() - 4)); + } #if 0 // border @@ -152,9 +179,11 @@ int ePositionGauge::event(int event, void *data, void *data2) void ePositionGauge::updatePosition() { m_pos = scale(m_position); + m_seek_pos = scale(m_seek_position); int base = (size().height() - 10) / 2; m_point_widget->move(ePoint(m_pos - m_point_center.x(), base - m_point_center.y())); + m_seek_point_widget->move(ePoint(m_seek_pos - m_seek_point_center.x(), base - m_seek_point_center.y())); } int ePositionGauge::scale(const pts_t &val) @@ -166,3 +195,29 @@ int ePositionGauge::scale(const pts_t &val) return width * val / m_length; } + +void ePositionGauge::setForegroundColor(const gRGB &col) +{ + if ((!m_have_foreground_color) || !(m_foreground_color == col)) + { + m_foreground_color = col; + m_have_foreground_color = 1; + invalidate(); + } +} + +void ePositionGauge::enableSeekPointer(int enable) +{ + if (enable) + m_seek_point_widget->show(); + else + m_seek_point_widget->hide(); +} + +void ePositionGauge::setSeekPosition(const pts_t &pos) +{ + if (m_seek_position == pos) + return; + m_seek_position = pos; + updatePosition(); +}