[goffice] Allow multi-lines labels in charts.
- From: Jean BrÃfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Allow multi-lines labels in charts.
- Date: Wed, 21 Dec 2011 17:07:21 +0000 (UTC)
commit a3f18804539fca2473abd2bce1f204965ac656e9
Author: Jean Brefort <jean brefort normalesup org>
Date: Wed Dec 21 18:06:35 2011 +0100
Allow multi-lines labels in charts.
ChangeLog | 19 +++++++
goffice/graph/gog-axis-line.c | 26 +++++-----
goffice/graph/gog-label.c | 91 +++++++++++++++++++++++++++++++---
goffice/graph/gog-legend.c | 10 ++--
goffice/graph/gog-renderer.c | 43 ++++++++++++----
goffice/graph/gog-renderer.h | 16 ++++--
goffice/utils/go-geometry.c | 2 +-
plugins/plot_distrib/gog-histogram.c | 21 +++++---
8 files changed, 180 insertions(+), 48 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index cf0a7b1..6cf75a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2011-12-21 Jean Brefort <jean brefort normalesup org>
+
+ * goffice/graph/gog-axis-line.c (axis_line_get_bbox),
+ (axis_line_render), (axis_circle_get_bbox), (axis_circle_render),
+ (xyz_process): allow for multi-line labels.
+ * goffice/graph/gog-label.c (gog_label_set_property),
+ (gog_label_get_property), (gog_label_class_init), (gog_label_init),
+ (gog_text_view_size_request), (gog_text_view_render): ditto.
+ * goffice/graph/gog-legend.c (cb_size_elements),
+ (cb_render_elements): ditto.
+ * goffice/graph/gog-renderer.c (gog_renderer_draw_gostring),
+ (gog_renderer_draw_text), (gog_renderer_get_gostring_OBR),
+ (gog_renderer_get_text_OBR), (gog_renderer_get_text_AABR),
+ (gog_renderer_get_gostring_AABR): add new arguments.
+ * goffice/graph/gog-renderer.h: ditto.
+ * goffice/utils/go-geometry.c: documentation typo.
+ * plugins/plot_distrib/gog-histogram.c
+ (gog_histogram_plot_view_render): fixed after API change.
+
2011-12-17 Jean Brefort <jean brefort normalesup org>
* plugins/plot_surface/gog-contour.c
diff --git a/goffice/graph/gog-axis-line.c b/goffice/graph/gog-axis-line.c
index 2cdf03e..f5853cb 100644
--- a/goffice/graph/gog-axis-line.c
+++ b/goffice/graph/gog-axis-line.c
@@ -1010,7 +1010,7 @@ axis_line_get_bbox (GogAxisBase *axis_base, GogRenderer *renderer,
major_tick_len = gog_renderer_pt2r (renderer, axis_base->major.size_pts);
tick_len = axis_base->major.tick_out ? major_tick_len :
(axis_base->minor.tick_out ? minor_tick_len : 0.);
- gog_renderer_get_text_OBR (renderer, "0", TRUE, &txt_obr);
+ gog_renderer_get_text_OBR (renderer, "0", TRUE, &txt_obr, -1.);
label_padding = txt_obr.w;
total_bbox.x = x; total_bbox.y = y;
@@ -1056,7 +1056,7 @@ axis_line_get_bbox (GogAxisBase *axis_base, GogRenderer *renderer,
for (i = 0; i < tick_nbr; i++) {
if (ticks[i].str != NULL) {
GOGeometryOBR *obr = obrs + i;
- gog_renderer_get_gostring_OBR (renderer, ticks[i].str, obr);
+ gog_renderer_get_gostring_OBR (renderer, ticks[i].str, obr, -1.);
if (obr->w > label_size_max
|| obr->h > label_size_max) {
label_size_max = MAX (obr->w, obr->h);
@@ -1158,7 +1158,7 @@ axis_line_render (GogAxisBase *axis_base,
tick_len = axis_base->major.tick_out ? major_tick_len :
(axis_base->minor.tick_out ? minor_tick_len : 0.);
- gog_renderer_get_text_OBR (renderer, "0", TRUE, &zero_obr);
+ gog_renderer_get_text_OBR (renderer, "0", TRUE, &zero_obr, -1.);
label_padding = zero_obr.w;
tick_nbr = gog_axis_get_ticks (axis_base->axis, &ticks);
@@ -1168,7 +1168,7 @@ axis_line_render (GogAxisBase *axis_base,
for (i = 0; i < tick_nbr; i++) {
if (ticks[i].str != NULL) {
GOGeometryOBR *obr = obrs + i;
- gog_renderer_get_gostring_OBR (renderer, ticks[i].str, obr);
+ gog_renderer_get_gostring_OBR (renderer, ticks[i].str, obr, -1.);
if (obr->w > label_size_max
|| obr->h > label_size_max) {
label_size_max = MAX (obr->w, obr->h);
@@ -1268,7 +1268,8 @@ axis_line_render (GogAxisBase *axis_base,
label_pos.x = obrs[j].x;
label_pos.y = obrs[j].y;
gog_renderer_draw_gostring (renderer, ticks[j].str,
- &label_pos, GO_ANCHOR_CENTER);
+ &label_pos, GO_ANCHOR_CENTER,
+ GTK_JUSTIFY_CENTER, -1.);
}
}
g_free (obrs);
@@ -1323,7 +1324,7 @@ axis_circle_get_bbox (GogAxisBase *axis_base, GogRenderer *renderer,
major_tick_len = gog_renderer_pt2r (renderer, axis_base->major.size_pts);
tick_len = axis_base->major.tick_out ? major_tick_len :
(axis_base->minor.tick_out ? minor_tick_len : 0.);
- gog_renderer_get_text_OBR (renderer, "0", TRUE, &txt_obr);
+ gog_renderer_get_text_OBR (renderer, "0", TRUE, &txt_obr, -1.);
label_padding = txt_obr.w;
draw_ticks = go_style_is_line_visible (axis_base->base.style) &&
@@ -1338,7 +1339,7 @@ axis_circle_get_bbox (GogAxisBase *axis_base, GogRenderer *renderer,
gog_chart_map_2D_to_view (c_map, ticks[i].position, position, &x, &y);
if (ticks[i].str != NULL && draw_labels) {
- gog_renderer_get_gostring_OBR (renderer, ticks[i].str, &txt_obr);
+ gog_renderer_get_gostring_OBR (renderer, ticks[i].str, &txt_obr, -1.);
txt_obr.w += label_padding;
go_geometry_calc_label_position (&txt_obr, angle + M_PI / 2.0, tick_len,
GO_SIDE_LEFT, GO_SIDE_AUTO);
@@ -1406,7 +1407,7 @@ axis_circle_render (GogAxisBase *axis_base, GogRenderer *renderer,
major_tick_len = gog_renderer_pt2r (renderer, axis_base->major.size_pts);
tick_len = axis_base->major.tick_out ? major_tick_len :
(axis_base->minor.tick_out ? minor_tick_len : 0.);
- gog_renderer_get_text_OBR (renderer, "0", TRUE, &txt_obr);
+ gog_renderer_get_text_OBR (renderer, "0", TRUE, &txt_obr, -1.);
label_padding = txt_obr.w;
tick_nbr = gog_axis_get_ticks (axis_base->axis, &ticks);
@@ -1462,7 +1463,7 @@ axis_circle_render (GogAxisBase *axis_base, GogRenderer *renderer,
if (ticks[i].str != NULL && draw_labels) {
gog_chart_map_2D_to_view (c_map, ticks[i].position, position,
&label_pos.x, &label_pos.y);
- gog_renderer_get_gostring_OBR (renderer, ticks[i].str, &txt_obr);
+ gog_renderer_get_gostring_OBR (renderer, ticks[i].str, &txt_obr, -1.);
txt_obr.w += label_padding;
go_geometry_calc_label_position (&txt_obr, angle + M_PI / 2.0, tick_len,
GO_SIDE_LEFT, GO_SIDE_AUTO);
@@ -1475,7 +1476,8 @@ axis_circle_render (GogAxisBase *axis_base, GogRenderer *renderer,
!go_geometry_test_OBR_overlap (&txt_obr, &txt_obr_first))) {
gog_renderer_draw_gostring
(renderer, ticks[i].str,
- &label_pos, GO_ANCHOR_CENTER);
+ &label_pos, GO_ANCHOR_CENTER,
+ GTK_JUSTIFY_CENTER, -1.);
txt_obr_old = txt_obr;
}
if (!first_label_done) {
@@ -2056,7 +2058,7 @@ xyz_process (GogAxisBaseAction action, GogView *view, GogViewPadding *padding,
tick_nbr = gog_axis_get_ticks (axis_base->axis, &ticks);
gog_renderer_get_text_OBR (view->renderer,
- "0", TRUE, &obr);
+ "0", TRUE, &obr, -1.);
tick_len += fabs (obr.w * ox);
if (axis_base->major_tick_labeled) {
label_w = label_h = 0;
@@ -2066,7 +2068,7 @@ xyz_process (GogAxisBaseAction action, GogView *view, GogViewPadding *padding,
gog_renderer_get_text_OBR
(view->renderer,
ticks[i].str->str,
- FALSE, &obr);
+ FALSE, &obr, -1.);
if (obr.w > label_w)
label_w = obr.w;
if (obr.h > label_h)
diff --git a/goffice/graph/gog-label.c b/goffice/graph/gog-label.c
index 504ab41..5a90565 100644
--- a/goffice/graph/gog-label.c
+++ b/goffice/graph/gog-label.c
@@ -41,7 +41,7 @@ enum {
TEXT_PROP_ALLOW_MARKUP,
TEXT_PROP_ROTATE_FRAME,
TEXT_PROP_ROTATE_BG,
- TEXT_PROP_ALLOW_WRAP
+ TEXT_PROP_ALLOW_WRAP,
};
static GObjectClass *text_parent_klass;
@@ -215,9 +215,11 @@ struct _GogLabel {
GogText base;
GogDatasetElement text;
+ GtkJustification justification;
};
enum {
LABEL_PROP_0,
+ LABEL_PROP_JUSTIFICATION
};
@@ -336,6 +338,61 @@ gog_label_get_markup (GogText *text)
}
static void
+gog_label_set_property (GObject *obj, guint param_id,
+ GValue const *value, GParamSpec *pspec)
+{
+ GogLabel *label = GOG_LABEL (obj);
+
+ switch (param_id) {
+ case LABEL_PROP_JUSTIFICATION: {
+ char const *str = g_value_get_string (value);
+ if (!strcmp (str, "left"))
+ label->justification = GTK_JUSTIFY_LEFT;
+ else if (!strcmp (str, "right"))
+ label->justification = GTK_JUSTIFY_RIGHT;
+ else if (!strcmp (str, "fill"))
+ label->justification = GTK_JUSTIFY_FILL;
+ else
+ label->justification = GTK_JUSTIFY_CENTER;
+ break;
+ }
+
+ default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
+ return; /* NOTE : RETURN */
+ }
+ gog_object_emit_changed (GOG_OBJECT (obj), FALSE);
+}
+
+static void
+gog_label_get_property (GObject *obj, guint param_id,
+ GValue *value, GParamSpec *pspec)
+{
+ GogLabel *label = GOG_LABEL (obj);
+
+ switch (param_id) {
+ case LABEL_PROP_JUSTIFICATION:
+ switch (label->justification) {
+ case GTK_JUSTIFY_CENTER:
+ g_value_set_string (value, "center");
+ break;
+ case GTK_JUSTIFY_LEFT:
+ g_value_set_string (value, "left");
+ break;
+ case GTK_JUSTIFY_RIGHT:
+ g_value_set_string (value, "right");
+ break;
+ case GTK_JUSTIFY_FILL:
+ g_value_set_string (value, "fill");
+ break;
+ }
+ break;
+
+ default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
+ break;
+ }
+}
+
+static void
gog_label_finalize (GObject *obj)
{
gog_dataset_finalize (GOG_DATASET (obj));
@@ -353,12 +410,26 @@ gog_label_class_init (GogLabelClass *klass)
#endif
label_parent_klass = g_type_class_peek_parent (klass);
gobject_klass->finalize = gog_label_finalize;
+ gobject_klass->set_property = gog_label_set_property;
+ gobject_klass->get_property = gog_label_get_property;
+ g_object_class_install_property (gobject_klass, LABEL_PROP_JUSTIFICATION,
+ g_param_spec_string ("justification",
+ _("Text justification"),
+ _("Text justification as a string. Possible values are \"center\" (default value), \"left\", \"right\", or \"fill\"."),
+ "center",
+ GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
got_klass->get_str = gog_label_get_str;
got_klass->get_markup = gog_label_get_markup;
}
static void
+gog_label_init (GogLabel *label)
+{
+ label->justification = GTK_JUSTIFY_CENTER;
+}
+
+static void
gog_label_dims (GogDataset const *set, int *first, int *last)
{
*first = *last = 0;
@@ -387,7 +458,7 @@ gog_label_dataset_init (GogDatasetClass *iface)
GSF_CLASS_FULL (GogLabel, gog_label,
NULL, NULL, gog_label_class_init, NULL,
- NULL, GOG_TYPE_TEXT, 0,
+ gog_label_init, GOG_TYPE_TEXT, 0,
GSF_INTERFACE (gog_label_dataset_init, GOG_TYPE_DATASET))
/************************************************************************/
@@ -587,10 +658,10 @@ gog_text_view_size_request (GogView *v,
style->text_layout.angle = 0.;
gog_renderer_push_style (v->renderer, style);
if (gostr) {
- gog_renderer_get_gostring_AABR (v->renderer, gostr, &aabr);
+ gog_renderer_get_gostring_AABR (v->renderer, gostr, &aabr, available->w);
go_string_unref (gostr);
} else
- gog_renderer_get_text_AABR (v->renderer, str, text->allow_markup, &aabr);
+ gog_renderer_get_text_AABR (v->renderer, str, text->allow_markup, &aabr, available->w);
gog_renderer_pop_style (v->renderer);
g_object_unref (style);
if (text->rotate_frame) {
@@ -636,9 +707,9 @@ gog_text_view_render (GogView *view, GogViewAllocation const *bbox)
gog_renderer_push_style (view->renderer, rect_style);
}
if (gostr)
- gog_renderer_get_gostring_AABR (view->renderer, gostr, &aabr);
+ gog_renderer_get_gostring_AABR (view->renderer, gostr, &aabr, view->allocation.w);
else
- gog_renderer_get_text_AABR (view->renderer, str, text->allow_markup, &aabr);
+ gog_renderer_get_text_AABR (view->renderer, str, text->allow_markup, &aabr, view->allocation.w);
if (text->rotate_frame) {
rect = view->allocation;
rect.w = aabr.w + 2. * outline + pad_x;
@@ -658,12 +729,16 @@ gog_text_view_render (GogView *view, GogViewAllocation const *bbox)
}
if (gostr) {
gog_renderer_draw_gostring (view->renderer, gostr,
- &view->residual, GO_ANCHOR_NW);
+ &view->residual, GO_ANCHOR_NW,
+ (GOG_IS_LABEL (text)? GOG_LABEL (text)->justification: GTK_JUSTIFY_LEFT),
+ view->allocation.w);
go_string_unref (gostr);
} else
gog_renderer_draw_text (view->renderer, str,
&view->residual, GO_ANCHOR_NW,
- text->allow_markup);
+ text->allow_markup,
+ (GOG_IS_LABEL (text)? GOG_LABEL (text)->justification: GTK_JUSTIFY_LEFT),
+ view->allocation.w);
g_free (str);
}
gog_renderer_pop_style (view->renderer);
diff --git a/goffice/graph/gog-legend.c b/goffice/graph/gog-legend.c
index 504a827..190dfa9 100644
--- a/goffice/graph/gog-legend.c
+++ b/goffice/graph/gog-legend.c
@@ -279,10 +279,10 @@ cb_size_elements (unsigned i, GOStyle const *style,
if (l) {
GOString *str = go_string_new_rich (name, -1, l, NULL);
- gog_renderer_get_gostring_AABR (view->renderer, str, &aabr);
+ gog_renderer_get_gostring_AABR (view->renderer, str, &aabr, -1.);
go_string_unref (str);
} else
- gog_renderer_get_text_AABR (view->renderer, name, FALSE, &aabr);
+ gog_renderer_get_text_AABR (view->renderer, name, FALSE, &aabr, -1.);
if (glv->element_width < aabr.w)
glv->element_width = aabr.w;
@@ -520,10 +520,12 @@ cb_render_elements (unsigned index, GOStyle const *base_style, char const *name,
pos.w = pos.h = -1;
if (l) {
GOString *str = go_string_new_rich (name, -1, l, NULL);
- gog_renderer_draw_gostring (view->renderer, str, &pos, GO_ANCHOR_W);
+ gog_renderer_draw_gostring (view->renderer, str, &pos,
+ GO_ANCHOR_W, GTK_JUSTIFY_LEFT, -1.);
go_string_unref (str);
} else
- gog_renderer_draw_text (renderer, name, &pos, GO_ANCHOR_W, FALSE);
+ gog_renderer_draw_text (renderer, name, &pos,
+ GO_ANCHOR_W, FALSE, GTK_JUSTIFY_LEFT, -1.);
if (style != base_style && style != NULL)
g_object_unref (style);
diff --git a/goffice/graph/gog-renderer.c b/goffice/graph/gog-renderer.c
index eb5d9ec..421d934 100644
--- a/goffice/graph/gog-renderer.c
+++ b/goffice/graph/gog-renderer.c
@@ -847,7 +847,8 @@ gog_renderer_draw_marker (GogRenderer *rend, double x, double y)
void
gog_renderer_draw_gostring (GogRenderer *rend, GOString *str,
- GogViewAllocation const *pos, GOAnchorType anchor)
+ GogViewAllocation const *pos, GOAnchorType anchor,
+ GtkJustification justification, double width)
{
PangoLayout *layout;
PangoContext *context;
@@ -869,6 +870,22 @@ gog_renderer_draw_gostring (GogRenderer *rend, GOString *str,
layout = pango_cairo_create_layout (cairo);
context = pango_layout_get_context (layout);
pango_layout_set_text (layout, str->str, -1);
+ if (width > 0)
+ pango_layout_set_width (layout, width * PANGO_SCALE / rend->scale);
+ switch (justification) {
+ case GTK_JUSTIFY_CENTER:
+ pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
+ break;
+ case GTK_JUSTIFY_LEFT:
+ pango_layout_set_alignment (layout, PANGO_ALIGN_LEFT);
+ break;
+ case GTK_JUSTIFY_RIGHT:
+ pango_layout_set_alignment (layout, PANGO_ALIGN_RIGHT);
+ break;
+ case GTK_JUSTIFY_FILL:
+ pango_layout_set_justify (layout, TRUE);
+ break;
+ }
attr = go_string_get_markup (str);
if (attr)
pango_layout_set_attributes (layout, attr);
@@ -934,7 +951,8 @@ gog_renderer_draw_gostring (GogRenderer *rend, GOString *str,
void
gog_renderer_draw_text (GogRenderer *rend, char const *text,
GogViewAllocation const *pos, GOAnchorType anchor,
- gboolean use_markup)
+ gboolean use_markup, GtkJustification justification,
+ double width)
{
GOString *str;
PangoAttrList *attr_list = NULL;
@@ -952,7 +970,7 @@ gog_renderer_draw_text (GogRenderer *rend, char const *text,
str = go_string_new_rich_nocopy (m_text, -1, attr_list, NULL);
else
str = go_string_new (text);
- gog_renderer_draw_gostring (rend, str, pos, anchor);
+ gog_renderer_draw_gostring (rend, str, pos, anchor, justification, width);
go_string_unref (str);
}
@@ -963,7 +981,8 @@ gog_renderer_draw_text (GogRenderer *rend, char const *text,
* @obr: #GOGeometryOBR to store the Object Bounding Rectangle of @text.
**/
void
-gog_renderer_get_gostring_OBR (GogRenderer *rend, GOString *str, GOGeometryOBR *obr)
+gog_renderer_get_gostring_OBR (GogRenderer *rend, GOString *str,
+ GOGeometryOBR *obr, double max_width)
{
GOStyle const *style;
PangoLayout *layout;
@@ -989,6 +1008,8 @@ gog_renderer_get_gostring_OBR (GogRenderer *rend, GOString *str, GOGeometryOBR *
layout = pango_cairo_create_layout (cairo);
context = pango_layout_get_context (layout);
pango_layout_set_text (layout, str->str, -1);
+ if (max_width > 0)
+ pango_layout_set_width (layout, max_width * PANGO_SCALE / rend->scale);
attr = go_string_get_markup (str);
if (attr)
pango_layout_set_attributes (layout, attr);
@@ -1021,7 +1042,8 @@ gog_renderer_get_gostring_OBR (GogRenderer *rend, GOString *str, GOGeometryOBR *
**/
void
gog_renderer_get_text_OBR (GogRenderer *rend, char const *text,
- gboolean use_markup, GOGeometryOBR *obr)
+ gboolean use_markup, GOGeometryOBR *obr,
+ double max_width)
{
GOString *str;
PangoAttrList *attr_list = NULL;
@@ -1036,7 +1058,7 @@ gog_renderer_get_text_OBR (GogRenderer *rend, char const *text,
str = go_string_new_rich_nocopy (m_text, -1, attr_list, NULL);
else
str = go_string_new (text);
- gog_renderer_get_gostring_OBR (rend, str, obr);
+ gog_renderer_get_gostring_OBR (rend, str, obr, max_width);
go_string_unref (str);
}
@@ -1050,11 +1072,12 @@ gog_renderer_get_text_OBR (GogRenderer *rend, char const *text,
**/
void
gog_renderer_get_text_AABR (GogRenderer *rend, char const *text,
- gboolean use_markup, GOGeometryAABR *aabr)
+ gboolean use_markup, GOGeometryAABR *aabr,
+ double max_width)
{
GOGeometryOBR obr;
- gog_renderer_get_text_OBR (rend, text, use_markup, &obr);
+ gog_renderer_get_text_OBR (rend, text, use_markup, &obr, max_width);
go_geometry_OBR_to_AABR (&obr, aabr);
}
@@ -1066,11 +1089,11 @@ gog_renderer_get_text_AABR (GogRenderer *rend, char const *text,
**/
void
gog_renderer_get_gostring_AABR (GogRenderer *rend, GOString *str,
- GOGeometryAABR *aabr)
+ GOGeometryAABR *aabr, double max_width)
{
GOGeometryOBR obr;
- gog_renderer_get_gostring_OBR (rend, str, &obr);
+ gog_renderer_get_gostring_OBR (rend, str, &obr, max_width);
go_geometry_OBR_to_AABR (&obr, aabr);
}
diff --git a/goffice/graph/gog-renderer.h b/goffice/graph/gog-renderer.h
index 1d7ac28..309eb80 100644
--- a/goffice/graph/gog-renderer.h
+++ b/goffice/graph/gog-renderer.h
@@ -89,7 +89,8 @@ void gog_renderer_draw_marker (GogRenderer *rend, double x, double y);
void gog_renderer_draw_text (GogRenderer *rend, char const *text,
GogViewAllocation const *pos,
GOAnchorType anchor,
- gboolean use_markup);
+ gboolean use_markup,
+ GtkJustification justification, double width);
void gog_renderer_draw_data_label (GogRenderer *rend, GogSeriesLabelElt const *elt,
GogViewAllocation const *pos, GOAnchorType anchor,
@@ -98,16 +99,19 @@ void gog_renderer_draw_data_label (GogRenderer *rend, GogSeriesLabelElt const *
void gog_renderer_draw_gostring (GogRenderer *rend,
GOString *str,
GogViewAllocation const *pos,
- GOAnchorType anchor);
+ GOAnchorType anchor,
+ GtkJustification justification, double width);
void gog_renderer_get_gostring_OBR (GogRenderer *rend, GOString *str,
- GOGeometryOBR *obr);
+ GOGeometryOBR *obr, double max_width);
void gog_renderer_get_text_OBR (GogRenderer *rend, char const *text,
- gboolean use_markup, GOGeometryOBR *obr);
+ gboolean use_markup, GOGeometryOBR *obr,
+ double max_width);
void gog_renderer_get_gostring_AABR (GogRenderer *rend, GOString *str,
- GOGeometryAABR *aabr);
+ GOGeometryAABR *aabr, double max_width);
void gog_renderer_get_text_AABR (GogRenderer *rend, char const *text,
- gboolean use_markup, GOGeometryAABR *aabr);
+ gboolean use_markup, GOGeometryAABR *aabr,
+ double max_width);
void gog_renderer_push_style (GogRenderer *rend, GOStyle const *style);
void gog_renderer_pop_style (GogRenderer *rend);
diff --git a/goffice/utils/go-geometry.c b/goffice/utils/go-geometry.c
index 280011b..761a3eb 100644
--- a/goffice/utils/go-geometry.c
+++ b/goffice/utils/go-geometry.c
@@ -103,7 +103,7 @@ go_geometry_AABR_add (GOGeometryAABR *aabr0, GOGeometryAABR const *aabr1)
* @obr: a #GOGeometryOBR
* @aabr: a #GOGeometryAABR
*
- * Stores Axis Aligned Bouding Rectangle of @obr in @aabr.
+ * Stores Axis Aligned Bounding Rectangle of @obr in @aabr.
*
**/
void
diff --git a/plugins/plot_distrib/gog-histogram.c b/plugins/plot_distrib/gog-histogram.c
index bd7514a..a02965b 100644
--- a/plugins/plot_distrib/gog-histogram.c
+++ b/plugins/plot_distrib/gog-histogram.c
@@ -753,35 +753,42 @@ gog_histogram_plot_view_render (GogView *view, GogViewAllocation const *bbox)
alloc.x = area->x + 2; /* FIXME: replace 2 by something configurable */
alloc.y = area->y + 2;
gog_renderer_draw_text (view->renderer, text, &alloc,
- GO_ANCHOR_NORTH_WEST, FALSE);
+ GO_ANCHOR_NORTH_WEST, FALSE,
+ GTK_JUSTIFY_LEFT, -1.);
text = (text2)? text2: _("Second values");
alloc.y = area->y + area->h - 2;
gog_renderer_draw_text (view->renderer, text, &alloc,
- GO_ANCHOR_SOUTH_WEST, FALSE);
+ GO_ANCHOR_SOUTH_WEST, FALSE,
+ GTK_JUSTIFY_LEFT, -1.);
} else {
alloc.x = area->x + area->w - 2; /* FIXME: replace 2 by something configurable */
alloc.y = area->y + area->h - 2;
gog_renderer_draw_text (view->renderer, text, &alloc,
- GO_ANCHOR_SOUTH_EAST, FALSE);
+ GO_ANCHOR_SOUTH_EAST, FALSE,
+ GTK_JUSTIFY_LEFT, -1.);
text = (text2)? text2: _("Second values");
alloc.x = area->x + 2;
gog_renderer_draw_text (view->renderer, text, &alloc,
- GO_ANCHOR_SOUTH_WEST, FALSE);
+ GO_ANCHOR_SOUTH_WEST, FALSE,
+ GTK_JUSTIFY_LEFT, -1.);
}
} else {
alloc.x = area->x + area->w - 2; /* FIXME: replace 2 by something configurable */
alloc.y = area->y + 2;
gog_renderer_draw_text (view->renderer, text, &alloc,
- GO_ANCHOR_NORTH_EAST, FALSE);
+ GO_ANCHOR_NORTH_EAST, FALSE,
+ GTK_JUSTIFY_LEFT, -1.);
text = (text2)? text2: _("Second values");
if (model->vertical) {
alloc.y = area->y + area->h - 2;
gog_renderer_draw_text (view->renderer, text, &alloc,
- GO_ANCHOR_SOUTH_EAST, FALSE);
+ GO_ANCHOR_SOUTH_EAST, FALSE,
+ GTK_JUSTIFY_LEFT, -1.);
} else {
alloc.x = area->x + 2;
gog_renderer_draw_text (view->renderer, text, &alloc,
- GO_ANCHOR_NORTH_WEST, FALSE);
+ GO_ANCHOR_NORTH_WEST, FALSE,
+ GTK_JUSTIFY_LEFT, -1.);
}
}
g_free (text1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]