Commit 48d59bf8 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg
Browse files

Make the displaying the warning optional. (sheet_range_splits_region) :


2001-05-04  Jody Goldberg <jgoldberg@home.com>

	* src/sheet.c (sheet_range_splits_array) : Make the displaying the
	  warning optional.
	(sheet_range_splits_region) : ditto.
	(sheet_range_contains_region) : implement.

	* src/workbook-control-gui.c (sort_cmd) : no need to check for merges
	  or arrays here.
	* src/dialogs/dialog-cell-sort.c (dialog_cell_sort) : or here.

	* src/commands.c (cmd_sort) : it belongs here.

	* src/print.c (print_page) : in the case of grid lines we were off by
	  a point.  In the case without gridlines we need not display the
	  leading cell margins.
parent 86bc8c6d
2001-05-04 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_range_splits_array) : Make the displaying the
warning optional.
(sheet_range_splits_region) : ditto.
(sheet_range_contains_region) : implement.
* src/workbook-control-gui.c (sort_cmd) : no need to check for merges
or arrays here.
* src/dialogs/dialog-cell-sort.c (dialog_cell_sort) : or here.
* src/commands.c (cmd_sort) : it belongs here.
* src/print.c (print_page) : in the case of grid lines we were off by
a point. In the case without gridlines we need not display the
leading cell margins.
2001-05-04 Jody Goldberg <jgoldberg@home.com>
s/clipboard_release/cellregion_free/
......
2001-05-04 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_range_splits_array) : Make the displaying the
warning optional.
(sheet_range_splits_region) : ditto.
(sheet_range_contains_region) : implement.
* src/workbook-control-gui.c (sort_cmd) : no need to check for merges
or arrays here.
* src/dialogs/dialog-cell-sort.c (dialog_cell_sort) : or here.
* src/commands.c (cmd_sort) : it belongs here.
* src/print.c (print_page) : in the case of grid lines we were off by
a point. In the case without gridlines we need not display the
leading cell margins.
2001-05-04 Jody Goldberg <jgoldberg@home.com>
s/clipboard_release/cellregion_free/
......
2001-05-04 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_range_splits_array) : Make the displaying the
warning optional.
(sheet_range_splits_region) : ditto.
(sheet_range_contains_region) : implement.
* src/workbook-control-gui.c (sort_cmd) : no need to check for merges
or arrays here.
* src/dialogs/dialog-cell-sort.c (dialog_cell_sort) : or here.
* src/commands.c (cmd_sort) : it belongs here.
* src/print.c (print_page) : in the case of grid lines we were off by
a point. In the case without gridlines we need not display the
leading cell margins.
2001-05-04 Jody Goldberg <jgoldberg@home.com>
s/clipboard_release/cellregion_free/
......
2001-05-04 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_range_splits_array) : Make the displaying the
warning optional.
(sheet_range_splits_region) : ditto.
(sheet_range_contains_region) : implement.
* src/workbook-control-gui.c (sort_cmd) : no need to check for merges
or arrays here.
* src/dialogs/dialog-cell-sort.c (dialog_cell_sort) : or here.
* src/commands.c (cmd_sort) : it belongs here.
* src/print.c (print_page) : in the case of grid lines we were off by
a point. In the case without gridlines we need not display the
leading cell margins.
2001-05-04 Jody Goldberg <jgoldberg@home.com>
s/clipboard_release/cellregion_free/
......
2001-05-04 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_range_splits_array) : Make the displaying the
warning optional.
(sheet_range_splits_region) : ditto.
(sheet_range_contains_region) : implement.
* src/workbook-control-gui.c (sort_cmd) : no need to check for merges
or arrays here.
* src/dialogs/dialog-cell-sort.c (dialog_cell_sort) : or here.
* src/commands.c (cmd_sort) : it belongs here.
* src/print.c (print_page) : in the case of grid lines we were off by
a point. In the case without gridlines we need not display the
leading cell margins.
2001-05-04 Jody Goldberg <jgoldberg@home.com>
s/clipboard_release/cellregion_free/
......
......@@ -1909,9 +1909,8 @@ cmd_sort_redo (GnumericCommand *cmd, WorkbookControl *wbc)
if (!me->perm) {
me->perm = sort_contents (wbc, me->data);
me->parent.size += 2 * sort_data_length (me->data);
} else {
} else
sort_position (wbc, me->data, me->perm);
}
return FALSE;
}
......@@ -1921,9 +1920,17 @@ cmd_sort (WorkbookControl *wbc, SortData *data)
{
GtkObject *obj;
CmdSort *me;
char *desc;
g_return_val_if_fail (data != NULL, TRUE);
desc = g_strdup_printf (_("Sorting %s"), range_name (data->range));
if (sheet_range_contains_region (data->sheet, data->range, wbc, desc)) {
sort_data_destroy (data);
g_free (desc);
return TRUE;
}
obj = gtk_type_new (CMD_SORT_TYPE);
me = CMD_SORT (obj);
......@@ -1933,8 +1940,7 @@ cmd_sort (WorkbookControl *wbc, SortData *data)
me->parent.sheet = data->sheet;
me->parent.size = 1; /* Changed in initial redo. */
me->parent.cmd_descriptor =
g_strdup_printf (_("Sorting %s"), range_name (me->data->range));
me->parent.cmd_descriptor = desc;
/* Register the command object */
return command_push_undo (wbc, obj);
......
......@@ -340,7 +340,6 @@ dialog_cell_sort_ok (SortFlow *sf)
cmd_sort (WORKBOOK_CONTROL (sf->wbcg), data);
return FALSE;
}
......@@ -491,9 +490,6 @@ dialog_cell_sort (WorkbookControlGUI *wbcg, Sheet *sheet)
if (!(sel = selection_first_range (sheet, WORKBOOK_CONTROL (wbcg), _("Sort"))))
return;
#warning can not contain merged regions
#warning can not contain arrays
/* Initialize some important stuff */
sort_flow.sel = range_dup (sel);
sort_flow.sheet = sheet;
......
......@@ -532,6 +532,15 @@ print_page (Sheet const *sheet, int start_col, int start_row, int end_col, int e
/* Margins */
base_x += margins->left.points;
base_y += MAX (margins->top.points, margins->header.points);
if (pj->pi->print_grid_lines) {
/* the initial grid lines */
base_x += 1.;
base_y += 1.;
} else {
/* If there are no grids ignore the leading cell margins */
base_x -= sheet->cols.default_style.margin_a;
base_y -= sheet->rows.default_style.margin_a;
}
for (i = 0; i < pj->n_copies; i++){
double x = base_x;
......
......@@ -1859,8 +1859,9 @@ sheet_range_splits_array (Sheet const *sheet,
if (closure.flags &&
colrow_foreach (&sheet->cols, r->start.col, r->end.col,
&cb_check_array_horizontal, &closure)) {
gnumeric_error_splits_array (COMMAND_CONTEXT (wbc),
cmd, &closure.error);
if (wbc)
gnumeric_error_splits_array (COMMAND_CONTEXT (wbc),
cmd, &closure.error);
return TRUE;
}
......@@ -1880,8 +1881,9 @@ sheet_range_splits_array (Sheet const *sheet,
if (closure.flags &&
colrow_foreach (&sheet->rows, r->start.row, r->end.row,
&cb_check_array_vertical, &closure)) {
gnumeric_error_splits_array (COMMAND_CONTEXT (wbc),
cmd, &closure.error);
if (wbc)
gnumeric_error_splits_array (COMMAND_CONTEXT (wbc),
cmd, &closure.error);
return TRUE;
}
return FALSE;
......@@ -1922,7 +1924,7 @@ sheet_range_splits_region (Sheet const *sheet,
}
g_slist_free (merged);
if (ptr != NULL) {
if (wbc != NULL && ptr != NULL) {
gnumeric_error_invalid (COMMAND_CONTEXT (wbc), cmd_name,
_("Target region contains merged cells"));
return TRUE;
......@@ -1956,7 +1958,6 @@ sheet_ranges_split_region (Sheet const * sheet, GSList const *ranges,
return FALSE;
}
#if 0
static Value *
cb_cell_is_array (Sheet *sheet, int col, int row, Cell *cell, void *user_data)
{
......@@ -1965,41 +1966,34 @@ cb_cell_is_array (Sheet *sheet, int col, int row, Cell *cell, void *user_data)
}
gboolean
selection_is_simple (WorkbookControl *wbc, Sheet const *sheet,
char const *command_name,
gboolean allow_merged, gboolean allow_arrays)
sheet_range_contains_region (Sheet const *sheet, Range const *r,
WorkbookControl *wbc, char const *cmd)
{
Range const *r;
GSList *merged;
g_return_val_if_fail (IS_SHEET (sheet), FALSE);
r = sheet->selections->data;
if (!allow_merged) {
merged = sheet_merge_get_overlap (sheet, r);
if (merged != NULL) {
gnumeric_error_invalid (COMMAND_CONTEXT (wbc), command_name,
merged = sheet_merge_get_overlap (sheet, r);
if (merged != NULL) {
if (wbc != NULL)
gnumeric_error_invalid (COMMAND_CONTEXT (wbc), cmd,
_("can not operate on merged cells"));
g_slist_free (merged);
return FALSE;
}
g_slist_free (merged);
return FALSE;
}
if (!allow_arrays) {
if (sheet_foreach_cell_in_range ((Sheet *)sheet, TRUE,
r->start.col, r->start.row,
r->end.col, r->end.row,
cb_cell_is_array, NULL)) {
gnumeric_error_invalid (COMMAND_CONTEXT (wbc), command_name,
if (sheet_foreach_cell_in_range ((Sheet *)sheet, TRUE,
r->start.col, r->start.row,
r->end.col, r->end.row,
cb_cell_is_array, NULL)) {
if (wbc != NULL)
gnumeric_error_invalid (COMMAND_CONTEXT (wbc), cmd,
_("can not operate on array formulae"));
return FALSE;
}
return FALSE;
}
return TRUE;
}
#endif
/***************************************************************************/
......
......@@ -1879,8 +1879,6 @@ sort_cmd (WorkbookControlGUI *wbcg, int asc)
if (!(tmp = selection_first_range (sheet, WORKBOOK_CONTROL (wbcg), _("Sort"))))
return;
#warning can not contain merged regions
#warning can not contain arrays
sel = range_dup (tmp);
range_clip_to_finite (sel, sheet);
......@@ -1899,11 +1897,13 @@ sort_cmd (WorkbookControlGUI *wbcg, int asc)
data->range = sel;
data->num_clause = numclause;
data->clauses = clause;
/* TODO : shouldn't this look at the shape of the region ? */
data->top = TRUE;
if (range_has_header (data->sheet, data->range, TRUE)) {
if (range_has_header (data->sheet, data->range, data->top))
data->range->start.row += 1;
}
else
data->range->start.col += 1;
cmd_sort (WORKBOOK_CONTROL (wbcg), data);
}
......
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