summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2010-02-04 18:32:04 +0000
committerRobert Jonsson <spamatica@gmail.com>2010-02-04 18:32:04 +0000
commit4cdcffed8c4ea184ff3ed6bbdec668782712fa65 (patch)
tree1430bfe14e0d3fdf2837a65c3aa5a7eb06fcdd86
parent54684f77a4455c49877e8b0f7c64c13a61de64f2 (diff)
improved grid
-rw-r--r--muse/ChangeLog2
-rw-r--r--muse/muse/arranger/pcanvas.cpp89
2 files changed, 50 insertions, 41 deletions
diff --git a/muse/ChangeLog b/muse/ChangeLog
index 5cf866d1..f0831447 100644
--- a/muse/ChangeLog
+++ b/muse/ChangeLog
@@ -1,3 +1,5 @@
+04.02.2010
+ * Improved: Grid handling in arranger improved, it should now be actually usable (rj)
01.02.2010
* Fixed: Jack midi output: Stuck or missing notes. (T356)
- Must only be one jack_midi_event_reserve() per event in handle_jack_midi_out_events().
diff --git a/muse/muse/arranger/pcanvas.cpp b/muse/muse/arranger/pcanvas.cpp
index 5a702713..a6994601 100644
--- a/muse/muse/arranger/pcanvas.cpp
+++ b/muse/muse/arranger/pcanvas.cpp
@@ -11,6 +11,7 @@
#include <errno.h>
#include <values.h>
#include <uuid/uuid.h>
+#include <math.h>
#include <qapplication.h>
#include <qclipboard.h>
@@ -2540,9 +2541,50 @@ void PartCanvas::drawCanvas(QPainter& p, const QRect& rect)
//////////
// GRID //
//////////
+ QColor baseColor(config.partCanvasBg.light(110));
+ p.setPen(baseColor);
- p.setPen(lightGray);
+ //--------------------------------
+ // vertical lines
+ //-------------------------------
+ printf("raster=%d\n", *_raster);
+ if (config.canvasShowGrid) {
+ int bar, beat;
+ unsigned tick;
+ switch (*_raster) {
+ case 0: // measure
+ sigmap.tickValues(x, &bar, &beat, &tick);
+ for (;;) {
+ int xt = sigmap.bar2tick(bar++, 0, 0);
+ if (xt >= x + w)
+ break;
+ if (!((bar-1) % 4))
+ p.setPen(baseColor.dark(130));
+ else
+ p.setPen(baseColor);
+ p.drawLine(xt, y, xt, y+h);
+ }
+ break;
+ case 1: // no raster
+ break;
+ case 768: // 1/2
+ case 384: // 1/4
+ case 192: // 1/8
+ case 96: // 1/16
+ {
+ int r = *_raster;
+ int rr = rmapx(r);
+ while (rr < 4) {
+ r *= 2;
+ rr = rmapx(r);
+ }
+ for (int xt = x; xt < (x + w); xt += r)
+ p.drawLine(xt, y, xt+1, y+h);
+ }
+ break;
+ }
+ }
//--------------------------------
// horizontal lines
//--------------------------------
@@ -2553,53 +2595,18 @@ void PartCanvas::drawCanvas(QPainter& p, const QRect& rect)
if (yy > y + h)
break;
Track* track = *it;
- if (config.canvasShowGrid || !track->isMidiTrack())
+ if (/*config.canvasShowGrid ||*/ !track->isMidiTrack()) {
+ p.setPen(baseColor.dark(130));
p.drawLine(x, yy, x + w, yy);
+ p.setPen(baseColor);
+ }
if (!track->isMidiTrack() && (track->type() != Track::WAVE)) {
QRect r = rect & QRect(x, yy, w, track->height());
drawAudioTrack(p, r, (AudioTrack*)track);
+ p.setPen(baseColor);
}
yy += track->height();
}
-
- if (!config.canvasShowGrid)
- return;
-
- //--------------------------------
- // vertical lines
- //--------------------------------
-
- int bar, beat;
- unsigned tick;
- switch (*_raster) {
- case 0: // measure
- sigmap.tickValues(x, &bar, &beat, &tick);
- for (;;) {
- int xt = sigmap.bar2tick(bar++, 0, 0);
- if (xt >= x + w)
- break;
- p.drawLine(xt, y, xt, y+h);
- }
- break;
- case 1: // no raster
- break;
- case 768: // 1/2
- case 384: // 1/4
- case 192: // 1/8
- case 96: // 1/16
- {
- int r = *_raster;
- int rr = rmapx(r);
- while (rr < 4) {
- r *= 2;
- rr = rmapx(r);
- }
-
- for (int xt = x; xt < (x + w); xt += r)
- p.drawLine(xt, y, xt+1, y+h);
- }
- break;
- }
}
//---------------------------------------------------------