traverso-commit
[Top][All Lists]
Advanced

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

[Traverso-commit] traverso/src/traverso/songcanvas AudioClipView....


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src/traverso/songcanvas AudioClipView....
Date: Mon, 21 Jan 2008 16:14:08 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       08/01/21 16:14:08

Removed files:
        src/traverso/songcanvas: AudioClipView.cpp AudioClipView.h 
                                 CMakeLists.txt ClipsViewPort.cpp 
                                 ClipsViewPort.h Cursors.cpp Cursors.h 
                                 CurveNodeView.cpp CurveNodeView.h 
                                 CurveView.cpp CurveView.h 
                                 FadeContextDialogView.cpp 
                                 FadeContextDialogView.h FadeView.cpp 
                                 FadeView.h LineView.h MarkerView.cpp 
                                 MarkerView.h PanelLed.cpp PanelLed.h 
                                 PluginChainView.cpp PluginChainView.h 
                                 PluginView.cpp PluginView.h 
                                 PositionIndicator.cpp 
                                 PositionIndicator.h SongView.cpp 
                                 SongView.h SongWidget.cpp SongWidget.h 
                                 TimeLineView.cpp TimeLineView.h 
                                 TimeLineViewPort.cpp TimeLineViewPort.h 
                                 TrackPanelView.cpp TrackPanelView.h 
                                 TrackPanelViewPort.cpp 
                                 TrackPanelViewPort.h TrackView.cpp 
                                 TrackView.h ViewItem.cpp ViewItem.h 
                                 libtraversosongcanvas.h precompile.h 
                                 songcanvas.pri songcanvas.pro 

Log message:
        bye bye now :)
        (rename to sheetcanvas, and moved one level up)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/AudioClipView.cpp?cvsroot=traverso&r1=1.127&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/AudioClipView.h?cvsroot=traverso&r1=1.38&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/CMakeLists.txt?cvsroot=traverso&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/ClipsViewPort.cpp?cvsroot=traverso&r1=1.30&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/ClipsViewPort.h?cvsroot=traverso&r1=1.10&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/Cursors.cpp?cvsroot=traverso&r1=1.37&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/Cursors.h?cvsroot=traverso&r1=1.16&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/CurveNodeView.cpp?cvsroot=traverso&r1=1.13&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/CurveNodeView.h?cvsroot=traverso&r1=1.8&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/CurveView.cpp?cvsroot=traverso&r1=1.75&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/CurveView.h?cvsroot=traverso&r1=1.19&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/FadeContextDialogView.cpp?cvsroot=traverso&r1=1.4&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/FadeContextDialogView.h?cvsroot=traverso&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/FadeView.cpp?cvsroot=traverso&r1=1.22&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/FadeView.h?cvsroot=traverso&r1=1.7&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/LineView.h?cvsroot=traverso&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/MarkerView.cpp?cvsroot=traverso&r1=1.26&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/MarkerView.h?cvsroot=traverso&r1=1.10&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/PanelLed.cpp?cvsroot=traverso&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/PanelLed.h?cvsroot=traverso&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/PluginChainView.cpp?cvsroot=traverso&r1=1.17&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/PluginChainView.h?cvsroot=traverso&r1=1.7&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/PluginView.cpp?cvsroot=traverso&r1=1.21&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/PluginView.h?cvsroot=traverso&r1=1.11&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/PositionIndicator.cpp?cvsroot=traverso&r1=1.6&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/PositionIndicator.h?cvsroot=traverso&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/SongView.cpp?cvsroot=traverso&r1=1.96&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/SongView.h?cvsroot=traverso&r1=1.40&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/SongWidget.cpp?cvsroot=traverso&r1=1.25&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/SongWidget.h?cvsroot=traverso&r1=1.13&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/TimeLineView.cpp?cvsroot=traverso&r1=1.58&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/TimeLineView.h?cvsroot=traverso&r1=1.14&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/TimeLineViewPort.cpp?cvsroot=traverso&r1=1.11&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/TimeLineViewPort.h?cvsroot=traverso&r1=1.5&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/TrackPanelView.cpp?cvsroot=traverso&r1=1.31&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/TrackPanelView.h?cvsroot=traverso&r1=1.14&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/TrackPanelViewPort.cpp?cvsroot=traverso&r1=1.13&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/TrackPanelViewPort.h?cvsroot=traverso&r1=1.4&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/TrackView.cpp?cvsroot=traverso&r1=1.38&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/TrackView.h?cvsroot=traverso&r1=1.19&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/ViewItem.cpp?cvsroot=traverso&r1=1.6&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/ViewItem.h?cvsroot=traverso&r1=1.19&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/libtraversosongcanvas.h?cvsroot=traverso&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/precompile.h?cvsroot=traverso&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/songcanvas.pri?cvsroot=traverso&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/songcanvas.pro?cvsroot=traverso&r1=1.11&r2=0

