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

Minor optimization to decrease flicker.


2000-11-10  Jody Goldberg <jgoldberg@home.com>

	* src/workbook-format-toolbar.c (workbook_format_toolbutton_update) :
	  Minor optimization to decrease flicker.

	* src/sheet.c (sheet_cell_calc_span) : Clarify the semantics of
	  the various flags.
	(cb_max_cell_width) : If the value used a dynamic format we need to
	  rerender ignoring the current width.

	* src/rendered-value.c (rendered_value_new) : renamed from
	  rendered_value_new_ext and delete the old rendered_value_new.
	  Extend slightly to flag whether or not to handle dynamic formats.

	* src/render-ascii.c (cell_region_render_ascii) : Handle the style
	  lookup localy.

	* src/cell.c (cell_eval_content) : We need to manually render
	  the value here, but no longer need to calculate the size
	  seperately.  That is done automatically in the render.
	(cell_render_value) : Handle style localy, and calculate the size.

2000-11-09  Jody Goldberg <jgoldberg@home.com>

	* src/workbook-control-gui.c (workbook_control_gui_init) : move the
	  autosave code here.
	* src/workbook.c : from here.
parent 0a3b0578
......@@ -13,15 +13,10 @@ Release Critical
Long term breakage
------------------
- clipboard : fix duality of PASTE_FORMULAS vs PASTE_VALUES, add PASTE_COMMENT
- Why does the number matching bother comparing against formats that are
covered by 'General' ?
- Column resizing and "general". Double-clicking on column separators to
autosize columns tends to shrink columns with, say, "=22/3" in them.
We should tweak autosize to rerender a cell if it has variable width content.
- format.c: we should resolve all the separators at gnumeric_setlocale time,
not every time we need them.
......
2000-11-10 Jody Goldberg <jgoldberg@home.com>
* src/workbook-format-toolbar.c (workbook_format_toolbutton_update) :
Minor optimization to decrease flicker.
* src/sheet.c (sheet_cell_calc_span) : Clarify the semantics of
the various flags.
(cb_max_cell_width) : If the value used a dynamic format we need to
rerender ignoring the current width.
* src/rendered-value.c (rendered_value_new) : renamed from
rendered_value_new_ext and delete the old rendered_value_new.
Extend slightly to flag whether or not to handle dynamic formats.
* src/render-ascii.c (cell_region_render_ascii) : Handle the style
lookup localy.
* src/cell.c (cell_eval_content) : We need to manually render
the value here, but no longer need to calculate the size
seperately. That is done automatically in the render.
(cell_render_value) : Handle style localy, and calculate the size.
2000-11-09 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (workbook_control_gui_init) : move the
autosave code here.
* src/workbook.c : from here.
2000-11-09 Morten Welinder <terra@diku.dk>
* src/border.c (style_border_unref): Take border out of hash table
......
2000-11-10 Jody Goldberg <jgoldberg@home.com>
* src/workbook-format-toolbar.c (workbook_format_toolbutton_update) :
Minor optimization to decrease flicker.
* src/sheet.c (sheet_cell_calc_span) : Clarify the semantics of
the various flags.
(cb_max_cell_width) : If the value used a dynamic format we need to
rerender ignoring the current width.
* src/rendered-value.c (rendered_value_new) : renamed from
rendered_value_new_ext and delete the old rendered_value_new.
Extend slightly to flag whether or not to handle dynamic formats.
* src/render-ascii.c (cell_region_render_ascii) : Handle the style
lookup localy.
* src/cell.c (cell_eval_content) : We need to manually render
the value here, but no longer need to calculate the size
seperately. That is done automatically in the render.
(cell_render_value) : Handle style localy, and calculate the size.
2000-11-09 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (workbook_control_gui_init) : move the
autosave code here.
* src/workbook.c : from here.
2000-11-09 Morten Welinder <terra@diku.dk>
* src/border.c (style_border_unref): Take border out of hash table
......
2000-11-10 Jody Goldberg <jgoldberg@home.com>
* src/workbook-format-toolbar.c (workbook_format_toolbutton_update) :
Minor optimization to decrease flicker.
* src/sheet.c (sheet_cell_calc_span) : Clarify the semantics of
the various flags.
(cb_max_cell_width) : If the value used a dynamic format we need to
rerender ignoring the current width.
* src/rendered-value.c (rendered_value_new) : renamed from
rendered_value_new_ext and delete the old rendered_value_new.
Extend slightly to flag whether or not to handle dynamic formats.
* src/render-ascii.c (cell_region_render_ascii) : Handle the style
lookup localy.
* src/cell.c (cell_eval_content) : We need to manually render
the value here, but no longer need to calculate the size
seperately. That is done automatically in the render.
(cell_render_value) : Handle style localy, and calculate the size.
2000-11-09 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (workbook_control_gui_init) : move the
autosave code here.
* src/workbook.c : from here.
2000-11-09 Morten Welinder <terra@diku.dk>
* src/border.c (style_border_unref): Take border out of hash table
......
2000-11-10 Jody Goldberg <jgoldberg@home.com>
* src/workbook-format-toolbar.c (workbook_format_toolbutton_update) :
Minor optimization to decrease flicker.
* src/sheet.c (sheet_cell_calc_span) : Clarify the semantics of
the various flags.
(cb_max_cell_width) : If the value used a dynamic format we need to
rerender ignoring the current width.
* src/rendered-value.c (rendered_value_new) : renamed from
rendered_value_new_ext and delete the old rendered_value_new.
Extend slightly to flag whether or not to handle dynamic formats.
* src/render-ascii.c (cell_region_render_ascii) : Handle the style
lookup localy.
* src/cell.c (cell_eval_content) : We need to manually render
the value here, but no longer need to calculate the size
seperately. That is done automatically in the render.
(cell_render_value) : Handle style localy, and calculate the size.
2000-11-09 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (workbook_control_gui_init) : move the
autosave code here.
* src/workbook.c : from here.
2000-11-09 Morten Welinder <terra@diku.dk>
* src/border.c (style_border_unref): Take border out of hash table
......
2000-11-10 Jody Goldberg <jgoldberg@home.com>
* src/workbook-format-toolbar.c (workbook_format_toolbutton_update) :
Minor optimization to decrease flicker.
* src/sheet.c (sheet_cell_calc_span) : Clarify the semantics of
the various flags.
(cb_max_cell_width) : If the value used a dynamic format we need to
rerender ignoring the current width.
* src/rendered-value.c (rendered_value_new) : renamed from
rendered_value_new_ext and delete the old rendered_value_new.
Extend slightly to flag whether or not to handle dynamic formats.
* src/render-ascii.c (cell_region_render_ascii) : Handle the style
lookup localy.
* src/cell.c (cell_eval_content) : We need to manually render
the value here, but no longer need to calculate the size
seperately. That is done automatically in the render.
(cell_render_value) : Handle style localy, and calculate the size.
2000-11-09 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (workbook_control_gui_init) : move the
autosave code here.
* src/workbook.c : from here.
2000-11-09 Morten Welinder <terra@diku.dk>
* src/border.c (style_border_unref): Take border out of hash table
......
......@@ -23,7 +23,7 @@ You need:
gtk+ >= 1.2.7 (gnome-libs 1.3 is not supported)
gnome-libs >= 1.0.57 (gnome-libs 2.0 is not supported)
libglade >= 0.14
gal >= 0.2.1.2
gal >= 0.2.2.0
gnome-print >= 0.24 (Be careful, newer version may not compile)
gnome-xml >= 1.8.7 (gnome-xml 2.x not supported yet)
......
......@@ -339,14 +339,14 @@ fi
dnl ******************************
dnl Gnome App Lib checking
dnl ******************************
AC_MSG_CHECKING(for Gnome App libraries (GAL) >= 0.01)
AC_MSG_CHECKING(for Gnome App libraries (GAL) >= 0.2.2.0)
if gnome-config --libs gal > /dev/null 2>&1; then
vers=`gnome-config --modversion gal | sed -e "s/gal-//" -e 's/cvs$//' -e 's/pre$//' | \
awk 'BEGIN { FS = "."; } { print $1*1000000 + $2*10000 + $3*100 + $4; }'`
if test "$vers" -ge 20102; then
if test "$vers" -ge 20200; then
AC_MSG_RESULT(found)
else
AC_MSG_ERROR(You need at least GNOME Application libs 0.2.1.2 for this version of Gnumeric)
AC_MSG_ERROR(You need at least GNOME Application libs 0.2.2.0 for this version of Gnumeric)
fi
else
AC_MSG_ERROR(Did not find GnomeAppLib (GAL) installed)
......
......@@ -20,7 +20,7 @@ Requires: gnome-print >= 0.24
Requires: libglade >= 0.14
Requires: libxml >= 1.8.5
Requires: libole2 >= 0.1.4
Requires: gal >= 0.2.1.2
Requires: gal >= 0.2.2.0
%description
GNOME (GNU Network Object Model Environment) is a user-friendly set of
......@@ -103,6 +103,9 @@ fi
%doc HACKING AUTHORS ChangeLog NEWS BUGS README COPYING TODO
%changelog
* Thu Nov 09 2000 Jody Goldberg <jgoldberg@home.com>
- Updated version requirements for GAL
* Fri Nov 03 2000 Jody Goldberg <jgoldberg@home.com>
- Updated version requirements for GAL
......
......@@ -191,7 +191,10 @@ cell_eval_content (Cell *cell)
v = value_new_error (&pos, "Internal error");
cell_assign_value (cell, v, NULL);
rendered_value_calc_size (cell);
/* TODO : Can we Use spancalc without too much performance overhead
* Seems like a better approach may be to do this at display time */
cell_render_value (cell, TRUE);
sheet_redraw_cell (cell);
}
......@@ -312,7 +315,7 @@ cell_set_text (Cell *cell, char const *text)
cell->base.flags &= ~CELL_HAS_EXPRESSION;
cell->value = val;
cell->format = format;
cell_render_value (cell);
cell_render_value (cell, TRUE);
} else { /* String was an expression */
cell_set_expr (cell, expr, format);
if (format) style_format_unref (format);
......@@ -352,7 +355,7 @@ cell_assign_value (Cell *cell, Value *v, StyleFormat *opt_fmt)
if (cell->value != NULL)
value_release (cell->value);
cell->value = v;
cell_render_value (cell);
cell_render_value (cell, TRUE);
}
/*
......@@ -631,9 +634,10 @@ cell_is_partial_array (Cell const *cell)
/***************************************************************************/
/*
* cell_render_value
/**
* cell_render_value :
* @cell: The cell whose value needs to be rendered
* @dynamic_width : Allow format to depend on column width.
*
* TODO :
* There is no reason currently for this to allocate the rendered value as
......@@ -642,15 +646,22 @@ cell_is_partial_array (Cell const *cell)
* are shared.
*/
void
cell_render_value (Cell *cell)
cell_render_value (Cell *cell, gboolean dynamic_width)
{
RenderedValue *rv;
MStyle *mstyle;
g_return_if_fail (cell != NULL);
rv = rendered_value_new (cell, NULL);
mstyle = cell_get_mstyle (cell);
rv = rendered_value_new (cell, mstyle, dynamic_width);
if (cell->rendered_value)
rendered_value_destroy (cell->rendered_value);
cell->rendered_value = rv;
rendered_value_calc_size_ext (cell, mstyle);
mstyle_unref (mstyle);
}
......@@ -756,7 +767,7 @@ cell_make_value (Cell *cell)
cell->base.flags &= ~CELL_HAS_EXPRESSION;
if (cell->rendered_value == NULL)
cell_render_value (cell);
cell_render_value (cell, TRUE);
cell_dirty (cell);
}
......@@ -91,6 +91,6 @@ char * cell_get_format (Cell const *cell);
void cell_set_format (Cell *cell, char const *format);
void cell_make_value (Cell *cell);
void cell_render_value (Cell *cell);
void cell_render_value (Cell *cell, gboolean dynamic_width);
#endif /* GNUMERIC_CELL_H */
......@@ -12,7 +12,7 @@
#include <glade/glade.h>
#include "gnumeric.h"
#include "workbook.h"
#include "workbook-control.h"
#include "workbook-control-gui-priv.h"
#include "gnumeric-util.h"
#include "dialogs.h"
......@@ -76,11 +76,8 @@ dialog_autosave (WorkbookControlGUI *wbcg)
gint v;
gboolean autosave_flag, prompt_flag;
autosave_t p;
Workbook *wb;
wb = wb_control_workbook (WORKBOOK_CONTROL (wbcg));
if (wb->autosave_timer != 0)
gtk_timeout_remove (wb->autosave_timer);
wb_control_gui_autosave_cancel (wbcg);
gui = gnumeric_glade_xml_new (wbcg, "autosave.glade");
if (gui == NULL)
......@@ -96,7 +93,7 @@ dialog_autosave (WorkbookControlGUI *wbcg)
return;
}
sprintf(buf, "%d", wb->autosave_minutes);
sprintf(buf, "%d", wbcg->autosave_minutes);
gtk_entry_set_text (GTK_ENTRY (p.minutes_entry), buf);
gnome_dialog_editable_enters (GNOME_DIALOG (dia),
......@@ -108,17 +105,17 @@ dialog_autosave (WorkbookControlGUI *wbcg)
gtk_object_set_user_data (GTK_OBJECT (autosave_on_off), &p);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (autosave_on_off),
wb->autosave);
wbcg->autosave);
if (!wb->autosave) {
if (!wbcg->autosave) {
gtk_widget_set_sensitive (p.minutes_entry, FALSE);
gtk_widget_set_sensitive (p.prompt_cb, FALSE);
}
if (wb->autosave_prompt)
if (wbcg->autosave_prompt)
gtk_toggle_button_set_active ((GtkToggleButton *)
p.prompt_cb,
wb->autosave_prompt);
wbcg->autosave_prompt);
gtk_signal_connect (GTK_OBJECT (p.prompt_cb), "toggled",
GTK_SIGNAL_FUNC (prompt_on_off_toggled),
&prompt_flag);
......@@ -140,9 +137,9 @@ loop:
goto loop;
}
if (autosave_flag)
workbook_autosave_set (wb, tmp, prompt_flag);
wb_control_gui_autosave_set (wbcg, tmp, prompt_flag);
else
workbook_autosave_cancel (wb);
wb_control_gui_autosave_cancel (wbcg);
} else if (v == 2) {
GnomeHelpMenuEntry help_ref = { "gnumeric", "autosave.html" };
gnome_help_display (NULL, &help_ref);
......
......@@ -181,7 +181,7 @@ gnumeric_goal_seek (WorkbookControlGUI *wbcg, Sheet *sheet,
(void) goal_seek_eval (oldx, &ydummy, &evaldata);
}
sheet_cell_calc_span (change_cell, SPANCALC_RESIZE);
sheet_cell_calc_span (change_cell, SPANCALC_RENDER);
sheet_flag_status_update_cell (change_cell);
sheet_redraw_cell (change_cell);
......
......@@ -100,10 +100,10 @@ typedef Value * (*ForeachCellCB)(Sheet *sheet, int col, int row,
typedef enum _SpanCalcFlags {
SPANCALC_SIMPLE = 0x0, /* Just calc spans */
SPANCALC_RESIZE = 0x1, /* Calculate the size of the rendered result */
SPANCALC_RENDER = 0x2, /* render and size any unrendered cells */
SPANCALC_RE_RENDER = 0x4, /* render of all cells */
SPANCALC_NO_DRAW = 0x8, /* Do not */
SPANCALC_RESIZE = 0x1, /* Calculate sizes of all cells */
SPANCALC_RE_RENDER = 0x2, /* Render and Size all cells */
SPANCALC_RENDER = 0x4, /* Render and Size any unrendered cells */
SPANCALC_NO_DRAW = 0x8, /* Do not queue a redraw */
} SpanCalcFlags;
#endif /* GNUMERIC_H */
......@@ -200,7 +200,7 @@ cb_grid_get_cell (int row, int col, gpointer data)
else
cell->value = controller->get_cell_content_cb (row, col, controller->cb_data);
res = rendered_value_new_ext (cell, mstyle);
res = rendered_value_new (cell, mstyle, TRUE);
cell->rendered_value = res;
......
......@@ -12,6 +12,8 @@
#include "gnumeric-util.h"
#include "render-ascii.h"
#include "rendered-value.h"
#include "sheet.h"
#include "mstyle.h"
/*
* Renders a CellRegion (we only deal with Cell Regions of type
......@@ -43,9 +45,14 @@ cell_region_render_ascii (CellRegion *cr)
char *v;
if (c_copy->type != CELL_COPY_TYPE_TEXT) {
RenderedValue *rv = rendered_value_new (c_copy->u.cell, styles);
MStyle *mstyle = sheet_style_compute_from_list (styles,
c_copy->u.cell->pos.col,
c_copy->u.cell->pos.row);
RenderedValue *rv = rendered_value_new (c_copy->u.cell,
mstyle, FALSE);
v = rendered_value_get_text (rv);
rendered_value_destroy (rv);
mstyle_unref (mstyle);
} else
v = g_strdup (c_copy->u.text);
......
......@@ -34,38 +34,17 @@
#include "application.h"
/**
* rendered_value_new
* @cell: The cell whose value needs to be rendered.
* @styles : An optional collection of styles.
*
* Returns a RenderedValue displaying the value of the cell formated according
* to the format style. If formulas are being displayed the text of the a
* formula instead of its value.
*/
RenderedValue *
rendered_value_new (Cell *cell, GList *styles)
{
MStyle *mstyle = (styles != NULL)
? sheet_style_compute_from_list (styles, cell->pos.col, cell->pos.row)
: cell_get_mstyle (cell);
RenderedValue *res = rendered_value_new_ext (cell, mstyle);
mstyle_unref (mstyle);
return res;
}
/**
* rendered_value_new_ext:
* rendered_value_new:
* @cell: The cell
* @mstyle: The mstyle associated with the cell
* @dynamic_width : Allow format to depend on column width.
*
* Formats the value of the cell according to the format style given in @mstyle
*
* Return value: a new RenderedValue
**/
RenderedValue *
rendered_value_new_ext (Cell *cell, MStyle *mstyle)
rendered_value_new (Cell *cell, MStyle *mstyle, gboolean dynamic_width)
{
RenderedValue *res;
Sheet *sheet;
......@@ -85,14 +64,16 @@ rendered_value_new_ext (Cell *cell, MStyle *mstyle)
str = g_strconcat ("=", tmpstr, NULL);
g_free (tmpstr);
color = NULL;
dynamic_width = FALSE;
} else if (mstyle_is_element_set (mstyle, MSTYLE_FORMAT)) {
/* entered text CAN be null if called by set_value */
StyleFormat *format = mstyle_get_format (mstyle);
/* For format general approximate the cell width in characters */
if (style_format_is_general(format)) {
if (cell->format == NULL ||
style_format_is_general (cell->format)) {
if (style_format_is_general (format)) {
if (dynamic_width &&
(cell->format == NULL ||
style_format_is_general (cell->format))) {
StyleFont *style_font =
sheet_view_get_style_font (sheet, mstyle);
GdkFont *gdk_font =
......@@ -114,9 +95,12 @@ rendered_value_new_ext (Cell *cell, MStyle *mstyle)
col_width = (COL_INTERNAL_WIDTH (cell->col_info)) / font_width;
style_font_unref (style_font);
} else
} else {
format = cell->format;
}
dynamic_width = FALSE;
}
} else
dynamic_width = FALSE;
str = format_value (format, cell->value, &color, col_width);
} else {
g_warning ("No format: serious error");
......@@ -129,6 +113,7 @@ rendered_value_new_ext (Cell *cell, MStyle *mstyle)
res->rendered_text = string_get (str);
res->render_color = color;
res->width_pixel = res->height_pixel = 0;
res->dynamic_width = dynamic_width;
g_free (str);
return res;
......
......@@ -24,11 +24,12 @@ struct _RenderedValue {
* Computed sizes of rendered text.
* In pixels EXCLUSIVE of margins and grid lines
*/
int width_pixel, height_pixel;
short width_pixel, height_pixel;
gboolean dynamic_width;
};
RenderedValue * rendered_value_new (Cell *cell, GList *styles);
RenderedValue * rendered_value_new_ext (Cell *cell, MStyle *mstyle);
RenderedValue * rendered_value_new (Cell *cell, MStyle *mstyle,
gboolean dynamic_width);
void rendered_value_destroy (RenderedValue *rv);
void rendered_value_calc_size (Cell const *cell);
void rendered_value_calc_size_ext (Cell const *cell, MStyle *mstyle);
......
......@@ -348,19 +348,13 @@ sheet_cell_calc_span (Cell const *cell, SpanCalcFlags flags)
g_return_if_fail (cell != NULL);
if (flags & SPANCALC_RENDER) {
RenderedValue const *rv = cell->rendered_value;
if (rv == NULL) {
render = TRUE;
resize = TRUE;
} else if (rv->width_pixel == 0 && rv->width_pixel == 0)
resize = TRUE;
}
/* Render & Size any unrendered cells */
if ((flags & SPANCALC_RENDER) && cell->rendered_value == NULL)
render = TRUE;
if (render)
cell_render_value ((Cell *)cell);
if (resize)
cell_render_value ((Cell *)cell, TRUE);
else if (resize)
rendered_value_calc_size (cell);
/* Calculate the span of the cell */
......@@ -999,7 +993,15 @@ static Value *
cb_max_cell_width (Sheet *sheet, int col, int row, Cell *cell,
int *max)
{
int const width = cell_rendered_width (cell);
int width;
g_return_val_if_fail (cell->rendered_value != NULL, NULL);
/* Dynamic cells must be rerendered */
if (cell->rendered_value->dynamic_width)
cell_render_value (cell, FALSE);
width = cell_rendered_width (cell);
if (width > *max)
*max = width;
return NULL;
......
......@@ -138,5 +138,5 @@ workbook_style_test (Workbook *wb)
sheets = g_list_remove (sheets, sheet);
}
workbook_recalc (wb);
workbook_calc_spans (wb, SPANCALC_RENDER|SPANCALC_RESIZE);
workbook_calc_spans (wb, SPANCALC_RENDER);
}
......@@ -11,7 +11,9 @@
struct _WorkbookControlGUI {
WorkbookControl wb_control;
/* FIXME : This is a mess, reorder to be more logical */
GtkWindow *toplevel;
GtkNotebook *notebook;
#ifdef ENABLE_BONOBO
BonoboUIComponent *uic;
GtkWidget *progress_bar;
......@@ -30,9 +32,6 @@ struct _WorkbookControlGUI {
GtkWidget *object_toolbar;
#endif
GtkWindow *toplevel;
GtkNotebook *notebook;
/* Combos */
GtkWidget *font_name_selector;
GtkWidget *font_size_selector;
......@@ -60,10 +59,10 @@ struct _WorkbookControlGUI {
void *auto_complete; /* GtkType is (Complete *) */
gboolean auto_completing;
char *auto_complete_text;
/* Used to detect if the user has backspaced, so we turn off auto-complete */
int auto_max_size;
/* FIXME : should be in the View */
/* When editing a cell: the cell (may be NULL) */
Cell *editing_cell;
Sheet *editing_sheet;
......@@ -79,8 +78,15 @@ struct _WorkbookControlGUI {
/* Edit area */
GtkWidget *selection_descriptor; /* A GtkEntry */
/* Used to pass information to tha async paste handler. */
PasteTarget *clipboard_paste_callback_data;
/* Autosave */
gboolean autosave;
gboolean autosave_prompt;
gint autosave_minutes;
gint autosave_timer;
};
typedef struct {
......
......@@ -94,6 +94,54 @@ wb_control_gui_focus_cur_sheet (WorkbookControlGUI *wbcg)
return sheet_view->sheet;
}
/****************************************************************************/
/* Autosave */
static gboolean
cb_autosave (gpointer *data)
{
WorkbookView *wb_view;
WorkbookControlGUI *wbcg = (WorkbookControlGUI *)data;
g_return_val_if_fail (IS_WORKBOOK_CONTROL (wbcg), FALSE);
wb_view = wb_control_view (WORKBOOK_CONTROL (wbcg));
if (wb_view == NULL)
return FALSE;
if (wbcg->autosave && workbook_is_dirty (wb_view_workbook (wb_view))) {
if (wbcg->autosave_prompt && !dialog_autosave_prompt (wbcg))
return TRUE;
workbook_save (wbcg, wb_view);
}
return TRUE;
}
void
wb_control_gui_autosave_cancel (WorkbookControlGUI *wbcg)
{
if (wbcg->autosave_timer != 0) {
gtk_timeout_remove (wbcg->autosave_timer);
wbcg->autosave_timer = 0;
}
}
void
wb_control_gui_autosave_set (WorkbookControlGUI *wbcg,
int minutes, gboolean prompt)
{
wb_control_gui_autosave_cancel (wbcg);
wbcg->autosave = (minutes != 0);
wbcg->autosave_minutes = minutes;
wbcg->autosave_prompt = prompt;
if (wbcg->autosave)
wbcg->autosave_timer = gtk_timeout_add (minutes * 60000,
(GtkFunction) cb_autosave, wbcg);
}
/****************************************************************************/
static WorkbookControl *
wbcg_control_new (WorkbookControl *wbc, WorkbookView *wbv, Workbook *wb)
{
......@@ -1322,11 +1370,8 @@ cb_cell_rerender (gpointer element, gpointer userdata)
{
Dependent *dep = element;
int const t = (dep->flags & DEPENDENT_TYPE_MASK);
if (t == DEPENDENT_CELL) {
Cell *cell = DEP_TO_CELL (dep);
cell_render_value (cell);
rendered_value_calc_size (cell);
}
if (t == DEPENDENT_CELL)
sheet_cell_calc_span (DEP_TO_CELL (dep), SPANCALC_RE_RENDER);
}
static void
......@@ -2973,6 +3018,11 @@ workbook_control_gui_init (WorkbookControlGUI *wbcg,
sy = (sy * 3) / 4;
wbcg_size_pixels_set (WORKBOOK_CONTROL (wbcg), sx, sy);
/* Init autosave */
wbcg->autosave_timer = 0;
wbcg->autosave_minutes = 0;
wbcg->autosave_prompt = FALSE;
gtk_widget_show_all (GTK_WIDGET (wbcg->toplevel));
}
......
......@@ -16,7 +16,11 @@ void workbook_control_gui_init (WorkbookControlGUI *wbcg,
WorkbookView *optional_view,
Workbook *optional_wb);
GtkWindow *wb_control_gui_toplevel (WorkbookControlGUI *wbcg);
GtkWindow *wb_control_gui_toplevel (WorkbookControlGUI *wbcg);
Sheet * wb_control_gui_focus_cur_sheet (WorkbookControlGUI *wbcg);
void wb_control_gui_autosave_cancel (WorkbookControlGUI *wbcg);
void wb_control_gui_autosave_set (WorkbookControlGUI *wbcg,
int minutes, gboolean prompt);
#endif /* GNUMERIC_WORKBOOK_CONTROL_GUI_H */
......@@ -314,7 +314,7 @@ cb_modify_cell_region (Sheet *sheet, Range const *r, void *closure)
sheet, TRUE,
r->start.col, r->start.row, r->end.col, r->end.row,
modify_cell_format, closure);
sheet_range_calc_spans (sheet, *r, SPANCALC_RE_RENDER|SPANCALC_RESIZE);
sheet_range_calc_spans (sheet, *r, SPANCALC_RE_RENDER);
}
/*
......@@ -492,19 +492,19 @@ workbook_format_toolbar_orient (GtkToolbar *toolbar,
GtkOrientation dir,
gpointer closure)
{
WorkbookControlGUI *wbcgg = closure;
WorkbookControlGUI *wbcg = closure;
GtkWidget *font_button;
font_button = gnumeric_toolbar_get_widget (GNUMERIC_TOOLBAR (toolbar),
TOOLBAR_FONT_BUTTON_INDEX);
if (dir == GTK_ORIENTATION_HORIZONTAL) {
gtk_widget_show (wbcgg->font_name_selector);
gtk_widget_show (wbcgg->font_size_selector);
gtk_widget_show (wbcg->font_name_selector);
gtk_widget_show (wbcg->font_size_selector);
gtk_widget_hide (font_button);