• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

作図ソフト dia の改良版


Commit MetaInfo

Revision77b98855973cc616da59392e2617209f1667642c (tree)
Time1998-09-30 07:57:30
AuthorAlexander Larsson <alexl@src....>
CommiterAlexander Larsson

Log Message

Changed handle->connectable to handle->connect_type.
Now handles can be HANDLE_CONNECTABLE_NOBREAK, which means
that their connections don't break when moving objects.

Change Summary

Incremental Difference

--- a/app/connectionpoint_ops.c
+++ b/app/connectionpoint_ops.c
@@ -1,4 +1,4 @@
1-/* xxxxxx -- an diagram creation/manipulation program
1+/* Dia -- an diagram creation/manipulation program
22 * Copyright (C) 1998 Alexander Larsson
33 *
44 * This program is free software; you can redistribute it and/or modify
@@ -135,8 +135,9 @@ ddisplay_connect_selected(DDisplay *ddisp)
135135 selected_obj = (Object *) list->data;
136136
137137 for (i=0; i<selected_obj->num_handles; i++) {
138- if (selected_obj->handles[i]->connectable)
138+ if (selected_obj->handles[i]->connect_type != HANDLE_NONCONNECTABLE) {
139139 object_connect_display(ddisp, selected_obj, selected_obj->handles[i]);
140+ }
140141 }
141142
142143 list = g_list_next(list);
@@ -159,7 +160,9 @@ diagram_unconnect_selected(Diagram *dia)
159160 for (i=0; i<selected_obj->num_handles; i++) {
160161 handle = selected_obj->handles[i];
161162
162- if (handle->connected_to != NULL) {
163+ if ((handle->connected_to != NULL) &&
164+ (handle->connect_type == HANDLE_CONNECTABLE)){
165+ /* don't do this if type is HANDLE_CONNECTABLE_BREAK */
163166 if (!diagram_is_selected(dia, handle->connected_to->object)) {
164167 object_unconnect(selected_obj, handle);
165168 }
--- a/app/create_object.c
+++ b/app/create_object.c
@@ -1,4 +1,4 @@
1-/* xxxxxx -- an diagram creation/manipulation program
1+/* Dia -- an diagram creation/manipulation program
22 * Copyright (C) 1998 Alexander Larsson
33 *
44 * This program is free software; you can redistribute it and/or modify
@@ -59,7 +59,8 @@ create_object_button_press(CreateObjectTool *tool, GdkEventButton *event,
5959 (Renderer *)ddisp->renderer);
6060
6161 /* Connect first handle if possible: */
62- if ((handle1!= NULL) && (handle1->connectable)) {
62+ if ((handle1!= NULL) &&
63+ (handle1->connect_type != HANDLE_NONCONNECTABLE)) {
6364 object_connect_display(ddisp, obj, handle1);
6465 }
6566
@@ -99,7 +100,7 @@ create_object_button_release(CreateObjectTool *tool, GdkEventButton *event,
99100 object_add_updates(tool->obj, ddisp->diagram);
100101
101102
102- if (tool->handle->connectable) {
103+ if (tool->handle->connect_type != HANDLE_NONCONNECTABLE) {
103104 object_connect_display(ddisp, tool->obj, tool->handle);
104105 diagram_update_connections_selection(ddisp->diagram);
105106 diagram_flush(ddisp->diagram);
@@ -126,7 +127,8 @@ create_object_motion(CreateObjectTool *tool, GdkEventMotion *event,
126127 /* Move to ConnectionPoint if near: */
127128 connectionpoint =
128129 object_find_connectpoint_display(ddisp, &to);
129- if ( (tool->handle->connectable) && (connectionpoint != NULL) ) {
130+ if ( (tool->handle->connect_type != HANDLE_NONCONNECTABLE) &&
131+ (connectionpoint != NULL) ) {
130132 to = connectionpoint->pos;
131133 } else {
132134 /* No connectionopoint near, then snap to grid (if enabled) */
--- a/app/group.c
+++ b/app/group.c
@@ -1,4 +1,4 @@
1-/* xxxxxx -- an diagram creation/manipulation program
1+/* Dia -- an diagram creation/manipulation program
22 * Copyright (C) 1998 Alexander Larsson
33 *
44 * This program is free software; you can redistribute it and/or modify
@@ -307,7 +307,7 @@ group_create(GList *objects)
307307 for (i=0;i<8;i++) {
308308 obj->handles[i] = &group->resize_handles[i];
309309 obj->handles[i]->type = HANDLE_NON_MOVABLE;
310- obj->handles[i]->connectable = FALSE;
310+ obj->handles[i]->connect_type = HANDLE_NONCONNECTABLE;
311311 obj->handles[i]->connected_to = NULL;
312312 }
313313
--- a/app/handle_ops.c
+++ b/app/handle_ops.c
@@ -1,4 +1,4 @@
1-/* xxxxxx -- an diagram creation/manipulation program
1+/* Dia -- an diagram creation/manipulation program
22 * Copyright (C) 1998 Alexander Larsson
33 *
44 * This program is free software; you can redistribute it and/or modify
@@ -83,7 +83,7 @@ handle_draw(Handle *handle, DDisplay *ddisp)
8383 HANDLE_SIZE-1, HANDLE_SIZE-1);
8484
8585
86- if (handle->connectable) {
86+ if (handle->connect_type != HANDLE_NONCONNECTABLE) {
8787 gdk_draw_line (ddisp->pixmap,
8888 handle_gc,
8989 x - HANDLE_SIZE/2, y - HANDLE_SIZE/2,
--- a/app/modify_tool.c
+++ b/app/modify_tool.c
@@ -1,4 +1,4 @@
1-/* xxxxxx -- an diagram creation/manipulation program
1+/* Dia -- an diagram creation/manipulation program
22 * Copyright (C) 1998 Alexander Larsson
33 *
44 * This program is free software; you can redistribute it and/or modify
@@ -213,7 +213,6 @@ modify_double_click(ModifyTool *tool, GdkEventButton *event,
213213 {
214214 Point clickedpoint;
215215 Object *clicked_obj;
216- GtkWidget *properties;
217216
218217 ddisplay_untransform_coords(ddisp,
219218 (int)event->x, (int)event->y,
@@ -265,7 +264,8 @@ modify_motion(ModifyTool *tool, GdkEventMotion *event,
265264 /* Move to ConnectionPoint if near: */
266265 connectionpoint =
267266 object_find_connectpoint_display(ddisp, &to);
268- if ( (tool->handle->connectable) && (connectionpoint != NULL) ) {
267+ if ( (tool->handle->connect_type != HANDLE_NONCONNECTABLE) &&
268+ (connectionpoint != NULL) ) {
269269 to = connectionpoint->pos;
270270 } else {
271271 /* No connectionopoint near, then snap to grid (if enabled) */
@@ -352,7 +352,7 @@ modify_button_release(ModifyTool *tool, GdkEventButton *event,
352352 object_add_updates(tool->object, ddisp->diagram);
353353
354354 /* Connect if possible: */
355- if (tool->handle->connectable) {
355+ if (tool->handle->connect_type != HANDLE_NONCONNECTABLE) {
356356 object_connect_display(ddisp, tool->object, tool->handle);
357357 diagram_update_connections_selection(ddisp->diagram);
358358 }
--- a/lib/connection.c
+++ b/lib/connection.c
@@ -1,4 +1,4 @@
1-/* xxxxxx -- an diagram creation/manipulation program
1+/* Dia -- an diagram creation/manipulation program
22 * Copyright (C) 1998 Alexander Larsson
33 *
44 * This program is free software; you can redistribute it and/or modify
@@ -95,7 +95,7 @@ connection_init(Connection *conn, int num_handles, int num_connections)
9595 for (i=0;i<2;i++) {
9696 obj->handles[i] = &conn->endpoint_handles[i];
9797 obj->handles[i]->type = HANDLE_MAJOR_CONTROL;
98- obj->handles[i]->connectable = TRUE;
98+ obj->handles[i]->connect_type = HANDLE_CONNECTABLE;
9999 obj->handles[i]->connected_to = NULL;
100100 }
101101 }
--- a/lib/element.c
+++ b/lib/element.c
@@ -1,4 +1,4 @@
1-/* xxxxxx -- an diagram creation/manipulation program
1+/* Dia -- an diagram creation/manipulation program
22 * Copyright (C) 1998 Alexander Larsson
33 *
44 * This program is free software; you can redistribute it and/or modify
@@ -257,7 +257,7 @@ element_init(Element *elem, int num_handles, int num_connections)
257257
258258 for (i=0;i<8;i++) {
259259 obj->handles[i] = &elem->resize_handles[i];
260- obj->handles[i]->connectable = FALSE;
260+ obj->handles[i]->connect_type = HANDLE_NONCONNECTABLE;
261261 obj->handles[i]->connected_to = NULL;
262262 obj->handles[i]->type = HANDLE_MAJOR_CONTROL;
263263 }
--- a/lib/handle.h
+++ b/lib/handle.h
@@ -1,4 +1,4 @@
1-/* xxxxxx -- an diagram creation/manipulation program
1+/* Dia -- an diagram creation/manipulation program
22 * Copyright (C) 1998 Alexander Larsson
33 *
44 * This program is free software; you can redistribute it and/or modify
@@ -22,6 +22,7 @@ typedef struct _Handle Handle;
2222 typedef enum _HandleId HandleId;
2323 typedef enum _HandleType HandleType;
2424 typedef enum _HandleMoveReason HandleMoveReason;
25+typedef enum _HandleConnectType HandleConnectType;
2526
2627 /* Is this needed? */
2728 enum _HandleId {
@@ -62,6 +63,12 @@ enum _HandleMoveReason {
6263 HANDLE_MOVE_CONNECTED
6364 };
6465
66+enum _HandleConnectType {
67+ HANDLE_NONCONNECTABLE,
68+ HANDLE_CONNECTABLE,
69+ HANDLE_CONNECTABLE_NOBREAK /* Don't break connection on object move */
70+};
71+
6572 #include "geometry.h"
6673 #include "object.h"
6774
@@ -70,7 +77,7 @@ struct _Handle {
7077 HandleType type;
7178 Point pos;
7279
73- int connectable;
80+ HandleConnectType connect_type;
7481 ConnectionPoint *connected_to; /* NULL if not connected */
7582 };
7683
--- a/lib/object.c
+++ b/lib/object.c
@@ -1,4 +1,4 @@
1-/* xxxxxx -- an diagram creation/manipulation program
1+/* Dia -- an diagram creation/manipulation program
22 * Copyright (C) 1998 Alexander Larsson
33 *
44 * This program is free software; you can redistribute it and/or modify
@@ -126,8 +126,8 @@ void
126126 object_connect(Object *obj, Handle *handle,
127127 ConnectionPoint *connectionpoint)
128128 {
129- if (!handle->connectable) {
130- message_error("Error? trying to connect a non conectable handle.\n"
129+ if (handle->connect_type==HANDLE_NONCONNECTABLE) {
130+ message_error("Error? trying to connect a non connectable handle.\n"
131131 "Check this out...\n");
132132 return;
133133 }
--- a/lib/object.h
+++ b/lib/object.h
@@ -1,4 +1,4 @@
1-/* xxxxxx -- an diagram creation/manipulation program
1+/* Dia -- an diagram creation/manipulation program
22 * Copyright (C) 1998 Alexander Larsson
33 *
44 * This program is free software; you can redistribute it and/or modify
--- a/lib/orth_conn.c
+++ b/lib/orth_conn.c
@@ -1,4 +1,4 @@
1-/* xxxxxx -- an diagram creation/manipulation program
1+/* Dia -- an diagram creation/manipulation program
22 * Copyright (C) 1998 Alexander Larsson
33 *
44 * This program is free software; you can redistribute it and/or modify
@@ -38,7 +38,7 @@ static void setup_midpoint_handle(Handle *handle)
3838 {
3939 handle->id = HANDLE_MIDPOINT;
4040 handle->type = HANDLE_MINOR_CONTROL;
41- handle->connectable = FALSE;
41+ handle->connect_type = HANDLE_NONCONNECTABLE;
4242 handle->connected_to = NULL;
4343 }
4444
@@ -416,13 +416,13 @@ orthconn_init(OrthConn *orth, Point *startpoint)
416416 orth->orientation = g_malloc(2*sizeof(Orientation));
417417
418418 obj->handles[0] = &orth->endpoint_handles[0];
419- obj->handles[0]->connectable = TRUE;
419+ obj->handles[0]->connect_type = HANDLE_CONNECTABLE;
420420 obj->handles[0]->connected_to = NULL;
421421 obj->handles[0]->type = HANDLE_MAJOR_CONTROL;
422422 obj->handles[0]->id = HANDLE_MOVE_STARTPOINT;
423423
424424 obj->handles[1] = &orth->endpoint_handles[1];
425- obj->handles[1]->connectable = TRUE;
425+ obj->handles[1]->connect_type = HANDLE_CONNECTABLE;
426426 obj->handles[1]->connected_to = NULL;
427427 obj->handles[1]->type = HANDLE_MAJOR_CONTROL;
428428 obj->handles[1]->id = HANDLE_MOVE_ENDPOINT;
@@ -544,14 +544,14 @@ orthconn_load(OrthConn *orth, int fd) /* NOTE: Does object_init() */
544544 }
545545
546546 obj->handles[0] = &orth->endpoint_handles[0];
547- obj->handles[0]->connectable = TRUE;
547+ obj->handles[0]->connect_type = HANDLE_CONNECTABLE;
548548 obj->handles[0]->connected_to = NULL;
549549 obj->handles[0]->type = HANDLE_MAJOR_CONTROL;
550550 obj->handles[0]->id = HANDLE_MOVE_STARTPOINT;
551551 obj->handles[0]->pos = orth->points[0];
552552
553553 obj->handles[1] = &orth->endpoint_handles[1];
554- obj->handles[1]->connectable = TRUE;
554+ obj->handles[1]->connect_type = HANDLE_CONNECTABLE;
555555 obj->handles[1]->connected_to = NULL;
556556 obj->handles[1]->type = HANDLE_MAJOR_CONTROL;
557557 obj->handles[1]->id = HANDLE_MOVE_ENDPOINT;
--- a/objects/UML/constraint.c
+++ b/objects/UML/constraint.c
@@ -1,4 +1,4 @@
1-/* xxxxxx -- an diagram creation/manipulation program
1+/* Dia -- an diagram creation/manipulation program
22 * Copyright (C) 1998 Alexander Larsson
33 *
44 * This program is free software; you can redistribute it and/or modify
@@ -256,7 +256,7 @@ constraint_create(Point *startpoint,
256256
257257 constraint->text_handle.id = HANDLE_MOVE_TEXT;
258258 constraint->text_handle.type = HANDLE_MINOR_CONTROL;
259- constraint->text_handle.connectable = FALSE;
259+ constraint->text_handle.connect_type = HANDLE_NONCONNECTABLE;
260260 constraint->text_handle.connected_to = NULL;
261261 obj->handles[2] = &constraint->text_handle;
262262
@@ -381,7 +381,7 @@ constraint_load(int fd, int version)
381381
382382 constraint->text_handle.id = HANDLE_MOVE_TEXT;
383383 constraint->text_handle.type = HANDLE_MINOR_CONTROL;
384- constraint->text_handle.connectable = FALSE;
384+ constraint->text_handle.connect_type = HANDLE_NONCONNECTABLE;
385385 constraint->text_handle.connected_to = NULL;
386386 obj->handles[2] = &constraint->text_handle;
387387
--- a/objects/UML/implements.c
+++ b/objects/UML/implements.c
@@ -1,4 +1,4 @@
1-/* xxxxxx -- an diagram creation/manipulation program
1+/* Dia -- an diagram creation/manipulation program
22 * Copyright (C) 1998 Alexander Larsson
33 *
44 * This program is free software; you can redistribute it and/or modify
@@ -268,13 +268,13 @@ implements_create(Point *startpoint,
268268
269269 implements->text_handle.id = HANDLE_MOVE_TEXT;
270270 implements->text_handle.type = HANDLE_MINOR_CONTROL;
271- implements->text_handle.connectable = FALSE;
271+ implements->text_handle.connect_type = HANDLE_NONCONNECTABLE;
272272 implements->text_handle.connected_to = NULL;
273273 obj->handles[2] = &implements->text_handle;
274274
275275 implements->circle_handle.id = HANDLE_CIRCLE_SIZE;
276276 implements->circle_handle.type = HANDLE_MINOR_CONTROL;
277- implements->circle_handle.connectable = FALSE;
277+ implements->circle_handle.connect_type = HANDLE_NONCONNECTABLE;
278278 implements->circle_handle.connected_to = NULL;
279279 obj->handles[3] = &implements->circle_handle;
280280
@@ -435,13 +435,13 @@ implements_load(int fd, int version)
435435
436436 implements->text_handle.id = HANDLE_MOVE_TEXT;
437437 implements->text_handle.type = HANDLE_MINOR_CONTROL;
438- implements->text_handle.connectable = FALSE;
438+ implements->text_handle.connect_type = HANDLE_NONCONNECTABLE;
439439 implements->text_handle.connected_to = NULL;
440440 obj->handles[2] = &implements->text_handle;
441441
442442 implements->circle_handle.id = HANDLE_CIRCLE_SIZE;
443443 implements->circle_handle.type = HANDLE_MINOR_CONTROL;
444- implements->circle_handle.connectable = FALSE;
444+ implements->circle_handle.connect_type = HANDLE_NONCONNECTABLE;
445445 implements->circle_handle.connected_to = NULL;
446446 obj->handles[3] = &implements->circle_handle;
447447
--- a/objects/standard/arc.c
+++ b/objects/standard/arc.c
@@ -1,4 +1,4 @@
1-/* xxxxxx -- an diagram creation/manipulation program
1+/* Dia -- an diagram creation/manipulation program
22 * Copyright (C) 1998 Alexander Larsson
33 *
44 * This program is free software; you can redistribute it and/or modify
@@ -286,7 +286,7 @@ arc_create(Point *startpoint,
286286 obj->handles[2] = &arc->middle_handle;
287287 arc->middle_handle.id = HANDLE_MIDDLE;
288288 arc->middle_handle.type = HANDLE_MINOR_CONTROL;
289- arc->middle_handle.connectable = FALSE;
289+ arc->middle_handle.connect_type = HANDLE_NONCONNECTABLE;
290290 arc->middle_handle.connected_to = NULL;
291291
292292 arc_update_data(arc);
@@ -437,7 +437,7 @@ arc_load(int fd, int version)
437437 obj->handles[2] = &arc->middle_handle;
438438 arc->middle_handle.id = HANDLE_MIDDLE;
439439 arc->middle_handle.type = HANDLE_MINOR_CONTROL;
440- arc->middle_handle.connectable = FALSE;
440+ arc->middle_handle.connect_type = HANDLE_NONCONNECTABLE;
441441 arc->middle_handle.connected_to = NULL;
442442
443443 arc_update_data(arc);
--- a/objects/standard/textobj.c
+++ b/objects/standard/textobj.c
@@ -1,4 +1,4 @@
1-/* xxxxxx -- an diagram creation/manipulation program
1+/* Dia -- an diagram creation/manipulation program
22 * Copyright (C) 1998 Alexander Larsson
33 *
44 * This program is free software; you can redistribute it and/or modify
@@ -277,7 +277,7 @@ textobj_create(Point *startpoint,
277277 obj->handles[0] = &textobj->text_handle;
278278 textobj->text_handle.id = HANDLE_TEXT;
279279 textobj->text_handle.type = HANDLE_MAJOR_CONTROL;
280- textobj->text_handle.connectable = TRUE;
280+ textobj->text_handle.connect_type = HANDLE_CONNECTABLE;
281281 textobj->text_handle.connected_to = NULL;
282282
283283 textobj_update_data(textobj);
@@ -354,7 +354,7 @@ textobj_load(int fd, int version)
354354 obj->handles[0] = &textobj->text_handle;
355355 textobj->text_handle.id = HANDLE_TEXT;
356356 textobj->text_handle.type = HANDLE_MINOR_CONTROL;
357- textobj->text_handle.connectable = TRUE;
357+ textobj->text_handle.connect_type = HANDLE_CONNECTABLE;
358358 textobj->text_handle.connected_to = NULL;
359359
360360 textobj_update_data(textobj);
--- a/objects/standard/zigzagline.c
+++ b/objects/standard/zigzagline.c
@@ -1,4 +1,4 @@
1-/* xxxxxx -- an diagram creation/manipulation program
1+/* Dia -- an diagram creation/manipulation program
22 * Copyright (C) 1998 Alexander Larsson
33 *
44 * This program is free software; you can redistribute it and/or modify
@@ -281,7 +281,7 @@ zigzagline_create(Point *startpoint,
281281 obj->handles[2] = &zigzagline->middle_handle;
282282 zigzagline->middle_handle.id = HANDLE_MIDDLE;
283283 zigzagline->middle_handle.type = HANDLE_MINOR_CONTROL;
284- zigzagline->middle_handle.connectable = FALSE;
284+ zigzagline->middle_handle.connect_type = HANDLE_NONCONNECTABLE;
285285 zigzagline->middle_handle.connected_to = NULL;
286286
287287 zigzagline_update_data(zigzagline);
@@ -381,7 +381,7 @@ zigzagline_load(int fd, int version)
381381 obj->handles[2] = &zigzagline->middle_handle;
382382 zigzagline->middle_handle.id = HANDLE_MIDDLE;
383383 zigzagline->middle_handle.type = HANDLE_MINOR_CONTROL;
384- zigzagline->middle_handle.connectable = FALSE;
384+ zigzagline->middle_handle.connect_type = HANDLE_NONCONNECTABLE;
385385 zigzagline->middle_handle.connected_to = NULL;
386386
387387 zigzagline_update_data(zigzagline);