[glide] Start an inspector window for shapes



commit 5addd22c824983a0940e6dc99246358fe68e134b
Author: Robert Carr <racarr Valentine localdomain>
Date:   Thu May 6 07:40:34 2010 -0400

    Start an inspector window for shapes

 libglide/Makefile.am                     |    2 +
 libglide/glide-inspector-notebook-priv.h |    1 +
 libglide/glide-inspector-notebook.c      |   12 ++-
 libglide/glide-inspector-shape-priv.h    |   34 +++++++
 libglide/glide-inspector-shape.c         |  148 ++++++++++++++++++++++++++++++
 libglide/glide-inspector-shape.h         |   61 ++++++++++++
 6 files changed, 257 insertions(+), 1 deletions(-)
---
diff --git a/libglide/Makefile.am b/libglide/Makefile.am
index ac0654c..30b9b41 100644
--- a/libglide/Makefile.am
+++ b/libglide/Makefile.am
@@ -52,6 +52,7 @@ glideheaders_HEADERS = \
 	glide-manipulator.h \
 	glide-window.h \
 	glide-inspector-window.h \
+	glide-inspector-shape.h \
 	glide.h \
 	glide-theme.h \
 	$(glide_VALABUILTHEADERS)
@@ -85,6 +86,7 @@ libglide_la_SOURCES = \
 	glide-inspector-image.c \
 	glide-inspector-text.c \
 	glide-inspector-window.c \
+	glide-inspector-shape.c \
 	glide.c \
 	glide-theme.c \
 	$(glide_VALABUILTSOURCES)
diff --git a/libglide/glide-inspector-notebook-priv.h b/libglide/glide-inspector-notebook-priv.h
index 8684510..93f4b73 100644
--- a/libglide/glide-inspector-notebook-priv.h
+++ b/libglide/glide-inspector-notebook-priv.h
@@ -33,6 +33,7 @@ struct _GlideInspectorNotebookPrivate
   GtkWidget *inspector_slide;
   GtkWidget *inspector_text;
   GtkWidget *inspector_image;
+  GtkWidget *inspector_shape;
   
   gulong selection_changed_id;
 };
diff --git a/libglide/glide-inspector-notebook.c b/libglide/glide-inspector-notebook.c
index 6b04217..90d3fee 100644
--- a/libglide/glide-inspector-notebook.c
+++ b/libglide/glide-inspector-notebook.c
@@ -24,10 +24,12 @@
 #include "glide-inspector-slide.h"
 #include "glide-inspector-image.h"
 #include "glide-inspector-text.h"
+#include "glide-inspector-shape.h"
 
 #include "glide-text.h"
 #include "glide-image.h"
 #include "glide-slide.h"
+#include "glide-shape.h"
 
 #define GLIDE_INSPECTOR_NOTEBOOK_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), GLIDE_TYPE_INSPECTOR_NOTEBOOK, GlideInspectorNotebookPrivate))
 
@@ -43,7 +45,8 @@ enum {
   PAGE_GENERAL,
   PAGE_SLIDE,
   PAGE_TEXT,
-  PAGE_IMAGE
+  PAGE_IMAGE,
+  PAGE_SHAPE
 };
 
 static void
@@ -74,6 +77,10 @@ glide_inspector_notebook_selection_changed (GlideStageManager *manager,
     {
       gtk_notebook_set_current_page (notebook, PAGE_IMAGE);
     }
+  else if (GLIDE_IS_SHAPE (selection))
+    {
+      gtk_notebook_set_current_page (notebook, PAGE_SHAPE);
+    }
 }
 
 static void
@@ -131,18 +138,21 @@ glide_inspector_notebook_add_pages (GlideInspectorNotebook *inspector)
   GtkWidget *slide_image = gtk_image_new_from_stock (GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_MENU);
   GtkWidget *image_image = gtk_image_new_from_icon_name ("image-x-generic", GTK_ICON_SIZE_MENU);
   GtkWidget *text_image = gtk_image_new_from_icon_name ("format-text-italic", GTK_ICON_SIZE_MENU);
+  GtkWidget *shape_image = gtk_image_new_from_icon_name ("gtk-select-color", GTK_ICON_SIZE_MENU);
 
   inspector->priv->inspector_animation= glide_inspector_animation_new ();
   inspector->priv->inspector_actor = glide_inspector_actor_new ();
   inspector->priv->inspector_slide = glide_inspector_slide_new ();
   inspector->priv->inspector_image = glide_inspector_image_new ();
   inspector->priv->inspector_text = glide_inspector_text_new ();
