Commit eb7517d7 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

add sheet_merge. (xml_sax_start_element) : add sheet_merge, and

2001-05-11  Jody Goldberg <jgoldberg@home.com>

	* xml-sax-read.c (xml_sax_characters) : add sheet_merge.
	(xml_sax_start_element) : add sheet_merge, and sheet_merged_regions.
	(xml_sax_end_element) : call xml_sax_parse_merge.
	(xml_sax_parse_merge) : new function.
	(xml_sax_parse_sheet_end) : new function to set the zoom after the
	  content.
	(xml_sax_parse_sheet_start) : renamed from xml_sax_parse_sheet.
	(xml_parse_sheet_zoom) : just store the zoom don't set till later.
	(xml_sax_cols_rows) : new function.

2001-05-10  Jody Goldberg <jgoldberg@home.com>

	* xml-sax-read.c (xml_sax_parse_attr_bool) : new function.
	(xmlSaxParseSheet) : use it here.
	(xml_sax_parse_wb) : fix inverted cmp.
	(xmlSaxParseSheet) : no sheet yet here.  Just store the prefs for
	  later.
	(xmlSaxParseSheet) : use any saved prefs.
	(xml_sax_file_open) : typo.

2001-05-11  Jody Goldberg <jgoldberg@home.com>

	* src/application.c (application_real_time_auto_expr_recalc) : new
	  function.

	* src/sheet.c (auto_expr_timer_clear) : new function.
	(sheet_update) : toggle the selection_content_changed flag here and
	  use a timer rather than an idle handler.

	* src/workbook-edit.c (wbcg_edit_ctor) : Init the sensitivity timer.

	* src/workbook-control-gui.c (workbook_setup_edit_area) : Use
	  wbcg_edit_ctor.
	(wbcg_destroy) : use wbcg_edit_dtor.

	* src/main.c (gnumeric_main) : setlocale (LC_ALL, NULL) to force
	  initialization of LC_* from the environment.
