diff options
Diffstat (limited to 'widgets/table/e-cell-popup.c')
-rw-r--r-- | widgets/table/e-cell-popup.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/widgets/table/e-cell-popup.c b/widgets/table/e-cell-popup.c index e398dc0abc..48b445a661 100644 --- a/widgets/table/e-cell-popup.c +++ b/widgets/table/e-cell-popup.c @@ -106,7 +106,9 @@ static void ecp_show_tooltip (ECellView *ecv, static char *ecp_get_bg_color (ECellView *ecell_view, int row); static gint e_cell_popup_do_popup (ECellPopupView *ecp_view, - GdkEvent *event); + GdkEvent *event, + int row, + int model_col); static ECellClass *parent_class; @@ -257,27 +259,22 @@ ecp_draw (ECellView *ecv, GdkDrawable *drawable, int x1, int y1, int x2, int y2) { ECellPopup *ecp = E_CELL_POPUP (ecv->ecell); - ETableItem *eti = E_TABLE_ITEM (ecv->e_table_item_view); ECellPopupView *ecp_view = (ECellPopupView *) ecv; GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (ecv->e_table_item_view)->canvas); GtkShadowType shadow; GdkRectangle rect; gboolean show_popup_arrow = FALSE; - /* Display the popup arrow if we are editing this cell, or the popup + /* Display the popup arrow if we are the cursor cell, or the popup is shown for this cell. */ - if (eti->editing_col == view_col && eti->editing_row == row) { + if (flags & E_CELL_CURSOR) { show_popup_arrow = TRUE; ecp->popup_arrow_shown = TRUE; - } else if (ecp->popup_shown && ecp->popup_view_col == view_col && ecp->popup_row == row) { show_popup_arrow = TRUE; } - if (eti->editing_col == -1) - ecp->popup_arrow_shown = FALSE; - #if 0 g_print ("In ecp_draw row:%i col: %i %i,%i %i,%i Show Arrow:%i\n", row, view_col, x1, y1, x2, y2, show_popup_arrow); @@ -331,7 +328,7 @@ ecp_event (ECellView *ecv, GdkEvent *event, int model_col, int view_col, switch (event->type) { case GDK_BUTTON_PRESS: - if (eti->editing_col == view_col && eti->editing_row == row + if (flags & E_CELL_CURSOR && ecp->popup_arrow_shown) { width = e_table_header_col_diff (eti->header, view_col, view_col + 1); @@ -342,7 +339,7 @@ ecp_event (ECellView *ecv, GdkEvent *event, int model_col, int view_col, /* FIXME: The event coords seem to be relative to the text within the cell, so we have to add 4. */ if (event->button.x + 4 >= width - E_CELL_POPUP_ARROW_WIDTH) { - return e_cell_popup_do_popup (ecp_view, event); + return e_cell_popup_do_popup (ecp_view, event, row, view_col); } } break; @@ -352,7 +349,7 @@ ecp_event (ECellView *ecv, GdkEvent *event, int model_col, int view_col, if (event->key.state & GDK_MOD1_MASK && event->key.keyval == GDK_Down) { g_print ("## Alt-Down pressed\n"); - return e_cell_popup_do_popup (ecp_view, event); + return e_cell_popup_do_popup (ecp_view, event, row, view_col); } g_print ("Key Press Event ECellPopup\n"); break; @@ -384,17 +381,10 @@ static void * ecp_enter_edit (ECellView *ecv, int model_col, int view_col, int row) { ECellPopupView *ecp_view = (ECellPopupView *) ecv; - ECellPopup *ecp = E_CELL_POPUP (ecp_view->cell_view.ecell); g_print ("In ecp_enter_edit model_col: %i view_col: %i row: %i\n", model_col, view_col, row); - if (ecp->popup_view_col != view_col || ecp->popup_row != row) - ecp->popup_arrow_shown = FALSE; - - ecp->popup_view_col = view_col; - ecp->popup_row = row; - return e_cell_enter_edit (ecp_view->child_view, model_col, view_col, row); } @@ -499,14 +489,19 @@ e_cell_popup_set_child (ECellPopup *ecp, static gint e_cell_popup_do_popup (ECellPopupView *ecp_view, - GdkEvent *event) + GdkEvent *event, + int row, + int view_col) { ECellPopup *ecp = E_CELL_POPUP (ecp_view->cell_view.ecell); - gint (*popup_func) (ECellPopup *ecp, GdkEvent *event); + gint (*popup_func) (ECellPopup *ecp, GdkEvent *event, int row, int view_col); ecp->popup_cell_view = ecp_view; popup_func = E_CELL_POPUP_CLASS (GTK_OBJECT (ecp)->klass)->popup; - return popup_func ? popup_func (ecp, event) : FALSE; + ecp->popup_view_col = view_col; + ecp->popup_row = row; + + return popup_func ? popup_func (ecp, event, row, view_col) : FALSE; } |