traverso-commit
[Top][All Lists]
Advanced

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

[Traverso-commit] traverso resources/keymap.xml src/commands/Gain...


From: Ben Levitt
Subject: [Traverso-commit] traverso resources/keymap.xml src/commands/Gain...
Date: Thu, 12 Apr 2007 18:28:39 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Ben Levitt <benjie>     07/04/12 18:28:39

Modified files:
        resources      : keymap.xml 
        src/commands   : Gain.cpp Gain.h 

Log message:
        Add horizontal gain adjustment for using track panel gain sliders

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/resources/keymap.xml?cvsroot=traverso&r1=1.55&r2=1.56
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/Gain.cpp?cvsroot=traverso&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/Gain.h?cvsroot=traverso&r1=1.10&r2=1.11

Patches:
Index: resources/keymap.xml
===================================================================
RCS file: /sources/traverso/traverso/resources/keymap.xml,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- resources/keymap.xml        12 Apr 2007 18:08:26 -0000      1.55
+++ resources/keymap.xml        12 Apr 2007 18:28:39 -0000      1.56
@@ -344,7 +344,7 @@
                                <Object objectname="CurveView" mousehint="LRUD" 
slotsignature="drag_node" modes="Effects" sortorder="3" instantanious="1" />
                                <Object objectname="TimeLineView" 
mousehint="LR" slotsignature="drag_marker" modes="All" sortorder="3" 
instantanious="1" />
                                <Object objectname="SongView" mousehint="LR" 
slotsignature="work_cursor_move" modes="All" sortorder="14" instantanious="0" />
-                               <Object objectname="TrackPanelGain" modes="All" 
sortorder="7" pluginname="TraversoCommands" commandname="Gain" />
+                               <Object objectname="TrackPanelGain" modes="All" 
sortorder="7" pluginname="TraversoCommands" commandname="Gain" 
arguments="horizontal" />
                                <Object objectname="TrackPanelPan" 
mousehint="LR"  modes="All" sortorder="8" pluginname="TraversoCommands" 
commandname="TrackPan" />
                        </Objects>
                </keyfact> 

Index: src/commands/Gain.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/commands/Gain.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- src/commands/Gain.cpp       12 Apr 2007 15:30:59 -0000      1.13
+++ src/commands/Gain.cpp       12 Apr 2007 18:28:39 -0000      1.14
@@ -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.13 2007/04/12 15:30:59 r_sijrier Exp $
+$Id: Gain.cpp,v 1.14 2007/04/12 18:28:39 benjie Exp $
 */
 
 #include "Gain.h"
@@ -37,17 +37,22 @@
        : Command(context, "")
 {
        gainObject = context;
+       horiz = false;
        
        float gain = -1;
        QString des = "";
        
-       if (args.size() > 0) {
+       if (args.size() > 0 && args[0].toString() != "horizontal") {
                gain = args.at(0).toDouble();
                des = QString(context->metaObject()->className()) + ": Reset 
gain";
        } else {
                des = QString(context->metaObject()->className()) + " Gain";
        }
        
+       if (args.size() > 0 && args[0].toString() == "horizontal") {
+               horiz = true;
+       }
+       
        setText(des);
        
        if (gain >= 0) {
@@ -80,7 +85,7 @@
                return -1;
        }
        newGain = origGain;
-       origY = cpointer().y();
+       origPos = QPoint(cpointer().on_first_input_event_x(), 
cpointer().on_first_input_event_y());
        return 1;
 }
 
@@ -119,7 +124,11 @@
        Q_UNUSED(useY);
        
        mousePos = QCursor::pos();
+       if (horiz) {
+               cpointer().get_viewport()->set_holdcursor(":/cursorHoldLr");
+       } else {
        cpointer().get_viewport()->set_holdcursor(":/cursorGain");
+       }
 }
 
 
@@ -130,12 +139,14 @@
        newGain = dB_to_scale_factor(dbFactor);
        QMetaObject::invokeMethod(gainObject, "set_gain", Q_ARG(float, 
newGain));
        
+       if (!horiz) {
        // now we get the new gain value from gainObject, since we don't know 
if 
        // gainobject accepted the change or not!
        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', 2).append(" dB"));
+       }
 }
 
 void Gain::decrease_gain(bool autorepeat)
@@ -146,31 +157,41 @@
        
        QMetaObject::invokeMethod(gainObject, "set_gain", Q_ARG(float, 
newGain));
        
+       if (!horiz) {
        // now we get the new gain value from gainObject, since we don't know 
if 
        // gainobject accepted the change or not!
        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', 2).append(" dB"));
+       }
 }
 
 
 int Gain::jog()
 {
        PENTER;
-       float ofy = 0;
+       float of = 0;
        
        float dbFactor = coefficient_to_dB(newGain);
        
-       if (dbFactor > -1)
-               ofy = (origY - cpointer().y()) * 0.05;
+       int diff;
+
+       if (horiz) {
+               diff = cpointer().x() - origPos.x();
+       } else {
+               diff = origPos.y() - cpointer().y();
+       }
+
+       if (dbFactor > -1) {
+               of = diff * 0.05;
+       }
        if (dbFactor <= -1) {
-               ofy = (origY - cpointer().y()) * ((1 - 
dB_to_scale_factor(dbFactor)) / 3);
+               of = diff * ((1 - dB_to_scale_factor(dbFactor)) / 3);
        }
                
                
-       newGain = dB_to_scale_factor( dbFactor + ofy );
+       newGain = dB_to_scale_factor( dbFactor + of );
        
        // Set the gain for gainObject
        QMetaObject::invokeMethod(gainObject, "set_gain", Q_ARG(float, 
newGain));
@@ -180,13 +201,15 @@
        int result = get_gain_from_object(newGain);
        
        // Update the vieport's hold cursor!
+       if (!horiz) {
        
cpointer().get_viewport()->set_holdcursor_text(QByteArray::number(dbFactor, 
'f', 2).append(" dB"));
+       }
        
        // Set the mouse cursor back to the original position, so it doesn't 
leave the 
        // object we're working on!
        // This avoids highlighting of other objects !!
        // Note that due this, we don't have to set the origY variable in this 
funcion!!
-       origY = cpointer().y();
+       origPos = cpointer().pos();
        
        return result;
 }

Index: src/commands/Gain.h
===================================================================
RCS file: /sources/traverso/traverso/src/commands/Gain.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- src/commands/Gain.h 16 Mar 2007 14:23:39 -0000      1.10
+++ src/commands/Gain.h 12 Apr 2007 18:28:39 -0000      1.11
@@ -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.h,v 1.10 2007/03/16 14:23:39 r_sijrier Exp $
+    $Id: Gain.h,v 1.11 2007/04/12 18:28:39 benjie Exp $
 */
 
 #ifndef GAIN_H
@@ -54,8 +54,9 @@
        ContextItem*    gainObject;
         float          origGain;
         float          newGain;
-        int            origY;
+        QPoint                 origPos;
        QPoint          mousePos;
+       bool            horiz;
        
        int get_gain_from_object(float& gain);
        




reply via email to

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