Implemented the Select Cases Dialog
authorJohn Darrington <john@darrington.wattle.id.au>
Sun, 29 Jul 2007 07:56:52 +0000 (07:56 +0000)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 29 Jul 2007 07:56:52 +0000 (07:56 +0000)
14 files changed:
po/de.po
po/pspp.pot
src/ui/gui/automake.mk
src/ui/gui/compute-dialog.c
src/ui/gui/data-editor.c
src/ui/gui/data-editor.glade
src/ui/gui/data-editor.h
src/ui/gui/psppire-data-store.c
src/ui/gui/psppire-data-store.h
src/ui/gui/psppire.glade
src/ui/gui/select-cases-dialog.c [new file with mode: 0644]
src/ui/gui/select-cases-dialog.h [new file with mode: 0644]
src/ui/gui/widget-io.c [new file with mode: 0644]
src/ui/gui/widget-io.h [new file with mode: 0644]

index abaabb600de31d49578ac40a39c844651fd3cd49..1590e1cbf9ea1814d4f6fab7b46a23d360a402dd 100644 (file)
--- a/po/de.po
+++ b/po/de.po
@@ -8,10 +8,10 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: PSPP 0.4.2\n"
+"Project-Id-Version: PSPP 0.4.3\n"
 "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n"
-"POT-Creation-Date: 2007-07-28 13:06+0800\n"
-"PO-Revision-Date: 2006-05-26 17:49+0800\n"
+"POT-Creation-Date: 2007-07-28 19:12+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"
 "MIME-Version: 1.0\n"
@@ -308,13 +308,13 @@ msgstr ""
 
 #: src/data/format.c:318 src/data/por-file-reader.c:492
 #: src/data/sys-file-reader.c:631 src/ui/gui/data-editor.glade:1143
-#: src/ui/gui/psppire.glade:1947 src/ui/gui/psppire-var-store.c:482
+#: src/ui/gui/psppire.glade:2144 src/ui/gui/psppire-var-store.c:482
 msgid "String"
 msgstr "Zeichenkette"
 
 #: src/data/format.c:318 src/data/por-file-reader.c:492
 #: src/data/sys-file-reader.c:631 src/ui/gui/data-editor.glade:1039
-#: src/ui/gui/psppire.glade:2020 src/ui/gui/psppire-var-store.c:475
+#: src/ui/gui/psppire.glade:2217 src/ui/gui/psppire-var-store.c:475
 msgid "Numeric"
 msgstr "Nummer"
 
@@ -1598,7 +1598,7 @@ msgstr ""
 
 #: src/language/dictionary/split-file.c:85
 #: src/language/dictionary/sys-file-info.c:395
-#: src/language/dictionary/sys-file-info.c:543 src/ui/gui/psppire.glade:1911
+#: src/language/dictionary/sys-file-info.c:543 src/ui/gui/psppire.glade:2108
 #: src/ui/gui/var-sheet.c:68
 msgid "Label"
 msgstr "Kennsatz"
@@ -1607,7 +1607,7 @@ msgstr "Kennsatz"
 msgid "File:"
 msgstr "Datei:"
 
-#: src/language/dictionary/sys-file-info.c:110 src/ui/gui/psppire.glade:1852
+#: src/language/dictionary/sys-file-info.c:110 src/ui/gui/psppire.glade:2049
 msgid "Label:"
 msgstr "Kennsatz:"
 
@@ -2517,7 +2517,7 @@ msgstr ""
 msgid "Directional measures."
 msgstr ""
 
-#: src/language/stats/crosstabs.q:1206 src/ui/gui/psppire.glade:2035
+#: src/language/stats/crosstabs.q:1206 src/ui/gui/psppire.glade:2232
 #: src/ui/gui/var-sheet.c:65
 msgid "Type"
 msgstr "Typ"
@@ -4182,214 +4182,223 @@ msgstr "Spalten"
 msgid "Style of bevel around the custom entry button"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:148
+#: src/ui/gui/data-editor.c:149
 msgid "Transformations Pending"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:281
+#: src/ui/gui/data-editor.c:282
 #, fuzzy
 msgid "Labels"
 msgstr "Kennsatz"
 
-#: src/ui/gui/data-editor.c:282
+#: src/ui/gui/data-editor.c:283
 msgid "Show (hide) value labels"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:300 src/ui/gui/data-editor.c:315
-#: src/ui/gui/data-editor.c:1573 src/ui/gui/data-editor.c:1626
+#: src/ui/gui/data-editor.c:301 src/ui/gui/data-editor.c:316
+#: src/ui/gui/data-editor.c:1592 src/ui/gui/data-editor.c:1645
 msgid "Clear"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:301
+#: src/ui/gui/data-editor.c:302
 msgid "Delete the cases at the selected position(s)"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:316
+#: src/ui/gui/data-editor.c:317
 msgid "Delete the variables at the selected position(s)"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:330 src/ui/gui/data-editor.c:1570
+#: src/ui/gui/data-editor.c:331 src/ui/gui/data-editor.c:1589
 #: 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:331
+#: src/ui/gui/data-editor.c:332
 msgid "Create a new variable at the current position"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:349 src/ui/gui/data-editor.c:1623
+#: src/ui/gui/data-editor.c:350 src/ui/gui/data-editor.c:1642
 #: src/ui/gui/data-editor.glade:642
 #, fuzzy
 msgid "Insert Case"
 msgstr "_Stecken"
 
-#: src/ui/gui/data-editor.c:350
+#: src/ui/gui/data-editor.c:351
 msgid "Create a new case at the current position"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:370
+#: src/ui/gui/data-editor.c:371
 #, fuzzy
 msgid "Goto Case"
 msgstr "_Stecken"
 
-#: src/ui/gui/data-editor.c:371
+#: src/ui/gui/data-editor.c:372
 msgid "Jump to a Case in the Data Sheet"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:390
+#: src/ui/gui/data-editor.c:391
 #, fuzzy
 msgid "Weights"
 msgstr "Rechts"
 
-#: src/ui/gui/data-editor.c:391
+#: src/ui/gui/data-editor.c:392
 msgid "Weight cases by variable"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:400 src/ui/gui/data-editor.glade:323
+#: src/ui/gui/data-editor.c:401 src/ui/gui/data-editor.glade:323
 msgid "Transpose"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:401
+#: src/ui/gui/data-editor.c:402
 msgid "Transpose the cases with the variables"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:412
+#: src/ui/gui/data-editor.c:413
 #, fuzzy
 msgid "Split"
 msgstr "Alle Datei"
 
-#: src/ui/gui/data-editor.c:413
+#: src/ui/gui/data-editor.c:414
 msgid "Split the active file"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:423
+#: src/ui/gui/data-editor.c:424
 msgid "Sort"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:424
+#: src/ui/gui/data-editor.c:425
 msgid "Sort cases in the active file"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:433
-msgid "Compute"
+#: src/ui/gui/data-editor.c:433 src/ui/gui/data-editor.glade:360
+#: src/ui/gui/data-editor.glade:697
+msgid "Select Cases"
 msgstr ""
 
 #: src/ui/gui/data-editor.c:434
+msgid "Select cases from the active file"
+msgstr ""
+
+#: src/ui/gui/data-editor.c:443
+msgid "Compute"
+msgstr ""
+
+#: src/ui/gui/data-editor.c:444
 #, fuzzy
 msgid "Compute new values for a variable"
 msgstr "Unpassend Wert für Variable"
 
-#: src/ui/gui/data-editor.c:442
+#: src/ui/gui/data-editor.c:452
 #, fuzzy
 msgid "Data File Comments"
 msgstr "Datei Fehler"
 
-#: src/ui/gui/data-editor.c:443
+#: src/ui/gui/data-editor.c:453
 msgid "Commentary text for the data file"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:451 src/ui/gui/data-editor.glade:267
+#: src/ui/gui/data-editor.c:461 src/ui/gui/data-editor.glade:267
 #: src/ui/gui/data-editor.glade:601
 msgid "Variables"
 msgstr "Variableansicht"
 
-#: src/ui/gui/data-editor.c:452
+#: src/ui/gui/data-editor.c:462
 #, fuzzy
 msgid "Jump to Variable"
 msgstr "Variableansicht"
 
-#: src/ui/gui/data-editor.c:841
+#: src/ui/gui/data-editor.c:860
 msgid "Font Selection"
 msgstr "Schriftwahlung"
 
-#: src/ui/gui/data-editor.c:1048
+#: src/ui/gui/data-editor.c:1067
 msgid "No Split"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1057
+#: src/ui/gui/data-editor.c:1076
 #, fuzzy
 msgid "Split by "
 msgstr "Alle Datei"
 
-#: src/ui/gui/data-editor.c:1082
+#: src/ui/gui/data-editor.c:1101
 msgid "Filter off"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1095
+#: src/ui/gui/data-editor.c:1114
 #, c-format
 msgid "Filter by %s"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1113
+#: src/ui/gui/data-editor.c:1132
 msgid "Weights off"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1126
+#: src/ui/gui/data-editor.c:1145
 #, c-format
 msgid "Weight by %s"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1149 src/ui/gui/data-editor.c:1380
+#: src/ui/gui/data-editor.c:1168 src/ui/gui/data-editor.c:1399
 #: src/ui/gui/data-editor.glade:512
 msgid "Open"
 msgstr "Öffen"
 
-#: src/ui/gui/data-editor.c:1150
+#: src/ui/gui/data-editor.c:1169
 msgid "Open a data file"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1158 src/ui/gui/data-editor.c:1265
+#: src/ui/gui/data-editor.c:1177 src/ui/gui/data-editor.c:1284
 #: src/ui/gui/data-editor.glade:522
 msgid "Save"
 msgstr "Speichen"
 
-#: src/ui/gui/data-editor.c:1159 src/ui/gui/data-editor.c:1169
+#: src/ui/gui/data-editor.c:1178 src/ui/gui/data-editor.c:1188
 #, fuzzy
 msgid "Save data to file"
 msgstr "Speichern unter"
 
-#: src/ui/gui/data-editor.c:1168
+#: src/ui/gui/data-editor.c:1187
 #, fuzzy
 msgid "Save As"
 msgstr "Speichern unter"
 
