traverso-commit
[Top][All Lists]
Advanced

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

[Traverso-commit] traverso/src commands/MoveClip.cpp commands/Mov...


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src commands/MoveClip.cpp commands/Mov...
Date: Tue, 12 Feb 2008 15:09:36 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       08/02/12 15:09:36

Modified files:
        src/commands   : MoveClip.cpp MoveClip.h 
        src/core       : ViewPort.cpp ViewPort.h 
        src/sheetcanvas: AudioClipView.cpp AudioClipView.h TrackView.h 

Log message:
        * remove PosIndicator in AudioClipView, and use the hold cursor text 
feature instead. Cleanups, and small improvements on the hold cursor text

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/MoveClip.cpp?cvsroot=traverso&r1=1.60&r2=1.61
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/MoveClip.h?cvsroot=traverso&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ViewPort.cpp?cvsroot=traverso&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ViewPort.h?cvsroot=traverso&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/traverso/src/sheetcanvas/AudioClipView.cpp?cvsroot=traverso&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/traverso/src/sheetcanvas/AudioClipView.h?cvsroot=traverso&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/traverso/src/sheetcanvas/TrackView.h?cvsroot=traverso&r1=1.1&r2=1.2

Patches:
Index: commands/MoveClip.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/commands/MoveClip.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- commands/MoveClip.cpp       12 Feb 2008 13:05:02 -0000      1.60
+++ commands/MoveClip.cpp       12 Feb 2008 15:09:35 -0000      1.61
@@ -116,7 +116,6 @@
        d->origPos = QPointF(d->origXPos, 
cpointer().on_first_input_event_scene_y());
        d->sv->start_shuttle(true, true);
        d->bypassjog = false;
-       d->origTrackView = d->view->get_trackview();
 }
 
 
@@ -267,6 +266,8 @@
        d->sv->update_shuttle_factor();
        
        
cpointer().get_viewport()->set_holdcursor_pos(d->sv->get_clips_viewport()->mapToScene(cpointer().pos()).toPoint());
+       
cpointer().get_viewport()->set_holdcursor_text(timeref_to_text(newTrackStartLocation,
 d->sv->timeref_scalefactor));
+
 
        return 1;
 }

Index: commands/MoveClip.h
===================================================================
RCS file: /sources/traverso/traverso/src/commands/MoveClip.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- commands/MoveClip.h 12 Feb 2008 11:46:52 -0000      1.25
+++ commands/MoveClip.h 12 Feb 2008 15:09:35 -0000      1.26
@@ -31,7 +31,6 @@
 class Sheet;
 class Track;
 class SheetView;
-class TrackView;
 class AudioClipView;
 class Zoom;
 
@@ -70,7 +69,6 @@
                TimeRef         xoffset;
                SheetView*      sv;
                AudioClipView*  view;
-               TrackView*      origTrackView;
                QPointF         origPos;
                TimeRef         origTrackEndLocation;
                bool            resync;

Index: core/ViewPort.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/ViewPort.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- core/ViewPort.cpp   12 Feb 2008 13:05:03 -0000      1.31
+++ core/ViewPort.cpp   12 Feb 2008 15:09:36 -0000      1.32
@@ -102,7 +102,7 @@
        setOptimizationFlag(DontClipPainter);
 #endif
 
-       m_holdcursor = new HoldCursor();
+       m_holdcursor = new HoldCursor(this);
        scene->addItem(m_holdcursor);
        m_holdcursor->hide();
        // m_holdCursorActive is a replacement for m_holdcursor->isVisible()
@@ -285,7 +285,7 @@
 
 void ViewPort::set_holdcursor_pos(QPoint pos)
 {
-       m_holdcursor->setPos(pos);
+       m_holdcursor->set_pos(pos);
 }
 
 void ViewPort::set_current_mode(int mode)
@@ -300,9 +300,12 @@
 /**********************************************************************/
 
 
