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

new. (sheet_colrow_insert_finish) : new. (sheet_colrow_delete_finish) :

2001-12-06  Jody Goldberg <jody@gnome.org>

	* src/sheet.c (sheet_colrow_set_collapse) : new.
	(sheet_colrow_insert_finish) : new.
	(sheet_colrow_delete_finish) : new.
	(sheet_{col,row}_{ins,del} : use them here, we shoulw now correctly
	  handle collapse states and gutters when ins/del cols/row.

2001-12-06  Jody Goldberg <jody@gnome.org>

	* src/sheet.c (sheet_colrow_gutter) : change signature and toggle the
	  resize flag if necessary.
	(sheet_update_only_grid) : handle the resize and
	  recompute_max_{col,row}_group flags.

	* src/colrow.c (colrow_set_states) : use simplified
	  sheet_colrow_gutter signature.

2001-12-06  Jody Goldberg <jody@gnome.org>

	* src/workbook-cmd-format.c (sheet_dialog_set_row_height) : const.

	* src/workbook-object-toolbar.c : disable some code that is not ready
	  for release.

	* src/sheet.c (sheet_colrow_insdel_finish) : new.
	(sheet_{col,row}_{ins,del} : use it here, and adjust the arguments to
	  include optional state to fill in the new cols/rows.
	(sheet_colrow_fit_gutter) : simplify.
	(sheet_colrow_group_ungroup) : ditto.
	(sheet_colrow_fetch) : new utility.
	(sheet_colrow_get_info) : ditto.

	* src/sheet-control-gui.c (scg_setup_group_buttons) : new.
	(scg_resize) : use it here.
	(sheet_control_gui_new) : handle the layout for the group buttons.

	* src/print.c (compute_group) : const.

	* src/item-grid.c (item_grid_draw) : remove pointless use of
	  ColRowInfo::pos because I want to remove that eventually.
	* src/print-cell.c (print_cell_range) : ditto.

	* src/item-bar.c (item_bar_normal_font) : new.
	(item_bar_indent) : new.
	(item_bar_draw) : draw the top line as black, to match other buttons,
	 fix its length.

	* src/history.c (history_menu_locate_separator) : sync with manu
	  changes.

	* src/gnumeric.h
	(ColRowStateGroup) : rename from ColRowSizeList.
	(ColRowStateList) : rename from ColRowRLESizeList.

	* src/gnumeric-canvas.c (gnm_canvas_find_col) : const.

	* src/complete-sheet.c (complete_sheet_search_iteration) : const.

	* src/commands.c (cmd_ins_del_colrow_undo) : pass the states into the
	  sheet_ routines.  They will handle restoring them, and cleaning up the
	  collapse states.
	(cmd_ins_del_colrow_redo) : ditto.
	(cmd_ins_del_colrow_destroy) : simplify.
	(cmd_colrow_outline_change) : use get_info and avoid the need to check
	  for NULL.
	(cmd_group_undo) : simplify.
	(cmd_group_redo) : ditto.
	(cmd_group) : simplify.

	* src/colrow.c (colrow_compute_pixels_from_pts) : move here from
	  sheet.c
	(colrow_compute_pts_from_pixels) : ditto.
	(colrow_is_default) : new utility routine so that we can remove ::pos
	  eventually.
	(ColRowState) : new struct, will eventually replace the ColRowInfo.
	(colrow_make_state) : new.
	(colrow_get_states) : renamed from colrow_save_sizes and add support
	  for outline levels and collapse state.
	(colrow_set_sizes) : use the correct aliases for the lists.
	(colrow_set_states) : renamed from colrow_restore_sizes and support
	  the extra state info.
	(colrow_restore_state_group) : rename colrow_restore_sizes_group.
	(colrow_set_outline) : simplify.

2001-12-05  Jody Goldberg <jody@gnome.org>

	* src/colrow.c (colrow_state_group_destroy) : rename from
	colrow_rle_size_list_destroy.

	* src/cellspan.c (cell_calc_span) : const.

2001-11-29  Jody Goldberg <jody@gnome.org>

	* src/sheet-control-gui.c (scg_resize) : size the select all button.

	* src/item-bar.c (item_bar_indent) : new utility.
parent 2581eee5
......@@ -4,7 +4,6 @@ This file is used as a scratch pad by developers. It is a list of known
issues that need to be addressed. Divided into, things that will prevent
release, and longer term bugs.
Release Critical
----------------
......@@ -20,6 +19,9 @@ Pending Patches
Long term breakage
------------------
- outline numbers
: implement 'clicked' callbacks
- Fix user visible strings "Foo :" to be "Foo:". (The former is a French
habit that we should let the French l10n team handle.)
......@@ -34,14 +36,12 @@ Long term breakage
- Data->Filter dialog
: use expr entry widget.
- Outline mode
: Ins/Del col/row breaks
- Missing undo/redo for
- Add/duplicate sheet.
- Remove sheet.
- Reorder sheets.
- Delete Comment.
- Freeze panes.
- Misc.
- Add an idle handler at start up to check for availablity of
......@@ -77,7 +77,6 @@ Long term breakage
- outline mode
: finish implementing optionally putting markers above/left
: Make ungroup smarter about handling extra items of lower level at the edges
: support the numbers.
- hidden rows/cols
: Make unhide smarter to find hidden regions on either side of selected ranges.
......
2001-12-06 Jody Goldberg <jody@gnome.org>
* src/sheet.c (sheet_colrow_set_collapse) : new.
(sheet_colrow_insert_finish) : new.
(sheet_colrow_delete_finish) : new.
(sheet_{col,row}_{ins,del} : use them here, we shoulw now correctly
handle collapse states and gutters when ins/del cols/row.
2001-12-06 Jody Goldberg <jody@gnome.org>
* src/sheet.c (sheet_colrow_gutter) : change signature and toggle the
resize flag if necessary.
(sheet_update_only_grid) : handle the resize and
recompute_max_{col,row}_group flags.
* src/colrow.c (colrow_set_states) : use simplified
sheet_colrow_gutter signature.
2001-12-06 Jody Goldberg <jody@gnome.org>
* src/workbook-cmd-format.c (sheet_dialog_set_row_height) : const.
* src/workbook-object-toolbar.c : disable some code that is not ready
for release.
* src/sheet.c (sheet_colrow_insdel_finish) : new.
(sheet_{col,row}_{ins,del} : use it here, and adjust the arguments to
include optional state to fill in the new cols/rows.
(sheet_colrow_fit_gutter) : simplify.
(sheet_colrow_group_ungroup) : ditto.
(sheet_colrow_fetch) : new utility.
(sheet_colrow_get_info) : ditto.
* src/sheet-control-gui.c (scg_setup_group_buttons) : new.
(scg_resize) : use it here.
(sheet_control_gui_new) : handle the layout for the group buttons.
* src/print.c (compute_group) : const.
* src/item-grid.c (item_grid_draw) : remove pointless use of
ColRowInfo::pos because I want to remove that eventually.
* src/print-cell.c (print_cell_range) : ditto.
* src/item-bar.c (item_bar_normal_font) : new.
(item_bar_indent) : new.
(item_bar_draw) : draw the top line as black, to match other buttons,
fix its length.
* src/history.c (history_menu_locate_separator) : sync with manu
changes.
* src/gnumeric.h
(ColRowStateGroup) : rename from ColRowSizeList.
(ColRowStateList) : rename from ColRowRLESizeList.
* src/gnumeric-canvas.c (gnm_canvas_find_col) : const.
* src/complete-sheet.c (complete_sheet_search_iteration) : const.
* src/commands.c (cmd_ins_del_colrow_undo) : pass the states into the
sheet_ routines. They will handle restoring them, and cleaning up the
collapse states.
(cmd_ins_del_colrow_redo) : ditto.
(cmd_ins_del_colrow_destroy) : simplify.
(cmd_colrow_outline_change) : use get_info and avoid the need to check
for NULL.
(cmd_group_undo) : simplify.
(cmd_group_redo) : ditto.
(cmd_group) : simplify.
* src/colrow.c (colrow_compute_pixels_from_pts) : move here from
sheet.c
(colrow_compute_pts_from_pixels) : ditto.
(colrow_is_default) : new utility routine so that we can remove ::pos
eventually.
(ColRowState) : new struct, will eventually replace the ColRowInfo.
(colrow_make_state) : new.
(colrow_get_states) : renamed from colrow_save_sizes and add support
for outline levels and collapse state.
(colrow_set_sizes) : use the correct aliases for the lists.
(colrow_set_states) : renamed from colrow_restore_sizes and support
the extra state info.
(colrow_restore_state_group) : rename colrow_restore_sizes_group.
(colrow_set_outline) : simplify.
2001-12-05 Jody Goldberg <jody@gnome.org>
* src/colrow.c (colrow_state_group_destroy) : rename from
colrow_rle_size_list_destroy.
* src/cellspan.c (cell_calc_span) : const.
2001-11-29 Jody Goldberg <jody@gnome.org>
* src/sheet-control-gui.c (scg_resize) : size the select all button.
* src/item-bar.c (item_bar_indent) : new utility.
2001-12-06 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/clipboard.c (clipboard_paste_region) : handle a
......@@ -35,7 +133,6 @@
(read_int) : taken from GTK 2.0
(gtk_XParseGeometry) : ditto
2001-12-01 Abel Cheung <maddog@linux.org.hk>
* configure.in: Renamed zh_CN.GB2312 to zh_CN in ALL_LINGUAS .
......
......@@ -35,6 +35,9 @@ Jody:
* Memory error when parsing names.
* Fix xml storage of parse position for names.
* sync print code with draw code for merges.
* Fix ins/del col/row in outline mode.
* Support number buttons in outline mode.
* Implement XL export for array formulas.
Morten:
* Fix EXPRESSION crash.
......
2001-12-06 Jody Goldberg <jody@gnome.org>
* src/sheet.c (sheet_colrow_set_collapse) : new.
(sheet_colrow_insert_finish) : new.
(sheet_colrow_delete_finish) : new.
(sheet_{col,row}_{ins,del} : use them here, we shoulw now correctly
handle collapse states and gutters when ins/del cols/row.
2001-12-06 Jody Goldberg <jody@gnome.org>
* src/sheet.c (sheet_colrow_gutter) : change signature and toggle the
resize flag if necessary.
(sheet_update_only_grid) : handle the resize and
recompute_max_{col,row}_group flags.
* src/colrow.c (colrow_set_states) : use simplified
sheet_colrow_gutter signature.
2001-12-06 Jody Goldberg <jody@gnome.org>
* src/workbook-cmd-format.c (sheet_dialog_set_row_height) : const.
* src/workbook-object-toolbar.c : disable some code that is not ready
for release.
* src/sheet.c (sheet_colrow_insdel_finish) : new.
(sheet_{col,row}_{ins,del} : use it here, and adjust the arguments to
include optional state to fill in the new cols/rows.
(sheet_colrow_fit_gutter) : simplify.
(sheet_colrow_group_ungroup) : ditto.
(sheet_colrow_fetch) : new utility.
(sheet_colrow_get_info) : ditto.
* src/sheet-control-gui.c (scg_setup_group_buttons) : new.
(scg_resize) : use it here.
(sheet_control_gui_new) : handle the layout for the group buttons.
* src/print.c (compute_group) : const.
* src/item-grid.c (item_grid_draw) : remove pointless use of
ColRowInfo::pos because I want to remove that eventually.
* src/print-cell.c (print_cell_range) : ditto.
* src/item-bar.c (item_bar_normal_font) : new.
(item_bar_indent) : new.
(item_bar_draw) : draw the top line as black, to match other buttons,
fix its length.
* src/history.c (history_menu_locate_separator) : sync with manu
changes.
* src/gnumeric.h
(ColRowStateGroup) : rename from ColRowSizeList.
(ColRowStateList) : rename from ColRowRLESizeList.
* src/gnumeric-canvas.c (gnm_canvas_find_col) : const.
* src/complete-sheet.c (complete_sheet_search_iteration) : const.
* src/commands.c (cmd_ins_del_colrow_undo) : pass the states into the
sheet_ routines. They will handle restoring them, and cleaning up the
collapse states.
(cmd_ins_del_colrow_redo) : ditto.
(cmd_ins_del_colrow_destroy) : simplify.
(cmd_colrow_outline_change) : use get_info and avoid the need to check
for NULL.
(cmd_group_undo) : simplify.
(cmd_group_redo) : ditto.
(cmd_group) : simplify.
* src/colrow.c (colrow_compute_pixels_from_pts) : move here from
sheet.c
(colrow_compute_pts_from_pixels) : ditto.
(colrow_is_default) : new utility routine so that we can remove ::pos
eventually.
(ColRowState) : new struct, will eventually replace the ColRowInfo.
(colrow_make_state) : new.
(colrow_get_states) : renamed from colrow_save_sizes and add support
for outline levels and collapse state.
(colrow_set_sizes) : use the correct aliases for the lists.
(colrow_set_states) : renamed from colrow_restore_sizes and support
the extra state info.
(colrow_restore_state_group) : rename colrow_restore_sizes_group.
(colrow_set_outline) : simplify.
2001-12-05 Jody Goldberg <jody@gnome.org>
* src/colrow.c (colrow_state_group_destroy) : rename from
colrow_rle_size_list_destroy.
* src/cellspan.c (cell_calc_span) : const.
2001-11-29 Jody Goldberg <jody@gnome.org>
* src/sheet-control-gui.c (scg_resize) : size the select all button.
* src/item-bar.c (item_bar_indent) : new utility.
2001-12-06 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/clipboard.c (clipboard_paste_region) : handle a
......@@ -35,7 +133,6 @@
(read_int) : taken from GTK 2.0
(gtk_XParseGeometry) : ditto
2001-12-01 Abel Cheung <maddog@linux.org.hk>
* configure.in: Renamed zh_CN.GB2312 to zh_CN in ALL_LINGUAS .
......
2001-12-06 Jody Goldberg <jody@gnome.org>
* src/sheet.c (sheet_colrow_set_collapse) : new.
(sheet_colrow_insert_finish) : new.
(sheet_colrow_delete_finish) : new.
(sheet_{col,row}_{ins,del} : use them here, we shoulw now correctly
handle collapse states and gutters when ins/del cols/row.
2001-12-06 Jody Goldberg <jody@gnome.org>
* src/sheet.c (sheet_colrow_gutter) : change signature and toggle the
resize flag if necessary.
(sheet_update_only_grid) : handle the resize and
recompute_max_{col,row}_group flags.
* src/colrow.c (colrow_set_states) : use simplified
sheet_colrow_gutter signature.
2001-12-06 Jody Goldberg <jody@gnome.org>
* src/workbook-cmd-format.c (sheet_dialog_set_row_height) : const.
* src/workbook-object-toolbar.c : disable some code that is not ready
for release.
* src/sheet.c (sheet_colrow_insdel_finish) : new.
(sheet_{col,row}_{ins,del} : use it here, and adjust the arguments to
include optional state to fill in the new cols/rows.
(sheet_colrow_fit_gutter) : simplify.
(sheet_colrow_group_ungroup) : ditto.
(sheet_colrow_fetch) : new utility.
(sheet_colrow_get_info) : ditto.
* src/sheet-control-gui.c (scg_setup_group_buttons) : new.
(scg_resize) : use it here.
(sheet_control_gui_new) : handle the layout for the group buttons.
* src/print.c (compute_group) : const.
* src/item-grid.c (item_grid_draw) : remove pointless use of
ColRowInfo::pos because I want to remove that eventually.
* src/print-cell.c (print_cell_range) : ditto.
* src/item-bar.c (item_bar_normal_font) : new.
(item_bar_indent) : new.
(item_bar_draw) : draw the top line as black, to match other buttons,
fix its length.
* src/history.c (history_menu_locate_separator) : sync with manu
changes.
* src/gnumeric.h
(ColRowStateGroup) : rename from ColRowSizeList.
(ColRowStateList) : rename from ColRowRLESizeList.
* src/gnumeric-canvas.c (gnm_canvas_find_col) : const.
* src/complete-sheet.c (complete_sheet_search_iteration) : const.
* src/commands.c (cmd_ins_del_colrow_undo) : pass the states into the
sheet_ routines. They will handle restoring them, and cleaning up the
collapse states.
(cmd_ins_del_colrow_redo) : ditto.
(cmd_ins_del_colrow_destroy) : simplify.
(cmd_colrow_outline_change) : use get_info and avoid the need to check
for NULL.
(cmd_group_undo) : simplify.
(cmd_group_redo) : ditto.
(cmd_group) : simplify.
* src/colrow.c (colrow_compute_pixels_from_pts) : move here from
sheet.c
(colrow_compute_pts_from_pixels) : ditto.
(colrow_is_default) : new utility routine so that we can remove ::pos
eventually.
(ColRowState) : new struct, will eventually replace the ColRowInfo.
(colrow_make_state) : new.
(colrow_get_states) : renamed from colrow_save_sizes and add support
for outline levels and collapse state.
(colrow_set_sizes) : use the correct aliases for the lists.
(colrow_set_states) : renamed from colrow_restore_sizes and support
the extra state info.
(colrow_restore_state_group) : rename colrow_restore_sizes_group.
(colrow_set_outline) : simplify.
2001-12-05 Jody Goldberg <jody@gnome.org>
* src/colrow.c (colrow_state_group_destroy) : rename from
colrow_rle_size_list_destroy.
* src/cellspan.c (cell_calc_span) : const.
2001-11-29 Jody Goldberg <jody@gnome.org>
* src/sheet-control-gui.c (scg_resize) : size the select all button.
* src/item-bar.c (item_bar_indent) : new utility.
2001-12-06 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/clipboard.c (clipboard_paste_region) : handle a
......@@ -35,7 +133,6 @@
(read_int) : taken from GTK 2.0
(gtk_XParseGeometry) : ditto
2001-12-01 Abel Cheung <maddog@linux.org.hk>
* configure.in: Renamed zh_CN.GB2312 to zh_CN in ALL_LINGUAS .
......
2001-12-06 Jody Goldberg <jody@gnome.org>
* src/sheet.c (sheet_colrow_set_collapse) : new.
(sheet_colrow_insert_finish) : new.
(sheet_colrow_delete_finish) : new.
(sheet_{col,row}_{ins,del} : use them here, we shoulw now correctly
handle collapse states and gutters when ins/del cols/row.
2001-12-06 Jody Goldberg <jody@gnome.org>
* src/sheet.c (sheet_colrow_gutter) : change signature and toggle the
resize flag if necessary.
(sheet_update_only_grid) : handle the resize and
recompute_max_{col,row}_group flags.
* src/colrow.c (colrow_set_states) : use simplified
sheet_colrow_gutter signature.
2001-12-06 Jody Goldberg <jody@gnome.org>
* src/workbook-cmd-format.c (sheet_dialog_set_row_height) : const.
* src/workbook-object-toolbar.c : disable some code that is not ready
for release.
* src/sheet.c (sheet_colrow_insdel_finish) : new.
(sheet_{col,row}_{ins,del} : use it here, and adjust the arguments to
include optional state to fill in the new cols/rows.
(sheet_colrow_fit_gutter) : simplify.
(sheet_colrow_group_ungroup) : ditto.
(sheet_colrow_fetch) : new utility.
(sheet_colrow_get_info) : ditto.
* src/sheet-control-gui.c (scg_setup_group_buttons) : new.
(scg_resize) : use it here.
(sheet_control_gui_new) : handle the layout for the group buttons.
* src/print.c (compute_group) : const.
* src/item-grid.c (item_grid_draw) : remove pointless use of
ColRowInfo::pos because I want to remove that eventually.
* src/print-cell.c (print_cell_range) : ditto.
* src/item-bar.c (item_bar_normal_font) : new.
(item_bar_indent) : new.
(item_bar_draw) : draw the top line as black, to match other buttons,
fix its length.
* src/history.c (history_menu_locate_separator) : sync with manu
changes.
* src/gnumeric.h
(ColRowStateGroup) : rename from ColRowSizeList.
(ColRowStateList) : rename from ColRowRLESizeList.
* src/gnumeric-canvas.c (gnm_canvas_find_col) : const.
* src/complete-sheet.c (complete_sheet_search_iteration) : const.
* src/commands.c (cmd_ins_del_colrow_undo) : pass the states into the
sheet_ routines. They will handle restoring them, and cleaning up the
collapse states.
(cmd_ins_del_colrow_redo) : ditto.
(cmd_ins_del_colrow_destroy) : simplify.
(cmd_colrow_outline_change) : use get_info and avoid the need to check
for NULL.
(cmd_group_undo) : simplify.
(cmd_group_redo) : ditto.
(cmd_group) : simplify.
* src/colrow.c (colrow_compute_pixels_from_pts) : move here from
sheet.c
(colrow_compute_pts_from_pixels) : ditto.
(colrow_is_default) : new utility routine so that we can remove ::pos
eventually.
(ColRowState) : new struct, will eventually replace the ColRowInfo.
(colrow_make_state) : new.
(colrow_get_states) : renamed from colrow_save_sizes and add support
for outline levels and collapse state.
(colrow_set_sizes) : use the correct aliases for the lists.
(colrow_set_states) : renamed from colrow_restore_sizes and support
the extra state info.
(colrow_restore_state_group) : rename colrow_restore_sizes_group.
(colrow_set_outline) : simplify.
2001-12-05 Jody Goldberg <jody@gnome.org>
* src/colrow.c (colrow_state_group_destroy) : rename from
colrow_rle_size_list_destroy.
* src/cellspan.c (cell_calc_span) : const.
2001-11-29 Jody Goldberg <jody@gnome.org>
* src/sheet-control-gui.c (scg_resize) : size the select all button.
* src/item-bar.c (item_bar_indent) : new utility.
2001-12-06 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/clipboard.c (clipboard_paste_region) : handle a
......@@ -35,7 +133,6 @@
(read_int) : taken from GTK 2.0
(gtk_XParseGeometry) : ditto
2001-12-01 Abel Cheung <maddog@linux.org.hk>
* configure.in: Renamed zh_CN.GB2312 to zh_CN in ALL_LINGUAS .
......
......@@ -3133,7 +3133,8 @@ ms_excel_read_guts (BiffQuery *q, ExcelSheet *esheet)
col_gut = MS_OLE_GET_GUINT16 (q->data + 6);
if (col_gut >= 1)
col_gut--;
sheet_col_row_gutter (esheet->gnum_sheet, col_gut, row_gut);
sheet_colrow_gutter (esheet->gnum_sheet, TRUE, col_gut);
sheet_colrow_gutter (esheet->gnum_sheet, FALSE, row_gut);
}
/* See: S59DE3.HTM */
......
......@@ -258,7 +258,7 @@ gnumeric_cell (FunctionEvalInfo *ei, Value **argv)
}
return value_new_string ("b");
} else if (!g_strcasecmp (info_type, "width")) {
ColRowInfo *info = sheet_col_get_info (ei->pos->sheet, ref.col);
ColRowInfo const *info = sheet_col_get_info (ei->pos->sheet, ref.col);
double charwidth;
int cellwidth;
......
......@@ -276,7 +276,7 @@ cell_calc_span (Cell const * const cell, int * const col1, int * const col2)
margin = cell->col_info->margin_a;
for (; left > 0 && pos > min_col; pos--){
ColRowInfo *ci = sheet_col_get_info (sheet, pos);
ColRowInfo const *ci = sheet_col_get_info (sheet, pos);
if (ci->visible) {
if (!cellspan_is_empty (pos, ri, cell))
......@@ -307,7 +307,7 @@ cell_calc_span (Cell const * const cell, int * const col1, int * const col2)
margin_b = cell->col_info->margin_b;
for (; remain_left > 0 || remain_right > 0;){
ColRowInfo *ci;
ColRowInfo const *ci;
if (--pos_l > min_col){
ci = sheet_col_get_info (sheet, pos_l);
......
......@@ -22,10 +22,45 @@
*/
#include <config.h>
#include "colrow.h"
#include "parse-util.h"
#include "selection.h"
#include "sheet.h"
#include "sheet-private.h"
#include "application.h"
#include "parse-util.h"
#include "selection.h"
void
colrow_compute_pixels_from_pts (ColRowInfo *cri,
Sheet const *sheet, gboolean horizontal)
{
double const scale =
sheet->last_zoom_factor_used *
application_display_dpi_get (horizontal) / 72.;
cri->size_pixels = (int)(cri->size_pts * scale + 0.5);
}
void
colrow_compute_pts_from_pixels (ColRowInfo *cri,
Sheet const *sheet, gboolean horizontal)
{
double const scale =
sheet->last_zoom_factor_used *
application_display_dpi_get (horizontal) / 72.;
cri->size_pts = cri->size_pixels / scale;
#if 0
/* Disable this until we decide how to deal with scaling */
g_return_if_fail (cri->size_pts >= cri->margin_a + cri->margin_b);
#endif
}
/* TODO : use the is_default flag */
gboolean
colrow_is_default (ColRowInfo const *cri)
{
g_return_val_if_fail (cri != NULL, FALSE);
return cri->pos < 0;
}
/**
* colrow_equal :
......@@ -83,6 +118,8 @@ colrow_foreach (ColRowCollection const *infos, int first, int last,
int i;
/* TODO : Do we need to support right -> left as an option */
/* clip */
if (last > infos->max_used)
last = infos->max_used;
......@@ -114,28 +151,37 @@ typedef struct _ColRowIndex
int first, last;
} ColRowIndex;
typedef struct _ColRowState {
float size_pts;
unsigned is_default : 1;
unsigned outline_level : 4;
unsigned is_collapsed : 1; /* Does this terminate an outline ? */
unsigned hard_size : 1; /* are dimensions explicitly set ? */
unsigned visible : 1; /* visible */
} ColRowState;
typedef struct {
int length;
float size;
} SavedSize;
int length;
ColRowState state;
} ColRowRLEState;
ColRowRLESizeList *
colrow_rle_size_list_destroy (ColRowSizeList *list)
ColRowStateList *
colrow_state_list_destroy (ColRowStateList *list)
{
GSList *ptr;
ColRowStateList *ptr;
for (ptr = list; ptr != NULL; ptr = ptr->next)
g_free (ptr->data);
g_slist_free (list);
return NULL;
}
ColRowSizeList *
colrow_size_list_destroy (ColRowSizeList *list)
ColRowStateGroup *
colrow_state_group_destroy (ColRowStateGroup *group)
{
ColRowSizeList *ptr;
for (ptr = list; ptr != NULL ; ptr = ptr->next)
colrow_rle_size_list_destroy ((ColRowSizeList *) ptr->data);
g_slist_free (list);
ColRowStateGroup *ptr;
for (ptr = group; ptr != NULL ; ptr = ptr->next)
colrow_state_list_destroy (ptr->data);
g_slist_free (group);
return NULL;
}
......@@ -165,7 +211,7 @@ colrow_index_compare (ColRowIndex const * a, ColRowIndex const * b)
* @is_single: If non-null this will be set to TRUE if there's only a single col/row involved.
*/
GString *
colrow_index_list_to_string (ColRowIndexList *list, gboolean const is_cols, gboolean *is_single)
colrow_index_list_to_string (ColRowIndexList *list, gboolean is_cols, gboolean *is_single)
{
ColRowIndexList *ptr;
GString *result;
......@@ -181,19 +227,19 @@ colrow_index_list_to_string (ColRowIndexList *list, gboolean const is_cols, gboo
g_string_append (result, cols_name (index->first, index->last));
else
g_string_append (result, rows_name (index->first, index->last));
if (index->last != index->first)
single = FALSE;
if (ptr->next) {
g_string_append (result, ", ");
single = FALSE;
}
}
if (is_single)
*is_single = single;
return result;
}
......@@ -235,61 +281,76 @@ colrow_get_index_list (int first, int last, ColRowIndexList *list)
return list;
}
ColRowRLESizeList *
colrow_save_sizes (Sheet *sheet, gboolean const is_cols, int first, int last)
ColRowStateList *
colrow_make_state (Sheet *sheet, int first, int last,
float size_pts, gboolean hard_size,
int outline_level)
{
ColRowRLEState *rles = g_new0 (ColRowRLEState, 1);
rles->length = last - first +1;
rles->state.size_pts = size_pts;
rles->state.outline_level = outline_level;
rles->state.is_collapsed = FALSE;
rles->state.hard_size = hard_size;
rles->state.visible = TRUE;
return g_slist_prepend (NULL, rles);
}
ColRowStateList *
colrow_get_states (Sheet *sheet, gboolean is_cols, int first, int last)
{
int i;
ColRowRLESizeList *list = NULL;
SavedSize *ss;
float size, run_size = 0.;
int run_length = 0;
ColRowStateList *list = NULL;
ColRowRLEState *rles;
ColRowState run_state, cur_state;
int i, run_length = 0;
g_return_val_if_fail (IS_SHEET (sheet), NULL);
g_return_val_if_fail (first <= last, NULL);
for (i = first; i <= last; ++i) {
ColRowInfo *info = sheet_colrow_get_info (sheet, i, is_cols);
g_return_val_if_fail (info != NULL, NULL); /* be anal, and leak */
if (info->pos != -1) {
size = info->size_pts;
if (info->hard_size)
size *= -1.;
} else
size = 0.;
ColRowInfo const *info = sheet_colrow_get_info (sheet, i, is_cols);
if (!(cur_state.is_default = colrow_is_default (info))) {
cur_state.size_pts = info->size_pts;
cur_state.outline_level = info->outline_level;
cur_state.is_collapsed = info->is_collapsed;
cur_state.hard_size = info->hard_size;
cur_state.visible = info->visible;
}
/* Initialize the run_size in the first loop */
if (i == first) {
run_size = size;
if (run_length == 0) {
run_state = cur_state;
run_length = 1;
continue;
}
/*
* If the size does not equal the size of
* the current run then the current run has ended
*/
if (size != run_size) {
ss = g_new0 (SavedSize, 1);
ss->length = run_length;
ss->size = run_size;
list = g_slist_prepend (list, ss);
run_size = size;
/* If state changed, start a new block */
if (cur_state.size_pts != run_state.size_pts ||
cur_state.outline_level != run_state.outline_level ||
cur_state.is_collapsed != run_state.is_collapsed ||
cur_state.hard_size != run_state.hard_size ||
cur_state.visible != run_state.visible) {
rles = g_new0 (ColRowRLEState, 1);
rles->length = run_length;
rles->state = run_state;
list = g_slist_prepend (list, rles);
run_state = cur_state;
run_length = 1;
} else
++run_length;
}
/* Store the final run */
ss = g_new0 (SavedSize, 1);
ss->length = run_length;
ss->size = run_size;
list = g_slist_prepend (list, ss);