traverso-commit
[Top][All Lists]
Advanced

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

[Traverso-commit] traverso/src commands/SplitClip.cpp commands/Sp...


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src commands/SplitClip.cpp commands/Sp...
Date: Sat, 19 May 2007 19:30:11 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/05/19 19:30:11

Modified files:
        src/commands   : SplitClip.cpp SplitClip.h 
        src/traverso/songcanvas: MarkerView.cpp MarkerView.h 
                                 songcanvas.pro 
Added files:
        src/traverso/songcanvas: LineView.h 

Log message:
        * Moved helper SplitCursor to LineView
        * Use LineView to paint MarkerViews line
        * Always show MarkerViews line

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/SplitClip.cpp?cvsroot=traverso&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/SplitClip.h?cvsroot=traverso&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/MarkerView.cpp?cvsroot=traverso&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/MarkerView.h?cvsroot=traverso&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/songcanvas.pro?cvsroot=traverso&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/LineView.h?cvsroot=traverso&rev=1.1

Patches:
Index: commands/SplitClip.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/commands/SplitClip.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- commands/SplitClip.cpp      17 May 2007 22:50:22 -0000      1.30
+++ commands/SplitClip.cpp      19 May 2007 19:30:11 -0000      1.31
@@ -24,6 +24,7 @@
 #include <libtraversocore.h>
 #include <SongView.h>
 #include <AudioClipView.h>
+#include "LineView.h"
 #include <ViewItem.h>
 #include "Fade.h"
 
@@ -31,25 +32,6 @@
 // in case we run with memory leak detection enabled!
 #include "Debugger.h"
 
-class SplitCursor : public ViewItem
-{
-       Q_OBJECT
-public:
-               
-       SplitCursor(ViewItem* parent)
-       : ViewItem(parent, 0) 
-       {
-               setZValue(parent->zValue() + 1);
-               m_boundingRect = QRectF(0, 0, 1, 
parent->boundingRect().height());
-       }
-       void paint(QPainter* painter, const QStyleOptionGraphicsItem*, 
QWidget*) 
-       {
-               painter->setPen(themer()->get_color("AudioClip:contour"));
-               painter->drawLine(0, 0, 0, (int)m_boundingRect.height());
-       }
-};
-
-#include "SplitClip.moc"
 
 SplitClip::SplitClip(AudioClipView* view)
        : Command(view->get_clip(), tr("Split Clip"))
@@ -127,7 +109,8 @@
 int SplitClip::begin_hold()
 {
        m_sv->start_shuttle(true, true);
-       m_splitcursor = new SplitCursor(m_cv);
+       m_splitcursor = new LineView(m_cv);
+       m_splitcursor->set_color(themer()->get_color("AudioClip:contour"));
        m_cv->scene()->addItem(m_splitcursor);
        return 1;
 }

Index: commands/SplitClip.h
===================================================================
RCS file: /sources/traverso/traverso/src/commands/SplitClip.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- commands/SplitClip.h        25 Apr 2007 21:26:08 -0000      1.5
+++ commands/SplitClip.h        19 May 2007 19:30:11 -0000      1.6
@@ -29,7 +29,7 @@
 class Track;
 class SongView;
 class AudioClipView;
-class SplitCursor;
+class LineView;
 
 class SplitClip : public Command
 {
@@ -56,7 +56,7 @@
         AudioClip* leftClip;
         AudioClip* rightClip;
        nframes_t m_splitPoint;
-       SplitCursor* m_splitcursor;
+       LineView* m_splitcursor;
 };
 
 #endif

Index: traverso/songcanvas/MarkerView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/MarkerView.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- traverso/songcanvas/MarkerView.cpp  18 May 2007 22:30:42 -0000      1.17
+++ traverso/songcanvas/MarkerView.cpp  19 May 2007 19:30:11 -0000      1.18
@@ -21,6 +21,7 @@
 
 #include "MarkerView.h"
 #include "SongView.h"
+#include "LineView.h"
 #include "Themer.h"
 #include "ClipsViewPort.h"
 #include "PositionIndicator.h"
@@ -39,15 +40,19 @@
 {
        m_sv = sv;
        m_marker = marker;
-       m_active = false;
+       m_line = new LineView(this);
+       set_active(false);
        m_posIndicator = 0;
 
        QFontMetrics fm(themer()->get_font("Timeline:marker"));
        m_ascent = fm.ascent();
        m_width = fm.width("NI"); // use any two letters to set the width of 
the marker indicator
+       m_line->setPos(m_width / 2, m_ascent);
+       
 
        load_theme_data();
        
+       
        connect(m_marker, SIGNAL(positionChanged(Snappable*)), this, 
SLOT(update_position()));
        connect(m_marker, SIGNAL(descriptionChanged()), this, 
SLOT(update_drawing()));
 }
