Skip to content

Commit 756cf51

Browse files
committed
- Introducing colored strips on the time ruler headers for loop
and punch recording ranges. (EXPERIMENTAL)
1 parent 27210bd commit 756cf51

File tree

5 files changed

+41
-14
lines changed

5 files changed

+41
-14
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ ChangeLog
66

77
GIT HEAD
88

9+
- Introducing colored strips on the time ruler headers for loop
10+
and punch recording ranges. (EXPERIMENTAL)
11+
912
- Fixed an off-by-one(-pixel) mispositioning of selected events,
1013
while on the MIDI clip editor (aka piano-roll). (EXPERIMENTAL)
1114

src/qtractorMidiEditTime.cpp

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// qtractorMidiEditTime.cpp
22
//
33
/****************************************************************************
4-
Copyright (C) 2005-2023, rncbc aka Rui Nuno Capela. All rights reserved.
4+
Copyright (C) 2005-2024, rncbc aka Rui Nuno Capela. All rights reserved.
55
66
This program is free software; you can redistribute it and/or
77
modify it under the terms of the GNU General Public License
@@ -255,16 +255,19 @@ void qtractorMidiEditTime::updatePixmap ( int cx, int /*cy*/)
255255
if (pSession->isLooping()) {
256256
QPolygon polyg(3);
257257
// h -= 4;
258-
const int d = (h >> 2) + 1;
259-
painter.setPen(Qt::darkCyan);
260-
painter.setBrush(Qt::cyan);
258+
const int d = (h >> 2);
259+
QRect rect(0, h - d, w, h - d);
260+
QColor color = Qt::cyan;
261+
painter.setPen(color.darker());
262+
painter.setBrush(color);
261263
x = pTimeScale->pixelFromFrame(pSession->loopStart()) - dx;
262264
if (x >= 0 && x < w) {
263265
polyg.putPoints(0, 3,
264266
x + d, h - d,
265267
x, h,
266268
x, h - d);
267269
painter.drawPolygon(polyg);
270+
rect.setLeft(x);
268271
}
269272
x = pTimeScale->pixelFromFrame(pSession->loopEnd()) - dx;
270273
if (x >= 0 && x < w) {
@@ -273,23 +276,29 @@ void qtractorMidiEditTime::updatePixmap ( int cx, int /*cy*/)
273276
x, h,
274277
x - d, h - d);
275278
painter.drawPolygon(polyg);
279+
rect.setRight(x);
276280
}
281+
color.setAlpha(60);
282+
painter.fillRect(rect, color);
277283
}
278284

279285
// Draw punch in/out boundaries, if applicable...
280286
if (pSession->isPunching()) {
281287
QPolygon polyg(3);
282288
// h -= 4;
283-
const int d = (h >> 2) + 1;
284-
painter.setPen(Qt::darkMagenta);
285-
painter.setBrush(Qt::magenta);
289+
const int d = (h >> 2);
290+
QRect rect(0, h - d, w, h - d);
291+
QColor color = Qt::magenta;
292+
painter.setPen(color.darker());
293+
painter.setBrush(color);
286294
x = pTimeScale->pixelFromFrame(pSession->punchIn()) - dx;
287295
if (x >= 0 && x < w) {
288296
polyg.putPoints(0, 3,
289297
x + d, h - d,
290298
x, h,
291299
x, h - d);
292300
painter.drawPolygon(polyg);
301+
rect.setLeft(x);
293302
}
294303
x = pTimeScale->pixelFromFrame(pSession->punchOut()) - dx;
295304
if (x >= 0 && x < w) {
@@ -298,7 +307,10 @@ void qtractorMidiEditTime::updatePixmap ( int cx, int /*cy*/)
298307
x, h,
299308
x - d, h - d);
300309
painter.drawPolygon(polyg);
310+
rect.setRight(x);
301311
}
312+
color.setAlpha(60);
313+
painter.fillRect(rect, color);
302314
}
303315
}
304316

