[ease/video: 2/2] [editor] Allow the user to add videos.
- From: Nate Stedman <natesm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ease/video: 2/2] [editor] Allow the user to add videos.
- Date: Thu, 29 Jul 2010 00:31:15 +0000 (UTC)
commit 10582e9ed16120bd9bf82fa1a58c9b7eac5efc41
Author: Nate Stedman <natesm gmail com>
Date: Wed Jul 28 20:15:43 2010 -0400
[editor] Allow the user to add videos.
data/ui/editor-window.ui | 2 +-
ease-core/ease-slide.vala | 8 +++++-
ease-core/ease-video-element.vala | 10 +++++++
src/ease-editor-window.vala | 49 +++++++++++++++++++++++++++++++-----
src/ease-main.vala | 2 +
5 files changed, 62 insertions(+), 9 deletions(-)
---
diff --git a/data/ui/editor-window.ui b/data/ui/editor-window.ui
index 06b27ed..854cce3 100644
--- a/data/ui/editor-window.ui
+++ b/data/ui/editor-window.ui
@@ -199,6 +199,7 @@
<property name="visible">True</property>
<property name="label" translatable="yes">_Video</property>
<property name="use_underline">True</property>
+ <signal name="activate" handler="ease_editor_window_insert_video"/>
</object>
</child>
<child>
@@ -244,7 +245,6 @@
<property name="visible">True</property>
<property name="label" translatable="yes">_View</property>
<property name="use_underline">True</property>
- <signal name="activate" handler="ease_editor_window_insert_video"/>
<child type="submenu">
<object class="GtkMenu" id="menu3">
<property name="visible">True</property>
diff --git a/ease-core/ease-slide.vala b/ease-core/ease-slide.vala
index 22dfb13..fd96cc7 100644
--- a/ease-core/ease-slide.vala
+++ b/ease-core/ease-slide.vala
@@ -25,6 +25,8 @@
public class Ease.Slide : GLib.Object, UndoSource
{
public const string IMAGE_TYPE = "EaseImageElement";
+ public const string SHAPE_TYPE = "EaseShapeElement";
+ public const string VIDEO_TYPE = "EaseVideoElement";
/**
* The { link Element}s contained by this Slide
@@ -262,10 +264,14 @@ public class Ease.Slide : GLib.Object, UndoSource
{
e = new ImageElement.from_json(node);
}
- else if (type == "EaseShapeElement")
+ else if (type == SHAPE_TYPE)
{
e = new ShapeElement.from_json(node);
}
+ else if (type == VIDEO_TYPE)
+ {
+ e = new VideoElement.from_json(node);
+ }
else
{
e = new TextElement.from_json(node);
diff --git a/ease-core/ease-video-element.vala b/ease-core/ease-video-element.vala
index 6867bd4..aee9b30 100644
--- a/ease-core/ease-video-element.vala
+++ b/ease-core/ease-video-element.vala
@@ -21,6 +21,16 @@
*/
public class Ease.VideoElement : MediaElement
{
+ public VideoElement()
+ {
+ signals();
+ }
+
+ internal VideoElement.from_json(Json.Object obj)
+ {
+ base.from_json(obj);
+ }
+
public override Actor actor(ActorContext c)
{
return new VideoActor(this, c);
diff --git a/src/ease-editor-window.vala b/src/ease-editor-window.vala
index 7577ecf..b739614 100644
--- a/src/ease-editor-window.vala
+++ b/src/ease-editor-window.vala
@@ -389,7 +389,7 @@ public class Ease.EditorWindow : Gtk.Window
e.width = width;
e.height = height;
e.x = slide.width / 2 - width / 2;
- e.y = slide.height / 2 - width / 2;
+ e.y = slide.height / 2 - height / 2;
e.element_type = Slide.IMAGE_TYPE;
e.identifier = Theme.CUSTOM_MEDIA;
@@ -410,6 +410,47 @@ public class Ease.EditorWindow : Gtk.Window
}
[CCode (instance_pos = -1)]
+ public 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.add(e);
+ add_undo_action(new ElementAddUndoAction(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)
{
var rect = new ShapeElement(ShapeType.RECTANGLE);
@@ -436,12 +477,6 @@ public class Ease.EditorWindow : Gtk.Window
}
[CCode (instance_pos = -1)]
- public void insert_video(Gtk.Widget sender)
- {
-
- }
-
- [CCode (instance_pos = -1)]
public void zoom_in(Gtk.Widget sender)
{
zoom_slider.zoom_in();
diff --git a/src/ease-main.vala b/src/ease-main.vala
index 470b1f9..485fb13 100644
--- a/src/ease-main.vala
+++ b/src/ease-main.vala
@@ -68,6 +68,8 @@ public class Ease.Main : GLib.Object
stdout.printf(_("error parsing options: %s\n"), e.message);
return 1;
}
+
+ Gst.init(ref args);
// initalize static classes
windows = new Gee.ArrayList<EditorWindow>();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]