docclipbase.cpp
timecode.cpp
monitormanager.cpp
- documenttrack.cpp
- documentvideotrack.cpp
- documentaudiotrack.cpp
headertrack.cpp
- trackpanelfunctionfactory.cpp
- trackpanelfunction.cpp
- trackpanelclipmovefunction.cpp
customtrackview.cpp
clipitem.cpp
labelitem.cpp
//painter->fillRect(QRectF(br.x() + br.width() - m_endPix.width(), br.y(), m_endPix.width(), br.height()), QBrush(QColor(Qt::black)));
// draw thumbnails
- if (!m_startPix.isNull()) {
+ if (!m_startPix.isNull() && KdenliveSettings::videothumbnails()) {
if (m_clipType == IMAGE) {
painter->drawPixmap(QPointF(br.x() + br.width() - m_startPix.width(), br.y()), m_startPix);
QLineF l(br.x() + br.width() - m_startPix.width(), br.y(), br.x() + br.width() - m_startPix.width(), br.y() + br.height());
QLineF l2(br.x() + m_startPix.width(), br.y(), br.x() + m_startPix.width(), br.y() + br.height());
painter->drawLine(l2);
}
- if ((m_clipType == AV || m_clipType == AUDIO || true) && audioThumbReady) {
+ if ((m_clipType == AV || m_clipType == AUDIO) && audioThumbReady && KdenliveSettings::audiothumbnails()) {
QPainterPath path = m_clipType == AV ? roundRectPathLower : roundRectPathUpper.united(roundRectPathLower);
painter->fillPath(path, QBrush(QColor(200, 200, 200, 127)));
+++ /dev/null
-
-#include <QMouseEvent>
-#include <QStylePainter>
-
-#include <KDebug>
-#include <QFrame>
-#include <QWidget>
-#include <QPainter>
-
-
-#include "documentaudiotrack.h"
-
-DocumentAudioTrack::DocumentAudioTrack(QDomElement xml, TrackView * view, QWidget *parent)
- : DocumentTrack(xml, view, parent), m_trackView(view) {
- setFixedHeight(50);
-}
-
-// virtual
-/*
-void DocumentAudioTrack::paintEvent(QPaintEvent *e )
-{
- QRect region = e->rect();
- QPainter painter(this);
- painter.fillRect(region, QBrush(Qt::green));
- painter.drawLine(region.bottomLeft (), region.bottomRight ());
-}
-*/
-
-#include "documentaudiotrack.moc"
+++ /dev/null
-#ifndef DOCUMENTAUDIOTRACK_H
-#define DOCUMENTAUDIOTRACK_H
-
-#include "documenttrack.h"
-#include "trackview.h"
-
-class DocumentAudioTrack : public DocumentTrack {
- Q_OBJECT
-
-public:
- DocumentAudioTrack(QDomElement xml, TrackView * view, QWidget *parent = 0);
-
-protected:
- //virtual void paintEvent(QPaintEvent * /*e*/);
-
-private:
- TrackView *m_trackView;
-public slots:
-
-};
-
-#endif
+++ /dev/null
-
-#include <QMouseEvent>
-#include <QStylePainter>
-
-#include <KDebug>
-#include <QFrame>
-#include <QWidget>
-#include <QPainter>
-
-
-#include "documenttrack.h"
-
-DocumentTrack::DocumentTrack(QDomElement xml, TrackView * view, QWidget *parent)
- : QWidget(parent), m_xml(xml), m_trackDuration(0) {
- setFixedHeight(50);
- addFunctionDecorator("move", "move");
- parseXml();
-}
-
-int DocumentTrack::documentTrackIndex() {
- return 0;
-}
-
-TrackViewClip *DocumentTrack::getClipAt(GenTime pos) {
- return 0;
-}
-
-void DocumentTrack::addFunctionDecorator(const QString & mode, const QString & function) {
- m_trackPanelFunctions[mode].append(function);
-}
-
-QStringList DocumentTrack::applicableFunctions(const QString & mode) {
- return m_trackPanelFunctions[mode];
-}
-
-void DocumentTrack::parseXml() {
- m_clipList.clear();
- int position = 0;
- for (QDomNode n = m_xml.firstChild(); !n.isNull(); n = n.nextSibling()) {
- QDomElement elem = n.toElement();
- if (elem.tagName() == "blank") {
- position += elem.attribute("length", 0).toInt();
- } else if (elem.tagName() == "entry") {
- TrackViewClip clip;
- clip.startTime = position;
- int in = elem.attribute("in", 0).toInt();
- int out = elem.attribute("out", 0).toInt() - in;
- clip.cropTime = in;
- clip.duration = out;
- position += out;
- clip.producer = elem.attribute("producer", QString::null);
- kDebug() << "++++++++++++++\n\n / / /ADDING CLIP: " << clip.cropTime << ", out: " << clip.duration << ", Producer: " << clip.producer << "\n\n++++++++++++++++++++";
- m_clipList.append(clip);
- }
- }
- m_trackDuration = position;
-}
-
-int DocumentTrack::duration() {
- return m_trackDuration;
-}
-
-QList <TrackViewClip> DocumentTrack::clipList() {
- return m_clipList;
-}
-
-// virtual
-/*
-void DocumentTrack::paintEvent(QPaintEvent *e )
-{
- QRect region = e->rect();
- region.setBottomRight(QPoint(region.right() - 1, region.bottom() - 1));
- QPainter painter(this);
- painter.fillRect(region, QBrush(Qt::red));
- painter.drawLine(region.bottomLeft (), region.bottomRight ());
-}
-*/
-
-#include "documenttrack.moc"
+++ /dev/null
-#ifndef DOCUMENTTRACK_H
-#define DOCUMENTTRACK_H
-
-#include <QDomElement>
-#include <QList>
-#include <QWidget>
-#include <QMap>
-#include <QStringList>
-
-#include "definitions.h"
-#include "gentime.h"
-
-
-class TrackPanelFunction;
-class TrackView;
-
-
-class DocumentTrack : public QWidget {
- Q_OBJECT
-
-public:
- DocumentTrack(QDomElement xml, TrackView * view, QWidget *parent = 0);
-
- QList <TrackViewClip> clipList();
- int duration();
- int documentTrackIndex();
- TrackViewClip *getClipAt(GenTime pos);
- void addFunctionDecorator(const QString & mode, const QString & function);
- QStringList applicableFunctions(const QString & mode);
-
-protected:
- //virtual void paintEvent(QPaintEvent * /*e*/);
-
-private:
- QDomElement m_xml;
- QList <TrackViewClip> m_clipList;
- void parseXml();
- int m_trackDuration;
- /** A map of lists of track panel functions. */
- QMap < QString, QStringList > m_trackPanelFunctions;
-
-
-public slots:
-
-};
-
-#endif
+++ /dev/null
-
-#include <QMouseEvent>
-#include <QStylePainter>
-
-#include <KDebug>
-#include <QFrame>
-#include <QWidget>
-#include <QPainter>
-
-
-#include "documentvideotrack.h"
-
-DocumentVideoTrack::DocumentVideoTrack(QDomElement xml, TrackView * view, QWidget *parent)
- : DocumentTrack(xml, view, parent), m_trackView(view) {
- setFixedHeight(50);
-}
-
-// virtual
-/*
-void DocumentVideoTrack::paintEvent(QPaintEvent *e )
-{
- QList <TrackViewClip> trackClipList = clipList();
- double scale = m_trackView->zoomFactor();
- QRect region = e->rect();
- QPainter painter(this);
- //painter.fillRect(region, QBrush(Qt::red));
- painter.drawLine(region.bottomLeft (), region.bottomRight ());
- for (int i = 0; i < trackClipList.size(); ++i) {
- int start = (int) (trackClipList.at(i).startTime * scale);
- int end = (int) (trackClipList.at(i).duration * scale);
- QRect clipRect(start, region.top(), end, region.bottom());
- QPainterPath path;
- painter.setRenderHint(QPainter::Antialiasing);
- painter.fillRect(clipRect, QBrush(Qt::red));
- painter.drawRect(clipRect);
-
- QRect textRect = painter.boundingRect ( clipRect, Qt::AlignCenter, " " + trackClipList.at(i).producer + " " );
- painter.fillRect(textRect, QBrush(QColor(255, 255, 255, 100)));
- painter.drawText(clipRect, Qt::AlignCenter, trackClipList.at(i).producer);
- }
-}
-*/
-
-#include "documentvideotrack.moc"
+++ /dev/null
-#ifndef DOCUMENTVIDEOTRACK_H
-#define DOCUMENTVIDEOTRACK_H
-
-
-#include "documenttrack.h"
-#include "trackview.h"
-
-class DocumentVideoTrack : public DocumentTrack {
- Q_OBJECT
-
-public:
- DocumentVideoTrack(QDomElement xml, TrackView * view, QWidget *parent = 0);
-
-protected:
- //virtual void paintEvent(QPaintEvent * /*e*/);
-
-private:
- TrackView *m_trackView;
-public slots:
-
-};
-
-#endif
// KConfigDialog didn't find an instance of this dialog, so lets
// create it :
KdenliveSettingsDialog* dialog = new KdenliveSettingsDialog(this);
- //connect( dialog, SIGNAL(settingsChanged()), this, SLOT(updateConfiguration()) );
+ connect(dialog, SIGNAL(settingsChanged(const QString&)), this, SLOT(updateConfiguration()));
dialog->show();
}
+void MainWindow::updateConfiguration() {
+ TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
+ if (currentTab) currentTab->refresh();
+}
+
void MainWindow::slotGotProgressInfo(KUrl url, int progress) {
statusProgressBar->setValue(progress);
if (progress > 0) {
void saveFileAs();
void saveFileAs(const QString &outputFileName);
void slotPreferences();
+ void updateConfiguration();
void slotConnectMonitors();
void slotRaiseMonitor(bool clipMonitor);
void slotSetClipDuration(int id, int duration);
+++ /dev/null
-/***************************************************************************
- TrackPanelClipMoveFunction.cpp - description
- -------------------
- begin : Sun May 18 2003
- copyright : (C) 2003 by Jason Wood
- email : jasonwood@blueyonder.co.uk
-***************************************************************************/
-
-/***************************************************************************
- * *
- * This program 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. *
- * *
- ***************************************************************************/
-
-#include <QMouseEvent>
-#include <KDebug>
-
-#include "trackpanelclipmovefunction.h"
-#include "definitions.h"
-#include "documenttrack.h"
-#include "trackview.h"
-
-
-TrackPanelClipMoveFunction::TrackPanelClipMoveFunction(TrackView *view):
- m_view(view), m_dragging(false), m_startedClipMove(false), m_masterClip(0), m_clipOffset(0) {
- // m_moveClipsCommand = 0;
- //m_deleteClipsCommand = 0;
- m_addingClips = false;
- m_firststep = true;
-}
-
-
-TrackPanelClipMoveFunction::~TrackPanelClipMoveFunction() {
-}
-
-bool TrackPanelClipMoveFunction::mouseApplies(DocumentTrack *,
- QMouseEvent * event) const {
- return mouseApplies(event->pos());
-}
-
-bool TrackPanelClipMoveFunction::mouseApplies(const QPoint & pos) const {
- TrackViewClip *clipUnderMouse = 0;
-
- DocumentTrack * panel = m_view->panelAt(pos.y());
-
- if (panel) {
- kDebug() << " TESTING CURSOR AT: " << pos.x() << ", MAPPED VAL: " << m_view->mapLocalToValue(pos.x());
- GenTime mouseTime((int)(m_view->mapLocalToValue(pos.x())), m_document->fps());
- clipUnderMouse = panel->getClipAt(mouseTime);
- }
- return clipUnderMouse;
-}
-
-QCursor TrackPanelClipMoveFunction::getMouseCursor(DocumentTrack *, QMouseEvent * event) {
- return QCursor(Qt::SizeAllCursor);
-}
-
-bool TrackPanelClipMoveFunction::mousePressed(DocumentTrack * panel,
- QMouseEvent * event) {
- bool result = false;
- /*
- if (panel->hasDocumentTrackIndex()) {
- DocTrackBase *track =
- m_document->track(panel->documentTrackIndex());
- if (track) {
- GenTime mouseTime((int)(m_timeline->mapLocalToValue(event->x())),
- m_document->framesPerSecond());
- m_clipUnderMouse = 0;
- m_clipUnderMouse = track->getClipAt(mouseTime);
-
- if (m_clipUnderMouse) {
- emit checkTransition(m_clipUnderMouse);
- if (event->state() & Qt::ControlButton) {
- m_app->addCommand(Command::KSelectClipCommand::toggleSelectClipAt(m_document, *track, mouseTime), true);
- }
- else {
- if (!track->clipSelected(m_clipUnderMouse)) {
- KMacroCommand *macroCommand = new KMacroCommand(i18n("Select Clip"));
- macroCommand->addCommand(Command::KSelectClipCommand::selectNone(m_document));
- macroCommand->addCommand(new Command::KSelectClipCommand(m_document, m_clipUnderMouse, true));
- m_app->addCommand(macroCommand, true);
- }
- }
- result = true;
- }
- }
- }
- */
- return result;
-}
-
-bool TrackPanelClipMoveFunction::mouseDoubleClicked(DocumentTrack * panel, QMouseEvent *event) {
- /*
- if (panel->hasDocumentTrackIndex()) {
- DocTrackBase *track =
- m_document->track(panel->documentTrackIndex());
- if (track) {
- GenTime mouseTime((int)(m_timeline->mapLocalToValue(event->x())),
- m_document->framesPerSecond());
- m_clipUnderMouse = track->getClipAt(mouseTime);
- if (m_clipUnderMouse) {
- track->openClip(m_clipUnderMouse);
- }
- }
- }*/
- return false; ///FIXME is that right ?
-}
-
-bool TrackPanelClipMoveFunction::mouseReleased(DocumentTrack *, QMouseEvent *) {
- //m_timeline->stopScrollTimer();
- return true;
-}
-
-bool TrackPanelClipMoveFunction::mouseMoved(DocumentTrack * panel,
- QMouseEvent * event) {
- bool result = false;
- /*if (panel->hasDocumentTrackIndex()) {
- DocTrackBase *track =
- m_document->track(panel->documentTrackIndex());
- if (track) {
- GenTime mouseTime((int)(m_timeline->mapLocalToValue(event->x())),
- m_document->framesPerSecond());
-
- if (m_dragging) {
- m_dragging = false;
- result = true;
- } else {
- if (m_clipUnderMouse) {
- if (!m_document->projectClip().clipSelected(m_clipUnderMouse)) {
- if ((event->state() & Qt::ControlButton)
- || (event->state() & Qt::ShiftButton)) {
- m_app->
- addCommand(Command::KSelectClipCommand::
- selectClipAt(m_document, *track,
- mouseTime), true);
- } else {
- KMacroCommand *macroCommand = new KMacroCommand(i18n("Select Clip"));
- macroCommand->addCommand(Command::KSelectClipCommand::selectNone(m_document));
- macroCommand->addCommand(new Command::KSelectClipCommand(m_document, m_clipUnderMouse, true));
- m_app->addCommand(macroCommand, true);
- }
- }
- m_dragging = true;
- initiateDrag(m_clipUnderMouse, mouseTime);
- result = true;
- }
- }
- }
- }
- */
- return result;
-}
-
-// virtual
-bool TrackPanelClipMoveFunction::dragEntered(DocumentTrack * panel,
- QDragEnterEvent * event) {
- /* if (m_startedClipMove) {
- m_document->activateSceneListGeneration(false);
- event->accept(true);
- } else if (ClipDrag::canDecode(event)) {
- m_document->activateSceneListGeneration(false);
- m_selection = ClipDrag::decode(m_document, event);
-
-
- if (!m_selection.isEmpty()) {
- if (m_selection.masterClip() == 0)
- m_selection.setMasterClip(m_selection.first());
- m_masterClip = m_selection.masterClip();
- m_clipOffset = GenTime();
- if (m_selection.isEmpty()) {
- event->accept(false);
- } else {
- setupSnapToGrid();
- event->accept(true);
- }
- } else {
- kdError() <<
- "ERROR! ERROR! ERROR! ClipDrag:decode decoded a null clip!!!"
- << endl;
- }
- } else if (EffectDrag::canDecode(event)) {
- event->accept(true);
- } else {
- event->accept(false);
- }
- //m_startedClipMove = false;
- */
- return true;
-}
-
-// virtual
-bool TrackPanelClipMoveFunction::dragMoved(DocumentTrack *, QDragMoveEvent * event) {
- /* QPoint pos = event->pos();
- if (ClipDrag::canDecode(event)) {
- GenTime mouseTime = m_timeline->timeUnderMouse((double) pos.x()) - m_clipOffset;
- mouseTime = m_snapToGrid.getSnappedTime(mouseTime);
- mouseTime = mouseTime + m_clipOffset;
- int trackUnder = trackUnderPoint(pos);
-
- if (m_selection.isEmpty() || m_dragging) {
- moveSelectedClips(trackUnder, mouseTime - m_clipOffset);
- } else {
- if (m_document->projectClip().canAddClipsToTracks(m_selection,
- trackUnder, mouseTime)) {
- m_selection_to_add = m_selection;
- addClipsToTracks(m_selection, trackUnder, mouseTime, true);
- setupSnapToGrid();
- m_selection.clear();
- m_dragging = true;
- }
- }
- } else if (EffectDrag::canDecode(event)) {
- if (mouseApplies(pos)) {
- event->accept();
- } else {
- event->ignore();
- }
- } else {
- event->ignore();
- }
- m_timeline->checkScrolling(pos);
- */
- return true;
-}
-
-int TrackPanelClipMoveFunction::trackUnderPoint(const QPoint & pos) {
- uint y = pos.y();
- DocumentTrack * panel = m_view->panelAt(y);
- /*
- if (panel) {
- return panel->documentTrackIndex();
- }*/
-
- return -1;
-}
-
-// virtual
-bool TrackPanelClipMoveFunction::dragLeft(DocumentTrack *, QDragLeaveEvent *) {
- m_dragging = false;
- /*
- if (!m_selection.isEmpty()) {
- m_selection.setAutoDelete(true);
- m_selection.clear();
- m_selection.setAutoDelete(false);
- }
-
- if (m_addingClips) {
- m_addingClips = false;
-
- QPtrListIterator < DocTrackBase >
- trackItt(m_document->trackList());
-
- while (trackItt.current()) {
- (*trackItt)->deleteClips(true);
- ++trackItt;
- }
-
- m_document->activateSceneListGeneration(true);
- }
-
- if (m_moveClipsCommand) {
- m_moveClipsCommand->setEndLocation(m_masterClip);
- m_app->addCommand(m_moveClipsCommand, false);
- // In a drag Leave Event, any clips in the selection are removed from the timeline.
- //delete m_moveClipsCommand;
- m_moveClipsCommand = 0;
- m_document->activateSceneListGeneration(true);
- }
-
- if (m_deleteClipsCommand) {
- m_app->addCommand(m_deleteClipsCommand, false);
- m_deleteClipsCommand = 0;
-
- QPtrListIterator < DocTrackBase >
- trackItt(m_document->trackList());
-
- while (trackItt.current()) {
- trackItt.current()->deleteClips(true);
- ++trackItt;
- }
- }
-
- m_timeline->drawTrackViewBackBuffer();
- m_timeline->stopScrollTimer();
- */
- return true;
-}
-
-// virtual
-bool TrackPanelClipMoveFunction::dragDropped(DocumentTrack * panel,
- QDropEvent * event) {
- /*
- m_dragging = false;
- m_startedClipMove = false;
- if (ClipDrag::canDecode(event)) {
- if (!m_selection.isEmpty()) {
- m_selection.setAutoDelete(true);
- m_selection.clear();
- m_selection.setAutoDelete(false);
- }
-
- if (m_addingClips) {
-
- m_app->addCommand(createAddClipsCommand(), true);
- m_addingClips = false;
- m_app->clipReferenceChanged();
-
- //if (m_firststep) m_document->activateSceneListGeneration(true);
- m_firststep = false;
- }
-
- if (m_deleteClipsCommand) {
- delete m_deleteClipsCommand;
- m_deleteClipsCommand = 0;
- }
-
- if (m_moveClipsCommand) {
- m_moveClipsCommand->setEndLocation(m_masterClip);
- if (!m_moveClipsCommand->doesMove())
- {
- //m_document->activateSceneListGeneration(true);
- moveSelectedClips(m_moveClipsCommand->startTrack(), m_moveClipsCommand->startTime());
- m_app->addCommand(m_moveClipsCommand, true);
- m_moveClipsCommand = 0;
- m_document->slotUpdateMonitorPlaytime();
- // KdenliveApp is now managing this command, we do not need to delete it.
- }
- else {
- m_document->activateSceneListGeneration(true, false);
- delete m_moveClipsCommand;
- m_moveClipsCommand = 0;
- }
- }
- event->accept();
- } else if (EffectDrag::canDecode(event)) {
- DocClipRef *clipUnderMouse = 0;
- DocumentTrack * panel =
- m_view->panelAt(event->pos().y());
- if (panel) {
- DocTrackBase *track =
- m_document->track(panel->documentTrackIndex());
- if (track) {
- GenTime mouseTime((int)(m_timeline->mapLocalToValue(event->pos().
- x())), m_document->framesPerSecond());
- clipUnderMouse = track->getClipAt(mouseTime);
- }
- }
-
- if (clipUnderMouse) {
- Effect *effect = EffectDrag::decode(m_document, event);
- if (effect) {
- m_app->
- addCommand(Command::KAddEffectCommand::
- appendEffect(m_document, clipUnderMouse, effect),
- true);
- if (effect->name() == i18n("Freeze")) m_app->getDocument()->emitCurrentClipPosition();
- } else {
- kdWarning() <<
- "EffectDrag::decode did not return an effect, ignoring drag drop..."
- << endl;
- }
- delete effect;
- }
- }
- m_timeline->stopScrollTimer();
- m_timeline->drawTrackViewBackBuffer();
- */
- return true;
-}
-
-bool TrackPanelClipMoveFunction::moveSelectedClips(int newTrack,
- GenTime start) {
- /*
- if (!m_masterClip) return false;
- int trackOffset =
- m_document->trackIndex(m_document->findTrack(m_masterClip));
- GenTime startOffset;
-
- if (trackOffset == -1) {
- kdError() <<
- "Trying to move selected clips, master clip is not set." <<
- endl;
- return false;
- } else {
- startOffset = m_masterClip->trackStart();
- }
-
- trackOffset = newTrack - trackOffset;
- startOffset = start - startOffset;
- if (startOffset == GenTime()) return false;
- m_document->moveSelectedClips(startOffset, trackOffset);
- */
- return true;
-}
-
-/*
-void TrackPanelClipMoveFunction::addClipsToTracks(DocClipRefList & clips,
- int track, GenTime value, bool selected)
-{
-
- if (clips.isEmpty())
- return;
-
- if (selected) {
- m_app->
- addCommand(Command::KSelectClipCommand::selectNone(m_document),
- true);
- }
-
- DocClipRef *masterClip = clips.masterClip();
- if (!masterClip)
- masterClip = clips.first();
-
- GenTime startOffset = value - masterClip->trackStart();
-
- int trackOffset = masterClip->trackNum();
-
- if (trackOffset == -1)
- trackOffset = 0;
- trackOffset = track - trackOffset;
-
- QPtrListIterator < DocClipRef > itt(clips);
- int moveToTrack;
-
- while (itt.current() != 0) {
- moveToTrack = itt.current()->trackNum();
-
- if (moveToTrack == -1) {
- moveToTrack = track;
- itt.current()->moveTrackStart(itt.current()->trackStart() + startOffset);
- startOffset += itt.current()->cropDuration();
- } else {
- moveToTrack += trackOffset;
- itt.current()->moveTrackStart(itt.current()->trackStart() + startOffset);
- }
-
-
-
- if ((moveToTrack >= 0) && (moveToTrack < (int)m_document->numTracks())) {
- //if (itt.current()->referencedClip()->numReferences() == 0)
- m_document->track(moveToTrack)->addClip(itt.current(), selected);
- }
-
- ++itt;
- }
-
- m_addingClips = true;
-}
-*/
-
-void TrackPanelClipMoveFunction::setupSnapToGrid() {
- /*
- m_snapToGrid.clearSnapList();
- if (m_timeline->snapToSeekTime())
- m_snapToGrid.addToSnapList(m_timeline->seekPosition());
- m_snapToGrid.setSnapToFrame(m_timeline->snapToFrame());
-
- m_snapToGrid.addToSnapList(m_document->getSnapTimes(m_timeline->
- snapToBorders(), m_timeline->snapToMarkers(), true, false));
-
- QValueVector < GenTime > cursor =
- m_document->getSnapTimes(m_timeline->snapToBorders(),
- m_timeline->snapToMarkers(), false, true, false);
- m_snapToGrid.setCursorTimes(cursor);
-
- m_snapToGrid.setSnapTolerance(GenTime((int)(m_timeline->
- mapLocalToValue(Gui::KTimeLine::snapTolerance) -
- m_timeline->mapLocalToValue(0)),
- m_document->framesPerSecond()));
- */
-}
-
-/*void TrackPanelClipMoveFunction::initiateDrag(DocClipRef * clipUnderMouse,
- GenTime mouseTime)
-{
- m_masterClip = clipUnderMouse;
- m_clipOffset = mouseTime - clipUnderMouse->trackStart();
-
- m_moveClipsCommand =
- new Command::KMoveClipsCommand(m_document, m_masterClip);
-
- m_moveClipsCommand->setClipList(m_document->listSelected());
-
- m_deleteClipsCommand =
- Command::KAddRefClipCommand::deleteSelectedClips(m_document);
- setupSnapToGrid();
-
- m_startedClipMove = true;
-
- DocClipRefList selection = m_document->listSelected();
-
- selection.setMasterClip(m_masterClip);
- ClipDrag *clip = new ClipDrag(selection, m_timeline, "Timeline Drag");
-
- clip->dragCopy();
-}
-
-KMacroCommand *TrackPanelClipMoveFunction::createAddClipsCommand()
-{
- KMacroCommand *macroCommand = new KMacroCommand(i18n("Add Clips"));
-
- for (int count = 0; count < (int)m_document->numTracks(); ++count) {
- DocTrackBase *track = m_document->track(count);
-
- QPtrListIterator < DocClipRef > itt = track->firstClip(true);
-
- while (itt.current()) {
- Command::KAddRefClipCommand * command =
- new Command::KAddRefClipCommand(*m_document, itt.current(), true);
- macroCommand->addCommand(command);
- ++itt;
- }
- m_document->generateProducersList();
- }
- return macroCommand;
-}
-*/
-
-#include "trackpanelclipmovefunction.moc"
+++ /dev/null
-/***************************************************************************
- TrackPanelClipMoveFunction.h - description
- -------------------
- begin : Sun May 18 2003
- copyright : (C) 2003 by Jason Wood
- email : jasonwood@blueyonder.co.uk
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program 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. *
- * *
- ***************************************************************************/
-#ifndef TRACKPANELCLIPMOVEFUNCTION_H
-#define TRACKPANELCLIPMOVEFUNCTION_H
-
-#include "qcursor.h"
-
-#include "trackpanelfunction.h"
-
-class QMouseEvent;
-
-class KdenliveDoc;
-class DocumentTrack;
-
-/**
-Abstract Base Class for track panel functionality decorators. This and it's
-derived classes allow different behaviours to be added to panels as required.
-
-@author Jason Wood
-*/
-class TrackPanelClipMoveFunction: public TrackPanelFunction {
-Q_OBJECT public:
- TrackPanelClipMoveFunction(TrackView * view);
-
- virtual ~ TrackPanelClipMoveFunction();
-
- /**
- Returns true if the specified position should cause this function to activate,
- otherwise returns false.
- */
- virtual bool mouseApplies(DocumentTrack *,
- QMouseEvent * event) const;
-
- /**
- Returns a relevant mouse cursor for the given mouse position
- */
- virtual QCursor getMouseCursor(DocumentTrack *, QMouseEvent * event);
-
- /**
- A mouse button has been pressed. Returns true if we want to handle this event
- */
- virtual bool mousePressed(DocumentTrack * panel,
- QMouseEvent * event);
-
- /**
- Processes Mouse double click.*/
- virtual bool mouseDoubleClicked(DocumentTrack * panel, QMouseEvent *);
-
- /**
- Mouse Release Events in the track view area. Returns true if we have finished
- an operation now.
- */
- virtual bool mouseReleased(DocumentTrack *, QMouseEvent *);
-
- /**
- Processes Mouse Move events in the track view area. Returns true if we are
- continuing with the drag.*/
- virtual bool mouseMoved(DocumentTrack * panel, QMouseEvent * event);
-
- /**
- Process drag events
- */
-
- virtual bool dragEntered(DocumentTrack * panel, QDragEnterEvent *);
- virtual bool dragMoved(DocumentTrack *, QDragMoveEvent *);
- virtual bool dragLeft(DocumentTrack *, QDragLeaveEvent *);
- virtual bool dragDropped(DocumentTrack * panel, QDropEvent *);
-
-private:
- TrackView * m_view;
- KdenliveDoc *m_document;
- TrackViewClip *m_clipUnderMouse;
- bool m_dragging;
- bool m_firststep;
-
- /**
- This variable should be set to true if we have initiated a drag which
- is going to be moving, rather than adding, clips.
-
- set to false otherwise. The purpose of this variable is to prevent the
- selection group from being re-created on drag entry if we are only
- moving it - this prevents a copy of the clips from being created.
- */
- bool m_startedClipMove;
-
- /**
- This list is used to group clips together when they are being dragged away from the
- timeline, or are being dragged onto the timeline. It gives a home to clips that have not yet
- been placed.
- */
- //DocClipRefList m_selection;
- //DocClipRefList m_selection_to_add;
-
- /**
- This is the "master" Clip - the clip that is actively being dragged by the mouse.
- All other clips move in relation to the master clip.
- */
- TrackViewClip *m_masterClip;
-
- /**
- When dragging a clip, this is the time offset that should be applied to where
- the mouse cursor to find the beginning of the master clip.
- */
- GenTime m_clipOffset;
-
- /** A snap to grid object used for calculating snap-to-grid calculations. */
- //SnapToGrid m_snapToGrid;
-
- /** Moves all selected clips to a new position. The new start position is that for the master clip,
- all other clips are moved in relation to it. Returns true on success, false on failure.*/
- bool moveSelectedClips(int newTrack, GenTime start);
-
- /** Adds a Clipgroup to the tracks in the timeline. It there are some currently selected clips and
- we add new clips with this method, the previously selected clips are dselected. */
- //void addClipsToTracks(DocClipRefList & clips, int track, GenTime value,bool selected);
-
- /** set up the snap-to-grid class */
- void setupSnapToGrid();
-
- /** Find the index of the document track underneath the specified point on the track. */
- int trackUnderPoint(const QPoint & pos);
-
- /** Initiates a drag operation on the selected clip, setting the master clip to clipUnderMouse,
- and specifying the time that the mouse is currently pointing at. */
- //void initiateDrag(DocClipRef * clipUnderMouse, GenTime mouseTime);
-
- /**
- True if we are currently in the process of adding clips to the timeline.
- False otherwise.
- */
- bool m_addingClips;
-
-
- /**
- A moveClipCommand action, used to record clip movement for undo/redo functionality.
- */
- //Command::KMoveClipsCommand * m_moveClipsCommand;
- /**
- This command is used to record clip deletion for undo/redo functionality.
- */
- //KMacroCommand *m_deleteClipsCommand;
-
-#warning - The following method is a bad example for programming design.
- /** Returns a command that would create those clips in the document that are currently selected.
- */
- //KMacroCommand *createAddClipsCommand();
-
- /** Returns true if the x,y position is over a clip (and therefore, the move function applies) */
- bool mouseApplies(const QPoint & pos) const;
-
-signals:
- //void checkTransition(DocClipRef*);
-};
-
-#endif
+++ /dev/null
-/***************************************************************************
- trackpanelfunction.cpp - description
- -------------------
- begin : Sun May 18 2003
- copyright : (C) 2003 by Jason Wood
- email : jasonwood@blueyonder.co.uk
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program 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. *
- * *
- ***************************************************************************/
-#include "trackpanelfunction.h"
-
-TrackPanelFunction::TrackPanelFunction() {
-}
-
-
-TrackPanelFunction::~TrackPanelFunction() {
-}
-
-#include "trackpanelfunction.moc"
-
+++ /dev/null
-/***************************************************************************
- trackpanelfunction.h - description
- -------------------
- begin : Sun May 18 2003
- copyright : (C) 2003 by Jason Wood
- email : jasonwood@blueyonder.co.uk
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program 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. *
- * *
- ***************************************************************************/
-#ifndef TRACKPANELFUNCTION_H
-#define TRACKPANELFUNCTION_H
-
-#include "qcursor.h"
-#include "qobject.h"
-
-#include "documenttrack.h"
-#include "gentime.h"
-
-class QMouseEvent;
-
-/**
-Abstract Base Class for track panel functionality decorators. This and it's
-derived classes allow different behaviours to be added to panels as required.
-
-@author Jason Wood
-*/
-class TrackPanelFunction: public QObject {
-Q_OBJECT public:
- TrackPanelFunction();
-
- virtual ~ TrackPanelFunction();
-
- /**
- Returns true if the specified position should cause this function to activate,
- otherwise returns false.
- */
- virtual bool mouseApplies(DocumentTrack * panel,
- QMouseEvent * event) const = 0;
-
- /**
- Returns a relevant mouse cursor for the given mouse position
- */
- virtual QCursor getMouseCursor(DocumentTrack * panel,
- QMouseEvent * event) = 0;
-
- /**
- A mouse button has been pressed. Returns true if we want to handle this event
- */
- virtual bool mousePressed(DocumentTrack * panel,
- QMouseEvent * event) = 0;
-
- virtual bool mouseDoubleClicked(DocumentTrack * panel, QMouseEvent * event) = 0;
-
- /**
- Mouse Release Events in the track view area. Returns true if we have finished
- an operation now.
- */
- virtual bool mouseReleased(DocumentTrack * panel,
- QMouseEvent * event) = 0;
-
- /**
- Processes Mouse Move events in the track view area. Returns true if we are
- continuing with the drag.*/
- virtual bool mouseMoved(DocumentTrack * panel,
- QMouseEvent * event) = 0;
-
- /**
- Process Drag events*/
- virtual bool dragEntered(DocumentTrack * , QDragEnterEvent *) {
- return false;
- };
- virtual bool dragMoved(DocumentTrack * , QDragMoveEvent *) {
- return false;
- };
- virtual bool dragLeft(DocumentTrack * , QDragLeaveEvent *) {
- return false;
- };
- virtual bool dragDropped(DocumentTrack * , QDropEvent *) {
- return false;
- };
-
-};
-
-#endif
+++ /dev/null
-/***************************************************************************
- trackpanelfunctionfactory - description
- -------------------
- begin : Sun Dec 28 2003
- copyright : (C) 2003 by Jason Wood
- email : jasonwood@blueyonder.co.uk
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program 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. *
- * *
- ***************************************************************************/
-#include "trackpanelfunctionfactory.h"
-
-#include "trackpanelfunction.h"
-
-#include <KDebug>
-
-TrackPanelFunctionFactory::TrackPanelFunctionFactory() {
-}
-
-
-TrackPanelFunctionFactory::~TrackPanelFunctionFactory() {
- clearFactory();
-}
-
-void TrackPanelFunctionFactory::clearFactory() {
- QMap < QString, TrackPanelFunction * >::iterator itt =
- m_functionMap.begin();
-
- while (itt != m_functionMap.end()) {
- delete(itt.value());
- itt.value() = 0;
- ++itt;
- }
- m_functionMap.clear();
-}
-
-void TrackPanelFunctionFactory::registerFunction(const QString & name,
- TrackPanelFunction * function) {
- if (!m_functionMap.contains(name)) {
- m_functionMap[name] = function;
- } else {
- kError() << "Factory already contains a function called " << name;
- }
-}
-
-TrackPanelFunction *TrackPanelFunctionFactory::
-function(const QString & name) {
- if (m_functionMap.contains(name)) {
- return m_functionMap[name];
- } else {
- kError() << "No function called " << name << " found in factory";
- }
-
- return 0;
-}
-
-#include "trackpanelfunctionfactory.moc"
-
+++ /dev/null
-/***************************************************************************
- trackpanelfunctionfactory - description
- -------------------
- begin : Sun Dec 28 2003
- copyright : (C) 2003 by Jason Wood
- email : jasonwood@blueyonder.co.uk
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program 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. *
- * *
- ***************************************************************************/
-#ifndef TRACKPANELFUNCTIONFACTORY_H
-#define TRACKPANELFUNCTIONFACTORY_H
-
-#include <qmap.h>
-
-class TrackPanelFunction;
-
-/**
-A factory containing all known trackpanel functions.
-
-@author Jason Wood
-*/
-class TrackPanelFunctionFactory {
-public:
-
- TrackPanelFunctionFactory();
-
- ~TrackPanelFunctionFactory();
-
- void registerFunction(const QString & name,
- TrackPanelFunction * function);
- TrackPanelFunction *function(const QString & name);
- void clearFactory();
-
-private:
- QMap < QString, TrackPanelFunction * >m_functionMap;
-};
-
-#endif
#include <KDebug>
#include "definitions.h"
-#include "documentvideotrack.h"
-#include "documentaudiotrack.h"
#include "headertrack.h"
#include "trackview.h"
#include "clipitem.h"
-#include "trackpanelclipmovefunction.h"
TrackView::TrackView(KdenliveDoc *doc, QWidget *parent)
- : QWidget(parent), m_doc(doc), m_scale(1.0), m_panelUnderMouse(NULL), m_function(NULL), m_projectTracks(0), m_projectDuration(0) {
+ : QWidget(parent), m_doc(doc), m_scale(1.0), m_projectTracks(0), m_projectDuration(0) {
setMouseTracking(true);
view = new Ui::TimeLine_UI();
view->setupUi(this);
m_trackview->initView();
}
-void TrackView::registerFunction(const QString & name, TrackPanelFunction * function) {
- m_factory.registerFunction(name, function);
-}
int TrackView::duration() {
return m_projectDuration;
return m_doc;
}
+void TrackView::refresh() {
+ m_trackview->viewport()->update();
+}
+
int TrackView::slotAddAudioTrack(int ix, QDomElement xml) {
kDebug() << "************* ADD AUDIO TRACK " << ix;
m_trackview->addTrack();
- //DocumentTrack *track = new DocumentAudioTrack(xml, this, m_trackview);
HeaderTrack *header = new HeaderTrack();
//m_tracksAreaLayout->addWidget(track); //, ix, Qt::AlignTop);
m_headersLayout->addWidget(header); //, ix, Qt::AlignTop);
int TrackView::slotAddVideoTrack(int ix, QDomElement xml) {
m_trackview->addTrack();
- //DocumentTrack *track = new DocumentVideoTrack(xml, this, m_trackview);
HeaderTrack *header = new HeaderTrack();
int trackTop = 50 * ix;
int trackBottom = trackTop + 50;
//track->show();
}
-DocumentTrack *TrackView::panelAt(int y) {
- return NULL;
-}
-
QGraphicsScene *TrackView::projectScene() {
return m_scene;
}
return m_editMode;
}
-/** This event occurs when the mouse has been moved. */
-void TrackView::mouseMoveEvent(QMouseEvent * event) {
- if (m_panelUnderMouse) {
- if (event->buttons() & Qt::LeftButton) {
- bool result = false;
- if (m_function)
- result =
- m_function->mouseMoved(m_panelUnderMouse, event);
- if (!result) {
- m_panelUnderMouse = 0;
- m_function = 0;
- }
- } else {
- if (m_function) {
- m_function->mouseReleased(m_panelUnderMouse, event);
- m_function = 0;
- }
- m_panelUnderMouse = 0;
- }
- } else {
- DocumentTrack *panel = panelAt(event->y());
- if (panel) {
- QCursor result(Qt::ArrowCursor);
-
- TrackPanelFunction *function =
- getApplicableFunction(panel, editMode(),
- event);
- if (function)
- result = function->getMouseCursor(panel, event);
-
- setCursor(result);
- } else {
- setCursor(QCursor(Qt::ArrowCursor));
- }
- }
-}
-
-TrackPanelFunction *TrackView::getApplicableFunction(DocumentTrack *
- panel, const QString & editMode, QMouseEvent * event) {
- TrackPanelFunction *function = 0;
-
- QStringList list = panel->applicableFunctions(editMode);
- QStringList::iterator itt = list.begin();
-
- while (itt != list.end()) {
- TrackPanelFunction *testFunction = m_factory.function(*itt);
- if (testFunction) {
- if (testFunction->mouseApplies(panel, event)) {
- function = testFunction;
- break;
- }
- }
-
- ++itt;
- }
-
- return function;
-}
-
-
#include "trackview.moc"
#include "ui_timeline_ui.h"
#include "customruler.h"
#include "kdenlivedoc.h"
-#include "documenttrack.h"
-#include "trackpanelfunctionfactory.h"
-#include "trackpanelfunction.h"
#include "customtrackview.h"
class ClipItem;
public:
TrackView(KdenliveDoc *doc, QWidget *parent = 0);
- /** This event occurs when the mouse has been moved. */
- void mouseMoveEvent(QMouseEvent * event);
-
const double zoomFactor() const;
- DocumentTrack *panelAt(int y);
const int mapLocalToValue(int x) const;
void setEditMode(const QString & editMode);
const QString & editMode() const;
int duration();
int tracksNumber();
KdenliveDoc *document();
+ void refresh() ;
public slots:
void slotDeleteClip(int clipId);
CustomRuler *m_ruler;
CustomTrackView *m_trackview;
double m_scale;
- QList <DocumentTrack*> documentTracks;
int m_projectDuration;
int m_projectTracks;
- TrackPanelFunctionFactory m_factory;
- DocumentTrack *m_panelUnderMouse;
- /** The currently applied function. This lasts from mousePressed until mouseRelease. */
- TrackPanelFunction *m_function;
QString m_editMode;
QGraphicsScene *m_scene;
uint m_currentZoom;
void parseDocument(QDomDocument doc);
int slotAddAudioTrack(int ix, QDomElement xml);
int slotAddVideoTrack(int ix, QDomElement xml);
- void registerFunction(const QString & name, TrackPanelFunction * function);
- TrackPanelFunction *getApplicableFunction(DocumentTrack * panel, const QString & editMode, QMouseEvent * event);
private slots:
void slotChangeZoom(int factor);