aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <[email protected]>2016-07-25 22:11:14 +0200
committerJean-Baptiste Mardelle <[email protected]>2016-07-25 22:11:14 +0200
commit68c0477b84038e77beb0badcfba93667f229ca1d (patch)
treea4f019fa6faa082a6827c66f9aff578eda0d7874
parente3f2662b27aa6d3bc20df7121bd106694e612722 (diff)
Fix delete guide hard to reach from timeline ruler on low zoom
CCBUG: 366068 Change timline size policy CCBUG: 366066
-rw-r--r--src/mainwindow.cpp2
-rw-r--r--src/timeline/customruler.cpp3
-rw-r--r--src/timeline/customtrackview.cpp13
-rw-r--r--src/timeline/customtrackview.h6
4 files changed, 15 insertions, 9 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 5c2ecc3..008bdb6 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -3159,7 +3159,7 @@ void MainWindow::slotPrepareRendering(bool scriptExport, bool zoneOnly, const QS
}
if (chapters.childNodes().count() > 0) {
- if (pCore->projectManager()->currentTimeline()->projectView()->hasGuide(out, 0) == -1) {
+ if (pCore->projectManager()->currentTimeline()->projectView()->hasGuide(out, true) == -1) {
// Always insert a guide in pos 0
QDomElement chapter = doc.createElement(QStringLiteral("chapter"));
chapters.insertBefore(chapter, QDomNode());
diff --git a/src/timeline/customruler.cpp b/src/timeline/customruler.cpp
index b07c41a..62bb71c 100644
--- a/src/timeline/customruler.cpp
+++ b/src/timeline/customruler.cpp
@@ -73,7 +73,6 @@ CustomRuler::CustomRuler(const Timecode &tc, const QList<QAction *> &rulerAction
setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
QFontMetricsF fontMetrics(font());
// Define size variables
- setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
LABEL_SIZE = fontMetrics.ascent();
FONT_WIDTH = fontMetrics.averageCharWidth();
PREVIEW_SIZE = LABEL_SIZE / 3;
@@ -163,7 +162,7 @@ void CustomRuler::mousePressEvent(QMouseEvent * event)
event->setAccepted(true);
int pos = (int)((event->x() + offset()));
if (event->button() == Qt::RightButton) {
- m_clickedGuide = m_view->hasGuide((int)(pos / m_factor), (int)(5 / m_factor + 1));
+ m_clickedGuide = m_view->hasGuide(pos, false);
m_editGuide->setEnabled(m_clickedGuide > 0);
m_deleteGuide->setEnabled(m_clickedGuide > 0);
m_view->buildGuidesMenu(m_goMenu);
diff --git a/src/timeline/customtrackview.cpp b/src/timeline/customtrackview.cpp
index 06e7384..4b4abb8 100644
--- a/src/timeline/customtrackview.cpp
+++ b/src/timeline/customtrackview.cpp
@@ -133,7 +133,6 @@ CustomTrackView::CustomTrackView(KdenliveDoc *doc, Timeline *timeline, CustomTra
//setCacheMode(QGraphicsView::CacheBackground);
setAutoFillBackground(false);
setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate);
- setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
setContentsMargins(0, 0, 0, 0);
KColorScheme scheme(palette().currentColorGroup(), KColorScheme::Window, KSharedConfig::openConfig(KdenliveSettings::colortheme()));
m_selectedTrackColor = scheme.background(KColorScheme::ActiveBackground ).color();
@@ -5836,12 +5835,16 @@ void CustomTrackView::clipEnd()
}
}
-int CustomTrackView::hasGuide(int pos, int offset)
+int CustomTrackView::hasGuide(double pos, bool framePos)
{
for (int i = 0; i < m_guides.count(); ++i) {
- int guidePos = m_guides.at(i)->position().frames(m_document->fps());
- if (qAbs(guidePos - pos) <= offset) return guidePos;
- else if (guidePos > pos) return -1;
+ double guidePos = m_guides.at(i)->position().frames(m_document->fps()) * (framePos ? 1 : matrix().m11());
+ if (framePos) {
+ if (guidePos == pos) return guidePos;
+ } else {
+ if (qAbs(guidePos - pos) <= QApplication::startDragDistance()) return guidePos;
+ }
+ if (guidePos > pos) return -1;
}
return -1;
}
diff --git a/src/timeline/customtrackview.h b/src/timeline/customtrackview.h
index 3fd0660..900ca15 100644
--- a/src/timeline/customtrackview.h
+++ b/src/timeline/customtrackview.h
@@ -170,7 +170,11 @@ public:
/** @brief Sets the clip type (av, video only, audio only) of the current selection. */
void setClipType(PlaylistState::ClipState state);
void doChangeClipType(ItemInfo info, PlaylistState::ClipState state);
- int hasGuide(int pos, int offset);
+ /** @brief Check if there is a guide at position.
+ * @param pos Position to check
+ * @param framePos If set to true, pos is an exact frame number, otherwise it's a mouse event pos
+ */
+ int hasGuide(double pos, bool framePos);
void reloadTransitionLumas();
void updateProjectFps();
double fps() const;