[ease/video: 4/5] Merge branch 'master' into video



commit 383529326f226756292cf9a016a3605487bce722
Merge: 992ee7f a451cc9
Author: Nate Stedman <natesm gmail com>
Date:   Thu Jul 29 06:48:56 2010 -0400

    Merge branch 'master' into video
    
    Conflicts:
    	src/ease-editor-window.vala

 Makefile.am                             |    2 +
 data/ui/editor-window.ui                |   90 +++--
 ease-core/ease-core-0.1.vapi            |  747 -------------------------------
 ease-core/ease-core-0.3.vapi            |  729 ------------------------------
 ease-core/ease-document.vala            |   59 +++-
 ease-core/ease-slide.vala               |   47 ++
 ease-core/ease-theme.vala               |    3 +
 ease-core/ease-video-actor.vala         |    5 +
 ease-core/ease-video-element.vala       |   10 +
 src/ease-about-dialog.vala              |   24 +-
 src/ease-close-confirm-dialog.vala      |    4 +-
 src/ease-editor-embed.vala              |   36 +-
 src/ease-editor-window.vala             |  138 +++++--
 src/ease-handle.vala                    |   12 +-
 src/ease-inspector-pane.vala            |    8 +-
 src/ease-inspector-slide-pane.vala      |    4 +-
 src/ease-inspector-transition-pane.vala |    8 +-
 src/ease-inspector.vala                 |    6 +-
 src/ease-main.vala                      |   16 +-
 src/ease-player.vala                    |   26 +-
 src/ease-scrollable-embed.vala          |   16 +-
 src/ease-selection-rectangle.vala       |    4 +-
 src/ease-slide-actor.vala               |   46 +-
 src/ease-slide-button-panel.vala        |    6 +-
 src/ease-slide-sorter.vala              |   72 +++
 src/ease-welcome-actor.vala             |   18 +-
 src/ease-welcome-window.vala            |    8 +-
 27 files changed, 479 insertions(+), 1665 deletions(-)
---
diff --cc ease-core/ease-theme.vala
index 12a6009,12a6009..c49062c
--- a/ease-core/ease-theme.vala
+++ b/ease-core/ease-theme.vala
@@@ -107,6 -107,6 +107,9 @@@ public class Ease.Theme : GLib.Objec
  	public const string IMAGE_ASPECT = "image-fill-aspect";
  	public const string IMAGE_ORIGINAL = "image-fill-original";
  	
++	// video properties
++	public const string VIDEO_PLAY_AUTO = "video-play-automatically";
++	
  	// generic element properties
  	public const string E_IDENTIFIER = "element-identifier";
  	public const string ELEMENT_TYPE = "element-type";
