[haiku-development] BListView/BOutlineListView patch

  • From: "Rene Gollent" <anevilyak@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 18 Feb 2008 23:41:05 -0600

Hi,

Attached please find a patch I've been working on for a while...I
noticed a number of issues in Haiku's BListView/BOutlineListView that
I sought to correct:

1) Fixed some edge cases in BOutlineListView's quicksort
implementation that would cause it to call the comparator with out of
bounds items.

2) Fixed a few cases where some of BOutlineListView's FullList methods
were only considering the visible list.

3) Modified BListView and BListItem such that the list items store
their position in the view's coordinate space. This is done by storing
the top of the item's bounds rectangle, since it already knows height
and width. While this results in some extra bookkeeping overhead in
list mutation operations, it has the side effect that IndexOf(BPoint)
is now implemented as a binary search. Also, this allows ItemFrame()
to be a very cheap call as well, so overall I believe the effort to be
worthwhile. However, this has the downside that storing the top used
up the last remaining reserved space in BListItem.

4) Probably other minor bugfixes I forgot about.

Still to do:

BOutlineListView's behavior with respect to some operations is broken
compared to R5, most noticably its SwapItems behavior. In R5, doing
SwapItems with two items that also have subitems causes the subitem
tree to move with them, while Haiku only swaps the items themselves.
This needless to say causes all kinds of unpredictable behavior, so I
intend to look at implementing that properly.

Please let me know if anyone has any comments / suggestions. I've
tested this patch with several different apps in Haiku, and as far as
I can tell it behaves correctly, but there may still be edge cases
left that I missed.

Regards,

Rene

Other related posts: