traverso-commit
[Top][All Lists]
Advanced

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

[Traverso-commit] traverso/src commands/commands.pro commands/Fad...


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src commands/commands.pro commands/Fad...
Date: Tue, 10 Apr 2007 19:37:58 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/04/10 19:37:57

Modified files:
        src/commands   : commands.pro Fade.cpp Gain.cpp 
        src/core       : Marker.cpp Marker.h ViewPort.cpp ViewPort.h 
        src/traverso/songcanvas: PositionIndicator.cpp SongView.cpp 
Added files:
        src/commands   : PlayHeadMove.cpp PlayHeadMove.h 
                         WorkCursorMove.cpp WorkCursorMove.h 

Log message:
        * move playhead/workcursor move classes to their own files
        * added positionindicators to both playhead, workcursor. Perhaps too 
much of the good ?

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/commands.pro?cvsroot=traverso&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/Fade.cpp?cvsroot=traverso&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/Gain.cpp?cvsroot=traverso&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/PlayHeadMove.cpp?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/PlayHeadMove.h?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/WorkCursorMove.cpp?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/WorkCursorMove.h?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Marker.cpp?cvsroot=traverso&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Marker.h?cvsroot=traverso&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ViewPort.cpp?cvsroot=traverso&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ViewPort.h?cvsroot=traverso&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/PositionIndicator.cpp?cvsroot=traverso&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/SongView.cpp?cvsroot=traverso&r1=1.38&r2=1.39

Patches:
Index: commands/commands.pro
===================================================================
RCS file: /sources/traverso/traverso/src/commands/commands.pro,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- commands/commands.pro       2 Apr 2007 09:52:31 -0000       1.16
+++ commands/commands.pro       10 Apr 2007 19:37:57 -0000      1.17
@@ -11,7 +11,9 @@
 TrackPan.cpp \
 Zoom.cpp \
 AudioClipExternalProcessing.cpp \
-ArmTracks.cpp
+ArmTracks.cpp \
+PlayHeadMove.cpp \
+WorkCursorMove.cpp
 HEADERS += AddRemove.h \
 ClipSelection.h \
 CommandGroup.h \
@@ -27,7 +29,9 @@
 TrackPan.h \
 Zoom.h \
 AudioClipExternalProcessing.h \
-ArmTracks.h
+ArmTracks.h \
+PlayHeadMove.h \
+WorkCursorMove.h
 TARGET = traversocommands
 DESTDIR = ../../lib
 TEMPLATE = lib

Index: commands/Fade.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/commands/Fade.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- commands/Fade.cpp   16 Mar 2007 00:09:43 -0000      1.9
+++ commands/Fade.cpp   10 Apr 2007 19:37:57 -0000      1.10
@@ -136,7 +136,7 @@
        Q_UNUSED(useY);
        
        mousePos = QCursor::pos();
-       cpointer().get_viewport()->set_hold_cursor(":/cursorHoldUd");
+       cpointer().get_viewport()->set_holdcursor(":/cursorHoldUd");
 }
 
 int FadeBend::jog()
@@ -193,7 +193,7 @@
        Q_UNUSED(useY);
        
        mousePos = QCursor::pos();      
-       cpointer().get_viewport()->set_hold_cursor(":/cursorHoldUd");
+       cpointer().get_viewport()->set_holdcursor(":/cursorHoldUd");
 }
 
 int FadeStrength::jog()

Index: commands/Gain.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/commands/Gain.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- commands/Gain.cpp   16 Mar 2007 00:09:43 -0000      1.10
+++ commands/Gain.cpp   10 Apr 2007 19:37:57 -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.cpp,v 1.10 2007/03/16 00:09:43 r_sijrier Exp $
+$Id: Gain.cpp,v 1.11 2007/04/10 19:37:57 r_sijrier Exp $
 */
 
 #include "Gain.h"
@@ -119,7 +119,7 @@
        Q_UNUSED(useY);
        
        mousePos = QCursor::pos();      
-       cpointer().get_viewport()->set_hold_cursor(":/cursorGain");
+       cpointer().get_viewport()->set_holdcursor(":/cursorGain");
 }
 
 
@@ -135,7 +135,7 @@
        get_gain_from_object(newGain);
        
        // Update the vieport's hold cursor with the _actuall_ gain value!
-       
cpointer().get_viewport()->set_hold_cursor_text(QByteArray::number(dbFactor, 
'f', 2).append(" dB"));
+       
cpointer().get_viewport()->set_holdcursor_text(QByteArray::number(dbFactor, 
'f', 2).append(" dB"));
 }
 
 void Gain::decrease_gain(bool autorepeat)
