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 /muse2/muse/arranger/pcanvas.cpp | |
| 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)
Diffstat (limited to 'muse2/muse/arranger/pcanvas.cpp')
| -rw-r--r-- | muse2/muse/arranger/pcanvas.cpp | 60 | 
1 files changed, 36 insertions, 24 deletions
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();  | 