-#: src/ui/gui/data-editor.c:1177
+#: src/ui/gui/data-editor.c:1196
 msgid "New"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1178
+#: src/ui/gui/data-editor.c:1197
 msgid "New data file"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1273 src/ui/gui/data-editor.c:1388
+#: src/ui/gui/data-editor.c:1292 src/ui/gui/data-editor.c:1407
 msgid "System Files (*.sav)"
 msgstr "Systemedatein (*.sav)"
 
-#: src/ui/gui/data-editor.c:1279 src/ui/gui/data-editor.c:1394
+#: src/ui/gui/data-editor.c:1298 src/ui/gui/data-editor.c:1413
 msgid "Portable Files (*.por) "
 msgstr "Tragbardatein (*.por)"
 
-#: src/ui/gui/data-editor.c:1285 src/ui/gui/data-editor.c:1400
+#: src/ui/gui/data-editor.c:1304 src/ui/gui/data-editor.c:1419
 #: 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:1293
+#: src/ui/gui/data-editor.c:1312
 #, fuzzy
 msgid "System File"
 msgstr "Systemedatein (*.sav)"
 
-#: src/ui/gui/data-editor.c:1298
+#: src/ui/gui/data-editor.c:1317
 #, fuzzy
 msgid "Portable File"
 msgstr "Tragbardatein (*.por)"
 
-#: src/ui/gui/data-editor.c:1563
+#: src/ui/gui/data-editor.c:1582
 msgid "Sort Ascending"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1566
+#: src/ui/gui/data-editor.c:1585
 msgid "Sort Descending"
 msgstr ""
 
@@ -4497,10 +4506,6 @@ msgstr ""
 msgid "Split File"
 msgstr "Alle Datei"
 
-#: src/ui/gui/data-editor.glade:360 src/ui/gui/data-editor.glade:697
-msgid "Select Cases"
-msgstr ""
-
 #: src/ui/gui/data-editor.glade:367 src/ui/gui/data-editor.glade:685
 msgid "Weight Cases"
 msgstr ""
@@ -4785,11 +4790,11 @@ msgstr ""
 msgid "Paste"
 msgstr "Datum"
 
-#: src/ui/gui/psppire-data-store.c:745
+#: src/ui/gui/psppire-data-store.c:744
 msgid "var"
 msgstr ""
 
-#: src/ui/gui/psppire-data-store.c:866 src/ui/gui/psppire-var-store.c:710
+#: src/ui/gui/psppire-data-store.c:865 src/ui/gui/psppire-var-store.c:710
 #, c-format
 msgid "%ld"
 msgstr ""
@@ -4912,86 +4917,78 @@ msgstr ""
 msgid "Functions:"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1120 src/ui/gui/psppire.glade:1275
+#: src/ui/gui/psppire.glade:1120 src/ui/gui/psppire.glade:1517
 msgid "If..."
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1231
+#: src/ui/gui/psppire.glade:1349
 #, fuzzy
-msgid "All Cases"
-msgstr "Alle Datei"
+msgid "Use filter variable"
+msgstr "Variableansicht"
 
-#: src/ui/gui/psppire.glade:1256
-msgid "If condition is satisfied"
+#: src/ui/gui/psppire.glade:1401
+msgid "Based on time or case range"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1311
-msgid "Random Sample of cases"
+#: src/ui/gui/psppire.glade:1414
+msgid "Range..."
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1325
+#: src/ui/gui/psppire.glade:1452
+msgid "Random sample of cases"
+msgstr ""
+
+#: src/ui/gui/psppire.glade:1465
 #, fuzzy
 msgid "Sample..."
 msgstr "Muster"
 
-#: src/ui/gui/psppire.glade:1336
-msgid "Approximately 23% of cases"
-msgstr ""
-
-#: src/ui/gui/psppire.glade:1371
-msgid "Based on time or case range"
-msgstr ""
-
-#: src/ui/gui/psppire.glade:1385
-msgid "Range..."
-msgstr ""
-
-#: src/ui/gui/psppire.glade:1396
-msgid "2 thru 3"
+#: src/ui/gui/psppire.glade:1503
+msgid "If condition is satisfied"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1431
+#: src/ui/gui/psppire.glade:1551
 #, fuzzy
-msgid "Use filter variable"
-msgstr "Variableansicht"
+msgid "All Cases"
+msgstr "Alle Datei"
 
-#: src/ui/gui/psppire.glade:1478
+#: src/ui/gui/psppire.glade:1566
 #, fuzzy
 msgid "Select"
 msgstr "Schriftwahlung"
 
-#: src/ui/gui/psppire.glade:1507
+#: src/ui/gui/psppire.glade:1595
 #, fuzzy
 msgid "Filtered"
 msgstr "Datei:"
 
-#: src/ui/gui/psppire.glade:1517
+#: src/ui/gui/psppire.glade:1605
 msgid "Deleted"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1534
+#: src/ui/gui/psppire.glade:1622
 #, fuzzy
 msgid "Unselected Cases Are"
 msgstr "_Stecken"
 
-#: src/ui/gui/psppire.glade:1596
+#: src/ui/gui/psppire.glade:1687
 #, fuzzy
 msgid "Comments:"
 msgstr "Spalten"
 
-#: src/ui/gui/psppire.glade:1638
+#: src/ui/gui/psppire.glade:1729
 msgid "Display comments in output"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1652
+#: src/ui/gui/psppire.glade:1743
 msgid "Column Number: 0"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1728
+#: src/ui/gui/psppire.glade:1819
 msgid "Variable Information:"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1754
+#: src/ui/gui/psppire.glade:1845
 msgid ""
 "\n"
 "\n"
@@ -5005,18 +5002,36 @@ msgid ""
 "\n"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1833
+#: src/ui/gui/psppire.glade:1939
+msgid "First case"
+msgstr ""
+
+#: src/ui/gui/psppire.glade:1952
+#, fuzzy
+msgid "Last case"
+msgstr "_Stecken"
+
+#: src/ui/gui/psppire.glade:1965
+msgid "Observation"
+msgstr ""
+
+#: src/ui/gui/psppire.glade:2030
 msgid "Use expression as label"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1958 src/ui/gui/var-sheet.c:66
+#: src/ui/gui/psppire.glade:2155 src/ui/gui/var-sheet.c:66
 msgid "Width"
 msgstr "Große"
 
-#: src/ui/gui/psppire.glade:2086
+#: src/ui/gui/psppire.glade:2283
 msgid "Goto Case Number:"
 msgstr ""
 
+#: src/ui/gui/psppire.glade:2418
+#, fuzzy
+msgid "Sample Size"
+msgstr "Muster"
+
 #: src/ui/gui/psppire-var-store.c:468 src/ui/gui/var-display.c:14
 msgid "None"
 msgstr "Keine"
@@ -5035,6 +5050,16 @@ msgstr "Spezial"
 msgid "%d"
 msgstr ""
 
+#: src/ui/gui/select-cases-dialog.c:67
+#, c-format
+msgid "Approximately %3d%% of all cases."
+msgstr ""
+
+#: src/ui/gui/select-cases-dialog.c:68
+#, c-format
+msgid "Exactly %3d cases from the first %3d cases."
+msgstr "Aus %2$3d beispielen, wahl genau %1$3d daren"
+
 #: src/ui/gui/syntax-editor.c:77
 #, c-format
 msgid "Save contents of syntax editor to %s?"
index fd997be54afc348eb41ec069393ead3e00f88ed3..37df691ed0267881873d165b4c58967f3860ea35 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n"
-"POT-Creation-Date: 2007-07-28 13:06+0800\n"
+"POT-Creation-Date: 2007-07-28 19:12+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"
@@ -306,13 +306,13 @@ msgstr ""
 
 #: src/data/format.c:318 src/data/por-file-reader.c:492
 #: src/data/sys-file-reader.c:631 src/ui/gui/data-editor.glade:1143
-#: src/ui/gui/psppire.glade:1947 src/ui/gui/psppire-var-store.c:482
+#: src/ui/gui/psppire.glade:2144 src/ui/gui/psppire-var-store.c:482
 msgid "String"
 msgstr ""
 
 #: src/data/format.c:318 src/data/por-file-reader.c:492
 #: src/data/sys-file-reader.c:631 src/ui/gui/data-editor.glade:1039
-#: src/ui/gui/psppire.glade:2020 src/ui/gui/psppire-var-store.c:475
+#: src/ui/gui/psppire.glade:2217 src/ui/gui/psppire-var-store.c:475
 msgid "Numeric"
 msgstr ""
 
@@ -1592,7 +1592,7 @@ msgstr ""
 
 #: src/language/dictionary/split-file.c:85
 #: src/language/dictionary/sys-file-info.c:395
-#: src/language/dictionary/sys-file-info.c:543 src/ui/gui/psppire.glade:1911
+#: src/language/dictionary/sys-file-info.c:543 src/ui/gui/psppire.glade:2108
 #: src/ui/gui/var-sheet.c:68
 msgid "Label"
 msgstr ""
@@ -1601,7 +1601,7 @@ msgstr ""
 msgid "File:"
 msgstr ""
 
-#: src/language/dictionary/sys-file-info.c:110 src/ui/gui/psppire.glade:1852
+#: src/language/dictionary/sys-file-info.c:110 src/ui/gui/psppire.glade:2049
 msgid "Label:"
 msgstr ""
 
@@ -2511,7 +2511,7 @@ msgstr ""
 msgid "Directional measures."
 msgstr ""
 
-#: src/language/stats/crosstabs.q:1206 src/ui/gui/psppire.glade:2035
+#: src/language/stats/crosstabs.q:1206 src/ui/gui/psppire.glade:2232
 #: src/ui/gui/var-sheet.c:65
 msgid "Type"
 msgstr ""
@@ -4175,200 +4175,209 @@ msgstr ""
 msgid "Style of bevel around the custom entry button"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:148
+#: src/ui/gui/data-editor.c:149
 msgid "Transformations Pending"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:281
+#: src/ui/gui/data-editor.c:282
 msgid "Labels"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:282
