From 0085c7edf6d3b9c9ee2ce880893023c567886101 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sun, 29 Jul 2007 07:56:52 +0000 Subject: [PATCH 1/1] Implemented the Select Cases Dialog --- po/de.po | 225 ++++++----- po/pspp.pot | 213 ++++++----- src/ui/gui/automake.mk | 4 + src/ui/gui/compute-dialog.c | 1 - src/ui/gui/data-editor.c | 19 + src/ui/gui/data-editor.glade | 2 +- src/ui/gui/data-editor.h | 1 + src/ui/gui/psppire-data-store.c | 13 +- src/ui/gui/psppire-data-store.h | 3 +- src/ui/gui/psppire.glade | 624 +++++++++++++++++++++++-------- src/ui/gui/select-cases-dialog.c | 491 ++++++++++++++++++++++++ src/ui/gui/select-cases-dialog.h | 30 ++ src/ui/gui/widget-io.c | 214 +++++++++++ src/ui/gui/widget-io.h | 40 ++ 14 files changed, 1526 insertions(+), 354 deletions(-) create mode 100644 src/ui/gui/select-cases-dialog.c create mode 100644 src/ui/gui/select-cases-dialog.h create mode 100644 src/ui/gui/widget-io.c create mode 100644 src/ui/gui/widget-io.h diff --git a/po/de.po b/po/de.po index abaabb60..1590e1cb 100644 --- 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 \n" "Language-Team: German \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?" diff --git a/po/pspp.pot b/po/pspp.pot index fd997be5..37df691e 100644 --- a/po/pspp.pot +++ b/po/pspp.pot @@ -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 \n" "Language-Team: LANGUAGE \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?" diff --git a/src/ui/gui/automake.mk b/src/ui/gui/automake.mk index 9b5d4154..dff1a96c 100644 --- a/src/ui/gui/automake.mk +++ b/src/ui/gui/automake.mk @@ -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 diff --git a/src/ui/gui/compute-dialog.c b/src/ui/gui/compute-dialog.c index 739d6b17..6a3b0aaa 100644 --- a/src/ui/gui/compute-dialog.c +++ b/src/ui/gui/compute-dialog.c @@ -405,7 +405,6 @@ compute_dialog (GObject *o, gpointer data) - response = psppire_dialog_run (PSPPIRE_DIALOG (dialog)); diff --git a/src/ui/gui/data-editor.c b/src/ui/gui/data-editor.c index 9681a09f..8fd9517d 100644 --- a/src/ui/gui/data-editor.c +++ b/src/ui/gui/data-editor.c @@ -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); diff --git a/src/ui/gui/data-editor.glade b/src/ui/gui/data-editor.glade index c5725588..24ee5807 100644 --- a/src/ui/gui/data-editor.glade +++ b/src/ui/gui/data-editor.glade @@ -354,7 +354,7 @@ - + True False Select Cases diff --git a/src/ui/gui/data-editor.h b/src/ui/gui/data-editor.h index 2186d4cf..00430e9f 100644 --- a/src/ui/gui/data-editor.h +++ b/src/ui/gui/data-editor.h @@ -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; diff --git a/src/ui/gui/psppire-data-store.c b/src/ui/gui/psppire-data-store.c index 323196e4..f79f4473 100644 --- a/src/ui/gui/psppire-data-store.c +++ b/src/ui/gui/psppire-data-store.c @@ -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 diff --git a/src/ui/gui/psppire-data-store.h b/src/ui/gui/psppire-data-store.h index 699f924a..8e29db33 100644 --- a/src/ui/gui/psppire-data-store.h +++ b/src/ui/gui/psppire-data-store.h @@ -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 } diff --git a/src/ui/gui/psppire.glade b/src/ui/gui/psppire.glade index 7c3b1266..0526467b 100644 --- a/src/ui/gui/psppire.glade +++ b/src/ui/gui/psppire.glade @@ -1177,6 +1177,7 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 5 5 5 @@ -1194,7 +1195,7 @@ GTK_POLICY_AUTOMATIC GTK_SHADOW_IN - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -1205,266 +1206,356 @@ - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 0 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 12 + 5 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - GTK_BUTTONBOX_SPREAD + 5 + 2 + 5 - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - All Cases True True + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + 0 + 0 + 0 + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + True + radiobutton-all + + + - False - False + 4 + 5 + - + True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - True - radiobutton1 + 0 + 0 + 0 + 0 + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + True + radiobutton-all + + + + + 3 + 4 + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + 0 + 0 + 0 + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + True + radiobutton-all + + + + + 2 + 3 + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + 0 + 0 + 0 + + + True + False + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + True + radiobutton-all + + + + + 1 + 2 + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Use filter variable + + - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + True + True + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - If condition is satisfied + 5 + + False + False + - + True + False + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - 0 - - - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - If... - - - - - False - False 1 + + 1 + - 1 + 1 + 2 + 4 + 5 - + True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - True - radiobutton1 - + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Based on time or case range + + + + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + True + True + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Random Sample of cases + Range... + + False + False + - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Sample... - - - False - False - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Approximately 23% of cases - True - - - 1 - - 1 + + 1 + - 2 + 1 + 2 + 3 + 4 - + True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - True - radiobutton1 - + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Random sample of cases + + + + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 - + True + True + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Based on time or case range + Sample... + + False + False + - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Range... - - - False - False - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 2 thru 3 - - - 1 - - 1 + + 1 + - 3 + 1 + 2 + 2 + 3 - + True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - True - radiobutton1 - + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + If condition is satisfied + + + + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + True + False + True + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Use filter variable + If... + + False + False + - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 1 - - 1 + + 1 + - 4 + 1 + 2 + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + All Cases + + + 1 + 2 @@ -1472,7 +1563,7 @@ - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Select @@ -1485,22 +1576,23 @@ - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 0 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 12 - + True + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK GTK_BUTTONBOX_SPREAD - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -1510,14 +1602,14 @@ - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Deleted True True - radiobutton5 + radiobutton-filter 1 @@ -1528,7 +1620,7 @@ - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Unselected Cases Are @@ -1545,6 +1637,9 @@ + False + False + GTK_PACK_END 1 @@ -1794,6 +1889,112 @@ + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Select Cases: Range + True + PSPPIRE_VERTICAL + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 2 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 2 + 3 + 5 + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + 1 1 100 1 10 10 + + + 2 + 3 + 1 + 2 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + 0 1 0 1 10 10 + + + 1 + 2 + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + First case + + + 1 + 2 + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Last case + + + 2 + 3 + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Observation + + + 2 + + + + + False + 5 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + PSPPIRE_BUTTON_CONTINUE_MASK | PSPPIRE_BUTTON_CANCEL_MASK | PSPPIRE_BUTTON_HELP_MASK + + + False + False + GTK_PACK_END + 1 + + + + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Compute Variable: Type and Label @@ -2121,4 +2322,131 @@ + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Select Cases: Random Sample + True + PSPPIRE_VERTICAL + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 2 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + 5 + 5 + 5 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 2 + 2 + 5 + 5 + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + True + + + + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + True + radiobutton-sample-percent + + + 1 + 2 + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + 0 + + + + + + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + 0 + + + + + + 1 + 2 + 1 + 2 + + + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Sample Size + True + + + label_item + + + + + 5 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + PSPPIRE_BUTTON_CONTINUE_MASK | PSPPIRE_BUTTON_CANCEL_MASK | PSPPIRE_BUTTON_HELP_MASK + + + False + False + GTK_PACK_END + 1 + + + + + diff --git a/src/ui/gui/select-cases-dialog.c b/src/ui/gui/select-cases-dialog.c new file mode 100644 index 00000000..1546da82 --- /dev/null +++ b/src/ui/gui/select-cases-dialog.c @@ -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 + +#include "select-cases-dialog.h" +#include +#include +#include "helper.h" +#include "psppire-dialog.h" +#include "data-editor.h" +#include "dialog-common.h" +#include "dict-display.h" +#include "widget-io.h" +#include +#include "syntax-editor.h" + + +#include +#define _(msgid) gettext (msgid) +#define N_(msgid) msgid + + + +/* FIXME: These shouldn't be here */ +#include +#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 index 00000000..4d9f7d4a --- /dev/null +++ b/src/ui/gui/select-cases-dialog.h @@ -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 +#include + + +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 index 00000000..81ffd731 --- /dev/null +++ b/src/ui/gui/widget-io.c @@ -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 . */ + +#include + +#include "widget-io.h" + +#include +#include +#include +#include +#include + +#include + + + +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 index 00000000..073578c5 --- /dev/null +++ b/src/ui/gui/widget-io.h @@ -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 . */ + +#include + +#include + + +/* 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, ...); -- 2.30.2