if (m_cropDuration > GenTime(3, m_fps)) durationDiff = GenTime(3, m_fps);
else return;
}
-
+ //kDebug()<<"// DURATION DIFF: "<<durationDiff.frames(25)<<", POS: "<<pos().x();
m_startPos += durationDiff;
if (type() == AVWIDGET) m_cropStart += durationDiff * speed;
m_cropDuration = m_cropDuration - durationDiff * speed;
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
- setPos(m_startPos.frames(m_fps), pos().y());
- if ((int) pos().x() != posx) {
+ moveBy(durationDiff.frames(m_fps), 0);
+ //setPos(m_startPos.frames(m_fps), pos().y());
+ if ((int) scenePos().x() != posx) {
//kDebug()<<"////// WARNING, DIFF IN XPOS: "<<pos().x()<<" == "<<m_startPos.frames(m_fps);
GenTime diff = GenTime((int) pos().x() - posx, m_fps);
if (type() == AVWIDGET) m_cropStart = m_cropStart + diff;
const int trackHeight = KdenliveSettings::trackheight();
QPointF start = sceneBoundingRect().topLeft();
QPointF newPos = value.toPointF();
- int xpos = projectScene()->getSnapPointForPos((int)(start.x() + newPos.x() - scenePos().x() + 0.5), KdenliveSettings::snaptopoints());
+ //kDebug()<<"REAL:"<<start.x()<<", PROPOSED:"<<(int)(start.x() - pos().x() + newPos.x());
+ int xpos = projectScene()->getSnapPointForPos((int)(start.x() + newPos.x() - pos().x()), KdenliveSettings::snaptopoints());
xpos = qMax(xpos, 0);
- newPos.setX((int)(scenePos().x() + xpos - (int) start.x()));
+ //kDebug()<<"GRP XPOS:"<<xpos<<", START:"<<start.x()<<",NEW:"<<newPos.x()<<"; SCENE:"<<scenePos().x()<<",POS:"<<pos().x();
+ newPos.setX((int)(pos().x() + xpos - (int) start.x()));
//int startTrack = (start.y() + trackHeight / 2) / trackHeight;
- int newTrack = (start.y() + newPos.y() - scenePos().y()) / trackHeight;
- int currTrack = start.y() / trackHeight;
- int currTrack2 = newPos.y() / trackHeight;
+ int realTrack = (start.y() + newPos.y() - pos().y()) / trackHeight;
+ int proposedTrack = newPos.y() / trackHeight;
- newTrack = qMin(newTrack, projectScene()->tracksCount() - (int)(boundingRect().height() + 5) / trackHeight);
- newTrack = qMax(newTrack, 0);
+ int correctedTrack = qMin(realTrack, projectScene()->tracksCount() - (int)(boundingRect().height() + 5) / trackHeight);
+ correctedTrack = qMax(correctedTrack, 0);
+
+ proposedTrack += (correctedTrack - realTrack);
// Check if top item is a clip or a transition
int offset = 0;
}
}
}
- newPos.setY((int)((currTrack2) * trackHeight) + offset);
+ newPos.setY((int)((proposedTrack) * trackHeight) + offset);
//if (newPos == start) return start;
/*if (newPos.x() < 0) {
QVariant ClipItem::itemChange(GraphicsItemChange change, const QVariant &value) {
if (change == ItemPositionChange && scene()) {
// calculate new position.
- if (parentItem()) return pos();
+ //if (parentItem()) return pos();
QPointF newPos = value.toPointF();
//kDebug() << "/// MOVING CLIP ITEM.------------\n++++++++++";
int xpos = projectScene()->getSnapPointForPos((int) newPos.x(), KdenliveSettings::snaptopoints());
}
}
-
+ if (m_dragItem->parentItem() && m_dragItem->parentItem() != m_selectionGroup) {
+ // Item was resized, rebuild group;
+ AbstractGroupItem *group = static_cast <AbstractGroupItem *>(m_dragItem->parentItem());
+ QList <QGraphicsItem *> children = group->childItems();
+ m_document->clipManager()->removeGroup(group);
+ scene()->destroyItemGroup(group);
+ for (int i = 0; i < children.count(); i++) {
+ children.at(i)->setSelected(true);
+ }
+ groupSelectedItems(false, true);
+ }
//m_document->renderer()->doRefresh();
} else if (m_operationMode == RESIZEEND && m_dragItem->endPos() != m_dragItemInfo.endPos) {
// resize end
m_commandStack->push(command);
}
}
+ if (m_dragItem->parentItem() && m_dragItem->parentItem() != m_selectionGroup) {
+ // Item was resized, rebuild group;
+ AbstractGroupItem *group = static_cast <AbstractGroupItem *>(m_dragItem->parentItem());
+ QList <QGraphicsItem *> children = group->childItems();
+ m_document->clipManager()->removeGroup(group);
+ scene()->destroyItemGroup(group);
+ for (int i = 0; i < children.count(); i++) {
+ children.at(i)->setSelected(true);
+ }
+ groupSelectedItems(false, true);
+ }
//m_document->renderer()->doRefresh();
} else if (m_operationMode == FADEIN) {
// resize fade in effect
for (int i = 0; i < itemList.count(); i++) {
if (itemList.at(i)->type() == AVWIDGET) {
ClipItem *item = static_cast <ClipItem *>(itemList.at(i));
- if (item->parentItem() && item->parentItem() != m_selectionGroup) {
- emit displayMessage(i18n("Cannot cut a clip in a group"), ErrorMessage);
- }
- else if (currentPos > item->startPos() && currentPos < item->endPos()) {
+ if (item->parentItem() && item->parentItem() != m_selectionGroup) {
+ emit displayMessage(i18n("Cannot cut a clip in a group"), ErrorMessage);
+ } else if (currentPos > item->startPos() && currentPos < item->endPos()) {
RazorClipCommand *command = new RazorClipCommand(this, item->info(), currentPos, true);
m_commandStack->push(command);
}
}
ClipItem *CustomTrackView::getClipItemAt(int pos, int track) {
- QPointF p(pos, track * m_tracksHeight + m_tracksHeight / 2);
- kDebug() << "LKING POINT:" << p;
- QList<QGraphicsItem *> list = scene()->items(p);
+ QList<QGraphicsItem *> list = scene()->items(QPointF(pos, track * m_tracksHeight + m_tracksHeight / 2));
ClipItem *clip = NULL;
for (int i = 0; i < list.size(); i++) {
if (list.at(i)->type() == AVWIDGET) {