Added a "recent-dialogs" toolbar button.
+2007-03-31 John Darrington <john@darrington.wattle.id.au>
+
+ * transformation.texi: SORT CASES: elaborated on the (D) (A) flags.
+
2007-03-01 Ben Pfaff <blp@gnu.org>
* automake.mk: Fix "make distcheck" by distributing doc/ni.texi,
@vindex SORT CASES
@display
-SORT CASES BY var_list.
+SORT CASES BY var_list[(@{D|A@}] [ var_list[(@{D|A@}] ] ...
@end display
@cmd{SORT CASES} sorts the active file by the values of one or more
Specify BY and a list of variables to sort by. By default, variables
are sorted in ascending order. To override sort order, specify (D) or
(DOWN) after a list of variables to get descending order, or (A) or (UP)
-for ascending order. These apply to the entire list of variables
-preceding them.
+for ascending order. These apply to all the listed variables
+up until the preceding (A), (D), (UP) or (DOWN).
The sort algorithms used by @cmd{SORT CASES} are stable. That is,
records that have equal values of the sort variables will have the
-This patch mitigates a bug in glade-2, which silently deletes stock_ids, which
-it thinks are not valid. You may have to apply this patch after editing
-data-editor.glade with glade-3.
---- src/ui/gui/data-editor.glade,bad 2007-01-26 16:15:32.000000000 +0900
-+++ src/ui/gui/data-editor.glade 2007-01-26 16:16:18.000000000 +0900
-@@ -506,7 +506,7 @@
+--- /Scratch/john/tmp.vKHTg31290/share/pspp/data-editor.glade 2007-03-31 12:55:02.000000000 +0800
++++ src/ui/gui/data-editor.glade 2007-03-31 13:04:27.000000000 +0800
+@@ -494,7 +494,7 @@
<property name="sensitive">False</property>
<property name="tooltip" translatable="yes">Variables</property>
<property name="use_underline">True</property>
</widget>
<packing>
<property name="expand">False</property>
-@@ -547,7 +547,7 @@
+@@ -535,7 +535,7 @@
<property name="sensitive">False</property>
<property name="tooltip" translatable="yes">Insert Case</property>
<property name="use_underline">True</property>
- <property name="stock_id">gtk-missing-image</property>
+ <property name="stock_id">pspp-insert-case</property>
- <signal name="clicked" handler="on_insert_case_clicked"/>
</widget>
<packing>
-@@ -560,7 +560,7 @@
+ <property name="expand">False</property>
+@@ -547,7 +547,7 @@
<property name="sensitive">False</property>
<property name="tooltip" translatable="yes">Insert Variable</property>
<property name="use_underline">True</property>
</widget>
<packing>
<property name="expand">False</property>
-@@ -581,7 +581,7 @@
- <property name="sensitive">False</property>
+@@ -567,7 +567,7 @@
+ <property name="visible">True</property>
<property name="tooltip" translatable="yes">Split File</property>
<property name="use_underline">True</property>
- <property name="stock_id">gtk-missing-image</property>
</widget>
<packing>
<property name="expand">False</property>
-@@ -592,7 +592,7 @@
+@@ -578,7 +578,7 @@
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Weight Cases</property>
<property name="use_underline">True</property>
</widget>
<packing>
<property name="expand">False</property>
-@@ -604,7 +604,7 @@
+@@ -590,7 +590,7 @@
<property name="sensitive">False</property>
<property name="tooltip" translatable="yes">Select Cases</property>
<property name="use_underline">True</property>
</widget>
<packing>
<property name="expand">False</property>
-@@ -624,7 +624,7 @@
+@@ -610,7 +610,7 @@
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Value Labels</property>
<property name="use_underline">True</property>
- <property name="stock_id">gtk-missing-image</property>
+ <property name="stock_id">pspp-value-labels</property>
- <signal name="toggled" handler="on_togglebutton_value_labels_toggled"/>
- </widget>
- <packing>
-@@ -667,25 +667,25 @@
- <property name="n_rows">1</property>
- <property name="n_columns">2</property>
- <child>
-- <widget class="GtkEntry" id="entry4">
-+ <widget class="GtkEntry" id="cell_ref_entry">
- <property name="visible">True</property>
-- <property name="can_focus">True</property>
-+ <property name="sensitive">False</property>
-+ <property name="editable">False</property>
-+ <property name="width_chars">25</property>
- </widget>
- <packing>
-- <property name="left_attach">1</property>
-- <property name="right_attach">2</property>
-+ <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
-- <widget class="GtkEntry" id="cell_ref_entry">
-+ <widget class="GtkEntry" id="entry4">
- <property name="visible">True</property>
-- <property name="sensitive">False</property>
-- <property name="editable">False</property>
-- <property name="width_chars">25</property>
-+ <property name="can_focus">True</property>
- </widget>
- <packing>
-- <property name="x_options">GTK_FILL</property>
-+ <property name="left_attach">1</property>
-+ <property name="right_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
-@@ -1216,63 +1216,63 @@
- <property name="column_spacing">2</property>
- <property name="row_spacing">1</property>
- <child>
-- <widget class="GtkLabel" id="decimals_label">
-+ <widget class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
-- <property name="xalign">0</property>
-- <property name="label" translatable="yes">Decimal Places:</property>
-+ <child>
-+ <widget class="GtkLabel" id="width_label">
-+ <property name="visible">True</property>
-+ <property name="label" translatable="yes">Width:</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</property>
- </widget>
- <packing>
-- <property name="top_attach">1</property>
-- <property name="bottom_attach">2</property>
-+ <property name="expand">False</property>
-+ <property name="fill">False</property>
-+ <property name="pack_type">GTK_PACK_END</property>
-+ </packing>
-+ </child>
-+ </widget>
-+ <packing>
- <property name="x_options">GTK_FILL</property>
-- <property name="y_options"></property>
-+ <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
-- <widget class="GtkEntry" id="width_entry">
-+ <widget class="GtkEntry" id="decimals_entry">
- <property name="width_request">25</property>
-+ <property name="visible">True</property>
- <property name="can_focus">True</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>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
-- <widget class="GtkEntry" id="decimals_entry">
-+ <widget class="GtkEntry" id="width_entry">
- <property name="width_request">25</property>
-- <property name="visible">True</property>
- <property name="can_focus">True</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>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
-- <widget class="GtkHBox" id="hbox2">
-- <property name="visible">True</property>
-- <child>
-- <widget class="GtkLabel" id="width_label">
-+ <widget class="GtkLabel" id="decimals_label">
- <property name="visible">True</property>
-- <property name="label" translatable="yes">Width:</property>
-+ <property name="xalign">0</property>
-+ <property name="label" translatable="yes">Decimal Places:</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</property>
- </widget>
- <packing>
-- <property name="expand">False</property>
-- <property name="fill">False</property>
-- <property name="pack_type">GTK_PACK_END</property>
-- </packing>
-- </child>
-- </widget>
-- <packing>
-+ <property name="top_attach">1</property>
-+ <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
-- <property name="y_options">GTK_FILL</property>
-+ <property name="y_options"></property>
- </packing>
- </child>
- </widget>
-@@ -1360,50 +1360,28 @@
- <property name="n_columns">2</property>
- <property name="row_spacing">5</property>
- <child>
-- <widget class="GtkVButtonBox" id="vbuttonbox2">
-- <property name="visible">True</property>
-- <property name="border_width">5</property>
-- <child>
-- <widget class="GtkButton" id="val_labs_add">
-- <property name="visible">True</property>
-- <property name="sensitive">False</property>
-- <property name="can_focus">True</property>
-- <property name="can_default">True</property>
-- <property name="label">gtk-add</property>
-- <property name="use_stock">True</property>
-- </widget>
-- </child>
-- <child>
-- <widget class="GtkButton" id="val_labs_change">
-+ <widget class="GtkScrolledWindow" id="scrolledwindow3">
- <property name="visible">True</property>
-- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
-- <property name="can_default">True</property>
-- <property name="label">gtk-apply</property>
-- <property name="use_stock">True</property>
-- </widget>
-- <packing>
-- <property name="position">1</property>
-- </packing>
-- </child>
-+ <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
-+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-+ <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
- <child>
-- <widget class="GtkButton" id="val_labs_remove">
-+ <widget class="GtkTreeView" id="treeview1">
- <property name="visible">True</property>
-- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
-- <property name="can_default">True</property>
-- <property name="label">gtk-remove</property>
-- <property name="use_stock">True</property>
-+ <property name="headers_visible">False</property>
-+ <property name="enable_search">False</property>
- </widget>
-- <packing>
-- <property name="position">2</property>
-- </packing>
- </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>
- <property name="x_options">GTK_FILL</property>
-+ <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
-@@ -1415,27 +1393,26 @@
- <property name="column_spacing">5</property>
- <property name="row_spacing">4</property>
- <child>
-- <widget class="GtkLabel" id="label5">
-+ <widget class="GtkHBox" id="hbox4">
- <property name="visible">True</property>
-- <property name="xalign">0</property>
-- <property name="label" translatable="yes">Value:</property>
-+ <child>
-+ <widget class="GtkEntry" id="value_entry">
-+ <property name="width_request">85</property>
-+ <property name="visible">True</property>
-+ <property name="can_focus">True</property>
- </widget>
- <packing>
-- <property name="x_options">GTK_FILL</property>
-- <property name="y_options"></property>
-+ <property name="expand">False</property>
-+ <property name="fill">False</property>
-+ <property name="padding">1</property>
- </packing>
- </child>
-- <child>
-- <widget class="GtkLabel" id="label6">
-- <property name="visible">True</property>
-- <property name="xalign">0</property>
-- <property name="label" translatable="yes">Value Label:</property>
- </widget>
- <packing>
-- <property name="top_attach">1</property>
-- <property name="bottom_attach">2</property>
-+ <property name="left_attach">1</property>
-+ <property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
-- <property name="y_options"></property>
-+ <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
-@@ -1452,26 +1429,27 @@
- </packing>
- </child>
- <child>
-- <widget class="GtkHBox" id="hbox4">
-- <property name="visible">True</property>
-- <child>
-- <widget class="GtkEntry" id="value_entry">
-- <property name="width_request">85</property>
-+ <widget class="GtkLabel" id="label6">
- <property name="visible">True</property>
-- <property name="can_focus">True</property>
-+ <property name="xalign">0</property>
-+ <property name="label" translatable="yes">Value Label:</property>
- </widget>
- <packing>
-- <property name="expand">False</property>
-- <property name="fill">False</property>
-- <property name="padding">1</property>
-+ <property name="top_attach">1</property>
-+ <property name="bottom_attach">2</property>
-+ <property name="x_options">GTK_FILL</property>
-+ <property name="y_options"></property>
- </packing>
- </child>
-+ <child>
-+ <widget class="GtkLabel" id="label5">
-+ <property name="visible">True</property>
-+ <property name="xalign">0</property>
-+ <property name="label" translatable="yes">Value:</property>
- </widget>
- <packing>
-- <property name="left_attach">1</property>
-- <property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
-- <property name="y_options">GTK_FILL</property>
-+ <property name="y_options"></property>
- </packing>
- </child>
- </widget>
-@@ -1481,28 +1459,50 @@
- </packing>
- </child>
- <child>
-- <widget class="GtkScrolledWindow" id="scrolledwindow3">
-+ <widget class="GtkVButtonBox" id="vbuttonbox2">
-+ <property name="visible">True</property>
-+ <property name="border_width">5</property>
-+ <child>
-+ <widget class="GtkButton" id="val_labs_add">
- <property name="visible">True</property>
-+ <property name="sensitive">False</property>
- <property name="can_focus">True</property>
-- <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
-- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-+ <property name="can_default">True</property>
-+ <property name="label">gtk-add</property>
-+ <property name="use_stock">True</property>
-+ </widget>
-+ </child>
- <child>
-- <widget class="GtkTreeView" id="treeview1">
-+ <widget class="GtkButton" id="val_labs_change">
- <property name="visible">True</property>
-+ <property name="sensitive">False</property>
- <property name="can_focus">True</property>
-- <property name="headers_visible">False</property>
-- <property name="enable_search">False</property>
-+ <property name="can_default">True</property>
-+ <property name="label">gtk-apply</property>
-+ <property name="use_stock">True</property>
- </widget>
-+ <packing>
-+ <property name="position">1</property>
-+ </packing>
-+ </child>
-+ <child>
-+ <widget class="GtkButton" id="val_labs_remove">
-+ <property name="visible">True</property>
-+ <property name="sensitive">False</property>
-+ <property name="can_focus">True</property>
-+ <property name="can_default">True</property>
-+ <property name="label">gtk-remove</property>
-+ <property name="use_stock">True</property>
-+ </widget>
-+ <packing>
-+ <property name="position">2</property>
-+ </packing>
- </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>
- <property name="x_options">GTK_FILL</property>
-- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- </widget>
-@@ -1590,64 +1590,68 @@
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
- <child>
-- <widget class="GtkVButtonBox" id="vbuttonbox5">
-+ <widget class="GtkVBox" id="vbox7">
- <property name="visible">True</property>
-- <property name="border_width">5</property>
-- <property name="spacing">5</property>
-- <property name="layout_style">GTK_BUTTONBOX_START</property>
- <child>
-- <widget class="GtkButton" id="missing_val_ok">
-+ <widget class="GtkRadioButton" id="range_missing">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
-- <property name="can_default">True</property>
-- <property name="label">gtk-ok</property>
-- <property name="use_stock">True</property>
-- <signal name="clicked" handler="gtk_widget_hide" object="val_labs_dialog"/>
-+ <property name="label" translatable="yes">_Range plus one optional discrete missing value</property>
-+ <property name="use_underline">True</property>
-+ <property name="focus_on_click">False</property>
-+ <property name="draw_indicator">True</property>
-+ <property name="group">no_missing</property>
- </widget>
-+ <packing>
-+ <property name="expand">False</property>
-+ <property name="fill">False</property>
-+ </packing>
- </child>
- <child>
-- <widget class="GtkButton" id="missing_val_cancel">
-+ <widget class="GtkVBox" id="vbox8">
- <property name="visible">True</property>
-- <property name="can_focus">True</property>
-- <property name="can_default">True</property>
-- <property name="label">gtk-cancel</property>
-- <property name="use_stock">True</property>
-- <signal name="clicked" handler="gtk_widget_hide" object="val_labs_dialog"/>
-+ <property name="spacing">5</property>
-+ <child>
-+ <widget class="GtkHBox" id="hbox7">
-+ <property name="visible">True</property>
-+ <child>
-+ <widget class="GtkHBox" id="hbox8">
-+ <property name="visible">True</property>
-+ <child>
-+ <widget class="GtkLabel" id="label11">
-+ <property name="visible">True</property>
-+ <property name="label" translatable="yes">_Low:</property>
-+ <property name="use_underline">True</property>
-+ <property name="mnemonic_widget">mv-low</property>
- </widget>
- <packing>
-- <property name="position">1</property>
-+ <property name="expand">False</property>
-+ <property name="fill">False</property>
-+ <property name="padding">20</property>
- </packing>
- </child>
- <child>
-- <widget class="GtkButton" id="help_button_missing_values">
-+ <widget class="GtkEntry" id="mv-low">
-+ <property name="width_request">75</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
-- <property name="can_default">True</property>
-- <property name="label">gtk-help</property>
-- <property name="use_stock">True</property>
- </widget>
- <packing>
-- <property name="position">2</property>
-+ <property name="expand">False</property>
-+ <property name="position">1</property>
- </packing>
- </child>
- </widget>
-- <packing>
-- <property name="left_attach">1</property>
-- <property name="right_attach">2</property>
-- </packing>
- </child>
- <child>
-- <widget class="GtkVBox" id="vbox5">
-+ <widget class="GtkHBox" id="hbox9">
- <property name="visible">True</property>
-- <property name="spacing">12</property>
- <child>
-- <widget class="GtkRadioButton" id="no_missing">
-+ <widget class="GtkLabel" id="label12">
- <property name="visible">True</property>
-- <property name="can_focus">True</property>
-- <property name="label" translatable="yes">_No missing values</property>
-+ <property name="label" translatable="yes">_High:</property>
- <property name="use_underline">True</property>
-- <property name="active">True</property>
-- <property name="draw_indicator">True</property>
-+ <property name="mnemonic_widget">mv-high</property>
- </widget>
- <packing>
- <property name="expand">False</property>
-@@ -1655,97 +1659,102 @@
- </packing>
- </child>
- <child>
-- <widget class="GtkVBox" id="vbox6">
-- <property name="visible">True</property>
-- <child>
-- <widget class="GtkRadioButton" id="discrete_missing">
-+ <widget class="GtkEntry" id="mv-high">
-+ <property name="width_request">75</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
-- <property name="label" translatable="yes">_Discrete missing values</property>
-- <property name="use_underline">True</property>
-- <property name="focus_on_click">False</property>
-- <property name="draw_indicator">True</property>
-- <property name="group">no_missing</property>
- </widget>
- <packing>
-- <property name="expand">False</property>
-+ <property name="padding">5</property>
-+ <property name="position">1</property>
-+ </packing>
-+ </child>
-+ </widget>
-+ <packing>
- <property name="fill">False</property>
-+ <property name="padding">20</property>
-+ <property name="position">1</property>
- </packing>
- </child>
- <child>
-- <widget class="GtkHBox" id="hbox10">
-- <property name="visible">True</property>
-+ <placeholder/>
-+ </child>
- <child>
-- <widget class="GtkHBox" id="hbox5">
-+ <placeholder/>
-+ </child>
-+ </widget>
-+ </child>
-+ <child>
-+ <widget class="GtkHBox" id="hbox6">
- <property name="visible">True</property>
-- <property name="border_width">5</property>
-- <property name="spacing">5</property>
-- <property name="homogeneous">True</property>
- <child>
-- <widget class="GtkEntry" id="mv0">
-- <property name="width_request">75</property>
-+ <widget class="GtkLabel" id="label10">
- <property name="visible">True</property>
-- <property name="can_focus">True</property>
-+ <property name="label" translatable="yes">Di_screte value:</property>
-+ <property name="use_underline">True</property>
-+ <property name="mnemonic_widget">mv-discrete</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
-+ <property name="padding">20</property>
- </packing>
- </child>
- <child>
-- <widget class="GtkEntry" id="mv1">
-+ <widget class="GtkEntry" id="mv-discrete">
- <property name="width_request">75</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
-- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
-- <child>
-- <widget class="GtkEntry" id="mv2">
-- <property name="width_request">75</property>
-- <property name="visible">True</property>
-- <property name="can_focus">True</property>
- </widget>
- <packing>
-- <property name="expand">False</property>
-- <property name="fill">False</property>
-- <property name="position">2</property>
-+ <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
-- <property name="padding">20</property>
-+ <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
-- <property name="position">1</property>
-+ <property name="right_attach">2</property>
-+ <property name="top_attach">1</property>
-+ <property name="bottom_attach">2</property>
-+ <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
-+ <child>
-+ <widget class="GtkVBox" id="vbox5">
-+ <property name="visible">True</property>
-+ <property name="spacing">12</property>
-+ <child>
-+ <widget class="GtkRadioButton" id="no_missing">
-+ <property name="visible">True</property>
-+ <property name="can_focus">True</property>
-+ <property name="label" translatable="yes">_No missing values</property>
-+ <property name="use_underline">True</property>
-+ <property name="active">True</property>
-+ <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
-- <property name="position">1</property>
-- </packing>
-- </child>
-- </widget>
-- <packing>
-- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
-- <widget class="GtkVBox" id="vbox7">
-+ <widget class="GtkVBox" id="vbox6">
- <property name="visible">True</property>
- <child>
-- <widget class="GtkRadioButton" id="range_missing">
-+ <widget class="GtkRadioButton" id="discrete_missing">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
-- <property name="label" translatable="yes">_Range plus one optional discrete missing value</property>
-+ <property name="label" translatable="yes">_Discrete missing values</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <property name="draw_indicator">True</property>
-@@ -1757,125 +1766,116 @@
- </packing>
- </child>
- <child>
-- <widget class="GtkVBox" id="vbox8">
-- <property name="visible">True</property>
-- <property name="spacing">5</property>
-- <child>
-- <widget class="GtkHBox" id="hbox7">
-+ <widget class="GtkHBox" id="hbox10">
- <property name="visible">True</property>
- <child>
-- <widget class="GtkHBox" id="hbox8">
-+ <widget class="GtkHBox" id="hbox5">
- <property name="visible">True</property>
-+ <property name="border_width">5</property>
-+ <property name="spacing">5</property>
-+ <property name="homogeneous">True</property>
- <child>
-- <widget class="GtkLabel" id="label11">
-+ <widget class="GtkEntry" id="mv0">
-+ <property name="width_request">75</property>
- <property name="visible">True</property>
-- <property name="label" translatable="yes">_Low:</property>
-- <property name="use_underline">True</property>
-- <property name="mnemonic_widget">mv-low</property>
-+ <property name="can_focus">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
-- <property name="padding">20</property>
- </packing>
- </child>
- <child>
-- <widget class="GtkEntry" id="mv-low">
-+ <widget class="GtkEntry" id="mv1">
- <property name="width_request">75</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
-+ <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
-- </widget>
-- </child>
-- <child>
-- <widget class="GtkHBox" id="hbox9">
-- <property name="visible">True</property>
- <child>
-- <widget class="GtkLabel" id="label12">
-+ <widget class="GtkEntry" id="mv2">
-+ <property name="width_request">75</property>
- <property name="visible">True</property>
-- <property name="label" translatable="yes">_High:</property>
-- <property name="use_underline">True</property>
-- <property name="mnemonic_widget">mv-high</property>
-+ <property name="can_focus">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
-+ <property name="position">2</property>
-+ </packing>
-+ </child>
-+ </widget>
-+ <packing>
-+ <property name="padding">20</property>
- </packing>
- </child>
-- <child>
-- <widget class="GtkEntry" id="mv-high">
-- <property name="width_request">75</property>
-- <property name="visible">True</property>
-- <property name="can_focus">True</property>
- </widget>
- <packing>
-- <property name="padding">5</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
-+ <property name="expand">False</property>
- <property name="fill">False</property>
-- <property name="padding">20</property>
- <property name="position">1</property>
- </packing>
- </child>
-- <child>
-- <placeholder/>
-- </child>
-- <child>
-- <placeholder/>
-- </child>
- </widget>
-+ <packing>
-+ <property name="y_options">GTK_FILL</property>
-+ </packing>
- </child>
- <child>
-- <widget class="GtkHBox" id="hbox6">
-+ <widget class="GtkVButtonBox" id="vbuttonbox5">
- <property name="visible">True</property>
-+ <property name="border_width">5</property>
-+ <property name="spacing">5</property>
-+ <property name="layout_style">GTK_BUTTONBOX_START</property>
- <child>
-- <widget class="GtkLabel" id="label10">
-+ <widget class="GtkButton" id="missing_val_ok">
- <property name="visible">True</property>
-- <property name="label" translatable="yes">Di_screte value:</property>
-- <property name="use_underline">True</property>
-- <property name="mnemonic_widget">mv-discrete</property>
-+ <property name="can_focus">True</property>
-+ <property name="can_default">True</property>
-+ <property name="label">gtk-ok</property>
-+ <property name="use_stock">True</property>
-+ <signal name="clicked" handler="gtk_widget_hide" object="val_labs_dialog"/>
- </widget>
-- <packing>
-- <property name="expand">False</property>
-- <property name="fill">False</property>
-- <property name="padding">20</property>
-- </packing>
- </child>
- <child>
-- <widget class="GtkEntry" id="mv-discrete">
-- <property name="width_request">75</property>
-+ <widget class="GtkButton" id="missing_val_cancel">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
-- </widget>
-- <packing>
-- <property name="expand">False</property>
-- <property name="position">1</property>
-- </packing>
-- </child>
-+ <property name="can_default">True</property>
-+ <property name="label">gtk-cancel</property>
-+ <property name="use_stock">True</property>
-+ <signal name="clicked" handler="gtk_widget_hide" object="val_labs_dialog"/>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
-+ <child>
-+ <widget class="GtkButton" id="help_button_missing_values">
-+ <property name="visible">True</property>
-+ <property name="can_focus">True</property>
-+ <property name="can_default">True</property>
-+ <property name="label">gtk-help</property>
-+ <property name="use_stock">True</property>
- </widget>
- <packing>
-- <property name="position">1</property>
-+ <property name="position">2</property>
- </packing>
- </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>
-- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- </widget>
+ <property name="expand">False</property>
<property id="modal" ignore="True" default="True" />
+ <property id="visible" ignore="True" default="False" />
</properties>
title="Keypad">
- <properties>
+ <properties>
<property id="child" disabled="True"/>
<property id="homogeneous" disabled="True"/>
<property id="n-columns" disabled="True"/>
<property id="n-rows" disabled="True"/>
+
+ <property id="above-child" disabled="True"/>
+ <property id="visible-window" disabled="True"/>
+ <property id="resize-mode" disabled="True"/>
+ <property id="border-width" disabled="True"/>
</properties>
</glade-widget-class>
+2007-03-31 John Darrington <john@darrington.wattle.id.au>
+
+ * data-editor.c data-editor.glade data-editor.h dialog-common.c
+ psppire-buttonbox.c psppire-dialog.c psppire-dialog.h
+ psppire-selector.c psppire-selector.h psppire.c psppire.glade
+ sort-cases-dialog.c sort-cases-dialog.h split-file-dialog.c
+ transpose-dialog.c weight-cases-dialog.c : Fixed the Refresh
+ button on all the dialogs.
+
2007-03-31 John Darrington <john@darrington.wattle.id.au>
* data-editor.c: Added hooks for the split-file-dialog
* Cell Ref Entry populate/depopulate.
-* Case weights.
-
* Goto Variable.
Wishlist
$(top_srcdir)/src/ui/gui/icons/goto-variable.png\
$(top_srcdir)/src/ui/gui/icons/insert-case.png \
$(top_srcdir)/src/ui/gui/icons/insert-variable.png \
+ $(top_srcdir)/src/ui/gui/icons/recent-dialogs.png \
$(top_srcdir)/src/ui/gui/icons/split-file.png \
$(top_srcdir)/src/ui/gui/icons/select-cases.png \
$(top_srcdir)/src/ui/gui/icons/weight-cases.png
#include "weight-cases-dialog.h"
#include "split-file-dialog.h"
#include "transpose-dialog.h"
+#include "sort-cases-dialog.h"
#include "dict-display.h"
#define _(msgid) gettext (msgid)
_("Split the active file"),
"pspp-split-file");
-
g_signal_connect (de->invoke_split_file_dialog, "activate",
G_CALLBACK (split_file_dialog), de);
+
+ de->invoke_sort_cases_dialog =
+ gtk_action_new ("sort-cases-dialog",
+ _("Sort"),
+ _("Sort cases in the active file"),
+ "pspp-sort-cases");
+
+ g_signal_connect (de->invoke_sort_cases_dialog, "activate",
+ G_CALLBACK (sort_cases_dialog), de);
+
+
e->window = GTK_WINDOW (get_widget_assert (de->xml, "data_editor"));
g_signal_connect_swapped (get_widget_assert (de->xml,"file_new_data"),
get_widget_assert (de->xml, "data_split-file")
);
+ gtk_action_connect_proxy (de->invoke_sort_cases_dialog,
+ get_widget_assert (de->xml, "data_sort-cases")
+ );
+
g_signal_connect (get_widget_assert (de->xml,"help_about"),
"activate",
gen_quoted_string (&filename);
- sss = create_syntax_string_source ("GET FILE=%s.",
+ sss = create_syntax_string_source ("GET FILE=%s.",
ds_cstr (&filename));
execute_syntax (sss);
</widget>
</child>
<child>
- <widget class="GtkMenuItem" id="sort_cases">
+ <widget class="GtkMenuItem" id="data_sort-cases">
<property name="visible">True</property>
- <property name="sensitive">False</property>
<property name="label" translatable="yes">Sort Cases</property>
<property name="use_underline">True</property>
</widget>
<property name="expand">False</property>
</packing>
</child>
+ <child>
+ <widget class="GtkToolButton" id="button-recent">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="tooltip" translatable="yes">Recall</property>
+ <property name="stock_id">pspp-recent-dialogs</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+
<child>
<widget class="GtkSeparatorToolItem" id="separatortoolitem1">
<property name="visible">True</property>
<property name="n_rows">1</property>
<property name="n_columns">2</property>
<child>
- <widget class="GtkEntry" id="cell_ref_entry">
+ <widget class="GtkEntry" id="entry4">
<property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="editable">False</property>
- <property name="width_chars">25</property>
+ <property name="can_focus">True</property>
</widget>
<packing>
- <property name="x_options">GTK_FILL</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkEntry" id="entry4">
+ <widget class="GtkEntry" id="cell_ref_entry">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="sensitive">False</property>
+ <property name="editable">False</property>
+ <property name="width_chars">25</property>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<widget class="GtkLabel" id="width_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Width:</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</property>
- </widget>
- <packing>
+ <property name="justify">GTK_JUSTIFY_RIGHT</property>
+ </widget>
+ <packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</child>
<child>
<widget class="GtkLabel" id="decimals_label">
- <property name="visible">True</property>
+ <property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Decimal Places:</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</property>
- </widget>
- <packing>
+ <property name="justify">GTK_JUSTIFY_RIGHT</property>
+ </widget>
+ <packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="row_spacing">5</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<property name="width_request">85</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- </widget>
- <packing>
+ </widget>
+ <packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">1</property>
- </packing>
- </child>
+ </packing>
+ </child>
</widget>
<packing>
<property name="left_attach">1</property>
</child>
<child>
<widget class="GtkLabel" id="label6">
- <property name="visible">True</property>
+ <property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Value Label:</property>
- </widget>
- <packing>
+ </widget>
+ <packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
- </packing>
- </child>
+ </packing>
+ </child>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="border_width">5</property>
<child>
<widget class="GtkButton" id="val_labs_add">
- <property name="visible">True</property>
+ <property name="visible">True</property>
<property name="sensitive">False</property>
- <property name="can_focus">True</property>
+ <property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="label">gtk-add</property>
<property name="use_stock">True</property>
<property name="label" translatable="yes">_Low:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">mv-low</property>
- </widget>
- <packing>
+ </widget>
+ <packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">20</property>
- </packing>
- </child>
- <child>
+ </packing>
+ </child>
+ <child>
<widget class="GtkEntry" id="mv-low">
<property name="width_request">75</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- </widget>
- <packing>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </widget>
+ <packing>
<property name="expand">False</property>
<property name="position">1</property>
- </packing>
- </child>
- </widget>
- </child>
- <child>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ <child>
<widget class="GtkHBox" id="hbox9">
- <property name="visible">True</property>
- <child>
+ <property name="visible">True</property>
+ <child>
<widget class="GtkLabel" id="label12">
- <property name="visible">True</property>
+ <property name="visible">True</property>
<property name="label" translatable="yes">_High:</property>
- <property name="use_underline">True</property>
+ <property name="use_underline">True</property>
<property name="mnemonic_widget">mv-high</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- <child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkEntry" id="mv-high">
<property name="width_request">75</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- </widget>
- <packing>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </widget>
+ <packing>
<property name="padding">5</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
- <property name="fill">False</property>
+ <property name="fill">False</property>
<property name="padding">20</property>
<property name="position">1</property>
- </packing>
- </child>
- <child>
+ </packing>
+ </child>
+ <child>
<placeholder/>
</child>
<child>
</child>
<child>
<widget class="GtkHBox" id="hbox6">
- <property name="visible">True</property>
- <child>
+ <property name="visible">True</property>
+ <child>
<widget class="GtkLabel" id="label10">
- <property name="visible">True</property>
+ <property name="visible">True</property>
<property name="label" translatable="yes">Di_screte value:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">mv-discrete</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="padding">20</property>
- </packing>
- </child>
- <child>
+ </packing>
+ </child>
+ <child>
<widget class="GtkEntry" id="mv-discrete">
- <property name="width_request">75</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="width_request">75</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
</widget>
<packing>
- <property name="position">1</property>
+ <property name="expand">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>
+ </packing>
+ </child>
+ </widget>
+ <packing>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- </packing>
- </child>
+ </packing>
+ </child>
<child>
<widget class="GtkVBox" id="vbox5">
<property name="visible">True</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVBox" id="vbox6">
- <property name="visible">True</property>
- <child>
- <widget class="GtkRadioButton" id="discrete_missing">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Discrete missing values</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">no_missing</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
</packing>
</child>
<child>
+ <widget class="GtkVBox" id="vbox6">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkRadioButton" id="discrete_missing">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Discrete missing values</property>
+ <property name="use_underline">True</property>
+ <property name="focus_on_click">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">no_missing</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkHBox" id="hbox10">
<property name="visible">True</property>
<child>
</widget>
<packing>
<property name="padding">20</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </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="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
<packing>
<property name="y_options">GTK_FILL</property>
</packing>
- </child>
- <child>
+ </child>
+ <child>
<widget class="GtkVButtonBox" id="vbuttonbox5">
- <property name="visible">True</property>
+ <property name="visible">True</property>
<property name="border_width">5</property>
<property name="spacing">5</property>
<property name="layout_style">GTK_BUTTONBOX_START</property>
- <child>
+ <child>
<widget class="GtkButton" id="missing_val_ok">
- <property name="visible">True</property>
+ <property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
- </widget>
- </child>
- <child>
+ </widget>
+ </child>
+ <child>
<widget class="GtkButton" id="missing_val_cancel">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
<child>
<widget class="GtkButton" id="help_button_missing_values">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
- <property name="response_id">-5</property>
+ <property name="response_id">5</property>
</widget>
</child>
</widget>
GtkAction *invoke_transpose_dialog;
GtkAction *invoke_split_file_dialog;
+ GtkAction *invoke_sort_cases_dialog;
+
GladeXML *xml;
gboolean save_as_portable;
#include <config.h>
#include "dialog-common.h"
+#include "helper.h"
+
+
+/* Append the names of selected variables to STRING.
+ TREEVIEW is the treeview containing the variables.
+ DICT is the dictionary for those variables.
+*/
gint
append_variable_names (GString *string,
PsppireDict *dict, GtkTreeView *treeview)
dialog = PSPPIRE_DIALOG (gtk_widget_get_toplevel (w));
- psppire_dialog_reload (dialog, data);
+ psppire_dialog_reload (dialog);
}
gtk_widget_show (GTK_WIDGET (dialog));
+ g_signal_emit (dialog, signals [DIALOG_REFRESH], 0);
+
g_main_loop_run (dialog->loop);
return dialog->response;
void
-psppire_dialog_reload (PsppireDialog *dialog, gpointer data)
+psppire_dialog_reload (PsppireDialog *dialog)
{
- g_signal_emit (dialog, signals [DIALOG_REFRESH], 0, data);
+ g_signal_emit (dialog, signals [DIALOG_REFRESH], 0);
}
GType psppire_dialog_get_type (void);
GtkWidget* psppire_dialog_new (void);
+void psppire_dialog_reload (PsppireDialog *);
void psppire_dialog_close (PsppireDialog *);
-void psppire_dialog_reload (PsppireDialog *, gpointer data);
gint psppire_dialog_run (PsppireDialog *);
gtk_widget_show (selector->arrow);
- /* FIXME: This shouldn't be necessary, but Glade interfaces seem to
- need it. */
- gtk_widget_show (GTK_WIDGET (selector));
+ selector->selecting = FALSE;
}
static void
de_select_selection (PsppireSelector *selector)
{
+ selector->selecting = TRUE;
+
if ( GTK_IS_TREE_VIEW (selector->dest ) )
de_select_selection_tree_view (selector);
else
g_assert_not_reached ();
+ selector->selecting = FALSE;
+
gtk_tree_model_filter_refilter (selector->filtered_source);
g_signal_emit (selector, signals [DE_SELECTED], 0);
g_return_if_fail (selector->select_items);
+ selector->selecting = TRUE;
for (item = g_list_first (selected_rows);
item != NULL;
gtk_tree_model_filter_refilter (selector->filtered_source);
g_signal_emit (selector, signals [SELECTED], 0);
+
+ selector->selecting = FALSE;
}
-/* Callback fro then the source treeview is activated (double clicked) */
+/* Callback for when the source treeview is activated (double clicked) */
static void
on_row_activate (GtkTreeView *tree_view,
GtkTreePath *path,
}
+/*
+ Callback for when the destination treeview's data changes
+ */
+static void
+on_dest_data_change (GtkTreeModel *tree_model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer user_data)
+{
+ PsppireSelector *selector = user_data;
+
+ if ( selector->selecting) return;
+
+ gtk_tree_model_filter_refilter (selector->filtered_source);
+}
+
+
+static void
+on_dest_data_delete (GtkTreeModel *tree_model,
+ GtkTreePath *path,
+ gpointer user_data)
+{
+ PsppireSelector *selector = user_data;
+
+ if ( selector->selecting ) return;
+
+ gtk_tree_model_filter_refilter (selector->filtered_source);
+}
+
+
+
+
/* Set the destination widget to DEST */
static void
set_tree_view_dest (PsppireSelector *selector,
GtkTreeView *dest)
{
GtkTreeSelection* selection = gtk_tree_view_get_selection (dest);
+ GtkTreeModel *model = gtk_tree_view_get_model (dest);
gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
g_signal_connect (selection, "changed", G_CALLBACK (on_dest_treeview_select),
selector);
+
+ g_signal_connect (model, "row-changed", G_CALLBACK (on_dest_data_change),
+ selector);
+
+ g_signal_connect (model, "row-deleted", G_CALLBACK (on_dest_data_delete),
+ selector);
+
}
/* Callback for when the DEST GtkEntry is activated (Enter is pressed) */
GtkWidget *source;
GtkWidget *dest;
+ /* A flag indicating that the object is in the process of
+ updating its subjects.
+ (not thread safe if two threads access the same object)
+ */
+ gboolean selecting;
gint orientation;
g_object_unref (pixbuf);
gtk_icon_factory_add ( factory, "pspp-select-cases", icon_set);
+ pixbuf = PIXBUF_NEW_FROM_FILE ("recent-dialogs.png");
+ icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
+ g_object_unref (pixbuf);
+ gtk_icon_factory_add ( factory, "pspp-recent-dialogs", icon_set);
+
+
+
gtk_icon_factory_add_default (factory);
}
<property name="visible">True</property>
<child>
<widget class="PsppireSelector" id="weight-cases-selector">
+ <property name="visible">True</property>
<property name="border_width">5</property>
</widget>
</child>
</packing>
</child>
</widget>
+ <packing>
+ <property name="padding">5</property>
+ </packing>
</child>
<child>
<widget class="PsppireButtonBox" id="psppire-buttonbox1">
</child>
</widget>
<widget class="PsppireDialog" id="transpose-dialog">
+ <property name="title">Transpose</property>
<property name="modal">True</property>
<child internal-child="hbox">
<widget class="GtkHBox" id="dialog-hbox2">
</child>
<child>
<widget class="PsppireSelector" id="psppire-selector3">
+ <property name="visible">True</property>
<property name="border_width">5</property>
</widget>
<packing>
</child>
<child>
<widget class="PsppireSelector" id="psppire-selector2">
+ <property name="visible">True</property>
<property name="border_width">5</property>
</widget>
<packing>
</child>
</widget>
<packing>
+ <property name="padding">5</property>
<property name="position">1</property>
</packing>
</child>
</widget>
+ <packing>
+ <property name="padding">5</property>
+ </packing>
</child>
<child>
<widget class="PsppireButtonBox" id="psppire-buttonbox2">
</child>
</widget>
<widget class="GtkWindow" id="window1">
- <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="GtkVBox" id="vbox9">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="style"></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>
</widget>
</child>
</widget>
+ <widget class="PsppireDialog" id="sort-cases-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">Sort Cases</property>
+ <property name="modal">True</property>
+ <child internal-child="hbox">
+ <widget class="GtkHBox" id="dialog-hbox4">
+ <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="GtkHBox" id="hbox14">
+ <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="GtkScrolledWindow" id="scrolledwindow6">
+ <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="hscrollbar_policy">GTK_POLICY_NEVER</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+ <child>
+ <widget class="GtkTreeView" id="sort-cases-treeview1">
+ <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="headers_visible">False</property>
+ <property name="headers_clickable">True</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment6">
+ <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="yalign">0.25</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <widget class="PsppireSelector" id="sort-cases-selector">
+ <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>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox12">
+ <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="GtkVBox" id="vbox16">
+ <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="label18">
+ <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">Sort by:</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow7">
+ <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="hscrollbar_policy">GTK_POLICY_NEVER</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+ <child>
+ <widget class="GtkTreeView" id="sort-cases-treeview2">
+ <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="headers_visible">False</property>
+ <property name="headers_clickable">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">5</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFrame" id="frame9">
+ <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="alignment5">
+ <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="GtkVButtonBox" id="vbuttonbox4">
+ <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>
+ <child>
+ <widget class="GtkRadioButton" id="sort-cases-radiobutton0">
+ <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">Ascending</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="sort-cases-radiobutton1">
+ <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">Descending</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">sort-cases-radiobutton0</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label17">
+ <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">Sort Order</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">5</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="PsppireButtonBox" id="psppire-buttonbox4">
+ <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>
+ </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>
-/*
- PSPPIRE --- A Graphical User Interface for PSPP
- Copyright (C) 2006 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. */
-
-/* This module describes the behaviour of the Sort Cases dialog box. */
-
-
-/* This code is rather quick and dirty. Some of the issues are:
-
- 1. Character set conversion when displaying dictionary tree view.
-
- 2. The interaction between the dictionary treeview, the criteria
- list treeview and the button, needs to be abstracted and made
- available as an external interface.
-
- 3. There's no destroy function for this dialog.
-
- 4. Some of the functionality might be better implemented with
- GtkAction.
-
- 5. Double clicking the tree view rows should insert/delete them
- from the criteria list.
-
- 6. Changing the Ascending/Descending flag ought to be possible for
- a criteria already in the criteria tree view.
-
- 7. Variables which are in the criteria tree view should not be
- shown in the dictionary treeview.
-
- 8. The dialog box structure itself ought to be a GtkWindow and
- abstracted better.
-*/
-
-
-#include <config.h>
-#include "helper.h"
+#include <gtk/gtk.h>
#include "sort-cases-dialog.h"
-#include "psppire-dict.h"
-#include <math/sort.h>
-
-#include <gettext.h>
-#define _(msgid) gettext (msgid)
-#define N_(msgid) msgid
-
-
-enum {CRIT_TVM_IDX = 0, CRIT_TVM_DIR};
-
-/* Occurs when the dictionary tree view selection changes */
-static void
-dictionary_selection_changed (GtkTreeSelection *selection,
- gpointer data)
-{
- GtkTreeSelection *otherselection ;
- struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) data;
-
- if ( 0 == gtk_tree_selection_count_selected_rows (selection) )
- return ;
-
- gtk_arrow_set (dialog->arrow, GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
- dialog->button_state = VAR_SELECT;
-
- otherselection = gtk_tree_view_get_selection (dialog->criteria_view);
-
- gtk_tree_selection_unselect_all (otherselection);
-}
-
-
-/* Occurs when the sort criteria tree view selection changes */
-static void
-criteria_selection_changed (GtkTreeSelection *selection,
- gpointer data)
-{
- GtkTreeSelection *otherselection ;
- struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) data;
-
- if ( 0 == gtk_tree_selection_count_selected_rows (selection) )
- return ;
-
- otherselection = gtk_tree_view_get_selection (dialog->dict_view);
-
- gtk_arrow_set (dialog->arrow, GTK_ARROW_LEFT, GTK_SHADOW_OUT);
- dialog->button_state = VAR_DESELECT;
-
- gtk_tree_selection_unselect_all (otherselection);
-}
-
-
-/* Occurs when the dialog box is deleted (eg: closed via the title bar) */
-static gint
-delete_event_callback (GtkWidget *widget,
- GdkEvent *event,
- gpointer data)
-{
- struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) data;
-
- g_main_loop_quit (dialog->loop);
-
- gtk_widget_hide_on_delete (widget);
-
- dialog->response = GTK_RESPONSE_DELETE_EVENT;
-
- return TRUE;
-}
-
-/* Occurs when the cancel button is clicked */
-static void
-sort_cases_cancel_callback (GObject *obj, gpointer data)
-{
- struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) data;
-
- gtk_widget_hide (dialog->window);
-
- g_main_loop_quit (dialog->loop);
+#include "helper.h"
+#include "psppire-dialog.h"
+#include "data-editor.h"
+#include <gtksheet/gtksheet.h>
+#include "psppire-var-store.h"
+#include "dialog-common.h"
+#include "dict-display.h"
- dialog->response = GTK_RESPONSE_CANCEL;
-}
+#include <language/syntax-string-source.h>
+#include "syntax-editor.h"
-/* Occurs when the reset button is clicked */
static void
-sort_cases_reset_callback (GObject *obj, gpointer data)
+refresh (PsppireDialog *dialog, GtkTreeView *dest)
{
- struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) data;
+ GtkTreeModel *liststore = gtk_tree_view_get_model (dest);
- gtk_arrow_set (dialog->arrow, GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
- dialog->button_state = VAR_SELECT;
- gtk_list_store_clear (dialog->criteria_list);
+ gtk_list_store_clear (GTK_LIST_STORE (liststore));
}
-/* Add variables currently selected in the dictionary tree view to the
- list of criteria */
-static void
-select_criteria (GtkTreeModel *model, GtkTreePath *path,
- GtkTreeIter *iter, gpointer data)
+struct sort_cases_dialog
{
- GtkTreeIter new_iter;
- gint index;
- gint dir;
- struct variable *variable;
- struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) data;
-
- /* Get the variable from the dictionary */
- gtk_tree_model_get (model, iter,
- DICT_TVM_COL_VAR, &variable,
- -1);
-
- index = var_get_dict_index (variable);
-
- dir = gtk_toggle_button_get_active (dialog->ascending_button) ?
- SRT_ASCEND:SRT_DESCEND;
-
- /* Append to the list of criteria */
- gtk_list_store_append (dialog->criteria_list, &new_iter);
- gtk_list_store_set (dialog->criteria_list,
- &new_iter, CRIT_TVM_IDX, index, -1);
- gtk_list_store_set (dialog->criteria_list,
- &new_iter, CRIT_TVM_DIR, dir, -1);
-}
+ GtkTreeView *tv;
+ PsppireDict *dict;
+ GtkToggleButton *ascending;
+};
-/* Create a list of the RowRefs which are to be removed from the
- criteria list */
-static void
-path_to_row_ref (GtkTreeModel *model, GtkTreePath *path,
- GtkTreeIter *iter, gpointer data)
+static char *
+generate_syntax (const struct sort_cases_dialog *scd)
{
- GList **rrlist = data;
- GtkTreeRowReference *rowref = gtk_tree_row_reference_new (model, path);
-
- *rrlist = g_list_append (*rrlist, rowref);
-}
-
-
-/* Remove a row from the list of criteria */
-static void
-deselect_criteria (gpointer data,
- gpointer user_data)
-{
- GtkTreeIter iter;
- GtkTreeRowReference *row_ref = data;
- GtkTreePath *path;
- struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) user_data;
-
- path = gtk_tree_row_reference_get_path (row_ref);
+ gchar *text;
+ GString *string = g_string_new ("SORT CASES BY ");
+ gint n_vars = append_variable_names (string,
+ scd->dict, GTK_TREE_VIEW (scd->tv));
- gtk_tree_model_get_iter (GTK_TREE_MODEL (dialog->criteria_list), &iter, path);
-
- gtk_list_store_remove (dialog->criteria_list, &iter);
-
- gtk_tree_row_reference_free (row_ref);
-}
-
-
-
-/* Callback which occurs when the button to remove variables from the list
- of criteria is clicked. */
-static void
-sort_cases_button_callback (GObject *obj, gpointer data)
-{
- struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) data;
-
- if ( dialog->button_state == VAR_SELECT) /* Right facing arrow */
+ if ( n_vars == 0 )
+ g_string_assign (string, "");
+ else
{
- GtkTreeSelection *selection =
- gtk_tree_view_get_selection (dialog->dict_view);
-
- gtk_tree_selection_selected_foreach (selection, select_criteria, dialog);
+ const char up_down =
+ gtk_toggle_button_get_active (scd->ascending) ? 'A' : 'D';
+ g_string_append_printf (string, "(%c)", up_down);
+ g_string_append (string, ".");
}
- else /* Left facing arrow */
- {
- GList *selectedRows = NULL;
- GtkTreeSelection *selection =
- gtk_tree_view_get_selection (dialog->criteria_view);
-
- /* Make a list of rows to be deleted */
- gtk_tree_selection_selected_foreach (selection, path_to_row_ref,
- &selectedRows);
-
- /* ... and delete them */
- g_list_foreach (selectedRows, deselect_criteria, dialog);
-
- g_list_free (selectedRows);
- }
-}
-/* Callback which occurs when the OK button is clicked */
-static void
-sort_cases_ok_callback (GObject *obj, gpointer data)
-{
- struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) data;
+ text = string->str;
- gtk_widget_hide (dialog->window);
- g_main_loop_quit (dialog->loop);
+ g_string_free (string, FALSE);
- dialog->response = GTK_RESPONSE_OK;
+ return text;
}
-/* This function is responsible for rendering a criterion in the
- criteria list */
-static void
-criteria_render_func (GtkTreeViewColumn *column, GtkCellRenderer *renderer,
- GtkTreeModel *model, GtkTreeIter *iter,
- gpointer data)
+/* Pops up the Sort Cases dialog box */
+void
+sort_cases_dialog (GObject *o, gpointer data)
{
- gint var_index;
- struct variable *variable ;
- gint direction;
- gchar *buf;
- gchar *varname;
- PsppireDict *dict = data;
-
- gtk_tree_model_get (model, iter,
- CRIT_TVM_IDX, &var_index,
- CRIT_TVM_DIR, &direction, -1);
-
- variable = psppire_dict_get_variable (dict, var_index);
-
- varname = pspp_locale_to_utf8 (var_get_name (variable),
- -1, 0);
-
- if ( direction == SRT_ASCEND)
- buf = g_strdup_printf ("%s: %s", varname, _("Ascending"));
- else
- buf = g_strdup_printf ("%s: %s", varname, _("Descending"));
-
- g_free (varname);
-
- g_object_set (renderer, "text", buf, NULL);
-
- g_free (buf);
-}
-
-
-/* Create the dialog */
-struct sort_cases_dialog *
-sort_cases_dialog_create (GladeXML *xml)
-{
- struct sort_cases_dialog *dialog = g_malloc (sizeof (*dialog));
-
- dialog->loop = g_main_loop_new (NULL, FALSE);
-
- dialog->window = get_widget_assert (xml, "sort-cases-dialog");
-
- dialog->dict_view = GTK_TREE_VIEW (get_widget_assert
- (xml, "sort-cases-treeview-dict"));
- dialog->criteria_view = GTK_TREE_VIEW (get_widget_assert
- (xml, "sort-cases-treeview-criteria"));
-
- dialog->arrow = GTK_ARROW (get_widget_assert (xml, "sort-cases-arrow"));
- dialog->button = GTK_BUTTON (get_widget_assert (xml, "sort-cases-button"));
-
- dialog->ascending_button =
- GTK_TOGGLE_BUTTON (get_widget_assert (xml, "sort-cases-button-ascending"));
-
- g_signal_connect (dialog->window, "delete-event",
- G_CALLBACK (delete_event_callback), dialog);
-
- g_signal_connect (get_widget_assert (xml, "sort-cases-cancel"),
- "clicked", G_CALLBACK (sort_cases_cancel_callback), dialog);
-
- g_signal_connect (get_widget_assert (xml, "sort-cases-ok"),
- "clicked", G_CALLBACK (sort_cases_ok_callback), dialog);
-
-
- g_signal_connect (get_widget_assert (xml, "sort-cases-reset"),
- "clicked", G_CALLBACK (sort_cases_reset_callback), dialog);
-
+ gint response;
+ struct data_editor *de = data;
- g_signal_connect (get_widget_assert (xml, "sort-cases-button"),
- "clicked", G_CALLBACK (sort_cases_button_callback), dialog);
+ struct sort_cases_dialog scd;
+ GladeXML *xml = XML_NEW ("psppire.glade");
- {
- /* Set up the dictionary treeview */
- GtkTreeViewColumn *col;
+ GtkWidget *dialog = get_widget_assert (xml, "sort-cases-dialog");
- GtkTreeSelection *selection =
- gtk_tree_view_get_selection (dialog->dict_view);
- GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
+ GtkWidget *source = get_widget_assert (xml, "sort-cases-treeview1");
+ GtkWidget *selector = get_widget_assert (xml, "sort-cases-selector");
+ GtkWidget *dest = get_widget_assert (xml, "sort-cases-treeview2");
- col = gtk_tree_view_column_new_with_attributes (_("Var"),
- renderer,
- "text",
- 0,
- NULL);
+ GtkSheet *var_sheet =
+ GTK_SHEET (get_widget_assert (de->xml, "variable_sheet"));
- /* FIXME: make this a value in terms of character widths */
- g_object_set (col, "min-width", 100, NULL);
+ PsppireVarStore *vs = PSPPIRE_VAR_STORE (gtk_sheet_get_model (var_sheet));
- gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_FIXED);
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
- gtk_tree_view_append_column (dialog->dict_view, col);
+ attach_dictionary_to_treeview (GTK_TREE_VIEW (source),
+ vs->dict,
+ GTK_SELECTION_MULTIPLE, NULL);
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
+ set_dest_model (GTK_TREE_VIEW (dest), vs->dict);
- g_signal_connect (selection, "changed",
- G_CALLBACK (dictionary_selection_changed), dialog);
- }
+ psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector),
+ source,
+ dest,
+ insert_source_row_into_tree_view,
+ NULL);
- {
- /* Set up the variable list treeview */
- GtkTreeSelection *selection =
- gtk_tree_view_get_selection (dialog->criteria_view);
+ g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), dest);
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
+ scd.tv = GTK_TREE_VIEW (dest);
+ scd.dict = vs->dict;
+ scd.ascending =
+ GTK_TOGGLE_BUTTON (get_widget_assert (xml, "sort-cases-radiobutton0"));
- dialog->crit_renderer = gtk_cell_renderer_text_new ();
+ response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
- dialog->crit_col = gtk_tree_view_column_new_with_attributes (_("Criteria"),
- dialog->crit_renderer,
- "text",
- 0,
- NULL);
- gtk_tree_view_column_set_sizing (dialog->crit_col, GTK_TREE_VIEW_COLUMN_FIXED);
-
- gtk_tree_view_append_column (GTK_TREE_VIEW (dialog->criteria_view),
- dialog->crit_col);
-
- g_signal_connect (selection, "changed",
- G_CALLBACK (criteria_selection_changed), dialog);
- }
-
- {
- /* Create the list of criteria */
- dialog->criteria_list = gtk_list_store_new (2,
- G_TYPE_INT, /* index of the variable */
- G_TYPE_INT /* Ascending/Descending */
- );
-
- gtk_tree_view_set_model (dialog->criteria_view,
- GTK_TREE_MODEL (dialog->criteria_list));
- }
-
- dialog->response = GTK_RESPONSE_NONE;
-
- return dialog;
-}
-
-
-static void
-convert_list_store_to_criteria (GtkListStore *list,
- PsppireDict *dict,
- struct sort_criteria *criteria);
-
-
-/* Run the dialog.
- If the return value is GTK_RESPONSE_OK, then CRITERIA gets filled
- with a valid sort criteria which can be used to sort the data.
- This structure and its contents must be freed by the caller. */
-gint
-sort_cases_dialog_run (struct sort_cases_dialog *dialog,
- PsppireDict *dict,
- struct sort_criteria *criteria
- )
-{
- g_assert (! g_main_loop_is_running (dialog->loop));
-
- gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->dict_view),
- GTK_TREE_MODEL (dict));
-
-
- gtk_tree_view_column_set_cell_data_func (dialog->crit_col,
- dialog->crit_renderer,
- criteria_render_func, dict, 0);
-
- gtk_list_store_clear (dialog->criteria_list);
-
- gtk_arrow_set (dialog->arrow, GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
- dialog->button_state = VAR_SELECT;
-
- gtk_widget_show (dialog->window);
-
- g_main_loop_run (dialog->loop);
-
- if ( GTK_RESPONSE_OK == dialog->response)
- convert_list_store_to_criteria (dialog->criteria_list,
- dict, criteria);
-
- return dialog->response;
-}
-
-
-
-/* Convert the GtkListStore to a struct sort_criteria*/
-static void
-convert_list_store_to_criteria (GtkListStore *list,
- PsppireDict *dict,
- struct sort_criteria *criteria)
-{
- GtkTreeIter iter;
- gboolean valid;
- gint n = 0;
-
- GtkTreeModel *model = GTK_TREE_MODEL (list);
-
- criteria->crit_cnt = gtk_tree_model_iter_n_children (model, NULL);
-
- criteria->crits = g_malloc (sizeof (struct sort_criterion) *
- criteria->crit_cnt);
-
- for (valid = gtk_tree_model_get_iter_first (model, &iter);
- valid;
- valid = gtk_tree_model_iter_next (model, &iter))
+ switch (response)
{
- struct variable *variable;
- gint index;
- struct sort_criterion *scn = &criteria->crits[n];
- g_assert ( n < criteria->crit_cnt);
- n++;
-
- gtk_tree_model_get (model, &iter,
- CRIT_TVM_IDX, &index,
- CRIT_TVM_DIR, &scn->dir,
- -1);
-
- variable = psppire_dict_get_variable (dict, index);
-
- scn->fv = var_get_case_index (variable);
- scn->width = var_get_width (variable);
+ 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 (xml);
}
#include <gtk/gtk.h>
#include <glade/glade.h>
-#include "psppire-dict.h"
-struct sort_criteria;
-struct sort_cases_dialog
-{
- GtkWidget *window;
- GMainLoop *loop;
-
- GtkTreeView *dict_view;
-
-
- GtkTreeView *criteria_view;
- GtkTreeViewColumn *crit_col;
- GtkCellRenderer *crit_renderer;
-
- GtkListStore *criteria_list;
-
- struct sort_criteria *sc;
-
- GtkArrow *arrow;
- GtkButton *button;
-
- GtkToggleButton *ascending_button;
-
- /* FIXME: Could this be done better with a GtkToggleAction ?? */
- enum {VAR_SELECT, VAR_DESELECT} button_state;
-
- gint response;
-};
-
-struct sort_cases_dialog * sort_cases_dialog_create (GladeXML *xml);
-
-
-gint sort_cases_dialog_run (struct sort_cases_dialog *dialog,
- PsppireDict *dict,
- struct sort_criteria *criteria
- );
+void sort_cases_dialog (GObject *o, gpointer data);
#endif
#include "psppire-var-store.h"
+struct split_file_dialog
+{
+ /* The XML that created the dialog */
+ GladeXML *xml;
+
+ /* The dictionary to which this dialog pertains */
+ PsppireDict *dict;
+
+ /* The treeview widget containing the list of variables
+ upon which the file should be split */
+ GtkTreeView *tv;
+
+
+ PsppireSelector *selector;
+};
+
static gchar *
-generate_syntax (GladeXML *xml, PsppireDict *dict)
+generate_syntax (const struct split_file_dialog *sfd)
{
gchar *text;
- GtkWidget *off = get_widget_assert (xml, "split-radiobutton0");
+ GtkWidget *off = get_widget_assert (sfd->xml, "split-radiobutton0");
GtkWidget *vars =
- get_widget_assert (xml, "split-file-grouping-vars");
+ get_widget_assert (sfd->xml, "split-file-grouping-vars");
GString *string = g_string_new ("SPLIT FILE OFF.");
if ( ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (off)))
{
GString * varlist = g_string_sized_new (80);
- GtkWidget *sort = get_widget_assert (xml, "split-radiobutton3");
- GtkWidget *layered = get_widget_assert (xml, "split-radiobutton1");
+ GtkWidget *sort = get_widget_assert (sfd->xml, "split-radiobutton3");
+ GtkWidget *layered = get_widget_assert (sfd->xml, "split-radiobutton1");
gint n_vars = append_variable_names (varlist,
- dict, GTK_TREE_VIEW (vars));
+ sfd->dict, GTK_TREE_VIEW (vars));
if ( n_vars > 0 )
{
}
static void
-refresh (GladeXML *xml)
+refresh (PsppireDialog *dialog, struct split_file_dialog *d)
{
- GtkWidget *off = get_widget_assert (xml, "split-radiobutton0");
+ GtkWidget *off = get_widget_assert (d->xml, "split-radiobutton0");
+ GtkWidget *on = get_widget_assert (d->xml, "split-radiobutton1");
+
+ GtkTreeModel *liststore = gtk_tree_view_get_model (d->tv);
- g_print ("%s\n", __FUNCTION__);
+ gint n_vars = dict_get_split_cnt (d->dict->dict);
+
+
+ gtk_list_store_clear (GTK_LIST_STORE (liststore));
+
+ if ( n_vars == 0 )
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(off), TRUE);
+ else
+ {
+ GtkTreeIter iter;
+ gint i;
+ struct variable *const *vars = dict_get_split_vars (d->dict->dict);
+
+ for (i = 0 ; i < n_vars; ++i )
+ {
+ gint idx = var_get_dict_index (vars[i]);
+
+ gtk_list_store_append (GTK_LIST_STORE (liststore), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (liststore), &iter, 0, idx, -1);
+ }
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(on), TRUE);
+ }
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(off), TRUE);
gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON(off));
}
-/* Pops up the Weight Cases dialog box */
+/* Pops up the Split File dialog box */
void
split_file_dialog (GObject *o, gpointer data)
{
gint response;
struct data_editor *de = data;
- PsppireDict *dict;
+ struct split_file_dialog sfd;
- GladeXML *xml = XML_NEW ("psppire.glade");
+ GtkWidget *dialog ;
+ GtkWidget *source ;
+ GtkWidget *dest ;
+ GtkWidget *selector ;
+ GtkWidget *on_off ;
- GtkWidget *dialog = get_widget_assert (xml, "split-file-dialog");
- GtkWidget *source = get_widget_assert (xml, "split-file-dict-treeview");
- GtkWidget *dest = get_widget_assert (xml, "split-file-grouping-vars");
- GtkWidget *selector = get_widget_assert (xml, "split-file-selector");
- GtkWidget *on_off = get_widget_assert (xml, "split-radiobutton0");
+ GtkSheet *var_sheet ;
+
+ sfd.xml = XML_NEW ("psppire.glade");
+
+ dialog = get_widget_assert (sfd.xml, "split-file-dialog");
+ source = get_widget_assert (sfd.xml, "split-file-dict-treeview");
+ dest = get_widget_assert (sfd.xml, "split-file-grouping-vars");
+ selector = get_widget_assert (sfd.xml, "split-file-selector");
+ on_off = get_widget_assert (sfd.xml, "split-radiobutton0");
- GtkSheet *var_sheet =
- GTK_SHEET (get_widget_assert (de->xml, "variable_sheet"));
+ var_sheet = GTK_SHEET (get_widget_assert (de->xml, "variable_sheet"));
PsppireVarStore *vs = PSPPIRE_VAR_STORE (gtk_sheet_get_model (var_sheet));
- dict = vs->dict;
+ sfd.dict = vs->dict;
+ sfd.tv = GTK_TREE_VIEW (dest);
+ sfd.selector = PSPPIRE_SELECTOR (
+ get_widget_assert (sfd.xml, "split-file-selector"));
attach_dictionary_to_treeview (GTK_TREE_VIEW (source),
vs->dict,
GTK_SELECTION_MULTIPLE, NULL);
- g_signal_connect (on_off, "toggled", G_CALLBACK(on_off_toggled), xml);
+ g_signal_connect (on_off, "toggled", G_CALLBACK(on_off_toggled), sfd.xml);
set_dest_model (GTK_TREE_VIEW (dest), vs->dict);
insert_source_row_into_tree_view,
NULL);
- refresh (xml);
+ g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), &sfd);
response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
{
case GTK_RESPONSE_OK:
{
- gchar *syntax = generate_syntax (xml, dict);
+ gchar *syntax = generate_syntax (&sfd);
struct getl_interface *sss = create_syntax_string_source (syntax);
execute_syntax (sss);
break;
case PSPPIRE_RESPONSE_PASTE:
{
- gchar *syntax = generate_syntax (xml, dict);
+ gchar *syntax = generate_syntax (&sfd);
struct syntax_editor *se =
(struct syntax_editor *) window_create (WINDOW_SYNTAX, NULL);
break;
}
- g_object_unref (xml);
+ g_object_unref (sfd.xml);
}
static gchar * generate_syntax (PsppireDict *dict, GladeXML *xml);
+static void
+refresh (PsppireDialog *dialog, gpointer data)
+{
+ GladeXML *xml = data;
+ GtkWidget *dest = get_widget_assert (xml, "variables-treeview");
+ GtkWidget *entry = get_widget_assert (xml, "new-name-entry");
+ GtkTreeModel *dmodel = gtk_tree_view_get_model (dest);
+
+ gtk_list_store_clear (GTK_LIST_STORE (dmodel));
+ gtk_entry_set_text (GTK_ENTRY (entry), "");
+}
+
void
transpose_dialog (GObject *o, gpointer data)
{
is_currently_in_entry);
+ g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), xml);
+
response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
switch (response)
#include <gtk/gtk.h>
#include <glade/glade.h>
+#include <gettext.h>
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+
/* FIXME: These shouldn't be here */
#include <gtksheet/gtksheet.h>
#include "psppire-var-store.h"
gtk_entry_set_text (entry, "");
}
+struct weight_cases_dialog
+{
+ PsppireDict *dict;
+ GtkEntry *entry;
+ GtkLabel *status;
+ GtkToggleButton *off;
+ GtkToggleButton *on;
+};
+static void
+refresh (PsppireDialog *dialog, const struct weight_cases_dialog *wcd)
+{
+ const struct variable *var = dict_get_weight (wcd->dict->dict);
+ if ( ! var )
+ {
+ gtk_entry_set_text (wcd->entry, "");
+ gtk_label_set_text (wcd->status, _("Do not weight cases"));
+ gtk_toggle_button_set_active (wcd->off, TRUE);
+ }
+ else
+ {
+ gchar *text =
+ g_strdup_printf (_("Weight cases by %s"), var_get_name (var));
-static gchar * generate_syntax (PsppireDict *, GtkEntry *);
+ gtk_entry_set_text (wcd->entry, var_get_name (var));
+ gtk_label_set_text (wcd->status, text);
+
+ g_free (text);
+ gtk_toggle_button_set_active (wcd->on, TRUE);
+ }
+
+ g_signal_emit_by_name (wcd->entry, "activate");
+}
+
+
+static gchar * generate_syntax (const struct weight_cases_dialog *wcd);
/* Pops up the Weight Cases dialog box */
{
gint response;
struct data_editor *de = data;
- PsppireDict *dict;
- struct variable *var;
+ struct weight_cases_dialog wcd;
GladeXML *xml = XML_NEW ("psppire.glade");
GtkWidget *radiobutton1 = get_widget_assert (xml,
"weight-cases-radiobutton1");
GtkWidget *radiobutton2 = get_widget_assert (xml, "radiobutton2");
+ GtkWidget *status = get_widget_assert (xml, "weight-status-label");
GtkSheet *var_sheet =
GTK_SHEET (get_widget_assert (de->xml, "variable_sheet"));
PsppireVarStore *vs = PSPPIRE_VAR_STORE (gtk_sheet_get_model (var_sheet));
- dict = vs->dict;
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
g_signal_connect (radiobutton1, "toggled", G_CALLBACK (on_toggle), entry);
g_signal_connect (selector, "selected", G_CALLBACK (on_select),
radiobutton1);
attach_dictionary_to_treeview (GTK_TREE_VIEW (source),
- dict,
+ vs->dict,
GTK_SELECTION_SINGLE,
var_is_numeric
);
is_currently_in_entry
);
- var = dict_get_weight (dict->dict);
- if ( ! var )
- gtk_entry_set_text (GTK_ENTRY (entry), "");
- else
- gtk_entry_set_text (GTK_ENTRY (entry), var_get_name (var));
- g_signal_emit_by_name (entry, "activate");
+ wcd.dict = vs->dict;
+ wcd.entry = GTK_ENTRY (entry);
+ wcd.status = GTK_LABEL (status);
+ wcd.off = GTK_TOGGLE_BUTTON (radiobutton1);
+ wcd.on = GTK_TOGGLE_BUTTON (radiobutton2);
+
+ g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), &wcd);
response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
{
case GTK_RESPONSE_OK:
{
- gchar *syntax = generate_syntax (dict, GTK_ENTRY (entry));
+ gchar *syntax = generate_syntax (&wcd);
struct getl_interface *sss = create_syntax_string_source (syntax);
execute_syntax (sss);
break;
case PSPPIRE_RESPONSE_PASTE:
{
- gchar *syntax = generate_syntax (dict, GTK_ENTRY (entry));
+ gchar *syntax = generate_syntax (&wcd);
struct syntax_editor *se =
(struct syntax_editor *) window_create (WINDOW_SYNTAX, NULL);
static gchar *
-generate_syntax (PsppireDict *dict, GtkEntry *entry)
+generate_syntax (const struct weight_cases_dialog *wcd)
{
gchar *syntax;
- const gchar *text = gtk_entry_get_text (entry);
+ const gchar *text = gtk_entry_get_text (wcd->entry);
- struct variable *var = psppire_dict_lookup_var (dict, text);
+ struct variable *var = psppire_dict_lookup_var (wcd->dict, text);
if ( var == NULL)
syntax = g_strdup ("WEIGHT OFF.");