~ubuntu-branches/ubuntu/feisty/gnumeric/feisty-updates

« back to all changes in this revision

Viewing changes to src/item-grid.c

  • Committer: Bazaar Package Importer
  • Author(s): Gauvain Pocentek
  • Date: 2006-11-14 14:02:03 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20061114140203-iv3j2aii3vch6isl
Tags: 1.7.2-1ubuntu1
* Merge with debian experimental:
  - debian/control, debian/*-gtk-*, debian/rules,
    debian/shlibs.local: Xubuntu changes for
    gtk/gnome multibuild.
  - run intltool-update in po*
  - Build Depend on intltool

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 *     Miguel de Icaza (miguel@kernel.org)
9
9
 *     Jody Goldberg (jody@gnome.org)
10
10
 *
11
 
 * Port to Maemo:
12
 
 *      Eduardo Lima  (eduardo.lima@indt.org.br)
13
 
 *      Renato Araujo (renato.filho@indt.org.br)
14
11
 */
15
12
 
16
13
#include <gnumeric-config.h>
306
303
 
307
304
        if (cell != NULL) {
308
305
                ColRowInfo const * const ri = cell->row_info;
309
 
                ColRowInfo const * const ci = cell->col_info;
310
306
 
311
307
                if (ri->needs_respan)
312
 
                        row_calc_spans ((ColRowInfo *)ri, sheet);
 
308
                        row_calc_spans ((ColRowInfo *)ri, cell->pos.row, sheet);
313
309
 
314
 
                /* FIXME : get the margins from the far col/row too */
315
310
                if (sheet->text_is_rtl)
316
311
                        cell_draw (cell, ig->gc.cell, drawable,
317
 
                                   r, t,
318
 
                                   l - r - (ci->margin_b + ci->margin_a + 1),
319
 
                                   b - t - (ri->margin_b + ri->margin_a + 1), -1);
 
312
                                r, t, l - r, b - t, -1);
320
313
                else
321
314
                        cell_draw (cell, ig->gc.cell, drawable,
322
 
                                   l, t,
323
 
                                   r - l - (ci->margin_b + ci->margin_a + 1),
324
 
                                   b - t - (ri->margin_b + ri->margin_a + 1), -1);
 
315
                                l, t, r - l, b - t, -1);
325
316
        }
326
317
        style_border_draw_diag (style, drawable, l, t, r, b);
327
318
}
509
500
                 * will ever get flagged.
510
501
                 */
511
502
                if (ri->needs_respan)
512
 
                        row_calc_spans ((ColRowInfo *)ri, sheet);
 
503
                        row_calc_spans ((ColRowInfo *)ri, row, sheet);
513
504
 
514
505
                /* look for merges that start on this row, on the first painted row
515
506
                 * also check for merges that start above. */
635
626
 
636
627
                        /* Is this part of a span?
637
628
                         * 1) There are cells allocated in the row
638
 
                         *       (indicated by ri->pos != -1)
 
629
                         *       (indicated by ri->spans != NULL)
639
630
                         * 2) Look in the rows hash table to see if
640
631
                         *    there is a span descriptor.
641
632
                         */
642
 
                        if (ri->pos == -1 || NULL == (span = row_span_get (ri, col))) {
 
633
                        if (NULL == ri->spans || NULL == (span = row_span_get (ri, col))) {
643
634
 
644
635
                                /* If it is being edited pretend it is empty to
645
636
                                 * avoid problems with the a long cells
649
640
                                GnmCell const *cell = sheet_cell_get (sheet, col, row);
650
641
                                if (!cell_is_empty (cell) && cell != edit_cell)
651
642
                                        cell_draw (cell, ig->gc.cell, drawable,
652
 
                                                   x, y, -1, -1, -1);
 
643
                                                   x, y, ci->size_pixels,
 
644
                                                   ri->size_pixels, -1);
653
645
 
654
646
                        /* Only draw spaning cells after all the backgrounds
655
647
                         * that we are going to draw have been drawn.  No need
656
 
                         * to draw the edit cell, or blanks.
657
 
                         */
 
648
                         * to draw the edit cell, or blanks. */
658
649
                        } else if (edit_cell != span->cell &&
659
650
                                   (col == span->right || col == end_col)) {
660
651
                                GnmCell const *cell = span->cell;
661
652
                                int const start_span_col = span->left;
662
653
                                int const end_span_col = span->right;
663
654
                                int real_x = x;
664
 
                                int center_offset = cell->col_info->size_pixels/2;
665
 
                                /* TODO : Use the spanning margins */
666
 
                                int tmp_width = ci->size_pixels -
667
 
                                        ci->margin_b - ci->margin_a;
 
655
                                ColRowInfo const *cell_col =
 
656
                                        sheet_col_get_info (sheet, cell->pos.col);
 
657
                                int center_offset = cell_col->size_pixels/2;
 
658
                                int tmp_width = ci->size_pixels;
668
659
 
669
660
                                if (col != cell->pos.col)
670
661
                                        style = sheet_style_get (sheet,
672
663
 
673
664
                                /* x, y are relative to this cell origin, but the cell
674
665
                                 * might be using columns to the left (if it is set to right
675
 
                                 * justify or center justify) compute the pixel difference
676
 
                                 */
 
666
                                 * justify or center justify) compute the pixel difference */
677
667
                                if (start_span_col != cell->pos.col)
678
668
                                        center_offset += scg_colrow_distance_get (
679
669
                                                gcanvas->simple.scg, TRUE,
698
688
                                }
699
689
 
700
690
                                cell_draw (cell, ig->gc.cell, drawable,
701
 
                                           real_x, y, tmp_width, -1, center_offset);
 
691
                                           real_x, y, tmp_width,
 
692
                                           ri->size_pixels, center_offset);
702
693
                        } else if (col != span->left)
703
694
                                sr.vertical [col] = NULL;
704
695
 
775
766
 
776
767
        coords[0] = coords[2] = event->x;
777
768
        coords[1] = coords[3] = event->y;
778
 
        sheet_object_anchor_init (&anchor, NULL, NULL, NULL, SO_DIR_DOWN_RIGHT);
 
769
        sheet_object_anchor_init (&anchor, NULL, NULL, NULL, GOD_ANCHOR_DIR_DOWN_RIGHT);
779
770
        scg_object_coords_to_anchor (ig->scg, coords, &anchor);
780
771
        sheet_object_set_anchor (so, &anchor);
781
772
        sheet_object_set_sheet (so, sc_sheet (SHEET_CONTROL (ig->scg)));
897
888
 
898
889
                        if ((ig->last_click_time + double_click_time) > event->time &&
899
890
                            wbcg_edit_start (scg->wbcg, FALSE, FALSE)) {
900
 
#ifdef USE_HILDON
901
 
                                gtk_im_context_focus_in (GNM_CANVAS (canvas)->im_context);
902
 
#endif
903
891
                                break;
904
892
                        }
905
893
                }
952
940
        GnmHLink *link;
953
941
        int x, y;
954
942
        GnmCellPos pos;
955
 
        const char *tiptext;
 
943
        char const *tiptext;
956
944
 
957
945
        /* Be anal and look it up in case something has destroyed the link
958
946
         * since the last motion */