Update of /cvsroot/audacity/audacity-src/src/effects/nyquist
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv31538/effects/nyquist

Modified Files:
        Nyquist.cpp 
Log Message:
Fix Nyquist effect dialog for locales with comma as decimal separator

Index: Nyquist.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/nyquist/Nyquist.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- Nyquist.cpp 27 Jun 2007 04:27:09 -0000      1.54
+++ Nyquist.cpp 30 Jun 2007 11:02:58 -0000      1.55
@@ -109,9 +109,7 @@
       return ((WaveTrack *)iter.First())->GetRate();
    }
    else {
-      double d;
-      s.ToDouble(&d);
-      return d;
+      return Internat::CompatibleToDouble(s);
    }
 }
 
@@ -870,11 +868,11 @@
       wxString valStr;
       if (ctrl->type == NYQ_CTRL_REAL) {
          if (ctrl->high - ctrl->low < 1)
-            valStr.Printf(wxT("%.3f"), ctrl->val);
+            valStr = Internat::ToDisplayString(ctrl->val, 3);
          else if (ctrl->high - ctrl->low < 10)
-            valStr.Printf(wxT("%.2f"), ctrl->val);
+            valStr = Internat::ToDisplayString(ctrl->val, 2);
          else if (ctrl->high - ctrl->low < 100)
-            valStr.Printf(wxT("%.1f"), ctrl->val);
+            valStr = Internat::ToDisplayString(ctrl->val, 1);
          else
             valStr.Printf(wxT("%d"), (int)floor(ctrl->val + 0.5));
       }
@@ -926,14 +924,16 @@
       wxSlider *slider = (wxSlider *)FindWindow(ID_NYQ_SLIDER + ctrlId);
       wxASSERT(slider);
 
-      ctrl->valStr.ToDouble(&ctrl->val);
-      int pos = (int)floor((ctrl->val - ctrl->low) /
-                           (ctrl->high - ctrl->low) * ctrl->ticks + 0.5);
-      if (pos < 0)
-         pos = 0;
-      if (pos > ctrl->ticks)
-         pos = ctrl->ticks;
-      slider->SetValue(pos);
+      if (ctrl->valStr.ToDouble(&ctrl->val))
+      {
+         int pos = (int)floor((ctrl->val - ctrl->low) /
+                              (ctrl->high - ctrl->low) * ctrl->ticks + 0.5);
+         if (pos < 0)
+            pos = 0;
+         if (pos > ctrl->ticks)
+            pos = ctrl->ticks;
+         slider->SetValue(pos);
+      }
    }   
 
    mInHandler = false;   


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to