Commit f4b6302b authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Do not make the edge visible, the scroll time will take care of that.


2000-06-08  Jody Goldberg <jgoldberg@home.com>

	* src/sheet-view.c (sheet_view_{col,row}_selection_changed) :
	  Do not make the edge visible, the scroll time will take care of
	  that.
	(sheet_view_{col,row}_size_changed) : Use the new undo wrappers.
	(cb_colrow_resize) : Use the new undo wrappers.
	(sheet_view_init) : Init the scroll timers.
	(sheet_view_stop_sliding) : Based on the version from item_grid.
	(sheet_view_start_sliding) : Ditto.
	(sheet_view_sliding_callback) : Ditto.  Added callback support.
	  tuned scroll parameters.

	* src/number.h : Clear out unused cruft.

	* src/item-grid.c : Move support for scroll timers into sheet-view.

	* src/item-bar.c (get_element_from_pixel) : Renamed from
	  get_col_from_pos.
	(cb_extend_selection) : New function.
	(item_bar_event) : Use the sliding scroll mechanism in sheet_view.

	* src/item-cursor.c (item_cursor_selection_event) : Adapt to changes in
	  item_grid_find_{col,row}.
	(item_cursor_drag_event) : Ditto.

	* src/sheet.c (sheet_foreach_colrow) : renamed and moved to.
	* src/colrow.c (col_row_foreach) here.

	* src/gnumeric-sheet.c (gnumeric_sheet_find_{col,row}) : Moved here
	  and renamed from.
	* src/item-grid.c (item_grid_find_{col,row}) : here.

	* src/value.c (value_equal) : deleted.
	(value_compare) : Moved and renamed from
	* src/expr.c (compare) : here.
	(expr_dump_tree) : Delete replicated function.

	* src/colrow.c (col_row_size_list_destroy) :
	(col_row_index_list_destroy) : New function.
	(col_row_get_index_list) : New function.
	(col_row_set_sizes) : New function.
	(col_row_restore_sizes_group) : New function.

	(col_row_save_sizes) : Moved from sheet.c
	col_row_restore_sizes : Ditto.
	cb_set_row_height : Ditto.
	rows_height_update : Ditto.

	src/commands.c (cmd_resize_row_col*) : Implement.
