criawips-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [devel] You need a PieceTable!


From: msevior
Subject: Re: [devel] You need a PieceTable!
Date: Fri, 11 Apr 2003 01:51:20 +1000 (EST)

> Am Don, 2003-04-10 um 11.59 schrieb address@hidden:
>> Basically you really, really need a PieceTable. This is a data
>> structure that allows you define a complex text and structure
>> properties. I'd be happy to give advice and help but unfortunately I
>> don't have time to code for your project. AbiWord consumes all my
>> Hacking time.
>
>   Great, all that stuff was left to the gnomecanvas in agnubis, which
> was controlled by gdome2. One thing that I didn't like.
>
>> Anyway, I feel very strongly that unless you design your app to use a
>> piecetable and have a well defined Model (Piecetable) View
>> (Implementation of the Piecetable) and control you will be doomed to
>> failure yet again.
>
>   MVC is IMO a must-have for a presentation program because there can be
> more views for one slide (remember the slide browser of powerpoint).
>
>> If there is interest, I'd be happy to explain further.
>
>   But there is one issue. The way abiword handles text and images is not
> the way a presentation program should do. A presentation program should
> have many piecetables (one for each text-block), so the piecetables
> wouldn't be the model but a part of it.
>

No you only need one piecetable. You just arrange for one of the structures
(struxes) to represent a slide.

In XML it could look like this.

<slide>
<p>
<c props="fontName:Time New Roman; fontsize:24">
This is my First slide.
</c>
</p>
</slide>

In the piecetable you'd have doubley linked list

Slide_strux_frag<=>para_strux_frag<=>Text_Frag<=>Slide_strux_frag_end<=>Slide_strux_frag
....

Each frag object has pointers to the properties of that particular fragment.

AbiWord uses these end of strux markers for it's tables implementation
which works really well.

Here is a piece of the AbiWord XML file. This is basically a dump of the
piecetable. This represents a blank 3 x 2 table.

<table>
<cell props="bot-attach:1; left-attach:0; right-attach:1; top-attach:0">
<p style="Normal"></p>
</cell>
<cell props="bot-attach:1; left-attach:1; right-attach:2; top-attach:0">
<p style="Normal"></p>
</cell>
<cell props="bot-attach:1; left-attach:2; right-attach:3; top-attach:0">
<p style="Normal"></p>
</cell>
<cell props="bot-attach:2; left-attach:0; right-attach:1; top-attach:1">
<p style="Normal"></p>
</cell>
<cell props="bot-attach:2; left-attach:1; right-attach:2; top-attach:1">
<p style="Normal"></p>
</cell>
<cell props="bot-attach:2; left-attach:2; right-attach:3; top-attach:1">
<p style="Normal"></p>
</cell>
</table>

The properties of the different strux types can be any arbitary sets of
strings. These strings can be given any meaning you like. The view layer
interprets the meaning to construct the physical representation of the
piecetable. In example above the cell properties tell the view which cell
goes where in the view.

For fancy animation you can invent properties to make text fly around,
expand, appear etc when in slide screen mode. In normal construct mode
these properties are just ignored.

BTW I think this code would be truely horrible to write in C. Use some
object oriented Language.

Cheers

Martin







reply via email to

[Prev in Thread] Current Thread [Next in Thread]