[goffice] Fix widgets position inside an RTL canvas.
- From: Jean BrÃfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Fix widgets position inside an RTL canvas.
- Date: Sun, 21 Aug 2011 12:44:43 +0000 (UTC)
commit 2436bdae23ed856eb211eb3ed8897652bcbc40c6
Author: Jean Brefort <jean brefort normalesup org>
Date: Sun Aug 21 14:49:21 2011 +0200
Fix widgets position inside an RTL canvas.
ChangeLog | 8 ++++++++
NEWS | 1 +
goffice/canvas/goc-widget.c | 10 ++++++++--
goffice/graph/gog-renderer.c | 12 ++++++------
4 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 92de6cc..d154f4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,12 @@
+2011-08-21 Jean Brefort <jean brefort normalesup org>
+
+ * goffice/canvas/goc-widget.c (goc_widget_notify_scrolled): fix widgets
+ position inside an RTL canvas.
+ * goffice/graph/gog-renderer.c (gog_renderer_draw_data_label): enhance
+ scale use.
+
2011-08-20 Jean Brefort <jean brefort normalesup org>
+
* goffice/graph/goffice-graph.h: fix include order.
* goffice/graph/gog-renderer.c (gog_renderer_draw_data_label): new function.
* goffice/graph/gog-renderer.h: ditto.
diff --git a/NEWS b/NEWS
index b03fded..f55866d 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ Jean:
* Chart labels accept rich text. [#417631]
* Axes can use only a part of available space. [#654392]
* Add support for smoothed curve renaming. [#656148].
+ * Fix widgets position inside an RTL canvas.
Morten:
* Recognize scientific formats with longer exponents.
diff --git a/goffice/canvas/goc-widget.c b/goffice/canvas/goc-widget.c
index fdab779..688d0f0 100644
--- a/goffice/canvas/goc-widget.c
+++ b/goffice/canvas/goc-widget.c
@@ -120,9 +120,15 @@ goc_widget_notify_scrolled (GocItem *item)
x1 = item->x1;
y1 = item->y1;
goc_group_adjust_bounds (parent, &x0, &y0, &x1, &y1);
- x0 = (x0 - item->canvas->scroll_x1) * item->canvas->pixels_per_unit;
+ if (item->canvas->direction == GOC_DIRECTION_LTR) {
+ x0 = (x0 - item->canvas->scroll_x1) * item->canvas->pixels_per_unit;
+ x1 = (x1 - item->canvas->scroll_x1) * item->canvas->pixels_per_unit;
+ } else {
+ double tmp = x1;
+ x1 = item->canvas->width - (x0 - item->canvas->scroll_x1) * item->canvas->pixels_per_unit;
+ x0 = item->canvas->width - (tmp - item->canvas->scroll_x1) * item->canvas->pixels_per_unit;
+ }
y0 = (y0 - item->canvas->scroll_y1) * item->canvas->pixels_per_unit;
- x1 = (x1 - item->canvas->scroll_x1) * item->canvas->pixels_per_unit;
y1 = (y1 - item->canvas->scroll_y1) * item->canvas->pixels_per_unit;
gtk_widget_set_size_request (widget->widget, x1 - x0, y1 - y0);
/* ensure we don't wrap throught he infinite */
diff --git a/goffice/graph/gog-renderer.c b/goffice/graph/gog-renderer.c
index 066e30c..90328e6 100644
--- a/goffice/graph/gog-renderer.c
+++ b/goffice/graph/gog-renderer.c
@@ -1178,18 +1178,16 @@ gog_renderer_draw_data_label (GogRenderer *rend, GogSeriesLabelElt const *elt,
obr.y - (obr.w / 2.0) * sin (obr.alpha) -
(obr.h / 2.0) * cos (obr.alpha));
cairo_rotate (cairo, obr.alpha);
- cairo_scale (cairo, rend->scale, rend->scale);
- pango_cairo_show_layout (cairo, layout);
/* now draw the legen entry if needed */
if (elt->legend_pos >= 0 && legend_style != NULL) {
GOStyle *style = go_style_dup (legend_style);
GogViewAllocation rectangle;
double x, y,w, h;
pango_layout_index_to_pos (layout, elt->legend_pos, &rect);
- x = (double) rect.x / PANGO_SCALE;
- y = (double) rect.y / PANGO_SCALE;
- w = (double) rect.width / PANGO_SCALE;
- h = (double) rect.height / PANGO_SCALE;
+ x = (double) rect.x / PANGO_SCALE * rend->scale;
+ y = (double) rect.y / PANGO_SCALE * rend->scale;
+ w = (double) rect.width / PANGO_SCALE * rend->scale;
+ h = (double) rect.height / PANGO_SCALE * rend->scale;
if (style->interesting_fields & GO_STYLE_LINE) { /* line and marker */
GOPath *line_path;
if (style->line.width > h / 3.)
@@ -1231,6 +1229,8 @@ gog_renderer_draw_data_label (GogRenderer *rend, GogSeriesLabelElt const *elt,
gog_renderer_pop_style (rend);
g_object_unref (style);
}
+ cairo_scale (cairo, rend->scale, rend->scale);
+ pango_cairo_show_layout (cairo, layout);
cairo_restore (cairo);
g_object_unref (layout);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]