dia r4169 - in trunk: . app lib objects/UML objects/standard plug-ins/cairo plug-ins/python



Author: hans
Date: Fri Jan  2 15:40:52 2009
New Revision: 4169
URL: http://svn.gnome.org/viewvc/dia?rev=4169&view=rev

Log:
2009-01-02  Hans Breuer  <hans breuer org>

	* app/preferences.c : don't try to set transient without shell
	
	* lib/prop_text.c : don't leak prop->attr.font
	* object/standard/textobj.c : fixed accordingly
	
	* objects/UML/class.c(umlclass_copy) : don't use a font reference 
	where a copy is needed
	
	* plug-ins/cairo/diacairo.c : fix scaling for clipboard use

	* plug-ins/python/diamodule.c : whitespace changes

	* plug-ins/python/group_props.py : better error message for missing 
	pygtk (bug #563094)



Modified:
   trunk/ChangeLog
   trunk/app/preferences.c
   trunk/lib/prop_text.c
   trunk/objects/UML/class.c
   trunk/objects/standard/textobj.c
   trunk/plug-ins/cairo/diacairo.c
   trunk/plug-ins/python/diamodule.c
   trunk/plug-ins/python/group_props.py

Modified: trunk/app/preferences.c
==============================================================================
--- trunk/app/preferences.c	(original)
+++ trunk/app/preferences.c	Fri Jan  2 15:40:52 2009
@@ -750,6 +750,10 @@
 update_floating_toolbox(DiaPrefData *pref, gpointer ptr)
 {
   g_return_if_fail (pref->key == NULL);
+
+  if (!app_is_interactive())
+    return;
+
   if (prefs.toolbox_on_top) {
     /* Go through all diagrams and set toolbox transient for all displays */
     GList *diagrams;
@@ -765,8 +769,9 @@
       }
     }
   } else {
-    gtk_window_set_transient_for(GTK_WINDOW(interface_get_toolbox_shell()),
-				 NULL);
+    GtkWindow *shell = GTK_WINDOW(interface_get_toolbox_shell());
+    if (shell)
+      gtk_window_set_transient_for(shell, NULL);
   }
 }
 

Modified: trunk/lib/prop_text.c
==============================================================================
--- trunk/lib/prop_text.c	(original)
+++ trunk/lib/prop_text.c	Fri Jan  2 15:40:52 2009
@@ -376,6 +376,8 @@
 static void 
 textprop_free(TextProperty *prop) 
 {
+  if (prop->attr.font)
+    dia_font_unref(prop->attr.font);
   g_free(prop->text_data);
   g_free(prop);
 }

Modified: trunk/objects/UML/class.c
==============================================================================
--- trunk/objects/UML/class.c	(original)
+++ trunk/objects/UML/class.c	Fri Jan  2 15:40:52 2009
@@ -1923,17 +1923,17 @@
           umlclass->comment_font_height;
 
   newumlclass->normal_font =
-          dia_font_ref(umlclass->normal_font);
+          dia_font_copy(umlclass->normal_font);
   newumlclass->abstract_font =
-          dia_font_ref(umlclass->abstract_font);
+          dia_font_copy(umlclass->abstract_font);
   newumlclass->polymorphic_font =
-          dia_font_ref(umlclass->polymorphic_font);
+          dia_font_copy(umlclass->polymorphic_font);
   newumlclass->classname_font =
-          dia_font_ref(umlclass->classname_font);
+          dia_font_copy(umlclass->classname_font);
   newumlclass->abstract_classname_font =
-          dia_font_ref(umlclass->abstract_classname_font);
+          dia_font_copy(umlclass->abstract_classname_font);
   newumlclass->comment_font =
-          dia_font_ref(umlclass->comment_font);
+          dia_font_copy(umlclass->comment_font);
 
   newumlclass->name = g_strdup(umlclass->name);
   if (umlclass->stereotype != NULL && umlclass->stereotype[0] != '\0')

Modified: trunk/objects/standard/textobj.c
==============================================================================
--- trunk/objects/standard/textobj.c	(original)
+++ trunk/objects/standard/textobj.c	Fri Jan  2 15:40:52 2009
@@ -326,6 +326,7 @@
 textobj_destroy(Textobj *textobj)
 {
   text_destroy(textobj->text);
+  dia_font_unref(textobj->attrs.font);
   object_destroy(&textobj->object);
 }
 