diff --cc ease-core/ease-video-actor.vala
index b63b688,0000000..344764c
mode 100644,000000..100644
--- a/ease-core/ease-video-actor.vala
+++ b/ease-core/ease-video-actor.vala
@@@ -1,153 -1,0 +1,158 @@@
 +/*  Ease, a GTK presentation application
 +    Copyright (C) 2010 Nate Stedman
 +
 +    This program is free software: you can redistribute it and/or modify
 +    it under the terms of the GNU General Public License as published by
 +    the Free Software Foundation, either version 3 of the License, or
 +    (at your option) any later version.
 +
 +    This program is distributed in the hope that it will be useful,
 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +    GNU General Public License for more details.
 +
 +    You should have received a copy of the GNU General Public License
 +    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 +*/
 +
 +/**
 + * { link Actor} for videos
 + *
 + * VideoActor uses Clutter-GStreamer, and therefore supports any video
 + * format supported by the GStreamer plugins on the user's system.
 + *
 + * VideoActor "implements" Clutter.Media by passing through all function calls
 + * to its VideoTexture.
 + */
 +public class Ease.VideoActor : Actor, Clutter.Media
 +{
 +	/**
 +	 * The VideoTexture displayed by this VideoActor.
 +	 */
 +	private ClutterGst.VideoTexture video;
++	
++	/**
++	 * The "play" button in a presentation.
++	 */
++	private Clutter.CairoTexture play_button;
 +
 +	/**
 +	 * Instantiates a new VideoActor from an Element.
 +	 * 
 +	 * The VideoActor's context is particularly important due to playback.
 +	 * Playing back automatically in the editor would, of course, not be
 +	 * desired.
 +	 *
 +	 * @param e The represented element.
 +	 * @param c The context of this Actor (Presentation, Sidebar, Editor)
 +	 */
 +	public VideoActor(VideoElement e, ActorContext c)
 +	{
 +		base(e, c);
 +
 +		video = new ClutterGst.VideoTexture();
 +		video.set_filename(Path.build_filename(e.parent.parent.path,
 +		                                       e.filename));
 +
 +		// play the video if it's in the presentation
 +		if (c == ActorContext.PRESENTATION)
 +		{
 +			video.set_playing(true);
 +		}
 +		else
 +		{
 +			// FIXME: toggle playback to get a frame
 +			video.set_playing(true);
 +			video.set_playing(false);
 +		}
 +		
 +		contents = video;
 +
 +		add_actor(contents);
 +		contents.width = e.width;
 +		contents.height = e.height;
 +		x = e.x;
 +		y = e.y;
 +	}
 +	
 +	public double get_audio_volume()
 +	{
 +		return video.get_audio_volume();
 +	}
 +	
 +	public double get_buffer_fill()
 +	{
 +		return video.get_buffer_fill();
 +	}
 +	
 +	public bool get_can_seek()
 +	{
 +		return video.get_can_seek();
 +	}
 +	
 +	public double get_duration()
 +	{
 +		return video.get_duration();
 +	}
 +	
 +	public bool get_playing()
 +	{
 +		return video.get_playing();
 +	}
 +	
 +	public double get_progress()
 +	{
 +		return video.get_progress();
 +	}
 +	
 +	public unowned string get_subtitle_font_name()
 +	{
 +		return video.get_subtitle_font_name();
 +	}
 +	
 +	public unowned string get_subtitle_uri()
 +	{
 +		return video.get_subtitle_uri();
 +	}
 +	
 +	public unowned string get_uri()
 +	{
 +		return video.get_uri();
 +	}
 +	
 +	public void set_audio_volume(double volume)
 +	{
 +		video.set_audio_volume(volume);
 +	}
 +	
 +	public void set_filename(string filename)
 +	{
 +		video.set_filename(filename);
 +	}
 +	
 +	public void set_playing(bool playing)
 +	{
 +		video.set_playing(playing);
 +	}
 +	
 +	public void set_progress(double progress)
 +	{
 +		video.set_progress(progress);
 +	}
 +	
 +	public void set_subtitle_font_name(string font_name)
 +	{
 +		video.set_subtitle_font_name(font_name);
 +	}
 +	
 +	public void set_subtitle_uri(string uri)
 +	{
 +		video.set_subtitle_uri(uri);
 +	}
 +	
 +	public void set_uri(string uri)
 +	{
 +		video.set_uri(uri);
 +	}
 +}
 +
diff --cc ease-core/ease-video-element.vala
index aee9b30,0000000..b6c5dbb
mode 100644,000000..100644
--- a/ease-core/ease-video-element.vala
+++ b/ease-core/ease-video-element.vala
@@@ -1,79 -1,0 +1,89 @@@
 +/*  Ease, a GTK presentation application
 +    Copyright (C) 2010 Nate Stedman
 +
 +    This program is free software: you can redistribute it and/or modify
 +    it under the terms of the GNU General Public License as published by
 +    the Free Software Foundation, either version 3 of the License, or
 +    (at your option) any later version.
 +
 +    This program is distributed in the hope that it will be useful,
 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +    GNU General Public License for more details.
 +
 +    You should have received a copy of the GNU General Public License
 +    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 +*/
 +
 +/**
 + * A { link MediaElement} subclass for playing a vide. Linked with
 + * { link VideoActor}.
 + */
 +public class Ease.VideoElement : MediaElement
 +{
++	public bool play_auto { get; set; default = false; }
++	
 +	public VideoElement()
 +	{
 +		signals();
 +	}
 +	
 +	internal VideoElement.from_json(Json.Object obj)
 +	{
++		play_auto = obj.get_string_member(Theme.VIDEO_PLAY_AUTO).to_bool();
 +		base.from_json(obj);
 +	}	
 +	
 +	public override Actor actor(ActorContext c)
 +	{
 +		return new VideoActor(this, c);
 +	}
 +	
++	public override Json.Object to_json()
++	{
++		var obj = base.to_json();
++		obj.set_string_member(Theme.VIDEO_PLAY_AUTO, play_auto.to_string());
++		return obj;
++	}
++	
 +	public override string html_render(HTMLExporter exporter)
 +	{
 +		// open the tag
 +		var html = "<video class=\"video element\" ";
 +		
 +		// set the video's style
 +		html += "style=\"";
 +		html += "left:" + x.to_string() + "px;";
 +		html += " top:" + y.to_string() + "px;";
 +		html += " position: absolute;\" ";
 +		
 +		// set the video's size
 +		html += " width=\"" + width.to_string() + "\" ";
 +		html += " height=\"" + width.to_string() + "\" ";
 +		
 +		// set the video's source and controls
 +		html += "src=\"" + exporter.path + " " +
 +		        filename + "\" " +
 +		        "controls=\"yes\">" +
 +		        _("Your browser does not support the video tag") + 
 +		        "</video>";
 +		        
 +		// copy the video file
 +		exporter.copy_file(filename, parent.parent.path);
 +		
 +		return html;
 +	}
 +	
 +	public override Gtk.Widget inspector_widget()
 +	{
 +		var label = new Gtk.Label("No inspector for videos right now...");
 +		label.show();
 +		return label;
 +	}
 +
 +	public override void cairo_render(Cairo.Context context) throws Error
 +	{
 +		warning("Video elements don't support Cairo right now...");
 +	}
 +}
 +