parent f73e172f
2000-06-08 Jody Goldberg <jgoldberg@home.com>
* src/sheet-view.c (sheet_view_{col,row}_selection_changed) :
Do not make the edge visible, the scroll time will take care of
that.
(sheet_view_{col,row}_size_changed) : Use the new undo wrappers.
(cb_colrow_resize) : Use the new undo wrappers.
(sheet_view_init) : Init the scroll timers.
(sheet_view_stop_sliding) : Based on the version from item_grid.
(sheet_view_start_sliding) : Ditto.
(sheet_view_sliding_callback) : Ditto. Added callback support.
tuned scroll parameters.
* src/number.h : Clear out unused cruft.
* src/item-grid.c : Move support for scroll timers into sheet-view.
* src/item-bar.c (get_element_from_pixel) : Renamed from
get_col_from_pos.
(cb_extend_selection) : New function.
(item_bar_event) : Use the sliding scroll mechanism in sheet_view.
* src/item-cursor.c (item_cursor_selection_event) : Adapt to changes in
item_grid_find_{col,row}.
(item_cursor_drag_event) : Ditto.
* src/sheet.c (sheet_foreach_colrow) : renamed and moved to.
* src/colrow.c (col_row_foreach) here.
* src/gnumeric-sheet.c (gnumeric_sheet_find_{col,row}) : Moved here
and renamed from.
* src/item-grid.c (item_grid_find_{col,row}) : here.
* src/value.c (value_equal) : deleted.
(value_compare) : Moved and renamed from
* src/expr.c (compare) : here.
(expr_dump_tree) : Delete replicated function.
* src/colrow.c (col_row_size_list_destroy) :
(col_row_index_list_destroy) : New function.
(col_row_get_index_list) : New function.
(col_row_set_sizes) : New function.
(col_row_restore_sizes_group) : New function.
(col_row_save_sizes) : Moved from sheet.c
col_row_restore_sizes : Ditto.
cb_set_row_height : Ditto.
rows_height_update : Ditto.
src/commands.c (cmd_resize_row_col*) : Implement.
2000-06-08 Morten Welinder <terra@diku.dk>
* src/commands.c (cmd_sort_undo): Take advantage of
......
2000-06-08 Jody Goldberg <jgoldberg@home.com>
* src/sheet-view.c (sheet_view_{col,row}_selection_changed) :
Do not make the edge visible, the scroll time will take care of
that.
(sheet_view_{col,row}_size_changed) : Use the new undo wrappers.
(cb_colrow_resize) : Use the new undo wrappers.
(sheet_view_init) : Init the scroll timers.
(sheet_view_stop_sliding) : Based on the version from item_grid.
(sheet_view_start_sliding) : Ditto.
(sheet_view_sliding_callback) : Ditto. Added callback support.
tuned scroll parameters.
* src/number.h : Clear out unused cruft.
* src/item-grid.c : Move support for scroll timers into sheet-view.
* src/item-bar.c (get_element_from_pixel) : Renamed from
get_col_from_pos.
(cb_extend_selection) : New function.
(item_bar_event) : Use the sliding scroll mechanism in sheet_view.
* src/item-cursor.c (item_cursor_selection_event) : Adapt to changes in
item_grid_find_{col,row}.
(item_cursor_drag_event) : Ditto.
* src/sheet.c (sheet_foreach_colrow) : renamed and moved to.
* src/colrow.c (col_row_foreach) here.
* src/gnumeric-sheet.c (gnumeric_sheet_find_{col,row}) : Moved here
and renamed from.
* src/item-grid.c (item_grid_find_{col,row}) : here.
* src/value.c (value_equal) : deleted.
(value_compare) : Moved and renamed from
* src/expr.c (compare) : here.
(expr_dump_tree) : Delete replicated function.
* src/colrow.c (col_row_size_list_destroy) :
(col_row_index_list_destroy) : New function.
(col_row_get_index_list) : New function.
(col_row_set_sizes) : New function.
(col_row_restore_sizes_group) : New function.
(col_row_save_sizes) : Moved from sheet.c
col_row_restore_sizes : Ditto.
cb_set_row_height : Ditto.
rows_height_update : Ditto.
src/commands.c (cmd_resize_row_col*) : Implement.
2000-06-08 Morten Welinder <terra@diku.dk>
* src/commands.c (cmd_sort_undo): Take advantage of
......
2000-06-08 Jody Goldberg <jgoldberg@home.com>
* src/sheet-view.c (sheet_view_{col,row}_selection_changed) :
Do not make the edge visible, the scroll time will take care of
that.
(sheet_view_{col,row}_size_changed) : Use the new undo wrappers.
(cb_colrow_resize) : Use the new undo wrappers.
(sheet_view_init) : Init the scroll timers.
(sheet_view_stop_sliding) : Based on the version from item_grid.
(sheet_view_start_sliding) : Ditto.
(sheet_view_sliding_callback) : Ditto. Added callback support.
tuned scroll parameters.
* src/number.h : Clear out unused cruft.
* src/item-grid.c : Move support for scroll timers into sheet-view.
* src/item-bar.c (get_element_from_pixel) : Renamed from
get_col_from_pos.
(cb_extend_selection) : New function.
(item_bar_event) : Use the sliding scroll mechanism in sheet_view.
* src/item-cursor.c (item_cursor_selection_event) : Adapt to changes in
item_grid_find_{col,row}.
(item_cursor_drag_event) : Ditto.
* src/sheet.c (sheet_foreach_colrow) : renamed and moved to.
* src/colrow.c (col_row_foreach) here.
* src/gnumeric-sheet.c (gnumeric_sheet_find_{col,row}) : Moved here
and renamed from.
* src/item-grid.c (item_grid_find_{col,row}) : here.
* src/value.c (value_equal) : deleted.
(value_compare) : Moved and renamed from
* src/expr.c (compare) : here.
(expr_dump_tree) : Delete replicated function.
* src/colrow.c (col_row_size_list_destroy) :
(col_row_index_list_destroy) : New function.
(col_row_get_index_list) : New function.
(col_row_set_sizes) : New function.
(col_row_restore_sizes_group) : New function.
(col_row_save_sizes) : Moved from sheet.c
col_row_restore_sizes : Ditto.
cb_set_row_height : Ditto.
rows_height_update : Ditto.
src/commands.c (cmd_resize_row_col*) : Implement.
2000-06-08 Morten Welinder <terra@diku.dk>
* src/commands.c (cmd_sort_undo): Take advantage of
......
2000-06-08 Jody Goldberg <jgoldberg@home.com>
* src/sheet-view.c (sheet_view_{col,row}_selection_changed) :
Do not make the edge visible, the scroll time will take care of
that.
(sheet_view_{col,row}_size_changed) : Use the new undo wrappers.
(cb_colrow_resize) : Use the new undo wrappers.
(sheet_view_init) : Init the scroll timers.
(sheet_view_stop_sliding) : Based on the version from item_grid.
(sheet_view_start_sliding) : Ditto.
(sheet_view_sliding_callback) : Ditto. Added callback support.
tuned scroll parameters.
* src/number.h : Clear out unused cruft.
* src/item-grid.c : Move support for scroll timers into sheet-view.
* src/item-bar.c (get_element_from_pixel) : Renamed from
get_col_from_pos.
(cb_extend_selection) : New function.
(item_bar_event) : Use the sliding scroll mechanism in sheet_view.
* src/item-cursor.c (item_cursor_selection_event) : Adapt to changes in
item_grid_find_{col,row}.
(item_cursor_drag_event) : Ditto.
* src/sheet.c (sheet_foreach_colrow) : renamed and moved to.
* src/colrow.c (col_row_foreach) here.
* src/gnumeric-sheet.c (gnumeric_sheet_find_{col,row}) : Moved here
and renamed from.
* src/item-grid.c (item_grid_find_{col,row}) : here.
* src/value.c (value_equal) : deleted.
(value_compare) : Moved and renamed from
* src/expr.c (compare) : here.
(expr_dump_tree) : Delete replicated function.
* src/colrow.c (col_row_size_list_destroy) :
(col_row_index_list_destroy) : New function.
(col_row_get_index_list) : New function.
(col_row_set_sizes) : New function.
(col_row_restore_sizes_group) : New function.
(col_row_save_sizes) : Moved from sheet.c
col_row_restore_sizes : Ditto.
cb_set_row_height : Ditto.
rows_height_update : Ditto.
src/commands.c (cmd_resize_row_col*) : Implement.
2000-06-08 Morten Welinder <terra@diku.dk>
* src/commands.c (cmd_sort_undo): Take advantage of
......
2000-06-08 Jody Goldberg <jgoldberg@home.com>
* src/sheet-view.c (sheet_view_{col,row}_selection_changed) :
Do not make the edge visible, the scroll time will take care of
that.
(sheet_view_{col,row}_size_changed) : Use the new undo wrappers.
(cb_colrow_resize) : Use the new undo wrappers.
(sheet_view_init) : Init the scroll timers.
(sheet_view_stop_sliding) : Based on the version from item_grid.
(sheet_view_start_sliding) : Ditto.
(sheet_view_sliding_callback) : Ditto. Added callback support.
tuned scroll parameters.
* src/number.h : Clear out unused cruft.
* src/item-grid.c : Move support for scroll timers into sheet-view.
* src/item-bar.c (get_element_from_pixel) : Renamed from
get_col_from_pos.
(cb_extend_selection) : New function.
(item_bar_event) : Use the sliding scroll mechanism in sheet_view.
* src/item-cursor.c (item_cursor_selection_event) : Adapt to changes in
item_grid_find_{col,row}.
(item_cursor_drag_event) : Ditto.
* src/sheet.c (sheet_foreach_colrow) : renamed and moved to.
* src/colrow.c (col_row_foreach) here.
* src/gnumeric-sheet.c (gnumeric_sheet_find_{col,row}) : Moved here
and renamed from.
* src/item-grid.c (item_grid_find_{col,row}) : here.
* src/value.c (value_equal) : deleted.
(value_compare) : Moved and renamed from
* src/expr.c (compare) : here.
(expr_dump_tree) : Delete replicated function.
* src/colrow.c (col_row_size_list_destroy) :
(col_row_index_list_destroy) : New function.
(col_row_get_index_list) : New function.
(col_row_set_sizes) : New function.
(col_row_restore_sizes_group) : New function.
(col_row_save_sizes) : Moved from sheet.c
col_row_restore_sizes : Ditto.
cb_set_row_height : Ditto.
rows_height_update : Ditto.
src/commands.c (cmd_resize_row_col*) : Implement.
2000-06-08 Morten Welinder <terra@diku.dk>
* src/commands.c (cmd_sort_undo): Take advantage of
......
2000-06-08 Jody Goldberg <jgoldberg@home.com>
* src/sheet-view.c (sheet_view_{col,row}_selection_changed) :
Do not make the edge visible, the scroll time will take care of
that.
(sheet_view_{col,row}_size_changed) : Use the new undo wrappers.
(cb_colrow_resize) : Use the new undo wrappers.
(sheet_view_init) : Init the scroll timers.
(sheet_view_stop_sliding) : Based on the version from item_grid.
(sheet_view_start_sliding) : Ditto.
(sheet_view_sliding_callback) : Ditto. Added callback support.
tuned scroll parameters.
* src/number.h : Clear out unused cruft.
* src/item-grid.c : Move support for scroll timers into sheet-view.
* src/item-bar.c (get_element_from_pixel) : Renamed from
get_col_from_pos.
(cb_extend_selection) : New function.
(item_bar_event) : Use the sliding scroll mechanism in sheet_view.
* src/item-cursor.c (item_cursor_selection_event) : Adapt to changes in
item_grid_find_{col,row}.
(item_cursor_drag_event) : Ditto.
* src/sheet.c (sheet_foreach_colrow) : renamed and moved to.
* src/colrow.c (col_row_foreach) here.
* src/gnumeric-sheet.c (gnumeric_sheet_find_{col,row}) : Moved here
and renamed from.
* src/item-grid.c (item_grid_find_{col,row}) : here.
* src/value.c (value_equal) : deleted.
(value_compare) : Moved and renamed from
* src/expr.c (compare) : here.
(expr_dump_tree) : Delete replicated function.
* src/colrow.c (col_row_size_list_destroy) :
(col_row_index_list_destroy) : New function.
(col_row_get_index_list) : New function.
(col_row_set_sizes) : New function.
(col_row_restore_sizes_group) : New function.
(col_row_save_sizes) : Moved from sheet.c
col_row_restore_sizes : Ditto.
cb_set_row_height : Ditto.
rows_height_update : Ditto.
src/commands.c (cmd_resize_row_col*) : Implement.
2000-06-08 Morten Welinder <terra@diku.dk>
* src/commands.c (cmd_sort_undo): Take advantage of
......
2000-06-08 Jody Goldberg <jgoldberg@home.com>
* src/sheet-view.c (sheet_view_{col,row}_selection_changed) :
Do not make the edge visible, the scroll time will take care of
that.
(sheet_view_{col,row}_size_changed) : Use the new undo wrappers.
(cb_colrow_resize) : Use the new undo wrappers.
(sheet_view_init) : Init the scroll timers.
(sheet_view_stop_sliding) : Based on the version from item_grid.
(sheet_view_start_sliding) : Ditto.
(sheet_view_sliding_callback) : Ditto. Added callback support.
tuned scroll parameters.
* src/number.h : Clear out unused cruft.
* src/item-grid.c : Move support for scroll timers into sheet-view.
* src/item-bar.c (get_element_from_pixel) : Renamed from
get_col_from_pos.
(cb_extend_selection) : New function.
(item_bar_event) : Use the sliding scroll mechanism in sheet_view.
* src/item-cursor.c (item_cursor_selection_event) : Adapt to changes in
item_grid_find_{col,row}.
(item_cursor_drag_event) : Ditto.
* src/sheet.c (sheet_foreach_colrow) : renamed and moved to.
* src/colrow.c (col_row_foreach) here.
* src/gnumeric-sheet.c (gnumeric_sheet_find_{col,row}) : Moved here
and renamed from.
* src/item-grid.c (item_grid_find_{col,row}) : here.
* src/value.c (value_equal) : deleted.
(value_compare) : Moved and renamed from
* src/expr.c (compare) : here.
(expr_dump_tree) : Delete replicated function.
* src/colrow.c (col_row_size_list_destroy) :
(col_row_index_list_destroy) : New function.
(col_row_get_index_list) : New function.
(col_row_set_sizes) : New function.
(col_row_restore_sizes_group) : New function.
(col_row_save_sizes) : Moved from sheet.c
col_row_restore_sizes : Ditto.
cb_set_row_height : Ditto.
rows_height_update : Ditto.
src/commands.c (cmd_resize_row_col*) : Implement.
2000-06-08 Morten Welinder <terra@diku.dk>
* src/commands.c (cmd_sort_undo): Take advantage of
......
......@@ -2691,7 +2691,7 @@ ms_excel_read_row (BiffQuery *q, ExcelSheet *sheet)
/* FIXME : I am not clear on the difference between collapsed, and dyn 0
* Use both for now */
if (flags & 0x30)
sheet_row_col_visible (sheet->gnum_sheet, FALSE, FALSE, row, 1);
col_row_set_visibility (sheet->gnum_sheet, FALSE, FALSE, row, row);
if (flags & 0x80) {
#ifndef NO_DEBUG_EXCEL
......@@ -2755,8 +2755,8 @@ ms_excel_read_colinfo (BiffQuery *q, ExcelSheet *sheet)
/* TODO : We should associate a style region with the columns */
if (hidden)
sheet_row_col_visible (sheet->gnum_sheet, TRUE, FALSE,
firstcol, lastcol-firstcol+1);
col_row_set_visibility (sheet->gnum_sheet, TRUE, FALSE,
firstcol, lastcol);
}
/**
......
......@@ -11,16 +11,266 @@
#include "colrow.h"
#include "selection.h"
#include "sheet.h"
#include "sheet-private.h"
struct row_col_visiblity
/**
* col_row_foreach:
* @sheet the sheet
* @infos The Row or Column collection.
* @start start position (inclusive)
* @end stop column (inclusive)
* @callback A callback function which should return TRUE to stop
* the iteration.
* @user_data A bagage pointer.
*
* Iterates through the existing rows or columns within the range supplied.
* Currently only support left -> right iteration. If a callback returns
* TRUE iteration stops.
*/
gboolean
col_row_foreach (ColRowCollection const *infos, int first, int last,
col_row_callback callback, void *user_data)
{
gboolean is_col, visible;
ColRowVisList elements;
};
int i;
/* TODO : Do we need to support right -> left as an option */
if (last > infos->max_used)
last = infos->max_used;
i = first;
while (i <= last) {
ColRowInfo * const * segment = COLROW_GET_SEGMENT (infos, i);
int sub = COLROW_SUB_INDEX(i);
i += COLROW_SEGMENT_SIZE - sub;
if (segment == NULL)
continue;
for (; sub < COLROW_SEGMENT_SIZE; ++sub) {
ColRowInfo * info = segment[sub];
if (info != NULL && (*callback)(info, user_data))
return TRUE;
}
}
return FALSE;
}
/*****************************************************************************/
typedef struct _ColRowIndex
{
int first, last;
} ColRowIndex;
ColRowSizeList *
col_row_size_list_destroy (ColRowIndexList *list)
{
ColRowIndexList *ptr;
for (ptr = list; ptr != NULL ; ptr = ptr->next)
g_free (ptr->data);
g_slist_free (list);
return NULL;
}
ColRowIndexList *
col_row_index_list_destroy (ColRowIndexList *list)
{
ColRowIndexList *ptr;
for (ptr = list; ptr != NULL ; ptr = ptr->next)
g_free (ptr->data);
g_slist_free (list);
return NULL;
}
struct pair_int
ColRowIndexList *
col_row_get_index_list (int first, int last, ColRowIndexList *list)
{
int index, count;
ColRowIndex *tmp;
if (list != NULL) {
tmp = list->data;
if (tmp->last == (first-1)) {
tmp->last = last;
return list;
}
}
tmp = g_new (ColRowIndex, 1);
tmp->first = first;
tmp->last = last;
return g_slist_prepend (list, tmp);
}
double *
col_row_save_sizes (Sheet *sheet, gboolean const is_cols, int first, int last)
{
int i;
double *res = NULL;
g_return_val_if_fail (sheet != NULL, NULL);
g_return_val_if_fail (first <= last, NULL);
res = g_new (double, last-first+1);
for (i = first ; i <= last ; ++i) {
ColRowInfo *info = is_cols
? sheet_col_get_info (sheet, i)
: sheet_row_get_info (sheet, i);
g_return_val_if_fail (info != NULL, NULL); /* be anal, and leak */
if (info->pos != -1) {
res[i-first] = info->size_pts;
if (info->hard_size)
res[i-first] *= -1.;
} else
res[i-first] = 0.;
}
return res;
}
ColRowSizeList *
col_row_set_sizes (Sheet *sheet, gboolean const is_cols,
ColRowIndexList *src, int new_size)
{
int i;
ColRowSizeList *res = NULL;
ColRowIndexList *ptr;
for (ptr = src; ptr != NULL ; ptr = ptr->next) {
ColRowIndex *index = ptr->data;
res = g_slist_prepend (res,
col_row_save_sizes (sheet, is_cols, index->first, index->last));
for (i = index->first ; i <= index->last ; ++i) {
int tmp = new_size;
if (tmp < 0)
tmp = (is_cols)
? sheet_col_size_fit_pixels (sheet, i)
: sheet_row_size_fit_pixels (sheet, i);
if (tmp <= 0)
continue;
if (is_cols)
sheet_col_set_size_pixels (sheet, i, tmp, TRUE);
else
sheet_row_set_size_pixels (sheet, i, tmp, TRUE);
}
}
return res;
}
/*
* NOTE : this is a low level routine it does not redraw or
* reposition objects
*/
void
col_row_restore_sizes (Sheet *sheet, gboolean const is_cols,
int first, int last, double *sizes)
{
int i;
g_return_if_fail (sizes != NULL);
g_return_if_fail (sheet != NULL);
g_return_if_fail (first <= last);
for (i = first ; i <= last ; ++i) {
gboolean hard_size = FALSE;
/* Reset to the default */
if (sizes[i-first] == 0.) {
ColRowCollection *infos = is_cols ? &(sheet->cols) : &(sheet->rows);
ColRowInfo ***segment =
(ColRowInfo ***)&COLROW_GET_SEGMENT(infos, i-first);
int const sub = COLROW_SUB_INDEX (i-first);
ColRowInfo *cri = NULL;
if (*segment != NULL) {
cri = (*segment)[sub];
if (cri != NULL) {
(*segment)[sub] = NULL;
g_free (cri);
}
}
} else {
if (sizes[i-first] < 0.) {
hard_size = TRUE;
sizes[i-first] *= -1.;
}
if (is_cols)
sheet_col_set_size_pts (sheet, i, sizes[i-first], hard_size);
else
sheet_row_set_size_pts (sheet, i, sizes[i-first], hard_size);
}
}
/* Notify sheet of pending update */
sheet->priv->recompute_visibility = TRUE;
if (is_cols) {
sheet->priv->recompute_spans = TRUE;
if (sheet->priv->reposition_col_comment > first)
sheet->priv->reposition_col_comment = first;
} else {
if (sheet->priv->reposition_row_comment > first)
sheet->priv->reposition_row_comment = first;
}
g_free (sizes);
}
void
col_row_restore_sizes_group (Sheet *sheet, gboolean const is_cols,
ColRowIndexList *selection,
ColRowSizeList *saved_sizes)
{
while (selection != NULL && saved_sizes != NULL) {
ColRowIndex *index = selection->data;
col_row_restore_sizes (sheet, is_cols,
index->first, index->last,
saved_sizes->data);
selection = selection->next;
saved_sizes = saved_sizes->next;
}
}
static gboolean
cb_set_row_height (ColRowInfo *info, void *sheet)
{
/* If the size was not set by the user then auto resize */
if (!info->hard_size) {
int const new_size = sheet_row_size_fit_pixels (sheet, info->pos);
if (new_size > 0)
sheet_row_set_size_pixels (sheet, info->pos, new_size, FALSE);
}
return FALSE;
}
/**
* rows_height_update
* @sheet: The sheet,
* @range: The range whose rows should be resized.
*
* Use this function having changed the font size to auto
* resize the row heights to make the text fit nicely.
**/
void
rows_height_update (Sheet *sheet, Range const * range)
{
/* FIXME : this needs to check font sizes and contents rather than
* just contents. Empty cells will cause resize also
*/
col_row_foreach (&sheet->rows, range->start.row, range->end.row,
&cb_set_row_height, sheet);
}
/*****************************************************************************/
struct row_col_visiblity
{
gboolean is_cols, visible;
ColRowVisList *elements;
};
static void
......@@ -34,7 +284,7 @@ cb_row_col_visibility (Sheet *sheet,
ColRowInfo * (*fetch) (Sheet *sheet, int pos);
int i, j, end;
if (dat->is_col) {
if (dat->is_cols) {
i = start_col;
end = end_col;
fetch = &sheet_col_fetch;
......@@ -48,7 +298,7 @@ cb_row_col_visibility (Sheet *sheet,
for (;i <= end ; ++i) {
ColRowInfo *cri = (*fetch) (sheet, i);
if ((visible == 0) != (cri->visible == 0)) {
struct pair_int *res = g_new(struct pair_int, 1);
ColRowIndex *res = g_new(ColRowIndex, 1);
/* Find the end */
for (j = i+1; j <= end ; ++j) {
......@@ -56,8 +306,8 @@ cb_row_col_visibility (Sheet *sheet,
if ((visible == 0) == (cri->visible == 0))
break;
}
res->index = i;
res->count = j - i;
res->first = i;
res->last = j - 1;
#if 0
printf ("%d %d\n", res->index, res->count);
......@@ -71,18 +321,18 @@ cb_row_col_visibility (Sheet *sheet,
/*
* col_row_get_visiblity_toggle :
* @sheet : The sheet whose selection we are interested in.
* @is_col: A flag indicating whether this it is a column or a row.
* @is_cols: A flag indicating whether this it is a column or a row.
* @is_visible: Should we unhide or hide the cols/rows.
*
* Searches the selection list and generates a list of index,count
* pairs of row/col ranges that need to be hidden or unhiden.
*/
ColRowVisList
col_row_get_visiblity_toggle (Sheet *sheet, gboolean const is_col,
ColRowVisList *
col_row_get_visiblity_toggle (Sheet *sheet, gboolean const is_cols,
gboolean const visible)
{
struct row_col_visiblity closure;
closure.is_col = is_col;
closure.is_cols = is_cols;
closure.visible = visible;
closure.elements = NULL;
......@@ -91,13 +341,13 @@ col_row_get_visiblity_toggle (Sheet *sheet, gboolean const is_col,
return closure.elements;
}
ColRowVisList
col_row_vis_list_destroy (ColRowVisList list)
ColRowVisList *
col_row_vis_list_destroy (ColRowVisList *list)
{
while (list != NULL) {
g_free (list->data);
list = g_slist_remove (list, list->data);
}
ColRowVisList *ptr;
for (ptr = list; ptr != NULL ; ptr = ptr->next)
g_free (ptr->data);
g_slist_free (list);
return NULL;
}
......@@ -108,50 +358,49 @@ col_row_vis_list_destroy (ColRowVisList list)
* It should not be called by other commands.
*/
void
col_row_set_visiblity (Sheet *sheet, gboolean const is_col,