aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Toshok <toshok@helixcode.com>2000-12-07 07:25:06 +0800
committerChris Toshok <toshok@src.gnome.org>2000-12-07 07:25:06 +0800
commit517cb96a31bc20a9b62609a4bdfa35d10a93a020 (patch)
tree5ae929045248265fa2263c464885097a2bbc4624
parent6dc395e2641eb93323879e9dac7980d27a8ba878 (diff)
downloadgsoc2013-evolution-517cb96a31bc20a9b62609a4bdfa35d10a93a020.tar.gz
gsoc2013-evolution-517cb96a31bc20a9b62609a4bdfa35d10a93a020.tar.zst
gsoc2013-evolution-517cb96a31bc20a9b62609a4bdfa35d10a93a020.zip
pass along the column's width to e_cell_show_tooltip.
2000-12-06 Chris Toshok <toshok@helixcode.com> * e-table-item.c (_do_tooltip): pass along the column's width to e_cell_show_tooltip. * e-cell-text.c (ect_show_tooltip): add col_width argument, and set cell.width = col_width - 8 (to mimic what happens in build_current_cell, but with a possibly altered width). * e-cell.c (e_cell_show_tooltip): add col_width argument, and pass along to virtual function. (ec_show_tooltip): add col_width argument. * e-cell.h: change prototype of e_cell_show_tooltip to include a width parameter. * e-cell-tree.c (ect_show_tooltip): send the width - the subcell's offset to e_cell_show_tooltip. svn path=/trunk/; revision=6831
-rw-r--r--widgets/table/e-cell-text.c8
-rw-r--r--widgets/table/e-cell-tree.c12
-rw-r--r--widgets/table/e-cell.c6
-rw-r--r--widgets/table/e-cell.h4
-rw-r--r--widgets/table/e-table-item.c1
5 files changed, 14 insertions, 17 deletions
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index 05742b6e70..5a1251cf01 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -1342,6 +1342,7 @@ ect_show_tooltip (ECellView *ecell_view,
int model_col,
int view_col,
int row,
+ int col_width,
ETableTooltip *tooltip)
{
ECellTextView *text_view = (ECellTextView *) ecell_view;
@@ -1366,6 +1367,7 @@ ect_show_tooltip (ECellView *ecell_view,
tooltip->timer = 0;
build_current_cell (&cell, text_view, model_col, view_col, row);
+ cell.width = col_width - 8;
split_into_lines (&cell);
calc_line_widths (&cell);
@@ -2444,7 +2446,7 @@ calc_ellipsis (ECellTextView *text_view)
EFont *font;
font = text_view->font;
- if (font)
+ if (font) {
text_view->ellipsis_width[E_FONT_PLAIN] =
e_font_utf8_text_width (font, E_FONT_PLAIN,
ect->ellipsis ? ect->ellipsis : "...",
@@ -2453,6 +2455,7 @@ calc_ellipsis (ECellTextView *text_view)
e_font_utf8_text_width (font, E_FONT_BOLD,
ect->ellipsis ? ect->ellipsis : "...",
ect->ellipsis ? strlen (ect->ellipsis) : 3);
+ }
}
/* Calculates the line widths (in pixels) of the text's splitted lines */
@@ -2493,8 +2496,9 @@ calc_line_widths (CurrentCell *cell)
lines->ellipsis_length = 0;
for (j = 0; j < lines->length; j++){
if (e_font_utf8_text_width (font, cell->style, lines->text, j) +
- text_view->ellipsis_width[cell->style] <= cell->width)
+ text_view->ellipsis_width[cell->style] < cell->width) {
lines->ellipsis_length = j;
+ }
else
break;
}
diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c
index 7390d0e284..6de490cd29 100644
--- a/widgets/table/e-cell-tree.c
+++ b/widgets/table/e-cell-tree.c
@@ -417,18 +417,12 @@ ect_max_width (ECellView *ecell_view, int model_col, int view_col)
*/
static void
ect_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row,
- ETableTooltip *tooltip)
+ int col_width, ETableTooltip *tooltip)
{
ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
ETreeModel *tree_model = e_cell_tree_get_tree_model (ecell_view->e_table_model, row);
ETreePath *node = e_cell_tree_get_node (ecell_view->e_table_model, row);
int offset = offset_of_node (tree_model, node);
-
- {
- tooltip->x += offset;
- e_cell_show_tooltip(tree_view->subcell_view, model_col, view_col, row, tooltip);
- }
-#if 0
GdkPixbuf *node_image;
node_image = e_tree_model_icon_of_node (tree_model, node);
@@ -436,12 +430,10 @@ ect_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row,
offset += gdk_pixbuf_get_width (node_image);
/* if the tooltip happened in the subcell, then handle it */
-
if (tooltip->cx > offset) {
tooltip->x += offset;
- e_cell_show_tooltip (tree_view->subcell_view, model_col, view_col, row, tooltip);
+ e_cell_show_tooltip (tree_view->subcell_view, model_col, view_col, row, col_width - offset, tooltip);
}
-#endif
}
/*
diff --git a/widgets/table/e-cell.c b/widgets/table/e-cell.c
index 50e62656d0..b4f01d6dde 100644
--- a/widgets/table/e-cell.c
+++ b/widgets/table/e-cell.c
@@ -90,7 +90,7 @@ ec_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void
}
static void
-ec_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row, ETableTooltip *tooltip)
+ec_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row, int col_width, ETableTooltip *tooltip)
{
/* Do nothing */
}
@@ -332,8 +332,8 @@ e_cell_max_width (ECellView *ecell_view, int model_col, int view_col)
void
e_cell_show_tooltip (ECellView *ecell_view, int model_col, int view_col,
- int row, ETableTooltip *tooltip)
+ int row, int col_width, ETableTooltip *tooltip)
{
return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->show_tooltip
- (ecell_view, model_col, view_col, row, tooltip);
+ (ecell_view, model_col, view_col, row, col_width, tooltip);
}
diff --git a/widgets/table/e-cell.h b/widgets/table/e-cell.h
index 14bf8c1a35..faaf23b916 100644
--- a/widgets/table/e-cell.h
+++ b/widgets/table/e-cell.h
@@ -75,7 +75,7 @@ typedef struct {
gdouble (*print_height) (ECellView *ecell_view, GnomePrintContext *context,
int model_col, int view_col, int row, gdouble width);
int (*max_width) (ECellView *ecell_view, int model_col, int view_col);
- void (*show_tooltip) (ECellView *ecell_view, int model_col, int view_col, int row, ETableTooltip *tooltip);
+ void (*show_tooltip) (ECellView *ecell_view, int model_col, int view_col, int row, int col_width, ETableTooltip *tooltip);
} ECellClass;
GtkType e_cell_get_type (void);
@@ -96,7 +96,7 @@ void e_cell_print (ECellView *ecell_view, GnomePrintContext *context,
gdouble e_cell_print_height (ECellView *ecell_view, GnomePrintContext *context,
int model_col, int view_col, int row, gdouble width);
int e_cell_max_width (ECellView *ecell_view, int model_col, int view_col);
-void e_cell_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row, ETableTooltip *tooltip);
+void e_cell_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row, int col_width, ETableTooltip *tooltip);
void e_cell_focus (ECellView *ecell_view, int model_col, int view_col, int row,
int x1, int y1, int x2, int y2);
void e_cell_unfocus (ECellView *ecell_view);
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 2c66260ac5..c10d964b52 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -1481,6 +1481,7 @@ _do_tooltip (ETableItem *eti)
view_to_model_col (eti, eti->tooltip->col),
eti->tooltip->col,
eti->tooltip->row,
+ eti->header->columns[eti->tooltip->col]->width,
eti->tooltip);
return FALSE;
}