- //p.fillRect(e->rect(), QBrush(QColor(200, 200, 200)));
- //kDebug()<<"RULER ZONE: "<<m_zoneStart<<", OFF: "<<offset()<<", END: "<<m_zoneEnd<<", FACTOR: "<<pixelPerMark() * FRAME_SIZE;
- int projectEnd = m_duration * pixelPerMark() * FRAME_SIZE;
- p.fillRect(QRect(- offset(), e->rect().y(), projectEnd, e->rect().height()), QBrush(QColor(245, 245, 245)));
-
-
- int zoneStart = m_zoneStart * pixelPerMark() * FRAME_SIZE;
- int zoneEnd = m_zoneEnd * pixelPerMark() * FRAME_SIZE;
-
- p.fillRect(QRect(zoneStart - offset(), e->rect().y() + e->rect().height() / 2, zoneEnd - zoneStart, e->rect().height() / 2), QBrush(QColor(133, 255, 143)));
-
- int value = m_view->cursorPos() - offset() + 4;
- int minval = minimum();
- int maxval = maximum() + offset() - endOffset();
-
- //ioffsetval = value-offset;
- // pixelpm = (int)ppm;
- // left = clip.left(),
- // right = clip.right();
- double f, fend,
- offsetmin = (double)(minval - offset()),
- offsetmax = (double)(maxval - offset()),
- fontOffset = (((double)minval) > offsetmin) ? (double)minval : offsetmin;
- QRect bg = QRect(offsetmin, 0, offsetmax, height());
-
- QPalette palette;
- //p.fillRect(bg, palette.light());
- // draw labels
- QFont font = p.font();
- font.setPointSize(LABEL_SIZE);
- p.setFont(font);
- p.setPen(palette.dark().color());
- // draw littlemarklabel
-
- // draw mediummarklabel
-
- // draw bigmarklabel
-
- // draw endlabel
- /*if (d->showEndL) {
- if (d->dir == Qt::Horizontal) {
- p.translate( fontOffset, 0 );
- p.drawText( END_LABEL_X, END_LABEL_Y, d->endlabel );
- }*/
-
- // draw the tiny marks
- //if (showTinyMarks())
- /*{
- fend = pixelPerMark()*tinyMarkDistance();
- if (fend > 5) for ( f=offsetmin; f<offsetmax; f+=fend ) {
- p.drawLine((int)f, BASE_MARK_X1, (int)f, BASE_MARK_X2);
- }
- }*/
- if (showLittleMarks()) {
- // draw the little marks
- fend = pixelPerMark() * littleMarkDistance();
- if (fend > 5) for (f = offsetmin; f < offsetmax; f += fend) {
- p.drawLine((int)f, LITTLE_MARK_X1, (int)f, LITTLE_MARK_X2);
- if (fend > 60) {
- QString lab = m_timecode.getTimecodeFromFrames((int)((f - offsetmin) / pixelPerMark() / FRAME_SIZE + 0.5));
- p.drawText((int)f + 2, LABEL_SIZE, lab);
- }
- }
- }
- if (showMediumMarks()) {
- // draw medium marks
- fend = pixelPerMark() * mediumMarkDistance();
- if (fend > 5) for (f = offsetmin; f < offsetmax; f += fend) {
- p.drawLine((int)f, MIDDLE_MARK_X1, (int)f, MIDDLE_MARK_X2);
- if (fend > 60) {
- QString lab = m_timecode.getTimecodeFromFrames((int)((f - offsetmin) / pixelPerMark() / FRAME_SIZE + 0.5));
- p.drawText((int)f + 2, LABEL_SIZE, lab);
- }
- }
- }
- if (showBigMarks()) {
- // draw big marks
- fend = pixelPerMark() * bigMarkDistance();
- if (fend > 5) for (f = offsetmin; f < offsetmax; f += fend) {
- p.drawLine((int)f, BIG_MARK_X1, (int)f, BIG_MARK_X2);
- if (fend > 60) {
- QString lab = m_timecode.getTimecodeFromFrames((int)((f - offsetmin) / pixelPerMark() / FRAME_SIZE + 0.5));
- p.drawText((int)f + 2, LABEL_SIZE, lab);
- } else if (((int)(f - offsetmin)) % ((int)(fend * 5)) == 0) {
- QString lab = m_timecode.getTimecodeFromFrames((int)((f - offsetmin) / pixelPerMark() / FRAME_SIZE + 0.5));
- p.drawText((int)f + 2, LABEL_SIZE, lab);
- }
- }
+ const int zoneStart = (int)(m_zoneStart * m_factor);
+ const int zoneEnd = (int)(m_zoneEnd * m_factor);
+ const QRect zoneRect();
+
+ p.fillRect(zoneStart - m_offset, height() / 2, zoneEnd - zoneStart, height() / 2, m_zoneColor);
+
+ const int value = m_view->cursorPos() * m_factor - m_offset;
+ int minval = (e->rect().left() + m_offset) / FRAME_SIZE - 1;
+ const int maxval = (e->rect().right() + m_offset) / FRAME_SIZE + 1;
+ if (minval < 0) minval = 0;
+
+ double f, fend;
+ const int offsetmax = maxval * FRAME_SIZE;
+
+ p.setPen(palette().dark().color());
+
+ // draw time labels
+ int offsetmin = (e->rect().left() + m_offset) / m_textSpacing;
+ offsetmin = offsetmin * m_textSpacing;
+ for (f = offsetmin; f < offsetmax; f += m_textSpacing) {
+ QString lab = m_timecode.getTimecodeFromFrames((int)(f / m_factor + 0.5));
+ p.drawText(f - m_offset + 2, LABEL_SIZE, lab);