Re: [Evolution-hackers] discuss about 47549



This patch now in the trunk, not sure if this is important enough to go
into the stable branch.

--Larry

On Mon, 2003-09-29 at 17:44, Larry Ewing wrote:
> It isn't very difficult, I'll try to get to it shortly.
> 
> --Larry
> 
> On Mon, 2003-09-29 at 15:57, Ettore Perazzoli wrote:
> > On Sun, 2003-09-28 at 03:47, Charles Zhang wrote:
> > > What I want to say is:
> > > I suggest that we draw an asterish but not a bullet in the composer 
> > > while the mail in the plain-text format.
> > > Of couse, if the mail is in the html format, we still should draw an 
> > > bullet in the composer.
> > > Thus we get the both sides' viewing corresponding whatever the mail's 
> > > format is.
> > > 
> > > Have I expressed myself clear enough?
> > 
> > Yes, and it makes sense.
> > 
> > I don't know how hard the fix is, but if someone comes up with a patch
> > that does this I think we should put it in.
> 
> _______________________________________________
> evolution-hackers maillist  -  evolution-hackers lists ximian com
> http://lists.ximian.com/mailman/listinfo/evolution-hackers
cvs diff -r 1.293 -r 1.294 htmlclueflow.c
Index: htmlclueflow.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlclueflow.c,v
retrieving revision 1.293
retrieving revision 1.294
diff -u -p -r1.293 -r1.294
--- htmlclueflow.c	25 Sep 2003 15:20:03 -0000	1.293
+++ htmlclueflow.c	30 Sep 2003 00:34:48 -0000	1.294
@@ -55,7 +55,7 @@ static HTMLClueClass *parent_class = NUL
 #define HCF_CLASS(x) HTML_CLUEFLOW_CLASS (HTML_OBJECT (x)->klass)
 
 inline HTMLHAlignType html_clueflow_get_halignment          (HTMLClueFlow *flow);
