/*! * \brief Create a deep copy of the object * \memberof Outline */ static DiaObject * outline_copy (Outline *from) { Outline *to; to = g_new0 (Outline, 1); object_copy (&from->object, &to->object); outline_init_handles (to); to->name = g_strdup (from->name); to->rotation = from->rotation; to->font = dia_font_copy (from->font); to->font_height = from->font_height; to->line_width = from->line_width; to->line_color = from->line_color; to->fill_color = from->fill_color; to->show_background = from->show_background; /* the rest will be recalculated in update_data() */ outline_update_data (to); return &to->object; }
Text * text_copy(Text *text) { Text *copy; int i; copy = g_new(Text, 1); copy->numlines = text->numlines; copy->lines = g_new(TextLine *, text->numlines); copy->font = dia_font_copy(text->font); copy->height = text->height; copy->position = text->position; copy->color = text->color; copy->alignment = text->alignment; for (i=0;i<text->numlines;i++) { TextLine *text_line = text->lines[i]; copy->lines[i] = text_line_new(text_line_get_string(text_line), text_line_get_font(text_line), text_line_get_height(text_line)); } copy->cursor_pos = 0; copy->cursor_row = 0; copy->focus.obj = NULL; copy->focus.has_focus = FALSE; copy->focus.key_event = text_key_event; copy->focus.text = copy; copy->ascent = text->ascent; copy->descent = text->descent; copy->max_width = text->max_width; return copy; }