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

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



On Tue, 2005-01-11 at 01:54 +0100, Philip Van Hoof wrote:
> On Mon, 2005-01-10 at 19:52 +0100, Philip Van Hoof wrote:
> > [subject]: This patch will do that.> 

> This new one fixes some issues Hans explained on the mailinglists.

And this new one is more correct about intersecting the properties.




-- 
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	11 Jan 2005 09:20:00 -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	11 Jan 2005 09:20:01 -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	11 Jan 2005 09:20:02 -0000
@@ -22,7 +22,8 @@
 
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
-
+#include "propinternals.h"
+#include "lib/properties.h"
 #include "intl.h"
 #include "properties.h"
 #include "object_ops.h"
@@ -163,6 +164,112 @@
 
   return 0;
 }
+
+void
+properties_of_selected_show (Diagram *dia, GList *selected_in)
+{
+  GList *selected = g_list_first(selected_in);
+
+  if (selected)
+  {
+	guint i;
+	GPtrArray *props = NULL;
+
+	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))
+		{
+			have = g_list_append (have, (gpointer)object_get_prop_descriptions (obj));
+		}
+		selected = g_list_next (selected);
+	}
+
+	pdesc = prop_desc_lists_intersection (have);
+	g_list_free (have);
+
+	props = prop_list_from_descs(pdesc, pdtpp_is_visible);
+
+	for (i = 0; i < props->len; i++) {
+		Property *prop = (Property*)g_ptr_array_index(props,i);
+		prop_dialog_add_property(pdialog, prop);
+	}
+
+	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) 
+			{
+				ObjectChange *obj_change = NULL;
+
+				current_obj = selected->data;
+				current_dia = dia;
+				object_part = pdialog->widget;
+
+
+				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);
+
+ 				if (obj_change != NULL) {
+					undo_object_change(current_dia, current_obj, obj_change);
+				}
+
+				diagram_modified(current_dia);
+
+				diagram_object_modified(current_dia, current_obj);
+
+				diagram_update_extents(current_dia);
+
+				if (obj_change != NULL) {
+					undo_set_transactionpoint(current_dia->undo);
+				}  else {
+					message_warning(_("This object doesn't support Undo/Redo.\n"
+						"Undo information erased."));
+					undo_clear(current_dia->undo);
+				}
+				diagram_flush(current_dia);
+
+
+			}
+			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	11 Jan 2005 09:20:02 -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);
Index: lib/propdialogs.c
===================================================================
RCS file: /cvs/gnome/dia/lib/propdialogs.c,v
retrieving revision 1.10
diff -u -r1.10 propdialogs.c
--- lib/propdialogs.c	21 May 2004 15:48:34 -0000	1.10
+++ lib/propdialogs.c	11 Jan 2005 09:20:02 -0000
@@ -289,7 +289,6 @@
     
   }
 }
-extern gboolean pdtpp_is_visible_no_standard(const PropDescription *pdesc);
 static void 
 prop_dialog_fill(PropDialog *dialog, DiaObject *obj, gboolean is_default) {
   const PropDescription *pdesc;


[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