dia r3878 - in trunk: . objects objects/custom_lines objects/custom_lines/pixmaps objects/standard
- From: lclausen svn gnome org
- To: svn-commits-list gnome org
- Subject: dia r3878 - in trunk: . objects objects/custom_lines objects/custom_lines/pixmaps objects/standard
- Date: Thu, 17 Jan 2008 19:29:03 +0000 (GMT)
Author: lclausen
Date: Thu Jan 17 19:29:02 2008
New Revision: 3878
URL: http://svn.gnome.org/viewvc/dia?rev=3878&view=rev
Log:
Patch from marcel Toele: Custom lines.
Added:
trunk/objects/custom_lines/
trunk/objects/custom_lines/Makefile.am
trunk/objects/custom_lines/custom_lines.c
trunk/objects/custom_lines/custom_linetypes.c
trunk/objects/custom_lines/custom_linetypes.h
trunk/objects/custom_lines/line_info.c
trunk/objects/custom_lines/line_info.h
trunk/objects/custom_lines/pixmaps/
trunk/objects/custom_lines/pixmaps/default.xpm
trunk/objects/standard/bezier.h
trunk/objects/standard/polyline.h
trunk/objects/standard/zigzagline.h
Modified:
trunk/ChangeLog
trunk/configure.in
trunk/objects/Makefile.am
trunk/objects/standard/bezier.c
trunk/objects/standard/polyline.c
trunk/objects/standard/zigzagline.c
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Thu Jan 17 19:29:02 2008
@@ -497,6 +497,7 @@
objects/bondgraph/Makefile
objects/chronogram/Makefile
objects/custom/Makefile
+objects/custom_lines/Makefile
objects/ER/Makefile
objects/flowchart/Makefile
objects/FS/Makefile
Modified: trunk/objects/Makefile.am
==============================================================================
--- trunk/objects/Makefile.am (original)
+++ trunk/objects/Makefile.am Thu Jan 17 19:29:02 2008
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
-SUBDIRS = standard network UML ER FS flowchart custom GRAFCET \
+SUBDIRS = standard network UML ER FS flowchart custom custom_lines GRAFCET \
chronogram SADT Misc bondgraph Istar Jackson KAOS AADL SISSI Database #EML
## I have disabled building the EML files, for GPL compliance reasons. Ask me
Added: trunk/objects/custom_lines/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/objects/custom_lines/Makefile.am Thu Jan 17 19:29:02 2008
@@ -0,0 +1,15 @@
+## Process this file with automake to produce Makefile.in
+
+pkglib_LTLIBRARIES = libcustom_lines_objects.la
+libcustom_lines_objects_la_SOURCES = \
+ custom_lines.c \
+ custom_linetypes.c \
+ line_info.c
+
+libcustom_lines_objects_la_LDFLAGS = -export-dynamic -module -avoid-version
+libcustom_lines_objects_la_LIBADD = ../standard/libstandard_objects.la
+
+INCLUDES = -I$(top_srcdir)/intl -I$(srcdir)/../../lib $(GTK_CFLAGS) $(GNOME_CFLAGS) $(PANGOFT2_CFLAGS) $(UNICODE_CFLAGS)
+
+EXTRA_DIST = \
+ pixmaps/default.xpm
Added: trunk/objects/custom_lines/custom_lines.c
==============================================================================
--- (empty file)
+++ trunk/objects/custom_lines/custom_lines.c Thu Jan 17 19:29:02 2008
@@ -0,0 +1,189 @@
+/* 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.
+ * Modifications (C) 2007 Kern Automatiseringsdiensten BV.
+ *
+ * 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 <config.h>
+
+#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <glib.h>
+
+#include "sheet.h"
+#include "line_info.h"
+#include "dia_dirs.h"
+#include "intl.h"
+#include "plug-ins.h"
+
+#include "custom_linetypes.h"
+
+char* custom_lines_string_plus( char* lhs, char* mid, char* rhs );
+
+G_MODULE_EXPORT gboolean custom_linefile_load(gchar *filename, LineInfo **info);
+
+/* Cannot be static, because we may use this fn later when loading
+ a new shape via the sheets dialog */
+
+G_MODULE_EXPORT gboolean custom_linefile_load(gchar *filename, LineInfo **info)
+{
+ if (!filename)
+ return FALSE;
+
+ *info = line_info_load(filename);
+
+ /*g_assert(info);*/
+ if (!(*info)) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+char* custom_lines_string_plus( char* lhs, char* mid, char* rhs )
+{
+ char* res = g_new0(char, strlen(lhs) + strlen(rhs) + strlen( mid ) + 1);
+
+ sprintf( res, "%s%s%s", lhs, mid, rhs );
+
+ return( res );
+}
+
+void custom_linetype_create_and_register( LineInfo* info )
+{
+ DiaObjectType* otype = NULL;
+
+ if (info->type == CUSTOM_LINETYPE_ALL ) {
+ int i = 0;
+ for( i = 0; i < CUSTOM_LINETYPE_ALL; i++ )
+ {
+ LineInfo* cloned_info = line_info_clone( info );
+ cloned_info->type = i;
+ cloned_info->name = custom_lines_string_plus( info->name, " - ", custom_linetype_strings[i] );
+
+ if (cloned_info->icon_filename) {
+ /* split at the file extension */
+ char** chunks = g_strsplit( info->icon_filename, ".png", 0 );
+ char buf[20];
+
+ sprintf( buf, "_%s", custom_linetype_strings[i] );
+ cloned_info->icon_filename =
+ custom_lines_string_plus( chunks[0], buf, ".png" );
+ }
+
+ custom_linetype_new(cloned_info, &otype);
+ g_assert(otype);
+ g_assert(otype->default_user_data);
+ object_register_type(otype);
+ }
+ } else {
+ custom_linetype_new(info, &otype);
+ g_assert(otype);
+ g_assert(otype->default_user_data);
+ object_register_type(otype);
+ }
+}
+
+static void load_linefiles_from_tree(const gchar *directory)
+{
+ GDir *dp;
+ const char *dentry;
+
+ dp = g_dir_open(directory, 0, NULL);
+ if (dp == NULL) {
+ return;
+ }
+ while ( (dentry = g_dir_read_name(dp)) ) {
+ gchar *filename = g_strconcat(directory, G_DIR_SEPARATOR_S,
+ dentry, NULL);
+ const gchar *p;
+
+ if (g_file_test(filename, G_FILE_TEST_IS_DIR)) {
+ load_linefiles_from_tree(filename);
+ g_free(filename);
+ continue;
+ }
+ /* if it's not a directory, then it must be a .line file */
+ if ( !g_file_test(filename, G_FILE_TEST_IS_REGULAR)
+ || (strlen(dentry) < strlen( ".line" ))) {
+ g_free(filename);
+ continue;
+ }
+
+ p = dentry + strlen(dentry) - strlen( ".line" );
+ if (0==strcmp(".line",p)) {
+ LineInfo *info;
+
+ if (!custom_linefile_load(filename, &info)) {
+ g_warning("could not load line file %s",filename);
+ } else {
+ custom_linetype_create_and_register( info );
+ }
+ }
+ g_free(filename);
+ }
+ g_dir_close(dp);
+}
+
+DIA_PLUGIN_CHECK_INIT
+
+PluginInitResult
+dia_plugin_init(PluginInfo *info)
+{
+ char *line_path;
+ const char *home_dir;
+
+
+ if (!dia_plugin_info_init(info, _("CustomLines"), _("Custom XML lines loader"),
+ NULL, NULL))
+ return DIA_PLUGIN_INIT_ERROR;
+
+ custom_linetypes_init();
+
+ home_dir = g_get_home_dir();
+ if (home_dir) {
+ home_dir = dia_config_filename("lines");
+ load_linefiles_from_tree(home_dir);
+ g_free((char *)home_dir);
+ }
+
+ line_path = getenv("DIA_LINE_PATH");
+ if (line_path) {
+ char **dirs = g_strsplit(line_path, G_SEARCHPATH_SEPARATOR_S, 0);
+ int i;
+
+ for (i = 0; dirs[i] != NULL; i++)
+ load_linefiles_from_tree(dirs[i]);
+ g_strfreev(dirs);
+ } else {
+ char *thedir = dia_get_data_directory("lines");
+ load_linefiles_from_tree(thedir);
+ g_free(thedir);
+ }
+
+ return DIA_PLUGIN_INIT_OK;
+}
+
Added: trunk/objects/custom_lines/custom_linetypes.c
==============================================================================
--- (empty file)
+++ trunk/objects/custom_lines/custom_linetypes.c Thu Jan 17 19:29:02 2008
@@ -0,0 +1,165 @@
+/* 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.
+ * Modifications (C) 2007 Kern Automatiseringsdiensten BV.
+ *
+ * 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 "../standard/polyline.h"
+#include "../standard/zigzagline.h"
+#include "../standard/bezier.h"
+
+#include "line_info.h"
+#include "custom_linetypes.h"
+
+#include "pixmaps/default.xpm"
+
+ObjectTypeOps custom_zigzagline_type_ops;
+ObjectTypeOps custom_polyline_type_ops;
+ObjectTypeOps custom_bezierline_type_ops;
+
+
+void custom_linetype_new(LineInfo *info, DiaObjectType **otype);
+void zigzagline_apply_properties( Zigzagline* line, LineInfo* info );
+DiaObject* customline_create(Point *startpoint,
+ void *user_data,
+ Handle **handle1,
+ Handle **handle2);
+
+void custom_linetypes_init()
+{
+ custom_zigzagline_type_ops = zigzagline_type_ops;
+ custom_zigzagline_type_ops.create = customline_create;
+ custom_zigzagline_type_ops.get_defaults = NULL;
+ custom_zigzagline_type_ops.apply_defaults = NULL;
+
+ custom_polyline_type_ops = polyline_type_ops;
+ custom_polyline_type_ops.create = customline_create;
+ custom_polyline_type_ops.get_defaults = NULL;
+ custom_polyline_type_ops.apply_defaults = NULL;
+
+ custom_bezierline_type_ops = bezierline_type_ops;
+ custom_bezierline_type_ops.create = customline_create;
+ custom_bezierline_type_ops.get_defaults = NULL;
+ custom_bezierline_type_ops.apply_defaults = NULL;
+}
+
+void zigzagline_apply_properties( Zigzagline* line, LineInfo* info )
+{
+ line->line_color = info->line_color;
+ line->line_style = info->line_style;
+ line->dashlength = info->dashlength;
+ line->line_width = info->line_width;
+ line->corner_radius = info->corner_radius;
+ line->start_arrow = info->start_arrow;
+ line->end_arrow = info->end_arrow;
+}
+void polyline_apply_properties( Polyline* line, LineInfo* info )
+{
+ line->line_color = info->line_color;
+ line->line_style = info->line_style;
+ line->dashlength = info->dashlength;
+ line->line_width = info->line_width;
+ line->corner_radius = info->corner_radius;
+ line->start_arrow = info->start_arrow;
+ line->end_arrow = info->end_arrow;
+}
+void bezierline_apply_properties( Bezierline* line, LineInfo* info )
+{
+ line->line_color = info->line_color;
+ line->line_style = info->line_style;
+ line->dashlength = info->dashlength;
+ line->line_width = info->line_width;
+ line->start_arrow = info->start_arrow;
+ line->end_arrow = info->end_arrow;
+}
+
+DiaObject *
+customline_create(Point *startpoint,
+ void *user_data,
+ Handle **handle1,
+ Handle **handle2)
+{
+ DiaObject* res = NULL;
+ LineInfo* line_info = (LineInfo*)user_data;
+
+ if( line_info->type == CUSTOM_LINETYPE_ZIGZAGLINE ) {
+ res = zigzagline_create( startpoint, user_data, handle1, handle2 );
+ zigzagline_apply_properties( (Zigzagline*)res, line_info );
+ } else if( line_info->type == CUSTOM_LINETYPE_POLYLINE ) {
+ res = polyline_create( startpoint, NULL, handle1, handle2 );
+ polyline_apply_properties( (Polyline*)res, line_info );
+ } else if( line_info->type == CUSTOM_LINETYPE_BEZIERLINE ) {
+ res = bezierline_create( startpoint, NULL, handle1, handle2 );
+ bezierline_apply_properties( (Bezierline*)res, line_info );
+ } else
+ g_warning(_("INTERNAL: CustomLines: Illegal line type in LineInfo object."));
+
+ 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;
+}
Added: trunk/objects/custom_lines/custom_linetypes.h
==============================================================================
--- (empty file)
+++ trunk/objects/custom_lines/custom_linetypes.h Thu Jan 17 19:29:02 2008
@@ -0,0 +1,31 @@
+/* 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.
+ * Modifications (C) 2007 Kern Automatiseringsdiensten BV.
+ *
+ * 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.
+ */
+#ifndef _CUSTOM_LINETYPES_H_
+#define _CUSTOM_LINETYPES_H_
+
+void custom_linetypes_init();
+void custom_linetype_new(LineInfo *info, DiaObjectType **otype);
+void custom_linetype_create_and_register( LineInfo* info );
+
+#endif /* _CUSTOM_LINETYPES_H_ */
Added: trunk/objects/custom_lines/line_info.c
==============================================================================
--- (empty file)
+++ trunk/objects/custom_lines/line_info.c Thu Jan 17 19:29:02 2008
@@ -0,0 +1,398 @@
+/* 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.
+ * Modifications (C) 2007 Kern Automatiseringsdiensten BV.
+ *
+ * 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 <stdlib.h>
+#include <libxml/tree.h>
+#include <libxml/parser.h>
+#include <libxml/xmlmemory.h>
+#include <float.h>
+#include <string.h>
+#include "dia_xml_libxml.h"
+
+
+#include <stdio.h>
+
+#include "dia-enums.h"
+#include "arrows.h"
+
+#include "line_info.h"
+
+char* custom_linetype_strings[] = {
+ "Zigzagline",
+ "Polyline",
+ "Bezierline",
+ "All"
+};
+
+
+/* to go in customline_util.c/h */
+gchar *
+custom_get_relative_filename(const gchar *current, const gchar *relative);
+gchar *
+custom_get_relative_filename(const gchar *current, const gchar *relative)
+{
+ gchar *dirname, *tmp;
+
+ g_return_val_if_fail(current != NULL, NULL);
+ g_return_val_if_fail(relative != NULL, NULL);
+
+ if (g_path_is_absolute(relative))
+ return g_strdup(relative);
+ dirname = g_path_get_dirname(current);
+ tmp = g_build_filename(dirname, relative, NULL);
+ g_free(dirname);
+ return tmp;
+}
+
+guint line_info_get_line_type( const gchar* filename, xmlNodePtr node )
+{
+ guint res = CUSTOM_LINETYPE_ZIGZAGLINE;
+ char* tmp = xmlNodeGetContent(node);
+
+ if( !strcmp(tmp, "Zigzagline") )
+ res = CUSTOM_LINETYPE_ZIGZAGLINE;
+ else if( !strcmp(tmp, "Polyline") )
+ res = CUSTOM_LINETYPE_POLYLINE;
+ else if( !strcmp(tmp, "Bezierline") )
+ res = CUSTOM_LINETYPE_BEZIERLINE;
+ else if( !strcmp(tmp, "All") )
+ res = CUSTOM_LINETYPE_ALL;
+ else
+ g_warning("%s: `%s' is not a valid line type",filename,tmp);
+
+ xmlFree(tmp);
+
+ return( res );
+}
+
+
+guint line_info_get_line_style( const gchar* filename, xmlNodePtr node )
+{
+ guint res = LINESTYLE_SOLID;
+ char* tmp = xmlNodeGetContent(node);
+
+ if( !strcmp(tmp, "Solid") )
+ res = LINESTYLE_SOLID;
+ else if( !strcmp(tmp, "Dashed") )
+ res = LINESTYLE_DASHED;
+ else if( !strcmp(tmp, "Dash-Dot") )
+ res = LINESTYLE_DASH_DOT;
+ else if( !strcmp(tmp, "Dash-Dot-Dot") )
+ res = LINESTYLE_DASH_DOT_DOT;
+ else if( !strcmp(tmp, "Dotted") )
+ res = LINESTYLE_DOTTED;
+ else
+ g_warning("%s: `%s' is not a valid line style",filename,tmp);
+
+ xmlFree(tmp);
+
+ return( res );
+}
+
+gfloat line_info_get_as_float( const gchar* filename, xmlNodePtr node )
+{
+ gfloat res = 1.0f;
+ char* tmp = xmlNodeGetContent(node);
+
+ res = g_ascii_strtod( tmp, NULL );
+
+ xmlFree(tmp);
+ return( res );
+}
+
+guint line_info_get_arrow_type( const gchar* filename, xmlNodePtr node )
+{
+ guint res = ARROW_NONE;
+ char* tmp = xmlNodeGetContent(node);
+
+ if( !strcmp(tmp, "None") )
+ res = ARROW_NONE;
+ else if( !strcmp(tmp, "Lines") )
+ res = ARROW_LINES;
+ else if( !strcmp(tmp, "Hollow-Triangle") )
+ res = ARROW_HOLLOW_TRIANGLE;
+ else if( !strcmp(tmp, "Filled-Triangle") )
+ res = ARROW_FILLED_TRIANGLE;
+ else if( !strcmp(tmp, "Hollow-Diamond") )
+ res = ARROW_HOLLOW_DIAMOND;
+ else if( !strcmp(tmp, "Filled-Diamond") )
+ res = ARROW_FILLED_DIAMOND;
+ else if( !strcmp(tmp, "Half-Head") )
+ res = ARROW_HALF_HEAD;
+ else if( !strcmp(tmp, "Slashed-Cross") )
+ res = ARROW_SLASHED_CROSS;
+ else if( !strcmp(tmp, "Filled-Ellipse") )
+ res = ARROW_FILLED_ELLIPSE;
+ else if( !strcmp(tmp, "Hollow-Ellipse") )
+ res = ARROW_HOLLOW_ELLIPSE;
+ else if( !strcmp(tmp, "Double-Hollow-Triangle ") )
+ res = ARROW_DOUBLE_HOLLOW_TRIANGLE;
+ else if( !strcmp(tmp, "Double-Filled-Triangle") )
+ res = ARROW_DOUBLE_FILLED_TRIANGLE;
+ else if( !strcmp(tmp, "Unfilled-Triangle ") )
+ res = ARROW_UNFILLED_TRIANGLE;
+ else if( !strcmp(tmp, "Filled-Dot") )
+ res = ARROW_FILLED_DOT;
+ else if( !strcmp(tmp, "Dimension-Origin") )
+ res = ARROW_DIMENSION_ORIGIN;
+ else if( !strcmp(tmp, "Blanked-Dot") )
+ res = ARROW_BLANKED_DOT;
+ else if( !strcmp(tmp, "Filled-Box") )
+ res = ARROW_FILLED_BOX;
+ else if( !strcmp(tmp, "Blanked-Box") )
+ res = ARROW_BLANKED_BOX;
+ else if( !strcmp(tmp, "Slash-Arrow") )
+ res = ARROW_SLASH_ARROW;
+ else if( !strcmp(tmp, "Integral-Symbol") )
+ res = ARROW_INTEGRAL_SYMBOL;
+ else if( !strcmp(tmp, "Crow-Foot") )
+ res = ARROW_CROW_FOOT;
+ else if( !strcmp(tmp, "Cross") )
+ res = ARROW_CROSS;
+ else if( !strcmp(tmp, "Filled-Concave") )
+ res = ARROW_FILLED_CONCAVE;
+ else if( !strcmp(tmp, "Blanked-Concave") )
+ res = ARROW_BLANKED_CONCAVE;
+ else if( !strcmp(tmp, "Rounded") )
+ res = ARROW_ROUNDED;
+ else if( !strcmp(tmp, "Half-Diamond") )
+ res = ARROW_HALF_DIAMOND;
+ else if( !strcmp(tmp, "Open-Rounded") )
+ res = ARROW_OPEN_ROUNDED;
+ else if( !strcmp(tmp, "Filled-Dot-N-Triangle") )
+ res = ARROW_FILLED_DOT_N_TRIANGLE;
+ else if( !strcmp(tmp, "One-Or-Many") )
+ res = ARROW_ONE_OR_MANY;
+ else if( !strcmp(tmp, "None-Or-Many") )
+ res = ARROW_NONE_OR_MANY;
+ else if( !strcmp(tmp, "One-Or-None") )
+ res = ARROW_ONE_OR_NONE;
+ else if( !strcmp(tmp, "One-Exactly") )
+ res = ARROW_ONE_EXACTLY;
+ else if( !strcmp(tmp, "Backslash") )
+ res = ARROW_BACKSLASH;
+ else if( !strcmp(tmp, "Three-Dots") )
+ res = ARROW_THREE_DOTS;
+ else
+ g_warning("%s: `%s' is not a valid arrow style",filename,tmp);
+
+ xmlFree(tmp);
+
+ return( res );
+}
+
+void line_info_get_arrow( const gchar* filename, xmlNodePtr node, Arrow* arrow )
+{
+ xmlNodePtr child_node = NULL;
+ char* tmp = xmlNodeGetContent(node);
+
+ for( child_node = node->xmlChildrenNode;
+ child_node != NULL;
+ child_node = child_node->next )
+ {
+ if( xmlIsBlankNode(child_node) )
+ continue;
+ else if (/*node->ns == shape_ns &&*/ !strcmp(child_node->name, "type")) {
+ arrow->type = line_info_get_arrow_type(filename, child_node);
+ }
+ else if (/*node->ns == shape_ns &&*/ !strcmp(child_node->name, "length")) {
+ arrow->length = line_info_get_as_float(filename, child_node);
+ }
+ else if (/*node->ns == shape_ns &&*/ !strcmp(child_node->name, "width")) {
+ arrow->width = line_info_get_as_float(filename, child_node);
+ }
+ }
+
+ /* res = g_ascii_strtod( tmp, NULL ); */
+
+ xmlFree(tmp);
+}
+
+void line_info_get_arrows( const gchar* filename, xmlNodePtr node, LineInfo* info )
+{
+ xmlNodePtr child_node = NULL;
+ char* tmp = xmlNodeGetContent(node);
+
+ for( child_node = node->xmlChildrenNode;
+ child_node != NULL;
+ child_node = child_node->next )
+ {
+ if( xmlIsBlankNode(child_node) )
+ continue;
+ else if (/*node->ns == shape_ns &&*/ !strcmp(child_node->name, "start")) {
+ line_info_get_arrow(filename, child_node, &(info->start_arrow));
+ }
+ else if (/*node->ns == shape_ns &&*/ !strcmp(child_node->name, "end")) {
+ line_info_get_arrow(filename, child_node, &(info->end_arrow));
+ }
+ }
+
+ /* res = g_ascii_strtod( tmp, NULL ); */
+
+ xmlFree(tmp);
+}
+
+
+void line_info_get_line_color( const gchar* filename, xmlNodePtr node, LineInfo* info )
+{
+ xmlNodePtr child_node = NULL;
+ char* tmp = xmlNodeGetContent(node);
+
+ for( child_node = node->xmlChildrenNode;
+ child_node != NULL;
+ child_node = child_node->next )
+ {
+ if( xmlIsBlankNode(child_node) )
+ continue;
+ else if (/*node->ns == shape_ns &&*/ !strcmp(child_node->name, "red")) {
+ info->line_color.red = line_info_get_as_float(filename, child_node);
+ }
+ else if (/*node->ns == shape_ns &&*/ !strcmp(child_node->name, "green")) {
+ info->line_color.green = line_info_get_as_float(filename, child_node);
+ }
+ else if (/*node->ns == shape_ns &&*/ !strcmp(child_node->name, "blue")) {
+ info->line_color.blue = line_info_get_as_float(filename, child_node);
+ }
+ }
+
+ /* res = g_ascii_strtod( tmp, NULL ); */
+
+ xmlFree(tmp);
+}
+
+LineInfo* line_info_load_and_apply_from_xmlfile(const gchar *filename, LineInfo* info);
+
+LineInfo* line_info_load(const gchar *filename)
+{
+ LineInfo* res = g_new0(LineInfo, 1);
+
+ res->line_info_filename = filename;
+
+ res->name = "CustomLines - Default";
+ res->icon_filename = NULL;
+ res->type = CUSTOM_LINETYPE_ZIGZAGLINE;
+ res->line_color.red = 0.0f;
+ res->line_color.green = 0.0f;
+ res->line_color.blue = 0.0f;
+ res->line_style = LINESTYLE_SOLID;
+ res->dashlength = 1.0f;
+ res->line_width = 0.1f;
+ res->corner_radius = 0.0f;
+ res->start_arrow.type = ARROW_NONE;
+ res->end_arrow.type = ARROW_NONE;
+
+ /* warning: possible memory leak */
+ res = line_info_load_and_apply_from_xmlfile( filename, res );
+
+ return( res );
+}
+
+LineInfo* line_info_clone(LineInfo* info)
+{
+ LineInfo* res = g_new0(LineInfo, 1);
+
+ res->line_info_filename = info->line_info_filename;
+
+ res->name = info->name;
+ res->icon_filename = info->icon_filename;
+ res->type = info->type;
+ res->line_color.red = info->line_color.red;
+ res->line_color.green = info->line_color.green;
+ res->line_color.blue = info->line_color.blue;
+ res->line_style = info->line_style;
+ res->dashlength = info->dashlength;
+ res->line_width = info->line_width;
+ res->corner_radius = info->corner_radius;
+ res->start_arrow.type = info->start_arrow.type;
+ res->start_arrow.length = (info->start_arrow.length > 0) ?
+ info->start_arrow.length : 1.0;
+ res->start_arrow.width = (info->start_arrow.width > 0) ?
+ info->start_arrow.width : 1.0;
+ res->end_arrow.type = info->end_arrow.type;
+ res->end_arrow.length = (info->end_arrow.length > 0) ?
+ info->end_arrow.length : 1.0;
+ res->end_arrow.width = (info->end_arrow.width > 0) ?
+ info->end_arrow.width : 1.0;
+
+ return( res );
+}
+
+LineInfo* line_info_load_and_apply_from_xmlfile(const gchar *filename, LineInfo* info)
+{
+ xmlDocPtr doc = xmlDoParseFile(filename);
+ xmlNsPtr shape_ns, svg_ns;
+ xmlNodePtr node, root, ext_node = NULL;
+ char *tmp;
+ int i;
+
+ if (!doc) {
+ g_warning("parse error for %s", filename);
+ return NULL;
+ }
+ /* skip (emacs) comments */
+ root = doc->xmlRootNode;
+ while (root && (root->type != XML_ELEMENT_NODE)) root = root->next;
+ if (!root) return NULL;
+ if (xmlIsBlankNode(root)) return NULL;
+
+ i = 0;
+ for (node = root->xmlChildrenNode; node != NULL; node = node->next) {
+ if (xmlIsBlankNode(node))
+ continue;
+ else if (node->type != XML_ELEMENT_NODE)
+ continue;
+ else if (/*node->ns == shape_ns &&*/ !strcmp(node->name, "name")) {
+ tmp = xmlNodeGetContent(node);
+/* g_free(info->name);*/
+ info->name = g_strdup(tmp);
+/* fprintf( stderr, "New shape of type: `%s'\n", info->name ); */
+ xmlFree(tmp);
+ } else if (/*node->ns == shape_ns &&*/ !strcmp(node->name, "icon")) {
+ tmp = xmlNodeGetContent(node);
+ g_free(info->icon_filename);
+ info->icon_filename = custom_get_relative_filename(filename, tmp);
+ xmlFree(tmp);
+ } else if (/*node->ns == shape_ns &&*/ !strcmp(node->name, "type")) {
+ info->type = line_info_get_line_type(filename, node);
+ } else if (/*node->ns == shape_ns &&*/ !strcmp(node->name, "line-style")) {
+ info->line_style = line_info_get_line_style(filename, node);
+ } else if (/*node->ns == shape_ns &&*/ !strcmp(node->name, "dash-length")) {
+ info->dashlength = line_info_get_as_float(filename, node);
+ } else if (/*node->ns == shape_ns &&*/ !strcmp(node->name, "line-width")) {
+ info->line_width = line_info_get_as_float(filename, node);
+ } else if (/*node->ns == shape_ns &&*/ !strcmp(node->name, "corner-radius")) {
+ info->corner_radius = line_info_get_as_float(filename, node);
+ } else if (/*node->ns == shape_ns &&*/ !strcmp(node->name, "arrows")) {
+ line_info_get_arrows(filename, node, info);
+ } else if (/*node->ns == shape_ns &&*/ !strcmp(node->name, "line-color")) {
+ line_info_get_line_color(filename, node, info);
+ }
+ }
+
+ return( info );
+}
+
+
+
+
Added: trunk/objects/custom_lines/line_info.h
==============================================================================
--- (empty file)
+++ trunk/objects/custom_lines/line_info.h Thu Jan 17 19:29:02 2008
@@ -0,0 +1,65 @@
+/* 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.
+ * Modifications (C) 2007 Kern Automatiseringsdiensten BV.
+ *
+ * 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.
+ */
+#ifndef _LINE_INFO_H_
+#define _LINE_INFO_H_
+
+#include <glib.h>
+
+#include "geometry.h"
+#include "dia_xml.h"
+#include "object.h"
+#include "text.h"
+#include "intl.h"
+#include "dia_svg.h"
+
+typedef enum {
+ CUSTOM_LINETYPE_ZIGZAGLINE,
+ CUSTOM_LINETYPE_POLYLINE,
+ CUSTOM_LINETYPE_BEZIERLINE,
+ CUSTOM_LINETYPE_ALL
+} CustomLineType;
+
+extern char* custom_linetype_strings[];
+
+typedef struct _LineInfo {
+ gchar *line_info_filename;
+
+ gchar *name;
+ gchar *icon_filename;
+ CustomLineType type;
+ Color line_color;
+ LineStyle line_style;
+ real dashlength;
+ real line_width;
+ real corner_radius;
+ Arrow start_arrow, end_arrow;
+
+ DiaObjectType* object_type;
+} LineInfo;
+
+/* there is no destructor for LineInfo at the moment */
+LineInfo* line_info_load(const gchar *filename);
+LineInfo* line_info_clone(LineInfo* info);
+
+#endif /* _LINE_INFO_H_ */
Added: trunk/objects/custom_lines/pixmaps/default.xpm
==============================================================================
--- (empty file)
+++ trunk/objects/custom_lines/pixmaps/default.xpm Thu Jan 17 19:29:02 2008
@@ -0,0 +1,53 @@
+/* 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.
+ * Modifications (C) 2007 Kern Automatiseringsdiensten BV.
+ *
+ * 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.
+ */
+
+/* XPM */
+static char * default_xpm[] = {
+"23 23 3 1",
+" c None",
+". c white",
+"X c black",
+" ",
+" ",
+" ",
+" X XXX X X XXXXX ",
+" X X XX X X ",
+" X X X X X XXX ",
+" X X X XX X ",
+" XXXXX XXX X X XXXXX ",
+" ",
+" ",
+" ",
+" XXXXXXXXX ",
+" XXXXXXXXX ",
+" XXXXXXXXX ",
+" XXX X ",
+" XXX XX ",
+" XXXXXXXXXXXXX ",
+" XXXXXXXXXXXXXX ",
+" XXXXXXXXXXXXX ",
+" XX ",
+" X ",
+" ",
+" "};
Modified: trunk/objects/standard/bezier.c
==============================================================================
--- trunk/objects/standard/bezier.c (original)
+++ trunk/objects/standard/bezier.c Thu Jan 17 19:29:02 2008
@@ -42,19 +42,7 @@
#define DEFAULT_WIDTH 0.15
-typedef struct _Bezierline Bezierline;
-
-struct _Bezierline {
- BezierConn bez;
-
- Color line_color;
- LineStyle line_style;
- real dashlength;
- real line_width;
- Arrow start_arrow, end_arrow;
- real absolute_start_gap, absolute_end_gap;
-};
-
+#include "bezier.h"
static ObjectChange* bezierline_move_handle(Bezierline *bezierline, Handle *handle,
Point *to, ConnectionPoint *cp,
@@ -63,7 +51,7 @@
static void bezierline_select(Bezierline *bezierline, Point *clicked_point,
DiaRenderer *interactive_renderer);
static void bezierline_draw(Bezierline *bezierline, DiaRenderer *renderer);
-static DiaObject *bezierline_create(Point *startpoint,
+DiaObject *bezierline_create(Point *startpoint,
void *user_data,
Handle **handle1,
Handle **handle2);
@@ -76,9 +64,9 @@
static void bezierline_get_props(Bezierline *bezierline, GPtrArray *props);
static void bezierline_set_props(Bezierline *bezierline, GPtrArray *props);
-static void bezierline_save(Bezierline *bezierline, ObjectNode obj_node,
+void bezierline_save(Bezierline *bezierline, ObjectNode obj_node,
const char *filename);
-static DiaObject *bezierline_load(ObjectNode obj_node, int version,
+DiaObject *bezierline_load(ObjectNode obj_node, int version,
const char *filename);
static DiaMenu *bezierline_get_object_menu(Bezierline *bezierline, Point *clickedpoint);
@@ -86,7 +74,7 @@
static real approx_bez_length(BezierConn *bez);
static void exchange_bez_gap_points(BezierConn * bez, Point* gap_points);
-static ObjectTypeOps bezierline_type_ops =
+ObjectTypeOps bezierline_type_ops =
{
(CreateFunc)bezierline_create, /* create */
(LoadFunc) bezierline_load, /* load */
@@ -95,7 +83,7 @@
(ApplyDefaultsFunc) NULL
};
-static DiaObjectType bezierline_type =
+DiaObjectType bezierline_type =
{
"Standard - BezierLine", /* name */
0, /* version */
@@ -418,7 +406,7 @@
}
}
-static DiaObject *
+DiaObject *
bezierline_create(Point *startpoint,
void *user_data,
Handle **handle1,
@@ -557,7 +545,7 @@
}
-static void
+void
bezierline_save(Bezierline *bezierline, ObjectNode obj_node,
const char *filename)
{
@@ -607,7 +595,7 @@
bezierline->absolute_end_gap);
}
-static DiaObject *
+DiaObject *
bezierline_load(ObjectNode obj_node, int version, const char *filename)
{
Bezierline *bezierline;
Added: trunk/objects/standard/bezier.h
==============================================================================
--- (empty file)
+++ trunk/objects/standard/bezier.h Thu Jan 17 19:29:02 2008
@@ -0,0 +1,36 @@
+#ifndef _BEZIERLINE_H_
+#define _BEZIERLINE_H_
+
+#include "intl.h"
+#include "object.h"
+#include "bezier_conn.h"
+#include "connectionpoint.h"
+#include "diarenderer.h"
+#include "attributes.h"
+#include "widgets.h"
+#include "diamenu.h"
+#include "message.h"
+#include "properties.h"
+#include "create.h"
+
+typedef struct _Bezierline Bezierline;
+
+struct _Bezierline {
+ BezierConn bez;
+
+ Color line_color;
+ LineStyle line_style;
+ real dashlength;
+ real line_width;
+ Arrow start_arrow, end_arrow;
+ real absolute_start_gap, absolute_end_gap;
+};
+
+extern ObjectTypeOps bezierline_type_ops;
+
+DiaObject *bezierline_create(Point *startpoint,
+ void *user_data,
+ Handle **handle1,
+ Handle **handle2);
+
+#endif /* _BEZIERLINE_H_ */
Modified: trunk/objects/standard/polyline.c
==============================================================================
--- trunk/objects/standard/polyline.c (original)
+++ trunk/objects/standard/polyline.c Thu Jan 17 19:29:02 2008
@@ -40,18 +40,7 @@
#define DEFAULT_WIDTH 0.15
-typedef struct _Polyline {
- PolyConn poly;
-
- Color line_color;
- LineStyle line_style;
- real dashlength;
- real line_width;
- real corner_radius;
- Arrow start_arrow, end_arrow;
- real absolute_start_gap, absolute_end_gap;
-} Polyline;
-
+#include "polyline.h"
static ObjectChange* polyline_move_handle(Polyline *polyline, Handle *handle,
Point *to, ConnectionPoint *cp,
@@ -60,7 +49,7 @@
static void polyline_select(Polyline *polyline, Point *clicked_point,
DiaRenderer *interactive_renderer);
static void polyline_draw(Polyline *polyline, DiaRenderer *renderer);
-static DiaObject *polyline_create(Point *startpoint,
+DiaObject *polyline_create(Point *startpoint,
void *user_data,
Handle **handle1,
Handle **handle2);
@@ -73,15 +62,15 @@
static void polyline_get_props(Polyline *polyline, GPtrArray *props);
static void polyline_set_props(Polyline *polyline, GPtrArray *props);
-static void polyline_save(Polyline *polyline, ObjectNode obj_node,
+void polyline_save(Polyline *polyline, ObjectNode obj_node,
const char *filename);
-static DiaObject *polyline_load(ObjectNode obj_node, int version,
+DiaObject *polyline_load(ObjectNode obj_node, int version,
const char *filename);
static DiaMenu *polyline_get_object_menu(Polyline *polyline, Point *clickedpoint);
void polyline_calculate_gap_endpoints(Polyline *polyline, Point *gap_endpoints);
static void polyline_exchange_gap_points(Polyline *polyline, Point *gap_points);
-static ObjectTypeOps polyline_type_ops =
+ObjectTypeOps polyline_type_ops =
{
(CreateFunc)polyline_create, /* create */
(LoadFunc) polyline_load, /* load */
@@ -90,7 +79,7 @@
(ApplyDefaultsFunc) NULL /*polyline_apply_defaults*/
};
-static DiaObjectType polyline_type =
+DiaObjectType polyline_type =
{
"Standard - PolyLine", /* name */
0, /* version */
@@ -318,7 +307,7 @@
If user_data is NULL, the startpoint is used and a 1x1 line is created.
Otherwise, the startpoint is ignored.
*/
-static DiaObject *
+DiaObject *
polyline_create(Point *startpoint,
void *user_data,
Handle **handle1,
@@ -463,7 +452,7 @@
obj->position = poly->points[0];
}
-static void
+void
polyline_save(Polyline *polyline, ObjectNode obj_node,
const char *filename)
{
@@ -508,7 +497,7 @@
polyline->corner_radius);
}
-static DiaObject *
+DiaObject *
polyline_load(ObjectNode obj_node, int version, const char *filename)
{
Polyline *polyline;
Added: trunk/objects/standard/polyline.h
==============================================================================
--- (empty file)
+++ trunk/objects/standard/polyline.h Thu Jan 17 19:29:02 2008
@@ -0,0 +1,35 @@
+#ifndef _POLYLINE_H_
+#define _POLYLINE_H_
+
+#include "intl.h"
+#include "object.h"
+#include "poly_conn.h"
+#include "connectionpoint.h"
+#include "diarenderer.h"
+#include "attributes.h"
+#include "widgets.h"
+#include "diamenu.h"
+#include "message.h"
+#include "properties.h"
+
+
+typedef struct _Polyline {
+ PolyConn poly;
+
+ Color line_color;
+ LineStyle line_style;
+ real dashlength;
+ real line_width;
+ real corner_radius;
+ Arrow start_arrow, end_arrow;
+ real absolute_start_gap, absolute_end_gap;
+} Polyline;
+
+extern ObjectTypeOps polyline_type_ops;
+
+DiaObject *polyline_create(Point *startpoint,
+ void *user_data,
+ Handle **handle1,
+ Handle **handle2);
+
+#endif /* _POLYLINE_H_ */
Modified: trunk/objects/standard/zigzagline.c
==============================================================================
--- trunk/objects/standard/zigzagline.c (original)
+++ trunk/objects/standard/zigzagline.c Thu Jan 17 19:29:02 2008
@@ -40,17 +40,7 @@
#define HANDLE_MIDDLE HANDLE_CUSTOM1
-typedef struct _Zigzagline {
- OrthConn orth;
-
- Color line_color;
- LineStyle line_style;
- real dashlength;
- real line_width;
- real corner_radius;
- Arrow start_arrow, end_arrow;
-} Zigzagline;
-
+#include "zigzagline.h"
static ObjectChange* zigzagline_move_handle(Zigzagline *zigzagline, Handle *handle,
Point *to, ConnectionPoint *cp,
@@ -59,7 +49,7 @@
static void zigzagline_select(Zigzagline *zigzagline, Point *clicked_point,
DiaRenderer *interactive_renderer);
static void zigzagline_draw(Zigzagline *zigzagline, DiaRenderer *renderer);
-static DiaObject *zigzagline_create(Point *startpoint,
+DiaObject *zigzagline_create(Point *startpoint,
void *user_data,
Handle **handle1,
Handle **handle2);
@@ -74,12 +64,12 @@
static void zigzagline_get_props(Zigzagline *zigzagline, GPtrArray *props);
static void zigzagline_set_props(Zigzagline *zigzagline, GPtrArray *props);
-static void zigzagline_save(Zigzagline *zigzagline, ObjectNode obj_node,
+void zigzagline_save(Zigzagline *zigzagline, ObjectNode obj_node,
const char *filename);
-static DiaObject *zigzagline_load(ObjectNode obj_node, int version,
+DiaObject *zigzagline_load(ObjectNode obj_node, int version,
const char *filename);
-static ObjectTypeOps zigzagline_type_ops =
+ObjectTypeOps zigzagline_type_ops =
{
(CreateFunc)zigzagline_create, /* create */
(LoadFunc) zigzagline_load, /* load */
@@ -88,7 +78,7 @@
(ApplyDefaultsFunc) NULL /*zigzagline_apply_defaults*/
};
-static DiaObjectType zigzagline_type =
+DiaObjectType zigzagline_type =
{
"Standard - ZigZagLine", /* name */
/* Version 0 had no autorouting and so shouldn't have it set by default. */
@@ -237,7 +227,7 @@
}
-static DiaObject *
+DiaObject *
zigzagline_create(Point *startpoint,
void *user_data,
Handle **handle1,
@@ -400,7 +390,7 @@
}
-static void
+void
zigzagline_save(Zigzagline *zigzagline, ObjectNode obj_node,
const char *filename)
{
@@ -438,7 +428,7 @@
zigzagline->corner_radius);
}
-static DiaObject *
+DiaObject *
zigzagline_load(ObjectNode obj_node, int version, const char *filename)
{
Zigzagline *zigzagline;
Added: trunk/objects/standard/zigzagline.h
==============================================================================
--- (empty file)
+++ trunk/objects/standard/zigzagline.h Thu Jan 17 19:29:02 2008
@@ -0,0 +1,33 @@
+#ifndef _ZIGZAGLINE_H_
+#define _ZIGZAGLINE_H_
+
+#include "intl.h"
+#include "object.h"
+#include "orth_conn.h"
+#include "connectionpoint.h"
+#include "diarenderer.h"
+#include "attributes.h"
+#include "widgets.h"
+#include "message.h"
+#include "properties.h"
+#include "autoroute.h"
+
+typedef struct _Zigzagline {
+ OrthConn orth;
+
+ Color line_color;
+ LineStyle line_style;
+ real dashlength;
+ real line_width;
+ real corner_radius;
+ Arrow start_arrow, end_arrow;
+} Zigzagline;
+
+extern ObjectTypeOps zigzagline_type_ops;
+
+DiaObject *zigzagline_create(Point *startpoint,
+ void *user_data,
+ Handle **handle1,
+ Handle **handle2);
+
+#endif /* _ZIGZAGLINE_H_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]