From: Andy W. <wi...@us...> - 2002-07-13 05:39:39
|
CVS Root: /cvsroot/gstreamer Module: gst-editor Changes by: wingo Date: Fri Jul 12 2002 22:39:38 PDT Log message: bug fixes and eye candy Modified files: . : TODO libs/gst/editor : gsteditorconnection.c gsteditorpad.c Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-editor/TODO.diff?r1=1.3&r2=1.4 http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-editor/libs/gst/editor/gsteditorconnection.c.diff?r1=1.8&r2=1.9 http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-editor/libs/gst/editor/gsteditorpad.c.diff?r1=1.12&r2=1.13 ====Begin Diffs==== Index: TODO =================================================================== RCS file: /cvsroot/gstreamer/gst-editor/TODO,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- TODO 13 Jul 2002 04:09:36 -0000 1.3 +++ TODO 13 Jul 2002 05:39:26 -0000 1.4 @@ -12,23 +12,24 @@ 3) Rapid prototyping with -launch syntax - 1 hr, depends on 1) -- DONE 4) Fix some bugs in connection end misplacement, and add arrow heads to - connections - 2 hrs + connections - 2 hrs -- DONE (some bugs remain on pipeline loading) 5) Make connections MVC - 1 hr - * Connections should be dashed when they are first constructed - * They turn solid when the pad_connected signal is fired + * Connections should be dashed when they are first constructed -- DONE + * They turn solid when the pad_connected signal is fired -- not necessary + right now -- pad_connect returns TRUE or FALSE 6) Make it possible to disconnect pads by dragging a connection off a pad - 1 hr -7) Make it possible to de-request pads - 2 hrs +7) Make it possible to de-request pads - 1 hr, depemds on 6) -8) Make editor threadsafe - unknown, possibly 5 hrs +8) Make editor threadsafe - unknown, possibly 10 hrs 9) Allow element removal - 2 hrs 10) Implement clipboard actions - 1 hr, depends on 9) and 2) -11) Add debug-ui page from libs/gst/debug-ui - 0.5 hr +11) Add debug-ui page from libs/gst/debug-ui - 1 hr 12) Fix mapping / realization bugs in element-ui - 1 hr Index: gsteditorconnection.c =================================================================== RCS file: /cvsroot/gstreamer/gst-editor/libs/gst/editor/gsteditorconnection.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- gsteditorconnection.c 12 Jul 2002 19:14:01 -0000 1.8 +++ gsteditorconnection.c 13 Jul 2002 05:39:26 -0000 1.9 @@ -103,12 +103,13 @@ g_return_val_if_fail(frompad != NULL, NULL); g_return_val_if_fail(GST_IS_EDITOR_PAD(frompad), NULL); - connection = GST_EDITOR_CONNECTION (gnome_canvas_item_new (GNOME_CANVAS_GROUP (frompad), + /* in the from element's group */ + connection = GST_EDITOR_CONNECTION (gnome_canvas_item_new (GNOME_CANVAS_ITEM (frompad)->parent, GST_TYPE_EDITOR_CONNECTION, + "from-pad", frompad, NULL)); - connection->frompad = GST_EDITOR_ITEM (frompad); - connection->fromsrc = frompad->issrc; + connection->fromsrc = frompad->issrc; gst_editor_connection_realize (GNOME_CANVAS_ITEM (connection)); return connection; @@ -155,6 +156,8 @@ } connection->frompad = (GstEditorItem*)frompad; + connection->fromsrc = frompad->issrc; + connection->resize = TRUE; break; case ARG_TOPAD: @@ -227,9 +230,16 @@ connection->points->coords[2] = 0.0; connection->points->coords[3] = 0.0; + /* see gnome-canvas-line.h for the docs */ gnome_canvas_item_set (citem, "points", connection->points, "width-units", 2.0, + "line-style", GDK_LINE_ON_OFF_DASH, + "first-arrowhead", !connection->fromsrc, + "last-arrowhead", connection->fromsrc, + "arrow-shape-a", 5.0, + "arrow-shape-b", 5.0, + "arrow-shape-c", 5.0, NULL); } @@ -247,7 +257,7 @@ if (connection->topad == NULL) { /* our base point is the source pad */ - x1 = y1 = 0.0; + g_object_get (connection->frompad, "x", &x1, "y", &y1, NULL); if (connection->fromsrc) x1 += connection->frompad->width; @@ -257,15 +267,14 @@ y2 = connection->y; /* NOTE: coords are in the following state: - x1,y1: item coords relative to the pad + x1,y1: item coords relative to the element x2,y2: item coords relative to the world - This means translating the x2,y2 coords into pad. + This means translating the x2,y2 coords into element. */ gnome_canvas_item_w2i (GNOME_CANVAS_ITEM (connection)->parent, &x2, &y2); } else { g_object_get (connection->topad, "x", &x2, "y", &y2, NULL); - - x1 = y1 = 0.0; + g_object_get (connection->frompad, "x", &x1, "y", &y1, NULL); if (connection->fromsrc) x1 += connection->frompad->width; @@ -276,7 +285,7 @@ y2 += connection->topad->height / 2; gnome_canvas_item_i2w (GNOME_CANVAS_ITEM (connection->topad)->parent, &x2, &y2); - gnome_canvas_item_w2i (GNOME_CANVAS_ITEM (connection->frompad), &x2, &y2); + gnome_canvas_item_w2i (GNOME_CANVAS_ITEM (connection->frompad)->parent, &x2, &y2); } connection->points->coords[0] = x1; @@ -352,18 +361,32 @@ g_message ("connecting %s and %s", GST_OBJECT_NAME (from), GST_OBJECT_NAME (to)); - if (GST_PAD_PEER (from) || GST_PAD_PEER (to)) { - if (GST_PAD_PEER (from) != to) { + if (GST_IS_EDITOR_PAD_ALWAYS (connection->frompad)) { + if (GST_IS_EDITOR_PAD_ALWAYS (connection->topad)) { + if (GST_PAD_PEER (from) || GST_PAD_PEER (to)) { + if (GST_PAD_PEER (from) != to) { + g_warning ("The from pad is connected, but not to the to pad"); + goto error; + } + if (GST_PAD_PEER (to) != from) { + g_warning ("The to pad is connected, but not to the from pad"); + goto error; + } + goto connected; + /* yay goto */ + } + } else if (GST_PAD_PEER (from)) { + /* the to pad is a template */ g_warning ("The from pad is connected, but not to the to pad"); goto error; } - if (GST_PAD_PEER (to) != from) { - g_warning ("The to pad is connected, but not to the from pad"); - goto error; - } - goto connected; - /* yay goto */ - } else if (connection->ghost) { + } else if (GST_IS_EDITOR_PAD_ALWAYS (connection->topad) && GST_PAD_PEER (to)) { + /* from pad is a real pad */ + g_warning ("The to pad is connected, but not to the from pad"); + goto error; + } + + if (connection->ghost) { g_print("uhhh.... Boo!\n"); return TRUE; } else { @@ -372,11 +395,10 @@ } else if (GST_IS_EDITOR_PAD_REQUEST (connection->frompad)) { frompad = gst_element_get_request_pad ((GstElement*)GST_EDITOR_ITEM (GNOME_CANVAS_ITEM (connection->frompad)->parent)->object, GST_PAD_TEMPLATE (from)->name_template); - /* voodoo */ - connection->frompad = GST_EDITOR_PAD (connection->frompad)->issrc - ? GST_EDITOR_ELEMENT (GNOME_CANVAS_ITEM (connection->frompad)->parent)->srcpads->data - : GST_EDITOR_ELEMENT (GNOME_CANVAS_ITEM (connection->frompad)->parent)->sinkpads->data; - gnome_canvas_item_set (GNOME_CANVAS_ITEM (connection), "from-pad", connection->frompad, NULL); + /* the new_pad signal will cause a new pad to made automagically in the + element */ + gnome_canvas_item_set (GNOME_CANVAS_ITEM (connection), "from-pad", + gst_editor_item_get ((GstObject*)frompad), NULL); } else { goto error; } @@ -389,10 +411,8 @@ } else if (GST_IS_EDITOR_PAD_REQUEST (connection->topad)) { topad = gst_element_get_request_pad ((GstElement*)GST_EDITOR_ITEM (GNOME_CANVAS_ITEM (connection->topad)->parent)->object, GST_PAD_TEMPLATE (to)->name_template); - connection->topad = GST_EDITOR_PAD (connection->topad)->issrc - ? GST_EDITOR_ELEMENT (GNOME_CANVAS_ITEM (connection->topad)->parent)->srcpads->data - : GST_EDITOR_ELEMENT (GNOME_CANVAS_ITEM (connection->topad)->parent)->sinkpads->data; - gnome_canvas_item_set (GNOME_CANVAS_ITEM (connection), "to-pad", connection->topad, NULL); + gnome_canvas_item_set (GNOME_CANVAS_ITEM (connection), "to-pad", + gst_editor_item_get ((GstObject*)topad), NULL); } else { goto error; } @@ -403,6 +423,7 @@ if (gst_pad_connect(frompad, topad)) { connected: + gnome_canvas_item_set (connection, "line-style", GDK_LINE_SOLID, NULL); g_signal_connect (GNOME_CANVAS_ITEM (connection->topad)->parent, "position-changed", G_CALLBACK (on_element_position_changed), G_OBJECT (connection)); g_signal_connect (GNOME_CANVAS_ITEM (connection->frompad)->parent, "position-changed", Index: gsteditorpad.c =================================================================== RCS file: /cvsroot/gstreamer/gst-editor/libs/gst/editor/gsteditorpad.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- gsteditorpad.c 12 Jul 2002 19:14:01 -0000 1.12 +++ gsteditorpad.c 13 Jul 2002 05:39:26 -0000 1.13 @@ -376,18 +376,20 @@ g_return_if_fail (GST_IS_EDITOR_PAD (pad)); - g_return_if_fail (pad->connection == NULL); - - pad->connection = gst_editor_connection_new (pad); + if (pad->connection) { + g_warning ("disconnection not yet implemented"); + } else { + pad->connection = gst_editor_connection_new (pad); - cursor = gdk_cursor_new (GDK_SB_RIGHT_ARROW); + cursor = gdk_cursor_new (GDK_SB_RIGHT_ARROW); - gnome_canvas_item_grab (GNOME_CANVAS_ITEM (pad), - GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, - cursor, - GDK_CURRENT_TIME); + gnome_canvas_item_grab (GNOME_CANVAS_ITEM (pad), + GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, + cursor, + GDK_CURRENT_TIME); - pad->connecting = TRUE; + pad->connecting = TRUE; + } } static void @@ -409,7 +411,7 @@ if (under && GST_IS_EDITOR_PAD (under)) destpad = GST_EDITOR_PAD (under); - if (destpad && destpad != pad) + if (destpad && destpad != pad && (!destpad->connection || destpad->connection == pad->connection)) gst_editor_connection_set_endpad (pad->connection, destpad); else gst_editor_connection_set_endpoint (pad->connection, wx, wy); |