Ben Pfaff [Wed, 25 Apr 2012 05:24:55 +0000 (22:24 -0700)]
PsppireValueEntry: Simplify 'if' condition.
The statement
if ((model != NULL) && (model != old_model))
can be simplifed to just:
if (model != NULL)
because if 'model' is nonnull then it is different from old_model,
because 'model' is a newly allocated GtkListStore.
Ben Pfaff [Wed, 25 Apr 2012 05:16:30 +0000 (22:16 -0700)]
gui: Properly manage ref counts of combo box and tree view models.
gtk_combo_box_set_model() and gtk_tree_view_set_model() add a
reference to the passed-in model, instead of transferring a
reference from the caller. A lot of the calls to these functions,
however, assumed that a reference was transferred and therefore
leaked a reference. This fixes them up.
This doesn't change PsppireValueEntry, because there's an ongoing
discussion about that.
Ben Pfaff [Wed, 25 Apr 2012 05:14:58 +0000 (22:14 -0700)]
psppire-acr: Clarify acr ownership of its list store.
PsppireAcr retains a pointer to the GtkListStore inside it but it
didn't, until now, keep a reference to it. This commit makes
PsppireAcr retain a reference, documents the interface, and updates
callers to properly maintain reference counts.
Ben Pfaff [Mon, 9 Apr 2012 03:30:14 +0000 (20:30 -0700)]
gui: New widget PsppireValueEntry for editing a "union value".
This is intended to be a convenenient way to allow the user to
view and edit a "union value" that includes the ability to see
and select values by value label.
Ben Pfaff [Thu, 7 Jul 2011 15:09:17 +0000 (08:09 -0700)]
gui: New type PsppireEmptyListStore.
PsppireEmptyListStore is an GtkTreeModel implementation that has a
client-specified number of rows and zero columns. It is a useful model for
GtkTreeView or PsppSheetView when the client can easily synthesize cell
data using a callback set with gtk_tree_view_column_set_cell_data_func().
In that situation, GtkListStore can be wasteful (because it uses a lot of
memory to store what does not need to be stored) and situation-specific
custom models require additional boilerplate.
This commit also modified the text data import dialog code to use
PsppireEmptyListStore. Future commits will add other users.
Ben Pfaff [Fri, 26 Aug 2011 03:20:52 +0000 (20:20 -0700)]
New "range-tower" data structure.
A range tower is a bitmap, implemented as an augmented binary tree.
Beyond the usual features of a bitmap, a range tower can efficiently
implement a "splice" operation that shifts ranges of bits left or right.
This feature does cost memory and time, so use a range tower only if this
feature is actually needed. Otherwise, use a range set (see range-set.h),
which can do everything that a range tower can do except the "splice"
operation.
Each operation has O(lg N) cost, where N is the number of contiguous
regions of 1-bits in the bitmap. Also, a cache reduces the second and
subsequent containment tests within a single contiguous region to O(1).
Ben Pfaff [Tue, 20 Sep 2011 04:34:13 +0000 (21:34 -0700)]
range-set: Rename "insert" function "set1", "delete" to "set0".
An upcoming commit will introduce a new "range-tower" data
structure that can actually insert and delete ranges. It
makes sense not to use different terminology for the two data
structures, so renaming these functions makes sense.
Ben Pfaff [Sat, 31 Mar 2012 22:41:39 +0000 (15:41 -0700)]
format: Fix typo in comment.
struct fmt_spec's 'd' member is not normally a number of "implied"
decimal places. It is normally the number of decimal places that
will be presented in formatted values. Thus, update the comment.
Ben Pfaff [Mon, 4 Jul 2011 21:48:57 +0000 (14:48 -0700)]
format: New functions fmt_change_width(), fmt_change_decimals().
These will be used in an upcoming commit for GUI-based format
adjustments, where we want to implement the user's request for
width or decimal places to the extent that we can, while
adjusting decimal places or width, respectively, as necessary.
John Darrington [Thu, 19 Apr 2012 19:14:54 +0000 (21:14 +0200)]
DO IF test: Correct expected outcome
Commit 27bd188495ec1a6085354b10545daba47771b517 added a test for an
error condition in DO IF, but appears to contain some cut and paste
errors. This change corrects them.
Ben Pfaff [Tue, 20 Mar 2012 06:00:05 +0000 (23:00 -0700)]
Allow dictionary 'var_deleted' callback to examine the deleted var.
The dictionary 'var_deleted' callback is the last chance to look at
a variable as it is getting deleted from a dictionary. For some of
the information in the variable, it legitimately doesn't make any
sense to get it from the variable itself at this point, e.g. the
index into the dictionary or the case, since it no longer is in
a dictionary. But for most of it, it's reasonable to get it from
the variable itself, but the callback doesn't provide any way to
do that, because it doesn't pass in the variable, just a dictionary
index that is no longer correct.
This commit changes the 'var_deleted' interface to pass in the
variable plus the information that can no longer be obtained from
the variable itself. An upcoming change to the GUI will make use
of this.
This commit also adapts all the existing users to the new interface.
Ben Pfaff [Mon, 16 Apr 2012 14:39:43 +0000 (07:39 -0700)]
Revert "Fix DSO linking issue"
This reverts commit 34abd8c7de0cac8efeead7fb3848427fb944b5bd.
The author blindly posted the patch without actually testing
whether it was necessary. It was not, because the libraries
in question were already linked against. Thanks to John
Darrington for pointing that out.
John Darrington [Tue, 10 Apr 2012 20:12:19 +0000 (22:12 +0200)]
PspppireSelector: Prevent selection of disallowed entries.
We had been relying on the deselected state of the widget to prevent
selection with the "allow" predicate was false. But clicking the
widget itself isn't the only way items can be selected (double clicking
the item for example). This change adds a test at a lower level to
prevent selection of disallowed items.
John Darrington [Sun, 8 Apr 2012 15:59:10 +0000 (17:59 +0200)]
Remove KMO and Bartlett statistics from bug check test.
Commit 6b351b28f47c1dfb1ce697eb50cd218b50122fd0 added a test for a bug
fix. This test however included a display of a the KMO and Bartlett
test statistics, which in this case are unstable since the determinant
of the correlation matrix is close to zero. These statistic are not
relevant to the bug being tested. So this change removes them.
Ben Pfaff [Wed, 4 Apr 2012 04:14:03 +0000 (21:14 -0700)]
spreadlevel-plot: Fix missing #include <stdlib.h>
Reported by GCC:
spreadlevel-plot.c: In function ‘spreadlevel_plot_chart_destroy’:
spreadlevel-plot.c:84: error: implicit declaration of function
‘free’
preadlevel-plot.c:84: error: incompatible implicit declaration of
built-in function ‘free’
Added a boolean argument to indicate whether or not a histogram bar
should be labelled. Labelling every bar leads to overprinted and
hence illegible labels.
John Darrington [Sun, 25 Mar 2012 08:47:27 +0000 (10:47 +0200)]
Histograms: Put hard limit on the number of histogram bins
Histograms with less than one bin are not useful (and tend to cause crashes!)
Histograms with very large numbers of bins are also of little use, and cause
other implementation headaches.
John Darrington [Sat, 24 Mar 2012 06:42:51 +0000 (07:42 +0100)]
Histograms: Ensure that the bins are aligned to an odd number of half bin widths
This has the benefit that the centres of the bins are aligned to integer multiples
of bin widths, and thus the labels are shorter. For example, instead of labels
-1.5 -0.5 0.5 1.5 2.5 we get -2 -1 0 1 2 which is more aesthetically pleasing.