[ease/inspector: 4/4] Added the inspector as a single window.



commit 68466989cdc314361ed550ed3b29a91fbb224010
Author: Nate Stedman <natesm gmail com>
Date:   Thu Jun 3 02:34:28 2010 -0400

    Added the inspector as a single window.

 src/EditorWindow.vala    |   23 +++--------------------
 src/InspectorWindow.vala |   17 ++++++++++++++++-
 src/TransitionPane.vala  |    1 +
 3 files changed, 20 insertions(+), 21 deletions(-)
---
diff --git a/src/EditorWindow.vala b/src/EditorWindow.vala
index c597ae8..2ab1fce 100644
--- a/src/EditorWindow.vala
+++ b/src/EditorWindow.vala
@@ -40,14 +40,11 @@ public class Ease.EditorWindow : Gtk.Window
 	public Document document;
 	public Slide slide;
 	
-	private Inspector inspector;
-	
 	// the UndoController for this window
 	private UndoController undo;
 	
 	// interface variables
-	public bool inspector_shown { get; set; }
-	public bool slides_shown { get; set; }
+	private bool slides_shown;
 	
 	// constants
 	private int[] ZOOM_LEVELS = {10, 25, 33, 50, 66, 75, 100, 125, 150,
@@ -76,9 +73,6 @@ public class Ease.EditorWindow : Gtk.Window
 		// undo controller
 		undo = new UndoController();
 		
-		// the inspector
-		inspector = new Inspector();
-		
 		// main editor
 		embed = new EditorEmbed(document, this);
 		
@@ -88,7 +82,6 @@ public class Ease.EditorWindow : Gtk.Window
 		hpaned.pack1(slides_win, false, false);
 		hpaned.pack2(embed, true, true);
 		hbox.pack_start(hpaned, true, true, 0);
-		hbox.pack_start(inspector, false, false, 0);
 		
 		// assemble window contents
 		var vbox = new Gtk.VBox(false, 0);
@@ -103,8 +96,6 @@ public class Ease.EditorWindow : Gtk.Window
 		add(vbox);
 		show_all();
 		embed.show();
-		inspector.hide();
-		inspector_shown = false;
 		slides_shown = true;
 		
 		// USER INTERFACE SIGNALS
@@ -113,15 +104,7 @@ public class Ease.EditorWindow : Gtk.Window
 		
 		// show and hide inspector
 		main_toolbar.inspector.clicked.connect(() => {
-			if (inspector_shown)
-			{
-				inspector.hide();
-			}
-			else
-			{
-				inspector.show();
-			}
-			inspector_shown = !inspector_shown;
+			InspectorWindow.toggle();
 		});
 		
 		// show and hide slides
@@ -211,7 +194,7 @@ public class Ease.EditorWindow : Gtk.Window
 		slide = document.slides.get(index);
 		
 		// update ui elements for this new slide
-		inspector.slide = slide;
+		InspectorWindow.slide = slide;
 		embed.set_slide(slide);
 	}
 	
diff --git a/src/InspectorWindow.vala b/src/InspectorWindow.vala
index d426cbf..bf7ac93 100644
--- a/src/InspectorWindow.vala
+++ b/src/InspectorWindow.vala
@@ -22,11 +22,19 @@
 public class Ease.InspectorWindow : Gtk.Window
 {
 	private Inspector inspector;
+	private const bool SKIP_TASKBAR = true;
+	private const int MIN_WIDTH = 200;
+	private const int MIN_HEIGHT = 500;
 	
 	public InspectorWindow()
 	{
 		inspector = new Inspector();
 		
+		title = _("Inspector");
+		
+		height_request = MIN_HEIGHT;
+		skip_taskbar_hint = SKIP_TASKBAR;
+		
 		add(inspector);
 	}
 	
@@ -41,6 +49,10 @@ public class Ease.InspectorWindow : Gtk.Window
 		if (instance == null)
 		{
 			instance = new InspectorWindow();
+			if (slide_priv != null)
+			{
+				instance.slide = slide_priv;
+			}
 		}
 		
 		if (instance.visible)
@@ -66,7 +78,10 @@ public class Ease.InspectorWindow : Gtk.Window
 		{
 			if (slide_priv != value)
 			{
-				instance.inspector.slide = value;
+				if (instance != null)
+				{
+					instance.inspector.slide = value;
+				}
 				slide_priv = value;
 			}
 		}
diff --git a/src/TransitionPane.vala b/src/TransitionPane.vala
index a503d41..3821f85 100644
--- a/src/TransitionPane.vala
+++ b/src/TransitionPane.vala
@@ -189,6 +189,7 @@ public class Ease.TransitionPane : InspectorPane
 		
 		// automatically scale the preview to fit in the embed
 		preview.get_stage().allocation_changed.connect((box, flags) => {
+			if (slide == null) return;
 			preview_group.scale_x = (box.x2 - box.x1) / slide.parent.width;
 			preview_group.scale_y = (box.y2 - box.y1) / slide.parent.height;
 		});



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