Commit 04f4c1cd authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg
Browse files

don't leak colour ref ditto.


2001-06-02  Jody Goldberg <jgoldberg@home.com>

	* dialog-stf-preview.c (stf_preview_format_line) : don't leak colour ref
	* dialog-cell-format.c (draw_format_preview) : ditto.

2001-06-03  Jody Goldberg <jgoldberg@home.com>

	* Makefile.am (INCLUDES) : add top_builddir so that we can gt
	  portability.h

2001-06-03  Jody Goldberg <jgoldberg@home.com>

	* src/cell-draw.c (draw_text) : limit length of cell text to avoid
	  flakey X servers that crash with long strings.

	* src/clipboard.c (clipboard_paste_region) : be sure to rerender and
	  span if formats change.

	* src/format.c (format_value) : simplify.
parent a1f8bb83
2001-06-03 Jody Goldberg <jgoldberg@home.com>
* src/cell-draw.c (draw_text) : limit length of cell text to avoid
flakey X servers that crash with long strings.
* src/clipboard.c (clipboard_paste_region) : be sure to rerender and
span if formats change.
* src/format.c (format_value) : simplify.
2001-06-03 Almer S. Tigelaar <almer@gnome.org>
* src/stf.c (stf_write_workbook): Exporting wouldn't work
......
2001-06-03 Jody Goldberg <jgoldberg@home.com>
* src/cell-draw.c (draw_text) : limit length of cell text to avoid
flakey X servers that crash with long strings.
* src/clipboard.c (clipboard_paste_region) : be sure to rerender and
span if formats change.
* src/format.c (format_value) : simplify.
2001-06-03 Almer S. Tigelaar <almer@gnome.org>
* src/stf.c (stf_write_workbook): Exporting wouldn't work
......
2001-06-03 Jody Goldberg <jgoldberg@home.com>
* src/cell-draw.c (draw_text) : limit length of cell text to avoid
flakey X servers that crash with long strings.
* src/clipboard.c (clipboard_paste_region) : be sure to rerender and
span if formats change.
* src/format.c (format_value) : simplify.
2001-06-03 Almer S. Tigelaar <almer@gnome.org>
* src/stf.c (stf_write_workbook): Exporting wouldn't work
......
2001-06-03 Jody Goldberg <jgoldberg@home.com>
* src/cell-draw.c (draw_text) : limit length of cell text to avoid
flakey X servers that crash with long strings.
* src/clipboard.c (clipboard_paste_region) : be sure to rerender and
span if formats change.
* src/format.c (format_value) : simplify.
2001-06-03 Almer S. Tigelaar <almer@gnome.org>
* src/stf.c (stf_write_workbook): Exporting wouldn't work
......
2001-06-03 Jody Goldberg <jgoldberg@home.com>
* src/cell-draw.c (draw_text) : limit length of cell text to avoid
flakey X servers that crash with long strings.
* src/clipboard.c (clipboard_paste_region) : be sure to rerender and
span if formats change.
* src/format.c (format_value) : simplify.
2001-06-03 Almer S. Tigelaar <almer@gnome.org>
* src/stf.c (stf_write_workbook): Exporting wouldn't work
......
2001-06-03 Jody Goldberg <jgoldberg@home.com>
* Makefile.am (INCLUDES) : add top_builddir so that we can gt
portability.h
2001-06-01 Zbigniew Chyla <cyba@gnome.pl>
* dif.c (dif_input_context_new, dif_input_context_destroy, dif_get_line,
......
INCLUDES = \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-I$(includedir) -I$(top_srcdir)/src \
-I$(includedir) -I$(top_srcdir)/src \
-I$(top_builddir)/src \
$(GNOME_INCLUDEDIR)
gnumeric_plugin_difdir = $(gnumeric_plugindir)/dif
......
......@@ -23,6 +23,12 @@ draw_text (GdkDrawable *drawable, GdkFont *font, GdkGC *gc,
int x1, int text_base, char const * text, int n, int len_pixels,
int const * const line_offset, int num_lines)
{
/* Some Xservers crash when asked to draw strings that are too long
* add an arbitrary limit to keep things simple
*/
if (n > 1024)
n = 1024;
gdk_draw_text (drawable, font, gc, x1, text_base, text, n);
/* FIXME how to handle small fonts ?
......
......@@ -247,17 +247,20 @@ clipboard_paste_region (WorkbookControl *wbc,
PasteTarget const *pt,
CellRegion const *content)
{
int tmp;
int repeat_horizontal, repeat_vertical;
int dst_cols = range_width (&pt->range);
int dst_rows = range_height (&pt->range);
int src_cols = content->cols;
int src_rows = content->rows;
int dst_cols, dst_rows, src_cols, src_rows, min_col, max_col, tmp;
Range const *r;
gboolean has_content;
g_return_val_if_fail (pt != NULL, TRUE);
g_return_val_if_fail (content != NULL, TRUE);
r = &pt->range;
dst_cols = range_width (r);
dst_rows = range_height (r);
src_cols = content->cols;
src_rows = content->rows;
/* Ensure that only 1 type is selected */
has_content = pt->paste_flags & (PASTE_CONTENT|PASTE_AS_VALUES|PASTE_LINK);
if (pt->paste_flags & PASTE_TRANSPOSE) {
......@@ -415,19 +418,18 @@ clipboard_paste_region (WorkbookControl *wbc,
}
if (has_content) {
Range const *r = &pt->range;
int min_col, max_col;
sheet_region_queue_recalc (pt->sheet, r);
sheet_regen_adjacent_spans (pt->sheet,
r->start.col, r->start.row, r->end.col, r->end.row,
&min_col, &max_col);
sheet_range_calc_spans (pt->sheet, pt->range, SPANCALC_RENDER);
sheet_flag_status_update_range (pt->sheet, &pt->range);
sheet_redraw_cell_region (pt->sheet,
min_col, r->start.row, max_col, r->end.row);
sheet_flag_status_update_range (pt->sheet, r);
} else
sheet_flag_format_update_range (pt->sheet, &pt->range);
sheet_flag_format_update_range (pt->sheet, r);
sheet_regen_adjacent_spans (pt->sheet,
r->start.col, r->start.row, r->end.col, r->end.row,
&min_col, &max_col);
sheet_range_calc_spans (pt->sheet, pt->range,
(pt->paste_flags & PASTE_FORMATS) ? SPANCALC_RE_RENDER : SPANCALC_RENDER);
sheet_redraw_cell_region (pt->sheet,
min_col, r->start.row, max_col, r->end.row);
if (pt->paste_flags & PASTE_UPDATE_ROW_HEIGHT)
rows_height_update (pt->sheet, &pt->range, FALSE);
......
2001-06-02 Jody Goldberg <jgoldberg@home.com>
* dialog-stf-preview.c (stf_preview_format_line) : don't leak colour ref
* dialog-cell-format.c (draw_format_preview) : ditto.
2001-06-03 Almer S. Tigelaar <almer@gnome.org>
* dialog-stf.glade: Make length of customfield
......
......@@ -344,7 +344,6 @@ draw_format_preview (FormatState *state)
FormatFamily const page = state->format.current_type;
GString *new_format = g_string_new ("");
gchar *preview;
StyleColor *preview_color;
StyleFormat *sf = NULL;
/* Update the format based on the current selections and page */
......@@ -476,7 +475,7 @@ draw_format_preview (FormatState *state)
return;
if (state->value) {
preview = format_value (sf, state->value, &preview_color, -1);
preview = format_value (sf, state->value, NULL, -1);
if (strlen (preview) > FORMAT_PREVIEW_MAX)
strcpy (&preview [FORMAT_PREVIEW_MAX - 5], " ...");
......
......@@ -433,7 +433,6 @@ stf_preview_format_line (RenderData_t *renderdata, GSList *data, int colcount)
for (col = 0; col <= colcount; col++) {
Value *value;
StyleFormat *sf;
StyleColor *color;
char *celltext;
if (!iterator || !iterator->data) {
......@@ -447,7 +446,7 @@ stf_preview_format_line (RenderData_t *renderdata, GSList *data, int colcount)
if (NULL == (value = format_match (iterator->data, sf, NULL)))
value = value_new_string (iterator->data);
celltext = format_value (sf, value, &color, -1);
celltext = format_value (sf, value, NULL, -1);
value_release (value);
......
......@@ -598,17 +598,17 @@ format_compile (StyleFormat *format)
entry->restriction_value = 0.;
switch (counter) {
case 1 : entry->restriction_type =
(num_entries > 2) ? '>' : '.';
case 1 : if (num_entries > 1)
entry->restriction_type =
(num_entries > 2) ? '>' : '.';
break;
case 2 : if (num_entries != 2)
case 2 : if (num_entries > 2)
entry->restriction_type = '<';
break;
case 3 : if (num_entries != 3)
case 3 : if (num_entries > 3)
entry->restriction_type = '=';
break;
case 4 : if (num_entries != 4)
entry->restriction_type = '@';
case 4 : entry->restriction_type = '@';
default :
break;
}
......@@ -1631,8 +1631,7 @@ format_value (StyleFormat *format, const Value *value, StyleColor **color,
float col_width)
{
char *v = NULL;
StyleFormatEntry const *entry;
gboolean is_general = FALSE;
StyleFormatEntry const *entry = NULL; /* default to General */
GSList *list;
if (color)
......@@ -1640,48 +1639,54 @@ format_value (StyleFormat *format, const Value *value, StyleColor **color,
g_return_val_if_fail (value != NULL, "<ERROR>");
/* Use top left corner of an array result.
* This wont work for ranges because we dont't have a location
*/
if (value->type == VALUE_ARRAY)
value = value_area_fetch_x_y (NULL, value, 0, 0);
if (format) {
/* get format */
for (list = format->entries; list; list = list->next)
if (style_format_condition (list->data, value))
break;
/* If nothing matches fall back on the first */
/* If nothing matches ignore result */
if (NULL == list)
list = format->entries;
entry = (StyleFormatEntry const *)(list->data);
return g_strdup ("");
if (color && entry->color != NULL)
*color = style_color_ref (entry->color);
entry = (StyleFormatEntry const *)(list->data);
/* Empty formats should be ignored */
if (entry->format [0] == '\0')
return g_strdup ("");
/* Formatting a value as a text returns the entered text */
if (strcmp (entry->format, "@") == 0) {
if (value->type == VALUE_STRING)
return g_strdup (value->v_str.val->str);
if (color && entry->color != NULL)
*color = style_color_ref (entry->color);
is_general = TRUE;
if (strcmp (entry->format, "@") == 0) {
/* FIXME : Formatting a value as a text returns the entered
* text. We need access to the parse format */
entry = NULL;
} else if (strcmp (entry->format, "General") == 0)
is_general = TRUE;
} else
is_general = TRUE;
/*
* Use top left corner of an array result.
* This wont work for ranges because we dont't have a location
*/
if (value->type == VALUE_ARRAY)
value = value_area_fetch_x_y (NULL, value, 0, 0);
entry = NULL;
}
switch (value->type){
switch (value->type) {
case VALUE_EMPTY:
return g_strdup ("");
case VALUE_BOOLEAN:
return g_strdup (value->v_bool.val ? _("TRUE"):_("FALSE"));
case VALUE_INTEGER:
if (entry == NULL)
return fmt_general_int (value->v_int.val, col_width);
v = format_number (value->v_int.val, (int)col_width, entry);
break;
case VALUE_FLOAT:
if (!FINITE (value->v_float.val))
return g_strdup (gnumeric_err_VALUE);
if (is_general) {
if (entry == NULL) {
gnum_float val = value->v_float.val;
if ((gnum_float)INT_MAX >= val && val >= (gnum_float)INT_MIN) {
double int_val = floor (value->v_float.val);
......@@ -1692,32 +1697,15 @@ format_value (StyleFormat *format, const Value *value, StyleColor **color,
}
v = format_number (value->v_float.val, (int)col_width, entry);
break;
case VALUE_INTEGER:
if (is_general)
return fmt_general_int (value->v_int.val, col_width);
v = format_number (value->v_int.val, (int)col_width, entry);
break;
case VALUE_BOOLEAN:
return g_strdup (value->v_bool.val ? _("TRUE"):_("FALSE"));
case VALUE_ERROR:
return g_strdup (value->v_err.mesg->str);
case VALUE_STRING:
return g_strdup (value->v_str.val->str);
case VALUE_CELLRANGE:
return g_strdup (gnumeric_err_VALUE);
case VALUE_ARRAY:
/* Array of arrays ?? */
case VALUE_ARRAY: /* Array of arrays ?? */
return g_strdup (_("ARRAY"));
case VALUE_EMPTY:
return g_strdup ("");
default:
return g_strdup ("Internal error");
}
......
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