[ease] Try to restore scaling. Connect menubar quit item.



commit 822a007949fc165799181c44ea4ae47c8316502f
Author: Stéphane Maniaci <stephane maniaci gmail com>
Date:   Wed Jul 7 20:25:26 2010 -0500

    Try to restore scaling. Connect menubar quit item.

 data/ui/editor-window.ui |    1 +
 src/ease-player.vala     |   42 ++++++++++++++++++++++++++++++++++++++----
 2 files changed, 39 insertions(+), 4 deletions(-)
---
diff --git a/data/ui/editor-window.ui b/data/ui/editor-window.ui
index 60736d2..d077301 100644
--- a/data/ui/editor-window.ui
+++ b/data/ui/editor-window.ui
@@ -108,6 +108,7 @@
                     <property name="visible">True</property>
                     <property name="use_underline">True</property>
                     <property name="use_stock">True</property>
+                    <signal name="activate" handler="gtk_main_quit"/>
                   </object>
                 </child>
               </object>
diff --git a/src/ease-player.vala b/src/ease-player.vala
index 7a5e766..b7b6bc8 100644
--- a/src/ease-player.vala
+++ b/src/ease-player.vala
@@ -42,6 +42,14 @@ public class Ease.Player : GLib.Object
 	// constants
 	private const uint FADE_IN_TIME = 1000;
 
+	// focus actors
+	private Clutter.Group shader;
+	private Clutter.Rectangle top_right;
+	private Clutter.Rectangle top_left;
+	private Clutter.Rectangle bottom_left;
+	private Clutter.Rectangle bottom_right;
+	private const uint FOCUS_SIZE = 50;
+	
 	public Player(Document doc)
 	{
 		document = doc;
@@ -52,15 +60,36 @@ public class Ease.Player : GLib.Object
 		stage.height = document.height * scale;
 		stage.title = _("Ease Presentation");
 		stage.use_fog = false;
-		
+		stage.set_fullscreen (true);
+		stage.show_all ();
+		stage.hide_all ();
+		// scale the presentation if needed
+		if (stage.width < document.width || stage.height < document.height)
+		{
+			var x = ((float)stage.width) / document.width;
+			var y = ((float)stage.height) / document.height;
+            
+			scale = x < y ? x : y;
+		}
+
+		// keyboard handling
 		stage.key_press_event.connect ( (ev) => 
 			{
 				on_key_press (ev);
 				return true;
 			});
-		stage.hide_cursor();
+
+		// mouse handling
+		stage.button_press_event.connect ( (ev) =>
+			{
+				on_button_press (ev);
+				return true;
+			});
+		// FIXME : do I really have to do lambda functions each time ?
+		
+		// TODO : auto hide/show of the cursor.
+		// stage.hide_cursor();
 		
-		stage.show_all();
 		stage.color = {0, 0, 0, 255};
 		Clutter.grab_keyboard(stage);
 
@@ -71,13 +100,18 @@ public class Ease.Player : GLib.Object
 		container.scale_y = scale;
 		
 		// start the presentation
-		stage.set_fullscreen (true);
 		stage.show_all ();
 
 		can_animate = true;
 		advance();
 	}
 	
+	public void on_button_press (Clutter.ButtonEvent event)
+	{
+		debug ("Got a mouse click");
+		
+	}
+
 	public void on_key_press (Clutter.KeyEvent event)
 	{
 		/* Coded with /usr/include/clutter-1.0/clutter/clutter-keysyms.h */



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