Set the max height of the text_rect to be the height difference
between two icons. Calculate the number of text lines that can be
displayed in this height, and display only that many.
Some of the indexes generated during cursor movement were using column
instead of model_column(), which caused inconsistent display of items
under the cursor.
Move the wrapping logic to get_item_rects(). This makes mouse events
able to hit the wrapped labels, and various other little things stop
glitching out as well.
Also, instead of having a per-line width when wrapping icon names,
make the text rect wide enough to fit every line.
This is nice when long item titles don't fit. You can now hover them
(or select them) and we'll break the item text into two lines instead
of just one.
It might make sense to go even further in some cases. Perhaps when
hovering an item, we could show the full item text, painted above
all other items. That's something for a future patch.
It would also be nice if the text didn't jump back and forth when
going in and out of this mode. Also for a future patch.
This allows the user to start typing and highlighting and jumping
to a match in ColumnsView, IconView, TableView and TreeView if
the model supports it.
IconView now responds to the editing key (F2) if the view is editable.
It does feel a little bit weird to have content_rect() return the text
rect for an item, and not the whole item rect. This internal API could
probably be better.
Move the basic movement keys (up/down/left/right/home/end/pgup/pgdn)
up to AbstractView::keydown_event() and have it call the virtual
move_cursor() which is then implemented by subclasses.
This implements the following optimizations:
* Rather than clearing a HashTable of selected items and re-populating
it every time the selection rectangle changes, determine the delta
by only examining the items that might be in the area where the
selection may have changed compared to the previous area. Then
only add/remove selection items as needed.
* When painting, only query and paint the items actually visible.
Also, keep a local cache of item information such as calculated
rectangles and selection state, so it doesn't have to be calculated
over and over again.
If selecting in a large icon view, and dragging the mouse outside
of the widget, or close to the border of it, start scrolling
automatically. This allows for selecting large amount of items
that exceed the amount that can be displayed.