X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fcrosstabs-dialog.c;h=34a3921301ba0b93d61412ccf920f37d24a40c31;hb=66ada89a69ed73a1a15abfbd9bffe4cdf9bf307a;hp=3c3bd9f42c2a26fdf979965b02fff56b423f0d33;hpb=d43a876351d94acce0e8d565ad2cb4d690727fe9;p=pspp-builds.git diff --git a/src/ui/gui/crosstabs-dialog.c b/src/ui/gui/crosstabs-dialog.c index 3c3bd9f4..34a39213 100644 --- a/src/ui/gui/crosstabs-dialog.c +++ b/src/ui/gui/crosstabs-dialog.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2008 Free Software Foundation + Copyright (C) 2008, 2010, 2011 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 @@ -18,18 +18,18 @@ #include "checkbox-treeview.h" #include "crosstabs-dialog.h" +#include "psppire-var-view.h" #include #include -#include -#include +#include #include #include -#include +#include "executor.h" #include #include -#include +#include #include "gettext.h" #define _(msgid) gettext (msgid) @@ -259,9 +259,9 @@ generate_syntax (const struct crosstabs_dialog *cd) GString *string = g_string_new ("CROSSTABS"); g_string_append (string, "\n\t/TABLES="); - append_variable_names (string, cd->dict, GTK_TREE_VIEW (cd->row_vars), 0); + psppire_var_view_append_names (PSPPIRE_VAR_VIEW (cd->row_vars), 0, string); g_string_append (string, "\tBY\t"); - append_variable_names (string, cd->dict, GTK_TREE_VIEW (cd->col_vars), 0); + psppire_var_view_append_names (PSPPIRE_VAR_VIEW (cd->col_vars), 0, string); g_string_append (string, "\n\t/FORMAT="); @@ -382,22 +382,20 @@ dialog_state_valid (gpointer data) /* Pops up the Crosstabs dialog box */ void -crosstabs_dialog (GObject *o, gpointer data) +crosstabs_dialog (PsppireDataWindow *de) { gint response; - struct data_editor *de = data; - struct crosstabs_dialog cd; - GladeXML *xml = XML_NEW ("crosstabs.glade"); + GtkBuilder *xml = builder_new ("crosstabs.ui"); PsppireVarStore *vs = NULL; + PsppireDict *dict = NULL; + GtkWidget *dialog = get_widget_assert (xml, "crosstabs-dialog"); GtkWidget *source = get_widget_assert (xml, "dict-treeview"); GtkWidget *dest_rows = get_widget_assert (xml, "rows"); GtkWidget *dest_cols = get_widget_assert (xml, "cols"); - GtkWidget *row_selector = get_widget_assert (xml, "row-selector"); - GtkWidget *col_selector = get_widget_assert (xml, "col-selector"); GtkWidget *format_button = get_widget_assert (xml, "format-button"); GtkWidget *stat_button = get_widget_assert (xml, "stats-button"); GtkWidget *cell_button = get_widget_assert (xml, "cell-button"); @@ -419,32 +417,14 @@ crosstabs_dialog (GObject *o, gpointer data) cells ); - gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window); - - attach_dictionary_to_treeview (GTK_TREE_VIEW (source), - vs->dict, - GTK_SELECTION_MULTIPLE, NULL); - - set_dest_model (GTK_TREE_VIEW (dest_rows), vs->dict); - set_dest_model (GTK_TREE_VIEW (dest_cols), vs->dict); + gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de)); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (row_selector), - source, - dest_rows, - insert_source_row_into_tree_view, - NULL, - NULL); - - psppire_selector_set_subjects (PSPPIRE_SELECTOR (col_selector), - source, - dest_cols, - insert_source_row_into_tree_view, - NULL, - NULL); + g_object_get (vs, "dictionary", &dict, NULL); + g_object_set (source, "model", dict, NULL); cd.row_vars = GTK_TREE_VIEW (dest_rows); cd.col_vars = GTK_TREE_VIEW (dest_cols); - cd.dict = vs->dict; + g_object_get (vs, "dictionary", &cd.dict, NULL); cd.format_dialog = get_widget_assert (xml, "format-dialog"); cd.table_button = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "print-tables")); cd.pivot_button = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "pivot")); @@ -461,9 +441,9 @@ crosstabs_dialog (GObject *o, gpointer data) cd.current_opts.table = TRUE; cd.current_opts.pivot = TRUE; - gtk_window_set_transient_for (GTK_WINDOW (cd.format_dialog), de->parent.window); - gtk_window_set_transient_for (GTK_WINDOW (cd.cell_dialog), de->parent.window); - gtk_window_set_transient_for (GTK_WINDOW (cd.stat_dialog), de->parent.window); + gtk_window_set_transient_for (GTK_WINDOW (cd.format_dialog), GTK_WINDOW (de)); + gtk_window_set_transient_for (GTK_WINDOW (cd.cell_dialog), GTK_WINDOW (de)); + gtk_window_set_transient_for (GTK_WINDOW (cd.stat_dialog), GTK_WINDOW (de)); g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), &cd); @@ -483,26 +463,10 @@ crosstabs_dialog (GObject *o, gpointer data) switch (response) { case GTK_RESPONSE_OK: - { - gchar *syntax = generate_syntax (&cd); - struct getl_interface *sss = create_syntax_string_source (syntax); - execute_syntax (sss); - - g_free (syntax); - } + g_free (execute_syntax_string (de, generate_syntax (&cd))); break; case PSPPIRE_RESPONSE_PASTE: - { - gchar *syntax = generate_syntax (&cd); - - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); - - g_free (syntax); - } + g_free (paste_syntax_to_window (generate_syntax (&cd))); break; default: break;