-static gchar *        get_item_number_str                   (HTMLClueFlow *flow);
+static gchar *        get_item_marker_str                   (HTMLClueFlow *flow, gint level, gboolean ascii_only);
 static guint          get_post_padding                      (HTMLClueFlow *flow, 
 							     guint pad);
 static int            get_similar_depth                     (HTMLClueFlow *self, 
@@ -1089,7 +1089,7 @@ get_roman_value (gint value, gboolean lo
 }
 
 static gchar *
-get_item_number_str (HTMLClueFlow *flow)
+get_item_marker_str (HTMLClueFlow *flow, gint level, gboolean ascii_only)
 {
 	switch (flow->item_type) {
 	case HTML_LIST_TYPE_ORDERED_ARABIC:
@@ -1100,6 +1100,13 @@ get_item_number_str (HTMLClueFlow *flow)
 	case HTML_LIST_TYPE_ORDERED_LOWER_ROMAN:
 	case HTML_LIST_TYPE_ORDERED_UPPER_ROMAN:
 		return get_roman_value (flow->item_number, flow->item_type == HTML_LIST_TYPE_ORDERED_LOWER_ROMAN);
+	case HTML_LIST_TYPE_UNORDERED:
+		if (ascii_only)
+			return g_strdup ("* ");
+		else if (!level || level & 1)
+			return g_strdup ("\342\227\217 "); /* U+25CF BLACK CIRCLE */
+		else
+			return g_strdup ("\342\227\213 "); /* U+25CB WHITE CIRCLE */
 	default:
 		return NULL;
 	}
@@ -1199,7 +1206,7 @@ draw_item (HTMLObject *self, HTMLPainter
 {
 	HTMLClueFlow *flow;
 	HTMLObject *first;
-	gint indent;
+	gchar *marker;
 
 	first = HTML_CLUE (self)->head;
 	if (html_object_is_text (first) && first->next)
@@ -1213,50 +1220,23 @@ draw_item (HTMLObject *self, HTMLPainter
 	} else
 		html_painter_set_pen (painter, &html_colorset_get_color_allocated (painter, HTMLTextColor)->color);
 
-	indent = get_indent (flow, painter);
-	if (flow->item_type == HTML_LIST_TYPE_UNORDERED) {
-		guint bullet_size;
-		gint xp, yp;
-		bullet_size = MAX (3, calc_bullet_size (painter));
-
-		xp = self->x + indent - 2 * bullet_size;	
-		yp = self->y - self->ascent 
-			+ (first->y - first->ascent) 
-			+ (first->ascent + first->descent)/2 
-			- bullet_size/2;
-
-		xp += tx, yp += ty;
-
-		if (flow->levels->len == 0 || (flow->levels->len & 1) != 0)
-			html_painter_fill_rect (painter, xp + 1, yp + 1, bullet_size - 2, bullet_size - 2);
-
-		html_painter_draw_line (painter, xp + 1, yp, xp + bullet_size - 2, yp);
-		html_painter_draw_line (painter, xp + 1, yp + bullet_size - 1,
-					xp + bullet_size - 2, yp + bullet_size - 1);
-		html_painter_draw_line (painter, xp, yp + 1, xp, yp + bullet_size - 2);
-		html_painter_draw_line (painter, xp + bullet_size - 1, yp + 1,
-					xp + bullet_size - 1, yp + bullet_size - 2);
-	} else {
-		gchar *number;
-
-		number = get_item_number_str (flow);
-		if (number) {
-			gint width, len, line_offset = 0, asc, dsc;
-
-			len   = strlen (number);
-			/* FIXME: cache items and glyphs? */
-			html_painter_calc_text_size (painter, number, len, NULL, NULL, 0, &line_offset,
-						     html_clueflow_get_default_font_style (flow), NULL, &width, &asc, &dsc);
-			width += html_painter_get_space_width (painter, html_clueflow_get_default_font_style (flow), NULL);
-			html_painter_set_font_style (painter, html_clueflow_get_default_font_style (flow));
-			html_painter_set_font_face  (painter, NULL);
-			/* FIXME: cache items and glyphs? */
-			html_painter_draw_text (painter, self->x + first->x - width + tx,
-						self->y - self->ascent + first->y + ty,
-						number, strlen (number), NULL, NULL, 0, 0);
-		}
-		g_free (number);
+	marker = get_item_marker_str (flow, flow->levels->len, HTML_IS_PLAIN_PAINTER (painter));
+	if (marker) {
+		gint width, len, line_offset = 0, asc, dsc;
+		
+		len   = g_utf8_strlen (marker, -1);
+		/* FIXME: cache items and glyphs? */
+		html_painter_calc_text_size (painter, marker, len, NULL, NULL, 0, &line_offset,
+					     html_clueflow_get_default_font_style (flow), NULL, &width, &asc, &dsc);
+		width += html_painter_get_space_width (painter, html_clueflow_get_default_font_style (flow), NULL);
+		html_painter_set_font_style (painter, html_clueflow_get_default_font_style (flow));
+		html_painter_set_font_face  (painter, NULL);
+		/* FIXME: cache items and glyphs? */
+		html_painter_draw_text (painter, self->x + first->x - width + tx,
+					self->y - self->ascent + first->y + ty,
+					marker, len, NULL, NULL, 0, 0);
 	}
+	g_free (marker);
 }
 
 static void
@@ -1687,20 +1667,7 @@ write_item_marker (GString *pad_string, 
 {
 	char *marker;
 
-	switch (flow->item_type) {
-	case HTML_LIST_TYPE_ORDERED_ARABIC:
-	case HTML_LIST_TYPE_ORDERED_UPPER_ROMAN:
-	case HTML_LIST_TYPE_ORDERED_LOWER_ROMAN:
-	case HTML_LIST_TYPE_ORDERED_UPPER_ALPHA:
-	case HTML_LIST_TYPE_ORDERED_LOWER_ALPHA:
-		marker = get_item_number_str (flow);
-		break;
-	case HTML_LIST_TYPE_UNORDERED:
-		marker = g_strdup ("* ");
-		break;
-	default:
-		marker = NULL;
-	}
+	marker = get_item_marker_str (flow, flow->levels->len, TRUE);
 
 	if (marker) {
 		gint marker_len = strlen (marker);
cvs diff -r 1.1884 -r 1.1885 ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.1884
retrieving revision 1.1885
diff -u -p -r1.1884 -r1.1885
--- ChangeLog	25 Sep 2003 17:57:10 -0000	1.1884
+++ ChangeLog	30 Sep 2003 00:34:48 -0000	1.1885
@@ -1,3 +1,8 @@
+2003-09-29  Larry Ewing  <lewing ximian com>
+
+	* htmlclueflow.c (get_item_marker_str): use ascii only ("* ") for
+	plain painter, always draw glyphs no speacial path for other chars.
+
 2003-09-25  Radek Doulik  <rodo ximian com>
 
 	* htmltextslave.c (update_lb): don't scale new_ltw by


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