if (row >= yyy_row_count (sheet) || col >= xxx_column_count (sheet))
return FALSE;
- /* _gtkextra_signal_emit (GTK_OBJECT (sheet), sheet_signals[ACTIVATE], row, col, &veto);
- if (!GTK_WIDGET_REALIZED (GTK_WIDGET (sheet))) return veto;
- */
-
if (!veto) return FALSE;
if (sheet->state != GTK_SHEET_NORMAL)
{
G_CALLBACK (gtk_sheet_entry_changed),
sheet);
- _gtkextra_signal_emit (GTK_OBJECT (sheet), sheet_signals[ACTIVATE], row, col, &veto);
+ _gtkextra_signal_emit (GTK_OBJECT (sheet), sheet_signals [ACTIVATE], row, col, &veto);
return TRUE;
}
*veto = FALSE;
return;
}
+ gtk_sheet_activate_cell (sheet, row, column);
}
if (gtk_sheet_autoscroll (sheet))
msgstr ""
"Project-Id-Version: PSPP 0.4.3\n"
"Report-Msgid-Bugs-To: pspp-dev@gnu.org\n"
-"POT-Creation-Date: 2007-08-16 14:11+0800\n"
+"POT-Creation-Date: 2007-08-18 08:25+0800\n"
"PO-Revision-Date: 2006-07-28 19:32+0800\n"
"Last-Translator: John Darrington <john@darrington.wattle.id.au>\n"
"Language-Team: German <pspp-dev@gnu.org>\n"
msgid "Multivariate GLM not yet supported"
msgstr ""
-#: src/language/stats/glm.q:268 src/language/stats/regression.q:1153
+#: src/language/stats/glm.q:268 src/language/stats/regression.q:1155
msgid "Dependent variable must be numeric."
msgstr ""
-#: src/language/stats/glm.q:343 src/language/stats/regression.q:1252
+#: src/language/stats/glm.q:343 src/language/stats/regression.q:1254
msgid "No valid data found. This command was skipped."
msgstr ""
#: src/language/stats/regression.q:1031
msgid ""
-"The dependent variable is equal to the independent variable. The least "
-"sequares line is therefore Y=X. Standard errors and related statistics may "
-"be meaningless."
+"The dependent variable is equal to the independent variable.The least "
+"squares line is therefore Y=X.Standard errors and related statistics may be "
+"meaningless."
msgstr ""
#: src/language/stats/sort-cases.c:63
msgid "Style of bevel around the custom entry button"
msgstr ""
-#: src/ui/gui/data-editor.c:151
+#: src/ui/gui/data-editor.c:154
msgid "Transformations Pending"
msgstr ""
-#: src/ui/gui/data-editor.c:290
+#: src/ui/gui/data-editor.c:349
#, fuzzy
msgid "Labels"
msgstr "Kennsatz"
-#: src/ui/gui/data-editor.c:291
+#: src/ui/gui/data-editor.c:350
msgid "Show/hide value labels"
msgstr ""
-#: src/ui/gui/data-editor.c:309 src/ui/gui/data-editor.c:324
-#: src/ui/gui/data-editor.c:1603 src/ui/gui/data-editor.c:1656
+#: src/ui/gui/data-editor.c:368 src/ui/gui/data-editor.c:385
+#: src/ui/gui/data-editor.c:1660 src/ui/gui/data-editor.c:1713
msgid "Clear"
msgstr ""
-#: src/ui/gui/data-editor.c:310
+#: src/ui/gui/data-editor.c:369
msgid "Delete the cases at the selected position(s)"
msgstr ""
-#: src/ui/gui/data-editor.c:325
+#: src/ui/gui/data-editor.c:386
msgid "Delete the variables at the selected position(s)"
msgstr ""
-#: src/ui/gui/data-editor.c:339 src/ui/gui/data-editor.c:1600
+#: src/ui/gui/data-editor.c:400 src/ui/gui/data-editor.c:1657
#: src/ui/gui/data-editor.glade:286 src/ui/gui/data-editor.glade:654
#, fuzzy
msgid "Insert Variable"
msgstr "Variableansicht"
-#: src/ui/gui/data-editor.c:340
+#: src/ui/gui/data-editor.c:401
msgid "Create a new variable at the current position"
msgstr ""
-#: src/ui/gui/data-editor.c:358 src/ui/gui/data-editor.c:1653
+#: src/ui/gui/data-editor.c:419 src/ui/gui/data-editor.c:1710
#: src/ui/gui/data-editor.glade:642
#, fuzzy
msgid "Insert Case"
msgstr "_Stecken"
-#: src/ui/gui/data-editor.c:359
+#: src/ui/gui/data-editor.c:420
msgid "Create a new case at the current position"
msgstr ""
-#: src/ui/gui/data-editor.c:379
+#: src/ui/gui/data-editor.c:440
#, fuzzy
msgid "Goto Case"
msgstr "_Stecken"
-#: src/ui/gui/data-editor.c:380
+#: src/ui/gui/data-editor.c:441
msgid "Jump to a Case in the Data Sheet"
msgstr ""
-#: src/ui/gui/data-editor.c:399
+#: src/ui/gui/data-editor.c:460
#, fuzzy
msgid "Weights"
msgstr "Rechts"
-#: src/ui/gui/data-editor.c:400
+#: src/ui/gui/data-editor.c:461
msgid "Weight cases by variable"
msgstr ""
-#: src/ui/gui/data-editor.c:409 src/ui/gui/data-editor.glade:323
+#: src/ui/gui/data-editor.c:470 src/ui/gui/data-editor.glade:323
msgid "Transpose"
msgstr ""
-#: src/ui/gui/data-editor.c:410
+#: src/ui/gui/data-editor.c:471
msgid "Transpose the cases with the variables"
msgstr ""
-#: src/ui/gui/data-editor.c:421
+#: src/ui/gui/data-editor.c:482
#, fuzzy
msgid "Split"
msgstr "Alle Datei"
-#: src/ui/gui/data-editor.c:422
+#: src/ui/gui/data-editor.c:483
msgid "Split the active file"
msgstr ""
-#: src/ui/gui/data-editor.c:432
+#: src/ui/gui/data-editor.c:493
msgid "Sort"
msgstr ""
-#: src/ui/gui/data-editor.c:433
+#: src/ui/gui/data-editor.c:494
msgid "Sort cases in the active file"
msgstr ""
-#: src/ui/gui/data-editor.c:441 src/ui/gui/data-editor.glade:360
+#: src/ui/gui/data-editor.c:502 src/ui/gui/data-editor.glade:360
#: src/ui/gui/data-editor.glade:697
msgid "Select Cases"
msgstr ""
-#: src/ui/gui/data-editor.c:442
+#: src/ui/gui/data-editor.c:503
msgid "Select cases from the active file"
msgstr ""
-#: src/ui/gui/data-editor.c:451
+#: src/ui/gui/data-editor.c:512
msgid "Compute"
msgstr ""
-#: src/ui/gui/data-editor.c:452
+#: src/ui/gui/data-editor.c:513
#, fuzzy
msgid "Compute new values for a variable"
msgstr "Unpassend Wert für Variable"
-#: src/ui/gui/data-editor.c:460
+#: src/ui/gui/data-editor.c:521
#, fuzzy
msgid "Data File Comments"
msgstr "Datei Fehler"
-#: src/ui/gui/data-editor.c:461
+#: src/ui/gui/data-editor.c:522
msgid "Commentary text for the data file"
msgstr ""
-#: src/ui/gui/data-editor.c:469 src/ui/gui/data-editor.glade:267
+#: src/ui/gui/data-editor.c:530 src/ui/gui/data-editor.glade:267
#: src/ui/gui/data-editor.glade:601
msgid "Variables"
msgstr "Variableansicht"
-#: src/ui/gui/data-editor.c:470
+#: src/ui/gui/data-editor.c:531
#, fuzzy
msgid "Jump to Variable"
msgstr "Variableansicht"
-#: src/ui/gui/data-editor.c:871
+#: src/ui/gui/data-editor.c:928
msgid "Font Selection"
msgstr "Schriftwahlung"
-#: src/ui/gui/data-editor.c:1078
+#: src/ui/gui/data-editor.c:1135
msgid "No Split"
msgstr ""
-#: src/ui/gui/data-editor.c:1087
+#: src/ui/gui/data-editor.c:1144
#, fuzzy
msgid "Split by "
msgstr "Alle Datei"
-#: src/ui/gui/data-editor.c:1112
+#: src/ui/gui/data-editor.c:1169
msgid "Filter off"
msgstr ""
-#: src/ui/gui/data-editor.c:1125
+#: src/ui/gui/data-editor.c:1182
#, c-format
msgid "Filter by %s"
msgstr ""
-#: src/ui/gui/data-editor.c:1143
+#: src/ui/gui/data-editor.c:1200
msgid "Weights off"
msgstr ""
-#: src/ui/gui/data-editor.c:1156
+#: src/ui/gui/data-editor.c:1213
#, c-format
msgid "Weight by %s"
msgstr ""
-#: src/ui/gui/data-editor.c:1179 src/ui/gui/data-editor.c:1410
+#: src/ui/gui/data-editor.c:1236 src/ui/gui/data-editor.c:1467
#: src/ui/gui/data-editor.glade:512
msgid "Open"
msgstr "Öffen"
-#: src/ui/gui/data-editor.c:1180
+#: src/ui/gui/data-editor.c:1237
msgid "Open a data file"
msgstr ""
-#: src/ui/gui/data-editor.c:1188 src/ui/gui/data-editor.c:1295
+#: src/ui/gui/data-editor.c:1245 src/ui/gui/data-editor.c:1352
#: src/ui/gui/data-editor.glade:522
msgid "Save"
msgstr "Speichen"
-#: src/ui/gui/data-editor.c:1189 src/ui/gui/data-editor.c:1199
+#: src/ui/gui/data-editor.c:1246 src/ui/gui/data-editor.c:1256
#, fuzzy
msgid "Save data to file"
msgstr "Speichern unter"
-#: src/ui/gui/data-editor.c:1198
+#: src/ui/gui/data-editor.c:1255
#, fuzzy
msgid "Save As"
msgstr "Speichern unter"
-#: src/ui/gui/data-editor.c:1207
+#: src/ui/gui/data-editor.c:1264
msgid "New"
msgstr ""
-#: src/ui/gui/data-editor.c:1208
+#: src/ui/gui/data-editor.c:1265
msgid "New data file"
msgstr ""
-#: src/ui/gui/data-editor.c:1303 src/ui/gui/data-editor.c:1418
+#: src/ui/gui/data-editor.c:1360 src/ui/gui/data-editor.c:1475
msgid "System Files (*.sav)"
msgstr "Systemedatein (*.sav)"
-#: src/ui/gui/data-editor.c:1309 src/ui/gui/data-editor.c:1424
+#: src/ui/gui/data-editor.c:1366 src/ui/gui/data-editor.c:1481
msgid "Portable Files (*.por) "
msgstr "Tragbardatein (*.por)"
-#: src/ui/gui/data-editor.c:1315 src/ui/gui/data-editor.c:1430
+#: src/ui/gui/data-editor.c:1372 src/ui/gui/data-editor.c:1487
#: src/ui/gui/syntax-editor.c:138 src/ui/gui/syntax-editor.c:524
msgid "All Files"
msgstr "Alle Datei"
-#: src/ui/gui/data-editor.c:1323
+#: src/ui/gui/data-editor.c:1380
#, fuzzy
msgid "System File"
msgstr "Systemedatein (*.sav)"
-#: src/ui/gui/data-editor.c:1328
+#: src/ui/gui/data-editor.c:1385
#, fuzzy
msgid "Portable File"
msgstr "Tragbardatein (*.por)"
-#: src/ui/gui/data-editor.c:1593
+#: src/ui/gui/data-editor.c:1650
msgid "Sort Ascending"
msgstr ""
-#: src/ui/gui/data-editor.c:1596
+#: src/ui/gui/data-editor.c:1653
msgid "Sort Descending"
msgstr ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: pspp-dev@gnu.org\n"
-"POT-Creation-Date: 2007-08-16 14:11+0800\n"
+"POT-Creation-Date: 2007-08-18 08:25+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "Multivariate GLM not yet supported"
msgstr ""
-#: src/language/stats/glm.q:268 src/language/stats/regression.q:1153
+#: src/language/stats/glm.q:268 src/language/stats/regression.q:1155
msgid "Dependent variable must be numeric."
msgstr ""
-#: src/language/stats/glm.q:343 src/language/stats/regression.q:1252
+#: src/language/stats/glm.q:343 src/language/stats/regression.q:1254
msgid "No valid data found. This command was skipped."
msgstr ""
#: src/language/stats/regression.q:1031
msgid ""
-"The dependent variable is equal to the independent variable. The least "
-"sequares line is therefore Y=X. Standard errors and related statistics may "
-"be meaningless."
+"The dependent variable is equal to the independent variable.The least "
+"squares line is therefore Y=X.Standard errors and related statistics may be "
+"meaningless."
msgstr ""
#: src/language/stats/sort-cases.c:63
msgid "Style of bevel around the custom entry button"
msgstr ""
-#: src/ui/gui/data-editor.c:151
+#: src/ui/gui/data-editor.c:154
msgid "Transformations Pending"
msgstr ""
-#: src/ui/gui/data-editor.c:290
+#: src/ui/gui/data-editor.c:349
msgid "Labels"
msgstr ""
-#: src/ui/gui/data-editor.c:291
+#: src/ui/gui/data-editor.c:350
msgid "Show/hide value labels"
msgstr ""
-#: src/ui/gui/data-editor.c:309 src/ui/gui/data-editor.c:324
-#: src/ui/gui/data-editor.c:1603 src/ui/gui/data-editor.c:1656
+#: src/ui/gui/data-editor.c:368 src/ui/gui/data-editor.c:385
+#: src/ui/gui/data-editor.c:1660 src/ui/gui/data-editor.c:1713
msgid "Clear"
msgstr ""
-#: src/ui/gui/data-editor.c:310
+#: src/ui/gui/data-editor.c:369
msgid "Delete the cases at the selected position(s)"
msgstr ""
-#: src/ui/gui/data-editor.c:325
+#: src/ui/gui/data-editor.c:386
msgid "Delete the variables at the selected position(s)"
msgstr ""
-#: src/ui/gui/data-editor.c:339 src/ui/gui/data-editor.c:1600
+#: src/ui/gui/data-editor.c:400 src/ui/gui/data-editor.c:1657
#: src/ui/gui/data-editor.glade:286 src/ui/gui/data-editor.glade:654
msgid "Insert Variable"
msgstr ""
-#: src/ui/gui/data-editor.c:340
+#: src/ui/gui/data-editor.c:401
msgid "Create a new variable at the current position"
msgstr ""
-#: src/ui/gui/data-editor.c:358 src/ui/gui/data-editor.c:1653
+#: src/ui/gui/data-editor.c:419 src/ui/gui/data-editor.c:1710
#: src/ui/gui/data-editor.glade:642
msgid "Insert Case"
msgstr ""
-#: src/ui/gui/data-editor.c:359
+#: src/ui/gui/data-editor.c:420
msgid "Create a new case at the current position"
msgstr ""
-#: src/ui/gui/data-editor.c:379
+#: src/ui/gui/data-editor.c:440
msgid "Goto Case"
msgstr ""
-#: src/ui/gui/data-editor.c:380
+#: src/ui/gui/data-editor.c:441
msgid "Jump to a Case in the Data Sheet"
msgstr ""
-#: src/ui/gui/data-editor.c:399
+#: src/ui/gui/data-editor.c:460
msgid "Weights"
msgstr ""
-#: src/ui/gui/data-editor.c:400
+#: src/ui/gui/data-editor.c:461
msgid "Weight cases by variable"
msgstr ""
-#: src/ui/gui/data-editor.c:409 src/ui/gui/data-editor.glade:323
+#: src/ui/gui/data-editor.c:470 src/ui/gui/data-editor.glade:323
msgid "Transpose"
msgstr ""
-#: src/ui/gui/data-editor.c:410
+#: src/ui/gui/data-editor.c:471
msgid "Transpose the cases with the variables"
msgstr ""
-#: src/ui/gui/data-editor.c:421
+#: src/ui/gui/data-editor.c:482
msgid "Split"
msgstr ""
-#: src/ui/gui/data-editor.c:422
+#: src/ui/gui/data-editor.c:483
msgid "Split the active file"
msgstr ""
-#: src/ui/gui/data-editor.c:432
+#: src/ui/gui/data-editor.c:493
msgid "Sort"
msgstr ""
-#: src/ui/gui/data-editor.c:433
+#: src/ui/gui/data-editor.c:494
msgid "Sort cases in the active file"
msgstr ""
-#: src/ui/gui/data-editor.c:441 src/ui/gui/data-editor.glade:360
+#: src/ui/gui/data-editor.c:502 src/ui/gui/data-editor.glade:360
#: src/ui/gui/data-editor.glade:697
msgid "Select Cases"
msgstr ""
-#: src/ui/gui/data-editor.c:442
+#: src/ui/gui/data-editor.c:503
msgid "Select cases from the active file"
msgstr ""
-#: src/ui/gui/data-editor.c:451
+#: src/ui/gui/data-editor.c:512
msgid "Compute"
msgstr ""
-#: src/ui/gui/data-editor.c:452
+#: src/ui/gui/data-editor.c:513
msgid "Compute new values for a variable"
msgstr ""
-#: src/ui/gui/data-editor.c:460
+#: src/ui/gui/data-editor.c:521
msgid "Data File Comments"
msgstr ""
-#: src/ui/gui/data-editor.c:461
+#: src/ui/gui/data-editor.c:522
msgid "Commentary text for the data file"
msgstr ""
-#: src/ui/gui/data-editor.c:469 src/ui/gui/data-editor.glade:267
+#: src/ui/gui/data-editor.c:530 src/ui/gui/data-editor.glade:267
#: src/ui/gui/data-editor.glade:601
msgid "Variables"
msgstr ""
-#: src/ui/gui/data-editor.c:470
+#: src/ui/gui/data-editor.c:531
msgid "Jump to Variable"
msgstr ""
-#: src/ui/gui/data-editor.c:871
+#: src/ui/gui/data-editor.c:928
msgid "Font Selection"
msgstr ""
-#: src/ui/gui/data-editor.c:1078
+#: src/ui/gui/data-editor.c:1135
msgid "No Split"
msgstr ""
-#: src/ui/gui/data-editor.c:1087
+#: src/ui/gui/data-editor.c:1144
msgid "Split by "
msgstr ""
-#: src/ui/gui/data-editor.c:1112
+#: src/ui/gui/data-editor.c:1169
msgid "Filter off"
msgstr ""
-#: src/ui/gui/data-editor.c:1125
+#: src/ui/gui/data-editor.c:1182
#, c-format
msgid "Filter by %s"
msgstr ""
-#: src/ui/gui/data-editor.c:1143
+#: src/ui/gui/data-editor.c:1200
msgid "Weights off"
msgstr ""
-#: src/ui/gui/data-editor.c:1156
+#: src/ui/gui/data-editor.c:1213
#, c-format
msgid "Weight by %s"
msgstr ""
-#: src/ui/gui/data-editor.c:1179 src/ui/gui/data-editor.c:1410
+#: src/ui/gui/data-editor.c:1236 src/ui/gui/data-editor.c:1467
#: src/ui/gui/data-editor.glade:512
msgid "Open"
msgstr ""
-#: src/ui/gui/data-editor.c:1180
+#: src/ui/gui/data-editor.c:1237
msgid "Open a data file"
msgstr ""
-#: src/ui/gui/data-editor.c:1188 src/ui/gui/data-editor.c:1295
+#: src/ui/gui/data-editor.c:1245 src/ui/gui/data-editor.c:1352
#: src/ui/gui/data-editor.glade:522
msgid "Save"
msgstr ""
-#: src/ui/gui/data-editor.c:1189 src/ui/gui/data-editor.c:1199
+#: src/ui/gui/data-editor.c:1246 src/ui/gui/data-editor.c:1256
msgid "Save data to file"
msgstr ""
-#: src/ui/gui/data-editor.c:1198
+#: src/ui/gui/data-editor.c:1255
msgid "Save As"
msgstr ""
-#: src/ui/gui/data-editor.c:1207
+#: src/ui/gui/data-editor.c:1264
msgid "New"
msgstr ""
-#: src/ui/gui/data-editor.c:1208
+#: src/ui/gui/data-editor.c:1265
msgid "New data file"
msgstr ""
-#: src/ui/gui/data-editor.c:1303 src/ui/gui/data-editor.c:1418
+#: src/ui/gui/data-editor.c:1360 src/ui/gui/data-editor.c:1475
msgid "System Files (*.sav)"
msgstr ""
-#: src/ui/gui/data-editor.c:1309 src/ui/gui/data-editor.c:1424
+#: src/ui/gui/data-editor.c:1366 src/ui/gui/data-editor.c:1481
msgid "Portable Files (*.por) "
msgstr ""
-#: src/ui/gui/data-editor.c:1315 src/ui/gui/data-editor.c:1430
+#: src/ui/gui/data-editor.c:1372 src/ui/gui/data-editor.c:1487
#: src/ui/gui/syntax-editor.c:138 src/ui/gui/syntax-editor.c:524
msgid "All Files"
msgstr ""
-#: src/ui/gui/data-editor.c:1323
+#: src/ui/gui/data-editor.c:1380
msgid "System File"
msgstr ""
-#: src/ui/gui/data-editor.c:1328
+#: src/ui/gui/data-editor.c:1385
msgid "Portable File"
msgstr ""
-#: src/ui/gui/data-editor.c:1593
+#: src/ui/gui/data-editor.c:1650
msgid "Sort Ascending"
msgstr ""
-#: src/ui/gui/data-editor.c:1596
+#: src/ui/gui/data-editor.c:1653
msgid "Sort Descending"
msgstr ""
+2007-08-18 John Darrington <john@darrington.wattle.id.au>
+
+ * clipboard.c clipboard.h data-editor.c: Added the ability to paste from
+ the clipboard into the data sheet.
+
2007-08-16 John Darrington <john@darrington.wattle.id.au>
* output-viewer.c output-viewer.h output-viewer.glade (new files)
#include <data/casewriter.h>
#include <data/format.h>
#include <data/data-out.h>
+#include "helper.h"
#include <stdlib.h>
+#include "data-editor.h"
/* A casereader and dictionary holding the data currently in the clip */
clipboard_clear_cb (clipboard, sheet);
}
+
+
+/* A callback for when clipboard contents have been received */
+void
+data_sheet_contents_received_callback (GtkClipboard *clipboard,
+ GtkSelectionData *sd,
+ gpointer data)
+{
+ struct data_editor *de = data;
+
+ gint count = 0;
+ gint row, column;
+ gint next_row, next_column;
+ gint first_column;
+ char *c;
+ GtkSheet *data_sheet ;
+ PsppireDataStore *data_store;
+
+ if ( sd->length < 0 )
+ return;
+
+ if ( sd->type != gdk_atom_intern ("UTF8_STRING", FALSE))
+ return;
+
+ c = (char *) sd->data;
+
+ /* Paste text to selected position */
+ data_sheet = GTK_SHEET (get_widget_assert (de->xml, "data_sheet"));
+ data_store = PSPPIRE_DATA_STORE (gtk_sheet_get_model (data_sheet));
+
+ gtk_sheet_get_active_cell (data_sheet, &row, &column);
+
+ g_return_if_fail (row >= 0);
+ g_return_if_fail (column >= 0);
+
+ first_column = column;
+ next_row = row;
+ next_column = column;
+ while (count < sd->length)
+ {
+ char *s = c;
+
+ row = next_row;
+ column = next_column;
+ while (*c != '\t' && *c != '\n' && count < sd->length)
+ {
+ c++;
+ count++;
+ }
+ if ( *c == '\t')
+ {
+ next_row = row ;
+ next_column = column + 1;
+ }
+ else if ( *c == '\n')
+ {
+ next_row = row + 1;
+ next_column = first_column;
+ }
+ *c++ = '\0';
+ count++;
+
+ /* Append some new cases if pasting beyond the last row */
+ if ( row >= psppire_data_store_get_case_count (data_store))
+ psppire_data_store_insert_new_case (data_store, row);
+
+ gtk_sheet_set_cell_text (data_sheet, row, column, s);
+ }
+}
void data_sheet_set_clip (GtkSheet *data_sheet);
+void data_sheet_contents_received_callback (GtkClipboard *clipboard,
+ GtkSelectionData *sd,
+ gpointer data);
+
#endif /* CLIPBOARD_H */
#include "psppire-var-store.h"
static void on_edit_copy (GtkMenuItem *, gpointer);
+static void on_edit_cut (GtkMenuItem *, gpointer);
+static void on_edit_paste (GtkAction *a, gpointer data);
+
static void create_data_sheet_variable_popup_menu (struct data_editor *);
static void create_data_sheet_cases_popup_menu (struct data_editor *);
static void on_filter_change (GObject *, gint, gpointer);
static void on_split_change (PsppireDict *, gpointer);
-static void data_var_select (GtkNotebook *notebook,
+static void on_switch_sheet (GtkNotebook *notebook,
GtkNotebookPage *page,
guint page_num,
gpointer user_data);
psppire_data_store_set_string (store, text, row, column);
}
+
+/* Update the Edit->Paste menuitem
+ If PAGE is not -1 , then it should be set to the current page of
+ the data editors notebook widget.
+ If -1, then it'll be queried.
+*/
+static void
+update_paste_menuitem (struct data_editor *de, gint page)
+{
+ GtkWidget * edit_paste = get_widget_assert (de->xml, "edit_paste");
+ GtkWidget *notebook = get_widget_assert (de->xml, "notebook");
+ GtkSheet * data_sheet ;
+ gint row, column;
+
+ if ( page < 0 )
+ page = gtk_notebook_get_current_page (GTK_NOTEBOOK(notebook));
+
+
+ if ( PAGE_VAR_SHEET == page )
+ {
+ /* We don't yet support pasting to the var sheet */
+ gtk_widget_set_sensitive (edit_paste, FALSE);
+ return;
+ }
+
+ data_sheet = GTK_SHEET (get_widget_assert (de->xml, "data_sheet"));
+
+ gtk_sheet_get_active_cell (data_sheet, &row, &column);
+
+ if ( row < 0 || column < 0 )
+ gtk_widget_set_sensitive (edit_paste, FALSE);
+ else
+ gtk_widget_set_sensitive (edit_paste, TRUE);
+}
+
+/* Update the Edit->Cut and Edit->Copy menuitems
+ If PAGE is not -1 , then it should be set to the current page of
+ the data editors notebook widget.
+ If -1, then it'll be queried.
+*/
+static void
+update_cut_copy_menuitem (struct data_editor *de, gint page)
+{
+ GtkWidget * edit_copy = get_widget_assert (de->xml, "edit_copy");
+ GtkWidget * edit_cut = get_widget_assert (de->xml, "edit_cut");
+ GtkWidget *notebook = get_widget_assert (de->xml, "notebook");
+ GtkSheet * data_sheet ;
+ gint row, column;
+
+ if ( page < 0 )
+ page = gtk_notebook_get_current_page (GTK_NOTEBOOK(notebook));
+
+
+ if ( PAGE_VAR_SHEET == page )
+ {
+ /* We don't yet support copying from the var sheet */
+ gtk_widget_set_sensitive (edit_copy, FALSE);
+ gtk_widget_set_sensitive (edit_cut, FALSE);
+ return;
+ }
+
+ data_sheet = GTK_SHEET (get_widget_assert (de->xml, "data_sheet"));
+
+ gtk_sheet_get_active_cell (data_sheet, &row, &column);
+
+ if ( row < 0 || column < 0 )
+ {
+ gtk_widget_set_sensitive (edit_copy, FALSE);
+ gtk_widget_set_sensitive (edit_cut, FALSE);
+ return;
+ }
+
+ gtk_widget_set_sensitive (edit_copy, TRUE);
+ gtk_widget_set_sensitive (edit_cut, TRUE);
+}
+
+
+/* Callback for when the datasheet's active cell becomes active/inactive */
+static gboolean
+on_data_sheet_activate_change (GtkSheet *sheet,
+ gint row, gint column, gpointer data)
+{
+ struct data_editor *de = data;
+
+ update_paste_menuitem (de, -1);
+ update_cut_copy_menuitem (de, -1);
+
+ return TRUE;
+}
+
extern struct dataset *the_dataset;
/*
var_sheet = GTK_SHEET (get_widget_assert (de->xml, "variable_sheet"));
data_sheet = GTK_SHEET (get_widget_assert (de->xml, "data_sheet"));
+
+ g_signal_connect (G_OBJECT (data_sheet), "activate",
+ G_CALLBACK (on_data_sheet_activate_change), de);
+
+ g_signal_connect (G_OBJECT (data_sheet), "deactivate",
+ G_CALLBACK (on_data_sheet_activate_change), de);
+
+
vs = PSPPIRE_VAR_STORE (gtk_sheet_get_model (var_sheet));
g_assert(vs); /* Traps a possible bug in win32 build */
"activate",
G_CALLBACK (on_edit_copy), de);
+ g_signal_connect (get_widget_assert (de->xml, "edit_cut"),
+ "activate",
+ G_CALLBACK (on_edit_cut), de);
+
register_data_editor_actions (de);
gtk_action_connect_proxy (de->delete_cases,
get_widget_assert (de->xml, "edit_clear-cases"));
+ g_signal_connect (get_widget_assert (de->xml, "edit_paste"), "activate",
+ G_CALLBACK (on_edit_paste), de);
gtk_action_set_visible (de->delete_cases, FALSE);
g_signal_connect (get_widget_assert (de->xml, "notebook"),
"switch-page",
- G_CALLBACK (data_var_select), de);
+ G_CALLBACK (on_switch_sheet), de);
g_signal_connect (get_widget_assert (de->xml, "view_statusbar"),
g_signal_connect (G_OBJECT (data_sheet), "button-event-row",
G_CALLBACK (popup_cases_menu), de);
- /* The "switch-page" signal does get emitted unless the page actually
- changes. But the state is indeterminate at startup. Therefore we
- must explicitly change it to one state, then the other */
- data_editor_select_sheet (de, PAGE_VAR_SHEET);
- data_editor_select_sheet (de, PAGE_DATA_SHEET);
-
return de;
}
window_create (WINDOW_DATA, NULL);
}
-
+/* Callback for when the datasheet/varsheet is selected */
static void
-data_var_select (GtkNotebook *notebook,
+on_switch_sheet (GtkNotebook *notebook,
GtkNotebookPage *page,
guint page_num,
gpointer user_data)
GtkWidget *view_data = get_widget_assert (de->xml, "view_data");
GtkWidget *view_variables = get_widget_assert (de->xml, "view_variables");
- GtkWidget *edit_copy = get_widget_assert (de->xml, "edit_copy");
switch (page_num)
{
case PAGE_VAR_SHEET:
gtk_widget_hide (view_variables);
gtk_widget_show (view_data);
- gtk_widget_set_sensitive (edit_copy, FALSE);
gtk_action_set_sensitive (de->insert_variable, TRUE);
gtk_action_set_sensitive (de->insert_case, FALSE);
gtk_action_set_sensitive (de->invoke_goto_dialog, FALSE);
gtk_widget_show (view_data);
gtk_action_set_sensitive (de->invoke_goto_dialog, TRUE);
gtk_action_set_sensitive (de->insert_case, TRUE);
- gtk_widget_set_sensitive (edit_copy, TRUE);
break;
default:
g_assert_not_reached ();
break;
}
+
+ update_paste_menuitem (de, page_num);
+ update_cut_copy_menuitem (de, page_num);
}
}
+static void
+on_edit_paste (GtkAction *a, gpointer data)
+{
+ GtkClipboard *clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+
+ gtk_clipboard_request_contents (clipboard,
+ gdk_atom_intern ("UTF8_STRING", TRUE),
+ data_sheet_contents_received_callback,
+ data);
+}
+
static void
on_edit_copy (GtkMenuItem *m, gpointer data)
}
+
+static void
+on_edit_cut (GtkMenuItem *m, gpointer data)
+{
+ struct data_editor *de = data;
+ gint max_rows, max_columns;
+ gint r;
+ GtkSheetRange range;
+ PsppireDataStore *ds;
+ GtkSheet *data_sheet = GTK_SHEET (get_widget_assert (de->xml,
+ "data_sheet"));
+
+ data_sheet_set_clip (data_sheet);
+
+
+ /* Now blank all the cells */
+ gtk_sheet_get_selected_range (data_sheet, &range);
+
+ ds = PSPPIRE_DATA_STORE (gtk_sheet_get_model (data_sheet));
+
+
+ /* If nothing selected, then use active cell */
+ if ( range.row0 < 0 || range.col0 < 0 )
+ {
+ gint row, col;
+ gtk_sheet_get_active_cell (data_sheet, &row, &col);
+
+ range.row0 = range.rowi = row;
+ range.col0 = range.coli = col;
+ }
+
+ /* The sheet range can include cells that do not include data.
+ Exclude them from the range. */
+ max_rows = psppire_data_store_get_case_count (ds);
+ if (range.rowi >= max_rows)
+ {
+ if (max_rows == 0)
+ return;
+ range.rowi = max_rows - 1;
+ }
+
+ max_columns = dict_get_var_cnt (ds->dict->dict);
+ if (range.coli >= max_columns)
+ {
+ if (max_columns == 0)
+ return;
+ range.coli = max_columns - 1;
+ }
+
+ g_return_if_fail (range.rowi >= range.row0);
+ g_return_if_fail (range.row0 >= 0);
+ g_return_if_fail (range.coli >= range.col0);
+ g_return_if_fail (range.col0 >= 0);
+
+
+ for (r = range.row0; r <= range.rowi ; ++r )
+ {
+ gint c;
+
+ for (c = range.col0 ; c <= range.coli; ++c)
+ {
+ psppire_data_store_set_string (ds, "", r, c);
+ }
+ }
+
+ /* and remove the selection */
+ gtk_sheet_unselect_range (data_sheet);
+}
+
+