From 93ea371c955c961051b5c2e2d7b47881aec04c84 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Mon, 16 May 2011 14:21:16 +0000 Subject: - changed appeareance settings to be able to choose between "y-stretch" and "no y-stretch" in cakewalk mode - when changing Midi to Drum or Drum to Midi in tlist, now a songChanged() gets emitted (fixes bug: slivers were not redrawn when changing that) --- muse2/muse/appearance.cpp | 5 +-- muse2/muse/arranger/pcanvas.cpp | 60 +++++++++++++++++++++--------------- muse2/muse/arranger/tlist.cpp | 3 +- muse2/muse/widgets/appearancebase.ui | 54 +++++++++++++++++++++++++++++++- 4 files changed, 94 insertions(+), 28 deletions(-) (limited to 'muse2') diff --git a/muse2/muse/appearance.cpp b/muse2/muse/appearance.cpp index df81e3b1..e326e868 100644 --- a/muse2/muse/appearance.cpp +++ b/muse2/muse/appearance.cpp @@ -474,6 +474,7 @@ void Appearance::resetValues() partShownames->setChecked(config->canvasShowPartType & 1); partShowevents->setChecked(config->canvasShowPartType & 2); partShowCakes->setChecked(!(config->canvasShowPartType & 2)); + partCakeStretch->setChecked(config->canvasShowPartType & 4); eventNoteon->setChecked(config->canvasShowPartEvent & (1 << 0)); eventPolypressure->setChecked(config->canvasShowPartEvent & (1 << 1)); @@ -598,8 +599,8 @@ void Appearance::apply() showPartType |= 1; if (partShowevents->isChecked()) showPartType |= 2; - //if (partShowCakes->isChecked()) - // showPartType |= 4; + if (partCakeStretch->isChecked()) + showPartType |= 4; config->canvasShowPartType = showPartType; diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index 9ad7bf3c..a37e237e 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -1721,42 +1721,54 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi int highest_pitch=0; map y_mapper; - for (iEvent i = events->begin(); i != ito; ++i) + if (config.canvasShowPartType & 4) //y-stretch? { - if (i->second.type()==Note) + for (iEvent i = events->begin(); i != ito; ++i) { - int pitch=i->second.pitch(); - - if (!isdrum) + if (i->second.type()==Note) { - if (pitch > highest_pitch) highest_pitch=pitch; - if (pitch < lowest_pitch) lowest_pitch=pitch; + int pitch=i->second.pitch(); + + if (!isdrum) + { + if (pitch > highest_pitch) highest_pitch=pitch; + if (pitch < lowest_pitch) lowest_pitch=pitch; + } + else + { + y_mapper.insert(pair(pitch, 0)); + } } - else + } + + if (isdrum) + { + int cnt=0; + for (map::iterator it=y_mapper.begin(); it!=y_mapper.end(); it++) { - y_mapper.insert(pair(pitch, 0)); + it->second=cnt; + cnt++; } + lowest_pitch=0; + highest_pitch=cnt-1; } - } - - if (isdrum) - { - int cnt=0; - for (map::iterator it=y_mapper.begin(); it!=y_mapper.end(); it++) + + if (lowest_pitch==highest_pitch) { - it->second=cnt; - cnt++; + lowest_pitch--; + highest_pitch++; } - lowest_pitch=0; - highest_pitch=cnt-1; } - - if (lowest_pitch==highest_pitch) + else { - lowest_pitch--; - highest_pitch++; - } + lowest_pitch=0; + highest_pitch=127; + if (isdrum) + for (int cnt=0;cnt<127;cnt++) + y_mapper[cnt]=cnt; + } + for (iEvent i = events->begin(); i != ito; ++i) { int t = i->first + pTick; int te = t + i->second.lenTick(); diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index 2a397a4e..4b531607 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -1660,6 +1660,7 @@ void TList::classesPopupMenu(Track* t, int x, int y) } t->setType(Track::MIDI); audio->msgIdle(false); + song->update(SC_EVENT_MODIFIED); } else if (Track::TrackType(n) == Track::DRUM && t->type() == Track::MIDI) { // @@ -1716,8 +1717,8 @@ void TList::classesPopupMenu(Track* t, int x, int y) // Add all port controller events. //audio->msgChangeAllPortDrumCtrlEvents(true); song->changeAllPortDrumCtrlEvents(true); - audio->msgIdle(false); + song->update(SC_EVENT_MODIFIED); } } diff --git a/muse2/muse/widgets/appearancebase.ui b/muse2/muse/widgets/appearancebase.ui index 8cb8c08c..a3a80a96 100644 --- a/muse2/muse/widgets/appearancebase.ui +++ b/muse2/muse/widgets/appearancebase.ui @@ -6,7 +6,7 @@ 0 0 - 538 + 558 531 @@ -69,6 +69,39 @@ + + + + + + Qt::Horizontal + + + QSizePolicy::Maximum + + + + 30 + 20 + + + + + + + + false + + + y-stretch + + + false + + + + + @@ -156,6 +189,9 @@ false + + false + 1 @@ -1936,5 +1972,21 @@ + + partShowCakes + toggled(bool) + partCakeStretch + setEnabled(bool) + + + 141 + 137 + + + 159 + 164 + + + -- cgit v1.2.3