diff -urN --minimal gnumeric-1.0.8/src/cell.c gnumeric-1.0.8-sleeping_v2/src/cell.c
--- gnumeric-1.0.8/src/cell.c Tue Dec 25 22:43:18 2001
+++ gnumeric-1.0.8-sleeping_v2/src/cell.c Fri Jul 12 12:00:13 2002
@@ -140,7 +140,7 @@
}
/**
- * cell_eval_content:
+ * cell_eval_content_always:
* @cell: the cell to evaluate.
*
* This function evaluates the contents of the cell,
@@ -148,7 +148,7 @@
* function.
**/
gboolean
-cell_eval_content (Cell *cell)
+cell_eval_content_always (Cell *cell)
{
static Cell *iterating = NULL;
Value *v;
@@ -274,6 +274,26 @@
return iterating == NULL;
}
+gboolean
+cell_eval_content (Cell *cell)
+{
+ /* FBK:
+ * Don't evaluate if the cell is sleeping and that hasn't
+ * been asked for, or if the cell isn't sleeping and we're
+ * only recalculating sleeping ones.
+ */
+ if (cell_is_sleeping (cell) ) {
+ if (cell->base.sheet->workbook->update_sleeping == FALSE)) {
+ return TRUE;
+ }
+ }
+ else if (cell->base.sheet->workbook->update_only_sleeping == TRUE)) {
+ return TRUE;
+ }
+
+ return cell_eval_content_always (cell);
+}
+
/*
* cell_relocate:
* @cell : The cell that is changing position
@@ -726,6 +746,18 @@
}
return result;
+}
+
+void
+cell_set_sleeping (Cell *cell)
+{
+ mstyle_set_content_sleeping(cell_get_mstyle(cell), TRUE);
+}
+
+gboolean
+cell_is_sleeping(Cell const *cell)
+{
+ return mstyle_get_content_sleeping(cell_get_mstyle(cell));
}
/*
diff -urN --minimal gnumeric-1.0.8/src/cell.h gnumeric-1.0.8-sleeping_v2/src/cell.h
--- gnumeric-1.0.8/src/cell.h Fri Jan 25 08:44:03 2002
+++ gnumeric-1.0.8-sleeping_v2/src/cell.h Fri Jul 12 11:48:46 2002
@@ -92,6 +92,8 @@
MStyle *cell_get_mstyle (Cell const *cell);
char * cell_get_format (Cell const *cell);
void cell_set_format (Cell *cell, char const *format);
+void cell_set_sleeping (Cell *cell);
+gboolean cell_is_sleeping (Cell const *cell);
void cell_render_value (Cell *cell, gboolean dynamic_width);
int cell_rendered_height (Cell const * cell);
diff -urN --minimal gnumeric-1.0.8/src/commands.c gnumeric-1.0.8-sleeping_v2/src/commands.c
--- gnumeric-1.0.8/src/commands.c Sat May 4 19:23:33 2002
+++ gnumeric-1.0.8-sleeping_v2/src/commands.c Fri Jul 12 11:48:46 2002
@@ -1329,6 +1329,36 @@
return command_push_undo (wbc, obj);
}
+ /**
+ Force evaluation of current cell
+ **/
+/* ?? Why always just the first cell ??*/
+gboolean
+cmd_activate_cell (WorkbookControl *wbc, Sheet *sheet)
+{
+ GSList *l = selection_get_ranges (sheet, FALSE /* No intersection */);
+ for (; l; l = l->next) {
+ Range range = *((Range const *)l->data);
+
+ Cell *cell = sheet_cell_get (sheet, range.start.col, range.start.row);
+
+ if (cell) {
+ cell_eval_content_always (cell);
+ }
+ }
+ return FALSE;
+}
+
+/* ?? Why always just the first cell ??*/
+gboolean
+cmd_set_sleeping (WorkbookControl *wbc, Sheet *sheet, Range const *sel)
+{
+ Cell *cell = sheet_cell_get (sheet, sel->start.col, sel->start.row);
+
+ if (cell) {
+ cell_set_sleeping (cell);
+ }
+}
/******************************************************************/
#define CMD_FORMAT_TYPE (cmd_format_get_type ())
diff -urN --minimal gnumeric-1.0.8/src/commands.h gnumeric-1.0.8-sleeping_v2/src/commands.h
--- gnumeric-1.0.8/src/commands.h Sat Nov 17 07:29:16 2001
+++ gnumeric-1.0.8-sleeping_v2/src/commands.h Fri Jul 12 11:48:46 2002
@@ -60,6 +60,9 @@
gboolean cmd_clear_selection (WorkbookControl *wbc, Sheet *sheet,
int clear_flags);
+gboolean cmd_activate_cell (WorkbookControl *wbc, Sheet *sheet);
+/* ?? How do I deactivate this ?? */
+gboolean cmd_set_sleeping (WorkbookControl *wbc, Sheet *sheet, Range const *sel);
gboolean cmd_autoformat (WorkbookControl *wbc, Sheet *sheet, FormatTemplate *ft);
diff -urN --minimal gnumeric-1.0.8/src/dialogs/cell-format.glade gnumeric-1.0.8-sleeping_v2/src/dialogs/cell-format.glade
--- gnumeric-1.0.8/src/dialogs/cell-format.glade Sun Mar 17 23:34:17 2002
+++ gnumeric-1.0.8-sleeping_v2/src/dialogs/cell-format.glade Fri Jul 12 11:48:46 2002
@@ -1186,7 +1186,6 @@
0.5
0
0
- combo-entry2
0
False
@@ -3164,70 +3163,93 @@
- GtkVBox
- protection_box
- 4
- False
- 4
+ GtkAlignment
+ alignment54
+ 0.5
+ 0.5
+ 1
+ 1
- GtkCheckButton
- protection_locked
- True
-
- False
- True
-
- 0
- False
- False
-
-
+ GtkVBox
+ protection_box
+ 4
+ False
+ 4
-
- GtkCheckButton
- protection_hidden
- True
-
- False
- True
-
- 0
- False
- False
-
-
+
+ GtkCheckButton
+ protection_locked
+ True
+
+ False
+ True
+
+ 0
+ False
+ False
+
+
-
- GtkLabel
- label28
-
- GTK_JUSTIFY_LEFT
- True
- 0
- 0
- 0
- 10
-
- 0
- False
- False
-
-
+
+ GtkCheckButton
+ protection_hidden
+ True
+
+ False
+ True
+
+ 0
+ False
+ False
+
+
-
- GtkCheckButton
- protection_sheet_protected
- False
- True
-
- False
- True
-
- 0
- False
- False
-
+
+ GtkCheckButton
+ protection_sleeping
+ True
+
+ False
+ True
+
+ 0
+ False
+ False
+
+
+
+
+ GtkLabel
+ label28
+
+ GTK_JUSTIFY_LEFT
+ True
+ 0
+ 0
+ 0
+ 10
+
+ 0
+ False
+ False
+
+
+
+
+ GtkCheckButton
+ protection_sheet_protected
+ False
+ True
+
+ False
+ True
+
+ 0
+ False
+ False
+
+
diff -urN --minimal gnumeric-1.0.8/src/dialogs/dialog-cell-format.c gnumeric-1.0.8-sleeping_v2/src/dialogs/dialog-cell-format.c
--- gnumeric-1.0.8/src/dialogs/dialog-cell-format.c Thu May 9 22:18:44 2002
+++ gnumeric-1.0.8-sleeping_v2/src/dialogs/dialog-cell-format.c Fri Jul 12 11:48:46 2002
@@ -159,7 +159,7 @@
PatternPicker pattern;
} back;
struct {
- GtkCheckButton *hidden, *locked;
+ GtkCheckButton *hidden, *locked, *sleeping;
} protection;
struct {
GtkTable *criteria_table;
@@ -1983,6 +1983,16 @@
}
static void
+cb_protection_sleeping_toggle (GtkToggleButton *button, FormatState *state)
+{
+ if (state->enable_edit) {
+ mstyle_set_content_sleeping (state->result,
+ gtk_toggle_button_get_active (button));
+ fmt_dialog_changed (state);
+ }
+}
+
+static void
fmt_dialog_init_protection_page (FormatState *state)
{
GtkWidget *w;
@@ -2005,6 +2015,16 @@
gtk_signal_connect (GTK_OBJECT (w),
"toggled", GTK_SIGNAL_FUNC (cb_protection_hidden_toggle),
state);
+
+ flag = mstyle_is_element_conflict (state->style, MSTYLE_CONTENT_SLEEPING)
+ ? FALSE : mstyle_get_content_sleeping (state->style);
+ w = glade_xml_get_widget (state->gui, "protection_sleeping");
+ state->protection.sleeping = GTK_CHECK_BUTTON (w);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), flag);
+ gtk_signal_connect (GTK_OBJECT (w),
+ "toggled", GTK_SIGNAL_FUNC (cb_protection_sleeping_toggle),
+ state);
+
}
/*****************************************************************************/
diff -urN --minimal gnumeric-1.0.8/src/mstyle.c gnumeric-1.0.8-sleeping_v2/src/mstyle.c
--- gnumeric-1.0.8/src/mstyle.c Mon Feb 25 16:17:31 2002
+++ gnumeric-1.0.8-sleeping_v2/src/mstyle.c Fri Jul 12 11:48:46 2002
@@ -60,6 +60,7 @@
gboolean wrap_text;
gboolean content_locked;
gboolean content_hidden;
+ gboolean content_sleeping;
Validation *validation;
@@ -99,7 +100,8 @@
case MSTYLE_FONT_STRIKETHROUGH: \
case MSTYLE_WRAP_TEXT:\
case MSTYLE_CONTENT_LOCKED:\
- case MSTYLE_CONTENT_HIDDEN
+ case MSTYLE_CONTENT_HIDDEN:\
+ case MSTYLE_CONTENT_SLEEPING
#define MSTYLE_ANY_GUINT16 MSTYLE_ALIGN_V: \
case MSTYLE_ALIGN_H
@@ -137,6 +139,7 @@
"WrapText",
"Content.Locked",
"Content.Hidden",
+ "Content.Sleeping",
"Validation"
};
@@ -378,6 +381,10 @@
if (a->u.content_hidden == b->u.content_hidden)
return TRUE;
break;
+ case MSTYLE_CONTENT_SLEEPING:
+ if (a->u.content_sleeping == b->u.content_sleeping)
+ return TRUE;
+ break;
case MSTYLE_VALIDATION:
if (a->u.validation == b->u.validation)
return TRUE;
@@ -616,6 +623,7 @@
mstyle_set_wrap_text (mstyle, FALSE);
mstyle_set_content_locked (mstyle, TRUE);
mstyle_set_content_hidden (mstyle, FALSE);
+ mstyle_set_content_sleeping (mstyle, FALSE);
mstyle_set_font_name (mstyle, DEFAULT_FONT);
mstyle_set_font_bold (mstyle, FALSE);
mstyle_set_font_italic (mstyle, FALSE);
@@ -1241,6 +1249,7 @@
return style->elements [MSTYLE_CONTENT_LOCKED].u.wrap_text;
}
+
void
mstyle_set_content_hidden (MStyle *style, gboolean f)
{
@@ -1256,6 +1265,23 @@
g_return_val_if_fail (mstyle_is_element_set (style, MSTYLE_CONTENT_HIDDEN), FALSE);
return style->elements [MSTYLE_CONTENT_HIDDEN].u.wrap_text;
+}
+
+void
+mstyle_set_content_sleeping (MStyle *style, gboolean f)
+{
+ g_return_if_fail (style != NULL);
+
+ style->elements[MSTYLE_CONTENT_SLEEPING].type = MSTYLE_CONTENT_SLEEPING;
+ style->elements[MSTYLE_CONTENT_SLEEPING].u.wrap_text = f;
+}
+
+gboolean
+mstyle_get_content_sleeping (const MStyle *style)
+{
+ g_return_val_if_fail (mstyle_is_element_set (style, MSTYLE_CONTENT_SLEEPING), FALSE);
+
+ return style->elements [MSTYLE_CONTENT_SLEEPING].u.wrap_text;
}
void
diff -urN --minimal gnumeric-1.0.8/src/mstyle.h gnumeric-1.0.8-sleeping_v2/src/mstyle.h
--- gnumeric-1.0.8/src/mstyle.h Sat Jan 12 09:06:59 2002
+++ gnumeric-1.0.8-sleeping_v2/src/mstyle.h Fri Jul 12 11:48:46 2002
@@ -47,6 +47,7 @@
MSTYLE_CONTENT_LOCKED,
MSTYLE_CONTENT_HIDDEN,
+ MSTYLE_CONTENT_SLEEPING,
MSTYLE_VALIDATION,
/* Delimiter */
@@ -119,6 +120,8 @@
gboolean mstyle_get_content_locked (const MStyle *st);
void mstyle_set_content_hidden (MStyle *st, gboolean f);
gboolean mstyle_get_content_hidden (const MStyle *st);
+void mstyle_set_content_sleeping (MStyle *st, gboolean f);
+gboolean mstyle_get_content_sleeping (const MStyle *st);
void mstyle_set_validation (MStyle *st, Validation *v);
Validation *mstyle_get_validation (const MStyle *st);
diff -urN --minimal gnumeric-1.0.8/src/workbook-control-gui.c gnumeric-1.0.8-sleeping_v2/src/workbook-control-gui.c
--- gnumeric-1.0.8/src/workbook-control-gui.c Sun Jun 2 02:08:32 2002
+++ gnumeric-1.0.8-sleeping_v2/src/workbook-control-gui.c Fri Jul 12 12:02:32 2002
@@ -1901,7 +1901,31 @@
cb_edit_recalc (GtkWidget *widget, WorkbookControlGUI *wbcg)
{
/* sheet_dump_dependencies (wb_control_cur_sheet (WORKBOOK_CONTROL (wbcg))); */
- workbook_recalc_all (wb_control_workbook (WORKBOOK_CONTROL (wbcg)));
+ Workbook* wb = wb_control_workbook (WORKBOOK_CONTROL (wbcg));
+ wb->update_sleeping = FALSE;
+ wb->update_only_sleeping = FALSE;
+ workbook_recalc_all (wb);
+}
+
+static void
+cb_edit_recalc_all(GtkWidget *widget, WorkbookControlGUI *wbcg)
+{
+ Workbook* wb = wb_control_workbook (WORKBOOK_CONTROL (wbcg));
+ wb->update_sleeping = TRUE;
+ wb->update_only_sleeping = FALSE;
+ workbook_recalc_all (wb);
+ wb->update_sleeping = FALSE;
+}
+
+static void
+cb_edit_calc_sleeping(GtkWidget *widget, WorkbookControlGUI *wbcg)
+{
+ Workbook* wb = wb_control_workbook (WORKBOOK_CONTROL (wbcg));
+ wb->update_sleeping = TRUE;
+ wb->update_only_sleeping = TRUE;
+ workbook_recalc_all (wb);
+ wb->update_sleeping = FALSE;
+ wb->update_only_sleeping = FALSE
}
/****************************************************************************/
@@ -2703,6 +2727,21 @@
GNOMEUIINFO_END
};
+static GnomeUIInfo workbook_menu_edit_recalculate [] = {
+ GNOMEUIINFO_ITEM_NODE (N_("Recalculate"),
+ N_("Recalculate the spreadsheet"),
+ cb_edit_recalc),
+ GNOMEUIINFO_ITEM_NODE (N_("Recalculate _All"),
+ N_("Recalculate the spreadsheet including sleeping cells"),
+ cb_edit_recalc_all),
+ GNOMEUIINFO_ITEM_NODE (N_("_Calculate Sleeping"),
+ N_("Calculate only the sleeping cells in the spreadsheet"),
+ cb_edit_calc_sleeping),
+
+ GNOMEUIINFO_END
+}
+
+
static GnomeUIInfo workbook_menu_edit_sheet [] = {
GNOMEUIINFO_ITEM_NONE (N_("_Duplicate"),
N_("Make a copy of the current sheet"),
@@ -2789,10 +2828,7 @@
cb_edit_goto,
NULL, NULL, 0, 0, GDK_F5, 0 },
- { GNOME_APP_UI_ITEM, N_("Recalculate"),
- N_("Recalculate the spreadsheet"),
- cb_edit_recalc,
- NULL, NULL, 0, 0, GDK_F9, 0 },
+ GNOMEUIINFO_SUBTREE(N_("Recalculate"), workbook_menu_edit_recalculate),
GNOMEUIINFO_END
};
@@ -3289,6 +3325,8 @@
BONOBO_UI_UNSAFE_VERB ("EditSearchReplace", cb_edit_search_replace),
BONOBO_UI_UNSAFE_VERB ("EditGoto", cb_edit_goto),
BONOBO_UI_UNSAFE_VERB ("EditRecalc", cb_edit_recalc),
+ BONOBO_UI_UNSAFE_VERB ("EditRecalcAll", cb_edit_recalc_all),
+ BONOBO_UI_UNSAFE_VERB ("EditCalcSleeping", cb_edit_calc_sleeping),
BONOBO_UI_UNSAFE_VERB ("ViewNewShared", cb_view_new_shared),
BONOBO_UI_UNSAFE_VERB ("ViewNewUnshared", cb_view_new_unshared),
diff -urN --minimal gnumeric-1.0.8/src/workbook.c gnumeric-1.0.8-sleeping_v2/src/workbook.c
--- gnumeric-1.0.8/src/workbook.c Thu Jan 31 04:11:27 2002
+++ gnumeric-1.0.8-sleeping_v2/src/workbook.c Fri Jul 12 12:04:01 2002
@@ -376,6 +376,9 @@
summary_info_default (wb->summary_info);
wb->summary_info->modified = FALSE;
+ wb->update_sleeping = FALSE;
+ wb->update_only_sleeping = FALSE;
+
/* Nothing to undo or redo */
wb->undo_commands = wb->redo_commands = NULL;
diff -urN --minimal gnumeric-1.0.8/src/workbook.h gnumeric-1.0.8-sleeping_v2/src/workbook.h
--- gnumeric-1.0.8/src/workbook.h Thu Dec 20 00:53:19 2001
+++ gnumeric-1.0.8-sleeping_v2/src/workbook.h Fri Jul 12 12:03:40 2002
@@ -23,6 +23,10 @@
gboolean modified;
+ /* booleans to keep state whether sleeping cells are to be recalculated */
+ gboolean update_sleeping;
+ gboolean update_only_sleeping;
+
/* Attribute list */
GList *attributes;
diff -urN --minimal gnumeric-1.0.8/src/xml-io.c gnumeric-1.0.8-sleeping_v2/src/xml-io.c
--- gnumeric-1.0.8/src/xml-io.c Fri Apr 12 22:44:37 2002
+++ gnumeric-1.0.8-sleeping_v2/src/xml-io.c Fri Jul 12 11:48:46 2002
@@ -581,6 +581,8 @@
xml_node_set_int (cur, "Locked", mstyle_get_content_locked (style));
if (mstyle_is_element_set (style, MSTYLE_CONTENT_HIDDEN))
xml_node_set_int (cur, "Hidden", mstyle_get_content_hidden (style));
+ if (mstyle_is_element_set (style, MSTYLE_CONTENT_SLEEPING))
+ xml_node_set_int (cur, "Sleeping", mstyle_get_content_sleeping (style));
if (mstyle_is_element_set (style, MSTYLE_COLOR_FORE))
xml_node_set_color (cur, "Fore", mstyle_get_color (style, MSTYLE_COLOR_FORE));
@@ -1396,6 +1398,8 @@
mstyle_set_content_locked (mstyle, val);
if (xml_node_get_int (tree, "Hidden", &val))
mstyle_set_content_hidden (mstyle, val);
+ if (xml_node_get_int (tree, "Sleeping", &val))
+ mstyle_set_content_sleeping (mstyle, val);
if (xml_node_get_int (tree, "VAlign", &val))
mstyle_set_align_v (mstyle, val);