svn path=/trunk/kdenlive/; revision=3580
13 files changed:
{
if (scene() == NULL) return;
QRectF r = boundingRect();
{
if (scene() == NULL) return;
QRectF r = boundingRect();
- double width = pix.width() / projectScene()->scale();
+ double width = pix.width() / projectScene()->scale().x();
if (m_startThumbRequested && frame == cropStart().frames(m_fps)) {
m_startPix = pix;
m_startThumbRequested = false;
if (m_startThumbRequested && frame == cropStart().frames(m_fps)) {
m_startPix = pix;
m_startThumbRequested = false;
if (m_editedKeyframe != -1) return KEYFRAME;
}
QRectF rect = sceneBoundingRect();
if (m_editedKeyframe != -1) return KEYFRAME;
}
QRectF rect = sceneBoundingRect();
- const double scale = projectScene()->scale();
+ const double scale = projectScene()->scale().x();
double maximumOffset = 6 / scale;
if (qAbs((int)(pos.x() - (rect.x() + m_startFade))) < maximumOffset && qAbs((int)(pos.y() - rect.y())) < 6) {
double maximumOffset = 6 / scale;
if (qAbs((int)(pos.x() - (rect.x() + m_startFade))) < maximumOffset && qAbs((int)(pos.y() - rect.y())) < 6) {
if (isItemLocked()) return;
m_hover = true;
QRectF r = boundingRect();
if (isItemLocked()) return;
m_hover = true;
QRectF r = boundingRect();
- double width = 35 / projectScene()->scale();
+ double width = 35 / projectScene()->scale().x();
double height = r.height() / 2;
//WARNING: seems like it generates a full repaint of the clip, maybe not so good...
update(r.x(), r.y() + height, width, height);
double height = r.height() / 2;
//WARNING: seems like it generates a full repaint of the clip, maybe not so good...
update(r.x(), r.y() + height, width, height);
if (isItemLocked()) return;
m_hover = false;
QRectF r = boundingRect();
if (isItemLocked()) return;
m_hover = false;
QRectF r = boundingRect();
- double width = 35 / projectScene()->scale();
+ double width = 35 / projectScene()->scale().x();
double height = r.height() / 2;
//WARNING: seems like it generates a full repaint of the clip, maybe not so good...
update(r.x(), r.y() + height, width, height);
double height = r.height() / 2;
//WARNING: seems like it generates a full repaint of the clip, maybe not so good...
update(r.x(), r.y() + height, width, height);
CustomTrackScene::CustomTrackScene(KdenliveDoc *doc, QObject *parent) :
QGraphicsScene(parent),
m_document(doc),
CustomTrackScene::CustomTrackScene(KdenliveDoc *doc, QObject *parent) :
QGraphicsScene(parent),
m_document(doc),
{
m_transitionPixmap = QPixmap(KStandardDirs::locate("appdata", "transition.png"));
}
{
m_transitionPixmap = QPixmap(KStandardDirs::locate("appdata", "transition.png"));
}
{
double maximumOffset;
if (doSnap) {
{
double maximumOffset;
if (doSnap) {
- if (m_scale > 3) maximumOffset = 10 / m_scale;
- else maximumOffset = 6 / m_scale;
+ if (m_scale.x() > 3) maximumOffset = 10 / m_scale.x();
+ else maximumOffset = 6 / m_scale.x();
for (int i = 0; i < m_snapPoints.size(); ++i) {
if (qAbs((int)(pos - m_snapPoints.at(i).frames(m_document->fps()))) < maximumOffset) {
return m_snapPoints.at(i).frames(m_document->fps());
for (int i = 0; i < m_snapPoints.size(); ++i) {
if (qAbs((int)(pos - m_snapPoints.at(i).frames(m_document->fps()))) < maximumOffset) {
return m_snapPoints.at(i).frames(m_document->fps());
-void CustomTrackScene::setScale(double scale)
+void CustomTrackScene::setScale(double scale, double vscale)
+ m_scale.setX(scale);
+ m_scale.setY(vscale);
-double CustomTrackScene::scale() const
+QPointF CustomTrackScene::scale() const
GenTime previousSnapPoint(GenTime pos);
GenTime nextSnapPoint(GenTime pos);
double getSnapPointForPos(double pos, bool doSnap = true);
GenTime previousSnapPoint(GenTime pos);
GenTime nextSnapPoint(GenTime pos);
double getSnapPointForPos(double pos, bool doSnap = true);
- void setScale(double scale);
- double scale() const;
+ void setScale(double scale, double vscale);
+ QPointF scale() const;
int tracksCount() const;
QPixmap m_transitionPixmap;
private:
KdenliveDoc *m_document;
QList <GenTime> m_snapPoints;
int tracksCount() const;
QPixmap m_transitionPixmap;
private:
KdenliveDoc *m_document;
QList <GenTime> m_snapPoints;
CustomTrackView::CustomTrackView(KdenliveDoc *doc, CustomTrackScene* projectscene, QWidget *parent) :
QGraphicsView(projectscene, parent),
CustomTrackView::CustomTrackView(KdenliveDoc *doc, CustomTrackScene* projectscene, QWidget *parent) :
QGraphicsView(projectscene, parent),
- m_tracksHeight(KdenliveSettings::defaulttrackheight()),
+ m_tracksHeight(KdenliveSettings::trackheight()),
m_projectDuration(0),
m_cursorPos(0),
m_document(doc),
m_projectDuration(0),
m_cursorPos(0),
m_document(doc),
return m_scene->m_tracksList;
}*/
return m_scene->m_tracksList;
}*/
-void CustomTrackView::checkTrackHeight(bool resetTrackHeight)
+void CustomTrackView::checkTrackHeight()
- if (resetTrackHeight) {
- KdenliveSettings::setTrackheight(KdenliveSettings::defaulttrackheight());
- }
if (m_tracksHeight == KdenliveSettings::trackheight()) return;
m_tracksHeight = KdenliveSettings::trackheight();
if (m_tracksHeight == KdenliveSettings::trackheight()) return;
m_tracksHeight = KdenliveSettings::trackheight();
- emit trackHeightChanged(resetTrackHeight);
+ emit trackHeightChanged();
QList<QGraphicsItem *> itemList = items();
ClipItem *item;
Transition *transitionitem;
QList<QGraphicsItem *> itemList = items();
ClipItem *item;
Transition *transitionitem;
-void CustomTrackView::setScale(double scaleFactor)
+void CustomTrackView::setScale(double scaleFactor, double verticalScale)
- matrix = matrix.scale(scaleFactor, 1);
- m_scene->setScale(scaleFactor);
+ matrix = matrix.scale(scaleFactor, verticalScale);
+ m_scene->setScale(scaleFactor, verticalScale);
+ kDebug() << "// Set SCALE: " << scaleFactor << "," << verticalScale;
//scale(scaleFactor, 1);
m_animationTimer->stop();
delete m_visualTip;
//scale(scaleFactor, 1);
m_animationTimer->stop();
delete m_visualTip;
void slotDeleteClipMarker(const QString &comment, const QString &id, const GenTime &position);
void slotDeleteAllClipMarkers(const QString &id);
void addMarker(const QString &id, const GenTime &pos, const QString comment);
void slotDeleteClipMarker(const QString &comment, const QString &id, const GenTime &position);
void slotDeleteAllClipMarkers(const QString &id);
void addMarker(const QString &id, const GenTime &pos, const QString comment);
- void setScale(double scaleFactor);
+ void setScale(double scaleFactor, double verticalScale);
void deleteClip(const QString &clipId);
void slotAddEffect(QDomElement effect, GenTime pos, int track);
void slotAddGroupEffect(QDomElement effect, AbstractGroupItem *group);
void deleteClip(const QString &clipId);
void slotAddEffect(QDomElement effect, GenTime pos, int track);
void slotAddGroupEffect(QDomElement effect, AbstractGroupItem *group);
void deleteSelectedClips();
void cutSelectedClips();
void setContextMenu(QMenu *timeline, QMenu *clip, QMenu *transition, QActionGroup *clipTypeGroup);
void deleteSelectedClips();
void cutSelectedClips();
void setContextMenu(QMenu *timeline, QMenu *clip, QMenu *transition, QActionGroup *clipTypeGroup);
- void checkTrackHeight(bool resetTrackHeight = false);
+ void checkTrackHeight();
//QList <TrackInfo> tracksList() const;
void setTool(PROJECTTOOL tool);
void cutClip(ItemInfo info, GenTime cutTime, bool cut);
//QList <TrackInfo> tracksList() const;
void setTool(PROJECTTOOL tool);
void cutClip(ItemInfo info, GenTime cutTime, bool cut);
void clipItemSelected(ClipItem*, int ix = -1);
void transitionItemSelected(Transition*, int track = 0, QPoint p = QPoint(), bool update = false);
void activateDocumentMonitor();
void clipItemSelected(ClipItem*, int ix = -1);
void transitionItemSelected(Transition*, int track = 0, QPoint p = QPoint(), bool update = false);
void activateDocumentMonitor();
- void trackHeightChanged(bool zoom);
+ void trackHeightChanged();
void displayMessage(const QString, MessageType);
void showClipFrame(DocClipBase *, const int);
void doTrackLock(int, bool);
void displayMessage(const QString, MessageType);
void showClipFrame(DocClipBase *, const int);
void doTrackLock(int, bool);
if (KdenliveSettings::showmarkers()) {
QRectF rect = QGraphicsLineItem::boundingRect();
rect.setLeft(line().x1());
if (KdenliveSettings::showmarkers()) {
QRectF rect = QGraphicsLineItem::boundingRect();
rect.setLeft(line().x1());
- rect.setWidth(m_width / static_cast <CustomTrackScene*>(scene())->scale());
+ rect.setWidth(m_width / static_cast <CustomTrackScene*>(scene())->scale().x());
return rect;
} else return QGraphicsLineItem::boundingRect();
}
return rect;
} else return QGraphicsLineItem::boundingRect();
}
if (KdenliveSettings::showmarkers()) {
const QFontMetrics metric = m_view->fontMetrics();
int height = metric.height();
if (KdenliveSettings::showmarkers()) {
const QFontMetrics metric = m_view->fontMetrics();
int height = metric.height();
- path.addRoundedRect(line().x1(), line().y1() + 10, m_width / static_cast <CustomTrackScene*>(scene())->scale(), height, 3, 3);
+ path.addRoundedRect(line().x1(), line().y1() + 10, m_width / static_cast <CustomTrackScene*>(scene())->scale().x(), height, 3, 3);
-#include "kdenlivesettings.h"
#include <KIcon>
#include <KLocale>
#include <KIcon>
#include <KLocale>
#include <QPainter>
#include <QAction>
#include <QPainter>
#include <QAction>
-HeaderTrack::HeaderTrack(int index, TrackInfo info, QWidget *parent) :
+HeaderTrack::HeaderTrack(int index, TrackInfo info, int height, QWidget *parent) :
QWidget(parent),
m_index(index),
m_type(info.type)
{
QWidget(parent),
m_index(index),
m_type(info.type)
{
- setFixedHeight(KdenliveSettings::trackheight());
+ setFixedHeight(height);
m_view.setupUi(this);
m_view.track_number->setText(QString::number(m_index));
m_view.setupUi(this);
m_view.track_number->setText(QString::number(m_index));
connect(m_view.buttonLock, SIGNAL(clicked()), this, SLOT(switchLock()));
// Don't show track buttons if size is too small
connect(m_view.buttonLock, SIGNAL(clicked()), this, SLOT(switchLock()));
// Don't show track buttons if size is too small
- if (KdenliveSettings::trackheight() < 40) {
m_view.buttonVideo->setHidden(true);
m_view.buttonAudio->setHidden(true);
m_view.buttonLock->setHidden(true);
m_view.buttonVideo->setHidden(true);
m_view.buttonAudio->setHidden(true);
m_view.buttonLock->setHidden(true);
- HeaderTrack(int index, TrackInfo info, QWidget *parent = 0);
+ HeaderTrack(int index, TrackInfo info, int height, QWidget *parent = 0);
~HeaderTrack();
void setLock(bool lock);
~HeaderTrack();
void setLock(bool lock);
<default>true</default>
</entry>
<default>true</default>
</entry>
- <entry name="defaulttrackheight" type="Int">
+ <entry name="trackheight" type="Int">
<label>Tracks height in pixel.</label>
<default>50</default>
</entry>
<label>Tracks height in pixel.</label>
<default>50</default>
</entry>
- <entry name="trackheight" type="Int">
- <label>Tracks height in pixel.</label>
- <default>50</default>
- </entry>
-
<entry name="project_display_ratio" type="Double">
<label>Current project display ratio.</label>
<default>1.7777778</default>
<entry name="project_display_ratio" type="Double">
<label>Current project display ratio.</label>
<default>1.7777778</default>
if (m_activeTimeline) {
m_activeTimeline->refresh();
m_activeTimeline->projectView()->checkAutoScroll();
if (m_activeTimeline) {
m_activeTimeline->refresh();
m_activeTimeline->projectView()->checkAutoScroll();
- m_activeTimeline->projectView()->checkTrackHeight(true);
+ m_activeTimeline->projectView()->checkTrackHeight();
if (m_activeDocument) m_activeDocument->clipManager()->checkAudioThumbs();
}
m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
if (m_activeDocument) m_activeDocument->clipManager()->checkAudioThumbs();
}
m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
tracksLayout->addWidget(m_trackview);
connect(m_trackview->verticalScrollBar(), SIGNAL(valueChanged(int)), m_view.headers_area->verticalScrollBar(), SLOT(setValue(int)));
tracksLayout->addWidget(m_trackview);
connect(m_trackview->verticalScrollBar(), SIGNAL(valueChanged(int)), m_view.headers_area->verticalScrollBar(), SLOT(setValue(int)));
- connect(m_trackview, SIGNAL(trackHeightChanged(bool)), this, SLOT(slotRebuildTrackHeaders(bool)));
+ connect(m_trackview, SIGNAL(trackHeightChanged()), this, SLOT(slotRebuildTrackHeaders()));
parseDocument(m_doc->toXml());
m_doc->setSceneList();
parseDocument(m_doc->toXml());
m_doc->setSceneList();
m_doc->setZoom(factor);
m_ruler->setPixelPerMark(factor);
m_scale = (double) FRAME_SIZE / m_ruler->comboScale[factor]; // m_ruler->comboScale[m_currentZoom] /
m_doc->setZoom(factor);
m_ruler->setPixelPerMark(factor);
m_scale = (double) FRAME_SIZE / m_ruler->comboScale[factor]; // m_ruler->comboScale[m_currentZoom] /
- m_trackview->setScale(m_scale);
+ m_trackview->setScale(m_scale, m_scene->scale().y());
}
int TrackView::fitZoom() const
}
int TrackView::fitZoom() const
m_trackview->viewport()->update();
}
m_trackview->viewport()->update();
}
-void TrackView::slotRebuildTrackHeaders(bool resetZoom)
+void TrackView::slotRebuildTrackHeaders()
{
// If the slot was triggered by a change in default track size, reset vertical zoom
{
// If the slot was triggered by a change in default track size, reset vertical zoom
- if (resetZoom) m_verticalZoom = 1;
QList <TrackInfo> list = m_doc->tracksList();
QLayoutItem *child;
while ((child = m_headersLayout->takeAt(0)) != 0) {
delete child;
}
int max = list.count();
QList <TrackInfo> list = m_doc->tracksList();
QLayoutItem *child;
while ((child = m_headersLayout->takeAt(0)) != 0) {
delete child;
}
int max = list.count();
+ int height = KdenliveSettings::trackheight() * m_scene->scale().y();
for (int i = 0; i < max; i++) {
for (int i = 0; i < max; i++) {
- HeaderTrack *header = new HeaderTrack(i, list.at(max - i - 1), this);
+ HeaderTrack *header = new HeaderTrack(i, list.at(max - i - 1), height, this);
connect(header, SIGNAL(switchTrackVideo(int)), m_trackview, SLOT(slotSwitchTrackVideo(int)));
connect(header, SIGNAL(switchTrackAudio(int)), m_trackview, SLOT(slotSwitchTrackAudio(int)));
connect(header, SIGNAL(switchTrackLock(int)), m_trackview, SLOT(slotSwitchTrackLock(int)));
connect(header, SIGNAL(switchTrackVideo(int)), m_trackview, SLOT(slotSwitchTrackVideo(int)));
connect(header, SIGNAL(switchTrackAudio(int)), m_trackview, SLOT(slotSwitchTrackAudio(int)));
connect(header, SIGNAL(switchTrackLock(int)), m_trackview, SLOT(slotSwitchTrackLock(int)));
{
if (m_verticalZoom == 0) return;
m_verticalZoom--;
{
if (m_verticalZoom == 0) return;
m_verticalZoom--;
- KdenliveSettings::setTrackheight(KdenliveSettings::trackheight() / 2);
- m_trackview->checkTrackHeight(false);
+ if (m_verticalZoom == 0) m_trackview->setScale(m_scene->scale().x(), 0.5);
+ else m_trackview->setScale(m_scene->scale().x(), 1);
+ slotRebuildTrackHeaders();
+ /*KdenliveSettings::setTrackheight(KdenliveSettings::trackheight() / 2);
+ m_trackview->checkTrackHeight(false);*/
}
void TrackView::slotVerticalZoomUp()
{
if (m_verticalZoom == 2) return;
m_verticalZoom++;
}
void TrackView::slotVerticalZoomUp()
{
if (m_verticalZoom == 2) return;
m_verticalZoom++;
- KdenliveSettings::setTrackheight(KdenliveSettings::trackheight() * 2);
- m_trackview->checkTrackHeight(false);
+ /*KdenliveSettings::setTrackheight(KdenliveSettings::trackheight() * 2);
+ m_trackview->checkTrackHeight(false);*/
+ if (m_verticalZoom == 2) m_trackview->setScale(m_scene->scale().x(), 2);
+ else m_trackview->setScale(m_scene->scale().x(), 1);
+ slotRebuildTrackHeaders();
}
#include "trackview.moc"
}
#include "trackview.moc"
private slots:
void setCursorPos(int pos);
void moveCursorPos(int pos);
private slots:
void setCursorPos(int pos);
void moveCursorPos(int pos);
- void slotRebuildTrackHeaders(bool resetZoom = false);
+ void slotRebuildTrackHeaders();
void slotChangeTrackLock(int ix, bool lock);
void slotVerticalZoomDown();
void slotVerticalZoomUp();
void slotChangeTrackLock(int ix, bool lock);
void slotVerticalZoomDown();
void slotVerticalZoomUp();
{
if (isItemLocked()) return NONE;
{
if (isItemLocked()) return NONE;
- const double scale = projectScene()->scale();
+ const double scale = projectScene()->scale().x();
double maximumOffset = 6 / scale;
QRectF rect = sceneBoundingRect();
double maximumOffset = 6 / scale;
QRectF rect = sceneBoundingRect();