blob: 563cd6a85f3b595e315ec9a17208f21751bcee60 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
//=========================================================
// MusE
// Linux Music Editor
// $Id: pitchedit.cpp,v 1.2 2004/01/09 17:12:54 wschweer Exp $
// (C) Copyright 2001 Werner Schweer (ws@seh.de)
//=========================================================
#include <stdio.h>
#include "pitchedit.h"
#include "helper.h"
//---------------------------------------------------------
// PitchEdit
//---------------------------------------------------------
PitchEdit::PitchEdit(QWidget* parent)
: QSpinBox(parent)
{
setMinimum(0);
setMaximum(127);
setSingleStep(1);
deltaMode = false;
}
//---------------------------------------------------------
// mapValueToText
//---------------------------------------------------------
QString PitchEdit::mapValueToText(int v)
{
if (deltaMode) {
QString s;
s.setNum(v);
return s;
}
else
return pitch2string(v);
}
//---------------------------------------------------------
// mapTextToValue
//---------------------------------------------------------
int PitchEdit::mapTextToValue(bool* ok)
{
printf("PitchEdit: mapTextToValue: not impl.\n");
if (ok)
*ok = false;
return 0;
}
//---------------------------------------------------------
// setDeltaMode
//---------------------------------------------------------
void PitchEdit::setDeltaMode(bool val)
{
deltaMode = val;
if (deltaMode)
setRange(-127, 127);
else
setRange(0, 127);
}
|