+#: src/ui/gui/data-editor.c:283
 msgid "Show (hide) value labels"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:300 src/ui/gui/data-editor.c:315
-#: src/ui/gui/data-editor.c:1573 src/ui/gui/data-editor.c:1626
+#: src/ui/gui/data-editor.c:301 src/ui/gui/data-editor.c:316
+#: src/ui/gui/data-editor.c:1592 src/ui/gui/data-editor.c:1645
 msgid "Clear"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:301
+#: src/ui/gui/data-editor.c:302
 msgid "Delete the cases at the selected position(s)"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:316
+#: src/ui/gui/data-editor.c:317
 msgid "Delete the variables at the selected position(s)"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:330 src/ui/gui/data-editor.c:1570
+#: src/ui/gui/data-editor.c:331 src/ui/gui/data-editor.c:1589
 #: src/ui/gui/data-editor.glade:286 src/ui/gui/data-editor.glade:654
 msgid "Insert Variable"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:331
+#: src/ui/gui/data-editor.c:332
 msgid "Create a new variable at the current position"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:349 src/ui/gui/data-editor.c:1623
+#: src/ui/gui/data-editor.c:350 src/ui/gui/data-editor.c:1642
 #: src/ui/gui/data-editor.glade:642
 msgid "Insert Case"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:350
+#: src/ui/gui/data-editor.c:351
 msgid "Create a new case at the current position"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:370
+#: src/ui/gui/data-editor.c:371
 msgid "Goto Case"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:371
+#: src/ui/gui/data-editor.c:372
 msgid "Jump to a Case in the Data Sheet"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:390
+#: src/ui/gui/data-editor.c:391
 msgid "Weights"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:391
+#: src/ui/gui/data-editor.c:392
 msgid "Weight cases by variable"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:400 src/ui/gui/data-editor.glade:323
+#: src/ui/gui/data-editor.c:401 src/ui/gui/data-editor.glade:323
 msgid "Transpose"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:401
+#: src/ui/gui/data-editor.c:402
 msgid "Transpose the cases with the variables"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:412
+#: src/ui/gui/data-editor.c:413
 msgid "Split"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:413
+#: src/ui/gui/data-editor.c:414
 msgid "Split the active file"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:423
+#: src/ui/gui/data-editor.c:424
 msgid "Sort"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:424
+#: src/ui/gui/data-editor.c:425
 msgid "Sort cases in the active file"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:433
-msgid "Compute"
+#: src/ui/gui/data-editor.c:433 src/ui/gui/data-editor.glade:360
+#: src/ui/gui/data-editor.glade:697
+msgid "Select Cases"
 msgstr ""
 
 #: src/ui/gui/data-editor.c:434
+msgid "Select cases from the active file"
+msgstr ""
+
+#: src/ui/gui/data-editor.c:443
+msgid "Compute"
+msgstr ""
+
+#: src/ui/gui/data-editor.c:444
 msgid "Compute new values for a variable"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:442
+#: src/ui/gui/data-editor.c:452
 msgid "Data File Comments"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:443
+#: src/ui/gui/data-editor.c:453
 msgid "Commentary text for the data file"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:451 src/ui/gui/data-editor.glade:267
+#: src/ui/gui/data-editor.c:461 src/ui/gui/data-editor.glade:267
 #: src/ui/gui/data-editor.glade:601
 msgid "Variables"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:452
+#: src/ui/gui/data-editor.c:462
 msgid "Jump to Variable"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:841
+#: src/ui/gui/data-editor.c:860
 msgid "Font Selection"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1048
+#: src/ui/gui/data-editor.c:1067
 msgid "No Split"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1057
+#: src/ui/gui/data-editor.c:1076
 msgid "Split by "
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1082
+#: src/ui/gui/data-editor.c:1101
 msgid "Filter off"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1095
+#: src/ui/gui/data-editor.c:1114
 #, c-format
 msgid "Filter by %s"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1113
+#: src/ui/gui/data-editor.c:1132
 msgid "Weights off"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1126
+#: src/ui/gui/data-editor.c:1145
 #, c-format
 msgid "Weight by %s"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1149 src/ui/gui/data-editor.c:1380
+#: src/ui/gui/data-editor.c:1168 src/ui/gui/data-editor.c:1399
 #: src/ui/gui/data-editor.glade:512
 msgid "Open"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1150
+#: src/ui/gui/data-editor.c:1169
 msgid "Open a data file"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1158 src/ui/gui/data-editor.c:1265
+#: src/ui/gui/data-editor.c:1177 src/ui/gui/data-editor.c:1284
 #: src/ui/gui/data-editor.glade:522
 msgid "Save"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1159 src/ui/gui/data-editor.c:1169
+#: src/ui/gui/data-editor.c:1178 src/ui/gui/data-editor.c:1188
 msgid "Save data to file"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1168
+#: src/ui/gui/data-editor.c:1187
 msgid "Save As"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1177
+#: src/ui/gui/data-editor.c:1196
 msgid "New"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1178
+#: src/ui/gui/data-editor.c:1197
 msgid "New data file"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1273 src/ui/gui/data-editor.c:1388
+#: src/ui/gui/data-editor.c:1292 src/ui/gui/data-editor.c:1407
 msgid "System Files (*.sav)"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1279 src/ui/gui/data-editor.c:1394
+#: src/ui/gui/data-editor.c:1298 src/ui/gui/data-editor.c:1413
 msgid "Portable Files (*.por) "
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1285 src/ui/gui/data-editor.c:1400
+#: src/ui/gui/data-editor.c:1304 src/ui/gui/data-editor.c:1419
 #: src/ui/gui/syntax-editor.c:138 src/ui/gui/syntax-editor.c:524
 msgid "All Files"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1293
+#: src/ui/gui/data-editor.c:1312
 msgid "System File"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1298
+#: src/ui/gui/data-editor.c:1317
 msgid "Portable File"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1563
+#: src/ui/gui/data-editor.c:1582
 msgid "Sort Ascending"
 msgstr ""
 
-#: src/ui/gui/data-editor.c:1566
+#: src/ui/gui/data-editor.c:1585
 msgid "Sort Descending"
 msgstr ""
 
@@ -4468,10 +4477,6 @@ msgstr ""
 msgid "Split File"
 msgstr ""
 
-#: src/ui/gui/data-editor.glade:360 src/ui/gui/data-editor.glade:697
-msgid "Select Cases"
-msgstr ""
-
 #: src/ui/gui/data-editor.glade:367 src/ui/gui/data-editor.glade:685
 msgid "Weight Cases"
 msgstr ""
@@ -4748,11 +4753,11 @@ msgstr ""
 msgid "Paste"
 msgstr ""
 
-#: src/ui/gui/psppire-data-store.c:745
+#: src/ui/gui/psppire-data-store.c:744
 msgid "var"
 msgstr ""
 
-#: src/ui/gui/psppire-data-store.c:866 src/ui/gui/psppire-var-store.c:710
+#: src/ui/gui/psppire-data-store.c:865 src/ui/gui/psppire-var-store.c:710
 #, c-format
 msgid "%ld"
 msgstr ""
@@ -4870,79 +4875,71 @@ msgstr ""
 msgid "Functions:"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1120 src/ui/gui/psppire.glade:1275
+#: src/ui/gui/psppire.glade:1120 src/ui/gui/psppire.glade:1517
 msgid "If..."
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1231
-msgid "All Cases"
-msgstr ""
-
-#: src/ui/gui/psppire.glade:1256
-msgid "If condition is satisfied"
-msgstr ""
-
-#: src/ui/gui/psppire.glade:1311
-msgid "Random Sample of cases"
+#: src/ui/gui/psppire.glade:1349
+msgid "Use filter variable"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1325
-msgid "Sample..."
+#: src/ui/gui/psppire.glade:1401
+msgid "Based on time or case range"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1336
-msgid "Approximately 23% of cases"
+#: src/ui/gui/psppire.glade:1414
+msgid "Range..."
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1371
-msgid "Based on time or case range"
+#: src/ui/gui/psppire.glade:1452
+msgid "Random sample of cases"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1385
-msgid "Range..."
+#: src/ui/gui/psppire.glade:1465
+msgid "Sample..."
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1396
-msgid "2 thru 3"
+#: src/ui/gui/psppire.glade:1503
+msgid "If condition is satisfied"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1431
-msgid "Use filter variable"
+#: src/ui/gui/psppire.glade:1551
+msgid "All Cases"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1478
+#: src/ui/gui/psppire.glade:1566
 msgid "Select"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1507
+#: src/ui/gui/psppire.glade:1595
 msgid "Filtered"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1517
+#: src/ui/gui/psppire.glade:1605
 msgid "Deleted"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1534
+#: src/ui/gui/psppire.glade:1622
 msgid "Unselected Cases Are"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1596
+#: src/ui/gui/psppire.glade:1687
 msgid "Comments:"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1638
+#: src/ui/gui/psppire.glade:1729
 msgid "Display comments in output"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1652
+#: src/ui/gui/psppire.glade:1743
 msgid "Column Number: 0"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1728
+#: src/ui/gui/psppire.glade:1819
 msgid "Variable Information:"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1754
+#: src/ui/gui/psppire.glade:1845
 msgid ""
 "\n"
 "\n"
@@ -4956,18 +4953,34 @@ msgid ""
 "\n"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1833
+#: src/ui/gui/psppire.glade:1939
+msgid "First case"
+msgstr ""
+
+#: src/ui/gui/psppire.glade:1952
+msgid "Last case"
+msgstr ""
+
+#: src/ui/gui/psppire.glade:1965
+msgid "Observation"
+msgstr ""
+
+#: src/ui/gui/psppire.glade:2030
 msgid "Use expression as label"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:1958 src/ui/gui/var-sheet.c:66
+#: src/ui/gui/psppire.glade:2155 src/ui/gui/var-sheet.c:66
 msgid "Width"
 msgstr ""
 
-#: src/ui/gui/psppire.glade:2086
+#: src/ui/gui/psppire.glade:2283
 msgid "Goto Case Number:"
 msgstr ""
 
