pspp-sheet-view: Reduce time and memory cost to O(1) in number of rows.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 22 Apr 2012 17:15:46 +0000 (10:15 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Wed, 25 Apr 2012 05:41:40 +0000 (22:41 -0700)
commit7ecdf4e88e39024da846a25c98caa2887f0dac59
tree022c7ee1781ad8f28fb57a70165f23e0a1767c5a
parentd64431ef201b3031adaca5643e35274c0cee2fa5
pspp-sheet-view: Reduce time and memory cost to O(1) in number of rows.

The standard GtkTreeView uses time and memory linear in the number of
rows in the tree.  When the model is set, it iterates over every row
and creates a corresponding GtkRbNode.  After that, GtkTreeView uses
the GtkRbNodes for many operations on the tree.

This commit adapts GtkTreeView to avoid the need to iterate over the
entire model up front, as well as the need to maintain data for every
row.  It makes the following major changes:

  - The tree model must now be just a list (GTK_TREE_MODEL_LIST_ONLY);
    that is, rows may not have children.

  - The height of a row in the view must be fixed (as with
    gtk_tree_view_set_fixed_height_mode()).  Column widths must also
    be fixed.

The following minor changes follow mainly as consequences of the above:

  - Expander arrows, tree lines, and level indentation are no longer
    supported, because these only make sense with rows that have
    children.

  - Separator rows are no longer supported.  (They are ugly in
    fixed-height mode because they occupy an entire row.)
src/ui/gui/automake.mk
src/ui/gui/pspp-rb-tree.c [deleted file]
src/ui/gui/pspp-rb-tree.h [deleted file]
src/ui/gui/pspp-sheet-private.h
src/ui/gui/pspp-sheet-selection.c
src/ui/gui/pspp-sheet-selection.h
src/ui/gui/pspp-sheet-view-column.c
src/ui/gui/pspp-sheet-view-column.h
src/ui/gui/pspp-sheet-view.c
src/ui/gui/pspp-sheet-view.h