/[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 1261 by persson, Thu Jul 5 17:12:20 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) {      if (ptr) {
99          *ptr = int32_t(spinbutton.get_value() * coeff);          const double f = pow(10, spinbutton.get_digits());
100            int new_value = round_to_int(spinbutton.get_value() * f);
101    
102            if (new_value != round_to_int(*ptr / coeff * f))
103            {
104                *ptr = round_to_int(new_value / f * coeff);
105                sig_changed();
106            }
107      }      }
108  }  }
109    
# Line 123  BoolEntryPlus6::BoolEntryPlus6(const cha Line 128  BoolEntryPlus6::BoolEntryPlus6(const cha
128    
129  void BoolEntryPlus6::value_changed()  void BoolEntryPlus6::value_changed()
130  {  {
131      if (ptr && update_gui) {      if (ptr) {
132          bool plus6 = checkbutton.get_active();          bool plus6 = checkbutton.get_active();
133          if (plus6) {          if (plus6) {
134              eGain.set_value(0);              eGain.set_value(0);
135              *ptr = plus6value;              *ptr = plus6value;
136                sig_changed();
137          } else {          } else {
138              if (*ptr < 0) {              if (*ptr < 0) {
139                  *ptr = 0;                  *ptr = 0;
140                    sig_changed();
141              }              }
142          }          }
143          eGain.set_sensitive(!plus6);          eGain.set_sensitive(!plus6);
# Line 154  NumEntryPermille::NumEntryPermille(const Line 161  NumEntryPermille::NumEntryPermille(const
161    
162  void NumEntryPermille::value_changed()  void NumEntryPermille::value_changed()
163  {  {
164      if (ptr && update_gui) {      if (ptr) {
165          *ptr = uint16_t(spinbutton.get_value() * 10 + 0.5);          uint16_t new_value = uint16_t(spinbutton.get_value() * 10 + 0.5);
166            if (new_value != *ptr) {
167                *ptr = uint16_t(spinbutton.get_value() * 10 + 0.5);
168                sig_changed();
169            }
170      }      }
171  }  }
172    
# Line 204  int NoteEntry::on_input(double* new_valu Line 215  int NoteEntry::on_input(double* new_valu
215  // Convert the Adjustment position to text  // Convert the Adjustment position to text
216  bool NoteEntry::on_output()  bool NoteEntry::on_output()
217  {  {
218      int x = int(spinbutton.get_adjustment()->get_value());      int x = int(spinbutton.get_adjustment()->get_value() + 0.5);
219      char buf[10];      char buf[10];
220      sprintf(buf, "%s%d", notes[x % 12], x / 12 - 1);      sprintf(buf, "%s%d", notes[x % 12], x / 12 - 1);
221      spinbutton.set_text(buf);      spinbutton.set_text(buf);
# Line 227  ChoiceEntryLeverageCtrl::ChoiceEntryLeve Line 238  ChoiceEntryLeverageCtrl::ChoiceEntryLeve
238    
239  void ChoiceEntryLeverageCtrl::value_changed()  void ChoiceEntryLeverageCtrl::value_changed()
240  {  {
241      if (ptr && update_gui) {      if (ptr) {
242          int rowno = combobox.get_active_row_number();          int rowno = combobox.get_active_row_number();
243          switch (rowno)          switch (rowno)
244          {          {
# Line 256  void ChoiceEntryLeverageCtrl::value_chan Line 267  void ChoiceEntryLeverageCtrl::value_chan
267              }              }
268              break;              break;
269          }          }
270            if (rowno >= 0) sig_changed();
271      }      }
272  }  }
273    
# Line 306  BoolEntry::BoolEntry(const char* labelTe Line 318  BoolEntry::BoolEntry(const char* labelTe
318    
319  void BoolEntry::value_changed()  void BoolEntry::value_changed()
320  {  {
321      if (ptr && update_gui) {      if (ptr) {
322          *ptr = checkbutton.get_active();          *ptr = checkbutton.get_active();
323            sig_changed();
324      }      }
325  }  }
326    
# Line 328  StringEntry::StringEntry(const char* lab Line 341  StringEntry::StringEntry(const char* lab
341    
342  void StringEntry::value_changed()  void StringEntry::value_changed()
343  {  {
344      if (ptr && update_gui) {      if (ptr) {
345          *ptr = entry.get_text();          *ptr = entry.get_text();
346            sig_changed();
347      }      }
348  }  }
349    

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

  ViewVC Help
Powered by ViewVC