Commit 3404218e authored by Andreas J. Guelzow 's avatar Andreas J. Guelzow Committed by Andreas J. Guelzow

new new new added frequency.glade and dialog-analysis-tool-frequency.c new

2008-10-12  Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* frequency.glade: new
	* dialog-analysis-tool-frequency.c: new
	* dialogs.h (dialog_frequency_tool): new
	* Makefile.am: added frequency.glade and 
	  dialog-analysis-tool-frequency.c
	* help.h (GNUMERIC_HELP_LINK_FREQUENCY): new

2008-10-12  Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* analysis-tools.h (set_cell_text_col): new
	* analysis-tools.c (set_cell_text_col): make non-static
	* analysis-frequency.[ch]: new
	* Makefile.am: added analysis-frequency.[ch]

2008-10-12  Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* component/Gnumeric-embed.xml.in: added frequency tool menu item
	* src/GNOME_Gnumeric-gtk.xml.in: ditto
	* src/HILDON_Gnumeric-gtk.xml.in: ditto
	* src/wbc-gtk-actions.c: added ToolsFrequency

2008-10-12  Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* POTFILES.in: added src/tools/analysis-frequency.c and 
	  src/dialogs/dialog-analysis-tool-frequency.c




svn path=/trunk/; revision=16876
parent 5b06139f
2008-10-12 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* component/Gnumeric-embed.xml.in: added frequency tool menu item
* src/GNOME_Gnumeric-gtk.xml.in: ditto
* src/HILDON_Gnumeric-gtk.xml.in: ditto
* src/wbc-gtk-actions.c: added ToolsFrequency
2008-10-10 Jody Goldberg <jody@gnome.org>
* src/gnm-pane.c (cb_gnm_pane_preedit_changed) :
......
......@@ -25,6 +25,7 @@ Andreas:
* Added multiplicative Holt-Winters exponential smoothing.
* Fix minor bugs. [#554818] [#553342]
* Update some of the analysis tools documentation.
* Add non-numeric frequency tables tool. [#134166]
Jean:
* Fix printing of rotated text. [#539734]
......
......@@ -169,7 +169,10 @@
<menuitem action="ToolsAverage"/>
</menu>
<menuitem action="ToolsFourier"/>
<menuitem action="ToolsHistogram"/>
<menu name="ToolForecast" action="MenuToolFrequencies">
<menuitem action="ToolsFrequency"/>
<menuitem action="ToolsHistogram"/>
</menu>
<menuitem action="ToolsRanking"/>
<menuitem action="ToolsRegression"/>
<menuitem action="ToolsSampling"/>
......
2008-10-12 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* POTFILES.in: added src/tools/analysis-frequency.c and
src/dialogs/dialog-analysis-tool-frequency.c
2008-10-12 Jorge Gonzalez <jorgegonz@svn.gnome.org>
* es.po: Updated Spanish translation
......
......@@ -141,6 +141,7 @@ src/dialogs/delete-cells.glade
src/dialogs/descriptive-stats.glade
src/dialogs/dialog-about.c
src/dialogs/dialog-advanced-filter.c
src/dialogs/dialog-analysis-tool-frequency.c
src/dialogs/dialog-analysis-tools.c
src/dialogs/dialog-autocorrect.c
src/dialogs/dialog-autofilter.c
......@@ -295,6 +296,7 @@ src/stf.c
src/style.c
src/test-pango.c
src/tools/analysis-exp-smoothing.c
src/tools/analysis-frequency.c
src/tools/analysis-histogram.c
src/tools/analysis-tools.c
src/tools/dao.c
......
......@@ -173,7 +173,10 @@
<menuitem action="ToolsAverage"/>
</menu>
<menuitem action="ToolsFourier"/>
<menuitem action="ToolsHistogram"/>
<menu name="ToolFrequencies" action="MenuToolFrequencies">
<menuitem action="ToolsFrequency"/>
<menuitem action="ToolsHistogram"/>
</menu>
<menuitem action="ToolsRanking"/>
<menuitem action="ToolsRegression"/>
<menuitem action="ToolsSampling"/>
......
......@@ -178,8 +178,11 @@
<menuitem action="ToolsAverage"/>
</menu>
<menuitem action="ToolsFourier"/>
<menuitem action="ToolsHistogram"/>
<menuitem action="ToolsRanking"/>
<menu name="ToolFrequencies" action="MenuToolFrequencies">
<menuitem action="ToolsFrequency"/>
<menuitem action="ToolsHistogram"/>
</menu>
<menuitem action="ToolsRanking"/>
<menuitem action="ToolsRegression"/>
<menuitem action="ToolsSampling"/>
<menu name="ToolTTest" action="MenuToolTTest">
......
2008-10-12 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* frequency.glade: new
* dialog-analysis-tool-frequency.c: new
* dialogs.h (dialog_frequency_tool): new
* Makefile.am: added frequency.glade and
dialog-analysis-tool-frequency.c
* help.h (GNUMERIC_HELP_LINK_FREQUENCY): new
2008-10-03 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* dialog-analysis-tools.c (exp_smoothing_*_cb): adjust sensitivity
......
......@@ -26,6 +26,7 @@ base_files = \
dialog-about.c \
dialog-advanced-filter.c \
dialog-analysis-tools.c \
dialog-analysis-tool-frequency.c \
dialog-autocorrect.c \
dialog-autofilter.c \
dialog-autoformat.c \
......@@ -115,6 +116,7 @@ glade_DATA = \
font-sel.glade \
formula-guru.glade \
fourier-analysis.glade \
frequency.glade \
function-select.glade \
goalseek.glade \
goto.glade \
......
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* dialog-analysis-tool-frequency.c:
*
* Authors:
* Andreas J. Guelzow <aguelzow@taliesin.ca>
*
* (C) Copyright 2008 by Andreas J. Guelzow <aguelzow@pyrshep.ca>
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gnumeric-config.h>
#include <glib/gi18n-lib.h>
#include <gnumeric.h>
#include "dialogs.h"
#include "analysis-frequency.h"
#include "analysis-tools.h"
#include <workbook.h>
#include <workbook-control.h>
#include <wbc-gtk.h>
#include <workbook-view.h>
#include <gui-util.h>
#include <parse-util.h>
#include <gnm-format.h>
#include <tool-dialogs.h>
#include <dao-gui-utils.h>
#include <sheet.h>
#include <expr.h>
#include <number-match.h>
#include <ranges.h>
#include <selection.h>
#include <value.h>
#include <commands.h>
#include "help.h"
#include <widgets/gnm-dao.h>
#include <widgets/gnumeric-expr-entry.h>
#include <glade/glade.h>
#include <string.h>
#include <gtk/gtktable.h>
#include <gtk/gtktogglebutton.h>
#include <gtk/gtkspinbutton.h>
#include <gtk/gtklabel.h>
#define FREQUENCY_KEY "analysistools-frequency-dialog"
static char const * const grouped_by_group[] = {
"grouped_by_row",
"grouped_by_col",
NULL
};
static char const * const chart_group[] = {
"nochart-button",
"barchart-button",
"columnchart-button",
NULL
};
typedef struct {
GenericToolState base;
GtkWidget *predetermined_button;
GtkWidget *calculated_button;
GtkEntry *n_entry;
} FrequencyToolState;
/**
* frequency_tool_update_sensitivity_cb:
* @dummy:
* @state:
*
* Update the dialog widgets sensitivity
**/
static void
frequency_tool_update_sensitivity_cb (G_GNUC_UNUSED GtkWidget *dummy,
FrequencyToolState *state)
{
int the_n;
gboolean predetermined_bins;
GSList *input_range;
GnmValue *input_range_2 = NULL;
input_range = gnm_expr_entry_parse_as_list
(GNM_EXPR_ENTRY (state->base.input_entry), state->base.sheet);
if (input_range == NULL) {
gtk_label_set_text (GTK_LABEL (state->base.warning),
_("The input range is invalid."));
gtk_widget_set_sensitive (state->base.ok_button, FALSE);
return;
}
range_list_destroy (input_range);
predetermined_bins = gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (state->predetermined_button));
if (predetermined_bins) {
input_range_2 = gnm_expr_entry_parse_as_value
(GNM_EXPR_ENTRY (state->base.input_entry_2), state->base.sheet);
if (input_range_2 == NULL) {
gtk_label_set_text (GTK_LABEL (state->base.warning),
_("The categories range is not valid."));
gtk_widget_set_sensitive (state->base.ok_button, FALSE);
return;
}
value_release (input_range_2);
} else if (entry_to_int(state->n_entry, &the_n,FALSE) != 0 || the_n <= 0) {
gtk_label_set_text (GTK_LABEL (state->base.warning),
_("The number of categories is invalid."));
gtk_widget_set_sensitive (state->base.ok_button, FALSE);
return;
}
if (!gnm_dao_is_ready (GNM_DAO (state->base.gdao))) {
gtk_label_set_text (GTK_LABEL (state->base.warning),
_("The output specification "
"is invalid."));
gtk_widget_set_sensitive (state->base.ok_button, FALSE);
return;
}
gtk_label_set_text (GTK_LABEL (state->base.warning), "");
gtk_widget_set_sensitive (state->base.ok_button, TRUE);
return;
}
/**
* frequency_tool_ok_clicked_cb:
* @button:
* @state:
*
* Retrieve the information from the dialog and call the frequency_tool.
* Note that we assume that the ok_button is only active if the entry fields
* contain sensible data.
**/
static void
frequency_tool_ok_clicked_cb (G_GNUC_UNUSED GtkWidget *button,
FrequencyToolState *state)
{
data_analysis_output_t *dao;
analysis_tools_data_frequency_t *data;
GtkWidget *w;
data = g_new0 (analysis_tools_data_frequency_t, 1);
dao = parse_output ((GenericToolState *)state, NULL);
data->base.input = gnm_expr_entry_parse_as_list (
GNM_EXPR_ENTRY (state->base.input_entry), state->base.sheet);
data->base.group_by = gnumeric_glade_group_value (state->base.gui, grouped_by_group);
data->predetermined = gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (state->predetermined_button));
if (data->predetermined) {
w = glade_xml_get_widget (state->base.gui, "labels_2_button");
data->bin = gnm_expr_entry_parse_as_value
(GNM_EXPR_ENTRY (state->base.input_entry_2),
state->base.sheet);
} else {
entry_to_int(state->n_entry, &data->n,TRUE);
data->bin = NULL;
}
data->chart = gnumeric_glade_group_value (state->base.gui, chart_group);
w = glade_xml_get_widget (state->base.gui, "labels_button");
data->base.labels = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w));
w = glade_xml_get_widget (state->base.gui, "percentage-button");
data->percentage = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w));
if (!cmd_analysis_tool (WORKBOOK_CONTROL (state->base.wbcg), state->base.sheet,
dao, data, analysis_tool_frequency_engine))
gtk_widget_destroy (state->base.dialog);
return;
}
/**
* frequency_tool_set_predetermined:
* @widget:
* @focus_widget:
* @state:
*
* Output range entry was focused. Switch to output range.
*
**/
static gboolean
frequency_tool_set_predetermined (G_GNUC_UNUSED GtkWidget *widget,
G_GNUC_UNUSED GdkEventFocus *event,
FrequencyToolState *state)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (state->predetermined_button), TRUE);
return FALSE;
}
/**
* frequency_tool_set_calculated:
* @widget:
* @event:
* @state:
*
**/
static gboolean
frequency_tool_set_calculated (G_GNUC_UNUSED GtkWidget *widget,
G_GNUC_UNUSED GdkEventFocus *event,
FrequencyToolState *state)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (state->calculated_button), TRUE);
return FALSE;
}
/**
* dialog_frequency_tool:
* @wbcg:
* @sheet:
*
* Show the dialog (guru).
*
**/
int
dialog_frequency_tool (WBCGtk *wbcg, Sheet *sheet)
{
FrequencyToolState *state;
if (wbcg == NULL) {
return 1;
}
/* Only pop up one copy per workbook */
if (gnumeric_dialog_raise_if_exists (wbcg, FREQUENCY_KEY))
return 0;
state = g_new0 (FrequencyToolState, 1);
if (dialog_tool_init (&state->base, wbcg, sheet,
GNUMERIC_HELP_LINK_FREQUENCY,
"frequency.glade", "Frequency",
_("Could not create the Frequency Tool dialog."),
FREQUENCY_KEY,
G_CALLBACK (frequency_tool_ok_clicked_cb), NULL,
G_CALLBACK (frequency_tool_update_sensitivity_cb),
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);
g_signal_connect (G_OBJECT (state->n_entry),
"key-press-event",
G_CALLBACK (frequency_tool_set_calculated), state);
g_signal_connect (G_OBJECT
(gnm_expr_entry_get_entry (
GNM_EXPR_ENTRY (state->base.input_entry_2))),
"focus-in-event",
G_CALLBACK (frequency_tool_set_predetermined), state);
gnm_dao_set_put (GNM_DAO (state->base.gdao), TRUE, TRUE);
frequency_tool_update_sensitivity_cb (NULL, state);
tool_load_selection ((GenericToolState *)state, TRUE);
gtk_widget_set_sensitive (state->n_entry, FALSE);
gtk_widget_set_sensitive (state->calculated_button, FALSE);
return 0;
}
......@@ -87,6 +87,7 @@ int dialog_ranking_tool (WBCGtk *wbcg, Sheet *sheet);
int dialog_anova_single_factor_tool (WBCGtk *wbcg, Sheet *sheet);
int dialog_anova_two_factor_tool (WBCGtk *wbcg, Sheet *sheet);
int dialog_histogram_tool (WBCGtk *wbcg, Sheet *sheet);
int dialog_frequency_tool (WBCGtk *wbcg, Sheet *sheet);
typedef enum {
TTEST_PAIRED = 1,
......
This diff is collapsed.
......@@ -146,6 +146,9 @@
#define GNUMERIC_HELP_LINK_ANOVA_SINGLE_FACTOR "sect-analysis-statistical"
#define GNUMERIC_HELP_LINK_ANOVA_TWO_FACTOR "sect-analysis-statistical"
/* dialog-analysis-tool-frequency.c */
#define GNUMERIC_HELP_LINK_FREQUENCY "sect-analysis-statistical"
/* dialog-consolidate.c */
#define GNUMERIC_HELP_LINK_CONSOLIDATE ""
......
2008-10-12 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* analysis-tools.h (set_cell_text_col): new
* analysis-tools.c (set_cell_text_col): make non-static
* analysis-frequency.[ch]: new
* Makefile.am: added analysis-frequency.[ch]
2008-10-05 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* analysis-exp-smoothing.c
......
......@@ -21,6 +21,8 @@ noinst_LTLIBRARIES = libtools.la
libtools_la_SOURCES = \
analysis-exp-smoothing.c \
analysis-exp-smoothing.h \
analysis-frequency.c \
analysis-frequency.h \
analysis-histogram.c \
analysis-histogram.h \
analysis-tools.c \
......
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* analysis-frequency.c:
*
* Author:
* Andreas J. Guelzow <aguelzow@pyrshep.ca>
*
* (C) Copyright 2008 by Andreas J. Guelzow <aguelzow@pyrshep.ca>
*
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gnumeric-config.h>
#include <glib/gi18n-lib.h>
#include "gnumeric.h"
#include "analysis-frequency.h"
#include "analysis-tools.h"
#include "value.h"
#include "ranges.h"
#include "expr.h"
#include "func.h"
#include "numbers.h"
#include "sheet-object-graph.h"
#include <goffice/graph/gog-graph.h>
#include <goffice/graph/gog-object.h>
#include <goffice/graph/gog-chart.h>
#include <goffice/graph/gog-plot.h>
#include <goffice/graph/gog-series.h>
#include <goffice/utils/go-glib-extras.h>
static gboolean
analysis_tool_frequency_engine_run (data_analysis_output_t *dao,
analysis_tools_data_frequency_t *info)
{
gint i_limit, col;
GSList *l;
GnmFunc *fd_sum;
GnmFunc *fd_if;
GnmFunc *fd_index;
GnmFunc *fd_rows = NULL;
GnmFunc *fd_columns = NULL;
fd_sum = gnm_func_lookup ("SUM", NULL);
gnm_func_ref (fd_sum);
fd_if = gnm_func_lookup ("IF", NULL);
gnm_func_ref (fd_if);
fd_index = gnm_func_lookup ("INDEX", NULL);
gnm_func_ref (fd_index);
if (info->percentage) {
fd_rows = gnm_func_lookup ("ROWS", NULL);
gnm_func_ref (fd_rows);
fd_columns = gnm_func_lookup ("COLUMNS", NULL);
gnm_func_ref (fd_columns);
}
/* General Info */
dao_set_italic (dao, 0, 0, 0, 0);
set_cell_text_col (dao, 0, 0, _("/Frequency Table"
"/Category"));
/* Setting up the categories */
if (info->predetermined) {
int row = 2, i, j, i_h_limit, i_w_limit;
GnmExpr const *expr_bin;
GnmRange range;
range_init_value (&range, info->bin);
i_h_limit = range_height (&range);
i_w_limit = range_width (&range);
i_limit = i_h_limit * i_w_limit;
expr_bin = gnm_expr_new_constant (info->bin);
for (i = 1; i <= i_h_limit; i++)
for (j = 1; j <= i_w_limit; j++)
dao_set_cell_expr (dao, 0, row++,
gnm_expr_new_funcall3
(fd_index,
gnm_expr_copy (expr_bin),
gnm_expr_new_constant (value_new_int (i)),
gnm_expr_new_constant (value_new_int (j))));
gnm_expr_free (expr_bin);
} else {
i_limit = info->n;
}
for (l = info->base.input, col = 1; l; col++, l = l->next) {
GnmValue *val = value_dup ((GnmValue *)l->data);
GnmValue *val_c = NULL;
GnmExpr const *expr_count;
GnmExpr const *expr_data;
GnmExpr const *expr_if;
int i, row = 2;
if (info->base.labels) {
val_c = value_dup (val);
switch (info->base.group_by) {
case GROUPED_BY_ROW:
val->v_range.cell.a.col++;
break;
default:
val->v_range.cell.a.row++;
break;
}
dao_set_cell_expr (dao, col, 1,
gnm_expr_new_funcall1 (fd_index,
gnm_expr_new_constant (val_c)));
} else {
char const *format;
switch (info->base.group_by) {
case GROUPED_BY_ROW:
format = _("Row %d");
break;
case GROUPED_BY_COL:
format = _("Column %d");
break;
default:
format = _("Area %d");
break;
}
dao_set_cell_printf (dao, col, 1, format, col);
}
expr_data = gnm_expr_new_constant (val);
expr_if = gnm_expr_new_funcall3
(fd_if,
gnm_expr_new_binary
(gnm_expr_copy (expr_data),
GNM_EXPR_OP_EQUAL, make_cellref (- col, 0)),
gnm_expr_new_constant (value_new_int (1)),
gnm_expr_new_constant (value_new_int (0)));
expr_count = gnm_expr_new_funcall1 (fd_sum, expr_if);
if (info->percentage) {
dao_set_format (dao, col, 2, col, i_limit + 2, "0.0%");
expr_count = gnm_expr_new_binary (expr_count,
GNM_EXPR_OP_DIV,
gnm_expr_new_binary
(gnm_expr_new_funcall1
(fd_rows, gnm_expr_copy (expr_data)),
GNM_EXPR_OP_MULT,
gnm_expr_new_funcall1
(fd_columns, expr_data)));
} else
gnm_expr_free (expr_data);
for (i = 0; i < i_limit; i++, row++)
dao_set_cell_array_expr (dao, col, row, gnm_expr_copy (expr_count));
gnm_expr_free (expr_count);
}
gnm_func_unref (fd_if);
gnm_func_unref (fd_sum);
gnm_func_unref (fd_index);
if (fd_rows != NULL)
gnm_func_unref (fd_rows);
if (fd_columns != NULL)
gnm_func_unref (fd_columns);
/* Create Chart if requested */
if (info->chart != NO_CHART) {
SheetObject *so;
GogGraph *graph;
GogChart *chart;
GogPlot *plot;
GogSeries *series;
GOData *cats;
GOData *values;
int ct;
graph = g_object_new (GOG_GRAPH_TYPE, NULL);
chart = GOG_CHART (gog_object_add_by_name (
GOG_OBJECT (graph), "Chart", NULL));
plot = gog_plot_new_by_name ("GogBarColPlot");
if (info->chart == BAR_CHART)
go_object_toggle (plot, "horizontal");
gog_object_add_by_name (GOG_OBJECT (chart),
"Plot", GOG_OBJECT (plot));
cats = dao_go_data_vector (dao, 0, 2,
0, 2 + i_limit);
for (ct = 1; ct < col; ct ++) {
g_object_ref (cats);
values = dao_go_data_vector (dao, ct, 2,
ct, 2 + i_limit);
series = gog_plot_new_series (plot);
gog_series_set_dim (series, 0, cats, NULL);
gog_series_set_dim (series, 1, values, NULL);
}
g_object_unref (cats);
so = sheet_object_graph_new (graph);
g_object_unref (graph);
dao_set_sheet_object (dao, 0, 1, so);
}
dao_redraw_respan (dao);
return FALSE;
}
static gint
calc_length (GnmValue *bin)
{
g_return_val_if_fail (bin != NULL, 0);
g_return_val_if_fail (bin->type == VALUE_CELLRANGE, 0);
return ((bin->v_range.cell.b.col - bin->v_range.cell.a.col + 1) *
(bin->v_range.cell.b.row - bin->v_range.cell.a.row + 1));
}
gboolean
analysis_tool_frequency_engine (data_analysis_output_t *dao, gpointer specs,
analysis_tool_engine_t selector, gpointer result)
{
analysis_tools_data_frequency_t *info = specs;
switch (selector) {
case TOOL_ENGINE_UPDATE_DESCRIPTOR:
return (dao_command_descriptor (dao, _("Frequency Table (%s)"), result)
== NULL);
case TOOL_ENGINE_UPDATE_DAO:
{
int i;
prepare_input_range (&info->base.input, info->base.group_by);
i = 2 + ((info->predetermined) ? calc_length (info->bin) : info->n);
dao_adjust (dao, g_slist_length (info->base.input) + 1, i);
return FALSE;
}
case TOOL_ENGINE_CLEAN_UP:
return analysis_tool_generic_clean (specs);
case TOOL_ENGINE_LAST_VALIDITY_CHECK:
return FALSE;
case TOOL_ENGINE_PREPARE_OUTPUT_RANGE:
dao_prepare_output (NULL, dao, _("Frequency Table"));
return FALSE;
case TOOL_ENGINE_FORMAT_OUTPUT_RANGE:
return dao_format_output (dao, _("Frequency Table"));
case TOOL_ENGINE_PERFORM_CALC:
default:
return analysis_tool_frequency_engine_run (dao, specs);
}
return TRUE;
}