1 //=========================================================
2 //  MusE
3 //  Linux Music Editor
4 //    $Id: ctrlpanel.h,v 1.2.2.5 2009/06/10 00:34:59 terminator356 Exp $
5 //  (C) Copyright 1999-2001 Werner Schweer (ws@seh.de)
6 //  (C) Copyright 2012, 2017 Tim E. Real (terminator356 on users dot sourceforge dot net)
7 //
8 //  This program is free software; you can redistribute it and/or
9 //  modify it under the terms of the GNU General Public License
10 //  as published by the Free Software Foundation; version 2 of
11 //  the License, or (at your option) any later version.
12 //
13 //  This program is distributed in the hope that it will be useful,
14 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 //  GNU General Public License for more details.
17 //
18 //  You should have received a copy of the GNU General Public License
19 //  along with this program; if not, write to the Free Software
20 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 //
22 //=========================================================
23 
24 #ifndef __CTRL_PANEL_H__
25 #define __CTRL_PANEL_H__
26 
27 #include <QWidget>
28 
29 #include "ttoolbutton.h"
30 #include "type_defs.h"
31 
32 
33 // Forward declarations:
34 class QHBoxLayout;
35 class QVBoxLayout;
36 class QSpacerItem;
37 class QAction;
38 
39 namespace MusECore {
40 class MidiController;
41 class MidiPort;
42 class MidiTrack;
43 }
44 
45 namespace MusEGui {
46 class MidiEditor;
47 class CtrlCanvas;
48 class CompactKnob;
49 class CompactSlider;
50 class LCDPatchEdit;
51 
52 //---------------------------------------------------------
53 //   CtrlPanel
54 //---------------------------------------------------------
55 
56 class CtrlPanel: public QWidget {
57       Q_OBJECT
58 
59       CompactToolButton* selCtrl;
60       MidiEditor* editor;
61       CtrlCanvas* ctrlcanvas;
62 
63       MusECore::MidiTrack* _track;
64       MusECore::MidiController* _ctrl;
65       int _dnum;
66       bool inHeartBeat;
67 
68       QVBoxLayout* vbox;
69       QHBoxLayout* kbox;
70       QSpacerItem* lspacer;
71       QSpacerItem* rspacer;
72       CompactKnob* _knob;
73       CompactSlider* _slider;
74       LCDPatchEdit* _patchEdit;
75       // Current local state of knobs versus sliders preference global setting.
76       bool _preferKnobs;
77       // Current local state of show values preference global setting.
78       bool _showval;
79 
80       CompactToolButton* _veloPerNoteButton;
81 
82       void buildPanel();
83       void setController();
84       void setControlColor();
85 
86    signals:
87       void destroyPanel();
88       void controllerChanged(int);
89 
90    private slots:
91       void patchCtrlChanged(int val);
92       void ctrlChanged(double val, bool off, int id, int scrollMode);
93       void ctrlRightClicked(const QPoint& p, int id);
94       void ctrlPopupTriggered(QAction* act);
95       void velPerNoteClicked();
96       void songChanged(MusECore::SongChangedStruct_t type);
97       void configChanged();
98 
99    protected slots:
100       virtual void heartBeat();
101 
102    public slots:
103       void setHeight(int);
104       void ctrlPopup();
105       void setVeloPerNoteMode(bool);
106 
107    public:
108       CtrlPanel(QWidget*, MidiEditor*, CtrlCanvas*, const char* name = 0);
109       void setHWController(MusECore::MidiTrack* t, MusECore::MidiController* ctrl);
110       };
111 
112 } // namespace MusEGui
113 
114 #endif
115