src/qtractorMidiEditTime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// qtractorMidiEditTime.h
22
//
33
/****************************************************************************
4-
Copyright (C) 2005-2023, rncbc aka Rui Nuno Capela. All rights reserved.
4+
Copyright (C) 2005-2024, rncbc aka Rui Nuno Capela. All rights reserved.
55
66
This program is free software; you can redistribute it and/or
77
modify it under the terms of the GNU General Public License

src/qtractorTrackTime.cpp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// qtractorTrackTime.cpp
22
//
33
/****************************************************************************
4-
Copyright (C) 2005-2023, rncbc aka Rui Nuno Capela. All rights reserved.
4+
Copyright (C) 2005-2024, rncbc aka Rui Nuno Capela. All rights reserved.
55
66
This program is free software; you can redistribute it and/or
77
modify it under the terms of the GNU General Public License
@@ -189,15 +189,18 @@ void qtractorTrackTime::updatePixmap ( int cx, int /* cy */)
189189
QPolygon polyg(3);
190190
// h -= 4;
191191
const int d = (h >> 2);
192-
painter.setPen(Qt::darkCyan);
193-
painter.setBrush(Qt::cyan);
192+
QRect rect(0, h - d , w, h - d);
193+
QColor color = Qt::cyan;
194+
painter.setPen(color.darker());
195+
painter.setBrush(color);
194196
x = pTimeScale->pixelFromFrame(pSession->loopStart()) - cx;
195197
if (x >= 0 && x < w) {
196198
polyg.putPoints(0, 3,
197199
x + d, h - d,
198200
x, h,
199201
x, h - d);
200202
painter.drawPolygon(polyg);
203+
rect.setLeft(x);
201204
}
202205
x = pTimeScale->pixelFromFrame(pSession->loopEnd()) - cx;
203206
if (x >= 0 && x < w) {
@@ -206,23 +209,29 @@ void qtractorTrackTime::updatePixmap ( int cx, int /* cy */)
206209
x, h,
207210
x - d, h - d);
208211
painter.drawPolygon(polyg);
212+
rect.setRight(x);
209213
}
214+
color.setAlpha(60);
215+
painter.fillRect(rect, color);
210216
}
211217

212218
// Draw punch in/out boundaries, if applicable...
213219
if (pSession->isPunching()) {
214220
QPolygon polyg(3);
215221
// h -= 4;
216222
const int d = (h >> 2);
217-
painter.setPen(Qt::darkMagenta);
218-
painter.setBrush(Qt::magenta);
223+
QRect rect(0, h - d, w, h - d);
224+
QColor color = Qt::magenta;
225+
painter.setPen(color.darker());
226+
painter.setBrush(color);
219227
x = pTimeScale->pixelFromFrame(pSession->punchIn()) - cx;
220228
if (x >= 0 && x < w) {
221229
polyg.putPoints(0, 3,
222230
x + d, h - d,
223231
x, h,
224232
x, h - d);
225233
painter.drawPolygon(polyg);
234+
rect.setLeft(x);
226235
}
227236
x = pTimeScale->pixelFromFrame(pSession->punchOut()) - cx;
228237
if (x >= 0 && x < w) {
@@ -231,7 +240,10 @@ void qtractorTrackTime::updatePixmap ( int cx, int /* cy */)
231240
x, h,
232241
x - d, h - d);
233242
painter.drawPolygon(polyg);
243+
rect.setRight(x);
234244
}
245+
color.setAlpha(60);
246+
painter.fillRect(rect, color);
235247
}
236248
}
237249

src/qtractorTrackTime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// qtractorTrackTime.h
22
//
33
/****************************************************************************
4-
Copyright (C) 2005-2023, rncbc aka Rui Nuno Capela. All rights reserved.
4+
Copyright (C) 2005-2024, rncbc aka Rui Nuno Capela. All rights reserved.
55
66
This program is free software; you can redistribute it and/or
77
modify it under the terms of the GNU General Public License

0 commit comments

Comments
 (0)