- ItemInfo itemInfo;
- itemInfo.startPos = startPos();
- itemInfo.endPos = endPos();
- itemInfo.cropStart = m_cropStart;
- itemInfo.track = track();
- return itemInfo;
+ ItemInfo info = m_info;
+ info.cropStart = cropStart();
+ info.endPos = endPos();
+ return info;
- m_track = (int)(scenePos().y() / KdenliveSettings::trackheight());
- m_startPos = GenTime((int) scenePos().x(), m_fps);
+ m_info.track = (int)(scenePos().y() / KdenliveSettings::trackheight());
+ m_info.startPos = GenTime((int) scenePos().x(), m_fps);
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
}
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
}
if (durationDiff == GenTime()) return;
//kDebug() << "-- RESCALE DIFF=" << durationDiff.frames(25) << ", CLIP: " << startPos().frames(25) << "-" << endPos().frames(25);
if (type() == AVWIDGET && cropStart() + durationDiff < GenTime()) {
durationDiff = GenTime() - cropStart();
if (durationDiff == GenTime()) return;
//kDebug() << "-- RESCALE DIFF=" << durationDiff.frames(25) << ", CLIP: " << startPos().frames(25) << "-" << endPos().frames(25);
if (type() == AVWIDGET && cropStart() + durationDiff < GenTime()) {
durationDiff = GenTime() - cropStart();
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
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);
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
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;
- m_cropDuration = m_cropDuration - diff;
+
+ if (type() == AVWIDGET) {
+ m_info.cropStart += diff;
+ }
+ m_info.cropDuration = m_info.cropDuration - diff;
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
//kDebug()<<"// NEW START: "<<m_startPos.frames(25)<<", NW DUR: "<<m_cropDuration.frames(25);
}
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
//kDebug()<<"// NEW START: "<<m_startPos.frames(25)<<", NW DUR: "<<m_cropDuration.frames(25);
}
{
GenTime durationDiff = GenTime(posx, m_fps) - endPos();
if (durationDiff == GenTime()) return;
{
GenTime durationDiff = GenTime(posx, m_fps) - endPos();
if (durationDiff == GenTime()) return;
if (cropDuration() + durationDiff <= GenTime()) {
durationDiff = GenTime() - (cropDuration() - GenTime(3, m_fps));
}
if (cropDuration() + durationDiff <= GenTime()) {
durationDiff = GenTime() - (cropDuration() - GenTime(3, m_fps));
}
- //kDebug() << "// DUR DIFF2:" << durationDiff.frames(25) << ", ADJUSTED: " << durationDiff.frames(25) * speed << ", SPED:" << speed;
- m_cropDuration += durationDiff * speed;
+
+ m_info.cropDuration += durationDiff;
+
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
if (durationDiff > GenTime()) {
QList <QGraphicsItem *> collisionList = collidingItems(Qt::IntersectsItemBoundingRect);
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
if (durationDiff > GenTime()) {
QList <QGraphicsItem *> collisionList = collidingItems(Qt::IntersectsItemBoundingRect);
kDebug() << "///////// CURRENT: " << startPos().frames(25) << "x" << endPos().frames(25) << ", RECT: " << rect() << "-" << pos();
kDebug() << "///////// COLLISION: " << ((AbstractClipItem *)item)->startPos().frames(25) << "x" << ((AbstractClipItem *)item)->endPos().frames(25) << ", RECT: " << ((AbstractClipItem *)item)->rect() << "-" << item->pos();*/
GenTime diff = ((AbstractClipItem *)item)->startPos() - GenTime(1, m_fps) - startPos();
kDebug() << "///////// CURRENT: " << startPos().frames(25) << "x" << endPos().frames(25) << ", RECT: " << rect() << "-" << pos();
kDebug() << "///////// COLLISION: " << ((AbstractClipItem *)item)->startPos().frames(25) << "x" << ((AbstractClipItem *)item)->endPos().frames(25) << ", RECT: " << ((AbstractClipItem *)item)->rect() << "-" << item->pos();*/
GenTime diff = ((AbstractClipItem *)item)->startPos() - GenTime(1, m_fps) - startPos();
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
break;
}
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
break;
}
double maxw = br.width() / cropDuration().frames(m_fps);
double maxh = br.height() / 100.0 * m_keyframeFactor;
if (m_keyframes.count() > 1) {
double maxw = br.width() / cropDuration().frames(m_fps);
double maxh = br.height() / 100.0 * m_keyframeFactor;
if (m_keyframes.count() > 1) {
while (i != m_keyframes.constEnd()) {
x1 = br.x() + maxw * (i.key() - cropStart().frames(m_fps));
y1 = br.bottom() - i.value() * maxh;
while (i != m_keyframes.constEnd()) {
x1 = br.x() + maxw * (i.key() - cropStart().frames(m_fps));
y1 = br.bottom() - i.value() * maxh;
setToolTip('[' + QString::number((GenTime(i.key(), m_fps) - cropStart()).seconds(), 'f', 2) + i18n("seconds") + ", " + QString::number(i.value(), 'f', 1) + "%]");
return i.key();
} else if (x1 > pos.x()) break;
setToolTip('[' + QString::number((GenTime(i.key(), m_fps) - cropStart()).seconds(), 'f', 2) + i18n("seconds") + ", " + QString::number(i.value(), 'f', 1) + "%]");
return i.key();
} else if (x1 > pos.x()) break;
if (!m_keyframes.contains(m_selectedKeyframe)) return;
int newpos = (int) pos.frames(m_fps);
int start = cropStart().frames(m_fps);
if (!m_keyframes.contains(m_selectedKeyframe)) return;
int newpos = (int) pos.frames(m_fps);
int start = cropStart().frames(m_fps);
newpos = qMax(newpos, start);
newpos = qMin(newpos, end);
if (value < -50 && m_selectedKeyframe != start && m_selectedKeyframe != end) {
newpos = qMax(newpos, start);
newpos = qMin(newpos, end);
if (value < -50 && m_selectedKeyframe != start && m_selectedKeyframe != end) {
QRectF br = sceneBoundingRect();
double maxh = 100.0 / br.height() / m_keyframeFactor;
int newval = (br.bottom() - value) * maxh;
QRectF br = sceneBoundingRect();
double maxh = 100.0 / br.height() / m_keyframeFactor;
int newval = (br.bottom() - value) * maxh;
- kDebug() << "Rect: " << br << "/ SCENE: " << sceneBoundingRect() << ", VALUE: " << value << ", MAX: " << maxh << ", NEWVAL: " << newval;
+ //kDebug() << "Rect: " << br << "/ SCENE: " << sceneBoundingRect() << ", VALUE: " << value << ", MAX: " << maxh << ", NEWVAL: " << newval;
int newpos = (int) pos.frames(m_fps) ;
m_keyframes[newpos] = newval;
m_selectedKeyframe = newpos;
int newpos = (int) pos.frames(m_fps) ;
m_keyframes[newpos] = newval;
m_selectedKeyframe = newpos;