Commit 109202e0 authored by Miguel de Icaza's avatar Miguel de Icaza Committed by Arturo Espinosa

the last element of a paste was being dropped.

2000-01-02  Miguel de Icaza  <miguel@gnu.org>

	* src/clipboard.c (x_selection_to_cell_region): the last element
	of a paste was being dropped.

2000-01-02  Miguel de Icaza  <miguel@gnu.org>

	* src/workbook-view.c (workbook_view_set_paste_special_state):
	Renamed this function to suit better its new purpose: only manage
	the paste special item, as paste can pull the information from the
	X clipboard.

	* src/parser.y (release_const_tree): New routine used to release
parent eceb72c2
2000-01-02 Miguel de Icaza <miguel@gnu.org>
* src/clipboard.c (x_selection_to_cell_region): the last element
of a paste was being dropped.
2000-01-02 Miguel de Icaza <miguel@gnu.org>
* src/workbook-view.c (workbook_view_set_paste_special_state):
Renamed this function to suit better its new purpose: only manage
the paste special item, as paste can pull the information from the
X clipboard.
* src/parser.y (release_const_tree): New routine used to release
exprtrees that we discard during parsing.
array_expressions: The various NUMBERS used in this rule are
never actually linked into the ExprTree, we are only interested in
them to pull a couple of integers from it. We now release them
after we construct the formula. This fixes the leaks reported by
Morten.
2000-01-02 Jody Goldberg <jgoldberg@home.com>
* src/application.h : Add application_clipboard_unant now that
......
2000-01-02 Miguel de Icaza <miguel@gnu.org>
* src/clipboard.c (x_selection_to_cell_region): the last element
of a paste was being dropped.
2000-01-02 Miguel de Icaza <miguel@gnu.org>
* src/workbook-view.c (workbook_view_set_paste_special_state):
Renamed this function to suit better its new purpose: only manage
the paste special item, as paste can pull the information from the
X clipboard.
* src/parser.y (release_const_tree): New routine used to release
exprtrees that we discard during parsing.
array_expressions: The various NUMBERS used in this rule are
never actually linked into the ExprTree, we are only interested in
them to pull a couple of integers from it. We now release them
after we construct the formula. This fixes the leaks reported by
Morten.
2000-01-02 Jody Goldberg <jgoldberg@home.com>
* src/application.h : Add application_clipboard_unant now that
......
......@@ -50,7 +50,7 @@ application_clipboard_clear (void)
Sheet *sheet = app.clipboard_sheet;
sheet_selection_unant (sheet);
workbook_view_set_paste_state (sheet->workbook, 0);
workbook_view_set_paste_special_state (sheet->workbook, FALSE);
app.clipboard_sheet = NULL;
}
}
......@@ -83,9 +83,7 @@ application_clipboard_copy (Sheet *sheet, Range const *area)
area->start.col, area->start.row,
area->end.col, area->end.row);
workbook_view_set_paste_state (sheet->workbook,
WORKBOOK_VIEW_PASTE_ITEM |
WORKBOOK_VIEW_PASTE_SPECIAL_ITEM);
workbook_view_set_paste_special_state (sheet->workbook, TRUE);
sheet_selection_ant (sheet);
}
......@@ -109,7 +107,7 @@ application_clipboard_cut (Sheet *sheet, Range const *area)
app.clipboard_cut_range = *area;
/* No paste special for copies */
workbook_view_set_paste_state (sheet->workbook, WORKBOOK_VIEW_PASTE_ITEM);
workbook_view_set_paste_special_state (sheet->workbook, TRUE);
sheet_selection_ant (sheet);
}
......
......@@ -258,6 +258,8 @@ x_selection_to_cell_region (char *data, int len)
list = new_node (list, data, p, cur_col, rows);
if (*p == '\n'){
if (p != data)
list = new_node (list, data, p, cur_col, rows);
rows++;
cur_col = 0;
} else {
......@@ -637,7 +639,11 @@ clipboard_paste_region (CommandContext *context,
return;
}
/* Now, trigger a grab of the X selection */
/*
* Now, trigger a grab of the X selection.
*
* This will callback x_selection_received
*/
gtk_selection_convert (
dest_sheet->workbook->toplevel, GDK_SELECTION_PRIMARY,
GDK_TARGET_STRING, time);
......
......@@ -685,13 +685,12 @@ sheet_selection_paste (CommandContext *context, Sheet *sheet,
content = application_clipboard_contents_get ();
/* If contents are null this was a cut */
if (content == NULL) {
if (content == NULL && area != NULL) {
struct expr_relocate_info rinfo;
Sheet * src_sheet = application_clipboard_sheet_get ();
Range const *sel = selection_first_range (sheet, FALSE);
g_return_if_fail (sel != NULL);
g_return_if_fail (area != NULL);
/* FIXME FIXME : This should not be a dialog.
*
......
......@@ -44,7 +44,6 @@ struct _WorkbookPrivate {
/* Menu items that get toggled */
GtkWidget *menu_item_undo;
GtkWidget *menu_item_redo;
GtkWidget *menu_item_paste;
GtkWidget *menu_item_paste_special;
#endif
};
......
......@@ -16,17 +16,13 @@
#include "gnumeric-util.h"
void
workbook_view_set_paste_state (Workbook *wb, int flags)
workbook_view_set_paste_special_state (Workbook *wb, gboolean enable)
{
g_return_if_fail (wb != NULL);
#ifndef ENABLE_BONOBO
gtk_widget_set_sensitive (
wb->priv->menu_item_paste,
flags & WORKBOOK_VIEW_PASTE_ITEM);
gtk_widget_set_sensitive (
wb->priv->menu_item_paste_special,
flags & WORKBOOK_VIEW_PASTE_SPECIAL_ITEM);
wb->priv->menu_item_paste_special, enable);
#else
/* gnome_ui_handler_menu_set_sensitivity (); */
#endif
......
......@@ -3,9 +3,6 @@
#include "gnumeric.h"
#define WORKBOOK_VIEW_PASTE_ITEM (1 << 0)
#define WORKBOOK_VIEW_PASTE_SPECIAL_ITEM (1 << 1)
/*
* Actions on the workbooks UI
*
......@@ -14,7 +11,7 @@
* but it is a starting point of the list.
*
*/
void workbook_view_set_paste_state (Workbook *wb, int flags);
void workbook_view_set_paste_special_state (Workbook *wb, gboolean enable);
void workbook_view_set_undo_redo_state (Workbook const * const wb,
gboolean const has_undos,
......
......@@ -674,9 +674,6 @@ paste_cmd (GtkWidget *widget, Workbook *wb)
{
Sheet *sheet;
/* These menu items should be insensitive when there is nothing to paste */
g_return_if_fail (!application_clipboard_is_empty ());
sheet = workbook_get_current_sheet (wb);
sheet_selection_paste (workbook_command_context_gui (wb), sheet,
sheet->cursor_col, sheet->cursor_row,
......@@ -2173,7 +2170,6 @@ workbook_new (void)
*/
wb->priv->menu_item_undo = workbook_menu_edit[0].widget;
wb->priv->menu_item_redo = workbook_menu_edit[1].widget;
wb->priv->menu_item_paste = workbook_menu_edit[5].widget;
wb->priv->menu_item_paste_special = workbook_menu_edit[6].widget;
#else
{
......@@ -2197,7 +2193,7 @@ workbook_new (void)
* Disable paste & paste special, they will be enabled when
* there is something to paste
*/
workbook_view_set_paste_state (wb, 0);
workbook_view_set_paste_special_state (wb, FALSE);
workbook_create_toolbars (wb);
......
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