PATCH: fix gnome-druid-edge



It appears the edge druid has been suffering bitrot so that when I ported
gnome-lokkit to gnome-2.0 it broke.

The patch fixes

1.	Remove x_set/y_set canvas properties that no longer exist
2.	Remove the use of "fontset" canvas properties that no longer exist
3.	Use pango markup for the title text  (as druid-standard does)
4.	Adjust the various constants to reflect gnome-druid-standard changes
	Now when you mix edge and standard druid pages they match up
5.	Adjust the icon layout to match the standard druid
6.	Fix an off by one in the left hand image positioning
7.	Fix the image positions that were broken by past canvas changes
8.	Stop text wrapping into the left hand logo area

This fixes all but one remaining text layout issue. That is caused by
the fact "text_width" is broken in the canvas and needs to be fixed there
not in the druid.

Both druids (standard and edge) still fail when the window mangler reduces
them below the gtk hinted minimum size [try viewing one on an iPAQ] but
thats a seperate issue.

For changelog purposes theses changes are Alan Cox <alan redhat com> and
(C) Copyright 2001 Red Hat Inc. Licensed under the LGPL v2.0 or later.

PS: libgnomeui claims to be GPL not LGPL. I though that was not the
plan - did someone use the wrong COPYING file in the toplevel dir 


--- gnome-druid-page-edge.c.orig	Thu Sep 20 14:34:12 2001
+++ gnome-druid-page-edge.c	Thu Sep 20 21:09:46 2001
@@ -61,9 +61,9 @@
 						 GtkWidget                      *druid,
 						 gpointer 			*data);
 
-#define LOGO_WIDTH 50.0
+#define LOGO_WIDTH 48.0
 #define DRUID_PAGE_HEIGHT 318
-#define DRUID_PAGE_WIDTH 516
+#define DRUID_PAGE_WIDTH 508
 #define DRUID_PAGE_LEFT_WIDTH 100.0
 #define GDK_COLOR_TO_RGBA(color) GNOME_CANVAS_COLOR ((color).red/256, (color).green/256, (color).blue/256)
 
@@ -208,14 +208,15 @@
 	gfloat watermark_width;
 	gfloat watermark_height;
 	gfloat watermark_ypos;
+	gfloat logo_width, logo_height;
 	int width, height;
 
 	width = GTK_WIDGET (druid_page_edge)->allocation.width;
 	height = GTK_WIDGET (druid_page_edge)->allocation.height;
 
 	watermark_width = DRUID_PAGE_LEFT_WIDTH;
-	watermark_height = (gfloat) height - LOGO_WIDTH + GNOME_PAD * 2.0;
-	watermark_ypos = LOGO_WIDTH + GNOME_PAD * 2.0;
+	watermark_height = (gfloat) height - 52;
+	watermark_ypos = 52.0;
 
 	if (druid_page_edge->watermark_image) {
 		watermark_width = gdk_pixbuf_get_width (druid_page_edge->watermark_image);
@@ -234,46 +235,62 @@
 			       "y2", (double) height,
 			       NULL);
 	gnome_canvas_item_set (druid_page_edge->_priv->textbox_item,
-			       "x1", (double) watermark_width,
-			       "y1", (double) (LOGO_WIDTH + GNOME_PAD * 2.0),
+			       "x1", (double) watermark_width+1,
+			       "y1", (double) 52.0,
 			       "x2", (double) width,
 			       "y2", (double) height,
 			       NULL);
 	if (druid_page_edge->logo_image != NULL) {
+		/*
+		 *	The extra gymnastics make us do the same as gnome_druid_standard
+		 *	does for this layout.
+		 */
+		logo_width = gdk_pixbuf_get_width (druid_page_edge->logo_image);
+		logo_height = gdk_pixbuf_get_height (druid_page_edge->logo_image);
 		gnome_canvas_item_show (druid_page_edge->_priv->logoframe_item);
 		gnome_canvas_item_set (druid_page_edge->_priv->logoframe_item,
-				       "x1", (double) (width - LOGO_WIDTH -GNOME_PAD),
-				       "y1", (double) (GNOME_PAD),
-				       "x2", (double) (width - GNOME_PAD),
-				       "y2", (double) (GNOME_PAD + LOGO_WIDTH),
+				       "x1", (double) (width - LOGO_WIDTH - 2),
+				       "y1", (double) 2.0,
+				       "x2", (double) (width - LOGO_WIDTH + logo_width - 2),
+				       "y2", (double) (2.0 + logo_height),
 				       "width_units", 1.0,
 				       NULL);
 	} else {
 		gnome_canvas_item_hide (druid_page_edge->_priv->logoframe_item);
 	}
 	gnome_canvas_item_set (druid_page_edge->_priv->logo_item,
-			       "x", (double) (width - GNOME_PAD - LOGO_WIDTH),
-			       "y", (double) (GNOME_PAD),
-			       "width", (double) (LOGO_WIDTH),
-			       "height", (double) (LOGO_WIDTH),
+			       "x", (double) (width - (LOGO_WIDTH+2)),
+			       "y", (double) 2,
+			       "anchor", GTK_ANCHOR_NORTH_WEST,
 			       NULL);
 	gnome_canvas_item_set (druid_page_edge->_priv->watermark_item,
 			       "x", 0.0,
 			       "y", (double) watermark_ypos,
-			       "width", (double) watermark_width,
+			       "width", (double) watermark_width-1,	/* WHY ?? */
 			       "height", (double) watermark_height,
+			       "anchor", GTK_ANCHOR_NORTH_WEST,
 			       NULL);
 
 	gnome_canvas_item_set (druid_page_edge->_priv->title_item,
 			       "x", 15.0,
-			       "y", (double) (GNOME_PAD + LOGO_WIDTH / 2.0),
+			       "y", (double) LOGO_WIDTH/2 + 2,
 			       "anchor", GTK_ANCHOR_WEST,
 			       NULL);
 	gnome_canvas_item_set (druid_page_edge->_priv->text_item,
-			       "x", (double) (((width - watermark_width) * 0.5) + watermark_width),
+			       "x", (double) watermark_width + GNOME_PAD,
 			       "y", (double) (LOGO_WIDTH + GNOME_PAD * 2.0 + (height - (LOGO_WIDTH + GNOME_PAD * 2.0))/ 2.0),
-			       "anchor", GTK_ANCHOR_CENTER,
+			       "text_width", (double) width - watermark_width - 2 * GNOME_PAD, 
+			       "anchor", GTK_ANCHOR_WEST,
 			       NULL);
