void Geometryval::slotDeleteFrame(int pos) { // check there is more than one keyframe Mlt::GeometryItem item; int frame = m_timePos.getValue(); if (pos == -1) pos = frame; int error = m_geom->next_key(&item, pos + 1); if (error) { error = m_geom->prev_key(&item, pos - 1); if (error || item.frame() == pos) return; } m_geom->remove(frame); buttonAdd->setEnabled(true); buttonDelete->setEnabled(false); widget->setEnabled(false); spinTransp->setEnabled(false); frameOptions->setEnabled(false); m_reset->setEnabled(false); m_helper->update(); slotPositionChanged(pos, false); updateTransitionPath(); emit parameterChanged(); }
void Geometryval::setupParam(const QDomElement par, int minFrame, int maxFrame) { QString val = par.attribute("value"); if (par.attribute("fixed") == "1") { m_fixedMode = true; buttonPrevious->setHidden(true); buttonNext->setHidden(true); buttonDelete->setHidden(true); buttonAdd->setHidden(true); spinTransp->setMaximum(500); label_pos->setHidden(true); m_helper->setHidden(true); m_timePos.setHidden(true); } if (par.attribute("opacity") == "false") { label_opacity->setHidden(true); spinTransp->setHidden(true); } if (m_geom) m_geom->parse(val.toUtf8().data(), maxFrame - minFrame, m_profile->width(), m_profile->height()); else m_geom = new Mlt::Geometry(val.toUtf8().data(), maxFrame - minFrame, m_profile->width(), m_profile->height()); ////qDebug() << " / / UPDATING TRANSITION VALUE: " << m_geom->serialise(); //read param her and set rect if (!m_fixedMode) { m_helper->setKeyGeometry(m_geom, maxFrame - minFrame - 1); m_helper->update(); /*QDomDocument doc; doc.appendChild(doc.importNode(par, true)); //qDebug() << "IMPORTED TRANS: " << doc.toString();*/ if (m_path == NULL) { m_path = new QGraphicsPathItem(); m_path->setPen(QPen(Qt::red)); m_scene->addItem(m_path); } updateTransitionPath(); } Mlt::GeometryItem item; m_geom->fetch(&item, 0); delete m_paramRect; m_paramRect = new QGraphicsRectItem(QRectF(0, 0, item.w() * m_dar, item.h())); m_paramRect->setPos(item.x() * m_dar, item.y()); m_paramRect->setZValue(0); m_paramRect->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable); m_paramRect->setPen(QPen(QBrush(QColor(255, 0, 0, 255)), 1.0)); m_scene->addItem(m_paramRect); slotPositionChanged(0, false); slotUpdateGeometry(); if (!m_fixedMode) { m_timePos.setRange(0, maxFrame - minFrame - 1); connect(&m_timePos, SIGNAL(timeCodeEditingFinished()), this , SLOT(slotPositionChanged())); } connect(spinTransp, SIGNAL(valueChanged(int)), this , SLOT(slotTransparencyChanged(int))); }
void Geometryval::setupParam(const QDomElement& par, int minFrame, int maxFrame) { m_param = par; QString val = par.attribute("value"); if (par.attribute("fixed") == "1") { m_fixedMode = true; m_ui.buttonPrevious->setHidden(true); m_ui.buttonNext->setHidden(true); m_ui.buttonDelete->setHidden(true); m_ui.buttonAdd->setHidden(true); m_ui.spinTransp->setMaximum(500); m_ui.label_pos->setHidden(true); m_helper->setHidden(true); m_ui.spinPos->setHidden(true); } char *tmp = (char *) qstrdup(val.toUtf8().data()); if (m_geom) m_geom->parse(tmp, maxFrame - minFrame, m_profile.width, m_profile.height); else m_geom = new Mlt::Geometry(tmp, maxFrame - minFrame, m_profile.width, m_profile.height); delete[] tmp; //kDebug() << " / / UPDATING TRANSITION VALUE: " << m_geom->serialise(); //read param her and set rect if (!m_fixedMode) { m_helper->setKeyGeometry(m_geom, maxFrame - minFrame - 1); m_helper->update(); /*QDomDocument doc; doc.appendChild(doc.importNode(par, true)); kDebug() << "IMPORTED TRANS: " << doc.toString();*/ m_ui.spinPos->setMaximum(maxFrame - minFrame - 1); if (m_path == NULL) { m_path = new QGraphicsPathItem(); m_path->setPen(QPen(Qt::red)); m_scene->addItem(m_path); } updateTransitionPath(); } Mlt::GeometryItem item; m_geom->fetch(&item, 0); delete m_paramRect; m_paramRect = new QGraphicsRectItem(QRectF(0, 0, item.w(), item.h())); m_paramRect->setPos(item.x(), item.y()); m_paramRect->setZValue(0); m_paramRect->setPen(QPen(QBrush(QColor(255, 0, 0, 255)), 1.0)); m_scene->addItem(m_paramRect); slotPositionChanged(0, false); if (!m_fixedMode) { connect(m_ui.spinPos, SIGNAL(valueChanged(int)), this , SLOT(slotPositionChanged(int))); }
void Geometryval::slotUpdateTransitionProperties() { int pos = m_timePos.getValue(); Mlt::GeometryItem item; int error = m_geom->next_key(&item, pos); if (error || item.frame() != pos) { // no keyframe under cursor return; } 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()); m_geom->insert(item); updateTransitionPath(); emit parameterChanged(); }
void Geometryval::slotDeleteFrame() { // check there is more than one keyframe Mlt::GeometryItem item; const int pos = m_ui.spinPos->value(); int error = m_geom->next_key(&item, pos + 1); if (error) { error = m_geom->prev_key(&item, pos - 1); if (error || item.frame() == pos) return; } m_geom->remove(m_ui.spinPos->value()); 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); m_helper->update(); slotPositionChanged(pos, false); updateTransitionPath(); emit parameterChanged(); }