#include <QStylePainter>
#include <KDebug>
+#include <KIcon>
#include <KGlobalSettings>
#include "customruler.h"
setBigMarkDistance(FRAME_SIZE * m_timecode.fps() * 60);
m_zoneStart = 2 * m_timecode.fps();
m_zoneEnd = 10 * m_timecode.fps();
+ m_contextMenu = new QMenu(this);
+ QAction *addGuide = m_contextMenu->addAction(KIcon("document-new"), i18n("Add Guide"));
+ connect(addGuide, SIGNAL(triggered()), this, SLOT(slotAddGuide()));
}
// virtual
void CustomRuler::mousePressEvent(QMouseEvent * event) {
+ if (event->button() == Qt::RightButton) {
+
+ return;
+ }
m_view->activateMonitor();
- int pos = (int)((event->x() + offset()) / pixelPerMark() / FRAME_SIZE);
+ int pos = (int)((event->x() + offset()));
m_moveCursor = RULER_CURSOR;
if (event->y() > 10) {
- if (qAbs(pos - m_zoneStart) < 4) m_moveCursor = RULER_START;
- else if (qAbs(pos - (m_zoneStart + (m_zoneEnd - m_zoneStart) / 2)) < 4) m_moveCursor = RULER_MIDDLE;
- else if (qAbs(pos - m_zoneEnd) < 4) m_moveCursor = RULER_END;
+ if (qAbs(pos - m_zoneStart * pixelPerMark() * FRAME_SIZE) < 4) m_moveCursor = RULER_START;
+ else if (qAbs(pos - (m_zoneStart + (m_zoneEnd - m_zoneStart) / 2) * pixelPerMark() * FRAME_SIZE) < 4) m_moveCursor = RULER_MIDDLE;
+ else if (qAbs(pos - m_zoneEnd * pixelPerMark() * FRAME_SIZE) < 4) m_moveCursor = RULER_END;
}
if (m_moveCursor == RULER_CURSOR)
- m_view->setCursorPos(pos);
+ m_view->setCursorPos((int) pos / pixelPerMark() / FRAME_SIZE);
}
// virtual
}
void CustomRuler::slotCursorMoved(int oldpos, int newpos) {
- //TODO: optimize (redraw only around cursor positions
- update();
+ update(oldpos - offset() -6, 2, 17, 16);
+ update(newpos - offset() - 6, 2, 17, 16);
+}
+
+void CustomRuler::slotAddGuide() {
+
}
void CustomRuler::setPixelPerMark(double rate) {
setContentsMargins(0, 0, 0, 0);
if (projectscene) {
m_cursorLine = projectscene->addLine(0, 0, 0, m_tracksHeight);
- m_cursorLine->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIgnoresTransformations);
+ m_cursorLine->setFlags(QGraphicsItem::ItemIsMovable);
m_cursorLine->setZValue(1000);
}
}
}
}
+ GenTime pos = GenTime(m_cursorPos, m_document->fps());
+ m_snapPoints.append(pos);
+ if (offset != GenTime()) m_snapPoints.append(pos - offset);
qSort(m_snapPoints);
//for (int i = 0; i < m_snapPoints.size(); ++i)
// kDebug() << "SNAP POINT: " << m_snapPoints.at(i).frames(25);
#include "titlewidget.h"
#include "mainwindow.h"
-KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, MltVideoProfile profile, QUndoGroup *undoGroup, MainWindow *parent): QObject(parent), m_render(NULL), m_url(url), m_projectFolder(projectFolder), m_profile(profile), m_fps((double)profile.frame_rate_num / profile.frame_rate_den), m_width(profile.width), m_height(profile.height), m_commandStack(new KUndoStack(undoGroup)), m_modified(false), m_documentLoadingProgress(0), m_documentLoadingStep(0.0) {
+KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, MltVideoProfile profile, QUndoGroup *undoGroup, MainWindow *parent): QObject(parent), m_render(NULL), m_url(url), m_projectFolder(projectFolder), m_profile(profile), m_fps((double)profile.frame_rate_num / profile.frame_rate_den), m_width(profile.width), m_height(profile.height), m_commandStack(new KUndoStack(undoGroup)), m_modified(false), m_documentLoadingProgress(0), m_documentLoadingStep(0.0), m_startPos(0) {
m_clipManager = new ClipManager(this);
if (!url.isEmpty()) {
QString tmpFile;