Heads Up. Multi-threaded doc importer.


Subject: Heads Up. Multi-threaded doc importer.
From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Sat Jan 12 2002 - 09:22:54 CST


Hi Folks,
         I've been working on fixing bug 158 (show an hour glass during
long processes). After quite a few false starts I decided that the only
way to do this was make use of Dom's nullUpdate() pure virtual method in
xap_Frame. This resolves to a gtk_main_itteration() on the unix platform
and presumabally into something similar on windows.

This is called within appendStrux() in pd_Document.cpp and
populateStrux() in fl_DocListener.cpp.

With this driving event propagation I start up a timer in
ap_EditMethods.cpp upon initiating loading a document. The updating sets
the cursor pointer to a watch icon in unix.

With all this in place it seemed to be not much more work to actually
implement a progressive document loading system ala MS Word. So as a
document is loaded into a frame the scroll bar shrinks and you can read
the first page of the document.

To do this we need a view and layout that is progressively filled after
FV_View and fl_DocLayout are created. Before this code, the layouts were
filled within the fl_DocLayout constructor.

So I implemented a fillLayouts() method in fl_DocLayout which actually
fills the layout structures after the fl_DocLayout is constructed and
after we have a view onto the layouts.

So now I have an abiword that imports a document into the piecetable then
displays it as the layout structures are filled. You see the firstpage
immediately it is available and can watch the scroll bar shrink in size as
more pages are added.

I had to fix a lot of segfaults arising from the assumption that there was
always a totally valid document during the load but now AbiWord is nice
and stable and I think I tracked down some nasty little bugs in the
piecetable as well. There are still a rough edges to polish off but is
basically working well right now. But only for unix.

For the other platforms there will need to be some small platfrom specific
changes.

In particular other platform maintainers will need

1. Something like a watch or hour glass icon to show there is a long
operation in progress. Update gr_*Graphics.cpp

2. Some code to set the cursor for other parts of the frame not within the
main drawing context.

3. Some small changes in the order which some methods are called within
the

_showDocument(izoom) method in ap_*Frame.cpp

I plan to make the changes needed in 3 for win, beos,qnx,cocoa, gtk and
gnome although I can only test for gtk/gnome. I hope the changes needed
for 1 and 2 will be obvious to the platform maintainers. I'll submit a
patch for this
on Monday and then commit the code if there are no objections after 0.99.1
is released.

Cheers

Martin



This archive was generated by hypermail 2b25 : Sat Jan 12 2002 - 09:22:58 CST