-HoldCursor::HoldCursor()
+HoldCursor::HoldCursor(ViewPort* vp)
+       : m_vp(vp)
 {
-       setFlag(QGraphicsItem::ItemIgnoresTransformations);
+       m_textItem = new QGraphicsTextItem(this);
+       
m_textItem->setFont(themer()->get_font("ViewPort:fontscale:infocursor"));
+
        setZValue(200);
 }
 
@@ -315,24 +318,22 @@
        Q_UNUSED(widget);
        Q_UNUSED(option);
 
-       
        painter->drawPixmap(0, 0, m_pixmap);
-       
-       if (!m_text.isEmpty()) {
-               QFontMetrics 
fm(themer()->get_font("ViewPort:fontscale:infocursor"));
-               int width = fm.width(m_text) + 8;
-               int height = fm.height();
-               QRect textArea = QRect(m_pixmap.width() + 10, m_pixmap.height() 
/ 4, width, height);
-               
painter->setFont(themer()->get_font("ViewPort:fontscale:infocursor"));
-               painter->fillRect(textArea, QBrush(Qt::white));
-               painter->drawText(textArea, Qt::AlignCenter, m_text);
-       }
 }
 
 
 void HoldCursor::set_text( const QString & text )
 {
        m_text = text;
+       
+       if (!m_text.isEmpty()) {
+               m_textItem->show();
+       } else {
+               m_textItem->hide();
+       }
+       QString html = "<html><body bgcolor=ghostwhite>" + m_text + 
"</body></html>";
+       m_textItem->setHtml(html);
+       
        update();
 }
 
@@ -354,4 +355,29 @@
        m_text = "";
 }
 
+void HoldCursor::set_pos(QPoint p)
+{
+       int x = m_vp->mapFromScene(pos()).x();
+       int y = m_vp->mapFromScene(pos()).y();
+       int yoffset = 0;
+       
+       if (y < 0) {
+               yoffset = - y;
+       } else if (y > m_vp->height() - m_pixmap.height()) {
+               yoffset = m_vp->height() - y - m_pixmap.height();
+       }
+       
+       int diff = m_vp->width() - (x + m_pixmap.width() + 8);
+       
+       if (diff < m_textItem->boundingRect().width()) {
+               m_textItem->setPos(diff - m_pixmap.width(), yoffset);
+       } else if (x < -m_pixmap.width()) {
+               m_textItem->setPos(8 - x, yoffset);
+       } else {
+               m_textItem->setPos(m_pixmap.width() + 8, yoffset);
+       }
+       
+       setPos(p);
+}
+
 

Index: core/ViewPort.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/ViewPort.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- core/ViewPort.h     9 Feb 2008 21:32:52 -0000       1.17
+++ core/ViewPort.h     12 Feb 2008 15:09:36 -0000      1.18
@@ -31,6 +31,7 @@
 class Import;
 class Track;
 class HoldCursor;
+class QGraphicsTextItem;
 
 class ViewPort : public QGraphicsView
 {
@@ -86,18 +87,21 @@
 {
        Q_OBJECT
 public:
-       HoldCursor();
+       HoldCursor(ViewPort* vp);
        ~HoldCursor();
 
        void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
 
        void set_text(const QString& text);
        void set_type(const QString& type);
+       void set_pos(QPoint pos);
        void reset();
 
        QRectF boundingRect() const;
 
 private:
+       ViewPort*       m_vp;
+       QGraphicsTextItem* m_textItem;
        QPoint          m_pos;
        QPixmap         m_pixmap;
        QString         m_text;

Index: sheetcanvas/AudioClipView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/sheetcanvas/AudioClipView.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- sheetcanvas/AudioClipView.cpp       12 Feb 2008 13:05:03 -0000      1.6
+++ sheetcanvas/AudioClipView.cpp       12 Feb 2008 15:09:36 -0000      1.7
@@ -29,7 +29,6 @@
 #include "TrackView.h"
 #include "FadeView.h"
 #include "CurveView.h"
-#include "PositionIndicator.h"
 
 #include "AudioClip.h"
 #include "ReadSource.h"
@@ -79,7 +78,6 @@
 
        m_waitingForPeaks = false;
        m_progress = 0;
-       m_posIndicator = 0;
        
        if (FadeCurve* curve = m_clip->get_fade_in()) {
                add_new_fadeview(curve);
@@ -219,22 +217,6 @@
                painter->drawPixmap(center - 8, m_height - 20, 
find_pixmap(":/lock"));
        }
 
-       if (m_clip->is_moving()) {
-               if (! m_posIndicator) {
-                       m_posIndicator = new PositionIndicator(this);
-                       m_posIndicator->set_position(2, 
get_childview_y_offset() + 1);
-               }
-               m_posIndicator->show();
-               m_posIndicator->set_value(timeref_to_text(TimeRef(x() * 
m_sv->timeref_scalefactor), m_sv->timeref_scalefactor));
-       } else {
-               if (m_posIndicator && m_posIndicator->isVisible()) {
-                       m_posIndicator->hide();
-/*                     scene()->removeItem(m_posIndicator);
-                       delete m_posIndicator;
-                       m_posIndicator = 0;*/
-               }
-       }
-       
        painter->restore();
 }
 
@@ -722,11 +704,6 @@
        update();
 }
 
