2376
2376
tmp[2], tmp[3],
2377
2377
pixels + 2, pixels + 3);
2378
2378
in_out->cell_bound.start.col = calc_obj_place (gcanvas, pixels[0], TRUE,
2379
in_out->type[0], in_out->offset + 0);
2379
in_out->offset + 0);
2380
2380
in_out->cell_bound.start.row = calc_obj_place (gcanvas, pixels[1], FALSE,
2381
in_out->type[1], in_out->offset + 1);
2381
in_out->offset + 1);
2382
2382
in_out->cell_bound.end.col = calc_obj_place (gcanvas, pixels[2], TRUE,
2383
in_out->type[2], in_out->offset + 2);
2383
in_out->offset + 2);
2384
2384
in_out->cell_bound.end.row = calc_obj_place (gcanvas, pixels[3], FALSE,
2385
in_out->type[3], in_out->offset + 3);
2385
in_out->offset + 3);
2389
cell_offset_calc_pixel (Sheet const *sheet, int i, gboolean is_col,
2390
SheetObjectAnchorType anchor_type, float offset)
2389
cell_offset_calc_pixel (Sheet const *sheet, int i, gboolean is_col, float offset)
2392
2391
ColRowInfo const *cri = sheet_colrow_get_info (sheet, i, is_col);
2393
/* TODO : handle other anchor types */
2394
2392
return offset * cri->size_pixels;
2417
2415
pixels[3] = pixels[1] + scg_colrow_distance_get (scg, FALSE,
2418
2416
r->start.row, r->end.row);
2419
2417
pixels[0] += cell_offset_calc_pixel (sheet, r->start.col,
2420
TRUE, anchor->type[0], anchor->offset[0]);
2418
TRUE, anchor->offset[0]);
2421
2419
pixels[1] += cell_offset_calc_pixel (sheet, r->start.row,
2422
FALSE, anchor->type[1], anchor->offset[1]);
2420
FALSE, anchor->offset[1]);
2423
2421
pixels[2] += cell_offset_calc_pixel (sheet, r->end.col,
2424
TRUE, anchor->type[2], anchor->offset[2]);
2422
TRUE, anchor->offset[2]);
2425
2423
pixels[3] += cell_offset_calc_pixel (sheet, r->end.row,
2426
FALSE, anchor->type[3], anchor->offset[3]);
2424
FALSE, anchor->offset[3]);
2428
2426
direction = anchor->base.direction;
2429
2427
if (direction == GOD_ANCHOR_DIR_UNKNOWN)
3192
3190
scg_drag_receive_img_data (SheetControlGUI *scg, double x, double y,
3193
3191
guint8 const *data, unsigned len)
3195
3194
SheetObjectAnchor anchor;
3198
sheet_object_anchor_init (&anchor, NULL, NULL, NULL,
3199
GOD_ANCHOR_DIR_DOWN_RIGHT);
3196
sheet_object_anchor_init (&anchor, NULL, NULL,
3197
GOD_ANCHOR_DIR_DOWN_RIGHT);
3200
3198
coords[0] = coords[2] = x;
3201
3199
coords[1] = coords[3] = y;
3202
3200
scg_object_coords_to_anchor (scg, coords, &anchor);
3263
3261
SheetObjectAnchor anchor;
3264
3262
double coords[4];
3266
sheet_object_anchor_init (&anchor, NULL, NULL, NULL,
3267
GOD_ANCHOR_DIR_DOWN_RIGHT);
3264
sheet_object_anchor_init (&anchor, NULL, NULL,
3265
GOD_ANCHOR_DIR_DOWN_RIGHT);
3268
3266
coords[0] = coords[2] = x;
3269
3267
coords[1] = coords[3] = y;
3270
3268
scg_object_coords_to_anchor (scg, coords, &anchor);
3435
3433
double x, double y, GtkSelectionData *selection_data)
3437
3435
gchar *target_type = gdk_atom_name (selection_data->target);
3436
const char *sel_data = (const char *)selection_data->data;
3437
gsize sel_len = selection_data->length;
3439
3439
if (!strcmp (target_type, "text/uri-list")) {
3440
scg_drag_receive_uri_list (scg, x, y,
3441
selection_data->data,
3442
selection_data->length);
3440
scg_drag_receive_uri_list (scg, x, y, sel_data, sel_len);
3444
3442
} else if (!strncmp (target_type, "image/", 6)) {
3445
scg_drag_receive_img_data (scg, x, y,
3446
selection_data->data,
3447
selection_data->length);
3443
scg_drag_receive_img_data (scg, x, y, selection_data->data, sel_len);
3448
3444
} else if (!strcmp (target_type, "GNUMERIC_SAME_PROC")) {
3449
3445
scg_drag_receive_same_process (scg, source_widget, x, y);
3450
3446
} else if (!strcmp (target_type, "application/x-gnumeric")) {
3451
scg_drag_receive_cellregion (scg, x, y,
3452
selection_data->data,
3453
selection_data->length);
3447
scg_drag_receive_cellregion (scg, x, y, sel_data, sel_len);
3454
3448
#ifdef DEBUG_DND
3455
3449
} else if (!strcmp (target_type, "x-special/gnome-copied-files")) {
3456
char *cdata = g_strndup (selection_data->data,
3457
selection_data->length);
3458
printf ("data length: %d, data: %s\n",
3459
selection_data->length, cdata);
3450
char *cdata = g_strndup (sel_data, sel_len);
3451
g_print ("data length: %d, data: %s\n",
3452
(int)sel_len, cdata);
3460
3453
g_free (cdata);
3461
3454
} else if (!strcmp (target_type, "_NETSCAPE_URL")) {
3462
char *cdata = g_strndup (selection_data->data,
3463
selection_data->length);
3464
printf ("data length: %d, data: %s\n",
3465
selection_data->length, cdata);
3455
char *cdata = g_strndup (sel_data, sel_len);
3456
g_print ("data length: %d, data: %s\n",
3457
(int)sel_len, cdata);
3466
3458
g_free (cdata);
3467
3459
} else if (is_text_target (target_type)) {
3468
char *cdata = g_strndup (selection_data->data,
3469
selection_data->length);
3470
printf ("data length: %d, data: %s\n",
3471
selection_data->length, cdata);
3460
char *cdata = g_strndup (sel_data, sel_len);
3461
g_print ("data length: %d, data: %s\n",
3462
(int)sel_len, cdata);
3472
3463
g_free (cdata);
3473
3464
} else if (!strcmp (target_type, "text/html")) {
3474
char *cdata = g_strndup (selection_data->data,
3475
selection_data->length);
3465
char *cdata = g_strndup (sel_data, sel_len);
3476
3466
/* For mozilla, need to convert the encoding */
3477
printf ("data length: %d, data: %s\n",
3478
selection_data->length, cdata);
3467
g_print ("data length: %d, data: %s\n", (int)sel_len, cdata);
3479
3468
g_free (cdata);
3591
3580
if (strcmp (target_name, "GNUMERIC_SAME_PROC") == 0) {
3592
3581
/* Set dummy selection for process internal dnd */
3593
3582
gtk_selection_data_set
3594
(selection_data, selection_data->target, 8, "", 1);
3583
(selection_data, selection_data->target, 8, (const guint8 *)"", 1);
3595
3584
} else if (strcmp (target_name, "application/x-gnumeric") == 0) {
3596
3585
scg_drag_send_clipboard_objects (SHEET_CONTROL (scg),
3597
3586
selection_data, objects);