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

- Remove have_selection cruft. Use application instead.

- Fix cut & paste to consistantly mark & clear X selection.
- Add depend on gtk >= 1.2.2 in configure.in

2000-01-13  Jody Goldberg <jgoldberg@home.com>

	* src/application.c (application_clipboard_copy,
	  application_clipboard_cut) : Use application_set_selected_sheet.
	(application_set_selected_sheet) : New routine that manages exporting
	  selection to X too.

	* src/clipboard.c (x_selection_clear) : Something else now has the
	  selection.  Clear ours.
	(clipboard_export_cell_region) : Delete.
	(find_local_workbook_with_selection) : Delete.
	(workbook_selection_locator) : Delete.

	* ./src/item-grid.c (item_grid_popup_menu) : Always enable paste,
	  only enable paste special when we have a local cut.  This matches
	  the behavior of the menus and toolbar.

	* configure.in : Add a depend on libgtk+ >= 1.2.2 because 1.2.1
	  did not have gtk_object_get.
parent 62e9b148
2000-01-12 Jody Goldberg <jgoldberg@home.com>
2000-01-13 Jody Goldberg <jgoldberg@home.com>
* src/application.c (application_clipboard_copy,
application_clipboard_cut) : Use application_set_selected_sheet.
(application_set_selected_sheet) : New routine that manages exporting
selection to X too.
* src/clipboard.c (x_selection_clear) : Something else now has the
selection. Clear ours.
(clipboard_export_cell_region) : Delete.
(find_local_workbook_with_selection) : Delete.
(workbook_selection_locator) : Delete.
* ./src/item-grid.c (item_grid_popup_menu) : Always enable paste,
only enable paste special when we have a local cut. This matches
the behavior of the menus and toolbar.
* gnumeric.spec.in : Add a depend on libgtk+ >= 1.2.2 because 1.2.1
did not have gtk_object_get.
* configure.in : Ditto.
2000-01-12 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/workbook.c (workbook_menu_tools): UIINFO separators added to
......
2000-01-12 Jody Goldberg <jgoldberg@home.com>
2000-01-13 Jody Goldberg <jgoldberg@home.com>
* src/application.c (application_clipboard_copy,
application_clipboard_cut) : Use application_set_selected_sheet.
(application_set_selected_sheet) : New routine that manages exporting
selection to X too.
* src/clipboard.c (x_selection_clear) : Something else now has the
selection. Clear ours.
(clipboard_export_cell_region) : Delete.
(find_local_workbook_with_selection) : Delete.
(workbook_selection_locator) : Delete.
* ./src/item-grid.c (item_grid_popup_menu) : Always enable paste,
only enable paste special when we have a local cut. This matches
the behavior of the menus and toolbar.
* gnumeric.spec.in : Add a depend on libgtk+ >= 1.2.2 because 1.2.1
did not have gtk_object_get.
* configure.in : Ditto.
2000-01-12 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/workbook.c (workbook_menu_tools): UIINFO separators added to
......
......@@ -248,6 +248,21 @@ else
AC_MSG_ERROR(Did not find libGlade installed)
fi
dnl ******************************
dnl gtk+ checking
dnl ******************************
AC_MSG_CHECKING(for GTK >= 1.2.2)
if gtk-config --version > /dev/null 2>&1; then
vers=`gtk-config --version`
case x$vers
in
x1.2.[[234567]]) AC_MSG_RESULT(found) ;;
*) AC_MSG_ERROR(You need at least gtk+ 1.2.2 for this version of Gnumeric) ;;
esac
else
AC_MSG_ERROR(Did not find gtk+ installed)
fi
EXTRA_GNOME_LIBS=`gnome-config --libs gnomeui print libglade $bonobo $gb`
EXTRA_GNOME_CFLAGS=`gnome-config --cflags gnomeui print libglade $bonobo $gb`
AC_SUBST(EXTRA_GNOME_LIBS)
......
......@@ -435,7 +435,7 @@ x_selection_handler (GtkWidget *widget, GtkSelectionData *selection_data, guint
static gint
x_selection_clear (GtkWidget *widget, GdkEventSelection *event, Workbook *wb)
{
wb->have_x_selection = FALSE;
application_clipboard_clear ();
return TRUE;
}
......@@ -449,7 +449,6 @@ x_selection_clear (GtkWidget *widget, GdkEventSelection *event, Workbook *wb)
void
x_clipboard_bind_workbook (Workbook *wb)
{
wb->have_x_selection = FALSE;
wb->clipboard_paste_callback_data = NULL;
gtk_signal_connect (
......@@ -469,21 +468,6 @@ x_clipboard_bind_workbook (Workbook *wb)
GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 0);
}
/**
* clipboard_export_cell_region:
*
* This routine exports a CellRegion to the X selection
*/
static void
clipboard_export_cell_region (Workbook *wb)
{
wb->have_x_selection = gtk_selection_owner_set (
wb->toplevel,
GDK_SELECTION_PRIMARY,
GDK_CURRENT_TIME);
}
typedef struct {
int base_col, base_row;
CellRegion *r;
......@@ -540,32 +524,9 @@ clipboard_copy_cell_range (Sheet *sheet,
/* reverse the list so that upper left corner is first */
c.r->list = g_list_reverse (c.r->list);
clipboard_export_cell_region (sheet->workbook);
return c.r;
}
static gboolean
workbook_selection_locator (Workbook *wb, gpointer data)
{
Workbook **target = data;
if (wb->have_x_selection)
*target = wb;
return TRUE;
}
static Workbook *
find_local_workbook_with_selection (void)
{
Workbook *result = NULL;
workbook_foreach (workbook_selection_locator, &result);
return result;
}
/**
* clipboard_paste_region:
* @region: A cell region
......@@ -584,7 +545,7 @@ clipboard_paste_region (CommandContext *context,
int paste_flags, guint32 time)
{
clipboard_paste_closure_t *data;
Workbook *workbook_holding_selection;
Sheet *sheet_holding_selection;
g_return_if_fail (dest_sheet != NULL);
g_return_if_fail (IS_SHEET (dest_sheet));
......@@ -618,8 +579,8 @@ clipboard_paste_region (CommandContext *context,
* we get from X
*/
workbook_holding_selection = find_local_workbook_with_selection ();
if (workbook_holding_selection && region) {
sheet_holding_selection = application_clipboard_sheet_get ();
if (sheet_holding_selection && region) {
CellRegion *content;
content = region;
......@@ -628,8 +589,8 @@ clipboard_paste_region (CommandContext *context,
content, dest_sheet->selections->data, data);
/* Check that this has not already been freed */
if (workbook_holding_selection->clipboard_paste_callback_data != NULL) {
workbook_holding_selection->clipboard_paste_callback_data = NULL;
if (sheet_holding_selection->workbook->clipboard_paste_callback_data != NULL) {
sheet_holding_selection->workbook->clipboard_paste_callback_data = NULL;
g_free (data);
}
return;
......
......@@ -625,7 +625,6 @@ context_row_height (GtkWidget *widget, Sheet *sheet)
typedef enum {
IG_ALWAYS,
IG_SEPARATOR,
IG_PASTE,
IG_PASTE_SPECIAL,
IG_ROW = 0x8,
IG_COLUMN = 0x10,
......@@ -643,7 +642,7 @@ static struct {
{ N_("_Copy"), GNOME_STOCK_PIXMAP_COPY,
&context_copy_cmd, IG_ALWAYS },
{ N_("_Paste"), GNOME_STOCK_PIXMAP_PASTE,
&context_paste_cmd, IG_PASTE },
&context_paste_cmd, IG_ALWAYS },
{ N_("Paste _Special"), NULL,
&context_paste_special_cmd, IG_PASTE_SPECIAL },
......@@ -681,7 +680,6 @@ static struct {
static GtkWidget *
create_popup_menu (Sheet *sheet,
gboolean const include_paste,
gboolean const include_paste_special,
gboolean const is_col,
gboolean const is_row)
......@@ -707,7 +705,7 @@ create_popup_menu (Sheet *sheet,
break;
/* Desesitize later */
case IG_PASTE : case IG_PASTE_SPECIAL :
case IG_PASTE_SPECIAL :
case IG_ROW : case IG_COLUMN :
case IG_ALWAYS:
{
......@@ -740,8 +738,7 @@ create_popup_menu (Sheet *sheet,
g_warning ("Never reached");
}
if ((type == IG_PASTE && !include_paste) ||
(type == IG_PASTE_SPECIAL && !include_paste_special) ||
if ((type == IG_PASTE_SPECIAL && !include_paste_special) ||
item_grid_context_menu [i].fn == NULL)
gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE);
......@@ -775,13 +772,16 @@ item_grid_popup_menu (Sheet *sheet, GdkEvent *event, int col, int row,
{
GtkWidget *menu;
/* We can paste if there is something in the clipboard */
gboolean const show_paste = !application_clipboard_is_empty ();
/* Paste special only applies to copied cells not cut */
gboolean const show_paste_special = show_paste &&
/*
* Paste special does not apply to cut cells. Enable
* when there is nothing in the local clipboard, or when
* the clipboard has the results of a copy.
*/
gboolean const show_paste_special =
application_clipboard_is_empty () ||
(application_clipboard_contents_get () != NULL);
menu = create_popup_menu (sheet, show_paste, show_paste_special,
menu = create_popup_menu (sheet, show_paste_special,
is_col, is_row);
gnumeric_popup_menu (GTK_MENU (menu), (GdkEventButton *) event);
......
......@@ -111,7 +111,6 @@ struct _Workbook {
* to the asyncronous paste callback
*/
void *clipboard_paste_callback_data;
gboolean have_x_selection;
void *corba_server;
......
......@@ -111,7 +111,6 @@ struct _Workbook {
* to the asyncronous paste callback
*/
void *clipboard_paste_callback_data;
gboolean have_x_selection;
void *corba_server;
......
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