[gnumeric] Some speed up of the early checks of column or row insertion
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Some speed up of the early checks of column or row insertion
- Date: Thu, 14 Jul 2011 07:24:54 +0000 (UTC)
commit 317a16b992cb1f3df7d48052a549820b7cf36741
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Thu Jul 14 01:22:51 2011 -0600
Some speed up of the early checks of column or row insertion
2011-07-14 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/commands.c (cmd_insert_cols): use sheet_range_trim rather
than sheet_get_extent (this will always be faster).
(cmd_insert_rows): ditto
ChangeLog | 8 +++++++-
src/commands.c | 16 +++++++++-------
2 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 49c2496..064927b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
-2011-07-09 Andreas J. Guelzow <aguelzow pyrshep ca>
+2011-07-14 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * src/commands.c (cmd_insert_cols): use sheet_range_trim rather
+ than sheet_get_extent (this will always be faster).
+ (cmd_insert_rows): ditto
+
+2011-07-12 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/gui-clipboard.c (x_clipboard_get_cb): provide undo of cut.
diff --git a/src/commands.c b/src/commands.c
index 362b7fa..449c895 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -1448,11 +1448,12 @@ cmd_insert_cols (WorkbookControl *wbc,
Sheet *sheet, int start_col, int count)
{
char *mesg;
- GnmRange r = sheet_get_extent (sheet, TRUE);
-
- r.end.col += count;
+ GnmRange r;
+
+ range_init_full_sheet (&r, sheet);
+ r.start.row = r.end.row - count + 1;
- if (gnm_sheet_get_last_col (sheet) < r.end.col) {
+ if (!sheet_range_trim (sheet, &r, FALSE, FALSE)) {
go_gtk_notice_dialog (wbcg_toplevel (WBC_GTK (wbc)), GTK_MESSAGE_ERROR,
ngettext ("Inserting %i column before column %s would push data off the sheet. "
"Please enlarge the sheet first.",
@@ -1476,11 +1477,12 @@ cmd_insert_rows (WorkbookControl *wbc,
Sheet *sheet, int start_row, int count)
{
char *mesg;
- GnmRange r = sheet_get_extent (sheet, TRUE);
+ GnmRange r;
- r.end.row += count;
+ range_init_full_sheet (&r, sheet);
+ r.start.row = r.end.row - count + 1;
- if (gnm_sheet_get_last_row (sheet) < r.end.row) {
+ if (!sheet_range_trim (sheet, &r, FALSE, FALSE)) {
go_gtk_notice_dialog (wbcg_toplevel (WBC_GTK (wbc)), GTK_MESSAGE_ERROR,
ngettext ("Inserting %i row before row %s would push data off the sheet. "
"Please enlarge the sheet first.",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]