+#: src/ui/gui/psppire.glade:2418
+msgid "Sample Size"
+msgstr ""
+
 #: src/ui/gui/psppire-var-store.c:468 src/ui/gui/var-display.c:14
 msgid "None"
 msgstr ""
@@ -4986,6 +4999,16 @@ msgstr ""
 msgid "%d"
 msgstr ""
 
+#: src/ui/gui/select-cases-dialog.c:67
+#, c-format
+msgid "Approximately %3d%% of all cases."
+msgstr ""
+
+#: src/ui/gui/select-cases-dialog.c:68
+#, c-format
+msgid "Exactly %3d cases from the first %3d cases."
+msgstr ""
+
 #: src/ui/gui/syntax-editor.c:77
 #, c-format
 msgid "Save contents of syntax editor to %s?"
index 9b5d4154cdf8e40828032d6d0de64dbc44aeb50e..dff1a96cdea1e073348943c05603bbec79d990ec 100644 (file)
@@ -116,6 +116,8 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/psppire-selector.h \
        src/ui/gui/psppire-var-store.c \
        src/ui/gui/psppire-var-store.h \
+       src/ui/gui/select-cases-dialog.c \
+       src/ui/gui/select-cases-dialog.h \
        src/ui/gui/sort-cases-dialog.c \
        src/ui/gui/sort-cases-dialog.h \
        src/ui/gui/split-file-dialog.c \
@@ -138,6 +140,8 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/variable-info-dialog.h \
        src/ui/gui/weight-cases-dialog.c \
        src/ui/gui/weight-cases-dialog.h \
+       src/ui/gui/widget-io.c \
+       src/ui/gui/widget-io.h \
        src/ui/gui/window-manager.c \
        src/ui/gui/window-manager.h
 
index 739d6b17cc504862631abed82986149452a5d141..6a3b0aaa75cdccb1d380539b86a3893c36db7147 100644 (file)
@@ -405,7 +405,6 @@ compute_dialog (GObject *o, gpointer data)
 
 
 
-  
   response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
 
 
index 9681a09f1be8813e1e14d7696839afd8f39cf743..8fd9517db535ca94c6efe062bb59752c8880ebd4 100644 (file)
@@ -33,6 +33,7 @@
 #include "split-file-dialog.h"
 #include "transpose-dialog.h"
 #include "sort-cases-dialog.h"
+#include "select-cases-dialog.h"
 #include "compute-dialog.h"
 #include "goto-case-dialog.h"
 #include "comments-dialog.h"
@@ -427,6 +428,15 @@ new_data_editor (void)
   g_signal_connect (de->invoke_sort_cases_dialog, "activate",
                    G_CALLBACK (sort_cases_dialog), de);
 
+  de->invoke_select_cases_dialog =
+    gtk_action_new ("select-cases-dialog",
+                   _("Select Cases"),
+                   _("Select cases from the active file"),
+                   "pspp-select-cases");
+
+  g_signal_connect (de->invoke_select_cases_dialog, "activate",
+                   G_CALLBACK (select_cases_dialog), de);
+
 
   de->invoke_compute_dialog =
     gtk_action_new ("compute-dialog",
@@ -547,6 +557,10 @@ new_data_editor (void)
                            get_widget_assert (de->xml, "data_sort-cases")
                            );
 
+  gtk_action_connect_proxy (de->invoke_select_cases_dialog,
+                           get_widget_assert (de->xml, "data_select-cases")
+                           );
+
   gtk_action_connect_proxy (de->invoke_compute_dialog,
                            get_widget_assert (de->xml, "transform_compute")
                            );
@@ -649,6 +663,11 @@ new_data_editor (void)
                            get_widget_assert (de->xml, "button-split-file")
                            );
 
+  gtk_action_connect_proxy (de->invoke_select_cases_dialog,
+                           get_widget_assert (de->xml, "button-select-cases")
+                           );
+
+
   g_signal_connect (get_widget_assert (de->xml, "file_quit"),
                    "activate",
                    G_CALLBACK (file_quit), de);
index c572558845c01f3335a888b08565355f946fca96..24ee580756625d6a14ea7e5d4d392c7e76204f05 100644 (file)
                       </widget>
                     </child>
                     <child>
-                      <widget class="GtkMenuItem" id="select_cases1">
+                      <widget class="GtkMenuItem" id="data_select-cases">
                         <property name="visible">True</property>
                         <property name="sensitive">False</property>
                         <property name="label" translatable="yes">Select Cases</property>
index 2186d4cf8e0cc8f5218da9bb722bd0e796c71245..00430e9f62e261f65033e1ad67d8ae1006c8ea60 100644 (file)
@@ -38,6 +38,7 @@ struct data_editor
   GtkAction *invoke_sort_cases_dialog;
   GtkAction *invoke_compute_dialog;
   GtkAction *invoke_comments_dialog;
+  GtkAction *invoke_select_cases_dialog;
   GtkAction *invoke_goto_dialog;
   GtkAction *invoke_variable_info_dialog;
 
index 323196e459bee11d9afb4773ce802b220334c32d..f79f44737e4b52c265c1139218204783b4c2a307 100644 (file)
@@ -159,18 +159,17 @@ psppire_data_store_get_var_count (const GSheetModel *model)
   return psppire_dict_get_var_cnt (store->dict);
 }
 
-casenumber
-psppire_data_store_get_case_count (PsppireDataStore *store)
+inline casenumber
+psppire_data_store_get_case_count (const PsppireDataStore *store)
 {
   return psppire_case_file_get_case_count (store->case_file);
 }
 
-static glong
-psppire_data_store_get_case_count_from_model (const GSheetModel *model)
+inline casenumber
+psppire_data_store_get_case_count_wrapper (const GSheetModel *model)
 {
   const PsppireDataStore *store = PSPPIRE_DATA_STORE (model);
-
-  return psppire_case_file_get_case_count (store->case_file);
+  return psppire_data_store_get_case_count (store);
 }
 
 static void
@@ -224,7 +223,7 @@ psppire_data_store_sheet_model_init (GSheetModelIface *iface)
   iface->get_font_desc = psppire_data_store_get_font_desc;
   iface->get_cell_border = NULL;
   iface->get_column_count = psppire_data_store_get_var_count;
-  iface->get_row_count = psppire_data_store_get_case_count_from_model;
+  iface->get_row_count = psppire_data_store_get_case_count_wrapper;
 }
 
 static
index 699f924a2a13c5a04616264b62895495baa19813..8e29db33ab9033311b6b662b71c301bb51315ead 100644 (file)
@@ -118,8 +118,7 @@ gboolean psppire_data_store_set_string (PsppireDataStore *ds,
                                        const gchar *text,
                                        glong row, glong column);
 
-casenumber psppire_data_store_get_case_count (PsppireDataStore *store);
-
+casenumber psppire_data_store_get_case_count (const PsppireDataStore *ds);
 
 #ifdef __cplusplus
 }
index 7c3b1266215859fe66a3244db59a21c2faf6638a..0526467bba6fbcad20a481a8647a85dc397b6fe1 100644 (file)
           <widget class="GtkAlignment" id="alignment2">
             <property name="visible">True</property>
             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+            <property name="yscale">0</property>
             <property name="top_padding">5</property>
             <property name="left_padding">5</property>
             <property name="right_padding">5</property>
                     <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
                     <property name="shadow_type">GTK_SHADOW_IN</property>
                     <child>
-                      <widget class="GtkTreeView" id="treeview1">
+                      <widget class="GtkTreeView" id="select-cases-treeview">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                   </widget>
                 </child>
                 <child>
-                  <widget class="GtkVBox" id="vbox10">
+                  <widget class="GtkVBox" id="vbox13">
                     <property name="visible">True</property>
                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                     <child>
-                      <widget class="GtkFrame" id="Select1">
+                      <widget class="GtkFrame" id="Select5">
                         <property name="visible">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                         <property name="label_xalign">0</property>
                         <child>
-                          <widget class="GtkAlignment" id="alignment3">
+                          <widget class="GtkAlignment" id="alignment11">
                             <property name="visible">True</property>
                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="xscale">0</property>
                             <property name="left_padding">12</property>
+                            <property name="right_padding">5</property>
                             <child>
-                              <widget class="GtkVButtonBox" id="vbuttonbox3">
+                              <widget class="GtkTable" id="table2">
                                 <property name="visible">True</property>
                                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                <property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
+                                <property name="n_rows">5</property>
+                                <property name="n_columns">2</property>
+                                <property name="row_spacing">5</property>
                                 <child>
-                                  <widget class="GtkRadioButton" id="radiobutton1">
+                                  <widget class="GtkRadioButton" id="radiobutton-all">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                    <property name="label" translatable="yes">All Cases</property>
                                     <property name="active">True</property>
                                     <property name="draw_indicator">True</property>
                                   </widget>
+                                </child>
+                                <child>
+                                  <widget class="GtkAlignment" id="alignment18">
+                                    <property name="visible">True</property>
+                                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <property name="xalign">0</property>
+                                    <property name="yalign">0</property>
+                                    <property name="xscale">0</property>
+                                    <property name="yscale">0</property>
+                                    <child>
+                                      <widget class="GtkRadioButton" id="radiobutton-filter-variable">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                        <property name="active">True</property>
+                                        <property name="draw_indicator">True</property>
+                                        <property name="group">radiobutton-all</property>
+                                      </widget>
+                                    </child>
+                                  </widget>
                                   <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