Modified: trunk/plug-ins/cairo/diacairo.c
==============================================================================
--- trunk/plug-ins/cairo/diacairo.c	(original)
+++ trunk/plug-ins/cairo/diacairo.c	Fri Jan  2 15:40:52 2009
@@ -30,10 +30,6 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-#ifdef HAVE_PANGOCAIRO_H
-#include <pango/pangocairo.h>
-#endif
-
 /*
  * To me the following looks rather suspicious. Why do we need to compile
  * the Cairo plug-in at all if we don't have Cairo? As a result we'll
@@ -68,6 +64,10 @@
 #  endif
 #endif
 
+#ifdef HAVE_PANGOCAIRO_H
+#include <pango/pangocairo.h>
+#endif
+
 #include "intl.h"
 #include "message.h"
 #include "geometry.h"
@@ -195,14 +195,13 @@
   case OUTPUT_WMF : /* different only on close/'play' */
   case OUTPUT_CLIPBOARD :
     /* NOT: renderer->with_alpha = TRUE; */
-    renderer->scale = 72.0;
     {
       /* see wmf/wmf.cpp */
       HDC  refDC = GetDC(NULL);
       RECT bbox = { 0, 0, 
-#if 0
-                   (int)((data->extents.right - data->extents.left) * renderer->scale * GetDeviceCaps(refDC, LOGPIXELSX)),
-		   (int)((data->extents.bottom - data->extents.top) * renderer->scale * GetDeviceCaps(refDC, LOGPIXELSY)) };
+#if 1 /* CreateEnhMetaFile() takes 0.01 mm */
+                   (int)((data->extents.right - data->extents.left) * data->paper.scaling * 1000.0),
+		   (int)((data->extents.bottom - data->extents.top) * data->paper.scaling * 1000.0) };
 #else
                    (int)((data->extents.right - data->extents.left) * renderer->scale 
 		          * 100 * GetDeviceCaps(refDC, HORZSIZE) / GetDeviceCaps(refDC, HORZRES)),
@@ -211,6 +210,8 @@
 #endif
       hFileDC = CreateEnhMetaFile (refDC, NULL, &bbox, "DiaCairo\0Diagram\0");
       renderer->surface = cairo_win32_printing_surface_create (hFileDC);
+      /* CreateEnhMetaFile() takes resolution 0.01 mm,  */
+      renderer->scale = 1000.0/25.4 * data->paper.scaling;
     }
     break;
 #endif

Modified: trunk/plug-ins/python/diamodule.c
==============================================================================
--- trunk/plug-ins/python/diamodule.c	(original)
+++ trunk/plug-ins/python/diamodule.c	Fri Jan  2 15:40:52 2009
@@ -432,7 +432,7 @@
 static PyObject *
 PyDia_RegisterAction (PyObject *self, PyObject *args)
 {
-	gchar *action;
+    gchar *action;
     gchar *desc;
     gchar *menupath;
     PyObject *func;
@@ -442,7 +442,7 @@
 			  &action, &desc, &menupath, &func))
 	return NULL;
 
-	return _RegisterAction (action, desc, menupath, func);
+    return _RegisterAction (action, desc, menupath, func);
 }
 
 static PyObject *

Modified: trunk/plug-ins/python/group_props.py
==============================================================================
--- trunk/plug-ins/python/group_props.py	(original)
+++ trunk/plug-ins/python/group_props.py	Fri Jan  2 15:40:52 2009
@@ -168,7 +168,10 @@
 			for v in uniques.keys() :
 				allProps[s].opts.append(uniques[v])
 	# display the dialog
-	dlg = CPropsDialog(d, data, allProps)
+	try :
+		dlg = CPropsDialog(d, data, allProps)
+	except ImportError :
+		dia.message(0, "Dialog creation failed. Missing pygtk?")
 
 dia.register_action ("DialogsGroupproperties", "Dia Group Properties", 
                       "/DisplayMenu/Dialogs/DialogsExtensionStart", 



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