| Thomas's profileBlogsBlogLists | Help |
|
|
22 January Something about DockPanelsDocking is not a new technology, in fact, Delphi has included the docking technology from the beginning, using the very common dockzones algorithm. In Visual Studio 2005, the surface is also using docking mechanisms while using the dockzones algorithm eighter. But dockzones suffers of some restriction. It’s not possible to slide a panel from one dockzone to another. What does is mean? Imagine a rectangle in which are 4 panels docked to each corner. With the dockzones algorithm, the rectangle is subdivided into 2 dockzone, whereas every zone contains 2 panels. Now the panels can be moved and sized within the zone, but unfortunately only within the zone. Now suppose each corner of the rectangle is names with one of the letters A,B,C,D and thus the panel of each corner has this letter. Dockzones now only allows to size eighter A with B and C with or A with C and B with D and this cannot be changed, so it is not possible to move A with B an then A with C, even if the bounds seem to allow this. Now I implemented a new algorithm, that makes this capable, and I named it smart placing algorithm. Which means:
Another advance of DockPanels is the way it interacts with the user. I implemented a visual animation that the user can literally feel. Moving a panel inside a dockable client (which is also a DockPanel, by the way), it’s using a floating effect. Sizing panels with dynamic sliders provide a snap meachnism, both visual and with sound, so you can feel and hear if a panel’s edge is snaped to another edge. It’s like the ways VS2005 does.
A DockPanel can be docked to another panel on each edge, and also tabbed together. It’s possible to move a single panel, and also a combination of docked panels, or tabbed panels. To improve the speed for animation, an image of the contents is used, rather than showing all controls of the panel in real time, which could be very time consuming when the panel is resizing animated. The technique of the DockPanel has also one disadvantage: Imagine 5 panels are docked like this:
Now when you’d remove panel X it would cause a hole, as none of the other panels A,B,C or D could fill the space, as their edges are restricted by other panels. So what to do? You need to eliminate the hole in X, using a hole elimination algorithm. But how can you detected a hole and remove it? Removing seems to be simple, you just need to expand the top edge of all panels that intersect with the top edge, or any panel who’s bottom edge intersects with the top of the hole to the bottom of the hole (or you do this with the left and right edges instead). And even detecting a hole is much more simpler as it seems to be: Just start with a region that is completely filled with the docking host size. Now you remove every panel’s bounds form the region, and that what remains is a group of holes, if there are any. Now you got the holes as rectangles and can remove them. Currently, detecting a hole is done after a panel was removed, because it’s not possible to construct a hole while inserting or moving panels with a slider. |
|
|