@@ -65,10 +70,6 @@
                painter->setClipRect(-clipx, 0, (int)m_boundingRect.width(), 
(int)m_boundingRect.height());
        }
 
-       if (m_active) {
-               painter->drawLine(m_width/2, m_ascent, m_width/2, 
(int)m_boundingRect.height());
-       }
-       
        painter->setRenderHint(QPainter::Antialiasing);
        painter->setFont(themer()->get_font("Timeline:fontscale:marker"));
        
@@ -99,13 +100,8 @@
        QFontMetrics fm(themer()->get_font("Timeline:fontscale:marker"));
        int descriptionwidth = fm.width(m_marker->get_description()) + 1;
 
-       if (m_active) {
-               m_boundingRect = QRectF(-1, 0, m_width + descriptionwidth,
-                               
m_sv->get_clips_viewport()->sceneRect().height());
-       } else {
+       m_line->set_bounding_rect(QRectF(-1, 0, m_width + descriptionwidth, 
m_sv->get_clips_viewport()->sceneRect().height()));
                m_boundingRect = QRectF(-1, 0, m_width + descriptionwidth, 
m_ascent);
-       }
-
 }
 
 void MarkerView::update_position()
@@ -136,11 +132,13 @@
 
        if (b) {
                m_fillColor = themer()->get_color("Marker:blink");
+               m_line->set_color(QColor(0, 0, 0, 200));
        } else {
                m_fillColor = themer()->get_color("Marker:default");
+               m_line->set_color(QColor(0, 0, 0, 80));
        }
 
-       calculate_bounding_rect();
+       m_line->update();
        update();
 }
 

Index: traverso/songcanvas/MarkerView.h
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/MarkerView.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- traverso/songcanvas/MarkerView.h    18 May 2007 22:30:42 -0000      1.9
+++ traverso/songcanvas/MarkerView.h    19 May 2007 19:30:11 -0000      1.10
@@ -26,6 +26,7 @@
 
 class Marker;
 class SongView;
+class LineView;
 class QColor;
 class PositionIndicator;
 
@@ -49,6 +50,7 @@
        
 private:
        Marker* m_marker;
+       LineView* m_line;
        QColor  m_fillColor;
        bool    m_active;
        bool    m_dragging;

Index: traverso/songcanvas/songcanvas.pro
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/songcanvas.pro,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- traverso/songcanvas/songcanvas.pro  23 Apr 2007 11:56:52 -0000      1.3
+++ traverso/songcanvas/songcanvas.pro  19 May 2007 19:30:11 -0000      1.4
@@ -50,7 +50,8 @@
 TrackPanelView.h \
 TrackPanelViewPort.h \
 TrackView.h \
-ViewItem.h
+ViewItem.h \
+LineView.h
 FORMS += ../ui/ExportWidget.ui \
        ../ui/AudioSourcesManagerWidget.ui \
        ../ui/PluginSelectorDialog.ui \
@@ -67,13 +68,13 @@
 
 
 contains(DEFINES, LV2_SUPPORT){
-INCLUDEPATH += \
+    INCLUDEPATH +=     \
        ../../plugins/LV2 \
        ../../3rdparty/slv2 
 }
 
 QT += opengl
 
-win32 {
+win32{
       INCLUDEPATH += ../../../3thparty/include
 }

Index: traverso/songcanvas/LineView.h
===================================================================
RCS file: traverso/songcanvas/LineView.h
diff -N traverso/songcanvas/LineView.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ traverso/songcanvas/LineView.h      19 May 2007 19:30:11 -0000      1.1
@@ -0,0 +1,49 @@
+/*
+Copyright (C) 2006-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 LINE_VIEW_H
+#define LINE_VIEW_H
+
+#include "ViewItem.h"
+
+class LineView : public ViewItem
+{
+       Q_OBJECT
+public:
+               
+       LineView(ViewItem* parent) : ViewItem(parent, 0) 
+       {
+               setZValue(parent->zValue() + 1);
+               m_boundingRect = QRectF(0, 0, 1, 
parent->boundingRect().height());
+       }
+       void set_bounding_rect(QRectF rect) {m_boundingRect = rect;}
+       void set_color(QColor color) {m_color = color;}
+       void paint(QPainter* painter, const QStyleOptionGraphicsItem*, 
QWidget*) 
+       {
+               painter->setPen(m_color);
+               painter->drawLine(0, 0, 0, (int)m_boundingRect.height());
+       }
+       
+private:
+       QColor m_color;
+};
+
+#endif




reply via email to

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