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

apply properties to all selected objects



I really wanted this feature in dia so I got it working, sort of.  It
alters the properties dialog to affect all selected objects instead of
just the current one.  I'm looking for feedback about my patch, because
I don't really know what I am doing (for instance what does add_updates
do?).  It will crash in the dia-gnome excutable (or did I just not
compile it right?).  I am really surprised that undo appears to work
correctly.

Also, I'm not sure if it is correct to allow changing objects of
different types.  Currently the property dialog comes up for the current
object, but applies changes to all selected objects.  It works great for
flowchart lines and rectangles, which both have a line color, for
instance to change both line colors at once.  But does changing the text
color on a box write into some invalid memory in the line, which doesn't
have text color, or is dia's object system advanced enough to handle
that?

Here is the patch attached to dia 0.88.1.

-- 
Tril 0. Byte <tril@tunes.org> http://tril.tunes.org/
This message is placed in the public domain.
--- dia-0.88.1.orig/app/properties.c	Mon Apr 30 17:55:37 2001
+++ dia-0.88.1/app/properties.c	Thu Dec 13 15:18:53 2001
@@ -150,20 +150,35 @@
 properties_apply(GtkWidget *canvas, gpointer data)
 {
   ObjectChange *obj_change = NULL;
+  Object *obj;
+  GList *list;
 
   if ( (current_obj == NULL) || (current_dia == NULL) )
     return 0;
-  
-  object_add_updates(current_obj, current_dia);
-  obj_change = current_obj->ops->apply_properties(current_obj, object_part);
+
   object_add_updates(current_obj, current_dia);
 
-  diagram_update_connections_object(current_dia, current_obj, TRUE);
+  /* TODO: only operate on objects of the same type as current_obj */
+  list = current_dia->data->selected;
+  while (list != NULL) {
+    obj = (Object *)  list->data;
+
+    if ( obj == NULL )
+      return 0;
+
+    obj_change = obj->ops->apply_properties(obj, object_part);
+
+    diagram_update_connections_object(current_dia, obj, TRUE);
   
-  if (obj_change != NULL) {
-    undo_object_change(current_dia, current_obj, obj_change);
+    if (obj_change != NULL) {
+      undo_object_change(current_dia, obj, obj_change);
+    }
+
+    list = g_list_next(list);
   }
-  
+
+  object_add_updates_list(current_dia->data->selected, current_dia);
+
   diagram_modified(current_dia);
 
   diagram_update_extents(current_dia);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] Mail converted by Mofo Magic and the Flying D

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

GuideSMACK