[pitivi] Add a button to toggle a "gapless" (auto-ripple) timeline mode
- From: Jean-François Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Add a button to toggle a "gapless" (auto-ripple) timeline mode
- Date: Thu, 4 Apr 2013 20:16:04 +0000 (UTC)
commit e643fb547fe9a49d831d31e8e278124992c55291
Author: Jean-François Fortin Tam <nekohayo gmail com>
Date: Fri Mar 15 16:29:54 2013 -0400
Add a button to toggle a "gapless" (auto-ripple) timeline mode
Fixes bug #668056
data/pixmaps/Makefile.am | 1 +
data/pixmaps/pitivi-gapless-24.svg | 340 ++++++++++++++++++++++++++++++++++++
pitivi/mainwindow.py | 27 +++
pitivi/timeline/track.py | 4 +-
4 files changed, 370 insertions(+), 2 deletions(-)
---
diff --git a/data/pixmaps/Makefile.am b/data/pixmaps/Makefile.am
index e72c548..8273502 100644
--- a/data/pixmaps/Makefile.am
+++ b/data/pixmaps/Makefile.am
@@ -4,6 +4,7 @@ pixmap_DATA = \
pitivi-advanced-22.png \
pitivi-advanced-24.png \
pitivi-align-24.svg \
+ pitivi-gapless-24.svg \
pitivi-group-24.svg \
pitivi-keyframe-24.svg \
pitivi-keyframe.svg \
diff --git a/data/pixmaps/pitivi-gapless-24.svg b/data/pixmaps/pitivi-gapless-24.svg
new file mode 100644
index 0000000..a2a3a80
--- /dev/null
+++ b/data/pixmaps/pitivi-gapless-24.svg
@@ -0,0 +1,340 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="24"
+ height="24"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.48.3.1 r9886"
+ sodipodi:modified="true"
+ version="1.0"
+ sodipodi:docname="pitivi-gapless-24.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3817">
+ <stop
+ style="stop-color:#3c6618;stop-opacity:1;"
+ offset="0"
+ id="stop3819" />
+ <stop
+ style="stop-color:#49910b;stop-opacity:1;"
+ offset="1"
+ id="stop3821" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3243">
+ <stop
+ style="stop-color:#3465a4;stop-opacity:1;"
+ offset="0"
+ id="stop3245" />
+ <stop
+ style="stop-color:#3465a4;stop-opacity:0;"
+ offset="1"
+ id="stop3247" />
+ </linearGradient>
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 24 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="48 : 24 : 1"
+ inkscape:persp3d-origin="24 : 16 : 1"
+ id="perspective7" />
+ <linearGradient
+ gradientTransform="matrix(1.004639,0,0,1,-1.037685,4.7681e-2)"
+ gradientUnits="userSpaceOnUse"
+ y2="40.231434"
+ x2="34.744495"
+ y1="10.445395"
+ x1="17.498823"
+ id="linearGradient5315"
+ xlink:href="#linearGradient5113"
+ inkscape:collect="always" />
+ <radialGradient
+ r="8.0625"
+ fy="19.03125"
+ fx="11.25"
+ cy="19.03125"
+ cx="11.25"
+ gradientTransform="matrix(1,0,0,0.282946,0,13.64644)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient4354"
+ xlink:href="#linearGradient5105"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient5113"
+ inkscape:collect="always">
+ <stop
+ id="stop5115"
+ offset="0"
+ style="stop-color:white;stop-opacity:1;" />
+ <stop
+ id="stop5117"
+ offset="1"
+ style="stop-color:white;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5105"
+ inkscape:collect="always">
+ <stop
+ id="stop5107"
+ offset="0"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ id="stop5109"
+ offset="1"
+ style="stop-color:black;stop-opacity:0;" />
+ </linearGradient>
+ <inkscape:perspective
+ id="perspective3181"
+ inkscape:persp3d-origin="24 : 16 : 1"
+ inkscape:vp_z="48 : 24 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 24 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5113"
+ id="linearGradient3199"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,0.2905223,-0.2891808,0,18.630492,26.384583)"
+ x1="17.498823"
+ y1="10.445395"
+ x2="34.744495"
+ y2="40.231434" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5105"
+ id="radialGradient3204"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.282946,0,13.64644)"
+ cx="11.25"
+ cy="19.03125"
+ fx="11.25"
+ fy="19.03125"
+ r="8.0625" />
+ <radialGradient
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.444008,0,21.02345)"
+ r="7.953125"
+ fy="37.8125"
+ fx="25.015625"
+ cy="37.8125"
+ cx="25.015625"
+ id="radialGradient3131"
+ xlink:href="#linearGradient3125"
+ inkscape:collect="always" />
+ <radialGradient
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.39823,0,25.31195)"
+ r="7.0625"
+ fy="42.0625"
+ fx="16.6875"
+ cy="42.0625"
+ cx="16.6875"
+ id="radialGradient3117"
+ xlink:href="#linearGradient3109"
+ inkscape:collect="always" />
+ <radialGradient
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.39823,0,25.31195)"
+ r="7.0625"
+ fy="42.0625"
+ fx="16.6875"
+ cy="42.0625"
+ cx="16.6875"
+ id="radialGradient3115"
+ xlink:href="#linearGradient3109"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient3109"
+ inkscape:collect="always">
+ <stop
+ id="stop3111"
+ offset="0"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ id="stop3113"
+ offset="1"
+ style="stop-color:black;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3125"
+ inkscape:collect="always">
+ <stop
+ id="stop3127"
+ offset="0"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ id="stop3129"
+ offset="1"
+ style="stop-color:black;stop-opacity:0;" />
+ </linearGradient>
+ <inkscape:perspective
+ id="perspective2435"
+ inkscape:persp3d-origin="24 : 16 : 1"
+ inkscape:vp_z="48 : 24 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 24 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3243"
+ id="linearGradient3479"
+ gradientUnits="userSpaceOnUse"
+ x1="11.976621"
+ y1="5.1620197"
+ x2="0.75"
+ y2="4.8084664" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3817"
+ id="linearGradient3034"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-6.9826798,-0.98353391)"
+ x1="9.6897869"
+ y1="3.0831845"
+ x2="9.6897869"
+ y2="8.8845434" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="22.627416"
+ inkscape:cx="22.85294"
+ inkscape:cy="16.409922"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ width="48px"
+ height="48px"
+ borderlayer="true"
+ inkscape:showpageshadow="false"
+ showgrid="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1022"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:snap-grids="false"
+ inkscape:window-maximized="1">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2380"
+ visible="true"
+ enabled="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="clips and stuff"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+
style="color:#000000;fill:url(#linearGradient3034);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect3020"
+ width="15"
+ height="6"
+ x="-4.9826798"
+ y="2.0164659" />
+ <use
+ x="0"
+ y="0"
+ xlink:href="#rect3020"
+ id="use3825"
+ width="24"
+ height="24"
+ transform="translate(23.025166,-0.03293201)"
+ style="opacity:0.5" />
+ <use
+ x="0"
+ y="0"
+ xlink:href="#use3825"
+ id="use3827"
+ transform="translate(2.0329319,7.0823304)"
+ width="24"
+ height="24" />
+ <use
+ x="0"
+ y="0"
+ xlink:href="#use3827"
+ id="use3030"
+ transform="translate(-4.0658642,6.9384856)"
+ width="24"
+ height="24" />
+ <path
+
style="fill:none;stroke:#2d90c0;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 10.562408,1.0190286 0,22.0086994"
+ id="path3036"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cc" />
+ <use
+ x="0"
+ y="0"
+ xlink:href="#path3036"
+ id="use3806"
+ width="24"
+ height="24"
+ transform="translate(0.92807769,0)"
+ style="opacity:0.4" />
+ <use
+ x="0"
+ y="0"
+ xlink:href="#use3806"
+ id="use3808"
+ transform="translate(1.016466,0)"
+ width="24"
+ height="24"
+ style="opacity:0.3" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer2"
+ inkscape:label="arrows"
+ sodipodi:insensitive="true">
+ <path
+ inkscape:connector-curvature="0"
+
style="fill:#dfdfdf;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
+ d="m 17.053833,9.085048 c -1.072127,0.941051 -2.872834,2.004354 -3.944961,2.945405 1.072127,0.936334
2.872834,2.039115 3.944961,2.975449 0,-0.448679 0,-1.451849 0,-1.900529 0.845997,0 2.092738,0 2.938735,0
0,-0.972357 0,-1.161399 0,-2.133756 -0.845997,0 -2.092738,0 -2.938735,0 0,-0.456347 0,-1.4302204 0,-1.886569
z"
+ id="path4348"
+ sodipodi:nodetypes="cccccccc" />
+ <use
+ x="0"
+ y="0"
+ xlink:href="#path4348"
+ id="use3854"
+ width="24"
+ height="24"
+ transform="translate(0,-7.0277281)" />
+ <use
+ x="0"
+ y="0"
+ xlink:href="#path4348"
+ id="use3856"
+ transform="translate(0,6.9384856)"
+ width="24"
+ height="24" />
+ </g>
+</svg>
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 27cd67e..ac74397 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -122,6 +122,10 @@ GlobalSettings.addConfigOption('lastCurrentVersion',
section='version',
key='last-current-version',
default='')
+GlobalSettings.addConfigOption('timelineAutoRipple',
+ section='user-interface',
+ key='timeline-autoripple',
+ default=False)
# FIXME PyGi to get stock_add working
@@ -138,6 +142,7 @@ def create_stock_icons():
# Translators: This is an action, the title of a button
('pitivi-group', _('Group'), 0, 0, 'pitivi'),
('pitivi-align', _('Align'), 0, 0, 'pitivi'),
+ ('pitivi-gapless', _('Gapless mode'), 0, 0, 'pitivi'),
])
pixmaps = {
"pitivi-render": "pitivi-render-24.png",
@@ -146,6 +151,7 @@ def create_stock_icons():
"pitivi-ungroup": "pitivi-ungroup-24.svg",
"pitivi-group": "pitivi-group-24.svg",
"pitivi-align": "pitivi-align-24.svg",
+ "pitivi-gapless": "pitivi-gapless-24.svg",
}
factory = Gtk.IconFactory()
pmdir = get_pixmap_dir()
@@ -433,6 +439,14 @@ class PitiviMainWindow(Gtk.Window, Loggable):
ttb.get_style_context().add_class("inline-toolbar")
ttb.set_orientation(Gtk.Orientation.VERTICAL)
ttb.set_style(Gtk.ToolbarStyle.ICONS)
+ # Toggle/pushbuttons like the "gapless mode" ones are special, it seems
+ # you can't insert them as normal "actions", so we create them here:
+ ttb_gaplessmode_button = Gtk.ToggleToolButton()
+ ttb_gaplessmode_button.set_stock_id("pitivi-gapless")
+ ttb_gaplessmode_button.set_tooltip_markup(_("Toggle gapless mode\n"
+ "When enabled, adjacent clips automatically move to fill gaps."))
+ ttb_gaplessmode_button.show()
+ ttb.add(ttb_gaplessmode_button)
self.vpaned.pack2(timeline_area, resize=True, shrink=False)
timeline_area.pack_start(self.timeline_ui, expand=True, fill=True, padding=0)
@@ -472,11 +486,15 @@ class PitiviMainWindow(Gtk.Window, Loggable):
self.move(self.settings.mainWindowX, self.settings.mainWindowY)
if allow_full_screen and self.settings.mainWindowFullScreen:
self.setFullScreen(True)
+ # Restore the state of the timeline's "gapless" mode:
+ self._autoripple_active = self.settings.timelineAutoRipple
+ ttb_gaplessmode_button.set_active(self._autoripple_active)
# Connect the main window's signals at the end, to avoid messing around
# with the restoration of settings above.
self.connect("delete-event", self._deleteCb)
self.connect("configure-event", self._configureCb)
+ ttb_gaplessmode_button.connect("toggled", self._gaplessmodeToggledCb)
def switchContextTab(self, tab=None):
"""
@@ -799,6 +817,15 @@ class PitiviMainWindow(Gtk.Window, Loggable):
self.prefsdialog.dialog.set_transient_for(self)
self.prefsdialog.run()
+ def _gaplessmodeToggledCb(self, widget):
+ if widget.get_active():
+ self.info("Automatic ripple activated")
+ self._autoripple_active = True
+ else:
+ self.info("Automatic ripple deactivated")
+ self._autoripple_active = False
+ self.settings.timelineAutoRipple = self._autoripple_active
+
def _projectManagerNewProjectLoadedCb(self, projectManager, project, unused_fully_loaded):
"""
Once a new project has been loaded, wait for media library's
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index b67ed72..1d3f272 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -228,7 +228,7 @@ class TrackElementController(Controller):
self._context.editTo(position, priority)
def _getMode(self):
- if self._shift_down:
+ if self._shift_down or self.app.gui._autoripple_active:
return GES.EditMode.EDIT_RIPPLE
elif self._control_down:
return GES.EditMode.EDIT_ROLL
@@ -390,7 +390,7 @@ class TrackElement(View, GooCanvas.CanvasGroup, Zoomable, Loggable):
self._view.app.action_log.begin("move object")
def _getMode(self):
- if self._shift_down:
+ if self._shift_down or self.app.gui._autoripple_active:
return GES.EditMode.EDIT_RIPPLE
return GES.EditMode.EDIT_NORMAL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]