Commit d473b0ae authored by Almer S. Tigelaar's avatar Almer S. Tigelaar Committed by Almer S. Tigelaar

Limit the number of lines displayed in the preview. This is a temporary

2000-09-10  Almer S. Tigelaar  <almer1@dds.nl>

	* src/dialogs/dialog-stf.h: Limit the number of lines
	displayed in the preview. This is a temporary solution for
	bug #23426.

	* src/dialogs/dialog-stf-csv-page.c:
	(stf_dialog_csv_page_prepare): Ditto.

	* src/dialogs/dialog-stf-fixed-page.c:
	(stf_dialog_fixed_page_prepare): Ditto.

	* src/dialogs/dialog-stf-format-page.c:
	(stf_dialog_format_page_prepare): Ditto.
	(format_page_format_changed): Kill memory
	leak.

	* src/stf-parse.c:
	(stf_parse_csv_line): Change to still return
	something if the maximum number of columns is
	exceeded.
	(stf_parse_fixed_line): Ditto.

	* src/dialogs/dialog-stf-preview.c:
	(stf_preview_render): Adjust to only render SHEET_MAX_COLS
	columns.
	(stf_preview_get_table_pixel_width): Ditto.
parent c58ac4cf
2000-09-10 Almer S. Tigelaar <almer1@dds.nl>
* src/dialogs/dialog-stf.h: Limit the number of lines
displayed in the preview. This is a temporary solution for
bug #23426.
* src/dialogs/dialog-stf-csv-page.c:
(stf_dialog_csv_page_prepare): Ditto.
* src/dialogs/dialog-stf-fixed-page.c:
(stf_dialog_fixed_page_prepare): Ditto.
* src/dialogs/dialog-stf-format-page.c:
(stf_dialog_format_page_prepare): Ditto.
(format_page_format_changed): Kill memory
leak.
* src/stf-parse.c:
(stf_parse_csv_line): Change to still return
something if the maximum number of columns is
exceeded.
(stf_parse_fixed_line): Ditto.
* src/dialogs/dialog-stf-preview.c:
(stf_preview_render): Adjust to only render SHEET_MAX_COLS
columns.
(stf_preview_get_table_pixel_width): Ditto.
2000-09-09 Michael Meeks <michael@helixcode.com>
* src/gnumeric.xml: add magic placeholder to help section.
......
2000-09-10 Almer S. Tigelaar <almer1@dds.nl>
* src/dialogs/dialog-stf.h: Limit the number of lines
displayed in the preview. This is a temporary solution for
bug #23426.
* src/dialogs/dialog-stf-csv-page.c:
(stf_dialog_csv_page_prepare): Ditto.
* src/dialogs/dialog-stf-fixed-page.c:
(stf_dialog_fixed_page_prepare): Ditto.
* src/dialogs/dialog-stf-format-page.c:
(stf_dialog_format_page_prepare): Ditto.
(format_page_format_changed): Kill memory
leak.
* src/stf-parse.c:
(stf_parse_csv_line): Change to still return
something if the maximum number of columns is
exceeded.
(stf_parse_fixed_line): Ditto.
* src/dialogs/dialog-stf-preview.c:
(stf_preview_render): Adjust to only render SHEET_MAX_COLS
columns.
(stf_preview_get_table_pixel_width): Ditto.
2000-09-09 Michael Meeks <michael@helixcode.com>
* src/gnumeric.xml: add magic placeholder to help section.
......
2000-09-10 Almer S. Tigelaar <almer1@dds.nl>
* src/dialogs/dialog-stf.h: Limit the number of lines
displayed in the preview. This is a temporary solution for
bug #23426.
* src/dialogs/dialog-stf-csv-page.c:
(stf_dialog_csv_page_prepare): Ditto.
* src/dialogs/dialog-stf-fixed-page.c:
(stf_dialog_fixed_page_prepare): Ditto.
* src/dialogs/dialog-stf-format-page.c:
(stf_dialog_format_page_prepare): Ditto.
(format_page_format_changed): Kill memory
leak.
* src/stf-parse.c:
(stf_parse_csv_line): Change to still return
something if the maximum number of columns is
exceeded.
(stf_parse_fixed_line): Ditto.
* src/dialogs/dialog-stf-preview.c:
(stf_preview_render): Adjust to only render SHEET_MAX_COLS
columns.
(stf_preview_get_table_pixel_width): Ditto.
2000-09-09 Michael Meeks <michael@helixcode.com>
* src/gnumeric.xml: add magic placeholder to help section.
......
2000-09-10 Almer S. Tigelaar <almer1@dds.nl>
* src/dialogs/dialog-stf.h: Limit the number of lines
displayed in the preview. This is a temporary solution for
bug #23426.
* src/dialogs/dialog-stf-csv-page.c:
(stf_dialog_csv_page_prepare): Ditto.
* src/dialogs/dialog-stf-fixed-page.c:
(stf_dialog_fixed_page_prepare): Ditto.
* src/dialogs/dialog-stf-format-page.c:
(stf_dialog_format_page_prepare): Ditto.
(format_page_format_changed): Kill memory
leak.
* src/stf-parse.c:
(stf_parse_csv_line): Change to still return
something if the maximum number of columns is
exceeded.
(stf_parse_fixed_line): Ditto.
* src/dialogs/dialog-stf-preview.c:
(stf_preview_render): Adjust to only render SHEET_MAX_COLS
columns.
(stf_preview_get_table_pixel_width): Ditto.
2000-09-09 Michael Meeks <michael@helixcode.com>
* src/gnumeric.xml: add magic placeholder to help section.
......
2000-09-10 Almer S. Tigelaar <almer1@dds.nl>
* src/dialogs/dialog-stf.h: Limit the number of lines
displayed in the preview. This is a temporary solution for
bug #23426.
* src/dialogs/dialog-stf-csv-page.c:
(stf_dialog_csv_page_prepare): Ditto.
* src/dialogs/dialog-stf-fixed-page.c:
(stf_dialog_fixed_page_prepare): Ditto.
* src/dialogs/dialog-stf-format-page.c:
(stf_dialog_format_page_prepare): Ditto.
(format_page_format_changed): Kill memory
leak.
* src/stf-parse.c:
(stf_parse_csv_line): Change to still return
something if the maximum number of columns is
exceeded.
(stf_parse_fixed_line): Ditto.
* src/dialogs/dialog-stf-preview.c:
(stf_preview_render): Adjust to only render SHEET_MAX_COLS
columns.
(stf_preview_get_table_pixel_width): Ditto.
2000-09-09 Michael Meeks <michael@helixcode.com>
* src/gnumeric.xml: add magic placeholder to help section.
......
2000-09-10 Almer S. Tigelaar <almer1@dds.nl>
* src/dialogs/dialog-stf.h: Limit the number of lines
displayed in the preview. This is a temporary solution for
bug #23426.
* src/dialogs/dialog-stf-csv-page.c:
(stf_dialog_csv_page_prepare): Ditto.
* src/dialogs/dialog-stf-fixed-page.c:
(stf_dialog_fixed_page_prepare): Ditto.
* src/dialogs/dialog-stf-format-page.c:
(stf_dialog_format_page_prepare): Ditto.
(format_page_format_changed): Kill memory
leak.
* src/stf-parse.c:
(stf_parse_csv_line): Change to still return
something if the maximum number of columns is
exceeded.
(stf_parse_fixed_line): Ditto.
* src/dialogs/dialog-stf-preview.c:
(stf_preview_render): Adjust to only render SHEET_MAX_COLS
columns.
(stf_preview_get_table_pixel_width): Ditto.
2000-09-09 Michael Meeks <michael@helixcode.com>
* src/gnumeric.xml: add magic placeholder to help section.
......
2000-09-10 Almer S. Tigelaar <almer1@dds.nl>
* src/dialogs/dialog-stf.h: Limit the number of lines
displayed in the preview. This is a temporary solution for
bug #23426.
* src/dialogs/dialog-stf-csv-page.c:
(stf_dialog_csv_page_prepare): Ditto.
* src/dialogs/dialog-stf-fixed-page.c:
(stf_dialog_fixed_page_prepare): Ditto.
* src/dialogs/dialog-stf-format-page.c:
(stf_dialog_format_page_prepare): Ditto.
(format_page_format_changed): Kill memory
leak.
* src/stf-parse.c:
(stf_parse_csv_line): Change to still return
something if the maximum number of columns is
exceeded.
(stf_parse_fixed_line): Ditto.
* src/dialogs/dialog-stf-preview.c:
(stf_preview_render): Adjust to only render SHEET_MAX_COLS
columns.
(stf_preview_get_table_pixel_width): Ditto.
2000-09-09 Michael Meeks <michael@helixcode.com>
* src/gnumeric.xml: add magic placeholder to help section.
......
......@@ -87,7 +87,7 @@ csv_page_global_change (GtkWidget *widget, DruidPageData_t *data)
stf_cache_options_set_range (info->csv_run_cacheoptions,
info->csv_run_renderdata->startrow - 1,
(info->csv_run_renderdata->startrow - 1) + info->csv_run_displayrows);
list = stf_parse_general_cached (parseoptions,
info->csv_run_cacheoptions);
......@@ -178,9 +178,20 @@ stf_dialog_csv_page_prepare (GnomeDruidPage *page, GnomeDruid *druid, DruidPageD
stf_cache_options_invalidate (info->csv_run_cacheoptions);
pagedata->colcount = stf_parse_get_colcount (info->csv_run_parseoptions, pagedata->cur);
GTK_RANGE (info->csv_scroll)->adjustment->upper = stf_parse_get_rowcount (info->csv_run_parseoptions, pagedata->cur) + 1;
/*
* This piece of code is here to limit the number of rows we display
* when previewing
*/
{
int rowcount = stf_parse_get_rowcount (info->csv_run_parseoptions, pagedata->cur) + 1;
if (rowcount > LINE_DISPLAY_LIMIT)
GTK_RANGE (info->csv_scroll)->adjustment->upper = LINE_DISPLAY_LIMIT;
else
GTK_RANGE (info->csv_scroll)->adjustment->upper = rowcount;
}
gtk_adjustment_changed (GTK_RANGE (info->csv_scroll)->adjustment);
stf_preview_set_startrow (info->csv_run_renderdata, GTK_RANGE (info->csv_scroll)->adjustment->value);
......
......@@ -551,8 +551,20 @@ stf_dialog_fixed_page_prepare (GnomeDruidPage *page, GnomeDruid *druid, DruidPag
stf_cache_options_invalidate (info->fixed_run_cacheoptions);
pagedata->colcount = stf_parse_get_colcount (info->fixed_run_parseoptions, pagedata->cur);
/*
* This piece of code is here to limit the number of rows we display
* when previewing
*/
{
int rowcount = stf_parse_get_rowcount (info->fixed_run_parseoptions, pagedata->cur) + 1;
if (rowcount > LINE_DISPLAY_LIMIT)
GTK_RANGE (info->fixed_scroll)->adjustment->upper = LINE_DISPLAY_LIMIT;
else
GTK_RANGE (info->fixed_scroll)->adjustment->upper = rowcount;
}
GTK_RANGE (info->fixed_scroll)->adjustment->upper = stf_parse_get_rowcount (info->fixed_run_parseoptions, pagedata->cur) + 1;
gtk_adjustment_changed (GTK_RANGE (info->fixed_scroll)->adjustment);
stf_preview_set_startrow (info->fixed_run_renderdata, GTK_RANGE (info->fixed_scroll)->adjustment->value);
......
......@@ -213,6 +213,8 @@ format_page_format_changed (GtkEntry *entry, DruidPageData_t *data)
listitem->data = style_format_new_XL (new_fmt, TRUE);
gtk_clist_set_text (info->format_collist, info->format_run_index, 1, new_fmt);
g_free (new_fmt);
gtk_clist_set_column_width (info->format_collist,
1,
......@@ -287,7 +289,10 @@ stf_dialog_format_page_prepare (GnomeDruidPage *page, GnomeDruid *druid, DruidPa
gtk_clist_columns_autosize (info->format_collist);
GTK_RANGE (info->format_scroll)->adjustment->upper = data->lines + 1;
if (data->lines > LINE_DISPLAY_LIMIT)
GTK_RANGE (info->format_scroll)->adjustment->upper = LINE_DISPLAY_LIMIT;
else
GTK_RANGE (info->format_scroll)->adjustment->upper = data->lines + 1;
stf_preview_colwidths_clear (info->format_run_renderdata);
for (i = 0; i < data->colcount + 1; i++) {
......
......@@ -191,7 +191,10 @@ stf_preview_get_table_pixel_width (RenderData_t *renderdata)
int i, tablewidth = 0;
for (i = 0; i < renderdata->colwidths->len; i++) {
if (i > SHEET_MAX_COLS)
break;
tablewidth += g_array_index (renderdata->colwidths, int, i);
}
......@@ -604,6 +607,13 @@ stf_preview_render (RenderData_t *renderdata, GSList *list, int rowcount, int co
if (rowcount < 1)
return;
/*
* Don't display more then the maximum amount of columns
* in a sheet
*/
if (colcount > SHEET_MAX_COLS)
colcount = SHEET_MAX_COLS;
renderdata->group = GNOME_CANVAS_GROUP (gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (renderdata->canvas)),
gnome_canvas_group_get_type(),
......@@ -626,7 +636,7 @@ stf_preview_render (RenderData_t *renderdata, GSList *list, int rowcount, int co
ypos = stf_preview_render_row (renderdata, ypos, captions, colcount);
/* Render line by line */
/* Render line by line */
iterator = list;
while (iterator) {
......
......@@ -17,6 +17,8 @@
#include "dialog-stf-preview.h"
#define LINE_DISPLAY_LIMIT 512
/* Define for text offsets used on the main page of the druid */
#define TEXT_OFFSET 10.0
......
......@@ -844,7 +844,7 @@ stf_parse_csv_line (Source_t *src, StfParseOptions_t *parseoptions)
if (++col >= SHEET_MAX_COLS) {
g_warning (WARN_TOO_MANY_COLS, col);
return NULL;
return list;
}
}
......@@ -938,7 +938,7 @@ stf_parse_fixed_line (Source_t *src, StfParseOptions_t *parseoptions)
if (++col >= SHEET_MAX_COLS) {
g_warning (WARN_TOO_MANY_COLS, col);
return NULL;
return list;
}
src->splitpos++;
......
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