Пример #1
0
void Geometryval::slotPositionChanged(int pos, bool seek)
{
    if (seek && KdenliveSettings::transitionfollowcursor()) emit seekToPos(pos);
    m_ui.spinPos->setValue(pos);
    m_helper->setValue(pos);
    Mlt::GeometryItem item;
    int error = m_geom->fetch(&item, pos);
    if (error || item.key() == false) {
        // no keyframe under cursor, adjust buttons
        m_ui.buttonAdd->setEnabled(true);
        m_ui.buttonDelete->setEnabled(false);
        m_ui.widget->setEnabled(false);
        m_ui.spinTransp->setEnabled(false);
        m_scaleMenu->setEnabled(false);
        m_alignMenu->setEnabled(false);
    } else {
        m_ui.buttonAdd->setEnabled(false);
        m_ui.buttonDelete->setEnabled(true);
        m_ui.widget->setEnabled(true);
        m_ui.spinTransp->setEnabled(true);
        m_scaleMenu->setEnabled(true);
        m_alignMenu->setEnabled(true);
    }
    m_paramRect->setPos(item.x(), item.y());
    m_paramRect->setRect(0, 0, item.w(), item.h());
    m_ui.spinTransp->setValue(item.mix());
    m_paramRect->setBrush(QColor(255, 0, 0, item.mix()));
}
Пример #2
0
void Geometryval::slotTransparencyChanged(int transp)
{
    int pos = m_ui.spinPos->value();
    Mlt::GeometryItem item;
    int error = m_geom->fetch(&item, pos);
    if (error || item.key() == false) {
        // no keyframe under cursor
        return;
    }
    item.mix(transp);
    m_paramRect->setBrush(QColor(255, 0, 0, transp));
    m_geom->insert(item);
    emit parameterChanged();
}
Пример #3
0
void Geometryval::slotPositionChanged(int pos, bool seek)
{
    if (pos == -1) {
        pos = m_timePos.getValue();
    }
    if (seek && KdenliveSettings::transitionfollowcursor()) emit seekToPos(pos + m_startPoint);
    m_timePos.setValue(pos);
    //spinPos->setValue(pos);
    m_helper->blockSignals(true);
    m_helper->setValue(pos);
    m_helper->blockSignals(false);
    Mlt::GeometryItem item;
    int error = m_geom->fetch(&item, pos);
    if (error || item.key() == false) {
        // no keyframe under cursor, adjust buttons
        buttonAdd->setEnabled(true);
        buttonDelete->setEnabled(false);
        widget->setEnabled(false);
        spinTransp->setEnabled(false);
        frameOptions->setEnabled(false);
        m_reset->setEnabled(false);
    } else {
        buttonAdd->setEnabled(false);
        buttonDelete->setEnabled(true);
        widget->setEnabled(true);
        spinTransp->setEnabled(true);
        frameOptions->setEnabled(true);
        m_reset->setEnabled(true);
    }

    m_paramRect->setPos(item.x() * m_dar, item.y());
    m_paramRect->setRect(0, 0, item.w() * m_dar, item.h());
    spinTransp->setValue(item.mix());
    m_paramRect->setBrush(QColor(255, 0, 0, item.mix()));
    slotUpdateGeometry();
}
Пример #4
0
// virtual
void KeyframeHelper::mousePressEvent(QMouseEvent * event)
{
    m_hoverKeyframe = -1;
    if (event->button() != Qt::LeftButton) {
        QWidget::mousePressEvent(event);
        return;
    }
    int xPos = event->x() - margin;
    int headOffset = m_lineHeight / 1.5;
    if (m_geom != NULL && (event->y() <= headOffset)) {
        // check if we want to move a keyframe
        int mousePos = qMax((int)(xPos / m_scale), 0) + m_offset;
        Mlt::GeometryItem item;
        if (m_geom->next_key(&item, mousePos) == 0) {
            if (qAbs((item.frame() - m_offset)* m_scale - xPos) < headOffset) {
                m_movingItem.x(item.x());
                m_movingItem.y(item.y());
                m_movingItem.w(item.w());
                m_movingItem.h(item.h());
                m_movingItem.mix(item.mix());
                m_movingItem.frame(item.frame());

                while (!m_extraMovingItems.isEmpty()) {
                    Mlt::GeometryItem *gitem = m_extraMovingItems.takeFirst();
                    if (gitem) delete gitem;
                }
                for (int i = 0; i < m_extraGeometries.count(); ++i) {
                    if (m_extraGeometries.at(i)->next_key(item, mousePos) == 0) {
                        Mlt::GeometryItem *item2 = new Mlt::GeometryItem();
                        item2->x(item.x());
                        item2->frame(item.frame());
                        m_extraMovingItems.append(item2);
                    } else {
                        m_extraMovingItems.append(NULL);
                    }
                }
                m_dragStart = event->pos();
                return;
            }
        }
    }
    int seekRequest = xPos / m_scale;
    if (seekRequest != m_position) {
        m_seekPosition = seekRequest;
        emit requestSeek(m_seekPosition);
        update();
    }
}
Пример #5
0
void Geometryval::slotAddFrame()
{
    int pos = m_ui.spinPos->value();
    Mlt::GeometryItem item;
    item.frame(pos);
    item.x(m_paramRect->pos().x());
    item.y(m_paramRect->pos().y());
    item.w(m_paramRect->rect().width());
    item.h(m_paramRect->rect().height());
    item.mix(m_ui.spinTransp->value());
    m_geom->insert(item);
    m_ui.buttonAdd->setEnabled(false);
    m_ui.buttonDelete->setEnabled(true);
    m_ui.widget->setEnabled(true);
    m_ui.spinTransp->setEnabled(true);
    m_scaleMenu->setEnabled(true);
    m_alignMenu->setEnabled(true);
    m_helper->update();
    emit parameterChanged();
}
Пример #6
0
void Geometryval::slotAddFrame(int pos)
{
    int frame = m_timePos.getValue();
    if (pos == -1) pos = frame;
    Mlt::GeometryItem item;
    item.frame(pos);
    QRectF r = m_paramRect->rect().normalized();
    QPointF rectpos = m_paramRect->pos();
    item.x(rectpos.x() / m_dar);
    item.y(rectpos.y());
    item.w(r.width() / m_dar);
    item.h(r.height());
    item.mix(spinTransp->value());
    m_geom->insert(item);
    buttonAdd->setEnabled(false);
    buttonDelete->setEnabled(true);
    widget->setEnabled(true);
    spinTransp->setEnabled(true);
    frameOptions->setEnabled(true);
    m_reset->setEnabled(true);
    m_helper->update();
    emit parameterChanged();
}