[ease/libraries: 100/100] Merge branch 'master' into libraries



commit 74d9417a2c855db025b4190e0e7e6399a884707d
Merge: c0b32f8 f54e44c
Author: Nate Stedman <natesm gmail com>
Date:   Sat Jul 24 02:32:01 2010 -0400

    Merge branch 'master' into libraries
    
    Conflicts:
    	.gitignore
    	Makefile.am
    	configure.ac
    	libease/ease-slide-button.vala
    	libease/ease-undo-actions.vala
    	libease/ease-video-actor.vala
    	libease/ease-video-element.vala
    	src/main.vala

 .gitignore                             |   11 +
 Makefile.am                            |   14 +-
 autogen.sh                             |    2 +-
 configure.ac                           |   38 +--
 data/Makefile.am                       |   11 +-
 data/ease.desktop.in                   |    1 -
 data/ease.desktop.in.in                |   11 +
 data/svg/handle-black.svg              |   74 ---
 data/svg/handle-white.svg              |   74 ---
 data/theme-defaults.json               |   49 ++
 data/ui/editor-window.ui               |   15 +-
 data/ui/welcome-window.ui              |  110 +++++
 examples/Transitions/Document.json     |  756 +++++++++++++-------------------
 libease/Makefile.am                    |   10 +-
 libease/ease-about-dialog.vala         |   11 +
 libease/ease-animated-zoom-slider.vala |   65 +++
 libease/ease-color.vala                |  249 +++++++++++
 libease/ease-document.vala             |   72 +++-
 libease/ease-editor-embed.vala         |   89 ++---
 libease/ease-editor-window.vala        |  117 +++++-
 libease/ease-element.vala              |   20 +-
 libease/ease-gradient.vala             |  166 +++++++
 libease/ease-handle.vala               |   61 ++--
 libease/ease-html-exporter.vala        |   12 +
 libease/ease-image-element.vala        |    2 +-
 libease/ease-json-parser.vala          |   73 +---
 libease/ease-main.vala                 |   14 +-
 libease/ease-pdf-exporter.vala         |   43 +--
 libease/ease-player.vala               |  229 +++++++----
 libease/ease-scrollable-embed.vala     |    5 +-
 libease/ease-slide-actor.vala          |   10 +-
 libease/ease-slide-button-panel.vala   |  204 ++++++++--
 libease/ease-slide-button.vala         |  134 ------
 libease/ease-slide-set.vala            |   40 +-
 libease/ease-slide.vala                |   74 +++-
 libease/ease-temp.vala                 |  185 ++++++---
 libease/ease-text-actor.vala           |   31 +-
 libease/ease-text-element.vala         |  119 +++---
 libease/ease-theme.vala                |  579 ++++++++++++++++++++++++-
 libease/ease-transition-pane.vala      |    6 +
 libease/ease-undo-action.vala          |  108 +++++
 libease/ease-undo-actions.vala         |   82 ----
 libease/ease-utilities.vala            |  235 ++++++++++-
 libease/ease-video-actor.vala          |  153 -------
 libease/ease-video-element.vala        |   83 ----
 libease/ease-welcome-actor.vala        |  227 +++++++---
 libease/ease-welcome-window.vala       |  326 +++++++-------
 libease/ease-zoom-slider.vala          |   33 +--
 po/POTFILES.in                         |   13 +-
 po/POTFILES.skip                       |   19 +-
 po/de.po                               |  120 +++---
 po/es.po                               |  121 +++---
 po/fr.po                               |  110 +++---
 po/pt_BR.po                            |  330 +++++++++-----
 po/sl.po                               |  152 +++----
 src/Makefile.am                        |    2 +-
 src/main.vala                          |    3 +-
 themes/Black/Theme.json                |   12 +
 themes/Pink/Media/Background.svg       |   11 -
 themes/Pink/Theme.json                 |   67 ---
 themes/White/Theme.json                |   69 +---
 61 files changed, 3662 insertions(+), 2400 deletions(-)
---
diff --cc .gitignore
index 9d58789,dbf1773..39a7704
--- a/.gitignore
+++ b/.gitignore
@@@ -60,3 -63,11 +63,11 @@@ INSTAL
  *.pc
  *.la
  *.stamp
+ 
+ # l18n
+ *.gmo
+ POTFILES
+ 
+ # some extra things
+ data/ease.desktop
 -stamp-*
