Commit 7de12d38 authored by Michael Meeks's avatar Michael Meeks

Speedup by freezing redraws before filling cells :-)

Slogged on with escher bits... comprehension improving.
parent 1b5b8d35
1999-05-06 Michael Meeks <michael@imaginator.com>
* src/workbook.c: Moved 'Sort' to the tools menu.
* HACKING: Pedantic clean.
1999-05-06 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-date.c: Added EDATE().
......
1999-05-06 Michael Meeks <michael@imaginator.com>
* src/workbook.c: Moved 'Sort' to the tools menu.
* HACKING: Pedantic clean.
1999-05-06 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-date.c: Added EDATE().
......
......@@ -11,7 +11,7 @@ goals in mind:
- Gnumeric has to be extensible.
- Gnumeric code has to make sense.
When you submit code to me for inclussion in Gnumeric, or when you
When you submit code to me for inclusion in Gnumeric, or when you
modify the sources directly on the CVS repository, please keep those
things in mind. Specifically, this means:
......@@ -66,12 +66,12 @@ modular chunks (as detailed by Linus).
not finished to let me fix it eventually.
- Do not submit code that is just a temporary workaround for a
full fledged feature. Ie, dont submit a quick hack at
full fledged feature. i.e. don't submit a quick hack at
"search text" which is not designed to be expanded upon. I
do not want to maintain limited features.
Better submit an implementation has been designed to be
expanded, enhanced, even if it is not completely finished.
It is better submit an implementation that has been designed
to be expanded and enhanced, even if it is not completely finished.
- It is more important to be correct than to be fast.
......@@ -94,16 +94,16 @@ modular chunks (as detailed by Linus).
- When documenting a function in the comments, please follow
the comment style of the existing code.
- Gnumeric is intended to be ran in various countries with
- Gnumeric is intended to be run in various countries with
different currency conventions, number formatting
conventions and different languages. Use the locale
functions to make sure your code will work on countries that
have different conventions than your country.
All of this is to insure the Gnumeric code will be kept within
All of this is to ensure the Gnumeric code will be kept within
reasonable margins of maintainability for the future: Remember, in two
years you will probably be very busy to maintain your own
contributions, and it might become a burden to the program maintainers.
years you will probably be far too busy to maintain your own
contributions, and they might become a burden to the program maintainers.
Gnumeric is the foundation for a large spreadsheet project and
various other projects in the GNOME desktop (the document model and
......
1999-05-06 Michael Meeks <michael@imaginator.com>
* src/workbook.c: Moved 'Sort' to the tools menu.
* HACKING: Pedantic clean.
1999-05-06 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-date.c: Added EDATE().
......
1999-05-06 Michael Meeks <michael@imaginator.com>
* src/workbook.c: Moved 'Sort' to the tools menu.
* HACKING: Pedantic clean.
1999-05-06 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-date.c: Added EDATE().
......
1999-05-06 Michael Meeks <michael@imaginator.com>
* ms-excel.c (ms_excelReadWorkbook): Added freeze /
thaw redraws for speed.
* ms-escher.c (OPT_new): Expanded.
(BStoreContainer_destroy): Added debug.
* ole.c: Updated functions from ms-escher.c
(main): Correctly skip over previously merged stuff.
1999-05-05 Michael Meeks <michael@imaginator.com>
* ms-formula.c (parse_list_push_raw): Cleaned debug.
......
......@@ -3,6 +3,8 @@
*
* Author:
* Michael Meeks (michael@imaginator.com)
*
* See S59FD6.HTM for an overview...
**/
#include <stdio.h>
......@@ -37,11 +39,13 @@
#define ESH_BITMAP_DUMP 0
#define ESH_OPT_DUMP 0
#define ESH_HEADER_DEBUG 0
#define ESH_HEADER_DEBUG 3
/**
* NB. SP = ShaPe
* GR = GRoup
*
* sizeof (MSOSPID) = 32 bits.
**/
typedef struct { /* See: S59FDA.HTM */
......@@ -354,6 +358,7 @@ typedef struct {
guint bid:1;
guint complex:1;
guint32 op; /* or value */
guint16 num_properties;
} OPT_DATA;
static OPT_DATA *
......@@ -366,8 +371,9 @@ OPT_new (ESH_HEADER *h) /*See: S59FFB.HTM */
od->bid = (d & 0x4000)!=0;
od->complex = (d &0x8000)!=0;
od->op = BIFF_GETLONG(data+2);
printf ("OPT : 0x%x %d %d 0x%x\n", od->pid,
od->bid, od->complex, od->op);
od->num_properties = h->instance;
printf ("OPT: 0x%x %d %d 0x%x, %d props.\n", od->pid,
od->bid, od->complex, od->op, od->num_properties);
#if ESH_OPT_DUMP > 0
dump (h->data, h->length);
#endif
......@@ -390,6 +396,9 @@ BStoreContainer_new (ESH_HEADER *h) /* See: S59FE3.HTM */
break;
}
}
if (!bsc || bsc->len < h->ver)
printf ("Too few BLIP entries, are %d should be %d\n",
bsc->len, h->ver);
return bsc;
}
static void
......@@ -427,12 +436,32 @@ read_DggContainer (ESH_HEADER *h)
}
}
/**
* A Shape ... it contains details about it self generaly,
* only one real shape in inside the container though.
**/
static void
SpContainer_new (ESH_HEADER *h) /* See: S59FEB.HTM */
{
ESH_HEADER *c = esh_header_contained (h);
while (esh_header_next (c)) {
switch (c->type) {
case Sp: /* See S59A001.HTM for Real Geometry Data... */
{
guint8 *data = c->data + ESH_HEADER_LEN;
guint32 spid = BIFF_GETLONG (data+0);
guint32 flags = BIFF_GETLONG (data+4);
enum { Group=1, Child=2, Patriarch=4, Deleted=8, OleShape=16,
HaveMaster=32, FlipH=64, FlipV=128, Connector=256,
HasAnchor=512, TypeProp=1024 };
printf ("Sp: SPID %d, Type %d group? %d, Child? %d, Patriarch? %d, Deleted? %d, OleShape? %d\n",
spid, c->instance, ((flags&Group)!=0), ((flags&Child)!=0), ((flags&Patriarch)!=0),
((flags&Deleted)!=0), ((flags&OleShape)!=0));
break;
case SpgrContainer:
printf ("SpgrContainer...\n");
break;
}
default:
printf ("Unknown shape container thing : type 0x%x, inst 0x%x ver 0x%x len 0x%x\n",
c->type, c->instance, c->ver, c->length);
......@@ -486,6 +515,8 @@ read_DgContainer (ESH_HEADER *h) /* See S59FE7.HTM */
guint32 num_shapes = BIFF_GETLONG(c->data+ESH_HEADER_LEN);
/* spid_cur = last SPID given to an SP in this DG :-) */
guint32 spid_cur = BIFF_GETLONG(c->data+ESH_HEADER_LEN+4);
guint32 drawing_id = c->instance;
/* This drawing has these num_shapes shapes, with a pointer to the last SPID given to it */
break;
}
case SpgrContainer: /* See: S59FEA.HTM */
......
......@@ -2048,6 +2048,8 @@ ms_excelReadWorkbook (MS_OLE * file)
MS_EXCEL_WORKBOOK *wb = NULL;
xmlNodePtr child;
cell_freeze_redraws ();
if (1){ /* ? */
MS_OLE_STREAM *stream;
BIFF_QUERY *q;
......@@ -2283,6 +2285,9 @@ ms_excelReadWorkbook (MS_OLE * file)
ms_biff_bof_data_destroy (ver);
ms_ole_stream_close (stream);
}
cell_thaw_redraws ();
if (wb)
{
workbook_recalc (wb->gnum_wb);
......
......@@ -2048,6 +2048,8 @@ ms_excelReadWorkbook (MS_OLE * file)
MS_EXCEL_WORKBOOK *wb = NULL;
xmlNodePtr child;
cell_freeze_redraws ();
if (1){ /* ? */
MS_OLE_STREAM *stream;
BIFF_QUERY *q;
......@@ -2283,6 +2285,9 @@ ms_excelReadWorkbook (MS_OLE * file)
ms_biff_bof_data_destroy (ver);
ms_ole_stream_close (stream);
}
cell_thaw_redraws ();
if (wb)
{
workbook_recalc (wb->gnum_wb);
......
......@@ -151,6 +151,7 @@ syntax_error(char *err)
/* ---------------------------- Start cut from ms-escher.c ---------------------------- */
typedef struct { /* See: S59FDA.HTM */
guint ver:4;
guint instance:12;
......@@ -197,33 +198,53 @@ esh_header_next (ESH_HEADER *h)
split = BIFF_GETWORD(h->data+0);
h->ver = (split&0x0f);
h->instance = (split>>4);
#if ESH_HEADER_DEBUG > 0
printf ("Next header length 0x%x(=%d), type 0x%x, ver 0x%x, instance 0x%x\n",
h->length, h->length, h->type, h->ver, h->instance);
#endif
return 1;
}
static ESH_HEADER *
esh_header_contained (ESH_HEADER *h)
{
if (h->length_left<ESH_HEADER_LEN)
return NULL;
g_assert (h->data[h->length_left-1] == /* Check that pointer */
h->data[h->length_left-1]);
return esh_header_new (h->data+ESH_HEADER_LEN,
h->length-ESH_HEADER_LEN);
}
static void
esh_header_destroy (ESH_HEADER *h)
{
if (h)
g_free(h);
}
/**
* Builds a flat record by merging CONTINUE records,
* Have to do until we move this into ms_ole.c
* pass pointers to your length & data variables.
* This is dead sluggish.
**/
static void
static int
biff_to_flat_data (const BIFF_QUERY *q, guint8 **data, guint32 *length)
{
BIFF_QUERY *nq = ms_biff_query_copy (q);
guint8 *ptr;
int cnt=0;
*length=0;
do {
*length+=nq->length;
ms_biff_query_next(nq);
} while (nq->opcode == BIFF_CONTINUE);
cnt++;
} while (nq->opcode == BIFF_CONTINUE ||
nq->opcode == BIFF_MS_O_DRAWING ||
nq->opcode == BIFF_MS_O_DRAWING_GROUP);
printf ("MERGING %d continues\n", cnt);
(*data) = g_malloc (*length);
ptr=(*data);
nq = ms_biff_query_copy (q);
......@@ -231,7 +252,10 @@ biff_to_flat_data (const BIFF_QUERY *q, guint8 **data, guint32 *length)
memcpy (ptr, nq->data, nq->length);
ptr+=nq->length;
ms_biff_query_next(nq);
} while (nq->opcode == BIFF_CONTINUE);
} while (nq->opcode == BIFF_CONTINUE ||
nq->opcode == BIFF_MS_O_DRAWING ||
nq->opcode == BIFF_MS_O_DRAWING_GROUP);
return cnt;
}
/* ---------------------------- End cut ---------------------------- */
......@@ -383,9 +407,10 @@ int main (int argc, char **argv)
guint8 *data;
guint32 len;
guint32 str_pos=q->streamPos;
biff_to_flat_data (q, &data, &len);
guint skip = biff_to_flat_data (q, &data, &len) - 1;
printf("Drawing: '%s'\n", get_biff_opcode_name(q->opcode));
dump_escher (data, len, 0);
while (skip > 0 && ms_biff_query_next(q)) skip--;
}
}
printf ("\n");
......
......@@ -919,8 +919,6 @@ static GnomeUIInfo workbook_menu_format [] = {
{ GNOME_APP_UI_ITEM, N_("_Cells..."),
N_("Modify the formatting of the selected cells"),
format_cells_cmd, NULL, NULL, 0, 0, GDK_1, GDK_CONTROL_MASK },
{ GNOME_APP_UI_ITEM, N_("_Sort"),
N_("Sort the selected cells"), sort_cells_cmd },
#if 0
{ GNOME_APP_UI_SUBTREE, N_("C_olumn"), NULL, workbook_menu_format_column },
{ GNOME_APP_UI_SUBTREE, N_("_Row"), NULL, workbook_menu_format_row },
......@@ -931,6 +929,8 @@ static GnomeUIInfo workbook_menu_format [] = {
/* Tools menu */
static GnomeUIInfo workbook_menu_tools [] = {
{ GNOME_APP_UI_ITEM, N_("_Sort"),
N_("Sort the selected cells"), sort_cells_cmd },
{ GNOME_APP_UI_ITEM, N_("_Goal Seek..."), NULL, goal_seek_cmd },
#if 0
{ GNOME_APP_UI_ITEM, N_("_Solver..."), NULL, solver_cmd },
......
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