From: Andy W. <wi...@us...> - 2002-08-06 04:56:48
|
CVS Root: /cvsroot/gstreamer Module: gst-editor Changes by: wingo Date: Mon Aug 05 2002 21:56:46 PDT Log message: * add menu items to pads * elements are not resizeable by default, bins are, except the toplevel Modified files: libs/gst/editor : gsteditorbin.c gsteditorcanvas.c gsteditorelement.c gsteditorelement.h gsteditoritem.h gsteditorpad.c Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-editor/libs/gst/editor/gsteditorbin.c.diff?r1=1.20&r2=1.21 http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-editor/libs/gst/editor/gsteditorcanvas.c.diff?r1=1.9&r2=1.10 http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-editor/libs/gst/editor/gsteditorelement.c.diff?r1=1.26&r2=1.27 http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-editor/libs/gst/editor/gsteditorelement.h.diff?r1=1.4&r2=1.5 http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-editor/libs/gst/editor/gsteditoritem.h.diff?r1=1.6&r2=1.7 http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-editor/libs/gst/editor/gsteditorpad.c.diff?r1=1.15&r2=1.16 ====Begin Diffs==== Index: gsteditorbin.c =================================================================== RCS file: /cvsroot/gstreamer/gst-editor/libs/gst/editor/gsteditorbin.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- gsteditorbin.c 6 Aug 2002 03:54:13 -0000 1.20 +++ gsteditorbin.c 6 Aug 2002 04:56:34 -0000 1.21 @@ -105,11 +105,14 @@ element->insidewidth = 200; element->insideheight = 100; + item->width = 100; item->height = 100; bin->element_x = -1; bin->element_y = -1; + + g_object_set (bin, "resizeable", TRUE, NULL); } static void Index: gsteditorcanvas.c =================================================================== RCS file: /cvsroot/gstreamer/gst-editor/libs/gst/editor/gsteditorcanvas.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- gsteditorcanvas.c 24 Jun 2002 06:26:39 -0000 1.9 +++ gsteditorcanvas.c 6 Aug 2002 04:56:34 -0000 1.10 @@ -136,6 +136,7 @@ width = GTK_WIDGET (object)->allocation.width; height = GTK_WIDGET (object)->allocation.height; g_object_set (canvas->bin, "width", width, "height", height, NULL); + g_object_set (canvas->bin, "resizeable", FALSE, NULL); g_object_get (canvas->bin, "x", &x, "y", &y, NULL); gnome_canvas_item_move (GNOME_CANVAS_ITEM (canvas->bin), -x, -y); break; Index: gsteditorelement.c =================================================================== RCS file: /cvsroot/gstreamer/gst-editor/libs/gst/editor/gsteditorelement.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- gsteditorelement.c 6 Aug 2002 03:54:13 -0000 1.26 +++ gsteditorelement.c 6 Aug 2002 04:56:34 -0000 1.27 @@ -79,6 +79,7 @@ enum { ARG_0, ARG_ACTIVE, + ARG_RESIZEABLE, }; enum { @@ -152,6 +153,9 @@ g_object_class_install_property (object_class, ARG_ACTIVE, g_param_spec_boolean ("active", "active", "active", FALSE, G_PARAM_READWRITE)); + g_object_class_install_property (object_class, ARG_RESIZEABLE, + g_param_spec_boolean ("resizeable", "resizeable", "resizeable", + FALSE, G_PARAM_READWRITE)); citem_class->realize = gst_editor_element_realize; citem_class->event = gst_editor_element_event; @@ -186,6 +190,15 @@ "width_units", (element->active ? 2.0 : 1.0), NULL); break; + case ARG_RESIZEABLE: + element->resizeable = g_value_get_boolean (value); + if (!GST_EDITOR_ITEM (element)->realized) + break; + if (element->resizeable) + gnome_canvas_item_show (element->resizebox); + else + gnome_canvas_item_hide (element->resizebox); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -201,6 +214,9 @@ case ARG_ACTIVE: g_value_set_boolean (value, element->active); break; + case ARG_RESIZEABLE: + g_value_set_boolean (value, element->resizeable); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -213,7 +229,6 @@ GstEditorElement *element; GstEditorItem *item; gint i; - gdouble x1,y1,x2,y2; GList *pads; g_print ("realizing element %p\n", citem); @@ -224,6 +239,7 @@ if (GNOME_CANVAS_ITEM_CLASS (parent_class)->realize) GNOME_CANVAS_ITEM_CLASS (parent_class)->realize (citem); + /* the resize box */ element->resizebox = gnome_canvas_item_new (GNOME_CANVAS_GROUP (citem), gnome_canvas_rect_get_type(), "width_units", 1.0, @@ -232,19 +248,16 @@ NULL); g_return_if_fail (element->resizebox != NULL); GST_EDITOR_SET_OBJECT (element->resizebox, item); + g_signal_connect (G_OBJECT (element->resizebox), "event", + G_CALLBACK (gst_editor_element_resizebox_event), element); + if (!element->resizeable) + gnome_canvas_item_hide (element->resizebox); - /* it could be the root canvas */ + /* so we can update our connections */ if (GST_IS_EDITOR_ELEMENT (citem->parent)) g_signal_connect_swapped (G_OBJECT (citem->parent), "position_changed", G_CALLBACK (gst_editor_element_position_changed), G_OBJECT (element)); - - /* calculate the inter-group coords (x1,y1,x2,y2 are convenience vars) */ - x1 = 0.0; y1 = 0.0; - x2 = item->width; y2 = item->height; - - g_signal_connect (G_OBJECT (element->resizebox), "event", - G_CALLBACK (gst_editor_element_resizebox_event), element); /* create the state boxen */ for (i=0;i<4;i++) { Index: gsteditorelement.h =================================================================== RCS file: /cvsroot/gstreamer/gst-editor/libs/gst/editor/gsteditorelement.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- gsteditorelement.h 4 Aug 2002 15:50:05 -0000 1.4 +++ gsteditorelement.h 6 Aug 2002 04:56:34 -0000 1.5 @@ -56,6 +56,7 @@ GnomeCanvasGroup *contents; /* contents if any */ gboolean active; /* is it active (currently selected) */ + gboolean resizeable; GList *srcpads, *sinkpads; /* list of pads */ gboolean padlistchange; Index: gsteditoritem.h =================================================================== RCS file: /cvsroot/gstreamer/gst-editor/libs/gst/editor/gsteditoritem.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- gsteditoritem.h 6 Aug 2002 03:54:13 -0000 1.6 +++ gsteditoritem.h 6 Aug 2002 04:56:34 -0000 1.7 @@ -82,10 +82,10 @@ GstEditorItem* gst_editor_item_get (GstObject *object); -#define GST_EDITOR_ITEM_CLASS_PREPEND_MENU_ITEMS(item_class, menu_items, nitems) \ +#define GST_EDITOR_ITEM_CLASS_PREPEND_MENU_ITEMS(item_class, menuitems, nitems) \ G_STMT_START{ \ GnomeUIInfo *info = g_new0 (GnomeUIInfo, item_class->num_menu_items + nitems + 1); \ - memcpy (info, menu_items, sizeof (GnomeUIInfo) * nitems + 1); \ + memcpy (info, menuitems, sizeof (GnomeUIInfo) * nitems + 1); \ if (item_class->num_menu_items) \ memcpy (&info[nitems], item_class->menu_items, \ sizeof (GnomeUIInfo) * item_class->num_menu_items + 1); \ @@ -93,13 +93,13 @@ item_class->num_menu_items += nitems; \ }G_STMT_END -#define GST_EDITOR_ITEM_CLASS_APPEND_MENU_ITEMS(item_class, menu_items, nitems) \ +#define GST_EDITOR_ITEM_CLASS_APPEND_MENU_ITEMS(item_class, menuitems, nitems) \ G_STMT_START{ \ GnomeUIInfo *info = g_new0 (GnomeUIInfo, item_class->num_menu_items + nitems + 1); \ if (item_class->num_menu_items) \ memcpy (info, item_class->menu_items, \ sizeof (GnomeUIInfo) * item_class->num_menu_items); \ - memcpy (&info[item_class->num_menu_items], menu_items, \ + memcpy (&info[item_class->num_menu_items], menuitems, \ sizeof (GnomeUIInfo) * nitems + 1); \ item_class->menu_items = info; \ item_class->num_menu_items += nitems; \ Index: gsteditorpad.c =================================================================== RCS file: /cvsroot/gstreamer/gst-editor/libs/gst/editor/gsteditorpad.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- gsteditorpad.c 4 Aug 2002 15:50:05 -0000 1.15 +++ gsteditorpad.c 6 Aug 2002 04:56:34 -0000 1.16 @@ -43,6 +43,12 @@ static void gst_editor_pad_connection_start (GstEditorPad *pad); static void gst_editor_pad_disconnect (GstEditorPad *pad); +static void on_pad_status (GtkWidget *unused, GstEditorPadAlways *pad); +static void on_derequest_pad (GtkWidget *unused, GstEditorPadAlways *pad); +static void on_ghost (GtkWidget *unused, GstEditorPadAlways *pad); +static void on_request_pad (GtkWidget *unused, GstEditorPadRequest *pad); +static void on_frobate (GtkWidget *unused, GstEditorPadSometimes *pad); + enum { ARG_0, @@ -54,6 +60,31 @@ static GstEditorItemClass *parent_class; +static GnomeUIInfo always_pad_menu_items[] = { + GNOMEUIINFO_ITEM_STOCK ("Pad status...", "Query pad caps, formats, etc", + on_pad_status, "gtk-properties"), + GNOMEUIINFO_ITEM_STOCK ("De-request pad", "De-request this previously-requested pad", + on_derequest_pad, "gtk-cancel"), + GNOMEUIINFO_ITEM_STOCK ("Ghost to managing bin...", "Ghost this pad to the managing bin", + on_ghost, "gtk-jump-to"), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_END +}; + +static GnomeUIInfo request_pad_menu_items[] = { + GNOMEUIINFO_ITEM_STOCK ("Request pad by name...", "Request a pad from this template by name", + on_request_pad, "gtk-select-font"), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_END +}; + +static GnomeUIInfo sometimes_pad_menu_items[] = { + GNOMEUIINFO_ITEM_STOCK ("Frobate...", "Frobate this pad into a cromulate mass of goo", + on_frobate, "gtk-execute"), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_END +}; + GType gst_editor_pad_get_type (void) @@ -166,6 +197,17 @@ citem_class->realize = gst_editor_pad_realize; citem_class->event = gst_editor_pad_event; item_class->repack = gst_editor_pad_repack; + + if (G_TYPE_FROM_CLASS (klass) == GST_TYPE_EDITOR_PAD_ALWAYS) { + GST_EDITOR_ITEM_CLASS_PREPEND_MENU_ITEMS (item_class, always_pad_menu_items, 3); +// item_class->whats_this = gst_editor_pad_always_whats_this; + } else if (G_TYPE_FROM_CLASS (klass) == GST_TYPE_EDITOR_PAD_SOMETIMES) { + GST_EDITOR_ITEM_CLASS_PREPEND_MENU_ITEMS (item_class, sometimes_pad_menu_items, 2); +// item_class->whats_this = gst_editor_pad_sometimes_whats_this; + } else if (G_TYPE_FROM_CLASS (klass) == GST_TYPE_EDITOR_PAD_REQUEST) { + GST_EDITOR_ITEM_CLASS_PREPEND_MENU_ITEMS (item_class, request_pad_menu_items, 2); +// item_class->whats_this = gst_editor_pad_request_whats_this; + } } static void @@ -513,3 +555,39 @@ gst_editor_connection_resize (pad->connection); } } + +static void on_pad_status (GtkWidget *unused, GstEditorPadAlways *pad) +{ + g_return_if_fail (GST_IS_EDITOR_PAD_ALWAYS (pad)); + + g_print ("pad status\n"); +} + +static void on_derequest_pad (GtkWidget *unused, GstEditorPadAlways *pad) +{ + g_return_if_fail (GST_IS_EDITOR_PAD_ALWAYS (pad)); + + g_print ("derequest pad\n"); +} + +static void on_request_pad (GtkWidget *unused, GstEditorPadRequest *pad) +{ + g_return_if_fail (GST_IS_EDITOR_PAD_REQUEST (pad)); + + g_print ("request pad\n"); +} + +static void on_frobate (GtkWidget *unused, GstEditorPadSometimes *pad) +{ + g_return_if_fail (GST_IS_EDITOR_PAD_SOMETIMES (pad)); + + g_print ("frobate\n"); +} + +static void on_ghost (GtkWidget *unused, GstEditorPadAlways *pad) +{ + g_return_if_fail (GST_IS_EDITOR_PAD_ALWAYS (pad)); + + g_print ("ghost\n"); +} + |