aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2003-03-19 04:49:59 +0800
committerChris Toshok <toshok@src.gnome.org>2003-03-19 04:49:59 +0800
commit529a87dfe59ffffb208bcc3f75f1a3a61b3f72a4 (patch)
tree09e36257b307a03c4ab720b7185fc98397db9810
parentbc9697c7d284b17fb2372068e738cdc5ba671667 (diff)
downloadgsoc2013-evolution-529a87dfe59ffffb208bcc3f75f1a3a61b3f72a4.tar
gsoc2013-evolution-529a87dfe59ffffb208bcc3f75f1a3a61b3f72a4.tar.gz
gsoc2013-evolution-529a87dfe59ffffb208bcc3f75f1a3a61b3f72a4.tar.bz2
gsoc2013-evolution-529a87dfe59ffffb208bcc3f75f1a3a61b3f72a4.tar.lz
gsoc2013-evolution-529a87dfe59ffffb208bcc3f75f1a3a61b3f72a4.tar.xz
gsoc2013-evolution-529a87dfe59ffffb208bcc3f75f1a3a61b3f72a4.tar.zst
gsoc2013-evolution-529a87dfe59ffffb208bcc3f75f1a3a61b3f72a4.zip
add underline_column field.
2003-03-18 Chris Toshok <toshok@ximian.com> * e-cell-text.h: add underline_column field. * e-cell-date.c: add underline_column to the comment. * e-cell-size.c: add underline_column to the comment. * e-cell-text.c (build_layout): handle underline column. (ect_show_tooltip): same. (ect_set_property): same. (ect_get_property): same. (e_cell_text_class_init): same. (e_cell_text_init): same. (e_cell_text_new): add underline_column to the comment. svn path=/trunk/; revision=20347
-rw-r--r--widgets/table/e-cell-date.c15
-rw-r--r--widgets/table/e-cell-size.c22
-rw-r--r--widgets/table/e-cell-text.c49
-rw-r--r--widgets/table/e-cell-text.h1
4 files changed, 60 insertions, 27 deletions
diff --git a/widgets/table/e-cell-date.c b/widgets/table/e-cell-date.c
index 022a3fa517..ce2355197b 100644
--- a/widgets/table/e-cell-date.c
+++ b/widgets/table/e-cell-date.c
@@ -159,13 +159,14 @@ e_cell_date_init (GtkObject *object)
* a finer control of the way the string is displayed. The arguments supported
* allow the control of strikeout, bold, color and a date filter.
*
- * The arguments "strikeout_column", "bold_column" and "color_column" set
- * and return an integer that points to a column in the model that controls
- * these settings. So controlling the way things are rendered is achieved
- * by having special columns in the model that will be used to flag whether
- * the date should be rendered with strikeout, or bolded. In the case of
- * the "color_column" argument, the column in the model is expected to have
- * a string that can be parsed by gdk_color_parse().
+ * The arguments "strikeout_column", "underline_column", "bold_column"
+ * and "color_column" set and return an integer that points to a
+ * column in the model that controls these settings. So controlling
+ * the way things are rendered is achieved by having special columns
+ * in the model that will be used to flag whether the date should be
+ * rendered with strikeout, underline, or bolded. In the case of the
+ * "color_column" argument, the column in the model is expected to
+ * have a string that can be parsed by gdk_color_parse().
*
* Returns: an ECell object that can be used to render dates.
*/
diff --git a/widgets/table/e-cell-size.c b/widgets/table/e-cell-size.c
index a72fc68321..1ba8f6d2e6 100644
--- a/widgets/table/e-cell-size.c
+++ b/widgets/table/e-cell-size.c
@@ -82,17 +82,19 @@ e_cell_size_init (GtkObject *object)
* is interpreted as being a time_t.
*
* The ECellSize object support a large set of properties that can be
- * configured through the Gtk argument system and allows the user to have
- * a finer control of the way the string is displayed. The arguments supported
- * allow the control of strikeout, bold, color and a size filter.
+ * configured through the Gtk argument system and allows the user to
+ * have a finer control of the way the string is displayed. The
+ * arguments supported allow the control of strikeout, underline,
+ * bold, color and a size filter.
*
- * The arguments "strikeout_column", "bold_column" and "color_column" set
- * and return an integer that points to a column in the model that controls
- * these settings. So controlling the way things are rendered is achieved
- * by having special columns in the model that will be used to flag whether
- * the size should be rendered with strikeout, or bolded. In the case of
- * the "color_column" argument, the column in the model is expected to have
- * a string that can be parsed by gdk_color_parse().
+ * The arguments "strikeout_column", "underline_column", "bold_column"
+ * and "color_column" set and return an integer that points to a
+ * column in the model that controls these settings. So controlling
+ * the way things are rendered is achieved by having special columns
+ * in the model that will be used to flag whether the size should be
+ * rendered with strikeout, underline, or bolded. In the case of the
+ * "color_column" argument, the column in the model is expected to
+ * have a string that can be parsed by gdk_color_parse().
*
* Returns: an ECell object that can be used to render file sizes. */
ECell *
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index 6477a91814..c848a369c1 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -80,6 +80,7 @@ enum {
PROP_0,
PROP_STRIKEOUT_COLUMN,
+ PROP_UNDERLINE_COLUMN,
PROP_BOLD_COLUMN,
PROP_COLOR_COLUMN,
PROP_EDITABLE,
@@ -456,7 +457,7 @@ build_layout (ECellTextView *text_view, int row, const char *text)
ECellView *ecell_view = (ECellView *) text_view;
ECellText *ect = E_CELL_TEXT (ecell_view->ecell);
PangoLayout *layout;
- gboolean bold, strikeout;
+ gboolean bold, strikeout, underline;
layout = gtk_widget_create_pango_layout (GTK_WIDGET (((GnomeCanvasItem *)ecell_view->e_table_item_view)->canvas), text);
@@ -466,8 +467,11 @@ build_layout (ECellTextView *text_view, int row, const char *text)
strikeout = ect->strikeout_column >= 0 &&
row >= 0 &&
e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row);
+ underline = ect->underline_column >= 0 &&
+ row >= 0 &&
+ e_table_model_value_at(ecell_view->e_table_model, ect->underline_column, row);
- if (bold || strikeout) {
+ if (bold || strikeout || underline) {
PangoAttrList *attrs;
int length = strlen (text);
attrs = pango_attr_list_new ();
@@ -485,6 +489,13 @@ build_layout (ECellTextView *text_view, int row, const char *text)
pango_attr_list_insert_before (attrs, attr);
}
+ if (underline) {
+ PangoAttribute *attr = pango_attr_underline_new (TRUE);
+ attr->start_index = 0;
+ attr->end_index = length;
+
+ pango_attr_list_insert_before (attrs, attr);
+ }
pango_layout_set_attributes (layout, attrs);
pango_attr_list_unref (attrs);
}
@@ -1286,6 +1297,7 @@ ect_show_tooltip (ECellView *ecell_view,
/* "font_gdk", text_view->font, */
"bold", (gboolean) ect->bold_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->bold_column, row),
"strikeout", (gboolean) ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row),
+ "underline", (gboolean) ect->underline_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->underline_column, row),
"fill_color_gdk", tooltip->foreground,
"text", pango_layout_get_text (layout),
"editable", FALSE,
@@ -1363,6 +1375,10 @@ ect_set_property (GObject *object,
text->strikeout_column = g_value_get_int (value);
break;
+ case PROP_UNDERLINE_COLUMN:
+ text->underline_column = g_value_get_int (value);
+ break;
+
case PROP_BOLD_COLUMN:
text->bold_column = g_value_get_int (value);
break;
@@ -1400,6 +1416,10 @@ ect_get_property (GObject *object,
g_value_set_int (value, text->strikeout_column);
break;
+ case PROP_UNDERLINE_COLUMN:
+ g_value_set_int (value, text->underline_column);
+ break;
+
case PROP_BOLD_COLUMN:
g_value_set_int (value, text->bold_column);
break;
@@ -1469,6 +1489,13 @@ e_cell_text_class_init (GObjectClass *object_class)
0, G_MAXINT, 0,
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class, PROP_UNDERLINE_COLUMN,
+ g_param_spec_int ("underline_column",
+ _("Underline Column"),
+ /*_( */"XXX blurb" /*)*/,
+ 0, G_MAXINT, 0,
+ G_PARAM_READWRITE));
+
g_object_class_install_property (object_class, PROP_BOLD_COLUMN,
g_param_spec_int ("bold_column",
_("Bold Column"),
@@ -1516,6 +1543,7 @@ e_cell_text_init (ECellText *ect)
ect->ellipsis = g_strdup (ellipsis_default);
ect->use_ellipsis = use_ellipsis_default;
ect->strikeout_column = -1;
+ ect->underline_column = -1;
ect->bold_column = -1;
ect->color_column = -1;
ect->bg_color_column = -1;
@@ -1555,15 +1583,16 @@ e_cell_text_construct (ECellText *cell, const char *fontname, GtkJustification j
* The ECellText object support a large set of properties that can be
* configured through the Gtk argument system and allows the user to have
* a finer control of the way the string is displayed. The arguments supported
- * allow the control of strikeout, bold, and color.
+ * allow the control of strikeout, underline, bold, and color.
*
- * The arguments "strikeout_column", "bold_column" and "color_column" set
- * and return an integer that points to a column in the model that controls
- * these settings. So controlling the way things are rendered is achieved
- * by having special columns in the model that will be used to flag whether
- * the text should be rendered with strikeout, or bolded. In the case of
- * the "color_column" argument, the column in the model is expected to have
- * a string that can be parsed by gdk_color_parse().
+ * The arguments "strikeout_column", "underline_column", "bold_column"
+ * and "color_column" set and return an integer that points to a
+ * column in the model that controls these settings. So controlling
+ * the way things are rendered is achieved by having special columns
+ * in the model that will be used to flag whether the text should be
+ * rendered with strikeout, or bolded. In the case of the
+ * "color_column" argument, the column in the model is expected to
+ * have a string that can be parsed by gdk_color_parse().
*
* Returns: an ECell object that can be used to render strings.
*/
diff --git a/widgets/table/e-cell-text.h b/widgets/table/e-cell-text.h
index cad1c836a8..466fc54f1a 100644
--- a/widgets/table/e-cell-text.h
+++ b/widgets/table/e-cell-text.h
@@ -65,6 +65,7 @@ typedef struct {
guint editable : 1; /* Whether the text can be edited. */
int strikeout_column;
+ int underline_column;
int bold_column;
/* This column in the ETable should return a string specifying a color,