dia r3966 - in trunk: . lib objects/UML



Author: hans
Date: Sun Apr 27 15:46:54 2008
New Revision: 3966
URL: http://svn.gnome.org/viewvc/dia?rev=3966&view=rev

Log:
2008-04-27  Hans Breuer  <hans breuer org>

	* lib/object_defaults.c : (dia_object_default_create) 
	Also only copy ~PROP_FLAG_NO_DEFAULTS to preserve intdata initialized
	properties over stored ones
	* objects/UML/class.c : no default name anymore


Modified:
   trunk/ChangeLog
   trunk/lib/object_defaults.c
   trunk/objects/UML/class.c

Modified: trunk/lib/object_defaults.c
==============================================================================
--- trunk/lib/object_defaults.c	(original)
+++ trunk/lib/object_defaults.c	Sun Apr 27 15:46:54 2008
@@ -268,8 +268,12 @@
       obj = type->ops->create (startpoint, user_data, handle1, handle2);
       if (obj)
         {
-          object_copy_props (obj, def_obj, TRUE);
+	  GPtrArray *props = prop_list_from_descs (
+	      object_get_prop_descriptions(def_obj), pdtpp_defaults);
+          def_obj->ops->get_props(def_obj, props);
+          obj->ops->set_props(obj, props);
 	  obj->ops->move (obj, startpoint);
+          prop_list_free(props);
 	}
     }
   else
@@ -297,12 +301,6 @@
   gint        obj_nr;
 };
 
-static gboolean 
-pdtpp_do_save_no_default (const PropDescription *pdesc)
-{ 
-  return (pdesc->flags & (PROP_FLAG_DONT_SAVE|PROP_FLAG_LOAD_ONLY|PROP_FLAG_NO_DEFAULTS|PROP_FLAG_WIDGET_ONLY)) == 0; 
-} 
-
 static void
 _obj_store (gpointer key,
             gpointer value,
@@ -360,18 +358,9 @@
   }
 
   obj->ops->move (obj,&(li->pos));
-  if (obj->ops->get_props) {
-    /* slightly modified from object_save_props() */
-    GPtrArray *props;
-    /* all but DONT_MERGE and NO_DEFAULTS: */
-    props = prop_list_from_descs (object_get_prop_descriptions(obj), pdtpp_do_save_no_default);  
-    obj->ops->get_props(obj, props);
-    prop_list_save(props,obj_node);
-    prop_list_free(props);
-  } else {
-    /* saving every property of the object */
-    obj->type->ops->save (obj, obj_node, ri->filename);
-  }
+  /* saving every property of the object */
+  obj->type->ops->save (obj, obj_node, ri->filename);
+
   /* arrange following objects below */
   li->pos.y += (obj->bounding_box.bottom - obj->bounding_box.top + 1.0); 
 }

Modified: trunk/objects/UML/class.c
==============================================================================
--- trunk/objects/UML/class.c	(original)
+++ trunk/objects/UML/class.c	Sun Apr 27 15:46:54 2008
@@ -137,7 +137,7 @@
 
   PROP_STD_NOTEBOOK_BEGIN,
   PROP_NOTEBOOK_PAGE("class", PROP_FLAG_DONT_MERGE, N_("Class")),
-  { "name", PROP_TYPE_STRING, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
+  { "name", PROP_TYPE_STRING, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL | PROP_FLAG_NO_DEFAULTS,
   N_("Name"), NULL, NULL },
   { "stereotype", PROP_TYPE_STRING, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
   N_("Stereotype"), NULL, NULL },
@@ -145,7 +145,7 @@
   N_("Comment"), NULL, NULL },
   { "abstract", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
   N_("Abstract"), NULL, NULL },
-  { "template", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL| PROP_FLAG_NO_DEFAULTS,
+  { "template", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL | PROP_FLAG_NO_DEFAULTS,
   N_("Template"), NULL, NULL },
 
   { "suppress_attributes", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,



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