diff options
author | Iain Holmes <iain@src.gnome.org> | 2000-09-18 01:18:04 +0800 |
---|---|---|
committer | Iain Holmes <iain@src.gnome.org> | 2000-09-18 01:18:04 +0800 |
commit | 13679221973a960628aa73dfa289b591e0de27e1 (patch) | |
tree | 71eddbe6d5750554a238e76ef8420295fdb4d761 | |
parent | 0d2998b1a1f8af2b6938d4dd40873ef80095844d (diff) | |
download | gsoc2013-evolution-13679221973a960628aa73dfa289b591e0de27e1.tar gsoc2013-evolution-13679221973a960628aa73dfa289b591e0de27e1.tar.gz gsoc2013-evolution-13679221973a960628aa73dfa289b591e0de27e1.tar.bz2 gsoc2013-evolution-13679221973a960628aa73dfa289b591e0de27e1.tar.lz gsoc2013-evolution-13679221973a960628aa73dfa289b591e0de27e1.tar.xz gsoc2013-evolution-13679221973a960628aa73dfa289b591e0de27e1.tar.zst gsoc2013-evolution-13679221973a960628aa73dfa289b591e0de27e1.zip |
Better calculations for tooltip positions
svn path=/trunk/; revision=5477
-rw-r--r-- | widgets/e-table/ChangeLog | 9 | ||||
-rw-r--r-- | widgets/e-table/e-cell-text.c | 13 | ||||
-rw-r--r-- | widgets/e-table/e-cell-tree.c | 8 | ||||
-rw-r--r-- | widgets/e-table/e-table-item.c | 5 | ||||
-rw-r--r-- | widgets/table/e-cell-text.c | 13 | ||||
-rw-r--r-- | widgets/table/e-cell-tree.c | 8 | ||||
-rw-r--r-- | widgets/table/e-table-item.c | 5 |
7 files changed, 41 insertions, 20 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog index d4e80ff24d..7da63f4074 100644 --- a/widgets/e-table/ChangeLog +++ b/widgets/e-table/ChangeLog @@ -1,3 +1,12 @@ +2000-09-17 Iain Holmes <iain@helixcode.com> + + * e-table-item.c: Better calculations for tooltip + positionings. + + * e-cell-text.c: Same. + + * e-cell-tree.c: Same. + 2000-09-16 Christopher James Lahey <clahey@helixcode.com> * e-cell-text.c: Added some missing #includes. diff --git a/widgets/e-table/e-cell-text.c b/widgets/e-table/e-cell-text.c index e07c44d1d8..8f31b7adf4 100644 --- a/widgets/e-table/e-cell-text.c +++ b/widgets/e-table/e-cell-text.c @@ -1451,14 +1451,15 @@ ect_show_tooltip (ECellView *ecell_view, break; } + gnome_canvas_item_move (tooltip_text, 3.0, 1.0); gnome_canvas_item_set (rect, - "x2", (double) tooltip_width, - "y2", (double) tooltip->row_height, + "x2", (double) tooltip_width + 6, + "y2", (double) tooltip->row_height + 1, NULL); - gtk_widget_set_usize (tooltip->window, tooltip_width, - tooltip->row_height); + gtk_widget_set_usize (tooltip->window, tooltip_width + 6, + tooltip->row_height + 1); gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas), 0.0, 0.0, - (double) tooltip_width, + (double) tooltip_width + 6, (double) tooltip_height); gtk_widget_show (canvas); gtk_widget_realize (tooltip->window); @@ -1466,7 +1467,7 @@ ect_show_tooltip (ECellView *ecell_view, GTK_SIGNAL_FUNC (tooltip_event), tooltip); gtk_widget_popup (tooltip->window, pixel_origin.x + tooltip->x, - pixel_origin.y + tooltip->y); + pixel_origin.y + tooltip->y + 1); unref_lines (&cell); unbuild_current_cell (&cell); diff --git a/widgets/e-table/e-cell-tree.c b/widgets/e-table/e-cell-tree.c index 6d8ff72cca..706551d7ad 100644 --- a/widgets/e-table/e-cell-tree.c +++ b/widgets/e-table/e-cell-tree.c @@ -421,10 +421,16 @@ ect_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row, ETreeModel *tree_model = e_cell_tree_get_tree_model (ecell_view->e_table_model, row); ETreePath *node = e_cell_tree_get_node (tree_model, row); int offset = offset_of_node (tree_model, node); - + GdkPixbuf *node_image; + + node_image = e_tree_model_icon_of_node (tree_model, node); + if (node_image) + 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); } } diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c index ecb5d8a59b..87d79ea9c5 100644 --- a/widgets/e-table/e-table-item.c +++ b/widgets/e-table/e-table-item.c @@ -1434,12 +1434,11 @@ _do_tooltip (ETableItem *eti) eti->tooltip->x = x; for (i = 0; i < eti->tooltip->row; i++) - y += ETI_ROW_HEIGHT (eti, i); + y += (ETI_ROW_HEIGHT (eti, i) + 1); eti->tooltip->y = y; - eti->tooltip->eti = GNOME_CANVAS_ITEM(eti); + eti->tooltip->eti = GNOME_CANVAS_ITEM (eti); eti->tooltip->row_height = ETI_ROW_HEIGHT (eti, i); - g_print ("Tooltip at %d,%d\n", x, y); e_cell_show_tooltip (ecell_view, view_to_model_col (eti, eti->tooltip->col), eti->tooltip->col, diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index e07c44d1d8..8f31b7adf4 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -1451,14 +1451,15 @@ ect_show_tooltip (ECellView *ecell_view, break; } + gnome_canvas_item_move (tooltip_text, 3.0, 1.0); gnome_canvas_item_set (rect, - "x2", (double) tooltip_width, - "y2", (double) tooltip->row_height, + "x2", (double) tooltip_width + 6, + "y2", (double) tooltip->row_height + 1, NULL); - gtk_widget_set_usize (tooltip->window, tooltip_width, - tooltip->row_height); + gtk_widget_set_usize (tooltip->window, tooltip_width + 6, + tooltip->row_height + 1); gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas), 0.0, 0.0, - (double) tooltip_width, + (double) tooltip_width + 6, (double) tooltip_height); gtk_widget_show (canvas); gtk_widget_realize (tooltip->window); @@ -1466,7 +1467,7 @@ ect_show_tooltip (ECellView *ecell_view, GTK_SIGNAL_FUNC (tooltip_event), tooltip); gtk_widget_popup (tooltip->window, pixel_origin.x + tooltip->x, - pixel_origin.y + tooltip->y); + pixel_origin.y + tooltip->y + 1); unref_lines (&cell); unbuild_current_cell (&cell); diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c index 6d8ff72cca..706551d7ad 100644 --- a/widgets/table/e-cell-tree.c +++ b/widgets/table/e-cell-tree.c @@ -421,10 +421,16 @@ ect_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row, ETreeModel *tree_model = e_cell_tree_get_tree_model (ecell_view->e_table_model, row); ETreePath *node = e_cell_tree_get_node (tree_model, row); int offset = offset_of_node (tree_model, node); - + GdkPixbuf *node_image; + + node_image = e_tree_model_icon_of_node (tree_model, node); + if (node_image) + 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); } } diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index ecb5d8a59b..87d79ea9c5 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -1434,12 +1434,11 @@ _do_tooltip (ETableItem *eti) eti->tooltip->x = x; for (i = 0; i < eti->tooltip->row; i++) - y += ETI_ROW_HEIGHT (eti, i); + y += (ETI_ROW_HEIGHT (eti, i) + 1); eti->tooltip->y = y; - eti->tooltip->eti = GNOME_CANVAS_ITEM(eti); + eti->tooltip->eti = GNOME_CANVAS_ITEM (eti); eti->tooltip->row_height = ETI_ROW_HEIGHT (eti, i); - g_print ("Tooltip at %d,%d\n", x, y); e_cell_show_tooltip (ecell_view, view_to_model_col (eti, eti->tooltip->col), eti->tooltip->col, |