Lots of editor changes:
authorWim Taymans <wim.taymans@gmail.com>
Mon, 25 Dec 2000 01:33:06 +0000 (01:33 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Mon, 25 Dec 2000 01:33:06 +0000 (01:33 +0000)
Original commit message from CVS:
Lots of editor changes:
- restucturing of object creation
- loading of xml files
- visual eye candy: color changes on mouseover
- active object is indicated
- property box changes for boolean and enum types
- property box: create properties per element
- show pads/caps in propertybox
added gst_util_get_bool_arg in gstutils.c
added default properties for audiosink

24 files changed:
editor/editor.glade
editor/editor.ts
editor/gsteditor.c
editor/gsteditor.h
editor/gsteditorbin.c
editor/gsteditorcanvas.c
editor/gsteditorconnection.c
editor/gsteditorconnection.h
editor/gsteditorcreate.c
editor/gsteditorcreate.h
editor/gsteditorelement.c
editor/gsteditorpad.c
editor/gsteditorproject.c
editor/gsteditorproject.h
editor/gsteditorprojectview.c
editor/gsteditorproperty.c
editor/gsteditorproperty.h
gst/elements/gstaudiosink.c
gst/gstbin.h
gst/gstelement.h
gst/gstutils.c
gst/gstutils.h
gst/gstxml.c
plugins/elements/gstaudiosink.c

index fa6e225105bb24c0e3beddf25e4dfe894ef9b862..b992d167d47f296e3190944e0f797fbc9ffbbe28 100644 (file)
 
       <widget>
        <class>GtkScrolledWindow</class>
-       <name>scrolledwindow6</name>
+       <name>pads_window</name>
        <hscrollbar_policy>GTK_POLICY_ALWAYS</hscrollbar_policy>
        <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
        <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
        </child>
 
        <widget>
-         <class>GtkCTree</class>
-         <name>ctree2</name>
-         <can_focus>True</can_focus>
-         <columns>2</columns>
-         <column_widths>187,80</column_widths>
-         <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
-         <show_titles>True</show_titles>
-         <shadow_type>GTK_SHADOW_IN</shadow_type>
-
-         <widget>
-           <class>GtkLabel</class>
-           <child_name>CTree:title</child_name>
-           <name>label20</name>
-           <label>Pad</label>
-           <justify>GTK_JUSTIFY_CENTER</justify>
-           <wrap>False</wrap>
-           <xalign>0.5</xalign>
-           <yalign>0.5</yalign>
-           <xpad>0</xpad>
-           <ypad>0</ypad>
-         </widget>
-
-         <widget>
-           <class>GtkLabel</class>
-           <child_name>CTree:title</child_name>
-           <name>label21</name>
-           <label>Value</label>
-           <justify>GTK_JUSTIFY_CENTER</justify>
-           <wrap>False</wrap>
-           <xalign>0.5</xalign>
-           <yalign>0.5</yalign>
-           <xpad>0</xpad>
-           <ypad>0</ypad>
-         </widget>
+         <class>Placeholder</class>
        </widget>
       </widget>
     </widget>
index 6e0775b298f9eb7a3cba07f37c4462390925ba4e..e0a4b92ef2ca6410a90c22839d0a97867056fd11 100644 (file)
@@ -23,8 +23,6 @@ gchar *s = N_("Standard Elements");
 gchar *s = N_("Tree select...");
 gchar *s = N_("Properties");
 gchar *s = N_("Element");
-gchar *s = N_("Pad");
-gchar *s = N_("Value");
 gchar *s = N_("Pads");
 gchar *s = N_("Signal");
 gchar *s = N_("Handler");
index e5eca3ad642671581cb9060e630a0cd133e47e31..3205d5d45caeb9051021286da5d8c7e321e94f7d 100644 (file)
@@ -35,16 +35,18 @@ enum {
   ARG_NAME,
 };
 
-static void gst_editor_class_init(GstEditorClass *klass);
-static void gst_editor_init(GstEditor *editor);
+static void    gst_editor_class_init           (GstEditorClass *klass);
+static void    gst_editor_init                 (GstEditor *editor);
 
-static void gst_editor_set_arg(GtkObject *object,GtkArg *arg,guint id);
-static void gst_editor_get_arg(GtkObject *object,GtkArg *arg,guint id);
+static void    gst_editor_set_arg              (GtkObject *object, GtkArg *arg, guint id);
+static void    gst_editor_get_arg              (GtkObject *object, GtkArg *arg, guint id);
 
 static GtkFrame *parent_class = NULL;
 static guint gst_editor_signals[LAST_SIGNAL] = { 0 };
 
-GtkType gst_editor_get_type(void) {
+GtkType 
+gst_editor_get_type (void) 
+{
   static GtkType editor_type = 0;
 
   if (!editor_type) {
@@ -58,12 +60,14 @@ GtkType gst_editor_get_type(void) {
       NULL,
       (GtkClassInitFunc)NULL,
     };
-    editor_type = gtk_type_unique(gtk_window_get_type(),&editor_info);
+    editor_type = gtk_type_unique (gtk_window_get_type (), &editor_info);
   }
   return editor_type;
 }
 
-static void gst_editor_class_init(GstEditorClass *klass) {
+static void 
+gst_editor_class_init (GstEditorClass *klass) 
+{
   GtkObjectClass *object_class;
 
   object_class = (GtkObjectClass*)klass;
@@ -85,10 +89,14 @@ static void gst_editor_class_init(GstEditorClass *klass) {
   object_class->get_arg = gst_editor_get_arg;
 }
 
-static void gst_editor_init(GstEditor *editor) {
+static void 
+gst_editor_init(GstEditor *editor) 
+{
 }
 
-static void on_name_changed(GstEditorElement *element, gpointer data) {
+static void 
+on_name_changed (GstEditorElement *element, gpointer data) 
+{
   gtk_signal_emit(GTK_OBJECT(element),gst_editor_signals[NAME_CHANGED], NULL);
 }
 /**
@@ -110,14 +118,18 @@ gst_editor_new (GstElement *element)
   editor->element = element;
 
   /* create the editor canvas */
-  editor->canvas = gst_editor_canvas_new(GST_BIN(editor->element),NULL);
+  if (element) {
+    editor->canvas = gst_editor_canvas_new_with_bin (gst_editor_bin_new (GST_BIN (element), NULL));
+  }
+  else {
+    editor->canvas = gst_editor_canvas_new ();
+  }
 
-  gtk_signal_connect_object(GTK_OBJECT(editor->canvas), "name_changed", on_name_changed, GTK_OBJECT(editor));
   /* create the scrolled window */
   editor->scrollwindow = gtk_scrolled_window_new(NULL,NULL);
 
   /* get the canvas widget */
-  editor->canvaswidget = gst_editor_canvas_get_canvas(editor->canvas);
+  editor->canvaswidget = GTK_WIDGET (editor->canvas);
 
   gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(editor->scrollwindow),
                     editor->canvaswidget);
@@ -127,38 +139,20 @@ gst_editor_new (GstElement *element)
 
   gtk_widget_set_usize(GTK_WIDGET(editor),400,400);
 
-  if (GST_IS_BIN (element)) {
-    GList *elements;
-
-    elements = gst_bin_get_list (GST_BIN(element));
-
-    while (elements) {
-      GstElement *child = (GstElement *)elements->data;
-      
-      if (GST_IS_BIN (child)) {
-       g_print ("new bin \n");
-        gst_editor_bin_new (GST_EDITOR_BIN(editor->canvas),GST_BIN(child),
-                "x",10.0,"y",10.0,"width",50.0,"height",20.0,NULL);
-      }
-      else {
-       g_print ("new element \n");
-        gst_editor_element_new (GST_EDITOR_BIN(editor->canvas),child,
-                "x",10.0,"y",10.0,"width",50.0,"height",20.0,NULL);
-      }
-      elements = g_list_next (elements);
-    }
-  }
-
   gtk_widget_show_all(GTK_WIDGET(editor));
 
   return editor;
 }
 
-char *gst_editor_get_name(GstEditor *editor) {
-  return gst_element_get_name(GST_ELEMENT(editor->element));
+const gchar*
+gst_editor_get_name (GstEditor *editor) 
+{
+  return gst_element_get_name (GST_ELEMENT (editor->element));
 }
 
-static void gst_editor_set_arg(GtkObject *object,GtkArg *arg,guint id) {
+static void 
+gst_editor_set_arg(GtkObject *object, GtkArg *arg, guint id) 
+{
   GstEditor *editor = GST_EDITOR(object);
 
   switch (id) {
@@ -173,13 +167,15 @@ static void gst_editor_set_arg(GtkObject *object,GtkArg *arg,guint id) {
   }
 }
 
-static void gst_editor_get_arg(GtkObject *object,GtkArg *arg,guint id) {
+static void 
+gst_editor_get_arg (GtkObject *object, GtkArg *arg, guint id) 
+{
   GstEditor *editor = GST_EDITOR(object);
 
   switch (id) {
     case ARG_NAME:
       GTK_VALUE_STRING(*arg) =
-        gst_element_get_name(GST_ELEMENT(editor->element));
+        (gchar *)gst_element_get_name(GST_ELEMENT(editor->element));
       break;
     default:
       arg->type = GTK_TYPE_INVALID;
index bf295c59e707415d4a13ab5c7ca112ca64470378..9bcedc0fae0b37373478ccb749715274d1b21c86 100644 (file)
@@ -76,12 +76,12 @@ struct _GstEditorClass {
 GtkType gst_editor_get_type();
 GstEditor *gst_editor_new(GstElement *element);
 
-char *gst_editor_get_name(GstEditor *editor);
+const gchar *gst_editor_get_name(GstEditor *editor);
 
 
 #define GST_EDITOR_SET_OBJECT(item,object) \
   (gtk_object_set_data(GTK_OBJECT(item),"gsteditorobject",(object)))
-#define GST_EDTIOR_GET_OBJECT(item) \
+#define GST_EDITOR_GET_OBJECT(item) \
   (gtk_object_get_data(GTK_OBJECT(item),"gsteditorobject"))
 
 
@@ -136,6 +136,7 @@ struct _GstEditorElement {
   GnomeCanvasGroup *insidegroup;               // contents if any
 
   gboolean resize;                             // does it need resizing?
+  gboolean active;                             // is it active (currently selected)
 
   /* list of pads */
   GList *srcpads,*sinkpads;
@@ -149,21 +150,21 @@ struct _GstEditorElement {
 struct _GstEditorElementClass {
   GnomeCanvasGroupClass parent_class;
 
-  void (*name_changed) (GstEditorElement *element);
-  void (*realize) (GstEditorElement *element);
-  gint (*event) (GnomeCanvasItem *item,GdkEvent *event,
-                GstEditorElement *element);
-  gint (*button_event) (GnomeCanvasItem *item,GdkEvent *event,
-                        GstEditorElement *element);
+  void (*name_changed)                 (GstEditorElement *element);
+  void (*position_changed)     (GstEditorElement *element);
+  void (*size_changed)                 (GstEditorElement *element);
+  void (*realize)              (GstEditorElement *element);
+  gint (*event)                (GnomeCanvasItem *item,GdkEvent *event,
+                                GstEditorElement *element);
+  gint (*button_event)                 (GnomeCanvasItem *item,GdkEvent *event,
+                                GstEditorElement *element);
 };
 
 
 GtkType gst_editor_element_get_type();
-GstEditorElement *gst_editor_element_new(GstEditorBin *parent,
-                                         GstElement *element,
+GstEditorElement *gst_editor_element_new(GstElement *element,
                                          const gchar *first_arg_name,...);
 void gst_editor_element_construct(GstEditorElement *element,
-                                  GstEditorBin *parent,
                                   const gchar *first_arg_name,
                                   va_list args);
 void gst_editor_element_repack(GstEditorElement *element);
@@ -207,11 +208,13 @@ struct _GstEditorBinClass {
 
 
 GtkType gst_editor_bin_get_type();
-GstEditorBin *gst_editor_bin_new(GstEditorBin *parent,GstBin *bin,
-                                 const gchar *first_arg_name,...);
-void gst_editor_bin_connection_drag(GstEditorBin *bin,
-                                    gdouble wx,gdouble wy);
-void gst_editor_bin_start_banding(GstEditorBin *bin,GstEditorPad *pad);
+
+GstEditorBin*  gst_editor_bin_new              (GstBin *bin, const gchar *first_arg_name,...);
+void           gst_editor_bin_add              (GstEditorBin *bin, GstEditorElement *element);
+       
+void           gst_editor_bin_connection_drag  (GstEditorBin *bin,
+                                                gdouble wx,gdouble wy);
+void           gst_editor_bin_start_banding    (GstEditorBin *bin,GstEditorPad *pad);
 
 
 #define GST_TYPE_EDITOR_CANVAS \
@@ -225,25 +228,24 @@ void gst_editor_bin_start_banding(GstEditorBin *bin,GstEditorPad *pad);
 #define GST_IS_EDITOR_CANVAS_CLASS(obj) \
   (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_EDITOR_CANVAS))
 
+GtkType gst_editor_canvas_get_type();
 
 struct _GstEditorCanvas {
-  GstEditorBin bin;
+  GnomeCanvas canvas;
 
-  gboolean inchild;
-
-  GnomeCanvas *canvas;
+  GstEditorBin *bin;
 };
 
 struct _GstEditorCanvasClass {
   GnomeCanvasClass parent_class;
 };
 
+GstEditorCanvas*       gst_editor_canvas_new                   (void);
+GstEditorCanvas*       gst_editor_canvas_new_with_bin          (GstEditorBin *bin);
 
-GtkType gst_editor_canvas_get_type();
-GstEditorCanvas *gst_editor_canvas_new(GstBin *bin,
-                                       const gchar *first_arg_name,...);
-GtkWidget *gst_editor_canvas_get_canvas(GstEditorCanvas *canvas);
-void gst_editor_bin_add(GstEditorBin *parent,GstEditorElement *element);
+void                   gst_editor_canvas_set_bin               (GstEditorCanvas *canvas, 
+                                                                GstEditorBin *element);
+GstEditorElement*      gst_editor_canvas_get_bin               (GstEditorCanvas *canvas);
 
 
 #define GST_TYPE_EDITOR_PAD \
@@ -356,7 +358,7 @@ struct _GstEditorConnectionClass {
 };
 
 GtkType gst_editor_connection_get_type();
-GstEditorConnection *gst_editor_connection_new(GstEditorBin *parent,
+GstEditorConnection *gst_editor_connection_new(GstEditorElement *parent,
                                                GstEditorPad *frompad);
 
 void gst_editor_connection_resize(GstEditorConnection *connection);
index 3d80373a97ae9e4125f4691010ad1f7a8a9bd6c6..3f070067a766394f3c59c9bf70d6c64134650ced 100644 (file)
@@ -33,23 +33,31 @@ enum {
   ARG_0,
 };
 
-static void gst_editor_bin_class_init(GstEditorBinClass *klass);
-static void gst_editor_bin_init(GstEditorBin *bin);
+static void    gst_editor_bin_class_init       (GstEditorBinClass *klass);
+static void    gst_editor_bin_init             (GstEditorBin *bin);
+
 //static void gst_editor_bin_set_arg(GtkObject *object,GtkArg *arg,guint id);
 //static void gst_editor_bin_get_arg(GtkObject *object,GtkArg *arg,guint id);
 
-static gint gst_editor_bin_event(GnomeCanvasItem *item,
-                                 GdkEvent *event,
-                                 GstEditorElement *element);
-static gint gst_editor_bin_button_event(GnomeCanvasItem *item,
-                                        GdkEvent *event,
-                                        GstEditorElement *element);
-void gst_editor_bin_connection_drag(GstEditorBin *bin,
-                                    gdouble wx,gdouble wy);
+static void    gst_editor_bin_realize          (GstEditorElement *bin);
+static void    gst_editor_bin_repack           (GstEditorBin *bin);
+
+static void    gst_editor_bin_object_added     (GstEditorBin *editorbin, GstObject *bin, GstObject *child);
+
+static gint    gst_editor_bin_event            (GnomeCanvasItem *item,
+                                                GdkEvent *event,
+                                                GstEditorElement *element);
+static gint    gst_editor_bin_button_event     (GnomeCanvasItem *item,
+                                                GdkEvent *event,
+                                                GstEditorElement *element);
+void           gst_editor_bin_connection_drag  (GstEditorBin *bin,
+                                                gdouble wx,gdouble wy);
 
 static GstEditorElementClass *parent_class = NULL;
 
-GtkType gst_editor_bin_get_type(void) {
+GtkType 
+gst_editor_bin_get_type (void) 
+{
   static GtkType bin_type = 0;
 
   if (!bin_type) {
@@ -68,7 +76,9 @@ GtkType gst_editor_bin_get_type(void) {
   return bin_type;
 }
 
-static void gst_editor_bin_class_init(GstEditorBinClass *klass) {
+static void 
+gst_editor_bin_class_init (GstEditorBinClass *klass) 
+{
   GstEditorElementClass *element_class;
 
   element_class = (GstEditorElementClass*)klass;
@@ -77,42 +87,104 @@ static void gst_editor_bin_class_init(GstEditorBinClass *klass) {
 
   element_class->event = gst_editor_bin_event;
   element_class->button_event = gst_editor_bin_button_event;
+  element_class->realize = gst_editor_bin_realize;
 }
 
-static void gst_editor_bin_init(GstEditorBin *bin) {
+static void 
+gst_editor_bin_init (GstEditorBin *bin) 
+{
   GstEditorElement *element = GST_EDITOR_ELEMENT(bin);
 
   element->insidewidth = 200;
   element->insideheight = 100;
 }
 
-GstEditorBin *gst_editor_bin_new(GstEditorBin *parent,GstBin *bin,
-                                 const gchar *first_arg_name,...) {
+GstEditorBin*
+gst_editor_bin_new (GstBin *bin, const gchar *first_arg_name,...) 
+{
   GstEditorBin *editorbin;
+  GList *children;
   va_list args;
+  gdouble xpos;
 
-  g_return_val_if_fail(parent != NULL, NULL);
-  g_return_val_if_fail(GST_IS_EDITOR_BIN(parent), NULL);
   g_return_val_if_fail(bin != NULL, NULL);
   g_return_val_if_fail(GST_IS_BIN(bin), NULL);
 
   editorbin = GST_EDITOR_BIN(gtk_type_new(GST_TYPE_EDITOR_BIN));
   GST_EDITOR_ELEMENT(editorbin)->element = GST_ELEMENT(bin);
+  GST_EDITOR_SET_OBJECT(bin, editorbin);
+
+  gtk_signal_connect_object (GTK_OBJECT (bin), "object_added", 
+                            gst_editor_bin_object_added, GTK_OBJECT (editorbin));
 
   va_start(args,first_arg_name);
-  gst_editor_element_construct(GST_EDITOR_ELEMENT(editorbin),parent,
-                               first_arg_name,args);
+  gst_editor_element_construct(GST_EDITOR_ELEMENT(editorbin), first_arg_name,args);
   va_end(args);
 
-  
+  children = gst_bin_get_list (bin);
+  xpos = 50.0;
+
+  while (children) {
+    GstElement *child = (GstElement *)children->data;
+
+    if (GST_IS_BIN (child)) {
+      GstEditorBin *childbin = gst_editor_bin_new (GST_BIN (child), "x", xpos+60.0, "y", 80.0, NULL);
+      
+      gst_editor_bin_add (editorbin, GST_EDITOR_ELEMENT (childbin));
+      xpos += 120.0;
+    }
+    else {
+      GstEditorElement *childelement = gst_editor_element_new (child, "x", xpos, "y", 50.0, NULL);
+      
+      gst_editor_bin_add (editorbin, childelement);
+    }
+       
+    xpos += 100.0;
+    children = g_list_next (children);
+  }
+
+  gtk_object_set (GTK_OBJECT (editorbin), "width", xpos-50.0, NULL);
 
   return editorbin;
 }
 
+static void
+gst_editor_bin_realize (GstEditorElement *element)
+{
+  GList *children;
+  GstEditorBin *bin = GST_EDITOR_BIN(element);
+
+  children = bin->elements;
+
+  if (GST_EDITOR_ELEMENT_CLASS(parent_class)->realize) {
+    GST_EDITOR_ELEMENT_CLASS(parent_class)->realize(GST_EDITOR_ELEMENT(bin));
+  }
+
+  while (children) {
+    GstEditorElement *child = (GstEditorElement *)children->data;
+    GstEditorElementClass *elementclass;
+
+    elementclass = GST_EDITOR_ELEMENT_CLASS(GTK_OBJECT(child)->klass);
+
+    if (elementclass->realize)
+      (elementclass->realize) (child);
+
+    children = g_list_next (children);
+  }
+
+  gst_editor_bin_repack (bin);
+}
+
+static void
+gst_editor_bin_repack (GstEditorBin *bin)
+{
+}
 
-static gint gst_editor_bin_event(GnomeCanvasItem *item,
-                                 GdkEvent *event,
-                                 GstEditorElement *element) {
+static gint 
+gst_editor_bin_event(GnomeCanvasItem *item,
+                     GdkEvent *event,
+                     GstEditorElement *element) 
+{
   GstEditorBin *bin = GST_EDITOR_BIN(element);
 
 //  g_print("bin got %d event at %.2fx%.2f\n",event->type,
@@ -135,7 +207,7 @@ static gint gst_editor_bin_event(GnomeCanvasItem *item,
         }
         bin->connecting = FALSE;
 //g_print("in bin, setting inchild for button release\n");
-        element->canvas->inchild = TRUE;
+        //element->canvas->inchild = TRUE;
         return TRUE;
       }
       break;
@@ -160,36 +232,55 @@ static gint gst_editor_bin_event(GnomeCanvasItem *item,
 }
 
 
-static gint gst_editor_bin_button_event(GnomeCanvasItem *item,
-                                        GdkEvent *event,
-                                        GstEditorElement *element) {
+static gint 
+gst_editor_bin_button_event(GnomeCanvasItem *item,
+                            GdkEvent *event,
+                            GstEditorElement *element) 
+{
   GstEditorBin *bin = GST_EDITOR_BIN(element);
   GstEditorElement *newelement;
+  GdkEventButton *buttonevent;
 
 //  g_print("bin got button event\n");
 
   if (event->type != GDK_BUTTON_RELEASE) return FALSE;
 
+  buttonevent = (GdkEventButton *) event;
+
+  if (buttonevent->button != 1) return FALSE;
+
   gnome_canvas_item_w2i(item,&event->button.x,&event->button.y);
 //  g_print("calling gst_editor_create_item(,%.2f,%.2f)\n",
 //          event->button.x,event->button.y);
-  newelement = gst_editor_create_item(bin,event->button.x,event->button.y);
-  if (newelement != NULL);
+  newelement = gst_editor_create_item(event->button.x,event->button.y);
+  if (newelement != NULL) {
+    GstEditorElementClass *elementclass;
+
+    gst_editor_bin_add (bin, newelement);
+
+    elementclass = GST_EDITOR_ELEMENT_CLASS(GTK_OBJECT(newelement)->klass);
+    if (elementclass->realize)
+      (elementclass->realize)(newelement);
+
     return TRUE;
+  }
   return FALSE;
 }
 
 
-void gst_editor_bin_start_banding(GstEditorBin *bin,GstEditorPad *pad) {
+void 
+gst_editor_bin_start_banding (GstEditorBin *bin,GstEditorPad *pad) 
+{
   GdkCursor *cursor;
 
 //  g_print("starting to band\n");
 
   g_return_if_fail(GST_IS_EDITOR_PAD(pad));
 
-  bin->connection = gst_editor_connection_new(bin,pad);
-  bin->connections = g_list_prepend(bin->connections,bin->connection);
-  cursor = gdk_cursor_new(GDK_SB_RIGHT_ARROW);
+  bin->connection = gst_editor_connection_new (GST_EDITOR_ELEMENT (bin), pad);
+  bin->connections = g_list_prepend (bin->connections, bin->connection);
+  
+  cursor = gdk_cursor_new (GDK_SB_RIGHT_ARROW);
   gnome_canvas_item_grab(
     GNOME_CANVAS_ITEM(GST_EDITOR_ELEMENT(bin)->group),
     GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
@@ -199,8 +290,10 @@ void gst_editor_bin_start_banding(GstEditorBin *bin,GstEditorPad *pad) {
 }
 
 
-void gst_editor_bin_connection_drag(GstEditorBin *bin,
-                                    gdouble wx,gdouble wy) {
+void 
+gst_editor_bin_connection_drag (GstEditorBin *bin,
+                                gdouble wx,gdouble wy) 
+{
   GstEditorElement *element;
   gdouble bx,by;
   GnomeCanvasItem *underitem, *under = NULL;
@@ -213,9 +306,9 @@ void gst_editor_bin_connection_drag(GstEditorBin *bin,
 
   // first see if we're on top of an interesting pad
   underitem = gnome_canvas_get_item_at(
-    GST_EDITOR_ELEMENT(bin)->canvas->canvas,wx,wy);
+    &GST_EDITOR_ELEMENT(bin)->canvas->canvas,wx,wy);
   if (underitem != NULL)
-    under = GST_EDTIOR_GET_OBJECT(underitem);
+    under = GST_EDITOR_GET_OBJECT(underitem);
   if ((under != NULL) && GST_IS_EDITOR_PAD(under)) {
     destpad = GST_EDITOR_PAD(under);
     if (destpad != bin->connection->frompad)
@@ -254,16 +347,20 @@ void gst_editor_bin_connection_drag(GstEditorBin *bin,
 */
 }
 
+static void 
+gst_editor_bin_object_added (GstEditorBin *editorbin, GstObject *bin, GstObject *child) 
+{
+  g_print ("gsteditorbin: object added\n");
+}
 
-void gst_editor_bin_add(GstEditorBin *bin,GstEditorElement *element) {
+void 
+gst_editor_bin_add (GstEditorBin *bin, GstEditorElement *element) 
+{
   /* set the element's parent */
   element->parent = bin;
 
   /* set the canvas */
-  if (GST_IS_EDITOR_CANVAS(bin))
-    element->canvas = GST_EDITOR_CANVAS(bin);
-  else
-    element->canvas = GST_EDITOR_ELEMENT(bin)->canvas;
+  element->canvas = GST_EDITOR_ELEMENT(bin)->canvas;
 
   /* add element to list of bin's children */
   bin->elements = g_list_prepend(bin->elements,element);
index 897053e2912a1b0020d2f0efa4f44f7472a37d2b..26d5b1dbbddbe4dd5386f94abb671ed4d8b4da38 100644 (file)
@@ -31,24 +31,15 @@ enum {
 
 enum {
   ARG_0,
-  ARG_CANVAS,
 };
 
-static void gst_editor_canvas_class_init(GstEditorCanvasClass *klass);
-static void gst_editor_canvas_init(GstEditorCanvas *editorcanvas);
-static void gst_editor_canvas_set_arg(GtkObject *object,GtkArg *arg,guint id);
-static void gst_editor_canvas_get_arg(GtkObject *object,GtkArg *arg,guint id);
-static void gst_editor_canvas_realize(GstEditorElement *element);
+static void    gst_editor_canvas_class_init    (GstEditorCanvasClass *klass);
+static void    gst_editor_canvas_init          (GstEditorCanvas *editorcanvas);
 
+static void    gst_editor_canvas_set_arg       (GtkObject *object,GtkArg *arg,guint id);
+static void    gst_editor_canvas_get_arg       (GtkObject *object,GtkArg *arg,guint id);
 
-static gint gst_editor_canvas_button_release(GtkWidget *widget,
-                                             GdkEvent *event,
-                                             GstEditorCanvas *canvas);
-static gint gst_editor_canvas_event(GnomeCanvasItem *item,
-                                    GdkEvent *event,
-                                    GstEditorElement *element);
-static void gst_editor_canvas_set_arg(GtkObject *object,GtkArg *arg,guint id);
-static void gst_editor_canvas_get_arg(GtkObject *object,GtkArg *arg,guint id);
+static void    gst_editor_canvas_realize       (GtkWidget *widget);
 
 
 //gint gst_editor_canvas_verbose_event(GtkWidget *widget,GdkEvent *event);
@@ -56,7 +47,9 @@ static void gst_editor_canvas_get_arg(GtkObject *object,GtkArg *arg,guint id);
 
 static GstEditorBinClass *parent_class = NULL;
 
-GtkType gst_editor_canvas_get_type(void) {
+GtkType 
+gst_editor_canvas_get_type (void) 
+{
   static GtkType editor_canvas_type = 0;
 
   if (!editor_canvas_type) {
@@ -70,76 +63,84 @@ GtkType gst_editor_canvas_get_type(void) {
       NULL,
       (GtkClassInitFunc)NULL,
     };
-    editor_canvas_type = gtk_type_unique(gst_editor_bin_get_type(),&editor_canvas_info);
+    editor_canvas_type = gtk_type_unique (gnome_canvas_get_type (), &editor_canvas_info);
   }
   return editor_canvas_type;
 }
 
-static void gst_editor_canvas_class_init(GstEditorCanvasClass *klass) {
+static void 
+gst_editor_canvas_class_init (GstEditorCanvasClass *klass) 
+{
   GtkObjectClass *object_class;
-  GstEditorElementClass *element_class;
+  GtkWidgetClass *widget_class;
 
   object_class = (GtkObjectClass*)klass;
+  widget_class = (GtkWidgetClass *)klass;
 
-  element_class = (GstEditorElementClass*)klass;
-
-  parent_class = gtk_type_class(gst_editor_bin_get_type());
-
-  gtk_object_add_arg_type("GstEditorCanvas::canvas",GTK_TYPE_POINTER,
-                          GTK_ARG_READABLE,ARG_CANVAS);
+  parent_class = gtk_type_class (gnome_canvas_get_type ());
 
   object_class->set_arg = gst_editor_canvas_set_arg;
   object_class->get_arg = gst_editor_canvas_get_arg;
 
-  element_class->realize = gst_editor_canvas_realize;
+  widget_class->realize = gst_editor_canvas_realize;
 }
 
-static void gst_editor_canvas_init(GstEditorCanvas *editorcanvas) {
+static void 
+gst_editor_canvas_init (GstEditorCanvas *editorcanvas) 
+{
+}
+
+GstEditorCanvas*
+gst_editor_canvas_new (void)
+{
+  GstEditorCanvas *editorcanvas;
+
+  editorcanvas = GST_EDITOR_CANVAS(gtk_type_new(GST_TYPE_EDITOR_CANVAS));
+
+  return editorcanvas;
 }
 
-GstEditorCanvas *gst_editor_canvas_new(GstBin *bin,
-                                       const gchar *first_arg_name,...) {
+GstEditorCanvas*
+gst_editor_canvas_new_with_bin (GstEditorBin *bin) 
+{
   GstEditorCanvas *editorcanvas;
-  va_list args;
 
   g_return_val_if_fail(bin != NULL, NULL);
-  g_return_val_if_fail(GST_IS_BIN(bin), NULL);
 
-  editorcanvas = GST_EDITOR_CANVAS(gtk_type_new(GST_TYPE_EDITOR_CANVAS));
-  GST_EDITOR_ELEMENT(editorcanvas)->element = GST_ELEMENT(bin);
-  GST_EDITOR_ELEMENT(editorcanvas)->parent = GST_EDITOR_BIN(editorcanvas);
+  editorcanvas = gst_editor_canvas_new ();
+  editorcanvas->bin = bin;
 
-  va_start(args,first_arg_name);
-  gst_editor_element_construct(GST_EDITOR_ELEMENT(editorcanvas),NULL,
-                               first_arg_name,args);
-  va_end(args);
+  GST_EDITOR_ELEMENT(bin)->parent = bin;
+  GST_EDITOR_ELEMENT(bin)->canvas = editorcanvas;
 
   return editorcanvas;
 }
 
-static void gst_editor_canvas_realize(GstEditorElement *element) {
-  GstEditorCanvas *canvas = GST_EDITOR_CANVAS(element);
-
-  canvas->canvas = GNOME_CANVAS(gnome_canvas_new());
-  element->canvas = canvas;
-  gtk_signal_connect(GTK_OBJECT(canvas->canvas),
-                     "event",
-                     GTK_SIGNAL_FUNC(gst_editor_canvas_event),
-                     canvas);
-  gtk_signal_connect_after(GTK_OBJECT(canvas->canvas),
-                     "button_release_event",
-                     GTK_SIGNAL_FUNC(gst_editor_canvas_button_release),
-                     canvas);
-  GST_EDITOR_SET_OBJECT(canvas->canvas,canvas);
-
-  element->group = gnome_canvas_root(canvas->canvas);
-
-  if (GST_EDITOR_ELEMENT_CLASS(parent_class)->realize) {
-    GST_EDITOR_ELEMENT_CLASS(parent_class)->realize(element);
+static void 
+gst_editor_canvas_realize (GtkWidget *widget) 
+{
+  GstEditorCanvas *canvas = GST_EDITOR_CANVAS (widget);
+
+  if (GTK_WIDGET_CLASS(parent_class)->realize) {
+    GTK_WIDGET_CLASS(parent_class)->realize(GTK_WIDGET(canvas));
+  }
+
+  if (canvas->bin) {
+    GstEditorElementClass *element_class;
+    
+    GST_EDITOR_ELEMENT(canvas->bin)->group = gnome_canvas_root(GNOME_CANVAS(canvas));
+
+    element_class = GST_EDITOR_ELEMENT_CLASS(GTK_OBJECT(canvas->bin)->klass);
+
+    if (element_class->realize) {
+      element_class->realize(GST_EDITOR_ELEMENT(canvas->bin));
+    }
   }
 }
 
-static void gst_editor_canvas_set_arg(GtkObject *object,GtkArg *arg,guint id) {
+static void 
+gst_editor_canvas_set_arg (GtkObject *object,GtkArg *arg,guint id) 
+{
   GstEditorCanvas *canvas;
 
   canvas = GST_EDITOR_CANVAS(object);
@@ -151,111 +152,17 @@ static void gst_editor_canvas_set_arg(GtkObject *object,GtkArg *arg,guint id) {
   }
 }
 
-static void gst_editor_canvas_get_arg(GtkObject *object,GtkArg *arg,guint id) {
+static void 
+gst_editor_canvas_get_arg (GtkObject *object,GtkArg *arg,guint id) 
+{
   GstEditorCanvas *canvas;
 
   canvas = GST_EDITOR_CANVAS(object);
 
   switch (id) {
-    case ARG_CANVAS:
-      GTK_VALUE_POINTER(*arg) = canvas->canvas;
-      break;
     default:
       arg->type = GTK_TYPE_INVALID;
       break;
   }
 }
 
-GtkWidget *gst_editor_canvas_get_canvas(GstEditorCanvas *canvas) {
-  return GTK_WIDGET(canvas->canvas);
-}
-
-
-static gint gst_editor_canvas_button_release(GtkWidget *widget,
-                                             GdkEvent *event,
-                                             GstEditorCanvas *canvas) {
-  //GstEditorBin *bin = GST_EDITOR_BIN(canvas);
-  gdouble x,y;
-  GstEditorElement *element;
-
-//  g_print("canvas got button press at %.2fx%.2f\n",
-//          event->button.x,event->button.y);
-  if (event->type != GDK_BUTTON_RELEASE) return FALSE;
-
-  // if we're connecting a pair of objects in the canvas, fall through
-//  if (bin->connection) {
-//    g_print("we're in a connection, not handling\n");
-//    return FALSE;
-//  }
-
-  if (canvas->inchild) {
-//    g_print("inchild, not responding to button_release\n");
-    canvas->inchild = FALSE;
-    return FALSE;
-  }
-
-  gnome_canvas_window_to_world(GNOME_CANVAS(widget),
-                               event->button.x,event->button.y,&x,&y);
-//  g_print("calling gst_editor_create_item()\n");
-  if ((element = gst_editor_create_item(GST_EDITOR_BIN(canvas),x,y)) != NULL)
-    return TRUE;
-  return FALSE;
-}
-
-
-/* FIXME: guerilla prototype... */
-void gst_editor_bin_connection_drag(GstEditorBin *bin,
-                                    gdouble wx,gdouble wy);
-
-static gint gst_editor_canvas_event(GnomeCanvasItem *item,
-                                    GdkEvent *event,
-                                    GstEditorElement *element) {
-//  if (GST_EDITOR_ELEMENT_CLASS(parent_class)->event)
-//    return (*GST_EDITOR_ELEMENT_CLASS(parent_class)->event)(
-//      element->group,event,element);
-
-  GstEditorBin *bin = GST_EDITOR_BIN(element);
-  GstEditorCanvas *canvas = GST_EDITOR_CANVAS(element);
-
-  //g_print("canvas got event %d at %.2fx%.2f\n",event->type,
-  //        event->button.x,event->button.y);
-
-  switch (event->type) {
-    case GDK_BUTTON_RELEASE:
-      if (bin->connecting) {
-//        g_print("canvas got button release during drag\n");
-        gnome_canvas_item_ungrab(
-          GNOME_CANVAS_ITEM(element->group),
-          event->button.time);
-        if (bin->connection->topad)
-          gst_editor_connection_connect(bin->connection);
-        else
-          gtk_object_destroy(GTK_OBJECT(bin->connection));
-        bin->connecting = FALSE;
-//g_print("finished dragging connection on canvas, setting inchild\n");
-        element->canvas->inchild = TRUE;
-        return TRUE;
-      } else {
-//        g_print("got release, calling button_release()\n");
-//        gst_editor_canvas_button_release(canvas->canvas,event,canvas);
-        return FALSE;
-      }
-      break;
-    case GDK_MOTION_NOTIFY:
-      if (bin->connecting) {
-        gdouble x,y;
-        x = event->button.x;y = event->button.y;
-        gnome_canvas_window_to_world(canvas->canvas,
-                               event->button.x,event->button.y,&x,&y);
-//        g_print("canvas has motion during connection draw at
-//%.2fx%.2f\n",
-//                x,y);
-        gst_editor_bin_connection_drag(bin,x,y);
-        return TRUE;
-      }
-      break;
-    default:
-      break;
-  }
-  return FALSE;
-}
index 1f7f28be972bbb32ba19d33fa37d7b230781ee8d..3709ec7be35548632ed05f53989b99e9ed30ccea 100644 (file)
@@ -6,12 +6,14 @@
 #include "gsteditor.h"
 
 /* class functions */
-static void gst_editor_connection_class_init(GstEditorConnectionClass *klass);
-static void gst_editor_connection_init(GstEditorConnection *connection);
-static void gst_editor_connection_set_arg(GtkObject *object,GtkArg *arg,guint id);
-static void gst_editor_connection_get_arg(GtkObject *object,GtkArg *arg,guint id);
-static void gst_editor_connection_destroy(GtkObject *object);
-static void gst_editor_connection_realize(GstEditorConnection *connection);
+static void    gst_editor_connection_class_init        (GstEditorConnectionClass *klass);
+static void    gst_editor_connection_init              (GstEditorConnection *connection);
+
+static void    gst_editor_connection_set_arg           (GtkObject *object,GtkArg *arg,guint id);
+static void    gst_editor_connection_get_arg           (GtkObject *object,GtkArg *arg,guint id);
+
+static void    gst_editor_connection_destroy           (GtkObject *object);
+static void    gst_editor_connection_realize           (GstEditorConnection *connection);
 
 /* events fired by items within self */
 //static gint gst_editor_connection_line_event(GnomeCanvasItem *item,
@@ -37,7 +39,9 @@ enum {
 static GtkObjectClass *parent_class;
 //static guint gst_editor_connection_signals[LAST_SIGNAL] = { 0 };
 
-GtkType gst_editor_connection_get_type() {
+GtkType 
+gst_editor_connection_get_type (void) 
+{
   static GtkType connection_type = 0;
 
   if (!connection_type) {
@@ -51,12 +55,14 @@ GtkType gst_editor_connection_get_type() {
       NULL,
       (GtkClassInitFunc)NULL,
     };
-    connection_type = gtk_type_unique(gtk_object_get_type(),&connection_info);
+    connection_type = gtk_type_unique (gtk_object_get_type (), &connection_info);
   }
   return connection_type;
 }
 
-static void gst_editor_connection_class_init(GstEditorConnectionClass *klass) {
+static void 
+gst_editor_connection_class_init (GstEditorConnectionClass *klass) 
+{
   GtkObjectClass *object_class;
 
   object_class = (GtkObjectClass*)klass;
@@ -78,19 +84,24 @@ static void gst_editor_connection_class_init(GstEditorConnectionClass *klass) {
 
   object_class->set_arg = gst_editor_connection_set_arg;
   object_class->get_arg = gst_editor_connection_get_arg;
+  
   object_class->destroy = gst_editor_connection_destroy;
 }
 
-static void gst_editor_connection_init(GstEditorConnection *connection) {
+static void 
+gst_editor_connection_init (GstEditorConnection *connection) 
+{
   connection->points = gnome_canvas_points_new(2);
 }
 
-GstEditorConnection *gst_editor_connection_new(GstEditorBin *parent,
-                                               GstEditorPad *frompad) {
+GstEditorConnection*
+gst_editor_connection_new (GstEditorElement *parent,
+                           GstEditorPad *frompad) 
+{
   GstEditorConnection *connection;
 
   g_return_val_if_fail(parent != NULL, NULL);
-  g_return_val_if_fail(GST_IS_EDITOR_BIN(parent), NULL);
+  g_return_val_if_fail(GST_IS_EDITOR_ELEMENT(parent), NULL);
   g_return_val_if_fail(frompad != NULL, NULL);
   g_return_val_if_fail(GST_IS_EDITOR_PAD(frompad), NULL);
 
@@ -98,7 +109,7 @@ GstEditorConnection *gst_editor_connection_new(GstEditorBin *parent,
   connection->frompad = frompad;
   connection->frompad->connection = connection;
   connection->fromsrc = connection->frompad->issrc;
-  connection->parent = GST_EDITOR_ELEMENT(parent);
+  connection->parent = parent;
 
   gst_editor_connection_realize(connection);
 
@@ -106,7 +117,9 @@ GstEditorConnection *gst_editor_connection_new(GstEditorBin *parent,
 }
 
 
-static void gst_editor_connection_set_arg(GtkObject *object,GtkArg *arg,guint id) {
+static void 
+gst_editor_connection_set_arg (GtkObject *object,GtkArg *arg,guint id) 
+{
   GstEditorConnection *connection;
 
   /* get the major types of this object */
@@ -151,7 +164,9 @@ static void gst_editor_connection_set_arg(GtkObject *object,GtkArg *arg,guint id
   gst_editor_connection_resize(connection);
 }
 
-static void gst_editor_connection_get_arg(GtkObject *object,GtkArg *arg,guint id) {
+static void 
+gst_editor_connection_get_arg (GtkObject *object,GtkArg *arg,guint id) 
+{
   GstEditorConnection *connection;
 
   /* get the major types of this object */
@@ -171,7 +186,9 @@ static void gst_editor_connection_get_arg(GtkObject *object,GtkArg *arg,guint id
 }
 
 
-static void gst_editor_connection_realize(GstEditorConnection *connection) {
+static void 
+gst_editor_connection_realize (GstEditorConnection *connection) 
+{
   connection->points->coords[0] = 0.0;
   connection->points->coords[1] = 0.0;
   connection->points->coords[2] = 0.0;
@@ -182,13 +199,17 @@ static void gst_editor_connection_realize(GstEditorConnection *connection) {
     "points",connection->points,"width_units",2.0, NULL);
 }
 
-static void gst_editor_connection_destroy(GtkObject *object) {
+static void 
+gst_editor_connection_destroy (GtkObject *object) 
+{
   GstEditorConnection *connection = GST_EDITOR_CONNECTION(object);
 
   gtk_object_destroy(GTK_OBJECT(connection->line));
 }
 
-void gst_editor_connection_resize(GstEditorConnection *connection) {
+void 
+gst_editor_connection_resize (GstEditorConnection *connection) 
+{
   gdouble x1,y1,x2,y2;
 
   if (connection->resize != TRUE) return;
@@ -241,8 +262,10 @@ void gst_editor_connection_resize(GstEditorConnection *connection) {
                         "points",connection->points,NULL);
 }
 
-void gst_editor_connection_set_endpoint(GstEditorConnection *connection,
-                                        gdouble x,gdouble y) {
+void 
+gst_editor_connection_set_endpoint (GstEditorConnection *connection,
+                                    gdouble x,gdouble y) 
+{
   connection->x = x;
   connection->y = y;
   if (connection->topad) {
@@ -256,8 +279,10 @@ void gst_editor_connection_set_endpoint(GstEditorConnection *connection,
   gst_editor_connection_resize(connection);
 }
 
-void gst_editor_connection_set_endpad(GstEditorConnection *connection,
-                                      GstEditorPad *pad) {
+void 
+gst_editor_connection_set_endpad (GstEditorConnection *connection,
+                                  GstEditorPad *pad) 
+{
   // first check for the trivial case
   if (connection->topad == pad) return;
 
@@ -277,7 +302,9 @@ void gst_editor_connection_set_endpad(GstEditorConnection *connection,
   gst_editor_connection_resize(connection);
 }
 
-void gst_editor_connection_connect(GstEditorConnection *connection) {
+void 
+gst_editor_connection_connect (GstEditorConnection *connection) 
+{
   if (connection->ghost) {
     g_print("uhhh.... Boo!\n");
   } else {
index 84ad6ed6d9bea5503df685ba15dd53e0996a7525..a1e8d5422d958b0851ef4e36c132047a186d9e5d 100644 (file)
@@ -57,8 +57,9 @@ struct _GstEditorConnectionClass {
 };
 
 GtkType gst_editor_connection_get_type();
-GstEditorConnection *gst_editor_connection_new(GstEditorBin *parent,
-                                              GstEditorPad *frompad);
+
+GstEditorConnection*   gst_editor_connection_new       (GstEditorBin *parent,
+                                                        GstEditorPad *frompad);
 
 
 #endif /* __GST_EDITOR_CONNECTION_H__ */
index 26c78dc1332b3959be2cdf3fca146fac84669ff7..8d8b29b384e685b9715c5d0334b0af5243751302 100644 (file)
 
 #include "gsteditor.h"
 #include "gstelementselect.h"
+#include "gsteditorcreate.h"
 
-GstEditorElement *gst_editor_create_item(GstEditorBin *bin,
-                                         gdouble x,gdouble y) {
+GstEditorElement*
+gst_editor_create_item(gdouble x,gdouble y) 
+{
   GstElementFactory *factory;
   GstElement *element;
   GstEditorElement *editorelement;
@@ -39,11 +41,10 @@ GstEditorElement *gst_editor_create_item(GstEditorBin *bin,
       if (GST_IS_BIN(element)) {
 //        g_print("factory is a bin\n");
         editorelement = GST_EDITOR_ELEMENT(gst_editor_bin_new(
-          GST_EDITOR_BIN(bin),GST_BIN(element),
-          "x",x,"y",y,"width",50.0,"height",20.0,NULL));
+          GST_BIN(element), "x",x,"y",y,"width",50.0,"height",20.0,NULL));
       } else {
 //        g_print("factory is an element\n");
-        editorelement = gst_editor_element_new(bin,element,
+        editorelement = gst_editor_element_new(element,
           "x",x,"y",y,"width",50.0,"height",20.0,NULL);
       }
 //      g_print("created element \"%s\" at %.2fx%.2f\n",
index 448de9157df00630bdbea2cdc827ffafd12f30c5..a057d080d79e040d747578f2614289e478d4da66 100644 (file)
@@ -20,5 +20,4 @@
 
 #include "gsteditor.h"
 
-GstEditorElement *gst_editor_create_item(GstEditorBin *bin,
-                                         gdouble x,gdouble y);
+GstEditorElement *gst_editor_create_item(gdouble x,gdouble y);
index 1d84ea6276fa6fb2208aa376ae47c26bc889070b..4b6064d3fb8daf9421b5b069add8fcdb178cf3f1 100644 (file)
 #include "gsteditorproperty.h"
 
 /* class functions */
-static void gst_editor_element_class_init(GstEditorElementClass *klass);
-static void gst_editor_element_init(GstEditorElement *element);
-static void gst_editor_element_set_arg(GtkObject *object,GtkArg *arg,guint id);
-static void gst_editor_element_get_arg(GtkObject *object,GtkArg *arg,guint id);
-static void gst_editor_element_realize(GstEditorElement *element);
-static gint gst_editor_element_event(GnomeCanvasItem *item,
-                                     GdkEvent *event,
-                                     GstEditorElement *element);
+static void    gst_editor_element_class_init           (GstEditorElementClass *klass);
+static void    gst_editor_element_init                 (GstEditorElement *element);
+
+static void    gst_editor_element_set_arg              (GtkObject *object,GtkArg *arg,guint id);
+static void    gst_editor_element_get_arg              (GtkObject *object,GtkArg *arg,guint id);
+
+static void    gst_editor_element_realize              (GstEditorElement *element);
+static gint    gst_editor_element_event                (GnomeCanvasItem *item,
+                                                        GdkEvent *event,
+                                                        GstEditorElement *element);
 
 /* events fired by items within self */
-static gint gst_editor_element_resizebox_event(GnomeCanvasItem *item,
-                                               GdkEvent *event,
-                                               GstEditorElement *element);
-static gint gst_editor_element_group_event(GnomeCanvasItem *item,
-                                           GdkEvent *event,
-                                           GstEditorElement *element);
-static gint gst_editor_element_state_event(GnomeCanvasItem *item,
-                                           GdkEvent *event,
-                                           gpointer data);
+static gint    gst_editor_element_resizebox_event      (GnomeCanvasItem *item,
+                                                                GdkEvent *event,
+                                                                GstEditorElement *element);
+static gint    gst_editor_element_group_event          (GnomeCanvasItem *item,
+                                                        GdkEvent *event,
+                                                        GstEditorElement *element);
+static gint    gst_editor_element_state_event          (GnomeCanvasItem *item,
+                                                        GdkEvent *event,
+                                                        gpointer data);
 
 /* external events (from GstElement) */
-static void gst_editor_element_state_change(GstElement *element,
-                                            gint state,
-                                            GstEditorElement *editorelement);
+static void    gst_editor_element_state_change         (GstElement *element,
+                                                        gint state,
+                                                        GstEditorElement *editorelement);
 
 /* utility functions */
-static void gst_editor_element_resize(GstEditorElement *element);
-static void gst_editor_element_set_state(GstEditorElement *element,
-                                         gint id,gboolean set);
-static void gst_editor_element_sync_state(GstEditorElement *element);
-static void gst_editor_element_move(GstEditorElement *element,
-                                    gdouble dx,gdouble dy);
+static void    gst_editor_element_resize               (GstEditorElement *element);
+static void    gst_editor_element_set_state            (GstEditorElement *element,
+                                                        gint id,gboolean set);
+static void    gst_editor_element_sync_state           (GstEditorElement *element);
+static void    gst_editor_element_move                 (GstEditorElement *element,
+                                                        gdouble dx,gdouble dy);
 
 
 static gchar *_gst_editor_element_states[] = { "S","R","P","F" };
@@ -82,17 +84,22 @@ enum {
   ARG_X2,
   ARG_Y2,
   ARG_ELEMENT,
+  ARG_ACTIVE,
 };
 
 enum {
   NAME_CHANGED,
+  POSITION_CHANGED,
+  SIZE_CHANGED,
   LAST_SIGNAL
 };
 
 static GtkObjectClass *parent_class;
 static guint gst_editor_element_signals[LAST_SIGNAL] = { 0 };
 
-GtkType gst_editor_element_get_type() {
+GtkType 
+gst_editor_element_get_type(void) 
+{
   static GtkType element_type = 0;
 
   if (!element_type) {
@@ -111,7 +118,9 @@ GtkType gst_editor_element_get_type() {
   return element_type;
 }
 
-static void gst_editor_element_class_init(GstEditorElementClass *klass) {
+static void 
+gst_editor_element_class_init (GstEditorElementClass *klass) 
+{
   GtkObjectClass *object_class;
 
   object_class = (GtkObjectClass*)klass;
@@ -119,10 +128,20 @@ static void gst_editor_element_class_init(GstEditorElementClass *klass) {
   parent_class = gtk_type_class(gtk_object_get_type());
 
   gst_editor_element_signals[NAME_CHANGED] =
-    gtk_signal_new("name_changed",GTK_RUN_FIRST,object_class->type,
-                   GTK_SIGNAL_OFFSET(GstEditorElementClass,name_changed),
-                   gtk_marshal_NONE__POINTER,GTK_TYPE_NONE,1,
-                   GST_TYPE_EDITOR_ELEMENT);
+    gtk_signal_new ("name_changed", GTK_RUN_FIRST, object_class->type,
+                    GTK_SIGNAL_OFFSET (GstEditorElementClass, name_changed),
+                    gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
+                    GST_TYPE_EDITOR_ELEMENT);
+  gst_editor_element_signals[POSITION_CHANGED] =
+    gtk_signal_new ("position_changed", GTK_RUN_FIRST, object_class->type,
+                    GTK_SIGNAL_OFFSET (GstEditorElementClass, position_changed),
+                    gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
+                    GST_TYPE_EDITOR_ELEMENT);
+  gst_editor_element_signals[SIZE_CHANGED] =
+    gtk_signal_new ("size_changed", GTK_RUN_FIRST, object_class->type,
+                    GTK_SIGNAL_OFFSET (GstEditorElementClass, size_changed),
+                    gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
+                    GST_TYPE_EDITOR_ELEMENT);
 
   gtk_object_class_add_signals(object_class,gst_editor_element_signals,LAST_SIGNAL);
 
@@ -139,15 +158,17 @@ static void gst_editor_element_class_init(GstEditorElementClass *klass) {
                           GTK_ARG_READWRITE|GTK_ARG_CONSTRUCT_ONLY,
                           ARG_HEIGHT);
   gtk_object_add_arg_type("GstEditorElement::x1",GTK_TYPE_DOUBLE,
-                          GTK_ARG_READWRITE,ARG_X1);
+                          GTK_ARG_READWRITE, ARG_X1);
   gtk_object_add_arg_type("GstEditorElement::y1",GTK_TYPE_DOUBLE,
-                          GTK_ARG_READWRITE,ARG_Y1);
+                          GTK_ARG_READWRITE, ARG_Y1);
   gtk_object_add_arg_type("GstEditorElement::x2",GTK_TYPE_DOUBLE,
-                          GTK_ARG_READWRITE,ARG_X2);
+                          GTK_ARG_READWRITE, ARG_X2);
   gtk_object_add_arg_type("GstEditorElement::y2",GTK_TYPE_DOUBLE,
-                          GTK_ARG_READWRITE,ARG_Y2);
+                          GTK_ARG_READWRITE, ARG_Y2);
   gtk_object_add_arg_type("GstEditorElement::element",GTK_TYPE_POINTER,
-                          GTK_ARG_READABLE,ARG_ELEMENT);
+                          GTK_ARG_READABLE, ARG_ELEMENT);
+  gtk_object_add_arg_type("GstEditorElement::active",GTK_TYPE_BOOL,
+                          GTK_ARG_READWRITE, ARG_ACTIVE);
 
   klass->realize = gst_editor_element_realize;
   klass->event = gst_editor_element_event;
@@ -156,32 +177,37 @@ static void gst_editor_element_class_init(GstEditorElementClass *klass) {
   object_class->get_arg = gst_editor_element_get_arg;
 }
 
-static void gst_editor_element_init(GstEditorElement *element) {
+static void 
+gst_editor_element_init (GstEditorElement *element) 
+{
+  element->active = FALSE;
 }
 
-GstEditorElement *gst_editor_element_new(GstEditorBin *parent,
-                                         GstElement *element,
-                                         const gchar *first_arg_name, ...) {
+GstEditorElement*
+gst_editor_element_new (GstElement *element,
+                        const gchar *first_arg_name, ...) 
+{
   GstEditorElement *editorelement;
   va_list args;
 
-  g_return_val_if_fail(parent != NULL, NULL);
-  g_return_val_if_fail(GST_IS_EDITOR_BIN(parent), NULL);
   g_return_val_if_fail(element != NULL, NULL);
   g_return_val_if_fail(GST_IS_ELEMENT(element), NULL);
 
   editorelement = GST_EDITOR_ELEMENT(gtk_type_new(GST_TYPE_EDITOR_ELEMENT));
   editorelement->element = element;
+  GST_EDITOR_SET_OBJECT(element, editorelement);
 
   va_start(args,first_arg_name);
-  gst_editor_element_construct(editorelement,parent,first_arg_name,args);
+  gst_editor_element_construct(editorelement,first_arg_name,args);
   va_end(args);
 
   return editorelement;
 }
 
-void gst_editor_element_set_name(GstEditorElement *element,
-                                  const gchar *name) {
+void 
+gst_editor_element_set_name (GstEditorElement *element,
+                             const gchar *name) 
+{
   g_return_if_fail(GST_IS_EDITOR_ELEMENT(element));
   g_return_if_fail(name != NULL);
 
@@ -190,22 +216,22 @@ void gst_editor_element_set_name(GstEditorElement *element,
   gtk_signal_emit(GTK_OBJECT(element),gst_editor_element_signals[NAME_CHANGED], element);
 }
 
-const gchar *gst_editor_element_get_name(GstEditorElement *element) {
+const gchar*
+gst_editor_element_get_name (GstEditorElement *element) 
+{
   g_return_val_if_fail(GST_IS_EDITOR_ELEMENT(element), NULL);
 
   return gst_element_get_name(element->element);
 }
 
 void 
-gst_editor_element_construct(GstEditorElement *element,
-                             GstEditorBin *parent,
-                             const gchar *first_arg_name,
-                             va_list args) 
+gst_editor_element_construct (GstEditorElement *element,
+                              const gchar *first_arg_name,
+                              va_list args) 
 {
   GtkObject *obj = GTK_OBJECT(element);
   GSList *arg_list = NULL, *info_list = NULL;
   gchar *error;
-  GstEditorElementClass *elementclass;
 
 //  g_print("in gst_editor_element_construct()\n");
 
@@ -221,18 +247,11 @@ gst_editor_element_construct(GstEditorElement *element,
       gtk_object_arg_set(obj,arg->data,info->data);
     gtk_args_collect_cleanup(arg_list,info_list);
   }
-
-  if (parent)
-    gst_editor_bin_add(parent,element);
-  else if (!GST_IS_EDITOR_BIN(element))
-    g_warning("floating element...\n");
-
-  elementclass = GST_EDITOR_ELEMENT_CLASS(GTK_OBJECT(element)->klass);
-  if (elementclass->realize)
-    (elementclass->realize)(element);
 }
 
-static void gst_editor_element_set_arg(GtkObject *object,GtkArg *arg,guint id) {
+static void 
+gst_editor_element_set_arg (GtkObject *object, GtkArg *arg, guint id) 
+{
   GstEditorElement *element;
 
   /* get the major types of this object */
@@ -271,13 +290,20 @@ static void gst_editor_element_set_arg(GtkObject *object,GtkArg *arg,guint id) {
       element->height = MAX(GTK_VALUE_DOUBLE(*arg),element->minheight);
       element->resize = TRUE;
       break;
+    case ARG_ACTIVE:
+      element->active = GTK_VALUE_BOOL(*arg);
+      gnome_canvas_item_set(GNOME_CANVAS_ITEM(element->border),
+                           "width_units", (element->active ? 2.0 : 1.0),  NULL);
+      break;
     default:
       g_warning("gsteditorelement: unknown arg!");
       break;
   }
 }
 
-static void gst_editor_element_get_arg(GtkObject *object,GtkArg *arg,guint id) {
+static void 
+gst_editor_element_get_arg(GtkObject *object, GtkArg *arg, guint id) 
+{
   GstEditorElement *element;
 
   /* get the major types of this object */
@@ -311,13 +337,32 @@ static void gst_editor_element_get_arg(GtkObject *object,GtkArg *arg,guint id) {
     case ARG_ELEMENT:
       GTK_VALUE_POINTER(*arg) = element->element;
       break;
+    case ARG_ACTIVE:
+      GTK_VALUE_BOOL(*arg) = element->active;
+      break;
     default:
       arg->type = GTK_TYPE_INVALID;
       break;
   }
 }
 
-static void gst_editor_element_realize(GstEditorElement *element) {
+static GtkMenu* 
+gst_editor_element_get_popup_menu (GstEditorElement *element) 
+{
+  GtkMenu *menu;
+
+  menu = GTK_MENU (gtk_menu_new ());
+  gtk_menu_append (menu, gtk_menu_item_new_with_label ("cut"));
+  gtk_menu_append (menu, gtk_menu_item_new_with_label ("copy"));
+  gtk_menu_append (menu, gtk_menu_item_new_with_label ("paste"));
+  gtk_widget_show_all (GTK_WIDGET (menu));
+
+  return menu;  
+}
+
+static void 
+gst_editor_element_realize (GstEditorElement *element) 
+{
   GnomeCanvasGroup *parentgroup;
   gint i;
   gdouble x1,y1,x2,y2;
@@ -359,7 +404,7 @@ static void gst_editor_element_realize(GstEditorElement *element) {
   /* create bordering box */
   element->border = gnome_canvas_item_new(element->group,
     gnome_canvas_rect_get_type(),
-    "width_units",2.0,"fill_color","white","outline_color","black", 
+    "width_units",1.0,"fill_color","white","outline_color","black", 
     "x1",x1,"y1",y1,"x2",x2,"y2",y2,NULL);
   g_return_if_fail(element->border != NULL);
   GST_EDITOR_SET_OBJECT(element->border,element);
@@ -414,6 +459,7 @@ static void gst_editor_element_realize(GstEditorElement *element) {
   while (pads) {
     pad = GST_PAD(pads->data);
     gst_editor_element_add_pad(element,pad);
+    
     pads = g_list_next(pads);
   }
 
@@ -436,7 +482,9 @@ static void gst_editor_element_realize(GstEditorElement *element) {
 }
 
 
-static void gst_editor_element_resize(GstEditorElement *element) {
+static void 
+gst_editor_element_resize (GstEditorElement *element) 
+{
   gdouble itemwidth,itemheight;
   gdouble groupwidth,groupheight;
   GList *pads;
@@ -523,7 +571,9 @@ static void gst_editor_element_resize(GstEditorElement *element) {
 //  g_print("is now %.2fx%.2f\n",element->width,element->height);
 }
 
-void gst_editor_element_repack(GstEditorElement *element) {
+void 
+gst_editor_element_repack (GstEditorElement *element) 
+{
   GList *pads;
   GstEditorPad *editorpad;
   gint sinks;
@@ -611,11 +661,14 @@ void gst_editor_element_repack(GstEditorElement *element) {
 }
 
 
-GstEditorPad *gst_editor_element_add_pad(GstEditorElement *element,
-                                         GstPad *pad) {
+GstEditorPad*
+gst_editor_element_add_pad (GstEditorElement *element,
+                            GstPad *pad) 
+{
   GstEditorPad *editorpad;
 
-  editorpad = gst_editor_pad_new(element,pad,NULL);
+  editorpad = gst_editor_pad_new (element, pad, NULL);
+
   if (pad->direction == GST_PAD_SINK) {
     element->sinkpads = g_list_prepend(element->sinkpads,editorpad);
     element->sinks++;
@@ -627,15 +680,16 @@ GstEditorPad *gst_editor_element_add_pad(GstEditorElement *element,
   } else
     g_print("HUH?!?  Don't know which direction this pad is...\n");
 
-  element->padlistchange = TRUE;
   gst_editor_element_repack(element);
   return editorpad;
 }
 
 
-static gint gst_editor_element_group_event(GnomeCanvasItem *item,
-                                           GdkEvent *event,
-                                           GstEditorElement *element) {
+static gint 
+gst_editor_element_group_event (GnomeCanvasItem *item,
+                                GdkEvent *event,
+                                GstEditorElement *element) 
+{
   switch(event->type) {
     case GDK_BUTTON_PRESS:
       gst_editor_property_show(gst_editor_property_get(), element);
@@ -651,8 +705,11 @@ static gint gst_editor_element_group_event(GnomeCanvasItem *item,
 }
 
 
-static gint gst_editor_element_event(GnomeCanvasItem *item,GdkEvent *event,
-                                     GstEditorElement *element) {
+static gint 
+gst_editor_element_event(GnomeCanvasItem *item,
+                        GdkEvent *event,
+                         GstEditorElement *element) 
+{
   gdouble dx,dy;
   GdkCursor *fleur;
 
@@ -660,25 +717,42 @@ static gint gst_editor_element_event(GnomeCanvasItem *item,GdkEvent *event,
 
   switch(event->type) {
     case GDK_ENTER_NOTIFY:
-      break;
+      gnome_canvas_item_set(GNOME_CANVAS_ITEM(element->border),
+                        "fill_color_rgba", 0xeeeeee80, NULL);
+      return TRUE;
     case GDK_LEAVE_NOTIFY:
-      break;
+      gnome_canvas_item_set(GNOME_CANVAS_ITEM(element->border),
+                        "fill_color", "white", NULL);
+      return TRUE;
     case GDK_BUTTON_PRESS:
-      // dragxy coords are world coords of button press
-      element->dragx = event->button.x;
-      element->dragy = event->button.y;
-      // set some flags
-      element->dragging = TRUE;
-      element->moved = FALSE;
-      fleur = gdk_cursor_new(GDK_FLEUR);
-      gnome_canvas_item_grab(item,
+    {
+      if (event->button.button == 3) {
+       GtkMenu *menu;
+
+       menu = gst_editor_element_get_popup_menu (element);
+
+       gtk_menu_popup (menu, NULL, NULL, NULL, NULL, 
+                       event->button.button, event->button.time);
+
+       return TRUE;
+      }
+      else {
+        // dragxy coords are world coords of button press
+        element->dragx = event->button.x;
+        element->dragy = event->button.y;
+        // set some flags
+        element->dragging = TRUE;
+        element->moved = FALSE;
+        fleur = gdk_cursor_new (GDK_FLEUR);
+        gnome_canvas_item_grab(item,
                              GDK_POINTER_MOTION_MASK |
 //                             GDK_ENTER_NOTIFY_MASK |
 //                             GDK_LEAVE_NOTIFY_MASK |
                              GDK_BUTTON_RELEASE_MASK,
                              fleur,event->button.time);
-      return TRUE;
-      break;
+        return TRUE;
+      }
+    }
     case GDK_MOTION_NOTIFY:
       if (element->dragging) {
         dx = event->button.x - element->dragx;
@@ -689,7 +763,6 @@ static gint gst_editor_element_event(GnomeCanvasItem *item,GdkEvent *event,
         element->moved = TRUE;
       }
       return TRUE;
-      break;
     case GDK_BUTTON_RELEASE:
       if (element->dragging) {
         element->dragging = FALSE;
@@ -702,9 +775,8 @@ static gint gst_editor_element_event(GnomeCanvasItem *item,GdkEvent *event,
           (elementclass->button_event)(item,event,element);
       }
 //g_print("in element group_event, setting inchild");
-      element->canvas->inchild = TRUE;
+      //element->canvas->inchild = TRUE;
       return TRUE;
-      break;
 
     default:
       break;
@@ -713,9 +785,11 @@ static gint gst_editor_element_event(GnomeCanvasItem *item,GdkEvent *event,
 }
 
 
-static gint gst_editor_element_resizebox_event(GnomeCanvasItem *item,
-                                               GdkEvent *event,
-                                               GstEditorElement *element) {
+static gint 
+gst_editor_element_resizebox_event (GnomeCanvasItem *item,
+                                    GdkEvent *event,
+                                    GstEditorElement *element) 
+{
   GdkCursor *bottomright;
   gdouble item_x,item_y;
 
@@ -728,9 +802,15 @@ static gint gst_editor_element_resizebox_event(GnomeCanvasItem *item,
 
   switch(event->type) {
     case GDK_ENTER_NOTIFY:
+      gnome_canvas_item_set(GNOME_CANVAS_ITEM(element->resizebox),
+                        "fill_color", "red" , NULL);
+      return TRUE;
       break;
     case GDK_LEAVE_NOTIFY:
+      gnome_canvas_item_set(GNOME_CANVAS_ITEM(element->resizebox),
+                        "fill_color", "white" , NULL);
       element->hesitating = FALSE;
+      return TRUE;
       break;
     case GDK_BUTTON_PRESS:
       element->dragx = event->button.x;
@@ -761,7 +841,7 @@ static gint gst_editor_element_resizebox_event(GnomeCanvasItem *item,
         element->resizing = FALSE;
         gnome_canvas_item_ungrab(item,event->button.time);
 //g_print("in element resizebox_event, setting inchild");
-        element->canvas->inchild = TRUE;
+        //element->canvas->inchild = TRUE;
         return TRUE;
       }
       break;
@@ -772,14 +852,16 @@ static gint gst_editor_element_resizebox_event(GnomeCanvasItem *item,
 }
 
 
-static gint gst_editor_element_state_event(GnomeCanvasItem *item,
-                                           GdkEvent *event,
-                                           gpointer data) {
+static gint 
+gst_editor_element_state_event(GnomeCanvasItem *item,
+                               GdkEvent *event,
+                               gpointer data) 
+{
   GstEditorElement *element;
   gint id = GPOINTER_TO_INT(data);
   GdkCursor *uparrow;
 
-  element = GST_EDTIOR_GET_OBJECT(item);
+  element = GST_EDITOR_GET_OBJECT(item);
 
   switch (event->type) {
     case GDK_ENTER_NOTIFY:
@@ -796,17 +878,28 @@ static gint gst_editor_element_state_event(GnomeCanvasItem *item,
       gnome_canvas_item_ungrab(item,event->button.time);
       break;
     case GDK_BUTTON_PRESS:
-      return TRUE;
-      break;
+    {
+      GdkEventButton *buttonevent = (GdkEventButton *)event;
+
+      if (buttonevent->button == 1)
+       return TRUE;
+      return FALSE;
+    }
     case GDK_BUTTON_RELEASE:
+    {
+      GdkEventButton *buttonevent = (GdkEventButton *)event;
+
+      if (buttonevent->button != 1)
+       return FALSE;
+
       if (id < 4) {
         gst_editor_element_set_state(element,id,TRUE);
       } else
         g_warning("Uh, shouldn't have gotten here, unknown state\n");
 //g_print("in element statebox_event, setting inchild");
-      element->canvas->inchild = TRUE;
+      //element->canvas->inchild = TRUE;
       return TRUE;
-      break;
+    }
     default:
       break;
   }
@@ -814,8 +907,10 @@ static gint gst_editor_element_state_event(GnomeCanvasItem *item,
 }
 
 
-static void gst_editor_element_set_state(GstEditorElement *element,
-                                         gint id,gboolean set) {
+static void 
+gst_editor_element_set_state(GstEditorElement *element,
+                             gint id,gboolean set) 
+{
   gboolean stateset = TRUE;    /* if we have no element, set anyway */
   //g_print("element set state %d\n", id);
   if (element->element)
@@ -823,16 +918,20 @@ static void gst_editor_element_set_state(GstEditorElement *element,
 }
 
 
-static void gst_editor_element_state_change(GstElement *element,
-                                            gint state,
-                                            GstEditorElement *editorelement) {
+static void 
+gst_editor_element_state_change(GstElement *element,
+                                gint state,
+                                GstEditorElement *editorelement) 
+{
   g_return_if_fail(editorelement != NULL);
 
   //g_print("gst_editor_element_state_change got state 0x%08x\n",state);
   gst_editor_element_sync_state(editorelement);
 }
 
-static void gst_editor_element_sync_state(GstEditorElement *element) {
+static void 
+gst_editor_element_sync_state (GstEditorElement *element) 
+{
   gint id;
   GstElementState state = GST_STATE(element->element);
 
@@ -852,8 +951,10 @@ static void gst_editor_element_sync_state(GstEditorElement *element) {
   }
 }
 
-static void gst_editor_element_move(GstEditorElement *element,
-                                    gdouble dx,gdouble dy) {
+static void 
+gst_editor_element_move(GstEditorElement *element,
+                        gdouble dx,gdouble dy) 
+{
   GList *pads;
   GstEditorPad *pad;
 
index e2972aeca3fb171ec8a62c023d438717afbd9bc7..78bba30bdb6dc6a84be047c8947e03e5168a9e70 100644 (file)
@@ -106,8 +106,10 @@ static void gst_editor_pad_class_init(GstEditorPadClass *klass) {
 static void gst_editor_pad_init(GstEditorPad *pad) {
 }
 
-GstEditorPad *gst_editor_pad_new(GstEditorElement *parent,GstPad *pad,
-                                 const gchar *first_arg_name, ...) {
+GstEditorPad*
+gst_editor_pad_new(GstEditorElement *parent,GstPad *pad,
+                   const gchar *first_arg_name, ...) 
+{
   GstEditorPad *editorpad;
   va_list args;
 
@@ -118,11 +120,28 @@ GstEditorPad *gst_editor_pad_new(GstEditorElement *parent,GstPad *pad,
 
   editorpad = GST_EDITOR_PAD(gtk_type_new(GST_TYPE_EDITOR_PAD));
   editorpad->pad = pad;
+  GST_EDITOR_SET_OBJECT(pad, editorpad);
 
   va_start(args,first_arg_name);
   gst_editor_pad_construct(editorpad,parent,first_arg_name,args);
   va_end(args);
 
+  if (GST_PAD_CONNECTED (pad)) {
+    GstPad *peerpad;
+    GstEditorPad *peereditorpad;
+
+    peerpad = pad->peer;
+
+    peereditorpad = GST_EDITOR_GET_OBJECT (peerpad);
+
+    if (peereditorpad) { 
+      GstEditorConnection *connection;
+
+      connection = gst_editor_connection_new (parent, editorpad);
+      gst_editor_connection_set_endpad (connection, peereditorpad);
+    }
+  }
+
   return editorpad;
 }
 
@@ -245,7 +264,8 @@ static void gst_editor_pad_realize(GstEditorPad *pad) {
       "x1",0.0,"y1",2.0,"x2",4.0,"y2",pad->height-2.0,NULL);
   g_return_if_fail(pad->padbox != NULL);
   GST_EDITOR_SET_OBJECT(pad->padbox,pad);
-  gtk_signal_connect(GTK_OBJECT(pad->padbox),"event",
+
+  gtk_signal_connect(GTK_OBJECT(pad->group),"event",
     GTK_SIGNAL_FUNC(gst_editor_pad_padbox_event),pad);
 
   pad->title = gnome_canvas_item_new(pad->group,
@@ -381,10 +401,14 @@ static gint gst_editor_pad_padbox_event(GnomeCanvasItem *item,
 
   switch(event->type) {
     case GDK_ENTER_NOTIFY:
+      gtk_object_set(GTK_OBJECT(pad->border),
+                 "fill_color_rgba", 0xBBDDBB00, NULL);
 //      g_print("entered pad '%s'\n",
 //              gst_pad_get_name(pad->pad));
       break;
     case GDK_LEAVE_NOTIFY:
+      gtk_object_set(GTK_OBJECT(pad->border),
+                 "fill_color_rgba", 0xCCFFCC00, NULL);
 //      g_print("left pad '%s'\n",
 //              gst_pad_get_name(pad->pad));
       break;
index 55dbe4291acc5e1129e91289aa3814facc9f7b17..c44523e023157130a7cdc8a992fe804824ce50fe 100644 (file)
@@ -124,7 +124,7 @@ gst_editor_project_new_from_file (const guchar *fname)
   GstXML *xml;
   GList *elements;
 
-  g_return_if_fail (fname != NULL);
+  g_return_val_if_fail (fname != NULL, NULL);
 
   editorproject = gst_editor_project_new();
 
@@ -143,6 +143,11 @@ gst_editor_project_new_from_file (const guchar *fname)
   return editorproject;
 }
 
+void
+gst_editor_project_load (GstEditorProject *project, const guchar *fname) 
+{
+}
+
 void 
 gst_editor_project_save_as (GstEditorProject *project, const guchar *fname) 
 {
@@ -163,7 +168,8 @@ gst_editor_project_save_as (GstEditorProject *project, const guchar *fname)
 }
 
 void 
-gst_editor_project_add_toplevel_element (GstEditorProject *project, GstElement *element) 
+gst_editor_project_add_toplevel_element (GstEditorProject *project, 
+                                        GstElement *element) 
 {
   g_return_if_fail(project != NULL);
   g_return_if_fail(GST_IS_EDITOR_PROJECT(project));
index d15e610a18d6c47b310bcb1cff481b8a192bca87..8f6943e0c679b79661880d0e249a5822f08cdebe 100644 (file)
@@ -60,6 +60,7 @@ GtkType               gst_editor_project_get_type             (void);
 
 GstEditorProject*      gst_editor_project_new                  (void);
 GstEditorProject*      gst_editor_project_new_from_file        (const guchar *fname);
+void                   gst_editor_project_load                 (GstEditorProject *project, const guchar *fname);
 void                   gst_editor_project_save                 (GstEditorProject *project);
 void                   gst_editor_project_save_as              (GstEditorProject *project,
                                                                 const guchar *fname);
index 39dfda838f45c9816b5d608b9bd37e09bfd587e6..43a0a20e9d221e9fb103ff17df00532b2a556283 100644 (file)
@@ -152,7 +152,7 @@ view_on_element_added (GstEditorProjectView *view, GstElement *element)
   GstEditor *editor;
 
   image = gst_editor_image_get_for_type(GTK_OBJECT_TYPE(element));
-  name = gst_element_get_name(element);
+  name = (gchar *)gst_element_get_name(element);
   row = gtk_clist_append(GTK_CLIST(view->list), &name);
   editor =  gst_editor_new(element);
 
@@ -215,7 +215,7 @@ on_load_file_selected (GtkWidget *button,
   GstEditorProjectView *view = data->view;
 
   gchar *file_name = gtk_file_selection_get_filename (GTK_FILE_SELECTION(selector));
-  //gst_editor_project_load (view->project, file_name);
+  gst_editor_project_load (view->project, file_name);
 
   g_free (data);
 }
@@ -286,7 +286,6 @@ gst_editor_project_view_new (GstEditorProject *project)
   while (elements) {
     GstElement *element = (GstElement *)elements->data;
 
-    g_print ("add\n");
     view_on_element_added (view, element);
 
     elements = g_list_next (elements);
index 4b9c4ee692fa5a54f2947ea853e1a5207cc50a0d..5c08d5e67c0efa2df38d22acabc7366b8f84476f 100644 (file)
 #include <ctype.h>
 #include <gnome.h>
 #include <gst/gst.h>
+#include <gst/gstpropsprivate.h>
 
 #include "gsteditorproperty.h"
 #include "gsteditorimage.h"
 
 /* class functions */
-static void gst_editor_property_class_init(GstEditorPropertyClass *klass);
-static void gst_editor_property_init(GstEditorProperty *property);
-static void gst_editor_property_set_arg(GtkObject *object,GtkArg *arg,guint id);
-static void gst_editor_property_get_arg(GtkObject *object,GtkArg *arg,guint id);
+static void            gst_editor_property_class_init  (GstEditorPropertyClass *klass);
+static void            gst_editor_property_init        (GstEditorProperty *property);
+
+static void            gst_editor_property_set_arg     (GtkObject *object,GtkArg *arg,guint id);
+static void            gst_editor_property_get_arg     (GtkObject *object,GtkArg *arg,guint id);
+
+static GtkWidget*      create_property_entry           (GtkArg *arg, GstElement *element);
+
+static GtkWidget*      gst_editor_property_create      (GstEditorProperty *property, GstEditorElement *element);
 
-static GtkWidget *create_property_entry(GtkArg *arg, GstElement *element);
 
 enum {
   ARG_0,
@@ -48,7 +53,9 @@ static guint gst_editor_property_signals[LAST_SIGNAL] = { 0 };
 
 static GstEditorProperty *_the_property = NULL;
 
-GtkType gst_editor_property_get_type() {
+GtkType 
+gst_editor_property_get_type (void) 
+{
   static GtkType property_type = 0;
 
   if (!property_type) {
@@ -67,7 +74,9 @@ GtkType gst_editor_property_get_type() {
   return property_type;
 }
 
-static void gst_editor_property_class_init(GstEditorPropertyClass *klass) {
+static void 
+gst_editor_property_class_init (GstEditorPropertyClass *klass) 
+{
   GtkObjectClass *object_class;
 
   object_class = (GtkObjectClass*)klass;
@@ -92,10 +101,10 @@ static void gst_editor_property_class_init(GstEditorPropertyClass *klass) {
   object_class->get_arg = gst_editor_property_get_arg;
 }
 
-static void gst_editor_property_init(GstEditorProperty *property) {
-
-  property->panels = g_hash_table_new(NULL, NULL);
-  property->current = NULL;
+static void 
+gst_editor_property_init (GstEditorProperty *property) 
+{
+  property->shown_element = NULL;
 }
 
 typedef struct {
@@ -104,7 +113,8 @@ typedef struct {
 } connect_struct;
   
 /* we need more control here so... */
-static void gst_editor_property_connect_func (const gchar *handler_name,
+static void 
+gst_editor_property_connect_func (const gchar *handler_name,
                             GtkObject *object,
                             const gchar *signal_name,
                             const gchar *signal_data,
@@ -125,7 +135,9 @@ static void gst_editor_property_connect_func (const gchar *handler_name,
   }
 }
 
-static GstEditorProperty *gst_editor_property_new() {
+static GstEditorProperty*
+gst_editor_property_new (void) 
+{
   GstEditorProperty *property;
   GtkWidget *property_window;
   connect_struct data;
@@ -147,14 +159,18 @@ static GstEditorProperty *gst_editor_property_new() {
   return property;
 }
 
-GstEditorProperty *gst_editor_property_get() {
+GstEditorProperty*
+gst_editor_property_get (void) 
+{
   if (!_the_property) {
     _the_property = gst_editor_property_new();
   }
   return _the_property;
 }
 
-static void gst_editor_property_set_arg(GtkObject *object,GtkArg *arg,guint id) {
+static void 
+gst_editor_property_set_arg (GtkObject *object,GtkArg *arg,guint id) 
+{
   GstEditorProperty *property;
 
   /* get the major types of this object */
@@ -167,7 +183,9 @@ static void gst_editor_property_set_arg(GtkObject *object,GtkArg *arg,guint id)
   }
 }
 
-static void gst_editor_property_get_arg(GtkObject *object,GtkArg *arg,guint id) {
+static void 
+gst_editor_property_get_arg (GtkObject *object,GtkArg *arg,guint id) 
+{
   GstEditorProperty *property;
 
   /* get the major types of this object */
@@ -180,11 +198,15 @@ static void gst_editor_property_get_arg(GtkObject *object,GtkArg *arg,guint id)
   }
 }
 
-static void on_name_changed(GtkEntry *entry, GstEditorElement *element) {
+static void 
+on_name_changed (GtkEntry *entry, GstEditorElement *element) 
+{
   gst_editor_element_set_name(element, gtk_entry_get_text(GTK_ENTRY(entry)));
 }
 
-static gchar *make_readable_name(gchar *name) {
+static gchar*
+make_readable_name (gchar *name) 
+{
   gchar *new;
   gchar *colon;
   gboolean inupper;
@@ -211,76 +233,222 @@ static gchar *make_readable_name(gchar *name) {
   return new;
 }
 
-void gst_editor_property_show(GstEditorProperty *property, GstEditorElement *element) {
+static gchar* 
+gst_editor_props_show_func (GstPropsEntry *entry) 
+{
+  switch (entry->propstype) {
+    case GST_PROPS_INT_ID_NUM:
+      return g_strdup_printf ("%d", entry->data.int_data);
+      break;
+    case GST_PROPS_INT_RANGE_ID_NUM:
+      return g_strdup_printf ("%d-%d", entry->data.int_range_data.min, entry->data.int_range_data.max);
+      break;
+    case GST_PROPS_FOURCC_ID_NUM:
+      return g_strdup_printf ("%4.4s", (gchar *)&entry->data.fourcc_data);
+      break;
+    case GST_PROPS_BOOL_ID_NUM:
+      return g_strdup_printf ("%s", (entry->data.bool_data ? "TRUE" : "FALSE"));
+      break;
+    default:
+      break;
+  }
+  return g_strdup ("unknown");
+}
+
+static GtkWidget* 
+gst_editor_pads_create (GstEditorProperty *property, GstEditorElement *element) 
+{
+  GstElement *realelement = element->element;
+  GList *pads;
+  GtkWidget *tree;
+  gchar *columns[2];
+
+  pads = gst_element_get_pad_list(realelement);
+
+  columns[0] = "name";
+  columns[1] = "info";
+
+  tree = gtk_ctree_new_with_titles (2, 0, columns);
+  gtk_clist_set_column_width (GTK_CLIST (tree), 0, 150);
+  
+  gtk_clist_freeze (GTK_CLIST (tree));
+  while (pads) {
+    GstPad *pad = (GstPad *)pads->data;
+    GstCaps *caps = gst_pad_get_caps (pad);
+    gchar *mime;
+    gchar *data[2];
+    GtkCTreeNode *padnode;
+
+    if (caps) {
+      GstType *type;
+      type = gst_type_find_by_id (caps->id);
+      mime = type->mime;
+    }
+    else {
+      mime = "unknown/unknown";
+    }
+
+    data[0] = g_strdup (gst_pad_get_name (pad));
+    data[1] = mime;
+    padnode = gtk_ctree_insert_node (GTK_CTREE (tree), NULL, NULL, data, 0, 
+                   NULL, NULL, NULL, NULL, FALSE, TRUE);
+    if (caps) {
+      GstProps *props = gst_caps_get_props (caps);
+      if (props) {
+        GSList *propslist = props->properties;
+
+        while (propslist) {
+         GstPropsEntry *entry = (GstPropsEntry *)propslist->data;
+
+          data[0] = g_quark_to_string (entry->propid);
+
+         switch (entry->propstype) {
+           case GST_PROPS_LIST_ID_NUM:
+           {
+             GList *list;
+             guint count = 0;
+             data[1] = "";
+
+             list = entry->data.list_data.entries;
+
+             while (list) {
+               data[1] = g_strconcat (data[1], (count++?", ":""),
+                             gst_editor_props_show_func ((GstPropsEntry *)list->data), NULL);
+               list = g_list_next (list);
+             }
+             break;
+           }
+           default:
+             data[1] = gst_editor_props_show_func (entry);
+             break;
+         }
+          gtk_ctree_insert_node (GTK_CTREE (tree), padnode, NULL, data, 0, 
+                     NULL, NULL, NULL, NULL, TRUE, TRUE);
+       
+         propslist = g_slist_next (propslist);
+       }
+      }
+    }
+    pads = g_list_next (pads);
+  }
+  gtk_clist_thaw (GTK_CLIST (tree));
+
+  gtk_widget_show(tree);
+  gtk_object_ref(GTK_OBJECT(tree));
+  return tree;
+}
+
+typedef struct {
+  GtkWidget *properties;
+  GtkWidget *pads;
+  GtkWidget *signals;
+} properties_widgets;
+  
+void 
+gst_editor_property_show (GstEditorProperty *property, GstEditorElement *element) 
+{
   GtkType type;
-  GtkWidget *table, *vbox;
-  GtkWidget *label, *entry, *panel = NULL;
+
+  if (property->shown_element != element) {
+    gtk_object_set (GTK_OBJECT (element), "active",TRUE,  NULL);
+    if (property->shown_element) {
+      gtk_object_set (GTK_OBJECT (property->shown_element), "active",FALSE,  NULL);
+    }
+  }
+  else return;
 
   type = GTK_OBJECT_TYPE(element->element);
   if (type != GTK_TYPE_INVALID) {
-    panel = (GtkWidget *)g_hash_table_lookup(property->panels, GINT_TO_POINTER(type));
-    vbox = glade_xml_get_widget(property->xml, "property_vbox");
+    GtkWidget *property_box, *pads_window;
+    properties_widgets *widgets;
+
+    property_box = glade_xml_get_widget(property->xml, "property_vbox");
+    pads_window = glade_xml_get_widget(property->xml, "pads_window");
 
-    if (panel && property->current == (gpointer) panel) return;
+    if (property->shown_element) {
+      properties_widgets *oldwidgets;
 
-    if (property->current)
-      gtk_container_remove(GTK_CONTAINER(vbox), GTK_WIDGET(property->current));
+      oldwidgets = (properties_widgets *) GST_EDITOR_PROPERTY_GET_OBJECT (property->shown_element);
 
-    if (panel) {
-      gtk_box_pack_start(GTK_BOX(vbox), panel, FALSE, TRUE, 0);
-      property->current = (gpointer) panel;
+      gtk_container_remove(GTK_CONTAINER(property_box), oldwidgets->properties);
+      gtk_container_remove(GTK_CONTAINER(pads_window), oldwidgets->pads);
     }
-    else {
-      GtkArg *args;
-      guint32 *flags;
-      guint num_args, i, count;
-    
-      table = gtk_table_new(1, 2, FALSE);
-      gtk_table_set_row_spacings(GTK_TABLE(table), 2);
-      gtk_widget_show(table);
-
-      label = gtk_label_new(_("Name:"));
-      gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
-      gtk_object_set(GTK_OBJECT(label), "width", 100, NULL);
-      gtk_widget_show(label);
-      entry = gtk_entry_new();
-      gtk_widget_show(entry);
-      gtk_entry_set_text(GTK_ENTRY(entry), gst_element_get_name(element->element));
-      gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
-      gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
 
-      gtk_signal_connect(GTK_OBJECT(entry), "changed", on_name_changed, element);
+    widgets = (properties_widgets *)GST_EDITOR_PROPERTY_GET_OBJECT(element);
 
-      args = gtk_object_query_args(type, &flags, &num_args);
-      count = 1;
-      for (i=0; i<num_args; i++) {
-        if (flags[i] & GTK_ARG_READABLE) {
-          gtk_object_getv(GTK_OBJECT(element->element), 1, &args[i]);
+    if (!widgets) {
+      widgets = g_new0 (properties_widgets, 1);
 
-         entry = create_property_entry(&args[i], element->element);
+      widgets->properties = gst_editor_property_create (property, element);
+      widgets->pads = gst_editor_pads_create (property, element);
 
-         if (entry) {
-           label = gtk_label_new(g_strconcat(make_readable_name(args[i].name), ":", NULL));
-           gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
-           gtk_object_set(GTK_OBJECT(label), "width", 100, NULL);
-           gtk_widget_show(label);
+      GST_EDITOR_PROPERTY_SET_OBJECT(element, widgets);
+    }
 
-            gtk_table_attach(GTK_TABLE(table), label, 0, 1, count, count+1, GTK_FILL, 0, 0, 0);
-            gtk_table_attach(GTK_TABLE(table), entry, 1, 2, count, count+1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
+    gtk_box_pack_start(GTK_BOX(property_box), widgets->properties, FALSE, TRUE, 0);
+    gtk_container_add(GTK_CONTAINER(pads_window), widgets->pads);
 
-           count++;
-         }
-        }
+    property->shown_element = element;
+  }
+}
+
+static GtkWidget* 
+gst_editor_property_create (GstEditorProperty *property, GstEditorElement *element) 
+{
+  GtkWidget *table;
+  GtkType type;
+  GtkArg *args;
+  guint32 *flags;
+  guint num_args, i, count;
+  GtkWidget *label, *entry;
+
+  type = GTK_OBJECT_TYPE(element->element);
+
+  table = gtk_table_new(1, 2, FALSE);
+  gtk_table_set_row_spacings(GTK_TABLE(table), 2);
+
+  label = gtk_label_new(_("Name:"));
+  gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
+  gtk_object_set(GTK_OBJECT(label), "width", 100, NULL);
+  gtk_widget_show(label);
+  entry = gtk_entry_new();
+  gtk_widget_show(entry);
+  gtk_entry_set_text(GTK_ENTRY(entry), gst_element_get_name(element->element));
+  gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
+  gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
+
+  gtk_signal_connect(GTK_OBJECT(entry), "changed", on_name_changed, element);
+
+  args = gtk_object_query_args(type, &flags, &num_args);
+  count = 1;
+  for (i=0; i<num_args; i++) {
+    if (flags[i] & GTK_ARG_READABLE) {
+      gtk_object_getv(GTK_OBJECT(element->element), 1, &args[i]);
+
+      entry = create_property_entry(&args[i], element->element);
+
+      if (entry) {
+        label = gtk_label_new(g_strconcat(make_readable_name(args[i].name), ":", NULL));
+       gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
+       gtk_object_set(GTK_OBJECT(label), "width", 100, NULL);
+       gtk_widget_show(label);
+
+        gtk_table_attach(GTK_TABLE(table), label, 0, 1, count, count+1, GTK_FILL, 0, 0, 0);
+        gtk_table_attach(GTK_TABLE(table), entry, 1, 2, count, count+1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
+
+       count++;
       }
-      gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, TRUE, 2);
-      g_hash_table_insert(property->panels, GINT_TO_POINTER(type), table);
-      gtk_object_ref(GTK_OBJECT(table));
-      property->current = (gpointer) table;
     }
   }
+
+  gtk_widget_show(table);
+  gtk_object_ref(GTK_OBJECT(table));
+  return table;
 }
 
-static void widget_show_toggled(GtkToggleButton *button, GtkArg *arg) {
+static void 
+widget_show_toggled (GtkToggleButton *button, GtkArg *arg) 
+{
   GtkWidget *window;
 
   window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@@ -293,15 +461,29 @@ static void widget_show_toggled(GtkToggleButton *button, GtkArg *arg) {
 typedef struct {
   GtkArg *arg;
   GstElement *element;
-} file_select;
+} arg_data;
+
+static void 
+widget_bool_toggled (GtkToggleButton *button, arg_data *arg) 
+{
+  gboolean toggled;
+
+  toggled = gtk_toggle_button_get_active(button);
+  gtk_object_set (GTK_OBJECT (button), "label", (toggled? _("Yes"):_("No")), NULL);
+
+  gtk_object_set (GTK_OBJECT (arg->element), arg->arg->name, toggled, NULL);
+}
   
-static void on_file_selected(GtkEditable *entry, file_select *fs)
+static void 
+on_file_selected (GtkEditable *entry, arg_data *fs)
 {
   gtk_object_set(GTK_OBJECT(fs->element), fs->arg->name, 
                  gtk_entry_get_text(GTK_ENTRY(entry)), NULL);
 }
 
-static GtkWidget *create_property_entry(GtkArg *arg, GstElement *element) {
+static GtkWidget*
+create_property_entry (GtkArg *arg, GstElement *element) 
+{
   GtkWidget *entry = NULL;
 
   // basic types
@@ -317,10 +499,16 @@ static GtkWidget *create_property_entry(GtkArg *arg, GstElement *element) {
     }
     case GTK_TYPE_BOOL:
     {
-      gboolean toggle;
-      toggle = GTK_VALUE_BOOL(*arg);
-      entry = gtk_toggle_button_new_with_label((toggle? _("Yes"):_("No")));
-      gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(entry), toggle);
+      gboolean toggled;
+      arg_data *data = g_new0(arg_data, 1);
+
+      data->element = element;
+      data->arg = arg;
+
+      toggled = GTK_VALUE_BOOL(*arg);
+      entry = gtk_toggle_button_new_with_label((toggled? _("Yes"):_("No")));
+      gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(entry), toggled);
+      gtk_signal_connect(GTK_OBJECT(entry), "toggled", widget_bool_toggled, data);
       break;
     }
     case GTK_TYPE_ULONG:
@@ -362,8 +550,10 @@ static GtkWidget *create_property_entry(GtkArg *arg, GstElement *element) {
     }
     else if (GTK_FUNDAMENTAL_TYPE(arg->type) == GTK_TYPE_ENUM) {
       GtkEnumValue *values;
-      gint i=0;
+      guint i = 0;
       GtkWidget *menu;
+      guint value = GTK_VALUE_ENUM (*arg);
+      guint active = 0;
 
       entry = gtk_option_menu_new();
       menu = gtk_menu_new();
@@ -374,12 +564,15 @@ static GtkWidget *create_property_entry(GtkArg *arg, GstElement *element) {
 
        gtk_menu_append(GTK_MENU(menu), menuitem);
        gtk_widget_show(menuitem);
+
+       if (value == values[i].value) active = i;
        i++;
       }
+      gtk_menu_set_active(GTK_MENU(menu), active);
       gtk_option_menu_set_menu(GTK_OPTION_MENU(entry), menu);
     }
     else if (arg->type == GST_TYPE_FILENAME) {
-      file_select *fs = g_new0(file_select, 1);
+      arg_data *fs = g_new0(arg_data, 1);
 
       entry = gnome_file_entry_new(NULL, NULL);
 
@@ -400,18 +593,3 @@ static GtkWidget *create_property_entry(GtkArg *arg, GstElement *element) {
   return entry;
 }
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
index 8fadde8b8c7a38a78179ee9ba5438a472aee595f..343b69c022d74c016ee06d09f5b352895d0ea96b 100644 (file)
 #define GST_IS_EDITOR_PROPERTY_CLASS(obj) \
   (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_EDITOR_PROPERTY))
 
+#define GST_EDITOR_PROPERTY_SET_OBJECT(item,object) \
+  (gtk_object_set_data(GTK_OBJECT(item),"gsteditorproperty",(object)))
+#define GST_EDITOR_PROPERTY_GET_OBJECT(item) \
+  (gtk_object_get_data(GTK_OBJECT(item),"gsteditorproperty"))
+
 typedef struct _GstEditorProperty GstEditorProperty;
 typedef struct _GstEditorPropertyClass GstEditorPropertyClass;
 
@@ -43,8 +48,7 @@ struct _GstEditorProperty {
   GtkObject object;
 
   GladeXML *xml;
-  GHashTable *panels;
-  gpointer *current;
+  GstEditorElement *shown_element;
 };
 
 struct _GstEditorPropertyClass {
index a49b15df4606bc2851b136b5484ac65cc2cdaa3f..73c25cd5f0bb9edb78f91df282aa3f803c818dff 100644 (file)
@@ -186,6 +186,9 @@ gst_audiosink_init (GstAudioSink *audiosink)
 
   audiosink->fd = -1;
   audiosink->clock = gst_clock_get_system();
+  audiosink->format = 16;
+  audiosink->channels = 2;
+  audiosink->frequency = 44100;
   
   gst_clock_register (audiosink->clock, GST_OBJECT (audiosink));
 
index c34434a12405a539980d3e0d5393d37f350b4183..e01a83eab4b1c29cb0d63853a0ed3bd1a0682c61 100644 (file)
@@ -79,6 +79,7 @@ struct _GstBinClass {
 
   /* signals */
   void                 (*object_added)         (GstObject *object, GstObject *child);
+  void                 (*object_removed)       (GstObject *object, GstObject *child);
 
   /* change the state of elements of the given type */
   gboolean     (*change_state_type)    (GstBin *bin,
index e0f885830161481d62a590d6c6cc5ddc3f2ca5a0..dd37c501f5b173dbb56e779c2cb58a7ff8e93334 100644 (file)
@@ -151,8 +151,8 @@ struct _GstElementClass {
   GstElementStateReturn (*change_state) (GstElement *element);
 
   /* create or read XML representation of self */
-  xmlNodePtr           (*save_thyself) (GstElement *element, xmlNodePtr parent);
-  void                         (*restore_thyself) (GstElement *element, xmlNodePtr self, GHashTable *elements);
+  xmlNodePtr   (*save_thyself)         (GstElement *element, xmlNodePtr parent);
+  void                 (*restore_thyself)      (GstElement *element, xmlNodePtr self, GHashTable *elements);
 };
 
 struct _GstElementDetails {
index 54dae5797ea155cf03ea2e8779dfd6ea65c12b46..18706866ea75be029c6a1a63ea588e6a6b412b2c 100644 (file)
@@ -37,6 +37,23 @@ gint gst_util_get_int_arg(GtkObject *object,guchar *argname) {
   return GTK_VALUE_INT(arg);
 }
 
+/**
+ * gst_util_get_bool_arg:
+ * @object: the object to query
+ * @argname: the name of the argument
+ *
+ * retrieves a property of an object as a boolean
+ *
+ * Returns: the property of the object
+ */
+gint gst_util_get_bool_arg(GtkObject *object,guchar *argname) {
+  GtkArg arg;
+
+  arg.name = argname;
+  gtk_object_getv(GTK_OBJECT(object),1,&arg);
+  return GTK_VALUE_BOOL(arg);
+}
+
 /**
  * gst_util_get_long_arg:
  * @object: the object to query
index 6cb4e6d5108623aab15d25005b68653c52b3653a..c1a7ba0a22a067a5cc642d299731b7dc2b7c81c1 100644 (file)
@@ -24,6 +24,7 @@
 #include <gtk/gtk.h>
 
 gint           gst_util_get_int_arg            (GtkObject *object, guchar *argname);
+gboolean       gst_util_get_bool_arg           (GtkObject *object, guchar *argname);
 glong          gst_util_get_long_arg           (GtkObject *object, guchar *argname);
 gfloat                 gst_util_get_float_arg          (GtkObject *object, guchar *argname);
 gdouble        gst_util_get_double_arg         (GtkObject *object, guchar *argname);
index c76e3598b286e00801e086e732d42de6fed1a4a1..4a08f811c6ddd715f6ee3ab5a0a445e732ce7405 100644 (file)
@@ -25,7 +25,9 @@ static void   gst_xml_init                    (GstXML *xml);
 
 static GstObjectClass *parent_class = NULL;
 
-GtkType gst_xml_get_type(void) {
+GtkType 
+gst_xml_get_type(void) 
+{
   static GtkType xml_type = 0;
 
   if (!xml_type) {
@@ -39,17 +41,20 @@ GtkType gst_xml_get_type(void) {
       (GtkArgGetFunc)NULL,
       (GtkClassInitFunc)NULL,
     };
-    xml_type = gtk_type_unique(GST_TYPE_XML,&xml_info);
+    xml_type = gtk_type_unique (GST_TYPE_XML, &xml_info);
   }
   return xml_type;
 }
 
 static void
-gst_xml_class_init(GstXMLClass *klass) {
-  parent_class = gtk_type_class(GST_TYPE_OBJECT);
+gst_xml_class_init (GstXMLClass *klass) 
+{
+  parent_class = gtk_type_class (GST_TYPE_OBJECT);
 }
 
-static void gst_xml_init(GstXML *xml) {
+static void 
+gst_xml_init(GstXML *xml) 
+{
 }
 
 /**
@@ -60,13 +65,15 @@ static void gst_xml_init(GstXML *xml) {
  *
  * Returns: a pointer to an XML document
  */
-xmlDocPtr gst_xml_write(GstElement *element) {
+xmlDocPtr 
+gst_xml_write (GstElement *element) 
+{
   xmlDocPtr doc;
 
-  doc = xmlNewDoc("1.0");
-  doc->root = xmlNewDocNode(doc,NULL,"GST-Pipeline",NULL);
+  doc = xmlNewDoc ("1.0");
+  doc->root = xmlNewDocNode (doc, NULL, "GST-Pipeline", NULL);
 
-  gst_element_save_thyself(element,doc->root);
+  gst_element_save_thyself (element, doc->root);
 
   return doc;
 }
index a49b15df4606bc2851b136b5484ac65cc2cdaa3f..73c25cd5f0bb9edb78f91df282aa3f803c818dff 100644 (file)
@@ -186,6 +186,9 @@ gst_audiosink_init (GstAudioSink *audiosink)
 
   audiosink->fd = -1;
   audiosink->clock = gst_clock_get_system();
+  audiosink->format = 16;
+  audiosink->channels = 2;
+  audiosink->frequency = 44100;
   
   gst_clock_register (audiosink->clock, GST_OBJECT (audiosink));