/[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 1262 by persson, Sun Jul 22 15:07:08 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 114  void NumEntryGain::set_ptr(int32_t* ptr) Line 119  void NumEntryGain::set_ptr(int32_t* ptr)
119    
120  BoolEntryPlus6::BoolEntryPlus6(const char* labelText, NumEntryGain& eGain, int32_t plus6value) :  BoolEntryPlus6::BoolEntryPlus6(const char* labelText, NumEntryGain& eGain, int32_t plus6value) :
121      LabelWidget(labelText, checkbutton),      LabelWidget(labelText, checkbutton),
122        checkbutton(labelText),
123      eGain(eGain),      eGain(eGain),
124      plus6value(plus6value)      plus6value(plus6value)
125  {  {
# Line 123  BoolEntryPlus6::BoolEntryPlus6(const cha Line 129  BoolEntryPlus6::BoolEntryPlus6(const cha
129    
130  void BoolEntryPlus6::value_changed()  void BoolEntryPlus6::value_changed()
131  {  {
132      if (ptr && update_gui) {      if (ptr) {
133          bool plus6 = checkbutton.get_active();          bool plus6 = checkbutton.get_active();
134          if (plus6) {          if (plus6) {
135              eGain.set_value(0);              eGain.set_value(0);
136              *ptr = plus6value;              *ptr = plus6value;
137                sig_changed();
138          } else {          } else {
139              if (*ptr < 0) {              if (*ptr < 0) {
140                  *ptr = 0;                  *ptr = 0;
141                    sig_changed();
142              }              }
143          }          }
144          eGain.set_sensitive(!plus6);          eGain.set_sensitive(!plus6);
# Line 154  NumEntryPermille::NumEntryPermille(const Line 162  NumEntryPermille::NumEntryPermille(const
162    
163  void NumEntryPermille::value_changed()  void NumEntryPermille::value_changed()
164  {  {
165      if (ptr && update_gui) {      if (ptr) {
166          *ptr = uint16_t(spinbutton.get_value() * 10 + 0.5);          uint16_t new_value = uint16_t(spinbutton.get_value() * 10 + 0.5);
167            if (new_value != *ptr) {
168                *ptr = uint16_t(spinbutton.get_value() * 10 + 0.5);
169                sig_changed();
170            }
171      }      }
172  }  }
173    
# Line 204  int NoteEntry::on_input(double* new_valu Line 216  int NoteEntry::on_input(double* new_valu
216  // Convert the Adjustment position to text  // Convert the Adjustment position to text
217  bool NoteEntry::on_output()  bool NoteEntry::on_output()
218  {  {
219      int x = int(spinbutton.get_adjustment()->get_value());      int x = int(spinbutton.get_adjustment()->get_value() + 0.5);
220      char buf[10];      char buf[10];
221      sprintf(buf, "%s%d", notes[x % 12], x / 12 - 1);      sprintf(buf, "%s%d", notes[x % 12], x / 12 - 1);
222      spinbutton.set_text(buf);      spinbutton.set_text(buf);
# Line 227  ChoiceEntryLeverageCtrl::ChoiceEntryLeve Line 239  ChoiceEntryLeverageCtrl::ChoiceEntryLeve
239    
240  void ChoiceEntryLeverageCtrl::value_changed()  void ChoiceEntryLeverageCtrl::value_changed()
241  {  {
242      if (ptr && update_gui) {      if (ptr) {
243          int rowno = combobox.get_active_row_number();          int rowno = combobox.get_active_row_number();
244          switch (rowno)          switch (rowno)
245          {          {
# Line 256  void ChoiceEntryLeverageCtrl::value_chan Line 268  void ChoiceEntryLeverageCtrl::value_chan
268              }              }
269              break;              break;
270          }          }
271            if (rowno >= 0) sig_changed();
272      }      }
273  }  }
274    
# Line 306  BoolEntry::BoolEntry(const char* labelTe Line 319  BoolEntry::BoolEntry(const char* labelTe
319    
320  void BoolEntry::value_changed()  void BoolEntry::value_changed()
321  {  {
322      if (ptr && update_gui) {      if (ptr) {
323          *ptr = checkbutton.get_active();          *ptr = checkbutton.get_active();
324            sig_changed();
325      }      }
326  }  }
327    
# Line 328  StringEntry::StringEntry(const char* lab Line 342  StringEntry::StringEntry(const char* lab
342    
343  void StringEntry::value_changed()  void StringEntry::value_changed()
344  {  {
345      if (ptr && update_gui) {      if (ptr) {
346          *ptr = entry.get_text();          *ptr = entry.get_text();
347            sig_changed();
348      }      }
349  }  }
350    

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

  ViewVC Help
Powered by ViewVC