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

make headers optional. make headers optional. make headers optional.

2001-09-18  Jody Goldberg <jgoldberg@home.com>

	* src/sheet-control-gui.c (scg_redraw_all) : make headers optional.
	* src/sheet-control.c (sc_redraw_all) : make headers optional.
	* src/sheet.c (sheet_redraw_all) : make headers optional.

	* src/colrow.c (colrow_set_visibility_list) : redraw_all does headers.

	* src/cell.c (cell_eval_content) : don't redraw here, and only render
	  if we were already rendered.  This will avoid rendering sheets no
	  one is looking at.

	* src/eval.c (workbook_recalc) : after a recalc redraw all, but not
	  headers.

2001-09-17  Jody Goldberg <jgoldberg@home.com>

	* src/workbook-control.c (wb_control_menu_state_sensitivity) : new
	  virtual.

	* src/workbook-control-gui.c (wbcg_menu_state_sensitivity) : renamed
	  and moved from.
	* src/workbook-edit.c (workbook_edit_toolbars_set_sensitive). here.

	* src/workbook-view.c (wb_view_open_custom) : Use
	  wb_control_menu_state_sensitivity to enable/disable
	  the menus and toolbars of the manging contol.
parent 85e8f8da
2001-09-18 Jody Goldberg <jgoldberg@home.com>
* src/sheet-control-gui.c (scg_redraw_all) : make headers optional.
* src/sheet-control.c (sc_redraw_all) : make headers optional.
* src/sheet.c (sheet_redraw_all) : make headers optional.
* src/colrow.c (colrow_set_visibility_list) : redraw_all does headers.
* src/cell.c (cell_eval_content) : don't redraw here, and only render
if we were already rendered. This will avoid rendering sheets no
one is looking at.
* src/eval.c (workbook_recalc) : after a recalc redraw all, but not
headers.
2001-09-17 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control.c (wb_control_menu_state_sensitivity) : new
virtual.
* src/workbook-control-gui.c (wbcg_menu_state_sensitivity) : renamed
and moved from.
* src/workbook-edit.c (workbook_edit_toolbars_set_sensitive). here.
* src/workbook-view.c (wb_view_open_custom) : Use
wb_control_menu_state_sensitivity to enable/disable
the menus and toolbars of the manging contol.
2001-09-17 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_cell_new) : add some protection.
......
......@@ -19,6 +19,7 @@ Jody:
* Parse using the assigned fmt before checking the builtins.
* Add simple bucketing of range dependencies.
* Add minor formating extension.
* Some simple recalc tuning speeds things up by a factor of 2.
* Cleanup the DOM based xml import/export utilities.
* Remove irritating frame around bonobo objects.
* Improve sheet object menus.
......
2001-09-18 Jody Goldberg <jgoldberg@home.com>
* src/sheet-control-gui.c (scg_redraw_all) : make headers optional.
* src/sheet-control.c (sc_redraw_all) : make headers optional.
* src/sheet.c (sheet_redraw_all) : make headers optional.
* src/colrow.c (colrow_set_visibility_list) : redraw_all does headers.
* src/cell.c (cell_eval_content) : don't redraw here, and only render
if we were already rendered. This will avoid rendering sheets no
one is looking at.
* src/eval.c (workbook_recalc) : after a recalc redraw all, but not
headers.
2001-09-17 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control.c (wb_control_menu_state_sensitivity) : new
virtual.
* src/workbook-control-gui.c (wbcg_menu_state_sensitivity) : renamed
and moved from.
* src/workbook-edit.c (workbook_edit_toolbars_set_sensitive). here.
* src/workbook-view.c (wb_view_open_custom) : Use
wb_control_menu_state_sensitivity to enable/disable
the menus and toolbars of the manging contol.
2001-09-17 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_cell_new) : add some protection.
......
2001-09-18 Jody Goldberg <jgoldberg@home.com>
* src/sheet-control-gui.c (scg_redraw_all) : make headers optional.
* src/sheet-control.c (sc_redraw_all) : make headers optional.
* src/sheet.c (sheet_redraw_all) : make headers optional.
* src/colrow.c (colrow_set_visibility_list) : redraw_all does headers.
* src/cell.c (cell_eval_content) : don't redraw here, and only render
if we were already rendered. This will avoid rendering sheets no
one is looking at.
* src/eval.c (workbook_recalc) : after a recalc redraw all, but not
headers.
2001-09-17 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control.c (wb_control_menu_state_sensitivity) : new
virtual.
* src/workbook-control-gui.c (wbcg_menu_state_sensitivity) : renamed
and moved from.
* src/workbook-edit.c (workbook_edit_toolbars_set_sensitive). here.
* src/workbook-view.c (wb_view_open_custom) : Use
wb_control_menu_state_sensitivity to enable/disable
the menus and toolbars of the manging contol.
2001-09-17 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_cell_new) : add some protection.
......
2001-09-18 Jody Goldberg <jgoldberg@home.com>
* src/sheet-control-gui.c (scg_redraw_all) : make headers optional.
* src/sheet-control.c (sc_redraw_all) : make headers optional.
* src/sheet.c (sheet_redraw_all) : make headers optional.
* src/colrow.c (colrow_set_visibility_list) : redraw_all does headers.
* src/cell.c (cell_eval_content) : don't redraw here, and only render
if we were already rendered. This will avoid rendering sheets no
one is looking at.
* src/eval.c (workbook_recalc) : after a recalc redraw all, but not
headers.
2001-09-17 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control.c (wb_control_menu_state_sensitivity) : new
virtual.
* src/workbook-control-gui.c (wbcg_menu_state_sensitivity) : renamed
and moved from.
* src/workbook-edit.c (workbook_edit_toolbars_set_sensitive). here.
* src/workbook-view.c (wb_view_open_custom) : Use
wb_control_menu_state_sensitivity to enable/disable
the menus and toolbars of the manging contol.
2001-09-17 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_cell_new) : add some protection.
......
This diff is collapsed.
......@@ -253,7 +253,13 @@ iterate :
if (cell->value != NULL)
value_release (cell->value);
cell->value = v;
cell_render_value (cell, TRUE);
/* Optimization : only render if it had already been rendered.
* If it had not been rendered yet, then we're probably not
* looking at this sheet.
*/
if (cell->rendered_value != NULL)
cell_render_value (cell, TRUE);
}
if (iterating == cell)
......@@ -263,7 +269,6 @@ iterate :
printf ("} (%d)\n", iterating == NULL);
#endif
cell->base.flags &= ~DEPENDENT_BEING_CALCULATED;
sheet_redraw_cell (cell);
return iterating == NULL;
}
......@@ -801,8 +806,6 @@ cellpos_cmp (CellPos const * a, CellPos const * b)
return (a->row == b->row && a->col == b->col);
}
CellComment *
cell_has_comment_pos (const Sheet *sheet, const CellPos *pos)
{
......
......@@ -692,8 +692,7 @@ colrow_set_visibility_list (Sheet *sheet, gboolean const is_cols,
&min_col, &max_col);
}
sheet_redraw_all (sheet);
sheet_redraw_headers (sheet, TRUE, TRUE, NULL);
sheet_redraw_all (sheet, TRUE);
}
/**
......
......@@ -35,7 +35,7 @@
#include "cell.h"
#include "sheet.h"
#define BUCKET_SIZE 256
#define BUCKET_SIZE 128
#define UNLINK_DEP(dep) \
do { \
......@@ -1106,6 +1106,7 @@ workbook_recalc (Workbook *wb)
g_return_if_fail (IS_WORKBOOK (wb));
WORKBOOK_FOREACH_DEPENDENT (wb, dep, dependent_eval (dep););
WORKBOOK_FOREACH_SHEET (wb, sheet, sheet_redraw_all (sheet, FALSE););
}
/**
......
......@@ -35,7 +35,7 @@
#include "cell.h"
#include "sheet.h"
#define BUCKET_SIZE 256
#define BUCKET_SIZE 128
#define UNLINK_DEP(dep) \
do { \
......@@ -1106,6 +1106,7 @@ workbook_recalc (Workbook *wb)
g_return_if_fail (IS_WORKBOOK (wb));
WORKBOOK_FOREACH_DEPENDENT (wb, dep, dependent_eval (dep););
WORKBOOK_FOREACH_SHEET (wb, sheet, sheet_redraw_all (sheet, FALSE););
}
/**
......
......@@ -73,7 +73,7 @@ scg_get_wbcg (SheetControlGUI const *scg)
}
static void
scg_redraw_all (SheetControl *sc)
scg_redraw_all (SheetControl *sc, gboolean headers)
{
int i;
SheetControlGUI *scg = (SheetControlGUI *)sc;
......@@ -85,14 +85,16 @@ scg_redraw_all (SheetControl *sc)
gnome_canvas_request_redraw (
GNOME_CANVAS (pane->gcanvas),
0, 0, INT_MAX, INT_MAX);
if (NULL != pane->col.canvas)
gnome_canvas_request_redraw (
pane->col.canvas,
0, 0, INT_MAX, INT_MAX);
if (NULL != pane->row.canvas)
gnome_canvas_request_redraw (
pane->row.canvas,
0, 0, INT_MAX, INT_MAX);
if (headers) {
if (NULL != pane->col.canvas)
gnome_canvas_request_redraw (
pane->col.canvas,
0, 0, INT_MAX, INT_MAX);
if (NULL != pane->row.canvas)
gnome_canvas_request_redraw (
pane->row.canvas,
0, 0, INT_MAX, INT_MAX);
}
}
}
......@@ -111,7 +113,6 @@ scg_redraw_region (SheetControl *sc,
}
}
/* A rough guess of the trade off point between of redrawing all
* and calculating the redraw size
*/
......@@ -146,9 +147,8 @@ scg_redraw_headers (SheetControl *sc,
}
}
/* Request excludes the far coordinate. Add 1 to include them */
gnome_canvas_request_redraw (
GNOME_CANVAS (pane->col.canvas),
left, 0, right+1, INT_MAX);
gnome_canvas_request_redraw (GNOME_CANVAS (pane->col.canvas),
left, 0, right+1, INT_MAX);
}
if (row && pane->row.canvas != NULL) {
......@@ -166,7 +166,7 @@ scg_redraw_headers (SheetControl *sc,
}
/* Request excludes the far coordinate. Add 1 to include them */
gnome_canvas_request_redraw (GNOME_CANVAS (pane->row.canvas),
0, top, INT_MAX, bottom+1);
0, top, INT_MAX, bottom+1);
}
}
}
......
......@@ -17,7 +17,7 @@ typedef struct {
void (*resize) (SheetControl *sc, gboolean force_scroll);
void (*set_zoom_factor) (SheetControl *sc);
void (*redraw_all) (SheetControl *sc);
void (*redraw_all) (SheetControl *sc, gboolean headers);
void (*redraw_region) (SheetControl *sc,
int start_col, int start_row,
int end_col, int end_row);
......
......@@ -86,7 +86,7 @@ SC_VIRTUAL (resize, (SheetControl *sc, gboolean force_scroll), (sc, force_scroll
SC_VIRTUAL (set_zoom_factor, (SheetControl *sc), (sc))
SC_VIRTUAL (redraw_all, (SheetControl *sc), (sc))
SC_VIRTUAL (redraw_all, (SheetControl *sc, gboolean headers), (sc, headers))
SC_VIRTUAL (redraw_region,
(SheetControl *sc,
int start_col, int start_row, int end_col, int end_row),
......
......@@ -22,7 +22,7 @@ void sc_sheet_set (SheetControl *sc, Sheet *sheet);
*/
void sc_resize (SheetControl *sc, gboolean force_scroll);
void sc_set_zoom_factor (SheetControl *sc);
void sc_redraw_all (SheetControl *sc);
void sc_redraw_all (SheetControl *sc, gboolean headers);
void sc_redraw_region (SheetControl *sc,
int start_col, int start_row,
int end_col, int end_row);
......
......@@ -96,10 +96,10 @@ sheet_ant (Sheet *sheet, GList *ranges)
}
void
sheet_redraw_all (Sheet const *sheet)
sheet_redraw_all (Sheet const *sheet, gboolean headers)
{
SHEET_FOREACH_CONTROL (sheet, control,
sc_redraw_all (control););
sc_redraw_all (control, headers););
}
void
......@@ -852,7 +852,7 @@ sheet_update_only_grid (Sheet const *sheet)
p->resize_scrollbar = FALSE; /* compute_visible_region does this */
SHEET_FOREACH_CONTROL(sheet, control,
sc_compute_visible_region (control, TRUE););
sheet_redraw_all (sheet);
sheet_redraw_all (sheet, TRUE);
}
if (p->resize_scrollbar) {
......@@ -4181,7 +4181,7 @@ sheet_adjust_preferences (Sheet const *sheet, gboolean redraw, gboolean resize)
if (resize)
sc_resize (control, FALSE);
if (redraw)
sc_redraw_all (control);
sc_redraw_all (control, TRUE);
});
}
......@@ -4441,7 +4441,7 @@ sheet_duplicate (Sheet const *src)
sheet_set_zoom_factor (dst, src->last_zoom_factor_used, TRUE, TRUE);
sheet_set_dirty (dst, TRUE);
sheet_redraw_all (dst);
sheet_redraw_all (dst, TRUE);
return dst;
}
......
......@@ -227,7 +227,7 @@ gboolean sheet_range_contains_region (Sheet const *sheet, Range const *r,
WorkbookControl *wbc, char const *cmd);
/* Redraw */
void sheet_redraw_all (Sheet const *sheet);
void sheet_redraw_all (Sheet const *sheet, gboolean header);
void sheet_redraw_cell (Cell const *cell);
void sheet_redraw_range (Sheet const *sheet, Range const *r);
void sheet_redraw_region (Sheet const *sheet,
......
......@@ -955,6 +955,51 @@ wbcg_menu_state_update (WorkbookControl *wbc, Sheet const *sheet, int flags)
}
}
static void
wbcg_menu_state_sensitivity (WorkbookControl *wbc, gboolean sensitive)
{
WorkbookControlGUI *wbcg = (WorkbookControlGUI *)wbc;
#ifdef ENABLE_BONOBO
CORBA_Environment ev;
#endif
/* Don't disable/enable again (prevent toolbar flickering) */
if (wbcg->toolbar_is_sensitive != sensitive)
wbcg->toolbar_is_sensitive = sensitive;
else
return;
#ifdef ENABLE_BONOBO
CORBA_exception_init (&ev);
bonobo_ui_component_set_prop (wbcg->uic, "/commands/MenuBar",
"sensitive", sensitive ? "1" : "0", &ev);
bonobo_ui_component_set_prop (wbcg->uic, "/commands/StandardToolbar",
"sensitive", sensitive ? "1" : "0", &ev);
bonobo_ui_component_set_prop (wbcg->uic, "/commands/FormatToolbar",
"sensitive", sensitive ? "1" : "0", &ev);
bonobo_ui_component_set_prop (wbcg->uic, "/commands/ObjectToolbar",
"sensitive", sensitive ? "1" : "0", &ev);
CORBA_exception_free (&ev);
/* TODO : Ugly hack to work around strange bonobo semantics for
* sensitivity of containers. Bonono likes to recursively set the state
* rather than just setting the container.
*/
if (sensitive) {
Workbook *wb = wb_control_workbook (WORKBOOK_CONTROL (wbcg));
if (wb->undo_commands == NULL)
gtk_widget_set_sensitive (wbcg->undo_combo, FALSE);
if (wb->redo_commands == NULL)
gtk_widget_set_sensitive (wbcg->redo_combo, FALSE);
}
#else
gtk_widget_set_sensitive (GNOME_APP (wbcg->toplevel)->menubar, sensitive);
gtk_widget_set_sensitive (wbcg->standard_toolbar, sensitive);
gtk_widget_set_sensitive (wbcg->format_toolbar, sensitive);
gtk_widget_set_sensitive (wbcg->object_toolbar, sensitive);
#endif
}
static void
wbcg_undo_redo_labels (WorkbookControl *wbc, char const *undo, char const *redo)
{
......@@ -3830,6 +3875,7 @@ workbook_control_gui_ctor_class (GtkObjectClass *object_class)
wbc_class->menu_state.update = wbcg_menu_state_update;
wbc_class->menu_state.sheet_prefs = wbcg_menu_state_sheet_prefs;
wbc_class->menu_state.sensitivity = wbcg_menu_state_sensitivity;
}
E_MAKE_TYPE(workbook_control_gui, "WorkbookControlGUI", WorkbookControlGUI,
......
......@@ -46,6 +46,7 @@ typedef struct {
struct {
void (*update) (WorkbookControl *wbc, Sheet const *sheet, int flags);
void (*sheet_prefs) (WorkbookControl *wbc, Sheet const *sheet);
void (*sensitivity) (WorkbookControl *wbc, gboolean sensitive);
} menu_state;
gboolean (*claim_selection) (WorkbookControl *wbc);
......
......@@ -103,6 +103,9 @@ WBC_VIRTUAL_FULL (menu_state_sheet_prefs, menu_state.sheet_prefs,
WBC_VIRTUAL_FULL (menu_state_update, menu_state.update,
(WorkbookControl *wbc, Sheet const *sheet, int flags),
(wbc, sheet, flags))
WBC_VIRTUAL_FULL (menu_state_sensitivity, menu_state.sensitivity,
(WorkbookControl *wbc, gboolean sensitive),
(wbc, sensitive))
WBC_VIRTUAL (paste_from_selection,
(WorkbookControl *wbc, PasteTarget const *pt, guint32 time),
......
......@@ -65,7 +65,7 @@ enum {
void wb_control_menu_state_update (WorkbookControl *wbc, Sheet const *s, int flags);
void wb_control_menu_state_sheet_prefs (WorkbookControl *wbc, Sheet const *s);
void wb_control_menu_state_sensitivity (WorkbookControl *wbc, gboolean sensitive);
void wb_control_paste_from_selection (WorkbookControl *wbc,
PasteTarget const *pt, guint32 time);
......
......@@ -57,50 +57,6 @@ wbcg_auto_complete_destroy (WorkbookControlGUI *wbcg)
}
static void
workbook_edit_toolbars_set_sensitive (WorkbookControlGUI *wbcg, gboolean sensitive)
{
#ifdef ENABLE_BONOBO
CORBA_Environment ev;
#endif
/* Don't disable/enable again (prevent toolbar flickering) */
if (wbcg->toolbar_is_sensitive != sensitive)
wbcg->toolbar_is_sensitive = sensitive;
else
return;
#ifdef ENABLE_BONOBO
CORBA_exception_init (&ev);
bonobo_ui_component_set_prop (wbcg->uic, "/commands/MenuBar",
"sensitive", sensitive ? "1" : "0", &ev);
bonobo_ui_component_set_prop (wbcg->uic, "/commands/StandardToolbar",
"sensitive", sensitive ? "1" : "0", &ev);
bonobo_ui_component_set_prop (wbcg->uic, "/commands/FormatToolbar",
"sensitive", sensitive ? "1" : "0", &ev);
bonobo_ui_component_set_prop (wbcg->uic, "/commands/ObjectToolbar",
"sensitive", sensitive ? "1" : "0", &ev);
CORBA_exception_free (&ev);
/* TODO : Ugly hack to work around strange bonobo semantics for
* sensitivity of containers. Bonono likes to recursively set the state
* rather than just setting the container.
*/
if (sensitive) {
Workbook *wb = wb_control_workbook (WORKBOOK_CONTROL (wbcg));
if (wb->undo_commands == NULL)
gtk_widget_set_sensitive (wbcg->undo_combo, FALSE);
if (wb->redo_commands == NULL)
gtk_widget_set_sensitive (wbcg->redo_combo, FALSE);
}
#else
gtk_widget_set_sensitive (GNOME_APP (wbcg->toplevel)->menubar, sensitive);
gtk_widget_set_sensitive (wbcg->standard_toolbar, sensitive);
gtk_widget_set_sensitive (wbcg->format_toolbar, sensitive);
gtk_widget_set_sensitive (wbcg->object_toolbar, sensitive);
#endif
}
static void
toolbar_timer_clear (WorkbookControlGUI *wbcg)
{
......@@ -118,7 +74,7 @@ cb_thaw_ui_toolbar (gpointer *data)
g_return_val_if_fail (IS_WORKBOOK_CONTROL_GUI (wbcg), FALSE);
workbook_edit_toolbars_set_sensitive (wbcg, TRUE);
wb_control_menu_state_sensitivity (WORKBOOK_CONTROL (wbcg), TRUE);
toolbar_timer_clear (wbcg);
return TRUE;
......@@ -143,7 +99,7 @@ workbook_edit_set_sensitive (WorkbookControlGUI *wbcg, gboolean flag1, gboolean
(GtkFunction) cb_thaw_ui_toolbar,
wbcg);
} else
workbook_edit_toolbars_set_sensitive (wbcg, flag2);
wb_control_menu_state_sensitivity (WORKBOOK_CONTROL (wbcg), flag2);
}
static gboolean
......
......@@ -699,6 +699,7 @@ wb_view_open_custom (WorkbookView *wbv, WorkbookControl *wbc,
if (g_file_test (file_name, G_FILE_TEST_ISFILE)) {
IOContext *io_context = gnumeric_io_context_new (wbc);
wb_control_menu_state_sensitivity (wbc, FALSE);
/* Search for an applicable opener */
if (fo == NULL) {
......@@ -745,6 +746,7 @@ wb_view_open_custom (WorkbookView *wbv, WorkbookControl *wbc,
gnumeric_io_error_display (io_context);
}
wb_control_menu_state_sensitivity (wbc, TRUE);
gtk_object_destroy (GTK_OBJECT (io_context));
} else {
new_wb = workbook_new_with_sheets (1);
......
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