minor revision and zoom cursor fix
This commit is contained in:
+4
-4
@@ -71,7 +71,7 @@ Config::Config()
|
||||
waveform_resolution(64),
|
||||
thumbnail_resolution(120),
|
||||
add_default_effects_to_clips(true),
|
||||
horizontal_timeline_scroll(true)
|
||||
invert_timeline_scroll_axes(true)
|
||||
{}
|
||||
|
||||
void Config::load(QString path) {
|
||||
@@ -88,9 +88,9 @@ void Config::load(QString path) {
|
||||
} else if (stream.name() == "ScrollZooms") {
|
||||
stream.readNext();
|
||||
scroll_zooms = (stream.text() == "1");
|
||||
} else if (stream.name() == "HorizontalTimelineScroll") {
|
||||
} else if (stream.name() == "InvertTimelineScrollAxes") {
|
||||
stream.readNext();
|
||||
horizontal_timeline_scroll = (stream.text() == "1");
|
||||
invert_timeline_scroll_axes = (stream.text() == "1");
|
||||
} else if (stream.name() == "EditToolSelectsLinks") {
|
||||
stream.readNext();
|
||||
edit_tool_selects_links = (stream.text() == "1");
|
||||
@@ -237,7 +237,7 @@ void Config::save(QString path) {
|
||||
stream.writeTextElement("Version", QString::number(olive::kSaveVersion));
|
||||
stream.writeTextElement("ShowTrackLines", QString::number(show_track_lines));
|
||||
stream.writeTextElement("ScrollZooms", QString::number(scroll_zooms));
|
||||
stream.writeTextElement("HorizontalTimelineScroll", QString::number(horizontal_timeline_scroll));
|
||||
stream.writeTextElement("InvertTimelineScrollAxes", QString::number(invert_timeline_scroll_axes));
|
||||
stream.writeTextElement("EditToolSelectsLinks", QString::number(edit_tool_selects_links));
|
||||
stream.writeTextElement("EditToolAlsoSeeks", QString::number(edit_tool_also_seeks));
|
||||
stream.writeTextElement("SelectAlsoSeeks", QString::number(select_also_seeks));
|
||||
|
||||
+3
-4
@@ -511,12 +511,11 @@ struct Config {
|
||||
bool add_default_effects_to_clips;
|
||||
|
||||
/**
|
||||
* @brief Horizontal timeline scroll
|
||||
* @brief Invert Timeline scroll axes
|
||||
*
|
||||
* **TRUE** Scrolling vertically with a mouse wheel or touchpad scrolls the Timeline horizontally.
|
||||
* The Shift key temporarily toggles this setting.
|
||||
* **TRUE** if scrolling vertically on the Timeline should scroll it horizontally
|
||||
*/
|
||||
bool horizontal_timeline_scroll;
|
||||
bool invert_timeline_scroll_axes;
|
||||
|
||||
/**
|
||||
* @brief Load config from file
|
||||
|
||||
+9
-7
@@ -70,7 +70,7 @@ MainWindow* olive::MainWindow;
|
||||
|
||||
#define DEFAULT_CSS "QPushButton::checked { background: rgb(25, 25, 25); }"
|
||||
|
||||
void MainWindow::setup_layout(bool reset) {
|
||||
void MainWindow::setup_layout(bool reset) {
|
||||
// load panels from file
|
||||
if (!reset) {
|
||||
QFile panel_config(get_config_dir().filePath("layout"));
|
||||
@@ -652,6 +652,7 @@ void MainWindow::setup_menus() {
|
||||
// INITIALIZE TOOLS MENU
|
||||
|
||||
tools_menu = MenuHelper::create_submenu(menuBar, this, SLOT(toolMenu_About_To_Be_Shown()));
|
||||
tools_menu->setToolTipsVisible(true);
|
||||
|
||||
pointer_tool_action = MenuHelper::create_menu_action(tools_menu, "pointertool", &olive::MenuHelper, SLOT(menu_click_button()), QKeySequence("V"));
|
||||
pointer_tool_action->setCheckable(true);
|
||||
@@ -717,9 +718,9 @@ void MainWindow::setup_menus() {
|
||||
scroll_wheel_zooms->setCheckable(true);
|
||||
scroll_wheel_zooms->setData(reinterpret_cast<quintptr>(&olive::CurrentConfig.scroll_zooms));
|
||||
|
||||
horizontal_timeline_scroll = MenuHelper::create_menu_action(tools_menu, "horizontaltimelinescroll", &olive::MenuHelper, SLOT(toggle_bool_action()));
|
||||
horizontal_timeline_scroll->setCheckable(true);
|
||||
horizontal_timeline_scroll->setData(reinterpret_cast<quintptr>(&olive::CurrentConfig.horizontal_timeline_scroll));
|
||||
invert_timeline_scroll_axes = MenuHelper::create_menu_action(tools_menu, "inverttimelinescrollaxes", &olive::MenuHelper, SLOT(toggle_bool_action()));
|
||||
invert_timeline_scroll_axes->setCheckable(true);
|
||||
invert_timeline_scroll_axes->setData(reinterpret_cast<quintptr>(&olive::CurrentConfig.invert_timeline_scroll_axes));
|
||||
|
||||
enable_drag_files_to_timeline = MenuHelper::create_menu_action(tools_menu, "enabledragfilestotimeline", &olive::MenuHelper, SLOT(toggle_bool_action()));
|
||||
enable_drag_files_to_timeline->setCheckable(true);
|
||||
@@ -885,8 +886,9 @@ void MainWindow::Retranslate()
|
||||
edit_tool_selects_links->setText(tr("Edit Tool Selects Links"));
|
||||
seek_also_selects->setText(tr("Seek Also Selects"));
|
||||
seek_to_end_of_pastes->setText(tr("Seek to the End of Pastes"));
|
||||
scroll_wheel_zooms->setText(tr("Scroll Wheel Zooms (Ctrl toggles)"));
|
||||
horizontal_timeline_scroll->setText(tr("Invert Timeline scroll axes"));
|
||||
scroll_wheel_zooms->setText(tr("Scroll Wheel Zooms"));
|
||||
scroll_wheel_zooms->setToolTip(tr("Hold CTRL to toggle this setting"));
|
||||
invert_timeline_scroll_axes->setText(tr("Invert Timeline Scroll Axes"));
|
||||
enable_drag_files_to_timeline->setText(tr("Enable Drag Files to Timeline"));
|
||||
autoscale_by_default->setText(tr("Auto-Scale By Default"));
|
||||
enable_seek_to_import->setText(tr("Enable Seek to Import"));
|
||||
@@ -1139,7 +1141,7 @@ void MainWindow::toolMenu_About_To_Be_Shown() {
|
||||
olive::MenuHelper.set_bool_action_checked(edit_tool_selects_links);
|
||||
olive::MenuHelper.set_bool_action_checked(seek_to_end_of_pastes);
|
||||
olive::MenuHelper.set_bool_action_checked(scroll_wheel_zooms);
|
||||
olive::MenuHelper.set_bool_action_checked(horizontal_timeline_scroll);
|
||||
olive::MenuHelper.set_bool_action_checked(invert_timeline_scroll_axes);
|
||||
olive::MenuHelper.set_bool_action_checked(rectified_waveforms);
|
||||
olive::MenuHelper.set_bool_action_checked(enable_drag_files_to_timeline);
|
||||
olive::MenuHelper.set_bool_action_checked(autoscale_by_default);
|
||||
|
||||
+1
-1
@@ -325,7 +325,7 @@ private:
|
||||
QAction* edit_tool_selects_links;
|
||||
QAction* seek_to_end_of_pastes;
|
||||
QAction* scroll_wheel_zooms;
|
||||
QAction* horizontal_timeline_scroll;
|
||||
QAction* invert_timeline_scroll_axes;
|
||||
QAction* rectified_waveforms;
|
||||
QAction* enable_drag_files_to_timeline;
|
||||
QAction* autoscale_by_default;
|
||||
|
||||
+75
-78
@@ -105,11 +105,11 @@ void GraphView::show_context_menu(const QPoint& pos) {
|
||||
}
|
||||
|
||||
void GraphView::reset_view() {
|
||||
x_zoom = 1.0;
|
||||
y_zoom = 1.0;
|
||||
x_zoom = 1.0;
|
||||
y_zoom = 1.0;
|
||||
set_scroll_x(0);
|
||||
set_scroll_y(0);
|
||||
emit zoom_changed(x_zoom, y_zoom);
|
||||
emit zoom_changed(x_zoom, y_zoom);
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -127,8 +127,8 @@ void GraphView::set_view_to_selection() {
|
||||
max_dbl = qMax(key.data.toDouble(), max_dbl);
|
||||
}
|
||||
|
||||
min_time -= row->parent_effect->parent_clip->clip_in();
|
||||
max_time -= row->parent_effect->parent_clip->clip_in();
|
||||
min_time -= row->parent_effect->parent_clip->clip_in();
|
||||
max_time -= row->parent_effect->parent_clip->clip_in();
|
||||
|
||||
set_view_to_rect(min_time, min_dbl, max_time, max_dbl);
|
||||
}
|
||||
@@ -153,8 +153,8 @@ void GraphView::set_view_to_all() {
|
||||
}
|
||||
}
|
||||
if (can_set) {
|
||||
min_time -= row->parent_effect->parent_clip->clip_in();
|
||||
max_time -= row->parent_effect->parent_clip->clip_in();
|
||||
min_time -= row->parent_effect->parent_clip->clip_in();
|
||||
max_time -= row->parent_effect->parent_clip->clip_in();
|
||||
|
||||
set_view_to_rect(min_time, min_dbl, max_time, max_dbl);
|
||||
}
|
||||
@@ -167,10 +167,10 @@ void GraphView::set_view_to_rect(int x1, double y1, int x2, double y2) {
|
||||
double y_diff = (y2 - y1);
|
||||
double x_diff_padded = (x_diff+10)*padding;
|
||||
double y_diff_padded = (y_diff+10)*padding;
|
||||
set_zoom(double(width()) / x_diff_padded, double(height()) / y_diff_padded);
|
||||
set_zoom(double(width()) / x_diff_padded, double(height()) / y_diff_padded);
|
||||
|
||||
set_scroll_x(qRound((double(x1) - ((x_diff_padded-x_diff)/2))*x_zoom));
|
||||
set_scroll_y(qRound((double(y1) - ((y_diff_padded-y_diff)/2))*y_zoom));
|
||||
set_scroll_x(qRound((double(x1) - ((x_diff_padded-x_diff)/2))*x_zoom));
|
||||
set_scroll_y(qRound((double(y1) - ((y_diff_padded-y_diff)/2))*y_zoom));
|
||||
}
|
||||
|
||||
void GraphView::draw_line_text(QPainter &p, bool vert, int line_no, int line_pos, int next_line_pos) {
|
||||
@@ -190,7 +190,7 @@ void GraphView::draw_lines(QPainter& p, bool vert) {
|
||||
int scroll = vert ? y_scroll : x_scroll;
|
||||
for (int i=0;i<lim;i++) {
|
||||
int scroll_offs = vert ? height() - i + scroll : i + scroll;
|
||||
int this_line = qFloor(scroll_offs/(kGraphSize*(vert ? y_zoom : x_zoom)));
|
||||
int this_line = qFloor(scroll_offs/(kGraphSize*(vert ? y_zoom : x_zoom)));
|
||||
if (vert) this_line++;
|
||||
if (this_line != last_line) {
|
||||
if (vert) {
|
||||
@@ -256,7 +256,7 @@ void GraphView::paintEvent(QPaintEvent *) {
|
||||
for (int j=0;j<sorted_keys.size();j++) {
|
||||
const EffectKeyframe& key = field->keyframes.at(sorted_keys.at(j));
|
||||
|
||||
int key_x = get_screen_x(key.time);
|
||||
int key_x = get_screen_x(key.time);
|
||||
int key_y = get_screen_y(key.data.toDouble());
|
||||
|
||||
line_pen.setColor(get_curve_color(i, row->fieldCount()));
|
||||
@@ -279,22 +279,22 @@ void GraphView::paintEvent(QPaintEvent *) {
|
||||
if (last_key.type == EFFECT_KEYFRAME_BEZIER && key.type == EFFECT_KEYFRAME_BEZIER) {
|
||||
// cubic bezier
|
||||
bezier_path.cubicTo(
|
||||
QPointF(last_key_x+last_post_handle*x_zoom, last_key_y-last_key.post_handle_y*y_zoom),
|
||||
QPointF(key_x+pre_handle*x_zoom, key_y-key.pre_handle_y*y_zoom),
|
||||
QPointF(last_key_x+last_post_handle*x_zoom, last_key_y-last_key.post_handle_y*y_zoom),
|
||||
QPointF(key_x+pre_handle*x_zoom, key_y-key.pre_handle_y*y_zoom),
|
||||
QPointF(key_x, key_y)
|
||||
);
|
||||
);
|
||||
} else if (key.type == EFFECT_KEYFRAME_LINEAR) { // quadratic bezier
|
||||
// last keyframe is the bezier one
|
||||
bezier_path.quadTo(
|
||||
QPointF(last_key_x+last_post_handle*x_zoom, last_key_y-last_key.post_handle_y*y_zoom),
|
||||
QPointF(last_key_x+last_post_handle*x_zoom, last_key_y-last_key.post_handle_y*y_zoom),
|
||||
QPointF(key_x, key_y)
|
||||
);
|
||||
);
|
||||
} else {
|
||||
// this keyframe is the bezier one
|
||||
bezier_path.quadTo(
|
||||
QPointF(key_x+pre_handle*x_zoom, key_y-key.pre_handle_y*y_zoom),
|
||||
QPointF(key_x+pre_handle*x_zoom, key_y-key.pre_handle_y*y_zoom),
|
||||
QPointF(key_x, key_y)
|
||||
);
|
||||
);
|
||||
}
|
||||
p.drawPath(bezier_path);
|
||||
} else {
|
||||
@@ -311,19 +311,19 @@ void GraphView::paintEvent(QPaintEvent *) {
|
||||
for (int j=0;j<sorted_keys.size();j++) {
|
||||
const EffectKeyframe& key = field->keyframes.at(sorted_keys.at(j));
|
||||
|
||||
int key_x = get_screen_x(key.time);
|
||||
int key_x = get_screen_x(key.time);
|
||||
int key_y = get_screen_y(key.data.toDouble());
|
||||
|
||||
if (key.type == EFFECT_KEYFRAME_BEZIER) {
|
||||
p.setPen(Qt::gray);
|
||||
|
||||
// pre handle line
|
||||
QPointF pre_point(key_x + key.pre_handle_x*x_zoom, key_y - key.pre_handle_y*y_zoom);
|
||||
QPointF pre_point(key_x + key.pre_handle_x*x_zoom, key_y - key.pre_handle_y*y_zoom);
|
||||
p.drawLine(pre_point, QPointF(key_x, key_y));
|
||||
p.drawEllipse(pre_point, kBezierHandleSize, kBezierHandleSize);
|
||||
|
||||
// post handle line
|
||||
QPointF post_point(key_x + key.post_handle_x*x_zoom, key_y - key.post_handle_y*y_zoom);
|
||||
QPointF post_point(key_x + key.post_handle_x*x_zoom, key_y - key.post_handle_y*y_zoom);
|
||||
p.drawLine(post_point, QPointF(key_x, key_y));
|
||||
p.drawEllipse(post_point, kBezierHandleSize, kBezierHandleSize);
|
||||
}
|
||||
@@ -344,7 +344,7 @@ void GraphView::paintEvent(QPaintEvent *) {
|
||||
|
||||
// draw playhead
|
||||
p.setPen(Qt::red);
|
||||
int playhead_x = qRound((double(panel_sequence_viewer->seq->playhead - visible_in)*x_zoom) - x_scroll);
|
||||
int playhead_x = qRound((double(panel_sequence_viewer->seq->playhead - visible_in)*x_zoom) - x_scroll);
|
||||
p.drawLine(playhead_x, 0, playhead_x, height());
|
||||
|
||||
if (rect_select) {
|
||||
@@ -390,7 +390,7 @@ void GraphView::mousePressEvent(QMouseEvent *event) {
|
||||
if (field->type == EFFECT_FIELD_DOUBLE && field_visibility.at(i)) {
|
||||
for (int j=0;j<field->keyframes.size();j++) {
|
||||
const EffectKeyframe& key = field->keyframes.at(j);
|
||||
int key_x = get_screen_x(key.time);
|
||||
int key_x = get_screen_x(key.time);
|
||||
int key_y = get_screen_y(key.data.toDouble());
|
||||
if (event->pos().x() > key_x-KEYFRAME_SIZE
|
||||
&& event->pos().x() < key_x+KEYFRAME_SIZE
|
||||
@@ -401,17 +401,17 @@ void GraphView::mousePressEvent(QMouseEvent *event) {
|
||||
break;
|
||||
} else {
|
||||
// selecting a handle
|
||||
QPointF pre_point(key_x + key.pre_handle_x*x_zoom, key_y - key.pre_handle_y*y_zoom);
|
||||
QPointF post_point(key_x + key.post_handle_x*x_zoom, key_y - key.post_handle_y*y_zoom);
|
||||
QPointF pre_point(key_x + key.pre_handle_x*x_zoom, key_y - key.pre_handle_y*y_zoom);
|
||||
QPointF post_point(key_x + key.post_handle_x*x_zoom, key_y - key.post_handle_y*y_zoom);
|
||||
if (event->pos().x() > pre_point.x()-kBezierHandleSize
|
||||
&& event->pos().x() < pre_point.x()+kBezierHandleSize
|
||||
&& event->pos().y() > pre_point.y()-kBezierHandleSize
|
||||
&& event->pos().y() < pre_point.y()+kBezierHandleSize) {
|
||||
current_handle = kBezierHandlePre;
|
||||
} else if (event->pos().x() > post_point.x()-kBezierHandleSize
|
||||
&& event->pos().x() < post_point.x()+kBezierHandleSize
|
||||
&& event->pos().y() > post_point.y()-kBezierHandleSize
|
||||
&& event->pos().y() < post_point.y()+kBezierHandleSize) {
|
||||
&& event->pos().x() < post_point.x()+kBezierHandleSize
|
||||
&& event->pos().y() > post_point.y()-kBezierHandleSize
|
||||
&& event->pos().y() < post_point.y()+kBezierHandleSize) {
|
||||
current_handle = kBezierHandlePost;
|
||||
}
|
||||
|
||||
@@ -514,11 +514,11 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
|
||||
switch (current_handle) {
|
||||
case kBezierHandleNone:
|
||||
for (int i=0;i<selected_keys.size();i++) {
|
||||
row->field(selected_keys_fields.at(i))->keyframes[selected_keys.at(i)].time = qRound(selected_keys_old_vals.at(i) + (double(event->pos().x() - start_x)/x_zoom));
|
||||
row->field(selected_keys_fields.at(i))->keyframes[selected_keys.at(i)].time = qRound(selected_keys_old_vals.at(i) + (double(event->pos().x() - start_x)/x_zoom));
|
||||
if (event->modifiers() & Qt::ShiftModifier) {
|
||||
row->field(selected_keys_fields.at(i))->keyframes[selected_keys.at(i)].data = selected_keys_old_doubles.at(i);
|
||||
} else {
|
||||
row->field(selected_keys_fields.at(i))->keyframes[selected_keys.at(i)].data = qRound(selected_keys_old_doubles.at(i) + (double(start_y - event->pos().y())/y_zoom));
|
||||
row->field(selected_keys_fields.at(i))->keyframes[selected_keys.at(i)].data = qRound(selected_keys_old_doubles.at(i) + (double(start_y - event->pos().y())/y_zoom));
|
||||
}
|
||||
}
|
||||
moved_keys = true;
|
||||
@@ -532,8 +532,8 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
|
||||
double new_post_handle_x = old_post_handle_x;
|
||||
double new_post_handle_y = old_post_handle_y;
|
||||
|
||||
double x_diff = double(event->pos().x() - start_x)/x_zoom;
|
||||
double y_diff = double(start_y - event->pos().y())/y_zoom;
|
||||
double x_diff = double(event->pos().x() - start_x)/x_zoom;
|
||||
double y_diff = double(start_y - event->pos().y())/y_zoom;
|
||||
|
||||
if (current_handle == kBezierHandlePre) {
|
||||
new_pre_handle_x += x_diff;
|
||||
@@ -572,26 +572,26 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
|
||||
for (int i=0;i<row->fieldCount();i++) {
|
||||
for (int j=0;j<row->field(i)->keyframes.size();j++) {
|
||||
const EffectKeyframe& key = row->field(i)->keyframes.at(j);
|
||||
int key_x = get_screen_x(key.time);
|
||||
int key_x = get_screen_x(key.time);
|
||||
int key_y = get_screen_y(key.data.toDouble());
|
||||
QRect test_rect(
|
||||
key_x - KEYFRAME_SIZE,
|
||||
key_y - KEYFRAME_SIZE,
|
||||
KEYFRAME_SIZE+KEYFRAME_SIZE,
|
||||
KEYFRAME_SIZE+KEYFRAME_SIZE
|
||||
);
|
||||
);
|
||||
QRect pre_rect(
|
||||
qRound(key_x + key.pre_handle_x*x_zoom - kBezierHandleSize),
|
||||
qRound(key_y + key.pre_handle_y*y_zoom - kBezierHandleSize),
|
||||
qRound(key_x + key.pre_handle_x*x_zoom - kBezierHandleSize),
|
||||
qRound(key_y + key.pre_handle_y*y_zoom - kBezierHandleSize),
|
||||
kBezierHandleSize+kBezierHandleSize,
|
||||
kBezierHandleSize+kBezierHandleSize
|
||||
);
|
||||
);
|
||||
QRect post_rect(
|
||||
qRound(key_x + key.post_handle_x*x_zoom - kBezierHandleSize),
|
||||
qRound(key_y + key.post_handle_y*y_zoom - kBezierHandleSize),
|
||||
qRound(key_x + key.post_handle_x*x_zoom - kBezierHandleSize),
|
||||
qRound(key_y + key.post_handle_y*y_zoom - kBezierHandleSize),
|
||||
kBezierHandleSize+kBezierHandleSize,
|
||||
kBezierHandleSize+kBezierHandleSize
|
||||
);
|
||||
);
|
||||
|
||||
if (test_rect.contains(event->pos())
|
||||
|| pre_rect.contains(event->pos())
|
||||
@@ -613,7 +613,7 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
|
||||
int y_comp = get_screen_y(f->keyframes.at(sorted_keys.first()).data.toDouble());
|
||||
if (event->pos().y() >= y_comp-kBezierLineSize
|
||||
&& event->pos().y() <= y_comp+kBezierLineSize) {
|
||||
// dout << "make an EARLY key on field" << i;
|
||||
// dout << "make an EARLY key on field" << i;
|
||||
click_add = true;
|
||||
click_add_type = f->keyframes.at(sorted_keys.first()).type;
|
||||
}
|
||||
@@ -621,7 +621,7 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
|
||||
int y_comp = get_screen_y(f->keyframes.at(sorted_keys.last()).data.toDouble());
|
||||
if (event->pos().y() >= y_comp-kBezierLineSize
|
||||
&& event->pos().y() <= y_comp+kBezierLineSize) {
|
||||
// dout << "make an LATE key on field" << i;
|
||||
// dout << "make an LATE key on field" << i;
|
||||
click_add = true;
|
||||
click_add_type = f->keyframes.at(sorted_keys.last()).type;
|
||||
}
|
||||
@@ -645,7 +645,7 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
|
||||
// hold
|
||||
if (event->pos().y() >= last_key_y-kBezierLineSize
|
||||
&& event->pos().y() <= last_key_y+kBezierLineSize) {
|
||||
// dout << "make an HOLD key on field" << i << "after key" << j;
|
||||
// dout << "make an HOLD key on field" << i << "after key" << j;
|
||||
click_add = true;
|
||||
}
|
||||
} else if (last_key.type == EFFECT_KEYFRAME_BEZIER || key.type == EFFECT_KEYFRAME_BEZIER) {
|
||||
@@ -654,25 +654,25 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
|
||||
if (last_key.type == EFFECT_KEYFRAME_BEZIER && key.type == EFFECT_KEYFRAME_BEZIER) {
|
||||
// cubic bezier
|
||||
bezier_path.cubicTo(
|
||||
QPointF(last_key_x+last_key.post_handle_x*x_zoom, last_key_y-last_key.post_handle_y*y_zoom),
|
||||
QPointF(key_x+key.pre_handle_x*x_zoom, key_y-key.pre_handle_y*y_zoom),
|
||||
QPointF(last_key_x+last_key.post_handle_x*x_zoom, last_key_y-last_key.post_handle_y*y_zoom),
|
||||
QPointF(key_x+key.pre_handle_x*x_zoom, key_y-key.pre_handle_y*y_zoom),
|
||||
QPointF(key_x, key_y)
|
||||
);
|
||||
);
|
||||
} else if (key.type == EFFECT_KEYFRAME_LINEAR) { // quadratic bezier
|
||||
// last keyframe is the bezier one
|
||||
bezier_path.quadTo(
|
||||
QPointF(last_key_x+last_key.post_handle_x*x_zoom, last_key_y-last_key.post_handle_y*y_zoom),
|
||||
QPointF(last_key_x+last_key.post_handle_x*x_zoom, last_key_y-last_key.post_handle_y*y_zoom),
|
||||
QPointF(key_x, key_y)
|
||||
);
|
||||
);
|
||||
} else {
|
||||
// this keyframe is the bezier one
|
||||
bezier_path.quadTo(
|
||||
QPointF(key_x+key.pre_handle_x*x_zoom, key_y-key.pre_handle_y*y_zoom),
|
||||
QPointF(key_x+key.pre_handle_x*x_zoom, key_y-key.pre_handle_y*y_zoom),
|
||||
QPointF(key_x, key_y)
|
||||
);
|
||||
);
|
||||
}
|
||||
if (bezier_path.intersects(mouse_rect)) {
|
||||
// dout << "make an BEZIER key on field" << i << "after key" << j;
|
||||
// dout << "make an BEZIER key on field" << i << "after key" << j;
|
||||
click_add = true;
|
||||
}
|
||||
} else {
|
||||
@@ -681,7 +681,7 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
|
||||
linear_path.moveTo(last_key_x, last_key_y);
|
||||
linear_path.lineTo(key_x, key_y);
|
||||
if (linear_path.intersects(mouse_rect)) {
|
||||
// dout << "make an LINEAR key on field" << i << "after key" << j;
|
||||
// dout << "make an LINEAR key on field" << i << "after key" << j;
|
||||
click_add = true;
|
||||
}
|
||||
}
|
||||
@@ -702,7 +702,7 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
|
||||
|
||||
void GraphView::mouseReleaseEvent(QMouseEvent *) {
|
||||
if (click_add_proc) {
|
||||
olive::UndoStack.push(new KeyframeFieldSet(click_add_field, click_add_key));
|
||||
olive::UndoStack.push(new KeyframeFieldSet(click_add_field, click_add_key));
|
||||
} else if (moved_keys && selected_keys.size() > 0) {
|
||||
ComboAction* ca = new ComboAction();
|
||||
switch (current_handle) {
|
||||
@@ -724,7 +724,7 @@ void GraphView::mouseReleaseEvent(QMouseEvent *) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
olive::UndoStack.push(ca);
|
||||
olive::UndoStack.push(ca);
|
||||
}
|
||||
moved_keys = false;
|
||||
mousedown = false;
|
||||
@@ -795,10 +795,9 @@ void GraphView::wheelEvent(QWheelEvent *event) {
|
||||
double zoom_diff = (kGraphZoomSpeed*y_zoom);
|
||||
new_y_zoom = y_zoom + (zoom_diff * (delta_v / 120.0));
|
||||
|
||||
// Center zoom vertically
|
||||
set_scroll_y(qRound((double(y_scroll)/y_zoom*new_y_zoom)
|
||||
+ double(height()-event->pos().y())*new_y_zoom
|
||||
- double(height()-event->pos().y())*y_zoom));
|
||||
// Center zoom around the mouse cursor vertically
|
||||
int true_mouse_y = height()-event->pos().y();
|
||||
set_scroll_y(qRound((double(y_scroll + true_mouse_y) / y_zoom) * new_y_zoom) - true_mouse_y);
|
||||
|
||||
redraw = true;
|
||||
}
|
||||
@@ -808,10 +807,8 @@ void GraphView::wheelEvent(QWheelEvent *event) {
|
||||
|
||||
new_x_zoom = x_zoom + (zoom_diff * (delta_h / 120.0));
|
||||
|
||||
// Center zoom horizontally
|
||||
set_scroll_x(qRound((double(x_scroll)/x_zoom*new_x_zoom)
|
||||
+ double(event->pos().x())*new_x_zoom
|
||||
- double(event->pos().x())*x_zoom));
|
||||
// Center zoom around the mouse cursor horizontally
|
||||
set_scroll_x(qRound((double(x_scroll + event->pos().x()) / x_zoom) * new_x_zoom) - event->pos().x());
|
||||
|
||||
redraw = true;
|
||||
}
|
||||
@@ -853,7 +850,7 @@ void GraphView::set_selected_keyframe_type(int type) {
|
||||
EffectKeyframe& key = row->field(selected_keys_fields.at(i))->keyframes[selected_keys.at(i)];
|
||||
ca->append(new SetInt(&key.type, type));
|
||||
}
|
||||
olive::UndoStack.push(ca);
|
||||
olive::UndoStack.push(ca);
|
||||
update_ui(false);
|
||||
}
|
||||
}
|
||||
@@ -899,32 +896,32 @@ void GraphView::set_scroll_y(int s) {
|
||||
}
|
||||
|
||||
void GraphView::set_zoom(double xz, double yz) {
|
||||
x_zoom = xz;
|
||||
y_zoom = yz;
|
||||
emit zoom_changed(x_zoom, y_zoom);
|
||||
x_zoom = xz;
|
||||
y_zoom = yz;
|
||||
emit zoom_changed(x_zoom, y_zoom);
|
||||
}
|
||||
|
||||
int GraphView::get_screen_x(double d) {
|
||||
if (row != nullptr) {
|
||||
d -= row->parent_effect->parent_clip->clip_in();
|
||||
}
|
||||
return qRound((d*x_zoom) - x_scroll);
|
||||
if (row != nullptr) {
|
||||
d -= row->parent_effect->parent_clip->clip_in();
|
||||
}
|
||||
return qRound((d*x_zoom) - x_scroll);
|
||||
}
|
||||
|
||||
int GraphView::get_screen_y(double d) {
|
||||
return qRound(height() + y_scroll - d*y_zoom);
|
||||
return qRound(height() + y_scroll - d*y_zoom);
|
||||
}
|
||||
|
||||
long GraphView::get_value_x(int i) {
|
||||
long frame = qRound((i + x_scroll)/x_zoom);
|
||||
if (row != nullptr) {
|
||||
frame += row->parent_effect->parent_clip->clip_in();
|
||||
}
|
||||
return frame;
|
||||
long frame = qRound((i + x_scroll)/x_zoom);
|
||||
if (row != nullptr) {
|
||||
frame += row->parent_effect->parent_clip->clip_in();
|
||||
}
|
||||
return frame;
|
||||
}
|
||||
|
||||
double GraphView::get_value_y(int i) {
|
||||
return double(height() + y_scroll - i)/y_zoom;
|
||||
return double(height() + y_scroll - i)/y_zoom;
|
||||
}
|
||||
|
||||
void GraphView::selection_update() {
|
||||
|
||||
@@ -352,7 +352,7 @@ void TimelineWidget::wheelEvent(QWheelEvent *event) {
|
||||
|
||||
// Allow shift for axis swap, but don't swap on zoom... Unless
|
||||
// we need to override Qt's axis swap via Alt
|
||||
bool swap_hv = ((shift != olive::CurrentConfig.horizontal_timeline_scroll) &
|
||||
bool swap_hv = ((shift != olive::CurrentConfig.invert_timeline_scroll_axes) &
|
||||
!zooming) | (alt & !shift & zooming);
|
||||
|
||||
int delta_h = swap_hv ? event->angleDelta().y() : event->angleDelta().x();
|
||||
@@ -1235,7 +1235,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
g.transition->secondary_clip->undeletable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// finally, perform actual movement of clips
|
||||
@@ -2351,7 +2351,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
|
||||
// get the range of tracks currently dragged
|
||||
int track_start = qMin(panel_timeline->cursor_track, panel_timeline->drag_track_start);
|
||||
int track_end = qMax(panel_timeline->cursor_track, panel_timeline->drag_track_start);
|
||||
int track_end = qMax(panel_timeline->cursor_track, panel_timeline->drag_track_start);
|
||||
int track_size = 1 + track_end - track_start;
|
||||
|
||||
// set tracks to be split
|
||||
|
||||
Reference in New Issue
Block a user