src/ui/gui/psppire-dialog-action-examine.h \
src/ui/gui/psppire-dialog-action-factor.c \
src/ui/gui/psppire-dialog-action-factor.h \
+ src/ui/gui/psppire-dialog-action-flip.c \
+ src/ui/gui/psppire-dialog-action-flip.h \
src/ui/gui/psppire-dialog-action-frequencies.c \
src/ui/gui/psppire-dialog-action-frequencies.h \
src/ui/gui/psppire-dialog-action-indep-samps.c \
src/ui/gui/page-sheet-spec.h \
src/ui/gui/text-data-import-dialog.c \
src/ui/gui/text-data-import-dialog.h \
- src/ui/gui/transpose-dialog.c \
- src/ui/gui/transpose-dialog.h \
src/ui/gui/t-test-one-sample.c \
src/ui/gui/t-test-one-sample.h \
src/ui/gui/t-test-options.c \
</object>
</child>
<child>
- <object class="GtkAction" id="data_transpose">
+ <object class="PsppireDialogActionFlip" id="data_transpose">
<property name="stock-id">data-transpose</property>
<property name="name">data_transpose</property>
+ <property name="manager">uimanager1</property>
<property name="label" translatable="yes">_Transpose...</property>
<property name="tooltip" translatable="yes">Transpose the cases with the variables</property>
</object>
#include "ui/gui/t-test-one-sample.h"
#include "ui/gui/t-test-paired-samples.h"
#include "ui/gui/text-data-import-dialog.h"
-#include "ui/gui/transpose-dialog.h"
#include "ui/gui/univariate-dialog.h"
#include "ui/gui/weight-cases-dialog.h"
#include "ui/syntax-gen.h"
g_signal_connect_swapped (get_action_assert (de->builder, "view_value-labels"), "toggled", G_CALLBACK (toggle_value_labels), de);
- connect_action (de, "data_transpose", G_CALLBACK (transpose_dialog));
connect_action (de, "data_select-cases", G_CALLBACK (select_cases_dialog));
connect_action (de, "data_aggregate", G_CALLBACK (aggregate_dialog));
connect_action (de, "transform_compute", G_CALLBACK (compute_dialog));
--- /dev/null
+/* PSPPIRE - a graphical user interface for PSPP.
+ Copyright (C) 2013 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-flip.h"
+
+#include "psppire-var-view.h"
+
+#include "psppire-dialog.h"
+#include "builder-wrapper.h"
+
+static void psppire_dialog_action_flip_init (PsppireDialogActionFlip *act);
+static void psppire_dialog_action_flip_class_init (PsppireDialogActionFlipClass *class);
+
+G_DEFINE_TYPE (PsppireDialogActionFlip, psppire_dialog_action_flip, PSPPIRE_TYPE_DIALOG_ACTION);
+
+
+/*
+ FLIP /VARIABLES=var_list /NEWNAMES=var_name.
+*/
+static char *
+generate_syntax (PsppireDialogAction *act)
+{
+ const gchar *text;
+ PsppireDialogActionFlip *rd = PSPPIRE_DIALOG_ACTION_FLIP (act);
+
+ GString *string = g_string_new ("FLIP");
+ gchar *syntax ;
+
+ g_string_append (string, " /VARIABLES = ");
+
+ psppire_var_view_append_names (PSPPIRE_VAR_VIEW (rd->dest), 0, string);
+
+ text = gtk_entry_get_text (GTK_ENTRY (rd->entry));
+
+ if ( text)
+ g_string_append_printf (string, " /NEWNAME = %s", text);
+
+ g_string_append (string, ".\n");
+
+ syntax = string->str;
+
+ g_string_free (string, FALSE);
+
+ return syntax;
+}
+
+
+static gboolean
+dialog_state_valid (gpointer a)
+{
+ PsppireDialogActionFlip *act = PSPPIRE_DIALOG_ACTION_FLIP (a);
+
+ GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (act->dest));
+
+ gint n_rows = gtk_tree_model_iter_n_children (model, NULL);
+
+ if ( n_rows == 0 )
+ return FALSE;
+
+ if ( 0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (act->entry))))
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+refresh (PsppireDialogAction *rd_)
+{
+ PsppireDialogActionFlip *rd = PSPPIRE_DIALOG_ACTION_FLIP (rd_);
+ GtkTreeModel *dmodel = gtk_tree_view_get_model (GTK_TREE_VIEW (rd->dest));
+
+ gtk_list_store_clear (GTK_LIST_STORE (dmodel));
+ gtk_entry_set_text (GTK_ENTRY (rd->entry), "");
+}
+
+static void
+psppire_dialog_action_flip_activate (GtkAction *a)
+{
+ PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
+ PsppireDialogActionFlip *act = PSPPIRE_DIALOG_ACTION_FLIP (a);
+
+ GtkBuilder *xml = builder_new ("psppire.ui");
+ pda->dialog = get_widget_assert (xml, "transpose-dialog");
+ pda->source = get_widget_assert (xml, "source-treeview");
+
+ act->dest = get_widget_assert (xml, "variables-treeview");
+ act->entry = get_widget_assert (xml, "new-name-entry");
+
+ psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid);
+ psppire_dialog_action_set_refresh (pda, refresh);
+
+ g_object_unref (xml);
+
+ if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_flip_parent_class)->activate)
+ PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_flip_parent_class)->activate (pda);
+}
+
+static void
+psppire_dialog_action_flip_class_init (PsppireDialogActionFlipClass *class)
+{
+ GtkActionClass *action_class = GTK_ACTION_CLASS (class);
+
+ action_class->activate = psppire_dialog_action_flip_activate;
+ PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
+}
+
+
+static void
+psppire_dialog_action_flip_init (PsppireDialogActionFlip *act)
+{
+}
+
--- /dev/null
+/* PSPPIRE - a graphical user interface for PSPP.
+ Copyright (C) 2013 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_FLIP_H__
+#define __PSPPIRE_DIALOG_ACTION_FLIP_H__
+
+G_BEGIN_DECLS
+
+
+#define PSPPIRE_TYPE_DIALOG_ACTION_FLIP (psppire_dialog_action_flip_get_type ())
+
+#define PSPPIRE_DIALOG_ACTION_FLIP(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ PSPPIRE_TYPE_DIALOG_ACTION_FLIP, PsppireDialogActionFlip))
+
+#define PSPPIRE_DIALOG_ACTION_FLIP_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ PSPPIRE_TYPE_DIALOG_ACTION_FLIP, \
+ PsppireDialogActionFlipClass))
+
+
+#define PSPPIRE_IS_DIALOG_ACTION_FLIP(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_DIALOG_ACTION_FLIP))
+
+#define PSPPIRE_IS_DIALOG_ACTION_FLIP_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_TYPE_DIALOG_ACTION_FLIP))
+
+
+#define PSPPIRE_DIALOG_ACTION_FLIP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ PSPPIRE_TYPE_DIALOG_ACTION_FLIP, \
+ PsppireDialogActionFlipClass))
+
+typedef struct _PsppireDialogActionFlip PsppireDialogActionFlip;
+typedef struct _PsppireDialogActionFlipClass PsppireDialogActionFlipClass;
+
+
+struct _PsppireDialogActionFlip
+{
+ PsppireDialogAction parent;
+
+ /*< private >*/
+ gboolean dispose_has_run ;
+
+ GtkWidget *dest;
+ GtkWidget *entry;
+};
+
+
+struct _PsppireDialogActionFlipClass
+{
+ PsppireDialogActionClass parent_class;
+};
+
+
+GType psppire_dialog_action_flip_get_type (void) ;
+
+G_END_DECLS
+
+#endif /* __PSPPIRE_DIALOG_ACTION_FLIP_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 "transpose-dialog.h"
-#include "psppire-selector.h"
-#include "psppire-var-view.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 "dialog-common.h"
-
-#include <gtk/gtk.h>
-
-#include <gettext.h>
-
-#define _(msgid) gettext (msgid)
-#define N_(msgid) msgid
-
-
-static gchar * generate_syntax (PsppireDict *dict, GtkBuilder *xml);
-
-static void
-refresh (PsppireDialog *dialog, gpointer data)
-{
- GtkBuilder *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 (GTK_TREE_VIEW (dest));
-
- gtk_list_store_clear (GTK_LIST_STORE (dmodel));
- gtk_entry_set_text (GTK_ENTRY (entry), "");
-}
-
-static gboolean
-dialog_state_valid (gpointer data)
-{
- GtkBuilder *xml = data;
-
- GtkWidget *tv = get_widget_assert (xml, "variables-treeview");
- GtkWidget *entry = get_widget_assert (xml, "new-name-entry");
-
- GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (tv));
-
- gint n_rows = gtk_tree_model_iter_n_children (model, NULL);
-
- if ( n_rows == 0 )
- return FALSE;
-
- if ( 0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (entry))))
- return FALSE;
-
- return TRUE;
-}
-
-
-void
-transpose_dialog (PsppireDataWindow *de)
-{
- gint response ;
- PsppireDict *dict = NULL;
-
- GtkBuilder *xml = builder_new ("psppire.ui");
-
- GtkWidget *dialog = get_widget_assert (xml, "transpose-dialog");
- GtkWidget *source = get_widget_assert (xml, "source-treeview");
- GtkWidget *selector2 = get_widget_assert (xml, "psppire-selector3");
-
- g_object_get (de->data_editor, "dictionary", &dict, NULL);
- g_object_set (source, "model", dict, NULL);
-
- psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector2),
- is_currently_in_entry);
-
-
- g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), xml);
-
- gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
-
- psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog),
- dialog_state_valid, xml);
-
- response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
-
- switch (response)
- {
- case GTK_RESPONSE_OK:
- g_free (execute_syntax_string (de, generate_syntax (dict, xml)));
- break;
- case PSPPIRE_RESPONSE_PASTE:
- {
- gchar *syntax = generate_syntax (dict, xml);
- paste_syntax_to_window (syntax);
-
- g_free (syntax);
- }
- break;
- default:
- break;
- }
-
- g_object_unref (xml);
-}
-
-
- /*
- FLIP /VARIABLES=var_list /NEWNAMES=var_name.
- */
-static gchar *
-generate_syntax (PsppireDict *dict, GtkBuilder *xml)
-{
- const gchar *text;
- GString *string = g_string_new ("FLIP");
- gchar *syntax ;
-
- GtkWidget *dest = get_widget_assert (xml, "variables-treeview");
- GtkWidget *entry = get_widget_assert (xml, "new-name-entry");
-
- g_string_append (string, " /VARIABLES = ");
-
- psppire_var_view_append_names (PSPPIRE_VAR_VIEW (dest), 0, string);
-
- text = gtk_entry_get_text (GTK_ENTRY (entry));
-
- if ( text)
- g_string_append_printf (string, " /NEWNAME = %s", text);
-
- g_string_append (string, ".");
-
- syntax = string->str;
-
- g_string_free (string, FALSE);
-
- return syntax;
-}
+++ /dev/null
-/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2007 Free Software Foundation
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-
-#ifndef TRANSPOSE_DIALOG_H
-#define TRANSPOSE_DIALOG_H
-
-#include "psppire-data-window.h"
-
-void transpose_dialog (PsppireDataWindow * data);
-
-
-#endif
#include "psppire-dialog-action-crosstabs.h"
#include "psppire-dialog-action-descriptives.h"
#include "psppire-dialog-action-examine.h"
+#include "psppire-dialog-action-flip.h"
#include "psppire-dialog-action-factor.h"
#include "psppire-dialog-action-frequencies.h"
#include "psppire-dialog-action-indep-samps.h"
psppire_dialog_action_descriptives_get_type ();
psppire_dialog_action_examine_get_type ();
psppire_dialog_action_factor_get_type ();
+ psppire_dialog_action_flip_get_type ();
psppire_dialog_action_frequencies_get_type ();
psppire_dialog_action_logistic_get_type ();
psppire_dialog_action_kmeans_get_type ();