Example #1
0
static gint
cb_cursor_motion (GnmItemGrid *ig)
{
	Sheet const *sheet = scg_sheet (ig->scg);
	GocCanvas *canvas = ig->canvas_item.canvas;
	GnmPane *pane = GNM_PANE (canvas);
	GdkCursor *cursor;
	GnmCellPos pos;
	GnmHLink *old_link;

	pos.col = gnm_pane_find_col (pane, ig->last_x, NULL);
	pos.row = gnm_pane_find_row (pane, ig->last_y, NULL);

	old_link = ig->cur_link;
	ig->cur_link = sheet_hlink_find (sheet, &pos);
	cursor = (ig->cur_link != NULL) ? ig->cursor_link : ig->cursor_cross;
	if (pane->mouse_cursor != cursor) {
		gnm_pane_mouse_cursor_set (pane, cursor);
		scg_set_display_cursor (ig->scg);
	}

	if (ig->cursor_timer != 0) {
		g_source_remove (ig->cursor_timer);
		ig->cursor_timer = 0;
	}

	if (old_link != ig->cur_link && ig->tip != NULL) {
		gtk_widget_destroy (gtk_widget_get_toplevel (ig->tip));
		ig->tip = NULL;
	}
	return FALSE;
}
Example #2
0
/**
 * wbcg_insert_object:
 * @wbcg: #WBCGtk *
 * @so: The object the needs to be placed
 *
 * Takes a newly created #SheetObject that has not yet been realized and
 * prepares to place it on the sheet.
 *
 * NOTE : Absorbs a reference to the object.
 **/
void
wbcg_insert_object (WBCGtk *wbcg, SheetObject *so)
{
	int i, npages;
	SheetControlGUI *scg;

	g_return_if_fail (GNM_IS_WBC_GTK (wbcg));
	g_return_if_fail (GNM_IS_SO (so));

	wbcg_insert_object_clear (wbcg);

	npages = wbcg_get_n_scg (wbcg);
	for (i = 0; i < npages; i++) {
		if (NULL != (scg = wbcg_get_nth_scg (wbcg, i))) {
			scg_object_unselect (scg, NULL);
			scg_cursor_visible (scg, FALSE);
			scg_set_display_cursor (scg);
			sc_unant (GNM_SC (scg));
		}
	}
	/* we can't set wbcg->new_object before now because if one sheet has a
	 * selected object, the new object will be destroyed by the loop
	 * above. See #669648. */
	wbcg->new_object = so;
	wb_control_update_action_sensitivity (GNM_WBC (wbcg));
}
Example #3
0
static gboolean
item_grid_enter_notify (GocItem *item, G_GNUC_UNUSED double x, G_GNUC_UNUSED double y)
{
	GnmItemGrid  *ig = GNM_ITEM_GRID (item);
	scg_set_display_cursor (ig->scg);
	return TRUE;
}