+                                    <property name="top_attach">4</property>
+                                    <property name="bottom_attach">5</property>
+                                    <property name="x_options"></property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <widget class="GtkRadioButton" id="radiobutton3">
+                                  <widget class="GtkAlignment" id="alignment17">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                    <property name="active">True</property>
-                                    <property name="draw_indicator">True</property>
-                                    <property name="group">radiobutton1</property>
+                                    <property name="xalign">0</property>
+                                    <property name="yalign">0</property>
+                                    <property name="xscale">0</property>
+                                    <property name="yscale">0</property>
+                                    <child>
+                                      <widget class="GtkRadioButton" id="radiobutton-range">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                        <property name="active">True</property>
+                                        <property name="draw_indicator">True</property>
+                                        <property name="group">radiobutton-all</property>
+                                      </widget>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="top_attach">3</property>
+                                    <property name="bottom_attach">4</property>
+                                    <property name="x_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkAlignment" id="alignment16">
+                                    <property name="visible">True</property>
+                                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <property name="xalign">0</property>
+                                    <property name="yalign">0</property>
+                                    <property name="xscale">0</property>
+                                    <property name="yscale">0</property>
+                                    <child>
+                                      <widget class="GtkRadioButton" id="radiobutton-sample">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                        <property name="active">True</property>
+                                        <property name="draw_indicator">True</property>
+                                        <property name="group">radiobutton-all</property>
+                                      </widget>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="top_attach">2</property>
+                                    <property name="bottom_attach">3</property>
+                                    <property name="x_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkAlignment" id="alignment13">
+                                    <property name="visible">True</property>
+                                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <property name="xalign">0</property>
+                                    <property name="yalign">0</property>
+                                    <property name="xscale">0</property>
+                                    <property name="yscale">0</property>
+                                    <child>
+                                      <widget class="GtkRadioButton" id="radiobutton-if">
+                                        <property name="visible">True</property>
+                                        <property name="sensitive">False</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                        <property name="active">True</property>
+                                        <property name="draw_indicator">True</property>
+                                        <property name="group">radiobutton-all</property>
+                                      </widget>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="top_attach">1</property>
+                                    <property name="bottom_attach">2</property>
+                                    <property name="x_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkVBox" id="vbox26">
+                                    <property name="visible">True</property>
+                                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <child>
+                                      <widget class="GtkLabel" id="label25">
+                                        <property name="visible">True</property>
+                                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                        <property name="xalign">0</property>
+                                        <property name="label" translatable="yes">Use filter variable</property>
+                                      </widget>
+                                    </child>
                                     <child>
-                                      <widget class="GtkVBox" id="vbox11">
+                                      <widget class="GtkHBox" id="hbox19">
                                         <property name="visible">True</property>
                                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                                         <child>
-                                          <widget class="GtkLabel" id="label8">
+                                          <widget class="PsppireSelector" id="psppire-selector-filter">
                                             <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
                                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                            <property name="label" translatable="yes">If condition is satisfied</property>
+                                            <property name="border_width">5</property>
                                           </widget>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="fill">False</property>
+                                          </packing>
                                         </child>
                                         <child>
-                                          <widget class="GtkHBox" id="hbox9">
+                                          <widget class="GtkEntry" id="filter-variable-entry">
                                             <property name="visible">True</property>
+                                            <property name="sensitive">False</property>
+                                            <property name="can_focus">True</property>
                                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                            <child>
-                                              <widget class="GtkAlignment" id="alignment4">
-                                                <property name="visible">True</property>
-                                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                                <property name="xalign">0</property>
-                                                <property name="xscale">0</property>
-                                                <child>
-                                                  <widget class="GtkButton" id="button1">
-                                                    <property name="visible">True</property>
-                                                    <property name="can_focus">True</property>
-                                                    <property name="receives_default">True</property>
-                                                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                                    <property name="label" translatable="yes">If...</property>
-                                                  </widget>
-                                                </child>
-                                              </widget>
-                                            </child>
                                           </widget>
                                           <packing>
-                                            <property name="expand">False</property>
-                                            <property name="fill">False</property>
                                             <property name="position">1</property>
                                           </packing>
                                         </child>
                                       </widget>
+                                      <packing>
+                                        <property name="position">1</property>
+                                      </packing>
                                     </child>
                                   </widget>
                                   <packing>
-                                    <property name="position">1</property>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                    <property name="top_attach">4</property>
+                                    <property name="bottom_attach">5</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <widget class="GtkRadioButton" id="radiobutton4">
+                                  <widget class="GtkVBox" id="vbox25">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                    <property name="active">True</property>
-                                    <property name="draw_indicator">True</property>
-                                    <property name="group">radiobutton1</property>
                                     <child>
-                                      <widget class="GtkVBox" id="vbox13">
+                                      <widget class="GtkLabel" id="label15">
+                                        <property name="visible">True</property>
+                                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                        <property name="xalign">0</property>
+                                        <property name="label" translatable="yes">Based on time or case range</property>
+                                      </widget>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkHBox" id="hbox12">
                                         <property name="visible">True</property>
                                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                                         <child>
-                                          <widget class="GtkLabel" id="label9">
+                                          <widget class="GtkButton" id="button-range">
                                             <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
                                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                            <property name="xalign">0</property>
-                                            <property name="label" translatable="yes">Random Sample of cases</property>
+                                            <property name="label" translatable="yes">Range...</property>
                                           </widget>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="fill">False</property>
+                                          </packing>
                                         </child>
                                         <child>
-                                          <widget class="GtkHBox" id="hbox10">
+                                          <widget class="GtkLabel" id="range-sample-label">
                                             <property name="visible">True</property>
                                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                            <property name="spacing">5</property>
-                                            <child>
-                                              <widget class="GtkButton" id="button2">
-                                                <property name="visible">True</property>
-                                                <property name="can_focus">True</property>
-                                                <property name="receives_default">True</property>
-                                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                                <property name="label" translatable="yes">Sample...</property>
-                                              </widget>
-                                              <packing>
-                                                <property name="expand">False</property>
-                                                <property name="fill">False</property>
-                                              </packing>
-                                            </child>
-                                            <child>
-                                              <widget class="GtkLabel" id="label10">
-                                                <property name="visible">True</property>
-                                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                                <property name="label" translatable="yes">Approximately 23% of cases</property>
-                                                <property name="single_line_mode">True</property>
-                                              </widget>
-                                              <packing>
-                                                <property name="position">1</property>
-                                              </packing>
-                                            </child>
                                           </widget>
                                           <packing>
                                             <property name="position">1</property>
                                           </packing>
                                         </child>
                                       </widget>
+                                      <packing>
+                                        <property name="position">1</property>
+                                      </packing>
                                     </child>
                                   </widget>
                                   <packing>
-                                    <property name="position">2</property>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                    <property name="top_attach">3</property>
+                                    <property name="bottom_attach">4</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <widget class="GtkRadioButton" id="radiobutton5">
+                                  <widget class="GtkVBox" id="vbox24">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                    <property name="active">True</property>
-                                    <property name="draw_indicator">True</property>
-                                    <property name="group">radiobutton1</property>
                                     <child>
-                                      <widget class="GtkVBox" id="vbox14">
+                                      <widget class="GtkLabel" id="label13">
+                                        <property name="visible">True</property>
+                                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                        <property name="xalign">0</property>
+                                        <property name="label" translatable="yes">Random sample of cases</property>
+                                      </widget>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkHBox" id="hbox11">
                                         <property name="visible">True</property>
                                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                        <property name="spacing">5</property>
                                         <child>
-                                          <widget class="GtkLabel" id="label11">
+                                          <widget class="GtkButton" id="button-sample">
                                             <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
                                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                            <property name="label" translatable="yes">Based on time or case range</property>
+                                            <property name="label" translatable="yes">Sample...</property>
                                           </widget>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="fill">False</property>
+                                          </packing>
                                         </child>
                                         <child>
-                                          <widget class="GtkHBox" id="hbox11">
+                                          <widget class="GtkLabel" id="random-sample-label">
                                             <property name="visible">True</property>
                                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                            <property name="spacing">5</property>
-                                            <child>
-                                              <widget class="GtkButton" id="button3">
-                                                <property name="visible">True</property>
-                                                <property name="can_focus">True</property>
-                                                <property name="receives_default">True</property>
-                                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                                <property name="label" translatable="yes">Range...</property>
-                                              </widget>
-                                              <packing>
-                                                <property name="expand">False</property>
-                                                <property name="fill">False</property>
-                                              </packing>
-                                            </child>
-                                            <child>
-                                              <widget class="GtkLabel" id="label12">
-                                                <property name="visible">True</property>
-                                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                                <property name="label" translatable="yes">2 thru 3</property>
-                                              </widget>
-                                              <packing>
-                                                <property name="position">1</property>
-                                              </packing>
-                                            </child>
                                           </widget>
                                           <packing>
                                             <property name="position">1</property>
                                           </packing>
                                         </child>
                                       </widget>
+                                      <packing>
+                                        <property name="position">1</property>
+                                      </packing>
                                     </child>
                                   </widget>
                                   <packing>
-                                    <property name="position">3</property>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                    <property name="top_attach">2</property>
+                                    <property name="bottom_attach">3</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <widget class="GtkRadioButton" id="radiobutton6">
+                                  <widget class="GtkVBox" id="vbox14">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                    <property name="active">True</property>
-                                    <property name="draw_indicator">True</property>
-                                    <property name="group">radiobutton1</property>
                                     <child>
-                                      <widget class="GtkVBox" id="vbox15">
+                                      <widget class="GtkLabel" id="label11">
+                                        <property name="visible">True</property>
+                                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                        <property name="xalign">0</property>
+                                        <property name="label" translatable="yes">If condition is satisfied</property>
+                                      </widget>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkHBox" id="hbox9">
                                         <property name="visible">True</property>
                                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                                         <child>
-                                          <widget class="GtkLabel" id="label13">
+                                          <widget class="GtkButton" id="button-if">
                                             <property name="visible">True</property>
+                                            <property name="sensitive">False</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
                                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                            <property name="xalign">0</property>
-                                            <property name="label" translatable="yes">Use filter variable</property>
+                                            <property name="label" translatable="yes">If...</property>
                                           </widget>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="fill">False</property>
+                                          </packing>
                                         </child>
                                         <child>
-                                          <widget class="GtkHBox" id="hbox12">
+                                          <widget class="GtkLabel" id="label26">
                                             <property name="visible">True</property>
                                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                            <property name="spacing">5</property>
-                                            <child>
-                                              <widget class="PsppireSelector" id="psppire-selector1">
-                                                <property name="visible">True</property>
-                                                <property name="can_focus">True</property>
-                                                <property name="receives_default">True</property>
-                                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                                <property name="border_width">5</property>
-                                              </widget>
-                                            </child>
-                                            <child>
-                                              <widget class="GtkEntry" id="entry1">
-                                                <property name="visible">True</property>
-                                                <property name="can_focus">True</property>
-                                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                              </widget>
-                                              <packing>
-                                                <property name="position">1</property>
-                                              </packing>
-                                            </child>
                                           </widget>
                                           <packing>
                                             <property name="position">1</property>
                                           </packing>
                                         </child>
                                       </widget>
