/[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 2151 - (show annotations) (download) (as text)
Sun Nov 21 12:38:41 2010 UTC (13 years, 4 months ago) by persson
File MIME type: text/x-c++hdr
File size: 9800 byte(s)
* use Cairo instead of deprecated gdk drawing primitives
* avoid deprecated gtk methods when using newer gtk versions
* raised minimum supported gtkmm version to 2.8

1 /* -*- c++ -*-
2 * Copyright (C) 2006-2010 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 #include <gig.h>
24
25 #include <gtkmm/entry.h>
26 #include <gtkmm/label.h>
27 #include <gtkmm/notebook.h>
28 #include <gtkmm/table.h>
29
30 #include <set>
31
32 #include "paramedit.h"
33
34 class DimRegionEdit : public Gtk::Notebook
35 {
36 public:
37 DimRegionEdit();
38 virtual ~DimRegionEdit();
39 void set_dim_region(gig::DimensionRegion* d);
40 bool set_sample(gig::Sample* sample);
41 Gtk::Entry* wSample;
42 sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_to_be_changed();
43 sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_changed();
44 sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/>& signal_sample_ref_changed();
45
46 std::set<gig::DimensionRegion*> dimregs;
47
48 protected:
49 sigc::signal<void, gig::DimensionRegion*> dimreg_to_be_changed_signal;
50 sigc::signal<void, gig::DimensionRegion*> dimreg_changed_signal;
51 sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/> sample_ref_changed_signal;
52 sigc::signal<void> instrument_changed;
53
54 gig::DimensionRegion* dimregion;
55
56 #ifdef OLD_TOOLTIPS
57 Gtk::Tooltips tooltips;
58 #endif
59
60 Gtk::Table* table[7];
61
62 Gtk::Label* lSample;
63
64 NumEntryPermille eEG1PreAttack;
65 NumEntryTemp<double> eEG1Attack;
66 NumEntryTemp<double> eEG1Decay1;
67 NumEntryTemp<double> eEG1Decay2;
68 BoolEntry eEG1InfiniteSustain;
69 NumEntryPermille eEG1Sustain;
70 NumEntryTemp<double> eEG1Release;
71 BoolEntry eEG1Hold;
72 ChoiceEntryLeverageCtrl eEG1Controller;
73 BoolEntry eEG1ControllerInvert;
74 NumEntryTemp<uint8_t> eEG1ControllerAttackInfluence;
75 NumEntryTemp<uint8_t> eEG1ControllerDecayInfluence;
76 NumEntryTemp<uint8_t> eEG1ControllerReleaseInfluence;
77 NumEntryTemp<double> eLFO1Frequency;
78 NumEntryTemp<uint16_t> eLFO1InternalDepth;
79 NumEntryTemp<uint16_t> eLFO1ControlDepth;
80 ChoiceEntry<gig::lfo1_ctrl_t> eLFO1Controller;
81 BoolEntry eLFO1FlipPhase;
82 BoolEntry eLFO1Sync;
83 NumEntryPermille eEG2PreAttack;
84 NumEntryTemp<double> eEG2Attack;
85 NumEntryTemp<double> eEG2Decay1;
86 NumEntryTemp<double> eEG2Decay2;
87 BoolEntry eEG2InfiniteSustain;
88 NumEntryPermille eEG2Sustain;
89 NumEntryTemp<double> eEG2Release;
90 ChoiceEntryLeverageCtrl eEG2Controller;
91 BoolEntry eEG2ControllerInvert;
92 NumEntryTemp<uint8_t> eEG2ControllerAttackInfluence;
93 NumEntryTemp<uint8_t> eEG2ControllerDecayInfluence;
94 NumEntryTemp<uint8_t> eEG2ControllerReleaseInfluence;
95 NumEntryTemp<double> eLFO2Frequency;
96 NumEntryTemp<uint16_t> eLFO2InternalDepth;
97 NumEntryTemp<uint16_t> eLFO2ControlDepth;
98 ChoiceEntry<gig::lfo2_ctrl_t> eLFO2Controller;
99 BoolEntry eLFO2FlipPhase;
100 BoolEntry eLFO2Sync;
101 NumEntryTemp<double> eEG3Attack;
102 NumEntryTemp<int16_t> eEG3Depth;
103 NumEntryTemp<double> eLFO3Frequency;
104 NumEntryTemp<int16_t> eLFO3InternalDepth;
105 NumEntryTemp<int16_t> eLFO3ControlDepth;
106 ChoiceEntry<gig::lfo3_ctrl_t> eLFO3Controller;
107 BoolEntry eLFO3Sync;
108 BoolEntry eVCFEnabled;
109 ChoiceEntry<gig::vcf_type_t> eVCFType;
110 ChoiceEntry<gig::vcf_cutoff_ctrl_t> eVCFCutoffController;
111 BoolEntry eVCFCutoffControllerInvert;
112 NumEntryTemp<uint8_t> eVCFCutoff;
113 ChoiceEntry<gig::curve_type_t> eVCFVelocityCurve;
114 NumEntryTemp<uint8_t> eVCFVelocityScale;
115 NumEntryTemp<uint8_t> eVCFVelocityDynamicRange;
116 NumEntryTemp<uint8_t> eVCFResonance;
117 BoolEntry eVCFResonanceDynamic;
118 ChoiceEntry<gig::vcf_res_ctrl_t> eVCFResonanceController;
119 BoolEntry eVCFKeyboardTracking;
120 NumEntryTemp<uint8_t> eVCFKeyboardTrackingBreakpoint;
121 ChoiceEntry<gig::curve_type_t> eVelocityResponseCurve;
122 NumEntryTemp<uint8_t> eVelocityResponseDepth;
123 NumEntryTemp<uint8_t> eVelocityResponseCurveScaling;
124 ChoiceEntry<gig::curve_type_t> eReleaseVelocityResponseCurve;
125 NumEntryTemp<uint8_t> eReleaseVelocityResponseDepth;
126 NumEntryTemp<uint8_t> eReleaseTriggerDecay;
127 NumEntryTemp<uint8_t> eCrossfade_in_start;
128 NumEntryTemp<uint8_t> eCrossfade_in_end;
129 NumEntryTemp<uint8_t> eCrossfade_out_start;
130 NumEntryTemp<uint8_t> eCrossfade_out_end;
131 BoolEntry ePitchTrack;
132 ChoiceEntry<gig::dim_bypass_ctrl_t> eDimensionBypass;
133 NumEntryTemp<int8_t> ePan;
134 BoolEntry eSelfMask;
135 ChoiceEntryLeverageCtrl eAttenuationController;
136 BoolEntry eInvertAttenuationController;
137 NumEntryTemp<uint8_t> eAttenuationControllerThreshold;
138 NumEntryTemp<uint8_t> eChannelOffset;
139 BoolEntry eSustainDefeat;
140 BoolEntry eMSDecode;
141 NumEntryTemp<uint16_t> eSampleStartOffset;
142 NoteEntry eUnityNote;
143 NumEntryTemp<int16_t> eFineTune;
144 NumEntryGain eGain;
145 BoolEntryPlus6 eGainPlus6;
146 BoolEntry eSampleLoopEnabled;
147 NumEntryTemp<uint32_t> eSampleLoopStart;
148 NumEntryTemp<uint32_t> eSampleLoopLength;
149 ChoiceEntry<uint32_t> eSampleLoopType;
150 BoolEntry eSampleLoopInfinite;
151 NumEntryTemp<uint32_t> eSampleLoopPlayCount;
152 Gtk::Label* lEG2;
153 Gtk::Label* lLFO2;
154
155 int rowno;
156 int pageno;
157 int firstRowInBlock;
158
159
160 void addProp(BoolEntry& boolentry);
161 void addProp(BoolEntryPlus6& boolentry);
162 void addProp(LabelWidget& labelwidget);
163 void addString(const char* labelText, Gtk::Label*& label,
164 Gtk::Entry*& widget);
165 Gtk::Label* addHeader(const char* text);
166 void nextPage();
167
168 void VCFEnabled_toggled();
169 void VCFCutoffController_changed();
170 void VCFResonanceController_changed();
171 void EG1InfiniteSustain_toggled();
172 void EG2InfiniteSustain_toggled();
173 void EG1Controller_changed();
174 void EG2Controller_changed();
175 void AttenuationController_changed();
176 void LFO1Controller_changed();
177 void LFO2Controller_changed();
178 void LFO3Controller_changed();
179 void crossfade1_changed();
180 void crossfade2_changed();
181 void crossfade3_changed();
182 void crossfade4_changed();
183 void update_loop_elements();
184 void loop_start_changed();
185 void loop_length_changed();
186 void loop_infinite_toggled();
187
188 int update_model;
189
190 // connect a widget to a setter function in DimRegionEdit
191 template<typename C, typename T>
192 void connect(C& widget,
193 void (DimRegionEdit::*setter)(gig::DimensionRegion*, T)) {
194 connect<C, T>(widget,
195 sigc::mem_fun(setter));
196 }
197
198 // connect a widget to a member variable in gig::DimensionRegion
199 template<typename C, typename T>
200 void connect(C& widget, T gig::DimensionRegion::* member) {
201 connect<C, T>(widget,
202 sigc::bind(sigc::mem_fun(&DimRegionEdit::set_member<T>), member));
203 }
204
205 // connect a widget to a setter function in gig::DimensionRegion
206 template<typename C, typename T>
207 void connect(C& widget,
208 void (gig::DimensionRegion::*setter)(T)) {
209 connect<C, T>(widget,
210 sigc::hide<0>(sigc::mem_fun(setter)));
211 }
212
213 // helper function for the connect functions above
214 template<typename C, typename T>
215 void connect(C& widget,
216 sigc::slot<void, DimRegionEdit*, gig::DimensionRegion*, T> setter) {
217 widget.signal_value_changed().connect(
218 sigc::compose(sigc::bind(sigc::mem_fun(*this, &DimRegionEdit::set_many<T>), setter),
219 sigc::mem_fun(widget, &C::get_value)));
220 }
221
222 // loop through all dimregions being edited ant set a value in
223 // each of them
224 template<typename T>
225 void set_many(T value,
226 sigc::slot<void, DimRegionEdit*, gig::DimensionRegion*, T> setter) {
227 if (update_model == 0) {
228 for (std::set<gig::DimensionRegion*>::iterator i = dimregs.begin() ;
229 i != dimregs.end() ; i++)
230 {
231 dimreg_changed_signal(*i);
232 setter(this, *i, value);
233 }
234 }
235 }
236
237 // set a value of a member variable in the given dimregion
238 template<typename T>
239 void set_member(gig::DimensionRegion* d, T value,
240 T gig::DimensionRegion::* member) {
241 d->*member = value;
242 }
243
244 // setters for specific dimregion parameters
245
246 void set_UnityNote(gig::DimensionRegion* d, uint8_t value);
247 void set_FineTune(gig::DimensionRegion* d, int16_t value);
248 void set_Crossfade_in_start(gig::DimensionRegion* d, uint8_t value);
249 void set_Crossfade_in_end(gig::DimensionRegion* d, uint8_t value);
250 void set_Crossfade_out_start(gig::DimensionRegion* d, uint8_t value);
251 void set_Crossfade_out_end(gig::DimensionRegion* d, uint8_t value);
252 void set_Gain(gig::DimensionRegion* d, int32_t value);
253 void set_LoopEnabled(gig::DimensionRegion* d, bool value);
254 void set_LoopType(gig::DimensionRegion* d, uint32_t value);
255 void set_LoopStart(gig::DimensionRegion* d, uint32_t value);
256 void set_LoopLength(gig::DimensionRegion* d, uint32_t value);
257 void set_LoopInfinite(gig::DimensionRegion* d, bool value);
258 void set_LoopPlayCount(gig::DimensionRegion* d, uint32_t value);
259 };
260
261 #endif

  ViewVC Help
Powered by ViewVC