++stamp-*
diff --cc Makefile.am
index 2c0ae1a,52ab9ee..0fadfa8
--- a/Makefile.am
+++ b/Makefile.am
@@@ -7,11 -7,81 +7,10 @@@ INCLUDES = 
  AM_CPPFLAGS = \
  	$(EASE_CFLAGS) \
  	-include $(CONFIG_HEADER) \
+ 	-O0 \
  	$(NULL)
  
- SUBDIRS = po data libease src
- 
- EXTRA_DIST = data/ease.desktop.in  \
 -ease_SOURCES = \
 -	src/ease-about-dialog.vala \
 -	src/ease-actor.vala \
 -	src/ease-animated-zoom-slider.vala \
 -	src/ease-close-confirm-dialog.vala \
 -	src/ease-color.vala \
 -	src/ease-document.vala \
 -	src/ease-editor-embed.vala \
 -	src/ease-editor-window.vala \
 -	src/ease-element-map.vala \
 -	src/ease-element-map-value.vala \
 -	src/ease-element.vala \
 -	src/ease-enums.vala \
 -	src/ease-gradient.vala \
 -	src/ease-handle.vala \
 -	src/ease-html-exporter.vala \
 -	src/ease-image-actor.vala \
 -	src/ease-image-element.vala \
 -	src/ease-inspector-pane.vala \
 -	src/ease-inspector.vala \
 -	src/ease-inspector-window.vala \
 -	src/ease-json-parser.vala \
 -	src/ease-media-element.vala \
 -	src/ease-open-dialog.vala \
 -	src/ease-pdf-exporter.vala \
 -	src/ease-player.vala \
 -	src/ease-scrollable-embed.vala \
 -	src/ease-slide-actor.vala \
 -	src/ease-slide-button-panel.vala \
 -	src/ease-slide-pane.vala \
 -	src/ease-slide-set.vala \
 -	src/ease-slide.vala \
 -	src/ease-temp.vala \
 -	src/ease-text-actor.vala \
 -	src/ease-text-element.vala \
 -	src/ease-theme.vala \
 -	src/ease-transformations.vala \
 -	src/ease-transition-pane.vala \
 -	src/ease-transitions.vala \
 -	src/ease-undo-action.vala \
 -	src/ease-undo-controller.vala \
 -	src/ease-utilities.vala \
 -	src/ease-welcome-actor.vala \
 -	src/ease-welcome-window.vala \
 -	src/ease-zoom-slider.vala \
 -	src/main.vala \
 -	$(NULL)
 -
 -# ease_VALAFLAGS = $(EASE_PACKAGES)
 -VALAFLAGS = --pkg glib-2.0 \
 -		--pkg gtk+-2.0 \
 -		--pkg clutter-1.0 \
 -		--pkg gdk-2.0 \
 -		--pkg gee-1.0 \
 -		--pkg clutter-gtk-0.10 \
 -		--pkg cogl-1.0 \
 -		--pkg gio-2.0 \
 -		--pkg json-glib-1.0\
 -		--pkg libarchive\
 -		--pkg gmodule-2.0\
 -		-g \
 -		$(NULL)
 -
 -SUBDIRS = po data
 -
 -ease_LDADD = \
 -	$(EASE_LIBS) \
 -	$(NULL)
 -
+ EXTRA_DIST = data/ease.desktop.in.in  \
  	$(NULL)
  
  DISTCLEANFILES = data/ease.desktop \
@@@ -19,15 -89,12 +18,22 @@@
  
  ACLOCAL_AMFLAGS = -I m4
  
