src/ui/gui/psppire-dialog-action-kmeans.h \
src/ui/gui/psppire-dialog-action-means.c \
src/ui/gui/psppire-dialog-action-means.h \
+ src/ui/gui/psppire-dialog-action-rank.c \
+ src/ui/gui/psppire-dialog-action-rank.h \
src/ui/gui/psppire-dialog-action-reliability.c \
src/ui/gui/psppire-dialog-action-reliability.h \
src/ui/gui/psppire-dialog-action-sort.c \
src/ui/gui/psppire-window-base.h \
src/ui/gui/psppire-window-register.c \
src/ui/gui/psppire-window-register.h \
- src/ui/gui/rank-dialog.c \
- src/ui/gui/rank-dialog.h \
src/ui/gui/recode-dialog.c \
src/ui/gui/recode-dialog.h \
src/ui/gui/regression-dialog.c \
</object>
</child>
<child>
- <object class="GtkAction" id="transform_rank">
+ <object class="PsppireDialogActionRank" id="transform_rank">
<property name="name">transform_rank</property>
+ <property name="manager">uimanager1</property>
<property name="label" translatable="yes">Ran_k Cases...</property>
</object>
</child>
#include "ui/gui/psppire-syntax-window.h"
#include "ui/gui/psppire-window.h"
#include "ui/gui/psppire.h"
-#include "ui/gui/rank-dialog.h"
#include "ui/gui/runs-dialog.h"
#include "ui/gui/ks-one-sample-dialog.h"
#include "ui/gui/recode-dialog.h"
connect_action (de, "utilities_comments", G_CALLBACK (comments_dialog));
- connect_action (de, "transform_rank", G_CALLBACK (rank_dialog));
-
connect_action (de, "transform_count", G_CALLBACK (count_dialog));
connect_action (de, "transform_recode-same", G_CALLBACK (recode_same_dialog));
--- /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 "psppire-dialog-action-rank.h"
+
+#include "psppire-var-view.h"
+#include "dialog-common.h"
+#include "psppire-selector.h"
+#include "psppire-dict.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_rank_class_init (PsppireDialogActionRankClass *class);
+
+G_DEFINE_TYPE (PsppireDialogActionRank, psppire_dialog_action_rank, PSPPIRE_TYPE_DIALOG_ACTION);
+
+
+static char *
+generate_syntax (PsppireDialogAction *act)
+{
+ PsppireDialogActionRank *rd = PSPPIRE_DIALOG_ACTION_RANK (act);
+
+ gchar *text = NULL;
+ GtkTreeModel *gs = gtk_tree_view_get_model (GTK_TREE_VIEW (rd->group_vars));
+
+ GtkTreeIter notused;
+
+ GString *str = g_string_new ("RANK VARIABLES=");
+
+ psppire_var_view_append_names (PSPPIRE_VAR_VIEW (rd->rank_vars), 0, str);
+
+ g_string_append_printf (str, " (%c)",
+ gtk_toggle_button_get_active (rd->ascending_togglebutton)
+ ?'A':'D');
+
+ if ( gtk_tree_model_get_iter_first (gs, ¬used) )
+ {
+ g_string_append (str, "\n\tBY ");
+
+ psppire_var_view_append_names (PSPPIRE_VAR_VIEW (rd->group_vars), 0, str);
+ }
+
+ g_string_append (str, "\n\t/PRINT = ");
+ if (gtk_toggle_button_get_active (rd->summary_togglebutton))
+ g_string_append (str, "YES");
+ else
+ g_string_append (str, "NO");
+
+
+ if (gtk_toggle_button_get_active (rd->func_button [RANK]))
+ g_string_append (str, "\n\t/RANK");
+ if (gtk_toggle_button_get_active (rd->func_button [NORMAL]))
+ g_string_append (str, "\n\t/NORMAL");
+ if (gtk_toggle_button_get_active (rd->func_button [PROPORTION]))
+ g_string_append (str, "\n\t/PROPORTION");
+ if (gtk_toggle_button_get_active (rd->func_button [PERCENT]))
+ g_string_append (str, "\n\t/PERCENT");
+ if (gtk_toggle_button_get_active (rd->func_button [RFRACTION]))
+ g_string_append (str, "\n\t/RFRACTION");
+ if (gtk_toggle_button_get_active (rd->func_button [N]))
+ g_string_append (str, "\n\t/N");
+ if (gtk_toggle_button_get_active (rd->func_button [SAVAGE]))
+ g_string_append (str, "\n\t/SAVAGE");
+ if (gtk_toggle_button_get_active (rd->func_button [NTILES]))
+ {
+ gint n = gtk_spin_button_get_value (GTK_SPIN_BUTTON (rd->ntiles_entry));
+ g_string_append_printf (str, "\n\t/NTILES(%d)", n);
+ }
+
+
+ if (gtk_toggle_button_get_active (rd->func_button [NORMAL])
+ ||
+ gtk_toggle_button_get_active (rd->func_button [PROPORTION]))
+ {
+ g_string_append (str, "\n\t/FRACTION=");
+
+ if ( gtk_toggle_button_get_active (rd->blom))
+ g_string_append (str, "BLOM");
+ else if ( gtk_toggle_button_get_active (rd->tukey))
+ g_string_append (str, "TUKEY");
+ else if ( gtk_toggle_button_get_active (rd->rankit))
+ g_string_append (str, "RANKIT");
+ else if ( gtk_toggle_button_get_active (rd->vw))
+ g_string_append (str, "VW");
+ }
+
+ g_string_append (str, "\n\t/TIES=");
+ if ( gtk_toggle_button_get_active (rd->mean))
+ g_string_append (str, "MEAN");
+ else if ( gtk_toggle_button_get_active (rd->low))
+ g_string_append (str, "LOW");
+ else if ( gtk_toggle_button_get_active (rd->high))
+ g_string_append (str, "HIGH");
+ else if ( gtk_toggle_button_get_active (rd->condense))
+ g_string_append (str, "CONDENSE");
+
+
+ g_string_append (str, ".");
+ text = str->str;
+
+ g_string_free (str, FALSE);
+
+ return text;
+}
+
+static gboolean
+dialog_state_valid (PsppireDialogAction *da)
+{
+ PsppireDialogActionRank *dar = PSPPIRE_DIALOG_ACTION_RANK (da);
+ GtkTreeIter notused;
+ GtkTreeModel *vars = gtk_tree_view_get_model (GTK_TREE_VIEW (dar->rank_vars));
+
+ return gtk_tree_model_get_iter_first (vars, ¬used);
+}
+
+static void
+dialog_refresh (PsppireDialogAction *act)
+{
+ PsppireDialogActionRank *dar = PSPPIRE_DIALOG_ACTION_RANK (act);
+
+ GtkTreeModel *liststore;
+
+ liststore = gtk_tree_view_get_model (GTK_TREE_VIEW (dar->rank_vars));
+ gtk_list_store_clear (GTK_LIST_STORE (liststore));
+
+ liststore = gtk_tree_view_get_model (GTK_TREE_VIEW (dar->group_vars));
+ gtk_list_store_clear (GTK_LIST_STORE (liststore));
+
+ gtk_toggle_button_set_active (dar->ascending_togglebutton, TRUE);
+ gtk_toggle_button_set_active (dar->summary_togglebutton, FALSE);
+}
+
+static void
+types_dialog_reset (PsppireDialogActionRank *rd)
+{
+ gint i;
+
+ for (i = 0 ; i < n_RANK_FUNCS ; ++i )
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->func_button [i]),
+ FALSE);
+
+ gtk_widget_set_sensitive (rd->ntiles_entry, FALSE);
+
+ gtk_widget_set_sensitive (rd->formula_box, FALSE);
+}
+
+static void
+run_types_dialog (GtkButton *b, PsppireDialogActionRank *dar)
+{
+ PsppireDialogAction *act = PSPPIRE_DIALOG_ACTION (dar);
+
+ gint response;
+
+ gtk_window_set_transient_for (GTK_WINDOW (dar->types_dialog),
+ GTK_WINDOW (act->dialog));
+
+ types_dialog_reset (dar);
+
+ response = psppire_dialog_run (PSPPIRE_DIALOG (dar->types_dialog));
+}
+
+static void
+run_ties_dialog (GtkButton *b, PsppireDialogActionRank *dar)
+{
+ PsppireDialogAction *act = PSPPIRE_DIALOG_ACTION (dar);
+
+ gint response;
+
+ gtk_window_set_transient_for (GTK_WINDOW (dar->ties_dialog),
+ GTK_WINDOW (act->dialog));
+
+ response = psppire_dialog_run (PSPPIRE_DIALOG (dar->ties_dialog));
+}
+
+static void
+on_ntiles_toggle (GtkToggleButton *toggle_button, PsppireDialogActionRank *dar)
+{
+ gboolean active = gtk_toggle_button_get_active (toggle_button);
+ gtk_widget_set_sensitive (GTK_WIDGET (dar), active);
+}
+
+static void
+set_sensitivity (PsppireDialogActionRank *dar)
+{
+ gboolean sens = gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON (dar->func_button[PROPORTION]))
+ ||
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dar->func_button[NORMAL]));
+
+ gtk_widget_set_sensitive (dar->formula_box, sens);
+}
+
+static void
+psppire_dialog_action_rank_activate (GtkAction *a)
+{
+ PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
+ PsppireDialogActionRank *act = PSPPIRE_DIALOG_ACTION_RANK (a);
+
+ GtkBuilder *xml = builder_new ("rank.ui");
+
+ GtkWidget *types_button = get_widget_assert (xml, "button1");
+ GtkWidget *ties_button = get_widget_assert (xml, "button2");
+
+ pda->dialog = get_widget_assert (xml, "rank-dialog");
+ pda->source = get_widget_assert (xml, "dict-treeview");
+ act->rank_vars = get_widget_assert (xml, "variables-treeview");
+ act->group_vars = get_widget_assert (xml, "group-vars-treeview");
+ act->ascending_togglebutton =
+ GTK_TOGGLE_BUTTON (get_widget_assert (xml, "radiobutton1"));
+
+ act->summary_togglebutton =
+ GTK_TOGGLE_BUTTON (get_widget_assert (xml, "summary-checkbutton"));
+
+ act->types_dialog = get_widget_assert (xml, "rank-types-dialog");
+
+
+ act->ntiles_entry = get_widget_assert (xml, "ntiles-entry");
+
+ act->func_button[RANK] =
+ GTK_TOGGLE_BUTTON (get_widget_assert (xml, "rank-checkbutton"));
+
+ act->func_button[SAVAGE] =
+ GTK_TOGGLE_BUTTON (get_widget_assert (xml, "savage-checkbutton"));
+
+ act->func_button[RFRACTION] =
+ GTK_TOGGLE_BUTTON (get_widget_assert (xml, "rfrac-checkbutton"));
+
+ act->func_button[PERCENT] =
+ GTK_TOGGLE_BUTTON (get_widget_assert (xml, "percent-checkbutton"));
+
+ act->func_button[N] =
+ GTK_TOGGLE_BUTTON (get_widget_assert (xml, "sum-checkbutton"));
+
+ act->func_button[NTILES] =
+ GTK_TOGGLE_BUTTON (get_widget_assert (xml, "ntiles-checkbutton"));
+
+ act->func_button[PROPORTION] =
+ GTK_TOGGLE_BUTTON (get_widget_assert (xml, "prop-checkbutton"));
+
+ act->func_button[NORMAL] =
+ GTK_TOGGLE_BUTTON (get_widget_assert (xml, "normal-checkbutton"));
+
+ act->formula_box = get_widget_assert (xml, "formula-frame");
+
+ act->blom = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "blom-button"));
+ act->tukey = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "tukey-button"));
+ act->rankit = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "rankit-button"));
+ act->vw = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "vw-button"));
+
+ /* Ties dialog */
+ act->ties_dialog = PSPPIRE_DIALOG (get_widget_assert (xml, "ties-dialog"));
+
+ act->mean = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "mean-button"));
+ act->low = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "low-button"));
+ act->high = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "high-button"));
+ act->condense = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "condense-button"));
+
+ g_signal_connect_swapped (act->func_button[PROPORTION], "toggled",
+ G_CALLBACK (set_sensitivity),
+ act);
+
+ g_signal_connect_swapped (act->func_button[NORMAL], "toggled",
+ G_CALLBACK (set_sensitivity),
+ act);
+
+ g_signal_connect (types_button, "clicked",
+ G_CALLBACK (run_types_dialog), act);
+
+ g_signal_connect (ties_button, "clicked",
+ G_CALLBACK (run_ties_dialog), act);
+
+ g_signal_connect (act->func_button[NTILES], "toggled",
+ G_CALLBACK (on_ntiles_toggle),
+ act->ntiles_entry);
+
+ psppire_dialog_action_set_valid_predicate (pda, (void *) dialog_state_valid);
+ psppire_dialog_action_set_refresh (pda, dialog_refresh);
+
+ PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_rank_parent_class)->activate (pda);
+
+ g_object_unref (xml);
+}
+
+static void
+psppire_dialog_action_rank_class_init (PsppireDialogActionRankClass *class)
+{
+ GTK_ACTION_CLASS (class)->activate = psppire_dialog_action_rank_activate;
+
+ PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
+}
+
+static void
+psppire_dialog_action_rank_init (PsppireDialogActionRank *act)
+{
+}
--- /dev/null
+/* PSPPIRE - a graphical user interface for PSPP.
+ Copyright (C) 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/>. */
+
+
+#ifndef __PSPPIRE_DIALOG_ACTION_RANK_H__
+#define __PSPPIRE_DIALOG_ACTION_RANK_H__
+
+#include <glib-object.h>
+#include <glib.h>
+
+#include "psppire-dialog-action.h"
+
+G_BEGIN_DECLS
+
+
+#define PSPPIRE_TYPE_DIALOG_ACTION_RANK (psppire_dialog_action_rank_get_type ())
+
+#define PSPPIRE_DIALOG_ACTION_RANK(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ PSPPIRE_TYPE_DIALOG_ACTION_RANK, PsppireDialogActionRank))
+
+#define PSPPIRE_DIALOG_ACTION_RANK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ PSPPIRE_TYPE_DIALOG_ACTION_RANK, \
+ PsppireDialogActionRankClass))
+
+
+#define PSPPIRE_IS_DIALOG_ACTION_RANK(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_DIALOG_ACTION_RANK))
+
+#define PSPPIRE_IS_DIALOG_ACTION_RANK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_TYPE_DIALOG_ACTION_RANK))
+
+
+#define PSPPIRE_DIALOG_ACTION_RANK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ PSPPIRE_TYPE_DIALOG_ACTION_RANK, \
+ PsppireDialogActionRankClass))
+
+typedef struct _PsppireDialogActionRank PsppireDialogActionRank;
+typedef struct _PsppireDialogActionRankClass PsppireDialogActionRankClass;
+
+
+enum RANK_FUNC
+ {
+ RANK,
+ NORMAL,
+ PERCENT,
+ RFRACTION,
+ PROPORTION,
+ N,
+ NTILES,
+ SAVAGE,
+ n_RANK_FUNCS
+ };
+
+struct _PsppireDialogActionRank
+{
+ PsppireDialogAction parent;
+
+ /*< private >*/
+ GtkWidget *rank_vars;
+ GtkWidget *group_vars;
+
+ GtkToggleButton *ascending_togglebutton;
+ GtkToggleButton *summary_togglebutton;
+
+
+ /* Types subdialog widgets */
+
+ GtkWidget *types_dialog;
+ GtkWidget *ntiles_entry;
+
+ GtkToggleButton *func_button[n_RANK_FUNCS];
+ GtkWidget *formula_box;
+
+ GtkToggleButton *blom;
+ GtkToggleButton *tukey;
+ GtkToggleButton *rankit;
+ GtkToggleButton *vw;
+
+ /* Ties subdialog widgets */
+
+ PsppireDialog *ties_dialog;
+ GtkToggleButton *mean;
+ GtkToggleButton *low;
+ GtkToggleButton *high;
+ GtkToggleButton *condense;
+};
+
+
+struct _PsppireDialogActionRankClass
+{
+ PsppireDialogActionClass parent_class;
+};
+
+
+GType psppire_dialog_action_rank_get_type (void) ;
+
+G_END_DECLS
+
+#endif /* __PSPPIRE_DIALOG_ACTION_RANK_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 "rank-dialog.h"
-
-#include <gtk/gtk.h>
-#include <stdlib.h>
-
-#include <ui/gui/psppire-data-window.h>
-#include <ui/gui/dialog-common.h>
-#include <ui/gui/dict-display.h>
-#include <ui/gui/builder-wrapper.h>
-#include <ui/gui/psppire-dialog.h>
-#include <ui/gui/psppire-var-store.h>
-#include <ui/gui/psppire-var-view.h>
-#include "executor.h"
-#include "helper.h"
-
-#include "gettext.h"
-#define _(msgid) gettext (msgid)
-#define N_(msgid) msgid
-
-
-enum RANK_FUNC
- {
- RANK,
- NORMAL,
- PERCENT,
- RFRACTION,
- PROPORTION,
- N,
- NTILES,
- SAVAGE,
- n_RANK_FUNCS
- };
-
-
-
-
-struct rank_dialog
-{
- PsppireDict *dict;
- GtkWidget *rank_vars;
- GtkWidget *group_vars;
- GtkWidget *dialog;
-
- GtkToggleButton *ascending_togglebutton;
- GtkToggleButton *summary_togglebutton;
-
-
- /* Types subdialog widgets */
-
- GtkWidget *types_dialog;
- GtkWidget *ntiles_entry;
-
- GtkToggleButton *func_button[n_RANK_FUNCS];
- GtkWidget *formula_box;
-
- GtkToggleButton *blom;
- GtkToggleButton *tukey;
- GtkToggleButton *rankit;
- GtkToggleButton *vw;
-
- /* Ties subdialog widgets */
-
- PsppireDialog *ties_dialog;
- GtkToggleButton *mean;
- GtkToggleButton *low;
- GtkToggleButton *high;
- GtkToggleButton *condense;
-};
-
-static void
-refresh (PsppireDialog *dialog, struct rank_dialog *rd)
-{
- GtkTreeModel *liststore;
-
- liststore = gtk_tree_view_get_model (GTK_TREE_VIEW (rd->rank_vars));
- gtk_list_store_clear (GTK_LIST_STORE (liststore));
-
- liststore = gtk_tree_view_get_model (GTK_TREE_VIEW (rd->group_vars));
- gtk_list_store_clear (GTK_LIST_STORE (liststore));
-
- gtk_toggle_button_set_active (rd->ascending_togglebutton, TRUE);
- gtk_toggle_button_set_active (rd->summary_togglebutton, FALSE);
-}
-
-static char *
-generate_syntax (const struct rank_dialog *rd)
-{
- gchar *text;
-
- GtkTreeModel *gs = gtk_tree_view_get_model (GTK_TREE_VIEW (rd->group_vars));
-
- GtkTreeIter notused;
-
- GString *str = g_string_new ("RANK VARIABLES=");
-
- psppire_var_view_append_names (PSPPIRE_VAR_VIEW (rd->rank_vars), 0, str);
-
- g_string_append_printf (str, " (%c)",
- gtk_toggle_button_get_active (rd->ascending_togglebutton)
- ?'A':'D');
-
- if ( gtk_tree_model_get_iter_first (gs, ¬used) )
- {
- g_string_append (str, "\n\tBY ");
-
- psppire_var_view_append_names (PSPPIRE_VAR_VIEW (rd->group_vars), 0, str);
- }
-
- g_string_append (str, "\n\t/PRINT = ");
- if (gtk_toggle_button_get_active (rd->summary_togglebutton))
- g_string_append (str, "YES");
- else
- g_string_append (str, "NO");
-
-
- if (gtk_toggle_button_get_active (rd->func_button [RANK]))
- g_string_append (str, "\n\t/RANK");
- if (gtk_toggle_button_get_active (rd->func_button [NORMAL]))
- g_string_append (str, "\n\t/NORMAL");
- if (gtk_toggle_button_get_active (rd->func_button [PROPORTION]))
- g_string_append (str, "\n\t/PROPORTION");
- if (gtk_toggle_button_get_active (rd->func_button [PERCENT]))
- g_string_append (str, "\n\t/PERCENT");
- if (gtk_toggle_button_get_active (rd->func_button [RFRACTION]))
- g_string_append (str, "\n\t/RFRACTION");
- if (gtk_toggle_button_get_active (rd->func_button [N]))
- g_string_append (str, "\n\t/N");
- if (gtk_toggle_button_get_active (rd->func_button [SAVAGE]))
- g_string_append (str, "\n\t/SAVAGE");
- if (gtk_toggle_button_get_active (rd->func_button [NTILES]))
- {
- gint n = gtk_spin_button_get_value (GTK_SPIN_BUTTON (rd->ntiles_entry));
- g_string_append_printf (str, "\n\t/NTILES(%d)", n);
- }
-
-
- if (gtk_toggle_button_get_active (rd->func_button [NORMAL])
- ||
- gtk_toggle_button_get_active (rd->func_button [PROPORTION]))
- {
- g_string_append (str, "\n\t/FRACTION=");
-
- if ( gtk_toggle_button_get_active (rd->blom))
- g_string_append (str, "BLOM");
- else if ( gtk_toggle_button_get_active (rd->tukey))
- g_string_append (str, "TUKEY");
- else if ( gtk_toggle_button_get_active (rd->rankit))
- g_string_append (str, "RANKIT");
- else if ( gtk_toggle_button_get_active (rd->vw))
- g_string_append (str, "VW");
- }
-
- g_string_append (str, "\n\t/TIES=");
- if ( gtk_toggle_button_get_active (rd->mean))
- g_string_append (str, "MEAN");
- else if ( gtk_toggle_button_get_active (rd->low))
- g_string_append (str, "LOW");
- else if ( gtk_toggle_button_get_active (rd->high))
- g_string_append (str, "HIGH");
- else if ( gtk_toggle_button_get_active (rd->condense))
- g_string_append (str, "CONDENSE");
-
-
- g_string_append (str, ".");
-
- text = str->str;
-
- g_string_free (str, FALSE);
-
- return text;
-}
-
-/* Dialog is valid iff at least one variable has been selected */
-static gboolean
-dialog_state_valid (gpointer data)
-{
- struct rank_dialog *rd = data;
-
- GtkTreeModel *vars = gtk_tree_view_get_model (GTK_TREE_VIEW (rd->rank_vars));
-
- GtkTreeIter notused;
-
- return gtk_tree_model_get_iter_first (vars, ¬used);
-}
-
-static void on_ntiles_toggle (GtkToggleButton *, gpointer);
-static void run_types_dialog (GtkButton *, gpointer);
-static void run_ties_dialog (GtkButton *, gpointer );
-
-static void
-set_sensitivity (struct rank_dialog *rd)
-{
- gboolean sens = gtk_toggle_button_get_active
- (GTK_TOGGLE_BUTTON (rd->func_button[PROPORTION]))
- ||
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->func_button[NORMAL]));
-
- gtk_widget_set_sensitive (rd->formula_box, sens);
-}
-
-/* Pops up the Rank dialog box */
-void
-rank_dialog (PsppireDataWindow *de)
-{
- gint response;
-
- struct rank_dialog rd;
-
- GtkBuilder * builder = builder_new ("rank.ui");
-
- GtkWidget *vars = get_widget_assert (builder, "dict-treeview");
-
- GtkWidget *types_button = get_widget_assert (builder, "button1");
- GtkWidget *ties_button = get_widget_assert (builder, "button2");
-
- PsppireVarStore *vs = NULL;
-
- g_object_get (de->data_editor, "var-store", &vs, NULL);
-
- g_object_get (vs, "dictionary", &rd.dict, NULL);
- rd.rank_vars = get_widget_assert (builder, "variables-treeview");
- rd.group_vars = get_widget_assert (builder, "group-vars-treeview");
- rd.dialog = get_widget_assert (builder, "rank-dialog");
- rd.ascending_togglebutton =
- GTK_TOGGLE_BUTTON (get_widget_assert (builder, "radiobutton1"));
-
- rd.summary_togglebutton =
- GTK_TOGGLE_BUTTON (get_widget_assert (builder, "summary-checkbutton"));
-
- rd.types_dialog = get_widget_assert (builder, "rank-types-dialog");
-
-
- rd.ntiles_entry = get_widget_assert (builder, "ntiles-entry");
-
- rd.func_button[RANK] =
- GTK_TOGGLE_BUTTON (get_widget_assert (builder, "rank-checkbutton"));
-
- rd.func_button[SAVAGE] =
- GTK_TOGGLE_BUTTON (get_widget_assert (builder, "savage-checkbutton"));
-
- rd.func_button[RFRACTION] =
- GTK_TOGGLE_BUTTON (get_widget_assert (builder, "rfrac-checkbutton"));
-
- rd.func_button[PERCENT] =
- GTK_TOGGLE_BUTTON (get_widget_assert (builder, "percent-checkbutton"));
-
- rd.func_button[N] =
- GTK_TOGGLE_BUTTON (get_widget_assert (builder, "sum-checkbutton"));
-
- rd.func_button[NTILES] =
- GTK_TOGGLE_BUTTON (get_widget_assert (builder, "ntiles-checkbutton"));
-
- rd.func_button[PROPORTION] =
- GTK_TOGGLE_BUTTON (get_widget_assert (builder, "prop-checkbutton"));
-
- rd.func_button[NORMAL] =
- GTK_TOGGLE_BUTTON (get_widget_assert (builder, "normal-checkbutton"));
-
- rd.formula_box = get_widget_assert (builder, "formula-frame");
-
- rd.blom = GTK_TOGGLE_BUTTON (get_widget_assert (builder, "blom-button"));
- rd.tukey = GTK_TOGGLE_BUTTON (get_widget_assert (builder, "tukey-button"));
- rd.rankit = GTK_TOGGLE_BUTTON (get_widget_assert (builder, "rankit-button"));
- rd.vw = GTK_TOGGLE_BUTTON (get_widget_assert (builder, "vw-button"));
-
- /* Ties dialog */
- rd.ties_dialog = PSPPIRE_DIALOG (get_widget_assert (builder, "ties-dialog"));
-
- rd.mean = GTK_TOGGLE_BUTTON (get_widget_assert (builder, "mean-button"));
- rd.low = GTK_TOGGLE_BUTTON (get_widget_assert (builder, "low-button"));
- rd.high = GTK_TOGGLE_BUTTON (get_widget_assert (builder, "high-button"));
- rd.condense = GTK_TOGGLE_BUTTON (get_widget_assert (builder, "condense-button"));
-
- g_signal_connect_swapped (rd.func_button[PROPORTION], "toggled",
- G_CALLBACK (set_sensitivity),
- &rd);
-
- g_signal_connect_swapped (rd.func_button[NORMAL], "toggled",
- G_CALLBACK (set_sensitivity),
- &rd);
-
- g_signal_connect (rd.func_button[NTILES], "toggled",
- G_CALLBACK (on_ntiles_toggle),
- rd.ntiles_entry);
-
- gtk_window_set_transient_for (GTK_WINDOW (rd.dialog), GTK_WINDOW (de));
-
- g_object_set (vars, "model", rd.dict, NULL);
-
- g_signal_connect (types_button, "clicked",
- G_CALLBACK (run_types_dialog), &rd);
-
- g_signal_connect (ties_button, "clicked",
- G_CALLBACK (run_ties_dialog), &rd);
-
- g_signal_connect (rd.dialog, "refresh", G_CALLBACK (refresh), &rd);
-
- psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (rd.dialog),
- dialog_state_valid, &rd);
-
- response = psppire_dialog_run (PSPPIRE_DIALOG (rd.dialog));
-
-
- switch (response)
- {
- case GTK_RESPONSE_OK:
- g_free (execute_syntax_string (de, generate_syntax (&rd)));
- break;
- case PSPPIRE_RESPONSE_PASTE:
- g_free (paste_syntax_to_window (generate_syntax (&rd)));
- break;
- default:
- break;
- }
-
- g_object_unref (builder);
-}
-
-
-static void
-types_dialog_reset (struct rank_dialog *rd)
-{
- gint i;
-
- for (i = 0 ; i < n_RANK_FUNCS ; ++i )
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->func_button [i]),
- FALSE);
-
- gtk_widget_set_sensitive (rd->ntiles_entry, FALSE);
-
- gtk_widget_set_sensitive (rd->formula_box, FALSE);
-}
-
-
-
-static void
-run_types_dialog (GtkButton *b, gpointer data)
-{
- struct rank_dialog *rd = data;
- gint response;
-
- gtk_window_set_transient_for (GTK_WINDOW (rd->types_dialog),
- GTK_WINDOW (rd->dialog));
-
- types_dialog_reset (rd);
-
- response = psppire_dialog_run (PSPPIRE_DIALOG (rd->types_dialog));
-}
-
-static void
-run_ties_dialog (GtkButton *b, gpointer data)
-{
- struct rank_dialog *rd = data;
- gint response;
-
- gtk_window_set_transient_for (GTK_WINDOW (rd->ties_dialog),
- GTK_WINDOW (rd->dialog));
-
-
- response = psppire_dialog_run (PSPPIRE_DIALOG (rd->ties_dialog));
-}
-
-
-static void
-on_ntiles_toggle (GtkToggleButton *toggle_button, gpointer data)
-{
- GtkWidget *w = data;
- gboolean active = gtk_toggle_button_get_active (toggle_button);
- gtk_widget_set_sensitive (w, active);
-}
+++ /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 __RANK_DIALOG_H
-#define __RANK_DIALOG_H
-
-
-#include "psppire-data-window.h"
-
-void rank_dialog (PsppireDataWindow *);
-
-#endif
<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">By:</property>
+ <property name="label" translatable="yes">_By:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">group-vars-treeview</property>
</object>
<packing>
<property name="expand">False</property>
<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">Variable(s):</property>
+ <property name="label" translatable="yes">_Variable(s):</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">variables-treeview</property>
</object>
<packing>
<property name="expand">False</property>
#include "psppire-dialog-action-kmeans.h"
#include "psppire-dialog-action-means.h"
#include "psppire-means-layer.h"
+#include "psppire-dialog-action-rank.h"
#include "psppire-dialog-action-reliability.h"
#include "psppire-dialog-action-roc.h"
#include "psppire-dialog-action-sort.h"
psppire_dialog_action_means_get_type ();
psppire_means_layer_get_type ();
psppire_dialog_action_var_info_get_type ();
+ psppire_dialog_action_rank_get_type ();
psppire_dialog_action_reliability_get_type ();
psppire_dialog_action_roc_get_type ();
psppire_dialog_action_sort_get_type ();