X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-dialog-action-factor.c;h=de33c5c5fa5a3573c89219e06d36c5fde576c1ad;hb=c8f16e229dede3bf3ec30c329cccc6924778553a;hp=2c6b3e63b3882dbebe273838e1e2cfc84ce94d41;hpb=374a86a6b6ebcb7a18e589f37bda90797f417dac;p=pspp diff --git a/src/ui/gui/psppire-dialog-action-factor.c b/src/ui/gui/psppire-dialog-action-factor.c index 2c6b3e63b3..de33c5c5fa 100644 --- a/src/ui/gui/psppire-dialog-action-factor.c +++ b/src/ui/gui/psppire-dialog-action-factor.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation + Copyright (C) 2009, 2010, 2011, 2012, 2014 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 @@ -19,6 +19,8 @@ #include "psppire-dialog-action-factor.h" +#include + #include "psppire-var-view.h" #include "dialog-common.h" #include "psppire-selector.h" @@ -71,7 +73,8 @@ generate_syntax (PsppireDialogAction *act) if ( rd->extraction.explicit_nfactors ) ds_put_c_format (&str, "FACTORS (%d)", rd->extraction.n_factors); else - ds_put_c_format (&str, "MINEIGEN (%g)", rd->extraction.mineigen); + ds_put_c_format (&str, "MINEIGEN (%.*g)", + DBL_DIG + 1, rd->extraction.mineigen); /* The CRITERIA = ITERATE subcommand is overloaded. @@ -298,77 +301,82 @@ psppire_dialog_action_factor_activate (GtkAction *a) GtkWidget *extraction_button ; GtkWidget *rotation_button ; - GtkBuilder *xml = builder_new ("factor.ui"); + GHashTable *thing = psppire_dialog_action_get_pointer (pda); + GtkBuilder *xml = g_hash_table_lookup (thing, a); + if (!xml) + { + xml = builder_new ("factor.ui"); + g_hash_table_insert (thing, a, xml); - pda->dialog = get_widget_assert (xml, "factor-dialog"); - pda->source = get_widget_assert (xml, "dict-view"); - extraction_button = get_widget_assert (xml, "button-extractions"); - rotation_button = get_widget_assert (xml, "button-rotations"); + pda->dialog = get_widget_assert (xml, "factor-dialog"); + pda->source = get_widget_assert (xml, "dict-view"); - act->extraction_dialog = get_widget_assert (xml, "extractions-dialog"); - act->rotation_dialog = get_widget_assert (xml, "rotations-dialog"); + extraction_button = get_widget_assert (xml, "button-extractions"); + rotation_button = get_widget_assert (xml, "button-rotations"); - act->variables = get_widget_assert (xml, "psppire-var-view1"); + act->extraction_dialog = get_widget_assert (xml, "extractions-dialog"); + act->rotation_dialog = get_widget_assert (xml, "rotations-dialog"); - { - GtkWidget *hbox = get_widget_assert (xml, "hbox6"); - GtkWidget *eigenvalue_extraction ; + act->variables = get_widget_assert (xml, "psppire-var-view1"); - act->mineigen_toggle = get_widget_assert (xml, "mineigen-radiobutton"); + { + GtkWidget *hbox = get_widget_assert (xml, "hbox6"); + GtkWidget *eigenvalue_extraction ; - eigenvalue_extraction = psppire_scanf_new (_("_Eigenvalues over %4.2f times the mean eigenvalue"), &act->mineigen); + act->mineigen_toggle = get_widget_assert (xml, "mineigen-radiobutton"); - g_object_set (eigenvalue_extraction, - "use-underline", TRUE, - "mnemonic-widget", act->mineigen_toggle, - NULL); + eigenvalue_extraction = psppire_scanf_new (_("_Eigenvalues over %4.2f times the mean eigenvalue"), &act->mineigen); - act->nfactors_toggle = get_widget_assert (xml, "nfactors-radiobutton"); - act->n_factors = get_widget_assert (xml, "spinbutton-nfactors"); - act->extract_iterations = get_widget_assert (xml, "spinbutton-extract-iterations"); - act->covariance_toggle = get_widget_assert (xml, "covariance-radiobutton"); - act->correlation_toggle = get_widget_assert (xml, "correlations-radiobutton"); + g_object_set (eigenvalue_extraction, + "use-underline", TRUE, + "mnemonic-widget", act->mineigen_toggle, + NULL); - act->scree_button = get_widget_assert (xml, "scree-button"); - act->unrotated_button = get_widget_assert (xml, "unrotated-button"); - act->extraction_combo = get_widget_assert (xml, "combobox1"); + act->nfactors_toggle = get_widget_assert (xml, "nfactors-radiobutton"); + act->n_factors = get_widget_assert (xml, "spinbutton-nfactors"); + act->extract_iterations = get_widget_assert (xml, "spinbutton-extract-iterations"); + act->covariance_toggle = get_widget_assert (xml, "covariance-radiobutton"); + act->correlation_toggle = get_widget_assert (xml, "correlations-radiobutton"); - gtk_container_add (GTK_CONTAINER (hbox), eigenvalue_extraction); + act->scree_button = get_widget_assert (xml, "scree-button"); + act->unrotated_button = get_widget_assert (xml, "unrotated-button"); + act->extraction_combo = get_widget_assert (xml, "combobox1"); - g_signal_connect (act->nfactors_toggle, "toggled", G_CALLBACK (on_extract_toggle), act); + gtk_container_add (GTK_CONTAINER (hbox), eigenvalue_extraction); - gtk_widget_show_all (eigenvalue_extraction); - } + g_signal_connect (act->nfactors_toggle, "toggled", G_CALLBACK (on_extract_toggle), act); - { - act->rotate_iterations = get_widget_assert (xml, "spinbutton-rot-iterations"); + gtk_widget_show_all (eigenvalue_extraction); + } - act->display_rotated_solution = get_widget_assert (xml, "checkbutton-rotated-solution"); + { + act->rotate_iterations = get_widget_assert (xml, "spinbutton-rot-iterations"); - act->rotation_none = get_widget_assert (xml, "radiobutton-none"); - act->rotation_varimax = get_widget_assert (xml, "radiobutton-varimax"); - act->rotation_quartimax = get_widget_assert (xml, "radiobutton-quartimax"); - act->rotation_equimax = get_widget_assert (xml, "radiobutton-equimax"); - } + act->display_rotated_solution = get_widget_assert (xml, "checkbutton-rotated-solution"); - g_signal_connect_swapped (extraction_button, "clicked", - G_CALLBACK (run_extractions_subdialog), act); - g_signal_connect_swapped (rotation_button, "clicked", G_CALLBACK (run_rotations_subdialog), act); + act->rotation_none = get_widget_assert (xml, "radiobutton-none"); + act->rotation_varimax = get_widget_assert (xml, "radiobutton-varimax"); + act->rotation_quartimax = get_widget_assert (xml, "radiobutton-quartimax"); + act->rotation_equimax = get_widget_assert (xml, "radiobutton-equimax"); + } + g_signal_connect_swapped (extraction_button, "clicked", + G_CALLBACK (run_extractions_subdialog), act); + g_signal_connect_swapped (rotation_button, "clicked", G_CALLBACK (run_rotations_subdialog), act); + + } 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_factor_parent_class)->activate (pda); - - g_object_unref (xml); } static void psppire_dialog_action_factor_class_init (PsppireDialogActionFactorClass *class) { - GTK_ACTION_CLASS (class)->activate = psppire_dialog_action_factor_activate; + psppire_dialog_action_set_activation (class, psppire_dialog_action_factor_activate); PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; }