Patches:
Index: AudioClipView.cpp
===================================================================
RCS file: AudioClipView.cpp
diff -N AudioClipView.cpp
--- AudioClipView.cpp   11 Jan 2008 15:44:55 -0000      1.127
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,1000 +0,0 @@
-/*
-Copyright (C) 2005-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 <libtraversocore.h>
-
-#include <QPainter>
-#include <QPainterPath>
-#include <QFont>
-
-#include "AudioClipView.h"
-#include "SongView.h"
-#include "TrackView.h"
-#include "FadeView.h"
-#include "CurveView.h"
-#include "PositionIndicator.h"
-
-#include "Themer.h"
-#include <Config.h>
-#include <FadeCurve.h>
-#include <Curve.h>
-#include <Interface.h>
-#include "PluginChain.h"
-
-#include <QFileDialog>
-#include "dialogs/AudioClipEditDialog.h"
-#include "Fade.h"
-#include "AudioDevice.h"
-
-// Always put me below _all_ includes, this is needed
-// in case we run with memory leak detection enabled!
-#include "Debugger.h"
-
-AudioClipView::AudioClipView(SongView* sv, TrackView* parent, AudioClip* clip )
-       : ViewItem(parent, clip)
-       , m_tv(parent)
-       , m_clip(clip)
-       , m_dragging(false)
-{
-       PENTERCONS;
-       
-       setZValue(parent->zValue() + 1);
-       
-       m_sv = sv;
-
-#if QT_VERSION < 0x040300
-       m_tv->scene()->addItem(this);
-#endif
-       
-       load_theme_data();
-       create_brushes();
-       create_clipinfo_string();
-
-       m_waitingForPeaks = false;
-       m_progress = 0;
-       m_posIndicator = 0;
-       m_song = m_clip->get_song();
-       
-       if (FadeCurve* curve = m_clip->get_fade_in()) {
-               add_new_fadeview(curve);
-       }
-       if (FadeCurve* curve = m_clip->get_fade_out()) {
-               add_new_fadeview(curve);
-       }
-       
-       curveView = new CurveView(m_sv, this, 
m_clip->get_plugin_chain()->get_fader()->get_curve());
-       // CurveViews don't 'get' their start offset, it's only a property for 
AudioClips..
-       // So to be sure the CurveNodeViews start offset get updated as well,
-       // we call curveviews calculate_bounding_rect() function!
-       curveView->set_start_offset(m_clip->get_source_start_location());
-       curveView->calculate_bounding_rect();
-       connect(curveView, SIGNAL(curveModified()), m_sv, 
SLOT(stop_follow_play_head()));
-       
-       connect(m_clip, SIGNAL(muteChanged()), this, SLOT(repaint()));
-       connect(m_clip, SIGNAL(stateChanged()), this, 
SLOT(clip_state_changed()));
-       connect(m_clip, SIGNAL(lockChanged()), this, SLOT(repaint()));
-       connect(m_clip, SIGNAL(fadeAdded(FadeCurve*)), this, 
SLOT(add_new_fadeview( FadeCurve*)));
-       connect(m_clip, SIGNAL(fadeRemoved(FadeCurve*)), this, 
SLOT(remove_fadeview( FadeCurve*)));
-       connect(m_clip, SIGNAL(positionChanged(Snappable*)), this, 
SLOT(position_changed()));
-       
-       connect(m_song, SIGNAL(modeChanged()), this, SLOT(repaint()));
-       
-       if (m_clip->recording_state() == AudioClip::RECORDING) {
-               start_recording();
-               connect(m_clip, SIGNAL(recordingFinished(AudioClip*)), this, 
SLOT(finish_recording()));
-       }
-       
-//     setFlags(ItemIsSelectable | ItemIsMovable);
-       setAcceptsHoverEvents(true);
-       setCursor(themer()->get_cursor("AudioClip"));
-}
-
-AudioClipView::~ AudioClipView()
-{
-       PENTERDES;
-}
-
-void AudioClipView::paint(QPainter* painter, const QStyleOptionGraphicsItem 
*option, QWidget *widget)
-{
-       PENTER2;
-       Q_UNUSED(widget);
-       
-//     printf("AudioClipView:: %s PAINT :: exposed rect is: x=%f, y=%f, w=%f, 
h=%f\n", QS_C(m_clip->get_name()), option->exposedRect.x(), 
option->exposedRect.y(), option->exposedRect.width(), 
option->exposedRect.height());
-       
-       int xstart = (int) option->exposedRect.x();
-       int pixelcount = (int) option->exposedRect.width();
-       if (pixelcount == 0) {
-               PWARN("AudioClipView::paint : Exposed rectangle has 0 width 
????");
-               return;
-       }
-       
-       painter->save();
-       painter->setClipRect(m_boundingRect);
-       
-       if (m_clip->is_readsource_invalid()) {
-               painter->fillRect(xstart, 0, pixelcount, m_height, 
themer()->get_color("AudioClip:invalidreadsource"));
-               draw_clipinfo_area(painter, xstart, pixelcount);
-               painter->setPen(themer()->get_color("AudioClip:contour"));
-               painter->drawRect(xstart, 0, pixelcount, m_height - 1);
-               painter->setPen(Qt::black);
-               painter->setFont( 
themer()->get_font("AudioClip:fontscale:title") );
-               painter->drawText(30, 0, 300, m_height, Qt::AlignVCenter, 
tr("Click to reset AudioFile !"));
-               painter->restore();
-               return;
-       }
-       
-       bool mousehover = (option->state & QStyle::State_MouseOver) || 
m_dragging;
-       
-       if (m_drawbackground) {
-               if (m_clip->recording_state() == AudioClip::RECORDING) {
-                       painter->fillRect(xstart, 0, pixelcount+1, m_height, 
m_brushBgRecording);
-               } else {
-                       if (m_clip->is_muted()) {
-                               if (mousehover) painter->fillRect(xstart, 0, 
pixelcount+1, m_height, m_brushBgMutedHover);
-                               else            painter->fillRect(xstart, 0, 
pixelcount+1, m_height, m_brushBgMuted);
-                       } else if (m_clip->is_selected()) {
-                               if (mousehover) painter->fillRect(xstart, 0, 
pixelcount+1, m_height, m_brushBgSelectedHover);
-                               else            painter->fillRect(xstart, 0, 
pixelcount+1, m_height, m_brushBgSelected);
-                       } else {
-                               if (mousehover) painter->fillRect(xstart, 0, 
pixelcount+1, m_height, m_brushBgHover);
-                               else            painter->fillRect(xstart, 0, 
pixelcount+1, m_height, m_brushBg);
-                       }
-               }
-       }
-       
-       if (m_clip->is_muted()) {
-               m_waveBrush = m_brushFgMuted;
-       } else {
-               if (m_song->get_mode() == Song::EDIT) {
-                       if (mousehover) m_waveBrush = m_brushFgHover;
-                       else            m_waveBrush = m_brushFg;
-               } else {
-                       if (mousehover) m_waveBrush = m_brushFgEditHover;
-                       else            m_waveBrush = m_brushFgEdit;
-               }
-       }
-       
-       int channels = m_clip->get_channels();
-
-       if (channels > 0) {
-               if (m_waitingForPeaks) {
-                       PMESG("Waiting for peaks!");
-                       // Hmm, do we paint here something?
-                       // Progress info, I think so....
-                       painter->setPen(Qt::black);
-                       QRect r(10, 0, 150, m_height);
-                       painter->setFont( 
themer()->get_font("AudioClip:fontscale:title") );
-                       QString si;
-                       si.setNum((int)m_progress);
-                       if (m_progress == 100) m_progress = 0;
-                       QString buildProcess = "Building Peaks: " + si + "%";
-                       painter->drawText(r, Qt::AlignVCenter, buildProcess);
-               
-               } else if (m_clip->recording_state() == 
AudioClip::NO_RECORDING) {
-//                     PROFILE_START;
-                       draw_peaks(painter, xstart, pixelcount);
-//                     PROFILE_END("draw peaks");
-               }
-       }
-       
-       // Draw the contour
-       if (m_height < m_mimimumheightforinfoarea) {
-               painter->setPen(themer()->get_color("AudioClip:contour"));
-               QRectF rect(0.5, 0, m_boundingRect.width() - 1, m_height - 0.5);
-               painter->drawRect(rect);
-       } else {
-               draw_clipinfo_area(painter, xstart, pixelcount);
-               painter->setPen(themer()->get_color("AudioClip:contour"));
-               QRectF rectinfo(0.5, 0, m_boundingRect.width() - 1, 
m_infoAreaHeight - 0.5);
-               painter->drawRect(rectinfo);
-               QRectF rect(0.5, 0, m_boundingRect.width() - 1, m_height - 0.5);
-               painter->drawRect(rect);
-       }
-       
-       // Paint a pixmap if the clip is locked
-       if (m_clip->is_locked()) {
-               int center = (int)(m_clip->get_length() / (2 * 
m_sv->timeref_scalefactor));
-               painter->drawPixmap(center - 8, m_height - 20, 
find_pixmap(":/lock"));
-       }
-
-       if (m_dragging) {
-               m_posIndicator->set_value(timeref_to_text(TimeRef(x() * 
m_sv->timeref_scalefactor), m_sv->timeref_scalefactor));
-       }
-       
-       painter->restore();
-}
-
-void AudioClipView::draw_peaks(QPainter* p, int xstart, int pixelcount)
-{
-       PENTER2;
-       // when painting with a path, I _have_ to use path.lineTo()
-       // which looks ugly when only parts of the clip is repainted
-       // when using a different color for the brush then the outline.
-       // Painting 2 more pixels makes it getting clipped away.....
-       pixelcount += 2;
-       
-       // boundary checking, important for microview only, macroview needs the 
additional
-       // pixels to paint the waveform correctly
-       if ((xstart + pixelcount) > m_boundingRect.width()) {
-               pixelcount = (int) m_boundingRect.width() - xstart;
-       }
-       
-       Peak* peak = m_clip->get_peak();
-       if (!peak) {
-               PERROR("No Peak object available for clip %s", 
QS_C(m_clip->get_name()));
-               return;
-       }
-       
-       bool microView = m_song->get_hzoom() > 
(Peak::MAX_ZOOM_USING_SOURCEFILE) ? 0 : 1;
-       TimeRef clipstartoffset = m_clip->get_source_start_location();
-       int channels = m_clip->get_channels();
-       int peakdatacount = microView ? pixelcount : pixelcount * 2;
-       float* pixeldata[channels];
-       float curveDefaultValue = 1.0;
-       int mixcurvedata = 0;
-       mixcurvedata |= curveView->has_nodes();
-       int offset = (int)(m_clip->get_source_start_location() / 
m_sv->timeref_scalefactor);
-               
-       if (!mixcurvedata) {
-               curveDefaultValue = curveView->get_default_value();
-       }
-       
-       // Load peak data for all channels, if no peakdata is returned
-       // for a certain Peak object, schedule it for loading.
-       for (int chan=0; chan < channels; ++chan) {
-               
-               int availpeaks = peak->calculate_peaks( chan,
-                               &pixeldata[chan],
-                               m_song->get_hzoom(),
-                               TimeRef(xstart * m_sv->timeref_scalefactor) + 
clipstartoffset,
-                               peakdatacount);
-               
-               if (peakdatacount != availpeaks) {
-//                     PWARN("peakdatacount != availpeaks (%d, %d)", 
peakdatacount, availpeaks);
-               }
-
-               if (availpeaks == Peak::NO_PEAK_FILE) {
-                       connect(peak, SIGNAL(progress(int)), this, 
SLOT(update_progress_info(int)));
-                       connect(peak, SIGNAL(finished()), this, SLOT 
(peak_creation_finished()));
-                       m_waitingForPeaks = true;
-                       peak->start_peak_loading();
-                       return;
-               }
-               
-               if (availpeaks == Peak::PERMANENT_FAILURE || availpeaks == 
Peak::NO_PEAKDATA_FOUND) {
-                       return;
-               }               
-               
-//             pixelcount = std::min(pixelcount, availpeaks);
-       }
-       
-       
-       float curvemixdown[peakdatacount];
-       if (mixcurvedata) {
-               mixcurvedata |= curveView->get_vector(xstart + offset, 
peakdatacount, curvemixdown);
-       }
-       
-       for (int i = 0; i < m_fadeViews.size(); ++i) {
-               FadeView* view = m_fadeViews.at(i);
-               float fademixdown[peakdatacount];
-               int fademix = 0;
-               
-               if (mixcurvedata) {
-                       fademix = view->get_vector(xstart, peakdatacount, 
fademixdown);
-               } else {
-                       fademix = view->get_vector(xstart, peakdatacount, 
curvemixdown);
-               }
-               
-               if (mixcurvedata && fademix) {
-                       for (int j=0; j<peakdatacount; ++j) {
-                               curvemixdown[j] *= fademixdown[j];
-                       }
-               }
-               
-               mixcurvedata |= fademix;
-       }
-       
-       // Load the Peak data into the pixeldata float buffers
-       // ClassicView uses both positive and negative values,
-       // rectified view: pick the highest value of both
-       // Merged view: calculate highest value for all channels, 
-       // and store it in the first channels pixeldata.
-       if (!microView) {
-               if (!m_classicView) {
-                       for (int chan=0; chan < channels; chan++) {
-                               for (int i=0, j=0; i < (pixelcount*2); i+=2, 
++j) {
-                                       pixeldata[chan][j] = - 
fabs(f_max(pixeldata[chan][i], - pixeldata[chan][i+1]));
-                               }
-                       }
-               }
-               
-               if (m_mergedView) {
-                       for (int chan=1; chan < channels; chan++) {
-                               for (int i = 0; i < (pixelcount*2); ++i) {
-                                       pixeldata[0][i] = f_max(pixeldata[chan 
- 1][i], pixeldata[chan][i]);
-                               }
-                       }
-               }
-               
-       }
-       
-       if (mixcurvedata) {
-               int curvemixdownpos;
-               for (int chan=0; chan < channels; chan++) {
-                       curvemixdownpos = 0;
-                       if (m_classicView) {
-                               for (int i = 0; i < (pixelcount*2); ++i) {
-                                       pixeldata[chan][i++] *= 
curvemixdown[curvemixdownpos];
-                                       pixeldata[chan][i] *= 
curvemixdown[curvemixdownpos];
-                                       curvemixdownpos++;
-                               }
-                       } else {
-                               for (int i = 0; i < pixelcount; i++) {
-                                       pixeldata[chan][i] *= 
curvemixdown[curvemixdownpos];
-                                       curvemixdownpos++;
-                               }
-                       }
-               }
-       }
-       
-
-       for (int chan=0; chan < channels; chan++) {
-               p->save();
-               
-               // calculate the height of the area available for peak drawing 
-               // and if the infoarea is displayed, translate the painter
-               // drawing by dy = m_infoAreaheight
-               int height;
-               
-               if (m_height >= m_mimimumheightforinfoarea) {
-                       p->setMatrix(matrix().translate(0, m_infoAreaHeight), 
true);
-                       height = (m_height - m_infoAreaHeight) / channels;
-               } else {
-                       height = m_height / channels;
-               }
-       
-               
-               float scaleFactor = ( (float) height * 0.90 / 2) * 
m_clip->get_gain() * curveDefaultValue;
-               float ytrans;
-               
-
-               // Draw channel seperator horizontal lines, if needed.
-               if (channels >= 2 && ! m_mergedView && m_classicView && chan 
>=1 ) {
-                       p->save();
-                       
-                       if (m_clip->is_selected()) {
-                               
p->setPen(themer()->get_color("AudioClip:channelseperator:selected"));
-                       } else {
-                               
p->setPen(themer()->get_color("AudioClip:channelseperator"));
-                       }
-               
-                       ytrans = height * chan;
-                       p->setMatrix(matrix().translate(0, ytrans), true);
-                       p->drawLine(xstart, 0, xstart + pixelcount, 0);
-                       p->restore();
-               }
-               
-               // Microview, paint waveform as polyline
-               if (microView) {
-               
-                       m_polygon.clear();
-                       m_polygon.reserve(pixelcount);
-                       
-                       int bufferPos = 0;
-                       
-                       if (m_mergedView) {
-                               ytrans = (height / 2) * channels;
-                       } else {
-                               ytrans = (height / 2) + (chan * height);
-                       }
-                       
-                       p->setMatrix(matrix().translate(0, ytrans), true);
-                       
-                       if (m_clip->is_selected()) {
-                               
p->setPen(themer()->get_color("AudioClip:channelseperator:selected"));
-                       } else {
-                               
p->setPen(themer()->get_color("AudioClip:channelseperator"));
-                       }
-                       
-                       p->drawLine(xstart, 0, xstart + pixelcount, 0);
-                       
-                       for (int x = xstart; x < (pixelcount+xstart); x++) {
-                               m_polygon.append( QPointF(x, -scaleFactor * 
pixeldata[chan][bufferPos++]) );
-                       }
-                       
-                       if 
(themer()->get_property("AudioClip:wavemicroview:antialiased", 0).toInt()) {
-                               p->setRenderHints(QPainter::Antialiasing);
-                       }
-                       
-                       
p->setPen(themer()->get_color("AudioClip:wavemicroview"));
-                       p->drawPolyline(m_polygon);
-               
-               // Macroview, paint waveform with painterpath
-               } else {
-                       if (m_fillwave) {
-                               p->setBrush(m_waveBrush);
-                       }
-
-                       if (m_song->get_mode() == Song::EDIT) {
-                               
p->setPen(themer()->get_color("AudioClip:wavemacroview:outline"));
-                       } else  {
-                               
p->setPen(themer()->get_color("AudioClip:wavemacroview:outline:curvemode"));
-                       }
-                       if (m_clip->is_muted()) {
-                               
p->setPen(themer()->get_color("AudioClip:wavemacroview:outline:muted"));
-                       }
-                               
-                       scaleFactor = ( (float) height * 0.90 / 
(Peak::MAX_DB_VALUE * 2)) * m_clip->get_gain() * curveDefaultValue;
-                       
-                       if (m_mergedView) {
-                               if (m_classicView) {
-                                       ytrans = (height / 2) * channels;
-                                       scaleFactor *= channels;
-                               } else {
-                                       ytrans = height * channels;
-                                       scaleFactor *= channels;
-                               }
-                       }
-                       
-                       // we add one start/stop point so reserve some more...
-                       int bufferpos = 0;
-
-                       if (m_classicView) {
-                               
-                               if (m_mergedView) {
-                                       ytrans = (height / 2) * channels;
-                               } else {
-                                       ytrans = (height / 2) + (chan * height);
-                               }
-                       
-                               p->setMatrix(matrix().translate(xstart, 
ytrans).scale(1, scaleFactor), true);
-                               
-                               if (m_paintWithOutline) {
-                                       QPainterPath path;
-                                       
-                                       m_polygon.clear();
-                                       m_polygon.reserve(pixelcount*2);
-                                       
-                                       for (int x = 0; x < pixelcount; x++) {
-                                               m_polygon.append( QPointF(x, - 
pixeldata[chan][bufferpos]) );
-                                               bufferpos+=2;
-                                       }
-                                       
-                                       bufferpos -= 1;
-                                       
-                                       for (int x = pixelcount - 1; x >= 0; 
x--) {
-                                               m_polygon.append( QPointF(x, 
pixeldata[chan][bufferpos]) );
-                                               bufferpos-=2;
-                                       }
-                                       
-                                       path.addPolygon(m_polygon);
-                                       p->drawPath(path);
-
-                               } else {
-                                       for (int x = 0; x < pixelcount; x++) {
-                                               int ytop = -1 * 
(int)(pixeldata[chan][bufferpos++]);
-                                               int ymin = 
(int)(pixeldata[chan][bufferpos++]);
-                                               p->drawLine(x, ytop, x, ymin);
-                                       }
-                               }
-                       
-                               // Draw 'the' -INF line
-                               p->setPen(minINFLineColor);
-                               p->drawLine(0, 0, pixelcount, 0);
-                       
-                       } else {
-                               scaleFactor =  (float) height * 0.95 * 
m_clip->get_gain() / Peak::MAX_DB_VALUE * curveDefaultValue;
-                               ytrans = height + (chan * height);
-               
-                               if (m_mergedView) {
-                                       ytrans = height * channels;
-                                       scaleFactor *= channels;
-                               }
-
-                               p->setMatrix(matrix().translate(xstart, 
ytrans).scale(1, scaleFactor), true);
-                               
-                               if (m_paintWithOutline) {
-                                       
-                                       QPainterPath path;
-                                       m_polygon.clear();
-                                       m_polygon.reserve(pixelcount + 2);
-                                       
-                                       for (int x=0; x<pixelcount; x++) {
-                                               m_polygon.append( QPointF(x, 
pixeldata[chan][bufferpos++]) );
-                                       }
-                                       
-                                       m_polygon.append(QPointF(pixelcount, 
0));
-                                       path.addPolygon(m_polygon);
-                                       path.lineTo(0, 0);
-                                       
-                                       p->drawPath(path);
-                               
-                               } else {
-                                       for (int x = 0; x < pixelcount; x++) {
-                                               p->drawLine(x, 0, x, 
int(pixeldata[chan][bufferpos++]));
-                                       }
-                               }
-                       }
-                       
-               }
-               
-               p->restore();
-               
-               if (m_mergedView) {
-                       break;
-               }
-       }
-}
-
-void AudioClipView::draw_clipinfo_area(QPainter* p, int xstart, int pixelcount)
-{
-       // clip info area bg
-       p->fillRect(xstart, 0, pixelcount+1, m_infoAreaHeight, 
themer()->get_color("AudioClip:clipinfobackground:inactive"));
-       // clip info, only if xstart lies in the stringlenght range which is 
calculated by a rough estimate.
-       if (xstart < m_clipinfoString.size() * 6) {
-               p->setFont(themer()->get_font("AudioClip:fontscale:title"));
-               p->drawText(5, 10, m_clipinfoString);
-       }
-}
-
-void AudioClipView::create_brushes()
-{
-       // make sure the brushes are made from solid colors (not gradients) if 
top and bottom color are equal
-
-       // create brushes for background states
-       QColor bg_colRecTop = 
themer()->get_color("AudioClip:background:recording:top");
-       QColor bg_colRecBottom = 
themer()->get_color("AudioClip:background:recording:Bottom");
-       if (bg_colRecTop == bg_colRecBottom) {
-               m_brushBgRecording = QBrush(bg_colRecTop);
-       } else {
-               QLinearGradient bg_gradientRec(QPoint(0, 0), QPoint(0, 
m_height));
-               bg_gradientRec.setSpread(QGradient::RepeatSpread);
-               bg_gradientRec.setColorAt(0, bg_colRecTop);
-               bg_gradientRec.setColorAt(1, bg_colRecBottom);
-               m_brushBgRecording = QBrush(bg_gradientRec);
-       }
-
-       QColor bg_colMutedTop = 
themer()->get_color("AudioClip:background:muted:top");
-       QColor bg_colMutedBottom = 
themer()->get_color("AudioClip:background:muted:bottom");
-       if (bg_colMutedTop == bg_colMutedBottom) {
-               m_brushBgMuted = QBrush(bg_colMutedTop);
-       } else {
-               QLinearGradient bg_gradientMuted(QPoint(0, 0), QPoint(0, 
m_height));
-               bg_gradientMuted.setSpread(QGradient::RepeatSpread);
-               bg_gradientMuted.setColorAt(0, bg_colMutedTop);
-               bg_gradientMuted.setColorAt(1, bg_colMutedBottom);
-               m_brushBgMuted = QBrush(bg_gradientMuted);
-       }
-
-       QColor bg_colMutedHoverTop = 
themer()->get_color("AudioClip:background:muted:mousehover:top");
-       QColor bg_colMutedHoverBottom = 
themer()->get_color("AudioClip:background:muted:mousehover:bottom");
-       if (bg_colMutedHoverTop == bg_colMutedHoverBottom) {
-               m_brushBgMutedHover = QBrush(bg_colMutedHoverTop);
-       } else {
-               QLinearGradient bg_gradientMutedHover(QPoint(0, 0), QPoint(0, 
m_height));
-               bg_gradientMutedHover.setSpread(QGradient::RepeatSpread);
-               bg_gradientMutedHover.setColorAt(0, bg_colMutedHoverTop);
-               bg_gradientMutedHover.setColorAt(1, bg_colMutedHoverBottom);
-               m_brushBgMutedHover = QBrush(bg_gradientMutedHover);
-       }
-
-       QColor bg_colSelectedTop = 
themer()->get_color("AudioClip:background:selected:top");
-       QColor bg_colSelectedBottom = 
themer()->get_color("AudioClip:background:selected:bottom");
-       if (bg_colSelectedTop == bg_colSelectedBottom) {
-               m_brushBgSelected = QBrush(bg_colSelectedTop);
-       } else {
-               QLinearGradient bg_gradientSelected(QPoint(0, 0), QPoint(0, 
m_height));
-               bg_gradientSelected.setSpread(QGradient::RepeatSpread);
-               bg_gradientSelected.setColorAt(0, bg_colSelectedTop);
-               bg_gradientSelected.setColorAt(1, bg_colSelectedBottom);
-               m_brushBgSelected = QBrush(bg_gradientSelected);
-       }
-
-       QColor bg_colSelectedHoverTop = 
themer()->get_color("AudioClip:background:selected:mousehover:top");
-       QColor bg_colSelectedHoverBottom = 
themer()->get_color("AudioClip:background:selected:mousehover:bottom");
-       if (bg_colSelectedHoverTop == bg_colSelectedHoverBottom) {
-               m_brushBgSelectedHover = QBrush(bg_colSelectedHoverTop);
-       } else {
-               QLinearGradient bg_gradientSelectedHover(QPoint(0, 0), 
QPoint(0, m_height));
-               bg_gradientSelectedHover.setSpread(QGradient::RepeatSpread);
-               bg_gradientSelectedHover.setColorAt(0, bg_colSelectedHoverTop);
-               bg_gradientSelectedHover.setColorAt(1, 
bg_colSelectedHoverBottom);
-               m_brushBgSelectedHover = QBrush(bg_gradientSelectedHover);
-       }
-
-       QColor bg_colTop = themer()->get_color("AudioClip:background:top");
-       QColor bg_colBottom = 
themer()->get_color("AudioClip:background:bottom");
-       if (bg_colTop == bg_colBottom) {
-               m_brushBg = QBrush(bg_colTop);
-       } else {
-               QLinearGradient bg_gradient(QPoint(0, 0), QPoint(0, m_height));
-               bg_gradient.setSpread(QGradient::RepeatSpread);
-               bg_gradient.setColorAt(0, bg_colTop);
-               bg_gradient.setColorAt(1, bg_colBottom);
-               m_brushBg = QBrush(bg_gradient);
-       }
-
-       QColor bg_colHoverTop = 
themer()->get_color("AudioClip:background:mousehover:top");
-       QColor bg_colHoverBottom = 
themer()->get_color("AudioClip:background:mousehover:bottom");
-       if (bg_colHoverTop == bg_colHoverBottom) {
-               m_brushBgHover = QBrush(bg_colHoverTop);
-       } else {
-               QLinearGradient bg_gradientHover(QPoint(0, 0), QPoint(0, 
m_height));
-               bg_gradientHover.setSpread(QGradient::RepeatSpread);
-               bg_gradientHover.setColorAt(0, bg_colHoverTop);
-               bg_gradientHover.setColorAt(1, bg_colHoverBottom);
-               m_brushBgHover = QBrush(bg_gradientHover);
-       }
-
-       // Foreground (Waveforms)
-       QColor fg_colTop = 
themer()->get_color("AudioClip:wavemacroview:brush:top");
-       QColor fg_colBottom = 
themer()->get_color("AudioClip:wavemacroview:brush:bottom");
-       if (fg_colTop == fg_colBottom) {
-               m_brushFg = QBrush(fg_colTop);
-       } else {
-               QLinearGradient fg_gradient(QPoint(0, 0), QPoint(0, m_height));
-               fg_gradient.setSpread(QGradient::RepeatSpread);
-               fg_gradient.setColorAt(0, fg_colTop);
-               fg_gradient.setColorAt(1, fg_colBottom);
-               m_brushFg = QBrush(fg_gradient);
-       }
-
-       QColor fg_colHoverTop = 
themer()->get_color("AudioClip:wavemacroview:brush:hover:top");
-       QColor fg_colHoverBottom = 
themer()->get_color("AudioClip:wavemacroview:brush:hover:bottom");
-       if (fg_colHoverTop == fg_colHoverBottom) {
-               m_brushFgHover = QBrush(fg_colHoverTop);
-       } else {
-               QLinearGradient fg_gradientHover(QPoint(0, 0), QPoint(0, 
m_height));
-               fg_gradientHover.setSpread(QGradient::RepeatSpread);
-               fg_gradientHover.setColorAt(0, fg_colHoverTop);
-               fg_gradientHover.setColorAt(1, fg_colHoverBottom);
-               m_brushFgHover = QBrush(fg_gradientHover);
-       }
-
-       QColor fg_colEditTop = 
themer()->get_color("AudioClip:wavemacroview:brush:curvemode:top");
-       QColor fg_colEditBottom = 
themer()->get_color("AudioClip:wavemacroview:brush:curvemode:bottom");
-       if (fg_colEditTop == fg_colEditBottom) {
-               m_brushFgEdit = QBrush(fg_colEditTop);
-       } else {
-               QLinearGradient fg_gradientEdit(QPoint(0, 0), QPoint(0, 
m_height));
-               fg_gradientEdit.setSpread(QGradient::RepeatSpread);
-               fg_gradientEdit.setColorAt(0, fg_colEditTop);
-               fg_gradientEdit.setColorAt(1, fg_colEditBottom);
-               m_brushFgEdit = QBrush(fg_gradientEdit);
-       }
-
-       QColor fg_colEditHoverTop = 
themer()->get_color("AudioClip:wavemacroview:brush:curvemode:hover:top");
-       QColor fg_colEditHoverBottom = 
themer()->get_color("AudioClip:wavemacroview:brush:curvemode:hover:bottom");
-       if (fg_colEditHoverTop == fg_colEditHoverBottom) {
-               m_brushFgEditHover = QBrush(fg_colEditHoverTop);
-       } else {
-               QLinearGradient fg_gradientEditHover(QPoint(0, 0), QPoint(0, 
m_height));
-               fg_gradientEditHover.setSpread(QGradient::RepeatSpread);
-               fg_gradientEditHover.setColorAt(0, fg_colEditHoverTop);
-               fg_gradientEditHover.setColorAt(1, fg_colEditHoverBottom);
-               m_brushFgEditHover = QBrush(fg_gradientEditHover);
-       }
-
-       QColor fg_colMutedTop = 
themer()->get_color("AudioClip:wavemacroview:brush:muted:top");
-       QColor fg_colMutedBottom = 
themer()->get_color("AudioClip:wavemacroview:brush:muted:bottom");
-       if (fg_colMutedTop == fg_colMutedBottom) {
-               m_brushFgMuted = QBrush(fg_colMutedTop);
-       } else {
-               QLinearGradient fg_gradientMuted(QPoint(0, 0), QPoint(0, 
m_height));
-               fg_gradientMuted.setSpread(QGradient::RepeatSpread);
-               fg_gradientMuted.setColorAt(0, fg_colMutedTop);
-               fg_gradientMuted.setColorAt(1, fg_colMutedBottom);
-               m_brushFgMuted = QBrush(fg_gradientMuted);
-       }
-}
-
-void AudioClipView::create_clipinfo_string()
-{
-       PENTER;
-       QString sclipGain = "Gain: "+ 
coefficient_to_dbstring(m_clip->get_gain());
-       m_clipinfoString = m_clip->get_name()  + "    " + sclipGain + "   " + 
QString::number(m_clip->get_rate()) +  " Hz";
-}
-
-void AudioClipView::update_progress_info( int progress )
-{
-//     if (progress > m_progress) {
-//     }
-       m_progress = progress;
-       update(10, 0, 150, m_height);
-}
-
-void AudioClipView::peak_creation_finished()
-{
-       m_waitingForPeaks = false;
-       update();
-}
-
-AudioClip * AudioClipView::get_clip( )
-{
-       return m_clip;
-}
-
-void AudioClipView::add_new_fadeview( FadeCurve * fade )
-{
-       PENTER;
-       FadeView* view = new FadeView(m_sv, this, fade);
-       m_fadeViews.append(view);
-       connect(view, SIGNAL(fadeModified()), m_sv, 
SLOT(stop_follow_play_head()));
-#if QT_VERSION < 0x040300
-       scene()->addItem(view);
-#endif
-}
-
-void AudioClipView::remove_fadeview( FadeCurve * fade )
-{
-       for (int i = 0; i < m_fadeViews.size(); ++i) {
-               FadeView* view = m_fadeViews.at(i);
-               if (view->get_fade() == fade) {
-                       m_fadeViews.takeAt(i);
-                       scene()->removeItem(view);
-                       delete view;
-                       break;
-               }
-       }
-}
-
-void AudioClipView::calculate_bounding_rect()
-{
-       prepareGeometryChange();
-//     printf("AudioClipView::calculate_bounding_rect()\n");
-       set_height(m_tv->get_height());
-       m_boundingRect = QRectF(0, 0, (m_clip->get_length() / 
m_sv->timeref_scalefactor), m_height);
-       update_start_pos();
-       ViewItem::calculate_bounding_rect();
-       
-       foreach(PainterPathCache* cache, m_pathCache) {
-               cache->xstart = -1;
-               cache->length = -1;
-       }
-}
-
-
-void AudioClipView::repaint( )
-{
-       update(m_boundingRect);
-}
-
-void AudioClipView::set_height( int height )
-{
-       m_height = height;
-       create_brushes();
-}
-
-int AudioClipView::get_childview_y_offset() const
-{
-       return (m_height >= m_mimimumheightforinfoarea) ? m_infoAreaHeight : 0;
-}
-
-void AudioClipView::update_start_pos()
-{
-//     printf("AudioClipView::update_start_pos()\n");
-       setPos(m_clip->get_track_start_location() / m_sv->timeref_scalefactor, 
m_tv->get_childview_y_offset());
-}
-
-Command * AudioClipView::fade_range()
-{
-       Q_ASSERT(m_song);
-       int x = (int) (cpointer().on_first_input_event_scene_x() - 
scenePos().x());
-
-       if (x < (m_boundingRect.width() / 2)) {
-               return clip_fade_in();
-       } else {
-               return clip_fade_out();
-       }
-
-       return 0;
-}
-
-Command * AudioClipView::clip_fade_in( )
-{
-       if (! m_clip->get_fade_in()) {
-               // This implicitely creates the fadecurve
-               m_clip->set_fade_in(1);
-       }
-       return new FadeRange(m_clip, m_clip->get_fade_in(), 
m_sv->timeref_scalefactor);
-}
-
-Command * AudioClipView::clip_fade_out( )
-{
-       if (! m_clip->get_fade_out()) {
-               m_clip->set_fade_out(1);
-       }
-       return new FadeRange(m_clip, m_clip->get_fade_out(), 
m_sv->timeref_scalefactor);
-}
-
-Command * AudioClipView::reset_fade()
-{
-       Q_ASSERT(m_song);
-       int x = (int) (cpointer().on_first_input_event_scene_x() - 
scenePos().x());
-
-       if (x < (m_boundingRect.width() / 2)) {
-               return m_clip->reset_fade_in();
-       } else {
-               return m_clip->reset_fade_out();
-       }
-
-       return 0;
-}
-
-void AudioClipView::position_changed()
-{
-       // Update the curveview start offset, only needed for left edge dragging
-       // but who cares :)
-       // the calculate_bounding_rect() will update AudioClipViews children, so
-       // the CurveView and it's nodes get updated as well, no need to set
-       // the start offset for those manually!
-       curveView->set_start_offset(m_clip->get_source_start_location());
-       calculate_bounding_rect();
-       update();
-}
-
-void AudioClipView::load_theme_data()
-{
-       m_drawbackground = themer()->get_property("AudioClip:drawbackground", 
1).toInt();
-       m_infoAreaHeight = themer()->get_property("AudioClip:infoareaheight", 
16).toInt();
-       m_usePolygonPeakDrawing = 
themer()->get_property("AudioClip:polygonpeakdrawing", 0).toInt();
-       m_mimimumheightforinfoarea = 
themer()->get_property("AudioClip:mimimumheightforinfoarea", 45).toInt();
-       m_classicView = ! config().get_property("Themer", 
"paintaudiorectified", false).toBool();
-       m_mergedView = config().get_property("Themer", 
"paintstereoaudioasmono", false).toBool();
-       m_fillwave = themer()->get_property("AudioClip:fillwave", 1).toInt();
-       minINFLineColor = themer()->get_color("AudioClip:channelseperator");
-       m_paintWithOutline = config().get_property("Themer", 
"paintwavewithoutline", true).toBool();
-       calculate_bounding_rect();
-}
-
-
-void AudioClipView::hoverEnterEvent(QGraphicsSceneHoverEvent* event)
-{
-       Q_UNUSED(event)
-                       if (ie().is_holding()) {
-               return;
-                       }
-       
-                       update(m_boundingRect);
-}
-
-
-Command * AudioClipView::select_fade_in_shape( )
-{
-       Interface::instance()->select_fade_in_shape();
-       
-       return 0;
-}
-
-Command * AudioClipView::select_fade_out_shape( )
-{
-       Interface::instance()->select_fade_out_shape();
-       
-       return 0;
-}
-
-void AudioClipView::start_recording()
-{
-       m_oldRecordingPos = TimeRef();
-       connect(&m_recordingTimer, SIGNAL(timeout()), this, 
SLOT(update_recording()));
-       m_recordingTimer.start(750);
-}
-
-void AudioClipView::finish_recording()
-{
-       m_recordingTimer.stop();
-       prepareGeometryChange();
-       m_boundingRect = QRectF(0, 0, (m_clip->get_length() / 
m_sv->timeref_scalefactor), m_height);
-       curveView->calculate_bounding_rect();
-       update();
-}
-
-void AudioClipView::update_recording()
-{
-       if (m_clip->recording_state() != AudioClip::RECORDING) {
-               return;
-       }
-       
-       TimeRef newPos = m_clip->get_length();
-       m_boundingRect = QRectF(0, 0, (newPos / m_sv->timeref_scalefactor), 
m_height);
-       
-       int updatewidth = int((newPos - m_oldRecordingPos) / 
m_sv->timeref_scalefactor);
-       QRect updaterect = QRect(int(m_oldRecordingPos / 
m_sv->timeref_scalefactor) - 1, 0, updatewidth, m_height);
-       update(updaterect);
-       m_oldRecordingPos = newPos;
-}
-
-void AudioClipView::set_dragging(bool dragging)
-{
-       if (dragging) {
-               if (! m_posIndicator) {
-                       m_posIndicator = new PositionIndicator(this);
-                       scene()->addItem(m_posIndicator);
-                       m_posIndicator->set_position(2, 
get_childview_y_offset() + 1);
-               }
-       } else {
-               if (m_posIndicator) {
-                       scene()->removeItem(m_posIndicator);
-                       delete m_posIndicator;
-                       m_posIndicator = 0;
-               }
-       }
-       
-       m_dragging = dragging;
-       update();
-}
-
-Command * AudioClipView::set_audio_file()
-{
-       if (m_clip->is_readsource_invalid()) {
-               ReadSource* rs = m_clip->get_readsource();
-               if ( ! rs ) {
-                       return ie().failure();
-               }
-               
-               QString filename = QFileDialog::getOpenFileName(0,
-                               tr("Reset Audio File for Clip: 
%1").arg(m_clip->get_name()),
-                                  rs->get_filename(),
-                                                  tr("All files (*);;Audio 
files (*.wav *.flac)"));
-               
-               if (filename.isEmpty()) {
-                       info().information(tr("No file selected!"));
-                       return ie().failure();
-               }
-               
-               if (rs->set_file(filename) < 0) {
-                       return ie().failure();
-               }
-                       
-               resources_manager()->set_source_for_clip(m_clip, rs);
-               
-               info().information(tr("Succesfully set AudioClip file to 
%1").arg(filename));
-               
-               return ie().succes();
-       }
-       
-       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());
-       
-       editdialog.exec();
-       
-       return 0;
-}
-
-void AudioClipView::clip_state_changed()
-{
-       create_clipinfo_string();
-       update();
-}
-

Index: AudioClipView.h
===================================================================
RCS file: AudioClipView.h
diff -N AudioClipView.h
--- AudioClipView.h     8 Jan 2008 21:18:57 -0000       1.38
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,178 +0,0 @@
-/*
-Copyright (C) 2005-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 AUDIO_CLIP_VIEW_H
-#define AUDIO_CLIP_VIEW_H
-
-#include "ViewItem.h"
-#include <defines.h>
-#include <QList>
-#include <QTimer>
-#include <QPolygonF>
-
-class AudioClip;
-class Song;
-class FadeCurve;
-class CurveView;
-class SongView;
-class TrackView;
-class FadeView;
-class Peak;
-class PositionIndicator;
-
-class AudioClipView : public ViewItem
-{
-       Q_OBJECT
-       Q_CLASSINFO("fade_range", tr("Closest: Adjust Length"))
-       Q_CLASSINFO("clip_fade_in", tr("In: Adjust Length"))
-       Q_CLASSINFO("clip_fade_out", tr("Out: Adjust Length"))
-       Q_CLASSINFO("select_fade_in_shape", tr("In: Select Preset"));
-       Q_CLASSINFO("select_fade_out_shape", tr("Out: Select Preset"));
-       Q_CLASSINFO("reset_fade", tr("Closest: Delete"));
-       Q_CLASSINFO("set_audio_file", tr("Reset Audio File"));
-       Q_CLASSINFO("edit_properties", tr("Edit Properties"));
-
-public:
-       AudioClipView(SongView* view, TrackView* parent, AudioClip* clip);
-       ~AudioClipView();
-
-       void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-       
-       void set_height(int height);
-       
-       AudioClip* get_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 set_dragging(bool dragging);
-       
-       void load_theme_data();
-       
-protected:
-       void hoverEnterEvent ( QGraphicsSceneHoverEvent * event );
-
-private:
-       TrackView*      m_tv;
-       QList<FadeView*> m_fadeViews;
-       AudioClip*      m_clip;
-       Song*           m_song;
-       CurveView*      curveView;
-       PositionIndicator* m_posIndicator;
-       QPolygonF m_polygon;
-       QPixmap m_background;
-       
-       struct PainterPathCache {
-               QPainterPath pathtop;
-               QPainterPath pathbottom;
-               int xstart;
-               int length;
-       };
-       
-       QList<PainterPathCache* > m_pathCache;
-
-       QTimer m_recordingTimer;
-
-       float m_progress;
-       int m_peakloadingcount;
-
-       bool m_waitingForPeaks;
-       bool m_mergedView;
-       bool m_classicView;
-       bool m_dragging;
-       bool m_paintWithOutline;
-       int m_height;
-       int m_infoAreaHeight;
-       int m_mimimumheightforinfoarea;
-       int m_usePolygonPeakDrawing;
-       TimeRef m_oldRecordingPos;
-       
-       // theme data
-       int m_drawbackground;
-       int m_fillwave;
-       QColor m_backgroundColorTop;
-       QColor m_backgroundColorBottom;
-       QColor m_backgroundColorMouseHoverTop;
-       QColor m_backgroundColorMouseHoverBottom;
-       QColor minINFLineColor;
-       QBrush m_waveBrush;
-       QBrush m_brushBgRecording;
-       QBrush m_brushBgMuted;
-       QBrush m_brushBgMutedHover;
-       QBrush m_brushBgSelected;
-       QBrush m_brushBgSelectedHover;
-       QBrush m_brushBg;
-       QBrush m_brushBgHover;
-       QBrush m_brushFg;
-       QBrush m_brushFgHover;
-       QBrush m_brushFgMuted;
-       QBrush m_brushFgEdit;
-       QBrush m_brushFgEditHover;
-
-       QString m_clipinfoString;
-
-       void create_clipinfo_string();
-
-       void draw_clipinfo_area(QPainter* painter, int xstart, int pixelcount);
-       void draw_peaks(QPainter* painter, int xstart, int pixelcount);
-       void create_brushes();
-
-       friend class FadeView;
-
-public slots:
-       void add_new_fadeview(FadeCurve* fade);
-       void remove_fadeview(FadeCurve* fade);
-       void repaint();
-       void update_start_pos();
-       void position_changed();
-       
-       Command* fade_range();
-       Command* clip_fade_in();
-       Command* clip_fade_out();
-       Command* select_fade_in_shape();
-       Command* select_fade_out_shape();
-       Command* reset_fade();
-       Command* set_audio_file();
-       Command* edit_properties();
-       
-private slots:
-       void update_progress_info(int progress);
-       void peak_creation_finished();
-       void start_recording();
-       void finish_recording();
-       void update_recording();
-       void clip_state_changed();
-};
-
-
-inline int AudioClipView::get_height() const {
-       int height;
-       (m_height > m_mimimumheightforinfoarea) ? height = m_height - 
m_infoAreaHeight : height = m_height;
-       return height;
-}
-
-
-#endif
-
-//eof

Index: CMakeLists.txt
===================================================================
RCS file: CMakeLists.txt
diff -N CMakeLists.txt
--- CMakeLists.txt      5 Nov 2007 22:28:11 -0000       1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,84 +0,0 @@
-INCLUDE_DIRECTORIES(
-${CMAKE_SOURCE_DIR}/src/commands
-${CMAKE_SOURCE_DIR}/src/common
-${CMAKE_SOURCE_DIR}/src/core
-${CMAKE_SOURCE_DIR}/src/engine
-${CMAKE_SOURCE_DIR}/src/plugins
-${CMAKE_SOURCE_DIR}/src/plugins/native
-${CMAKE_SOURCE_DIR}/src/plugins/LV2
-${CMAKE_SOURCE_DIR}/src/3rdparty/slv2
-${CMAKE_SOURCE_DIR}/src/traverso
-${CMAKE_SOURCE_DIR}/src/traverso/dialogs
-${QT_QTGUI_INCLUDE_DIR}
-${QT_QTXML_INCLUDE_DIR}
-)
-
-IF(HAVE_OPENGL)
-INCLUDE_DIRECTORIES(
-${QT_QTOPENGL_INCLUDE_DIR}
-)
-ENDIF(HAVE_OPENGL)
-
-SET(TRAVERSO_SONGCANVAS_SOURCES
-AudioClipView.cpp
-ClipsViewPort.cpp
-Cursors.cpp
-CurveNodeView.cpp
-CurveView.cpp
-FadeContextDialogView.cpp
-FadeView.cpp
-MarkerView.cpp
-PluginChainView.cpp
-PluginView.cpp
-PositionIndicator.cpp
-SongView.cpp
-SongWidget.cpp
-TimeLineView.cpp
-TimeLineViewPort.cpp
-TrackPanelView.cpp
-TrackPanelViewPort.cpp
-TrackView.cpp
-ViewItem.cpp
-dialogs/AudioClipEditDialog.cpp
-)
-
-SET(TRAVERSO_SONGCANVAS_MOC_CLASSES
-AudioClipView.h
-ClipsViewPort.h
-Cursors.h
-CurveNodeView.h
-FadeView.h
-MarkerView.h
-PluginChainView.h
-PluginView.h
-PositionIndicator.h
-TrackView.h
-ViewItem.h
-dialogs/AudioClipEditDialog.h
-CurveView.h
-SongView.h
-SongWidget.h
-TrackPanelView.h
-TimeLineView.h
-LineView.h
-)
-
-SET(TRAVERSO_SONGCANVAS_UI_FILES
-ui/AudioClipEditDialog.ui
-)
-
-QT4_WRAP_CPP(TRAVERSO_SONGCANVAS_MOC_SOURCES 
${TRAVERSO_SONGCANVAS_MOC_CLASSES})
-QT4_WRAP_UI(TRAVERSO_SONGCANVAS_UI_SOURCES ${TRAVERSO_SONGCANVAS_UI_FILES})
-
-
-SET(TRAVERSO_SONGCANVAS_LIBRARY "traversosongcanvas")
-
-ADD_LIBRARY(${TRAVERSO_SONGCANVAS_LIBRARY} STATIC 
-       ${TRAVERSO_SONGCANVAS_SOURCES} 
-       ${TRAVERSO_SONGCANVAS_MOC_SOURCES} 
-       ${TRAVERSO_SONGCANVAS_UI_SOURCES}
-)
-
-IF(USE_PCH)
-    ADD_DEPENDENCIES(traversosongcanvas precompiled_headers)
-ENDIF(USE_PCH)

Index: ClipsViewPort.cpp
===================================================================
RCS file: ClipsViewPort.cpp
diff -N ClipsViewPort.cpp
--- ClipsViewPort.cpp   15 Jan 2008 19:56:07 -0000      1.30
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,221 +0,0 @@
-/*
-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.
-
-*/
-
-#include "ClipsViewPort.h"
-
-#include "SongWidget.h"
-#include "SongView.h"
-#include "TrackView.h"
-#include "ViewItem.h"
-#include <libtraversocore.h>
-#include <Import.h>
-#include <CommandGroup.h>
-#include "RemoveClip.h"
-
-#include "AudioDevice.h"
-
-#include <QScrollBar>
-#include <QSet>
-#include <QPaintEngine>
-#include <QUrl>
-#include <QFileInfo>
-#include <QDir>
-               
-#include <Debugger.h>
-               
-ClipsViewPort::ClipsViewPort(QGraphicsScene* scene, SongWidget* sw)
-       : ViewPort(scene, sw)
-{
-
-       m_sw = sw;
-       viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
-       
-//     setViewportUpdateMode(SmartViewportUpdate);
-       setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-       setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-}
-
-void ClipsViewPort::get_pointed_context_items(QList<ContextItem* > &list)
-{
-       QList<QGraphicsItem *> itemlist = 
items(cpointer().on_first_input_event_x(), cpointer().on_first_input_event_y());
-       foreach(QGraphicsItem* item, itemlist) {
-               if (ViewItem::is_viewitem(item)) {
-                       list.append((ViewItem*)item);
-               }
-       }
-       list.append(m_sw->get_songview());
-}
-
-void ClipsViewPort::resizeEvent( QResizeEvent * e )
-{
-       ViewPort::resizeEvent(e);
-       m_sw->get_songview()->update_scrollbars();
-}
-
-
-void ClipsViewPort::paintEvent(QPaintEvent * e)
-{
-       QGraphicsView::paintEvent(e);
-}
-
-
-void ClipsViewPort::dragEnterEvent( QDragEnterEvent * event )
-{
-       m_imports.clear();
-       m_resourcesImport.clear();
-       
-       // let's see if the D&D was from the resources bin.
-       if 
(event->mimeData()->hasFormat("application/x-qabstractitemmodeldatalist")) {
-               QByteArray encodedData = 
event->mimeData()->data("application/x-qabstractitemmodeldatalist");
-               QDataStream stream(&encodedData, QIODevice::ReadOnly);
-               int r, c;
-               QMap<int, QVariant> v;
-               
-               while (!stream.atEnd()) {
-                       stream >> r >> c >> v;
-                       qint64 id = v.value(Qt::UserRole).toLongLong();
-                       if (!id) {
-                               continue;
-                       }
-                       m_resourcesImport.append(id);
-               }
-       }
-       
-       // and who knows, it could have been a D&D drop from a filemanager...
-       if (event->mimeData()->hasUrls()) {
-
-               foreach(QUrl url, event->mimeData()->urls()) {
-                       QString fileName = url.toLocalFile();
-                       
-                       if (fileName.isEmpty()) {
-                               continue;
-                       }
-                       
-                       Import* import = new Import(fileName);
-                       m_imports.append(import);
-                       
-                       // If a readsource fails to init, the D&D should be
-                       // marked as failed, cleanup allready created imports,
-                       // and clear the import list.
-                       if (import->create_readsource() == -1) {
-                               foreach(Import* import, m_imports) {
-                                       delete import;
-                               }
-                               m_imports.clear();
-                               break;
-                       }
-               }
-       }
-       
-       if (m_imports.size() || m_resourcesImport.size()) {
-               event->acceptProposedAction();
-       }
-}
-
-void ClipsViewPort::dropEvent(QDropEvent* event )
-{
-       PENTER;
-       Q_UNUSED(event)
-       
-       if (!importTrack) {
-               return;
-       }
-
-       CommandGroup* group = new CommandGroup(m_sw->get_song(), 
-                      tr("Import %n audiofile(s)", "", m_imports.size() + 
m_resourcesImport.size()), true);
-       
-       TimeRef startpos = TimeRef(mapFromGlobal(QCursor::pos()).x() * 
m_sw->get_songview()->timeref_scalefactor);
-       
-       foreach(qint64 id, m_resourcesImport) {
-               AudioClip* clip = resources_manager()->get_clip(id);
-               if (clip) {
-                       bool hadSong = clip->has_song();
-                       clip->set_song(m_sw->get_song());
-                       clip->set_track(importTrack);
-                       if (!hadSong) {
-                               clip->set_state(clip->get_dom_node());
-                       }
-                       clip->set_track_start_location(startpos);
-                       startpos = clip->get_track_end_location();
-                       AddRemoveClip* arc = new AddRemoveClip(clip, 
AddRemoveClip::ADD);
-                       group->add_command(arc);
-                       continue;
-               }
-               ReadSource* source = resources_manager()->get_readsource(id);
-               if (source) {
-                       clip = 
resources_manager()->new_audio_clip(source->get_short_name());
-                       resources_manager()->set_source_for_clip(clip, source);
-                       clip->set_song(importTrack->get_song());
-                       clip->set_track(importTrack);
-                       clip->set_track_start_location(startpos);
-                       startpos = clip->get_track_end_location();
-                       AddRemoveClip* arc = new AddRemoveClip(clip, 
AddRemoveClip::ADD);
-                       group->add_command(arc);
-               }
-       }
-       
-       bool firstItem = true;
-       foreach(Import* import, m_imports) {
-               import->set_track(importTrack);
-               if (firstItem) {
-                       // Place first item at cursor, others at end of track.
-                       import->set_position(startpos);
-                       firstItem = false;
-               }
-               group->add_command(import);
-       }
-
-       Command::process_command(group);
-}
-
-void ClipsViewPort::dragMoveEvent( QDragMoveEvent * event )
-{
-       Q_UNUSED(event)
-                       
-       Project* project = pm().get_project();
-       if (!project) {
-               return;
-       }
-       
-       Song* song = project->get_current_song();
-       
-       if (!song) {
-               return;
-       }
-       
-       importTrack = 0;
-       
-       // hmmm, code below is candidate for improvements...?
-       
-       // no mouse move events during D&D move events...
-       // So we need to calculate the scene pos ourselves.
-       QPointF mouseposTosScene = mapFromGlobal(QCursor::pos());
-       
-       QList<QGraphicsItem *> itemlist = items((int)mouseposTosScene.x(), 
(int)mouseposTosScene.y());
-       foreach(QGraphicsItem* obj, itemlist) {
-               TrackView* tv = dynamic_cast<TrackView*>(obj);
-               if (tv) {
-                       importTrack = tv->get_track();
-                       return;
-               }
-       }
-}
-

Index: ClipsViewPort.h
===================================================================
RCS file: ClipsViewPort.h
diff -N ClipsViewPort.h
--- ClipsViewPort.h     25 Apr 2007 15:58:50 -0000      1.10
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,60 +0,0 @@
-/*
-    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 CLIPS_VIEW_PORT_H
-#define CLIPS_VIEW_PORT_H
-
-#include <QGraphicsScene>
-#include <QGraphicsItem>
-#include <QStyleOptionGraphicsItem>
-
-#include "ViewPort.h"
-
-class SongWidget;
-class Import;
-               
-class ClipsViewPort : public ViewPort
-{
-       Q_OBJECT
-
-public:
-       ClipsViewPort(QGraphicsScene* scene, SongWidget* sw);
-       ~ClipsViewPort() {};
-       
-        void get_pointed_context_items(QList<ContextItem* > &list);
-
-protected:
-        void resizeEvent(QResizeEvent* e);
-       void paintEvent( QPaintEvent* e);
-       void dragEnterEvent(QDragEnterEvent *event);
-       void dropEvent(QDropEvent *event);
-       void dragMoveEvent(QDragMoveEvent *event);
-private:
-       SongWidget*     m_sw;
-       QList<Import*>  m_imports;
-       QList<qint64 >  m_resourcesImport;
-       Track*          importTrack;
-};
-
-
-#endif
-
-//eof

Index: Cursors.cpp
===================================================================
RCS file: Cursors.cpp
diff -N Cursors.cpp
--- Cursors.cpp 7 Jan 2008 18:18:05 -0000       1.37
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,313 +0,0 @@
-/*
-    Copyright (C) 2005-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 "Cursors.h"
-#include "SongView.h"
-#include "ClipsViewPort.h"
-#include "AudioDevice.h"
-#include <QPen>
-#include <Song.h>
-#include <Config.h>
-#include <Themer.h>
-#include <QScrollBar>
-               
-// Always put me below _all_ includes, this is needed
-// in case we run with memory leak detection enabled!
-#include "Debugger.h"
-
-#define ANIME_DURATION         1000
-#define AUTO_SCROLL_MARGIN     0.05  // autoscroll when within 5% of the clip 
view port
-
-
-PlayHead::PlayHead(SongView* sv, Song* song, ClipsViewPort* vp)
-       : ViewItem(0, song)
-       , m_song(song)
-       , m_vp(vp)
-{
-       m_sv = sv;
-       check_config();
-       connect(&(config()), SIGNAL(configChanged()), this, 
SLOT(check_config()));
-       
-       // TODO: Make duration scale with scalefactor? (nonlinerly?)
-       m_animation.setDuration(ANIME_DURATION);
-       m_animation.setCurveShape(QTimeLine::SineCurve);
-       
-       connect(m_song, SIGNAL(transferStarted()), this, SLOT(play_start()));
-       connect(m_song, SIGNAL(transferStopped()), this, SLOT(play_stop()));
-       
-       connect(&m_playTimer, SIGNAL(timeout()), this, SLOT(update_position()));
-       
-       connect(&m_animation, SIGNAL(frameChanged(int)), this, 
SLOT(set_animation_value(int)));
-       connect(&m_animation, SIGNAL(finished()), this, 
SLOT(animation_finished()));
-       
-       setZValue(99);
-}
-
-PlayHead::~PlayHead( )
-{
-        PENTERDES2;
-}
-
-void PlayHead::check_config( )
-{
-       m_mode = (PlayHeadMode) config().get_property("PlayHead", "Scrollmode", 
ANIMATED_FLIP_PAGE).toInt();
-       m_follow = config().get_property("PlayHead", "Follow", true).toBool();
-}
-
-void PlayHead::paint( QPainter * painter, const QStyleOptionGraphicsItem * 
option, QWidget * widget )
-{
-       Q_UNUSED(option);
-       Q_UNUSED(widget);
-       QColor color;
-       
-       if (m_song->is_transport_rolling()) {
-               color = themer()->get_color("Playhead:active");
-       } else {
-               color = themer()->get_color("Playhead:inactive");
-       }
-       
-       painter->fillRect(0, 0, (int)m_boundingRect.width(), 
(int)m_boundingRect.height(), color);
-}
-
-void PlayHead::play_start()
-{
-       show();
-
-       m_followDisabled = false;
-
-       m_playTimer.start(20);
-       
-       if (m_animation.state() == QTimeLine::Running) {
-               m_animation.stop();
-               m_animation.setCurrentTime(0);
-       }
-}
-
-void PlayHead::play_stop()
-{
-       m_playTimer.stop();
-
-       if (m_animation.state() == QTimeLine::Running) {
-               m_animation.stop();
-               m_animation.setCurrentTime(0);
-       }
-
-       update();
-}
-
-void PlayHead::disable_follow()
-{
-       m_followDisabled = true;
-}
-
-void PlayHead::enable_follow()
-{
-       m_followDisabled = false;
-       // This function is called after the song finished a seek action.
-       // if the song is still playing, update our position, and start moving 
again!
-       if (m_song->is_transport_rolling()) {
-               play_start();
-       }
-}
-
-void PlayHead::update_position()
-{
-       QPointF newPos(m_song->get_transport_location() / 
m_sv->timeref_scalefactor, 1);
-       qreal playBufferTimePositionCompensation = 0;
-       if (m_song->is_transport_rolling()) {
-               playBufferTimePositionCompensation = 
audiodevice().get_buffer_latency() / m_sv->timeref_scalefactor;
-       }
-       qreal newXPos = newPos.x() - playBufferTimePositionCompensation;
-       if (newXPos < 0.0) {
-               newXPos = 0.0;
-       }
-       newPos.setX(newXPos);
-       
-       if (int(newPos.x()) != int(pos().x()) && (m_animation.state() != 
QTimeLine::Running)) {
-               setPos(newPos);
-       } else {
-               return;
-       }
-       
-       if ( ! m_follow || m_followDisabled || ! 
m_song->is_transport_rolling()) {
-               return;
-       }
-       
-       int vpWidth = m_vp->viewport()->width();
-       
-       if (m_mode == CENTERED) {
-               m_sv->set_hscrollbar_value((int)scenePos().x() - (int)(0.5 * 
vpWidth));
-               return;
-       }
-        
-       QPoint vppoint = m_vp->mapFromScene(pos());
-       
-       if (vppoint.x() < 0 || (vppoint.x() > vpWidth)) {
-               
-               // If the playhead is _not_ in the viewports range, center it 
in the middle!
-               m_sv->set_hscrollbar_value((int)scenePos().x() - (int)(0.5 * 
vpWidth));
-       
-       } else if (vppoint.x() > ( vpWidth * (1.0 - AUTO_SCROLL_MARGIN) )) {
-               
-               // If the playhead is in the viewports range, and is nearing 
the end
-               // either start the animated flip page, or flip the page and 
place the 
-               // playhead cursor ~ 1/10 from the left viewport border
-               if (m_mode == ANIMATED_FLIP_PAGE) {
-                       if (m_animation.state() != QTimeLine::Running) {
-                               m_animFrameRange = (int)(vpWidth * (1.0 - 
(AUTO_SCROLL_MARGIN * 2)));
-                               m_totalAnimValue = 0;
-                               m_animation.setFrameRange(0, m_animFrameRange);
-                               calculate_total_anim_frames();
-                               m_animationScrollStartPos = 
m_sv->hscrollbar_value();
-                               //during the animation, we stop the play update 
timer
-                               // to avoid unnecessary update/paint events
-                               play_stop();
-                               m_animation.start();
-                       }
-               } else {
-                       m_sv->set_hscrollbar_value((int) ((int)scenePos().x() - 
(AUTO_SCROLL_MARGIN * vpWidth)) );
-               }
-       }
-}
-
-
-void PlayHead::set_animation_value(int value)
-{
-       QPointF newPos(m_song->get_transport_location() / 
m_sv->timeref_scalefactor, 0);
-       // calculate the motion distance of the playhead.
-       qreal deltaX = newPos.x() - pos().x();
-       
-       // calculate the animation x diff.
-       int diff = (int)(0.5 + ((float)(value) / m_totalAnimFrames) * 
m_animFrameRange);
-       m_totalAnimValue += (int)(diff + deltaX);
-       int newXPos = (int)(m_animationScrollStartPos + m_totalAnimValue);
-       
-       if (newPos != pos()) {
-               setPos(newPos);
-       }
-       
-       m_sv->set_hscrollbar_value(newXPos);
-}
-
-void PlayHead::calculate_total_anim_frames()
-{
-       int count = (ANIME_DURATION / 40);
-       m_totalAnimFrames = 0;
-       for (int i=0; i<count; ++i) {
-               m_totalAnimFrames += m_animation.frameForTime(i*40);
-       }
-}
-
-
-void PlayHead::animation_finished()
-{
-       if (m_song->is_transport_rolling()) {
-               play_start();
-       }
-}
-
-
-void PlayHead::set_bounding_rect( QRectF rect )
-{
-       m_boundingRect = rect;
-}
-
-bool PlayHead::is_active()
-{
-       return m_playTimer.isActive();
-}
-
-void PlayHead::set_active(bool active)
-{
-       if (active) {
-               play_start();
-       } else {
-               play_stop();
-       }
-}
-
-void PlayHead::set_mode( PlayHeadMode mode )
-{
-       m_mode = mode;
-}
-
-void PlayHead::toggle_follow( )
-{
-       m_follow = ! m_follow;
-}
-
-
-
-/**************************************************************/
-/*                    WorkCursor                              */
-/**************************************************************/
-
-
-WorkCursor::WorkCursor(SongView* sv, Song* song)
-       : ViewItem(0, song)
-       , m_song(song)
-       , m_sv(sv)
-{
-       setZValue(100);
-}
-
-WorkCursor::~WorkCursor( )
-{
-        PENTERDES2;
-}
-
-void WorkCursor::paint( QPainter * painter, const QStyleOptionGraphicsItem * 
option, QWidget * widget )
-{
-       Q_UNUSED(option);
-       Q_UNUSED(widget);
-       
-       if (m_pix.height() != int(m_boundingRect.height())) {
-               update_background();
-       }
-       
-       painter->drawPixmap(0, 0, int(m_boundingRect.width()), 
int(m_boundingRect.height()), m_pix);
-}
-
-void WorkCursor::update_position()
-{
-       setPos(m_song->get_work_location() / m_sv->timeref_scalefactor, 1);
-}
-
-void WorkCursor::set_bounding_rect( QRectF rect )
-{
-       m_boundingRect = rect;
-}
-
-void WorkCursor::update_background()
-{
-       m_pix = QPixmap(int(m_boundingRect.width()), 
int(m_boundingRect.height()));
-       m_pix.fill(Qt::transparent);
-       QPainter p(&m_pix);
-       QPen pen;
-       pen.setWidth(4);
-       pen.setStyle(Qt::DashDotLine);
-       pen.setColor(themer()->get_color("Workcursor:default"));
-       p.setPen(pen);
-       p.drawLine(0, 0, int(m_boundingRect.width()), 
int(m_boundingRect.height()));
-}
-
-
-

Index: Cursors.h
===================================================================
RCS file: Cursors.h
diff -N Cursors.h
--- Cursors.h   27 Nov 2007 13:11:56 -0000      1.16
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,111 +0,0 @@
-/*
-    Copyright (C) 2005-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 CURSORS_H
-#define CURSORS_H
-
-#include "ViewItem.h"
-#include <QTimer>
-#include <QTimeLine>
-
-class Song;
-class SongView;
-class ClipsViewPort;
-               
-class PlayHead : public ViewItem
-{
-        Q_OBJECT
-
-public:
-        PlayHead(SongView* sv, Song* song, ClipsViewPort* vp);
-        ~PlayHead();
-
-       void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-       void set_bounding_rect(QRectF rect);
-       
-       bool is_active();
-       void set_active(bool active);
-       
-       enum PlayHeadMode {
-               FLIP_PAGE,
-               CENTERED,
-               ANIMATED_FLIP_PAGE
-       };
-       
-       void set_mode(PlayHeadMode mode);
-       void toggle_follow();
-
-private:
-       Song*           m_song;
-        QTimer         m_playTimer;
-        QTimeLine      m_animation;
-        ClipsViewPort* m_vp;
-        bool           m_follow;
-       bool            m_followDisabled;
-        PlayHeadMode   m_mode;
-        int            m_animationScrollStartPos;
-       int             m_animFrameRange;
-       int             m_totalAnimFrames;
-       int             m_totalAnimValue;
-       
-       void calculate_total_anim_frames();
-
-private slots:
-       void check_config();
-        void play_start();
-        void play_stop();
-        void set_animation_value(int);
-        void animation_finished();
-        
-public slots:
-        void update_position();
-        void enable_follow();  // enable/disable follow only do anything if 
following is
-        void disable_follow(); // enabled in the config
-};
-
-
-
-class WorkCursor : public ViewItem
-{
-        Q_OBJECT
-
-public:
-        WorkCursor(SongView* sv, Song* song);
-        ~WorkCursor();
-
-       void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-       void set_bounding_rect(QRectF rect);
-
-private:
-       Song*           m_song;
-       SongView*       m_sv;
-       QPixmap         m_pix;
-       
-       void update_background();
-
-public slots:
-        void update_position();
-};
-
-
-#endif
-
-//eof

Index: CurveNodeView.cpp
===================================================================
RCS file: CurveNodeView.cpp
diff -N CurveNodeView.cpp
--- CurveNodeView.cpp   5 Nov 2007 15:49:32 -0000       1.13
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,141 +0,0 @@
-/*
-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.
-
-*/
-
-#include "CurveNodeView.h"
-#include "SongView.h"
-
-#include <QPainter>
-#include <QPen>
-#include <CurveNode.h>
-#include <Themer.h>
-#include <Curve.h>
-#include "CurveView.h"
-
-#include <Debugger.h>
-
-CurveNodeView::CurveNodeView( SongView * sv, CurveView* curveview, CurveNode * 
node, Curve* guicurve)
-       : ViewItem(curveview, 0)
-       , CurveNode(guicurve, node->get_when(), node->get_value())
-       , m_node(node)
-{
-       PENTERCONS;
-       m_sv = sv;
-       m_curveview = curveview;
-       int size = themer()->get_property("CurveNode:diameter", 6).toInt();
-       setCursor(themer()->get_cursor("CurveNode"));
-       m_boundingRect = QRectF(0, 0, size, size);
-       load_theme_data();
-       
-       connect(m_node->m_curve, SIGNAL(nodePositionChanged()), this, 
SLOT(update_pos()));
-}
-
-CurveNodeView::~ CurveNodeView( )
-{
-       PENTERDES;
-}
-
-void CurveNodeView::paint( QPainter * painter, const QStyleOptionGraphicsItem 
* option, QWidget * widget )
-{
-       Q_UNUSED(option);
-       Q_UNUSED(widget);
-       
-       painter->save();
-       
-       QPen pen;
-       pen.setColor(m_color);
-       
-       QPointF mapped = mapToParent(QPointF(0, 0));
-       int x = (int) mapped.x();
-       int y = (int) mapped.y();
-       int heightadjust = 0;
-       int widthadjust = 0;
-       
-       if ( (y + m_boundingRect.height()) > (int) 
m_parentViewItem->boundingRect().height() ) {
-               heightadjust = y - 
(int)m_parentViewItem->boundingRect().height() + (int) m_boundingRect.height();
-       }
-       
-       if ( (x + m_boundingRect.width()) > (int) 
m_parentViewItem->boundingRect().width() ) {
-               widthadjust = x - (int) 
m_parentViewItem->boundingRect().width() + (int) m_boundingRect.width();
-       }
-               
-//     printf("widthadjust is %d, heightadjust = %d\n", widthadjust, 
heightadjust);
-       if (x > 0) x = 0;
-       if (y > 0) y = 0;
-       
-       QRectF rect = m_boundingRect.adjusted(- x, - y, - widthadjust, 
-heightadjust);
-       painter->setClipRect(rect);
-       painter->setRenderHint(QPainter::Antialiasing);
-       painter->setPen(pen);
-       
-       QPainterPath path;
-       path.addEllipse(m_boundingRect);
-       
-       painter->fillPath(path, QBrush(m_color));
-       
-       painter->restore();
-} 
-
-
-void CurveNodeView::calculate_bounding_rect()
-{
-       update_pos();
-}
-
-
-void CurveNodeView::set_color(QColor color)
-{
-       m_color = color;
-}
-
-void CurveNodeView::update_pos( )
-{
-       qreal halfwidth = (m_boundingRect.width() / 2);
-       qreal parentheight = m_parentViewItem->boundingRect().height();
-       qreal when = ((TimeRef(m_node->get_when()) - 
m_curveview->get_start_offset()) / m_sv->timeref_scalefactor) - halfwidth;
-       qreal value = parentheight - (m_node->get_value() * parentheight + 
halfwidth);
-       setPos(when, value);
-               
-       set_when_and_value((m_node->get_when() / m_sv->timeref_scalefactor), 
m_node->get_value());
-}
-
-void CurveNodeView::set_selected( )
-{
-       int size = themer()->get_property("CurveNode:diameter", 6).toInt();
-       m_boundingRect.setWidth(size + 1);
-       m_boundingRect.setHeight(size + 1);
-       update_pos();
-}
-
-void CurveNodeView::reset_size( )
-{
-       int size = themer()->get_property("CurveNode:diameter", 6).toInt();
-       m_boundingRect.setWidth(size);
-       m_boundingRect.setHeight(size);
-       update_pos();
-}
-
-void CurveNodeView::load_theme_data()
-{
-       m_color = themer()->get_color("CurveNode:default");
-       calculate_bounding_rect();
-}
-
-

Index: CurveNodeView.h
===================================================================
RCS file: CurveNodeView.h
diff -N CurveNodeView.h
--- CurveNodeView.h     15 Jan 2008 19:56:07 -0000      1.8
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,61 +0,0 @@
-/*
-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 CURVE_NODE_VIEW_H
-#define CURVE_NODE_VIEW_H
-
-#include "ViewItem.h"
-
-#include <CurveNode.h>
-
-class CurveView;
-
-class CurveNodeView : public ViewItem, public CurveNode
-{
-       Q_OBJECT
-
-public:
-       CurveNodeView(SongView* sv, CurveView* curveview, CurveNode* node, 
Curve* guicurve);
-       ~CurveNodeView();
-       
-       void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-       void calculate_bounding_rect();
-       void set_selected();
-       void reset_size();
-       
-       void set_color(QColor color);
-       void load_theme_data();
-       CurveNode* get_curve_node() const {return m_node;}
-       
-private:
-       CurveView*      m_curveview;
-       CurveNode*      m_node;
-       QColor          m_color;
-
-public slots:
-       void update_pos();
-};
-
-#endif
-
-//eof
- 
- 

Index: CurveView.cpp
===================================================================
RCS file: CurveView.cpp
diff -N CurveView.cpp
--- CurveView.cpp       12 Dec 2007 18:13:37 -0000      1.75
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,669 +0,0 @@
-/*
-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.
-
-*/
-
-#include "CurveView.h"
-#include "SongView.h"
-#include "CurveNodeView.h"
-#include "ClipsViewPort.h"
-#include <Themer.h>
-#include "AudioDevice.h"
-               
-#include <Curve.h>
-#include <CurveNode.h>
-#include <ContextPointer.h>
-#include <Song.h>
-#include <InputEngine.h>
-
-#include <AddRemove.h>
-#include "CommandGroup.h"
-
-#include <Debugger.h>
-
-
-#define NODE_SOFT_SELECTION_DISTANCE 40
-       
-DragNode::DragNode(CurveNode* node,
-       CurveView* curveview,
-       qint64 scalefactor,
-       TimeRef rangeMin,
-       TimeRef rangeMax,
-       const QString& des)
-       : Command(curveview->get_context(), des)
-       , d(new Private)
-{
-       m_node = node;
-       d->rangeMin = rangeMin;
-       d->rangeMax = rangeMax;
-       d->curveView = curveview;
-       d->scalefactor = scalefactor;
-       d->verticalOnly = false;
-}
-
-void DragNode::set_vertical_only()
-{
-       d->verticalOnly = true;
-}
-
-int DragNode::prepare_actions()
-{
-       return 1;
-}
-
-int DragNode::finish_hold()
-{
-       delete d;
-       return 1;
-}
-
-void DragNode::cancel_action()
-{
-       delete d;
-       undo_action();
-}
-
-int DragNode::begin_hold()
-{
-       m_origWhen = m_newWhen = m_node->get_when();
-       m_origValue = m_newValue = m_node->get_value();
-       
-       d->mousepos = QPoint(cpointer().on_first_input_event_x(), 
cpointer().on_first_input_event_y());
-       return 1;
-}
-
-
-int DragNode::do_action()
-{
-       m_node->set_when_and_value(m_newWhen, m_newValue);
-       return 1;
-}
-
-int DragNode::undo_action()
-{
-       m_node->set_when_and_value(m_origWhen, m_origValue);
-       return 1;
-}
-
-void DragNode::move_up(bool )
-{
-       m_newValue = m_newValue + ( 1 / d->curveView->boundingRect().height());
-       calculate_and_set_node_values();
-}
-
-void DragNode::move_down(bool )
-{
-       m_newValue = m_newValue - ( 1 / d->curveView->boundingRect().height());
-       calculate_and_set_node_values();
-}
-
-void DragNode::set_cursor_shape(int useX, int useY)
-{
-       cpointer().get_viewport()->set_holdcursor(":/cursorHoldLrud");
-}
-
-int DragNode::jog()
-{
-       QPoint mousepos = cpointer().pos();
-       
-       int dx, dy;
-       dx = mousepos.x() - d->mousepos.x();
-       dy = mousepos.y() - d->mousepos.y();
-       
-       d->mousepos = mousepos;
-       
-       if (!d->verticalOnly) {
-               m_newWhen = m_newWhen + dx * d->scalefactor;
-       }
-       m_newValue = m_newValue - ( dy / d->curveView->boundingRect().height());
-       
-       TimeRef startoffset = d->curveView->get_start_offset();
-       if ( ((TimeRef(m_newWhen) - startoffset) / d->scalefactor) > 
d->curveView->boundingRect().width()) {
-               m_newWhen = double(d->curveView->boundingRect().width() * 
d->scalefactor + startoffset.universal_frame());
-       }
-       if ((TimeRef(m_newWhen) - startoffset) < TimeRef()) {
-               m_newWhen = startoffset.universal_frame();
-       }
-       
-       return calculate_and_set_node_values();
-}
-
-int DragNode::calculate_and_set_node_values()
-{
-       if (m_newValue < 0.0) {
-               m_newValue = 0.0;
-       }
-       if (m_newValue > 1.0) {
-               m_newValue = 1.0;
-       }
-       if (m_newWhen < 0.0) {
-               m_newWhen = 0.0;
-       }
-       
-       if (m_newWhen < d->rangeMin) {
-               m_newWhen = double(d->rangeMin.universal_frame());
-       } else if (d->rangeMax != qint64(-1) && m_newWhen > d->rangeMax) {
-               m_newWhen = double(d->rangeMax.universal_frame());
-       }
-
-       // NOTE: this obviously only makes sense when the Node == GainEnvelope 
Node
-       // Use a delegate (or something similar) in the future that set's the 
correct value.
-       float dbFactor = coefficient_to_dB(m_newValue);
-       
cpointer().get_viewport()->set_holdcursor_text(QByteArray::number(dbFactor, 
'f', 2).append(" dB"));
-       cpointer().get_viewport()->set_holdcursor_pos(d->mousepos +
-                       QPoint(d->curveView->get_songview()->hscrollbar_value(),
-                       d->curveView->get_songview()->vscrollbar_value()) -
-                       QPoint(16, 16));
-       
-       return do_action();
-}
-
-
-               
-CurveView::CurveView(SongView* sv, ViewItem* parentViewItem, Curve* curve)
-       : ViewItem(parentViewItem, curve)
-       , m_curve(curve)
-{
-       setZValue(parentViewItem->zValue() + 1);
-       
-       m_sv = sv;
-#if QT_VERSION < 0x040300
-       m_sv->scene()->addItem(this);
-#endif
-       load_theme_data();
-       
-       m_blinkColorDirection = 1;
-       m_blinkingNode = 0;
-       m_startoffset = TimeRef();
-       m_guicurve = new Curve(0);
-       m_guicurve->set_song(sv->get_song());
-       
-       apill_foreach(CurveNode* node, CurveNode, m_curve->get_nodes()) {
-               add_curvenode_view(node);
-       }
-       
-       connect(&m_blinkTimer, SIGNAL(timeout()), this, 
SLOT(update_blink_color()));
-       connect(m_curve, SIGNAL(nodeAdded(CurveNode*)), this, 
SLOT(add_curvenode_view(CurveNode*)));
-       connect(m_curve, SIGNAL(nodeRemoved(CurveNode*)), this, 
SLOT(remove_curvenode_view(CurveNode*)));
-       connect(m_curve, SIGNAL(nodePositionChanged()), this, 
SLOT(node_moved()));
-       connect(m_sv->get_song(), SIGNAL(modeChanged()), this, 
SLOT(set_view_mode()));
-       
-       setAcceptsHoverEvents(true);
-       
-       set_view_mode();
-}
-
-CurveView::~ CurveView( )
-{
-       m_guicurve->clear_curve();
-       delete m_guicurve;
-}
-
-static bool smallerpoint(const QPointF& left, const QPointF& right) {
-       return left.x() < right.x();
-}
-
-void CurveView::paint( QPainter * painter, const QStyleOptionGraphicsItem * 
option, QWidget * widget )
-{
-       Q_UNUSED(widget);
-       PENTER2;
-       
-       
-       int xstart = (int) option->exposedRect.x();
-       int pixelcount = (int) option->exposedRect.width()+1;
-       int height = int(m_boundingRect.height());
-       int offset = int(m_startoffset / m_sv->timeref_scalefactor);
-       
-       QPen pen;
-       
-       if (m_sv->get_song()->get_mode() == Song::EFFECTS) {
-               pen.setColor(themer()->get_color("Curve:active"));
-       } else {
-               pen.setColor(themer()->get_color("Curve:inactive"));
-       }
-       
-       painter->save();
-       painter->setPen(pen);
-       painter->setClipRect(m_boundingRect);
-       
-       
-       if (m_nodeViews.size() == 1) {
-               int y = int(height - (m_nodeViews.first()->value * height));
-               painter->drawLine(xstart, y, xstart + pixelcount, y);
-               painter->restore();
-               return;
-       }
-       
-       if (m_nodeViews.first()->when > xstart) {
-               int y = int(height - (m_nodeViews.first()->value * height));
-               int length = int(m_nodeViews.first()->when) - xstart - offset;
-               if (length > 0) {
-                       painter->drawLine(xstart, y, xstart + length, y);
-                       xstart += length;
-                       pixelcount -= length;
-               }
-               if (pixelcount <= 0) {
-                       painter->restore();
-                       return;
-               }
-       }
-       
-       if (m_nodeViews.last()->when < (xstart + pixelcount + offset)) {
-               int y = int(height - (m_nodeViews.last()->value * height));
-               int x = int(m_nodeViews.last()->when) - offset;
-               int length = (xstart + pixelcount) - 
int(m_nodeViews.last()->when) + offset;
-               if (length > 0) {
-                       painter->drawLine(x, y, x + length - 1, y);
-                       pixelcount -= length;
-               }
-               if (pixelcount <= 0) {
-                       painter->restore();
-                       return;
-               }
-       }
-       
-       
-       // Path's need an additional pixel righ/left to be painted correctly.
-       // FadeView get_curve adjusts for this, if changing these 
-       // values, also change the adjustment in FadeView::get_curve() !!!
-       pixelcount += 2;
-       xstart -= 1;
-       if (xstart < 0) {
-               xstart = 0;
-       }
-       
-       painter->setRenderHint(QPainter::Antialiasing);
-       
-       QPolygonF polygon;
-       float vector[pixelcount];
-       
-//     printf("range: %d\n", (int)m_nodeViews.last()->pos().x());
-       m_guicurve->get_vector(xstart + offset,
-                               xstart + pixelcount + offset,
-                               vector,
-                               pixelcount);
-       
-       for (int i=0; i<pixelcount; i++) {
-               polygon <<  QPointF(xstart + i, height - (vector[i] * height) );
-       }
-       
-       // Depending on the zoom level, curve nodes can end up to be aligned 
-       // vertically at the exact same x position. The curve line won't be 
painted
-       // by the routine above (it doesn't catch the second node position 
obviously)
-       // so we add curvenodes _always_ to solve this problem easily :-)
-       apill_foreach(CurveNodeView* view, CurveNodeView, m_nodeViews) {
-               qreal x = view->x();
-               if ( (x > xstart) && x < (xstart + pixelcount)) {
-                       polygon <<  QPointF( x + view->boundingRect().width() / 
2,
-                               (height - (view->get_curve_node()->get_value() 
* height)) );
-               }
-       }
-       
-       // Which means we have to sort the polygon *sigh* (rather cpu costly, 
but what can I do?)
-       qSort(polygon.begin(), polygon.end(), smallerpoint);
-       
-/*     for (int i=0; i<polygon.size(); ++i) {
-               printf("polygin %d, x=%d, y=%d\n", i, (int)polygon.at(i).x(), 
(int)polygon.at(i).y());
-       }*/
-       
-       QPainterPath path;
-       path.addPolygon(polygon);
-       
-       painter->drawPath(path);
-       
-       if (xstart <= 100) {
-               
painter->setFont(themer()->get_font("CurveView:fontscale:label"));
-               painter->drawText(10, (int)(m_boundingRect.height() - 14), 
"Gain Curve");
-       }
-       
-       painter->restore();
-}
-
-int CurveView::get_vector(int xstart, int pixelcount, float* arg)
-{
-       if (m_guicurve->get_nodes().size() == 1 && 
((CurveNode*)m_guicurve->get_nodes().first())->value == 1.0) {
-               return 0;
-       }
-       
-       m_guicurve->get_vector(xstart, xstart + pixelcount, arg, pixelcount);
-       
-       return 1;
-}
-
-void CurveView::add_curvenode_view(CurveNode* node)
-{
-       CurveNodeView* nodeview = new CurveNodeView(m_sv, this, node, 
m_guicurve);
-#if QT_VERSION < 0x040300
-       m_sv->scene()->addItem(nodeview);
-#endif
-       m_nodeViews.append(nodeview);
-       
-       AddRemove* cmd = (AddRemove*) m_guicurve->add_node(nodeview, false);
-       cmd->set_instantanious(true);
-       Command::process_command(cmd);
-       
-       qSort(m_nodeViews.begin(), m_nodeViews.end(), Curve::smallerNode);
-       
-       update_softselected_node(cpointer().pos());
-       update();
-}
-
-void CurveView::remove_curvenode_view(CurveNode* node)
-{
-       apill_foreach(CurveNodeView* nodeview, CurveNodeView, m_nodeViews) {
-               if (nodeview->get_curve_node() == node) {
-                       m_nodeViews.removeAll(nodeview);
-                       if (nodeview == m_blinkingNode) {
-                               update_softselected_node(cpointer().pos());
-                       }
-                       AddRemove* cmd = (AddRemove*) 
m_guicurve->remove_node(nodeview, false);
-                       cmd->set_instantanious(true);
-                       Command::process_command(cmd);
-                       
-                       scene()->removeItem(nodeview);
-                       delete nodeview;
-                       update();
-                       return;
-               }
-       }
-}
-
-void CurveView::calculate_bounding_rect()
-{
-       int y  = m_parentViewItem->get_childview_y_offset();
-       m_boundingRect = QRectF(0, 0, m_parentViewItem->boundingRect().width(), 
m_parentViewItem->get_height());
-       setPos(0, y);
-       ViewItem::calculate_bounding_rect();
-}
-
-void CurveView::hoverEnterEvent ( QGraphicsSceneHoverEvent * event )
-{
-       Q_UNUSED(event);
-       
-       m_blinkTimer.start(40);
-}
-
-void CurveView::hoverLeaveEvent ( QGraphicsSceneHoverEvent * event )
-{
-       Q_UNUSED(event);
-       
-       if (ie().is_holding()) {
-               event->ignore();
-               return;
-       }
-       
-       m_blinkTimer.stop();
-       if (m_blinkingNode) {
-               
m_blinkingNode->set_color(themer()->get_color("CurveNode:default"));
-               m_blinkingNode->reset_size();
-               m_blinkingNode = 0;
-       }
-}
-       
-       
-void CurveView::hoverMoveEvent ( QGraphicsSceneHoverEvent * event )
-{
-       QPoint point((int)event->pos().x(), (int)event->pos().y());
-       
-       update_softselected_node(point);
-
-       if (m_blinkingNode) {
-               setCursor(themer()->get_cursor("CurveNode"));
-       } else {
-               setCursor(themer()->get_cursor("AudioClip"));
-       }
-//     printf("mouse x,y pos %d,%d\n", point.x(), point.y());
-       
-//     printf("\n");
-}
-
-
-void CurveView::update_softselected_node( QPoint pos , bool force)
-{
-       if (ie().is_holding() && !force) {
-               return;
-       }
-       
-       CurveNodeView* prevNode = m_blinkingNode;
-       m_blinkingNode = m_nodeViews.first();
-       
-       if (! m_blinkingNode)
-               return;
-       
-       foreach(CurveNodeView* nodeView, m_nodeViews) {
-               
-               QPoint nodePos((int)nodeView->pos().x(), 
(int)nodeView->pos().y());
-//             printf("node x,y pos %d,%d\n", nodePos.x(), nodePos.y());
-               
-               int nodeDist = (pos - nodePos).manhattanLength();
-               int blinkNodeDist = (pos - QPoint((int)m_blinkingNode->x(), 
(int)m_blinkingNode->y())).manhattanLength();
-               
-               if (nodeDist < blinkNodeDist) {
-                       m_blinkingNode = nodeView;
-               }
-       }
-
-       if ((pos - QPoint(4, 4) - QPoint((int)m_blinkingNode->x(), 
(int)m_blinkingNode->y())).manhattanLength() > NODE_SOFT_SELECTION_DISTANCE) {
-               m_blinkingNode = 0;
-       }
-       
-       if (prevNode && (prevNode != m_blinkingNode) ) {
-               prevNode->set_color(themer()->get_color("CurveNode:default"));
-               prevNode->update();
-               prevNode->reset_size();
-               if (m_blinkingNode) {
-                       m_blinkingNode->set_selected();
-               }
-       }
-       if (!prevNode && m_blinkingNode) {
-               m_blinkingNode->set_selected();
-               m_blinkDarkness = 100;
-       }
-}
-
-
-void CurveView::update_blink_color()
-{
-       if (!m_blinkingNode) {
-               return;
-       }
-       
-       m_blinkDarkness += (6 * m_blinkColorDirection);
-       
-       if (m_blinkDarkness >= 100) {
-               m_blinkColorDirection *= -1;
-               m_blinkDarkness = 100;
-       } else if (m_blinkDarkness <= 40) {
-               m_blinkColorDirection *= -1;
-               m_blinkDarkness = 40;
-       }
-       
-       QColor blinkColor = themer()->get_color("CurveNode:blink");
-       
-       m_blinkingNode->set_color(blinkColor.light(m_blinkDarkness));
-       
-       m_blinkingNode->update();
-}
-
-
-Command* CurveView::add_node()
-{
-       PENTER;
-       QPointF point = mapFromScene(cpointer().scene_pos());
-
-       emit curveModified();
-       
-       double when = point.x() * double(m_sv->timeref_scalefactor) + 
m_startoffset.universal_frame();
-       double value = (m_boundingRect.height() - point.y()) / 
m_boundingRect.height();
-       
-       CurveNode* node = new CurveNode(m_curve, when, value);
-       
-       return m_curve->add_node(node);
-}
-
-
-Command* CurveView::remove_node()
-{
-       PENTER;
-
-       QPointF 
origPos(mapFromScene(QPoint(cpointer().on_first_input_event_scene_x(), 
cpointer().on_first_input_event_scene_y())));
-
-       emit curveModified();
-
-       update_softselected_node(QPoint((int)origPos.x(), (int)origPos.y()), 
true);
-
-       if (m_blinkingNode) {
-               CurveNode* node = m_blinkingNode->get_curve_node();
-               m_blinkingNode = 0;
-               return m_curve->remove_node(node);
-       }
-       return ie().did_not_implement();
-}
-
-Command* CurveView::drag_node()
-{
-       PENTER;
-
-       QPointF 
origPos(mapFromScene(QPoint(cpointer().on_first_input_event_scene_x(), 
cpointer().on_first_input_event_scene_y())));
-
-       update_softselected_node(QPoint((int)origPos.x(), (int)origPos.y()), 
true);
-       
-       if (m_blinkingNode) {
-               TimeRef min(qint64(0));
-               TimeRef max(qint64(-1));
-               APILinkedList nodeList = m_curve->get_nodes();
-               CurveNode* node = m_blinkingNode->get_curve_node();
-               int index = nodeList.indexOf(node);
-               
-               emit curveModified();
-               
-               if (index > 0) {
-                       min = 
qint64(((CurveNode*)nodeList.at(index-1))->get_when() + 1);
-               }
-               if (nodeList.size() > (index + 1)) {
-                       max = 
qint64(((CurveNode*)nodeList.at(index+1))->get_when() - 1);
-               }
-               return new DragNode(m_blinkingNode->get_curve_node(), this, 
m_sv->timeref_scalefactor, min, max, tr("Drag Node"));
-       }
-       return ie().did_not_implement();
-}
-
-
-Command * CurveView::drag_node_vertical_only()
-{
-       DragNode* drag = qobject_cast<DragNode*>(drag_node());
-       
-       if (!drag) {
-               return 0;
-       }
-       
-       drag->set_vertical_only();
-       
-       return drag;
-}
-
-
-void CurveView::node_moved( )
-{
-       if (!m_blinkingNode) {
-               update();
-               return;
-       }
-
-       CurveNodeView* prev = 0;
-       CurveNodeView* next = 0;
-       
-       int index = m_nodeViews.indexOf(m_blinkingNode);
-       int xleft = (int) m_blinkingNode->x(), xright = (int) 
m_blinkingNode->x();
-       int leftindex = index;
-       int count = 0;
-       
-       if (m_blinkingNode == m_nodeViews.first()) {
-               xleft = 0;
-       } else {
-               while ( leftindex > 0 && count < 2) {
-                       leftindex--;
-                       count++;
-               }
-               prev = m_nodeViews.at(leftindex);
-       }       
-       
-       
-       count = 0;
-       int rightindex = index;
-       
-       if (m_blinkingNode == m_nodeViews.last()) {
-               xright = (int) m_boundingRect.width();
-       } else {
-               while (rightindex < (m_nodeViews.size() - 1) && count < 2) {
-                       rightindex++;
-                       count++;
-               }
-               next = m_nodeViews.at(rightindex);
-       }
-       
-       
-       if (prev) xleft = (int) prev->x();
-       if (next) xright = (int) next->x();
-       
-       
-       update(xleft, 0, xright - xleft + 3, m_boundingRect.height());
-}
-
-void CurveView::set_view_mode()
-{
-       if (m_sv->get_song()->get_mode() == Song::EFFECTS) {
-               show();
-       } else {
-               hide();
-       }
-}
-
-void CurveView::load_theme_data()
-{
-       calculate_bounding_rect();
-}
-
-void CurveView::set_start_offset(const TimeRef& offset)
-{
-       m_startoffset = offset;
-}
-
-bool CurveView::has_nodes() const
-{
-       return m_guicurve->get_nodes().size() > 1 ? true : false;
-}
-
-float CurveView::get_default_value()
-{
-       return ((CurveNode*)m_guicurve->get_nodes().first())->value;
-}
-
-Command * CurveView::remove_all_nodes()
-{
-       CommandGroup* group = new CommandGroup(m_curve, tr("Clear Nodes"));
-
-       apill_foreach(CurveNode* node, CurveNode, m_curve->get_nodes()) {
-               group->add_command(m_curve->remove_node(node));
-       }
-
-       return group;
-
-}
-

