/[svn]/gigedit/trunk/src/gigedit/paramedit.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/paramedit.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1225 by schoenebeck, Sun Jun 10 10:56:11 2007 UTC revision 1359 by schoenebeck, Sun Sep 30 18:30:52 2007 UTC
# Line 19  Line 19 
19    
20  #include "paramedit.h"  #include "paramedit.h"
21    
 bool update_gui;  
   
22  namespace {  namespace {
23      const char* const controlChangeTexts[] = {      const char* const controlChangeTexts[] = {
24          "none", "channelaftertouch", "velocity",          "none", "channelaftertouch", "velocity",
# Line 97  NumEntryGain::NumEntryGain(const char* l Line 95  NumEntryGain::NumEntryGain(const char* l
95    
96  void NumEntryGain::value_changed()  void NumEntryGain::value_changed()
97  {  {
98      if (ptr && update_gui) {      const double f = pow(10, spinbutton.get_digits());
99          *ptr = int32_t(spinbutton.get_value() * coeff);      int new_value = round_to_int(spinbutton.get_value() * f);
100        if (ptr) {
101            if (new_value != round_to_int(*ptr / coeff * f))
102            {
103                sig_to_be_changed.emit();
104                *ptr = round_to_int(new_value / f * coeff);
105                sig_val_changed.emit(new_value);
106                sig_changed.emit();
107            }
108        } else {
109            sig_to_be_changed.emit();
110            sig_val_changed.emit(new_value);
111            sig_changed.emit();
112      }      }
113  }  }
114    
# Line 114  void NumEntryGain::set_ptr(int32_t* ptr) Line 124  void NumEntryGain::set_ptr(int32_t* ptr)
124    
125  BoolEntryPlus6::BoolEntryPlus6(const char* labelText, NumEntryGain& eGain, int32_t plus6value) :  BoolEntryPlus6::BoolEntryPlus6(const char* labelText, NumEntryGain& eGain, int32_t plus6value) :
126      LabelWidget(labelText, checkbutton),      LabelWidget(labelText, checkbutton),
127        checkbutton(labelText),
128      eGain(eGain),      eGain(eGain),
129      plus6value(plus6value)      plus6value(plus6value)
130  {  {
# Line 123  BoolEntryPlus6::BoolEntryPlus6(const cha Line 134  BoolEntryPlus6::BoolEntryPlus6(const cha
134    
135  void BoolEntryPlus6::value_changed()  void BoolEntryPlus6::value_changed()
136  {  {
137      if (ptr && update_gui) {      if (ptr) {
138          bool plus6 = checkbutton.get_active();          bool plus6 = checkbutton.get_active();
139          if (plus6) {          if (plus6) {
140              eGain.set_value(0);              eGain.set_value(0);
141              *ptr = plus6value;              *ptr = plus6value;
142                sig_changed();
143          } else {          } else {
144              if (*ptr < 0) {              if (*ptr < 0) {
145                  *ptr = 0;                  *ptr = 0;
146                    sig_changed();
147              }              }
148          }          }
149          eGain.set_sensitive(!plus6);          eGain.set_sensitive(!plus6);
# Line 154  NumEntryPermille::NumEntryPermille(const Line 167  NumEntryPermille::NumEntryPermille(const
167    
168  void NumEntryPermille::value_changed()  void NumEntryPermille::value_changed()
169  {  {
170      if (ptr && update_gui) {      if (ptr) {
171          *ptr = uint16_t(spinbutton.get_value() * 10 + 0.5);          uint16_t new_value = uint16_t(spinbutton.get_value() * 10 + 0.5);
172            if (new_value != *ptr) {
173                *ptr = uint16_t(spinbutton.get_value() * 10 + 0.5);
174                sig_changed();
175            }
176      }      }
177  }  }
178    
# Line 204  int NoteEntry::on_input(double* new_valu Line 221  int NoteEntry::on_input(double* new_valu
221  // Convert the Adjustment position to text  // Convert the Adjustment position to text
222  bool NoteEntry::on_output()  bool NoteEntry::on_output()
223  {  {
224      int x = int(spinbutton.get_adjustment()->get_value());      int x = int(spinbutton.get_adjustment()->get_value() + 0.5);
225      char buf[10];      char buf[10];
226      sprintf(buf, "%s%d", notes[x % 12], x / 12 - 1);      sprintf(buf, "%s%d", notes[x % 12], x / 12 - 1);
227      spinbutton.set_text(buf);      spinbutton.set_text(buf);
# Line 227  ChoiceEntryLeverageCtrl::ChoiceEntryLeve Line 244  ChoiceEntryLeverageCtrl::ChoiceEntryLeve
244    
245  void ChoiceEntryLeverageCtrl::value_changed()  void ChoiceEntryLeverageCtrl::value_changed()
246  {  {
247      if (ptr && update_gui) {      if (ptr) {
248          int rowno = combobox.get_active_row_number();          int rowno = combobox.get_active_row_number();
249          switch (rowno)          switch (rowno)
250          {          {
# Line 256  void ChoiceEntryLeverageCtrl::value_chan Line 273  void ChoiceEntryLeverageCtrl::value_chan
273              }              }
274              break;              break;
275          }          }
276            if (rowno >= 0) sig_changed();
277      }      }
278  }  }
279    
# Line 306  BoolEntry::BoolEntry(const char* labelTe Line 324  BoolEntry::BoolEntry(const char* labelTe
324    
325  void BoolEntry::value_changed()  void BoolEntry::value_changed()
326  {  {
327      if (ptr && update_gui) {      if (ptr) {
328          *ptr = checkbutton.get_active();          *ptr = checkbutton.get_active();
329            sig_changed();
330      }      }
331  }  }
332    
# Line 328  StringEntry::StringEntry(const char* lab Line 347  StringEntry::StringEntry(const char* lab
347    
348  void StringEntry::value_changed()  void StringEntry::value_changed()
349  {  {
350      if (ptr && update_gui) {      if (ptr) {
351          *ptr = entry.get_text();          *ptr = entry.get_text();
352            sig_changed();
353      }      }
354  }  }
355    

Legend:
Removed from v.1225  
changed lines
  Added in v.1359

  ViewVC Help
Powered by ViewVC