Commit 5d1d82cf authored by JP Rosevear's avatar JP Rosevear Committed by JP Rosevear

Add another level of indirection to ignore hiddens rows/cols

2000-07-21  JP Rosevear  <jpr@arcavia.com>

	* src/sort.c (sort_contents): Add another level of indirection
	to ignore hiddens rows/cols
parent 2a8ec3cc
2000-07-21 JP Rosevear <jpr@arcavia.com>
* src/sort.c (sort_contents): Add another level of indirection
to ignore hiddens rows/cols
2000-07-14 Michael Meeks <michael@helixcode.com>
* src/sheet-object.c (shutdown_sheet_object_creation): implement
......
2000-07-21 JP Rosevear <jpr@arcavia.com>
* src/sort.c (sort_contents): Add another level of indirection
to ignore hiddens rows/cols
2000-07-14 Michael Meeks <michael@helixcode.com>
* src/sheet-object.c (shutdown_sheet_object_creation): implement
......
2000-07-21 JP Rosevear <jpr@arcavia.com>
* src/sort.c (sort_contents): Add another level of indirection
to ignore hiddens rows/cols
2000-07-14 Michael Meeks <michael@helixcode.com>
* src/sheet-object.c (shutdown_sheet_object_creation): implement
......
2000-07-21 JP Rosevear <jpr@arcavia.com>
* src/sort.c (sort_contents): Add another level of indirection
to ignore hiddens rows/cols
2000-07-14 Michael Meeks <michael@helixcode.com>
* src/sheet-object.c (shutdown_sheet_object_creation): implement
......
2000-07-21 JP Rosevear <jpr@arcavia.com>
* src/sort.c (sort_contents): Add another level of indirection
to ignore hiddens rows/cols
2000-07-14 Michael Meeks <michael@helixcode.com>
* src/sheet-object.c (shutdown_sheet_object_creation): implement
......
2000-07-21 JP Rosevear <jpr@arcavia.com>
* src/sort.c (sort_contents): Add another level of indirection
to ignore hiddens rows/cols
2000-07-14 Michael Meeks <michael@helixcode.com>
* src/sheet-object.c (shutdown_sheet_object_creation): implement
......
2000-07-21 JP Rosevear <jpr@arcavia.com>
* src/sort.c (sort_contents): Add another level of indirection
to ignore hiddens rows/cols
2000-07-14 Michael Meeks <michael@helixcode.com>
* src/sheet-object.c (shutdown_sheet_object_creation): implement
......
......@@ -252,29 +252,53 @@ sort_position (CommandContext *context, SortData *data, int *perm)
int *
sort_contents (CommandContext *context, SortData *data)
{
ColRowInfo const *cra;
SortDataPerm *perm;
int length, i, *iperm;
int length, real_length, i, cur, *iperm, *real;
length = sort_data_length (data);
real_length = 0;
/* Discern the rows/cols to be actually sorted */
real = g_new (int, length);
for (i = 0; i < length; i++) {
cra = data->top
? sheet_row_get (data->sheet, i)
: sheet_col_get (data->sheet, i);
perm = g_new (SortDataPerm, length);
if (cra && !cra->visible) {
real[i] = -1;
} else {
real[i] = i;
real_length++;
}
}
cur = 0;
perm = g_new (SortDataPerm, real_length);
for (i = 0; i < length; i++) {
perm[i].index = i;
/*
* A constant member to get around qsort's lack of a user_data
* argument.
*/
perm[i].data = data;
if (real[i] != -1) {
perm[cur].index = i;
perm[cur].data = data;
cur++;
}
}
qsort (perm, length, sizeof (SortDataPerm), sort_qsort_compare);
qsort (perm, real_length, sizeof (SortDataPerm), sort_qsort_compare);
cur = 0;
iperm = g_new (int, length);
for (i = 0; i < length; i++)
iperm[i] = perm[i].index;
for (i = 0; i < length; i++) {
if (real[i] != -1) {
iperm[i] = perm[cur].index;
cur++;
} else {
iperm[i] = i;
}
}
g_free (perm);
g_free (real);
sort_permute (context, data, iperm, length);
return iperm;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment