示例#1
0
static void
part_item_class_init (PartItemClass *part_item_class)
{
	GObjectClass *object_class;
	SheetItemClass *sheet_item_class;

	object_class = G_OBJECT_CLASS (part_item_class);
	sheet_item_class = SHEET_ITEM_CLASS (part_item_class);
	parent_class = g_type_class_peek_parent (part_item_class);

	object_class->finalize = part_item_finalize;
	object_class->dispose = part_item_dispose;
	object_class->set_property = part_item_set_property;
	object_class->get_property = part_item_get_property;

	sheet_item_class->moved = part_item_moved;
	sheet_item_class->is_in_area = is_in_area;
	sheet_item_class->show_labels = show_labels;
	sheet_item_class->paste = part_item_paste;
	sheet_item_class->edit_properties = edit_properties;
	sheet_item_class->selection_changed = (gpointer) selection_changed;

	sheet_item_class->place = part_item_place;
	sheet_item_class->place_ghost = part_item_place_ghost;
}
示例#2
0
static void
wire_item_class_init (WireItemClass *wire_item_class)
{
	GObjectClass *object_class;
	GtkObjectClass *gtk_object_class;
	SheetItemClass *sheet_item_class;

	object_class = G_OBJECT_CLASS(wire_item_class);
	gtk_object_class = GTK_OBJECT_CLASS(wire_item_class);
	sheet_item_class = SHEET_ITEM_CLASS(wire_item_class);
	wire_item_parent_class = g_type_class_peek(TYPE_SHEET_ITEM);

	/*gtk_object_add_arg_type ("WireItem::name",
	 * GTK_TYPE_POINTER, GTK_ARG_READWRITE, WIRE_ITEM_ARG_NAME);*/

/*	object_class->set_arg = wire_item_set_arg;
	object_class->get_arg = wire_item_get_arg;*/
	gtk_object_class->destroy = wire_item_destroy;

	sheet_item_class->moved = wire_item_moved;
	sheet_item_class->paste = wire_item_paste;
	sheet_item_class->is_in_area = is_in_area;
	sheet_item_class->selection_changed = (gpointer) selection_changed;
	sheet_item_class->place = wire_item_place;
	sheet_item_class->place_ghost = wire_item_place_ghost;
}
示例#3
0
void
clipboard_add_object (GObject *item)
{
    ItemDataClass *id_class;
    ItemData *item_data, *clone;
    ClipboardData *cb_data;

    g_return_if_fail (item != NULL);

    item_data = sheet_item_get_data (SHEET_ITEM (item));
    g_return_if_fail (item_data != NULL);

    id_class = ITEM_DATA_CLASS (G_OBJECT_GET_CLASS (item_data));
    if (id_class->clone == NULL)
        return;

    // Duplicate the data for the object and add to the clipboard.
    clone = id_class->clone (item_data);

    cb_data = g_new0 (ClipboardData, 1);
    cb_data->item_data = clone;
    cb_data->item_class = SHEET_ITEM_CLASS (G_OBJECT_GET_CLASS (item));

    oregano.clipboard = g_slist_prepend (oregano.clipboard, cb_data);
}
示例#4
0
void sheet_item_place_ghost (SheetItem *item, Sheet *sheet)
{
	SheetItemClass *sheet_item_class;

	g_return_if_fail (item != NULL);
	g_return_if_fail (IS_SHEET_ITEM (item));

	sheet_item_class = SHEET_ITEM_CLASS (G_OBJECT_GET_CLASS (item));

	if (sheet_item_class->place_ghost)
		sheet_item_class->place_ghost (item, sheet);
}
示例#5
0
void sheet_item_edit_properties (SheetItem *item)
{
	SheetItemClass *sheet_item_class;

	g_return_if_fail (item != NULL);
	g_return_if_fail (IS_SHEET_ITEM (item));

	sheet_item_class = SHEET_ITEM_CLASS (G_OBJECT_GET_CLASS (item));

	if (sheet_item_class->edit_properties)
		sheet_item_class->edit_properties (item);
}
示例#6
0
void sheet_item_select_in_area (SheetItem *item, Coords *p1, Coords *p2)
{
	SheetItemClass *sheet_item_class;
	gboolean in_area;

	g_return_if_fail (item != NULL);
	g_return_if_fail (IS_SHEET_ITEM (item));
	g_return_if_fail (p1 != NULL);
	g_return_if_fail (p2 != NULL);

	sheet_item_class = SHEET_ITEM_CLASS (G_OBJECT_GET_CLASS (item));
	in_area = sheet_item_class->is_in_area (item, p1, p2);

	if (in_area && !item->priv->selected)
		sheet_item_select (item, TRUE);
	else if (!in_area && item->priv->selected && !item->priv->preserve_selection)
		sheet_item_select (item, FALSE);
}
示例#7
0
static void textbox_item_class_init (TextboxItemClass *textbox_item_class)
{
	GObjectClass *object_class;
	SheetItemClass *sheet_item_class;

	object_class = G_OBJECT_CLASS (textbox_item_class);
	sheet_item_class = SHEET_ITEM_CLASS (textbox_item_class);
	textbox_item_parent_class = g_type_class_peek_parent (textbox_item_class);

	object_class->finalize = textbox_item_finalize;

	sheet_item_class->moved = textbox_item_moved;
	sheet_item_class->paste = textbox_item_paste;
	sheet_item_class->is_in_area = is_in_area;
	sheet_item_class->selection_changed = (gpointer)selection_changed;
	sheet_item_class->edit_properties = edit_textbox;
	sheet_item_class->place = textbox_item_place;
	sheet_item_class->place_ghost = textbox_item_place_ghost;
}
示例#8
0
static void
wire_item_class_init (WireItemClass *wire_item_class)
{
	GObjectClass *object_class;
	SheetItemClass *sheet_item_class;

	object_class = G_OBJECT_CLASS (wire_item_class);
	sheet_item_class = SHEET_ITEM_CLASS (wire_item_class);
	wire_item_parent_class = g_type_class_peek_parent (wire_item_class);
	
	object_class->finalize = wire_item_finalize;
	object_class->set_property = wire_item_set_property;
    object_class->get_property = wire_item_get_property;

	sheet_item_class->moved = wire_item_moved;
	sheet_item_class->paste = wire_item_paste;
	sheet_item_class->is_in_area = is_in_area;
	sheet_item_class->selection_changed = (gpointer) selection_changed;
	sheet_item_class->place = wire_item_place;
	sheet_item_class->place_ghost = wire_item_place_ghost;
}
示例#9
0
void sheet_item_paste (Sheet *sheet, ClipboardData *data)
{
	SheetItemClass *item_class;
	ItemDataClass *id_class;
	ItemData *item_data, *clone;

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

	item_data = ITEM_DATA (clipboard_data_get_item_data (data));

	id_class = ITEM_DATA_CLASS (G_OBJECT_GET_CLASS (item_data));
	if (id_class->clone == NULL)
		return;

	// Duplicate the data for the item and paste the item on the sheet.
	item_class = SHEET_ITEM_CLASS (clipboard_data_get_item_class (data));
	if (item_class->paste) {
		clone = id_class->clone (item_data);
		item_class->paste (sheet, clone);
	}
}