diff --cc src/ease-editor-window.vala
index e68c874,f37f7d2..6763c40
--- a/src/ease-editor-window.vala
+++ b/src/ease-editor-window.vala
@@@ -398,47 -438,7 +438,47 @@@ internal class Ease.EditorWindow : Gtk.
  	}
  	
  	[CCode (instance_pos = -1)]
- 	public void insert_video(Gtk.Widget sender)
++	internal void insert_video(Gtk.Widget sender)
 +	{
 +		var dialog = new Gtk.FileChooserDialog(_("Insert Video"),
 +		                                       null,
 +		                                       Gtk.FileChooserAction.OPEN,
 +		                                       "gtk-cancel",
 +		                                       Gtk.ResponseType.CANCEL,
 +		                                       "gtk-open",
 +		                                       Gtk.ResponseType.ACCEPT);
 +
 +		if (dialog.run() == Gtk.ResponseType.ACCEPT)
 +		{
 +			try
 +			{
 +				var e = new VideoElement();
 +				
 +				// TODO: find the actual size of the video
 +				e.width = 640;
 +				e.height = 480;
 +				e.x = slide.width / 2 - e.width / 2;
 +				e.y = slide.height / 2 - e.height / 2;
 +				
 +				e.element_type = Slide.VIDEO_TYPE;
 +				e.identifier = Theme.CUSTOM_MEDIA;
 +				e.filename = document.add_media_file(dialog.get_filename());
 +				e.source_filename = dialog.get_filename();
 +				
 +				// add the element
 +				slide.append(e);
 +				embed.select_element(e);
 +			}
 +			catch (Error e)
 +			{
 +				error_dialog(_("Error Inserting Video"), e.message);
 +			}
 +		}
 +		dialog.destroy();
 +	}
 +	
 +	[CCode (instance_pos = -1)]
- 	public void on_insert_rectangle(Gtk.Widget sender)
+ 	internal void on_insert_rectangle(Gtk.Widget sender)
  	{
  		var rect = new ShapeElement(ShapeType.RECTANGLE);
  		rect.width = 400;
@@@ -462,7 -462,39 +502,33 @@@
  	}
  	
  	[CCode (instance_pos = -1)]
- 	public void zoom_in(Gtk.Widget sender)
 -	internal void insert_video(Gtk.Widget sender)
 -	{
 -		
 -	}
 -	
 -	[CCode (instance_pos = -1)]
+ 	internal void set_view(Gtk.Widget sender)
+ 	{
+ 		if (show_editor == sender)
+ 		{
+ 			if (main_bin.get_child() == editor) return;
+ 			main_bin.remove(sorter);
+ 			main_bin.add(editor);
+ 			sorter = null;
+ 		}
+ 		else if (show_sorter == sender)
+ 		{
+ 			if (sorter == null) sorter = new SlideSorter(document);
+ 			if (main_bin.get_child() == sorter) return;
+ 			main_bin.remove(editor);
+ 			main_bin.add(sorter);
+ 			sorter.show_all();
+ 			
+ 			// when a slide is clicked in the sorter, switch back here
+ 			sorter.display_slide.connect((s) => {
+ 				set_slide(document.index_of(s));
+ 				show_editor.active = true;
+ 			});
+ 		}
+ 	}
+ 	
+ 	[CCode (instance_pos = -1)]
+ 	internal void zoom_in(Gtk.Widget sender)
  	{
  		zoom_slider.zoom_in();
  	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]