Index: CurveView.h
===================================================================
RCS file: CurveView.h
diff -N CurveView.h
--- CurveView.h 15 Jan 2008 19:56:07 -0000      1.19
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,151 +0,0 @@
-/*
-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 CURVE_VIEW_H
-#define CURVE_VIEW_H
-
-#include "ViewItem.h"
-#include "Command.h"
-
-#include <QTimer>
-
-class Curve;
-class CurveNode;
-class CurveNodeView;
-class QPoint;
-class CurveView;
-
-class DragNode : public Command
-{
-       Q_OBJECT
-       Q_CLASSINFO("move_up", tr("Move Up"));
-       Q_CLASSINFO("move_down", tr("Move Down"));
-       
-public:
-       DragNode(CurveNode* node,
-               CurveView* curveview,
-               qint64 scalefactor,
-               TimeRef rangeMin,
-               TimeRef rangeMax,
-               const QString& des);
-
-       int prepare_actions();
-       int do_action();
-       int undo_action();
-       int finish_hold();
-       void cancel_action();
-       int begin_hold();
-       int jog();
-       void set_cursor_shape(int useX, int useY);
-       void set_vertical_only();
-
-private :
-       class   Private {
-               public:
-                       CurveView*      curveView;
-                       qint64          scalefactor;
-                       TimeRef         rangeMin;
-                       TimeRef         rangeMax;
-                       QPoint          mousepos;
-                       bool            verticalOnly;
-       };
-
-       Private* d;
-       CurveNode* m_node;
-       double  m_origWhen;
-       double  m_origValue;
-       double  m_newWhen;
-       double  m_newValue;
-       
-       int calculate_and_set_node_values();
-
-
-public slots:
-       void move_up(bool autorepeat);
-       void move_down(bool autorepeat);
-};
-
-
-class CurveView : public ViewItem
-{
-       Q_OBJECT
-       Q_CLASSINFO("add_node", tr("New node"))
-       Q_CLASSINFO("remove_node", tr("Remove node"))
-       Q_CLASSINFO("remove_all_nodes", tr("Remove all Nodes"))
-       Q_CLASSINFO("drag_node", tr("Move node"))
-       Q_CLASSINFO("drag_node_vertical_only", tr("Move node (vertical only)"))
-
-public:
-       CurveView(SongView* sv, ViewItem* parentViewItem, Curve* curve);
-       ~CurveView();
-       
-       void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-       int get_vector(int xstart, int pixelcount, float *arg);
-       bool has_nodes() const;
-       float get_default_value();
-       void calculate_bounding_rect();
-       void load_theme_data();
-       
-       void set_start_offset(const TimeRef& offset);
-       const TimeRef& get_start_offset() const {return m_startoffset;}
-       
-
-protected:
-       void hoverEnterEvent ( QGraphicsSceneHoverEvent * event );
-       void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
-       void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
-
-private:
-       Curve*          m_curve;
-       Curve*          m_guicurve;
-       QTimer          m_blinkTimer;
-       CurveNodeView*  m_blinkingNode;
-       int             m_blinkDarkness;
-       int             m_blinkColorDirection;
-       QList<CurveNodeView*>   m_nodeViews;
-       TimeRef         m_startoffset;
-       
-       void update_softselected_node(QPoint pos, bool force = false);
-
-public slots:
-       Command* add_node();
-       Command* remove_node();
-       Command* remove_all_nodes();
-       Command* drag_node();
-       Command* drag_node_vertical_only();
-       
-private slots:
-       void add_curvenode_view(CurveNode* node);
-       void remove_curvenode_view(CurveNode* node);
-       void node_moved();
-       void set_view_mode();
-       void update_blink_color();
-       
-signals :
-       // emit from the gui so that we can stop following the playhead only
-       // when the user manually edits, not on undo/redo
-       void curveModified();
-};
-
-#endif
-
-//eof
- 

Index: FadeContextDialogView.cpp
===================================================================
RCS file: FadeContextDialogView.cpp
diff -N FadeContextDialogView.cpp
--- FadeContextDialogView.cpp   23 Feb 2007 13:53:13 -0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,162 +0,0 @@
-/*
-Copyright (C) 2006 Remon Sijrier, Nicola Doebelin
-
-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.
-
-$Id: FadeContextDialogView.cpp,v 1.4 2007/02/23 13:53:13 r_sijrier Exp $
-*/
-
-#include "FadeContextDialogView.h"
-
-#include "ViewPort.h"
-#include "Themer.h"
-#include "FadeCurve.h"
-#include "CurveNode.h"
-#include "Command.h"
-#include <ContextPointer.h>
-
-#include <QPainterPath>
-
-#include <Debugger.h>
-
-static const int GRID_LINES            = 4;
-static const float RASTER_SIZE         = 0.05;
-static const int DOT_SIZE              = 6;
-static const QString DOT_COLOR         = "#78817B";
-static const QString INACTIVE_COLOR    = "#A6B2A9";
-
-
-FadeContextDialogView::FadeContextDialogView(ViewPort* viewPort, FadeCurve* 
fadeCurve)
-       : ViewItem(0, fadeCurve), m_vp(viewPort), m_fade(fadeCurve)
-{
-       connect(m_vp, SIGNAL(resized()), this, SLOT(resize()));
-       connect(m_fade, SIGNAL(stateChanged()), this, 
SLOT(schedule_for_repaint()));
-}
-
-
-FadeContextDialogView::~FadeContextDialogView()
-{}
-
-
-void FadeContextDialogView::paint(QPainter *painter, const 
QStyleOptionGraphicsItem *option, QWidget *widget)
-{
-/*
-       // Draw the background pixmap
-       painter->drawPixmap(0, 0, background);
-
-       painter->setRenderHint(QPainter::Antialiasing);
-       
-       // Calculate and draw control points
-       int h = m_vp->height() - 1;
-       int w = m_vp->width() - 1;
-       QList<QPointF> points = m_fade->get_control_points();
-       QPoint p1(int(points.at(1).x() * w + 0.5), h - int(points.at(1).y() * h 
+ 0.5));
-       QPoint p2(w - int((1.0 - points.at(2).x()) * w + 0.5), int((1.0 - 
points.at(2).y()) * h + 0.5));
-
-       painter->setPen(QColor(DOT_COLOR));
-       painter->setBrush(QColor(DOT_COLOR));
-       
-       if (m_fade->get_fade_type() == FadeCurve::FadeOut) {
-               p1.setX(w - int((1 - points.at(2).x()) * w + 0.5));
-               p1.setY(h - int((1 - points.at(2).y()) * h + 0.5));
-               p2.setX(int((points.at(1).x()) * w + 0.5));
-               p2.setY(int((points.at(1).y()) * h + 0.5));
-               painter->drawLine(w, h, p1.x(), p1.y());
-               painter->drawLine(0, 0, p2.x(), p2.y());
-       } else {
-               painter->drawLine(0, h, p1.x(), p1.y());
-               painter->drawLine(w, 0, p2.x(), p2.y());
-       }
-       
-       painter->drawEllipse(p1.x() - DOT_SIZE/2, p1.y() - DOT_SIZE/2, 
DOT_SIZE, DOT_SIZE);
-       painter->drawEllipse(p2.x() - DOT_SIZE/2, p2.y() - DOT_SIZE/2, 
DOT_SIZE, DOT_SIZE);
-
-
-       QPolygonF polygon;
-       float value[2];
-       int step = 0;
-       int height = m_vp->height();
-       
-       int zoom = (int) m_fade->get_range() / m_vp->width();
-       
-       // Populate the polygon with enough points to draw a smooth curve.
-       // using a 2 pixel resolution, is sufficient enough
-       for (int i=0; i < m_vp->width(); i+=2) {
-               m_fade->get_vector(i * zoom, i * zoom + 1, value, 2);
-               polygon << QPointF( step, height - (value[1] * height) );
-               step += 2;
-       }
-
-       // Always add the uppermost point in the polygon path 
-       // since the above routine potentially does not include it.
-       polygon << QPointF(m_vp->width(), 0);
-       
-       // Draw the curve
-       QPainterPath path;
-       path.moveTo(0, m_vp->height());
-       path.addPolygon(polygon);
-       path.lineTo(0, 0);
-       path.closeSubpath();
-       
-       painter->setPen(Qt::NoPen);
-       painter->setBrush(QColor(255, 0, 255, 80));
-       
-       painter->drawPath(path);        
-*/
-}
-
-
-
-
-void FadeContextDialogView::create_background( )
-{
-       if (background.size() != m_vp->size()) {
-               background = QPixmap(m_vp->width(), m_vp->height());
-       }
-
-       QPainter painter(&background);
-       
-//     painter->setRenderHint(QPainter::Antialiasing);
-
-       // Background color
-       painter.fillRect(0, 0, m_vp->width(), m_vp->height(), 
themer()->get_color("CLIP_BG_DEFAULT"));
-
-       // grid lines
-       painter.setPen(QColor(INACTIVE_COLOR));
-       for (int i = 0; i <= GRID_LINES; i++) {
-               float d = (float)i / (float)GRID_LINES;
-               int x = (int)(m_vp->width() * d);
-               int y = (int)(m_vp->height() * d);
-               painter.drawLine(x, 0, x, m_vp->height());
-               painter.drawLine(0, y, m_vp->width(), y);
-       }
-
-}
-
-
-
-/******** SLOTS ***************/
-
-void FadeContextDialogView::resize( )
-{
-       create_background();
-}
-
-
-
-
-//eof

Index: FadeContextDialogView.h
===================================================================
RCS file: FadeContextDialogView.h
diff -N FadeContextDialogView.h
--- FadeContextDialogView.h     8 Nov 2006 14:45:22 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,63 +0,0 @@
-/*
-Copyright (C) 2006 Remon Sijrier, Nicola Doebelin
-
-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.
-
-$Id: FadeContextDialogView.h,v 1.1 2006/11/08 14:45:22 r_sijrier Exp $
-*/
-
-#ifndef FADE_CONTEXT_DIALOG_VIEW_H
-#define FADE_CONTEXT_DIALOG_VIEW_H
-
-#include "ViewItem.h"
-
-#include <QPixmap>
-#include "Command.h"
-
-class ViewPort;
-class FadeCurve;
-
-class FadeContextDialogView : public ViewItem
-{
-       Q_OBJECT
-       
-public:
-       FadeContextDialogView(ViewPort* viewPort, FadeCurve* fadeCurve);
-       ~FadeContextDialogView();
-
-       void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-        
-       QRect draw(QPainter& p);
-
-       float roundFloat(float f);
-
-private:
-       void create_background();
-       
-       QPixmap         background;
-       ViewPort*       m_vp;
-       FadeCurve*      m_fade;
-
-private slots:
-        void resize();
-};
-
-
-#endif
-
-//eof
- 

Index: FadeView.cpp
===================================================================
RCS file: FadeView.cpp
diff -N FadeView.cpp
--- FadeView.cpp        29 Dec 2007 02:03:37 -0000      1.22
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,297 +0,0 @@
-/*
-Copyright (C) 2006 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.
-
-$Id: FadeView.cpp,v 1.22 2007/12/29 02:03:37 benjie Exp $
-*/
-
-#include "FadeView.h"
-
-#include <QPainter>
-
-#include "FadeCurve.h"
-#include "AudioClipView.h"
-#include "FadeContextDialog.h"
-#include "SongView.h"
-#include "Interface.h"
-#include <Themer.h>
-#include <Fade.h>
-#include <InputEngine.h>
-#include <AddRemove.h>
-
-#include <Song.h>
-#include <Utils.h>
-
-#include <Debugger.h>
-
-static const int DOT_SIZE              = 6;
-static const QString DOT_COLOR         = "#78817B";
-
-FadeView::FadeView(SongView* sv, AudioClipView* parent, FadeCurve * fadeCurve )
-       : ViewItem(parent, fadeCurve)
-       , m_fadeCurve(fadeCurve)
-{
-       PENTERCONS;
-       m_sv = sv;
-       m_holdactive = false;
-       m_guicurve = new Curve(0);
-       m_guicurve->set_song(m_sv->get_song());
-       
-       
-       apill_foreach(CurveNode* node, CurveNode, m_fadeCurve->get_nodes()) {
-               CurveNode* guinode = new CurveNode(m_guicurve, 
-                               node->get_when() / m_sv->timeref_scalefactor,
-                               node->get_value());
-               AddRemove* cmd = (AddRemove*) m_guicurve->add_node(guinode, 
false);
-               cmd->set_instantanious(true);
-               Command::process_command(cmd);
-       }
-       
-       load_theme_data();
-       setAcceptsHoverEvents(true);
-       setCursor(themer()->get_cursor("Fade"));
-       
-       connect(m_fadeCurve, SIGNAL(stateChanged()), this, 
SLOT(state_changed()));
-       connect(m_fadeCurve, SIGNAL(rangeChanged()), this, 
SLOT(state_changed()));
-}
-
-
-FadeView::~ FadeView( )
-{
-       PENTERDES;
-       delete m_guicurve;
-}
-
-
-void FadeView::paint(QPainter *painter, const QStyleOptionGraphicsItem 
*option, QWidget *widget)
-{
-       Q_UNUSED(widget);
-       
-       
-       int pixelcount = (int) option->exposedRect.width();
-       
-       if (pixelcount == 0) {
-               return;
-       }
-       
-       pixelcount += 1;
-       
-       QPolygonF polygon;
-       int xstart = (int)option->exposedRect.x();
-       int vector_start = xstart;
-       int height = (int)m_boundingRect.height();
-       float vector[pixelcount];
-       
-       if (m_fadeCurve->get_fade_type() == FadeCurve::FadeOut && 
m_guicurve->get_range() > m_parentViewItem->boundingRect().width()) {
-               vector_start += (int) (m_guicurve->get_range() - 
m_parentViewItem->boundingRect().width());
-       }
-       
-       m_guicurve->get_vector(vector_start, vector_start + pixelcount, vector, 
pixelcount);
-       
-       for (int i=0; i<pixelcount; i++) {
-               polygon <<  QPointF(xstart + i, height - (vector[i] * height) );
-       }
-       
-       
-       painter->save();
-       
painter->setClipRect(m_boundingRect.intersect(m_parentViewItem->boundingRect()));
-       painter->setRenderHint(QPainter::Antialiasing);
-       
-       QPainterPath path;
-       
-       path.addPolygon(polygon);
-       path.lineTo(xstart + 1 + pixelcount, 0);
-       path.lineTo(xstart + 1, 0);
-       path.closeSubpath();
-       
-       painter->setPen(Qt::NoPen);
-       
-       QColor color = m_fadeCurve->is_bypassed() ? 
-                       themer()->get_color("Fade:bypassed") :
-                       themer()->get_color("Fade:default");
-       
-       if (option->state & QStyle::State_MouseOver) {
-               color.setAlpha(color.alpha() + 10);
-       }
-       
-       painter->setBrush(color);
-       painter->drawPath(path);        
-
-
-       if (m_holdactive) {
-               // Calculate and draw control points
-               int h = (int) m_boundingRect.height() - 1;
-               int w = (int) m_boundingRect.width() - 1;
-               QList<QPointF> points = m_fadeCurve->get_control_points();
-               QPoint p1(int(points.at(1).x() * w + 0.5), h - 
int(points.at(1).y() * h + 0.5));
-               QPoint p2(w - int((1.0 - points.at(2).x()) * w + 0.5), int((1.0 
- points.at(2).y()) * h + 0.5));
-       
-               painter->setPen(QColor(DOT_COLOR));
-               painter->setBrush(QColor(DOT_COLOR));
-               
-               if (m_fadeCurve->get_fade_type() == FadeCurve::FadeOut) {
-                       p1.setX(w - int((1 - points.at(2).x()) * w + 0.5));
-                       p1.setY(h - int((1 - points.at(2).y()) * h + 0.5));
-                       p2.setX(int((points.at(1).x()) * w + 0.5));
-                       p2.setY(int((points.at(1).y()) * h + 0.5));
-                       painter->drawLine(w, h, p1.x(), p1.y());
-                       painter->drawLine(0, 0, p2.x(), p2.y());
-               } else {
-                       painter->drawLine(0, h, p1.x(), p1.y());
-                       painter->drawLine(w, 0, p2.x(), p2.y());
-               }
-               
-               painter->drawEllipse(p1.x() - DOT_SIZE/2, p1.y() - DOT_SIZE/2, 
DOT_SIZE, DOT_SIZE);
-               painter->drawEllipse(p2.x() - DOT_SIZE/2, p2.y() - DOT_SIZE/2, 
DOT_SIZE, DOT_SIZE);
-       }
-       
-       painter->restore();
-}
-
-int FadeView::get_vector(int xstart, int pixelcount, float * arg)
-{
-       // If boundingrect width is smaller then a pixel, don't even try
-       if (m_boundingRect.width() < 1.0) {
-               return 0;
-       }
-       
-       if (m_fadeCurve->get_fade_type() == FadeCurve::FadeOut) {
-               
-               // If the fade widt is larger the the clipview, add the 
difference,
-               // since the 'start' of the fadeview lies beyond the left edge 
of the clip!
-               if (m_boundingRect.width() > 
m_parentViewItem->boundingRect().width()) {
-                       xstart += (int)(m_boundingRect.width() - 
m_parentViewItem->boundingRect().width());
-               }
-               
-               // map the xstart position to the fadeviews x position
-               int mappedx = (int)mapFromParent(QPoint(xstart, 0)).x();
-               int x = mappedx;
-               float* p = arg;
-               
-               // check if the xstart lies before 'our' first pixel
-               if (mappedx < 0) {
-                       x = 0;
-                       // substract the difference from the pixelcount
-                       pixelcount += mappedx;
-                       
-                       // point to the mapped location of the buffer.
-                       p = arg - mappedx;
-                       
-                       // and if pixelcount is 0, there is nothing to do!
-                       if (pixelcount <= 0) {
-                               return 0;
-                       }
-                       
-                       // Any pixels outside of our range shouldn't alter the 
waveform,
-                       // so let's assign 1 to them!
-                       for (int i=0; i < - mappedx; ++i) {
-                               arg[i] = 1;
-                       }
-               }
-
-               m_guicurve->get_vector(x, x + pixelcount, p, pixelcount);
-               
-               return 1;
-       }
-       
-       if (xstart < m_boundingRect.width()) {
-               m_guicurve->get_vector(xstart, xstart + pixelcount, arg, 
pixelcount);
-               return 1;
-       }
-       
-       return 0;
-}
-
-void FadeView::calculate_bounding_rect()
-{
-       APILinkedList guinodes = m_guicurve->get_nodes();
-       APILinkedList nodes = m_fadeCurve->get_nodes();
-       
-       APILinkedListNode* node = nodes.first();
-       APILinkedListNode* guinode = guinodes.first();
-       
-       while (node) {
-               CurveNode* cnode = (CurveNode*)node;
-               CurveNode* cguinode = (CurveNode*)guinode;
-               
-               cguinode->set_when_and_value(cnode->get_when() / 
m_sv->timeref_scalefactor, cnode->get_value());
-               
-               node = node->next;
-               guinode = guinode->next;
-       }
-       
-       double range = m_guicurve->get_range();
-       m_boundingRect = QRectF( 0, 0, range, m_parentViewItem->get_height() );
-       
-       if (m_fadeCurve->get_fade_type() == FadeCurve::FadeOut) {
-               int diff = 0;
-               if (m_boundingRect.width() > 
m_parentViewItem->boundingRect().width()) {
-                       diff = (int)(m_boundingRect.width() - 
m_parentViewItem->boundingRect().width());
-               }
-               setPos(m_parentViewItem->boundingRect().width() - 
m_boundingRect.width() + diff, 
-                      m_parentViewItem->get_childview_y_offset());
-       } else {
-               setPos(0, m_parentViewItem->get_childview_y_offset());
-       }
-}
-
-
-void FadeView::state_changed( )
-{
-       PENTER;
-       prepareGeometryChange();
-       calculate_bounding_rect();
-       update();
-       
-       emit fadeModified();
-}
-
-
-Command* FadeView::bend()
-{
-       return new FadeBend(this);
-}
-
-Command* FadeView::strength()
-{
-       return new FadeStrength(this);
-}
-
-Command* FadeView::select_fade_shape()
-{
-       if (m_fadeCurve->get_fade_type() == FadeCurve::FadeIn) {
-               Interface::instance()->select_fade_in_shape();
-       }
-       else {
-               Interface::instance()->select_fade_out_shape();
-       }
-       return 0;
-}
-
-void FadeView::set_holding(bool hold)
-{
-       m_holdactive = hold;
-       update(m_boundingRect);
-}
-
-
-void FadeView::load_theme_data()
-{
-       calculate_bounding_rect();
-}
-

Index: FadeView.h
===================================================================
RCS file: FadeView.h
diff -N FadeView.h
--- FadeView.h  15 Jan 2008 19:56:07 -0000      1.7
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,78 +0,0 @@
-/*
-Copyright (C) 2006 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.
-
-$Id: FadeView.h,v 1.7 2008/01/15 19:56:07 r_sijrier Exp $
-*/
-
-#ifndef FADE_VIEW_H
-#define FADE_VIEW_H
-
-#include "ViewItem.h"
-
-class Curve;
-class FadeCurve;
-class FadeContextDialog;
-class AudioClipView;
-
-class FadeView : public ViewItem
-{
-       Q_OBJECT
-       
-       Q_CLASSINFO("bend", tr("Adjust Bend"))
-       Q_CLASSINFO("strength", tr("Adjust Strength"))
-       Q_CLASSINFO("select_fade_shape", tr("Select Preset"))
-       
-public:
-       FadeView(SongView* sv, AudioClipView* parent, FadeCurve* fadeCuve);
-       ~FadeView();
-       
-       void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-       int get_vector(int xstart, int pixelcount, float * arg);
-       void calculate_bounding_rect();
-       void set_holding(bool hold);
-       
-       FadeCurve* get_fade() const {return m_fadeCurve;}
-       
-       void load_theme_data();
-
-private:
-       FadeCurve*      m_fadeCurve;
-       Curve*          m_guicurve;
-       bool            m_holdactive;
-       
-public slots:
-       void state_changed();
-       
-       Command* bend();
-       Command* strength();
-       Command* select_fade_shape();
-//     Command* edit_properties();
-
-signals :
-       // emit from the gui so that we can stop following the playhead only
-       // when the user manually edits, not on undo/redo
-       void fadeModified();
-};
-
-
-#endif
-
-//eof
-
-

