Commit 7baa890a authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Delete unused routine. (sheet_selection_to_list) : Ditto.


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

	* src/selection.c (sheet_selection_reset) : Delete unused routine.
	(sheet_selection_to_list) : Ditto.

	* src/item-cursor.c (item_cursor_autofill_event) : Use new undoable
	  version of autofill.

	* src/corba-sheet.c (Sheet_selection_reset) : Delete.

	* src/commands.c (cmd_area_set_text_undo) : We want to restore
	  formulas, not values.
	(cmd_clear_selection) : Paste by value should be exclusive of paste by
	  formula.
	(cmd_autofill_*) : New functions.

	* idl/Gnumeric.idl : Remove useless function selection_reset.

	* src/number-match.c (format_match) : Handle numbers larger than
	  LONG_{MAX,MIN} by falling through to double.

	* src/sheet.c (sheet_recompute_spans_for_col) : Use closure.
parent 840f684c
......@@ -10,7 +10,7 @@ Long term breakage
------------------
- The max row/col scroll size is still hard coded.
- Sorting should move styles too.
- Sorting should move styles too (jpr is working on this)
- Increase/Decrease precision toolbar buttons should look at the displayed
precision for the edit cell and assign the changed value to the entire
......
2000-06-02 Jody Goldberg <jgoldberg@home.com>
* src/selection.c (sheet_selection_reset) : Delete unused routine.
(sheet_selection_to_list) : Ditto.
* src/item-cursor.c (item_cursor_autofill_event) : Use new undoable
version of autofill.
* src/corba-sheet.c (Sheet_selection_reset) : Delete.
* src/commands.c (cmd_area_set_text_undo) : We want to restore
formulas, not values.
(cmd_clear_selection) : Paste by value should be exclusive of paste by
formula.
(cmd_autofill_*) : New functions.
* idl/Gnumeric.idl : Remove useless function selection_reset.
* src/number-match.c (format_match) : Handle numbers larger than
LONG_{MAX,MIN} by falling through to double.
* src/sheet.c (sheet_recompute_spans_for_col) : Use closure.
2000-06-01 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_sheet_write) : Adjust to changes in
......
2000-06-02 Jody Goldberg <jgoldberg@home.com>
* src/selection.c (sheet_selection_reset) : Delete unused routine.
(sheet_selection_to_list) : Ditto.
* src/item-cursor.c (item_cursor_autofill_event) : Use new undoable
version of autofill.
* src/corba-sheet.c (Sheet_selection_reset) : Delete.
* src/commands.c (cmd_area_set_text_undo) : We want to restore
formulas, not values.
(cmd_clear_selection) : Paste by value should be exclusive of paste by
formula.
(cmd_autofill_*) : New functions.
* idl/Gnumeric.idl : Remove useless function selection_reset.
* src/number-match.c (format_match) : Handle numbers larger than
LONG_{MAX,MIN} by falling through to double.
* src/sheet.c (sheet_recompute_spans_for_col) : Use closure.
2000-06-01 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_sheet_write) : Adjust to changes in
......
2000-06-02 Jody Goldberg <jgoldberg@home.com>
* src/selection.c (sheet_selection_reset) : Delete unused routine.
(sheet_selection_to_list) : Ditto.
* src/item-cursor.c (item_cursor_autofill_event) : Use new undoable
version of autofill.
* src/corba-sheet.c (Sheet_selection_reset) : Delete.
* src/commands.c (cmd_area_set_text_undo) : We want to restore
formulas, not values.
(cmd_clear_selection) : Paste by value should be exclusive of paste by
formula.
(cmd_autofill_*) : New functions.
* idl/Gnumeric.idl : Remove useless function selection_reset.
* src/number-match.c (format_match) : Handle numbers larger than
LONG_{MAX,MIN} by falling through to double.
* src/sheet.c (sheet_recompute_spans_for_col) : Use closure.
2000-06-01 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_sheet_write) : Adjust to changes in
......
2000-06-02 Jody Goldberg <jgoldberg@home.com>
* src/selection.c (sheet_selection_reset) : Delete unused routine.
(sheet_selection_to_list) : Ditto.
* src/item-cursor.c (item_cursor_autofill_event) : Use new undoable
version of autofill.
* src/corba-sheet.c (Sheet_selection_reset) : Delete.
* src/commands.c (cmd_area_set_text_undo) : We want to restore
formulas, not values.
(cmd_clear_selection) : Paste by value should be exclusive of paste by
formula.
(cmd_autofill_*) : New functions.
* idl/Gnumeric.idl : Remove useless function selection_reset.
* src/number-match.c (format_match) : Handle numbers larger than
LONG_{MAX,MIN} by falling through to double.
* src/sheet.c (sheet_recompute_spans_for_col) : Use closure.
2000-06-01 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_sheet_write) : Adjust to changes in
......
2000-06-02 Jody Goldberg <jgoldberg@home.com>
* src/selection.c (sheet_selection_reset) : Delete unused routine.
(sheet_selection_to_list) : Ditto.
* src/item-cursor.c (item_cursor_autofill_event) : Use new undoable
version of autofill.
* src/corba-sheet.c (Sheet_selection_reset) : Delete.
* src/commands.c (cmd_area_set_text_undo) : We want to restore
formulas, not values.
(cmd_clear_selection) : Paste by value should be exclusive of paste by
formula.
(cmd_autofill_*) : New functions.
* idl/Gnumeric.idl : Remove useless function selection_reset.
* src/number-match.c (format_match) : Handle numbers larger than
LONG_{MAX,MIN} by falling through to double.
* src/sheet.c (sheet_recompute_spans_for_col) : Use closure.
2000-06-01 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_sheet_write) : Adjust to changes in
......
2000-06-02 Jody Goldberg <jgoldberg@home.com>
* src/selection.c (sheet_selection_reset) : Delete unused routine.
(sheet_selection_to_list) : Ditto.
* src/item-cursor.c (item_cursor_autofill_event) : Use new undoable
version of autofill.
* src/corba-sheet.c (Sheet_selection_reset) : Delete.
* src/commands.c (cmd_area_set_text_undo) : We want to restore
formulas, not values.
(cmd_clear_selection) : Paste by value should be exclusive of paste by
formula.
(cmd_autofill_*) : New functions.
* idl/Gnumeric.idl : Remove useless function selection_reset.
* src/number-match.c (format_match) : Handle numbers larger than
LONG_{MAX,MIN} by falling through to double.
* src/sheet.c (sheet_recompute_spans_for_col) : Use closure.
2000-06-01 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_sheet_write) : Adjust to changes in
......
2000-06-02 Jody Goldberg <jgoldberg@home.com>
* src/selection.c (sheet_selection_reset) : Delete unused routine.
(sheet_selection_to_list) : Ditto.
* src/item-cursor.c (item_cursor_autofill_event) : Use new undoable
version of autofill.
* src/corba-sheet.c (Sheet_selection_reset) : Delete.
* src/commands.c (cmd_area_set_text_undo) : We want to restore
formulas, not values.
(cmd_clear_selection) : Paste by value should be exclusive of paste by
formula.
(cmd_autofill_*) : New functions.
* idl/Gnumeric.idl : Remove useless function selection_reset.
* src/number-match.c (format_match) : Handle numbers larger than
LONG_{MAX,MIN} by falling through to double.
* src/sheet.c (sheet_recompute_spans_for_col) : Use closure.
2000-06-01 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_sheet_write) : Adjust to changes in
......
......@@ -64,7 +64,6 @@ module GNOME {
//
void select_all ();
boolean is_all_selected ();
void selection_reset ();
void selection_append (in long col, in long row)
raises (OutOfRange);
void selection_append_range (in long start_col,
......
......@@ -64,7 +64,6 @@ module GNOME {
//
void select_all ();
boolean is_all_selected ();
void selection_reset ();
void selection_append (in long col, in long row)
raises (OutOfRange);
void selection_append_range (in long start_col,
......
......@@ -41,6 +41,7 @@
#include "border.h"
#include "rendered-value.h"
#include "dialogs/dialog-autocorrect.h"
#include "sheet-autofill.h"
/*
* NOTE : This is a work in progress
......@@ -479,7 +480,7 @@ cmd_area_set_text_undo (GnumericCommand *cmd, CommandContext *context)
c = me->old_content->data;
clipboard_paste_region (context,
paste_target_init (&pt, me->pos.sheet, r, PASTE_VALUES),
paste_target_init (&pt, me->pos.sheet, r, PASTE_FORMULAS),
c);
clipboard_release (c);
me->old_content = g_slist_remove (me->old_content, c);
......@@ -984,7 +985,7 @@ cmd_clear_selection (CommandContext *context, Sheet *sheet, int clear_flags)
me->paste_flags = 0;
if (clear_flags & CLEAR_VALUES)
me->paste_flags |= PASTE_VALUES | PASTE_FORMULAS;
me->paste_flags |= PASTE_FORMULAS;
if (clear_flags & CLEAR_FORMATS)
me->paste_flags |= PASTE_FORMATS;
if (clear_flags & CLEAR_COMMENTS)
......@@ -1485,10 +1486,6 @@ cmd_resize_row_col (CommandContext *context,
/* TODO :
* - Patch into manual and auto resizing
* - store the selected sized,
*
* There is something odd about the way row/col resize is handled currently.
* The item-bar sends a signal to all the sheet-views each of which sets
* the size for the sheet.
*/
/* Register the command object */
......@@ -2002,12 +1999,130 @@ cmd_paste_copy (CommandContext *context,
/******************************************************************/
#define CMD_AUTOFILL_TYPE (cmd_autofill_get_type ())
#define CMD_AUTOFILL(o) (GTK_CHECK_CAST ((o), CMD_AUTOFILL_TYPE, CmdAutofill))
typedef struct
{
GnumericCommand parent;
CellRegion *content;
PasteTarget dst;
int base_col, base_row, w, h, end_col, end_row;
} CmdAutofill;
GNUMERIC_MAKE_COMMAND (CmdAutofill, cmd_autofill);
static gboolean
cmd_autofill_undo (GnumericCommand *cmd, CommandContext *context)
{
CmdAutofill *me = CMD_AUTOFILL(cmd);
gboolean res;
g_return_val_if_fail (me != NULL, TRUE);
g_return_val_if_fail (me->content != NULL, TRUE);
res = clipboard_paste_region (context, &me->dst, me->content);
clipboard_release (me->content);
me->content = NULL;
if (res)
return TRUE;
/* Make the newly pasted content the selection (this queues a redraw) */
sheet_selection_reset_only (me->dst.sheet);
sheet_selection_add_range (me->dst.sheet,
me->base_col, me->base_row,
me->base_col, me->base_row,
me->base_col + me->w-1,
me->base_row + me->h-1);
sheet_set_dirty (me->dst.sheet, TRUE);
workbook_recalc (me->dst.sheet->workbook);
sheet_update (me->dst.sheet);
return FALSE;
}
static gboolean
cmd_autofill_redo (GnumericCommand *cmd, CommandContext *context)
{
CmdAutofill *me = CMD_AUTOFILL(cmd);
g_return_val_if_fail (me != NULL, TRUE);
g_return_val_if_fail (me->content == NULL, TRUE);
me->content = clipboard_copy_range (me->dst.sheet, &me->dst.range);
sheet_autofill (me->dst.sheet,
me->base_col, me->base_row, me->w, me->h,
me->end_col, me->end_row);
/* Make the newly filled content the selection (this queues a redraw) */
sheet_selection_reset_only (me->dst.sheet);
sheet_selection_add_range (me->dst.sheet,
me->base_col, me->base_row,
me->base_col, me->base_row,
me->end_col, me->end_row);
sheet_set_dirty (me->dst.sheet, TRUE);
workbook_recalc (me->dst.sheet->workbook);
sheet_update (me->dst.sheet);
return FALSE;
}
static void
cmd_autofill_destroy (GtkObject *cmd)
{
CmdAutofill *me = CMD_AUTOFILL(cmd);
if (me->content) {
clipboard_release (me->content);
me->content = NULL;
}
gnumeric_command_destroy (cmd);
}
gboolean
cmd_autofill (CommandContext *context, Sheet *sheet,
int base_col, int base_row,
int w, int h, int end_col, int end_row)
{
GtkObject *obj;
CmdAutofill *me;
g_return_val_if_fail (sheet != NULL, TRUE);
obj = gtk_type_new (CMD_AUTOFILL_TYPE);
me = CMD_AUTOFILL (obj);
/* Store the specs for the object */
me->content = NULL;
me->dst.sheet = sheet;
me->dst.paste_flags = PASTE_FORMULAS | PASTE_FORMATS;
/* FIXME : We can copy less than this */
range_init (&me->dst.range, base_col, base_row, end_col, end_row);
me->base_col = base_col;
me->base_row = base_row,
me->w = w;
me->h = h;
me->end_col = end_col;
me->end_row = end_row;
me->parent.cmd_descriptor = g_strdup (_("Autofill"));
/* Register the command object */
return command_push_undo (context, sheet->workbook, obj);
}
/******************************************************************/
/*
* - Complete colrow resize
*
* TODO : Make a list of commands that should have undo support
* that do not even have stubs
*
* - Autofill
* - SheetObject creation & manipulation.
*/
......@@ -45,6 +45,10 @@ gboolean cmd_sort (CommandContext *context, Sheet *sheet,
gboolean cmd_format (CommandContext *context, Sheet *sheet,
MStyle *style, MStyleBorder **borders);
gboolean cmd_autofill (CommandContext *context, Sheet *sheet,
int base_col, int base_row,
int w, int h, int end_col, int end_row);
gboolean cmd_clear_selection (CommandContext *context, Sheet *sheet,
int const clear_flags);
gboolean cmd_hide_selection_rows_cols (CommandContext *context, Sheet *sheet,
......
......@@ -150,14 +150,6 @@ Sheet_is_all_selected (PortableServer_Servant servant, CORBA_Environment *ev)
return sheet_is_all_selected (sheet);
}
static void
Sheet_selection_reset (PortableServer_Servant servant, CORBA_Environment *ev)
{
Sheet *sheet = sheet_from_servant (servant);
sheet_selection_reset (sheet);
}
static void
Sheet_selection_append (PortableServer_Servant servant,
const CORBA_long col, const CORBA_long row,
......@@ -1170,7 +1162,6 @@ Sheet_corba_class_init (void)
gnome_gnumeric_sheet_epv.make_cell_visible = Sheet_make_cell_visible;
gnome_gnumeric_sheet_epv.select_all = Sheet_select_all;
gnome_gnumeric_sheet_epv.is_all_selected = Sheet_is_all_selected;
gnome_gnumeric_sheet_epv.selection_reset = Sheet_selection_reset;
gnome_gnumeric_sheet_epv.selection_append = Sheet_selection_append;
gnome_gnumeric_sheet_epv.selection_append_range = Sheet_selection_append_range;
gnome_gnumeric_sheet_epv.selection_copy = Sheet_selection_copy;
......
......@@ -16,8 +16,8 @@
#include "selection.h"
#include "workbook.h"
#include "gnumeric-util.h"
#include "sheet-autofill.h"
#include "cmd-edit.h"
#include "commands.h"
static GnomeCanvasItem *item_cursor_parent_class;
......@@ -939,20 +939,11 @@ item_cursor_autofill_event (GnomeCanvasItem *item, GdkEvent *event)
gnome_canvas_item_ungrab (item, event->button.time);
gdk_flush ();
if (!((item_cursor->pos.end.col == item_cursor->base_col + item_cursor->base_cols) &&
(item_cursor->pos.end.row == item_cursor->base_row + item_cursor->base_rows))){
workbook_finish_editing (sheet->workbook, TRUE);
sheet_autofill (sheet,
item_cursor->base_col, item_cursor->base_row,
item_cursor->base_cols+1, item_cursor->base_rows+1,
item_cursor->pos.end.col, item_cursor->pos.end.row);
}
sheet_selection_reset_only (sheet);
sheet_selection_add_range (sheet,
item_cursor->base_col, item_cursor->base_row,
item_cursor->base_col, item_cursor->base_row,
item_cursor->pos.end.col, item_cursor->pos.end.row);
workbook_finish_editing (sheet->workbook, TRUE);
cmd_autofill (workbook_command_context_gui (sheet->workbook), sheet,
item_cursor->base_col, item_cursor->base_row,
item_cursor->base_cols+1, item_cursor->base_rows+1,
item_cursor->pos.end.col, item_cursor->pos.end.row);
gtk_object_destroy (GTK_OBJECT (item));
......
......@@ -19,6 +19,7 @@
#include <ctype.h>
#include <sys/types.h>
#include <regex.h>
#include <errno.h>
#include "number-match.h"
#include "formats.h"
#include "dates.h"
......@@ -818,11 +819,13 @@ format_match (const char *text, StyleFormat **format)
{
char *end;
long l = strtol (text, &end, 10);
/* ignore spaces at the end . */
while (*end == ' ')
end++;
if (text != end && *end == '\0' && l == (int)l)
return value_new_int ((int)l);
if (errno != ERANGE) {
/* ignore spaces at the end . */
while (*end == ' ')
end++;
if (text != end && *end == '\0' && l == (int)l)
return value_new_int ((int)l);
}
}
/* Is it a double */
......
......@@ -450,25 +450,6 @@ sheet_selection_reset_only (Sheet *sheet)
g_list_free (list);
}
/**
* sheet_selection_reset:
* @sheet: The sheet
*
* Clears all of the selection ranges and resets it to a
* selection that only covers the edit cursor.
*/
void
sheet_selection_reset (Sheet *sheet)
{
g_return_if_fail (sheet != NULL);
g_return_if_fail (IS_SHEET (sheet));
sheet_selection_reset_only (sheet);
sheet_selection_add (sheet,
sheet->cursor.edit_pos.col,
sheet->cursor.edit_pos.row);
}
/*
* assemble_cell_list: A callback for sheet_cell_foreach_range
* intented to assemble a list of cells in a region.
......@@ -497,17 +478,6 @@ assemble_selection_list (Sheet *sheet,
&assemble_cell_list, closure);
}
CellList *
sheet_selection_to_list (Sheet *sheet)
{
/* selection_apply will check all necessary invariants. */
CellList *list = NULL;
selection_apply (sheet, &assemble_selection_list, FALSE, &list);
return list;
}
void
sheet_cell_list_free (CellList *cell_list)
{
......@@ -1050,7 +1020,7 @@ selection_to_string (Sheet *sheet, gboolean include_sheet_name_prefix)
}
/*
* sheet_selection_to_list :
* selection_to_list :
* @sheet : The whose selection we are interested in.
*
* Assembles a unique CellList of all the existing cells in the selection.
......
......@@ -20,10 +20,8 @@ void sheet_selection_add_range (Sheet *sheet,
int base_col, int base_row,
int move_col, int move_row);
void sheet_selection_reset (Sheet *sheet);
void sheet_selection_reset_only (Sheet *sheet);
void sheet_selection_free (Sheet *sheet);
CellList *sheet_selection_to_list (Sheet *sheet);
void sheet_cell_list_free (CellList *cell_list);
char *sheet_selection_to_string (Sheet *sheet, gboolean include_sheet_name_prefix);
......
......@@ -1074,10 +1074,14 @@ cb_recalc_spans_in_col (ColRowInfo *ri, gpointer user)
void
sheet_recompute_spans_for_col (Sheet *sheet, int col)
{
struct recalc_span_closure closure;
closure.sheet = sheet;
closure.col = col;
sheet_foreach_colrow (&sheet->rows,
0, SHEET_MAX_ROWS-1,
&cb_recalc_spans_in_col,
GINT_TO_POINTER(col));
&closure);
}
void
......
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