[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gtk3: Replaced PsppSheetView with GtkTreeView for the variables wind

From: Ben Pfaff
Subject: Re: gtk3: Replaced PsppSheetView with GtkTreeView for the variables window
Date: Sat, 12 Dec 2015 18:29:56 -0800
User-agent: Mutt/1.5.23 (2014-03-12)

On Sat, Dec 12, 2015 at 05:12:58PM +0100, John Darrington wrote:
> On Sat, Dec 12, 2015 at 03:43:55PM +0100, Friedrich Beckmann wrote:
>      Am 12.12.2015 um 11:40 schrieb John Darrington <address@hidden>:
>      > Can you checkin a change on that branch to replace the data sheet too. 
>  That is where I expect we might
>      > see a problem.  Let us evaluate the scale of that problem and decide 
> what to do about it (if anything).
>      > 
>      Hi John,
>      i will do that and checkin the change once I am ready. I looked into a 
> way to change the focus to the
>      next cell after editing a cell. It turned out to be journey through the 
> world of signals?
> I can well believe that.    But I think it is do-able.
> I think it is best to make sure that the GtkTreeView solution is 
> fundamentally sound before
> we start trying to fix the details.

I spent a little time this morning (I'm in Pune, India at the moment)
going through the Git commits on the pspp-sheet-view code, to refresh my
memory on why I built it to begin with.  I didn't choose to do it
lightly and if it was just a matter of using the fixed-row-height mode I
certainly would have not bothered.

Looking at the commits, the biggest reason that I built PsppSheetView is
that GtkTreeView uses O(n) memory (and therefore time as well) for an
n-row treeview.  This is true even when it has fixed-height rows,
because it maintains a per-row red-black tree that has one node per row.
(It is pretty much necessary to have some kind of data structure because
of the ability to have a tree rather than just a list.)

The commit message for the commit that made these changes to
PsppSheetView might help:


>From 7ecdf4e88e39024da846a25c98caa2887f0dac59 Mon Sep 17 00:00:00 2001
From: Ben Pfaff <address@hidden>
Date: Sun, 22 Apr 2012 10:15:46 -0700
Subject: [PATCH] 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

  - Separator rows are no longer supported.  (They are ugly in
    fixed-height mode because they occupy an entire row.)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]