diff options
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/table/e-cell-text.c | 7 | ||||
-rw-r--r-- | widgets/table/e-cell-toggle.c | 5 | ||||
-rw-r--r-- | widgets/table/e-cell-tree.c | 13 | ||||
-rw-r--r-- | widgets/table/e-cell.c | 6 | ||||
-rw-r--r-- | widgets/table/e-cell.h | 6 | ||||
-rw-r--r-- | widgets/table/e-table-item.c | 40 |
6 files changed, 48 insertions, 29 deletions
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index 2a7eae1d70..05742b6e70 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -871,7 +871,7 @@ ect_edit_select_all (ECellTextView *text_view) * ECell::event method */ static gint -ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row) +ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags) { ECellTextView *text_view = (ECellTextView *) ecell_view; ETextEventProcessorEvent e_tep_event; @@ -879,8 +879,11 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, CellEdit *edit = text_view->edit; GtkWidget *canvas = GTK_WIDGET (text_view->canvas); gint return_val = 0; - CurrentCell cell, *cellptr; + + if (flags & !E_CELL_EDITING) + return 0; + build_current_cell (&cell, text_view, model_col, view_col, row); diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c index 9c5f7b391b..c4ddc66053 100644 --- a/widgets/table/e-cell-toggle.c +++ b/widgets/table/e-cell-toggle.c @@ -182,11 +182,14 @@ etog_set_value (ECellToggleView *toggle_view, int model_col, int view_col, int r * ECell::event method */ static gint -etog_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row) +etog_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags) { ECellToggleView *toggle_view = (ECellToggleView *) ecell_view; void *_value = e_table_model_value_at (ecell_view->e_table_model, model_col, row); const int value = GPOINTER_TO_INT (_value); + + if (flags & !E_CELL_EDITING) + return 0; switch (event->type){ case GDK_BUTTON_RELEASE: diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c index 32ae9ca1f7..7390d0e284 100644 --- a/widgets/table/e-cell-tree.c +++ b/widgets/table/e-cell-tree.c @@ -300,7 +300,7 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable, * ECell::event method */ static gint -ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row) +ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags) { ECellTreeView *tree_view = (ECellTreeView *) ecell_view; ETreeModel *tree_model = e_cell_tree_get_tree_model (ecell_view->e_table_model, row); @@ -322,7 +322,7 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, return TRUE; } else if (event->button.x < (offset - INDENT_AMOUNT)) - return TRUE; + return FALSE; } default: /* modify the event and pass it off to our subcell_view */ @@ -339,7 +339,7 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, default: /* nada */ } - return e_cell_event(tree_view->subcell_view, event, model_col, view_col, row); + return e_cell_event(tree_view->subcell_view, event, model_col, view_col, row, flags); } } @@ -423,6 +423,12 @@ 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 (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); @@ -435,6 +441,7 @@ ect_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row, tooltip->x += offset; e_cell_show_tooltip (tree_view->subcell_view, model_col, view_col, row, tooltip); } +#endif } /* diff --git a/widgets/table/e-cell.c b/widgets/table/e-cell.c index 53aba7c625..50e62656d0 100644 --- a/widgets/table/e-cell.c +++ b/widgets/table/e-cell.c @@ -43,7 +43,7 @@ ec_draw (ECellView *ecell_view, GdkDrawable *drawable, } static gint -ec_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row) +ec_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags) { g_error ("e-cell-event invoked\n"); return 0; @@ -137,10 +137,10 @@ E_MAKE_TYPE(e_cell, "ECell", ECell, e_cell_class_init, e_cell_init, PARENT_TYPE) * Returns: processing state from the GdkEvent handling. */ gint -e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row) +e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags) { return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->event ( - ecell_view, event, model_col, view_col, row); + ecell_view, event, model_col, view_col, row, flags); } /** diff --git a/widgets/table/e-cell.h b/widgets/table/e-cell.h index 986af546c5..14bf8c1a35 100644 --- a/widgets/table/e-cell.h +++ b/widgets/table/e-cell.h @@ -30,6 +30,8 @@ enum _ECellFlags { E_CELL_ALIGN_RIGHT = 1 << 2, E_CELL_FOCUSED = 1 << 3, + + E_CELL_EDITING = 1 << 4, }; struct _ECell { @@ -59,7 +61,7 @@ typedef struct { void (*draw) (ECellView *ecell_view, GdkDrawable *drawable, int model_col, int view_col, int row, ECellFlags flags, int x1, int y1, int x2, int y2); - gint (*event) (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row); + gint (*event) (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags); void (*focus) (ECellView *ecell_view, int model_col, int view_col, int row, int x1, int y1, int x2, int y2); void (*unfocus) (ECellView *ecell_view); @@ -80,7 +82,7 @@ GtkType e_cell_get_type (void); ECellView *e_cell_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view); void e_cell_kill_view (ECellView *ecell_view); -gint e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row); +gint e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags); void e_cell_realize (ECellView *ecell_view); void e_cell_unrealize (ECellView *ecell_view); diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index 8e6103427a..2c66260ac5 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -679,7 +679,7 @@ eti_table_model_row_changed (ETableModel *table_model, int row, ETableItem *eti) return; } - eti_request_region_redraw (eti, 0, row, eti->cols, row, 0); + eti_request_region_redraw (eti, 0, row, eti->cols - 1, row, 0); } static void @@ -692,7 +692,7 @@ eti_table_model_cell_changed (ETableModel *table_model, int col, int row, ETable return; } - eti_request_region_redraw (eti, 0, row, eti->cols -1, row, 0); + eti_request_region_redraw (eti, 0, row, eti->cols - 1, row, 0); } static void @@ -1496,6 +1496,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) switch (e->type){ case GDK_BUTTON_PRESS: { double x1, y1; + GdkEventButton button; int col, row; gint cursor_row, cursor_col; @@ -1513,15 +1514,22 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1)) return TRUE; - return_val = FALSE; + ecell_view = eti->cell_views [col]; + button = *(GdkEventButton *)e; + button.x = x1; + button.y = y1; - gtk_signal_emit (GTK_OBJECT (eti), eti_signals [CLICK], - row, view_to_model_col(eti, col), e, &return_val); + return_val = e_cell_event (ecell_view, (GdkEvent *) &button, view_to_model_col(eti, col), col, row, 0); + if (return_val) + return TRUE; + return_val = FALSE; + gtk_signal_emit (GTK_OBJECT (eti), eti_signals [CLICK], + row, view_to_model_col(eti, col), &button, &return_val); if (return_val) return TRUE; - e_table_selection_model_do_something(eti->selection, view_to_model_row(eti, row), view_to_model_col(eti, col), e->button.state); + e_table_selection_model_do_something(eti->selection, view_to_model_row(eti, row), view_to_model_col(eti, col), button.state); gtk_object_get(GTK_OBJECT(eti->selection), "cursor_row", &cursor_row, @@ -1534,16 +1542,12 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) e_table_item_enter_edit (eti, col, row); } - ecell_view = eti->cell_views [col]; - /* * Adjust the event positions */ - e->button.x = x1; - e->button.y = y1; - - return_val = e_cell_event (ecell_view, e, - view_to_model_col(eti, col), col, row); + + return_val = e_cell_event (ecell_view, (GdkEvent *) &button, + view_to_model_col(eti, col), col, row, E_CELL_EDITING); } break; @@ -1603,7 +1607,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) e->button.y = y1; return_val = e_cell_event (ecell_view, e, - view_to_model_col(eti, col), col, row); + view_to_model_col(eti, col), col, row, E_CELL_EDITING); } break; case 3: @@ -1666,7 +1670,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) e->motion.y = y1; return_val = e_cell_event (ecell_view, e, - view_to_model_col(eti, col), col, row); + view_to_model_col(eti, col), col, row, E_CELL_EDITING); } break; } @@ -1757,7 +1761,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) ecell_view = eti->cell_views [eti->editing_col]; return_val = e_cell_event (ecell_view, e, view_to_model_col(eti, eti->editing_col), - eti->editing_col, eti->editing_row); + eti->editing_col, eti->editing_row, E_CELL_EDITING); #endif } return_val = FALSE; @@ -1785,7 +1789,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) ecell_view = eti->cell_views [eti->editing_col]; return_val = e_cell_event (ecell_view, e, view_to_model_col(eti, eti->editing_col), - eti->editing_col, eti->editing_row); + eti->editing_col, eti->editing_row, E_CELL_EDITING); } } break; @@ -1806,7 +1810,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) ecell_view = eti->cell_views [eti->editing_col]; return_val = e_cell_event (ecell_view, e, view_to_model_col(eti, eti->editing_col), - eti->editing_col, eti->editing_row); + eti->editing_col, eti->editing_row, E_CELL_EDITING); } break; } |