diff options
author | Tim E. Real <termtech@rogers.com> | 2011-04-14 23:13:03 +0000 |
---|---|---|
committer | Tim E. Real <termtech@rogers.com> | 2011-04-14 23:13:03 +0000 |
commit | 8acbc05a692368347cffa794d047dc4839ad6b78 (patch) | |
tree | 746224e249a57b11ff4cbbce8726a407693bdcd8 /muse2 | |
parent | 1d3741efd41bdcde88f05b210ebae218acc6967d (diff) |
Fix arranger midi part event 'sliver' drawing. Fix partname drawing.
Remove dssi gui killtimers causing error.
Diffstat (limited to 'muse2')
-rw-r--r-- | muse2/ChangeLog | 7 | ||||
-rw-r--r-- | muse2/muse/arranger/pcanvas.cpp | 47 | ||||
-rw-r--r-- | muse2/muse/arranger/pcanvas.h | 5 | ||||
-rw-r--r-- | muse2/muse/osc.cpp | 19 |
4 files changed, 62 insertions, 16 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 92b25883..b3e18e71 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,10 @@ +14.04.2011: + - Fixed notes 'sliver' drawing in arranger midi parts. Invert if too dark. (Tim) + - Gave arranger part name text drawing a shadow to help contrast with drawn events. + Also moved part name text out of the way, to top of part. + - Removed DSSI gui QProcess kill timers. In Qt4 they can only be used that way with threads started with QThread. + Kill is not nice anyway. On terminate, gui may prompt user to save work etc. App should check at close + if all these guis closed and ask to abort closing, or kill the guis, or leave them alone. 12.04.2011: - Another fix for FLAM GUI controls - 300ms delay before sending control values in PluginI::oscUpdate(). (Tim) Good enough? How to make sure (any) gui is really ready? diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index 5747726f..4fc0c3dd 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -1593,7 +1593,7 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) drawWavePart(p, rect, wp, r); else if (mp) { - drawMidiPart(p, rect, mp->events(),(MidiTrack*)part->track(), r, mp->tick(), from, to); + drawMidiPart(p, rect, mp->events(), (MidiTrack*)part->track(), mp, r, mp->tick(), from, to); } if (config.canvasShowPartType & 1) { // show names @@ -1602,16 +1602,27 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) int part_r, part_g, part_b, brightness; config.partColors[i].getRgb(&part_r, &part_g, &part_b); brightness = part_r*29 + part_g*59 + part_b*12; - if (brightness < 12000 || part->selected()) - p.setPen(Qt::white); /* too dark: use white for text color */ - else - p.setPen(Qt::black); /* otherwise use black */ + //if (brightness < 12000 || part->selected()) + // p.setPen(Qt::white); /* too dark: use white for text color */ + //else + // p.setPen(Qt::black); /* otherwise use black */ + bool rev = brightness < 12000 || part->selected(); QRect rr = map(r); rr.setX(rr.x() + 3); p.save(); p.setFont(config.fonts[1]); p.setWorldMatrixEnabled(false); - p.drawText(rr, Qt::AlignVCenter|Qt::AlignLeft, part->name()); + if (rev) + p.setPen(Qt::black); + else + p.setPen(Qt::white); + p.drawText(rr, Qt::AlignTop|Qt::AlignLeft, part->name()); + rr.translate(1,1); + if (rev) + p.setPen(Qt::white); + else + p.setPen(Qt::black); + p.drawText(rr, Qt::AlignTop|Qt::AlignLeft, part->name()); p.restore(); } } @@ -1649,14 +1660,30 @@ void PartCanvas::drawMoving(QPainter& p, const CItem* item, const QRect&) // pr - part rectangle //--------------------------------------------------------- -void PartCanvas::drawMidiPart(QPainter& p, const QRect& bb, EventList* events, MidiTrack *mt, const QRect& r, int pTick, int from, int to) +void PartCanvas::drawMidiPart(QPainter& p, const QRect& bb, EventList* events, MidiTrack *mt, MidiPart *pt, const QRect& r, int pTick, int from, int to) { //printf("x=%d y=%d h=%d w=%d\n",r.x(),r.y(),r.height(),r.width()); + + if(pt) + { + int part_r, part_g, part_b, brightness; + config.partColors[pt->colorIndex()].getRgb(&part_r, &part_g, &part_b); + brightness = part_r*29 + part_g*59 + part_b*12; + if (brightness < 12000 || pt->selected()) + //p.setPen(Qt::white); // too dark: use white for color + p.setPen(QColor(192,192,192)); // too dark: use lighter color + else + //p.setPen(Qt::black); // otherwise use black + p.setPen(QColor(64,64,64)); // otherwise use dark color + } + else + p.setPen(QColor(80,80,80)); + if (config.canvasShowPartType & 2) { // show events // Do not allow this, causes segfault. if(from <= to) { - p.setPen(QColor(80,80,80)); + //p.setPen(QColor(80,80,80)); //EventList* events = mp->events(); iEvent ito(events->lower_bound(to)); @@ -1678,7 +1705,7 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect& bb, EventList* events, M } } else { // show Cakewalk Style - p.setPen(QColor(80,80,80)); + //p.setPen(QColor(80,80,80)); //EventList* events = mp->events(); iEvent ito(events->lower_bound(to)); //printf("PartCanvas::drawItem pTick:%d from:%d to:%d\n", pTick, from, to); @@ -3047,7 +3074,7 @@ void PartCanvas::drawTopItem(QPainter& p, const QRect& rect) } } } - drawMidiPart(p, rect, &myEventList, mt, partRect,startPos,0,song->cpos()-startPos); + drawMidiPart(p, rect, &myEventList, mt, 0, partRect,startPos,0,song->cpos()-startPos); } yPos+=track->height(); } diff --git a/muse2/muse/arranger/pcanvas.h b/muse2/muse/arranger/pcanvas.h index d3e835b0..a3dd7900 100644 --- a/muse2/muse/arranger/pcanvas.h +++ b/muse2/muse/arranger/pcanvas.h @@ -84,8 +84,6 @@ class PartCanvas : public Canvas { virtual int pitch2y(int p) const; virtual void moveCanvasItems(CItemList&, int, int, DragType, int*); - // Changed by T356. - //virtual bool moveItem(CItem*, const QPoint&, DragType, int*); virtual bool moveItem(CItem*, const QPoint&, DragType); virtual CItem* newItem(const QPoint&, int); virtual void resizeItem(CItem*,bool); @@ -112,7 +110,8 @@ class PartCanvas : public Canvas { void movePartsTotheRight(unsigned int startTick, int length); //Part* readClone(Xml&, Track*, bool toTrack = true); void drawWavePart(QPainter&, const QRect&, WavePart*, const QRect&); - void drawMidiPart(QPainter&, const QRect& rect, EventList* events, MidiTrack *mt, const QRect& r, int pTick, int from, int to); + //void drawMidiPart(QPainter&, const QRect& rect, EventList* events, MidiTrack*mt, const QRect& r, int pTick, int from, int to); + void drawMidiPart(QPainter&, const QRect& rect, EventList* events, MidiTrack*mt, MidiPart*pt, const QRect& r, int pTick, int from, int to); Track* y2Track(int) const; void drawAudioTrack(QPainter& p, const QRect& r, AudioTrack* track); void drawAutomation(QPainter& p, const QRect& r, AudioTrack* track); diff --git a/muse2/muse/osc.cpp b/muse2/muse/osc.cpp index 2b567856..66242e17 100644 --- a/muse2/muse/osc.cpp +++ b/muse2/muse/osc.cpp @@ -504,7 +504,13 @@ OscIF::~OscIF() // process needs to do all its cleanup: use a higher value if the process is likely to do a lot of // computation or I/O on cleanup." _oscGuiQProc->terminate(); - QTimer::singleShot( 5000, _oscGuiQProc, SLOT( kill() ) ); + // FIXME: In Qt4 this can only be used with threads started with QThread. + // Kill is bad anyway, app should check at close if all these guis closed or not + // and ask user if they really want to close, possibly with kill. + // Terminate might not terminate the thread. It is given a chance to prompt for saving etc. + // so kill is not desirable. + // We could wait until terminate finished but don't think that's good here. + ///QTimer::singleShot( 5000, _oscGuiQProc, SLOT( kill() ) ); } //delete _oscGuiQProc; } @@ -710,7 +716,13 @@ int OscIF::oscExiting(lo_arg**) // process needs to do all its cleanup: use a higher value if the process is likely to do a lot of // computation or I/O on cleanup." _oscGuiQProc->terminate(); - QTimer::singleShot( 5000, _oscGuiQProc, SLOT( kill() ) ); + // FIXME: In Qt4 this can only be used with threads started with QThread. + // Kill is bad anyway, app should check at close if all these guis closed or not + // and ask user if they really want to close, possibly with kill. + // Terminate might not terminate the thread. It is given a chance to prompt for saving etc. + // so kill is not desirable. + // We could wait until terminate finished but don't think that's good here. + ///QTimer::singleShot( 5000, _oscGuiQProc, SLOT( kill() ) ); } //delete _oscGuiQProc; } @@ -928,7 +940,8 @@ bool OscIF::oscInitGui(const QString& typ, const QString& baseName, const QStrin //{ // No QProcess created yet? Do it now. Only once per SynthIF instance. Exists until parent destroyed. if(_oscGuiQProc == 0) - _oscGuiQProc = new QProcess(muse); + //_oscGuiQProc = new QProcess(muse); + _oscGuiQProc = new QProcess(); //QString program(fi.filePath()); QString program(guiPath); |