dia r3925 - in trunk: . lib objects/UML
- From: hans svn gnome org
- To: svn-commits-list gnome org
- Subject: dia r3925 - in trunk: . lib objects/UML
- Date: Sun, 6 Apr 2008 16:40:47 +0100 (BST)
Author: hans
Date: Sun Apr 6 16:40:46 2008
New Revision: 3925
URL: http://svn.gnome.org/viewvc/dia?rev=3925&view=rev
Log:
2008-04-06 Hans Breuer <hans breuer org>
* objects/UML/class.c : switching comment visibility via object menu
produced an invalid change object: bug #512848
* lib/objchange.c(new_object_state_change): g_return_val_if_fail()
on invalid arguments
* objects/UML/class_dialog.c : a lot of stuff from the 'UML - Class'
was not considered for undo
* lib/newgroup.c : only avoid linking app/ for G_OS_WIN32 does _not_
fix the crash from bug #505513
Modified:
trunk/ChangeLog
trunk/lib/newgroup.c
trunk/lib/objchange.c
trunk/objects/UML/class.c
trunk/objects/UML/class_dialog.c
Modified: trunk/lib/newgroup.c
==============================================================================
--- trunk/lib/newgroup.c (original)
+++ trunk/lib/newgroup.c Sun Apr 6 16:40:46 2008
@@ -283,7 +283,7 @@
/* Remove the group object that stayed at the start of the list,
leaving only the children */
children = g_list_remove_link(children, children);
-#if 0 /* this introduces a crircular dependency, does not work on win32 and is bad style everywhere */
+#ifndef G_OS_WIN32 /* this introduces a crircular dependency, does not work on win32 and is bad style everywhere */
diagram_unselect_objects(layer_get_parent_diagram(layer), children);
#else
g_warning ("used to call diagram_unselect_objects()");
Modified: trunk/lib/objchange.c
==============================================================================
--- trunk/lib/objchange.c (original)
+++ trunk/lib/objchange.c Sun Apr 6 16:40:46 2008
@@ -61,6 +61,8 @@
{
ObjectStateChange *change;
+ g_return_val_if_fail (get_state != NULL && set_state != NULL, NULL);
+
change = g_new(ObjectStateChange, 1);
change->obj_change.apply =
Modified: trunk/objects/UML/class.c
==============================================================================
--- trunk/objects/UML/class.c (original)
+++ trunk/objects/UML/class.c Sun Apr 6 16:40:46 2008
@@ -322,9 +322,32 @@
return ¨class_menu;
}
-ObjectChange *umlclass_show_comments_callback(DiaObject *obj, Point *pos, gpointer data)
+typedef struct _CommentState {
+ ObjectState state;
+ gboolean visible_comments;
+} CommentState;
+static ObjectState*
+_comment_get_state (DiaObject *obj)
+{
+ CommentState *state = g_new (CommentState,1);
+ state->state.free = NULL; /* we don't have any pointers to free */
+ state->visible_comments = ((UMLClass *)obj)->visible_comments;
+ return (ObjectState *)state;
+}
+static void
+_comment_set_state (DiaObject *obj, ObjectState *state)
+{
+ ((UMLClass *)obj)->visible_comments = ((CommentState *)state)->visible_comments;
+ g_free (state); /* rather strange convention set_state consumes the state */
+ umlclass_calculate_data((UMLClass *)obj);
+ umlclass_update_data((UMLClass *)obj);
+}
+
+ObjectChange *
+umlclass_show_comments_callback(DiaObject *obj, Point *pos, gpointer data)
{
- ObjectChange *change = new_object_state_change(obj, NULL, NULL, NULL );
+ ObjectState *old_state = _comment_get_state(obj);
+ ObjectChange *change = new_object_state_change(obj, old_state, _comment_get_state, _comment_set_state );
((UMLClass *)obj)->visible_comments = !((UMLClass *)obj)->visible_comments;
umlclass_calculate_data((UMLClass *)obj);
Modified: trunk/objects/UML/class_dialog.c
==============================================================================
--- trunk/objects/UML/class_dialog.c (original)
+++ trunk/objects/UML/class_dialog.c Sun Apr 6 16:40:46 2008
@@ -53,13 +53,39 @@
typedef struct _UMLClassState UMLClassState;
struct _UMLClassState {
+ real font_height;
+ real abstract_font_height;
+ real polymorphic_font_height;
+ real classname_font_height;
+ real abstract_classname_font_height;
+ real comment_font_height;
+
+ DiaFont *normal_font;
+ DiaFont *abstract_font;
+ DiaFont *polymorphic_font;
+ DiaFont *classname_font;
+ DiaFont *abstract_classname_font;
+ DiaFont *comment_font;
+
char *name;
char *stereotype;
+ char *comment;
+
int abstract;
int suppress_attributes;
int suppress_operations;
int visible_attributes;
int visible_operations;
+ int visible_comments;
+
+ int wrap_operations;
+ int wrap_after_char;
+ int comment_line_length;
+ int comment_tagging;
+
+ Color line_color;
+ Color fill_color;
+ Color text_color;
/* Attributes: */
GList *attributes;
@@ -2938,8 +2964,16 @@
{
GList *list;
+ g_object_unref (state->normal_font);
+ g_object_unref (state->abstract_font);
+ g_object_unref (state->polymorphic_font);
+ g_object_unref (state->classname_font);
+ g_object_unref (state->abstract_classname_font);
+ g_object_unref (state->comment_font);
+
g_free(state->name);
g_free(state->stereotype);
+ g_free(state->comment);
list = state->attributes;
while (list) {
@@ -2969,15 +3003,39 @@
UMLClassState *state = g_new0(UMLClassState, 1);
GList *list;
+ state->font_height = umlclass->font_height;
+ state->abstract_font_height = umlclass->abstract_font_height;
+ state->polymorphic_font_height = umlclass->polymorphic_font_height;
+ state->classname_font_height = umlclass->classname_font_height;
+ state->abstract_classname_font_height = umlclass->abstract_classname_font_height;
+ state->comment_font_height = umlclass->comment_font_height;
+
+ state->normal_font = g_object_ref (umlclass->normal_font);
+ state->abstract_font = g_object_ref (umlclass->abstract_font);
+ state->polymorphic_font = g_object_ref (umlclass->polymorphic_font);
+ state->classname_font = g_object_ref (umlclass->classname_font);
+ state->abstract_classname_font = g_object_ref (umlclass->abstract_classname_font);
+ state->comment_font = g_object_ref (umlclass->comment_font);
+
state->name = g_strdup(umlclass->name);
state->stereotype = g_strdup(umlclass->stereotype);
+ state->comment = g_strdup(umlclass->comment);
state->abstract = umlclass->abstract;
state->suppress_attributes = umlclass->suppress_attributes;
state->suppress_operations = umlclass->suppress_operations;
state->visible_attributes = umlclass->visible_attributes;
state->visible_operations = umlclass->visible_operations;
+ state->visible_comments = umlclass->visible_comments;
+ state->wrap_operations = umlclass->wrap_operations;
+ state->wrap_after_char = umlclass->wrap_after_char;
+ state->comment_line_length = umlclass->comment_line_length;
+ state->comment_tagging = umlclass->comment_tagging;
+
+ state->line_color = umlclass->line_color;
+ state->fill_color = umlclass->fill_color;
+ state->text_color = umlclass->text_color;
state->attributes = NULL;
list = umlclass->attributes;
@@ -3102,14 +3160,46 @@
static void
umlclass_set_state(UMLClass *umlclass, UMLClassState *state)
{
+ umlclass->font_height = state->font_height;
+ umlclass->abstract_font_height = state->abstract_font_height;
+ umlclass->polymorphic_font_height = state->polymorphic_font_height;
+ umlclass->classname_font_height = state->classname_font_height;
+ umlclass->abstract_classname_font_height = state->abstract_classname_font_height;
+ umlclass->comment_font_height = state->comment_font_height;
+
+ /* transfer ownership, but don't leak the previous font */
+ g_object_unref (umlclass->normal_font);
+ umlclass->normal_font = state->normal_font;
+ g_object_unref (umlclass->abstract_font);
+ umlclass->abstract_font = state->abstract_font;
+ g_object_unref (umlclass->polymorphic_font);
+ umlclass->polymorphic_font = state->polymorphic_font;
+ g_object_unref (umlclass->classname_font);
+ umlclass->classname_font = state->classname_font;
+ g_object_unref (umlclass->abstract_classname_font);
+ umlclass->abstract_classname_font = state->abstract_classname_font;
+ g_object_unref (umlclass->comment_font);
+ umlclass->comment_font = state->comment_font;
+
umlclass->name = state->name;
umlclass->stereotype = state->stereotype;
+ umlclass->comment = state->comment;
umlclass->abstract = state->abstract;
umlclass->suppress_attributes = state->suppress_attributes;
umlclass->suppress_operations = state->suppress_operations;
umlclass->visible_attributes = state->visible_attributes;
umlclass->visible_operations = state->visible_operations;
+ umlclass->visible_comments = state->visible_comments;
+
+ umlclass->wrap_operations = state->wrap_operations;
+ umlclass->wrap_after_char = state->wrap_after_char;
+ umlclass->comment_line_length = state->comment_line_length;
+ umlclass->comment_tagging = state->comment_tagging;
+
+ umlclass->line_color = state->line_color;
+ umlclass->fill_color = state->fill_color;
+ umlclass->text_color = state->text_color;
umlclass->attributes = state->attributes;
umlclass->operations = state->operations;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]