summaryrefslogtreecommitdiff
path: root/muse2/muse/key.h
blob: b6179bed7b09ef6f1ef114adb25fba6b7b62db06 (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
65
66
67
68
69
70
71
72
73
74
75
//=========================================================
//  MusE
//  Linux Music Editor
//  $Id: key.h,v 1.1.1.1 2003/10/27 18:51:25 wschweer Exp $
//
//  (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; version 2 of
//  the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//
//=========================================================

#ifndef __KEY_H__
#define __KEY_H__

#include <stdio.h>
class QPainter;
class QPoint;

namespace MusECore {

class Xml;

//---------------------------------------------------------
//   NKey
//---------------------------------------------------------

class NKey {
      static int offsets[14];
      int val;
   public:
      NKey() { val = 7; }
      NKey(int k) { val = k; }
      void draw(QPainter& p, const QPoint& pt) const;
      int idx() const  { return val; }
      int offset() const { return offsets[val]; }
      void read(Xml&);
      void write(int, Xml&) const;
      void set(int n) { val = n; }
      int width() const;
      };

//---------------------------------------------------------
//   Scale
//---------------------------------------------------------

class Scale {
      int val;                // 1 = 1 sharp,  -1 1 flat
      bool minor;
   public:
      Scale() { val = 0; minor = false; }
      Scale(int s, bool m = false) { val = s; minor = m; }
      int idx() const             { return val; }
      void read(Xml&);
      void write(int, Xml&) const;
      void set(int n)             { val = n; }
      void setMajorMinor(bool f)  { minor = f; }      // true == minor
      int width() const;
      };

} // namespace MusECore

#endif