Index: LineView.h
===================================================================
RCS file: LineView.h
diff -N LineView.h
--- LineView.h  19 May 2007 19:30:11 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,49 +0,0 @@
-/*
-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

Index: MarkerView.cpp
===================================================================
RCS file: MarkerView.cpp
diff -N MarkerView.cpp
--- MarkerView.cpp      23 Nov 2007 14:21:08 -0000      1.26
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,180 +0,0 @@
-/*
-    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 "MarkerView.h"
-#include "SongView.h"
-#include "LineView.h"
-#include "Themer.h"
-#include "ClipsViewPort.h"
-#include "PositionIndicator.h"
-
-#include <QFont>
-#include <QFontMetrics>
-#include <QColor>
-#include <Song.h>
-#include <Marker.h>
-#include <Utils.h>
-#include <QDebug>
-
-MarkerView::MarkerView(Marker* marker, SongView* sv, ViewItem* parentView)
-       : ViewItem(parentView, marker)
-       , m_dragging(false)
-{
-       m_sv = sv;
-       m_marker = marker;
-       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()));
-}
-
-void MarkerView::paint(QPainter * painter, const QStyleOptionGraphicsItem * 
option, QWidget * widget)
-{
-       Q_UNUSED(option);
-       Q_UNUSED(widget);
-       
-       painter->save();
-       
-       int xstart = (int)option->exposedRect.x();
-       int clipx = (int)mapToParent(xstart, 0).x();
-       if (clipx < 0) {
-               painter->setClipRect(-clipx, 0, (int)m_boundingRect.width(), 
(int)m_boundingRect.height());
-       }
-
-       painter->setRenderHint(QPainter::Antialiasing);
-       painter->setFont(themer()->get_font("Timeline:fontscale:marker"));
-       
-       painter->setPen(QColor(Qt::black));
-       painter->setBrush(m_fillColor);
-
-       const QPointF pts[3] = {
-                       QPointF(0, 0),
-                       QPointF(m_width + 0.5, 0),
-                       QPointF((m_width+ 0.5)/2, m_ascent) };
-
-       painter->drawPolygon(pts, 3);
-       painter->drawText(m_width + 1, m_ascent, m_marker->get_description());
-
-       if (m_dragging) {
-               m_posIndicator->set_value(timeref_to_text(TimeRef((x() + 
m_width / 2) * m_sv->timeref_scalefactor), m_sv->timeref_scalefactor));
-       }
-
-       painter->restore();
-}
-
-void MarkerView::calculate_bounding_rect()
-{
-       prepareGeometryChange();
-       update_position();
-       
-       QFontMetrics fm(themer()->get_font("Timeline:fontscale:marker"));
-       int descriptionwidth = fm.width(m_marker->get_description()) + 1;
-
-       m_line->set_bounding_rect(QRectF(0, 0, 1, 
m_sv->get_clips_viewport()->sceneRect().height()));
-       m_boundingRect = QRectF(-1, 0, m_width + descriptionwidth, m_ascent);
-}
-
-void MarkerView::update_position()
-{
-       // markerwidth / 2 == center of markerview !
-       setPos( (long)(m_marker->get_when() / m_sv->timeref_scalefactor) - 
(m_width / 2), 0);
-}
-
-int MarkerView::position()
-{
-       return (int)(pos().x() + m_width / 2);
-}
-
-void MarkerView::set_position(int i)
-{
-       setPos(i - m_width / 2, 0);
-}
-
-void MarkerView::load_theme_data()
-{
-       if (m_marker->get_type() == Marker::ENDMARKER) {
-               m_fillColor = themer()->get_color("Marker:end");
-       } else {
-               m_fillColor = themer()->get_color("Marker:default");
-       }
-       calculate_bounding_rect();
-}
-
-void MarkerView::set_active(bool b)
-{
-       m_active = b;
-
-       if (b) {
-               if (m_marker->get_type() == Marker::ENDMARKER) {
-                       m_fillColor = themer()->get_color("Marker:blinkend");
-               } else {
-                       m_fillColor = themer()->get_color("Marker:blink");
-               }
-               m_line->set_color(QColor(0, 0, 0, 140));
-       } else {
-               if (m_marker->get_type() == Marker::ENDMARKER) {
-                       m_fillColor = themer()->get_color("Marker:end");
-               } else {
-                       m_fillColor = themer()->get_color("Marker:default");
-               }
-               m_line->set_color(QColor(0, 0, 0, 45));
-       }
-
-       m_line->update();
-       update();
-}
-
-void MarkerView::update_drawing()
-{
-       calculate_bounding_rect();
-       update();
-}
-
-void MarkerView::set_dragging(bool dragging)
-{
-       if (dragging) {
-               if (! m_posIndicator) {
-                       m_posIndicator = new PositionIndicator(this);
-                       scene()->addItem(m_posIndicator);
-                       m_posIndicator->set_position(15, 0);
-               }
-       } else {
-               if (m_posIndicator) {
-                       scene()->removeItem(m_posIndicator);
-                       delete m_posIndicator;
-                       m_posIndicator = 0;
-               }
-       }
-       
-       m_dragging = dragging;
-}
-

Index: MarkerView.h
===================================================================
RCS file: MarkerView.h
diff -N MarkerView.h
--- MarkerView.h        19 May 2007 19:30:11 -0000      1.10
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,68 +0,0 @@
-/*
-    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 MARKER_VIEW_H
-#define MARKER_VIEW_H
-
-#include "ViewItem.h"
-
-class Marker;
-class SongView;
-class LineView;
-class QColor;
-class PositionIndicator;
-
-class MarkerView : public ViewItem
-{
-       Q_OBJECT
-       
-public:
-       MarkerView(Marker* marker, SongView* sv, ViewItem* parent);
-       ~MarkerView() {}
-       
-       void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-       void calculate_bounding_rect();
-       void load_theme_data();
-       void set_active(bool);
-       int position();
-       void set_position(int);
-       void set_dragging(bool dragging);
-       
-       Marker* get_marker() const {return m_marker;}
-       
-private:
-       Marker* m_marker;
-       LineView* m_line;
-       QColor  m_fillColor;
-       bool    m_active;
-       bool    m_dragging;
-       PositionIndicator* m_posIndicator;
-       int     m_ascent;
-       int     m_width;
-       
-private slots:
-       void update_position();
-       void update_drawing();
-};
-
-#endif
-
-//eof

Index: PanelLed.cpp
===================================================================
RCS file: PanelLed.cpp
diff -N PanelLed.cpp
--- PanelLed.cpp        8 Nov 2006 14:45:22 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,82 +0,0 @@
-/*
-    Copyright (C) 2005-2006 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.
- 
-    $Id: PanelLed.cpp,v 1.1 2006/11/08 14:45:22 r_sijrier Exp $
-*/
-
-#include "PanelLed.h"
-
-#include <QPainter>
-
-#include "TrackPanelView.h"
-#include <Utils.h>
-
-// Always put me below _all_ includes, this is needed
-// in case we run with memory leak detection enabled!
-#include "Debugger.h"
-
-const int LED_Y = 18;
-const int LED_WIDTH = 35;
-const int LED_HEIGHT = 14;
-
-
-PanelLed::PanelLed(TrackPanelView* parent, int xpos, char* on, char* off )
-       : QObject(parent),  m_xpos(xpos), onType(on), offType(off)
-{
-        m_isOn = false;
-}
-
-PanelLed::~PanelLed( )
-{
-        PENTERDES2;
-}
-
-void PanelLed::paint(QPainter *painter)
-{
-
-       if (m_isOn) {
-               painter->drawPixmap(m_xpos, LED_Y, find_pixmap(onType));
-       } else {
-               painter->drawPixmap(m_xpos, LED_Y, find_pixmap(offType));
-       }
-}
-
-void PanelLed::ison_changed( bool isOn )
-{
-        PENTER2;
-        m_isOn = isOn;
-}
-
-void PanelLed::set_on_type( char * type )
-{
-        onType = type;
-}
-
-void PanelLed::set_of_type( char * type )
-{
-        offType = type;
-}
-
-
-void PanelLed::set_xpos( int x )
-{
-        m_xpos = x;
-}
-
-//eof

Index: PanelLed.h
===================================================================
RCS file: PanelLed.h
diff -N PanelLed.h
--- PanelLed.h  8 Nov 2006 14:45:22 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,59 +0,0 @@
-/*
-    Copyright (C) 2005-2006 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.
- 
-    $Id: PanelLed.h,v 1.1 2006/11/08 14:45:22 r_sijrier Exp $
-*/
-
-#ifndef PANEL_LED_VIEW_H
-#define PANEL_LED_VIEW_H
-
-#include <QObject>
-#include <QString>
-
-class TrackPanelView;
-
-class PanelLed : public QObject
-{
-        Q_OBJECT
-
-public:
-        PanelLed(TrackPanelView* view, int xpos, char* on, char* off);
-        ~PanelLed();
-
-       void paint(QPainter *painter);
-
-        void set_on_type(char* type);
-        void set_of_type(char* type);
-        void set_xpos(int x);
-
-private:
-        int m_xpos;
-        bool m_isOn;
-        QString onType;
-        QString offType;
-
-
-public slots:
-        void ison_changed(bool isOn);
-};
-
-
-#endif
-
-//eof

Index: PluginChainView.cpp
===================================================================
RCS file: PluginChainView.cpp
diff -N PluginChainView.cpp
--- PluginChainView.cpp 5 Nov 2007 15:49:32 -0000       1.17
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,152 +0,0 @@
-/*
-    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.
-
-*/
-
-#include "PluginChainView.h"
-
-#include <QScrollBar>
-
-#include "TrackView.h"
-#include "SongView.h"
-#include "ClipsViewPort.h"
-#include "PluginView.h"
-#include "Themer.h"
-#include <PluginChain.h>
-#include <Plugin.h>
-
-#include <Track.h>
-#include "Song.h"
-
-#if defined (LV2_SUPPORT)
-#include <LV2Plugin.h>
-#endif
-#include <PluginChain.h>
-
-// Always put me below _all_ includes, this is needed
-// in case we run with memory leak detection enabled!
-#include "Debugger.h"
-
-
-PluginChainView::PluginChainView(SongView* sv, ViewItem* parent, PluginChain* 
chain)
-       : ViewItem(parent, parent)
-       , m_pluginchain(chain)
-{
-       PENTERCONS;
-       
-       setZValue(parent->zValue() + 2);
-       m_sv = sv;
-       calculate_bounding_rect();
-       
-#if QT_VERSION < 0x040300
-       parent->scene()->addItem(this);
-#endif
-       
-       foreach(Plugin* plugin, chain->get_plugin_list()) {
-               add_new_pluginview(plugin);
-       }
-       
-       connect(chain, SIGNAL(pluginAdded(Plugin*)), this, 
SLOT(add_new_pluginview(Plugin*)));
-       connect(chain, SIGNAL(pluginRemoved(Plugin*)), this, 
SLOT(remove_pluginview(Plugin*)));
-       connect(m_sv->get_clips_viewport()->horizontalScrollBar(), 
SIGNAL(valueChanged(int)),
-               this, SLOT(scrollbar_value_changed(int)));
-       connect(m_sv->get_song(), SIGNAL(modeChanged()), this, 
SLOT(set_view_mode()));
-       
-       set_view_mode();
-}
-
-PluginChainView::~PluginChainView( )
-{
-        PENTERDES2;
-}
-
-void PluginChainView::add_new_pluginview( Plugin * plugin )
-{
-       PluginView* view = new PluginView(this, m_pluginchain, plugin, 
m_pluginViews.size());
-#if QT_VERSION < 0x040300
-       scene()->addItem(view);
-#endif
-       
-       int x = 6;
-       foreach(PluginView* view, m_pluginViews) {
-               x += (int)view->boundingRect().width() + 6;
-       }
-       
-       view->setPos(x, m_boundingRect.height() - 
view->boundingRect().height());
-       
-       m_pluginViews.append(view);
-       
-       show();
-}
-
-void PluginChainView::remove_pluginview( Plugin * plugin )
-{
-       foreach(PluginView* view, m_pluginViews) {
-               if (view->get_plugin() == plugin) {
-                       m_pluginViews.removeAll(view);
-                       delete view;
-               }
-       }
-
-       for (int i=0; i<m_pluginViews.size(); ++i) {
-               m_pluginViews.at(i)->set_index(i);
-       }
-       
-       int x = 6;
-       foreach(PluginView* view, m_pluginViews) {
-               view->setPos(x, m_boundingRect.height() - 
view->boundingRect().height());
-               x += (int)view->boundingRect().width() + 6;
-       }
-       
-       if (!m_pluginViews.size()) {
-               hide();
-       }
-       
-       m_parentViewItem->update();
-}
-
-void PluginChainView::paint( QPainter * painter, const 
QStyleOptionGraphicsItem * option, QWidget * widget )
-{
-       Q_UNUSED(painter);
-       Q_UNUSED(option);
-       Q_UNUSED(widget);
-}
-
-void PluginChainView::scrollbar_value_changed(int value)
-{
-       setPos(value, y());
-}
-
-void PluginChainView::set_view_mode()
-{
-       if (m_sv->get_song()->get_mode() == Song::EFFECTS) {
-               show();
-       } else {
-               hide();
-       }
-}
-
-void PluginChainView::calculate_bounding_rect()
-{
-       int y = (int)(m_parentViewItem->boundingRect().height());
-       m_boundingRect = QRectF(0, 0, 0, y);
-       setPos(pos().x(), - 2);
-       ViewItem::calculate_bounding_rect();
-}
-

Index: PluginChainView.h
===================================================================
RCS file: PluginChainView.h
diff -N PluginChainView.h
--- PluginChainView.h   24 May 2007 13:11:38 -0000      1.7
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,62 +0,0 @@
-/*
-    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 PLUGIN_CHAIN_VIEW_H
-#define PLUGIN_CHAIN_VIEW_H
-
-
-#include "ViewItem.h"
-#include <QString>
-
-class SongView;
-class Plugin;
-class PluginChain;
-class PluginView;
-
-class PluginChainView : public ViewItem
-{
-        Q_OBJECT
-
-public:
-        PluginChainView(SongView* sv, ViewItem* parent, PluginChain* chain);
-        ~PluginChainView();
-
-        void paint(QPainter* painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-       void calculate_bounding_rect();
-
-private:
-       PluginChain* m_pluginchain;
-        QList<PluginView* >    m_pluginViews;
-
-public slots:
-        void add_new_pluginview(Plugin* plugin);
-        void remove_pluginview(Plugin* plugin);
-       void scrollbar_value_changed(int value);
-       
-private slots:
-       void set_view_mode();
-
-};
-
-#endif
-
-//eof
-

Index: PluginView.cpp
===================================================================
RCS file: PluginView.cpp
diff -N PluginView.cpp
--- PluginView.cpp      5 Nov 2007 15:49:32 -0000       1.21
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,147 +0,0 @@
-/*
-Copyright (C) 2005-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 "PluginView.h"
-
-#include <QPainter>
-
-#include "TrackView.h"
-#include "PluginChainView.h"
-#include "Interface.h"
-
-#include <Themer.h>
-#include <Plugin.h>
-#include <PluginChain.h>
-#include <Track.h>
-#include <Utils.h>
-
-#include <PluginPropertiesDialog.h>
-
-// Always put me below _all_ includes, this is needed
-// in case we run with memory leak detection enabled!
-#include "Debugger.h"
-
-PluginView::PluginView(PluginChainView* parent, PluginChain* chain, Plugin* 
plugin, int index)
-       : ViewItem(parent, plugin)
-       , m_pluginchain(chain)
-       , m_plugin(plugin)
-       , m_index(index)
-{
-       PENTERCONS;
-       
-       m_propertiesDialog = 0;
-
-       setZValue(parent->zValue() + 2);
-       
-       m_name = plugin->get_name();
-       
-       QFontMetrics fm(themer()->get_font("Plugin:fontscale:name"));
-       m_textwidth = fm.width(m_name);
-       
-       calculate_bounding_rect();
-       
-       setAcceptsHoverEvents(true);
-       setCursor(themer()->get_cursor("Plugin"));
-       
-       connect(m_plugin, SIGNAL(bypassChanged()), this, SLOT(repaint()));
-}
-
-PluginView::~PluginView( )
-{
-       PENTERDES2;
-       if (m_propertiesDialog) {
-               delete m_propertiesDialog;
-       }
-}
-
-void PluginView::paint(QPainter* painter, const QStyleOptionGraphicsItem 
*option, QWidget *widget)
-{
-       Q_UNUSED(option);
-       Q_UNUSED(widget);
-       
-       QColor color;
-       if (m_plugin->is_bypassed()) {
-               color = themer()->get_color("Plugin:background:bypassed");
-       } else {
-               color = themer()->get_color("Plugin:background");
-       }
-
-       int height, width;
-       if (option->state & QStyle::State_MouseOver) {
-               height = (int)m_boundingRect.height() + 1;
-               width = (int)m_boundingRect.width() + 1;
-               color = color.light(120);
-       } else {
-               height = (int)m_boundingRect.height();
-               width = (int)m_boundingRect.width();
-       }
-       
-       QBrush brush(color);
-       QRect rect(0, 0, width, height); 
-       painter->fillRect(rect, brush);
-       painter->setPen(themer()->get_color("Plugin:text"));
-       painter->setFont(themer()->get_font("Plugin:fontscale:name"));
-       painter->drawText(rect, Qt::AlignCenter, m_name);
-}
-
-
-Command * PluginView::edit_properties( )
-{
-       if (! m_propertiesDialog) {
-               m_propertiesDialog = new 
PluginPropertiesDialog(Interface::instance(), m_plugin);
-               m_propertiesDialog->setWindowTitle(m_name);
-       } 
-       m_propertiesDialog->show();
-       return (Command*) 0;
-}
-
-Command* PluginView::remove_plugin()
-{
-       return m_pluginchain->remove_plugin(m_plugin);
-}
-
-Plugin * PluginView::get_plugin( )
-{
-       return m_plugin;
-}
-
-void PluginView::set_index(int index)
-{
-       m_index = index;
-}
-
-void PluginView::repaint( )
-{
-       update();
-}
-
-void PluginView::calculate_bounding_rect()
-{
-       int height = 25;
-       int parentheight = (int)m_parentViewItem->boundingRect().height();
-       if (parentheight < 30) {
-               height = parentheight - 4;
-       }
-       int y = parentheight - height;
-       m_boundingRect = QRectF(0, 0, m_textwidth + 8, height);
-       setPos(x(), y);
-}
-

Index: PluginView.h
===================================================================
RCS file: PluginView.h
diff -N PluginView.h
--- PluginView.h        30 May 2007 13:14:48 -0000      1.11
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,73 +0,0 @@
-/*
-    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 PLUGIN_VIEW_H
-#define PLUGIN_VIEW_H
-
-
-#include "ViewItem.h"
-#include <QString>
-
-class PluginPropertiesDialog;
-
-class TrackView;
-class PluginChainView;
-class Plugin;
-class PluginChain;
-
-class PluginView : public ViewItem
-{
-        Q_OBJECT
-       Q_CLASSINFO("edit_properties", tr("Edit..."))
-       Q_CLASSINFO("remove_plugin", tr("Remove"))
-
-public:
-       PluginView(PluginChainView* pcv, PluginChain* chain, Plugin* plugin, 
int index);
-        ~PluginView();
-
-       Plugin* get_plugin();
-        void set_index(int index);
-
-        void paint(QPainter* painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-       void calculate_bounding_rect();
-
-private:
-       PluginChain*    m_pluginchain;
-       Plugin*         m_plugin;
-
-        int            m_index;
-       int             m_textwidth;
-        QString                m_name;
-       
-        PluginPropertiesDialog* m_propertiesDialog;
-
-public slots:
-       Command* edit_properties();
-        Command* remove_plugin();
-        
-private slots:
-       void repaint();
-};
-
-#endif
-
-//eof
-

Index: PositionIndicator.cpp
===================================================================
RCS file: PositionIndicator.cpp
diff -N PositionIndicator.cpp
--- PositionIndicator.cpp       5 Nov 2007 15:49:32 -0000       1.6
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,70 +0,0 @@
-/*
-    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 "PositionIndicator.h"
-
-#include "SongView.h"
-
-#include <QColor>
-#include <Utils.h>
-
-PositionIndicator::PositionIndicator(ViewItem* parentView)
-       : ViewItem(parentView, 0)
-{
-       calculate_bounding_rect();
-       setZValue(100);
-}
-
-void PositionIndicator::paint(QPainter * painter, const 
QStyleOptionGraphicsItem * option, QWidget * widget)
-{
-       Q_UNUSED(option);
-       Q_UNUSED(widget);
-       
-       painter->drawPixmap(0, 0, m_background);
-       painter->drawText(m_boundingRect, Qt::AlignVCenter, m_value);
-}
-
-void PositionIndicator::calculate_bounding_rect()
-{
-       prepareGeometryChange();
-       m_boundingRect = QRectF(0, 0, 70, 14);
-       
-       m_background = QPixmap((int)m_boundingRect.width(), 
(int)m_boundingRect.height());
-       m_background.fill(QColor(Qt::transparent));
-       
-       QPainter painter(&m_background);
-       painter.setRenderHint(QPainter::Antialiasing);
-       painter.setBrush(QColor(255, 255, 255));
-       painter.setPen(Qt::NoPen);
-       int rounding = 10;
-       painter.drawRoundRect(0, 0, (int)m_boundingRect.width(), 
(int)m_boundingRect.height(), rounding, rounding);
-}
-
-void PositionIndicator::set_position(int x, int y)
-{
-       setPos(x, y);
-}
-
-void PositionIndicator::set_value(const QString & value)
-{
-       m_value = value;
-}
-

Index: PositionIndicator.h
===================================================================
RCS file: PositionIndicator.h
diff -N PositionIndicator.h
--- PositionIndicator.h 10 Apr 2007 17:11:48 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,49 +0,0 @@
-/*
-    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 POSITION_INDICATOR_H
-#define POSITION_INDICATOR_H
-
-#include "ViewItem.h"
-#include <QPixmap>
-
-class PositionIndicator : public ViewItem
-{
-       Q_OBJECT
-       
-public:
-       PositionIndicator(ViewItem* parent);
-       ~PositionIndicator() {}
-       
-       void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-       void calculate_bounding_rect();
-       void set_position(int x, int y);
-       
-       void set_value(const QString& value);
-       
-private:
-       QString m_value;
-       QPixmap m_background;
-};
-
-#endif
-
-//eof

Index: SongView.cpp
===================================================================
RCS file: SongView.cpp
diff -N SongView.cpp
--- SongView.cpp        2 Jan 2008 19:23:59 -0000       1.96
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,747 +0,0 @@
-/*
-Copyright (C) 2005-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-11  USA.
-
-*/
-
-
-#include <QScrollBar>
-#include <libtraversocore.h>
-
-#include "SongView.h"
-#include "SongWidget.h"
-#include "TrackView.h"
-#include "TrackPanelView.h"
-#include "Cursors.h"
-#include "ClipsViewPort.h"
-#include "TimeLineViewPort.h"
-#include "TimeLineView.h"
-#include "TrackPanelViewPort.h"
-#include "Themer.h"
-#include "AddRemove.h"
-
-#include <Zoom.h>
-#include <Scroll.h>
-#include <PlayHeadMove.h>
-#include <WorkCursorMove.h>
-
-#include "AudioDevice.h"
-               
-#include <Debugger.h>
-
-class Shuttle : public Command
-{
-public :
-       Shuttle(SongView* sv) : Command("Shuttle"), m_sv(sv) {}
-
-       int begin_hold() {
-               m_sv->update_shuttle_factor();
-               m_sv->start_shuttle(true);
-               return 1;
-       }
-
-       int finish_hold() {
-               m_sv->start_shuttle(false);
-               return 1;
-       }
-       
-       int jog() {
-               m_sv->update_shuttle_factor();
-               return 1;
-       }
-
-private :
-       SongView*       m_sv;
-};
-
-
-static bool smallerTrackView(const TrackView* left, const TrackView* right )
-{
-       return left->get_track()->get_sort_index() < 
right->get_track()->get_sort_index();
-}
-
-SongView::SongView(SongWidget* songwidget, 
-       ClipsViewPort* viewPort,
-       TrackPanelViewPort* tpvp,
-       TimeLineViewPort* tlvp,
-       Song* song)
-       : ViewItem(0, song)
-{
-       setZValue(1);
-       
-       m_song = song;
-       m_clipsViewPort = viewPort;
-       m_tpvp = tpvp;
-       m_tlvp = tlvp;
-       m_vScrollBar = songwidget->m_vScrollBar;
-       m_hScrollBar = songwidget->m_hScrollBar;
-       m_actOnPlayHead = true;
-       
-       m_clipsViewPort->scene()->addItem(this);
-       
-       m_playCursor = new PlayHead(this, m_song, m_clipsViewPort);
-       m_workCursor = new WorkCursor(this, m_song);
-       connect(m_song, SIGNAL(workingPosChanged()), m_workCursor, 
SLOT(update_position()));
-       connect(m_song, SIGNAL(transferStarted()), this, 
SLOT(follow_play_head()));
-       connect(m_song, SIGNAL(transportPosSet()), this, 
SLOT(follow_play_head()));
-       connect(m_song, SIGNAL(workingPosChanged()), this, 
SLOT(stop_follow_play_head()));
-       
-       m_clipsViewPort->scene()->addItem(m_playCursor);
-       m_clipsViewPort->scene()->addItem(m_workCursor);
-       
-       m_clipsViewPort->setSceneRect(0, 0, MAX_CANVAS_WIDTH, 
MAX_CANVAS_HEIGHT);
-       m_tlvp->setSceneRect(0, -TIMELINE_HEIGHT, MAX_CANVAS_WIDTH, 0);
-       m_tpvp->setSceneRect(-200, 0, 0, MAX_CANVAS_HEIGHT);
-       
-       
-       timeref_scalefactor = Peak::zoomStep[m_song->get_hzoom()] * 640;
-       
-       song_mode_changed();
-       
-       foreach(Track* track, m_song->get_tracks()) {
-               add_new_trackview(track);
-       }
-       
-       connect(m_song, SIGNAL(hzoomChanged()), this, 
SLOT(scale_factor_changed()));
-       connect(m_song, SIGNAL(tempFollowChanged(bool)), this, 
SLOT(set_follow_state(bool)));
-       connect(m_song, SIGNAL(trackAdded(Track*)), this, 
SLOT(add_new_trackview(Track*)));
-       connect(m_song, SIGNAL(trackRemoved(Track*)), this, 
SLOT(remove_trackview(Track*)));
-       connect(m_song, SIGNAL(lastFramePositionChanged()), this, 
SLOT(update_scrollbars()));
-       connect(m_song, SIGNAL(modeChanged()), this, SLOT(song_mode_changed()));
-       connect(&m_shuttletimer, SIGNAL(timeout()), this, SLOT 
(update_shuttle()));
-       connect(m_hScrollBar, SIGNAL(sliderMoved(int)), this, 
SLOT(stop_follow_play_head()));
-       connect(m_hScrollBar, SIGNAL(actionTriggered(int)), this, 
SLOT(hscrollbar_action(int)));
-       connect(m_hScrollBar, SIGNAL(valueChanged(int)), this, 
SLOT(hscrollbar_value_changed(int)));
-       connect(m_vScrollBar, SIGNAL(valueChanged(int)), 
m_clipsViewPort->verticalScrollBar(), SLOT(setValue(int)));
-       
-       load_theme_data();
-       
-       int x, y;
-       m_song->get_scrollbar_xy(x, y);
-       set_hscrollbar_value(x);
-       set_vscrollbar_value(y);
-       
-       m_shuttleCurve = new Curve(0);
-       m_shuttleCurve->set_song(m_song);
-       m_dragShuttleCurve = new Curve(0);
-       m_dragShuttleCurve->set_song(m_song);
-       
-       // Use these variables to fine tune the scroll behavior
-       float whens[7] = {0.0, 0.2, 0.3, 0.4, 0.6, 0.9, 1.2};
-       float values[7] = {0.0, 0.15, 0.3, 0.8, 0.95, 1.5, 8.0};
-       
-       // Use these variables to fine tune the scroll during drag behavior
-       float dragWhens[7] =  {0.0, 0.9, 0.94, 0.98, 1.0, 1.1, 1.3};
-       float dragValues[7] = {0.0, 0.0, 0.2,  0.5,  0.85,  1.1,  2.0};
-       
-       for (int i=0; i<7; ++i) {
-               AddRemove* cmd = (AddRemove*) m_dragShuttleCurve->add_node(new 
CurveNode(m_dragShuttleCurve, dragWhens[i], dragValues[i]), false);
-               cmd->set_instantanious(true);
-               Command::process_command(cmd);
-               
-               cmd = (AddRemove*) m_shuttleCurve->add_node(new 
CurveNode(m_shuttleCurve, whens[i], values[i]), false);
-               cmd->set_instantanious(true);
-               Command::process_command(cmd);
-       }
-}
-
-SongView::~SongView()
-{
-       delete m_dragShuttleCurve;
-       delete m_shuttleCurve;
-}
-               
-void SongView::scale_factor_changed( )
-{
-       timeref_scalefactor = Peak::zoomStep[m_song->get_hzoom()] * 640;
-       m_tlvp->scale_factor_changed();
-       layout_tracks();
-}
-
-void SongView::song_mode_changed()
-{
-       int mode = m_song->get_mode();
-       m_clipsViewPort->set_current_mode(mode);
-       m_tlvp->set_current_mode(mode);
-       m_tpvp->set_current_mode(mode);
-}
-
-TrackView* SongView::get_trackview_under( QPointF point )
-{
-       TrackView* view = 0;
-       QList<QGraphicsItem*> views = 
m_clipsViewPort->items(m_clipsViewPort->mapFromScene(point));
-       
-       for (int i=0; i<views.size(); ++i) {
-               view = dynamic_cast<TrackView*>(views.at(i));
-               if (view) {
-                       return view;
-               }
-       }
-       return  0;
-       
-}
-
-void SongView::add_new_trackview(Track* track)
-{
-       TrackView* view = new TrackView(this, track);
-       m_trackViews.append(view);
-       
-       int sortIndex = track->get_sort_index();
-       
-       if (sortIndex < 0) {
-               sortIndex = m_trackViews.size();
-               track->set_sort_index(sortIndex);
-       } else {
-               foreach(TrackView* view, m_trackViews) {
-                       if (view->get_track()->get_sort_index() == sortIndex) {
-                               sortIndex = m_trackViews.size();
-                               track->set_sort_index(sortIndex);
-                               break;
-                       }
-               }
-       }
-       
-       qSort(m_trackViews.begin(), m_trackViews.end(), smallerTrackView);
-       
-       for(int i=0; i<m_trackViews.size(); ++i) {
-               m_trackViews.at(i)->get_track()->set_sort_index(i);
-       }
-       
-       if (m_trackViews.size() > 1) {
-               int height = 
m_trackViews.at(m_trackViews.size()-2)->get_track()->get_height();
-               
m_trackViews.at(m_trackViews.size()-1)->get_track()->set_height(height);
-       }
-       
-       layout_tracks();
-}
-
-void SongView::remove_trackview(Track* track)
-{
-       foreach(TrackView* view, m_trackViews) {
-               if (view->get_track() == track) {
-                       TrackPanelView* tpv = view->get_trackpanel_view();
-                       scene()->removeItem(tpv);
-                       scene()->removeItem(view);
-                       m_trackViews.removeAll(view);
-                       delete view;
-                       delete tpv;
-                       break;
-               }
-       }
-       
-       for(int i=0; i<m_trackViews.size(); ++i) {
-               m_trackViews.at(i)->get_track()->set_sort_index(i);
-       }
-       
-       layout_tracks();
-}
-
-void SongView::update_scrollbars()
-{
-       int width = (int)(m_song->get_last_location() / timeref_scalefactor) - 
(m_clipsViewPort->width() / 4);
-       
-       m_hScrollBar->setRange(0, width);
-       m_hScrollBar->setSingleStep(m_clipsViewPort->width() / 10);
-       m_hScrollBar->setPageStep(m_clipsViewPort->width());
-       
-       m_vScrollBar->setRange(0, m_sceneHeight - m_clipsViewPort->height() / 
2);
-       m_vScrollBar->setSingleStep(m_clipsViewPort->height() / 10);
-       m_vScrollBar->setPageStep(m_clipsViewPort->height());
-       
-       m_playCursor->set_bounding_rect(QRectF(0, 0, 2, m_vScrollBar->maximum() 
+ m_clipsViewPort->height()));
-       m_playCursor->update_position();
-       m_workCursor->set_bounding_rect(QRectF(0, 0, 1, m_vScrollBar->maximum() 
+ m_clipsViewPort->height()));
-       m_workCursor->update_position();
-       
-       set_snap_range(m_hScrollBar->value());
-}
-
-void SongView::hscrollbar_value_changed(int value)
-{
-       // This slot is called when the hscrollbar value changes,
-       // which can be due shuttling.
-       // In that very case, we do NOT set the hscrollbar value AGAIN
-       // but in case of a non-shuttle command, we call ie().jog to give the 
-       // command the opportunity to update itself for the changed
-       // viewport / mouse coordinates.
-       if (ie().is_holding()) {
-               Shuttle* s = dynamic_cast<Shuttle*>(ie().get_holding_command());
-               if (!s) {
-                       ie().jog();
-               }
-       } else {
-               m_clipsViewPort->horizontalScrollBar()->setValue(value);
-       }
-       
-       set_snap_range(m_hScrollBar->value());
-}
-
-Command* SongView::zoom()
-{
-       return new Zoom(this);
-}
-
-Command* SongView::hzoom_out()
-{
-       PENTER;
-       m_song->set_hzoom(m_song->get_hzoom() + 1);
-       center();
-       return (Command*) 0;
-}
-
-
-Command* SongView::hzoom_in()
-{
-       PENTER;
-       m_song->set_hzoom(m_song->get_hzoom() - 1);
-       center();
-       return (Command*) 0;
-}
-
-
-Command* SongView::vzoom_in()
-{
-       PENTER;
-       for (int i=0; i<m_trackViews.size(); ++i) {
-               TrackView* view = m_trackViews.at(i);
-               Track* track = view->get_track();
-               int height = track->get_height();
-               height = (int) (height * 1.2);
-               if (height > m_trackMaximumHeight) {
-                       height = m_trackMaximumHeight;
-               }
-               track->set_height(height);
-       }
-       
-       layout_tracks();
-       
-       return (Command*) 0;
-}
-
-
-Command* SongView::vzoom_out()
-{
-       PENTER;
-       for (int i=0; i<m_trackViews.size(); ++i) {
-               TrackView* view = m_trackViews.at(i);
-               Track* track = view->get_track();
-               int height = track->get_height();
-               height = (int) (height * 0.8);
-               if (height < m_trackMinimumHeight) {
-                       height = m_trackMinimumHeight;
-               }
-               track->set_height(height);
-       }
-       
-       layout_tracks();
-       
-       return (Command*) 0;
-}
-
-
-void SongView::layout_tracks()
-{
-       int verticalposition = m_trackTopIndent;
-       for (int i=0; i<m_trackViews.size(); ++i) {
-               TrackView* view = m_trackViews.at(i);
-               view->calculate_bounding_rect();
-               view->move_to(0, verticalposition);
-               verticalposition += (view->get_track()->get_height() + 
m_trackSeperatingHeight);
-       }
-       
-       m_sceneHeight = verticalposition;
-       update_scrollbars();
-}
-
-
-Command* SongView::center()
-{
-       PENTER2;
-       TimeRef centerX;
-       if (m_song->is_transport_rolling() && m_actOnPlayHead) { 
-               centerX = m_song->get_transport_location();
-       } else {
-               centerX = m_song->get_work_location();
-       }
-
-       set_hscrollbar_value((int)(centerX / timeref_scalefactor) - 
m_clipsViewPort->width() / 2);
-       return (Command*) 0;
-}
-
-
-void SongView::stop_follow_play_head()
-{
-       m_song->set_temp_follow_state(false);
-}
-
-
-void SongView::follow_play_head()
-{
-       m_song->set_temp_follow_state(true);
-}
-
-
-void SongView::set_follow_state(bool state)
-{
-       if (state) {
-               m_actOnPlayHead = true;
-               m_playCursor->enable_follow();
-               m_playCursor->setPos(m_song->get_transport_location() / 
timeref_scalefactor, 0);
-       } else {
-               m_actOnPlayHead = false;
-               m_playCursor->disable_follow();
-       }
-}
-
-
-Command* SongView::shuttle()
-{
-       return new Shuttle(this);
-}
-
-
-void SongView::start_shuttle(bool start, bool drag)
-{
-       if (start) {
-               m_shuttletimer.start(40);
-               m_dragShuttle = drag;
-               m_shuttleYfactor = m_shuttleXfactor = 0;
-               stop_follow_play_head();
-       } else {
-               m_shuttletimer.stop();
-       }
-}
-
-void SongView::set_shuttle_factor_values(int x, int y)
-{
-       m_shuttleXfactor = x;
-       m_shuttleYfactor = y;
-}
-
-
-void SongView::update_shuttle_factor()
-{
-       float vec[2];
-       int direction = 1;
-       
-       float normalizedX = (float) cpointer().x() / m_clipsViewPort->width();
-       
-       if (normalizedX < 0.5) {
-               normalizedX = 0.5 - normalizedX;
-               normalizedX *= 2;
-               direction = -1;
-       } else if (normalizedX > 0.5) {
-               normalizedX = normalizedX - 0.5;
-               normalizedX *= 2;
-               if (normalizedX > 1.0) {
-                       normalizedX *= 1.15;
-               }
-       }
-       
-       if (m_dragShuttle) {
-               m_dragShuttleCurve->get_vector(normalizedX, normalizedX + 0.01, 
vec, 2);
-       } else {
-               m_shuttleCurve->get_vector(normalizedX, normalizedX + 0.01, 
vec, 2);
-       }
-       
-       if (direction > 0) {
-               m_shuttleXfactor = (int) (vec[0] * 30);
-       } else {
-               m_shuttleXfactor = (int) (vec[0] * -30);
-       }
-       
-       direction = 1;
-       float normalizedY = (float) cpointer().y() / m_clipsViewPort->height();
-       
-       if (normalizedY < 0) normalizedY = 0;
-       if (normalizedY > 1) normalizedY = 1;
-       
-       if (normalizedY > 0.35 && normalizedY < 0.65) {
-               normalizedY = 0;
-       } else if (normalizedY < 0.5) {
-               normalizedY = 0.5 - normalizedY;
-               direction = -1;
-       } else if (normalizedY > 0.5) {
-               normalizedY = normalizedY - 0.5;
-       }
-       
-       normalizedY *= 2;
-       
-       if (m_dragShuttle) {
-               m_dragShuttleCurve->get_vector(normalizedY, normalizedY + 0.01, 
vec, 2);
-       } else {
-               m_shuttleCurve->get_vector(normalizedY, normalizedY + 0.01, 
vec, 2);
-       }
-       
-       int yscale;
-       
-       if (m_trackViews.size()) {
-               yscale = int(mean_track_height() / 10);
-       } else {
-               yscale = int(m_clipsViewPort->viewport()->height() / 10);
-       }
-       
-       if (direction > 0) {
-               m_shuttleYfactor = (int) (vec[0] * yscale);
-       } else {
-               m_shuttleYfactor = (int) (vec[0] * -yscale);
-       }
-       
-       if (m_dragShuttle) {
-               m_shuttleYfactor *= 4;
-       }
-}
-
-int SongView::mean_track_height()
-{
-       int total =0;
-       int mean = 0;
-       
-       foreach(TrackView* view, m_trackViews) {
-               total += view->get_height();
-       }
-       
-       mean = total / m_trackViews.size();
-       
-       return mean;
-}
-
-void SongView::update_shuttle()
-{
-       int x = m_clipsViewPort->horizontalScrollBar()->value() + 
m_shuttleXfactor;
-       set_hscrollbar_value(x);
-       
-       int y = m_clipsViewPort->verticalScrollBar()->value() + 
m_shuttleYfactor;
-       set_vscrollbar_value(y);
-       
-       if (m_shuttleXfactor != 0 || m_shuttleYfactor != 0) {
-               ie().jog();
-       }
-}
-
-
-Command* SongView::goto_begin()
-{
-       stop_follow_play_head();
-       m_song->set_work_at(TimeRef());
-       center();
-       return (Command*) 0;
-}
-
-
-Command* SongView::goto_end()
-{
-       stop_follow_play_head();
-       TimeRef lastlocation = m_song->get_last_location();
-       m_song->set_work_at(lastlocation);
-       center();
-       return (Command*) 0;
-}
-
-
-TrackPanelViewPort* SongView::get_trackpanel_view_port( ) const
-{
-       return m_tpvp;
-}
-
-ClipsViewPort * SongView::get_clips_viewport() const
-{
-       return m_clipsViewPort;
-}
-
-
-Command * SongView::touch( )
-{
-       QPointF point = 
m_clipsViewPort->mapToScene(QPoint(cpointer().on_first_input_event_x(), 
cpointer().on_first_input_event_y()));
-       m_song->set_work_at(TimeRef(point.x() * timeref_scalefactor));
-
-       return 0;
-}
-
-Command * SongView::touch_play_cursor( )
-{
-       QPointF point = 
m_clipsViewPort->mapToScene(QPoint(cpointer().on_first_input_event_x(), 
cpointer().on_first_input_event_y()));
-       m_playCursor->setPos(point.x(), 0);
-       m_song->set_transport_pos(TimeRef(point.x() * timeref_scalefactor));
-
-       return 0;
-}
-
-Command * SongView::play_to_begin( )
-{
-       m_playCursor->setPos(0, 0);
-       m_song->set_transport_pos(TimeRef());
-
-       return 0;
-}
-
-Command * SongView::play_cursor_move( )
-{
-       return new PlayHeadMove(m_playCursor, this);
-}
-
-Command * SongView::work_cursor_move( )
-{
-       return new WorkCursorMove(m_playCursor, this);
-}
-
-void SongView::set_snap_range(int start)
-{
-//     printf("SongView::set_snap_range\n");
-       m_song->get_snap_list()->set_range(TimeRef(start * timeref_scalefactor),
-                                       TimeRef((start + 
m_clipsViewPort->viewport()->width()) * timeref_scalefactor),
-                                       timeref_scalefactor);
-}
-
-Command* SongView::scroll_up( )
-{
-       PENTER3;
-       set_vscrollbar_value(m_clipsViewPort->verticalScrollBar()->value() - 
int(mean_track_height() * 0.75));
-       return (Command*) 0;
-}
-
-Command* SongView::scroll_down( )
-{
-       PENTER3;
-       set_vscrollbar_value(m_clipsViewPort->verticalScrollBar()->value() + 
int(mean_track_height() * 0.75));
-       return (Command*) 0;
-}
-
-Command* SongView::scroll_right()
-{
-       PENTER3;
-       stop_follow_play_head();
-       set_hscrollbar_value(m_clipsViewPort->horizontalScrollBar()->value() + 
50);
-       return (Command*) 0;
-}
-
-
-Command* SongView::scroll_left()
-{
-       PENTER3;
-       stop_follow_play_head();
-       set_hscrollbar_value(m_clipsViewPort->horizontalScrollBar()->value() - 
50);
-       return (Command*) 0;
-}
-
-Command* SongView::scroll_up_hold( )
-{
-       PENTER3;
-       return new Scroll(0, -20, this);
-}
-
-Command* SongView::scroll_down_hold( )
-{
-       PENTER3;
-       return new Scroll(0, 20, this);
-}
-
-Command* SongView::scroll_right_hold()
-{
-       PENTER3;
-       return new Scroll(20, 0, this);
-}
-
-
-Command* SongView::scroll_left_hold()
-{
-       PENTER3;
-       return new Scroll(-20, 0, this);
-}
-
-int SongView::hscrollbar_value() const
-{
-       return m_clipsViewPort->horizontalScrollBar()->value();
-}
-
-void SongView::hscrollbar_action(int action)
-{
-       if (action == QAbstractSlider::SliderPageStepAdd || action == 
QAbstractSlider::SliderPageStepSub) {
-               stop_follow_play_head();
-       }
-}
-
-int SongView::vscrollbar_value() const
-{
-       return m_clipsViewPort->verticalScrollBar()->value();
-}
-
-void SongView::load_theme_data()
-{
-       m_trackSeperatingHeight = 
themer()->get_property("Song:track:seperatingheight", 0).toInt();
-       m_trackMinimumHeight = 
themer()->get_property("Song:track:minimumheight", 16).toInt();
-       m_trackMaximumHeight = 
themer()->get_property("Song:track:maximumheight", 300).toInt();
-       m_trackTopIndent = themer()->get_property("Song:track:topindent", 
6).toInt();
-       
-       
m_clipsViewPort->setBackgroundBrush(themer()->get_color("Song:background"));
-       
m_tpvp->setBackgroundBrush(themer()->get_color("TrackPanel:background"));
-
-       layout_tracks();
-}
-
-Command * SongView::add_marker()
-{
-       return m_tlvp->get_timeline_view()->add_marker();
-}
-
-Command * SongView::add_marker_at_playhead()
-{
-       return m_tlvp->get_timeline_view()->add_marker_at_playhead();
-}
-
-Command * SongView::playhead_to_workcursor( )
-{
-       TimeRef worklocation = m_song->get_work_location();
-
-       m_song->set_transport_pos(worklocation);
-       m_playCursor->setPos(worklocation / timeref_scalefactor, 0);
-       
-       if (!m_song->is_transport_rolling()) {
-               center();
-       }
-
-       return (Command*) 0;
-}
-
-Command * SongView::center_playhead( )
-{
-       TimeRef centerX = m_song->get_transport_location();
-       set_hscrollbar_value(int(centerX / timeref_scalefactor - 
m_clipsViewPort->width() / 2));
-       
-       follow_play_head();
-
-       return (Command*) 0;
-}
-
-void SongView::set_hscrollbar_value(int value)
-{
-       m_clipsViewPort->horizontalScrollBar()->setValue(value);
-       m_hScrollBar->setValue(value);
-       m_song->set_scrollbar_xy(m_hScrollBar->value(), m_vScrollBar->value());
-}
-
-void SongView::set_vscrollbar_value(int value)
-{
-       if (value > m_vScrollBar->maximum()) {
-               value = m_vScrollBar->maximum();
-       }
-       m_clipsViewPort->verticalScrollBar()->setValue(value);
-       m_vScrollBar->setValue(value);
-       m_song->set_scrollbar_xy(m_hScrollBar->value(), m_vScrollBar->value());
-}
-

