92
92
self.MyCanvas = goocanvas.Canvas()
93
93
self.MyCanvas.connect("scroll-event", self.on_scrolledwindow_Right_scroll_event)
94
self.MyCanvas.set_bounds (0, 0, 50000, 3000)
94
self.MyCanvas.set_bounds (0, 0, 50000, 1000)
95
95
hboxTimeline.set_border_width(0)
96
96
self.MyCanvas.show()
782
785
#////////////////////
788
def expand_timeline(self, clip_object):
789
""" Determine if the timeline needs to be expanded. """
790
# get end time of dropped clip
791
position = clip_object.position_on_track
792
length = clip_object.length()
793
end_of_clip = position + length
795
# get length of timeline
796
timeline_length = self.project.sequences[0].length
798
# does timeline need to be extended?
799
if end_of_clip > timeline_length:
800
# update length of timeline
801
self.project.sequences[0].length = end_of_clip
785
807
def on_frmMain_delete_event(self, widget, *args):
787
809
# get correct gettext method
1583
def on_hsZoom_value_changed(self, widget, *args):
1605
def on_hsZoom_change_value(self, widget, *args):
1585
1607
# get correct gettext method
1610
# get current horizontal scroll position & time
1611
pixels_per_second = self.project.sequences[0].get_pixels_per_second()
1612
current_scroll_pixels = self.hscrollbar2.get_value()
1613
current_scroll_time = current_scroll_pixels / pixels_per_second
1588
1615
# get the value of the zoom slider (this value represents the number of seconds
1589
1616
# between the tick marks on the timeline ruler
1598
1625
# re-render the timeline with the new scale
1599
1626
self.project.Render()
1628
# scroll to last scroll position
1629
self.scroll_to_last(current_scroll_time)
1632
def scroll_to_last(self, current_scroll_time):
1633
# get position of play-head
1634
pixels_per_second = self.project.sequences[0].get_pixels_per_second()
1635
goto_pixel = current_scroll_time * pixels_per_second
1637
# scroll to last scroll position
1638
self.hscrollbar2.set_value(goto_pixel)
1641
def scroll_to_playhead(self):
1642
""" scroll the horizontal scroll if the playhead is playing, and moves
1643
past the center point of the screen. """
1645
if self.MyVideo.isPlaying:
1647
# get current scroll position
1648
current_scroll_pixels = self.hscrollbar2.get_value()
1650
# get playhead position
1651
pixels_per_second = self.project.sequences[0].get_pixels_per_second()
1652
playhead_time = self.project.sequences[0].play_head_position
1653
playhead_pixels = playhead_time * pixels_per_second
1655
# get the middle of the window
1656
screen_width = (self.width / 2) - 100
1658
if playhead_pixels > (current_scroll_pixels + screen_width):
1659
# scroll to last scroll position
1660
self.hscrollbar2.set_value(playhead_pixels - screen_width)
1602
1663
def on_tlbResize_toggled(self, widget, *args):
1603
1664
print "on_tlbResize_toggled called with self.%s" % widget.get_name()
1668
1729
def on_scrolledwindow_Right_scroll_event(self, widget, *args):
1670
## Manually scroll the scrollbars
1671
if args[0].direction == gtk.gdk.SCROLL_DOWN:
1672
widget = self.vscrollbar2
1673
vertical_value = widget.get_value() + 10
1675
# Update vertical scrollbar value
1676
widget.set_value(vertical_value)
1678
# Get horizontal value
1679
horizontal_scrollbar = self.hscrollbar2
1680
horizontal_value = horizontal_scrollbar.get_value()
1682
# scroll the canvases
1683
self.MyCanvas.scroll_to(horizontal_value, vertical_value)
1684
self.MyCanvas_Left.scroll_to(horizontal_value, vertical_value)
1731
# Is the CTRL key pressed?
1732
if args[0].state & gtk.gdk.CONTROL_MASK:
1733
# CTRL Key - thus we need to zoom in or out
1734
if args[0].direction == gtk.gdk.SCROLL_DOWN:
1736
self.on_btnZoomOu_clicked(widget)
1739
self.on_btnZoomIn_clicked(widget)
1686
widget = self.vscrollbar2
1687
vertical_value = widget.get_value() - 10
1689
# Update vertical scrollbar value
1690
widget.set_value(vertical_value)
1692
# Get horizontal value
1693
horizontal_scrollbar = self.hscrollbar2
1694
horizontal_value = horizontal_scrollbar.get_value()
1696
# scroll the canvases
1697
self.MyCanvas.scroll_to(horizontal_value, vertical_value)
1698
self.MyCanvas_Left.scroll_to(horizontal_value, vertical_value)
1744
# Regular scroll... scroll canvas vertical
1745
## Manually scroll the scrollbars
1746
if args[0].direction == gtk.gdk.SCROLL_DOWN:
1747
widget = self.vscrollbar2
1748
vertical_value = widget.get_value() + 10
1750
# Update vertical scrollbar value
1751
widget.set_value(vertical_value)
1753
# Get horizontal value
1754
horizontal_scrollbar = self.hscrollbar2
1755
horizontal_value = horizontal_scrollbar.get_value()
1757
# scroll the canvases
1758
self.MyCanvas.scroll_to(horizontal_value, vertical_value)
1759
self.MyCanvas_Left.scroll_to(horizontal_value, vertical_value)
1761
widget = self.vscrollbar2
1762
vertical_value = widget.get_value() - 10
1764
# Update vertical scrollbar value
1765
widget.set_value(vertical_value)
1767
# Get horizontal value
1768
horizontal_scrollbar = self.hscrollbar2
1769
horizontal_value = horizontal_scrollbar.get_value()
1771
# scroll the canvases
1772
self.MyCanvas.scroll_to(horizontal_value, vertical_value)
1773
self.MyCanvas_Left.scroll_to(horizontal_value, vertical_value)
1700
1777
# Don't bubble up the scroll event. This prevents the scroll wheel from
1701
1778
# scrolling the individual canvas.