if (effect.hasAttribute("src")) parameters.addParam("src", effect.attribute("src"));
if (effect.hasAttribute("disable")) parameters.addParam("disable", effect.attribute("disable"));
-
QString effectId = effect.attribute("id");
if (effectId.isEmpty()) effectId = effect.attribute("tag");
parameters.addParam("id", effectId);
+ // special case: the affine effect need in / out points
+ if (effectId == "pan_zoom") {
+ parameters.addParam("in", QString::number(cropStart().frames(m_fps)));
+ parameters.addParam("out", QString::number((cropStart() + cropDuration()).frames(m_fps)));
+ }
+
QDomNodeList params = effect.elementsByTagName("parameter");
int fade = 0;
for (int i = 0; i < params.count(); i++) {
{
EffectsParameterList parameters;
parameters.addParam("tag", effect.attribute("tag"));
+ if (effect.hasAttribute("region")) parameters.addParam("region", effect.attribute("region"));
parameters.addParam("kdenlive_ix", effect.attribute("kdenlive_ix"));
parameters.addParam("id", effect.attribute("id"));
if (effect.hasAttribute("src")) parameters.addParam("src", effect.attribute("src"));
if (effect.hasAttribute("disable")) parameters.addParam("disable", effect.attribute("disable"));
+ if (effect.hasAttribute("in")) parameters.addParam("in", effect.attribute("in"));
+ if (effect.hasAttribute("out")) parameters.addParam("out", effect.attribute("out"));
QDomNodeList params = effect.elementsByTagName("parameter");
for (int i = 0; i < params.count(); i++) {
m_commandStack->push(command);
}
+void CustomTrackView::slotUpdateClipRegion(ClipItem *clip, int ix, QString region)
+{
+ QDomElement effect = clip->getEffectAt(ix);
+ QDomElement oldeffect = effect.cloneNode().toElement();
+ effect.setAttribute("region", region);
+ EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), oldeffect, effect, ix, true);
+ m_commandStack->push(command);
+}
+
ClipItem *CustomTrackView::cutClip(ItemInfo info, GenTime cutTime, bool cut, bool execute)
{
if (cut) {
void CustomTrackView::setCursorPos(int pos, bool seek)
{
+ kDebug() << "SEEk TO: " << pos << ", SEEK: " << seek;
if (pos == m_cursorPos) return;
emit cursorMoved((int)(m_cursorPos), (int)(pos));
m_cursorPos = pos;
}
}
}
+
+ effectPos = item->hasEffect("affine", "pan_zoom");
+ if (effectPos != -1) {
+ QDomElement oldeffect = item->effectAt(effectPos);
+ int start = item->cropStart().frames(m_document->fps());
+ int max = start + item->cropDuration().frames(m_document->fps());
+ oldeffect.setAttribute("in", start);
+ oldeffect.setAttribute("out", max);
+ if (!m_document->renderer()->mltEditEffect(m_document->tracksCount() - item->track(), item->startPos(), item->getEffectArgs(oldeffect)))
+ emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
+ // if effect is displayed, update the effect edit widget with new clip duration
+ if (item->isSelected() && effectPos == item->selectedEffectIndex()) emit clipItemSelected(item, effectPos);
+ }
}
double CustomTrackView::getSnapPointForPos(double pos)
void splitAudio();
/** @brief Seperates the audio of a clip to a audio track.
- * @param pos Position of the clip to split
+ * @param pos Position of the clip to split
* @param track Track of the clip
* @param split Split or unsplit */
void doSplitAudio(const GenTime &pos, int track, bool split);
void slotChangeEffectState(ClipItem *clip, int effectPos, bool disable);
void slotChangeEffectPosition(ClipItem *clip, int currentPos, int newPos);
void slotUpdateClipEffect(ClipItem *clip, QDomElement oldeffect, QDomElement effect, int ix);
+ void slotUpdateClipRegion(ClipItem *clip, int ix, QString region);
void slotRefreshEffects(ClipItem *clip);
void setDuration(int duration);
void slotAddTransition(ClipItem* clip, ItemInfo transitionInfo, int endTrack, QDomElement transition = QDomElement());
m_params.setAttribute(name, value);
}
-void EffectStackEdit::transferParamDesc(const QDomElement d, int in, int out)
+void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, int out)
{
clearAllItems();
if (m_keyframeEditor) delete m_keyframeEditor;
m_valueItems[paramName+"complex"] = pl;
connect(pl, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
} else if (type == "geometry") {
- Geometryval *geo = new Geometryval(m_profile, m_timecode, m_frameSize, m_in);
+ Geometryval *geo = new Geometryval(m_profile, m_timecode, m_frameSize, pos);
if (minFrame == maxFrame) geo->setupParam(pa, m_in, m_out);
else geo->setupParam(pa, minFrame, maxFrame);
m_vbox->addWidget(geo);
m_valueItems[paramName+"geometry"] = geo;
connect(geo, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
- connect(geo, SIGNAL(seekToPos(int)), this, SLOT(slotSeekToPos(int)));
+ connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
} else if (type == "keyframe" || type == "simplekeyframe") {
// keyframe editor widget
kDebug() << "min: " << m_in << ", MAX: " << m_out;
m_valueItems[paramName+"keyframe"] = geo;
m_keyframeEditor = geo;
connect(geo, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
- connect(geo, SIGNAL(seekToPos(int)), this, SLOT(slotSeekToPos(int)));
+ connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
} else {
// we already have a keyframe editor, so just add another column for the new param
m_keyframeEditor->addParameter(pa);
m_vbox->addStretch();
}
-void EffectStackEdit::slotSeekToPos(int pos)
-{
- emit seekTimeline(pos);
-}
-
wipeInfo EffectStackEdit::getWipeInfo(QString value)
{
wipeInfo info;
KeyframeEdit *m_keyframeEditor;
public slots:
- void transferParamDesc(const QDomElement, int , int);
+ /** \brief Called when an effect is selected, builds the UI for this effect */
+ void transferParamDesc(const QDomElement, int, int , int);
void slotSliderMoved(int);
/** \brief Called whenever(?) some parameter is changed in the gui.
*
* Transfers all Dynamic gui parameter settings into m_params(??) */
void collectAllParameters();
-private slots:
- void slotSeekToPos(int);
-
signals:
void parameterChanged(const QDomElement, const QDomElement);
void seekTimeline(int);
#include "clipitem.h"
#include "mainwindow.h"
#include "docclipbase.h"
+#include "projectlist.h"
+#include "kthumb.h"
#include "kdenlivesettings.h"
#include <KDebug>
#include <KLocale>
#include <KMessageBox>
#include <KStandardDirs>
+#include <KFileDialog>
#include <QMenu>
#include <QTextStream>
vbox1->setSpacing(0);
vbox1->addWidget(m_effectedit);
m_ui.frame->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
+ m_ui.region_url->fileDialog()->setFilter(ProjectList::getExtensions());
//m_ui.effectlist->horizontalHeader()->setVisible(false);
//m_ui.effectlist->verticalHeader()->setVisible(false);
m_clipref = NULL;
m_ui.effectlist->setDragDropMode(QAbstractItemView::NoDragDrop); //use internal if drop is recognised right
+ connect(m_ui.region_url, SIGNAL(urlSelected(const KUrl &)), this , SLOT(slotRegionChanged()));
+ connect(m_ui.region_url, SIGNAL(returnPressed()), this , SLOT(slotRegionChanged()));
connect(m_ui.effectlist, SIGNAL(itemSelectionChanged()), this , SLOT(slotItemSelectionChanged()));
connect(m_ui.effectlist, SIGNAL(itemChanged(QListWidgetItem *)), this , SLOT(slotItemChanged(QListWidgetItem *)));
connect(m_ui.buttonUp, SIGNAL(clicked()), this, SLOT(slotItemUp()));
if (m_clipref == NULL) {
m_ui.effectlist->blockSignals(true);
m_ui.effectlist->clear();
- m_effectedit->transferParamDesc(QDomElement(), 0, 0);
+ m_effectedit->transferParamDesc(QDomElement(), 0, 0, 0);
+ m_ui.region_url->clear();
m_ui.effectlist->blockSignals(false);
setEnabled(false);
return;
{
bool disable = true;
if (item->checkState() == Qt::Checked) disable = false;
- m_ui.frame->setEnabled(!disable);
+ m_ui.frame_layout->setEnabled(!disable);
m_ui.buttonReset->setEnabled(!disable);
int activeRow = m_ui.effectlist->currentRow();
if (activeRow >= 0) {
m_ui.checkAll->setEnabled(true);
}
m_ui.effectlist->blockSignals(false);
- if (m_ui.effectlist->count() == 0) m_effectedit->transferParamDesc(QDomElement(), 0, 0);
+ if (m_ui.effectlist->count() == 0) {
+ m_effectedit->transferParamDesc(QDomElement(), 0, 0, 0);
+ m_ui.region_url->clear();
+ }
else slotItemSelectionChanged(false);
slotUpdateCheckAllButton();
}
bool isChecked = false;
if (hasItem && m_ui.effectlist->currentItem()->checkState() == Qt::Checked) isChecked = true;
if (hasItem && m_ui.effectlist->currentItem()->isSelected()) {
- m_effectedit->transferParamDesc(m_clipref->effectAt(activeRow),
+ QDomElement eff = m_clipref->effectAt(activeRow);
+ m_effectedit->transferParamDesc(eff,
+ 0,
m_clipref->cropStart().frames(KdenliveSettings::project_fps()),
- m_clipref->cropDuration().frames(KdenliveSettings::project_fps())); //minx max frame
+ (m_clipref->cropStart() + m_clipref->cropDuration()).frames(KdenliveSettings::project_fps())); //minx max frame
+ m_ui.region_url->setText(eff.attribute("region"));
}
if (m_clipref && update) m_clipref->setSelectedEffect(activeRow);
m_ui.buttonDel->setEnabled(hasItem);
m_ui.buttonReset->setEnabled(hasItem && isChecked);
m_ui.buttonUp->setEnabled(activeRow > 0);
m_ui.buttonDown->setEnabled((activeRow < m_ui.effectlist->count() - 1) && hasItem);
- m_ui.frame->setEnabled(isChecked);
+ m_ui.frame_layout->setEnabled(isChecked);
}
void EffectStackView::slotItemUp()
if (!dom.isNull()) {
dom.setAttribute("kdenlive_ix", old.attribute("kdenlive_ix"));
m_clipref->initEffect(dom);
- m_effectedit->transferParamDesc(dom, m_clipref->cropStart().frames(KdenliveSettings::project_fps()), m_clipref->cropDuration().frames(KdenliveSettings::project_fps()));//minx max frame
+ m_effectedit->transferParamDesc(dom, 0, m_clipref->cropStart().frames(KdenliveSettings::project_fps()), (m_clipref->cropStart() + m_clipref->cropDuration()).frames(KdenliveSettings::project_fps()));//minx max frame
+ m_ui.region_url->setText(dom.attribute("region"));
emit updateClipEffect(m_clipref, old, dom, activeRow);
}
}
m_ui.buttonUp->setEnabled(false);
m_ui.buttonDown->setEnabled(false);
m_ui.checkAll->setEnabled(false);
- m_effectedit->transferParamDesc(QDomElement(), 0, 0);
+ m_effectedit->transferParamDesc(QDomElement(), 0, 0, 0);
+ m_ui.region_url->clear();
m_ui.effectlist->blockSignals(false);
}
m_ui.effectlist->item(i)->setCheckState((Qt::CheckState)state);
}
+void EffectStackView::slotRegionChanged()
+{
+ emit updateClipRegion(m_clipref, m_ui.effectlist->currentRow(), m_ui.region_url->text());
+}
+
#include "effectstackview.moc"
* @param c Clip whose effect list should be managed
* @param ix Effect to preselect */
void slotClipItemSelected(ClipItem* c, int ix);
-
+
/** @brief Emits updateClipEffect.
* @param old Old effect information
* @param e New effect information
/** @brief Sets the check state of all effects according to @param state. */
void slotCheckAll(int state);
+ /** @brief Define the region filter for current effect. */
+ void slotRegionChanged();
+
signals:
void removeEffect(ClipItem*, QDomElement);
/** Parameters for an effect changed, update the filter in playlist */
void reloadEffects();
/** An effect with position parameter was changed, seek */
void seekTimeline(int);
+ /** The region effect for current effect was changed */
+ void updateClipRegion(ClipItem*, int, QString);
};
#endif
connect(m_effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement, int)), trackView->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement, int)));
+ connect(m_effectStack, SIGNAL(updateClipRegion(ClipItem*, int, QString)), trackView->projectView(), SLOT(slotUpdateClipRegion(ClipItem*, int, QString)));
connect(m_effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
connect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, bool)), trackView->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, bool)));
connect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, int)), trackView->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, int)));
KShortcutsDialog dialog(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, this);
dialog.addCollection(actionCollection(), i18nc("general keyboard shortcuts", "General"));
dialog.addCollection(m_effectsActionCollection, i18nc("effects and transitions keyboard shortcuts", "Effects & Transitions"));
- dialog.configure();
+ dialog.configure();
}
void MainWindow::slotPreferences(int page, int option)
void queryQuit();
void activateDocument();
void connectDocument(TrackView*, KdenliveDoc*);
-
+
/** @brief Shows file open dialog. */
void openFile();
void openLastFile();
void slotUpdateZoomSliderToolTip(int zoomlevel);
/** @brief Displays the zoom slider tooltip.
- * @param zoomlevel (optional) The zoom level to show in the tooltip.
+ * @param zoomlevel (optional) The zoom level to show in the tooltip.
*
* Adopted from Dolphin (src/statusbar/dolphinstatusbar.cpp) */
void slotShowZoomSliderToolTip(int zoomlevel = -1);
void Render::emitFrameNumber(double position)
{
+ if (position == m_framePosition) return;
m_framePosition = position;
emit rendererPosition((int) position);
- //if (qApp->activeWindow()) QApplication::postEvent(qApp->activeWindow(), new PositionChangeEvent( GenTime((int) position, m_fps), m_monitorId));
}
void Render::emitConsumerStopped()
if (filter && filter->is_valid()) {
filter->set("kdenlive_id", filterId);
if (!region.isEmpty()) {
- char *filterResource = decodedString(region);
- filter->set("resource", filterResource);
+ char *tmp = decodedString(region);
+ filter->set("resource", tmp);
+ tmp = decodedString(params.paramValue("kdenlive_ix"));
+ filter->set("kdenlive_ix", tmp);
filter->set("filter0", filterTag);
prefix = "filter0.";
- delete[] filterResource;
+ delete[] tmp;
+ params.removeParam("id");
+ params.removeParam("region");
+ params.removeParam("kdenlive_ix");
}
} else {
kDebug() << "filter is NULL";
{
QString index = params.paramValue("kdenlive_ix");
QString tag = params.paramValue("tag");
- QString region = params.paramValue("region");
- if (!params.paramValue("keyframes").isEmpty() || /*it.key().startsWith("#") || */tag.startsWith("ladspa") || tag == "sox" || tag == "autotrack_rectangle" || !region.isEmpty()) {
+ if (!params.paramValue("keyframes").isEmpty() || /*it.key().startsWith("#") || */tag.startsWith("ladspa") || tag == "sox" || tag == "autotrack_rectangle" || params.hasParam("region")) {
// This is a keyframe effect, to edit it, we remove it and re-add it.
mltRemoveEffect(track, position, index, false);
bool success = mltAddEffect(track, position, params);
m_isBlocked = false;
return success;
}
+ QString prefix;
+ QString ser = filter->get("mlt_service");
+ if (ser == "region") prefix = "filter0.";
mlt_service_lock(service.get_service());
for (int j = 0; j < params.count(); j++) {
- char *name = decodedString(params.at(j).name());
+ char *name = decodedString(prefix + params.at(j).name());
char *value = decodedString(params.at(j).value());
filter->set(name, value);
delete[] name;
connect(transitionList, SIGNAL(activated(int)), this, SLOT(slotTransitionChanged()));
connect(transitionTrack, SIGNAL(activated(int)), this, SLOT(slotTransitionTrackChanged()));
-
- connect(this, SIGNAL(transferParamDesc(const QDomElement&, int , int)), m_effectEdit , SLOT(transferParamDesc(const QDomElement&, int , int)));
connect(m_effectEdit, SIGNAL(parameterChanged(const QDomElement&, const QDomElement&)), this , SLOT(slotUpdateEffectParams(const QDomElement&, const QDomElement&)));
}
void TransitionSettings::slotTransitionChanged(bool reinit, bool updateCurrent)
{
QDomElement e = m_usedTransition->toXML().cloneNode().toElement();
+ int start = m_usedTransition->startPos().frames(KdenliveSettings::project_fps());
+ int end = m_usedTransition->endPos().frames(KdenliveSettings::project_fps());
if (reinit) {
// Reset the transition parameters to the default one
QDomElement newTransition = MainWindow::transitions.getEffectByName(transitionList->currentText()).cloneNode().toElement();
slotUpdateEffectParams(e, newTransition);
- emit transferParamDesc(newTransition, m_usedTransition->startPos().frames(KdenliveSettings::project_fps()), m_usedTransition->endPos().frames(KdenliveSettings::project_fps()));
+ m_effectEdit->transferParamDesc(newTransition, start, start, end);
} else if (!updateCurrent) {
// Transition changed, update parameters dialog
//slotUpdateEffectParams(e, e);
- m_effectEdit->transferParamDesc(e, m_usedTransition->startPos().frames(KdenliveSettings::project_fps()), m_usedTransition->endPos().frames(KdenliveSettings::project_fps()));
+ m_effectEdit->transferParamDesc(e, start, start, end);
} else {
// Same transition, we just want to update the parameters value
slotUpdateEffectParams(e, e);
- if (m_usedTransition->hasGeometry()) emit transferParamDesc(m_usedTransition->toXML(), m_usedTransition->startPos().frames(KdenliveSettings::project_fps()), m_usedTransition->endPos().frames(KdenliveSettings::project_fps()));
+ if (m_usedTransition->hasGeometry()) m_effectEdit->transferParamDesc(m_usedTransition->toXML(), start, start, end);
}
}
} else {
// null transition selected
m_usedTransition = NULL;
- m_effectEdit->transferParamDesc(QDomElement(), 0, 0);
+ m_effectEdit->transferParamDesc(QDomElement(), 0, 0, 0);
}
}
signals:
void transitionUpdated(Transition *, QDomElement);
- void transferParamDesc(const QDomElement&, int , int);
void seekTimeline(int);
};
<rect>
<x>0</x>
<y>0</y>
- <width>415</width>
- <height>344</height>
+ <width>448</width>
+ <height>248</height>
</rect>
</property>
<property name="sizePolicy">
</item>
</layout>
</widget>
- <widget class="QFrame" name="frame">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
+ <widget class="QWidget" name="">
+ <layout class="QVBoxLayout" name="frame_layout">
+ <item>
+ <widget class="QFrame" name="frame">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KUrlRequester" name="region_url">
+ <property name="clickMessage">
+ <string>Set filter region</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
+ <customwidget>
+ <class>KUrlRequester</class>
+ <extends>QFrame</extends>
+ <header>kurlrequester.h</header>
+ </customwidget>
<customwidget>
<class>KListWidget</class>
<extends>QListWidget</extends>