From 101ad79e9d074b7e02db277d69a79815171bd86b Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Thu, 7 Feb 2019 03:54:03 +1100 Subject: [PATCH] added graph editor to maximize panel --- mainwindow.cpp | 3 ++- ui/viewercontainer.cpp | 32 ++++++++++++++++---------------- ui/viewerwidget.cpp | 4 ++++ 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 805d06552..0e1480127 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1231,7 +1231,8 @@ void MainWindow::maximize_panel() { if (focused_panel != panel_effect_controls) removeDockWidget(panel_effect_controls); if (focused_panel != panel_timeline) removeDockWidget(panel_timeline); if (focused_panel != panel_sequence_viewer) removeDockWidget(panel_sequence_viewer); - if (focused_panel != panel_footage_viewer) removeDockWidget(panel_footage_viewer); + if (focused_panel != panel_footage_viewer) removeDockWidget(panel_footage_viewer); + if (focused_panel != panel_graph_editor) removeDockWidget(panel_graph_editor); } } else { // we must be maximized, restore previous state diff --git a/ui/viewercontainer.cpp b/ui/viewercontainer.cpp index 8a744f2ec..f42999c5e 100644 --- a/ui/viewercontainer.cpp +++ b/ui/viewercontainer.cpp @@ -84,24 +84,21 @@ void ViewerContainer::adjust() { if (!fit) { widget_width -= vertical_scrollbar->sizeHint().width(); widget_height -= horizontal_scrollbar->sizeHint().height(); - } - - double widget_ar = double(widget_width) / double(widget_height); - - bool widget_is_wider_than_sequence = widget_ar > aspect_ratio; - - if (widget_is_wider_than_sequence) { - widget_width = widget_height * aspect_ratio; - widget_x = (width() / 2) - (widget_width / 2); - } else { - widget_height = widget_width / aspect_ratio; - widget_y = (height() / 2) - (widget_height / 2); - } - - child->move(widget_x, widget_y); - child->resize(widget_width, widget_height); + } if (fit) { + double widget_ar = double(widget_width) / double(widget_height); + + bool widget_is_wider_than_sequence = widget_ar > aspect_ratio; + + if (widget_is_wider_than_sequence) { + widget_width = widget_height * aspect_ratio; + widget_x = (width() / 2) - (widget_width / 2); + } else { + widget_height = widget_width / aspect_ratio; + widget_y = (height() / 2) - (widget_height / 2); + } + zoom = double(widget_width) / double(viewer->seq->width); } else if (zoomed_width > width() || zoomed_height > height()) { horizontal_scrollbar->setVisible(true); @@ -115,6 +112,9 @@ void ViewerContainer::adjust() { adjust_scrollbars(); } + + child->move(widget_x, widget_y); + child->resize(widget_width, widget_height); } else { // if the zoom size is smaller than the available area, scale the surface down diff --git a/ui/viewerwidget.cpp b/ui/viewerwidget.cpp index 57bd5c0a3..aa60717d0 100644 --- a/ui/viewerwidget.cpp +++ b/ui/viewerwidget.cpp @@ -585,6 +585,7 @@ void ViewerWidget::paintGL() { glBegin(GL_QUADS); + double ar_diff = (double(viewer->seq->width)/double(viewer->seq->height)/(double(width())/double(height()))); double zoom_factor = container->zoom/(double(width())/double(viewer->seq->width)); double zoom_size = (zoom_factor*2.0) - 2.0; double zoom_left = -zoom_size*x_scroll - 1.0; @@ -592,6 +593,9 @@ void ViewerWidget::paintGL() { double zoom_bottom = -zoom_size*(1.0-y_scroll) - 1.0; double zoom_top = zoom_size*(y_scroll) + 1.0; + //zoom_left *= ar_diff; + //zoom_right *= ar_diff; + glVertex2d(zoom_left, zoom_bottom); glTexCoord2d(0, 0); glVertex2d(zoom_left, zoom_top);