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

Setting the properties of multiple selected objects in stead of just one (the first or only selected->data)



[subject]: This patch will do that.

One thing remaining is updating the diagram (the pointer is dia).
Perhaps I will fix this later on the evening, I'm going to do something
else now :-).

For now I'll just assume it's a minor issue which all other core Dia
developers know how to solve (so feel free to quick-email me how to do
that, it could save me a few minutes of searching for it).

If there's stuff you'd like to be different from how the patch is now,
please tell me. Else: I have a CVS-account on cvs.gnome.org. If you want
me to, I can commit this.

Using this patch, an intersection of the available properties is
generated and using that intersection, a properties dialog box is
created. When clicking OK or Apply, all selected objects are notified to
change their properties to the new ones.

I didn't had to code much since all functionality used (like creating an
intersection of the available properties) was already available.

Next on the list is to fix the properties box for a grouped object. At
this moment it will show an empty-one. This isn't necessary. A grouped
object can give it's subobjects as a GList. This routine would already
load a property box with an intersection of the available properties.

However. 

For a grouped object, I'd (as a user) prefer an union of the properties.
Which is also no problem, the functionality for that is also already
available.

If this gets accepted by you folks (the core developers of Dia), I will
most likely continue with my idea's and provide a properties box for
grouped objects too.




-- 
Philip Van Hoof, Software Developer @ Cronos
home: me at freax dot org
gnome: pvanhoof at gnome dot org
work: philip dot vanhoof at cronos dot be
junk: philip dot vanhoof at gmail dot com
http://www.freax.be, http://www.freax.eu.org
? Diagram1.dia.autosave
? lib/diamarshal.c
? lib/diamarshal.h
? plug-ins/gprint/Makefile
? plug-ins/gprint/Makefile.in
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/dia/ChangeLog,v
retrieving revision 1.1657
diff -u -r1.1657 ChangeLog
--- ChangeLog	31 Dec 2004 20:13:35 -0000	1.1657
+++ ChangeLog	10 Jan 2005 18:49:55 -0000
@@ -1,3 +1,9 @@
+2004-01-10  Philip Van Hoof  <pvanhoof gnome org>
+
+	* app/properties.c: A properties box when multiple objects
+	are selected. The intersection of the available properties
+	is showed.
+
 2004-12-31  Hans Breuer  <hans breuer org>
 
 	* lib/dia_dirs.c(dia_get_canonical_path) : complete
Index: app/commands.c
===================================================================
RCS file: /cvs/gnome/dia/app/commands.c,v
retrieving revision 1.128
diff -u -r1.128 commands.c
--- app/commands.c	6 Nov 2004 16:51:23 -0000	1.128
+++ app/commands.c	10 Jan 2005 18:49:56 -0000
@@ -1082,8 +1082,13 @@
   if (!dia) return;
 
   if (dia->data->selected != NULL) {
+
+    properties_of_selected_show (dia, dia->data->selected);
+/*
     selected = dia->data->selected->data;
     properties_show(dia, selected);
+*/
+
   } else {
     diagram_properties_show(dia);
   } 
Index: app/properties.c
===================================================================
RCS file: /cvs/gnome/dia/app/properties.c,v
retrieving revision 1.35
diff -u -r1.35 properties.c
--- app/properties.c	4 Jul 2004 23:03:07 -0000	1.35
+++ app/properties.c	10 Jan 2005 18:49:57 -0000
@@ -22,7 +22,7 @@
 
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
-
+#include "propinternals.h"
 #include "intl.h"
 #include "properties.h"
 #include "object_ops.h"
@@ -163,6 +163,96 @@
 
   return 0;
 }
+
+extern gboolean pdtpp_is_visible_no_standard(const PropDescription *pdesc);
+void
+properties_of_selected_show (Diagram *dia, GList *selected_in)
+{
+  GList *selected = g_list_first(selected_in);
+
+  if (selected)
+  {
+	gint dialog_retval = 0;
+	PropDialog *pdialog = prop_dialog_new (selected->data, FALSE);
+	GList *have = NULL;
+	PropDescription *pdesc = NULL;
+	GtkWidget *dialog = gtk_dialog_new_with_buttons(
+             	("Properties of multiple objects"),
+             GTK_WINDOW (ddisplay_active()->shell),
+             GTK_DIALOG_DESTROY_WITH_PARENT,
+             GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
+             GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
+             GTK_STOCK_OK, GTK_RESPONSE_OK,
+             NULL);
+
+	gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_OK);
+
+
+	have = g_list_append (have, (gpointer)object_get_prop_descriptions (selected->data));
+
+	while (selected)
+	{
+		DiaObject *obj = selected->data;
+		if (object_complies_with_stdprop (obj))
+		{
+			guint i;
+			GPtrArray *props = NULL;
+
+			
+			have = g_list_append (have, (gpointer)object_get_prop_descriptions (obj));
+			pdesc = prop_desc_lists_intersection (have);
+
+			props = prop_list_from_descs(pdesc, pdtpp_is_visible_no_standard);
+
+			obj->ops->get_props(obj,props);
+
+			for (i = 0; i < props->len; i++) {
+				Property *prop = (Property*)g_ptr_array_index(props,i);
+    				prop_dialog_add_property(pdialog, prop);
+			}
+
+			
+		}
+
+		selected = g_list_next (selected);
+	}
+
+	g_list_free (have);
+
+
+	gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dialog)->vbox), prop_dialog_get_widget(pdialog));
+	gtk_widget_show_all (prop_dialog_get_widget (pdialog));
+
+
+	dialog_retval = gtk_dialog_run (GTK_DIALOG(dialog));
+
+	if (dialog_retval == GTK_RESPONSE_APPLY || dialog_retval == GTK_RESPONSE_OK)
+	{
+
+		selected = selected_in;
+		while (selected)
+		{
+			if (selected->data) 
+			{
+
+				current_obj = selected->data;
+				current_dia = dia;
+				object_part = pdialog->widget;
+
+				// object_apply_props_from_dialog (current_obj, object_part);
+				prop_get_data_from_widgets(pdialog);
+				object_apply_props(selected->data, pdialog->props);
+
+			}
+			selected = g_list_next (selected);
+		}
+	}
+
+	gtk_widget_destroy (dialog);
+
+  }
+}
+
 
 void
 properties_show(Diagram *dia, DiaObject *obj)
Index: app/properties.h
===================================================================
RCS file: /cvs/gnome/dia/app/properties.h,v
retrieving revision 1.6
diff -u -r1.6 properties.h
--- app/properties.h	21 May 2004 15:48:33 -0000	1.6
+++ app/properties.h	10 Jan 2005 18:49:57 -0000
@@ -21,6 +21,7 @@
 #include "object.h"
 #include "diagram.h"
 
+void properties_of_selected_show (Diagram *dia, GList *selected_in);
 void properties_show(Diagram *dia, DiaObject *obj);
 void properties_update_if_shown(Diagram *dia, DiaObject *obj);
 void properties_hide_if_shown(Diagram *dia, DiaObject *obj);


[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