Index: SongView.h
===================================================================
RCS file: SongView.h
diff -N SongView.h
--- SongView.h  15 Jan 2008 19:56:07 -0000      1.40
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,178 +0,0 @@
-/*
-    Copyright (C) 2005-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 SONG_VIEW_H
-#define SONG_VIEW_H
-
-#include "ViewItem.h"
-#include <QTimer>
-
-class Song;
-class TrackView;
-class ClipsViewPort;
-class TrackPanelViewPort;
-class TimeLineViewPort;
-class Track;
-class SongWidget;
-class TrackView;
-class PlayHead;
-class WorkCursor;
-class Curve;
-
-class SongView : public ViewItem
-{
-        Q_OBJECT
-       Q_CLASSINFO("touch", tr("Set"))
-       Q_CLASSINFO("touch_play_cursor", tr("Set"))
-       Q_CLASSINFO("hzoom_out", tr("Horizontal Out"))
-       Q_CLASSINFO("hzoom_in", tr("Horizontal In"))
-       Q_CLASSINFO("vzoom_out", tr("Vertical Out"))
-       Q_CLASSINFO("vzoom_in", tr("Vertical In"))
-       Q_CLASSINFO("zoom", tr("Omnidirectional"))
-       Q_CLASSINFO("center", tr("Center View"))
-       Q_CLASSINFO("scroll_right", tr("Right"))
-       Q_CLASSINFO("scroll_left", tr("Left"))
-       Q_CLASSINFO("scroll_up", tr("Up"))
-       Q_CLASSINFO("scroll_down", tr("Down"))
-       Q_CLASSINFO("scroll_right_hold", tr("Right"))
-       Q_CLASSINFO("scroll_left_hold", tr("Left"))
-       Q_CLASSINFO("scroll_up_hold", tr("Up"))
-       Q_CLASSINFO("scroll_down_hold", tr("Down"))
-       Q_CLASSINFO("shuttle", tr("Shuttle"))
-       Q_CLASSINFO("goto_begin", tr("To start"))
-       Q_CLASSINFO("goto_end", tr("To end"))
-       Q_CLASSINFO("play_to_begin", tr("To Start"))
-       Q_CLASSINFO("play_cursor_move", tr("Move"))
-       Q_CLASSINFO("work_cursor_move", tr("Move"))
-       Q_CLASSINFO("add_marker", tr("Add Marker"))
-       Q_CLASSINFO("add_marker_at_playhead", tr("Add Marker at Playhead"))
-       Q_CLASSINFO("playhead_to_workcursor", tr("To workcursor"))
-       Q_CLASSINFO("center_playhead", tr("Center"))
-
-public :
-
-        SongView(SongWidget* songwidget,
-                       ClipsViewPort* viewPort,
-                       TrackPanelViewPort* tpvp, 
-                               TimeLineViewPort* tlvp, 
-                       Song* song);
-        ~SongView();
-       
-       void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) {};
-       QRectF boundingRect() const {return QRectF();}
-       
-       Song* get_song() const {return m_song;}
-       TrackPanelViewPort* get_trackpanel_view_port() const;
-       ClipsViewPort* get_clips_viewport() const;
-       
-       TrackView* get_trackview_under(QPointF point);
-       
-       void load_theme_data();
-       void start_shuttle(bool start, bool drag=false);
-       void update_shuttle_factor();
-       void set_shuttle_factor_values(int x, int y);
-       int hscrollbar_value() const;
-       int vscrollbar_value() const;
-       int get_peak_cache_zoom_factor() const {return m_peakCacheZoomFactor;}
-
-       qint64          timeref_scalefactor;
-
-private:
-        Song*                  m_song;
-       Curve*                  m_shuttleCurve;
-       Curve*                  m_dragShuttleCurve;
-       PlayHead*               m_playCursor;
-       ClipsViewPort*          m_clipsViewPort;
-       TrackPanelViewPort*     m_tpvp;
-       TimeLineViewPort*       m_tlvp;
-       QList<TrackView*>       m_trackViews;
-       WorkCursor*             m_workCursor;
-       int                     m_shuttleXfactor;
-       int                     m_shuttleYfactor;
-       int                     m_sceneHeight;
-       int                     m_peakCacheZoomFactor;
-       bool                    m_dragShuttle;
-       QTimer                  m_shuttletimer;
-       QScrollBar*             m_vScrollBar;
-       QScrollBar*             m_hScrollBar;
-       bool                    m_actOnPlayHead;
-       
-       // Themeing data
-       int     m_trackSeperatingHeight;
-       int     m_trackMinimumHeight;
-       int     m_trackMaximumHeight;
-       int     m_trackTopIndent;
-       
-       void layout_tracks();
-       void set_hscrollbar_value(int value);
-       void set_vscrollbar_value(int value);
-       
-       int mean_track_height();
-       
-       friend class PlayHead;
-
-
-public slots:
-       void set_snap_range(int);
-       void update_scrollbars();
-       void stop_follow_play_head();
-       void follow_play_head();
-       void set_follow_state(bool state);
-
-       Command* touch();
-       Command* touch_play_cursor();
-        Command* hzoom_out();
-        Command* hzoom_in();
-        Command* vzoom_out();
-        Command* vzoom_in();
-        Command* zoom();
-        Command* center();
-        Command* scroll_right();
-        Command* scroll_left();
-        Command* scroll_up();
-        Command* scroll_down();
-        Command* scroll_right_hold();
-        Command* scroll_left_hold();
-        Command* scroll_up_hold();
-        Command* scroll_down_hold();
-        Command* shuttle();
-        Command* goto_begin();
-        Command* goto_end();
-       Command* play_to_begin();
-       Command* play_cursor_move();
-       Command* work_cursor_move();
-       Command* add_marker();
-       Command* add_marker_at_playhead();
-       Command* playhead_to_workcursor();
-       Command* center_playhead();
-       
-private slots:
-       void scale_factor_changed();
-       void add_new_trackview(Track*);
-       void remove_trackview(Track*);
-       void update_shuttle();
-       void song_mode_changed();
-       void hscrollbar_value_changed(int);
-       void hscrollbar_action(int);
-};
-
-
-#endif

Index: SongWidget.cpp
===================================================================
RCS file: SongWidget.cpp
diff -N SongWidget.cpp
--- SongWidget.cpp      15 Jan 2008 19:56:07 -0000      1.25
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,309 +0,0 @@
-/*
-    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.
- 
-*/
-
-               
-#include "SongWidget.h"
-#include "TrackPanelViewPort.h"
-#include "ClipsViewPort.h"
-#include "TimeLineViewPort.h"
-#include "SongView.h"
-#include "Themer.h"
-#include "Config.h"
-
-#include <Song.h>
-#include "Utils.h"
-#include "ContextPointer.h"
-#include "Mixer.h"
-
-#if defined (QT_OPENGL_SUPPORT)
-#include <QtOpenGL>
-#endif
-
-#include <QGridLayout>
-#include <QScrollBar>
-
-#include <Debugger.h>
-
-
-SongPanelGain::SongPanelGain(ViewItem* parent, Song* song)
-       : ViewItem(parent, song)
-       , m_song(song)
-{
-       m_boundingRect = QRectF(0, 0, 180, 9);
-       connect(song, SIGNAL(masterGainChanged()), this, SLOT(update_gain()));
-       setAcceptsHoverEvents(true);
-}
-
-void SongPanelGain::paint( QPainter * painter, const QStyleOptionGraphicsItem 
* option, QWidget * widget )
-{
-       Q_UNUSED(widget);
-       const int height = 9;
-
-       int sliderWidth = (int)m_boundingRect.width() - 75;
-       float gain = m_song->get_gain();
-       QString sgain = coefficient_to_dbstring(gain);
-       float db = coefficient_to_dB(gain);
-
-       if (db < -60) {
-               db = -60;
-       }
-       int sliderdbx =  (int) (sliderWidth - (sliderWidth*0.3)) - (int) ( ( 
(-1 * db) / 60 ) * sliderWidth);
-       if (sliderdbx < 0) {
-               sliderdbx = 0;
-       }
-       if (db > 0) {
-               sliderdbx =  (int)(sliderWidth*0.7) + (int) ( ( db / 6 ) * 
(sliderWidth*0.3));
-       }
-
-       int cr = (gain >= 1 ? 30 + (int)(100 * gain) : (int)(50 * gain));
-       int cb = ( gain < 1 ? 150 + (int)(50 * gain) : abs((int)(10 * gain)) );
-       
-       painter->setPen(themer()->get_color("TrackPanel:text"));
-       painter->setFont(themer()->get_font("TrackPanel:fontscale:gain"));
-       painter->drawText(0, height + 1, "GAIN");
-       painter->drawRect(30, 1, sliderWidth, height);
-       
-       bool mousehover = (option->state & QStyle::State_MouseOver);
-       QColor color(cr,0,cb);
-       if (mousehover) {
-               color = color.light(140);
-       }
-       painter->fillRect(31, 2, sliderdbx, height-1, color);
-       painter->drawText(sliderWidth + 35, height, sgain);
-}
-
-Command* SongPanelGain::gain_increment()
-{
-       m_song->set_gain(m_song->get_gain() + 0.05);
-       return 0;
-}
-
-Command* SongPanelGain::gain_decrement()
-{
-       m_song->set_gain(m_song->get_gain() - 0.05);
-       return 0;
-}
-
-
-SongPanelView::SongPanelView(QGraphicsScene* scene, Song* song)
-       : ViewItem(0, 0)
-       , m_song(song)
-{
-       scene->addItem(this);
-       m_gainview = new SongPanelGain(this, m_song);
-       m_gainview->setPos(10, 16);
-#if QT_VERSION < 0x040300
-       scene->addItem(m_gainview);
-#endif
-       m_boundingRect = QRectF(0, 0, 200, TIMELINE_HEIGHT);
-}
-
-void SongPanelView::paint(QPainter * painter, const QStyleOptionGraphicsItem * 
option, QWidget * widget)
-{
-       int xstart = (int)option->exposedRect.x();
-       int pixelcount = (int)option->exposedRect.width();
-       
-       painter->setPen(themer()->get_color("TrackPanel:text"));
-       painter->setFont(themer()->get_font("TrackPanel:fontscale:led"));
-       painter->drawText(10, 11, "Sheet: " + m_song->get_title());
-       
-       QColor color = 
QColor(Qt::darkGray);//themer()->get_color("Track:cliptopoffset");
-       painter->setPen(color);
-       painter->fillRect(xstart, TIMELINE_HEIGHT - 2, pixelcount, 2, color);
-       painter->fillRect(199, 0, 1, TIMELINE_HEIGHT, color);
-}
-
-class SongPanelViewPort : public ViewPort
-{
-public:
-       SongPanelViewPort(QGraphicsScene* scene, SongWidget* sw);
-       ~SongPanelViewPort() {};
-
-       void get_pointed_context_items(QList<ContextItem* > &list)
-       {
-               QList<QGraphicsItem *> itemlist = 
items(cpointer().on_first_input_event_x(), cpointer().on_first_input_event_y());
-               foreach(QGraphicsItem* item, itemlist) {
-                       if (ViewItem::is_viewitem(item)) {
-                               list.append((ViewItem*)item);
-                       }
-               }
-               list.removeAll(m_spv);
-               list.append(m_sv);
-       }
-       
-       void set_song_view(SongView* sv)
-       {
-               m_sv = sv;
-               m_spv = new SongPanelView(scene(), m_song);
-               m_spv->setPos(-200, -TIMELINE_HEIGHT);
-       }
-
-private:
-       Song*   m_song;
-       SongView* m_sv;
-       SongPanelView* m_spv;
-};
-
-
-SongPanelViewPort::SongPanelViewPort(QGraphicsScene * scene, SongWidget * sw)
-       : ViewPort(scene, sw)
-{
-       setSceneRect(-200, -TIMELINE_HEIGHT, 200, 0);
-       m_song = sw->get_song();
-       
-       setMaximumHeight(TIMELINE_HEIGHT);
-       setMinimumHeight(TIMELINE_HEIGHT);
-       setMinimumWidth(200);
-       setMaximumWidth(200);
-       setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-       setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-       setBackgroundBrush(themer()->get_color("SongPanel:background"));
-}
-
-
-SongWidget::SongWidget(Song* song, QWidget* parent)
-       : QFrame(parent)
-       , m_song(song)
-{
-       if (!m_song) {
-               return;
-       }
-       m_scene = new QGraphicsScene();
-       m_vScrollBar = new QScrollBar(this);
-       m_hScrollBar = new QScrollBar(this);
-       m_hScrollBar->setOrientation(Qt::Horizontal);
-
-       m_trackPanel = new TrackPanelViewPort(m_scene, this);
-       m_clipsViewPort = new ClipsViewPort(m_scene, this);
-       m_timeLine = new TimeLineViewPort(m_scene, this);
-       m_songPanelVP = new SongPanelViewPort(m_scene, this);
-       
-       m_mainLayout = new QGridLayout(this);
-       m_mainLayout->addWidget(m_songPanelVP, 0, 0);
-       m_mainLayout->addWidget(m_timeLine, 0, 1);
-       m_mainLayout->addWidget(m_trackPanel, 1, 0);
-       m_mainLayout->addWidget(m_clipsViewPort, 1, 1);
-       m_mainLayout->addWidget(m_hScrollBar, 2, 1);
-       m_mainLayout->addWidget(m_vScrollBar, 1, 2);
-       
-       m_mainLayout->setMargin(0);
-       m_mainLayout->setSpacing(0);
-
-       setLayout(m_mainLayout);
-       
-       m_sv = new SongView(this, m_clipsViewPort, m_trackPanel, m_timeLine, 
song);
-       m_timeLine->set_songview(m_sv);
-       m_songPanelVP->set_song_view(m_sv);
-       
-       connect(m_clipsViewPort->horizontalScrollBar(), 
-               SIGNAL(valueChanged(int)),
-               m_timeLine->horizontalScrollBar(), 
-               SLOT(setValue(int)));
-       
-       connect(m_timeLine->horizontalScrollBar(), 
-               SIGNAL(valueChanged(int)),
-               m_clipsViewPort->horizontalScrollBar(), 
-               SLOT(setValue(int)));
-       
-       connect(m_clipsViewPort->verticalScrollBar(), 
-               SIGNAL(valueChanged(int)),
-               m_trackPanel->verticalScrollBar(), 
-               SLOT(setValue(int)));
-       
-       connect(m_trackPanel->verticalScrollBar(), 
-               SIGNAL(valueChanged(int)),
-               m_clipsViewPort->verticalScrollBar(), 
-               SLOT(setValue(int)));
-       
-       connect(themer(), SIGNAL(themeLoaded()), this, SLOT(load_theme_data()), 
Qt::QueuedConnection);
-       
-       m_usingOpenGL  = false;
-       set_use_opengl(config().get_property("Interface", "OpenGL", 
false).toBool());
-
-       setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
-
-       cpointer().set_current_viewport(m_clipsViewPort);
-       m_clipsViewPort->setFocus();
-}
-
-
-SongWidget::~ SongWidget()
-{
-       if (!m_song) {
-               return;
-       }
-       delete m_trackPanel;
-       delete m_clipsViewPort;
-       delete m_timeLine;
-       delete m_songPanelVP;
-       delete m_scene;
-}
-
-
-QSize SongWidget::minimumSizeHint() const
-{
-       return QSize(400, 200);
-}
-
-QSize SongWidget::sizeHint() const
-{
-       return QSize(700, 600);
-}
-
-void SongWidget::set_use_opengl( bool useOpenGL )
-{
-       if (!m_song) {
-               return;
-       }
-       
-       if (useOpenGL != m_usingOpenGL) {
-#if defined (QT_OPENGL_SUPPORT)
-               m_clipsViewPort->setViewport(useOpenGL ? new 
QGLWidget(QGLFormat(QGL::SampleBuffers)) : new QWidget);
-               m_trackPanel->setViewport(useOpenGL ? new 
QGLWidget(QGLFormat(QGL::SampleBuffers)) : new QWidget);
-#endif
-       }
-       m_usingOpenGL = useOpenGL;
-}
-
-
-void SongWidget::load_theme_data()
-{
-       QList<QGraphicsItem*> list = m_scene->items();
-       
-       for (int i = 0; i < list.size(); ++i) {
-               ViewItem* item = qgraphicsitem_cast<ViewItem*>(list.at(i));
-               if (item) {
-                       item->load_theme_data();
-               }
-       }
-       
-}
-
-Song * SongWidget::get_song() const
-{
-       return m_song;
-}
-
-SongView * SongWidget::get_songview() const
-{
-       return m_sv;
-}
-

Index: SongWidget.h
===================================================================
RCS file: SongWidget.h
diff -N SongWidget.h
--- SongWidget.h        5 Nov 2007 15:49:32 -0000       1.13
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,114 +0,0 @@
-/*
-    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.
- 
-    $Id: SongWidget.h,v 1.13 2007/11/05 15:49:32 r_sijrier Exp $
-*/
-
-#ifndef SONG_WIDGET_H
-#define SONG_WIDGET_H
-
-#include <QFrame>
-#include "ViewItem.h"
-
-class QGridLayout;
-class QGraphicsScene;
-class QScrollBar;
-               
-class TrackPanelViewPort;
-class TimeLineViewPort;
-class ClipsViewPort;
-class SongPanelViewPort;
-
-class Project;
-class Song;
-class Command;
-class SongView;
-
-class SongPanelGain : public ViewItem
-{
-       Q_OBJECT
-public:
-       SongPanelGain(ViewItem* parent, Song* song);
-       SongPanelGain(){}
-
-       void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-
-public slots:
-       Command* gain_increment();
-       Command* gain_decrement();
-
-private slots:
-       void update_gain() {update();}
-
-private:
-       Song* m_song;
-};
-
-class SongPanelView : public ViewItem
-{
-       Q_OBJECT
-public:
-       SongPanelView(QGraphicsScene* scene, Song* song);
-       ~SongPanelView() {}
-
-       void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-
-private:
-       SongPanelGain* m_gainview;
-       Song* m_song;
-};
-
-class SongWidget : public QFrame
-{
-       Q_OBJECT
-public:
-       SongWidget(Song* song, QWidget* parent=0);
-       ~SongWidget();
-       
-       void set_use_opengl(bool useOpenGL);
-       Song* get_song() const;
-       SongView* get_songview() const;
-       
-protected:
-       QSize minimumSizeHint () const;
-       QSize sizeHint () const;
-
-private:
-       SongView*               m_sv;
-       Song*                   m_song;
-       QGridLayout*            m_mainLayout;
-       TrackPanelViewPort*     m_trackPanel;
-       TimeLineViewPort*       m_timeLine;
-       ClipsViewPort*          m_clipsViewPort;
-       SongPanelViewPort*      m_songPanelVP;
-       QGraphicsScene*         m_scene;
-       QScrollBar*             m_vScrollBar;
-       QScrollBar*             m_hScrollBar;
-       bool                    m_usingOpenGL;
-       
-       friend class SongView;
-
-private slots:
-       void load_theme_data();
-};
-
-
-#endif
-
-//eof