++SUBDIRS = po data libease src
++
 +pkgconfigdir = $(libdir)/pkgconfig
 +pkgconfig_DATA = ease-0.1.pc
 +
  themedir = $(datadir)/ease/themes
  theme_DATA = $(wildcard $(top_srcdir)/themes/*.easetheme)
  
 -doc: src/*.vala
 +doc: libease/*.vala
  	rm -rf doc
- 	valadoc --internal --private $(EASE_PACKAGES) --directory=./doc --basedir=src ./libease/*.vala
 -	valadoc --internal --private --pkg "json-glib-1.0" --pkg "gee-1.0"  --pkg "clutter-gtk-0.10" --pkg "libarchive" --directory=./doc --basedir=src ./src/*.vala
++	
++	valadoc \
++		--internal \
++		$(EASE_PACKAGES) \
++		--directory=./doc --basedir=src ./libease/*.vala
++	
  	gnome-open doc/doc/Ease.html
  
  archive: themes/* examples/*
diff --cc configure.ac
index d46919a,98104e7..4871ffb
--- a/configure.ac
+++ b/configure.ac
@@@ -32,56 -26,10 +32,30 @@@ dnl LT_PREREQ([2.2.6]
  GNOME_COMPILE_WARNINGS([maximum])
  GNOME_MAINTAINER_MODE_DEFINES
  
--dnl FIXME
 -pkg_modules="clutter-gtk-0.10 >= 0.10 gee-1.0 >= 0.5.0 json-glib-1.0 >= 0.7.6 libarchive gmodule-2.0"
 -
 -EASE_PACKAGES="--pkg gee-1.0 --pkg clutter-gtk-0.10 --pkg libarchive --pkg gmodule-2.0"
++dnl packages
 +pkg_modules=" \
++	gee-1.0 \
 +	clutter-gtk-0.10 >= 0.10 \
- 	gee-1.0 >= 0.5.0 \
- 	clutter-gst-1.0 >= 1.0.0 \
- 	json-glib-1.0 >= 0.7.6 \
 +	libarchive \
- 	gmodule-2.0"
++	json-glib-1.0 >= 0.7.6"
 +
 +EASE_PACKAGES=" \
- 	--pkg glib-2.0 \ 
- 	--pkg gtk+-2.0 \
- 	--pkg clutter-1.0 \
- 	--pkg gdk-2.0 \
- 	--pkg libxml-2.0 \
 +	--pkg gee-1.0 \
 +	--pkg clutter-gtk-0.10 \
- 	--pkg cogl-1.0 \
- 	--pkg gio-2.0 \
- 	--pkg clutter-gst-1.0 \
 +	--pkg libarchive \
- 	--pkg gmodule-2.0"
++	--pkg json-glib-1.0"
 +
 +EASE_CFLAGS="\`pkg-config --cflags \
- 	glib-2.0 \
- 	gtk+-2.0 \
- 	clutter-1.0 \
- 	gdk-2.0 \
 +	gee-1.0 \
 +	clutter-gtk-0.10 \
- 	cogl-1.0 \
- 	gio-2.0 \
- 	clutter-gst-1.0 \
 +	json-glib-1.0 \
- 	libarchive \
- 	gmodule-2.0 \`"
++	libarchive \`"
 +
 +EASE_LDFLAGS="\`pkg-config --libs \
- 	glib-2.0 \
- 	gtk+-2.0 \
- 	clutter-1.0 \
- 	gdk-2.0 \
 +	gee-1.0 \
 +	clutter-gtk-0.10 \
- 	cogl-1.0 \
- 	gio-2.0 \
- 	clutter-gst-1.0 \
 +	json-glib-1.0 \
- 	libarchive \
- 	gmodule-2.0 \`"
++	libarchive \`"
  
  PKG_CHECK_MODULES(EASE, [$pkg_modules])
  
diff --cc libease/Makefile.am
index 1db4cb1,0000000..4b3858d
mode 100644,000000..100644
--- a/libease/Makefile.am
+++ b/libease/Makefile.am
@@@ -1,75 -1,0 +1,75 @@@
 +lib_LTLIBRARIES = libease-0.1.la
 +
 +INCLUDES = \
 +	-include config.h \
 +	$(EASE_CFLAGS)
 +
 +AM_CPPFLAGS = \
 +	$(EASE_CFLAGS) \
 +	-include $(CONFIG_HEADER) \
 +	$(NULL)
 +
 +# source files
 +libease_0_1_la_SOURCES = \
 +	ease-about-dialog.vala \
 +	ease-actor.vala \
++	ease-animated-zoom-slider.vala \
 +	ease-close-confirm-dialog.vala \
++	ease-color.vala \
 +	ease-document.vala \
 +	ease-editor-embed.vala \
 +	ease-editor-window.vala \
 +	ease-element-map.vala \
 +	ease-element-map-value.vala \
 +	ease-element.vala \
 +	ease-enums.vala \
++	ease-gradient.vala \
 +	ease-handle.vala \
 +	ease-html-exporter.vala \
 +	ease-image-actor.vala \
 +	ease-image-element.vala \
 +	ease-inspector-pane.vala \
 +	ease-inspector.vala \
 +	ease-inspector-window.vala \
 +	ease-json-parser.vala \
++	ease-main.vala \
 +	ease-media-element.vala \
 +	ease-open-dialog.vala \
 +	ease-pdf-exporter.vala \
 +	ease-player.vala \
 +	ease-scrollable-embed.vala \
 +	ease-slide-actor.vala \
 +	ease-slide-button-panel.vala \
- 	ease-slide-button.vala \
 +	ease-slide-pane.vala \
 +	ease-slide-set.vala \
 +	ease-slide.vala \
 +	ease-temp.vala \
 +	ease-text-actor.vala \
 +	ease-text-element.vala \
 +	ease-theme.vala \
 +	ease-transformations.vala \
 +	ease-transition-pane.vala \
 +	ease-transitions.vala \
- 	ease-undo-actions.vala \
++	ease-undo-action.vala \
 +	ease-undo-controller.vala \
 +	ease-utilities.vala \
- 	ease-video-actor.vala \
- 	ease-video-element.vala \
 +	ease-welcome-actor.vala \
 +	ease-welcome-window.vala \
 +	ease-zoom-slider.vala \
- 	ease-main.vala \
 +	$(NULL)
 +
 +# compiler flags
 +libease_0_1_la_VALAFLAGS = \
 +	$(EASE_PACKAGES) \
 +	--vapi=ease.vapi \
 +	--header=libease.h \
 +	--thread \
 +	-g \
 +	$(NULL)
 +
 +libease_0_1_la_CFLAGS = $(EASE_CFLAGS)
 +libease_0_1_la_LDFLAGS = $(EASE_LDFLAGS)
 +
 +# header installation
 +libease_includedir=$(includedir)/ease-0.1/
 +libease_include_HEADERS = libease.h
diff --cc libease/ease-animated-zoom-slider.vala
index 0000000,21bac65..21bac65
mode 000000,100644..100644
--- a/libease/ease-animated-zoom-slider.vala
+++ b/libease/ease-animated-zoom-slider.vala
diff --cc libease/ease-color.vala
index 0000000,e0b0fc2..e0b0fc2
mode 000000,100644..100644
--- a/libease/ease-color.vala
+++ b/libease/ease-color.vala
diff --cc libease/ease-gradient.vala
index 0000000,0f3f960..0f3f960
mode 000000,100644..100644
--- a/libease/ease-gradient.vala
+++ b/libease/ease-gradient.vala
diff --cc libease/ease-main.vala
index 0738b01,0000000..c11bb04
mode 100644,000000..100644
--- a/libease/ease-main.vala
+++ b/libease/ease-main.vala
@@@ -1,243 -1,0 +1,231 @@@
 +/*  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/>.
 +*/
 +
- /**
-  * Handles core actions in Ease
-  *
-  * When Ease starts, the  simple C main function calls a function in this
-  * class. Main then initializes GTK, Clutter, and anything else.
-  * 
-  * Main keeps track of { link EditorWindow}s, as well as the status of the
-  * single { link WelcomeWindow}. Main will end Ease if none of these are
-  * shown on the screen.
-  */
- public static class Ease.Main : GLib.Object
++public class Ease.Main : GLib.Object
 +{
 +	private static Gee.ArrayList<EditorWindow> windows;
 +	private static WelcomeWindow welcome;
 +	
 +	// options
 +	static string play_filename;
 +	static string[] filenames;
 +	public static bool presentation_windowed = false;
 +	
 +	private const OptionEntry[] options = {
 +		{ "play", 'p', 0, OptionArg.FILENAME, ref play_filename,
 +		   "Play the specified file", "FILE" },
 +		{ "window", 'w', 0, OptionArg.NONE, ref presentation_windowed,
 +		  "Display presentations in a window", null},
 +		{ "", 0, 0, OptionArg.FILENAME_ARRAY, ref filenames, null, "FILE..." },
 +		{ null } };
 +	
 +	private static Player player;
 +	
 +	/**
 +	 * Start Ease to edit files.
 +	 * 
 +	 * If the user runs Ease with a filename as a parameter, this function
 +	 * will open an { link EditorWindow}. Otherwise, a { link WelcomeWindow}
 +	 * will be opened.
 +	 *
 +	 * @param args Program arguments.
 +	 */
 +	public static int main(string[] args)
 +	{	
 +		// parse command line options
 +		var context = new OptionContext(_(" - a presentation editor"));
 +		
 +		// TODO: set translation
 +		context.add_main_entries(options, null);
 +
 +		// add library option groups
 +		context.add_group(Gtk.get_option_group(true));
 +		context.add_group(Clutter.get_option_group());
 +		
 +		try
 +		{
 +			if (!context.parse(ref args))
 +			{
 +				return 1;
 +			}
 +		}
 +		catch (OptionError e)
 +		{
 +			stdout.printf(_("error parsing options: %s\n"), e.message);
 +			return 1;
 +		}
- 	
- 		ClutterGst.init(ref args);
 +
 +		// initalize static classes
 +		Transitions.init();
 +		OpenDialog.init();
 +		windows = new Gee.ArrayList<EditorWindow>();
 +		
 +		// Clutter settings
 +		var backend = Clutter.get_default_backend();
 +		var settings = Gtk.Settings.get_default();
 +		backend.set_double_click_time(settings.gtk_double_click_time);
 +		backend.set_double_click_distance(settings.gtk_double_click_distance);
 +	
 +		// open editor windows for each argument specified
 +		if (filenames != null)
 +		{
 +			for (int i = 0; filenames[i] != null; i++)
 +			{
 +				open_file(filenames[i]);
 +			}
 +		}
 +		
 +		// if --play is specified, play the presentation
 +		if (play_filename != null)
 +		{
 +			try
 +			{
 +				var doc = JSONParser.document(play_filename);
 +				player = new Player(doc);
 +			
 +				// if no editor windows are specified, quit when done
 +				if (filenames == null)
 +				{
 +					player.stage.hide.connect(() => {
 +						Gtk.main_quit();
 +					});
 +				}
 +			}
 +			catch (Error e)
 +			{
 +				error_dialog(_("Error Playing Document"), e.message);
 +			}
 +		}
 +		
 +		// if no files are given, show the new presentation window
 +		if (filenames == null && play_filename == null)
 +		{
 +			show_welcome();
 +		}
 +	
 +		Gtk.main();
 +		
 +		Temp.clean();
 +	
 +		return 0;
 +	}
 +
 +	/**
 +	 * Creates a new { link EditorWindow}, or raises an existing one.
 +	 *
 +	 * If the passed filename does not have a window associated with it,
 +	 * a new window will be created to edit that file. Otherwise, the currently
 +	 * existing window will be raised.
 +	 *
 +	 * @param path The filename
 +	 */
 +	public static void open_file(string path)
 +	{
 +		foreach (var w in windows)
 +		{
 +			if (w.document.path == path)
 +			{
 +				w.present();
 +				
 +				return;
 +			}
 +		}
 +		
 +		try
 +		{
 +			var doc = JSONParser.document(path);
 +			add_window(new EditorWindow(doc));
 +		}
 +		catch (Error e)
 +		{
 +			error_dialog(_("Error Opening Document"), e.message);
 +			return;
 +		}
 +	}
 +
 +	/**
 +	 * Removes an { link EditorWindow} from Ease's internal store of windows.
 +	 * 
 +	 * Ease tracks the current windows in order to properly quit when there
 +	 * are no { link EditorWindow}s on screen and the { link WelcomeWindow} is
 +	 * hidden. This function will quit Ease if the removed window is the final
 +	 * window and the { link WelcomeWindow} is hidden.
 +	 *
 +	 * @param win The { link EditorWindow}.
 +	 */
 +	public static void remove_window(EditorWindow win)
 +	{
 +		windows.remove(win);
 +		if (windows.size == 0 && welcome == null)
 +		{
 +			Gtk.main_quit();
 +		}
 +	}
 +
 +	/**
 +	 * Adds an { link EditorWindow} to Ease's internal store of windows.
 +	 * 
 +	 * Ease tracks the current windows in order to properly quit when there
 +	 * are no { link EditorWindow}s on screen and the { link WelcomeWindow} is
 +	 * hidden. 
 +	 *
 +	 * @param win The { link EditorWindow}.
 +	 */
 +	public static void add_window(EditorWindow win)
 +	{
 +		windows.add(win);
 +	}
 +
 +	/**
 +	 * Shows the { link WelcomeWindow}
 +	 * 
 +	 * Shows the { link WelcomeWindow}, or raises it to the top if it is not
 +	 * already displayed.
 +	 *
 +	 */
 +	public static void show_welcome()
 +	{
 +		if (welcome == null)
 +		{
 +			welcome = new WelcomeWindow();
 +			welcome.hide.connect(() => remove_welcome());
 +		}
 +		else
 +		{
 +			welcome.present();
 +		}
 +	}
 +
 +	/**
 +	 * Hides the { link WelcomeWindow}.
 +	 * 
 +	 * It's important to call this function when the { link WelcomeWindow} is
 +	 * hidden, so that Ease can properly exit when all windows are closed.
 +	 * When the { link WelcomeWindow} is shown via show_welcome, this function
 +	 * is automatically added in that window's hide signal handler.
 +	 */
 +	public static void remove_welcome()
 +	{
 +		welcome.hide_all();
 +		welcome = null;
 +		if (windows.size == 0)
 +		{
 +			Gtk.main_quit();
 +		}
 +	}
 +}
 +
diff --cc libease/ease-undo-action.vala
index 0000000,fa39ba7..fa39ba7
mode 000000,100644..100644
--- a/libease/ease-undo-action.vala
+++ b/libease/ease-undo-action.vala
diff --cc src/Makefile.am
index 5d685f1,0000000..0530953
mode 100644,000000..100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@@ -1,18 -1,0 +1,18 @@@
 +bin_PROGRAMS = ease
 +
 +# source files
 +ease_SOURCES = main.vala
 +
 +# compiler flags
 +ease_VALAFLAGS = \
 +	--pkg ease \
 +	$(EASE_PACKAGES) \
 +	--vapidir ../libease
 +
 +ease_LDADD = \
 +	../libease/libease-0.1.la \
 +	$(EASE_LIBS) \
 +	$(NULL)
 +	
- ease_CFLAGS = $(EASE_CFLAGS)
++ease_CFLAGS = $(EASE_CFLAGS) -I../libease/libease.h
 +ease_LDFLAGS = $(EASE_LDFLAGS)
diff --cc src/main.vala
index d57d61e,6b2fc58..a7c98a4
--- a/src/main.vala
+++ b/src/main.vala
@@@ -15,8 -15,227 +15,7 @@@
      along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
  
- public static int main(string[] args)
 -/**
 - * Handles core actions in Ease
 - *
 - * When Ease starts, the  simple C main function calls a function in this
 - * class. Main then initializes GTK, Clutter, and anything else.
 - * 
 - * Main keeps track of { link EditorWindow}s, as well as the status of the
 - * single { link WelcomeWindow}. Main will end Ease if none of these are
 - * shown on the screen.
 - */
 -public static class Ease.Main : GLib.Object
++public int main(string args[])
  {
 -	private static Gee.ArrayList<EditorWindow> windows;
 -	private static WelcomeWindow welcome;
 -	
 -	// options
 -	static string play_filename;
 -	static string[] filenames;
 -	public static bool presentation_windowed = false;
 -	
 -	private const OptionEntry[] options = {
 -		{ "play", 'p', 0, OptionArg.FILENAME, ref play_filename,
 -		   "Play the specified file", "FILE" },
 -		{ "window", 'w', 0, OptionArg.NONE, ref presentation_windowed,
 -		  "Display presentations in a window", null},
 -		{ "", 0, 0, OptionArg.FILENAME_ARRAY, ref filenames, null, "FILE..." },
 -		{ null } };
 -	
 -	private static Player player;
 -	
 -	/**
 -	 * Start Ease to edit files.
 -	 * 
 -	 * If the user runs Ease with a filename as a parameter, this function
 -	 * will open an { link EditorWindow}. Otherwise, a { link WelcomeWindow}
 -	 * will be opened.
 -	 *
 -	 * @param args Program arguments.
 -	 */
 -	public static int main(string[] args)
 -	{	
 -		// parse command line options
 -		var context = new OptionContext(_(" - a presentation editor"));
 -		
 -		// TODO: set translation
 -		context.add_main_entries(options, null);
 -
 -		// add library option groups
 -		context.add_group(Gtk.get_option_group(true));
 -		context.add_group(Clutter.get_option_group());
 -		
 -		try
 -		{
 -			if (!context.parse(ref args))
 -			{
 -				return 1;
 -			}
 -		}
 -		catch (OptionError e)
 -		{
 -			stdout.printf(_("error parsing options: %s\n"), e.message);
 -			return 1;
 -		}
 -
 -		// initalize static classes
 -		Transitions.init();
 -		OpenDialog.init();
 -		windows = new Gee.ArrayList<EditorWindow>();
 -		
 -		// Clutter settings
 -		var backend = Clutter.get_default_backend();
 -		var settings = Gtk.Settings.get_default();
 -		backend.set_double_click_time(settings.gtk_double_click_time);
 -		backend.set_double_click_distance(settings.gtk_double_click_distance);
 -	
 -		// open editor windows for each argument specified
 -		if (filenames != null)
 -		{
 -			for (int i = 0; filenames[i] != null; i++)
 -			{
 -				open_file(filenames[i]);
 -			}
 -		}
 -		
 -		// if --play is specified, play the presentation
 -		if (play_filename != null)
 -		{
 -			try
 -			{
 -				var doc = JSONParser.document(play_filename);
 -				player = new Player(doc);
 -			
 -				// if no editor windows are specified, quit when done
 -				if (filenames == null)
 -				{
 -					player.stage.hide.connect(() => {
 -						Gtk.main_quit();
 -					});
 -				}
 -			}
 -			catch (Error e)
 -			{
 -				error_dialog(_("Error Playing Document"), e.message);
 -			}
 -		}
 -		
 -		// if no files are given, show the new presentation window
 -		if (filenames == null && play_filename == null)
 -		{
 -			show_welcome();
 -		}
 -	
 -		Gtk.main();
 -		
 -		Temp.clean();
 -	
 -		return 0;
 -	}
 -
 -	/**
 -	 * Creates a new { link EditorWindow}, or raises an existing one.
 -	 *
 -	 * If the passed filename does not have a window associated with it,
 -	 * a new window will be created to edit that file. Otherwise, the currently
 -	 * existing window will be raised.
 -	 *
 -	 * @param path The filename
 -	 */
 -	public static void open_file(string path)
 -	{
 -		foreach (var w in windows)
 -		{
 -			if (w.document.path == path)
 -			{
 -				w.present();
 -				
 -				return;
 -			}
 -		}
 -		
 -		try
 -		{
 -			var doc = JSONParser.document(path);
 -			add_window(new EditorWindow(doc));
 -		}
 -		catch (Error e)
 -		{
 -			error_dialog(_("Error Opening Document"), e.message);
 -			return;
 -		}
 -	}
 -
 -	/**
 -	 * Removes an { link EditorWindow} from Ease's internal store of windows.
 -	 * 
 -	 * Ease tracks the current windows in order to properly quit when there
 -	 * are no { link EditorWindow}s on screen and the { link WelcomeWindow} is
 -	 * hidden. This function will quit Ease if the removed window is the final
 -	 * window and the { link WelcomeWindow} is hidden.
 -	 *
 -	 * @param win The { link EditorWindow}.
 -	 */
 -	public static void remove_window(EditorWindow win)
 -	{
 -		windows.remove(win);
 -		if (windows.size == 0 && welcome == null)
 -		{
 -			Gtk.main_quit();
 -		}
 -	}
 -
 -	/**
 -	 * Adds an { link EditorWindow} to Ease's internal store of windows.
 -	 * 
 -	 * Ease tracks the current windows in order to properly quit when there
 -	 * are no { link EditorWindow}s on screen and the { link WelcomeWindow} is
 -	 * hidden. 
 -	 *
 -	 * @param win The { link EditorWindow}.
 -	 */
 -	public static void add_window(EditorWindow win)
 -	{
 -		windows.add(win);
 -	}
 -
 -	/**
 -	 * Shows the { link WelcomeWindow}
 -	 * 
 -	 * Shows the { link WelcomeWindow}, or raises it to the top if it is not
 -	 * already displayed.
 -	 *
 -	 */
 -	public static void show_welcome()
 -	{
 -		if (welcome == null)
 -		{
 -			welcome = new WelcomeWindow();
 -			welcome.hide.connect(() => remove_welcome());
 -		}
 -		else
 -		{
 -			welcome.present();
 -		}
 -	}
 -
 -	/**
 -	 * Hides the { link WelcomeWindow}.
 -	 * 
 -	 * It's important to call this function when the { link WelcomeWindow} is
 -	 * hidden, so that Ease can properly exit when all windows are closed.
 -	 * When the { link WelcomeWindow} is shown via show_welcome, this function
 -	 * is automatically added in that window's hide signal handler.
 -	 */
 -	public static void remove_welcome()
 -	{
 -		welcome.hide_all();
 -		welcome = null;
 -		if (windows.size == 0)
 -		{
 -			Gtk.main_quit();
 -		}
 -	}
 +	return Ease.Main.main(args);
  }
--



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