summaryrefslogtreecommitdiff
path: root/muse2/muse/master/master.h
blob: 04a0089649ecd7bfa3b4d26a7531a678f2c08a4d (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
//=========================================================
//  MusE
//  Linux Music Editor
//    $Id: master.h,v 1.3 2004/04/11 13:03:32 wschweer Exp $
//  (C) Copyright 1999 Werner Schweer (ws@seh.de)
//  (C) Copyright 2012 Tim E. Real (terminator356 on users dot sourceforge dot net)
//
//  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 __MASTER_H__
#define __MASTER_H__

#include "type_defs.h"
#include "view.h"
#include "song.h"
#include "tools.h"

class QMouseEvent;
class QPainter;
class QPoint;
class QRect;
class QToolBar;

namespace MusEGui {

class MidiEditor;
class ScrollScale;

//---------------------------------------------------------
//   Master
//---------------------------------------------------------

class Master : public MusEGui::View {
      Q_OBJECT
      enum DragMode { DRAG_OFF, DRAG_NEW, DRAG_MOVE_START, DRAG_MOVE,
            DRAG_DELETE, DRAG_COPY_START, DRAG_COPY,
            DRAG_RESIZE, DRAG_LASSO_START, DRAG_LASSO
            };
      ScrollScale* vscroll;
      unsigned pos[3];
      QPoint start;
      MusEGui::Tool tool;
      DragMode drag;
      MidiEditor* editor;

      int line1x;
      int line1y;
      int line2x;
      int line2y;
      bool drawLineMode;
      
      virtual void pdraw(QPainter&, const QRect&);
      virtual void viewMouseMoveEvent(QMouseEvent* event);
      virtual void leaveEvent(QEvent*e);
      virtual void viewMousePressEvent(QMouseEvent* event);
      virtual void viewMouseReleaseEvent(QMouseEvent*);

      void draw(QPainter&, const QRect&);
      void newVal(int x1, int x2, int y);
      bool deleteVal1(unsigned int x1, unsigned int x2);
      void deleteVal(int x1, int x2);

      void newValRamp(int x1, int y1, int x2, int y2);

   private slots:
      void songChanged(MusECore::SongChangedFlags_t);
     
   signals:
      void followEvent(int);
      void xposChanged(int);
      void yposChanged(int);
      void timeChanged(unsigned);
      void tempoChanged(int);

   public slots:
      void setPos(int, unsigned, bool adjustScrollbar);
      void setTool(int t);

   public:
      Master(MidiEditor*, QWidget* parent, int xmag, int ymag);
      };

} // namespace MusEGui

#endif