Tab key now moves to next row, upon end of line.
authorJohn Darrington <john@darrington.wattle.id.au>
Fri, 6 Mar 2009 02:35:47 +0000 (11:35 +0900)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 6 Mar 2009 02:35:47 +0000 (11:35 +0900)
This change alters the behaviour of the tab key
in the variable and data sheet.  When using the
tab key, if the last cell in a row is encountered,
it will now cause the active cell to move to the
first cell in the next row.  Fixes bug #25168

lib/gtk-contrib/psppire-sheet.c

index 31ecbcbf5b17dfb30e9ff9590632d0d4157fa6de..908081e1a0abaafe0e2627e6ff8a6a9ded3e6fa2 100644 (file)
@@ -4204,12 +4204,29 @@ step_sheet (PsppireSheet *sheet, GtkScrollType dir)
     case GTK_SCROLL_STEP_LEFT:
       new_cell.col--;
       break;
+    case GTK_SCROLL_STEP_FORWARD:
+      new_cell.col++;
+      if (new_cell.col >=
+         psppire_sheet_model_get_column_count (sheet->model))
+       {
+         new_cell.col = 0;
+         new_cell.row++;
+       }
+      break;
+    case GTK_SCROLL_STEP_BACKWARD:
+      new_cell.col--;
+      if (new_cell.col < 0)
+       {
+         new_cell.col =
+           psppire_sheet_model_get_column_count (sheet->model) - 1;
+         new_cell.row--;
+       }
+      break;
     default:
       g_assert_not_reached ();
       break;
     }
 
-
   g_signal_emit (sheet, sheet_signals[TRAVERSE], 0,
                 &sheet->active_cell,
                 &new_cell,
@@ -4287,10 +4304,14 @@ psppire_sheet_key_press (GtkWidget *widget,
   switch (key->keyval)
     {
     case GDK_Tab:
+      step_sheet (sheet, GTK_SCROLL_STEP_FORWARD);
+      break;
     case GDK_Right:
       step_sheet (sheet, GTK_SCROLL_STEP_RIGHT);
       break;
     case GDK_ISO_Left_Tab:
+      step_sheet (sheet, GTK_SCROLL_STEP_BACKWARD);
+      break;
     case GDK_Left:
       step_sheet (sheet, GTK_SCROLL_STEP_LEFT);
       break;