From: John Darrington Date: Sun, 30 Nov 2008 04:08:56 +0000 (+0900) Subject: When adding variables in varsheet, add at the current position. X-Git-Tag: v0.7.1~93 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56ec3543af35ae753a206142d36eb8393f7b4bb3;p=pspp-builds.git When adding variables in varsheet, add at the current position. Previously variables could only be inserted at the start of the dictionary. Fixes bug #24502 --- diff --git a/src/ui/gui/psppire-data-editor.c b/src/ui/gui/psppire-data-editor.c index d0a6b808..592e8aaa 100644 --- a/src/ui/gui/psppire-data-editor.c +++ b/src/ui/gui/psppire-data-editor.c @@ -1175,14 +1175,26 @@ psppire_data_editor_sort_descending (PsppireDataEditor *de) void psppire_data_editor_insert_variable (PsppireDataEditor *de) { - glong posn = -1; - - if ( de->data_sheet[0]->state == GTK_SHEET_COLUMN_SELECTED ) - posn = GTK_SHEET (de->data_sheet[0])->range.col0; - else - posn = GTK_SHEET (de->data_sheet[0])->active_cell.col; + glong posn = 0; - if ( posn == -1 ) posn = 0; + switch (gtk_notebook_get_current_page (GTK_NOTEBOOK (de))) + { + case PSPPIRE_DATA_EDITOR_DATA_VIEW: + if ( de->data_sheet[0]->state == GTK_SHEET_COLUMN_SELECTED ) + posn = GTK_SHEET (de->data_sheet[0])->range.col0; + else + posn = GTK_SHEET (de->data_sheet[0])->active_cell.col; + break; + case PSPPIRE_DATA_EDITOR_VARIABLE_VIEW: + if ( de->var_sheet->state == GTK_SHEET_ROW_SELECTED ) + posn = GTK_SHEET (de->var_sheet)->range.row0; + else + posn = GTK_SHEET (de->var_sheet)->active_cell.row; + break; + default: + g_assert_not_reached (); + break; + }; psppire_dict_insert_variable (de->data_store->dict, posn, NULL); }