diff options
author | Robert Jonsson <spamatica@gmail.com> | 2010-04-19 21:56:26 +0000 |
---|---|---|
committer | Robert Jonsson <spamatica@gmail.com> | 2010-04-19 21:56:26 +0000 |
commit | 087b94d11f3319adb1d9514d60961e3688385e3d (patch) | |
tree | 98eb7300117e876b37ca0acc334f2c47c30c5c7c | |
parent | a1a81592d302a831beff371f0422fc1c609ffcc0 (diff) |
grid fix
-rw-r--r-- | muse/ChangeLog | 1 | ||||
-rw-r--r-- | muse/muse/arranger/pcanvas.cpp | 62 |
2 files changed, 34 insertions, 29 deletions
diff --git a/muse/ChangeLog b/muse/ChangeLog index 83580e6f..270ee100 100644 --- a/muse/ChangeLog +++ b/muse/ChangeLog @@ -1,5 +1,6 @@ 19.04.2010 * Patch: Fix for libdir bug causing synths to not be available on some 64bit systems. By Orcan Ogetbil (rj) + * Fixed: Drawing of grid when snaping to less than measure (rj) 12.04.2010 * Fixed: LADSPA rack effects: Do not display LADSPA output controls (such as latency). (T356) * Fixed: Bug when cancelling 'save as' operation, says 'file exists'. Caused by my earlier compressed save fixes. (T356) diff --git a/muse/muse/arranger/pcanvas.cpp b/muse/muse/arranger/pcanvas.cpp index 080bf9bf..cd89cee2 100644 --- a/muse/muse/arranger/pcanvas.cpp +++ b/muse/muse/arranger/pcanvas.cpp @@ -2539,7 +2539,7 @@ void PartCanvas::drawCanvas(QPainter& p, const QRect& rect) ////////// // GRID // ////////// - QColor baseColor(config.partCanvasBg.light(110)); + QColor baseColor(config.partCanvasBg.light(104)); p.setPen(baseColor); //-------------------------------- @@ -2549,38 +2549,42 @@ void PartCanvas::drawCanvas(QPainter& p, const QRect& rect) 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; + + 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(115)); + else + p.setPen(baseColor); + p.drawLine(xt, y, xt, y+h); + + // append + int noDivisors=0; + switch (*_raster) { case 768: // 1/2 + noDivisors=2; break; case 384: // 1/4 + noDivisors=4; break; case 192: // 1/8 + noDivisors=8; break; 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; + noDivisors=16; break; + } + int r = *_raster; + int rr = rmapx(r); + if (*_raster > 1) { + while (rr < 4) { + r *= 2; + rr = rmapx(r); + noDivisors=noDivisors/2; + } + p.setPen(baseColor); + for (int t=1;t< noDivisors;t++) + p.drawLine(xt+r*t, y, xt+r*t, y+h); + } } } //-------------------------------- |