Commit 5dbe9caa authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

stddev <= 0 == #NUM! not #DIV/0! (gnumeric_standardize) : ditto.


2005-05-11  Jody Goldberg <jody@gnome.org>

	* functions.c (gnumeric_lognormdist) : stddev <= 0 == #NUM! not #DIV/0!
	(gnumeric_standardize) : ditto.
	(gnumeric_normdist) : ditto.
	(gnumeric_confidence) : ditto.  Additionally size <= 0 == #NUM! too

2005-05-13  Jody Goldberg <jody@gnome.org>

	http://bugzilla.gnome.org/show_bug.cgi?id=164950
	* src/ranges.c (range_trim) : make this more efficient.
parent 08b1bf00
......@@ -16,7 +16,14 @@ Release Critical
sumproduct(A1:A5>4,B1:B4) will not work and that they will
need
sumproduct(--(A1:A5>4),B1:B4)
: fix the row/col separators problem in array formula
: fix the row/col separators problem in array formula
: Using expr_name_set_expr in cb_nexpr_remove is wasteful
http://bugzilla.gnome.org/show_bug.cgi?id=303923
: valgrind warning reading the cycling workbook from
==17415== Conditional jump or move depends on uninitialised value(s)
==17415== at 0x1E5A7847: ms_excel_chart_read (ms-chart.c:2642)
==17415== by 0x1E5A79E4: ms_excel_chart_read_BOF (ms-chart.c:2692)
Worries
-------
......
2005-05-13 Jody Goldberg <jody@gnome.org>
http://bugzilla.gnome.org/show_bug.cgi?id=164950
* src/ranges.c (range_trim) : make this more efficient.
2005-05-14 Jody Goldberg <jody@gnome.org>
http://bugzilla.gnome.org/show_bug.cgi?id=165734
......@@ -41,6 +46,15 @@
* src/xml-sax-read.c (content_ns, gnumeric_1_0_dtd): Mark these
variables with G_GNUC_UNUSED, the #warning below is enough.
2005-05-12 Jody Goldberg <jody@gnome.org>
* src/value.c (parse_database_criteria) : remove old FIXME with a
simple test.
http://bugzilla.gnome.org/show_bug.cgi?id=165700
* src/commands.c (update_after_action) : re-focus only controls for
the current view, not all controls.
2005-05-12 Jody Goldberg <jody@gnome.org>
* src/sheet-filter.c (filter_expr_eval) : for regexp based matches
......
Gnumeric 1.5.2
Jody:
* Tweak the errors from LOGNORMDIST, CONFIDENCE, STANDARDIZE, and
NORMDIST to match MS Excel.
* After a command refocus controls for the current view. [#165700]
* Fix 'Begins with' vs 'Ends With' for autofilters.
* Autofilter string equality is stronger than containment [#172355]
* Buttons in sheet manager dialog should not strech vertically.
* Stub for MS Excel's ASC function, which is unncessary in gnumeric.
* Make range clipping more efficient. [#164950]
* Fix advanced filter for inputs that do not start at col A. [#165734]
Jon Kåre:
* Don't output the xml declaration for xhtml. [#303827]
Morten:
* Fix SUMIF even more. [Debian #308346]
* Fix horizonal alignment of rotated numbers broken by fix to
......@@ -13,9 +21,6 @@ Morten:
* Fix CRITICAL when undoing borders.
* Improve multiline rotated text.
Jon Kåre:
* Don't output the xml declaration for xhtml. [#303827]
--------------------------------------------------------------------------
Gnumeric 1.5.1
......
2005-05-13 Jody Goldberg <jody@gnome.org>
http://bugzilla.gnome.org/show_bug.cgi?id=164950
* src/ranges.c (range_trim) : make this more efficient.
2005-05-14 Jody Goldberg <jody@gnome.org>
http://bugzilla.gnome.org/show_bug.cgi?id=165734
......@@ -41,6 +46,15 @@
* src/xml-sax-read.c (content_ns, gnumeric_1_0_dtd): Mark these
variables with G_GNUC_UNUSED, the #warning below is enough.
2005-05-12 Jody Goldberg <jody@gnome.org>
* src/value.c (parse_database_criteria) : remove old FIXME with a
simple test.
http://bugzilla.gnome.org/show_bug.cgi?id=165700
* src/commands.c (update_after_action) : re-focus only controls for
the current view, not all controls.
2005-05-12 Jody Goldberg <jody@gnome.org>
* src/sheet-filter.c (filter_expr_eval) : for regexp based matches
......
......@@ -20,6 +20,15 @@
* ms-chart.c: (chart_write_AI): fix a crash condition. Constant series
names are not exported yet.
2005-05-12 Jody Goldberg <jody@gnome.org>
* ms-excel-read.c (excel_read_ROW) : fix debug spew
2005-05-12 Jody Goldberg <jody@gnome.org>
* ms-pivot.c (excel_read_pivot_caches) : don't produce warnings for
files without OLE2 wrapper
2005-05-12 Jean Brefort <jean.brefort@normalesup.org>
* ms-chart.c: export series data when constant;
......
......@@ -3405,13 +3405,13 @@ excel_read_ROW (BiffQuery *q, ExcelReadSheet *esheet)
xf = flags2 & 0xfff;
d (1, {
fprintf (stderr,"Row %d height 0x%x, flags=0x%x;\n", row + 1, height,flags);
fprintf (stderr,"Row %d height 0x%x, flags=0x%x 0x%x;\n", row + 1, height, flags, flags2);
if (is_std_height)
puts ("Is Std Height");
fputs ("Is Std Height;\n", stderr);
if (flags2 & 0x1000)
puts ("Top thick");
fputs ("Top thick;\n", stderr);
if (flags2 & 0x2000)
puts ("Bottom thick");
fputs ("Bottom thick;\n", stderr);
});
/* TODO: Put mechanism in place to handle thick margins */
......
......@@ -293,9 +293,11 @@ excel_read_pivot_caches (ExcelWorkbook *ewb,
BiffQuery *q;
GsfInput *cache, *dir;
dir = gsf_infile_child_by_name (ole, "_SX_DB_CUR"); /* office 97 */
if (NULL == ole)
return; /* pre-Excel 95 without ole */
dir = gsf_infile_child_by_name (ole, "_SX_DB_CUR"); /* Excel 97 */
if (NULL == dir)
dir = gsf_infile_child_by_name (ole, "_SX_DB"); /* office 95 */
dir = gsf_infile_child_by_name (ole, "_SX_DB"); /* Excel 95 */
if (NULL == dir)
return;
......
2005-05-11 Jody Goldberg <jody@gnome.org>
* functions.c (gnumeric_lognormdist) : stddev <= 0 == #NUM! not #DIV/0!
(gnumeric_standardize) : ditto.
(gnumeric_normdist) : ditto.
(gnumeric_confidence) : ditto. Additionally size <= 0 == #NUM! too
2005-05-10 Jody Goldberg <jody@gnome.org>
* Release 1.5.1
......
......@@ -637,16 +637,11 @@ static GnmFuncHelp const help_lognormdist[] = {
static GnmValue *
gnumeric_lognormdist (FunctionEvalInfo *ei, GnmValue **argv)
{
gnm_float x, mean, stddev;
gnm_float x = value_get_as_float (argv[0]);
gnm_float mean = value_get_as_float (argv[1]);
gnm_float stddev = value_get_as_float (argv[2]);
x = value_get_as_float (argv[0]);
mean = value_get_as_float (argv[1]);
stddev = value_get_as_float (argv[2]);
if (stddev == 0)
return value_new_error_DIV0 (ei->pos);
if (x <= 0 || mean < 0 || stddev < 0)
if (x <= 0 || mean < 0 || stddev <= 0)
return value_new_error_NUM (ei->pos);
return value_new_float (plnorm (x, mean, stddev, TRUE, FALSE));
......@@ -2195,17 +2190,11 @@ static GnmFuncHelp const help_confidence[] = {
static GnmValue *
gnumeric_confidence (FunctionEvalInfo *ei, GnmValue **argv)
{
gnm_float x, stddev;
int size;
x = value_get_as_float (argv[0]);
stddev = value_get_as_float (argv[1]);
size = value_get_as_int (argv[2]);
if (size == 0)
return value_new_error_DIV0 (ei->pos);
gnm_float x = value_get_as_float (argv[0]);
gnm_float stddev = value_get_as_float (argv[1]);
int size = value_get_as_int (argv[2]);
if (size < 0)
if (size <= 0 || stddev <= 0)
return value_new_error_NUM (ei->pos);
return value_new_float (-qnorm (x / 2, 0, 1, TRUE, FALSE) * (stddev / gnm_sqrt (size)));
......@@ -2238,15 +2227,11 @@ static GnmFuncHelp const help_standardize[] = {
static GnmValue *
gnumeric_standardize (FunctionEvalInfo *ei, GnmValue **argv)
{
gnm_float x, mean, stddev;
gnm_float x = value_get_as_float (argv[0]);
gnm_float mean = value_get_as_float (argv[1]);
gnm_float stddev = value_get_as_float (argv[2]);
x = value_get_as_float (argv[0]);
mean = value_get_as_float (argv[1]);
stddev = value_get_as_float (argv[2]);
if (stddev == 0)
return value_new_error_DIV0 (ei->pos);
else if (stddev < 0)
if (stddev <= 0)
return value_new_error_NUM (ei->pos);
return value_new_float ((x - mean) / stddev);
......@@ -2342,7 +2327,7 @@ gnumeric_normdist (FunctionEvalInfo *ei, GnmValue **argv)
stddev = value_get_as_float (argv[2]);
if (stddev <= 0)
return value_new_error_DIV0 (ei->pos);
return value_new_error_NUM (ei->pos);
cuml = value_get_as_bool (argv[3], &err);
if (err)
......
......@@ -1178,7 +1178,7 @@ gnumeric_search (FunctionEvalInfo *ei, GnmValue **argv)
hay2 = g_utf8_next_char (hay2);
}
if (gnumeric_regcomp_XL (&r, needle, REG_ICASE) == REG_OK) {
if (gnm_regcomp_XL (&r, needle, REG_ICASE) == REG_OK) {
switch (go_regexec (&r, hay2, 1, &rm, 0)) {
case REG_NOMATCH: break;
case REG_OK:
......
......@@ -366,7 +366,7 @@ undo_redo_menu_labels (Workbook *wb)
}
static void
update_after_action (Sheet *sheet, Workbook *wb)
update_after_action (Sheet *sheet, WorkbookControl *wbc)
{
if (sheet != NULL) {
g_return_if_fail (IS_SHEET (sheet));
......@@ -376,15 +376,11 @@ update_after_action (Sheet *sheet, Workbook *wb)
workbook_recalc (sheet->workbook);
sheet_update (sheet);
WORKBOOK_FOREACH_CONTROL (sheet->workbook, view, control,
wb_control_sheet_focus (control, sheet);
);
} else if (wb != NULL) {
WORKBOOK_FOREACH_CONTROL (wb, view, wbc, {
wb_control_sheet_focus (wbc, sheet);
sheet_update (wb_control_cur_sheet (wbc));
});
}
if (sheet->workbook == wb_control_workbook (wbc))
WORKBOOK_VIEW_FOREACH_CONTROL (wb_control_view (wbc), control,
wb_control_sheet_focus (control, sheet););
} else if (wbc != NULL)
sheet_update (wb_control_cur_sheet (wbc));
}
/*
......@@ -508,7 +504,7 @@ command_undo (WorkbookControl *wbc)
if (!klass->undo_cmd (cmd, wbc)) {
gboolean undo_cleared;
update_after_action (cmd->sheet, wb);
update_after_action (cmd->sheet, wbc);
/*
* A few commands clear the undo queue. For those, we do not
......@@ -557,7 +553,7 @@ command_redo (WorkbookControl *wbc)
/* TRUE indicates a failure to redo. Leave the command where it is */
if (klass->redo_cmd (cmd, wbc))
return;
update_after_action (cmd->sheet, wb);
update_after_action (cmd->sheet, wbc);
/* Remove the command from the undo list */
wb->redo_commands = g_slist_remove (wb->redo_commands,
......@@ -803,7 +799,7 @@ command_push_undo (WorkbookControl *wbc, GObject *obj)
/* TRUE indicates a failure to do the command */
trouble = klass->redo_cmd (cmd, wbc);
update_after_action (cmd->sheet, wb);
update_after_action (cmd->sheet, wbc);
if (!trouble)
command_register_undo (wbc, obj);
......
......@@ -108,7 +108,7 @@ gnm_usr_dir (void)
}
int
gnumeric_regcomp_XL (GORegexp *preg, char const *pattern, int cflags)
gnm_regcomp_XL (GORegexp *preg, char const *pattern, int cflags)
{
GString *res = g_string_new (NULL);
int retval;
......
......@@ -21,6 +21,6 @@ char const *gnm_usr_dir (void);
extern const char *gnumeric_lib_dir;
extern const char *gnumeric_data_dir;
int gnumeric_regcomp_XL (GORegexp *preg, char const *pattern, int cflags);
int gnm_regcomp_XL (GORegexp *preg, char const *pattern, int cflags);
#endif /* GNUMERIC_UTILS_H */
......@@ -692,52 +692,51 @@ range_normalize (GnmRange *src)
}
}
static GnmValue *
cb_find_extents (Sheet *sheet, int col, int row, GnmCell *cell,
GnmCellPos *extent)
{
if (extent->col < col)
extent->col = col;
if (extent->row < row)
extent->row = row;
return NULL;
}
/**
* range_trim:
* @sheet: sheet cells are contained on
* @range: range to trim empty cells from
* @cols: trim from right, vs bottom
* @r: range to trim empty cells from
* @cols: trim from right
* @rows: trim from bottom
*
* This removes empty rows/cols from the
* right hand or bottom edges of the range
* depending on the value of @location.
*
* WARNING! FOR LARGE RANGES THIS IS EXPENSIVE!
* depending on the value of @cols or @rows.
*
* Return value: TRUE if the range was totally empty, else FALSE.
* Return value: TRUE if the range was totally empty.
**/
gboolean
range_trim (Sheet const *sheet, GnmRange *range, gboolean cols)
range_trim (Sheet const *sheet, GnmRange *r,
gboolean cols, gboolean rows)
{
int start, *move;
GnmCellPos extent = { -1, -1 };
/* Setup the pointers to the fields which will
* be changed (to remove the empty cells)
*/
if (cols) {
start = range->start.col;
move = &range->end.col;
range->start.col = *move;
if (*move > sheet->cols.max_used)
*move = sheet->cols.max_used;
} else {
start = range->start.row;
move = &range->end.row;
range->start.row = *move;
if (*move > sheet->rows.max_used)
*move = sheet->rows.max_used;
}
g_return_val_if_fail (IS_SHEET (sheet), TRUE);
g_return_val_if_fail (r != NULL, TRUE);
for (; *move >= start ; (*move)--)
if (!sheet_is_region_empty ((Sheet *)sheet, range))
break;
sheet_foreach_cell_in_range (
(Sheet *)sheet, CELL_ITER_IGNORE_BLANK,
r->start.col, r->start.row, r->end.col, r->end.row,
(CellIterFunc) cb_find_extents, &extent);
if (extent.col < 0 || extent.row < 0)
return TRUE;
if (cols)
range->start.col = start;
else
range->start.row = start;
return *move < start;
r->end.col = extent.col;
if (rows)
r->end.row = extent.row;
return FALSE;
}
/**
......@@ -1000,11 +999,12 @@ range_transpose (GnmRange *range, GnmCellPos const *origin)
GnmSheetRange *
gnm_sheet_range_new (Sheet *sheet, GnmRange const *r)
{
GnmSheetRange *gr = g_new0 (GnmSheetRange, 1);
GnmSheetRange *gr;
g_return_val_if_fail (IS_SHEET (sheet), NULL);
g_return_val_if_fail (r != NULL, NULL);
gr = g_new0 (GnmSheetRange, 1);
gr->sheet = sheet;
gr->range = *r;
......
......@@ -86,7 +86,7 @@ gboolean range_transpose (GnmRange *range, GnmCellPos const *origin);
* Probably sheet.h but that is overfull.
*/
gboolean range_trim (Sheet const *sheet, GnmRange *r,
gboolean cols);
gboolean cols, gboolean rows);
gboolean range_has_header (Sheet const *sheet, GnmRange const *src,
gboolean top, gboolean ignore_styles);
......
......@@ -1265,7 +1265,7 @@ characterize_vec (Sheet *sheet, GnmRange *vector,
while (1) {
tmp = *vector;
if (!range_trim (sheet, &tmp, as_cols)) {
if (!range_trim (sheet, &tmp, as_cols, !as_cols)) {
cell = sheet_cell_get (sheet, tmp.end.col+dx, tmp.end.row+dy);
if (cell == NULL)
return is_string;
......
......@@ -3,7 +3,7 @@
/*
* filter.c: support for filters
*
* Copyright (C) 2002-2004 Jody Goldberg (jody@gnome.org)
* Copyright (C) 2002-2005 Jody Goldberg (jody@gnome.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
......@@ -442,6 +442,8 @@ cb_filter_button_pressed (GtkButton *button, FooCanvasItem *view)
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
range_dump (&so->anchor.cell_bound, "");
fprintf (stderr, " : so = %p, view = %p\n", so, view);
if (clip != NULL) {
GdkRectangle rect;
GtkWidget *sw = gtk_scrolled_window_new (
......@@ -530,7 +532,10 @@ static void
filter_view_set_bounds (SheetObjectView *sov, double const *coords, gboolean visible)
{
FooCanvasItem *view = FOO_CANVAS_ITEM (sov);
SheetObject *so = sheet_object_view_get_so (sov);
range_dump (&so->anchor.cell_bound, "");
fprintf (stderr, " : so = %p, view = %p is %s\n", so, sov, visible ? "visible" : "not visible");
if (visible) {
double h, x;
/* clip vertically */
......@@ -569,6 +574,14 @@ static GSF_CLASS_FULL (FilterFooView, filter_foo_view,
FOO_TYPE_CANVAS_WIDGET, 0,
GSF_INTERFACE (filter_foo_view_init, SHEET_OBJECT_VIEW_TYPE))
static void
cb_notify_visibility (GtkWidget *w,
GParamSpec *pspec,
FooCanvasItem *sov)
{
g_warning ("set visibility for %p", sov);
}
static SheetObjectView *
filter_field_new_view (SheetObject *so, SheetObjectViewContainer *container)
{
......@@ -594,6 +607,8 @@ filter_field_new_view (SheetObject *so, SheetObjectViewContainer *container)
G_CALLBACK (cb_filter_button_pressed), view_item);
gtk_widget_show_all (view_widget);
g_signal_connect (arrow, "notify::visible",
G_CALLBACK (cb_notify_visibility), view_item);
return gnm_pane_object_register (so, view_item, FALSE);
}
......@@ -649,7 +664,7 @@ filter_expr_init (FilterExpr *fexpr, unsigned i,
if (fexpr->val[i] != NULL)
return;
if ((op == GNM_FILTER_OP_EQUAL || op == GNM_FILTER_OP_NOT_EQUAL) &&
gnumeric_regcomp_XL (fexpr->regexp + i, str, REG_ICASE) == REG_OK)
gnm_regcomp_XL (fexpr->regexp + i, str, REG_ICASE) == REG_OK)
return;
}
fexpr->val[i] = value_dup (tmp);
......
......@@ -1660,7 +1660,12 @@ parse_database_criteria (GnmEvalPos const *ep, GnmValue *database, GnmValue *cri
e_col = criteria->v_range.cell.b.col;
e_row = criteria->v_range.cell.b.row;
/* FIXME: are we sure that e_col>=b_col? */
if (e_col < b_col) {
int tmp = b_col;
b_col = e_col;
e_col = tmp;
}
/* Find the index numbers for the columns of criterias */
field_ind = g_alloca (sizeof (int) * (e_col - b_col + 1));
for (i = b_col; i <= e_col; i++) {
......
......@@ -430,9 +430,7 @@ static GNM_ACTION_DEF (cb_edit_fill_autofill)
gboolean do_loop;
GSList *merges, *ptr;
/* This could be more efficient, but it is not important */
if (range_trim (sheet, &src, TRUE) ||
range_trim (sheet, &src, FALSE))
if (range_trim (sheet, &src, TRUE, TRUE))
return; /* Region totally empty */
/* trim is a bit overzealous, it forgets about merges */
......
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