Commit 831920d7 authored by Miguel de Icaza's avatar Miguel de Icaza Committed by Arturo Espinosa

Do not check for cell->sheet and cell->sheet->workbook, these must be

2000-01-03  Miguel de Icaza  <miguel@gnu.org>

	* src/cell.c (cell_render_value): Do not check for cell->sheet and
	cell->sheet->workbook, these must be true.

2000-01-02  Martin Sheppard  <martin.sheppard@iname.com>

	* src/workbook.h (struct _Workbook): add option to display text of
	formulas instead of their value

	* src/workbook.c (workbook_menu_edit): add menu oiption for toggling
	the display of formulas
	(toggle_formuals_cmd,cb_cell_rerender): new function to toggle the
	display of formulas
	(workbook_new): initialize the display formulas option

	* src/cell.c (cell_render_value): implemented displaying formulas
parent 680b46f3
2000-01-03 Miguel de Icaza <miguel@gnu.org>
* src/cell.c (cell_render_value): Do not check for cell->sheet and
cell->sheet->workbook, these must be true.
2000-01-02 Martin Sheppard <martin.sheppard@iname.com>
* src/workbook.h (struct _Workbook): add option to display text of
formulas instead of their value
* src/workbook.c (workbook_menu_edit): add menu oiption for toggling
the display of formulas
(toggle_formuals_cmd,cb_cell_rerender): new function to toggle the
display of formulas
(workbook_new): initialize the display formulas option
* src/cell.c (cell_render_value): implemented displaying formulas
2000-01-02 Martin Sheppard <martin.sheppard@iname.com>
* src/parser.{c,y} (yylex) : fixed so that while parsing a formula,
......
2000-01-03 Miguel de Icaza <miguel@gnu.org>
* src/cell.c (cell_render_value): Do not check for cell->sheet and
cell->sheet->workbook, these must be true.
2000-01-02 Martin Sheppard <martin.sheppard@iname.com>
* src/workbook.h (struct _Workbook): add option to display text of
formulas instead of their value
* src/workbook.c (workbook_menu_edit): add menu oiption for toggling
the display of formulas
(toggle_formuals_cmd,cb_cell_rerender): new function to toggle the
display of formulas
(workbook_new): initialize the display formulas option
* src/cell.c (cell_render_value): implemented displaying formulas
2000-01-02 Martin Sheppard <martin.sheppard@iname.com>
* src/parser.{c,y} (yylex) : fixed so that while parsing a formula,
......
......@@ -378,7 +378,9 @@ cell_get_formatted_val (Cell *cell, StyleColor **col)
* cell_render_value
* @cell: The cell whose value needs to be rendered
*
* The value of the cell is formated according to the format style
* The value of the cell is formated according to the format style, but if
* formulas are being displayed then use the text of the formula instead of
* its value.
*/
void
cell_render_value (Cell *cell)
......@@ -397,8 +399,16 @@ cell_render_value (Cell *cell)
cell->render_color = NULL;
}
str = cell_get_formatted_val (cell, &color);
cell->render_color = color;
if (cell->sheet->workbook->display_formulas && cell->parsed_node){
ParsePosition pp;
char *tmpstr = expr_decode_tree (cell->parsed_node,
parse_pos_cell (&pp, cell));
str = g_strconcat ("=", tmpstr, NULL);
g_free (tmpstr);
} else {
str = cell_get_formatted_val (cell, &color);
cell->render_color = color;
}
cell_set_rendered_text (cell, str);
g_free (str);
......
......@@ -111,6 +111,8 @@ struct _Workbook {
void *corba_server;
gboolean display_formulas;
WorkbookPrivate *priv;
};
......
......@@ -846,6 +846,20 @@ zoom_cmd (GtkWidget *widget, Workbook *wb)
dialog_zoom (wb, sheet);
}
static void
cb_cell_rerender (gpointer cell, gpointer data)
{
cell_render_value(cell);
cell_queue_redraw(cell);
}
static void
toggle_formulas_cmd (GtkWidget *widget, Workbook *wb)
{
wb->display_formulas = !wb->display_formulas;
g_list_foreach(wb->formula_cell_list, &cb_cell_rerender, NULL);
}
static void
format_cells_cmd (GtkWidget *widget, Workbook *wb)
{
......@@ -1101,6 +1115,8 @@ static GnomeUIInfo workbook_menu_edit [] = {
static GnomeUIInfo workbook_menu_view [] = {
{ GNOME_APP_UI_ITEM, N_("_Zoom..."),
N_("Zoom the spreadsheet in or out"), zoom_cmd },
{ GNOME_APP_UI_ITEM, N_("Toggle _Formulas"),
N_("Toggle the display of formulas"), toggle_formulas_cmd },
GNOMEUIINFO_END
};
......@@ -2138,6 +2154,7 @@ workbook_new (void)
wb = gtk_type_new (workbook_get_type ());
wb->toplevel = gnome_app_new ("Gnumeric", "Gnumeric");
wb->table = gtk_table_new (0, 0, 0);
wb->display_formulas = FALSE;
gtk_window_set_policy (GTK_WINDOW (wb->toplevel), 1, 1, 0);
sx = MAX (gdk_screen_width () - 64, 400);
......
......@@ -111,6 +111,8 @@ struct _Workbook {
void *corba_server;
gboolean display_formulas;
WorkbookPrivate *priv;
};
......
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