Index: TimeLineView.cpp
===================================================================
RCS file: TimeLineView.cpp
diff -N TimeLineView.cpp
--- TimeLineView.cpp    29 Dec 2007 03:00:26 -0000      1.58
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,493 +0,0 @@
-/*
-Copyright (C) 2005-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 "TimeLineView.h"
-
-#include <QPainter>
-
-#include "Themer.h"
-#include "SongView.h"
-#include "MarkerView.h"
-#include "TimeLineViewPort.h"
-#include "SnapList.h"
-
-#include <ProjectManager.h>
-#include <Project.h>
-#include <Song.h>
-#include <TimeLine.h>
-#include <Marker.h>
-#include <ContextPointer.h>
-#include <Utils.h>
-#include <defines.h>
-#include <AddRemove.h>
-#include <CommandGroup.h>
-#include "Information.h"
-#include "InputEngine.h"
-
-#include <QFont>
-#include <QDebug>
-
-// Always put me below _all_ includes, this is needed
-// in case we run with memory leak detection enabled!
-#include "Debugger.h"
-
-
-#define MARKER_SOFT_SELECTION_DISTANCE 50
-
-
-DragMarker::DragMarker(MarkerView* mview, qint64 scalefactor, const QString& 
des)
-       : Command(mview->get_marker(), des)
-{
-       d = new Data;
-       d->view = mview;
-       m_marker= d->view->get_marker();
-       d->scalefactor = scalefactor;
-       d->bypassjog = false;
-}
-
-int DragMarker::prepare_actions()
-{
-       return 1;
-}
-
-int DragMarker::begin_hold()
-{
-       m_origWhen = m_newWhen = m_marker->get_when();
-       m_marker->set_snappable(false);
-       d->view->get_songview()->start_shuttle(true, true);
-       d->view->set_dragging(true);    
-       return 1;
-}
-
-int DragMarker::finish_hold()
-{
-       m_marker->set_snappable(true);
-       d->view->get_songview()->start_shuttle(false);
-       d->view->set_dragging(false);
-       delete d;
-       
-       return 1;
-}
-
-int DragMarker::do_action()
-{
-       m_marker->set_when(m_newWhen);
-       return 1;
-}
-
-int DragMarker::undo_action()
-{
-       m_marker->set_when(m_origWhen);
-       return 1;
-}
-
-void DragMarker::cancel_action()
-{
-       finish_hold();
-       undo_action();
-}
-
-void DragMarker::move_left(bool )
-{
-       d->bypassjog = true;
-       // Move 1 pixel to the left
-       TimeRef newpos = TimeRef(m_newWhen - d->scalefactor);
-       if (newpos < TimeRef()) {
-               newpos = TimeRef();
-       }
-       m_newWhen = newpos;
-       do_action();
-}
-
-void DragMarker::move_right(bool )
-{
-       d->bypassjog = true;
-       // Move 1 pixel to the right
-       m_newWhen = m_newWhen + d->scalefactor;
-       do_action();
-}
-
-int DragMarker::jog()
-{
-       if (d->bypassjog) {
-               int diff = d->jogBypassPos - cpointer().x();
-               if (abs(diff) > 15) {
-                       d->bypassjog = false;
-               } else {
-                       return 0;
-               }
-       }
-       
-       d->jogBypassPos = cpointer().x();
-       TimeRef newpos = TimeRef(cpointer().scene_x() * d->scalefactor);
-
-       if (m_marker->get_timeline()->get_song()->is_snap_on()) {
-               SnapList* slist = 
m_marker->get_timeline()->get_song()->get_snap_list();
-               newpos = slist->get_snap_value(newpos);
-       }
-
-       if (newpos < TimeRef()) {
-               newpos = TimeRef();
-       }
-       
-       m_newWhen = newpos;
-       d->view->set_position(int(m_newWhen / d->scalefactor));
-       
-       d->view->get_songview()->update_shuttle_factor();
-       
-       return 1;
-}
-
-
-// End DragMarker
-
-
-
-TimeLineView::TimeLineView(SongView* view)
-       : ViewItem(0, 0)
-       , m_blinkingMarker(0)
-{
-       PENTERCONS2;
-
-       m_sv = view;
-       m_boundingRect = QRectF(0, 0, MAX_CANVAS_WIDTH, TIMELINE_HEIGHT);
-       m_timeline = m_sv->get_song()->get_timeline();
-       
-#if QT_VERSION < 0x040300
-       view->scene()->addItem(this);
-#endif
-       load_theme_data();
-       
-       // Create MarkerViews for existing markers
-       foreach(Marker* marker, m_timeline->get_markers()) {
-               add_new_marker_view(marker);
-       }
-       
-       // Make connections to the 'core'
-       connect(m_timeline, SIGNAL(markerAdded(Marker*)), this, 
SLOT(add_new_marker_view(Marker*)));
-       connect(m_timeline, SIGNAL(markerRemoved(Marker*)), this, 
SLOT(remove_marker_view(Marker*)));
-
-       setAcceptsHoverEvents(true);
-
-       m_zooms[524288 * 640] = "20:00.000";
-       m_zooms[262144 * 640] = "10:00.000";
-       m_zooms[131072 * 640] = "5:00.000";
-       m_zooms[ 65536 * 640] = "2:30.000";
-       m_zooms[ 32768 * 640] = "1:00.000";
-       m_zooms[ 16384 * 640] = "0:30.000";
-       m_zooms[  8192 * 640] = "0:20.000";
-       m_zooms[  4096 * 640] = "0:10.000";
-       m_zooms[  2048 * 640] = "0:05.000";
-       m_zooms[  1024 * 640] = "0:02.000";
-       m_zooms[   512 * 640] = "0:01.000";
-       m_zooms[   256 * 640] = "0:00.800";
-       m_zooms[   128 * 640] = "0:00.400";
-       m_zooms[    64 * 640] = "0:00.200";
-       m_zooms[    32 * 640] = "0:00.100";
-       m_zooms[    16 * 640] = "0:00.050";
-       m_zooms[     8 * 640] = "0:00.020";
-       m_zooms[     4 * 640] = "0:00.010";
-       m_zooms[     2 * 640] = "0:00.005";
-       m_zooms[     1 * 640] = "0:00.002";
-}
-
-
-TimeLineView::~TimeLineView()
-{
-       PENTERDES;
-}
-
-
-void TimeLineView::hzoom_changed( )
-{
-       update();
-}
-
-void TimeLineView::paint(QPainter* painter, const QStyleOptionGraphicsItem* 
option, QWidget* widget)
-{
-       PENTER3;
-       Q_UNUSED(widget);
-       
-       painter->save();
-       
-       // When the scrollarea moves by a small value, the text
-       // can be screwed up, so give it some room, 100 pixels should do!
-       int xstart = (int) option->exposedRect.x() - 100;
-       int pixelcount = (int) option->exposedRect.width() + 100;
-       int expheight = (int) option->exposedRect.height();
-       int top = (int) option->exposedRect.top();
-       bool paintText = top > 28 &&  expheight < 2 ? false : true;
-       
-       if (xstart < 0) {
-               xstart = 0;
-       }
-       
-       painter->setClipRect(m_boundingRect);
-       
-       int height = TIMELINE_HEIGHT;
-       
-       painter->fillRect(xstart, 0,  pixelcount, height, 
themer()->get_color("Timeline:background") );
-       
-       painter->setPen(themer()->get_color("Timeline:text"));
-       painter->setFont( themer()->get_font("Timeline:fontscale:label") );
-       
-       TimeRef major;
-       
-       if (m_zooms.contains(m_sv->timeref_scalefactor)) {
-               major = msms_to_timeref(m_zooms[m_sv->timeref_scalefactor]);
-       } else {
-               major = 120 * m_sv->timeref_scalefactor;
-       }
-
-       // minor is double so they line up right with the majors,
-       // despite not always being an even number of frames
-       // @Ben : is still still the same when using TimeRef based calculations?
-       double minor = double(major/double(10));
-
-       TimeRef firstLocation = TimeRef(xstart * m_sv->timeref_scalefactor);
-       TimeRef lastLocation = TimeRef(xstart * m_sv->timeref_scalefactor + 
pixelcount * m_sv->timeref_scalefactor);
-       int xstartoffset = m_sv->hscrollbar_value();
-       
-       painter->setMatrixEnabled(false);
-
-       TimeRef factor = (firstLocation/major)*major;
-       // Draw minor ticks
-       TimeRef range((lastLocation-firstLocation+major) / minor);
-       for (qint64 i = 0; i < range.universal_frame(); i++ ) {
-               int x = (int)((factor + i * minor) / m_sv->timeref_scalefactor) 
- xstartoffset;
-               painter->drawLine(x, height - 5, x, height - 1);
-       }
-       
-       // Draw major ticks
-       for (TimeRef location = factor; location < lastLocation; location += 
major) {
-               int x = int(location/m_sv->timeref_scalefactor - xstartoffset);
-               painter->drawLine(x, height - 13, x, height - 1);
-               if (paintText) {
-                       painter->drawText(x + 4, height - 8, 
timeref_to_text(location, m_sv->timeref_scalefactor));
-               }
-       }
-       
-       painter->restore();
-}
-
-void TimeLineView::calculate_bounding_rect()
-{
-       update();
-       ViewItem::calculate_bounding_rect();
-}
-
-
-void TimeLineView::add_new_marker_view(Marker * marker)
-{
-       MarkerView* view = new MarkerView(marker, m_sv, this);
-       view->set_active(false);
-       m_markerViews.append(view);
-#if QT_VERSION < 0x040300
-       m_sv->scene()->addItem(view);
-#endif
-       view->update();
-}
-
-void TimeLineView::remove_marker_view(Marker * marker)
-{
-       foreach(MarkerView* view, m_markerViews) {
-               if (view->get_marker() == marker) {
-                       m_markerViews.removeAll(view);
-                       scene()->removeItem(view);
-                       m_blinkingMarker = 0;
-                       delete view;
-                       return;
-               }
-       }
-}
-
-Command* TimeLineView::add_marker()
-{
-       QPointF point = mapFromScene(cpointer().scene_pos());
-       
-       TimeRef when(point.x() * m_sv->timeref_scalefactor);
-       
-       return add_marker_at(when);
-}
-
-Command* TimeLineView::add_marker_at_playhead()
-{
-       return add_marker_at(m_sv->get_song()->get_transport_location());
-}
-
-Command* TimeLineView::add_marker_at(const TimeRef when)
-{
-       CommandGroup* group = new CommandGroup(m_timeline, "");
-
-       // check if it is the first marker added to the timeline
-       if (!m_timeline->get_markers().size()) {
-               if (when > TimeRef()) {  // add one at the beginning of the song
-                       Marker* m = new Marker(m_timeline, TimeRef(), 
Marker::CDTRACK);
-                       m->set_description("");
-                       group->add_command(m_timeline->add_marker(m));
-               }
-
-               TimeRef lastlocation = m_sv->get_song()->get_last_location();
-               if (when < lastlocation) {  // add one at the end of the song
-                       Marker* me = new Marker(m_timeline, lastlocation, 
Marker::ENDMARKER);
-                       me->set_description(tr("End"));
-                       group->add_command(m_timeline->add_marker(me));
-               }
-       }
-
-       Marker* marker = new Marker(m_timeline, when, Marker::CDTRACK);
-       marker->set_description("");
-       
-       group->setText(tr("Add Marker"));
-       group->add_command(m_timeline->add_marker(marker));
-       
-       return group;
-}
-
-Command* TimeLineView::playhead_to_marker()
-{
-       
update_softselected_marker(QPoint(cpointer().on_first_input_event_scene_x(), 
cpointer().on_first_input_event_scene_y()));
-
-       if (m_blinkingMarker) {
-               
m_sv->get_song()->set_transport_pos(m_blinkingMarker->get_marker()->get_when());
-               return 0;
-       }
-
-       return ie().did_not_implement();
-}
-
-Command* TimeLineView::remove_marker()
-{
-       if (m_blinkingMarker) {
-               Marker* marker = m_blinkingMarker->get_marker();
-               if (marker->get_type() == Marker::ENDMARKER && 
m_markerViews.size() > 1) {
-                       info().information(tr("You have to remove all other 
markers first."));
-                       return ie().failure();
-               }
-               return m_timeline->remove_marker(marker);
-       }
-
-       return 0;
-}
-
-void TimeLineView::update_softselected_marker(QPoint pos)
-{
-       MarkerView* prevMarker = m_blinkingMarker;
-       if (m_markerViews.size()) {
-               m_blinkingMarker = m_markerViews.first();
-       }
-       
-       if (! m_blinkingMarker) {
-               return;
-       }
-       
-       int x = pos.x();
-       int blinkMarkerDist = abs(x - m_blinkingMarker->position());
-       
-       foreach(MarkerView* markerView, m_markerViews) {
-               int markerDist = abs(x - markerView->position());
-
-               fflush(stdout);
-               if (markerDist < blinkMarkerDist) {
-                       m_blinkingMarker = markerView;
-                       blinkMarkerDist = abs(x - m_blinkingMarker->position());
-               }
-       }
-       
-       if (blinkMarkerDist > MARKER_SOFT_SELECTION_DISTANCE) {
-               m_blinkingMarker = 0;
-       }
-       
-       if (prevMarker && (prevMarker != m_blinkingMarker) ) {
-               prevMarker->set_active(false);
-               if (m_blinkingMarker) {
-                       m_blinkingMarker->set_active(true);
-               }
-       }
-       
-       if (!prevMarker && m_blinkingMarker) {
-               m_blinkingMarker->set_active(true);
-       }
-}
-
-void TimeLineView::hoverEnterEvent ( QGraphicsSceneHoverEvent * event )
-{
-       Q_UNUSED(event);
-
-       if (m_blinkingMarker) {
-               m_blinkingMarker->set_active(true);
-       }
-}
-
-void TimeLineView::hoverLeaveEvent ( QGraphicsSceneHoverEvent * event )
-{
-       Q_UNUSED(event);
-       
-       if (ie().is_holding()) {
-               event->ignore();
-               return;
-       }
-       
-       if (m_blinkingMarker) {
-               // TODO add these functions, or something else to 
-               // let the user know which marker is to be moved!
-               m_blinkingMarker->set_active(false);
-               m_blinkingMarker = 0;
-       }
-}
-               
-               
-void TimeLineView::hoverMoveEvent ( QGraphicsSceneHoverEvent * event )
-{
-       QPoint pos((int)event->pos().x(), (int)event->pos().y());
-
-       update_softselected_marker(pos);
-}
-
-
-Command * TimeLineView::drag_marker()
-{
-       
update_softselected_marker(QPoint(cpointer().on_first_input_event_scene_x(), 
cpointer().on_first_input_event_scene_y()));
-
-       if (m_blinkingMarker) {
-               return new DragMarker(m_blinkingMarker, 
m_sv->timeref_scalefactor, tr("Drag Marker"));
-       }
-       
-       return ie().did_not_implement();
-}
-
-Command * TimeLineView::clear_markers()
-{
-       CommandGroup* group = new CommandGroup(m_timeline, tr("Clear Markers"));
-
-       foreach(Marker *m, m_timeline->get_markers()) {
-               group->add_command(m_timeline->remove_marker(m));
-       }
-
-       return group;
-}
-
-void TimeLineView::load_theme_data()
-{
-       // TODO Load pixmap, fonts, colors from themer() !!
-       calculate_bounding_rect();
-}
-

Index: TimeLineView.h
===================================================================
RCS file: TimeLineView.h
diff -N TimeLineView.h
--- TimeLineView.h      5 Nov 2007 15:49:32 -0000       1.14
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,122 +0,0 @@
-/*
-    Copyright (C) 2005-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 TIME_LINE_VIEW_H
-#define TIME_LINE_VIEW_H
-
-#include "ViewItem.h"
-#include <Command.h>
-
-#include <QTimer>
-
-class SongView;
-class TimeLine;
-class MarkerView;
-class Marker;
-
-class DragMarker : public Command
-{
-       Q_OBJECT
-       Q_CLASSINFO("move_left", tr("Move Left"))
-       Q_CLASSINFO("move_right", tr("Move right"))
-
-public:
-       DragMarker(MarkerView* mview, qint64 scalefactor, const QString& des);
-
-       int prepare_actions();
-       int do_action();
-       int undo_action();
-       int finish_hold();
-       int begin_hold();
-       void cancel_action();
-       int jog();
-
-private :
-       Marker*         m_marker;
-       TimeRef         m_origWhen;
-       TimeRef         m_newWhen;
-       struct Data {
-               MarkerView*     view;
-               qint64          scalefactor;
-               bool            bypassjog;
-               int             jogBypassPos;
-       };
-       Data* d;
-
-public slots:
-       void move_left(bool autorepeat);
-       void move_right(bool autorepeat);
-};
-
-class TimeLineView : public ViewItem
-{
-        Q_OBJECT
-       Q_CLASSINFO("add_marker", tr("Add Marker"))
-       Q_CLASSINFO("add_marker_at_playhead", tr("Add Marker at Playhead"))
-       Q_CLASSINFO("remove_marker", tr("Remove Marker"))
-       Q_CLASSINFO("drag_marker", tr("Drag Marker"))
-       Q_CLASSINFO("clear_markers", tr("Clear all Markers"))
-       Q_CLASSINFO("playhead_to_marker", tr("Playhead to Marker"))
-
-public:
-        TimeLineView(SongView* view);
-        ~TimeLineView();
-       
-       void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-       void calculate_bounding_rect();
-       void load_theme_data();
-
-protected:
-       void hoverEnterEvent ( QGraphicsSceneHoverEvent * event );
-       void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
-       void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
-
-private:
-       QList<MarkerView* > m_markerViews;
-       TimeLine*       m_timeline;
-       MarkerView*     m_blinkingMarker;
-       QColor          m_blinkColor;
-
-       QHash<nframes_t, QString>       m_zooms;        
-
-       Command* add_marker_at(const TimeRef when);
-       void update_softselected_marker(QPoint pos);
-       
-       
-public slots:
-        void hzoom_changed();
-       
-public slots:
-       Command* add_marker();
-       Command* add_marker_at_playhead();
-       Command* remove_marker();
-       Command* drag_marker();
-       Command* clear_markers();
-       Command* playhead_to_marker();
-
-private slots:
-       void add_new_marker_view(Marker* marker);
-       void remove_marker_view(Marker* marker);
-};
-
-#endif
-
-//eof

Index: TimeLineViewPort.cpp
===================================================================
RCS file: TimeLineViewPort.cpp
diff -N TimeLineViewPort.cpp
--- TimeLineViewPort.cpp        15 Jan 2008 19:56:07 -0000      1.11
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,77 +0,0 @@
-/*
-    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.
- 
-*/
-
-#include "TimeLineViewPort.h"
-#include "SongView.h"
-#include "SongWidget.h"
-#include "TimeLineView.h"
-#include <QScrollBar>
-#include <QWheelEvent>
-#include <ContextPointer.h>
-               
-#include <Debugger.h>
-
-TimeLineViewPort::TimeLineViewPort(QGraphicsScene* scene, SongWidget* sw)
-       : ViewPort(scene, sw)
-{
-       setMaximumHeight(TIMELINE_HEIGHT);
-       setMinimumHeight(TIMELINE_HEIGHT);
-       setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-       setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-}
-
-
-void TimeLineViewPort::wheelEvent ( QWheelEvent * e )
-{
-       if (e->delta() > 0) {
-               m_sv->scroll_left();
-       } else {
-               m_sv->scroll_right();
-       }
-}
-
-void TimeLineViewPort::set_songview( SongView * view )
-{
-       m_timeLineView = new TimeLineView(view);
-       scene()->addItem(m_timeLineView);
-       m_timeLineView->setPos(0, -TIMELINE_HEIGHT);
-       m_sv = view;
-}
-
-void TimeLineViewPort::get_pointed_context_items(QList<ContextItem* > &list)
-{
-       QList<QGraphicsItem *> itemlist = 
items(cpointer().on_first_input_event_x(), cpointer().on_first_input_event_y());
-       foreach(QGraphicsItem* item, itemlist) {
-               if (ViewItem::is_viewitem(item)) {
-                       list.append((ViewItem*)item);
-               }
-       }
-       list.append(m_sv);
-}
-
-void TimeLineViewPort::scale_factor_changed()
-{
-       m_timeLineView->calculate_bounding_rect();
-}
-
-
-//eof
-

Index: TimeLineViewPort.h
===================================================================
RCS file: TimeLineViewPort.h
diff -N TimeLineViewPort.h
--- TimeLineViewPort.h  17 May 2007 12:45:20 -0000      1.5
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,56 +0,0 @@
-/*
-    Copyright (C) 2006 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.
- 
-    $Id: TimeLineViewPort.h,v 1.5 2007/05/17 12:45:20 r_sijrier Exp $
-*/
-
-#ifndef TIME_LINE_VIEW_PORT_H
-#define TIME_LINE_VIEW_PORT_H
-
-#include "ViewPort.h"
-
-class SongWidget;
-class SongView;
-class TimeLineView;
-
-#define TIMELINE_HEIGHT 32
-               
-class TimeLineViewPort : public ViewPort
-{
-public:
-       TimeLineViewPort(QGraphicsScene* scene, SongWidget* sw);
-       ~TimeLineViewPort() {};
-       
-       void set_songview(SongView* view);
-       void scale_factor_changed();
-       TimeLineView* get_timeline_view() const {return m_timeLineView;}
-       
-       void get_pointed_context_items(QList<ContextItem* > &list);
-
-protected:
-       void wheelEvent ( QWheelEvent * e );
-
-private:
-       SongView*       m_sv;
-       TimeLineView*   m_timeLineView;
-};
-
-#endif
-
-//eof

Index: TrackPanelView.cpp
===================================================================
RCS file: TrackPanelView.cpp
diff -N TrackPanelView.cpp
--- TrackPanelView.cpp  5 Nov 2007 15:49:32 -0000       1.31
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,497 +0,0 @@
-/*
-Copyright (C) 2005-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.
-
-$Id: TrackPanelView.cpp,v 1.31 2007/11/05 15:49:32 r_sijrier Exp $
-*/
-
-#include <QGraphicsScene>
-#include <QFont>
-#include "TrackPanelView.h"
-#include "TrackView.h"
-#include "SongView.h"
-#include <Themer.h>
-#include "TrackPanelViewPort.h"
-#include <Track.h>
-#include "TrackPanelView.h"
-#include <Utils.h>
-#include <Mixer.h>
-#include <Gain.h>
-#include <TrackPan.h>
-               
-#include <Debugger.h>
-
-#define MICRO_HEIGHT 35
-#define SMALL_HEIGHT 65
-
-TrackPanelView::TrackPanelView(TrackView* trackView)
-       : ViewItem(0, trackView)
-       , m_tv(trackView)
-{
-       PENTERCONS;
-       
-       m_viewPort = m_tv->get_songview()->get_trackpanel_view_port();
-       m_track = m_tv->get_track();
-       
-       m_gainView = new TrackPanelGain(this, m_track);
-       m_gainView->set_width(m_viewPort->width() - 20);
-       
-       m_panView = new TrackPanelPan(this, m_track);
-       m_panView->set_width(m_viewPort->width() - 20);
-       
-       recLed = new TrackPanelLed(this, "rec", "toggle_arm");
-       soloLed = new TrackPanelLed(this, "solo", "solo");
-       muteLed = new TrackPanelLed(this, "mute", "mute");
-       
-       if (m_track->armed()) {
-               recLed->ison_changed(true);
-       }
-       if (m_track->is_solo()) {
-               soloLed->ison_changed(true);
-       }
-       if (m_track->is_muted()) {
-               muteLed->ison_changed(true);
-       }
-       
-       inBus = new TrackPanelBus(this, m_track, TrackPanelBus::BUSIN);
-       outBus = new TrackPanelBus(this, m_track, TrackPanelBus::BUSOUT);
-       
-       m_viewPort->scene()->addItem(this);
-
-       
-       m_boundingRect = QRectF(0, 0, 200, m_track->get_height());
-       
-       layout_panel_items();
-       
-       connect(m_track, SIGNAL(armedChanged(bool)), recLed, 
SLOT(ison_changed(bool)));
-       connect(m_track, SIGNAL(soloChanged(bool)), soloLed, 
SLOT(ison_changed(bool)));
-       connect(m_track, SIGNAL(muteChanged(bool)), muteLed, 
SLOT(ison_changed(bool)));
-       
-       connect(m_track, SIGNAL(gainChanged()), this, SLOT(update_gain()));
-       connect(m_track, SIGNAL(panChanged()), this, SLOT(update_pan()));
-       
-       connect(m_track, SIGNAL(inBusChanged()), inBus, SLOT(bus_changed()));
-       connect(m_track, SIGNAL(outBusChanged()), outBus, SLOT(bus_changed()));
-       
-       connect(m_track, SIGNAL(stateChanged()), this, 
SLOT(update_track_name()));
-       
-       
-//     setFlags(ItemIsSelectable | ItemIsMovable);
-//     setAcceptsHoverEvents(true);
-       setCursor(themer()->get_cursor("Track"));
-}
-
-TrackPanelView::~TrackPanelView( )
-{
-       PENTERDES;
-}
-
-
-void TrackPanelView::paint(QPainter* painter, const QStyleOptionGraphicsItem* 
option, QWidget* widget)
-{
-       Q_UNUSED(widget);
-       Q_UNUSED(option);
-       
-       int xstart = (int)option->exposedRect.x();
-       int pixelcount = (int)option->exposedRect.width();
-       
-       if (m_tv->m_topborderwidth > 0) {
-               QColor color = themer()->get_color("Track:cliptopoffset");
-               painter->fillRect(xstart, 0, pixelcount, 
m_tv->m_topborderwidth, color);
-       }
-       
-       if (m_tv->m_paintBackground) {
-               QColor color = themer()->get_color("Track:background");
-               painter->fillRect(xstart, m_tv->m_topborderwidth, pixelcount, 
m_track->get_height() - m_tv->m_bottomborderwidth, color);
-       }
-       
-       if (m_tv->m_bottomborderwidth > 0) {
-               QColor color = themer()->get_color("Track:clipbottomoffset");
-               painter->fillRect(xstart, m_track->get_height() - 
m_tv->m_bottomborderwidth, pixelcount, m_tv->m_bottomborderwidth, color);
-       }
-
-       // Track / track panel seperator is painted in TrackPanelViewPort... 
not the best place perhaps ?
-       painter->fillRect(m_viewPort->width() - 3, 0, 3, m_track->get_height() 
- 1, themer()->get_color("TrackPanel:trackseparation"));
-       
-       if (xstart < 180) {
-               draw_panel_track_name(painter);
-       }
-}
-
-void TrackPanelView::update_track_name()
-{
-       update();
-}
-
-void TrackPanelView::update_gain()
-{
-       m_gainView->update();
-}
-
-
-void TrackPanelView::update_pan()
-{
-       m_panView->update();
-}
-
-
-void TrackPanelView::draw_panel_track_name(QPainter* painter)
-{
-       QString title = QString::number(m_track->get_sort_index() + 1) + "  " + 
m_track->get_name();
-       
-       if (m_track->get_height() < SMALL_HEIGHT) {
-               QFontMetrics 
fm(themer()->get_font("TrackPanel:fontscale:name"));
-               title = fm.elidedText(title, Qt::ElideMiddle, 90);
-       }
-       
-       painter->setPen(themer()->get_color("TrackPanel:text"));
-       painter->setFont(themer()->get_font("TrackPanel:fontscale:name"));
-       painter->drawText(4, 12, title);
-}
-
-
-void TrackPanelView::calculate_bounding_rect()
-{
-       prepareGeometryChange();
-       m_boundingRect = QRectF(0, 0, 200, m_track->get_height());
-       layout_panel_items();
-}
-
-void TrackPanelView::layout_panel_items()
-{
-       int height =  m_track->get_height();
-       
-       m_gainView->setPos(10, 39);
-       m_panView->setPos(10, 54);
-       
-       inBus->setPos(10, 73);
-       outBus->setPos(100, 73);
-       
-       if (height < SMALL_HEIGHT) {
-               m_gainView->setPos(10, 20);
-               m_panView->setPos(10, 36);
-       } else {
-               muteLed->setPos(70, 19);
-               soloLed->setPos(118, 19);
-               recLed->setPos(162, 19);
-               muteLed->set_bounding_rect(QRectF(0, 0, 41, 14)); 
-               soloLed->set_bounding_rect(QRectF(0, 0, 38, 14)); 
-               recLed->set_bounding_rect(QRectF(0, 0, 30, 14)); 
-               
-               m_gainView->setPos(10, 39);
-               m_panView->setPos(10, 54);
-       }
-       
-       if (height < SMALL_HEIGHT) {
-               muteLed->setPos(90, 1.5);
-               soloLed->setPos(132, 1.5);
-               recLed->setPos(166, 1.5);
-               muteLed->set_bounding_rect(QRectF(0, 0, 39, 12)); 
-               soloLed->set_bounding_rect(QRectF(0, 0, 31, 12)); 
-               recLed->set_bounding_rect(QRectF(0, 0, 27, 12)); 
-       }
-       
-       if ((inBus->pos().y() + inBus->boundingRect().height()) >= height) {
-               inBus->hide();
-               outBus->hide();
-       } else {
-               inBus->show();
-               outBus->show();
-       }
-       
-       if ( (m_panView->pos().y() + m_panView->boundingRect().height()) >= 
height) {
-               m_panView->hide();
-       } else {
-               m_panView->show();
-       }
-       
-       if ( (m_gainView->pos().y() + m_panView->boundingRect().height()) >= 
height) {
-               m_gainView->hide();
-       } else {
-               m_gainView->show();
-       }
-}
-
-
-TrackPanelGain::TrackPanelGain(TrackPanelView* parent, Track * track)
-       : ViewItem(parent, track)
-       , m_track(track)
-{
-       setAcceptsHoverEvents(true);
-
-}
-
-void TrackPanelGain::paint( QPainter * painter, const QStyleOptionGraphicsItem 
* option, QWidget * widget )
-{
-       Q_UNUSED(widget);
-       const int height = 9;
-
-       int sliderWidth = (int)m_boundingRect.width() - 75;
-       float gain = m_track->get_gain();
-       QString sgain = coefficient_to_dbstring(gain);
-       float db = coefficient_to_dB(gain);
-
-       if (db < -60) {
-               db = -60;
-       }
-       int sliderdbx =  (int) (sliderWidth - (sliderWidth*0.3)) - (int) ( ( 
(-1 * db) / 60 ) * sliderWidth);
-       if (sliderdbx < 0) {
-               sliderdbx = 0;
-       }
-       if (db > 0) {
-               sliderdbx =  (int)(sliderWidth*0.7) + (int) ( ( db / 6 ) * 
(sliderWidth*0.3));
-       }
-
-       int cr = (gain >= 1 ? 30 + (int)(100 * gain) : (int)(50 * gain));
-       int cb = ( gain < 1 ? 150 + (int)(50 * gain) : abs((int)(10 * gain)) );
-       
-       painter->setPen(themer()->get_color("TrackPanel:text"));
-       painter->setFont(themer()->get_font("TrackPanel:fontscale:gain"));
-       painter->drawText(0, height + 1, "GAIN");
-       painter->drawRect(30, 0, sliderWidth, height);
-       
-       bool mousehover = (option->state & QStyle::State_MouseOver);
-       QColor color(cr,0,cb);
-       if (mousehover) {
-               color = color.light(140);
-       }
-       painter->fillRect(31, 1, sliderdbx, height-1, color);
-       painter->drawText(sliderWidth + 35, height, sgain);
-}
-
-void TrackPanelGain::set_width(int width)
-{
-       m_boundingRect = QRectF(0, 0, width, 9);
-}
-
-Command* TrackPanelGain::gain_increment()
-{
-       m_track->set_gain(m_track->get_gain() + 0.05);
-       return 0;
-}
-
-Command* TrackPanelGain::gain_decrement()
-{
-       m_track->set_gain(m_track->get_gain() - 0.05);
-       return 0;
-}
-
-TrackPanelPan::TrackPanelPan(TrackPanelView* parent, Track * track)
-       : ViewItem(parent, track)
-       , m_track(track)
-{
-       setAcceptsHoverEvents(true);
-}
-
-void TrackPanelPan::paint( QPainter * painter, const QStyleOptionGraphicsItem 
* option, QWidget * widget )
-{
-       Q_UNUSED(widget);
-
-       bool mousehover = (option->state & QStyle::State_MouseOver);
-       
-       QColor color = themer()->get_color("TrackPanel:slider:background");
-       if (mousehover) {
-               color = color.light(110);
-       }
-       
-       const int PAN_H = 9;
-
-       int sliderWidth = (int)m_boundingRect.width() - 75;
-       float v;
-       //      int y;
-       QString s, span;
-       painter->setPen(themer()->get_color("TrackPanel:text"));
-       painter->setFont(themer()->get_font("TrackPanel:fontscale:pan"));
-
-       painter->drawText(0, PAN_H + 1, "PAN");
-
-       v = m_track->get_pan();
-       span = QByteArray::number(v,'f',1);
-       s = ( v > 0 ? QString("+") + span :  span );
-       painter->fillRect(30, 0, sliderWidth, PAN_H, color);
-       painter->drawRect(30, 0, sliderWidth, PAN_H);
-       int pm= 31 + sliderWidth/2;
-       int z = abs((int)(v*(sliderWidth/2)));
-       int c = abs((int)(255*v));
-       if (v>=0) {
-               painter->fillRect(pm, 1, z, PAN_H-1, QColor(c,0,0));
-       } else {
-               painter->fillRect(pm-z, 1, z, PAN_H-1, QColor(c,0,0));
-       }
-       painter->drawText(30 + sliderWidth + 10, PAN_H + 1, s);
-}
-
-void TrackPanelPan::set_width(int width)
-{
-       m_boundingRect = QRectF(0, 0, width, 9);
-}
-
-Command* TrackPanelPan::pan_left()
-{
-       m_track->set_pan(m_track->get_pan() - 0.05);
-       return 0;
-}
-
-Command* TrackPanelPan::pan_right()
-{
-       m_track->set_pan(m_track->get_pan() + 0.05);
-       return 0;
-}
-
-
-
-TrackPanelLed::TrackPanelLed(TrackPanelView* parent, const QString& name, 
const QString& toggleslot)
-       : ViewItem(parent, 0)
-       , m_name(name)
-       , m_toggleslot(toggleslot)
-       , m_isOn(false)
-{
-       m_track = parent->get_track();
-       setAcceptsHoverEvents(true);
-}
-
-void TrackPanelLed::paint(QPainter* painter, const QStyleOptionGraphicsItem * 
option, QWidget * widget )
-{
-       Q_UNUSED(widget);
-       
-       bool mousehover = (option->state & QStyle::State_MouseOver);
-       int roundfactor = 20;
-       
-       painter->setRenderHint(QPainter::Antialiasing);
-       
-       if (m_isOn) {
-               QColor color = themer()->get_color("TrackPanel:" + m_name + 
"led");
-               if (mousehover) {
-                       color = color.light(110);
-               }
-               
-               
painter->setPen(themer()->get_color("TrackPanel:led:margin:active"));
-               painter->setBrush(color);
-               painter->drawRoundRect(m_boundingRect, roundfactor, 
roundfactor);
-               
-               
painter->setFont(themer()->get_font("TrackPanel:fontscale:led"));
-               
painter->setPen(themer()->get_color("TrackPanel:led:font:active"));
-               
-               painter->drawText(m_boundingRect, Qt::AlignCenter, m_name);
-       } else {
-               QColor color = themer()->get_color("TrackPanel:led:inactive");
-               if (mousehover) {
-                       color = color.light(110);
-               }
-               
-               
painter->setPen(themer()->get_color("TrackPanel:led:margin:inactive"));
-               painter->setBrush(color);
-               painter->drawRoundRect(m_boundingRect, roundfactor, 
roundfactor);
-               
-               
painter->setFont(themer()->get_font("TrackPanel:fontscale:led"));
-               
painter->setPen(themer()->get_color("TrackPanel:led:font:inactive"));
-               
-               painter->drawText(m_boundingRect, Qt::AlignCenter, m_name);
-       }
-       
-}
-
-void TrackPanelLed::set_bounding_rect(QRectF rect)
-{
-       prepareGeometryChange();
-       m_boundingRect = rect;
-}
-
-
-void TrackPanelLed::ison_changed(bool isOn)
-{
-        m_isOn = isOn;
-       update();
-}
-
-Command * TrackPanelLed::toggle()
-{
-       Command* com;
-       QMetaObject::invokeMethod(m_track, QS_C(m_toggleslot), 
Qt::DirectConnection, Q_RETURN_ARG(Command*, com));
-       return 0;
-}
-
-
-
-TrackPanelBus::TrackPanelBus(TrackPanelView* parent, Track* track, int type)
-       : ViewItem(parent, 0)
-       , m_track(track)
-       , m_type(type)
-{
-       bus_changed();
-       setAcceptsHoverEvents(true);
-}
-
-void TrackPanelBus::paint(QPainter* painter, const QStyleOptionGraphicsItem * 
option, QWidget * widget )
-{
-       Q_UNUSED(option);
-       Q_UNUSED(widget);
-       
-       QColor color = themer()->get_color("TrackPanel:bus:background");
-       int roundfactor = 15;
-       
-       painter->setRenderHint(QPainter::Antialiasing);
-       
-       if (option->state & QStyle::State_MouseOver) {
-               color = color.light(110);
-       }
-        
-       painter->setPen(themer()->get_color("TrackPanel:bus:margin"));
-       painter->setBrush(color);
-       painter->drawRoundRect(m_boundingRect, roundfactor, roundfactor);
-       
-       painter->setFont(themer()->get_font("TrackPanel:fontscale:led"));
-       painter->setPen(themer()->get_color("TrackPanel:bus:font"));
-       
-       QString leftright = "";
-       
-       if ((m_type == BUSIN) && ! (m_track->capture_left_channel() && 
m_track->capture_right_channel()) ) {
-               if (m_track->capture_left_channel()) {
-                       leftright = " L";
-               } else {
-                       leftright = " R";
-               }
-       }
-       
-       painter->drawText(m_boundingRect.adjusted(15, 0, 0, 0), 
Qt::AlignCenter, m_busName + leftright);
-                       
-       painter->drawPixmap(3, 3, m_pix);
-}
-
-void TrackPanelBus::bus_changed()
-{
-       QFontMetrics fm(themer()->get_font("TrackPanel:bus"));
-       prepareGeometryChange();
-       
-       if (m_type == BUSIN) {
-               m_busName =  m_track->get_bus_in();
-               m_pix = find_pixmap(":/bus_in");
-               m_boundingRect = m_pix.rect();
-               m_boundingRect.setWidth(m_pix.rect().width() + 
fm.width(m_busName) + 10);
-       } else {
-               m_busName = m_track->get_bus_out();
-               m_pix = find_pixmap(":/bus_out");
-               m_boundingRect = m_pix.rect();
-               m_boundingRect.setWidth(m_pix.rect().width() + 
fm.width(m_busName) + 10);
-       }
-       
-       m_boundingRect.setHeight(m_boundingRect.height() + 6);
-       
-       update();
-}
-

