diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py index 6a47c26983b55e5b99b3aafb1ae22b780e7314ed..0f0905205fb839254bf56043ff44c1784ea99240 100644 --- a/pitivi/timeline/elements.py +++ b/pitivi/timeline/elements.py @@ -1596,6 +1596,14 @@ class TransitionClip(Clip): self.props.has_tooltip = True + overlay = self.get_children()[0] + assert isinstance(overlay, Gtk.Overlay) + drawing_area = Gtk.DrawingArea() + drawing_area.connect("draw", self._draw_cb) + overlay.add_overlay(drawing_area) + # Make this the lowermost layer to prevent it from blocking the trim handles. + overlay.reorder_overlay(drawing_area, 0) + def do_query_tooltip(self, x, y, keyboard_mode, tooltip): if self.__has_video: markup = str(self.ges_clip.props.vtype.value_nick) @@ -1605,6 +1613,25 @@ class TransitionClip(Clip): return True + def _draw_cb(self, unused_da, ctx): + height = self.ges_clip.ui.get_allocation().height + width = self.ges_clip.ui.get_allocation().width + + # Draw triangle. + ctx.set_source_rgba(.5, .6, .8, .9) + ctx.move_to(0, height) + ctx.line_to(width, 0) + ctx.line_to(0, 0) + ctx.close_path() + ctx.fill() + # Highlight diagonal + ctx.new_path() + ctx.set_source_rgba(1, 1, 1, 1) + ctx.set_line_width(1) + ctx.move_to(0, height) + ctx.line_to(width, 0) + ctx.stroke() + def _add_child(self, ges_timeline_element): Clip._add_child(self, ges_timeline_element)