From: John Darrington Date: Thu, 4 Dec 2008 02:38:08 +0000 (+0900) Subject: Allow variables to be entered beyond the end of sheet. X-Git-Tag: v0.7.1~71 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e353bce75f100fb7d9b2dc1fa26bcf4e8ca2679;p=pspp-builds.git Allow variables to be entered beyond the end of sheet. Several changes to fix the problem where variables beyond the vertical size of the var sheet couldn't be added. 1. Undo the effect of commit 8c9fae384585163197685e684e62e49a6b922f0c since it seems to cause problems and need to be rethought. 2. On the traverse callback, don't clamp the range of the requested destination cell. Clamp it only after the signal returns. 3. Add one more row than there are variables. --- diff --git a/lib/gtksheet/gtksheet.c b/lib/gtksheet/gtksheet.c index bab70950..93d261b4 100644 --- a/lib/gtksheet/gtksheet.c +++ b/lib/gtksheet/gtksheet.c @@ -4125,6 +4125,15 @@ step_sheet (GtkSheet *sheet, GtkScrollType dir) } + g_signal_emit (sheet, sheet_signals[TRAVERSE], 0, + &sheet->active_cell, + &new_cell, + &forbidden); + + if (forbidden) + return; + + maximize_int (&new_cell.row, 0); maximize_int (&new_cell.col, 0); @@ -4134,14 +4143,6 @@ step_sheet (GtkSheet *sheet, GtkScrollType dir) minimize_int (&new_cell.col, psppire_axis_unit_count (sheet->haxis) - 1); - g_signal_emit (sheet, sheet_signals[TRAVERSE], 0, - &sheet->active_cell, - &new_cell, - &forbidden); - - if (forbidden) - return; - change_active_cell (sheet, new_cell.row, new_cell.col); @@ -4844,10 +4845,12 @@ update_adjustment (GtkAdjustment *adj, PsppireAxis *axis, gint page_size) adj->lower = 0; adj->page_size = page_size; +#if 0 adj->value = position * (adj->upper - adj->lower) - adj->page_size; if ( adj->value < adj->lower) adj->value = adj->lower; +#endif gtk_adjustment_changed (adj); } diff --git a/src/ui/gui/psppire-data-editor.c b/src/ui/gui/psppire-data-editor.c index c68133df..b6f66403 100644 --- a/src/ui/gui/psppire-data-editor.c +++ b/src/ui/gui/psppire-data-editor.c @@ -294,7 +294,9 @@ new_variables_callback (PsppireDict *dict, gpointer data) psppire_axis_hetero_clear (vaxis); - for (v = 0 ; v < psppire_dict_get_var_cnt (dict); ++v) + /* NOTE: "<=" in the following line is correct. + There needs to be one more row than there are variables */ + for (v = 0 ; v <= psppire_dict_get_var_cnt (dict); ++v) psppire_axis_hetero_append (vaxis, DEFAULT_ROW_HEIGHT); for (i = 0 ; i < 4 ; ++i)