@@ -152,7 +152,7 @@
 
 
        // Update the vieport's hold cursor with the _actuall_ gain value!
-       
cpointer().get_viewport()->set_hold_cursor_text(QByteArray::number(dbFactor, 
'f', 2).append(" dB"));
+       
cpointer().get_viewport()->set_holdcursor_text(QByteArray::number(dbFactor, 
'f', 2).append(" dB"));
 }
 
 
@@ -180,7 +180,7 @@
        int result = get_gain_from_object(newGain);
        
        // Update the vieport's hold cursor!
-       
cpointer().get_viewport()->set_hold_cursor_text(QByteArray::number(dbFactor, 
'f', 2).append(" dB"));
+       
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!

Index: core/Marker.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Marker.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- core/Marker.cpp     31 Mar 2007 03:53:27 -0000      1.8
+++ core/Marker.cpp     10 Apr 2007 19:37:57 -0000      1.9
@@ -141,38 +141,22 @@
 
 void Marker::set_preemphasis(bool b)
 {
-       if (b) {
-               m_preemph = 1;
-       } else {
-               m_preemph = 0;
-       }
+       m_preemph = b;
 }
 
 void Marker::set_copyprotect(bool b)
 {
-       if (b) {
-               m_copyprotect = 1;
-       } else {
-               m_copyprotect = 0;
-       }
+       m_copyprotect = b;
 }
 
 bool Marker::get_preemphasis()
 {
-       if (m_preemph) {
-               return true;
-       } else {
-               return false;
-       }
+       return m_preemph;
 }
 
 bool Marker::get_copyprotect()
 {
-       if (m_copyprotect) {
-               return true;
-       } else {
-               return false;
-       }
+       return m_copyprotect;
 }
 
 //eof

Index: core/Marker.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Marker.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- core/Marker.h       31 Mar 2007 03:53:27 -0000      1.7
+++ core/Marker.h       10 Apr 2007 19:37:57 -0000      1.8
@@ -75,7 +75,7 @@
                m_arranger,
                m_message,
                m_isrc;
-       int     m_preemph,
+       bool    m_preemph,
                m_copyprotect;
        uint    m_type;
        

Index: core/ViewPort.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/ViewPort.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- core/ViewPort.cpp   16 Mar 2007 00:14:43 -0000      1.8
+++ core/ViewPort.cpp   10 Apr 2007 19:37:57 -0000      1.9
@@ -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: ViewPort.cpp,v 1.8 2007/03/16 00:14:43 r_sijrier Exp $
+$Id: ViewPort.cpp,v 1.9 2007/04/10 19:37:57 r_sijrier Exp $
 */
 
 #include <QMouseEvent>
@@ -117,7 +117,7 @@
        // a mouse move event, while the mouse really move, so we check
        // if the mouse cursor really has changed position!
        if (e->pos() == m_oldMousePos) {
-               return;
+//             return;
        }
        m_oldMousePos = e->pos();
        QGraphicsView::mouseMoveEvent(e);
@@ -192,7 +192,7 @@
        m_holdcursor->reset();
 }
 
-void ViewPort::set_hold_cursor( const QString & cursorName )
+void ViewPort::set_holdcursor( const QString & cursorName )
 {
        viewport()->setCursor(Qt::BlankCursor);
        
@@ -201,11 +201,16 @@
        m_holdcursor->show();
 }
 
-void ViewPort::set_hold_cursor_text( const QString & text )
+void ViewPort::set_holdcursor_text( const QString & text )
 {
        m_holdcursor->set_text(text);
 }
 
+void ViewPort::set_holdcursor_pos(QPoint pos)
+{
+       m_holdcursor->setPos(pos);
+}
+
 
 
 /**********************************************************************/

Index: core/ViewPort.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/ViewPort.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- core/ViewPort.h     16 Mar 2007 00:14:43 -0000      1.10
+++ core/ViewPort.h     10 Apr 2007 19:37:57 -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: ViewPort.h,v 1.10 2007/03/16 00:14:43 r_sijrier Exp $
+    $Id: ViewPort.h,v 1.11 2007/04/10 19:37:57 r_sijrier Exp $
 */
 
 #ifndef VIEWPORT_H
@@ -46,8 +46,9 @@
         virtual void get_pointed_context_items(QList<ContextItem* > &list) = 0;
 
         // Set functions
