Commit beb3cce3 authored by Harish Fulara's avatar Harish Fulara Committed by Alexandru Băluț

timeline: Show vertical scrollbar only when needed

Fixes #1811
parent 2b115b75
Pipeline #46839 passed with stages
in 67 minutes and 26 seconds
......@@ -1353,6 +1353,7 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
self.app.project_manager.connect("new-project-loaded",
self._projectLoadedCb)
self.timeline.connect("size-allocate", self.__timeline_size_allocate_cb)
# Public API
......@@ -1499,9 +1500,11 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
self.timeline = Timeline(self.app, left_size_group)
vscrollbar = Gtk.Scrollbar(orientation=Gtk.Orientation.VERTICAL,
adjustment=self.timeline.vadj)
vscrollbar.get_style_context().add_class("background")
# Vertical Scrollbar. It will be displayed only when needed.
self.vscrollbar = Gtk.Scrollbar(orientation=Gtk.Orientation.VERTICAL,
adjustment=self.timeline.vadj)
self.vscrollbar.get_style_context().add_class("background")
hscrollbar = Gtk.Scrollbar(orientation=Gtk.Orientation.HORIZONTAL,
adjustment=self.timeline.hadj)
hscrollbar.get_style_context().add_class("background")
......@@ -1522,7 +1525,7 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
self.attach(zoom_box, 0, 0, 1, 1)
self.attach(self.ruler, 1, 0, 1, 1)
self.attach(self.timeline, 0, 1, 2, 1)
self.attach(vscrollbar, 2, 1, 1, 1)
self.attach(self.vscrollbar, 2, 1, 1, 1)
self.attach(hscrollbar, 1, 2, 1, 1)
self.attach(self.toolbar, 3, 1, 1, 1)
......@@ -1946,6 +1949,10 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
self._framerate = videorate
self.ruler.setProjectFrameRate(self._framerate)
def __timeline_size_allocate_cb(self, unused_widget, allocation):
fits = self.timeline.layout.props.height <= allocation.height
self.vscrollbar.set_opacity(0 if fits else 1)
def _projectLoadedCb(self, unused_project_manager, project):
"""Connects to the project's timeline and pipeline."""
if self._project:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment