~francesco-hermanitosverdes/openshot/hv_francesco

« back to all changes in this revision

Viewing changes to openshot/windows/MainGTK.py

  • Committer: Jonathan Thomas
  • Date: 2009-11-23 05:18:01 UTC
  • Revision ID: jonathan@jonathan64-20091123051801-puk4ywupukusoeb9
Bumped to version 0.9.54

Timeline now auto-extends when a clip is dragged or
resized past the edge of the timeline.

The size of the ruler and the timeline are now
in sync.  There used to be a small difference, which 
caused some strange results when scrolled all the 
way to the right side of the timeline.

The ruler has been tweaked, to better draw the 
tick marks, so there is not a gap at the end of the 
ruler.

The video thread now pauses the project when it reaches
100%.  This was a bug, but never caused an issue, until
I added some of these new features in this version.

Zoom in and zoom out now keeps your scrollbar position
and maintains it.  For example, it translates the timecode
associated with the left edge of your scrollbar, and no
matter what your zoom level, maintains that timecode.

The play-head is now auto-centered while you are playing 
back / previewing your project.  When the play-head
goes past 1/2 of your screen width, it starts to animate and
auto scroll to keep the timeline centered.

The zoom slider has been adjusted to DELAYED.  This means 
when you stop sliding it, it then updates the timeline.  You
don't have to let go of the slider, just stop sliding it, and
it will adjust your timeline.  This makes it much easier to 
see the results as you slide the bar.

Also, a new key mapping has been added, CTRL + Scroll Wheel.
Just move your mouse over the timeline, and hold the CTRL key
and scroll your mouse wheel.  It also maintains your scrollbars,
so you won't get lost.  Also, if you are playing your project,
it will continue to auto-scroll the timeline even while you zoom in
and zoom out (unless the play-head is not 1/2 way across the screen.

The .Desktop file has been updated to fix some issues with 
Debian validation.

All 7 default languages have been updated with new translations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
 
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()
97
97
                
763
763
                        
764
764
                        # move play head to top (over the clip)
765
765
                        #drop_track.parent.play_head.raise_(None)
 
766
                        
 
767
                        # check if the timeline needs to be expanded
 
768
                        self.expand_timeline(self.new_clip_object)
766
769
 
767
770
                else:
768
771
                        # Remove clip, because of invalid parent
782
785
        #////////////////////
783
786
 
784
787
 
 
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
 
794
                
 
795
                # get length of timeline
 
796
                timeline_length = self.project.sequences[0].length
 
797
                
 
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
 
802
                        
 
803
                        # refresh timeline
 
804
                        self.refresh()
 
805
 
 
806
 
785
807
        def on_frmMain_delete_event(self, widget, *args):
786
808
                
787
809
                # get correct gettext method
1580
1602
                        
1581
1603
                        
1582
1604
                
1583
 
        def on_hsZoom_value_changed(self, widget, *args):
 
1605
        def on_hsZoom_change_value(self, widget, *args):
1584
1606
 
1585
1607
                # get correct gettext method
1586
1608
                _ = self._
 
1609
                
 
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
1587
1614
 
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()
1600
1627
                
 
1628
                # scroll to last scroll position
 
1629
                self.scroll_to_last(current_scroll_time)
 
1630
                
 
1631
                
 
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
 
1636
 
 
1637
                # scroll to last scroll position
 
1638
                self.hscrollbar2.set_value(goto_pixel)
 
1639
 
 
1640
        
 
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. """ 
 
1644
                
 
1645
                if self.MyVideo.isPlaying:
 
1646
                        
 
1647
                        # get current scroll position
 
1648
                        current_scroll_pixels = self.hscrollbar2.get_value()
 
1649
                        
 
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
 
1654
                        
 
1655
                        # get the middle of the window
 
1656
                        screen_width = (self.width / 2) - 100
 
1657
                        
 
1658
                        if playhead_pixels > (current_scroll_pixels + screen_width):
 
1659
                                # scroll to last scroll position
 
1660
                                self.hscrollbar2.set_value(playhead_pixels - screen_width)
 
1661
 
1601
1662
                
1602
1663
        def on_tlbResize_toggled(self, widget, *args):
1603
1664
                print "on_tlbResize_toggled called with self.%s" % widget.get_name()
1667
1728
 
1668
1729
        def on_scrolledwindow_Right_scroll_event(self, widget, *args):
1669
1730
 
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
1674
 
 
1675
 
                        # Update vertical scrollbar value
1676
 
                        widget.set_value(vertical_value)
1677
 
 
1678
 
                        # Get horizontal value
1679
 
                        horizontal_scrollbar = self.hscrollbar2
1680
 
                        horizontal_value = horizontal_scrollbar.get_value()
1681
 
 
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:
 
1735
                                # Zoom Out
 
1736
                                self.on_btnZoomOu_clicked(widget)
 
1737
                        else:
 
1738
                                # Zoom In
 
1739
                                self.on_btnZoomIn_clicked(widget)
 
1740
                        
 
1741
                        
1685
1742
                else:
1686
 
                        widget = self.vscrollbar2          
1687
 
                        vertical_value = widget.get_value() - 10
1688
 
 
1689
 
                        # Update vertical scrollbar value
1690
 
                        widget.set_value(vertical_value)
1691
 
 
1692
 
                        # Get horizontal value
1693
 
                        horizontal_scrollbar = self.hscrollbar2
1694
 
                        horizontal_value = horizontal_scrollbar.get_value()
1695
 
 
1696
 
                        # scroll the canvases
1697
 
                        self.MyCanvas.scroll_to(horizontal_value, vertical_value)
1698
 
                        self.MyCanvas_Left.scroll_to(horizontal_value, vertical_value)
 
1743
                        
 
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
 
1749
        
 
1750
                                # Update vertical scrollbar value
 
1751
                                widget.set_value(vertical_value)
 
1752
        
 
1753
                                # Get horizontal value
 
1754
                                horizontal_scrollbar = self.hscrollbar2
 
1755
                                horizontal_value = horizontal_scrollbar.get_value()
 
1756
        
 
1757
                                # scroll the canvases
 
1758
                                self.MyCanvas.scroll_to(horizontal_value, vertical_value)
 
1759
                                self.MyCanvas_Left.scroll_to(horizontal_value, vertical_value)
 
1760
                        else:
 
1761
                                widget = self.vscrollbar2          
 
1762
                                vertical_value = widget.get_value() - 10
 
1763
        
 
1764
                                # Update vertical scrollbar value
 
1765
                                widget.set_value(vertical_value)
 
1766
        
 
1767
                                # Get horizontal value
 
1768
                                horizontal_scrollbar = self.hscrollbar2
 
1769
                                horizontal_value = horizontal_scrollbar.get_value()
 
1770
        
 
1771
                                # scroll the canvases
 
1772
                                self.MyCanvas.scroll_to(horizontal_value, vertical_value)
 
1773
                                self.MyCanvas_Left.scroll_to(horizontal_value, vertical_value)
 
1774
 
 
1775
 
1699
1776
 
1700
1777
                # Don't bubble up the scroll event.  This prevents the scroll wheel from 
1701
1778
                # scrolling the individual canvas.