/[svn]/gigedit/branches/linuxsampler_org/src/propedit.cpp
ViewVC logotype

Annotation of /gigedit/branches/linuxsampler_org/src/propedit.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1055 - (hide annotations) (download)
Sat Mar 3 12:20:03 2007 UTC (14 years, 6 months ago) by persson
Original Path: gigedit/trunk/src/propedit.cpp
File size: 6276 byte(s)
Initial revision

1 persson 1055 #include "propedit.h"
2    
3     /*
4    
5     NumEntryX access(dimreg) = T(spinbutton.get_value())
6     NumEntryTemp dimreg->*param = T(spinbutton.get_value())
7     NumEntryPermille dimreg->*param = uint16_t(spinbutton.get_value() * 10 + 0.5)
8    
9     ChoiceEntry int rowno = combobox.get_active_row_number();
10     if (rowno != -1) dimreg->*param = values[rowno];
11    
12     ChoiceEntryLC int rowno = combobox.get_active_row_number();
13     ...
14     (dimreg->*param).type ...
15    
16     BoolEntry dimreg->*param = checkbutton.get_active();
17    
18    
19    
20     */
21    
22     namespace {
23     const char* const controlChangeTexts[] = {
24     "none", "channelaftertouch", "velocity",
25     0,
26     "modwheel", // "Modulation Wheel or Lever",
27     "breath", // "Breath Controller",
28     0,
29     "foot", // "Foot Controller",
30     "portamentotime", // "Portamento Time",
31     0, 0, 0, 0, 0, 0,
32     "effect1", // "Effect Control 1",
33     "effect2", // "Effect Control 2",
34     0, 0,
35     "genpurpose1", // "General Purpose Controller 1",
36     "genpurpose2", // "General Purpose Controller 2",
37     "genpurpose3", // "General Purpose Controller 3",
38     "genpurpose4", // "General Purpose Controller 4",
39     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
40     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
41     0, 0, 0, 0, 0, 0,
42     "sustainpedal", // "Damper Pedal on/off (Sustain)",
43     "portamento", // "Portamento On/Off",
44     "sostenuto", // "Sustenuto On/Off",
45     "softpedal", // "Soft Pedal On/Off",
46     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
47     "genpurpose5", // "General Purpose Controller 5",
48     "genpurpose6", // "General Purpose Controller 6",
49     "genpurpose7", // "General Purpose Controller 7",
50     "genpurpose8", // "General Purpose Controller 8",
51     0, 0, 0, 0, 0, 0, 0,
52     "effect1depth", // "Effects 1 Depth",
53     "effect2depth", // "Effects 2 Depth",
54     "effect3depth", // "Effects 3 Depth",
55     "effect4depth", // "Effects 4 Depth",
56     "effect5depth", // "Effects 5 Depth"
57     };
58     }
59    
60     // -------------------------------------------------------------------------
61     LabelWidget::LabelWidget(char* labelText, Gtk::Widget& widget) :
62     label(Glib::ustring(labelText) + ":"),
63     widget(widget)
64     {
65     label.set_alignment(Gtk::ALIGN_LEFT);
66     }
67    
68     void LabelWidget::set_sensitive(bool sensitive)
69     {
70     label.set_sensitive(sensitive);
71     widget.set_sensitive(sensitive);
72     }
73    
74     // -------------------------------------------------------------------------
75     NumEntryPermille::NumEntryPermille(char* labelText,
76     uint16_t gig::DimensionRegion::* param,
77     double lower, double upper, int decimals) :
78     NumEntry<gig::DimensionRegion>(labelText, lower, upper, decimals),
79     param(param)
80     {
81     spinbutton.signal_value_changed().connect(
82     sigc::mem_fun(*this, &NumEntryPermille::value_changed));
83     }
84    
85     void NumEntryPermille::value_changed()
86     {
87     if (dimreg) {
88     dimreg->*param = uint16_t(spinbutton.get_value() * 10 + 0.5);
89     }
90     }
91    
92     void NumEntryPermille::set_dimreg(gig::DimensionRegion* dimreg)
93     {
94     this->dimreg = 0;
95     spinbutton.set_value(dimreg->*param / 10.0);
96     this->dimreg = dimreg;
97     }
98    
99    
100    
101     // -------------------------------------------------------------------------
102     BoolEntry::BoolEntry(char* labelText, bool gig::DimensionRegion::* param) :
103     LabelWidget(labelText, checkbutton),
104     param(param)
105     {
106     checkbutton.signal_toggled().connect(
107     sigc::mem_fun(*this, &BoolEntry::value_changed));
108     }
109    
110     void BoolEntry::value_changed()
111     {
112     if (dimreg) {
113     dimreg->*param = checkbutton.get_active();
114     }
115     }
116    
117     void BoolEntry::set_dimreg(gig::DimensionRegion* dimreg)
118     {
119     this->dimreg = 0;
120     checkbutton.set_active(dimreg->*param);
121     this->dimreg = dimreg;
122     }
123    
124     // -------------------------------------------------------------------------
125     ChoiceEntryLeverageCtrl::ChoiceEntryLeverageCtrl(
126     char* labelText,
127     gig::leverage_ctrl_t gig::DimensionRegion::* param) :
128     LabelWidget(labelText, combobox),
129     param(param)
130     {
131     for (int i = 0 ; i < 99 ; i++) {
132     if (controlChangeTexts[i]) {
133     combobox.append_text(controlChangeTexts[i]);
134     }
135     }
136     combobox.signal_changed().connect(
137     sigc::mem_fun(*this, &ChoiceEntryLeverageCtrl::value_changed));
138     }
139    
140     void ChoiceEntryLeverageCtrl::value_changed()
141     {
142     if (dimreg) {
143     int rowno = combobox.get_active_row_number();
144     switch (rowno)
145     {
146     case -1:
147     break;
148     case 0:
149     (dimreg->*param).type = gig::leverage_ctrl_t::type_none;
150     break;
151     case 1:
152     (dimreg->*param).type =
153     gig::leverage_ctrl_t::type_channelaftertouch;
154     break;
155     case 2:
156     (dimreg->*param).type = gig::leverage_ctrl_t::type_velocity;
157     break;
158     default:
159     (dimreg->*param).type = gig::leverage_ctrl_t::type_controlchange;
160     int x = 3;
161     for (int cc = 0 ; cc < 96 ; cc++) {
162     if (controlChangeTexts[cc + 3]) {
163     if (rowno == x) {
164     (dimreg->*param).controller_number = cc;
165     break;
166     }
167     x++;
168     }
169     }
170     break;
171     }
172     }
173     }
174    
175     void ChoiceEntryLeverageCtrl::set_dimreg(gig::DimensionRegion* dimreg)
176     {
177     this->dimreg = 0;
178     gig::leverage_ctrl_t c = dimreg->*param;
179     int x;
180     switch (c.type)
181     {
182     case gig::leverage_ctrl_t::type_none:
183     x = 0;
184     break;
185     case gig::leverage_ctrl_t::type_channelaftertouch:
186     x = 1;
187     break;
188     case gig::leverage_ctrl_t::type_velocity:
189     x = 2;
190     break;
191     case gig::leverage_ctrl_t::type_controlchange:
192     x = -1;
193     for (int cc = 0 ; cc < 96 ; cc++) {
194     if (controlChangeTexts[cc + 3]) {
195     x++;
196     if (c.controller_number == cc) {
197     x += 3;
198     break;
199     }
200     }
201     }
202     break;
203     default:
204     x = -1;
205     break;
206     }
207     combobox.set_active(x);
208     this->dimreg = dimreg;
209     }

  ViewVC Help
Powered by ViewVC