svn path=/trunk/kdenlive/; revision=5322
m_editedKeyframe(-1),
m_selectedKeyframe(0),
m_keyframeFactor(1),
m_editedKeyframe(-1),
m_selectedKeyframe(0),
m_keyframeFactor(1),
m_fps(fps)
#if QT_VERSION >= 0x040600
, m_closeAnimation(NULL)
m_fps(fps)
#if QT_VERSION >= 0x040600
, m_closeAnimation(NULL)
if (active) {
x1 = br.x();
x2 = br.right();
if (active) {
x1 = br.x();
x2 = br.right();
- y1 = br.bottom() - m_keyframeDefault * maxh;
+ y1 = br.bottom() - (m_keyframeDefault - m_keyframeOffset) * maxh;
QLineF l(x1, y1, x2, y1);
QLineF l2 = painter->matrix().map(l);
painter->setPen(QColor(168, 168, 168, 180));
QLineF l(x1, y1, x2, y1);
QLineF l2 = painter->matrix().map(l);
painter->setPen(QColor(168, 168, 168, 180));
QColor color(Qt::blue);
QLineF l2;
x1 = br.x() + maxw * (i.key() - start);
QColor color(Qt::blue);
QLineF l2;
x1 = br.x() + maxw * (i.key() - start);
- y1 = br.bottom() - i.value() * maxh;
+ y1 = br.bottom() - (i.value() - m_keyframeOffset) * maxh;
// make sure line begins with clip beginning
if (i.key() != start) {
// make sure line begins with clip beginning
if (i.key() != start) {
y2 = y1;
} else {
x2 = br.x() + maxw * (i.key() - start);
y2 = y1;
} else {
x2 = br.x() + maxw * (i.key() - start);
- y2 = br.bottom() - i.value() * maxh;
+ y2 = br.bottom() - (i.value() - m_keyframeOffset) * maxh;
}
QLineF l(x1, y1, x2, y2);
l2 = painter->matrix().map(l);
}
QLineF l(x1, y1, x2, y2);
l2 = painter->matrix().map(l);
double y1;
while (i != m_keyframes.constEnd()) {
x1 = br.x() + maxw * (i.key() - cropStart().frames(m_fps));
double y1;
while (i != m_keyframes.constEnd()) {
x1 = br.x() + maxw * (i.key() - cropStart().frames(m_fps));
- y1 = br.bottom() - i.value() * maxh;
+ y1 = br.bottom() - (i.value() - m_keyframeOffset) * maxh;
if (qAbs(pos.x() - x1) < maxOffset && qAbs(pos.y() - y1) < 10) {
setToolTip('[' + QString::number((GenTime(i.key(), m_fps) - cropStart()).seconds(), 'f', 2) + i18n("seconds") + ", " + QString::number(i.value(), 'f', 1) + "]");
return i.key();
if (qAbs(pos.x() - x1) < maxOffset && qAbs(pos.y() - y1) < 10) {
setToolTip('[' + QString::number((GenTime(i.key(), m_fps) - cropStart()).seconds(), 'f', 2) + i18n("seconds") + ", " + QString::number(i.value(), 'f', 1) + "]");
return i.key();
QRectF br = sceneBoundingRect();
double maxw = br.width() / cropDuration().frames(m_fps);
double maxh = br.height() / 100.0 * m_keyframeFactor;
QRectF br = sceneBoundingRect();
double maxw = br.width() / cropDuration().frames(m_fps);
double maxh = br.height() / 100.0 * m_keyframeFactor;
- update(br.x() + maxw *(m_selectedKeyframe - cropStart().frames(m_fps)) - 3, br.bottom() - m_keyframes.value(m_selectedKeyframe) * maxh - 3, 12, 12);
+ update(br.x() + maxw *(m_selectedKeyframe - cropStart().frames(m_fps)) - 3, br.bottom() - (m_keyframes.value(m_selectedKeyframe) - m_keyframeOffset) * maxh - 3, 12, 12);
m_selectedKeyframe = m_editedKeyframe;
m_selectedKeyframe = m_editedKeyframe;
- update(br.x() + maxw *(m_selectedKeyframe - cropStart().frames(m_fps)) - 3, br.bottom() - m_keyframes.value(m_selectedKeyframe) * maxh - 3, 12, 12);
+ update(br.x() + maxw *(m_selectedKeyframe - cropStart().frames(m_fps)) - 3, br.bottom() - (m_keyframes.value(m_selectedKeyframe) - m_keyframeOffset) * maxh - 3, 12, 12);
}
int AbstractClipItem::editedKeyFramePos() const
}
int AbstractClipItem::editedKeyFramePos() const
double newval = qMax(value, 0.0);
newval = qMin(newval, 100.0);
double newval = qMax(value, 0.0);
newval = qMin(newval, 100.0);
- newval = newval / m_keyframeFactor;
+ newval = newval / m_keyframeFactor + m_keyframeOffset;
if (m_editedKeyframe != newpos)
m_keyframes.remove(m_editedKeyframe);
m_keyframes[newpos] = (int) newval;
if (m_editedKeyframe != newpos)
m_keyframes.remove(m_editedKeyframe);
m_keyframes[newpos] = (int) newval;
{
QRectF br = sceneBoundingRect();
double maxh = 100.0 / br.height() / m_keyframeFactor;
{
QRectF br = sceneBoundingRect();
double maxh = 100.0 / br.height() / m_keyframeFactor;
- int newval = (br.bottom() - value) * maxh;
+ int newval = (br.bottom() - value) * maxh + m_keyframeOffset;
//kDebug() << "Rect: " << br << "/ SCENE: " << sceneBoundingRect() << ", VALUE: " << value << ", MAX: " << maxh << ", NEWVAL: " << newval;
int newpos = (int) pos.frames(m_fps) ;
m_keyframes[newpos] = newval;
//kDebug() << "Rect: " << br << "/ SCENE: " << sceneBoundingRect() << ", VALUE: " << value << ", MAX: " << maxh << ", NEWVAL: " << newval;
int newpos = (int) pos.frames(m_fps) ;
m_keyframes[newpos] = newval;
GenTime m_startPos;*/
GenTime m_maxDuration;
QMap <int, int> m_keyframes;
GenTime m_startPos;*/
GenTime m_maxDuration;
QMap <int, int> m_keyframes;
+ /** @brief Strech factor so that keyframes display on the full clip height. */
+ /** @brief Offset factor so that keyframes minimum value are displaed at the bottom of the clip. */
+ double m_keyframeOffset;
+ /** @brief Default reset value for keyframe. */
double m_keyframeDefault;
/** The (keyframe) parameter that is visible and editable in timeline (on the clip) */
int m_visibleParam;
double m_keyframeDefault;
/** The (keyframe) parameter that is visible and editable in timeline (on the clip) */
int m_visibleParam;
double max = e.attribute("max").toDouble();
double min = e.attribute("min").toDouble();
m_keyframeFactor = 100.0 / (max - min);
double max = e.attribute("max").toDouble();
double min = e.attribute("min").toDouble();
m_keyframeFactor = 100.0 / (max - min);
+ m_keyframeOffset = min;
m_keyframeDefault = e.attribute("default").toDouble();
m_selectedKeyframe = 0;
// parse keyframes
m_keyframeDefault = e.attribute("default").toDouble();
m_selectedKeyframe = 0;
// parse keyframes
double max = e.attribute("max").toDouble();
double min = e.attribute("min").toDouble();
m_keyframeFactor = 100.0 / (max - min);
double max = e.attribute("max").toDouble();
double min = e.attribute("min").toDouble();
m_keyframeFactor = 100.0 / (max - min);
+ m_keyframeOffset = min;
m_keyframeDefault = e.attribute("default").toDouble();
m_selectedKeyframe = 0;
m_keyframeDefault = e.attribute("default").toDouble();
m_selectedKeyframe = 0;
m_slidersLayout->addWidget(doubleparam, columnId, 0);
QRadioButton *radio = new QRadioButton(this);
m_slidersLayout->addWidget(doubleparam, columnId, 0);
QRadioButton *radio = new QRadioButton(this);
+ radio->setToolTip(i18n("Show %1 in timeline").arg(paramName));
m_showButtons->addButton(radio, columnId);
if (e.attribute("intimeline") == "1")
radio->setChecked(true);
m_showButtons->addButton(radio, columnId);
if (e.attribute("intimeline") == "1")
radio->setChecked(true);
- QVBoxLayout *radioLayout = new QVBoxLayout(this);
+ QVBoxLayout *radioLayout = new QVBoxLayout;
radioLayout->addWidget(radio, 0, Qt::AlignTop);
m_slidersLayout->addLayout(radioLayout, columnId, 1);
radioLayout->addWidget(radio, 0, Qt::AlignTop);
m_slidersLayout->addLayout(radioLayout, columnId, 1);