1 |
/* -*- c++ -*- |
/* -*- c++ -*- |
2 |
* Copyright (C) 2006-2015 Andreas Persson |
* Copyright (C) 2006-2017 Andreas Persson |
3 |
* |
* |
4 |
* This program is free software; you can redistribute it and/or |
* This program is free software; you can redistribute it and/or |
5 |
* modify it under the terms of the GNU General Public License as |
* modify it under the terms of the GNU General Public License as |
20 |
#ifndef GIGEDIT_DIMREGIONEDIT_H |
#ifndef GIGEDIT_DIMREGIONEDIT_H |
21 |
#define GIGEDIT_DIMREGIONEDIT_H |
#define GIGEDIT_DIMREGIONEDIT_H |
22 |
|
|
23 |
#include <gig.h> |
#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> |
#include <cairomm/context.h> |
30 |
#include <gtkmm/box.h> |
#include <gtkmm/box.h> |
37 |
#include <set> |
#include <set> |
38 |
|
|
39 |
#include "paramedit.h" |
#include "paramedit.h" |
40 |
|
#include "global.h" |
41 |
|
|
42 |
class VelocityCurve : public Gtk::DrawingArea { |
class VelocityCurve : public Gtk::DrawingArea { |
43 |
public: |
public: |
75 |
bool sensitive); |
bool sensitive); |
76 |
}; |
}; |
77 |
|
|
78 |
|
class EGStateOptions : public Gtk::HBox { |
79 |
|
public: |
80 |
|
Gtk::Label label; |
81 |
|
BoolBox checkBoxAttack; |
82 |
|
BoolBox checkBoxAttackHold; |
83 |
|
BoolBox checkBoxDecay1; |
84 |
|
BoolBox checkBoxDecay2; |
85 |
|
BoolBox checkBoxRelease; |
86 |
|
|
87 |
|
EGStateOptions(); |
88 |
|
}; |
89 |
|
|
90 |
class DimRegionEdit : public Gtk::Notebook |
class DimRegionEdit : public Gtk::Notebook |
91 |
{ |
{ |
92 |
public: |
public: |
111 |
sigc::signal<void> instrument_changed; |
sigc::signal<void> instrument_changed; |
112 |
sigc::signal<void, gig::Sample*> select_sample_signal; |
sigc::signal<void, gig::Sample*> select_sample_signal; |
113 |
|
|
114 |
|
/** |
115 |
|
* Ensures that the 2 signals DimRegionEdit::dimreg_to_be_changed_signal and |
116 |
|
* DimRegionEdit::dimreg_changed_signal are always triggered correctly as a |
117 |
|
* pair. It behaves similar to a "mutex lock guard" design pattern. |
118 |
|
*/ |
119 |
|
class DimRegionChangeGuard : public SignalGuard<gig::DimensionRegion*> { |
120 |
|
public: |
121 |
|
DimRegionChangeGuard(DimRegionEdit* edit, gig::DimensionRegion* pDimReg) : |
122 |
|
SignalGuard<gig::DimensionRegion*>(edit->dimreg_to_be_changed_signal, edit->dimreg_changed_signal, pDimReg) |
123 |
|
{ |
124 |
|
} |
125 |
|
}; |
126 |
|
|
127 |
gig::DimensionRegion* dimregion; |
gig::DimensionRegion* dimregion; |
128 |
|
|
129 |
#ifdef OLD_TOOLTIPS |
#ifdef OLD_TOOLTIPS |
152 |
NumEntryTemp<uint8_t> eEG1ControllerAttackInfluence; |
NumEntryTemp<uint8_t> eEG1ControllerAttackInfluence; |
153 |
NumEntryTemp<uint8_t> eEG1ControllerDecayInfluence; |
NumEntryTemp<uint8_t> eEG1ControllerDecayInfluence; |
154 |
NumEntryTemp<uint8_t> eEG1ControllerReleaseInfluence; |
NumEntryTemp<uint8_t> eEG1ControllerReleaseInfluence; |
155 |
|
EGStateOptions eEG1StateOptions; |
156 |
NumEntryTemp<double> eLFO1Frequency; |
NumEntryTemp<double> eLFO1Frequency; |
157 |
NumEntryTemp<uint16_t> eLFO1InternalDepth; |
NumEntryTemp<uint16_t> eLFO1InternalDepth; |
158 |
NumEntryTemp<uint16_t> eLFO1ControlDepth; |
NumEntryTemp<uint16_t> eLFO1ControlDepth; |
171 |
NumEntryTemp<uint8_t> eEG2ControllerAttackInfluence; |
NumEntryTemp<uint8_t> eEG2ControllerAttackInfluence; |
172 |
NumEntryTemp<uint8_t> eEG2ControllerDecayInfluence; |
NumEntryTemp<uint8_t> eEG2ControllerDecayInfluence; |
173 |
NumEntryTemp<uint8_t> eEG2ControllerReleaseInfluence; |
NumEntryTemp<uint8_t> eEG2ControllerReleaseInfluence; |
174 |
|
EGStateOptions eEG2StateOptions; |
175 |
NumEntryTemp<double> eLFO2Frequency; |
NumEntryTemp<double> eLFO2Frequency; |
176 |
NumEntryTemp<uint16_t> eLFO2InternalDepth; |
NumEntryTemp<uint16_t> eLFO2InternalDepth; |
177 |
NumEntryTemp<uint16_t> eLFO2ControlDepth; |
NumEntryTemp<uint16_t> eLFO2ControlDepth; |
246 |
void addProp(BoolEntry& boolentry); |
void addProp(BoolEntry& boolentry); |
247 |
void addProp(BoolEntryPlus6& boolentry); |
void addProp(BoolEntryPlus6& boolentry); |
248 |
void addProp(LabelWidget& labelwidget); |
void addProp(LabelWidget& labelwidget); |
249 |
|
void addLine(Gtk::HBox& line); |
250 |
void addString(const char* labelText, Gtk::Label*& label, |
void addString(const char* labelText, Gtk::Label*& label, |
251 |
Gtk::Entry*& widget); |
Gtk::Entry*& widget); |
252 |
void addString(const char* labelText, Gtk::Label*& label, |
void addString(const char* labelText, Gtk::Label*& label, |
278 |
|
|
279 |
int update_model; |
int update_model; |
280 |
|
|
281 |
|
/** |
282 |
|
* Workaround for the circumstance that C++ does not allow to cast to |
283 |
|
* member pointers. |
284 |
|
*/ |
285 |
|
template<typename classT, typename memberT> |
286 |
|
union ClassMemberPtr { |
287 |
|
memberT classT::*pmember; |
288 |
|
void* pvoid; |
289 |
|
|
290 |
|
ClassMemberPtr(size_t s) : pvoid((void*)s) {} |
291 |
|
ClassMemberPtr(void* p) : pvoid(p) {} |
292 |
|
}; |
293 |
|
|
294 |
// connect a widget to a setter function in DimRegionEdit |
// connect a widget to a setter function in DimRegionEdit |
295 |
template<typename C, typename T> |
template<typename C, typename T> |
296 |
void connect(C& widget, |
void connect(C& widget, |
332 |
for (std::set<gig::DimensionRegion*>::iterator i = dimregs.begin() ; |
for (std::set<gig::DimensionRegion*>::iterator i = dimregs.begin() ; |
333 |
i != dimregs.end() ; ++i) |
i != dimregs.end() ; ++i) |
334 |
{ |
{ |
335 |
dimreg_changed_signal(*i); |
DimRegionChangeGuard(this, *i); |
336 |
setter(this, *i, value); |
setter(this, *i, value); |
337 |
} |
} |
338 |
} |
} |