+  inspector->priv->inspector_shape = glide_inspector_shape_new ();
   
   gtk_notebook_append_page (notebook, inspector->priv->inspector_animation, animation_image);
   gtk_notebook_append_page (notebook, inspector->priv->inspector_actor, actor_image);
   gtk_notebook_append_page (notebook, inspector->priv->inspector_slide, slide_image);
   gtk_notebook_append_page (notebook, inspector->priv->inspector_text, text_image);
   gtk_notebook_append_page (notebook, inspector->priv->inspector_image, image_image);
+  gtk_notebook_append_page (notebook, inspector->priv->inspector_shape, shape_image);
 }
 
 static void
diff --git a/libglide/glide-inspector-shape-priv.h b/libglide/glide-inspector-shape-priv.h
new file mode 100644
index 0000000..1dc3a69
--- /dev/null
+++ b/libglide/glide-inspector-shape-priv.h
@@ -0,0 +1,34 @@
+/*
+ * glide-inspector-shape-priv.h
+ * Copyright (C) Robert Carr 2010 <racarr gnome org>
+ * 
+ * Glide 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.
+ * 
+ * Glide 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/>.
+ */
+
+
+#ifndef __GLIDE_INSPECTOR_SHAPE_PRIVATE_H__
+#define __GLIDE_INSPECTOR_SHAPE_PRIVATE_H__
+
+#include "glide-inspector-shape.h"
+
+G_BEGIN_DECLS
+
+struct _GlideInspectorShapePrivate
+{
+  GlideActor *actor;
+};
+
+G_END_DECLS
+
+#endif
diff --git a/libglide/glide-inspector-shape.c b/libglide/glide-inspector-shape.c
new file mode 100644
index 0000000..06bc44f
--- /dev/null
+++ b/libglide/glide-inspector-shape.c
@@ -0,0 +1,148 @@
+/*
+ * glide-inspector-shape.c
+ * Copyright (C) Robert Carr 2010 <racarr gnome org>
+ * 
+ * Glide 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.
+ * 
+ * Glide 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/>.
+ */
+
+#include "glide-inspector-shape.h"
+#include "glide-inspector-shape-priv.h"
+
+#include "glide-shape.h"
+
+#include "glide-undo-manager.h"
+
+#include "glide-gtk-util.h"
+
+#include <string.h>
+#include <math.h>
+
+#define GLIDE_INSPECTOR_SHAPE_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), GLIDE_TYPE_INSPECTOR_SHAPE, GlideInspectorShapePrivate))
+
+G_DEFINE_TYPE(GlideInspectorShape, glide_inspector_shape, GTK_TYPE_ALIGNMENT);
+
+enum {
+  PROP_0,
+  PROP_ACTOR
+};
+
+static void
+glide_inspector_shape_finalize (GObject *object)
+{
+  
+}
+
+static void
+glide_inspector_shape_get_property (GObject *object,
+			      guint prop_id,
+			      GValue *value,
+			      GParamSpec *pspec)
+{
+  GlideInspectorShape *inspector = GLIDE_INSPECTOR_SHAPE (object);
+  
+  switch (prop_id)
+    {
+    case PROP_ACTOR:
+      g_value_set_object (value, inspector->priv->actor);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+glide_inspector_shape_set_property (GObject *object,
+			      guint prop_id,
+			      const GValue *value,
+			      GParamSpec *pspec)
+{
+  GlideInspectorShape *inspector = GLIDE_INSPECTOR_SHAPE (object);
+  
+  switch (prop_id)
+    {
+    case PROP_ACTOR:
+      glide_inspector_shape_set_actor (inspector, g_value_get_object (value));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+glide_inspector_shape_init (GlideInspectorShape *inspector)
+{
+  inspector->priv = GLIDE_INSPECTOR_SHAPE_GET_PRIVATE (inspector);
+  
+  gtk_widget_set_sensitive (GTK_WIDGET (inspector), FALSE);
+  
+
+  gtk_alignment_set (GTK_ALIGNMENT (inspector), .5, 0, 0.8, 1.0);
+  gtk_alignment_set_padding (GTK_ALIGNMENT (inspector), 5, 0, 0, 0);
+}
+
+static void
+glide_inspector_shape_class_init (GlideInspectorShapeClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = glide_inspector_shape_finalize;
+  object_class->get_property = glide_inspector_shape_get_property;
+  object_class->set_property = glide_inspector_shape_set_property;
+  
+  g_object_class_install_property (object_class,
+				   PROP_ACTOR,
+				   g_param_spec_object ("actor",
+							"Actor",
+							"The actor we are inspecting",
+							GLIDE_TYPE_ACTOR,
+							G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_type_class_add_private (object_class, sizeof(GlideInspectorShapePrivate));
+}
+
+GtkWidget *
+glide_inspector_shape_new ()
+{
+  return (GtkWidget *)g_object_new (GLIDE_TYPE_INSPECTOR_SHAPE, NULL);
+}
+
+
+GlideActor *
+glide_inspector_shape_get_actor (GlideInspectorShape *inspector)
+{
+  return inspector->priv->actor;
+}
+
+void
+glide_inspector_shape_set_actor (GlideInspectorShape *inspector,
+				 GlideActor *actor)
+{
+  inspector->priv->actor = actor;
+  
+  if (!actor)
+    return;
+  
+  if (!GLIDE_IS_SHAPE (actor))
+    {
+      gtk_widget_set_sensitive (GTK_WIDGET (inspector), FALSE);
+    }
+  else
+    {
+      gtk_widget_set_sensitive (GTK_WIDGET (inspector), TRUE);
+    }
+  
+  g_object_notify (G_OBJECT (inspector), "actor");
+}
diff --git a/libglide/glide-inspector-shape.h b/libglide/glide-inspector-shape.h
new file mode 100644
index 0000000..b494ece
--- /dev/null
+++ b/libglide/glide-inspector-shape.h
@@ -0,0 +1,61 @@
+/*
+ * glide-inspector-shape.h
+ * Copyright (C) Robert Carr 2010 <racarr gnome org>
+ * 
+ * Glide 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.
+ * 
+ * Glide 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/>.
+ */
+
+#ifndef __GLIDE_INSPECTOR_SHAPE_H__
+#define __GLIDE_INSPECTOR_SHAPE_H__
+
+#include <gtk/gtk.h>
+#include "glide-actor.h"
+
+G_BEGIN_DECLS
+
+#define GLIDE_TYPE_INSPECTOR_SHAPE              (glide_inspector_shape_get_type())
+#define GLIDE_INSPECTOR_SHAPE(obj)              (G_TYPE_CHECK_INSTANCE_CAST((obj), GLIDE_TYPE_INSPECTOR_SHAPE, GlideInspectorShape))
+#define GLIDE_INSPECTOR_SHAPE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass), GLIDE_TYPE_INSPECTOR_SHAPE, GlideInspectorShapeClass))
+#define GLIDE_IS_INSPECTOR_SHAPE(obj)           (G_TYPE_CHECK_INSTANCE_TYPE((obj), GLIDE_TYPE_INSPECTOR_SHAPE))
+#define GLIDE_IS_INSPECTOR_SHAPE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GLIDE_TYPE_INSPECTOR_SHAPE))
+#define GLIDE_INSPECTOR_SHAPE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), GLIDE_TYPE_INSPECTOR_SHAPE, GlideInspectorShapeClass))
+
+typedef struct _GlideInspectorShapePrivate GlideInspectorShapePrivate;
+
+
+typedef struct _GlideInspectorShape GlideInspectorShape;
+
+struct _GlideInspectorShape
+{
+  GtkAlignment alignment;
+  
+  GlideInspectorShapePrivate *priv;
+};
+
+typedef struct _GlideInspectorShapeClass GlideInspectorShapeClass;
+
+struct _GlideInspectorShapeClass
+{
+  GtkAlignmentClass parent_class;
+};
+
+GType glide_inspector_shape_get_type (void) G_GNUC_CONST;
+GtkWidget *glide_inspector_shape_new (void);
+
+GlideActor *glide_inspector_shape_get_actor (GlideInspectorShape *inspector);
+void glide_inspector_shape_set_actor (GlideInspectorShape *inspector, GlideActor *actor);
+
+G_END_DECLS
+
+#endif



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