dia r4002 - in trunk: . objects/Misc objects/standard



Author: hans
Date: Sat May 10 20:43:00 2008
New Revision: 4002
URL: http://svn.gnome.org/viewvc/dia?rev=4002&view=rev

Log:
2008-05-10  Hans Breuer  <hans breuer org>

	* objects/standard/outline.c(move_handle) : initial implementation
	* objects/Misc/measure.c : object position should be start point



Modified:
   trunk/ChangeLog
   trunk/objects/Misc/measure.c
   trunk/objects/standard/outline.c

Modified: trunk/objects/Misc/measure.c
==============================================================================
--- trunk/objects/Misc/measure.c	(original)
+++ trunk/objects/Misc/measure.c	Sat May 10 20:43:00 2008
@@ -256,7 +256,7 @@
   bbox.right = bbox.left + width;
   rectangle_union(&obj->bounding_box, &bbox);
 
-  obj->position = measure->text_pos;
+  obj->position = conn->endpoints[0];
 }
 static void 
 measure_draw(Measure *measure, DiaRenderer *renderer)

Modified: trunk/objects/standard/outline.c
==============================================================================
--- trunk/objects/standard/outline.c	(original)
+++ trunk/objects/standard/outline.c	Sat May 10 20:43:00 2008
@@ -181,6 +181,8 @@
   *handle1 = outline->object.handles[0];
   *handle2 = outline->object.handles[1];
 
+  outline_update_data (outline);
+
   return obj;
 }
 static DiaObject *
@@ -235,10 +237,10 @@
   DiaObject *obj = &outline->object;
 
   g_return_if_fail (obj->handles != NULL);
-  obj->handles[0]->id = HANDLE_CUSTOM1;
+  obj->handles[0]->id = HANDLE_RESIZE_NW;
   obj->handles[0]->pos = outline->ink_rect[0];
 
-  obj->handles[1]->id = HANDLE_CUSTOM2;
+  obj->handles[1]->id = HANDLE_RESIZE_SE;
   obj->handles[1]->pos = outline->ink_rect[2];
 }
 /*! Not in the object interface but very important anyway. Used to recalculate the object data after a change  */
@@ -451,7 +453,29 @@
 		     Point *to, ConnectionPoint *cp,
 		     HandleMoveReason reason, ModifierKeys modifiers)
 {
-  /* setup transform? */
+  DiaObject *obj = &outline->object;
+  Point start = obj->position;
+  Point end = outline->ink_rect[2];
+  real old_height = outline->font_height;
+  real dist, old_dist = distance_point_point (&start, &end);
+  Point norm = end;
+  point_sub (&norm, &start);
+  point_normalize (&norm);
+  /* we use this to modify angle and scale */
+  switch (handle->id) {
+  case HANDLE_RESIZE_NW :
+    obj->position = start = *to;
+    break;
+  case HANDLE_RESIZE_SE :
+    end = *to;
+    break;
+  default :
+    g_warning ("Outline unknown handle");
+  }
+  dist = distance_point_point (&start, &end);
+  outline->font_height *= (dist / old_dist);
+  
+  outline_update_data (outline);
   return NULL;
 }
 static ObjectChange* 
@@ -460,6 +484,7 @@
   DiaObject *obj = &outline->object;
 
   obj->position = *to;
+
   outline_update_data (outline);
   return NULL;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]