From 8c1ff10694627c362b2b075fd33d94edee1f5c4d Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Tue, 31 Mar 2009 14:10:46 +0000 Subject: [PATCH] Cleanup ruler painting svn path=/trunk/kdenlive/; revision=3194 --- src/customruler.cpp | 7 +++++-- src/customruler.h | 2 ++ src/smallruler.cpp | 3 ++- src/smallruler.h | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/customruler.cpp b/src/customruler.cpp index 18a31922..68cdf01b 100644 --- a/src/customruler.cpp +++ b/src/customruler.cpp @@ -56,6 +56,8 @@ CustomRuler::CustomRuler(Timecode tc, CustomTrackView *parent) : QWidget(parent), m_timecode(tc), m_view(parent), m_duration(0), m_offset(0) { setFont(KGlobalSettings::toolBarFont()); m_scale = 3; + m_bgColor = QColor(245, 245, 245); + m_zoneColor = QColor(133, 255, 143); littleMarkDistance = FRAME_SIZE; mediumMarkDistance = FRAME_SIZE * m_timecode.fps(); bigMarkDistance = FRAME_SIZE * m_timecode.fps() * 60; @@ -223,12 +225,13 @@ void CustomRuler::paintEvent(QPaintEvent *e) { p.setClipRect(e->rect()); const int projectEnd = (int)(m_duration * m_factor); - p.fillRect(QRect(0, 0, projectEnd - m_offset, height()), QBrush(QColor(245, 245, 245))); + p.fillRect(0, 0, projectEnd - m_offset, height(), m_bgColor); const int zoneStart = (int)(m_zoneStart * m_factor); const int zoneEnd = (int)(m_zoneEnd * m_factor); + const QRect zoneRect(); - p.fillRect(QRect(zoneStart - offset(), height() / 2, zoneEnd - zoneStart, height() / 2), QBrush(QColor(133, 255, 143))); + p.fillRect(zoneStart - offset(), height() / 2, zoneEnd - zoneStart, height() / 2, m_zoneColor); const int value = m_view->cursorPos() * m_factor - offset(); int minval = (e->rect().left() + m_offset) / FRAME_SIZE - 1; diff --git a/src/customruler.h b/src/customruler.h index f84fdb56..3073ae40 100644 --- a/src/customruler.h +++ b/src/customruler.h @@ -53,6 +53,8 @@ private: int m_zoneStart; int m_zoneEnd; int m_duration; + QColor m_bgColor; + QColor m_zoneColor; double m_textSpacing; double m_factor; double m_scale; diff --git a/src/smallruler.cpp b/src/smallruler.cpp index a07d1755..b75dd03f 100644 --- a/src/smallruler.cpp +++ b/src/smallruler.cpp @@ -29,6 +29,7 @@ SmallRuler::SmallRuler(QWidget *parent) : QWidget(parent), m_scale(1), m_maxval(25) { m_zoneStart = 10; m_zoneEnd = 60; + m_zoneColor = QColor(133, 255, 143); } void SmallRuler::adjustScale(int maximum) { @@ -124,7 +125,7 @@ void SmallRuler::paintEvent(QPaintEvent *e) { const int zoneStart = (int)(m_zoneStart * m_scale); const int zoneEnd = (int)(m_zoneEnd * m_scale); - p.fillRect(QRect(zoneStart, height() / 2, zoneEnd - zoneStart, height() / 2), QBrush(QColor(133, 255, 143))); + p.fillRect(zoneStart, height() / 2, zoneEnd - zoneStart, height() / 2, m_zoneColor); if (r.top() < 9) { // draw the little marks diff --git a/src/smallruler.h b/src/smallruler.h index cee54b2e..9d5d07d0 100644 --- a/src/smallruler.h +++ b/src/smallruler.h @@ -47,6 +47,7 @@ private: int m_maxval; int m_zoneStart; int m_zoneEnd; + QColor m_zoneColor; public slots: void slotNewValue(int value); -- 2.39.2