+                                      <packing>
+                                        <property name="position">1</property>
+                                      </packing>
                                     </child>
                                   </widget>
                                   <packing>
-                                    <property name="position">4</property>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                    <property name="top_attach">1</property>
+                                    <property name="bottom_attach">2</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkLabel" id="label10">
+                                    <property name="visible">True</property>
+                                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <property name="xalign">0</property>
+                                    <property name="label" translatable="yes">All Cases</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
                                   </packing>
                                 </child>
                               </widget>
                           </widget>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="Select2">
+                          <widget class="GtkLabel" id="Select6">
                             <property name="visible">True</property>
                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                             <property name="label" translatable="yes">Select</property>
                       </widget>
                     </child>
                     <child>
-                      <widget class="GtkFrame" id="frame6">
+                      <widget class="GtkFrame" id="frame8">
                         <property name="visible">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                         <property name="label_xalign">0</property>
                         <child>
-                          <widget class="GtkAlignment" id="alignment9">
+                          <widget class="GtkAlignment" id="alignment12">
                             <property name="visible">True</property>
                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                             <property name="left_padding">12</property>
                             <child>
-                              <widget class="GtkHButtonBox" id="hbuttonbox1">
+                              <widget class="GtkHButtonBox" id="filter-delete-button-box">
                                 <property name="visible">True</property>
+                                <property name="sensitive">False</property>
                                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                                 <property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
                                 <child>
-                                  <widget class="GtkRadioButton" id="radiobutton7">
+                                  <widget class="GtkRadioButton" id="radiobutton-filter">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                                   </widget>
                                 </child>
                                 <child>
-                                  <widget class="GtkRadioButton" id="radiobutton8">
+                                  <widget class="GtkRadioButton" id="radiobutton-delete">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                                     <property name="label" translatable="yes">Deleted</property>
                                     <property name="active">True</property>
                                     <property name="draw_indicator">True</property>
-                                    <property name="group">radiobutton5</property>
+                                    <property name="group">radiobutton-filter</property>
                                   </widget>
                                   <packing>
                                     <property name="position">1</property>
                           </widget>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label14">
+                          <widget class="GtkLabel" id="label9">
                             <property name="visible">True</property>
                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                             <property name="label" translatable="yes">Unselected Cases Are</property>
                     </child>
                   </widget>
                   <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="pack_type">GTK_PACK_END</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
       </widget>
     </child>
   </widget>
+  <widget class="PsppireDialog" id="select-cases-range-dialog">
+    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+    <property name="title">Select Cases: Range</property>
+    <property name="modal">True</property>
+    <property name="orientation">PSPPIRE_VERTICAL</property>
+    <child internal-child="hbox">
+      <widget class="GtkVBox" id="dialog-hbox10">
+        <property name="visible">True</property>
+        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+        <property name="spacing">2</property>
+        <child>
+          <widget class="GtkTable" id="table3">
+            <property name="visible">True</property>
+            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+            <property name="n_rows">2</property>
+            <property name="n_columns">3</property>
+            <property name="column_spacing">5</property>
+            <child>
+              <widget class="GtkSpinButton" id="range-dialog-last">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="truncate_multiline">True</property>
+                <property name="adjustment">1 1 100 1 10 10</property>
+              </widget>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="right_attach">3</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkSpinButton" id="range-dialog-first">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="truncate_multiline">True</property>
+                <property name="adjustment">0 1 0 1 10 10</property>
+              </widget>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="label8">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="label" translatable="yes">First case</property>
+              </widget>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="x_options"></property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="label12">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="label" translatable="yes">Last case</property>
+              </widget>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="right_attach">3</property>
+                <property name="x_options"></property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="label14">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="label" translatable="yes">Observation</property>
+              </widget>
+              <packing>
+                <property name="bottom_attach">2</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="fill">False</property>
+            <property name="padding">5</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="PsppireHButtonBox" id="psppire-hbuttonbox4">
+            <property name="visible">True</property>
+            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+            <property name="border_width">5</property>
+            <property name="buttons">PSPPIRE_BUTTON_CONTINUE_MASK | PSPPIRE_BUTTON_CANCEL_MASK | PSPPIRE_BUTTON_HELP_MASK</property>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="pack_type">GTK_PACK_END</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
   <widget class="PsppireDialog" id="type-and-label-dialog">
     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
     <property name="title">Compute Variable: Type and Label</property>
       </widget>
     </child>
   </widget>
+  <widget class="PsppireDialog" id="select-cases-random-sample-dialog">
+    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+    <property name="title">Select Cases: Random Sample</property>
+    <property name="modal">True</property>
+    <property name="orientation">PSPPIRE_VERTICAL</property>
+    <child internal-child="hbox">
+      <widget class="GtkVBox" id="dialog-hbox13">
+        <property name="visible">True</property>
+        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+        <property name="spacing">2</property>
+        <child>
+          <widget class="GtkFrame" id="frame6">
+            <property name="visible">True</property>
+            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+            <property name="label_xalign">0</property>
+            <child>
+              <widget class="GtkAlignment" id="alignment3">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="top_padding">5</property>
+                <property name="bottom_padding">5</property>
+                <property name="left_padding">5</property>
+                <property name="right_padding">5</property>
+                <child>
+                  <widget class="GtkTable" id="select-cases-random-sample-table">
+                    <property name="visible">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="n_rows">2</property>
+                    <property name="n_columns">2</property>
+                    <property name="column_spacing">5</property>
+                    <property name="row_spacing">5</property>
+                    <child>
+                      <widget class="GtkRadioButton" id="radiobutton-sample-percent">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                      </widget>
+                      <packing>
+                        <property name="x_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkRadioButton" id="radiobutton-sample-n-cases">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">radiobutton-sample-percent</property>
+                      </widget>
+                      <packing>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="x_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkAlignment" id="alignment4">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="xalign">0</property>
+                        <property name="xscale">0</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkAlignment" id="alignment9">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="xalign">0</property>
+                        <property name="xscale">0</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                      </packing>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="label32">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="label" translatable="yes">Sample Size</property>
+                <property name="use_markup">True</property>
+              </widget>
+              <packing>
+                <property name="type">label_item</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="padding">5</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="PsppireHButtonBox" id="psppire-hbuttonbox5">
+            <property name="visible">True</property>
+            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+            <property name="border_width">5</property>
+            <property name="buttons">PSPPIRE_BUTTON_CONTINUE_MASK | PSPPIRE_BUTTON_CANCEL_MASK | PSPPIRE_BUTTON_HELP_MASK</property>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="pack_type">GTK_PACK_END</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
 </glade-interface>
