Commit 9a9dacc0 authored by Andreas J. Guelzow 's avatar Andreas J. Guelzow

Fix spin button handling in various tool dialogs. [#619971]

2010-05-31 Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* tool-dialogs.h (tool_setup_update): new
	* dialog-analysis-tool-chi-squared.c (dialog_chi_square_tool):
	  use tool_setup_update
	* dialog-analysis-tool-frequency.c (dialog_frequency_tool):
	  ditto
	* dialog-analysis-tool-normality.c (dialog_normality_tool):
	  ditto
	* dialog-analysis-tool-sign-test.c (dialog_sign_test_two_tool):
	  ditto
	(dialog_sign_test_tool): ditto
	* dialog-analysis-tools.c (tool_setup_update): new
parent 4e13534f
Gnumeric 1.10.6
Andreas:
* Add Wilcoxon Signed Rank Test tools for one and two populations.
* Add Wilcoxon Signed Rank Test tools for one and two populations.
* Fix spin button handling in various tool dialogs. [#619971]
Morten:
* Make sure windows for help commands show up on right screen.
......
2010-05-31 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* tool-dialogs.h (tool_setup_update): new
* dialog-analysis-tool-chi-squared.c (dialog_chi_square_tool):
use tool_setup_update
* dialog-analysis-tool-frequency.c (dialog_frequency_tool):
ditto
* dialog-analysis-tool-normality.c (dialog_normality_tool):
ditto
* dialog-analysis-tool-sign-test.c (dialog_sign_test_two_tool):
ditto
(dialog_sign_test_tool): ditto
* dialog-analysis-tools.c (tool_setup_update): new
2010-05-31 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* dialogs.h (dialog_sign_test_two_tool): new
......
......@@ -228,21 +228,21 @@ dialog_chi_square_tool (WBCGtk *wbcg, Sheet *sheet, gboolean independence)
type ="test-of-independence";
else
type ="test-of-homogeneity";
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (glade_xml_get_widget (state->base.gui, type)),
TRUE);
state->label = glade_xml_get_widget (state->base.gui,
"labels_button");
g_signal_connect_after (G_OBJECT (state->label),
"toggled",
G_CALLBACK (chi_squared_tool_update_sensitivity_cb), state);
state->alpha_entry = glade_xml_get_widget (state->base.gui,
"alpha-entry");
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (glade_xml_get_widget (state->base.gui,
type)),
TRUE);
state->label = tool_setup_update
(&state->base, "labels_button",
G_CALLBACK (chi_squared_tool_update_sensitivity_cb),
state);
state->alpha_entry = tool_setup_update
(&state->base, "alpha-entry",
G_CALLBACK (chi_squared_tool_update_sensitivity_cb),
state);
float_to_entry (GTK_ENTRY (state->alpha_entry), 0.05);
g_signal_connect_after (G_OBJECT (state->alpha_entry),
"changed",
G_CALLBACK (chi_squared_tool_update_sensitivity_cb), state);
gnumeric_editable_enters (GTK_WINDOW (state->base.dialog),
GTK_WIDGET (state->alpha_entry));
gnm_dao_set_put (GNM_DAO (state->base.gdao), TRUE, TRUE);
chi_squared_tool_update_sensitivity_cb (NULL, state);
......
......@@ -262,24 +262,21 @@ dialog_frequency_tool (WBCGtk *wbcg, Sheet *sheet)
0))
return 0;
state->predetermined_button = GTK_WIDGET (glade_xml_get_widget
(state->base.gui,
"pre_determined_button"));
state->calculated_button = GTK_WIDGET (glade_xml_get_widget
(state->base.gui,
"calculated_button"));
state->n_entry = GTK_ENTRY(glade_xml_get_widget (state->base.gui,
"n_entry"));
g_signal_connect_after (G_OBJECT (state->predetermined_button),
"toggled",
G_CALLBACK (frequency_tool_update_sensitivity_cb), state);
g_signal_connect_after (G_OBJECT (state->calculated_button),
"toggled",
G_CALLBACK (frequency_tool_update_sensitivity_cb), state);
g_signal_connect_after (G_OBJECT (state->n_entry),
"changed",
G_CALLBACK (frequency_tool_update_sensitivity_cb), state);
state->predetermined_button = tool_setup_update
(&state->base, "pre_determined_button",
G_CALLBACK (frequency_tool_update_sensitivity_cb),
state);
state->calculated_button = tool_setup_update
(&state->base, "calculated_button",
G_CALLBACK (frequency_tool_update_sensitivity_cb),
state);
state->n_entry =
GTK_ENTRY(tool_setup_update
(&state->base, "n_entry",
G_CALLBACK (frequency_tool_update_sensitivity_cb),
state));
g_signal_connect (G_OBJECT (state->n_entry),
"key-press-event",
G_CALLBACK (frequency_tool_set_calculated), state);
......
......@@ -206,14 +206,12 @@ dialog_normality_tool (WBCGtk *wbcg, Sheet *sheet)
return 0;
state->alpha_entry = glade_xml_get_widget (state->base.gui,
"alpha-entry");
state->alpha_entry = tool_setup_update
(&state->base, "alpha-entry",
G_CALLBACK (normality_tool_update_sensitivity_cb),
state);
float_to_entry (GTK_ENTRY (state->alpha_entry), 0.05);
g_signal_connect_after (G_OBJECT (state->alpha_entry),
"changed",
G_CALLBACK (normality_tool_update_sensitivity_cb), state);
gnumeric_editable_enters (GTK_WINDOW (state->base.dialog),
GTK_WIDGET (state->alpha_entry));
gnm_dao_set_put (GNM_DAO (state->base.gdao), TRUE, TRUE);
normality_tool_update_sensitivity_cb (NULL, state);
......
......@@ -266,27 +266,21 @@ dialog_sign_test_two_tool (WBCGtk *wbcg, Sheet *sheet, signtest_type type)
return 0;
state->alpha_entry = glade_xml_get_widget (state->base.gui,
"alpha-entry");
state->alpha_entry = tool_setup_update
(&state->base, "alpha-entry",
G_CALLBACK (sign_test_two_tool_update_sensitivity_cb),
state);
float_to_entry (GTK_ENTRY (state->alpha_entry), 0.05);
g_signal_connect (G_OBJECT (state->alpha_entry),
"value-changed",
G_CALLBACK (sign_test_two_tool_update_sensitivity_cb),
state);
gnumeric_editable_enters (GTK_WINDOW (state->base.dialog),
GTK_WIDGET (state->alpha_entry));
state->median_entry = glade_xml_get_widget (state->base.gui,
"median-entry");
state->median_entry = tool_setup_update
(&state->base, "median-entry",
G_CALLBACK (sign_test_two_tool_update_sensitivity_cb),
state);
int_to_entry (GTK_ENTRY (state->median_entry), 0);
g_signal_connect_after (G_OBJECT (state->median_entry),
"changed",
G_CALLBACK (sign_test_two_tool_update_sensitivity_cb),
state);
gnumeric_editable_enters (GTK_WINDOW (state->base.dialog),
GTK_WIDGET (state->median_entry));
w = glade_xml_get_widget (state->base.gui,
(type == SIGNTEST) ? "signtest" : "signedranktest");
(type == SIGNTEST) ? "signtest"
: "signedranktest");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), TRUE);
gnm_dao_set_put (GNM_DAO (state->base.gdao), TRUE, TRUE);
......@@ -417,26 +411,21 @@ dialog_sign_test_tool (WBCGtk *wbcg, Sheet *sheet, signtest_type type)
return 0;
state->alpha_entry = glade_xml_get_widget (state->base.gui,
"alpha-entry");
float_to_entry (GTK_ENTRY (state->alpha_entry), 0.05);
g_signal_connect (G_OBJECT (state->alpha_entry),
"value-changed",
G_CALLBACK (sign_test_tool_update_sensitivity_cb),
state);
gnumeric_editable_enters (GTK_WINDOW (state->base.dialog),
GTK_WIDGET (state->alpha_entry));
state->median_entry = glade_xml_get_widget (state->base.gui,
"median-entry");
state->alpha_entry = tool_setup_update
(&state->base, "alpha-entry",
G_CALLBACK (sign_test_two_tool_update_sensitivity_cb),
state);
state->median_entry = tool_setup_update
(&state->base, "median-entry",
G_CALLBACK (sign_test_two_tool_update_sensitivity_cb),
state);
int_to_entry (GTK_ENTRY (state->median_entry), 0);
g_signal_connect_after (G_OBJECT (state->median_entry),
"changed", G_CALLBACK (sign_test_tool_update_sensitivity_cb),
state);
gnumeric_editable_enters (GTK_WINDOW (state->base.dialog),
GTK_WIDGET (state->median_entry));
float_to_entry (GTK_ENTRY (state->alpha_entry), 0.05);
w = glade_xml_get_widget (state->base.gui,
(type == SIGNTEST) ? "signtest" : "signedranktest");
(type == SIGNTEST) ? "signtest"
: "signedranktest");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), TRUE);
gnm_dao_set_put (GNM_DAO (state->base.gdao), TRUE, TRUE);
......
......@@ -529,6 +529,28 @@ tool_load_selection (GenericToolState *state, gboolean allow_multiple)
FALSE);
}
GtkWidget *
tool_setup_update (GenericToolState* state, char const *name, GCallback cb,
gpointer closure)
{
GtkWidget *w = glade_xml_get_widget (state->gui, name);
if (GTK_IS_SPIN_BUTTON (w)) {
g_signal_connect_after (w, "value-changed", cb, closure);
gnumeric_editable_enters (GTK_WINDOW (state->dialog), w);
} else if (GTK_IS_ENTRY (w)) {
g_signal_connect_after (w, "changed", cb, closure);
gnumeric_editable_enters (GTK_WINDOW (state->dialog), w);
} else if (GTK_IS_TOGGLE_BUTTON (w))
g_signal_connect_after (w, "toggled", cb, closure);
else
g_warning ("tool_setup_update called with unknown type");
return w;
}
/**********************************************/
/* Generic functions for the analysis tools */
/* Functions in this section are being used */
......
......@@ -65,4 +65,9 @@ gboolean dialog_tool_init (GenericToolState *state,
GCallback sensitivity_cb,
GnmExprEntryFlags flags);
GtkWidget *tool_setup_update (GenericToolState* state,
char const *name,
GCallback cb,
gpointer closure);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment