summaryrefslogtreecommitdiff
path: root/muse_qt4_evolution/muse/midiedit/pianoroll.h
blob: e510408cad6b8df668dc84e923dc0e4f8a547932 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
//=============================================================================
//  MusE
//  Linux Music Editor
//  $Id:$
//
//  Copyright (C) 2002-2006 by Werner Schweer and others
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License version 2.
//
//  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., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================

#ifndef __PIANOROLL_H__
#define __PIANOROLL_H__

#include "midieditor.h"
#include "prcanvas.h"

namespace AL {
      class Xml;
      };
using AL::Xml;

class PianoCanvas;
class PartList;
class QuantConfig;
class Part;
class TimeCanvas;

//---------------------------------------------------------
//   PianoRoll
//---------------------------------------------------------

class PianoRoll : public MidiEditor {
      Q_OBJECT

      Q_PROPERTY(int colorMode     READ colorMode     WRITE setColorMode)
      Q_PROPERTY(int quantStrength READ quantStrength WRITE setQuantStrength)
      Q_PROPERTY(int quantLimit    READ quantLimit    WRITE setQuantLimit)
      Q_PROPERTY(bool quantLen     READ quantLen      WRITE setQuantLen)

      int _quantStrength, _quantLimit;
      bool _quantLen;
      int _colorMode;

      Event selEvent;

      enum { CMD_EVENT_COLOR, CMD_CONFIG_QUANT, CMD_LAST };

      QAction* menu_ids[CMD_LAST];
      QMenu *menuFunctions, *menuSelect, *menuConfig;

      int tickOffset;
      int lenOffset;
      int pitchOffset;
      int veloOnOffset;
      int veloOffOffset;
      bool deltaMode;

      QAction* colorModeAction[3];
      QMenu* eventColor;
      QuantConfig* quantConfig;

      QWidget* genToolbar(QWidget* parent);
      void setEventColorMode(int);
      PianoCanvas* canvas() { return (PianoCanvas*)tcanvas; }
      const PianoCanvas* canvas() const { return (PianoCanvas*)tcanvas; }

   private slots:
      void setSelection(int, Event&, Part*);
      void noteinfoChanged(NoteInfo::ValType, int);
      void soloChanged(bool flag);
      void configQuant();

      virtual void cmd(QAction*);
      void setEventColorMode(QAction*);
      void pianoCmd(QObject*);

   public:
      PianoRoll(PartList*, bool);
      ~PianoRoll() {}

      int colorMode() const          { return _colorMode;     }
      void setColorMode(int val)     { _colorMode = val;      }
      int quantStrength() const      { return _quantStrength; }
      int quantLimit() const         { return _quantLimit;    }
      bool quantLen() const          { return _quantLen;      }
      void setQuantStrength(int val) { _quantStrength = val;  }
      void setQuantLimit(int val)    { _quantLimit = val;     }
      void setQuantLen(bool val)     { _quantLen = val;       }

      static void readConfiguration(QDomNode);
      static void writeConfiguration(Xml&);
      static int initRaster, initQuant, initWidth, initHeight;
      static bool initFollow, initSpeaker, initMidiin;
      static int initColorMode, initApplyTo;
      static double initXmag;
      static int initQuantStrength, initQuantLimit;
      static bool initQuantLen;

      static const int INIT_WIDTH       = 650;
      static const int INIT_HEIGHT      = 450;
      static const int INIT_RASTER      = 384 / 2;
      static const int INIT_QUANT       = 384 / 2;
      static const bool INIT_FOLLOW     = false;
      static const bool INIT_SPEAKER    = true;
      static const bool INIT_MIDIIN     = false;
      static const bool INIT_SREC       = false;
      static const bool INIT_COLOR_MODE = 0;
      static const double INIT_XMAG     = 0.08;
      static const int INIT_APPLY_TO       = 0;
      static const int INIT_QUANT_STRENGTH = 100;
      static const int INIT_QUANT_LIMIT    = 0;
      static const int INIT_QUANT_LEN      = false;
      };

#endif