Hi Mike,
Maybe it is time to modularize VT in general. I'm not sure how that should be in the end, but the unit is a big beast and Google Code doesn't even show diffs for changes. I loved the idea to have just one file, store it somewhere in your lib folder and add it to your project and you are done. But this has drawbacks.
I managed to live with these drawbacks :), not sure of SVN :)
In general, what I'm going to get won't break
single-unit-for-the-end-user approach.
All new units to be added while porting,
will work as, say, platform-specific service-providers and type-definitions. End
user won't need to use these units directly.
Example with type-definitions:
all coordinates in FMX are floating point (good
stuff for scalable GUI btw) - so we'll have to define our TPoint, TSize, and all
values returned/received by Width/Height-related procedures are not integers
anymore. More precisely, the remain integers for Windows, but with wrappers,
like
type TVtCoordinate = integer; // in Win32 type-def
unit and type = TVtCoordinate = single; // in FMX
Example with service-providers:
ScrollDC and BitBlt aren't available/shouldn't
be invoked directly under FMX
So, we'll have to move whole TVTDragImage.DragTo()
method or its parts to platform-specific service-provider class and call its
method from TVTDragImage.DragTo().
same goes to TVirtualTreeColumns.AnimatedResize(),
TBaseVirtualTree.ToggleCallback() and so forth.
I think this can be done similar to how
painter classes are implemented in themed software. Often they are just set of
class-methods, so no instances are required. Inside these methods they implement
all theme-related specifics.
Looks like implementing stand-alone service
providers for drawing is better than moving platform specific methods to parent
class because the service-provider class (or classes) can be re-used from many
different (unrelated in the inheritance tree) classes - like TVTDragImage,
TVirtualTreeColumns and TBaseVirtualTree which can hardly be done
with "move-to-parent" approach I mentioned earlier.
Still, move-to-parent approach may work good with
features that aren't avilable in other platforms. For example, OLE is not
avilable under Mac. So we may want to move OLE-related things to
platform-specific parent class.
From the end-user point of view, after porting is
done he/she will still work with VirtualTrees.pas unit and
TVirtualStringTree class in it like it was before.
If under modularization you mean that you want to
change something in this area, please explain the details.
Porting is a big work that can't be finished over
night :). It's desirable to have as low changes in the main code branch while
porting as possible until it is finished. This would simplify further merging
the branches if the porting code appears acceptable.
Alternatively, we can do changes together while
porting.
I understand that VT is a quite large unit,
probably the largest in my project, but look - it will be smaller after all
platform-specific stuff is moved away to platform-specific modules. Maybe some
of the problems related to its size will go away with porting?
I guess nobody here has experiences with that so the best approach is probably to start and see how this works out. Please use a separate dev branch for this ongoing development.
I saw 2 versions of VT ported to LCL
The latest VT for LCL is 4.8.6. Looks like the
authors are porting each time from scratches.
I think they may be interested in porting
VirtualTrees.pas in a right way that would simplify futher maintenance under their
platform too.
Regards,
Dmitri