-       void set_hold_cursor(const QString& cursorName);
-       void set_hold_cursor_text(const QString& text);
+       void set_holdcursor(const QString& cursorName);
+       void set_holdcursor_text(const QString& text);
+       void set_holdcursor_pos(QPoint pos);
         
        void reset_cursor();
 

Index: traverso/songcanvas/PositionIndicator.cpp
===================================================================
RCS file: 
/sources/traverso/traverso/src/traverso/songcanvas/PositionIndicator.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- traverso/songcanvas/PositionIndicator.cpp   10 Apr 2007 17:11:48 -0000      
1.1
+++ traverso/songcanvas/PositionIndicator.cpp   10 Apr 2007 19:37:57 -0000      
1.2
@@ -30,6 +30,7 @@
        : ViewItem(parentView, 0)
 {
        calculate_bounding_rect();
+       setZValue(100);
 }
 
 void PositionIndicator::paint(QPainter * painter, const 
QStyleOptionGraphicsItem * option, QWidget * widget)

Index: traverso/songcanvas/SongView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/SongView.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- traverso/songcanvas/SongView.cpp    6 Apr 2007 10:16:13 -0000       1.38
+++ traverso/songcanvas/SongView.cpp    10 Apr 2007 19:37:57 -0000      1.39
@@ -40,6 +40,8 @@
 #include <SnapList.h>
 #include <ContextPointer.h>
 #include <Zoom.h>
+#include <PlayHeadMove.h>
+#include <WorkCursorMove.h>
                
 #include <Debugger.h>
 
@@ -69,144 +71,6 @@
 };
 
 