parent 169750b3
......@@ -8,9 +8,6 @@ release, and longer term bugs.
Release Critical
----------------
- Performance regression: navigating and (say) selecting an area in,
for example, statfuns.xls takes an embarrassingly long time.
- smarter support for unicode characters that do not convert to the
current encoding during XL import.
......@@ -35,9 +32,6 @@ Names :
depends correctly.
: references in names do not get changed with cut/paste or ins/del row/col.
- range selection support for merged cells, should name the corner not the
content.
- When using the new range-selector for dialogs with only one range, it
should not be necessary to select the range field before selecting the
range. As long as the selector is in a modal dialog.
......
2001-05-11 Jody Goldberg <jgoldberg@home.com>
* src/application.c (application_real_time_auto_expr_recalc) : new
function.
* src/sheet.c (auto_expr_timer_clear) : new function.
(sheet_update) : toggle the selection_content_changed flag here and
use a timer rather than an idle handler.
* src/workbook-edit.c (wbcg_edit_ctor) : Init the sensitivity timer.
* src/workbook-control-gui.c (workbook_setup_edit_area) : Use
wbcg_edit_ctor.
(wbcg_destroy) : use wbcg_edit_dtor.
* src/main.c (gnumeric_main) : setlocale (LC_ALL, NULL) to force
initialization of LC_* from the environment.
2001-05-11 Jon K Hellan <hellan@acm.org>
* src/sheet-control-gui.c (scg_rangesel_changed): Improve handling
......
2001-05-11 Jody Goldberg <jgoldberg@home.com>
* src/application.c (application_real_time_auto_expr_recalc) : new
function.
* src/sheet.c (auto_expr_timer_clear) : new function.
(sheet_update) : toggle the selection_content_changed flag here and
use a timer rather than an idle handler.
* src/workbook-edit.c (wbcg_edit_ctor) : Init the sensitivity timer.
* src/workbook-control-gui.c (workbook_setup_edit_area) : Use
wbcg_edit_ctor.
(wbcg_destroy) : use wbcg_edit_dtor.
* src/main.c (gnumeric_main) : setlocale (LC_ALL, NULL) to force
initialization of LC_* from the environment.
2001-05-11 Jon K Hellan <hellan@acm.org>
* src/sheet-control-gui.c (scg_rangesel_changed): Improve handling
......
2001-05-11 Jody Goldberg <jgoldberg@home.com>
* src/application.c (application_real_time_auto_expr_recalc) : new
function.
* src/sheet.c (auto_expr_timer_clear) : new function.
(sheet_update) : toggle the selection_content_changed flag here and
use a timer rather than an idle handler.
* src/workbook-edit.c (wbcg_edit_ctor) : Init the sensitivity timer.
* src/workbook-control-gui.c (workbook_setup_edit_area) : Use
wbcg_edit_ctor.
(wbcg_destroy) : use wbcg_edit_dtor.
* src/main.c (gnumeric_main) : setlocale (LC_ALL, NULL) to force
initialization of LC_* from the environment.
2001-05-11 Jon K Hellan <hellan@acm.org>
* src/sheet-control-gui.c (scg_rangesel_changed): Improve handling
......
2001-05-11 Jody Goldberg <jgoldberg@home.com>
* src/application.c (application_real_time_auto_expr_recalc) : new
function.
* src/sheet.c (auto_expr_timer_clear) : new function.
(sheet_update) : toggle the selection_content_changed flag here and
use a timer rather than an idle handler.
* src/workbook-edit.c (wbcg_edit_ctor) : Init the sensitivity timer.
* src/workbook-control-gui.c (workbook_setup_edit_area) : Use
wbcg_edit_ctor.
(wbcg_destroy) : use wbcg_edit_dtor.
* src/main.c (gnumeric_main) : setlocale (LC_ALL, NULL) to force
initialization of LC_* from the environment.
2001-05-11 Jon K Hellan <hellan@acm.org>
* src/sheet-control-gui.c (scg_rangesel_changed): Improve handling
......
2001-05-11 Jody Goldberg <jgoldberg@home.com>
* src/application.c (application_real_time_auto_expr_recalc) : new
function.
* src/sheet.c (auto_expr_timer_clear) : new function.
(sheet_update) : toggle the selection_content_changed flag here and
use a timer rather than an idle handler.
* src/workbook-edit.c (wbcg_edit_ctor) : Init the sensitivity timer.
* src/workbook-control-gui.c (workbook_setup_edit_area) : Use
wbcg_edit_ctor.
(wbcg_destroy) : use wbcg_edit_dtor.
* src/main.c (gnumeric_main) : setlocale (LC_ALL, NULL) to force
initialization of LC_* from the environment.
2001-05-11 Jon K Hellan <hellan@acm.org>
* src/sheet-control-gui.c (scg_rangesel_changed): Improve handling
......
2001-05-11 Jody Goldberg <jgoldberg@home.com>
* ms-excel-read.c (ms_excel_read_workbook) : clear the global handle
after it is closed.
2001-05-11 Almer S. Tigelaar <almer@gnome.org>
* ms-excel-write.c (write_sheet_bools): Write dimensions as
......
......@@ -4376,6 +4376,7 @@ ms_excel_read_workbook (IOContext *context, WorkbookView *wb_view,
}
#endif
excel_iconv_close (current_workbook_iconv);
current_workbook_iconv = 0;
if (wb) {
/* Cleanup */
ms_excel_workbook_destroy (wb);
......
2001-05-11 Jody Goldberg <jgoldberg@home.com>
* xml-sax-read.c (xml_sax_characters) : add sheet_merge.
(xml_sax_start_element) : add sheet_merge, and sheet_merged_regions.
(xml_sax_end_element) : call xml_sax_parse_merge.
(xml_sax_parse_merge) : new function.
(xml_sax_parse_sheet_end) : new function to set the zoom after the
content.
(xml_sax_parse_sheet_start) : renamed from xml_sax_parse_sheet.
(xml_parse_sheet_zoom) : just store the zoom don't set till later.
(xml_sax_cols_rows) : new function.
2001-05-10 Jody Goldberg <jgoldberg@home.com>
* xml-sax-read.c (xml_sax_parse_attr_bool) : new function.
(xmlSaxParseSheet) : use it here.
(xml_sax_parse_wb) : fix inverted cmp.
(xmlSaxParseSheet) : no sheet yet here. Just store the prefs for
later.
(xmlSaxParseSheet) : use any saved prefs.
(xml_sax_file_open) : typo.
2001-04-27 Jody Goldberg <jgoldberg@home.com>
* xml-sax-read.c (xml_sax_unknown_attr) : Start
......
This diff is collapsed.
......@@ -101,6 +101,7 @@ typedef struct
GList *history_list;
gboolean edit_auto_complete;
int auto_expr_recalc_lag;
} GnumericApplication;
static GnumericApplication app;
......@@ -233,6 +234,14 @@ application_init (void)
gnome_config_push_prefix ("Gnumeric/Editing/");
app.edit_auto_complete = gnome_config_get_bool ("AutoComplete=true");
/* If positive auto expressions are recalculated within <lag>
* millesecond after a change.
* if negative they are recalculated with <lag> milleseconds after the
* last change where 'last' is defined as a periond > <lag> after a
* change with no changes.
*/
app.auto_expr_recalc_lag = gnome_config_get_int ("AutoExprRecalcLag=200");
gnome_config_pop_prefix ();
}
......@@ -328,7 +337,7 @@ application_clipboard_copy (WorkbookControl *wbc,
g_return_if_fail (area != NULL);
if (application_set_selected_sheet (wbc, sheet) ) {
GList *l = NULL;
GList *l;
app.clipboard_cut_range = *area;
app.clipboard_copied_contents =
......@@ -342,7 +351,7 @@ application_clipboard_copy (WorkbookControl *wbc,
* The 'area' and the list itself will be copied
* entirely. We ant the copied range on the sheet.
*/
l = g_list_append (l, (Range *) area);
l = g_list_append (NULL, (Range *) area);
sheet_ant (sheet, l);
g_list_free (l);
}
......@@ -367,7 +376,7 @@ application_clipboard_cut (WorkbookControl *wbc,
g_return_if_fail (area != NULL);
if (application_set_selected_sheet (wbc, sheet) ) {
GList *l = NULL;
GList *l;
app.clipboard_cut_range = *area;
......@@ -380,7 +389,7 @@ application_clipboard_cut (WorkbookControl *wbc,
* The 'area' and the list itself will be copied
* entirely. We ant the cut range on the sheet.
*/
l = g_list_append (l, (Range *) area);
l = g_list_append (NULL, (Range *) area);
sheet_ant (sheet, l);
g_list_free (l);
}
......@@ -660,6 +669,12 @@ application_use_auto_complete_get (void)
return app.edit_auto_complete;
}
int
application_auto_expr_recalc_lag (void)
{
return app.auto_expr_recalc_lag;
}
void
application_use_auto_complete_set (gboolean use_auto_complete)
{
......
......@@ -41,4 +41,6 @@ double application_dpi_to_pixels (void);
gboolean application_use_auto_complete_get (void);
void application_use_auto_complete_set (gboolean use_auto_complete);
int application_auto_expr_recalc_lag (void);
#endif /* GNUMERIC_APPLICATION_H */
......@@ -1671,6 +1671,11 @@ expr_tree_get_func_def (ExprTree const *expr)
return expr->func.func;
}
/**
* expr_tree_first_func :
* @expr :
*
*/
ExprTree const *
expr_tree_first_func (ExprTree const *expr)
{
......@@ -1704,3 +1709,57 @@ expr_tree_first_func (ExprTree const *expr)
g_assert_not_reached ();
return NULL;
}
/**
* expr_tree_container :
*/
void
expr_boundingbox (ExprTree const *expr, CellPos const *pos, Range *bound)
{
g_return_if_fail (expr != NULL);
switch (expr->any.oper) {
case OPER_ANY_BINARY:
expr_boundingbox (expr->binary.value_a, pos, bound);
expr_boundingbox (expr->binary.value_b, pos, bound);
break;
case OPER_ANY_UNARY:
expr_boundingbox (expr->unary.value, pos, bound);
break;
case OPER_FUNCALL: {
GList *l;
for (l = expr->func.arg_list; l; l = l->next)
expr_boundingbox (l->data, pos, bound);
break;
}
case OPER_NAME:
/* Do NOT validate the name. */
/* TODO : is that correct ? */
break;
case OPER_VAR:
break;
case OPER_CONSTANT: {
Value const *v = expr->constant.value;
if (v->type == VALUE_CELLRANGE) {
CellRef ref_a = v->v_range.cell.a;
CellRef ref_b = v->v_range.cell.b;
}
break;
}
case OPER_ARRAY: {
ExprArray const * a = &expr->array;
if (a->x == 0 && a->y == 0)
expr_boundingbox (a->corner.expr, pos, bound);
break;
}
}
g_assert_not_reached ();
}
......@@ -11,6 +11,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <gnome.h>
#include <locale.h>
#include "gnumeric.h"
#include "xml-io.h"
#ifdef ENABLE_BONOBO
......@@ -131,6 +132,11 @@ gnumeric_main (void *closure, int argc, char *argv [])
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
/* Force all of the locale segments to update from the environment.
* Unless we do this they will default to C
*/
setlocale (LC_ALL, "");
gnumeric_arg_parse (argc, argv);
if (gnumeric_show_version) {
......
......@@ -11,6 +11,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <gnome.h>
#include <locale.h>
#include "gnumeric.h"
#include "xml-io.h"
#ifdef ENABLE_BONOBO
......@@ -131,6 +132,11 @@ gnumeric_main (void *closure, int argc, char *argv [])
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
/* Force all of the locale segments to update from the environment.
* Unless we do this they will default to C
*/
setlocale (LC_ALL, "");
gnumeric_arg_parse (argc, argv);
if (gnumeric_show_version) {
......
......@@ -28,7 +28,7 @@ struct _SheetPrivate {
gboolean resize_scrollbar;
CellPos reposition_objects;
guint auto_expr_idle_id;
guint auto_expr_timer;
};
#endif /* GNUMERIC_SHEET_PRIVATE_H */
......@@ -8,9 +8,6 @@
* Jody Goldberg (jgoldbeg@home.com)
*/
#include <config.h>
#include <ctype.h>
#include <gnome.h>
#include <string.h>
#include "gnumeric.h"
#include "command-context.h"
#include "sheet-control-gui.h"
......@@ -43,6 +40,11 @@
#include "sheet-object-impl.h"
#include "sheet-object-cell-comment.h"
#include <gnome.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
static void sheet_redraw_partial_row (Sheet const *sheet, int row,
int start_col, int end_col);
......@@ -50,12 +52,12 @@ void
sheet_unant (Sheet *sheet)
{
GList *l;
g_return_if_fail (sheet != NULL);
if (!sheet->ants)
return;
for (l = sheet->ants; l != NULL; l = l->next) {
Range *ss = l->data;
g_free (ss);
......@@ -78,7 +80,7 @@ sheet_ant (Sheet *sheet, GList *ranges)
if (sheet->ants != NULL)
sheet_unant (sheet);
/*
* We need to copy the whole selection to the
* 'ant' list which contains all currently anted
......@@ -91,7 +93,7 @@ sheet_ant (Sheet *sheet, GList *ranges)
sheet->ants = g_list_prepend (sheet->ants, range_dup (ss));
}
sheet->ants = g_list_reverse (sheet->ants);
SHEET_FOREACH_CONTROL (sheet, control,
scg_ant (control););
}
......@@ -183,7 +185,7 @@ sheet_new (Workbook *wb, char const *name)
sheet->priv->reposition_objects.row = SHEET_MAX_ROWS;
sheet->priv->reposition_objects.col = SHEET_MAX_COLS;
sheet->priv->auto_expr_idle_id = 0;
sheet->priv->auto_expr_timer = 0;
sheet->signature = SHEET_SIGNATURE;
sheet->workbook = wb;
......@@ -240,7 +242,7 @@ sheet_new (Workbook *wb, char const *name)
sheet->outline_symbols_below = TRUE;
sheet->outline_symbols_right = TRUE;
sheet->frozen_corner.col = sheet->frozen_corner.row = -1;
/* Init menu states */
sheet->priv->enable_insert_rows = TRUE;
sheet->priv->enable_insert_cols = TRUE;
......@@ -730,6 +732,18 @@ sheet_flag_selection_change (Sheet const *sheet)
sheet->priv->selection_content_changed = TRUE;
}
/**
* sheet_flag_recompute_spans:
* flag the sheet as requiring a full span recomputation.
*
* @sheet :
*/
void
sheet_flag_recompute_spans (Sheet const *sheet)
{
sheet->priv->recompute_spans = TRUE;
}
/**
* sheet_update_only_grid :
*
......@@ -805,22 +819,29 @@ sheet_update_only_grid (Sheet const *sheet)
}
}
static void
auto_expr_timer_clear (SheetPrivate *p)
{
if (p->auto_expr_timer != 0) {
gtk_timeout_remove (p->auto_expr_timer);
p->auto_expr_timer = 0;
}
}
static gboolean
sheet_update_auto_expr_idle_func (gpointer data)
cb_sheet_update_auto_expr (gpointer data)
{
Sheet *sheet = (Sheet *) data;
SheetPrivate *p;
p = sheet->priv;
if (p->selection_content_changed) {
p->selection_content_changed = FALSE;
WORKBOOK_FOREACH_VIEW (sheet->workbook, view,
{
if (wb_view_cur_sheet (view) == sheet)
wb_view_auto_expr_recalc (view, TRUE);
});
}
p->auto_expr_idle_id = 0;
WORKBOOK_FOREACH_VIEW (sheet->workbook, view,
{
if (wb_view_cur_sheet (view) == sheet)
wb_view_auto_expr_recalc (view, TRUE);
});
p->auto_expr_timer = 0;
return FALSE;
}
......@@ -873,8 +894,15 @@ sheet_update (Sheet const *sheet)
});
}
if (p->selection_content_changed && p->auto_expr_idle_id == 0)
p->auto_expr_idle_id = g_idle_add (sheet_update_auto_expr_idle_func, (gpointer) sheet);
if (p->selection_content_changed) {
int const lag = application_auto_expr_recalc_lag ();
p->selection_content_changed = FALSE;
if (p->auto_expr_timer == 0 || lag < 0) {
auto_expr_timer_clear (p);
p->auto_expr_timer = gtk_timeout_add (abs (lag), /* seems ok */
cb_sheet_update_auto_expr, (gpointer) sheet);
}
}
}
/**
......@@ -1292,7 +1320,7 @@ sheet_range_set_text (EvalPos const *pos, Range const *r, char const *str)
/**
* sheet_cell_set_text:
*
* Marks the sheet as dirty
* Marks the sheet as dirty
* Clears old spans.
* Flags status updates
* Queues recalcs
......@@ -1336,7 +1364,7 @@ sheet_cell_set_text (Cell *cell, char const *text)
/**
* sheet_cell_set_expr:
*
* Marks the sheet as dirty
* Marks the sheet as dirty
* Clears old spans.
* Flags status updates
* Queues recalcs
......@@ -2620,6 +2648,8 @@ sheet_destroy (Sheet *sheet)
{
g_return_if_fail (IS_SHEET (sheet));
auto_expr_timer_clear (sheet->priv);
if (sheet->print_info) {
print_info_free (sheet->print_info);
sheet->print_info = NULL;
......@@ -3956,7 +3986,7 @@ sheet_menu_state_enable_insert (Sheet *sheet, gboolean col, gboolean row)
flags |= MS_INSERT_CELLS;
sheet->priv->enable_insert_cells = (col|row);
}
if (!flags)
return;
......@@ -4016,7 +4046,7 @@ sheet_clone_colrow_info (Sheet const *src, Sheet *dst)
colrow_foreach (&src->rows, 0, SHEET_MAX_ROWS-1,
&sheet_clone_colrow_info_item, &closure);
sheet_col_set_default_size_pixels (dst,
sheet_col_set_default_size_pixels (dst,
sheet_col_get_default_size_pixels (src));
sheet_row_set_default_size_pixels (dst,
sheet_row_get_default_size_pixels (src));
......@@ -4028,7 +4058,7 @@ sheet_clone_styles (Sheet const *src, Sheet *dst)
Range r;
StyleList *styles;
CellPos corner = { 0, 0 };
styles = sheet_style_get_list (src, range_init_full_sheet (&r));
sheet_style_set_list (dst, &corner, FALSE, styles);
style_list_free (styles);
......@@ -4086,7 +4116,7 @@ sheet_clone_names (Sheet const *src, Sheet *dst)
g_warning ("We are not duplicating names yet. Function not implemented\n");
warned = TRUE;
}
names = g_list_copy (src->names);
#if 0 /* Feature not implemented, not cloning it yet. */
for (; names; names = names->next) {
......
......@@ -234,6 +234,7 @@ void sheet_flag_status_update_cell (Cell const *c);
void sheet_flag_status_update_range (Sheet const *s, Range const *r);
void sheet_flag_format_update_range (Sheet const *s, Range const *r);
void sheet_flag_selection_change (Sheet const *s);
void sheet_flag_recompute_spans (Sheet const *s);
void sheet_update_only_grid (Sheet const *s);
void sheet_update (Sheet const *s);
void sheet_scrollbar_config (Sheet const *s);
......
......@@ -77,7 +77,7 @@ struct _WorkbookControlGUI {
GtkWidget *func_button;
gboolean updating_ui;
gint ui_timer;
gint toolbar_sensitivity_timer;
/* Auto completion */
void *auto_complete; /* GtkType is (Complete *) */
......
......@@ -2924,7 +2924,7 @@ workbook_setup_edit_area (WorkbookControlGUI *wbcg)
wbcg->selection_descriptor = gtk_entry_new ();
workbook_edit_init (wbcg);
wbcg_edit_ctor (wbcg);
entry = GTK_ENTRY (workbook_get_entry (wbcg));
box = gtk_hbox_new (0, 0);
......@@ -3061,6 +3061,7 @@ wbcg_destroy (GtkObject *obj)
GTK_SIGNAL_FUNC (wbcg_set_focus), wbcg);
workbook_auto_complete_destroy (wbcg);
wbcg_edit_dtor (wbcg);
gtk_window_set_focus (GTK_WINDOW (wbcg->toplevel), NULL);
......
......@@ -84,26 +84,30 @@ workbook_edit_toolbars_set_sensitive (WorkbookControlGUI *wbcg, gboolean sensiti
}
static void
toolbar_timer_clear (WorkbookControlGUI *wbcg)
{
/* Remove previous ui timer */
if (wbcg->toolbar_sensitivity_timer != 0) {
gtk_timeout_remove (wbcg->toolbar_sensitivity_timer);
wbcg->toolbar_sensitivity_timer = 0;
}
}
static gboolean
cb_thaw_ui_toolbar (gpointer *data)
{
WorkbookControlGUI *wbcg = (WorkbookControlGUI *)data;
g_return_val_if_fail (IS_WORKBOOK_CONTROL_GUI (wbcg), FALSE);