diff --git a/src/ui/gui/select-cases-dialog.c b/src/ui/gui/select-cases-dialog.c
new file mode 100644 (file)
index 0000000..1546da8
--- /dev/null
@@ -0,0 +1,491 @@
+/*
+    PSPPIRE --- A Graphical User Interface for PSPP
+    Copyright (C) 2007  Free Software Foundation
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301, USA. */
+
+#include <config.h>
+
+#include "select-cases-dialog.h"
+#include <gtk/gtk.h>
+#include <glade/glade.h>
+#include "helper.h"
+#include "psppire-dialog.h"
+#include "data-editor.h"
+#include "dialog-common.h"
+#include "dict-display.h"
+#include "widget-io.h"
+#include <language/syntax-string-source.h>
+#include "syntax-editor.h"
+
+
+#include <gettext.h>
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+
+
+/* FIXME: These shouldn't be here */
+#include <gtksheet/gtksheet.h>
+#include "psppire-data-store.h"
+
+
+struct select_cases_dialog
+{
+  /* The XML that created the dialog */
+  GladeXML *xml;
+
+  GtkWidget *spinbutton ;
+  GtkWidget *spinbutton1 ;
+  GtkWidget *spinbutton2 ;
+
+  GtkWidget *hbox1;
+  GtkWidget *hbox2;
+
+  PsppireDataStore *data_store;
+};
+
+static gchar * generate_syntax (const struct select_cases_dialog *scd);
+
+
+static void
+set_sensitivity_from_toggle (GtkToggleButton *togglebutton,  gpointer data)
+{
+  GtkWidget *w = data;
+  gboolean active = gtk_toggle_button_get_active (togglebutton);
+
+  gtk_widget_set_sensitive (w, active);
+}
+
+static void
+set_sensitivity_from_toggle_invert (GtkToggleButton *togglebutton,
+                                   gpointer data)
+{
+  GtkWidget *w = data;
+  gboolean active = gtk_toggle_button_get_active (togglebutton);
+
+  gtk_widget_set_sensitive (w, !active);
+}
+
+
+
+static const gchar label1[]=N_("Approximately %3d%% of all cases.");
+static const gchar label2[]=N_("Exactly %3d cases from the first %3d cases.");
+
+
+static void
+sample_subdialog (GtkButton *b, gpointer data)
+{
+  gint response;
+  struct select_cases_dialog *scd = data;
+
+  gint case_count = psppire_data_store_get_case_count (scd->data_store);
+
+  GtkWidget *parent_dialog = get_widget_assert (scd->xml,
+                                               "select-cases-dialog");
+  GtkWidget *dialog = get_widget_assert (scd->xml,
+                                        "select-cases-random-sample-dialog");
+  GtkWidget *percent = get_widget_assert (scd->xml,
+                                         "radiobutton-sample-percent");
+  GtkWidget *sample_n_cases = get_widget_assert (scd->xml,
+                                                "radiobutton-sample-n-cases");
+  GtkWidget *table = get_widget_assert (scd->xml,
+                                       "select-cases-random-sample-table");
+
+  if ( ! scd->hbox1 )
+    {
+      scd->hbox1 = widget_scanf (gettext (label1), &scd->spinbutton);
+
+      gtk_widget_show (scd->hbox1);
+
+      gtk_table_attach_defaults (GTK_TABLE (table),
+                                scd->hbox1, 1, 2, 0, 1);
+
+      g_signal_connect (G_OBJECT (percent), "toggled",
+                       G_CALLBACK (set_sensitivity_from_toggle), scd->hbox1);
+
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (percent), TRUE);
+    }
+
+
+  if ( ! scd->hbox2 )
+    {
+      scd->hbox2 =
+       widget_scanf (gettext (label2), &scd->spinbutton1, &scd->spinbutton2);
+
+      gtk_spin_button_set_range (GTK_SPIN_BUTTON (scd->spinbutton1),
+                                1, case_count);
+
+      gtk_spin_button_set_range (GTK_SPIN_BUTTON (scd->spinbutton2),
+                                1, case_count);
+
+      gtk_widget_show (scd->hbox2);
+      gtk_widget_set_sensitive (scd->hbox2, FALSE);
+
+      gtk_table_attach_defaults (GTK_TABLE (table),
+                                scd->hbox2, 1, 2, 1, 2);
+
+      g_signal_connect (G_OBJECT (sample_n_cases), "toggled",
+                       G_CALLBACK (set_sensitivity_from_toggle), scd->hbox2);
+
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_n_cases), FALSE);
+    }
+
+
+  gtk_window_set_transient_for (GTK_WINDOW (dialog),
+                               GTK_WINDOW (parent_dialog));
+
+  response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
+
+  if ( response != PSPPIRE_RESPONSE_CONTINUE)
+    {
+      g_signal_handlers_disconnect_by_func
+       (G_OBJECT (percent),
+        G_CALLBACK (set_sensitivity_from_toggle),
+        scd->hbox1);
+
+      g_signal_handlers_disconnect_by_func
+       (G_OBJECT (sample_n_cases),
+        G_CALLBACK (set_sensitivity_from_toggle),
+        scd->hbox2);
+
+      gtk_widget_destroy(scd->hbox1);
+      gtk_widget_destroy(scd->hbox2);
+      scd->hbox1 = scd->hbox2 = NULL;
+    }
+  else
+    {
+      gchar *text;
+      GtkWidget *l0 = get_widget_assert (scd->xml, "random-sample-label");
+
+      if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (percent)))
+       {
+         text = widget_printf (gettext(label1), scd->spinbutton);
+         gtk_label_set (GTK_LABEL (l0), text);
+       }
+      else
+       {
+         text =
+           widget_printf (gettext(label2), scd->spinbutton1, scd->spinbutton2);
+         gtk_label_set (GTK_LABEL (l0), text);
+
+       }
+      g_free (text);
+
+    }
+}
+
+static void
+range_subdialog (GtkButton *b, gpointer data)
+{
+  gint response;
+  struct select_cases_dialog *scd = data;
+
+  gint n_cases = psppire_data_store_get_case_count (scd->data_store);
+
+  GtkWidget *parent_dialog = get_widget_assert (scd->xml,
+                                               "select-cases-dialog");
+
+  GtkWidget *dialog = get_widget_assert (scd->xml,
+                                        "select-cases-range-dialog");
+
+  GtkWidget *first = get_widget_assert (scd->xml,
+                                       "range-dialog-first");
+
+  GtkWidget *last = get_widget_assert (scd->xml,
+                                       "range-dialog-last");
+
+
+  gtk_spin_button_set_range (GTK_SPIN_BUTTON (last), 1, n_cases);
+
+  gtk_spin_button_set_range (GTK_SPIN_BUTTON (first), 1, n_cases);
+
+  gtk_window_set_transient_for (GTK_WINDOW (dialog),
+                               GTK_WINDOW (parent_dialog));
+
+
+  response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
+  if ( response == PSPPIRE_RESPONSE_CONTINUE)
+    {
+      GtkWidget *first = get_widget_assert (scd->xml, "range-dialog-first");
+      GtkWidget *last = get_widget_assert (scd->xml, "range-dialog-last");
+      GtkWidget *l1 = get_widget_assert (scd->xml, "range-sample-label");
+      gchar *text = widget_printf (_("%d thru %d"), first, last);
+
+      gtk_label_set (GTK_LABEL (l1), text);
+
+      g_free (text);
+    }
+}
+
+static void
+set_radiobutton (GtkWidget *button, gpointer data)
+{
+  GtkToggleButton *toggle = data;
+  gtk_toggle_button_set_active (toggle, TRUE);
+}
+
+/* Pops up the Select Cases dialog box */
+void
+select_cases_dialog (GObject *o, gpointer data)
+{
+  gint response;
+  struct select_cases_dialog scd = {0,0,0,0,0,0};
+  GtkWidget *dialog   ;
+  struct data_editor *de = data;
+  GtkWidget *entry = NULL;
+  GtkWidget *selector ;
+  GtkWidget *button_range;
+  GtkWidget *button_sample;
+
+  scd.xml = XML_NEW ("psppire.glade");
+
+  {
+    GtkSheet *data_sheet =
+      GTK_SHEET (get_widget_assert (de->xml, "data_sheet"));
+
+    scd.data_store = PSPPIRE_DATA_STORE (gtk_sheet_get_model (data_sheet));
+  }
+
+  button_range = get_widget_assert (scd.xml, "button-range");
+  button_sample = get_widget_assert (scd.xml, "button-sample");
+  entry = get_widget_assert (scd.xml, "filter-variable-entry");
+  selector = get_widget_assert (scd.xml, "psppire-selector-filter");
+
+  {
+    GtkWidget *button_if =
+      get_widget_assert (scd.xml, "button-if");
+
+    GtkWidget *radiobutton_if =
+      get_widget_assert (scd.xml, "radiobutton-if");
+
+    GtkWidget *radiobutton_all =
+      get_widget_assert (scd.xml, "radiobutton-all");
+
+    GtkWidget *radiobutton_sample =
+      get_widget_assert (scd.xml, "radiobutton-sample");
+
+    GtkWidget *radiobutton_range =
+      get_widget_assert (scd.xml, "radiobutton-range");
+
+    GtkWidget *radiobutton_filter =
+      get_widget_assert (scd.xml, "radiobutton-filter-variable");
+
+    GtkWidget *range_label =
+      get_widget_assert (scd.xml, "range-sample-label");
+
+    GtkWidget *sample_label =
+      get_widget_assert (scd.xml, "random-sample-label");
+
+    g_signal_connect (radiobutton_all, "toggled",
+                     G_CALLBACK (set_sensitivity_from_toggle_invert),
+                     get_widget_assert (scd.xml, "filter-delete-button-box")
+                     );
+
+    g_signal_connect (button_if, "clicked",
+                     G_CALLBACK (set_radiobutton), radiobutton_if);
+
+    g_signal_connect (button_sample, "clicked",
+                     G_CALLBACK (set_radiobutton), radiobutton_sample);
+
+    g_signal_connect (button_range,  "clicked",
+                     G_CALLBACK (set_radiobutton), radiobutton_range);
+
+    g_signal_connect (selector, "clicked",
+                     G_CALLBACK (set_radiobutton), radiobutton_filter);
+
+    g_signal_connect (selector, "selected",
+                     G_CALLBACK (set_radiobutton), radiobutton_filter);
+
+    g_signal_connect (radiobutton_range, "toggled",
+                     G_CALLBACK (set_sensitivity_from_toggle),
+                     range_label
+                     );
+
+    g_signal_connect (radiobutton_sample, "toggled",
+                     G_CALLBACK (set_sensitivity_from_toggle),
+                     sample_label
+                     );
+
+    g_signal_connect (radiobutton_filter, "toggled",
+                     G_CALLBACK (set_sensitivity_from_toggle),
+                     entry
+                     );
+  }
+
+
+
+  dialog = get_widget_assert (scd.xml, "select-cases-dialog");
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+
+  {
+    GtkWidget *source = get_widget_assert   (scd.xml, "select-cases-treeview");
+
+    attach_dictionary_to_treeview (GTK_TREE_VIEW (source),
+                                  scd.data_store->dict,
+                                  GTK_SELECTION_SINGLE, NULL);
+
+    psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector),
+                                  source,
+                                  entry,
+                                  insert_source_row_into_entry,
+                                  is_currently_in_entry);
+  }
+
+
+
+  g_signal_connect (button_range,
+                   "clicked", G_CALLBACK (range_subdialog), &scd);
+
+
+  g_signal_connect (button_sample,
+                   "clicked", G_CALLBACK (sample_subdialog), &scd);
+
+
+  response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
+
+  switch (response)
+    {
+    case GTK_RESPONSE_OK:
+      {
+       gchar *syntax = generate_syntax (&scd);
+       struct getl_interface *sss = create_syntax_string_source (syntax);
+       execute_syntax (sss);
+
+       g_free (syntax);
+      }
+      break;
+    case PSPPIRE_RESPONSE_PASTE:
+      {
+       gchar *syntax = generate_syntax (&scd);
+
+       struct syntax_editor *se =
+         (struct syntax_editor *) window_create (WINDOW_SYNTAX, NULL);
+
+       gtk_text_buffer_insert_at_cursor (se->buffer, syntax, -1);
+
+       g_free (syntax);
+      }
+      break;
+    default:
+      break;
+    }
+
+  g_object_unref (scd.xml);
+}
+
+
+static gchar *
+generate_syntax (const struct select_cases_dialog *scd)
+{
+  gchar *text = NULL;
+  GString *string = NULL;
+
+  if ( gtk_toggle_button_get_active
+       (GTK_TOGGLE_BUTTON (get_widget_assert (scd->xml,
+                                             "radiobutton-all"))))
+    {
+      return strdup ("\n");
+    }
+
+  string = g_string_new ("");
+
+  if ( gtk_toggle_button_get_active
+       (GTK_TOGGLE_BUTTON (get_widget_assert (scd->xml,
+                                             "radiobutton-sample"))))
+  {
+    GtkWidget *random_sample =
+      get_widget_assert (scd->xml,
+                        "radiobutton-sample-percent");
+
+    g_string_append (string, "SAMPLE ");
+
+    if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (random_sample)))
+      {
+       const double percentage =
+         gtk_spin_button_get_value (GTK_SPIN_BUTTON (scd->spinbutton));
+       g_string_append_printf (string, "%g.", percentage / 100.0);
+      }
+    else
+      {
+       const gint n_cases =
+         gtk_spin_button_get_value (GTK_SPIN_BUTTON (scd->spinbutton1));
+       const gint from_n_cases =
+         gtk_spin_button_get_value (GTK_SPIN_BUTTON (scd->spinbutton2));
+
+       g_string_append_printf (string, "%d FROM %d .", n_cases, from_n_cases);
+      }
+
+  }
+  else if ( gtk_toggle_button_get_active
+           (GTK_TOGGLE_BUTTON (get_widget_assert (scd->xml,
+                                                  "radiobutton-range"))))
+    {
+      GtkSpinButton *first =
+       GTK_SPIN_BUTTON (get_widget_assert (scd->xml,
+                                          "range-dialog-first"));
+
+      GtkSpinButton *last =
+       GTK_SPIN_BUTTON (get_widget_assert (scd->xml,
+                                          "range-dialog-last"));
+
+      g_string_append_printf (string,
+                             "COMPUTE filter_$ = ($CASENUM >= %ld "
+                              "AND $CASENUM <= %ld).\n",
+                             (long) gtk_spin_button_get_value (first),
+                             (long) gtk_spin_button_get_value (last)
+                             );
+      g_string_append (string, "EXECUTE.\n");
+      g_string_append_printf (string, "SELECT IF filter_$.\n");
+
+    }
+  else if ( gtk_toggle_button_get_active
+           (GTK_TOGGLE_BUTTON
+            (get_widget_assert (scd->xml,
+                                "radiobutton-filter-variable"))))
+    {
+      GtkEntry *entry =
+       GTK_ENTRY (get_widget_assert (scd->xml,
+                                     "filter-variable-entry"));
+
+      g_string_append_printf (string, "SELECT IF (%s <> 0).",
+                             gtk_entry_get_text (entry));
+    }
+
+
+  g_string_append (string, "\n");
+
+
+  /* Are we filtering or deleting ? */
+  if ( gtk_toggle_button_get_active
+       (GTK_TOGGLE_BUTTON (get_widget_assert (scd->xml,
+                                             "radiobutton-delete"))))
+    {
+      g_string_append (string, "EXECUTE.\n");
+
+      if ( gtk_toggle_button_get_active
+          (GTK_TOGGLE_BUTTON (get_widget_assert (scd->xml,
+                                                 "radiobutton-range"))))
+       {
+         g_string_append (string, "DELETE VARIABLES filter_$.\n");
+       }
+    }
+
+
+  text  = string->str;
+  g_string_free (string, FALSE);
+  return text;
+}
diff --git a/src/ui/gui/select-cases-dialog.h b/src/ui/gui/select-cases-dialog.h
new file mode 100644 (file)
index 0000000..4d9f7d4
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+    PSPPIRE --- A Graphical User Interface for PSPP
+    Copyright (C) 2007  Free Software Foundation
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301, USA. */
+
+#ifndef __SELECT_CASES_DIALOG_H
+#define __SELECT_CASES_DIALOG_H
+
+
+#include <gtk/gtk.h>
+#include <glade/glade.h>
+
+
+void select_cases_dialog (GObject *o, gpointer data);
+
+#endif
diff --git a/src/ui/gui/widget-io.c b/src/ui/gui/widget-io.c
new file mode 100644 (file)
index 0000000..81ffd73
--- /dev/null
@@ -0,0 +1,214 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2007  Free Software Foundation
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+#include "widget-io.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <gl/printf-parse.h>
+#include <stdarg.h>
+#include <gtk/gtk.h>
+
+#include <gl/gettext.h>
+
+
+
+static void
+ship_label (GtkBox *box, const char **s, const char_directive *dir)
+{
+  GtkWidget *label ;
+  gchar *text = g_strdup (*s);
+
+  if ( dir )
+    {
+      text [ dir->dir_start - *s ] = '\0';
+      *s = dir->dir_end;
+    }
+
+  label = gtk_label_new (text);
+  g_free (text);
+
+  gtk_box_pack_start (box, label, FALSE, FALSE, 0);
+  gtk_widget_show (label);
+}
+
+/* Returns a string generated from FMT and a list of GtkEntry widgets.
+   Each conversion in FMT will be replaced with the text from the
+   corresponding GtkEntry.  The normal printf semantics will be ignored.
+   Note that the GtkEntry widgets may be GtkSpinbuttons or any other widget
+   derived from GtkEntry.
+   The returned string should be freed when no longer required.
+ */
+gchar *
+widget_printf (const gchar *fmt, ...)
+{
+  gint i;
+  char_directives d;
+  arguments a;
+  GString *output;
+  GtkWidget **widgets;
+  gchar *text;
+  va_list ap;
+  const char *s = fmt;
+
+  if ( 0 !=  printf_parse (fmt, &d, &a) )
+    return NULL;
+
+  widgets = calloc (sizeof (*widgets), d.count);
+  va_start (ap, fmt);
+  for (i = 0 ; i < d.count ; ++i )
+    {
+      if ( d.dir[i].conversion != '%')
+       widgets[i] = va_arg (ap, GtkWidget *);
+    }
+  va_end (ap);
+
+  g_free (a.arg);
+
+  output = g_string_sized_new (strlen (fmt));
+
+  for (i = 0 ; i < d.count ; ++i )
+    {
+      char_directive dir = d.dir[i];
+      GtkWidget *w ;
+      const gchar *entry_text;
+
+      if ( dir.conversion == '%')
+       {
+         s++;
+         continue;
+       }
+
+      w = widgets [dir.arg_index];
+      entry_text = gtk_entry_get_text (GTK_ENTRY (w));
+
+      if ( dir.dir_start > s )
+       g_string_append_len (output, s, dir.dir_start - s);
+
+      s = dir.dir_end;
+
+      g_string_append (output, entry_text);
+    }
+
+  free (widgets);
+  free (d.dir);
+
+  if (*s)
+    g_string_append_len (output, s, -1);
+
+  text = output->str;
+  g_string_free (output, FALSE);
+  return text;
+}
+
+/*
+   Returns a GtkHBox populated with an GtkLabel and GtkEntry widgets.
+   Each conversion in FMT will cause a GtkEntry (possibly a GtkSpinButton) to
+   be created.  Any text between conversions produces a GtkLabel.
+   There should be N arguments following FMT should be of type GtkEntry **,
+   where N is the number of conversions.
+   These arguments will be filled with a pointer to the corresponding widgets.
+   Their properties may be changed, but they should not be unrefed.
+ */
+GtkWidget *
+widget_scanf (const gchar *fmt, ...)
+{
+  char_directives d;
+  arguments a;
+  int i;
+  va_list ap;
+  GtkWidget ***widgets = NULL;
+  GtkWidget *hbox = NULL;
+  GtkWidget **w;
+  const char *s = fmt;
+
+  if ( 0 !=  printf_parse (fmt, &d, &a) )
+    return NULL;
+
+  g_free (a.arg);
+
+  va_start (ap, fmt);
+
+  if ( d.count > 0 )
+    {
+      hbox = gtk_hbox_new (FALSE, 0);
+      widgets = calloc (sizeof (*widgets), d.count);
+    }
+
+  for (i = 0 ; i < d.count ; ++i )
+    {
+      if ( d.dir[i].conversion != '%')
+       widgets[i] = va_arg (ap, GtkWidget **);
+    }
+  va_end (ap);
+
+
+  for (i = 0 ; i < d.count ; ++i )
+    {
+      char_directive dir = d.dir[i];
+      int precision = 0;
+      int width = 0;
+
+
+      if ( dir.precision_start && dir.precision_end)
+       precision = strtol (dir.precision_start + 1,
+                           (char **) &dir.precision_end, 10);
+
+      if ( dir.width_start && dir.width_end )
+       width = strtol (dir.width_start, (char **) &dir.width_end, 10);
+
+      if ( dir.dir_start > s )
+       ship_label (GTK_BOX (hbox), &s, &dir);
+
+      if ( dir.conversion == '%')
+       {
+         s++;
+         continue;
+       }
+
+      w = widgets [dir.arg_index];
+      switch (dir.conversion)
+       {
+       case 'd':
+       case 'i':
+       case 'f':
+         {
+           *w = gtk_spin_button_new_with_range (0, 100.0, 1.0);
+           g_object_set (*w, "digits", precision, NULL);
+         }
+         break;
+       case 's':
+         *w = gtk_entry_new ();
+         break;
+       };
+
+      g_object_set (*w, "width-chars", width, NULL);
+      gtk_box_pack_start (GTK_BOX (hbox), *w, FALSE, FALSE, 0);
+      gtk_widget_show (*w);
+    }
+
+  if ( *s )
+    ship_label (GTK_BOX (hbox), &s, NULL);
+
+
+  g_free (widgets);
+
+  free (d.dir);
+
+  return hbox;
+}
diff --git a/src/ui/gui/widget-io.h b/src/ui/gui/widget-io.h
new file mode 100644 (file)
index 0000000..073578c
--- /dev/null
@@ -0,0 +1,40 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2007  Free Software Foundation
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+#include <gtk/gtk.h>
+
+
+/* Returns a string generated from FMT and a list of GtkEntry widgets.
+   Each conversion in FMT will be replaced with the text from the
+   corresponding GtkEntry.  The normal printf semantics will be ignored.
+   Note that the GtkEntry widgets may be GtkSpinbuttons or any other widget
+   derived from GtkEntry.
+   The returned string should be freed when no longer required.
+ */
+gchar * widget_printf (const gchar *fmt, ...);
+
+/*
+   Returns a GtkHBox populated with an GtkLabel and GtkEntry widgets.
+   Each conversion in FMT will cause a GtkEntry (possibly a GtkSpinButton) to
+   be created.  Any text between conversions produces a GtkLabel.
+   There should be N arguments following FMT should be of type GtkEntry **,
+   where N is the number of conversions.
+   These arguments will be filled with a pointer to the corresponding widgets.
+   Their properties may be changed, but they should not be unrefed.
+ */
+GtkWidget *widget_scanf (const gchar *fmt, ...);