CustomTrackView::CustomTrackView(KdenliveDoc *doc, CustomTrackScene* projectscene, QWidget *parent) :
QGraphicsView(projectscene, parent),
m_tracksHeight(KdenliveSettings::trackheight()),
- m_selectedTrack(0),
m_projectDuration(0),
m_cursorPos(0),
m_document(doc),
KIcon spacerIcon("kdenlive-spacer-tool");
m_spacerCursor = QCursor(spacerIcon.pixmap(22, 22));
verticalScrollBar()->setTracking(true);
- connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(slotRefreshGuides()));
+ // Line below was supposed to scroll guides label with scrollbar, not implemented yet
+ //connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(slotRefreshGuides()));
connect(&m_scrollTimer, SIGNAL(timeout()), this, SLOT(slotCheckMouseScrolling()));
m_scrollTimer.setInterval(100);
m_scrollTimer.setSingleShot(true);
update();
}
-// virtual
-void CustomTrackView::resizeEvent(QResizeEvent * event)
-{
- QGraphicsView::resizeEvent(event);
-}
-
-// virtual
/** Zoom or move viewport on mousewheel
*
* If mousewheel+Ctrl, zooms in/out on the timeline.
int pos = event->x();
int mappedXPos = (int)(mapToScene(event->pos()).x() + 0.5);
emit mousePosition(mappedXPos);
+
if (event->buttons() & Qt::MidButton) return;
- if ((event->modifiers() == Qt::ControlModifier && m_tool != SPACERTOOL) || event->modifiers() == Qt::ShiftModifier) {
+ if (m_operationMode == RUBBERSELECTION || (event->modifiers() == Qt::ControlModifier && m_tool != SPACERTOOL)) {
QGraphicsView::mouseMoveEvent(event);
m_moveOpMode = NONE;
return;
m_dragItem->updateKeyFramePos(keyFramePos, pos);
}
- if (m_animation) delete m_animation;
+ delete m_animation;
m_animation = NULL;
- if (m_visualTip) delete m_visualTip;
+ delete m_visualTip;
m_visualTip = NULL;
return;
} else if (m_operationMode == MOVEGUIDE) {
- if (m_animation) delete m_animation;
+ delete m_animation;
m_animation = NULL;
- if (m_visualTip) delete m_visualTip;
+ delete m_visualTip;
m_visualTip = NULL;
QGraphicsView::mouseMoveEvent(event);
return;
return;
} else {
if (m_visualTip) {
- if (m_animation) delete m_animation;
+ delete m_animation;
m_animation = NULL;
m_animationTimer->stop();
delete m_visualTip;
slotCheckPositionScrolling();
} else m_moveOpMode = NONE;
if (m_visualTip) {
- if (m_animation) delete m_animation;
+ delete m_animation;
m_animationTimer->stop();
m_animation = NULL;
delete m_visualTip;
m_document->renderer()->mltInsertClip(info, item->xml(), item->baseClip()->producer(item->track()));
item->setSelected(true);
}
+ m_document->setModified(true);
m_changeSpeedAction->setEnabled(hasVideoClip);
m_pasteEffectsAction->setEnabled(m_copiedItems.count() == 1);
groupSelectedItems(true);
m_commandStack->push(moveCommand);
} else {
// undo last move and emit error message
- MoveClipCommand *command = new MoveClipCommand(this, info, m_dragItemInfo, true);
- m_commandStack->push(command);
+ bool snap = KdenliveSettings::snaptopoints();
+ KdenliveSettings::setSnaptopoints(false);
+ item->setPos((int) m_dragItemInfo.startPos.frames(m_document->fps()), (int)(m_dragItemInfo.track * m_tracksHeight + 1));
+ KdenliveSettings::setSnaptopoints(snap);
emit displayMessage(i18n("Cannot move clip to position %1", m_document->timecode().getTimecodeFromFrames(m_dragItemInfo.startPos.frames(m_document->fps()))), ErrorMessage);
}
m_document->setModified(true);
scene()->removeItem(item);
if (m_dragItem == item) m_dragItem = NULL;
delete item;
+ m_document->setModified(true);
m_document->renderer()->doRefresh();
}
ClipItem *item = static_cast <ClipItem *>(itemList.at(i));
if (item->parentItem()) resetGroup = true;
new AddTimelineClipCommand(this, item->xml(), item->clipProducer(), item->info(), item->effectList(), true, true, deleteSelected);
+ emit clipItemSelected(NULL);
} else if (itemList.at(i)->type() == TRANSITIONWIDGET) {
Transition *item = static_cast <Transition *>(itemList.at(i));
if (item->parentItem()) resetGroup = true;
info.endPos = item->endPos();
info.track = item->track();
new AddTransitionCommand(this, info, item->transitionEndTrack(), item->toXML(), true, true, deleteSelected);
+ emit transitionItemSelected(NULL);
}
}
+
m_commandStack->push(deleteSelected);
}
}
ClipItem *item = new ClipItem(baseclip, info, m_document->fps(), xml.attribute("speed", "1").toDouble());
item->setEffectList(effects);
+ if (xml.hasAttribute("audio_only")) item->setAudioOnly(true);
+ else if (xml.hasAttribute("video_only")) item->setVideoOnly(true);
scene()->addItem(item);
int tracknumber = m_document->tracksCount() - info.track - 1;
if (list.at(i)->type() == AVWIDGET) {
clip = static_cast <ClipItem *>(list.at(i));
if (clip->clipProducer() == clipId) {
- clip->refreshClip();
+ clip->refreshClip(true);
ItemInfo info = clip->info();
info.track = m_document->tracksCount() - clip->track();
m_document->renderer()->mltUpdateClip(info, clip->xml(), clip->baseClip()->producer());
bool found = false;
for (int i = 0; i < m_guides.count(); i++) {
if (m_guides.at(i)->position() == oldPos) {
- Guide *item = m_guides.takeAt(i);
- delete item;
+ delete m_guides.takeAt(i);
found = true;
break;
}
m_scene->setScale(scaleFactor);
//scale(scaleFactor, 1);
m_animationTimer->stop();
- if (m_visualTip) {
- delete m_visualTip;
- m_visualTip = NULL;
- }
- if (m_animation) {
- delete m_animation;
- m_animation = NULL;
- }
+ delete m_visualTip;
+ m_visualTip = NULL;
+ delete m_animation;
+ m_animation = NULL;
//setSceneRect(0, 0, m_projectDuration + 100 * scaleFactor, sceneRect().height());
setMatrix(matrix);
void CustomTrackView::copyClip()
{
- while (m_copiedItems.count() > 0) {
- delete m_copiedItems.takeFirst();
- }
+ qDeleteAll(m_copiedItems);
+ m_copiedItems.clear();
QList<QGraphicsItem *> itemList = scene()->selectedItems();
if (itemList.count() == 0) {
emit displayMessage(i18n("Select a clip before copying"), ErrorMessage);
}
}
}
- item->refreshClip();
+ item->refreshClip(false);
qApp->processEvents();
}
}
}
}
+
#include "customtrackview.moc"