/[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 1623 - (show annotations) (download) (as text)
Fri Jan 4 19:42:45 2008 UTC (16 years, 2 months ago) by persson
File MIME type: text/x-c++hdr
File size: 9801 byte(s)
* gig files where regions are not internally ordered are now handled
* the resize mouse pointer is not shown anymore for regions that can't
  be resized
* the region and dimregion chooser widgets are now resizable
* bugfix: sometimes you could not delete more than one dimension
* filter headers are now also greyed out when the filter is inactive

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

  ViewVC Help
Powered by ViewVC