diff options
author | Florian Jung <flo@windfisch.org> | 2011-05-16 14:21:16 +0000 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2011-05-16 14:21:16 +0000 |
commit | 93ea371c955c961051b5c2e2d7b47881aec04c84 (patch) | |
tree | 6d0fd4674330745b3c3845173f9012c67b7f3107 | |
parent | 03e37abb33dfcaa9d67cadbb3b1d3c5ae17b057d (diff) |
- 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)
-rw-r--r-- | muse2/muse/appearance.cpp | 5 | ||||
-rw-r--r-- | muse2/muse/arranger/pcanvas.cpp | 60 | ||||
-rw-r--r-- | muse2/muse/arranger/tlist.cpp | 3 | ||||
-rw-r--r-- | muse2/muse/widgets/appearancebase.ui | 54 |
4 files changed, 94 insertions, 28 deletions
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<int,int> 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<int,int>(pitch, 0)); + } } - else + } + + if (isdrum) + { + int cnt=0; + for (map<int,int>::iterator it=y_mapper.begin(); it!=y_mapper.end(); it++) { - y_mapper.insert(pair<int,int>(pitch, 0)); + it->second=cnt; + cnt++; } + lowest_pitch=0; + highest_pitch=cnt-1; } - } - - if (isdrum) - { - int cnt=0; - for (map<int,int>::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 @@ <rect> <x>0</x> <y>0</y> - <width>538</width> + <width>558</width> <height>531</height> </rect> </property> @@ -69,6 +69,39 @@ </property> </widget> </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Maximum</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>30</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QCheckBox" name="partCakeStretch"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>y-stretch</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </item> </layout> </widget> </item> @@ -156,6 +189,9 @@ <attribute name="headerVisible"> <bool>false</bool> </attribute> + <attribute name="headerVisible"> + <bool>false</bool> + </attribute> <column> <property name="text"> <string notr="true">1</string> @@ -1936,5 +1972,21 @@ </hint> </hints> </connection> + <connection> + <sender>partShowCakes</sender> + <signal>toggled(bool)</signal> + <receiver>partCakeStretch</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>141</x> + <y>137</y> + </hint> + <hint type="destinationlabel"> + <x>159</x> + <y>164</y> + </hint> + </hints> + </connection> </connections> </ui> |