-class PlayHeadMove : public Command
-{
-public :
-        PlayHeadMove(PlayHead* cursor, SongView* sv);
-        ~PlayHeadMove(){PENTERDES;};
-
-       int finish_hold();
-        int begin_hold();
-        int jog();
-
-private :
-       PlayHead*       m_cursor;
-       Song*           m_song;
-       SongView*       m_sv;
-       bool            m_resync;
-};
-
-PlayHeadMove::PlayHeadMove(PlayHead* cursor, SongView* sv)
-       : Command("Play Cursor Move")
-       , m_cursor(cursor)
-       , m_song(sv->get_song())
-       , m_sv(sv)
-{
-       m_resync = config().get_property("AudioClip", "SyncDuringDrag", 
false).toBool();
-}
-
-int PlayHeadMove::finish_hold()
-{
-       int x = cpointer().scene_x();
-       if (x < 0) {
-               x = 0;
-       }
-       m_cursor->set_active(m_song->is_transporting());
-       m_song->set_transport_pos( (nframes_t) (x * m_sv->scalefactor));
-       m_sv->start_shuttle(true);
-       return -1;
-}
-
-int PlayHeadMove::begin_hold()
-{
-       m_cursor->show();
-       m_cursor->set_active(false);
-       m_sv->start_shuttle(true, true);
-       return 1;
-}
-
-int PlayHeadMove::jog()
-{
-       int x = cpointer().scene_x();
-       if (x < 0) {
-               x = 0;
-       }
-       m_cursor->setPos(x, 0);
-       if (m_resync && m_song->is_transporting()) {
-               m_song->set_transport_pos( (nframes_t) (x * m_sv->scalefactor));
-       }
-       
-       m_sv->update_shuttle_factor();
-       
-       return 1;
-}
-
-
-               
-class WorkCursorMove : public Command
-{
-public :
-        WorkCursorMove (PlayHead* cursor, SongView* sv);
-        ~WorkCursorMove (){PENTERDES;};
-
-       int finish_hold();
-        int begin_hold();
-        int jog();
-
-private :
-       Song*           m_song;
-       SongView*       m_sv;
-       PlayHead*       m_playCursor;
-};
-
-WorkCursorMove::WorkCursorMove(PlayHead* cursor, SongView* sv)
-       : Command("Play Cursor Move")
-       , m_song(sv->get_song())
-       , m_sv(sv)
-       , m_playCursor(cursor)
-{
-}
-
-int WorkCursorMove::finish_hold()
-{
-       int x = cpointer().scene_x();
-
-       if (x < 0) {
-               x = 0;
-       }
-
-       m_song->get_work_snap()->set_snappable(true);
-
-       if (!m_song->is_transporting()) {
-               m_playCursor->setPos(x, 0);
-               m_song->set_transport_pos( (nframes_t) (x * m_sv->scalefactor));
-       }
-       m_sv->start_shuttle(false);
-       return -1;
-}
-
-int WorkCursorMove::begin_hold()
-{
-       if (m_song->is_transporting()) {
-               m_playCursor->disable_follow();
-       }
-       m_song->get_work_snap()->set_snappable(false);
-       m_sv->start_shuttle(true, true);
-       return 1;
-}
-
-int WorkCursorMove::jog()
-{
-       int x = cpointer().scene_x();
-
-       if (x < 0) {
-               x = 0;
-       }
-
-       nframes_t newFrame = x * m_sv->scalefactor;
-
-       if (m_song->is_snap_on()) {
-               SnapList* slist = m_song->get_snap_list();
-               newFrame = slist->get_snap_value(newFrame);
-       }
-
-       m_song->set_work_at(newFrame);
-
-       m_sv->update_shuttle_factor();
-       return 1;
-}
-
-
                
 SongView::SongView(SongWidget* songwidget, 
                        ClipsViewPort* viewPort, 

Index: commands/PlayHeadMove.cpp
===================================================================
RCS file: commands/PlayHeadMove.cpp
diff -N commands/PlayHeadMove.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ commands/PlayHeadMove.cpp   10 Apr 2007 19:37:57 -0000      1.1
@@ -0,0 +1,88 @@
+/*
+    Copyright (C) 2007 Remon Sijrier 
+ 
+    This file is part of Traverso
+ 
+    Traverso is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+ 
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+ 
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
+ 
+*/
+
+#include "PlayHeadMove.h"
+
+#include <libtraversocore.h>
+#include <SongView.h>
+#include <Cursors.h>
+
+#include <Debugger.h>
+
+PlayHeadMove::PlayHeadMove(PlayHead* cursor, SongView* sv)
+       : Command("Play Cursor Move")
+       , m_cursor(cursor)
+       , m_song(sv->get_song())
+       , m_sv(sv)
+{
+       m_resync = config().get_property("AudioClip", "SyncDuringDrag", 
false).toBool();
+}
+
+int PlayHeadMove::finish_hold()
+{
+       int x = cpointer().scene_x();
+       if (x < 0) {
+               x = 0;
+       }
+       m_cursor->set_active(m_song->is_transporting());
+       m_song->set_transport_pos( (nframes_t) (x * m_sv->scalefactor));
+       m_sv->start_shuttle(true);
+       return -1;
+}
+
+int PlayHeadMove::begin_hold()
+{
+       m_cursor->show();
+       m_cursor->set_active(false);
+       m_sv->start_shuttle(true, true);
+       return 1;
+}
+
+void PlayHeadMove::set_cursor_shape(int useX, int useY)
+{
+       Q_UNUSED(useX);
+       Q_UNUSED(useY);
+       
+       cpointer().get_viewport()->set_holdcursor(":/cursorHoldLr");
+}
+
+int PlayHeadMove::jog()
+{
+       int x = cpointer().scene_x();
+       if (x < 0) {
+               x = 0;
+       }
+       m_cursor->setPos(x, 0);
+       
+       nframes_t newpos = (nframes_t) (x * m_sv->scalefactor);
+       if (m_resync && m_song->is_transporting()) {
+               m_song->set_transport_pos(newpos);
+       }
+       
+       m_sv->update_shuttle_factor();
+       cpointer().get_viewport()->set_holdcursor_text(frame_to_smpte(newpos, 
m_song->get_rate()));
+       // Hmm, the alignment of the holdcursor isn't in the center, so we have 
to 
+       // substract half the width of it to make it appear centered... :-(
+       
cpointer().get_viewport()->set_holdcursor_pos(QPoint(cpointer().scene_x() - 16, 
cpointer().scene_y()));
+       
+       return 1;
+}
+

Index: commands/PlayHeadMove.h
===================================================================
RCS file: commands/PlayHeadMove.h
diff -N commands/PlayHeadMove.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ commands/PlayHeadMove.h     10 Apr 2007 19:37:57 -0000      1.1
@@ -0,0 +1,50 @@
+/*
+    Copyright (C) 2007 Remon Sijrier 
+ 
+    This file is part of Traverso
+ 
+    Traverso is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+ 
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+ 
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
+ 
+*/
+
+#ifndef PLAYHEAD_MOVE_H
+#define PLAYHEAD_MOVE_H
+
+#include <Command.h>
+
+class Song;
+class SongView;
+class PlayHead;
+
+class PlayHeadMove : public Command
+{
+public :
+       PlayHeadMove(PlayHead* cursor, SongView* sv);
+       ~PlayHeadMove(){};
+
+       int finish_hold();
+       int begin_hold();
+       int jog();
+
+       void set_cursor_shape(int useX, int useY);
+
+private :
+       PlayHead*       m_cursor;
+       Song*           m_song;
+       SongView*       m_sv;
+       bool            m_resync;
+};
+
+#endif

Index: commands/WorkCursorMove.cpp
===================================================================
RCS file: commands/WorkCursorMove.cpp
diff -N commands/WorkCursorMove.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ commands/WorkCursorMove.cpp 10 Apr 2007 19:37:57 -0000      1.1
@@ -0,0 +1,99 @@
+/*
+    Copyright (C) 2007 Remon Sijrier 
+ 
+    This file is part of Traverso
+ 
+    Traverso is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+ 
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+ 
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
+ 
+*/
+
+#include "WorkCursorMove.h"
+
+#include <libtraversocore.h>
+#include <SongView.h>
+#include <Cursors.h>
+
+#include <Debugger.h>
+
+WorkCursorMove::WorkCursorMove(PlayHead* cursor, SongView* sv)
+       : Command("Play Cursor Move")
+       , m_song(sv->get_song())
+       , m_sv(sv)
+       , m_playCursor(cursor)
+{
+}
+
+int WorkCursorMove::finish_hold()
+{
+       int x = cpointer().scene_x();
+
+       if (x < 0) {
+               x = 0;
+       }
+
+       m_song->get_work_snap()->set_snappable(true);
+
+       if (!m_song->is_transporting()) {
+               m_playCursor->setPos(x, 0);
+               m_song->set_transport_pos( (nframes_t) (x * m_sv->scalefactor));
+       }
+       m_sv->start_shuttle(false);
+       return -1;
+}
+
+int WorkCursorMove::begin_hold()
+{
+       if (m_song->is_transporting()) {
+               m_playCursor->disable_follow();
+       }
+       m_song->get_work_snap()->set_snappable(false);
+       m_sv->start_shuttle(true, true);
+       return 1;
+}
+
+void WorkCursorMove::set_cursor_shape(int useX, int useY)
+{
+       Q_UNUSED(useX);
+       Q_UNUSED(useY);
+       
+       cpointer().get_viewport()->set_holdcursor(":/cursorHoldLr");
+}
+
+int WorkCursorMove::jog()
+{
+       int x = cpointer().scene_x();
+
+       if (x < 0) {
+               x = 0;
+       }
+
+       nframes_t newFrame = x * m_sv->scalefactor;
+
+       if (m_song->is_snap_on()) {
+               SnapList* slist = m_song->get_snap_list();
+               newFrame = slist->get_snap_value(newFrame);
+       }
+
+       m_song->set_work_at(newFrame);
+
+       m_sv->update_shuttle_factor();
+       cpointer().get_viewport()->set_holdcursor_text(frame_to_smpte(newFrame, 
m_song->get_rate()));
+       // Hmm, the alignment of the holdcursor isn't in the center, so we have 
to 
+       // substract half the width of it to make it appear centered... :-(
+       
cpointer().get_viewport()->set_holdcursor_pos(QPoint(cpointer().scene_x() - 16, 
cpointer().scene_y()));
+       
+       return 1;
+}
+

Index: commands/WorkCursorMove.h
===================================================================
RCS file: commands/WorkCursorMove.h
diff -N commands/WorkCursorMove.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ commands/WorkCursorMove.h   10 Apr 2007 19:37:57 -0000      1.1
@@ -0,0 +1,49 @@
+/*
+    Copyright (C) 2007 Remon Sijrier 
+ 
+    This file is part of Traverso
+ 
+    Traverso is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+ 
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+ 
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
+ 
+*/
+
+#ifndef WORKCURSOR_MOVE_H
+#define WORKCURSOR_MOVE_H
+
+#include <Command.h>
+
+class Song;
+class SongView;
+class PlayHead;
+
+class WorkCursorMove : public Command
+{
+public :
+       WorkCursorMove (PlayHead* cursor, SongView* sv);
+       ~WorkCursorMove (){};
+
+       int finish_hold();
+       int begin_hold();
+       int jog();
+
+       void set_cursor_shape(int useX, int useY);
+
+private :
+       Song*           m_song;
+       SongView*       m_sv;
+       PlayHead*       m_playCursor;
+};
+
+#endif




reply via email to

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