aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2001-01-30 19:37:34 +0800
committerChris Lahey <clahey@src.gnome.org>2001-01-30 19:37:34 +0800
commitda03d43325d3410577ace4073d5b26fd72944ce4 (patch)
treef8b56730e2d62409f0d951034eda25a69968a081 /widgets
parent8ee392b8a3cea8965d3cc250c9e679d48f5d4aed (diff)
downloadgsoc2013-evolution-da03d43325d3410577ace4073d5b26fd72944ce4.tar.gz
gsoc2013-evolution-da03d43325d3410577ace4073d5b26fd72944ce4.tar.zst
gsoc2013-evolution-da03d43325d3410577ace4073d5b26fd72944ce4.zip
Made the contained %ETableItem have cursor_mode as
2001-01-30 Christopher James Lahey <clahey@helixcode.com> * e-table-click-to-add.c (etcta_event): Made the contained %ETableItem have cursor_mode as %E_TABLE_CURSOR_SPREADSHEET. * e-table-defines.h, e-table-item.c, e-table-specification.c: Added a new cursor mode E_TABLE_CURSOR_SPREADSHEET. This is accessed using cursor_mode="spreadsheet" in your specification xml, as well as by the click_to_add item. It is identical to E_TABLE_CURSOR_SIMPLE, except that tab goes to the next item in the table instead of to the next widget. svn path=/trunk/; revision=7910
Diffstat (limited to 'widgets')
-rw-r--r--widgets/table/e-table-click-to-add.c15
-rw-r--r--widgets/table/e-table-defines.h1
-rw-r--r--widgets/table/e-table-item.c61
-rw-r--r--widgets/table/e-table-specification.c2
4 files changed, 45 insertions, 34 deletions
diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c
index 0948ad1eb0..4e2d71f9d6 100644
--- a/widgets/table/e-table-click-to-add.c
+++ b/widgets/table/e-table-click-to-add.c
@@ -303,6 +303,7 @@ finish_editing (ETableClickToAdd *etcta)
"minimum_width", etcta->width,
"drawgrid", TRUE,
"table_selection_model", etcta->selection,
+ "cursor_mode", E_TABLE_CURSOR_SPREADSHEET,
NULL);
gtk_signal_connect(GTK_OBJECT(etcta->row), "key_press",
@@ -347,6 +348,7 @@ etcta_event (GnomeCanvasItem *item, GdkEvent *e)
"minimum_width", etcta->width,
"drawgrid", TRUE,
"table_selection_model", etcta->selection,
+ "cursor_mode", E_TABLE_CURSOR_SPREADSHEET,
NULL);
gtk_signal_connect(GTK_OBJECT(etcta->row), "key_press",
@@ -367,17 +369,13 @@ etcta_event (GnomeCanvasItem *item, GdkEvent *e)
case GDK_KEY_PRESS:
switch (e->key.keyval) {
- case GDK_Return:
- case GDK_KP_Enter:
- case GDK_ISO_Enter:
- case GDK_3270_Enter:
-
case GDK_Tab:
case GDK_KP_Tab:
case GDK_ISO_Left_Tab:
finish_editing (etcta);
break;
default:
+ return FALSE;
break;
}
@@ -503,6 +501,13 @@ e_table_click_to_add_get_type (void)
/* The colors in this need to be themefied. */
+/**
+ * e_table_click_to_add_commit:
+ * @etcta: The %ETableClickToAdd to commit.
+ *
+ * This routine commits the current thing being edited and returns to
+ * just displaying the click to add message.
+ **/
void
e_table_click_to_add_commit (ETableClickToAdd *etcta)
{
diff --git a/widgets/table/e-table-defines.h b/widgets/table/e-table-defines.h
index a1232911a7..01208da1aa 100644
--- a/widgets/table/e-table-defines.h
+++ b/widgets/table/e-table-defines.h
@@ -18,6 +18,7 @@ typedef enum
{
E_TABLE_CURSOR_LINE,
E_TABLE_CURSOR_SIMPLE,
+ E_TABLE_CURSOR_SPREADSHEET,
} ETableCursorMode;
#endif
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index c2aa4d1ffa..e0543ca536 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -1310,6 +1310,7 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width,
ECellFlags flags;
switch (eti->cursor_mode) {
case E_TABLE_CURSOR_SIMPLE:
+ case E_TABLE_CURSOR_SPREADSHEET:
if (cursor_col == ecol->col_idx && cursor_row == view_to_model_row(eti, row))
col_selected = !col_selected;
break;
@@ -1370,6 +1371,7 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width,
}
break;
case E_TABLE_CURSOR_SIMPLE:
+ case E_TABLE_CURSOR_SPREADSHEET:
if (view_to_model_col(eti, col) == cursor_col && view_to_model_row(eti, row) == cursor_row) {
f_x1 = xd;
f_x2 = xd + ecol->width;
@@ -1879,7 +1881,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
#endif
case GDK_Home:
case GDK_KP_Home:
- if (eti->cursor_mode == E_TABLE_CURSOR_SIMPLE) {
+ if (eti->cursor_mode != E_TABLE_CURSOR_LINE) {
eti_cursor_move (eti, model_to_view_row(eti, cursor_row), 0);
return_val = TRUE;
} else
@@ -1887,7 +1889,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
break;
case GDK_End:
case GDK_KP_End:
- if (eti->cursor_mode == E_TABLE_CURSOR_SIMPLE) {
+ if (eti->cursor_mode != E_TABLE_CURSOR_LINE) {
eti_cursor_move (eti, model_to_view_row(eti, cursor_row), eti->cols - 1);
return_val = TRUE;
} else
@@ -1896,37 +1898,38 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
case GDK_Tab:
case GDK_KP_Tab:
case GDK_ISO_Left_Tab:
+ if (eti->cursor_mode == E_TABLE_CURSOR_SPREADSHEET) {
+ if ((e->key.state & GDK_SHIFT_MASK) != 0){
+ /* shift tab */
+ if (cursor_col != view_to_model_col(eti, 0))
+ eti_cursor_move_left (eti);
+ else if (cursor_row != view_to_model_row(eti, 0))
+ eti_cursor_move (eti, model_to_view_row(eti, cursor_row) - 1, eti->cols - 1);
+ else
+ return_val = FALSE;
+ } else {
+ if (cursor_col != view_to_model_col (eti, eti->cols - 1))
+ eti_cursor_move_right (eti);
+ else if (cursor_row != view_to_model_row(eti, eti->rows - 1))
+ eti_cursor_move (eti, model_to_view_row(eti, cursor_row) + 1, 0);
+ else
+ return_val = FALSE;
+ }
+ gtk_object_get(GTK_OBJECT(eti->selection),
+ "cursor_row", &cursor_row,
+ "cursor_col", &cursor_col,
+ NULL);
+
+ if (cursor_col >= 0 && cursor_row >= 0 && return_val &&
+ (!eti_editing(eti)) && e_table_model_is_cell_editable(eti->selection->model, cursor_col, cursor_row)) {
+ e_table_item_enter_edit (eti, model_to_view_col(eti, cursor_col), model_to_view_row(eti, cursor_row));
+ }
+ break;
+ } else {
/* Let tab send you to the next widget. */
return_val = FALSE;
break;
-#if 0
- if ((e->key.state & GDK_SHIFT_MASK) != 0){
- /* shift tab */
- if (cursor_col != view_to_model_col(eti, 0))
- eti_cursor_move_left (eti);
- else if (cursor_row != view_to_model_row(eti, 0))
- eti_cursor_move (eti, model_to_view_row(eti, cursor_row) - 1, eti->cols - 1);
- else
- return_val = FALSE;
- } else {
- if (cursor_col != view_to_model_col (eti, eti->cols - 1))
- eti_cursor_move_right (eti);
- else if (cursor_row != view_to_model_row(eti, eti->rows - 1))
- eti_cursor_move (eti, model_to_view_row(eti, cursor_row) + 1, 0);
- else
- return_val = FALSE;
}
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_row", &cursor_row,
- "cursor_col", &cursor_col,
- NULL);
-
- if (cursor_col >= 0 && cursor_row >= 0 && return_val &&
- (!eti_editing(eti)) && e_table_model_is_cell_editable(eti->selection->model, cursor_col, cursor_row)) {
- e_table_item_enter_edit (eti, model_to_view_col(eti, cursor_col), model_to_view_row(eti, cursor_row));
- }
- break;
-#endif
case GDK_Return:
case GDK_KP_Enter:
diff --git a/widgets/table/e-table-specification.c b/widgets/table/e-table-specification.c
index 33523129b8..fff5812aa2 100644
--- a/widgets/table/e-table-specification.c
+++ b/widgets/table/e-table-specification.c
@@ -176,6 +176,8 @@ e_table_specification_load_from_node (ETableSpecification *specification,
temp = e_xml_get_string_prop_by_name (node, "cursor-mode");
if (temp && !strcasecmp (temp, "line")) {
specification->cursor_mode = E_TABLE_CURSOR_LINE;
+ } else if (temp && !strcasecmp (temp, "spreadsheet")) {
+ specification->cursor_mode = E_TABLE_CURSOR_SPREADSHEET;
}
g_free (temp);
g_free (specification->click_to_add_message);