/[svn]/gigedit/trunk/src/gigedit/dimregionedit.h
ViewVC logotype

Contents of /gigedit/trunk/src/gigedit/dimregionedit.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3068 - (show annotations) (download) (as text)
Mon Jan 2 22:13:01 2017 UTC (7 years, 2 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 11989 byte(s)
- Preparations for Xcode project update.

1 /* -*- c++ -*-
2 * Copyright (C) 2006-2017 Andreas Persson
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with program; see the file COPYING. If not, write to the Free
16 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17 * 02110-1301 USA.
18 */
19
20 #ifndef GIGEDIT_DIMREGIONEDIT_H
21 #define GIGEDIT_DIMREGIONEDIT_H
22
23 #ifdef LIBGIG_HEADER_FILE
24 # include LIBGIG_HEADER_FILE(gig.h)
25 #else
26 # include <gig.h>
27 #endif
28
29 #include <cairomm/context.h>
30 #include <gtkmm/box.h>
31 #include <gtkmm/drawingarea.h>
32 #include <gtkmm/entry.h>
33 #include <gtkmm/label.h>
34 #include <gtkmm/notebook.h>
35 #include <gtkmm/table.h>
36
37 #include <set>
38
39 #include "paramedit.h"
40
41 class VelocityCurve : public Gtk::DrawingArea {
42 public:
43 VelocityCurve(double (gig::DimensionRegion::*getter)(uint8_t));
44 void set_dim_region(gig::DimensionRegion* d) { dimreg = d; }
45
46 protected:
47 #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
48 bool on_expose_event(GdkEventExpose* e);
49 #else
50 bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
51 #endif
52
53 private:
54 double (gig::DimensionRegion::* const getter)(uint8_t);
55 gig::DimensionRegion* dimreg;
56 };
57
58 class CrossfadeCurve : public Gtk::DrawingArea {
59 public:
60 CrossfadeCurve();
61 void set_dim_region(gig::DimensionRegion* d) { dimreg = d; }
62
63 protected:
64 #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
65 bool on_expose_event(GdkEventExpose* e);
66 #else
67 bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
68 #endif
69
70 private:
71 gig::DimensionRegion* dimreg;
72 void draw_one_curve(const Cairo::RefPtr<Cairo::Context>& cr,
73 const gig::DimensionRegion* d,
74 bool sensitive);
75 };
76
77 class DimRegionEdit : public Gtk::Notebook
78 {
79 public:
80 DimRegionEdit();
81 virtual ~DimRegionEdit();
82 void set_dim_region(gig::DimensionRegion* d);
83 bool set_sample(gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop);
84 bool set_sample(gig::DimensionRegion* dimreg, gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop);
85 Gtk::Entry* wSample;
86 Gtk::Button* buttonNullSampleReference;
87 sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_to_be_changed();
88 sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_changed();
89 sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/>& signal_sample_ref_changed();
90 sigc::signal<void, gig::Sample*>& signal_select_sample();
91
92 std::set<gig::DimensionRegion*> dimregs;
93
94 protected:
95 sigc::signal<void, gig::DimensionRegion*> dimreg_to_be_changed_signal;
96 sigc::signal<void, gig::DimensionRegion*> dimreg_changed_signal;
97 sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/> sample_ref_changed_signal;
98 sigc::signal<void> instrument_changed;
99 sigc::signal<void, gig::Sample*> select_sample_signal;
100
101 gig::DimensionRegion* dimregion;
102
103 #ifdef OLD_TOOLTIPS
104 Gtk::Tooltips tooltips;
105 #endif
106
107 Gtk::Table* table[7];
108
109 Gtk::Label* lSample;
110
111 VelocityCurve velocity_curve;
112 VelocityCurve release_curve;
113 VelocityCurve cutoff_curve;
114 CrossfadeCurve crossfade_curve;
115
116 NumEntryPermille eEG1PreAttack;
117 NumEntryTemp<double> eEG1Attack;
118 NumEntryTemp<double> eEG1Decay1;
119 NumEntryTemp<double> eEG1Decay2;
120 BoolEntry eEG1InfiniteSustain;
121 NumEntryPermille eEG1Sustain;
122 NumEntryTemp<double> eEG1Release;
123 BoolEntry eEG1Hold;
124 ChoiceEntryLeverageCtrl eEG1Controller;
125 BoolEntry eEG1ControllerInvert;
126 NumEntryTemp<uint8_t> eEG1ControllerAttackInfluence;
127 NumEntryTemp<uint8_t> eEG1ControllerDecayInfluence;
128 NumEntryTemp<uint8_t> eEG1ControllerReleaseInfluence;
129 NumEntryTemp<double> eLFO1Frequency;
130 NumEntryTemp<uint16_t> eLFO1InternalDepth;
131 NumEntryTemp<uint16_t> eLFO1ControlDepth;
132 ChoiceEntry<gig::lfo1_ctrl_t> eLFO1Controller;
133 BoolEntry eLFO1FlipPhase;
134 BoolEntry eLFO1Sync;
135 NumEntryPermille eEG2PreAttack;
136 NumEntryTemp<double> eEG2Attack;
137 NumEntryTemp<double> eEG2Decay1;
138 NumEntryTemp<double> eEG2Decay2;
139 BoolEntry eEG2InfiniteSustain;
140 NumEntryPermille eEG2Sustain;
141 NumEntryTemp<double> eEG2Release;
142 ChoiceEntryLeverageCtrl eEG2Controller;
143 BoolEntry eEG2ControllerInvert;
144 NumEntryTemp<uint8_t> eEG2ControllerAttackInfluence;
145 NumEntryTemp<uint8_t> eEG2ControllerDecayInfluence;
146 NumEntryTemp<uint8_t> eEG2ControllerReleaseInfluence;
147 NumEntryTemp<double> eLFO2Frequency;
148 NumEntryTemp<uint16_t> eLFO2InternalDepth;
149 NumEntryTemp<uint16_t> eLFO2ControlDepth;
150 ChoiceEntry<gig::lfo2_ctrl_t> eLFO2Controller;
151 BoolEntry eLFO2FlipPhase;
152 BoolEntry eLFO2Sync;
153 NumEntryTemp<double> eEG3Attack;
154 NumEntryTemp<int16_t> eEG3Depth;
155 NumEntryTemp<double> eLFO3Frequency;
156 NumEntryTemp<int16_t> eLFO3InternalDepth;
157 NumEntryTemp<int16_t> eLFO3ControlDepth;
158 ChoiceEntry<gig::lfo3_ctrl_t> eLFO3Controller;
159 BoolEntry eLFO3Sync;
160 BoolEntry eVCFEnabled;
161 ChoiceEntry<gig::vcf_type_t> eVCFType;
162 ChoiceEntry<gig::vcf_cutoff_ctrl_t> eVCFCutoffController;
163 BoolEntry eVCFCutoffControllerInvert;
164 NumEntryTemp<uint8_t> eVCFCutoff;
165 ChoiceEntry<gig::curve_type_t> eVCFVelocityCurve;
166 NumEntryTemp<uint8_t> eVCFVelocityScale;
167 NumEntryTemp<uint8_t> eVCFVelocityDynamicRange;
168 NumEntryTemp<uint8_t> eVCFResonance;
169 BoolEntry eVCFResonanceDynamic;
170 ChoiceEntry<gig::vcf_res_ctrl_t> eVCFResonanceController;
171 BoolEntry eVCFKeyboardTracking;
172 NumEntryTemp<uint8_t> eVCFKeyboardTrackingBreakpoint;
173 ChoiceEntry<gig::curve_type_t> eVelocityResponseCurve;
174 NumEntryTemp<uint8_t> eVelocityResponseDepth;
175 NumEntryTemp<uint8_t> eVelocityResponseCurveScaling;
176 ChoiceEntry<gig::curve_type_t> eReleaseVelocityResponseCurve;
177 NumEntryTemp<uint8_t> eReleaseVelocityResponseDepth;
178 NumEntryTemp<uint8_t> eReleaseTriggerDecay;
179 NumEntryTemp<uint8_t> eCrossfade_in_start;
180 NumEntryTemp<uint8_t> eCrossfade_in_end;
181 NumEntryTemp<uint8_t> eCrossfade_out_start;
182 NumEntryTemp<uint8_t> eCrossfade_out_end;
183 BoolEntry ePitchTrack;
184 ChoiceEntry<gig::dim_bypass_ctrl_t> eDimensionBypass;
185 NumEntryTemp<int8_t> ePan;
186 BoolEntry eSelfMask;
187 ChoiceEntryLeverageCtrl eAttenuationController;
188 BoolEntry eInvertAttenuationController;
189 NumEntryTemp<uint8_t> eAttenuationControllerThreshold;
190 NumEntryTemp<uint8_t> eChannelOffset;
191 BoolEntry eSustainDefeat;
192 BoolEntry eMSDecode;
193 NumEntryTemp<uint16_t> eSampleStartOffset;
194 NoteEntry eUnityNote;
195 ReadOnlyLabelWidget eSampleGroup;
196 ReadOnlyLabelWidget eSampleFormatInfo;
197 ReadOnlyLabelWidget eSampleID;
198 ReadOnlyLabelWidget eChecksum;
199 NumEntryTemp<int16_t> eFineTune;
200 NumEntryGain eGain;
201 BoolEntryPlus6 eGainPlus6;
202 BoolEntry eSampleLoopEnabled;
203 NumEntryTemp<uint32_t> eSampleLoopStart;
204 NumEntryTemp<uint32_t> eSampleLoopLength;
205 ChoiceEntry<uint32_t> eSampleLoopType;
206 BoolEntry eSampleLoopInfinite;
207 NumEntryTemp<uint32_t> eSampleLoopPlayCount;
208 Gtk::Label* lEG2;
209 Gtk::Label* lLFO2;
210
211 Gtk::Button buttonSelectSample;
212
213 int rowno;
214 int pageno;
215 int firstRowInBlock;
216
217
218 void addProp(BoolEntry& boolentry);
219 void addProp(BoolEntryPlus6& boolentry);
220 void addProp(LabelWidget& labelwidget);
221 void addString(const char* labelText, Gtk::Label*& label,
222 Gtk::Entry*& widget);
223 void addString(const char* labelText, Gtk::Label*& label,
224 Gtk::Entry*& widget, Gtk::Button*& button);
225 Gtk::Label* addHeader(const char* text);
226 void addRightHandSide(Gtk::Widget& widget);
227 void nextPage();
228
229 void VCFEnabled_toggled();
230 void VCFCutoffController_changed();
231 void VCFResonanceController_changed();
232 void EG1InfiniteSustain_toggled();
233 void EG2InfiniteSustain_toggled();
234 void EG1Controller_changed();
235 void EG2Controller_changed();
236 void AttenuationController_changed();
237 void LFO1Controller_changed();
238 void LFO2Controller_changed();
239 void LFO3Controller_changed();
240 void crossfade1_changed();
241 void crossfade2_changed();
242 void crossfade3_changed();
243 void crossfade4_changed();
244 void update_loop_elements();
245 void loop_start_changed();
246 void loop_length_changed();
247 void loop_infinite_toggled();
248 void nullOutSampleReference();
249
250 int update_model;
251
252 // connect a widget to a setter function in DimRegionEdit
253 template<typename C, typename T>
254 void connect(C& widget,
255 void (DimRegionEdit::*setter)(gig::DimensionRegion*, T)) {
256 connect<C, T>(widget,
257 sigc::mem_fun(setter));
258 }
259
260 // connect a widget to a member variable in gig::DimensionRegion
261 template<typename C, typename T>
262 void connect(C& widget, T gig::DimensionRegion::* member) {
263 connect<C, T>(widget,
264 sigc::bind(sigc::mem_fun(&DimRegionEdit::set_member<T>), member));
265 }
266
267 // connect a widget to a setter function in gig::DimensionRegion
268 template<typename C, typename T>
269 void connect(C& widget,
270 void (gig::DimensionRegion::*setter)(T)) {
271 connect<C, T>(widget,
272 sigc::hide<0>(sigc::mem_fun(setter)));
273 }
274
275 // helper function for the connect functions above
276 template<typename C, typename T>
277 void connect(C& widget,
278 sigc::slot<void, DimRegionEdit*, gig::DimensionRegion*, T> setter) {
279 widget.signal_value_changed().connect(
280 sigc::compose(sigc::bind(sigc::mem_fun(*this, &DimRegionEdit::set_many<T>), setter),
281 sigc::mem_fun(widget, &C::get_value)));
282 }
283
284 // loop through all dimregions being edited and set a value in
285 // each of them
286 template<typename T>
287 void set_many(T value,
288 sigc::slot<void, DimRegionEdit*, gig::DimensionRegion*, T> setter) {
289 if (update_model == 0) {
290 for (std::set<gig::DimensionRegion*>::iterator i = dimregs.begin() ;
291 i != dimregs.end() ; ++i)
292 {
293 dimreg_changed_signal(*i);
294 setter(this, *i, value);
295 }
296 }
297 }
298
299 // set a value of a member variable in the given dimregion
300 template<typename T>
301 void set_member(gig::DimensionRegion* d, T value,
302 T gig::DimensionRegion::* member) {
303 d->*member = value;
304 }
305
306 // setters for specific dimregion parameters
307
308 void set_UnityNote(gig::DimensionRegion* d, uint8_t value);
309 void set_FineTune(gig::DimensionRegion* d, int16_t value);
310 void set_Crossfade_in_start(gig::DimensionRegion* d, uint8_t value);
311 void set_Crossfade_in_end(gig::DimensionRegion* d, uint8_t value);
312 void set_Crossfade_out_start(gig::DimensionRegion* d, uint8_t value);
313 void set_Crossfade_out_end(gig::DimensionRegion* d, uint8_t value);
314 void set_Gain(gig::DimensionRegion* d, int32_t value);
315 void set_LoopEnabled(gig::DimensionRegion* d, bool value);
316 void set_LoopType(gig::DimensionRegion* d, uint32_t value);
317 void set_LoopStart(gig::DimensionRegion* d, uint32_t value);
318 void set_LoopLength(gig::DimensionRegion* d, uint32_t value);
319 void set_LoopInfinite(gig::DimensionRegion* d, bool value);
320 void set_LoopPlayCount(gig::DimensionRegion* d, uint32_t value);
321
322 void onButtonSelectSamplePressed();
323 };
324
325 #endif

  ViewVC Help
Powered by ViewVC