diff --git a/effects/shaders/vignette.frag b/effects/shaders/vignette.frag
index 86d13b14b..fffd8c192 100644
--- a/effects/shaders/vignette.frag
+++ b/effects/shaders/vignette.frag
@@ -1,5 +1,7 @@
uniform float lensRadiusX;
uniform float lensRadiusY;
+uniform float centerX;
+uniform float centerY;
uniform bool circular;
uniform vec2 resolution;
// uniform vec2 lensRadius; // 0.45, 0.38
@@ -14,7 +16,7 @@ vec4 process(vec4 c) {
vignetteCoord.x *= ar;
vignetteCoord.x -= (1.0-(1.0/ar));
}
- float dist = distance(vignetteCoord, vec2(0.5,0.5));
+ float dist = distance(vignetteCoord, vec2(0.5 + centerX*0.01, 0.5 + centerY*0.01));
float size = (lensRadiusX*0.01);
return vec4(c.rgb * smoothstep(size, size*0.99*(1.0-lensRadiusY*0.01), dist), c.a);
}
diff --git a/effects/shaders/vignette.xml b/effects/shaders/vignette.xml
index 5156a84c4..a85e94be5 100644
--- a/effects/shaders/vignette.xml
+++ b/effects/shaders/vignette.xml
@@ -9,5 +9,9 @@
+
+
+
+
\ No newline at end of file
diff --git a/global/config.cpp b/global/config.cpp
index cd22f52a0..917bc66cc 100644
--- a/global/config.cpp
+++ b/global/config.cpp
@@ -82,7 +82,8 @@ Config::Config()
playback_bit_depth(olive::PIX_FMT_RGBA16F),
export_bit_depth(olive::PIX_FMT_RGBA32F),
dont_use_proxies_on_export(true),
- maximum_recent_projects(10)
+ maximum_recent_projects(10),
+ locked_panels(false)
{}
void Config::load(QString path) {
@@ -267,6 +268,9 @@ void Config::load(QString path) {
} else if (stream.name() == "DontUseProxiesOnExport") {
stream.readNext();
dont_use_proxies_on_export = (stream.text() == "1");
+ } else if (stream.name() == "LockedPanels") {
+ stream.readNext();
+ locked_panels = (stream.text() == "1");
}
}
}
@@ -349,6 +353,7 @@ void Config::save(QString path) {
stream.writeTextElement("PlaybackBitDepth", QString::number(playback_bit_depth));
stream.writeTextElement("ExportBitDepth", QString::number(export_bit_depth));
stream.writeTextElement("DontUseProxiesOnExport", QString::number(dont_use_proxies_on_export));
+ stream.writeTextElement("LockedPanels", QString::number(locked_panels));
stream.writeEndElement(); // configuration
stream.writeEndDocument(); // doc
diff --git a/global/config.h b/global/config.h
index 0291a5e3a..293bcdcca 100644
--- a/global/config.h
+++ b/global/config.h
@@ -614,6 +614,11 @@ struct Config {
*/
int maximum_recent_projects;
+ /**
+ * @brief Sets whether panels should load locked or not
+ */
+ bool locked_panels;
+
/**
* @brief Load config from file
*
diff --git a/panels/timeline.cpp b/panels/timeline.cpp
index 0cb4c0f1b..4833a288a 100644
--- a/panels/timeline.cpp
+++ b/panels/timeline.cpp
@@ -753,7 +753,7 @@ void Timeline::split_at_playhead()
}
long getFrameFromScreenPoint(double zoom, int x) {
- long f = qRound(double(x) / zoom);
+ long f = qFloor(double(x) / zoom);
if (f < 0) {
return 0;
}
diff --git a/panels/viewer.cpp b/panels/viewer.cpp
index f0c6756a5..6a3d66872 100644
--- a/panels/viewer.cpp
+++ b/panels/viewer.cpp
@@ -619,7 +619,7 @@ void Viewer::setup_ui() {
lower_control_layout->setMargin(0);
QSizePolicy timecode_container_policy(QSizePolicy::Minimum, QSizePolicy::Maximum);
- QSizePolicy lower_control_policy(QSizePolicy::Expanding, QSizePolicy::Maximum);
+ QSizePolicy lower_control_policy(QSizePolicy::Maximum, QSizePolicy::Maximum);
// Current time code container
QWidget* current_timecode_container = new QWidget();
diff --git a/timeline/track.cpp b/timeline/track.cpp
index 9273b67ed..97e626dd4 100644
--- a/timeline/track.cpp
+++ b/timeline/track.cpp
@@ -246,8 +246,7 @@ bool Track::IsClipSelected(Clip *clip, bool containing)
for (int i=0;itimeline_in() >= s.in() && clip->timeline_out() <= s.out())
- || (!containing && !(clip->timeline_in() < s.in() && clip->timeline_out() < s.in())
- && !(clip->timeline_in() > s.in() && clip->timeline_out() > s.in())))) {
+ || (!containing && !(clip->timeline_in() >= s.out() || clip->timeline_out() <= s.in())))) {
return true;
}
}
@@ -340,27 +339,27 @@ void Track::ClearSelections()
void Track::DeselectArea(long in, long out)
{
int selection_count = selections_.size();
- for (int i=0;i= in && s.out() <= out) {
- // whole selection is in deselect area
- selections_.removeAt(i);
- i--;
- selection_count--;
- } else if (s.in() < in && s.out() > out) {
- // middle of selection is in deselect area
- Selection new_sel(out, s.out(), s.track());
- selections_.append(new_sel);
+ if (s.in() >= in && s.out() <= out) {
+ // whole selection is in deselect area
+ selections_.removeAt(i);
+ i--;
+ selection_count--;
+ } else if (s.in() < in && s.out() > out) {
+ // middle of selection is in deselect area
+ Selection new_sel(out, s.out(), s.track());
+ selections_.append(new_sel);
- s.set_out(in);
- } else if (s.in() < in && s.out() > in) {
- // only out point is in deselect area
- s.set_out(in);
- } else if (s.in() < out && s.out() > out) {
- // only in point is in deselect area
- s.set_in(out);
- }
+ s.set_out(in);
+ } else if (s.in() < in && s.out() > in) {
+ // only out point is in deselect area
+ s.set_out(in);
+ } else if (s.in() < out && s.out() > out) {
+ // only in point is in deselect area
+ s.set_in(out);
+ }
}
}
diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp
index cade09482..cbe7acb3a 100644
--- a/ui/mainwindow.cpp
+++ b/ui/mainwindow.cpp
@@ -285,6 +285,9 @@ MainWindow::MainWindow(QWidget *parent) :
olive::Global->check_for_autorecovery_file();
+ // lock panels if the config says so
+ set_panels_locked(olive::config.locked_panels);
+
// set up output audio device
init_audio();
@@ -1193,6 +1196,8 @@ void MainWindow::set_panels_locked(bool locked)
panel->setTitleBarWidget(nullptr);
}
}
+
+ olive::config.locked_panels = locked;
}
void MainWindow::fileMenu_About_To_Be_Shown() {
diff --git a/ui/timelineview.cpp b/ui/timelineview.cpp
index ed6bc07f5..25351529d 100644
--- a/ui/timelineview.cpp
+++ b/ui/timelineview.cpp
@@ -720,6 +720,7 @@ void TimelineView::mousePressEvent(QMouseEvent *event) {
}
hovered_clip->track()->SelectArea(s_in, s_out);
}
+
} else {
// if the clip is not already selected
@@ -2498,9 +2499,9 @@ void TimelineView::mouseMoveEvent(QMouseEvent *event) {
//
// threshold around a trim point that the cursor can be within and still considered "trimming"
- int lim = 5;
- long mouse_frame_lower = ParentTimeline()->getTimelineFrameFromScreenPoint(pos.x()-lim)-1;
- long mouse_frame_upper = ParentTimeline()->getTimelineFrameFromScreenPoint(pos.x()+lim)+1;
+ int lim = 10; // FIXME Magic number for the clip trimming threshold
+ int mouse_frame_lower = pos.x() - lim;
+ int mouse_frame_upper = pos.x() + lim;
// used to determine whether we the cursor found a trim point or not
bool found = false;
@@ -2548,11 +2549,14 @@ void TimelineView::mouseMoveEvent(QMouseEvent *event) {
}
}
+ int visual_in_point = ParentTimeline()->getTimelineScreenPointFromFrame(c->timeline_in());
+ int visual_out_point = ParentTimeline()->getTimelineScreenPointFromFrame(c->timeline_out());
+
// is the cursor hovering around the clip's IN point?
- if (c->timeline_in() > mouse_frame_lower && c->timeline_in() < mouse_frame_upper) {
+ if (visual_in_point > mouse_frame_lower && visual_in_point < mouse_frame_upper) {
// test how close this IN point is to the cursor
- long nc = qAbs(c->timeline_in() + 1 - ParentTimeline()->cursor_frame);
+ int nc = qAbs(visual_in_point + 1 - pos.x());
// and test whether it's closer than the last in/out point we found
if (nc < closeness) {
@@ -2567,10 +2571,10 @@ void TimelineView::mouseMoveEvent(QMouseEvent *event) {
}
// is the cursor hovering around the clip's OUT point?
- if (c->timeline_out() > mouse_frame_lower && c->timeline_out() < mouse_frame_upper) {
+ if (visual_out_point > mouse_frame_lower && visual_out_point < mouse_frame_upper) {
// test how close this OUT point is to the cursor
- long nc = qAbs(c->timeline_out() - 1 - ParentTimeline()->cursor_frame);
+ int nc = qAbs(visual_out_point - 1 - pos.x());
// and test whether it's closer than the last in/out point we found
if (nc < closeness) {
@@ -2592,13 +2596,14 @@ void TimelineView::mouseMoveEvent(QMouseEvent *event) {
if (c->opening_transition != nullptr) {
// cache the timeline frame where the transition ends
- long transition_point = c->timeline_in() + c->opening_transition->get_true_length();
+ int transition_point = ParentTimeline()->getTimelineScreenPointFromFrame(c->timeline_in()
+ + c->opening_transition->get_true_length());
// check if the cursor is hovering around it (within the threshold)
if (transition_point > mouse_frame_lower && transition_point < mouse_frame_upper) {
// similar to above, test how close it is and if it's closer, make this active
- long nc = qAbs(transition_point - 1 - ParentTimeline()->cursor_frame);
+ int nc = qAbs(transition_point - 1 - pos.x());
if (nc < closeness) {
ParentTimeline()->trim_target = c;
ParentTimeline()->trim_type = olive::timeline::TRIM_OUT;
@@ -2613,13 +2618,14 @@ void TimelineView::mouseMoveEvent(QMouseEvent *event) {
if (c->closing_transition != nullptr) {
// cache the timeline frame where the transition starts
- long transition_point = c->timeline_out() - c->closing_transition->get_true_length();
+ int transition_point = ParentTimeline()->getTimelineScreenPointFromFrame(c->timeline_out()
+ - c->closing_transition->get_true_length());
// check if the cursor is hovering around it (within the threshold)
if (transition_point > mouse_frame_lower && transition_point < mouse_frame_upper) {
// similar to above, test how close it is and if it's closer, make this active
- long nc = qAbs(transition_point + 1 - ParentTimeline()->cursor_frame);
+ int nc = qAbs(transition_point + 1 - pos.x());
if (nc < closeness) {
ParentTimeline()->trim_target = c;
ParentTimeline()->trim_type = olive::timeline::TRIM_IN;