]> git.pld-linux.org Git - packages/nautilus.git/blame - nautilus-width_of_text_selection.patch
- bugfixes (gnome cvs stable gnome-2-14 branch)
[packages/nautilus.git] / nautilus-width_of_text_selection.patch
CommitLineData
b1fc7992 1===================================================================
2RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-canvas-item.c,v
3retrieving revision 1.200
4retrieving revision 1.200.2.1
5diff -u -r1.200 -r1.200.2.1
6--- nautilus-icon-canvas-item.c 2006/04/18 16:54:31 1.200
7+++ libnautilus-private/nautilus-icon-canvas-item.c 2006/04/26 15:00:23 1.200.2.1
8@@ -80,6 +80,7 @@
9 NautilusEmblemAttachPoints *attach_points;
10
11 /* Size of the text at current font. */
12+ int text_dx;
13 int text_width;
14 int text_height;
15
16@@ -715,20 +716,22 @@
17 {
18 ArtIRect text_rectangle;
19 double pixels_per_unit;
20- double text_width, text_height;
21+ double text_width, text_height, text_dx;
22
23 pixels_per_unit = EEL_CANVAS_ITEM (item)->canvas->pixels_per_unit;
24 if (canvas_coords) {
25 text_width = item->details->text_width;
26 text_height = item->details->text_height;
27+ text_dx = item->details->text_dx;
28 } else {
29 text_width = item->details->text_width / pixels_per_unit;
30 text_height = item->details->text_height / pixels_per_unit;
31+ text_dx = item->details->text_dx / pixels_per_unit;
32 }
33
34 if (NAUTILUS_ICON_CONTAINER (EEL_CANVAS_ITEM (item)->canvas)->details->label_position == NAUTILUS_ICON_LABEL_POSITION_BESIDE) {
35 text_rectangle.x0 = icon_rectangle.x1;
36- text_rectangle.x1 = text_rectangle.x0 + text_width;
37+ text_rectangle.x1 = text_rectangle.x0 + text_dx + text_width;
38 text_rectangle.y0 = (icon_rectangle.y0 + icon_rectangle.y1) / 2- (int) text_height / 2;
39 text_rectangle.y1 = text_rectangle.y0 + text_height + LABEL_OFFSET / pixels_per_unit;
40 } else {
41@@ -923,13 +926,17 @@
42 static void
43 layout_get_full_size (PangoLayout *layout,
44 int *width,
45- int *height)
46+ int *height,
47+ int *dx)
48 {
49 PangoRectangle logical_rect;
50+ int total_width;
51
52 pango_layout_get_extents (layout, NULL, &logical_rect);
53- *width = (logical_rect.x + logical_rect.width + PANGO_SCALE / 2) / PANGO_SCALE;
54- *height = (logical_rect.y + logical_rect.height + PANGO_SCALE / 2) / PANGO_SCALE;
55+ *width = (logical_rect.width + PANGO_SCALE / 2) / PANGO_SCALE;
56+ total_width = (logical_rect.x + logical_rect.width + PANGO_SCALE / 2) / PANGO_SCALE;
57+ *dx = total_width - *width;
58+ *height = (logical_rect.height + PANGO_SCALE / 2) / PANGO_SCALE;
59 }
60
61
62@@ -941,8 +948,8 @@
63 {
64 NautilusIconCanvasItemDetails *details;
65 NautilusIconContainer *container;
66- guint editable_height, editable_width;
67- guint additional_height, additional_width;
68+ guint editable_height, editable_width, editable_dx;
69+ guint additional_height, additional_width, additional_dx;
70 EelCanvasItem *canvas_item;
71 PangoLayout *editable_layout;
72 PangoLayout *additional_layout;
73@@ -1000,8 +1007,10 @@
74
75 editable_width = 0;
76 editable_height = 0;
77+ editable_dx = 0;
78 additional_width = 0;
79 additional_height = 0;
80+ additional_dx = 0;
81
82 max_text_width = floor (nautilus_icon_canvas_item_get_max_text_width (item));
83
84@@ -1011,15 +1020,21 @@
85
86 if (have_editable) {
87 editable_layout = get_label_layout (&details->editable_text_layout, item, details->editable_text);
88- layout_get_full_size (editable_layout, &editable_width, &editable_height);
89+ layout_get_full_size (editable_layout, &editable_width, &editable_height, &editable_dx);
90 }
91
92 if (have_additional) {
93 additional_layout = get_label_layout (&details->additional_text_layout, item, details->additional_text);
94- layout_get_full_size (additional_layout, &additional_width, &additional_height);
95+ layout_get_full_size (additional_layout, &additional_width, &additional_height, &additional_dx);
96 }
97
98- details->text_width = MAX (editable_width, additional_width);
99+ if (editable_width > additional_width) {
100+ details->text_width = editable_width;
101+ details->text_dx = editable_dx;
102+ } else {
103+ details->text_width = additional_width;
104+ details->text_dx = additional_dx;
105+ }
106
107 if (have_additional) {
108 details->text_height = editable_height + LABEL_LINE_SPACING + additional_height;
This page took 0.060826 seconds and 4 git commands to generate.