traverso-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Traverso-commit] traverso/src/commands Gain.cpp


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src/commands Gain.cpp
Date: Wed, 13 Feb 2008 10:25:25 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       08/02/13 10:25:25

Modified files:
        src/commands   : Gain.cpp 

Log message:
        * small improvement for numerical input

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/Gain.cpp?cvsroot=traverso&r1=1.26&r2=1.27

Patches:
Index: Gain.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/commands/Gain.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- Gain.cpp    12 Feb 2008 20:39:07 -0000      1.26
+++ Gain.cpp    13 Feb 2008 10:25:25 -0000      1.27
@@ -17,7 +17,7 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
 
-$Id: Gain.cpp,v 1.26 2008/02/12 20:39:07 r_sijrier Exp $
+$Id: Gain.cpp,v 1.27 2008/02/13 10:25:25 r_sijrier Exp $
 */
 
 #include "Gain.h"
@@ -149,10 +149,19 @@
        bool ok;
        float dbFactor = collected.toDouble(&ok);
        if (!ok) {
-               PWARN("collected is not a valid float number");
+               if (collected.contains(".") || collected.contains("-")) {
+                       QString s = collected;
+                       s.append(" dB");
+                       cpointer().get_viewport()->set_holdcursor_text(s);
+               }
                return;
        }
        
+       int rightfromdot = 0;
+       if (collected.contains(".")) {
+               rightfromdot = collected.size() - collected.lastIndexOf(".") - 
1;
+       }
+       
        newGain = dB_to_scale_factor(dbFactor);
        QMetaObject::invokeMethod(gainObject, "set_gain", Q_ARG(float, 
newGain));
        
@@ -161,7 +170,11 @@
        get_gain_from_object(newGain);
        
        // Update the vieport's hold cursor with the _actuall_ gain value!
-       
cpointer().get_viewport()->set_holdcursor_text(QByteArray::number(dbFactor, 
'f', collected.size()).append(" dB"));
+       if(rightfromdot) {
+               
cpointer().get_viewport()->set_holdcursor_text(QByteArray::number(dbFactor, 
'f', rightfromdot).append(" dB"));
+       } else {
+               
cpointer().get_viewport()->set_holdcursor_text(QByteArray::number(dbFactor).append("
 dB"));
+       }
 
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]