From: John Darrington Date: Mon, 23 Nov 2009 19:03:05 +0000 (+0100) Subject: New module psppire-var-view X-Git-Tag: sid-i386-build122~17 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd0c595927a23ea0373551a1eed4570388ea0fc5;p=pspp-builds.git New module psppire-var-view Added a new object PsppireVarView which is a subclass of GtkTreeView. It automatically creates a model for itself for the storage of variables. This change breaks some features. These must be corrected in subsequenct commits. --- diff --git a/glade/automake.mk b/glade/automake.mk index 8e51e1f7..1ef6b32c 100644 --- a/glade/automake.mk +++ b/glade/automake.mk @@ -15,6 +15,9 @@ libglade_psppire_la_SOURCES = \ glade/selector.c \ glade/acr.c \ glade/dictview.c \ + glade/var-view.c \ + src/ui/gui/psppire-var-ptr.c \ + src/ui/gui/dict-display.c \ src/ui/gui/psppire-conf.c \ src/ui/gui/psppire-acr.c \ src/ui/gui/psppire-buttonbox.c \ @@ -23,7 +26,8 @@ libglade_psppire_la_SOURCES = \ src/ui/gui/psppire-dialog.c \ src/ui/gui/psppire-keypad.c \ src/ui/gui/psppire-dictview.c \ - src/ui/gui/psppire-selector.c + src/ui/gui/psppire-selector.c \ + src/ui/gui/psppire-var-view.c dist_catalog_DATA = \ glade/psppire.xml diff --git a/glade/psppire.xml b/glade/psppire.xml index 5673d677..db8956b7 100644 --- a/glade/psppire.xml +++ b/glade/psppire.xml @@ -176,6 +176,7 @@ + @@ -211,12 +212,33 @@ + + + + + + + + + glade_psppire_var_view_post_create + glade_psppire_var_view_get_children + glade_psppire_var_view_get_internal_child + + + + + + + + + + @@ -224,6 +246,7 @@ + diff --git a/glade/var-view.c b/glade/var-view.c new file mode 100644 index 00000000..272f7dbe --- /dev/null +++ b/glade/var-view.c @@ -0,0 +1,76 @@ +#include + +#include +#include +#include "psppire-var-view.h" + +#include + + + + +void +glade_psppire_var_view_post_create (GladeWidgetAdaptor *adaptor, + GObject *object, + GladeCreateReason reason) +{ + GladeWidget *widget ; + + PsppireVarView *var_view = PSPPIRE_VAR_VIEW (object); + + g_return_if_fail (PSPPIRE_IS_VAR_VIEW (var_view)); + + widget = glade_widget_get_from_gobject (GTK_WIDGET (var_view)); + if (!widget) + return; + + if (reason == GLADE_CREATE_USER) + { + /* HIG complient border-width defaults on var_views */ + glade_widget_property_set (widget, "border-width", 5); + } +} + + +GtkWidget * +glade_psppire_var_view_get_internal_child (GladeWidgetAdaptor *adaptor, + PsppireVarView *var_view, + const gchar *name) +{ +#if DEBUGGING + g_print ("%s\n", __FUNCTION__); +#endif + return GTK_WIDGET (var_view); +} + + + +void +glade_psppire_var_view_set_property (GladeWidgetAdaptor *adaptor, + GObject *object, + const gchar *id, + const GValue *value) +{ +#if DEBUGGING + g_print ("%s(%p) Type=\"%s\" Id=\"%s\"\n", __FUNCTION__, object, + G_OBJECT_TYPE_NAME( object ), + id); +#endif + + GWA_GET_CLASS (GTK_TYPE_WINDOW)->set_property (adaptor, object, + id, value); +} + + +GList * +glade_psppire_var_view_get_children (GladeWidgetAdaptor *adaptor, + PsppireVarView *dv) +{ + GList *list = NULL; + + g_return_val_if_fail (PSPPIRE_IS_VAR_VIEW (dv), NULL); + + list = glade_util_container_get_all_children (GTK_CONTAINER (dv)); + + return list; +} diff --git a/src/ui/gui/automake.mk b/src/ui/gui/automake.mk index aaaa05b6..f2f0b813 100644 --- a/src/ui/gui/automake.mk +++ b/src/ui/gui/automake.mk @@ -163,6 +163,8 @@ src_ui_gui_psppire_SOURCES = \ src/ui/gui/psppire-keypad.h \ src/ui/gui/psppire-output-window.c \ src/ui/gui/psppire-output-window.h \ + src/ui/gui/psppire-var-view.c \ + src/ui/gui/psppire-var-view.h \ src/ui/gui/psppire-selector.h \ src/ui/gui/psppire-syntax-window.c \ src/ui/gui/psppire-syntax-window.h \ diff --git a/src/ui/gui/crosstabs-dialog.c b/src/ui/gui/crosstabs-dialog.c index 8198520d..2b93a77b 100644 --- a/src/ui/gui/crosstabs-dialog.c +++ b/src/ui/gui/crosstabs-dialog.c @@ -18,6 +18,7 @@ #include "checkbox-treeview.h" #include "crosstabs-dialog.h" +#include "psppire-var-view.h" #include #include @@ -259,9 +260,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="); @@ -398,8 +399,6 @@ crosstabs_dialog (GObject *o, gpointer data) 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"); @@ -426,17 +425,6 @@ crosstabs_dialog (GObject *o, gpointer data) g_object_get (vs, "dictionary", &dict, NULL); g_object_set (source, "model", dict, NULL); - set_dest_model (GTK_TREE_VIEW (dest_rows), dict); - set_dest_model (GTK_TREE_VIEW (dest_cols), dict); - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (row_selector), - insert_source_row_into_tree_view, - NULL); - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (col_selector), - insert_source_row_into_tree_view, - NULL); - cd.row_vars = GTK_TREE_VIEW (dest_rows); cd.col_vars = GTK_TREE_VIEW (dest_cols); g_object_get (vs, "dictionary", &cd.dict, NULL); diff --git a/src/ui/gui/crosstabs.ui b/src/ui/gui/crosstabs.ui index cb90d3cc..e21ae808 100644 --- a/src/ui/gui/crosstabs.ui +++ b/src/ui/gui/crosstabs.ui @@ -34,7 +34,7 @@ automatic etched-in - + True False @@ -73,7 +73,7 @@ automatic etched-in - + True False diff --git a/src/ui/gui/descriptives-dialog.c b/src/ui/gui/descriptives-dialog.c index c29e1d8d..9d8502de 100644 --- a/src/ui/gui/descriptives-dialog.c +++ b/src/ui/gui/descriptives-dialog.c @@ -18,6 +18,7 @@ #include "checkbox-treeview.h" #include "descriptives-dialog.h" +#include "psppire-var-view.h" #include #include @@ -117,7 +118,7 @@ generate_syntax (const struct descriptives_dialog *scd) string = g_string_new ("DESCRIPTIVES"); g_string_append (string, "\n /VARIABLES="); - append_variable_names (string, scd->dict, GTK_TREE_VIEW (scd->stat_vars), 0); + psppire_var_view_append_names (PSPPIRE_VAR_VIEW (scd->stat_vars), 0, string); listwise = gtk_toggle_button_get_active (scd->exclude_missing_listwise); include = gtk_toggle_button_get_active (scd->include_user_missing); @@ -212,7 +213,6 @@ descriptives_dialog (GObject *o, gpointer data) GtkWidget *source = get_widget_assert (xml, "all-variables"); - GtkWidget *selector = get_widget_assert (xml, "stat-var-selector"); GtkWidget *dest = get_widget_assert (xml, "stat-variables"); GtkWidget *stats_treeview = get_widget_assert (xml, "statistics"); @@ -229,11 +229,6 @@ descriptives_dialog (GObject *o, gpointer data) g_object_set (source, "model", dict, "predicate", var_is_numeric, NULL); - set_dest_model (GTK_TREE_VIEW (dest), dict); - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), - insert_source_row_into_tree_view, NULL); - put_checkbox_items_in_treeview (GTK_TREE_VIEW (stats_treeview), B_DS_DEFAULT, N_DESCRIPTIVE_STATS, stats); diff --git a/src/ui/gui/descriptives.ui b/src/ui/gui/descriptives.ui index f43ed495..62e601f9 100644 --- a/src/ui/gui/descriptives.ui +++ b/src/ui/gui/descriptives.ui @@ -99,7 +99,7 @@ automatic etched-in - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK diff --git a/src/ui/gui/dialog-common.c b/src/ui/gui/dialog-common.c index 5d52204c..7edbbe50 100644 --- a/src/ui/gui/dialog-common.c +++ b/src/ui/gui/dialog-common.c @@ -23,66 +23,18 @@ #include "helper.h" - -/* Append the names of selected variables to STRING. - TREEVIEW is the treeview containing the variables. - COLUMN is the column in the treeview containing the variables. - DICT is the dictionary for those variables. +/* A (*GtkTreeCellDataFunc) function. + This function expects TREEMODEL to hold G_TYPE_BOXED, which is a pointer to a variable. + It renders the name of the variable into CELL. */ -gint -append_variable_names (GString *string, - PsppireDict *dict, GtkTreeView *treeview, gint column) -{ - gint n_vars = 0; - GtkTreeIter iter; - - GtkTreeModel *list_store = - gtk_tree_view_get_model (treeview); - - if ( gtk_tree_model_get_iter_first (list_store, &iter) ) - { - do - { - GValue value = {0}; - struct variable *var = NULL; - GtkTreePath *path = gtk_tree_model_get_path (list_store, &iter); - - gtk_tree_model_get_value (list_store, &iter, column, &value); - - /* FIXME: G_TYPE_INT should be deprecated. - As well as being simpler, it'd be unecessary to pass dict */ - if ( G_VALUE_TYPE (&value) == G_TYPE_INT ) - var = psppire_dict_get_variable (dict, g_value_get_int (&value)); - - else if ( G_VALUE_TYPE (&value) == PSPPIRE_VAR_PTR_TYPE) - var = g_value_get_boxed (&value); - - else - g_critical ("Unsupported type \"%s\", in variable name treeview.", - G_VALUE_TYPE_NAME (&value)); - - g_value_unset (&value); - - g_string_append (string, " "); - g_string_append (string, var_get_name (var)); - - gtk_tree_path_free (path); - n_vars++; - } - while (gtk_tree_model_iter_next (list_store, &iter)); - } - - return n_vars; -} - - - -struct variable * -get_selected_variable (GtkTreeModel *treemodel, - GtkTreeIter *iter, - PsppireDict *dict) +void +XXX_cell_var_name (GtkTreeViewColumn *tree_column, + GtkCellRenderer *cell, + GtkTreeModel *treemodel, + GtkTreeIter *iter, + gpointer data) { - struct variable *var; + const struct variable *var; GValue value = {0}; GtkTreePath *path = gtk_tree_model_get_path (treemodel, iter); @@ -91,67 +43,15 @@ get_selected_variable (GtkTreeModel *treemodel, gtk_tree_path_free (path); - var = psppire_dict_get_variable (dict, g_value_get_int (&value)); + var = g_value_get_boxed (&value); g_value_unset (&value); - return var; -} - - - - -/* A (*GtkTreeCellDataFunc) function. - This function expects TREEMODEL to hold G_TYPE_INT. The ints it holds - are the indices of the variables in the dictionary, which DATA points to. - It renders the name of the variable into CELL. -*/ -void -cell_var_name (GtkTreeViewColumn *tree_column, - GtkCellRenderer *cell, - GtkTreeModel *tree_model, - GtkTreeIter *iter, - gpointer data) -{ - PsppireDict *dict = data; - const struct variable *var = get_selected_variable (tree_model, iter, dict); - g_object_set (cell, "text", var_get_name (var), NULL); } -/* Set a model for DEST, which is an GtkListStore of g_int's - whose values are the indices into DICT */ -void -set_dest_model (GtkTreeView *dest, PsppireDict *dict) -{ - GtkTreeViewColumn *col; - GtkListStore *dest_list = gtk_list_store_new (1, G_TYPE_INT); - GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); - - gtk_tree_view_set_model (GTK_TREE_VIEW (dest), GTK_TREE_MODEL (dest_list)); - - col = gtk_tree_view_column_new_with_attributes ("Var", - renderer, - "text", - 0, - NULL); - - gtk_tree_view_column_set_cell_data_func (col, renderer, - cell_var_name, - dict, 0); - - /* FIXME: make this a value in terms of character widths */ - g_object_set (col, "min-width", 100, NULL); - - gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_FIXED); - - gtk_tree_view_append_column (GTK_TREE_VIEW (dest), col); -} - - - /* Returns FALSE if the variables represented by the union of the rows currently selected by SOURCE widget, and contents of the DEST widget, are of different types. @@ -224,11 +124,8 @@ homogeneous_types (GtkWidget *source, GtkWidget *dest) ok; ok = gtk_tree_model_iter_next (model, &iter)) { - gint idx; const struct variable *v; - gtk_tree_model_get (model, &iter, 0, &idx, -1); - - v = psppire_dict_get_variable (dict, idx); + gtk_tree_model_get (model, &iter, 0, &v, -1); if ( type != -1 ) { @@ -242,7 +139,6 @@ homogeneous_types (GtkWidget *source, GtkWidget *dest) type = var_get_type (v); } - return retval; } diff --git a/src/ui/gui/dialog-common.h b/src/ui/gui/dialog-common.h index 9a003f35..328904ac 100644 --- a/src/ui/gui/dialog-common.h +++ b/src/ui/gui/dialog-common.h @@ -23,40 +23,18 @@ #include #include "psppire-dict.h" -/* Append the names of selected variables to STRING. - TREEVIEW is the treeview containing the variables. - COLUMN is column in treeview containing the variables. - DICT is the dictionary for those variables. -*/ -gint append_variable_names (GString *string, PsppireDict *dict, - GtkTreeView *treeview, gint column); - - -/* Returns the variable currently selected by the iterator - pointing to TREEMODEL */ -struct variable * get_selected_variable (GtkTreeModel *treemodel, - GtkTreeIter *iter, - PsppireDict *dict); - - - /* A (*GtkTreeCellDataFunc) function. This function expects TREEMODEL to hold G_TYPE_INT. The ints it holds are the indices of the variables in the dictionary, which DATA points to. It renders the name of the variable into CELL. */ -void cell_var_name (GtkTreeViewColumn *tree_column, +void XXX_cell_var_name (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data); -/* Set a model for DEST, which is an GtkListStore of g_int's - whose values are the indices into DICT */ -void set_dest_model (GtkTreeView *dest, PsppireDict *dict); - - /* Returns FALSE if the variables represented by the union of the rows currently selected by SOURCE widget, and contents of the DEST widget, are of different types. diff --git a/src/ui/gui/dict-display.c b/src/ui/gui/dict-display.c index b06fcb4b..160cdb2a 100644 --- a/src/ui/gui/dict-display.c +++ b/src/ui/gui/dict-display.c @@ -54,7 +54,6 @@ get_base_model (GtkTreeModel *top_model, GtkTreeIter *top_iter, } - void insert_source_row_into_entry (GtkTreeIter iter, GtkWidget *dest, @@ -84,7 +83,6 @@ insert_source_row_into_entry (GtkTreeIter iter, } - void insert_source_row_into_tree_view (GtkTreeIter iter, GtkWidget *dest, @@ -96,24 +94,28 @@ insert_source_row_into_tree_view (GtkTreeIter iter, GtkTreeIter dest_iter; GtkTreeIter dict_iter; gint *row ; - GtkTreeModel *destmodel = gtk_tree_view_get_model ( GTK_TREE_VIEW (dest)); + GtkTreeModel *destmodel = gtk_tree_view_get_model (GTK_TREE_VIEW (dest)); + const struct variable *var; GtkTreeModel *dict; - get_base_model (model, &iter, &dict, &dict_iter); path = gtk_tree_model_get_path (dict, &dict_iter); row = gtk_tree_path_get_indices (path); + var = psppire_dict_get_variable (PSPPIRE_DICT (dict), *row); + gtk_list_store_append (GTK_LIST_STORE (destmodel), &dest_iter); - gtk_list_store_set (GTK_LIST_STORE (destmodel), &dest_iter, 0, *row, -1); + + gtk_list_store_set (GTK_LIST_STORE (destmodel), &dest_iter, 0, var, -1); gtk_tree_path_free (path); } + gboolean is_currently_in_entry (GtkTreeModel *model, GtkTreeIter *iter, PsppireSelector *selector) diff --git a/src/ui/gui/dict-display.h b/src/ui/gui/dict-display.h index 2c8df440..f1a8a001 100644 --- a/src/ui/gui/dict-display.h +++ b/src/ui/gui/dict-display.h @@ -31,7 +31,6 @@ void insert_source_row_into_tree_view (GtkTreeIter source_iter, gpointer data ); - /* A SelectItemsFunc function for GtkEntry widgets */ void insert_source_row_into_entry (GtkTreeIter source_iter, GtkWidget *dest, diff --git a/src/ui/gui/examine-dialog.c b/src/ui/gui/examine-dialog.c index 09b5f8b8..67523143 100644 --- a/src/ui/gui/examine-dialog.c +++ b/src/ui/gui/examine-dialog.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2007, 2008 Free Software Foundation + Copyright (C) 2007, 2008, 2009 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 @@ -17,6 +17,7 @@ #include #include "examine-dialog.h" +#include "psppire-var-view.h" #include #include @@ -96,13 +97,13 @@ generate_syntax (const struct examine_dialog *ed) GString *str = g_string_new ("EXAMINE "); g_string_append (str, "\n\t/VARIABLES="); - append_variable_names (str, ed->dict, GTK_TREE_VIEW (ed->dep_list), 0); + psppire_var_view_append_names (PSPPIRE_VAR_VIEW (ed->dep_list), 0, str); if ( 0 < gtk_tree_model_iter_n_children (gtk_tree_view_get_model (GTK_TREE_VIEW (ed->fct_list)), NULL)) { g_string_append (str, "\n\tBY "); - append_variable_names (str, ed->dict, GTK_TREE_VIEW (ed->fct_list), 0); + psppire_var_view_append_names (PSPPIRE_VAR_VIEW (ed->fct_list), 0, str); } label = gtk_entry_get_text (GTK_ENTRY (ed->id_entry)); @@ -250,8 +251,6 @@ examine_dialog (GObject *o, gpointer data) GtkWidget *dep_selector = get_widget_assert (xml, "psppire-selector1"); - GtkWidget *fct_selector = get_widget_assert (xml, "psppire-selector2"); - GtkWidget *id_selector = get_widget_assert (xml, "psppire-selector3"); PsppireVarStore *vs = NULL; @@ -282,28 +281,9 @@ examine_dialog (GObject *o, gpointer data) g_object_get (vs, "dictionary", &ex_d.dict, NULL); g_object_set (source, "model", ex_d.dict, NULL); - set_dest_model (GTK_TREE_VIEW (ex_d.dep_list), ex_d.dict); - - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (dep_selector), - insert_source_row_into_tree_view, - NULL); - psppire_selector_set_allow (PSPPIRE_SELECTOR (dep_selector), numeric_only); - set_dest_model (GTK_TREE_VIEW (ex_d.fct_list), ex_d.dict); - - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (fct_selector), - insert_source_row_into_tree_view, - NULL); - - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (id_selector), - insert_source_row_into_entry, - NULL); - g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), &ex_d); psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog), diff --git a/src/ui/gui/examine.ui b/src/ui/gui/examine.ui index e2acfc3f..316f1043 100644 --- a/src/ui/gui/examine.ui +++ b/src/ui/gui/examine.ui @@ -81,7 +81,7 @@ automatic etched-in - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -128,7 +128,7 @@ automatic etched-in - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -198,6 +198,7 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 5 + True treeview1 treeview2 diff --git a/src/ui/gui/find-dialog.c b/src/ui/gui/find-dialog.c index 07b73fe8..40e91bc0 100644 --- a/src/ui/gui/find-dialog.c +++ b/src/ui/gui/find-dialog.c @@ -246,10 +246,6 @@ find_dialog (GObject *o, gpointer data) "selection-mode", GTK_SELECTION_SINGLE, NULL); - psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), - insert_source_row_into_entry, - NULL - ); psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector), is_currently_in_entry); diff --git a/src/ui/gui/find.ui b/src/ui/gui/find.ui index 8dae0c99..d1cb203c 100644 --- a/src/ui/gui/find.ui +++ b/src/ui/gui/find.ui @@ -52,6 +52,8 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 5 + find-variable-treeview + find-variable-entry False diff --git a/src/ui/gui/frequencies-dialog.c b/src/ui/gui/frequencies-dialog.c index 1d6a3a2a..2d5fcbb4 100644 --- a/src/ui/gui/frequencies-dialog.c +++ b/src/ui/gui/frequencies-dialog.c @@ -18,6 +18,7 @@ #include "checkbox-treeview.h" #include "frequencies-dialog.h" +#include "psppire-var-view.h" #include #include @@ -147,7 +148,7 @@ generate_syntax (const struct frequencies_dialog *fd) GString *string = g_string_new ("FREQUENCIES"); g_string_append (string, "\n\t/VARIABLES="); - append_variable_names (string, fd->dict, GTK_TREE_VIEW (fd->stat_vars), 0); + psppire_var_view_append_names (PSPPIRE_VAR_VIEW (fd->stat_vars), 0, string); g_string_append (string, "\n\t/FORMAT="); @@ -316,7 +317,6 @@ frequencies_dialog (GObject *o, gpointer data) GtkWidget *dialog = get_widget_assert (xml, "frequencies-dialog"); GtkWidget *source = get_widget_assert (xml, "dict-treeview"); GtkWidget *dest = get_widget_assert (xml, "var-treeview"); - GtkWidget *selector = get_widget_assert (xml, "selector1"); GtkWidget *format_button = get_widget_assert (xml, "button1"); GtkWidget *stats_treeview = get_widget_assert (xml, "stats-treeview"); @@ -336,15 +336,6 @@ frequencies_dialog (GObject *o, gpointer data) g_object_get (vs, "dictionary", &fd.dict, NULL); g_object_set (source, "model", fd.dict, NULL); - - set_dest_model (GTK_TREE_VIEW (dest), fd.dict); - - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), - insert_source_row_into_tree_view, - NULL); - - fd.stat_vars = GTK_TREE_VIEW (dest); fd.table_button = get_widget_assert (xml, "checkbutton1"); fd.format_dialog = get_widget_assert (xml, "format-dialog"); diff --git a/src/ui/gui/frequencies.ui b/src/ui/gui/frequencies.ui index 1a246578..0ab2f29f 100644 --- a/src/ui/gui/frequencies.ui +++ b/src/ui/gui/frequencies.ui @@ -87,7 +87,7 @@ automatic etched-in - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK diff --git a/src/ui/gui/oneway-anova-dialog.c b/src/ui/gui/oneway-anova-dialog.c index e1e3c5ae..57428667 100644 --- a/src/ui/gui/oneway-anova-dialog.c +++ b/src/ui/gui/oneway-anova-dialog.c @@ -15,12 +15,12 @@ along with this program. If not, see . */ - #include #include #include "oneway-anova-dialog.h" #include "psppire-dict.h" #include "psppire-var-store.h" +#include "psppire-var-view.h" #include "helper.h" #include "psppire-data-window.h" #include "psppire-dialog.h" @@ -29,7 +29,6 @@ #include "psppire-selector.h" #include "dict-display.h" - #include #include "executor.h" @@ -141,9 +140,6 @@ oneway_anova_dialog (GObject *o, gpointer data) GtkWidget *selector2 = get_widget_assert (builder, "oneway-anova-selector2"); - GtkWidget *selector1 = - get_widget_assert (builder, "oneway-anova-selector1"); - GtkWidget *contrasts_button = get_widget_assert (builder, "contrasts-button"); @@ -173,18 +169,6 @@ oneway_anova_dialog (GObject *o, gpointer data) g_object_set (dict_view, "model", ow.dict, NULL); - set_dest_model (GTK_TREE_VIEW (ow.vars_treeview), ow.dict); - - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector1), - insert_source_row_into_tree_view, - NULL); - - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector2), - insert_source_row_into_entry, - NULL); - psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector2), is_currently_in_entry); @@ -264,7 +248,7 @@ static gchar * generate_syntax (const struct oneway_anova_dialog *ow) GString *str = g_string_new ("ONEWAY /VARIABLES="); - append_variable_names (str, ow->dict, GTK_TREE_VIEW (ow->vars_treeview), 0); + psppire_var_view_append_names (PSPPIRE_VAR_VIEW (ow->vars_treeview), 0, str); g_string_append (str, " BY "); diff --git a/src/ui/gui/oneway.ui b/src/ui/gui/oneway.ui index a0f79145..7381932b 100644 --- a/src/ui/gui/oneway.ui +++ b/src/ui/gui/oneway.ui @@ -84,7 +84,7 @@ automatic etched-in - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -128,6 +128,7 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 5 + True oneway-anova-treeview1 oneway-anova-treeview2 diff --git a/src/ui/gui/psppire-selector.c b/src/ui/gui/psppire-selector.c index d871d5d1..367502b6 100644 --- a/src/ui/gui/psppire-selector.c +++ b/src/ui/gui/psppire-selector.c @@ -12,7 +12,8 @@ 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 . */ + along with this program. If not, see . +*/ /* This module provides a widget, PsppireSelector derived from @@ -57,6 +58,11 @@ #include +#include "psppire-dictview.h" +#include "psppire-var-view.h" + + + #include #include #include @@ -146,6 +152,7 @@ enum { PROP_0, PROP_ORIENTATION, + PROP_PRIMARY, PROP_SOURCE_WIDGET, PROP_DEST_WIDGET }; @@ -170,6 +177,10 @@ psppire_selector_set_property (GObject *object, selector->orientation = g_value_get_enum (value); set_direction (selector, selector->direction); break; + case PROP_PRIMARY: + selector->primary_requested = TRUE; + update_subjects (selector); + break; case PROP_SOURCE_WIDGET: selector->source = g_value_dup_object (value); update_subjects (selector); @@ -224,6 +235,15 @@ psppire_selector_class_init (PsppireSelectorClass *class) PSPPIRE_SELECT_SOURCE_BEFORE_DEST /* default value */, G_PARAM_CONSTRUCT_ONLY |G_PARAM_READWRITE); + + /* Meaningfull only if more than one selector shares this selectors source */ + GParamSpec *primary_spec = + g_param_spec_boolean ("primary", + "Primary", + "Whether this selector should be the primary selector for the source", + FALSE, + G_PARAM_READWRITE); + GParamSpec *source_widget_spec = g_param_spec_object ("source-widget", "Source Widget", @@ -246,6 +266,10 @@ psppire_selector_class_init (PsppireSelectorClass *class) PROP_ORIENTATION, orientation_spec); + g_object_class_install_property (object_class, + PROP_PRIMARY, + primary_spec); + g_object_class_install_property (object_class, PROP_SOURCE_WIDGET, source_widget_spec); @@ -298,11 +322,71 @@ psppire_selector_base_finalize(PsppireSelectorClass *class, g_hash_table_destroy (class->source_hash); } +/* Callback for when the source treeview is activated (double clicked) */ +static void +on_row_activate (GtkTreeView *tree_view, + GtkTreePath *path, + GtkTreeViewColumn *column, + gpointer data) +{ + PsppireSelector *selector = data; + + gtk_action_activate (selector->action); +} + +/* Callback for when the source selection changes */ +static void +on_source_select (GtkTreeSelection *treeselection, gpointer data) +{ + PsppireSelector *selector = data; + + set_direction (selector, PSPPIRE_SELECTOR_SOURCE_TO_DEST); + + if ( selector->allow_selection ) + { + gtk_action_set_sensitive (selector->action, + selector->allow_selection (selector->source, selector->dest)); + } + else if ( GTK_IS_ENTRY (selector->dest) ) + { + gtk_action_set_sensitive (selector->action, + gtk_tree_selection_count_selected_rows + (treeselection) <= 1 ); + } +} + + +static void +on_realize (PsppireSelector *selector) +{ + PsppireSelectorClass *class = g_type_class_peek (PSPPIRE_SELECTOR_TYPE); + GtkTreeSelection* selection ; + + GList *list = g_hash_table_lookup (class->source_hash, selector->source); + + if ( g_list_first (list)->data == selector) + { + if ( selector->row_activate_id ) + g_signal_handler_disconnect (selector->source, selector->row_activate_id); + + selector->row_activate_id = + g_signal_connect (selector->source, "row-activated", G_CALLBACK (on_row_activate), selector); + } + + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (selector->source)); + + if ( selector->source_select_id ) + g_signal_handler_disconnect (selection, selector->source_select_id); + + selector->source_select_id = + g_signal_connect (selection, "changed", G_CALLBACK (on_source_select), selector); +} static void psppire_selector_init (PsppireSelector *selector) { + selector->primary_requested = FALSE; selector->select_user_data = NULL; selector->select_items = NULL; selector->allow_selection = NULL; @@ -330,6 +414,10 @@ psppire_selector_init (PsppireSelector *selector) selector->row_activate_id = 0; selector->source_select_id = 0; + + g_signal_connect (selector, "realize", + G_CALLBACK (on_realize), NULL); + } @@ -392,27 +480,6 @@ set_direction (PsppireSelector *selector, enum psppire_selector_dir d) } } -/* Callback for when the source selection changes */ -static void -on_source_select (GtkTreeSelection *treeselection, gpointer data) -{ - PsppireSelector *selector = data; - - set_direction (selector, PSPPIRE_SELECTOR_SOURCE_TO_DEST); - - if ( selector->allow_selection ) - { - gtk_action_set_sensitive (selector->action, - selector->allow_selection (selector->source, selector->dest)); - } - else if ( GTK_IS_ENTRY (selector->dest) ) - { - gtk_action_set_sensitive (selector->action, - gtk_tree_selection_count_selected_rows - (treeselection) <= 1 ); - } -} - /* Callback for when the destination treeview selection changes */ static void on_dest_treeview_select (GtkTreeSelection *treeselection, gpointer data) @@ -559,18 +626,6 @@ select_selection (PsppireSelector *selector) selector->selecting = FALSE; } -/* Callback for when the source treeview is activated (double clicked) */ -static void -on_row_activate (GtkTreeView *tree_view, - GtkTreePath *path, - GtkTreeViewColumn *column, - gpointer data) -{ - PsppireSelector *selector = data; - - gtk_action_activate (selector->action); -} - /* Callback for when the selector button is clicked, or other event which causes the selector's action to occur. */ @@ -591,6 +646,13 @@ on_activate (PsppireSelector *selector, gpointer data) } } +static gboolean +permissive_filter (GtkTreeModel *model, GtkTreeIter *iter, + PsppireSelector *selector) +{ + return FALSE; +} + /* Default visibility filter for GtkTreeView DEST widget */ static gboolean is_item_in_dest (GtkTreeModel *model, GtkTreeIter *iter, @@ -685,7 +747,7 @@ static void set_tree_view_source (PsppireSelector *selector, GtkTreeView *source) { - GtkTreeSelection* selection ; + GList *list = NULL; PsppireSelectorClass *class = g_type_class_peek (PSPPIRE_SELECTOR_TYPE); @@ -715,23 +777,17 @@ set_tree_view_source (PsppireSelector *selector, selector->filtered_source = GTK_TREE_MODEL_FILTER (model); - list = g_list_append (list, selector); - g_hash_table_replace (class->source_hash, source, list); + if ( NULL == g_list_find (list, selector) ) + { + if ( selector->primary_requested ) + list = g_list_prepend (list, selector); + else + list = g_list_append (list, selector); + g_hash_table_replace (class->source_hash, source, list); + } } - selection = gtk_tree_view_get_selection (source); - - if ( selector->row_activate_id ) - g_signal_handler_disconnect (source, selector->row_activate_id); - - selector->row_activate_id = - g_signal_connect (source, "row-activated", G_CALLBACK (on_row_activate), selector); - - if ( selector->source_select_id ) - g_signal_handler_disconnect (selection, selector->source_select_id); - selector->source_select_id = - g_signal_connect (selection, "changed", G_CALLBACK (on_source_select), selector); } @@ -868,6 +924,16 @@ set_entry_dest (PsppireSelector *selector, G_CALLBACK (on_row_inserted), selector); } +static void +set_default_filter (PsppireSelector *selector) +{ + if ( selector->filter == NULL) + { + if (GTK_IS_TREE_VIEW (selector->dest)) + selector->filter = permissive_filter; + } +} + static void update_subjects (PsppireSelector *selector) { @@ -876,11 +942,7 @@ update_subjects (PsppireSelector *selector) if ( NULL == selector->dest ) return; - if ( selector->filter == NULL) - { - if (GTK_IS_TREE_VIEW (selector->dest)) - selector->filter = is_item_in_dest; - } + set_default_filter (selector); if ( NULL == selector->source ) return; @@ -916,8 +978,20 @@ update_subjects (PsppireSelector *selector) else g_error ("Unsupported destination widget: %s", G_OBJECT_TYPE_NAME (selector->dest)); -} + /* FIXME: Remove this dependency */ + if ( PSPPIRE_IS_DICT_VIEW (selector->source) ) + { + if ( PSPPIRE_IS_VAR_VIEW (selector->dest)) + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), + insert_source_row_into_tree_view, + NULL); + else if (GTK_IS_ENTRY (selector->dest)) + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), + insert_source_row_into_entry, + NULL); + } +} /* Set FILTER_FUNC for this selector */ void @@ -925,12 +999,8 @@ psppire_selector_set_filter_func (PsppireSelector *selector, FilterItemsFunc *filter_func) { selector->filter = filter_func ; - - if ( selector->filter == NULL) - { - if (GTK_IS_TREE_VIEW (selector->dest)) - selector->filter = is_item_in_dest; - } + + set_default_filter (selector); } @@ -953,7 +1023,6 @@ psppire_selector_set_allow (PsppireSelector *selector, AllowSelectionFunc *allow } - GType psppire_selector_orientation_get_type (void) { diff --git a/src/ui/gui/psppire-selector.h b/src/ui/gui/psppire-selector.h index 8e033ae4..c2d18424 100644 --- a/src/ui/gui/psppire-selector.h +++ b/src/ui/gui/psppire-selector.h @@ -104,6 +104,8 @@ struct _PsppireSelector gulong row_activate_id ; gulong source_select_id ; + + gboolean primary_requested; }; struct _PsppireSelectorClass diff --git a/src/ui/gui/psppire-var-view.c b/src/ui/gui/psppire-var-view.c new file mode 100644 index 00000000..da1cc8c1 --- /dev/null +++ b/src/ui/gui/psppire-var-view.c @@ -0,0 +1,280 @@ +/* PSPPIRE - a graphical user interface for PSPP. + Copyright (C) 2009 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 . */ + +#include + +#include +#include +#include "psppire-var-view.h" +#include "psppire-var-ptr.h" + +#include + +#include +#define _(msgid) gettext (msgid) +#define N_(msgid) msgid + +static void psppire_var_view_base_finalize (PsppireVarViewClass *, gpointer); +static void psppire_var_view_base_init (PsppireVarViewClass *class); +static void psppire_var_view_class_init (PsppireVarViewClass *class); +static void psppire_var_view_init (PsppireVarView *var_view); + + +GType +psppire_var_view_get_type (void) +{ + static GType psppire_var_view_type = 0; + + if (!psppire_var_view_type) + { + static const GTypeInfo psppire_var_view_info = + { + sizeof (PsppireVarViewClass), + (GBaseInitFunc) psppire_var_view_base_init, + (GBaseFinalizeFunc) psppire_var_view_base_finalize, + (GClassInitFunc)psppire_var_view_class_init, + (GClassFinalizeFunc) NULL, + NULL, + sizeof (PsppireVarView), + 0, + (GInstanceInitFunc) psppire_var_view_init, + }; + + psppire_var_view_type = + g_type_register_static (GTK_TYPE_TREE_VIEW, "PsppireVarView", + &psppire_var_view_info, 0); + } + + return psppire_var_view_type; +} + + +static void +psppire_var_view_finalize (GObject *object) +{ + PsppireVarView *var_view = PSPPIRE_VAR_VIEW (object); + g_free (var_view->nums); +} + +/* Properties */ +enum +{ + PROP_0, + PROP_N_COLS +}; + +/* A (*GtkTreeCellDataFunc) function. + This function expects TREEMODEL to hold PSPPIRE_VAR_PTR_TYPE. + It renders the name of the variable into CELL. +*/ +static void +display_cell_var_name (GtkTreeViewColumn *tree_column, + GtkCellRenderer *cell, + GtkTreeModel *treemodel, + GtkTreeIter *iter, + gpointer data) +{ + struct variable *var; + GValue value = {0}; + gint *col = data; + + GtkTreePath *path = gtk_tree_model_get_path (treemodel, iter); + + gtk_tree_model_get_value (treemodel, iter, *col, &value); + + gtk_tree_path_free (path); + + var = g_value_get_boxed (&value); + + g_value_unset (&value); + + g_object_set (cell, "text", var_get_name (var), NULL); +} + + +static void +psppire_var_view_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + PsppireVarView *var_view = PSPPIRE_VAR_VIEW (object); + + switch (prop_id) + { + case PROP_N_COLS: + g_value_set_int (value, gtk_tree_model_iter_n_children (GTK_TREE_MODEL (var_view->list), NULL)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + }; +} + + +static void +psppire_var_view_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + PsppireVarView *var_view = PSPPIRE_VAR_VIEW (object); + + switch (prop_id) + { + case PROP_N_COLS: + { + gint n_cols = g_value_get_int (value); + gint c; + + + GType *array = g_alloca (sizeof (GType) * n_cols); + + var_view->nums = g_malloc (sizeof *var_view->nums * n_cols); + + for (c = 0 ; c < n_cols; ++c) + { + GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); + GtkTreeViewColumn *col = gtk_tree_view_column_new (); + + gchar *label = g_strdup_printf (_("Var%d"), c + 1); + + gtk_tree_view_column_set_min_width (col, 100); + gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_FIXED); + gtk_tree_view_column_set_resizable (col, TRUE); + gtk_tree_view_column_set_title (col, label); + + g_free (label); + + var_view->nums[c] = c; + + gtk_tree_view_column_pack_start (col, renderer, TRUE); + gtk_tree_view_column_set_cell_data_func (col, renderer, + display_cell_var_name, + &var_view->nums[c], 0); + + gtk_tree_view_append_column (GTK_TREE_VIEW (var_view), col); + array[c] = PSPPIRE_VAR_PTR_TYPE; + } + + /* Set a model, which is an GtkListStore of gpointers which point to a variable */ + var_view->list = gtk_list_store_newv (n_cols, array); + gtk_tree_view_set_model (GTK_TREE_VIEW (var_view), GTK_TREE_MODEL (var_view->list)); + } + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + }; +} + +static void +psppire_var_view_class_init (PsppireVarViewClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); + + GParamSpec *n_cols_spec = + g_param_spec_int ("n-cols", + "Number of columns", + "The Number of Columns in the Variable View", + 1, 20, + 1, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READABLE | G_PARAM_WRITABLE); + + + object_class->set_property = psppire_var_view_set_property; + object_class->get_property = psppire_var_view_get_property; + + g_object_class_install_property (object_class, + PROP_N_COLS, + n_cols_spec); + +} + + +static void +psppire_var_view_base_init (PsppireVarViewClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); + + object_class->finalize = psppire_var_view_finalize; +} + + + +static void +psppire_var_view_base_finalize (PsppireVarViewClass *class, + gpointer class_data) +{ +} + + + +static void +psppire_var_view_init (PsppireVarView *var_view) +{ +} + + +GtkWidget* +psppire_var_view_new (void) +{ + return GTK_WIDGET (g_object_new (psppire_var_view_get_type (), NULL)); +} + + +/* + Append the names of selected variables to STRING. + Returns the number of variables appended. +*/ +gint +psppire_var_view_append_names (PsppireVarView *vv, gint column, GString *string) +{ + gint n_vars = 0; + GtkTreeIter iter; + + if ( gtk_tree_model_get_iter_first (GTK_TREE_MODEL (vv->list), &iter) ) + { + do + { + GValue value = {0}; + struct variable *var = NULL; + GtkTreePath *path = gtk_tree_model_get_path (GTK_TREE_MODEL (vv->list), &iter); + + gtk_tree_model_get_value (GTK_TREE_MODEL (vv->list), &iter, column, &value); + + if ( G_VALUE_TYPE (&value) == PSPPIRE_VAR_PTR_TYPE) + var = g_value_get_boxed (&value); + else + g_critical ("Unsupported type \"%s\", in variable name treeview.", + G_VALUE_TYPE_NAME (&value)); + + g_value_unset (&value); + + g_string_append (string, " "); + g_string_append (string, var_get_name (var)); + + gtk_tree_path_free (path); + n_vars++; + } + while (gtk_tree_model_iter_next (GTK_TREE_MODEL (vv->list), &iter)); + } + + return n_vars; +} + + + diff --git a/src/ui/gui/psppire-var-view.h b/src/ui/gui/psppire-var-view.h new file mode 100644 index 00000000..9563cce4 --- /dev/null +++ b/src/ui/gui/psppire-var-view.h @@ -0,0 +1,66 @@ +/* PSPPIRE - a graphical user interface for PSPP. + Copyright (C) 2009 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 . */ + + +#ifndef __PSPPIRE_VAR_VIEW_H__ +#define __PSPPIRE_VAR_VIEW_H__ + + +#include +#include +#include + +G_BEGIN_DECLS + +#define PSPPIRE_VAR_VIEW_TYPE (psppire_var_view_get_type ()) +#define PSPPIRE_VAR_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PSPPIRE_VAR_VIEW_TYPE, PsppireVarView)) +#define PSPPIRE_VAR_VIEW_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + PSPPIRE_VAR_VIEW_TYPE, PsppireVarViewClass)) +#define PSPPIRE_IS_VAR_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + PSPPIRE_VAR_VIEW_TYPE)) +#define PSPPIRE_IS_VAR_VIEW_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + PSPPIRE_VAR_VIEW_TYPE)) + + +typedef struct _PsppireVarView PsppireVarView; +typedef struct _PsppireVarViewClass PsppireVarViewClass; + + + +struct _PsppireVarView +{ + GtkTreeView parent; + + GtkListStore *list; + + gint *nums; + +}; + +struct _PsppireVarViewClass +{ + GtkTreeViewClass parent_class; + +}; + +GType psppire_var_view_get_type (void); + +gint psppire_var_view_append_names (PsppireVarView *vv, gint column, GString *string); + + +G_END_DECLS + +#endif /* __PSPPIRE_VAR_VIEW_H__ */ diff --git a/src/ui/gui/psppire.ui b/src/ui/gui/psppire.ui index 99d9ed06..06e72fb1 100644 --- a/src/ui/gui/psppire.ui +++ b/src/ui/gui/psppire.ui @@ -299,7 +299,7 @@ never automatic - + True False @@ -342,6 +342,7 @@ False False 5 + True source-treeview variables-treeview @@ -552,7 +553,7 @@ never automatic - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK diff --git a/src/ui/gui/rank-dialog.c b/src/ui/gui/rank-dialog.c index 157f2136..aa81e23b 100644 --- a/src/ui/gui/rank-dialog.c +++ b/src/ui/gui/rank-dialog.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "executor.h" #include "gettext.h" @@ -110,7 +111,7 @@ generate_syntax (const struct rank_dialog *rd) GString *str = g_string_new ("RANK VARIABLES="); - append_variable_names (str, rd->dict, GTK_TREE_VIEW (rd->rank_vars), 0); + 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) @@ -120,7 +121,7 @@ generate_syntax (const struct rank_dialog *rd) { g_string_append (str, "\n\tBY "); - append_variable_names (str, rd->dict, GTK_TREE_VIEW (rd->group_vars), 0); + psppire_var_view_append_names (PSPPIRE_VAR_VIEW (rd->group_vars), 0, str); } g_string_append (str, "\n\t/PRINT = "); @@ -227,9 +228,6 @@ rank_dialog (GObject *o, gpointer data) GtkBuilder * builder = builder_new ("rank.ui"); GtkWidget *vars = get_widget_assert (builder, "dict-treeview"); - GtkWidget *selector1 = get_widget_assert (builder, "psppire-selector1"); - GtkWidget *selector2 = get_widget_assert (builder, "psppire-selector2"); - GtkWidget *types_button = get_widget_assert (builder, "button1"); GtkWidget *ties_button = get_widget_assert (builder, "button2"); @@ -308,19 +306,6 @@ rank_dialog (GObject *o, gpointer data) g_object_set (vars, "model", rd.dict, NULL); - set_dest_model (GTK_TREE_VIEW (rd.rank_vars), rd.dict); - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector1), - insert_source_row_into_tree_view, - NULL); - - set_dest_model (GTK_TREE_VIEW (rd.group_vars), rd.dict); - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector2), - insert_source_row_into_tree_view, - NULL); - - g_signal_connect (types_button, "clicked", G_CALLBACK (run_types_dialog), &rd); diff --git a/src/ui/gui/rank.ui b/src/ui/gui/rank.ui index 1b2a8245..b05ab450 100644 --- a/src/ui/gui/rank.ui +++ b/src/ui/gui/rank.ui @@ -72,7 +72,7 @@ automatic etched-in - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -119,7 +119,7 @@ automatic etched-in - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -163,6 +163,7 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 5 + True dict-treeview variables-treeview diff --git a/src/ui/gui/recode-dialog.c b/src/ui/gui/recode-dialog.c index 16a20cb1..2f0c332d 100644 --- a/src/ui/gui/recode-dialog.c +++ b/src/ui/gui/recode-dialog.c @@ -26,6 +26,8 @@ #include "executor.h" +#include "psppire-var-view.h" + #include #include @@ -887,14 +889,9 @@ recode_dialog (PsppireDataWindow *de, gboolean diff) gtk_window_set_transient_for (GTK_WINDOW (rd.dialog), GTK_WINDOW (de)); - g_object_set (rd.dict_treeview, "model", rd.dict, NULL); - if ( ! rd.different ) - { - set_dest_model (GTK_TREE_VIEW (rd.variable_treeview), rd.dict); - } - else + if (rd.different) { GtkTreeSelection *sel; GtkTreeViewColumn *col; @@ -905,7 +902,6 @@ recode_dialog (PsppireDataWindow *de, gboolean diff) G_TYPE_STRING); - gtk_tree_view_set_model (GTK_TREE_VIEW (rd.variable_treeview), GTK_TREE_MODEL (rd.var_map)); @@ -915,7 +911,7 @@ recode_dialog (PsppireDataWindow *de, gboolean diff) NULL); gtk_tree_view_column_set_cell_data_func (col, renderer, - cell_var_name, + XXX_cell_var_name, rd.dict, 0); @@ -949,12 +945,6 @@ recode_dialog (PsppireDataWindow *de, gboolean diff) G_CALLBACK (select_something), &rd); } - - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), - insert_source_row_into_tree_view, - NULL); - psppire_selector_set_allow (PSPPIRE_SELECTOR (selector), homogeneous_types); /* Set up the Old & New Values subdialog */ @@ -1273,7 +1263,6 @@ run_old_and_new_dialog (struct recode_dialog *rd) /* Find the type of the first variable (it's invariant that all variables are of the same type) */ const struct variable *v; - gint idx; GtkTreeIter iter; GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (rd->variable_treeview)); @@ -1282,9 +1271,7 @@ run_old_and_new_dialog (struct recode_dialog *rd) g_return_if_fail (not_empty); - gtk_tree_model_get (model, &iter, 0, &idx, -1); - - v = psppire_dict_get_variable (rd->dict, idx); + gtk_tree_model_get (model, &iter, 0, &v, -1); rd->input_var_is_string = var_is_alpha (v); @@ -1439,7 +1426,7 @@ generate_syntax (const struct recode_dialog *rd) g_string_append (str, "\nRECODE "); - append_variable_names (str, rd->dict, GTK_TREE_VIEW (rd->variable_treeview), 0); + psppire_var_view_append_names (PSPPIRE_VAR_VIEW (rd->variable_treeview), 0, str); g_string_append (str, "\n\t"); diff --git a/src/ui/gui/recode.ui b/src/ui/gui/recode.ui index 711a4eaf..c573dba0 100644 --- a/src/ui/gui/recode.ui +++ b/src/ui/gui/recode.ui @@ -942,7 +942,7 @@ automatic etched-in - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK diff --git a/src/ui/gui/regression-dialog.c b/src/ui/gui/regression-dialog.c index b52f0f7c..070d30a6 100644 --- a/src/ui/gui/regression-dialog.c +++ b/src/ui/gui/regression-dialog.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "gettext.h" @@ -157,9 +158,9 @@ generate_syntax (const struct regression_dialog *rd) GString *string = g_string_new ("REGRESSION"); g_string_append (string, "\n\t/VARIABLES="); - append_variable_names (string, rd->dict, GTK_TREE_VIEW (rd->indep_vars), 0); + psppire_var_view_append_names (PSPPIRE_VAR_VIEW (rd->indep_vars), 0, string); g_string_append (string, "\n\t/DEPENDENT=\t"); - append_variable_names (string, rd->dict, GTK_TREE_VIEW (rd->dep_vars), 0); + psppire_var_view_append_names (PSPPIRE_VAR_VIEW (rd->dep_vars), 0, string); selected = 0; for (i = 0, ok = gtk_tree_model_get_iter_first (rd->stat, &iter); ok; @@ -234,8 +235,6 @@ regression_dialog (GObject *o, gpointer data) GtkWidget *source = get_widget_assert (xml, "dict-view"); GtkWidget *dest_dep = get_widget_assert (xml, "dep-view"); GtkWidget *dest_indep = get_widget_assert (xml, "indep-view"); - GtkWidget *dep_selector = get_widget_assert (xml, "dep-selector"); - GtkWidget *indep_selector = get_widget_assert (xml, "indep-selector"); GtkWidget *stat_button = get_widget_assert (xml, "stat-button"); GtkWidget *save_button = get_widget_assert (xml, "save-button"); @@ -256,17 +255,6 @@ regression_dialog (GObject *o, gpointer data) g_object_get (vs, "dictionary", &rd.dict, NULL); g_object_set (source, "model", rd.dict, NULL); - set_dest_model (GTK_TREE_VIEW (dest_dep), rd.dict); - set_dest_model (GTK_TREE_VIEW (dest_indep), rd.dict); - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (dep_selector), - insert_source_row_into_tree_view, - NULL); - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (indep_selector), - insert_source_row_into_tree_view, - NULL); - rd.dep_vars = GTK_TREE_VIEW (dest_dep); rd.indep_vars = GTK_TREE_VIEW (dest_indep); diff --git a/src/ui/gui/regression.ui b/src/ui/gui/regression.ui index 437a1f6b..61561f35 100644 --- a/src/ui/gui/regression.ui +++ b/src/ui/gui/regression.ui @@ -138,7 +138,7 @@ automatic etched-in - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -183,7 +183,7 @@ automatic etched-in - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK diff --git a/src/ui/gui/reliability-dialog.c b/src/ui/gui/reliability-dialog.c index 3d661a5c..9831ab7f 100644 --- a/src/ui/gui/reliability-dialog.c +++ b/src/ui/gui/reliability-dialog.c @@ -24,6 +24,7 @@ #include "psppire-dialog.h" #include "psppire-data-window.h" +#include "psppire-var-view.h" #include "executor.h" #include "helper.h" @@ -121,8 +122,6 @@ reliability_dialog (GObject *o, gpointer data) GtkWidget *dialog = get_widget_assert (xml, "reliability-dialog"); GtkWidget *source = get_widget_assert (xml, "dict-view"); - GtkWidget *selector = get_widget_assert (xml, "psppire-selector1"); - rd.split_point_hbox = get_widget_assert (xml, "split-point-hbox"); rd.variables = get_widget_assert (xml, "treeview2"); @@ -140,12 +139,6 @@ reliability_dialog (GObject *o, gpointer data) g_object_get (vs, "dictionary", &rd.dict, NULL); g_object_set (source, "model", rd.dict, NULL); - set_dest_model (GTK_TREE_VIEW (rd.variables), rd.dict); - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), - insert_source_row_into_tree_view, - NULL); - { GtkTreeModel *tm = gtk_tree_view_get_model (GTK_TREE_VIEW (rd.variables)); @@ -203,7 +196,7 @@ generate_syntax (const struct reliability *rd) GString *string = g_string_new ("RELIABILITY"); g_string_append (string, "\n\t/VARIABLES="); - append_variable_names (string, rd->dict, GTK_TREE_VIEW (rd->variables), 0); + psppire_var_view_append_names (PSPPIRE_VAR_VIEW (rd->variables), 0, string); g_string_append (string, "\n\t/MODEL="); diff --git a/src/ui/gui/reliability.ui b/src/ui/gui/reliability.ui index 364ea893..25af6ca1 100644 --- a/src/ui/gui/reliability.ui +++ b/src/ui/gui/reliability.ui @@ -98,7 +98,7 @@ automatic etched-in - + True True False diff --git a/src/ui/gui/select-cases-dialog.c b/src/ui/gui/select-cases-dialog.c index 63061b1f..5b027825 100644 --- a/src/ui/gui/select-cases-dialog.c +++ b/src/ui/gui/select-cases-dialog.c @@ -331,14 +331,8 @@ select_cases_dialog (GObject *o, gpointer data) "selection-mode", GTK_SELECTION_SINGLE, NULL); - psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), - insert_source_row_into_entry, - NULL); - psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector), is_currently_in_entry); - - } diff --git a/src/ui/gui/sort-cases-dialog.c b/src/ui/gui/sort-cases-dialog.c index 337aaf05..22c53781 100644 --- a/src/ui/gui/sort-cases-dialog.c +++ b/src/ui/gui/sort-cases-dialog.c @@ -24,6 +24,7 @@ #include "dialog-common.h" #include "psppire-selector.h" #include "dict-display.h" +#include "psppire-var-view.h" #include #include "helper.h" @@ -40,7 +41,7 @@ refresh (PsppireDialog *dialog, GtkTreeView *dest) struct sort_cases_dialog { - GtkTreeView *tv; + PsppireVarView *tv; PsppireDict *dict; GtkToggleButton *ascending; }; @@ -50,7 +51,7 @@ static gboolean dialog_state_valid (gpointer data) { struct sort_cases_dialog *scd = data; - GtkTreeModel *model = gtk_tree_view_get_model (scd->tv); + GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (scd->tv)); gint n_rows = gtk_tree_model_iter_n_children (model, NULL); @@ -65,8 +66,8 @@ generate_syntax (const struct sort_cases_dialog *scd) { gchar *text; GString *string = g_string_new ("SORT CASES BY "); - gint n_vars = append_variable_names (string, - scd->dict, GTK_TREE_VIEW (scd->tv), 0); + + gint n_vars = psppire_var_view_append_names (scd->tv, 0, string); if ( n_vars == 0 ) g_string_assign (string, ""); @@ -102,9 +103,7 @@ sort_cases_dialog (GObject *o, gpointer data) 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"); - PsppireVarStore *vs = NULL; g_object_get (de->data_editor, "var-store", &vs, NULL); @@ -114,15 +113,9 @@ sort_cases_dialog (GObject *o, gpointer data) g_object_get (vs, "dictionary", &scd.dict, NULL); g_object_set (source, "model", scd.dict, NULL); - set_dest_model (GTK_TREE_VIEW (dest), scd.dict); - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), - insert_source_row_into_tree_view, - NULL); - g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), dest); - scd.tv = GTK_TREE_VIEW (dest); + scd.tv = PSPPIRE_VAR_VIEW (dest); scd.ascending = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "sort-cases-radiobutton0")); diff --git a/src/ui/gui/sort.ui b/src/ui/gui/sort.ui index b80affaf..19f8b719 100644 --- a/src/ui/gui/sort.ui +++ b/src/ui/gui/sort.ui @@ -92,7 +92,7 @@ automatic etched-in - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK diff --git a/src/ui/gui/split-file-dialog.c b/src/ui/gui/split-file-dialog.c index 3546f844..cb226d9f 100644 --- a/src/ui/gui/split-file-dialog.c +++ b/src/ui/gui/split-file-dialog.c @@ -26,6 +26,8 @@ #include "helper.h" #include +#include "psppire-var-view.h" + #include @@ -68,8 +70,7 @@ generate_syntax (const struct split_file_dialog *sfd) 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 = append_variable_names (varlist, - sfd->dict, GTK_TREE_VIEW (vars), 0); + gint n_vars = psppire_var_view_append_names (PSPPIRE_VAR_VIEW (vars), 0, varlist); if ( n_vars > 0 ) { @@ -195,12 +196,6 @@ split_file_dialog (GObject *o, gpointer data) g_signal_connect (on_off, "toggled", G_CALLBACK(on_off_toggled), sfd.xml); - set_dest_model (GTK_TREE_VIEW (dest), sfd.dict); - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), - insert_source_row_into_tree_view, - NULL); - g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), &sfd); gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de)); diff --git a/src/ui/gui/t-test-independent-samples-dialog.c b/src/ui/gui/t-test-independent-samples-dialog.c index 473e04e0..90c5ab54 100644 --- a/src/ui/gui/t-test-independent-samples-dialog.c +++ b/src/ui/gui/t-test-independent-samples-dialog.c @@ -21,6 +21,7 @@ #include "t-test-independent-samples-dialog.h" #include "psppire-dict.h" #include "psppire-var-store.h" +#include "psppire-var-view.h" #include "executor.h" #include "psppire-data-window.h" #include "psppire-dialog.h" @@ -160,7 +161,7 @@ generate_syntax (const struct tt_indep_samples_dialog *d) GString *str = g_string_new ("T-TEST /VARIABLES="); - append_variable_names (str, d->dict, GTK_TREE_VIEW (tv), 0); + psppire_var_view_append_names (PSPPIRE_VAR_VIEW (tv), 0, str); g_string_append (str, "\n\t/GROUPS="); @@ -400,9 +401,6 @@ t_test_independent_samples_dialog (GObject *o, gpointer data) GtkWidget *dict_view = get_widget_assert (xml, "indep-samples-t-test-treeview1"); - GtkWidget *test_variables_treeview = - get_widget_assert (xml, "indep-samples-t-test-treeview2"); - GtkWidget *selector2 = get_widget_assert (xml, "indep-samples-t-test-selector2"); @@ -428,21 +426,10 @@ t_test_independent_samples_dialog (GObject *o, gpointer data) g_object_set (dict_view, "model", tt_d.dict, NULL); - set_dest_model (GTK_TREE_VIEW (test_variables_treeview), tt_d.dict); - - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector1), - insert_source_row_into_tree_view, - NULL); - psppire_selector_set_allow (PSPPIRE_SELECTOR (selector1), numeric_only); - psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector2), - insert_source_row_into_entry, - NULL); - psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector2), is_currently_in_entry); diff --git a/src/ui/gui/t-test-one-sample.c b/src/ui/gui/t-test-one-sample.c index 1161db5b..9301b2c3 100644 --- a/src/ui/gui/t-test-one-sample.c +++ b/src/ui/gui/t-test-one-sample.c @@ -21,6 +21,7 @@ #include "t-test-one-sample.h" #include "psppire-dict.h" #include "psppire-var-store.h" +#include "psppire-var-view.h" #include "helper.h" #include "psppire-data-window.h" #include "psppire-dialog.h" @@ -58,7 +59,7 @@ generate_syntax (const struct tt_one_sample_dialog *d) g_string_append (str, "\n\t/VARIABLES="); - append_variable_names (str, d->dict, GTK_TREE_VIEW (d->vars_treeview), 0); + psppire_var_view_append_names (PSPPIRE_VAR_VIEW (d->vars_treeview), 0, str); tt_options_dialog_append_syntax (d->opt, str); @@ -135,8 +136,6 @@ t_test_one_sample_dialog (GObject *o, gpointer data) GtkWidget *options_button = get_widget_assert (xml, "button1"); - GtkWidget *selector = get_widget_assert (xml, "psppire-selector1"); - GtkWidget *dialog = get_widget_assert (xml, "t-test-one-sample-dialog"); g_object_get (de->data_editor, "var-store", &vs, NULL); @@ -153,14 +152,6 @@ t_test_one_sample_dialog (GObject *o, gpointer data) "predicate", var_is_numeric, NULL); - set_dest_model (GTK_TREE_VIEW (tt_d.vars_treeview), tt_d.dict); - - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), - insert_source_row_into_tree_view, - NULL); - - g_signal_connect_swapped (dialog, "refresh", G_CALLBACK (refresh), &tt_d); diff --git a/src/ui/gui/t-test-paired-samples.c b/src/ui/gui/t-test-paired-samples.c index a021ce2c..68b45fcb 100644 --- a/src/ui/gui/t-test-paired-samples.c +++ b/src/ui/gui/t-test-paired-samples.c @@ -21,6 +21,7 @@ #include "psppire-data-window.h" #include "psppire-selector.h" +#include "psppire-var-view.h" #include "psppire-dict.h" #include "psppire-var-store.h" @@ -56,11 +57,11 @@ generate_syntax (const struct tt_paired_samples_dialog *d) gchar *text = NULL; GString *str = g_string_new ("T-TEST \n\tPAIRS = "); - append_variable_names (str, d->dict, GTK_TREE_VIEW (d->pairs_treeview), 0); + psppire_var_view_append_names (PSPPIRE_VAR_VIEW (d->pairs_treeview), 0, str); g_string_append (str, " WITH "); - append_variable_names (str, d->dict, GTK_TREE_VIEW (d->pairs_treeview), 1); + psppire_var_view_append_names (PSPPIRE_VAR_VIEW (d->pairs_treeview), 1, str); g_string_append (str, " (PAIRED)"); g_string_append (str, "\n"); @@ -151,7 +152,7 @@ select_as_pair_member (GtkTreeIter source_iter, } } - +#if 0 /* Append a new column to TV at position C, and heading TITLE */ static void add_new_column (GtkTreeView *tv, const gchar *title, gint c) @@ -175,6 +176,8 @@ add_new_column (GtkTreeView *tv, const gchar *title, gint c) gtk_tree_view_column_add_attribute (col, renderer, "text", c); } +#endif + /* Pops up the dialog box */ void @@ -211,22 +214,8 @@ t_test_paired_samples_dialog (GObject *o, gpointer data) "predicate", var_is_numeric, NULL); - { - tt_d.list_store = - GTK_TREE_MODEL ( - gtk_list_store_new (2, - PSPPIRE_VAR_PTR_TYPE, - PSPPIRE_VAR_PTR_TYPE)); - - - gtk_tree_view_set_model (GTK_TREE_VIEW (tt_d.pairs_treeview), - GTK_TREE_MODEL (tt_d.list_store)); - - - add_new_column (GTK_TREE_VIEW (tt_d.pairs_treeview), _("Var 1"), 0); - add_new_column (GTK_TREE_VIEW (tt_d.pairs_treeview), _("Var 2"), 1); - } - + + tt_d.list_store = gtk_tree_view_get_model (GTK_TREE_VIEW (tt_d.pairs_treeview)); psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), select_as_pair_member, diff --git a/src/ui/gui/t-test.ui b/src/ui/gui/t-test.ui index 48ac0940..d8c25113 100644 --- a/src/ui/gui/t-test.ui +++ b/src/ui/gui/t-test.ui @@ -145,7 +145,7 @@ automatic etched-in - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -566,7 +566,7 @@ automatic etched-in - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -780,15 +780,16 @@ True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - never + always automatic etched-in - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK False + 2 diff --git a/src/ui/gui/transpose-dialog.c b/src/ui/gui/transpose-dialog.c index 2bc7e7b3..0061193e 100644 --- a/src/ui/gui/transpose-dialog.c +++ b/src/ui/gui/transpose-dialog.c @@ -18,6 +18,7 @@ #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" @@ -88,8 +89,6 @@ transpose_dialog (GObject *o, gpointer data) GtkWidget *dialog = get_widget_assert (xml, "transpose-dialog"); GtkWidget *source = get_widget_assert (xml, "source-treeview"); - GtkWidget *dest = get_widget_assert (xml, "variables-treeview"); - GtkWidget *selector1 = get_widget_assert (xml, "psppire-selector2"); GtkWidget *selector2 = get_widget_assert (xml, "psppire-selector3"); g_object_get (de->data_editor, "var-store", &vs, NULL); @@ -97,17 +96,6 @@ transpose_dialog (GObject *o, gpointer data) g_object_get (vs, "dictionary", &dict, NULL); g_object_set (source, "model", dict, NULL); - set_dest_model (GTK_TREE_VIEW (dest), dict); - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector1), - insert_source_row_into_tree_view, - NULL); - - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector2), - insert_source_row_into_entry, - NULL); - psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector2), is_currently_in_entry); @@ -164,7 +152,7 @@ generate_syntax (PsppireDict *dict, GtkBuilder *xml) g_string_append (string, " /VARIABLES = "); - append_variable_names (string, dict, GTK_TREE_VIEW (dest), 0); + psppire_var_view_append_names (PSPPIRE_VAR_VIEW (dest), 0, string); text = gtk_entry_get_text (GTK_ENTRY (entry)); diff --git a/src/ui/gui/weight-cases-dialog.c b/src/ui/gui/weight-cases-dialog.c index 1871f7aa..40951360 100644 --- a/src/ui/gui/weight-cases-dialog.c +++ b/src/ui/gui/weight-cases-dialog.c @@ -137,10 +137,6 @@ weight_cases_dialog (GObject *o, gpointer data) "predicate", var_is_numeric, NULL); - psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), - insert_source_row_into_entry, - NULL); - psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector), is_currently_in_entry); diff --git a/src/ui/gui/widgets.c b/src/ui/gui/widgets.c index 979224fe..a1a55d14 100644 --- a/src/ui/gui/widgets.c +++ b/src/ui/gui/widgets.c @@ -10,6 +10,7 @@ #include "psppire-keypad.h" #include "psppire-acr.h" #include "psppire-dictview.h" +#include "psppire-var-view.h" /* Any custom widgets which are to be used in GtkBuilder ui files @@ -25,4 +26,5 @@ preregister_widgets (void) psppire_keypad_get_type (); psppire_acr_get_type (); psppire_dict_view_get_type (); + psppire_var_view_get_type (); }