当前位置: 首页>>代码示例>>C++>>正文


C++ GOO_CANVAS_ITEM函数代码示例

本文整理汇总了C++中GOO_CANVAS_ITEM函数的典型用法代码示例。如果您正苦于以下问题:C++ GOO_CANVAS_ITEM函数的具体用法?C++ GOO_CANVAS_ITEM怎么用?C++ GOO_CANVAS_ITEM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GOO_CANVAS_ITEM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sheet_release_selected_objects

//FIXME this looks weird
void
sheet_release_selected_objects (Sheet *sheet)
{
	GList *list, *copy;
	GooCanvasGroup *group;
	gint   item_nbr;
	
	g_return_if_fail (sheet != NULL);
	g_return_if_fail (IS_SHEET (sheet));

	group = sheet->priv->selected_group;
	copy = g_list_copy (sheet->priv->selected_objects);
	
	// Remove all the selected_objects into selected_group
	for (list = copy; list; list = list->next) {
		item_nbr = goo_canvas_item_find_child (GOO_CANVAS_ITEM (group),
		                                      GOO_CANVAS_ITEM (list->data));
		goo_canvas_item_remove_child (GOO_CANVAS_ITEM (group),
		                              item_nbr);
	}
	g_list_free (copy);
		
	g_list_free (sheet->priv->selected_objects);
	sheet->priv->selected_objects = NULL;
}
开发者ID:hriesz,项目名称:oregano-old,代码行数:26,代码来源:sheet.c

示例2: sheet_item_cancel_floating

// Cancel the placement of floating items and remove them.
void sheet_item_cancel_floating (Sheet *sheet)
{
	GooCanvasGroup *group;
	GList *list;

	g_return_if_fail (sheet != NULL);
	g_return_if_fail (IS_SHEET (sheet));

	group = GOO_CANVAS_GROUP (sheet->priv->floating_group);
	if (group == NULL)
		return;

	if (sheet->state != SHEET_STATE_FLOAT && sheet->state != SHEET_STATE_FLOAT_START)
		return;

	if (g_signal_handler_is_connected (sheet, sheet->priv->float_handler_id))
		g_signal_handler_disconnect (sheet, sheet->priv->float_handler_id);

	// TODO verfiy that the following has no nasty sideffects
	for (list = sheet->priv->floating_objects; list; list = list->next) {
		goo_canvas_item_remove (list->data); // remove from canvas and free
	}
	g_list_free (sheet->priv->floating_objects);
	sheet->priv->floating_objects = NULL;
	goo_canvas_item_remove (GOO_CANVAS_ITEM (group));

	// Create a new empty group to prepare next floating group
	sheet->priv->floating_group = GOO_CANVAS_GROUP (
	    goo_canvas_group_new (GOO_CANVAS_ITEM (sheet->object_group), "x", 0.0, "y", 0.0, NULL));

	// sheet_clear_ghosts (sheet);
	sheet->priv->float_handler_id = 0;
	sheet->state = SHEET_STATE_NONE;
}
开发者ID:LukasGibeh,项目名称:oregano,代码行数:35,代码来源:sheet-item.c

示例3: make_dynamic_link

static void
make_dynamic_link (GstEditorLink * link)
{
  GstElement *srce, *sinke;
  GstPadTemplate *src = NULL, *sink = NULL;

  if (GST_IS_EDITOR_PAD_SOMETIMES (link->srcpad))
    src = GST_PAD_TEMPLATE (link->srcpad->object);

  if (GST_IS_EDITOR_PAD_SOMETIMES (link->sinkpad))
    sink = GST_PAD_TEMPLATE (link->sinkpad->object);
  srce =
      GST_ELEMENT (GST_EDITOR_ITEM (goo_canvas_item_get_parent (GOO_CANVAS_ITEM
              (link->srcpad)))->object);
  sinke =
      GST_ELEMENT (GST_EDITOR_ITEM (goo_canvas_item_get_parent (GOO_CANVAS_ITEM
              (link->sinkpad)))->object);

  g_return_if_fail (src || sink);

  if (src)
    g_signal_connect_after (srce, "pad-added", G_CALLBACK (on_new_pad), link);
  if (sink)
    g_signal_connect_after (sinke, "pad-added", G_CALLBACK (on_new_pad), link);

  g_print ("dynamic link\n");
}
开发者ID:metratec,项目名称:gst-editor,代码行数:27,代码来源:gsteditorlink.c

示例4: gst_editor_link_resize

static void
gst_editor_link_resize (GstEditorLink * link)
{
  gdouble x1, y1, x2, y2;

  GooCanvas * canvas;

  g_object_get (link, "x1", &x1, "y1", &y1, "x2", &x2, "y2", &y2, NULL);
  canvas = goo_canvas_item_get_canvas (GOO_CANVAS_ITEM (link));
  if (!canvas) {
    g_print ("Warning: gst_editor_link_resize canvas null\n");
    return;
  }
  goo_canvas_convert_from_pixels (canvas, &x1, &y1);
  goo_canvas_convert_to_item_space (canvas, GOO_CANVAS_ITEM (link), &x1, &y1);

  // goo_canvas_item_get_parent(GOO_CANVAS_ITEM (link)),&x1, &y1);
  goo_canvas_convert_from_pixels (canvas, &x2, &y2);
  goo_canvas_convert_to_item_space (canvas, GOO_CANVAS_ITEM (link), &x2, &y2);

  // goo_canvas_item_get_parent(GOO_CANVAS_ITEM (link)), &x2, &y2);
  /* we do this in reverse so that with dot-dash lines it gives the illusion of
     pulling out a rope from the element */
  link->points->coords[2] = x1;
  link->points->coords[3] = y1;
  link->points->coords[0] = x2;
  link->points->coords[1] = y2;
  g_object_set (G_OBJECT (link), "points", link->points, NULL);
}
开发者ID:metratec,项目名称:gst-editor,代码行数:29,代码来源:gsteditorlink.c

示例5: part_item_canvas_new

PartItem *
part_item_canvas_new (Sheet *sheet, Part *part)
{
	PartItem *part_item;
	PartItemPriv *priv;
	GooCanvasItem *item;
	ItemData *item_data;

	g_return_val_if_fail (sheet != NULL, NULL);
	g_return_val_if_fail (IS_SHEET (sheet), NULL);
	g_return_val_if_fail (part != NULL, NULL);
	g_return_val_if_fail (IS_PART (part), NULL);

	item = g_object_new (TYPE_PART_ITEM, NULL);
	
	g_object_set (item, 
	              "parent", sheet->object_group, 
	              NULL);
	
	part_item = PART_ITEM (item);
	g_object_set (part_item, 
                  "data", part, 
                  NULL);
	priv = part_item->priv;
	
	priv->label_group = GOO_CANVAS_ITEM (goo_canvas_group_new (
	        GOO_CANVAS_ITEM (part_item),
	        "width", -1.0,
	        "height", -1.0,
	        NULL));
	g_object_unref (item);
	
	priv->node_group = GOO_CANVAS_ITEM (goo_canvas_group_new (
	        GOO_CANVAS_ITEM (part_item), 
	        NULL));

	g_object_set (GOO_CANVAS_ITEM (priv->node_group),
	              "visibility", GOO_CANVAS_ITEM_INVISIBLE, 
	              NULL);

	item_data = ITEM_DATA (part);
	item_data->rotated_handler_id = g_signal_connect_object (G_OBJECT (part), 
	                                "rotated",
	                                G_CALLBACK (part_rotated_callback),
	                                G_OBJECT (part_item), 0);
	item_data->flipped_handler_id = g_signal_connect_object (G_OBJECT (part), 
	                                "flipped",
	                                G_CALLBACK (part_flipped_callback),
	                                G_OBJECT (part_item), 0);
	item_data->moved_handler_id = g_signal_connect_object (G_OBJECT (part),
	                                "moved",
	                                G_CALLBACK (part_moved_callback),
	                                G_OBJECT (part_item), 0);
	item_data->changed_handler_id = g_signal_connect_object (G_OBJECT (part),
	                                "changed",
	                                G_CALLBACK (part_changed_callback),
	                                G_OBJECT (part_item), 0);

	return part_item;
}
开发者ID:rodolforg,项目名称:oregano,代码行数:60,代码来源:part-item.c

示例6: gst_editor_link_destroy

void
gst_editor_link_destroy (GstEditorLink * link)
{
  // g_print ("trying to destroy this half link");
  GstEditorBin * padbin;
  if (link->srcpad)
    padbin = GST_EDITOR_BIN (goo_canvas_item_get_parent (
        goo_canvas_item_get_parent (GOO_CANVAS_ITEM (link->srcpad))));
  else
    padbin = GST_EDITOR_BIN (goo_canvas_item_get_parent (
        goo_canvas_item_get_parent (GOO_CANVAS_ITEM (link->sinkpad))));
  padbin->links = g_list_remove (padbin->links, link);
  if (link->srcpad)
    GST_EDITOR_PAD (link->srcpad)->link = NULL;
  if (link->sinkpad)
    GST_EDITOR_PAD (link->sinkpad)->link = NULL;
  // int killnumber;
  // killnumber=goo_canvas_item_find_child(goo_canvas_item_get_parent(GOO_CANVAS_ITEM(link)),GOO_CANVAS_ITEM(link));
  // g_print ("found child at %d",killnumber);
  // ARGH, what am I doing here
  // g_realloc(link,sizeof(GooCanvasPolyline));

  // g_realloc(link,sizeof(GooCanvasPolyline));
  // goo_canvas_item_remove_child(goo_canvas_item_get_parent(GOO_CANVAS_ITEM(link)),killnumber);
  goo_canvas_item_remove (GOO_CANVAS_ITEM (link));
  if (link->points)
    goo_canvas_points_unref (link->points);
  // g_print ("ready to crash:)");
  // g_free(link);
  // g_print ("no warnings until now");
  return;
}
开发者ID:metratec,项目名称:gst-editor,代码行数:32,代码来源:gsteditorlink.c

示例7: wire_changed_callback

static void
wire_changed_callback (Wire *wire, WireItem *item)
{
	Coords start_pos, length;
	GooCanvasPoints *points;

	g_return_if_fail (wire != NULL);
	g_return_if_fail (IS_ITEM_DATA (wire));
	g_return_if_fail (item != NULL);
	g_return_if_fail (IS_WIRE_ITEM (item));


	wire_get_pos_and_length (wire, &start_pos, &length);

	Sheet *sheet = SHEET (goo_canvas_item_get_canvas (GOO_CANVAS_ITEM (item)));
	if (G_UNLIKELY(!sheet)) {
		g_warning ("Failed to determine the Sheet the item is glued to. This should never happen. Ever!");
	} else {
		item_data_snap (ITEM_DATA (wire), sheet->grid);
	}

	// Move the canvas item and invalidate the bbox cache.
	goo_canvas_item_set_simple_transform (GOO_CANVAS_ITEM (item),
	                                      start_pos.x,
	                                      start_pos.y,
	                                      1.0,
	                                      0.0);
	item->priv->cache_valid = FALSE;

	points = goo_canvas_points_new (2);
	points->coords[0] = 0;
	points->coords[1] = 0;
	points->coords[2] = length.x;
	points->coords[3] = length.y;

	// this does handle cleanup of previous points internally
	g_object_set (item->priv->line,
	              "points", points,
	              NULL);
	goo_canvas_points_unref (points);

	g_object_set (item->priv->resize1,
	              "x", -RESIZER_SIZE,
	              "y", -RESIZER_SIZE,
	              "width", 2 * RESIZER_SIZE,
	              "height", 2 * RESIZER_SIZE,
	              NULL);

	g_object_set (item->priv->resize2,
	              "x", length.x-RESIZER_SIZE,
	              "y", length.y-RESIZER_SIZE,
	              "width", 2 * RESIZER_SIZE,
	              "height", 2 * RESIZER_SIZE,
	              NULL);

	goo_canvas_item_request_update (GOO_CANVAS_ITEM (item->priv->line));
}
开发者ID:baboofei,项目名称:oregano,代码行数:57,代码来源:wire-item.c

示例8: rubberband_update

gboolean
rubberband_update (Sheet *sheet, GdkEvent *event)
{
	GList *iter;
	Coords cur, cmin, cmax;
	double dx, dy; // TODO maybe keep track of subpixel changes, make em global/part of the rubberband_info struct and reset on finish
	double width, height,
	       width_ng, height_ng;
	RubberbandInfo *rubberband_info;

	rubberband_info = sheet->priv->rubberband_info;

	g_assert (event->type == GDK_MOTION_NOTIFY);
	cur.x = event->motion.x;
	cur.y = event->motion.y;
	goo_canvas_convert_from_pixels (GOO_CANVAS (sheet), &cur.x, &cur.y);

	width  = fabs(rubberband_info->end.x - rubberband_info->start.x);
	height = fabs(rubberband_info->end.y - rubberband_info->start.y);

	width_ng  = fabs(cur.x - rubberband_info->start.x);
	height_ng = fabs(cur.y - rubberband_info->start.y);

	dx = fabs (width_ng - width);
	dy = fabs (height_ng - height);
	NG_DEBUG ("motion :: dx=%lf, dy=%lf :: x=%lf, y=%lf :: w_ng=%lf, h_ng=%lf", dx, dy, cur.x, cur.y, width_ng, height_ng);

	// TODO FIXME scroll window if needed (use http://developer.gnome.org/goocanvas/stable/GooCanvas.html#goo-canvas-scroll-to)

	if (dx > 0.1 || dy > 0.1) { //a 0.1 change in pixel coords would be the least visible, silently ignore everything else
		rubberband_info->end.x = cur.x;
		rubberband_info->end.y = cur.y;
		cmin.x = MIN(rubberband_info->start.x, rubberband_info->end.x);
		cmin.y = MIN(rubberband_info->start.y, rubberband_info->end.y);
		cmax.x = cmin.x + width_ng;
		cmax.y = cmin.y + height_ng;
#if 1
		for (iter = sheet->priv->items; iter; iter = iter->next) {
			sheet_item_select_in_area (iter->data,
			                           &cmin,
			                           &cmax);
		}
#endif

		g_object_set (GOO_CANVAS_ITEM (rubberband_info->rectangle),
		              "x", cmin.x,
		              "y", cmin.y,
		              "width", width_ng, 
		              "height", height_ng,
		              "visibility", GOO_CANVAS_ITEM_VISIBLE,
		              NULL);
		goo_canvas_item_raise (GOO_CANVAS_ITEM (rubberband_info->rectangle), NULL);
	}
	return TRUE;
}
开发者ID:baboofei,项目名称:oregano,代码行数:55,代码来源:rubberband.c

示例9: sheet_item_reparent

// Reparent a sheet object without moving it on the sheet.
void sheet_item_reparent (SheetItem *item, GooCanvasGroup *group)
{
	g_return_if_fail (item != NULL);
	g_return_if_fail (IS_SHEET_ITEM (item));
	g_return_if_fail (group != NULL);

	g_object_ref (item);
	goo_canvas_item_remove (GOO_CANVAS_ITEM (item));
	goo_canvas_item_add_child (GOO_CANVAS_ITEM (group), GOO_CANVAS_ITEM (item), -1);
	// FIXME are we leaking a ref here?
}
开发者ID:LukasGibeh,项目名称:oregano,代码行数:12,代码来源:sheet-item.c

示例10: node_item_init

static void node_item_init (NodeItem *item)
{
	item->priv = g_new0 (NodeItemPriv, 1);
	item->priv->dot_item =
	    goo_canvas_ellipse_new (GOO_CANVAS_ITEM (item), 0.0, 0.0, 2.0, 2.0, "fill-color", "black",
	                            "visibility", GOO_CANVAS_ITEM_INVISIBLE, NULL);
	item->priv->circle_item = goo_canvas_ellipse_new (
	    GOO_CANVAS_ITEM (item), 0.0, 0.0, 3.0, 3.0, "stroke-color-rgba", 0x3399FFFF, "line-width",
	    1.0, "visibility",
	    oregano_options_debug_dots () ? GOO_CANVAS_ITEM_VISIBLE : GOO_CANVAS_ITEM_INVISIBLE, NULL);
}
开发者ID:LukasGibeh,项目名称:oregano,代码行数:11,代码来源:node-item.c

示例11: goo_canvas_item_accessible_ref_child

static AtkObject*
goo_canvas_item_accessible_ref_child (AtkObject *accessible,
				      gint       child_num)
{
  GooCanvasItem *item, *child;
  AtkObject *atk_object;
  GObject *object;

  g_return_val_if_fail (GOO_IS_CANVAS_ITEM_ACCESSIBLE (accessible), NULL);

  object = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (accessible));
  if (object == NULL)
    return NULL;

  item = GOO_CANVAS_ITEM (object);

  child = goo_canvas_item_get_child (item, child_num);
  if (!child)
    return NULL;

  atk_object = atk_gobject_accessible_for_object (G_OBJECT (child));
  g_object_ref (atk_object);

  return atk_object;
}
开发者ID:AbuMussabRaja,项目名称:yarp,代码行数:25,代码来源:goocanvasatk.c

示例12: wire_changed_callback

