1 /* -----------------------------------------------------------------------------
2  *
3  * Giada - Your Hardcore Loopmachine
4  *
5  * -----------------------------------------------------------------------------
6  *
7  * Copyright (C) 2010-2020 Giovanni A. Zuliani | Monocasual
8  *
9  * This file is part of Giada - Your Hardcore Loopmachine.
10  *
11  * Giada - Your Hardcore Loopmachine is free software: you can
12  * redistribute it and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation, either
14  * version 3 of the License, or (at your option) any later version.
15  *
16  * Giada - Your Hardcore Loopmachine is distributed in the hope that it
17  * will be useful, but WITHOUT ANY WARRANTY; without even the implied
18  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19  * See the GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with Giada - Your Hardcore Loopmachine. If not, see
23  * <http://www.gnu.org/licenses/>.
24  *
25  * -------------------------------------------------------------------------- */
26 
27 
28 #ifndef GE_WAVE_TOOLS_H
29 #define GE_WAVE_TOOLS_H
30 
31 
32 #include <FL/Fl_Scroll.H>
33 
34 
35 namespace giada {
36 namespace v
37 {
38 class geWaveform;
39 class geWaveTools : public Fl_Scroll
40 {
41 public:
42 
43 	geWaveTools(int x, int y, int w, int h);
44 
45 	void resize(int x, int y, int w, int h) override;
46 	int  handle(int e) override;
47 
48 	/* rebuild
49 	Updates the waveform by realloc-ing new data (i.e. when the waveform has
50 	changed). */
51 
52 	void rebuild(const c::sampleEditor::Data& d);
53 
54 	/* refresh
55 	Redraws the waveform, called by the video thread. This is meant to be called
56 	repeatedly when you need to update the play head inside the waveform. The
57 	method is smart enough to skip painting if the channel is stopped. */
58 
59 	void refresh();
60 
getChannelData()61 	const c::sampleEditor::Data& getChannelData() const { return *m_data; }
62 
63 	v::geWaveform* waveform;
64 
65 private:
66 
67 	void openMenu();
68 
69 	const c::sampleEditor::Data* m_data;
70 };
71 }} // giada::v::
72 
73 
74 #endif
75