[ease/libraries: 137/155] Merge branch 'master' into libraries



commit 3ad837d2750190e4a3ab69b35cd372d60612449b
Merge: 74d9417 219bd60
Author: Nate Stedman <natesm gmail com>
Date:   Mon Jul 26 03:52:07 2010 -0400

    Merge branch 'master' into libraries
    
    Conflicts:
    	Makefile.am
    	libease/ease-element-map-value.vala
    	libease/ease-element-map.vala
    	libease/ease-json-parser.vala
    	libease/ease-open-dialog.vala
    	libease/ease-pdf-exporter.vala
    	libease/ease-slide-set.vala
    	src/ease-dialogs.vala
    	src/ease-element-map-value.vala
    	src/ease-open-dialog.vala
    	src/ease-undo-source.vala
    	src/main.vala

 Makefile.am                                        |   11 +-
 configure.ac                                       |    2 +-
 data/Makefile.am                                   |   10 +
 data/theme-defaults.json                           |   14 +-
 {themes => data/themes}/Black/Theme.json           |    0
 data/themes/Blue/Theme.json                        |   13 +
 data/themes/Goddard/Media/default.jpg              |  Bin 0 -> 132275 bytes
 data/themes/Goddard/Theme.json                     |   30 +
 data/themes/Green/Theme.json                       |   13 +
 {themes/Black => data/themes/Red}/Theme.json       |    5 +-
 {themes => data/themes}/White/Theme.json           |    0
 {themes => data/themes}/build.sh                   |    2 +-
 data/ui/editor-window.ui                           |   40 +-
 data/ui/inspector-slide.ui                         |  315 ++++++
 examples/Transitions/Document.json                 | 1102 ++++++++++----------
 libease/ease-color.vala                            |   58 +-
 libease/ease-document.vala                         |  337 ++++++-
 libease/ease-editor-embed.vala                     |  292 +++++-
 libease/ease-editor-window.vala                    |  109 ++-
 libease/ease-element-map.vala                      |  127 ---
 libease/ease-element.vala                          |  356 +------
 libease/ease-enums.vala                            |   13 +
 libease/ease-gradient.vala                         |  181 +++-
 libease/ease-image-element.vala                    |   35 +-
 libease/ease-inspector-pane.vala                   |   15 +-
 libease/ease-inspector.vala                        |   19 +-
 libease/ease-json-parser.vala                      |  233 -----
 libease/ease-main.vala                             |    6 +-
 libease/ease-media-element.vala                    |   28 +-
 libease/ease-pdf-exporter.vala                     |   77 --
 libease/ease-player.vala                           |    9 +-
 libease/ease-slide-actor.vala                      |  312 +++++-
 libease/ease-slide-button-panel.vala               |   91 +-
 libease/ease-slide-pane.vala                       |  351 ++++++-
 libease/ease-slide-set.vala                        |  133 ---
 libease/ease-slide.vala                            |  383 ++++++--
 libease/ease-text-actor.vala                       |    4 +-
 libease/ease-text-element.vala                     |  275 +++---
 libease/ease-theme.vala                            |   67 +-
 libease/ease-transition-pane.vala                  |  216 ++++-
 libease/ease-transitions.vala                      |  553 +++++-----
 libease/ease-undo-action.vala                      |   20 +-
 libease/ease-undo-controller.vala                  |   20 +-
 libease/ease-utilities.vala                        |   18 +
 libease/ease-welcome-actor.vala                    |    6 +-
 libease/ease-welcome-window.vala                   |    2 +
 src/ease-clutter-iterables.vala                    |   63 ++
 .../ease-open-dialog.vala => src/ease-dialogs.vala |   53 +-
 src/ease-iterables.vala                            |   74 ++
 src/ease-selection-rectangle.vala                  |   74 ++
 src/ease-undo-actions-element.vala                 |   93 ++
 src/ease-undo-actions-slide.vala                   |   93 ++
 .../ease-undo-item.vala                            |   20 +-
 .../ease-undo-source.vala                          |   12 +-
 54 files changed, 4076 insertions(+), 2309 deletions(-)
---
diff --cc Makefile.am
index 0fadfa8,ef60e4b..2cf2576
--- a/Makefile.am
+++ b/Makefile.am
@@@ -1,6 -1,6 +1,8 @@@
  NULL =
  
 -INCLUDES = 
++SUBDIRS = po data libease src
++
 +INCLUDES = \
  	-include config.h \
  	$(EASE_CFLAGS)
  
@@@ -18,25 -93,12 +20,20 @@@ DISTCLEANFILES = data/ease.desktop 
  
  ACLOCAL_AMFLAGS = -I m4
  
- SUBDIRS = po data libease src
- 
 -doc: src/*.vala
 +pkgconfigdir = $(libdir)/pkgconfig
 +pkgconfig_DATA = ease-0.1.pc
 +
- themedir = $(datadir)/ease/themes
- theme_DATA = $(wildcard $(top_srcdir)/themes/*.easetheme)
- 
 +doc: libease/*.vala
  	rm -rf doc
 -	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/*
- 	sh themes/build.sh
+ archive: data/themes/* examples/*
+ 	sh data/themes/build.sh
  	sh examples/build.sh
  
diff --cc libease/ease-main.vala
index c11bb04,0000000..470b1f9
mode 100644,000000..100644
--- a/libease/ease-main.vala
+++ b/libease/ease-main.vala
@@@ -1,231 -1,0 +1,229 @@@
 +/*  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/>.
 +*/
 +
 +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;
 +		}
 +
 +		// 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);
++				var doc = new Document.from_saved(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);
++			var doc = new Document.from_saved(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();
 +		}
 +	}
 +}
 +



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