-AudioClip * AudioClipView::get_clip( )
-{
-       return m_clip;
-}
-
 void AudioClipView::add_new_fadeview( FadeCurve * fade )
 {
        PENTER;
@@ -956,15 +933,6 @@
        return ie().did_not_implement();
 }
 
-void AudioClipView::set_trackview(TrackView * view)
-{
-       if (m_posIndicator) {
-               m_posIndicator->update();
-       }
-       m_tv = view;
-       setParentItem(m_tv);
-}
-
 Command * AudioClipView::edit_properties()
 {
        AudioClipEditDialog editdialog(m_clip, Interface::instance());

Index: sheetcanvas/AudioClipView.h
===================================================================
RCS file: /sources/traverso/traverso/src/sheetcanvas/AudioClipView.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- sheetcanvas/AudioClipView.h 12 Feb 2008 13:05:03 -0000      1.2
+++ sheetcanvas/AudioClipView.h 12 Feb 2008 15:09:36 -0000      1.3
@@ -36,7 +36,6 @@
 class TrackView;
 class FadeView;
 class Peak;
-class PositionIndicator;
 class QGraphicsSimpleTextItem;
 
 class AudioClipView : public ViewItem
@@ -55,23 +54,15 @@
        AudioClipView(SheetView* view, TrackView* parent, AudioClip* clip);
        ~AudioClipView();
 
-       enum {Type = UserType + 1};
-       int type() const;
-
-       
        void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
        
        void set_height(int height);
        
-       AudioClip* get_clip();
+       AudioClip* get_clip() const {return m_clip;}
        int get_height() const;
        int get_childview_y_offset() const;
        
        void calculate_bounding_rect();
-       
-       TrackView* get_trackview() const {return m_tv;}
-       void set_trackview(TrackView* view);
-       
        void load_theme_data();
        
 protected:
@@ -83,7 +74,6 @@
        AudioClip*      m_clip;
        Sheet*          m_sheet;
        CurveView*      curveView;
-       PositionIndicator* m_posIndicator;
        QPolygonF m_polygon;
        QGraphicsSimpleTextItem* m_clipInfo;
        
@@ -175,10 +165,6 @@
        return height;
 }
 
-inline int AudioClipView::type() const {return Type;}
-
-
-
 #endif
 
 //eof

Index: sheetcanvas/TrackView.h
===================================================================
RCS file: /sources/traverso/traverso/src/sheetcanvas/TrackView.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- sheetcanvas/TrackView.h     21 Jan 2008 16:17:31 -0000      1.1
+++ sheetcanvas/TrackView.h     12 Feb 2008 15:09:36 -0000      1.2
@@ -42,8 +42,6 @@
        TrackView(SheetView* sv, Track* track);
        ~TrackView();
        
-       enum {Type = UserType + 2};
-       
        void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
        
        Track* get_track() const;




reply via email to

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