+			       
+	/*
+	 *	FIXME: At this point we should check the text actually fits.
+	 *	If not then we can lose the watermark. Possibly one day we
+	 *	should add scrollbars too but thats tricky without redoing
+	 *	this widget into 3 canvasses (which would actually be MUCH
+	 *	saner). Fortunately we can do this later without changing
+	 *	the API.
+	 */
 }
 
 static void
@@ -281,7 +298,9 @@
 {
 	GnomeCanvas *canvas;
 	guint32 fill_color;
-
+	gchar *title_markup;
+	gchar *title = druid_page_edge->title;
+	
 	canvas = GNOME_CANVAS (druid_page_edge->_priv->canvas);
 
 	/* set up the rest of the page */
@@ -314,8 +333,6 @@
 				       GNOME_TYPE_CANVAS_PIXBUF,
 				       "x", 0.0,
 				       "y", 0.0,
-				       "x_set", TRUE,
-				       "y_set", TRUE,
 				       NULL);
 
 	if (druid_page_edge->top_watermark_image != NULL)
@@ -326,8 +343,6 @@
 	druid_page_edge->_priv->logo_item =
 		gnome_canvas_item_new (gnome_canvas_root (canvas),
 				       GNOME_TYPE_CANVAS_PIXBUF,
-				       "x_set", TRUE,
-				       "y_set", TRUE,
 				       NULL);
 
 	if (druid_page_edge->logo_image != NULL)
@@ -337,8 +352,6 @@
 	druid_page_edge->_priv->watermark_item =
 		gnome_canvas_item_new (gnome_canvas_root (canvas),
 				       GNOME_TYPE_CANVAS_PIXBUF,
-				       "x_set", TRUE,
-				       "y_set", TRUE,
 				       NULL);
 
 	if (druid_page_edge->watermark_image != NULL)
@@ -347,21 +360,24 @@
 				       NULL);
 
 	fill_color = GDK_COLOR_TO_RGBA (druid_page_edge->title_color);
+	
+	title_markup = g_strconcat ("<span size=\"xx-large\" weight=\"ultrabold\">", 
+	                              title ? title : "", "</span>", NULL);
 	druid_page_edge->_priv->title_item =
 		gnome_canvas_item_new (gnome_canvas_root (canvas),
 				       GNOME_TYPE_CANVAS_TEXT,
-				       "text", druid_page_edge->title,
+				       "markup", title_markup,
 				       "fill_color_rgba", fill_color,
-				       "fontset", _("-adobe-helvetica-bold-r-normal-*-*-180-*-*-p-*-*-*,*-r-*"),
 				       NULL);
 
+	g_free(title_markup);
+	
 	fill_color = GDK_COLOR_TO_RGBA (druid_page_edge->text_color);
 	druid_page_edge->_priv->text_item =
 		gnome_canvas_item_new (gnome_canvas_root (canvas),
 				       GNOME_TYPE_CANVAS_TEXT,
 				       "text", druid_page_edge->text,
 				       "justification", GTK_JUSTIFY_LEFT,
-				       "fontset", _("-adobe-helvetica-medium-r-normal-*-*-120-*-*-p-*-*-*,*-r-*"),
 				       "fill_color_rgba", fill_color,
 				       NULL);
 





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