~ubuntu-branches/ubuntu/saucy/muse/saucy

« back to all changes in this revision

Viewing changes to muse/arranger/pcanvas.cpp

  • Committer: Package Import Robot
  • Author(s): Alessio Treglia
  • Date: 2013-01-07 10:27:14 UTC
  • mfrom: (1.1.14)
  • Revision ID: package-import@ubuntu.com-20130107102714-fajkwjbz02aqupbh
Tags: 2.1-1
* New upstream release.
* Refresh 1001-buildsystem.patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3564
3564
      {
3565
3565
        //p.restore();
3566
3566
        return;
3567
 
      }  
 
3567
      }
 
3568
 
3568
3569
      int xpixel = oldX;
3569
3570
      int oldY = -1;
3570
3571
      int ypixel = oldY;
3575
3576
      QPen pen2(cl->color(), 2);  
3576
3577
      pen2.setCosmetic(true);
3577
3578
 
3578
 
      // First check that there ARE automation, ic == cl->end means no automation
3579
 
      if (ic == cl->end()) 
3580
 
      {
3581
 
        double y;   
3582
 
        if (cl->valueType() == MusECore::VAL_LOG ) { // use db scale for volume
3583
 
          y = logToVal(cl->curVal(), min, max); // represent volume between 0 and 1
3584
 
          if (y < 0) y = 0.0;
3585
 
        }
3586
 
        else 
3587
 
          y = (cl->curVal() - min)/(max-min);  // we need to set curVal between 0 and 1
3588
 
        ypixel = oldY = bottom - rmapy_f(y) * height;
 
3579
      // Store first value for later
 
3580
      double yfirst;
 
3581
      {
 
3582
          if (cl->valueType() == MusECore::VAL_LOG ) { // use db scale for volume
 
3583
            yfirst = logToVal(cl->curVal(), min, max); // represent volume between 0 and 1
 
3584
            if (yfirst < 0) yfirst = 0.0;
 
3585
          }
 
3586
          else {
 
3587
            yfirst = (cl->curVal() - min)/(max-min);  // we need to set curVal between 0 and 1
 
3588
          }
 
3589
          yfirst = oldY = bottom - rmapy_f(yfirst) * height;
 
3590
      }
 
3591
 
 
3592
      // Check that there IS automation, ic == cl->end means no automation
 
3593
      if (ic == cl->end())
 
3594
      {
 
3595
          ypixel = yfirst;
3589
3596
      }
3590
3597
      else
3591
3598
      {
3592
3599
        for (; ic !=cl->end(); ++ic)
3593
3600
        {
3594
3601
            double y = ic->second.val; 
3595
 
            if (cl->valueType() == MusECore::VAL_LOG ) { // use db scale for volume
 
3602
            if (cl->valueType() == MusECore::VAL_LOG ) {
3596
3603
              y = logToVal(y, min, max); // represent volume between 0 and 1
3597
3604
              if (y < 0) y = 0.0;
3598
3605
            }
3617
3624
              break;
3618
3625
 
3619
3626
            // draw a square around the point
3620
 
            //p.drawRect(mapx(MusEGlobal::tempomap.frame2tick(prevPosFrame))-2, (rr.bottom()-2)-prevVal*height-2, 5, 5);
3621
 
            //p.drawRect(mapx(MusEGlobal::tempomap.frame2tick(prevPosFrame))-1, (rr.bottom()-1)-prevVal*height-2, 3, 3);
3622
3627
            pen2.setColor((automation.currentCtrlValid && automation.currentCtrlList == cl && 
3623
3628
                           automation.currentCtrlFrameList.contains(ic->second.frame)) ?
3624
3629
                          Qt::white : cl->color());  
3637
3642
                    if (cl->valueType() == MusECore::VAL_LOG) {
3638
3643
                        val = MusECore::fast_log10(ic->second.val) * 20.0;
3639
3644
                    }
3640
 
                    p.drawText(textRect, QString("Value: %1").arg(val));
 
3645
                    p.drawText(textRect, QString("Param: %1, Value: %2").arg(cl->name()).arg(val));
3641
3646
            }
3642
3647
        }
3643
3648
      }
 
3649
 
 
3650
      p.setPen(pen1);
 
3651
      //int xTextPos = mapx(0) > rmapx(0) ? mapx(0) + 5 : rmapx(0) + 5; // follow window..(doesn't work very well)
 
3652
      int xTextPos = mapx(0) + 5;
 
3653
      p.drawText(xTextPos,yfirst,100,height-2,0,cl->name());
 
3654
 
3644
3655
      if (xpixel <= rr.right())
3645
3656
      {
3646
3657
        p.setPen(pen1);