~ubuntu-branches/ubuntu/breezy/muse/breezy

« back to all changes in this revision

Viewing changes to widgets/mtscale.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2004-02-07 15:18:22 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040207151822-es27xxkzbcxkebjm
Tags: 0.6.3-1
* New upstream version.
* Added patches:
  + [10_alsa_init_fix] New, from upstream CVS.
    Initialize direction variable when setting Alsa parameters.
  + [10_canvas_translation_fix] New, from upstream CVS.
    Do not translate tooltips twice in canvas popup.
  + [10_checkbox_fix] New, from upstream CVS.
    Use proper set/test methods on metronome checkboxes.
  + [10_html_doc_cleanup] New.
    Fix links and HTML errors in documentation.
  + [20_allow_system_timer] New.
    The new upstream version fails by default if the real-time clock
    could not be accessed (usually the case when not running suid-root).
    This patch reverts the old behaviour of falling back to the more
    inaccurate system timer.
* Updated patches:
  + [11_PIC_fixes_fixup] Rediffed.
* Removed patches:
  + [20_no_atomic_asm] Merged upstream.
* debian/compat: Splice out debhelper compatibility level from rules file.
* debian/control: Build-depend on latest jack release by default.
  Closes: #228788
* debian/control: Bump standards version.
* debian/control: Use auto-generated debconf dependency via misc:Depends.
* debian/control: Minor tweaks to the long description.
* debian/control: Tighten fluidsynth build dependency to sane version.
* debian/muse.doc-base: New. Register HTML documentation with doc-base.
* debian/templates: Tiny rewording, and typo fix.
* debian/templates, debian/po/*: Switch to po-debconf for translations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//=========================================================
2
2
//  MusE
3
3
//  Linux Music Editor
4
 
//    $Id: mtscale.cpp,v 1.2 2002/02/28 09:02:25 muse Exp $
 
4
//    $Id: mtscale.cpp,v 1.1.1.1 2003/10/29 10:06:27 wschweer Exp $
5
5
//  (C) Copyright 1999 Werner Schweer (ws@seh.de)
6
6
//=========================================================
7
7
 
 
8
#include <cmath>
 
9
#include <qpainter.h>
 
10
#include <qtooltip.h>
 
11
 
8
12
#include "mtscale.h"
9
13
#include "midieditor.h"
10
14
#include "globals.h"
11
 
#include <qpainter.h>
12
 
#include <qtooltip.h>
13
15
#include "song.h"
14
16
#include "../marker/marker.h"
15
17
#include "icons.h"
19
21
//    Midi Time Scale
20
22
//---------------------------------------------------------
21
23
 
22
 
MTScale::MTScale(int* r, QWidget* parent, int xs, bool _mode=false)
 
24
MTScale::MTScale(int* r, QWidget* parent, int xs, bool _mode)
23
25
   : View(parent, xs, 1)
24
26
      {
25
27
      waveMode = _mode;
26
28
      QToolTip::add(this, tr("bar scale"));
27
29
      barLocator = false;
28
30
      raster = r;
29
 
      pos[0] = song->cpos();
30
 
      pos[1] = song->lpos();
31
 
      pos[2] = song->rpos();
 
31
      if (waveMode) {
 
32
            pos[0] = int(tempomap.tick2time(song->cpos()) * sampleRate);
 
33
            pos[1] = int(tempomap.tick2time(song->lpos()) * sampleRate);
 
34
            pos[2] = int(tempomap.tick2time(song->rpos()) * sampleRate);
 
35
            }
 
36
      else {
 
37
            pos[0] = song->cpos();
 
38
            pos[1] = song->lpos();
 
39
            pos[2] = song->rpos();
 
40
            }
32
41
      pos[3] = -1;            // do not show
33
42
      button = QMouseEvent::NoButton;
34
43
      setMouseTracking(true);
45
54
 
46
55
void MTScale::songChanged(int type)
47
56
      {
48
 
      if (type & SC_SIG)
 
57
      if (type & (SC_SIG|SC_TEMPO)) {
 
58
           if ((type & SC_TEMPO) && waveMode) {
 
59
                  pos[0] = int(tempomap.tick2time(song->cpos())*sampleRate);
 
60
                  pos[1] = int(tempomap.tick2time(song->lpos())*sampleRate);
 
61
                  pos[2] = int(tempomap.tick2time(song->rpos())*sampleRate);
 
62
                  }
49
63
            redraw();
 
64
            }
50
65
      }
51
66
 
52
67
//---------------------------------------------------------
228
243
      int bar1, bar2, beat, tick;
229
244
 
230
245
      if (waveMode) {
231
 
            ctick = tempomap.samples2tick(mapxDev(x));
 
246
            ctick = tempomap.time2tick(double(mapxDev(x))/double(sampleRate));
232
247
            sigmap.tickValues(ctick, &bar1, &beat, &tick);
233
 
            sigmap.tickValues(tempomap.samples2tick(mapxDev(x+w)), &bar2, &beat, &tick);
 
248
            sigmap.tickValues(tempomap.time2tick(double(mapxDev(x+w))/double(sampleRate)),
 
249
               &bar2, &beat, &tick);
234
250
            }
235
251
      else {
236
252
            ctick = mapxDev(x);
244
260
      int ntick;
245
261
      for (int bar = bar1; bar <= bar2; bar++, stick = ntick) {
246
262
            ntick     = sigmap.bar2tick(bar+1, 0, 0);
247
 
            int tpix, a, b;
 
263
            int tpix, a, b=0;
248
264
            if (waveMode) {
249
 
                  a = tempomap.tick2samples(ntick);
250
 
                  b = tempomap.tick2samples(stick);
 
265
                  a = lrint(tempomap.tick2time(ntick) * double(sampleRate));
 
266
                  b = lrint(tempomap.tick2time(stick) * double(sampleRate));
251
267
                  tpix  = rmapx(a - b);
252
268
                  }
253
269
            else {
283
299
                  for (int beat = 0; beat < z; beat++) {
284
300
                        int xx = sigmap.bar2tick(bar, beat, 0);
285
301
                        if (waveMode)
286
 
                              xx = tempomap.tick2samples(xx);
 
302
                              xx = lrint(tempomap.tick2time(xx) * double(sampleRate));
287
303
                        int xp = mapx(xx);
288
304
                        QString s;
289
305
                        QRect r(xp+2, y, 1000, h);