2005-09-05 Inaki Larranaga <dooteo@euskalgnu.org>
[dia.git] / lib / connpoint_line.h
blob83149452975670121107891d2dd17dca514218cd
1 /* Dynamic container for connection points -*- c -*-
2 * Copyright(C) 2000 Cyrille Chepelov
4 * Connection point line is a helper struct, to hold a few connection points
5 * on a line segment. There can be a variable number of these connection
6 * points. The user should be made able to add or remove some connection
7 * points.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #ifndef __CONNPOINT_LINE_H
25 #define __CONNPOINT_LINE_H
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <assert.h>
30 #include <math.h>
31 #include <glib.h>
33 #include "geometry.h"
34 #include "connectionpoint.h"
35 #include "object.h"
36 #include "dia_xml.h"
38 typedef struct {
39 Point start,end;
40 DiaObject *parent;
42 int num_connections;
43 GSList *connections;
44 } ConnPointLine;
47 ConnPointLine *connpointline_create(DiaObject *parent,
48 int num_connections);
49 void connpointline_destroy(ConnPointLine *cpl);
50 void connpointline_update(ConnPointLine *cpl);
51 void connpointline_putonaline(ConnPointLine *cpl,Point *start,Point *end);
52 int connpointline_can_add_point(ConnPointLine *cpl,
53 Point *clicked);
54 int connpointline_can_remove_point(ConnPointLine *cpl,
55 Point *clicked);
57 ObjectChange *connpointline_add_points(ConnPointLine *cpl,
58 Point *clickedpoint,
59 int count);
60 ObjectChange *connpointline_remove_points(ConnPointLine *cpl,
61 Point *clickedpoint,
62 int count);
63 ConnPointLine *connpointline_load(DiaObject *obj,ObjectNode obj_node,
64 const gchar *name, int default_nc,
65 int *realconncount);
66 void connpointline_save(ConnPointLine *cpl,ObjectNode obj_node,
67 const gchar *name);
68 ConnPointLine *connpointline_copy(DiaObject *newobj,ConnPointLine *cpl,
69 int *realconncount);
71 #define connpointline_add_point(cpl, clickedpoint) \
72 connpointline_add_points(cpl, clickedpoint, 1)
73 #define connpointline_remove_point(cpl, clickedpoint) \
74 connpointline_remove_points(cpl, clickedpoint, 1)
76 int connpointline_adjust_count(ConnPointLine *cpl,
77 int newcount, Point *where);
79 #endif /* __CONNPOINT_LINE_H */