Index: TrackPanelView.h
===================================================================
RCS file: TrackPanelView.h
diff -N TrackPanelView.h
--- TrackPanelView.h    15 Jan 2008 19:56:07 -0000      1.14
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,158 +0,0 @@
-/*
-Copyright (C) 2005-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.
-
-$Id: TrackPanelView.h,v 1.14 2008/01/15 19:56:07 r_sijrier Exp $
-*/
-
-#ifndef TRACK_PANEL_VIEW_H
-#define TRACK_PANEL_VIEW_H
-
-#include "ViewItem.h"
-
-class Track;
-class TrackView;
-class TrackPanelViewPort;
-class PanelLed;
-class TrackPanelView;
-
-class TrackPanelGain : public ViewItem
-{
-       Q_OBJECT
-
-public:
-       TrackPanelGain(TrackPanelView* parent, Track* track);
-       TrackPanelGain(){}
-
-       void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-       void set_width(int width);
-
-public slots:
-       Command* gain_increment();
-       Command* gain_decrement();
-       
-private:
-       Track* m_track;
-};
-
-class TrackPanelPan : public ViewItem
-{
-       Q_OBJECT
-       
-public:
-       TrackPanelPan(TrackPanelView* parent, Track* track);
-       TrackPanelPan(){}
-       
-
-       void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-       void set_width(int width);
-
-public slots:
-       Command* pan_left();
-       Command* pan_right();
-
-private:
-       Track* m_track;
-};
-
-
-
-class TrackPanelLed : public ViewItem
-{
-       Q_OBJECT
-public:
-       TrackPanelLed(TrackPanelView* view, const QString& name, const QString& 
toggleslot);
-       
-       void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-       void set_bounding_rect(QRectF rect);
-
-private:
-       Track* m_track;
-        QString m_name;
-       QString m_toggleslot;
-       bool m_isOn;
-
-public slots:
-        void ison_changed(bool isOn);
-       
-       Command* toggle();
-};
-
-class TrackPanelBus : public ViewItem
-{
-       Q_OBJECT
-public:
-       TrackPanelBus(TrackPanelView* view, Track* track, int busType);
-       TrackPanelBus(){}
-       
-       void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-       
-       enum { BUSIN, BUSOUT };
-
-private:
-       Track*  m_track;
-        int    m_type;
-       QString m_busName;
-       QPixmap m_pix;
-
-public slots:
-        void bus_changed();
-};
-
-
-class TrackPanelView : public ViewItem
-{
-       Q_OBJECT
-
-public:
-       TrackPanelView(TrackView* trackView);
-       ~TrackPanelView();
-
-       void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-       void calculate_bounding_rect();
-       
-       Track* get_track() const {return m_track;}
-       
-private:
-       Track*                  m_track;
-       TrackView*              m_tv;
-       TrackPanelViewPort*     m_viewPort;
-       TrackPanelGain*         m_gainView;
-       TrackPanelPan*          m_panView;
-       
-       TrackPanelLed* muteLed;
-       TrackPanelLed* soloLed;
-       TrackPanelLed* recLed;
-       
-       TrackPanelBus*  inBus;
-       TrackPanelBus*  outBus;
-
-       void draw_panel_track_name(QPainter* painter);
-       void layout_panel_items();
-
-private slots:
-       void update_gain();
-       void update_pan();
-       void update_track_name();
-};
-
-
-#endif
-
-//eof
- 

Index: TrackPanelViewPort.cpp
===================================================================
RCS file: TrackPanelViewPort.cpp
diff -N TrackPanelViewPort.cpp
--- TrackPanelViewPort.cpp      15 Jan 2008 19:56:07 -0000      1.13
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,56 +0,0 @@
-/*
-    Copyright (C) 2006 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.
- 
-    $Id: TrackPanelViewPort.cpp,v 1.13 2008/01/15 19:56:07 r_sijrier Exp $
-*/
-
-#include "TrackPanelViewPort.h"
-               
-#include "SongWidget.h"
-#include "SongView.h"
-#include "TrackPanelView.h"
-#include <ContextPointer.h>
-
-#include <Debugger.h>
-
-
-TrackPanelViewPort::TrackPanelViewPort(QGraphicsScene* scene, SongWidget* sw)
-       : ViewPort(scene, sw)
-{
-       setMinimumWidth(200);
-       setMaximumWidth(200);
-
-       m_sw = sw;
-       
-       setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-}
-
-void TrackPanelViewPort::get_pointed_context_items(QList<ContextItem* > &list)
-{
-       QList<QGraphicsItem *> itemlist = 
items(cpointer().on_first_input_event_x(), cpointer().on_first_input_event_y());
-       foreach(QGraphicsItem* item, itemlist) {
-               if (ViewItem::is_viewitem(item)) {
-                       list.append((ViewItem*)item);
-               }
-       }
-       list.append(m_sw->get_songview());
-}
-
-
-//eof

Index: TrackPanelViewPort.h
===================================================================
RCS file: TrackPanelViewPort.h
diff -N TrackPanelViewPort.h
--- TrackPanelViewPort.h        17 Oct 2007 14:46:18 -0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,49 +0,0 @@
-/*
-    Copyright (C) 2006 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.
- 
-    $Id: TrackPanelViewPort.h,v 1.4 2007/10/17 14:46:18 r_sijrier Exp $
-*/
-
-#ifndef TRACK_PANEL_VIEW_PORT_H
-#define TRACK_PANEL_VIEW_PORT_H
-
-#include "ViewPort.h"
-               
-class SongWidget;
-               
-class TrackPanelViewPort : public ViewPort
-{
-public:
-       TrackPanelViewPort(QGraphicsScene* scene, SongWidget* sw);
-       ~TrackPanelViewPort() {};
-       
-        void get_pointed_context_items(QList<ContextItem* > &list);
-
-private:
-       SongWidget*     m_sw;
-};
-
-#endif
-
-//eof
-
- 
- 
- 
- 

Index: TrackView.cpp
===================================================================
RCS file: TrackView.cpp
diff -N TrackView.cpp
--- TrackView.cpp       2 Jan 2008 19:23:59 -0000       1.38
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,217 +0,0 @@
-/*
-Copyright (C) 2005-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 <QLineEdit>
-#include <QInputDialog>
-#include <QGraphicsScene>
-
-#include "TrackView.h"
-#include "AudioClipView.h"
-#include "PluginChainView.h"
-#include "Themer.h"
-#include "TrackPanelViewPort.h"
-#include "SongView.h"
-#include "TrackPanelView.h"
-#include <Interface.h>
-
-#include <Song.h>
-#include <Track.h>
-#include <AudioClip.h>
-#include <Utils.h>
-
-#include <PluginSelectorDialog.h>
-
-#include <Debugger.h>
-
-TrackView::TrackView(SongView* sv, Track * track)
-       : ViewItem(0, track)
-{
-       PENTERCONS;
-       
-       setZValue(sv->zValue() + 1);
-       
-       m_sv = sv;
-       sv->scene()->addItem(this);
-       
-       load_theme_data();
-
-       m_track = track;
-       setFlags(ItemIsSelectable | ItemIsMovable);
-       setCursor(themer()->get_cursor("Track"));
-
-       m_panel = new TrackPanelView(this);
-       calculate_bounding_rect();
-       
-       m_pluginChainView = new PluginChainView(m_sv, this, 
m_track->get_plugin_chain());
-
-       connect(m_track, SIGNAL(audioClipAdded(AudioClip*)), this, 
SLOT(add_new_audioclipview(AudioClip*)));
-       connect(m_track, SIGNAL(audioClipRemoved(AudioClip*)), this, 
SLOT(remove_audioclipview(AudioClip*)));
-       
-       
-       foreach(AudioClip* clip, m_track->get_cliplist()) {
-               add_new_audioclipview(clip);
-       }
-}
-
-TrackView:: ~ TrackView( )
-{
-}
-
-void TrackView::paint(QPainter* painter, const QStyleOptionGraphicsItem* 
option, QWidget* widget)
-{
-       Q_UNUSED(widget);
-       
-//     printf("TrackView:: PAINT :: exposed rect is: x=%f, y=%f, w=%f, 
h=%f\n", option->exposedRect.x(), option->exposedRect.y(), 
option->exposedRect.width(), option->exposedRect.height());
-       
-       int xstart = (int)option->exposedRect.x();
-       int pixelcount = (int)option->exposedRect.width();
-       
-       if (m_topborderwidth > 0) {
-               QColor color = themer()->get_color("Track:cliptopoffset");
-               painter->fillRect(xstart, 0, pixelcount, m_topborderwidth, 
color);
-       }
-       
-       if (m_paintBackground) {
-               QColor color = themer()->get_color("Track:background");
-               painter->fillRect(xstart, m_topborderwidth, pixelcount, 
m_track->get_height() - m_bottomborderwidth, color);
-       }
-       
-       if (m_bottomborderwidth > 0) {
-               QColor color = themer()->get_color("Track:clipbottomoffset");
-               painter->fillRect(xstart, m_track->get_height() - 
m_bottomborderwidth, pixelcount, m_bottomborderwidth, color);
-       }
-}
-
-void TrackView::add_new_audioclipview( AudioClip * clip )
-{
-       PENTER;
-       AudioClipView* clipView = new AudioClipView(m_sv, this, clip);
-       m_clipViews.append(clipView);
-}
-
-void TrackView::remove_audioclipview( AudioClip * clip )
-{
-       PENTER;
-       foreach(AudioClipView* view, m_clipViews) {
-               if (view->get_clip() == clip) {
-                       m_clipViews.removeAll(view);
-                       scene()->removeItem(view);
-                       delete view;
-                       return;
-               }
-       }
-}
-
-Track* TrackView::get_track( ) const
-{
-       return m_track;
-}
-
-TrackPanelView * TrackView::get_trackpanel_view() const
-{
-       return m_panel;
-}
-
-int TrackView::get_childview_y_offset() const
-{
-       return m_topborderwidth + m_cliptopmargin;
-}
-
-void TrackView::move_to( int x, int y )
-{
-       Q_UNUSED(x);
-       setPos(0, y);
-       m_panel->setPos(-200, y);
-}
-
-int TrackView::get_height( )
-{
-       return m_track->get_height() - (m_topborderwidth + m_bottomborderwidth 
+ m_clipbottommargin + m_cliptopmargin);
-}
-
-Command* TrackView::edit_properties( )
-{
-       bool ok;
-       QString text = 
QInputDialog::getText(m_sv->get_trackpanel_view_port()->viewport(), tr("Set 
Track name"),
-                                       tr("Enter new Track name"),
-                                       QLineEdit::Normal, m_track->get_name(), 
&ok);
-       if (ok && !text.isEmpty()) {
-               m_track->set_name(text);
-       }
-
-       return (Command*) 0;
-}
-
-Command* TrackView::add_new_plugin( )
-{
-       PluginSelectorDialog::instance()->set_description(tr("Track %1:  %2")
-                       
.arg(m_track->get_sort_index()+1).arg(m_track->get_name()));
-       
-       if (PluginSelectorDialog::instance()->exec() == QDialog::Accepted) {
-               Plugin* plugin = 
PluginSelectorDialog::instance()->get_selected_plugin();
-               if (plugin) {
-                       // Force showing into effects mode, just in case the 
user adds
-                       // a plugin in edit mode, which means it won't show up!
-                       m_sv->get_song()->set_effects_mode();
-                       return m_track->add_plugin(plugin);
-               }
-       }
-
-       return 0;
-}
-
-void TrackView::set_height( int height )
-{
-       m_height = height;
-}
-
-void TrackView::calculate_bounding_rect()
-{
-       prepareGeometryChange();
-       m_boundingRect = QRectF(0, 0, MAX_CANVAS_WIDTH, m_track->get_height());
-       m_panel->calculate_bounding_rect();
-       ViewItem::calculate_bounding_rect();
-}
-
-void TrackView::load_theme_data()
-{
-       m_paintBackground = 
themer()->get_property("Track:paintbackground").toInt();
-       m_topborderwidth = 
themer()->get_property("Track:topborderwidth").toInt();
-       m_bottomborderwidth = 
themer()->get_property("Track:bottomborderwidth").toInt();
-       
-       m_cliptopmargin = themer()->get_property("Track:cliptopmargin").toInt();
-       m_clipbottommargin = 
themer()->get_property("Track:clipbottommargin").toInt();
-}
-
-
-Command* TrackView::select_bus()
-{
-       Interface::instance()->show_busselector(m_track);
-       return 0; 
-}
-
-Command* TrackView::insert_silence()
-{
-       Interface::instance()->show_insertsilence_dialog();
-       Interface::instance()->set_insertsilence_track(m_track);
-       return 0; 
-}
-

Index: TrackView.h
===================================================================
RCS file: TrackView.h
diff -N TrackView.h
--- TrackView.h 28 Jun 2007 03:11:28 -0000      1.19
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,89 +0,0 @@
-/*
-Copyright (C) 2005-2006 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 TRACK_VIEW_H
-#define TRACK_VIEW_H
-
-#include "ViewItem.h"
-
-class Track;
-class AudioClip;
-class AudioClipView;
-class TrackPanelView;
-class PluginChainView;
-
-class TrackView : public ViewItem
-{
-       Q_OBJECT
-       Q_CLASSINFO("edit_properties", tr("Edit properties"))
-       Q_CLASSINFO("add_new_plugin", tr("Add new Plugin")) 
-       Q_CLASSINFO("select_bus", tr("Select Bus")) 
-       Q_CLASSINFO("insert_silence", tr("Insert Silence")) 
-
-public:
-       TrackView(SongView* sv, Track* track);
-       ~TrackView();
-       
-       enum {Type = UserType + 2};
-       
-       void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
-       
-       Track* get_track() const;
-       QList<AudioClipView* >* get_clipviews() {return &m_clipViews;}
-       TrackPanelView* get_trackpanel_view() const;
-       
-       int get_childview_y_offset() const;
-       void move_to(int x, int y);
-       int get_height();
-       void set_height(int height);
-       
-       void calculate_bounding_rect();
-       void load_theme_data();
-       
-private:
-       Track*                  m_track;
-       QList<AudioClipView* >  m_clipViews;
-       TrackPanelView*         m_panel;
-       PluginChainView*        m_pluginChainView;
-       int                     m_height;
-       int                     m_paintBackground;
-       int                     m_cliptopmargin;
-       int                     m_clipbottommargin;
-       int                     m_topborderwidth;
-       int                     m_bottomborderwidth;
-       
-       friend class TrackPanelView;
-
-public slots:
-       Command* edit_properties();
-       Command* add_new_plugin();      
-       Command* select_bus();
-       Command* insert_silence();
-
-private slots:
-       void add_new_audioclipview(AudioClip* clip);
-       void remove_audioclipview(AudioClip* clip);
-};
-
-
-#endif
-
-//eof

Index: ViewItem.cpp
===================================================================
RCS file: ViewItem.cpp
diff -N ViewItem.cpp
--- ViewItem.cpp        15 Jan 2008 19:56:07 -0000      1.6
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,32 +0,0 @@
-/*
-Copyright (C) 2005-2006 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 "ViewItem.h"
-
-ViewItem::ViewItem(ViewItem* parentViewItem, ContextItem* parentContext)
-       : ContextItem(parentViewItem)
-       , QGraphicsItem(parentViewItem)
-{
-       set_context_item(parentContext);
-       m_parentViewItem = parentViewItem;
-       setCursor(themer()->get_cursor("Default"));
-}

Index: ViewItem.h
===================================================================
RCS file: ViewItem.h
diff -N ViewItem.h
--- ViewItem.h  15 Jan 2008 19:56:07 -0000      1.19
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,99 +0,0 @@
-/*
-Copyright (C) 2005-2006 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 VIEW_ITEM_H
-#define VIEW_ITEM_H
-
-#include <ContextItem.h>
-#include <QGraphicsScene>
-#include <QGraphicsView>
-#include <QGraphicsItem>
-#include <QGraphicsSceneMouseEvent>
-#include <QStyleOptionGraphicsItem>
-#include <QCursor>
-#include <Utils.h>
-#include <Themer.h>
-
-class SongView;
-               
-// Canvas width should be 2^31, but it doesn't work ok
-// 2^30 works ok, so let's use that, still gives a lot 
-// of headroom for real large recordings
-#if ! defined (Q_WS_WIN)
-#define MAX_CANVAS_WIDTH 1073741824
-#define MAX_CANVAS_HEIGHT 1073741824
-#else          
-#define MAX_CANVAS_WIDTH 107374182
-#define MAX_CANVAS_HEIGHT 107374182
-#endif
-
-
-class ViewItem : public ContextItem, public QGraphicsItem
-{
-       Q_OBJECT
-       
-public:
-
-       ViewItem(ViewItem* parentViewItem=0, ContextItem* parentContext=0);
-       ~ViewItem() {};
-       
-       enum {Type = UserType + 1};
-       
-       QRectF boundingRect() const;
-       virtual void calculate_bounding_rect() {
-               for (int i=0; i< QGraphicsItem::children().size(); ++i) {
-                       QGraphicsItem* item = QGraphicsItem::children().at(i);
-                       if (is_viewitem(item)) {
-                               ((ViewItem*)item)->calculate_bounding_rect();
-                       }
-               }
-       }
-       void prepare_geometry_change() {prepareGeometryChange();}
-       virtual int get_childview_y_offset() const {return 0;}
-       virtual int type() const;
-       virtual int get_height() const {return (int)m_boundingRect.height();}
-       
-       /**
-        *      Reimplement and call update() in the reimplementation
-        *      to make the theme change visible.
-        */
-       virtual void load_theme_data() {};
-       
-       SongView* get_songview() const {return m_sv;}
-       
-       static bool is_viewitem(QGraphicsItem* item) {
-               return item->type() == Type;
-       }
-               
-
-protected:
-
-       SongView*       m_sv;
-       ViewItem*       m_parentViewItem;
-       QRectF          m_boundingRect;
-};
-
-inline QRectF ViewItem::boundingRect() const {return m_boundingRect;}
-inline int ViewItem::type() const {return Type;}
-
-#endif
-
-//eof

Index: libtraversosongcanvas.h
===================================================================
RCS file: libtraversosongcanvas.h
diff -N libtraversosongcanvas.h
--- libtraversosongcanvas.h     16 Mar 2007 00:39:12 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-#include "AudioClipView.h"
-#include "ClipsViewPort.h"
-#include "Cursors.h"
-#include "CurveNodeView.h"
-#include "CurveView.h"
-#include "FadeView.h"
-#include "MarkerView.h"
-#include "PluginView.h"
-#include "PluginChainView.h"
-#include "SongView.h"
-#include "TimeLineView.h"
-#include "TimeLineViewPort.h"
-#include "TrackView.h"
-#include "TrackPanelView.h"
-#include "TrackPanelViewPort.h"
-#include "ViewItem.h"

Index: precompile.h
===================================================================
RCS file: precompile.h
diff -N precompile.h
--- precompile.h        4 Apr 2007 19:24:05 -0000       1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,26 +0,0 @@
-#include <qcoreapplication.h>
-#include <qlist.h>
-#include <qvariant.h>  // All moc genereated code has this include
-#include <qobject.h>
-#include <qregexp.h>
-#include <qstring.h>
-#include <qstringlist.h>
-#include <qtextcodec.h>
-
-#include <qapplication.h>
-#include <qbitmap.h>
-#include <qcursor.h>
-#include <qdesktopwidget.h>
-#include <qevent.h>
-#include <qimage.h>
-#include <qlayout.h>
-#include <qpainter.h>
-#include <qpixmap.h>
-#include <qstyle.h>
-#include <qtimer.h>
-#include <qwidget.h>
-
-#include <qgraphicsscene.h>
-#include <qgraphicsview.h>
-#include <qgraphicsitem.h>
-#include <stdlib.h>

Index: songcanvas.pri
===================================================================
RCS file: songcanvas.pri
diff -N songcanvas.pri
--- songcanvas.pri      28 Nov 2006 14:06:12 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,43 +0,0 @@
-PRECOMPILED_HEADER = songcanvas/precompile.h
-
-
-SOURCES += \
-       songcanvas/AudioClipView.cpp \
-       songcanvas/SongWidget.cpp \
-       songcanvas/ClipsViewPort.cpp \
-       songcanvas/CurveView.cpp \
-       songcanvas/CurveNodeView.cpp \
-       songcanvas/TimeLineViewPort.cpp \
-       songcanvas/TrackPanelViewPort.cpp \
-       songcanvas/TrackView.cpp \
-#      songcanvas/ViewItem.cpp \
-       songcanvas/ViewPort.cpp \
-       songcanvas/SongView.cpp \
-       songcanvas/TimeLineView.cpp \
-       songcanvas/TrackPanelView.cpp \
-       songcanvas/Cursors.cpp \
-       songcanvas/FadeView.cpp \
-        songcanvas/FadeContextDialogView.cpp \
-       songcanvas/PluginView.cpp \
-       songcanvas/PluginChainView.cpp \
-
-HEADERS += \
-       songcanvas/AudioClipView.h \
-       songcanvas/SongWidget.h \
-       songcanvas/ClipsViewPort.h \
-       songcanvas/CurveView.h \
-       songcanvas/CurveNodeView.h \
-       songcanvas/TimeLineViewPort.h \
-       songcanvas/TrackPanelViewPort.h \
-       songcanvas/TrackView.h \
-       songcanvas/ViewItem.h \
-       songcanvas/ViewPort.h \
-       songcanvas/SongView.h \
-       songcanvas/TimeLineview.h \
-       songcanvas/TrackPanelView.h \
-       songcanvas/Cursors.h \
-       songcanvas/FadeView.h \
-        songcanvas/FadeContextDialogView.h \
-       songcanvas/PluginView.h \
-       songcanvas/PluginChainView.h \
- 

Index: songcanvas.pro
===================================================================
RCS file: songcanvas.pro
diff -N songcanvas.pro
--- songcanvas.pro      5 Nov 2007 17:39:42 -0000       1.11
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,79 +0,0 @@
-include(../../libbase.pri)
-
-TARGET = traversosongcanvas
-DESTDIR = ../../../lib
-TEMPLATE = lib
-
-PRECOMPILED_HEADER = precompile.h 
-
-INCLUDEPATH +=         ../../core \
-               ../../common \
-               ../../traverso \
-               ../../traverso/dialogs \
-               ../../engine \
-               ../../commands \
-               ../../commands/build \
-               ../../plugins \
-               ../../plugins/native \
-               ./
-
-SOURCES += AudioClipView.cpp \
-ClipsViewPort.cpp \
-Cursors.cpp \
-CurveNodeView.cpp \
-CurveView.cpp \
-FadeContextDialogView.cpp \
-FadeView.cpp \
-MarkerView.cpp \
-PluginChainView.cpp \
-PluginView.cpp \
-SongView.cpp \
-SongWidget.cpp \
-TimeLineView.cpp \
-TimeLineViewPort.cpp \
-TrackPanelView.cpp \
-TrackPanelViewPort.cpp \
-TrackView.cpp \
-ViewItem.cpp \
-dialogs/AudioClipEditDialog.cpp
-
-HEADERS += AudioClipView.h \
-ClipsViewPort.h \
-Cursors.h \
-CurveNodeView.h \
-CurveView.h \
-FadeContextDialogView.h \
-FadeView.h \
-libtraversosongcanvas.h \
-MarkerView.h \
-PluginChainView.h \
-PluginView.h \
-precompile.h \
-SongView.h \
-SongWidget.h \
-TimeLineView.h \
-TimeLineViewPort.h \
-TrackPanelView.h \
-TrackPanelViewPort.h \
-TrackView.h \
-ViewItem.h \
-LineView.h \
-dialogs/AudioClipEditDialog.h
-
-FORMS += \
-ui/AudioClipEditDialog.ui \
-
-
-contains(DEFINES, LV2_SUPPORT){
-    INCLUDEPATH +=     \
-       ../../plugins/LV2 \
-       ../../3rdparty/slv2 
-}
-
-contains(DEFINES, QT_OPENGL_SUPPORT){
-QT += opengl
-}
-
-win32{
-    INCLUDEPATH += ../../../3thparty/include
-}




reply via email to

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