Sunday, August 15, 2010

Properties, ItemSets, Item Pools, etc VS Animation effects

In the start, there was two completely different items:
1) Something representing an entry in a stylesheet (think font color, font size, bold, bullet type...)
2) An animation effect
These are two completely different items, and had to be somehow connected.
Stylesheets are basically a wrapper around so-called ItemPools - which is a bunch of SfxPoolItem-s.
SfxPoolItem is a base class whose instance can be contained in an item pool.
http://docs.go-oo.org/svtools/html/classSfxPoolItem.html
The names of the extended class speak for themselves - bool item, flag item, int item...each instance of a Sfx*Item represents exactly one piece of data. E.g. a bool item can hold a true/false, an int item - an integer value, etc.
How are these tied to 'what' that flag/int is about? Each SfxPoolItem has to have a "Which" - which is a unique ID which ties it to what information is that item used for.

In the case of this project, we needed to make a special item that would somehow describe the whole animation. The whichId (or just simply 'Which'), is defined here: sd/inc/app.hrc just as a constant:
#define SID_ANIMATION_ITEM (SID_SD_START+446)

Luckily, there was already a simple enough data structure which stored all the effect data. The name is STLPropertySet, and it was used only by the CustomAnimationPane (the effect chooser on the right side) to collect the data, once someone would choose an effect. That structure had to be taken out of that class, out of the UI library, and wrapped into an SfxAnimationItem.

No comments:

Post a Comment