static void
wire_changed_callback (Wire *wire, WireItem *item)
{
	SheetPos start_pos, length;
	GooCanvasPoints *points;
	
	wire_get_pos_and_length (wire, &start_pos, &length);

	points = goo_canvas_points_new (2);
	points->coords[0] = 0;
	points->coords[1] = 0;
	points->coords[2] = length.x;
	points->coords[3] = length.y;

	g_object_set (item->priv->line, 
	              "points", points, 
	              NULL);
	goo_canvas_points_unref (points);

	g_object_set (item->priv->resize1,
	              "x", -RESIZER_SIZE, 
	              "y", -RESIZER_SIZE,
	              "width", 2 * RESIZER_SIZE, 
	              "height", 2 * RESIZER_SIZE, 
	              NULL);

	g_object_set (item->priv->resize2,
	              "x", length.x-RESIZER_SIZE, 
	              "y", length.y-RESIZER_SIZE,
	              "width", 2 * RESIZER_SIZE, 
	              "height", 2 * RESIZER_SIZE, 
	              NULL);

	goo_canvas_item_request_update (GOO_CANVAS_ITEM (item->priv->line));
}
开发者ID:dionysos-sf,项目名称:oregano,代码行数:35,代码来源:wire-item.c

示例13: goo_canvas_item_accessible_get_parent

static AtkObject*
goo_canvas_item_accessible_get_parent (AtkObject *accessible)
{
  GooCanvasItem *item, *parent;
  GooCanvas *canvas;
  GObject *object;

  g_return_val_if_fail (GOO_IS_CANVAS_ITEM_ACCESSIBLE (accessible), NULL);

  if (accessible->accessible_parent)
    return accessible->accessible_parent;

  object = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (accessible));
  if (object == NULL)
    return NULL;

  item = GOO_CANVAS_ITEM (object);
  parent = goo_canvas_item_get_parent (item);

  if (parent)
    return atk_gobject_accessible_for_object (G_OBJECT (parent));

  canvas = goo_canvas_item_get_canvas (item);
  if (canvas)
    return gtk_widget_get_accessible (GTK_WIDGET (canvas));

  return NULL;
}
开发者ID:AbuMussabRaja,项目名称:yarp,代码行数:28,代码来源:goocanvasatk.c

示例14: goo_canvas_item_accessible_grab_focus

static gboolean
goo_canvas_item_accessible_grab_focus (AtkComponent    *component)
{
  GooCanvasItem *item;
  GooCanvas *canvas;
  GtkWidget *toplevel;
  GObject *object;

  g_return_val_if_fail (GOO_IS_CANVAS_ITEM_ACCESSIBLE (component), FALSE);

  object = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (component));
  if (!object)
    return FALSE;

  item = GOO_CANVAS_ITEM (object);

  canvas = goo_canvas_item_get_canvas (item);
  if (!canvas)
    return FALSE;

  goo_canvas_grab_focus (canvas, item);

  toplevel = gtk_widget_get_toplevel (GTK_WIDGET (canvas));
  if (GTK_WIDGET_TOPLEVEL (toplevel))
    gtk_window_present (GTK_WINDOW (toplevel));

  return TRUE;
}
开发者ID:AbuMussabRaja,项目名称:yarp,代码行数:28,代码来源:goocanvasatk.c

示例15: get_cached_bounds

// Retrieves the bounding box. We use a caching scheme for this
// since it's too expensive to calculate it every time we need it.
inline static void
get_cached_bounds (PartItem *item, Coords *p1, Coords *p2)
{
	PartItemPriv *priv;
	priv = item->priv;

	if (!priv->cache_valid) {
		Coords start_pos, end_pos;
		GooCanvasBounds bounds;
		
		goo_canvas_item_get_bounds (GOO_CANVAS_ITEM (item), &bounds);

		start_pos.x = bounds.x1;
		start_pos.y = bounds.y1;
		end_pos.x = bounds.x2;
		end_pos.y = bounds.y2;

		priv->bbox_start = start_pos;
		priv->bbox_end = end_pos;
		priv->cache_valid = TRUE;
	}

	memcpy (p1, &priv->bbox_start, sizeof (Coords));
	memcpy (p2, &priv->bbox_end, sizeof (Coords));
}
开发者ID:rodolforg,项目名称:oregano,代码行数:27,代码来源:part-item.c


注:本文中的GOO_CANVAS_ITEM函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。