dia r3962 - in trunk: . app lib objects/GRAFCET objects/Istar objects/Jackson objects/KAOS objects/UML
- From: hans svn gnome org
- To: svn-commits-list gnome org
- Subject: dia r3962 - in trunk: . app lib objects/GRAFCET objects/Istar objects/Jackson objects/KAOS objects/UML
- Date: Sun, 27 Apr 2008 15:22:12 +0100 (BST)
Author: hans
Date: Sun Apr 27 14:22:12 2008
New Revision: 3962
URL: http://svn.gnome.org/viewvc/dia?rev=3962&view=rev
Log:
2008-04-27 Hans Breuer <hans breuer org>
[
finally restores the feature to have different defaults for the same
object by 'intdata' in sheet file, e.g. Class and Template in UML.
Strange that I can't find any bug report related to this ;)
]
* app/defaults.[hc] lib/object.h lib/object_defaults.c : pass user_data
to dia_object_default_get(), although not using it yet. Remove unused
function dia_object_default_make().
(dia_object_default_create) : direct hashtable access to avoid
creating a default object for every object used. Only the default
dialog created from double-clicking the tools toolbox icon creates
a new default object now.
* objects/GRAFCET/vergent.c objects/Istar/actor.c objects/Istar/goal.c
objects/Istar/link.c objects/Istar/other.c objects/Jackson/domain.c
objects/Jackson/phenomenon.c objects/KAOS/goal.c
objects/KAOS/metaandorrel.c objects/KAOS/metabinrel.c
objects/UML/association.c objects/UML/component_feature.c : mark
properties modified by intdata/GPOINTER_TO_INT(user_data) as
PROP_FLAG_NO_DEFAULTS, thus they are no longer over-written by the
object defauts system.
Modified:
trunk/ChangeLog
trunk/app/defaults.c
trunk/app/defaults.h
trunk/app/tool.c
trunk/lib/libdia.def
trunk/lib/object.h
trunk/lib/object_defaults.c
trunk/objects/GRAFCET/vergent.c
trunk/objects/Istar/actor.c
trunk/objects/Istar/goal.c
trunk/objects/Istar/link.c
trunk/objects/Istar/other.c
trunk/objects/Jackson/domain.c
trunk/objects/Jackson/phenomenon.c
trunk/objects/KAOS/goal.c
trunk/objects/KAOS/metaandorrel.c
trunk/objects/KAOS/metabinrel.c
trunk/objects/UML/association.c
trunk/objects/UML/component_feature.c
Modified: trunk/app/defaults.c
==============================================================================
--- trunk/app/defaults.c (original)
+++ trunk/app/defaults.c Sun Apr 27 14:22:12 2008
@@ -95,7 +95,7 @@
}
void
-defaults_show(DiaObjectType *objtype)
+defaults_show(DiaObjectType *objtype, gpointer user_data)
{
GtkWidget *defaults;
DiaObject *def_object = NULL;
@@ -105,7 +105,7 @@
if (objtype->ops->get_defaults != NULL)
defaults = objtype->ops->get_defaults();
else {
- def_object = dia_object_default_get (objtype);
+ def_object = dia_object_default_get (objtype, user_data);
defaults = object_create_props_dialog (def_object, TRUE);
}
title = g_strconcat(_("Defaults: "), objtype->name, NULL);
Modified: trunk/app/defaults.h
==============================================================================
--- trunk/app/defaults.h (original)
+++ trunk/app/defaults.h Sun Apr 27 14:22:12 2008
@@ -21,7 +21,7 @@
#include "object.h"
#include "diagram.h"
-void defaults_show(DiaObjectType *obj);
+void defaults_show(DiaObjectType *obj, gpointer user_data);
#endif /* DEFAULTS_H */
Modified: trunk/app/tool.c
==============================================================================
--- trunk/app/tool.c (original)
+++ trunk/app/tool.c Sun Apr 27 14:22:12 2008
@@ -145,7 +145,7 @@
break;
case CREATE_OBJECT_TOOL:
objtype = object_get_type((char *)extra_data);
- defaults_show(objtype);
+ defaults_show(objtype, user_data);
break;
case MAGNIFY_TOOL:
break;
Modified: trunk/lib/libdia.def
==============================================================================
--- trunk/lib/libdia.def (original)
+++ trunk/lib/libdia.def Sun Apr 27 14:22:12 2008
@@ -274,7 +274,6 @@
dia_object_default_create
dia_object_default_get
- dia_object_default_make
dia_object_defaults_load
dia_object_defaults_save
dia_object_is_selectable
Modified: trunk/lib/object.h
==============================================================================
--- trunk/lib/object.h (original)
+++ trunk/lib/object.h Sun Apr 27 14:22:12 2008
@@ -562,8 +562,7 @@
gboolean dia_object_defaults_load (const gchar *filename,
gboolean create_lazy);
-void dia_object_default_make (const DiaObject *obj_from);
-DiaObject *dia_object_default_get (const DiaObjectType *type);
+DiaObject *dia_object_default_get (const DiaObjectType *type, gpointer user_data);
DiaObject *dia_object_default_create (const DiaObjectType *type,
Point *startpoint,
void *user_data,
Modified: trunk/lib/object_defaults.c
==============================================================================
--- trunk/lib/object_defaults.c (original)
+++ trunk/lib/object_defaults.c Sun Apr 27 14:22:12 2008
@@ -204,22 +204,6 @@
return TRUE;
}
-/*
- * Remember as defaults from a diagram object
- */
-void
-dia_object_default_make (const DiaObject *obj_from)
-{
- DiaObject *obj_to;
-
- g_return_if_fail (obj_from);
-
- obj_to = dia_object_default_get (obj_from->type);
- g_return_if_fail (obj_to);
-
- object_copy_props (obj_to, obj_from, TRUE);
-}
-
/**
* dia_object_default_get :
* @param type The type of the object for which you want the defaults object.
@@ -227,7 +211,7 @@
* Allows to edit one defaults object properties
*/
DiaObject *
-dia_object_default_get (const DiaObjectType *type)
+dia_object_default_get (const DiaObjectType *type, gpointer user_data)
{
DiaObject *obj;
@@ -275,7 +259,8 @@
g_return_val_if_fail (type != NULL, NULL);
- def_obj = dia_object_default_get (type);
+ /* don't use dia_object_default_get() as it would insert the object into the hashtable (store defaults without being asked for it) */
+ def_obj = g_hash_table_lookup (defaults_hash, type->name);
if (def_obj && def_obj->ops->describe_props)
{
/* copy properties to new object, but keep position */
@@ -361,6 +346,12 @@
g_snprintf(buffer, 30, "O%d", ri->obj_nr++);
xmlSetProp(obj_node, (const xmlChar *)"id", (xmlChar *)buffer);
+ /* if it looks like intdata store it as well */
+ if ((int)obj->type->default_user_data > 0 && (int)obj->type->default_user_data < 0xFF) {
+ g_snprintf(buffer, 30, "%d", (int)obj->type->default_user_data);
+ xmlSetProp(obj_node, (const xmlChar *)"intdata", (xmlChar *)buffer);
+ }
+
obj->ops->move (obj,&(li->pos));
obj->type->ops->save (obj, obj_node, ri->filename);
/* arrange following objects below */
Modified: trunk/objects/GRAFCET/vergent.c
==============================================================================
--- trunk/objects/GRAFCET/vergent.c (original)
+++ trunk/objects/GRAFCET/vergent.c Sun Apr 27 14:22:12 2008
@@ -132,7 +132,7 @@
"cpl_north","cpl_north"},
{ "cpl_south",PROP_TYPE_CONNPOINT_LINE, 0,
"cpl_south","cpl_south"},
- { "vtype", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE,
+ { "vtype", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE|PROP_FLAG_NO_DEFAULTS,
N_("Vergent type:"),NULL, prop_vtype_data},
PROP_DESC_END
};
Modified: trunk/objects/Istar/actor.c
==============================================================================
--- trunk/objects/Istar/actor.c (original)
+++ trunk/objects/Istar/actor.c Sun Apr 27 14:22:12 2008
@@ -142,7 +142,7 @@
static PropDescription actor_props[] = {
ELEMENT_COMMON_PROPERTIES,
- { "type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE,
+ { "type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE|PROP_FLAG_NO_DEFAULTS,
N_("Type"),
N_("Type"),
prop_actor_type_data},
Modified: trunk/objects/Istar/goal.c
==============================================================================
--- trunk/objects/Istar/goal.c (original)
+++ trunk/objects/Istar/goal.c Sun Apr 27 14:22:12 2008
@@ -152,7 +152,7 @@
static PropDescription goal_props[] = {
ELEMENT_COMMON_PROPERTIES,
- { "type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE,
+ { "type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE|PROP_FLAG_NO_DEFAULTS,
N_("Goal Type"),
N_("Goal Type"),
prop_goal_type_data},
Modified: trunk/objects/Istar/link.c
==============================================================================
--- trunk/objects/Istar/link.c (original)
+++ trunk/objects/Istar/link.c Sun Apr 27 14:22:12 2008
@@ -162,7 +162,7 @@
static PropDescription link_props[] = {
CONNECTION_COMMON_PROPERTIES,
- { "type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE,
+ { "type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE|PROP_FLAG_NO_DEFAULTS,
N_("Type:"), NULL, prop_link_type_data },
{ "pm", PROP_TYPE_POINT, 0, "pm", NULL, NULL},
PROP_DESC_END
Modified: trunk/objects/Istar/other.c
==============================================================================
--- trunk/objects/Istar/other.c (original)
+++ trunk/objects/Istar/other.c Sun Apr 27 14:22:12 2008
@@ -146,7 +146,7 @@
static PropDescription other_props[] = {
ELEMENT_COMMON_PROPERTIES,
- { "type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE,
+ { "type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE|PROP_FLAG_NO_DEFAULTS,
N_("Type"),
N_("Type"),
prop_other_type_data},
Modified: trunk/objects/Jackson/domain.c
==============================================================================
--- trunk/objects/Jackson/domain.c (original)
+++ trunk/objects/Jackson/domain.c Sun Apr 27 14:22:12 2008
@@ -174,7 +174,7 @@
static PropDescription box_props[] = {
ELEMENT_COMMON_PROPERTIES,
- { "domtype", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE,
+ { "domtype", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE|PROP_FLAG_NO_DEFAULTS,
N_("Domain Type"),
N_("Domain Type"),
prop_domain_type_data},
Modified: trunk/objects/Jackson/phenomenon.c
==============================================================================
--- trunk/objects/Jackson/phenomenon.c (original)
+++ trunk/objects/Jackson/phenomenon.c Sun Apr 27 14:22:12 2008
@@ -144,7 +144,7 @@
{ "text", PROP_TYPE_STRING, PROP_FLAG_NO_DEFAULTS|PROP_FLAG_LOAD_ONLY|PROP_FLAG_OPTIONAL, N_("Message:"), NULL, NULL },
/* new name matching "same name, same type" rule */
{ "name", PROP_TYPE_STRING, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL, N_("Message:"), NULL, NULL },
- { "type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE,
+ { "type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE|PROP_FLAG_NO_DEFAULTS,
N_("Type:"), NULL, prop_message_type_data },
{ "text_pos", PROP_TYPE_POINT, 0,
"text_pos:", NULL,NULL },
Modified: trunk/objects/KAOS/goal.c
==============================================================================
--- trunk/objects/KAOS/goal.c (original)
+++ trunk/objects/KAOS/goal.c Sun Apr 27 14:22:12 2008
@@ -155,7 +155,7 @@
static PropDescription goal_props[] = {
ELEMENT_COMMON_PROPERTIES,
- { "type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE,
+ { "type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE|PROP_FLAG_NO_DEFAULTS,
N_("Goal Type"),
N_("Goal Type"),
prop_goal_type_data},
Modified: trunk/objects/KAOS/metaandorrel.c
==============================================================================
--- trunk/objects/KAOS/metaandorrel.c (original)
+++ trunk/objects/KAOS/metaandorrel.c Sun Apr 27 14:22:12 2008
@@ -164,7 +164,7 @@
/* new name matching "same name, same type" rule */
{ "name", PROP_TYPE_STRING, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL, N_("Text:"), NULL, NULL },
- { "type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE,
+ { "type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE|PROP_FLAG_NO_DEFAULTS,
N_("Type:"), NULL, prop_maor_type_data },
{ "text_pos", PROP_TYPE_POINT, 0,
Modified: trunk/objects/KAOS/metabinrel.c
==============================================================================
--- trunk/objects/KAOS/metabinrel.c (original)
+++ trunk/objects/KAOS/metabinrel.c Sun Apr 27 14:22:12 2008
@@ -169,7 +169,7 @@
static PropDescription mbr_props[] = {
CONNECTION_COMMON_PROPERTIES,
- { "type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE,
+ { "type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE|PROP_FLAG_NO_DEFAULTS,
N_("Type:"), NULL, prop_mbr_type_data },
{ "pm", PROP_TYPE_POINT, 0, "pm", NULL, NULL},
PROP_DESC_END
Modified: trunk/objects/UML/association.c
==============================================================================
--- trunk/objects/UML/association.c (original)
+++ trunk/objects/UML/association.c Sun Apr 27 14:22:12 2008
@@ -236,9 +236,9 @@
{ "name", PROP_TYPE_STRING, PROP_FLAG_VISIBLE, N_("Name"), NULL, NULL },
{ "direction", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE,
N_("Direction"), NULL, prop_assoc_direction_data },
- { "show_direction", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
+ { "show_direction", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL|PROP_FLAG_NO_DEFAULTS,
N_("Show direction"), N_("Show the small arrow denoting the reading direction"), 0 },
- { "assoc_type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
+ { "assoc_type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL|PROP_FLAG_NO_DEFAULTS,
N_("Type"), NULL, prop_assoc_type_data },
PROP_MULTICOL_BEGIN("sides"),
Modified: trunk/objects/UML/component_feature.c
==============================================================================
--- trunk/objects/UML/component_feature.c (original)
+++ trunk/objects/UML/component_feature.c Sun Apr 27 14:22:12 2008
@@ -157,7 +157,7 @@
static PropDescription compfeat_props[] = {
ORTHCONN_COMMON_PROPERTIES,
PROP_STD_LINE_COLOUR_OPTIONAL,
- { "role", PROP_TYPE_ENUM, 0, NULL, NULL, prop_compfeat_type_data },
+ { "role", PROP_TYPE_ENUM, PROP_FLAG_NO_DEFAULTS, NULL, NULL, prop_compfeat_type_data },
{ "text", PROP_TYPE_TEXT, 0, N_("Text"), NULL, NULL },
PROP_STD_TEXT_FONT,
PROP_STD_TEXT_HEIGHT,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]