src/ui/gui/psppire-dialog-action-scatterplot.h \
src/ui/gui/psppire-dialog-action-sort.c \
src/ui/gui/psppire-dialog-action-sort.h \
+ src/ui/gui/psppire-dialog-action-split.c \
+ src/ui/gui/psppire-dialog-action-split.h \
src/ui/gui/psppire-dialog-action-tt1s.c \
src/ui/gui/psppire-dialog-action-tt1s.h \
src/ui/gui/psppire-dialog-action-two-sample.c \
src/ui/gui/recode-dialog.h \
src/ui/gui/select-cases-dialog.c \
src/ui/gui/select-cases-dialog.h \
- src/ui/gui/split-file-dialog.c \
- src/ui/gui/split-file-dialog.h \
src/ui/gui/t-test-options.c \
src/ui/gui/t-test-options.h \
src/ui/gui/val-labs-dialog.c \
</object>
</child>
<child>
- <object class="GtkAction" id="data_split-file">
+ <object class="PsppireDialogActionSplit" id="data_split-file">
<property name="name">data_split-file</property>
+ <property name="manager">uimanager1</property>
<property name="label" translatable="yes">S_plit File...</property>
<property name="tooltip" translatable="yes">Split the active dataset</property>
<property name="stock-id">data-split-file</property>
#include "ui/gui/psppire.h"
#include "ui/gui/recode-dialog.h"
#include "ui/gui/select-cases-dialog.h"
-#include "ui/gui/split-file-dialog.h"
#include "ui/syntax-gen.h"
#include "gl/c-strcase.h"
g_signal_connect_swapped (get_action_assert (de->builder, "view_value-labels"), "toggled", G_CALLBACK (toggle_value_labels), de);
connect_action (de, "data_select-cases", G_CALLBACK (select_cases_dialog));
- connect_action (de, "data_split-file", G_CALLBACK (split_file_dialog));
connect_action (de, "transform_recode-same", G_CALLBACK (recode_same_dialog));
connect_action (de, "transform_recode-different", G_CALLBACK (recode_different_dialog));
--- /dev/null
+/* PSPPIRE - a graphical user interface for PSPP.
+ Copyright (C) 2007, 2010, 2011, 2012, 2015 Free Software Foundation
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+
+#include <config.h>
+
+#include "psppire-dialog-action-split.h"
+#include "psppire-selector.h"
+#include "psppire-var-view.h"
+#include "dict-display.h"
+
+#include "psppire-dialog.h"
+#include "builder-wrapper.h"
+
+#include <gettext.h>
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+static void psppire_dialog_action_split_init (PsppireDialogActionSplit *act);
+static void psppire_dialog_action_split_class_init (PsppireDialogActionSplitClass *class);
+
+G_DEFINE_TYPE (PsppireDialogActionSplit, psppire_dialog_action_split, PSPPIRE_TYPE_DIALOG_ACTION);
+
+
+static char *
+generate_syntax (PsppireDialogAction *pda)
+{
+ PsppireDialogActionSplit *act = PSPPIRE_DIALOG_ACTION_SPLIT (pda);
+ gchar *text;
+
+ GString *string = g_string_new ("SPLIT FILE OFF.");
+
+ if ( ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->off)))
+ {
+ GString * varlist = g_string_sized_new (80);
+ gint n_vars = psppire_var_view_append_names (PSPPIRE_VAR_VIEW (act->tv), 0, varlist);
+
+ if ( n_vars > 0 )
+ {
+ g_string_assign (string, "");
+
+ if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(act->sort)))
+ {
+ g_string_append (string, "SORT CASES BY");
+ g_string_append (string, varlist->str);
+ g_string_append (string, ".\n");
+ }
+
+ g_string_append (string, "SPLIT FILE ");
+
+ if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->layered)))
+ g_string_append (string, "LAYERED ");
+ else
+ g_string_append (string, "SEPARATE ");
+
+ g_string_append (string, "BY ");
+ g_string_append (string, varlist->str);
+ g_string_append (string, ".");
+ }
+ g_string_free (varlist, TRUE);
+ }
+
+ text = string->str;
+
+ g_string_free (string, FALSE);
+
+ return text;
+}
+
+
+static gboolean
+dialog_state_valid (gpointer data)
+{
+ return TRUE;
+}
+
+static void
+refresh (PsppireDialogAction *pda)
+{
+ PsppireDialogActionSplit *act = PSPPIRE_DIALOG_ACTION_SPLIT (pda);
+
+ GtkTreeModel *liststore = gtk_tree_view_get_model (GTK_TREE_VIEW (act->tv));
+
+ gint n_vars = dict_get_split_cnt (pda->dict->dict);
+
+ gtk_list_store_clear (GTK_LIST_STORE (liststore));
+
+ if ( n_vars == 0 )
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (act->off), TRUE);
+ else
+ {
+ GtkTreeIter iter;
+ gint i;
+ const struct variable *const *vars = dict_get_split_vars (pda->dict->dict);
+
+ for (i = 0 ; i < n_vars; ++i )
+ {
+ gtk_list_store_append (GTK_LIST_STORE (liststore), &iter);
+
+ gtk_list_store_set (GTK_LIST_STORE (liststore), &iter,
+ 0, vars[i],
+ -1);
+ }
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (act->layered), TRUE);
+ }
+
+ gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (act->off));
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (act->sort), TRUE);
+}
+
+static void
+on_off_toggled (GtkToggleButton *togglebutton,
+ gpointer user_data)
+{
+ PsppireDialogActionSplit *act = PSPPIRE_DIALOG_ACTION_SPLIT (user_data);
+
+ gboolean state = !gtk_toggle_button_get_active (togglebutton);
+
+ gtk_widget_set_sensitive (act->dest, state);
+ gtk_widget_set_sensitive (act->selector, state);
+ gtk_widget_set_sensitive (act->source, state);
+}
+
+static void
+psppire_dialog_action_split_activate (PsppireDialogAction *pda)
+{
+ PsppireDialogActionSplit *act = PSPPIRE_DIALOG_ACTION_SPLIT (pda);
+
+ GHashTable *thing = psppire_dialog_action_get_hash_table (pda);
+ GtkBuilder *xml = g_hash_table_lookup (thing, pda);
+ if (!xml)
+ {
+ xml = builder_new ("split-file.ui");
+ g_hash_table_insert (thing, pda, xml);
+
+ pda->dialog = get_widget_assert (xml, "split-file-dialog");
+ pda->source = get_widget_assert (xml, "split-file-dict-treeview");
+ act->selector = get_widget_assert (xml, "split-file-selector");
+
+ act->dest = get_widget_assert (xml, "split-file-grouping-vars");
+ act->source = get_widget_assert (xml, "split-file-dict-treeview");
+ act->sort = get_widget_assert (xml, "split-sort");
+
+ act->off = get_widget_assert (xml, "split-off");
+ act->layered = get_widget_assert (xml, "split-layered");
+
+ act->tv = get_widget_assert (xml, "split-file-grouping-vars");
+
+ g_signal_connect (act->off, "toggled", G_CALLBACK (on_off_toggled), pda);
+ g_signal_connect_swapped (pda->dialog, "show", G_CALLBACK (refresh), pda);
+ }
+
+ psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid);
+ psppire_dialog_action_set_refresh (pda, refresh);
+
+ if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_split_parent_class)->activate)
+ PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_split_parent_class)->activate (pda);
+}
+
+static void
+psppire_dialog_action_split_class_init (PsppireDialogActionSplitClass *class)
+{
+ psppire_dialog_action_set_activation (class, psppire_dialog_action_split_activate);
+ PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
+}
+
+
+static void
+psppire_dialog_action_split_init (PsppireDialogActionSplit *act)
+{
+}
+
--- /dev/null
+/* PSPPIRE - a graphical user interface for PSPP.
+ Copyright (C) 2015 Free Software Foundation
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+
+#include <glib-object.h>
+#include <glib.h>
+
+#include "psppire-dialog-action.h"
+
+#ifndef __PSPPIRE_DIALOG_ACTION_SPLIT_H__
+#define __PSPPIRE_DIALOG_ACTION_SPLIT_H__
+
+G_BEGIN_DECLS
+
+
+#define PSPPIRE_TYPE_DIALOG_ACTION_SPLIT (psppire_dialog_action_split_get_type ())
+
+#define PSPPIRE_DIALOG_ACTION_SPLIT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ PSPPIRE_TYPE_DIALOG_ACTION_SPLIT, PsppireDialogActionSplit))
+
+#define PSPPIRE_DIALOG_ACTION_SPLIT_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ PSPPIRE_TYPE_DIALOG_ACTION_SPLIT, \
+ PsppireDialogActionSplitClass))
+
+
+#define PSPPIRE_IS_DIALOG_ACTION_SPLIT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_DIALOG_ACTION_SPLIT))
+
+#define PSPPIRE_IS_DIALOG_ACTION_SPLIT_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_TYPE_DIALOG_ACTION_SPLIT))
+
+
+#define PSPPIRE_DIALOG_ACTION_SPLIT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ PSPPIRE_TYPE_DIALOG_ACTION_SPLIT, \
+ PsppireDialogActionSplitClass))
+
+typedef struct _PsppireDialogActionSplit PsppireDialogActionSplit;
+typedef struct _PsppireDialogActionSplitClass PsppireDialogActionSplitClass;
+
+
+struct _PsppireDialogActionSplit
+{
+ PsppireDialogAction parent;
+
+ /*< private >*/
+ /* The treeview widget containing the list of variables
+ upon which the file should be split */
+ GtkWidget *tv;
+
+ GtkWidget *selector;
+
+ GtkWidget *dest ;
+ GtkWidget *source ;
+
+ GtkWidget *sort ;
+ GtkWidget *layered ;
+
+ GtkWidget *off ;
+};
+
+
+struct _PsppireDialogActionSplitClass
+{
+ PsppireDialogActionClass parent_class;
+};
+
+
+GType psppire_dialog_action_split_get_type (void) ;
+
+G_END_DECLS
+
+#endif /* __PSPPIRE_DIALOG_ACTION_SPLIT_H__ */
+++ /dev/null
-/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2007, 2010, 2011, 2012 Free Software Foundation
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include "split-file-dialog.h"
-#include "psppire-selector.h"
-#include "psppire-dialog.h"
-#include "executor.h"
-#include "psppire-data-window.h"
-#include "dict-display.h"
-#include "builder-wrapper.h"
-#include "helper.h"
-
-#include <data/dictionary.h>
-
-#include "psppire-var-view.h"
-
-#include <gtk/gtk.h>
-
-
-#include "dialog-common.h"
-
-
-struct split_file_dialog
-{
- /* The XML that created the dialog */
- GtkBuilder *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 (const struct split_file_dialog *sfd)
-{
- gchar *text;
- GtkWidget *off = get_widget_assert (sfd->xml, "split-radiobutton0");
-
- 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 (sfd->xml, "split-radiobutton3");
- GtkWidget *layered = get_widget_assert (sfd->xml, "split-radiobutton1");
- gint n_vars = psppire_var_view_append_names (PSPPIRE_VAR_VIEW (sfd->tv), 0, varlist);
-
- if ( n_vars > 0 )
- {
- g_string_assign (string, "");
-
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(sort)))
- {
- g_string_append (string, "SORT CASES BY");
- g_string_append (string, varlist->str);
- g_string_append (string, ".\n");
- }
-
- g_string_append (string, "SPLIT FILE ");
-
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (layered)))
- g_string_append (string, "LAYERED ");
- else
- g_string_append (string, "SEPARATE ");
-
- g_string_append (string, "BY ");
- g_string_append (string, varlist->str);
- g_string_append (string, ".");
- }
- g_string_free (varlist, TRUE);
- }
-
- text = string->str;
-
- g_string_free (string, FALSE);
-
- return text;
-};
-
-
-static void
-on_off_toggled (GtkToggleButton *togglebutton,
- gpointer user_data)
-{
- GtkBuilder *xml = user_data;
- GtkWidget *dest = get_widget_assert (xml, "split-file-grouping-vars");
- GtkWidget *selector = get_widget_assert (xml, "split-file-selector");
- GtkWidget *source = get_widget_assert (xml, "split-file-dict-treeview");
- GtkWidget *button3 = get_widget_assert (xml, "split-radiobutton3");
- GtkWidget *button4 = get_widget_assert (xml, "split-radiobutton4");
-
- gboolean state = !gtk_toggle_button_get_active (togglebutton);
-
- gtk_widget_set_sensitive (dest, state);
- gtk_widget_set_sensitive (selector, state);
- gtk_widget_set_sensitive (source, state);
- gtk_widget_set_sensitive (button3, state);
- gtk_widget_set_sensitive (button4, state);
-}
-
-static void
-refresh (PsppireDialog *dialog, struct split_file_dialog *d)
-{
- 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);
-
- 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;
- const struct variable *const *vars = dict_get_split_vars (d->dict->dict);
-
- for (i = 0 ; i < n_vars; ++i )
- {
- gtk_list_store_append (GTK_LIST_STORE (liststore), &iter);
-
- gtk_list_store_set (GTK_LIST_STORE (liststore), &iter,
- 0, vars[i],
- -1);
- }
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(on), TRUE);
- }
-
- gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON(off));
-}
-
-
-
-/* Pops up the Split File dialog box */
-void
-split_file_dialog (PsppireDataWindow *de)
-{
- gint response;
- struct split_file_dialog sfd;
-
- GtkWidget *dialog ;
- GtkWidget *source ;
- GtkWidget *selector ;
- GtkWidget *on_off ;
-
- sfd.xml = builder_new ("split-file.ui");
-
- dialog = get_widget_assert (sfd.xml, "split-file-dialog");
- source = get_widget_assert (sfd.xml, "split-file-dict-treeview");
- selector = get_widget_assert (sfd.xml, "split-file-selector");
- on_off = get_widget_assert (sfd.xml, "split-radiobutton0");
-
- sfd.tv = GTK_TREE_VIEW (get_widget_assert (sfd.xml, "split-file-grouping-vars"));
-
- g_object_get (de->data_editor, "dictionary", &sfd.dict, NULL);
-
- sfd.selector = PSPPIRE_SELECTOR (selector);
-
- g_object_set (source, "model", sfd.dict, NULL);
-
- g_signal_connect (on_off, "toggled", G_CALLBACK(on_off_toggled), sfd.xml);
-
- g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), &sfd);
-
- gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
-
- response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
-
-
- switch (response)
- {
- case GTK_RESPONSE_OK:
- g_free (execute_syntax_string (de, generate_syntax (&sfd)));
- break;
- case PSPPIRE_RESPONSE_PASTE:
- g_free (paste_syntax_to_window (generate_syntax (&sfd)));
- break;
- default:
- break;
- }
-
- g_object_unref (sfd.xml);
-}
-
+++ /dev/null
-/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2007 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-
-#ifndef SPLIT_FILE_DIALOG_H
-#define SPLIT_FILE_DIALOG_H
-
-#include "psppire-data-window.h"
-
-/* Pops up the Split File dialog box */
-void split_file_dialog (PsppireDataWindow * data);
-
-
-#endif
<property name="orientation">vertical</property>
<property name="layout_style">spread</property>
<child>
- <object class="GtkRadioButton" id="split-radiobutton0">
+ <object class="GtkRadioButton" id="split-off">
<property name="label" translatable="yes">Anal_yze all cases. Do not create groups.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="split-radiobutton1">
+ <object class="GtkRadioButton" id="split-layered">
<property name="label" translatable="yes">Compare _groups.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="xalign">0.5</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">split-radiobutton0</property>
+ <property name="group">split-off</property>
</object>
<packing>
<property name="expand">False</property>
<property name="xalign">0.5</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">split-radiobutton0</property>
+ <property name="group">split-off</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
<property name="layout_style">spread</property>
<child>
- <object class="GtkRadioButton" id="split-radiobutton3">
+ <object class="GtkRadioButton" id="split-sort">
<property name="label" translatable="yes">_Sort the file by grouping variables.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="split-radiobutton4">
+ <object class="GtkRadioButton" id="split-dont-sort">
<property name="label" translatable="yes">_File is already sorted.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
- <property name="group">split-radiobutton3</property>
+ <property name="group">split-sort</property>
</object>
<packing>
<property name="expand">False</property>
#include "psppire-dialog-action-runs.h"
#include "psppire-dialog-action-scatterplot.h"
#include "psppire-dialog-action-sort.h"
+#include "psppire-dialog-action-split.h"
#include "psppire-dialog-action-tt1s.h"
#include "psppire-dialog-action-two-sample.h"
#include "psppire-dialog-action-univariate.h"
psppire_dialog_action_runs_get_type ();
psppire_dialog_action_scatterplot_get_type ();
psppire_dialog_action_sort_get_type ();
+ psppire_dialog_action_split_get_type ();
psppire_dialog_action_tt1s_get_type ();
psppire_dialog_action_two_sample_get_type ();
psppire_dialog_action_univariate_get_type ();