dia r4144 - in trunk: . objects/Database objects/UML objects/custom_lines
- From: hans svn gnome org
- To: svn-commits-list gnome org
- Subject: dia r4144 - in trunk: . objects/Database objects/UML objects/custom_lines
- Date: Fri, 21 Nov 2008 21:23:23 +0000 (UTC)
Author: hans
Date: Fri Nov 21 21:23:23 2008
New Revision: 4144
URL: http://svn.gnome.org/viewvc/dia?rev=4144&view=rev
Log:
2008-11-21 Hans Breuer <hans breuer org>
* objects/custom_lines/custom_linetypes.c objects/Database/compound.c
objects/Database/reference.c objects/Database/table.c
objects/UML/actor.c objects/UML/class.c objects/UML/large_package.c
objects/UML/note.c objects/UML/object.c objects/UML/small_package.c
objects/UML/usecase.c : consitent use PROP_STDNAME_LINE_WIDTH instead
of "line_width", patch from Sameer Sahasrabuddhe
Modified:
trunk/ChangeLog
trunk/objects/Database/compound.c
trunk/objects/Database/reference.c
trunk/objects/Database/table.c
trunk/objects/UML/actor.c
trunk/objects/UML/class.c
trunk/objects/UML/large_package.c
trunk/objects/UML/note.c
trunk/objects/UML/object.c
trunk/objects/UML/small_package.c
trunk/objects/UML/usecase.c
trunk/objects/custom_lines/custom_linetypes.c
Modified: trunk/objects/Database/compound.c
==============================================================================
--- trunk/objects/Database/compound.c (original)
+++ trunk/objects/Database/compound.c Fri Nov 21 21:23:23 2008
@@ -202,7 +202,7 @@
static PropOffset compound_offsets[] =
{
{ "line_colour", PROP_TYPE_COLOUR, offsetof(Compound, line_color) },
- { "line_width", PROP_TYPE_REAL, offsetof(Compound, line_width) },
+ { PROP_STDNAME_LINE_WIDTH, PROP_STDTYPE_LINE_WIDTH, offsetof(Compound, line_width) },
{ "num_arms", PROP_TYPE_INT, offsetof(Compound, num_arms) },
{ NULL, 0, 0 }
@@ -476,7 +476,7 @@
}
/* load remainding properties */
- attr = object_find_attribute (obj_node, "line_width");
+ attr = object_find_attribute (obj_node, PROP_STDTYPE_LINE_WIDTH);
if (attr == NULL)
comp->line_width = 0.1;
else
@@ -510,7 +510,7 @@
data_add_point (attr, &h->pos);
}
- attr = new_attribute (obj_node, "line_width");
+ attr = new_attribute (obj_node, PROP_STDNAME_LINE_WIDTH);
data_add_real (attr, comp->line_width);
attr = new_attribute (obj_node, "line_color");
data_add_color (attr, &comp->line_color);
Modified: trunk/objects/Database/reference.c
==============================================================================
--- trunk/objects/Database/reference.c (original)
+++ trunk/objects/Database/reference.c Fri Nov 21 21:23:23 2008
@@ -127,7 +127,7 @@
ORTHCONN_COMMON_PROPERTIES_OFFSETS,
{ "text_colour", PROP_TYPE_COLOUR, offsetof(TableReference, text_color) },
{ "line_colour", PROP_TYPE_COLOUR, offsetof(TableReference, line_color) },
- { "line_width", PROP_TYPE_REAL, offsetof(TableReference, line_width) },
+ { PROP_STDNAME_LINE_WIDTH, PROP_STDTYPE_LINE_WIDTH, offsetof(TableReference, line_width) },
{ "line_style", PROP_TYPE_LINESTYLE, offsetof(TableReference, line_style),
offsetof(TableReference, dashlength) },
{ "end_arrow", PROP_TYPE_ARROW, offsetof(TableReference, end_arrow) },
Modified: trunk/objects/Database/table.c
==============================================================================
--- trunk/objects/Database/table.c (original)
+++ trunk/objects/Database/table.c Fri Nov 21 21:23:23 2008
@@ -217,7 +217,7 @@
{ "text_colour", PROP_TYPE_COLOUR, offsetof(Table, text_color) },
{ "line_colour", PROP_TYPE_COLOUR, offsetof(Table, line_color) },
{ "fill_colour", PROP_TYPE_COLOUR, offsetof(Table, fill_color) },
- { "line_width", PROP_TYPE_REAL, offsetof(Table, border_width) },
+ { PROP_STDNAME_LINE_WIDTH, PROP_STDTYPE_LINE_WIDTH, offsetof(Table, border_width) },
{ "name", PROP_TYPE_STRING, offsetof(Table, name) },
{ "comment", PROP_TYPE_STRING, offsetof(Table, comment) },
{ "visible_comment", PROP_TYPE_BOOL, offsetof(Table, visible_comment) },
@@ -429,7 +429,7 @@
table->text_color = attributes_get_foreground ();
if (object_find_attribute (obj_node, "fill_colour") == NULL)
table->fill_color = attributes_get_background ();
- if (object_find_attribute (obj_node, "line_width") == NULL)
+ if (object_find_attribute (obj_node, PROP_STDNAME_LINE_WIDTH) == NULL)
table->border_width = attributes_get_default_linewidth ();
if (object_find_attribute (obj_node, "underline_primary_key") == NULL)
table->underline_primary_key = TRUE;
Modified: trunk/objects/UML/actor.c
==============================================================================
--- trunk/objects/UML/actor.c (original)
+++ trunk/objects/UML/actor.c Fri Nov 21 21:23:23 2008
@@ -399,7 +399,7 @@
/* For compatibility with previous dia files. If no line_width, use
* ACTOR_LINEWIDTH, that was the previous line width.
*/
- attr = object_find_attribute(obj_node, "line_width");
+ attr = object_find_attribute(obj_node, PROP_STDNAME_LINE_WIDTH);
if (attr == NULL)
((Actor*)obj)->line_width = ACTOR_LINEWIDTH;
Modified: trunk/objects/UML/class.c
==============================================================================
--- trunk/objects/UML/class.c (original)
+++ trunk/objects/UML/class.c Fri Nov 21 21:23:23 2008
@@ -2092,7 +2092,7 @@
umlclass->comment_line_length);
data_add_boolean(new_attribute(obj_node, "comment_tagging"),
umlclass->comment_tagging);
- data_add_real(new_attribute(obj_node, "line_width"),
+ data_add_real(new_attribute(obj_node, PROP_STDNAME_LINE_WIDTH),
umlclass->line_width);
data_add_color(new_attribute(obj_node, "line_color"),
¨class->line_color);
@@ -2229,7 +2229,7 @@
/* Loads the line width */
umlclass->line_width = UMLCLASS_BORDER;
- attr_node = object_find_attribute(obj_node, "line_width");
+ attr_node = object_find_attribute(obj_node, PROP_STDNAME_LINE_WIDTH);
if(attr_node != NULL)
umlclass->line_width = data_real(attribute_first_data(attr_node));
Modified: trunk/objects/UML/large_package.c
==============================================================================
--- trunk/objects/UML/large_package.c (original)
+++ trunk/objects/UML/large_package.c Fri Nov 21 21:23:23 2008
@@ -402,7 +402,7 @@
/* For compatibility with previous dia files. If no line_width, use
* LARGEPACKAGE_BORDERWIDTH, that was the previous line width.
*/
- attr = object_find_attribute(obj_node, "line_width");
+ attr = object_find_attribute(obj_node, PROP_STDNAME_LINE_WIDTH);
if (attr == NULL)
((LargePackage*)obj)->line_width = LARGEPACKAGE_BORDERWIDTH;
Modified: trunk/objects/UML/note.c
==============================================================================
--- trunk/objects/UML/note.c (original)
+++ trunk/objects/UML/note.c Fri Nov 21 21:23:23 2008
@@ -359,7 +359,7 @@
/* For compatibility with previous dia files. If no line_width, use
* NOTE_BORDERWIDTH, that was the previous line width.
*/
- attr = object_find_attribute(obj_node, "line_width");
+ attr = object_find_attribute(obj_node, PROP_STDNAME_LINE_WIDTH);
if (attr == NULL)
((Note*)obj)->line_width = NOTE_BORDERWIDTH;
Modified: trunk/objects/UML/object.c
==============================================================================
--- trunk/objects/UML/object.c (original)
+++ trunk/objects/UML/object.c Fri Nov 21 21:23:23 2008
@@ -520,7 +520,7 @@
/* For compatibility with previous dia files. If no line_width, use
* OBJET_BORDERWIDTH, that was the previous line width.
*/
- attr = object_find_attribute(obj_node, "line_width");
+ attr = object_find_attribute(obj_node, PROP_STDNAME_LINE_WIDTH);
if (attr == NULL)
((Objet*)obj)->line_width = OBJET_BORDERWIDTH;
Modified: trunk/objects/UML/small_package.c
==============================================================================
--- trunk/objects/UML/small_package.c (original)
+++ trunk/objects/UML/small_package.c Fri Nov 21 21:23:23 2008
@@ -409,7 +409,7 @@
/* For compatibility with previous dia files. If no line_width, use
* SMALLPACKAGE_BORDERWIDTH, that was the previous line width.
*/
- attr = object_find_attribute(obj_node, "line_width");
+ attr = object_find_attribute(obj_node, PROP_STDNAME_LINE_WIDTH);
if (attr == NULL)
((SmallPackage*)obj)->line_width = SMALLPACKAGE_BORDERWIDTH;
Modified: trunk/objects/UML/usecase.c
==============================================================================
--- trunk/objects/UML/usecase.c (original)
+++ trunk/objects/UML/usecase.c Fri Nov 21 21:23:23 2008
@@ -471,7 +471,7 @@
/* For compatibility with previous dia files. If no line_width, use
* USECASE_LINEWIDTH, that was the previous line width.
*/
- attr = object_find_attribute(obj_node, "line_width");
+ attr = object_find_attribute(obj_node, PROP_STDNAME_LINE_WIDTH);
if (attr == NULL)
((Usecase*)obj)->line_width = USECASE_LINEWIDTH;
Modified: trunk/objects/custom_lines/custom_linetypes.c
==============================================================================
--- trunk/objects/custom_lines/custom_linetypes.c (original)
+++ trunk/objects/custom_lines/custom_linetypes.c Fri Nov 21 21:23:23 2008
@@ -1,89 +1,89 @@
-/* Dia -- an diagram creation/manipulation program
- * Copyright (C) 1998, 1999 Alexander Larsson
- *
- * Custom Lines -- line shapes defined in XML rather than C.
- * Based on the original Custom Objects plugin.
+/* Dia -- an diagram creation/manipulation program
+ * Copyright (C) 1998, 1999 Alexander Larsson
+ *
+ * Custom Lines -- line shapes defined in XML rather than C.
+ * Based on the original Custom Objects plugin.
* Copyright (C) 1999 James Henstridge.
- *
- * Adapted for Custom Lines plugin by Marcel Toele.
+ *
+ * Adapted for Custom Lines plugin by Marcel Toele.
* Modifications (C) 2007 Kern Automatiseringsdiensten BV.
*
- * Rewrite to use only public API (C) 2008 Hans Breuer
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <assert.h>
-#include <gmodule.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include "object.h"
-
-#include "line_info.h"
-#include "custom_linetypes.h"
-
-#include "properties.h"
-#include "propinternals.h"
-
-#include "pixmaps/default.xpm"
-
-static void customline_apply_properties( DiaObject* line, LineInfo* info );
-static DiaObject* customline_create(Point *startpoint,
- void *user_data,
- Handle **handle1,
- Handle **handle2);
-static DiaObject *custom_zigzagline_load (ObjectNode obj_node, int version, const char *filename);
-static DiaObject *custom_polyline_load (ObjectNode obj_node, int version, const char *filename);
-static DiaObject *custom_bezierline_load (ObjectNode obj_node, int version, const char *filename);
-
-static void customline_save (DiaObject *object, ObjectNode obj_node, const char *filename);
-
-static ObjectTypeOps
-custom_zigzagline_type_ops = {
- (CreateFunc)customline_create, /* create */
- (LoadFunc) custom_zigzagline_load, /* load */
- (SaveFunc) customline_save, /* save */
- (GetDefaultsFunc) NULL /* get_defaults*/,
- (ApplyDefaultsFunc) NULL /* apply_defaults*/
-};
-
-static ObjectTypeOps
-custom_polyline_type_ops = {
- (CreateFunc)customline_create, /* create */
- (LoadFunc) custom_polyline_load, /* load */
- (SaveFunc) customline_save, /* save */
- (GetDefaultsFunc) NULL /* get_defaults*/,
- (ApplyDefaultsFunc) NULL /* apply_defaults*/
-};
-
-static ObjectTypeOps
-custom_bezierline_type_ops = {
- (CreateFunc)customline_create, /* create */
- (LoadFunc) custom_bezierline_load, /* load */
- (SaveFunc) customline_save, /* save */
- (GetDefaultsFunc) NULL /* get_defaults*/,
- (ApplyDefaultsFunc) NULL /* apply_defaults*/
-};
-
-/* our delegates types, intialized on demand */
-static DiaObjectType *polyline_ot = NULL;
-static DiaObjectType *bezier_ot = NULL;
-static DiaObjectType *zigzag_ot = NULL;
+ * Rewrite to use only public API (C) 2008 Hans Breuer
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <assert.h>
+#include <gmodule.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include "object.h"
+
+#include "line_info.h"
+#include "custom_linetypes.h"
+
+#include "properties.h"
+#include "propinternals.h"
+
+#include "pixmaps/default.xpm"
+
+static void customline_apply_properties( DiaObject* line, LineInfo* info );
+static DiaObject* customline_create(Point *startpoint,
+ void *user_data,
+ Handle **handle1,
+ Handle **handle2);
+static DiaObject *custom_zigzagline_load (ObjectNode obj_node, int version, const char *filename);
+static DiaObject *custom_polyline_load (ObjectNode obj_node, int version, const char *filename);
+static DiaObject *custom_bezierline_load (ObjectNode obj_node, int version, const char *filename);
+
+static void customline_save (DiaObject *object, ObjectNode obj_node, const char *filename);
+
+static ObjectTypeOps
+custom_zigzagline_type_ops = {
+ (CreateFunc)customline_create, /* create */
+ (LoadFunc) custom_zigzagline_load, /* load */
+ (SaveFunc) customline_save, /* save */
+ (GetDefaultsFunc) NULL /* get_defaults*/,
+ (ApplyDefaultsFunc) NULL /* apply_defaults*/
+};
+
+static ObjectTypeOps
+custom_polyline_type_ops = {
+ (CreateFunc)customline_create, /* create */
+ (LoadFunc) custom_polyline_load, /* load */
+ (SaveFunc) customline_save, /* save */
+ (GetDefaultsFunc) NULL /* get_defaults*/,
+ (ApplyDefaultsFunc) NULL /* apply_defaults*/
+};
+
+static ObjectTypeOps
+custom_bezierline_type_ops = {
+ (CreateFunc)customline_create, /* create */
+ (LoadFunc) custom_bezierline_load, /* load */
+ (SaveFunc) customline_save, /* save */
+ (GetDefaultsFunc) NULL /* get_defaults*/,
+ (ApplyDefaultsFunc) NULL /* apply_defaults*/
+};
+
+/* our delegates types, intialized on demand */
+static DiaObjectType *polyline_ot = NULL;
+static DiaObjectType *bezier_ot = NULL;
+static DiaObjectType *zigzag_ot = NULL;
static gboolean
@@ -98,45 +98,45 @@
return (polyline_ot && bezier_ot && zigzag_ot);
}
-
-static DiaObject *
-custom_zigzagline_load (ObjectNode obj_node, int version, const char *filename)
+
+static DiaObject *
+custom_zigzagline_load (ObjectNode obj_node, int version, const char *filename)
+{
+ ensure_standard_types ();
+
+ if (!zigzag_ot) {
+ g_warning ("Can't delegate to 'Standard - ZigZagLine'");
+ return NULL;
+ }
+ return zigzag_ot->ops->load (obj_node, version, filename);
+}
+static DiaObject *
+custom_polyline_load (ObjectNode obj_node, int version, const char *filename)
{
- ensure_standard_types ();
-
- if (!zigzag_ot) {
- g_warning ("Can't delegate to 'Standard - ZigZagLine'");
- return NULL;
- }
- return zigzag_ot->ops->load (obj_node, version, filename);
-}
-static DiaObject *
-custom_polyline_load (ObjectNode obj_node, int version, const char *filename)
-{
ensure_standard_types ();
-
- if (!polyline_ot) {
- g_warning ("Can't delegate to 'Standard - PolyLine'");
- return NULL;
- }
- return polyline_ot->ops->load (obj_node, version, filename);
-}
-static DiaObject *
-custom_bezierline_load (ObjectNode obj_node, int version, const char *filename)
-{
+
+ if (!polyline_ot) {
+ g_warning ("Can't delegate to 'Standard - PolyLine'");
+ return NULL;
+ }
+ return polyline_ot->ops->load (obj_node, version, filename);
+}
+static DiaObject *
+custom_bezierline_load (ObjectNode obj_node, int version, const char *filename)
+{
ensure_standard_types ();
-
- if (!bezier_ot) {
- g_warning ("Can't delegate to 'Standard - BezierLine'");
- return NULL;
- }
- return bezier_ot->ops->load (obj_node, version, filename);
-}
-
-static void
-customline_save (DiaObject *object, ObjectNode obj_node, const char *filename)
-{
- g_assert (object->type && object->type->ops && object->type->ops->save);
+
+ if (!bezier_ot) {
+ g_warning ("Can't delegate to 'Standard - BezierLine'");
+ return NULL;
+ }
+ return bezier_ot->ops->load (obj_node, version, filename);
+}
+
+static void
+customline_save (DiaObject *object, ObjectNode obj_node, const char *filename)
+{
+ g_assert (object->type && object->type->ops && object->type->ops->save);
if (!ensure_standard_types()) {
g_warning ("Can't create standard types");
@@ -150,124 +150,124 @@
else if (object->type->ops == &custom_bezierline_type_ops)
bezier_ot->ops->save (object, obj_node, filename);
else
- g_warning ("customline_save() no delegate");
-}
-
-/* the order here must match the one in customline_apply_properties */
-static PropDescription
-_customline_prop_descs[] = {
- { "line_colour", PROP_TYPE_COLOUR },
- { "line_style", PROP_TYPE_LINESTYLE },
- { "line_width", PROP_TYPE_REAL },
- { "corner_radius", PROP_TYPE_REAL },
- { "start_arrow", PROP_TYPE_ARROW },
- { "end_arrow", PROP_TYPE_ARROW },
- PROP_DESC_END
-};
-
-void
-customline_apply_properties( DiaObject* line, LineInfo* info )
-{
- GPtrArray *props;
- LinestyleProperty *lsprop;
- ColorProperty *cprop;
- RealProperty *rprop;
- ArrowProperty *aprop;
-
- props = prop_list_from_descs( _customline_prop_descs, pdtpp_true );
- g_assert( props->len == 6 );
-
- /* order/index/type must match _customline_prop_descs */
- cprop = g_ptr_array_index( props, 0 );
- cprop->color_data = info->line_color;
-
- lsprop = g_ptr_array_index( props, 1 );
- lsprop->style = info->line_style;
- lsprop->dash = info->dashlength;
-
- rprop = g_ptr_array_index( props, 2 );
- rprop->real_data = info->line_width;
-
- rprop = g_ptr_array_index( props, 3 );
- rprop->real_data = info->corner_radius;
-
- aprop = g_ptr_array_index( props, 4 );
- aprop->arrow_data = info->start_arrow;
-
- aprop = g_ptr_array_index( props, 5 );
- aprop->arrow_data = info->end_arrow;
-
- line->ops->set_props( line, props );
-
- prop_list_free(props);
-}
-
-DiaObject *
-customline_create(Point *startpoint,
- void *user_data,
- Handle **handle1,
- Handle **handle2)
-{
- DiaObject* res = NULL;
- LineInfo* line_info = (LineInfo*)user_data;
-
+ g_warning ("customline_save() no delegate");
+}
+
+/* the order here must match the one in customline_apply_properties */
+static PropDescription
+_customline_prop_descs[] = {
+ { "line_colour", PROP_TYPE_COLOUR },
+ { "line_style", PROP_TYPE_LINESTYLE },
+ { PROP_STDNAME_LINE_WIDTH, PROP_STDTYPE_LINE_WIDTH },
+ { "corner_radius", PROP_TYPE_REAL },
+ { "start_arrow", PROP_TYPE_ARROW },
+ { "end_arrow", PROP_TYPE_ARROW },
+ PROP_DESC_END
+};
+
+void
+customline_apply_properties( DiaObject* line, LineInfo* info )
+{
+ GPtrArray *props;
+ LinestyleProperty *lsprop;
+ ColorProperty *cprop;
+ RealProperty *rprop;
+ ArrowProperty *aprop;
+
+ props = prop_list_from_descs( _customline_prop_descs, pdtpp_true );
+ g_assert( props->len == 6 );
+
+ /* order/index/type must match _customline_prop_descs */
+ cprop = g_ptr_array_index( props, 0 );
+ cprop->color_data = info->line_color;
+
+ lsprop = g_ptr_array_index( props, 1 );
+ lsprop->style = info->line_style;
+ lsprop->dash = info->dashlength;
+
+ rprop = g_ptr_array_index( props, 2 );
+ rprop->real_data = info->line_width;
+
+ rprop = g_ptr_array_index( props, 3 );
+ rprop->real_data = info->corner_radius;
+
+ aprop = g_ptr_array_index( props, 4 );
+ aprop->arrow_data = info->start_arrow;
+
+ aprop = g_ptr_array_index( props, 5 );
+ aprop->arrow_data = info->end_arrow;
+
+ line->ops->set_props( line, props );
+
+ prop_list_free(props);
+}
+
+DiaObject *
+customline_create(Point *startpoint,
+ void *user_data,
+ Handle **handle1,
+ Handle **handle2)
+{
+ DiaObject* res = NULL;
+ LineInfo* line_info = (LineInfo*)user_data;
+
if (!ensure_standard_types()) {
g_warning ("Can't create standar types.");
return NULL;
}
-
- if (line_info->type == CUSTOM_LINETYPE_ZIGZAGLINE)
- res = zigzag_ot->ops->create( startpoint, user_data, handle1, handle2 );
- else if (line_info->type == CUSTOM_LINETYPE_POLYLINE)
- res = polyline_ot->ops->create( startpoint, NULL, handle1, handle2 );
- else if (line_info->type == CUSTOM_LINETYPE_BEZIERLINE)
- res = bezier_ot->ops->create( startpoint, NULL, handle1, handle2 );
- else
- g_warning(_("INTERNAL: CustomLines: Illegal line type in LineInfo object."));
-
- if (res) {
- customline_apply_properties (res, line_info);
- res->type = line_info->object_type;
- }
-
- return( res );
-}
-
-void
-custom_linetype_new(LineInfo *info, DiaObjectType **otype)
-{
- DiaObjectType *obj = g_new0(DiaObjectType, 1);
-
- obj->version = 1;
- obj->pixmap = default_xpm;
-
- if (info->type == CUSTOM_LINETYPE_ZIGZAGLINE)
- obj->ops = &custom_zigzagline_type_ops;
- else if (info->type == CUSTOM_LINETYPE_POLYLINE)
- obj->ops = &custom_polyline_type_ops;
- else if (info->type == CUSTOM_LINETYPE_BEZIERLINE)
- obj->ops = &custom_bezierline_type_ops;
- else
- g_warning(_("INTERNAL: CustomLines: Illegal line type in LineInfo object %s."),
- obj->name);
-
- obj->name = info->name;
- obj->default_user_data = info;
-
- if (info->icon_filename) {
- struct stat buf;
- if (0==stat(info->icon_filename,&buf)) {
- obj->pixmap = NULL;
- obj->pixmap_file = info->icon_filename;
- } else {
- g_warning(_("Cannot open icon file %s for object type '%s'."),
- info->icon_filename, obj->name);
- }
- }
-
- info->object_type = obj; /* <-- Reciproce type linking */
-
- obj->default_user_data = (void*)info;
-
- *otype = obj;
-}
+
+ if (line_info->type == CUSTOM_LINETYPE_ZIGZAGLINE)
+ res = zigzag_ot->ops->create( startpoint, user_data, handle1, handle2 );
+ else if (line_info->type == CUSTOM_LINETYPE_POLYLINE)
+ res = polyline_ot->ops->create( startpoint, NULL, handle1, handle2 );
+ else if (line_info->type == CUSTOM_LINETYPE_BEZIERLINE)
+ res = bezier_ot->ops->create( startpoint, NULL, handle1, handle2 );
+ else
+ g_warning(_("INTERNAL: CustomLines: Illegal line type in LineInfo object."));
+
+ if (res) {
+ customline_apply_properties (res, line_info);
+ res->type = line_info->object_type;
+ }
+
+ return( res );
+}
+
+void
+custom_linetype_new(LineInfo *info, DiaObjectType **otype)
+{
+ DiaObjectType *obj = g_new0(DiaObjectType, 1);
+
+ obj->version = 1;
+ obj->pixmap = default_xpm;
+
+ if (info->type == CUSTOM_LINETYPE_ZIGZAGLINE)
+ obj->ops = &custom_zigzagline_type_ops;
+ else if (info->type == CUSTOM_LINETYPE_POLYLINE)
+ obj->ops = &custom_polyline_type_ops;
+ else if (info->type == CUSTOM_LINETYPE_BEZIERLINE)
+ obj->ops = &custom_bezierline_type_ops;
+ else
+ g_warning(_("INTERNAL: CustomLines: Illegal line type in LineInfo object %s."),
+ obj->name);
+
+ obj->name = info->name;
+ obj->default_user_data = info;
+
+ if (info->icon_filename) {
+ struct stat buf;
+ if (0==stat(info->icon_filename,&buf)) {
+ obj->pixmap = NULL;
+ obj->pixmap_file = info->icon_filename;
+ } else {
+ g_warning(_("Cannot open icon file %s for object type '%s'."),
+ info->icon_filename, obj->name);
+ }
+ }
+
+ info->object_type = obj; /* <-- Reciproce type linking */
+
+ obj->default_user_data = (void*)info;
+
+ *otype = obj;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]