1 /*
2  * Hydrogen
3  * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
4  *
5  * http://www.hydrogen-music.org
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY, without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  *
21  */
22 
23 #ifndef TARGET_WAVE_DISPLAY
24 #define TARGET_WAVE_DISPLAY
25 
26 #include <QtGui>
27 #if QT_VERSION >= 0x050000
28 #  include <QtWidgets>
29 #endif
30 #include <hydrogen/object.h>
31 #include <hydrogen/basics/sample.h>
32 #include <memory>
33 
34 class SampleEditor;
35 
36 namespace H2Core
37 {
38 	class InstrumentLayer;
39 	class EnvelopePoint;
40 }
41 
42 class TargetWaveDisplay : public QWidget, public H2Core::Object
43 {
44 	H2_OBJECT
45 	Q_OBJECT
46 
47 	public:
48 		TargetWaveDisplay(QWidget* pParent);
49 		~TargetWaveDisplay();
50 
51 		void updateDisplay( H2Core::InstrumentLayer *pLayer );
52 		void updateDisplayPointer();
53 		void paintLocatorEventTargetDisplay( int pos, bool last_event);
54 		void paintEvent(QPaintEvent *ev);
get_pan()55 		H2Core::Sample::PanEnvelope* get_pan() { return &m_PanEnvelope; }
get_velocity()56 		H2Core::Sample::VelocityEnvelope* get_velocity() { return &m_VelocityEnvelope; }
57 
58 	private:
59 		QPixmap m_Background;
60 
61 		QString m_sSampleName;
62 		QString m_sInfo;
63 
64 		int m_nX;
65 		int m_nY;
66 		int m_nLocator;
67 
68 		int *m_pPeakData_Left;
69 		int *m_pPeakData_Right;
70 
71 		unsigned m_nSampleLength;
72 
73 		bool m_VMove;
74 		bool m_UpdatePosition;
75 
76 		virtual void mouseMoveEvent(QMouseEvent *ev);
77 		virtual void mousePressEvent(QMouseEvent *ev);
78 		virtual void mouseReleaseEvent(QMouseEvent *ev);
79 
80 		H2Core::Sample::PanEnvelope m_PanEnvelope;
81 		H2Core::Sample::VelocityEnvelope m_VelocityEnvelope;
82 };
83 
84 
85 #endif
86