[gnumeric: 1/2] update after GOStyle::outline deprecation
- From: Jean Bréfort <jbrefort src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnumeric: 1/2] update after GOStyle::outline deprecation
- Date: Mon, 31 Aug 2009 17:32:16 +0000 (UTC)
commit 8d8ca74fbb51ae796568f62cb55abf2725d21c08
Author: Jean Brefort <jean brefort normalesup org>
Date: Mon Aug 31 19:19:43 2009 +0200
update after GOStyle::outline deprecation
ChangeLog | 13 +++++++++++++
plugins/excel/ChangeLog | 9 +++++++++
plugins/excel/ms-chart.c | 24 ++++++++----------------
plugins/excel/ms-excel-read.c | 6 +++---
plugins/excel/ms-excel-write.c | 4 +---
plugins/excel/xlsx-read.c | 2 --
src/dialogs/ChangeLog | 7 +++++++
src/dialogs/dialog-autoformat.c | 4 ++--
src/dialogs/dialog-cell-format.c | 2 +-
src/dialogs/dialog-printer-setup.c | 16 ++++++++--------
src/gnm-pane.c | 8 ++++----
src/gnm-so-filled.c | 28 ++++++++++++++--------------
src/gnm-so-polygon.c | 8 ++++----
src/item-edit.c | 4 ++--
src/sheet-object-cell-comment.c | 2 +-
src/sheet-object-image.c | 2 +-
16 files changed, 78 insertions(+), 61 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 35aefe8..493647d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2009-08-31 Jean Brefort <jean brefort normalesup org>
+
+ * src/gnm-pane.c (new_control_point), (set_acetate_coords):
+ replace GOStyle::outline.
+ * src/gnm-so-filled.c (sof_default_style),
+ (gnm_so_filled_draw_cairo), (gnm_so_filled_read_xml_dom),
+ (gnm_so_filled_write_xml_sax), (gnm_so_filled_prep_sax_parser):
+ * src/gnm-so-polygon.c (sop_default_style): ditto.
+ * src/item-edit.c (item_edit_draw): fixed cursor position.
+ * src/sheet-object-cell-comment.c (cell_comment_new_view):
+ replace GOStyle::outline.
+ * src/sheet-object-image.c (gnm_soi_draw_cairo): ditto.
+
2009-08-30 Morten Welinder <terra gnome org>
* configure.in: Post-release bump.
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index ea86342..65d9705 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,12 @@
+2009-08-31 Jean Brefort <jean brefort normalesup org>
+
+ * ms-chart.c (lineformat), (ms_excel_chart_read),
+ (style_is_completely_auto), (chart_write_style),
+ (chart_write_DROPBAR): replace GOStyle::outline.
+ * ms-excel-read.c (ms_sheet_realize_obj): ditto.
+ * ms-excel-write.c (extract_gog_object_style): ditto.
+ * xlsx-read.c (xlsx_draw_line_dash): ditto.
+
2009-08-30 Morten Welinder <terra gnome org>
* Release 1.9.11
diff --git a/plugins/excel/ms-chart.c b/plugins/excel/ms-chart.c
index 8c2f1a0..d37419c 100644
--- a/plugins/excel/ms-chart.c
+++ b/plugins/excel/ms-chart.c
@@ -1365,8 +1365,6 @@ BC_R(lineformat)(XLChartHandler const *handle,
s->style->line.auto_color = (fore == 31 + s->series->len);
}
- s->style->outline = s->style->line;
-
if (s->prev_opcode == BIFF_CHART_chartline) {
/* we only support hi-lo lines at the moment */
if (s->cur_role == 1)
@@ -3491,8 +3489,8 @@ ms_excel_chart_read (BiffQuery *q, MSContainer *container,
if (NULL != full_page) {
GOStyle *style = gog_style_new ();
- style->outline.width = 0;
- style->outline.dash_type = GO_LINE_NONE;
+ style->line.width = 0;
+ style->line.dash_type = GO_LINE_NONE;
style->fill.type = GO_STYLE_FILL_NONE;
g_object_set (G_OBJECT (state.graph), "style", style, NULL);
g_object_set (G_OBJECT (state.chart), "style", style, NULL);
@@ -4301,16 +4299,12 @@ store_dim (GogSeries const *series, GogMSDimType t,
static gboolean
style_is_completely_auto (GOStyle const *style)
{
- if ((style->interesting_fields & GO_STYLE_OUTLINE) &&
- (!style->outline.auto_color || !style->outline.auto_dash ||
- (style->outline.width != 0.)))
- return FALSE;
if ((style->interesting_fields & GO_STYLE_FILL)) {
if (style->fill.type != GO_STYLE_FILL_PATTERN ||
!style->fill.auto_back)
return FALSE;
}
- if ((style->interesting_fields & GO_STYLE_LINE) &&
+ if ((style->interesting_fields & (GO_STYLE_OUTLINE | GO_STYLE_LINE)) &&
(!style->line.auto_color || !style->line.auto_dash ||
(style->line.width != 0.)))
return FALSE;
@@ -4332,11 +4326,9 @@ chart_write_style (XLChartWriteState *s, GOStyle const *style,
chart_write_BEGIN (s);
ms_biff_put_2byte (s->bp, BIFF_CHART_3dbarshape, 0); /* box */
if (!style_is_completely_auto (style) || interpolation == GO_LINE_INTERPOLATION_SPLINE) {
- if ((style->interesting_fields & GO_STYLE_LINE)) {
- chart_write_LINEFORMAT (s, &style->line, FALSE, FALSE);
+ chart_write_LINEFORMAT (s, &style->line, FALSE, FALSE);
+ if ((style->interesting_fields & GO_STYLE_LINE))
chart_write_SERFMT (s, interpolation);
- } else
- chart_write_LINEFORMAT (s, &style->outline, FALSE, FALSE);
chart_write_AREAFORMAT (s, style, FALSE);
chart_write_PIEFORMAT (s, separation);
chart_write_MARKERFORMAT (s, style, FALSE);
@@ -5103,17 +5095,17 @@ chart_write_DROPBAR (XLChartWriteState *s)
GSF_LE_SET_GUINT16 (data + 0, s->dp_width);
ms_biff_put_commit (s->bp);
chart_write_BEGIN (s);
- chart_write_LINEFORMAT (s, &s->dp_style->outline, FALSE, FALSE);
+ chart_write_LINEFORMAT (s, &s->dp_style->line, FALSE, FALSE);
chart_write_AREAFORMAT (s, s->dp_style, FALSE);
chart_write_END (s);
data = ms_biff_put_len_next (s->bp, BIFF_CHART_dropbar, 2);
GSF_LE_SET_GUINT16 (data + 0, s->dp_width);
ms_biff_put_commit (s->bp);
- s->dp_style->outline.color = 0xffffff00 ^ s->dp_style->outline.color;
+ s->dp_style->line.color = 0xffffff00 ^ s->dp_style->line.color;
s->dp_style->fill.pattern.fore = 0xffffff00 ^ s->dp_style->fill.pattern.fore ;
s->dp_style->fill.pattern.back = 0xffffff00 ^ s->dp_style->fill.pattern.back ;
chart_write_BEGIN (s);
- chart_write_LINEFORMAT (s, &s->dp_style->outline, FALSE, FALSE);
+ chart_write_LINEFORMAT (s, &s->dp_style->line, FALSE, FALSE);
chart_write_AREAFORMAT (s, s->dp_style, FALSE);
chart_write_END (s);
g_object_unref (s->dp_style);
diff --git a/plugins/excel/ms-excel-read.c b/plugins/excel/ms-excel-read.c
index b6b4fa3..e07ab6e 100644
--- a/plugins/excel/ms-excel-read.c
+++ b/plugins/excel/ms-excel-read.c
@@ -533,11 +533,11 @@ ms_sheet_realize_obj (MSContainer *container, MSObj *obj)
case 0x06: /* TextBox */
case 0x0E: /* Label */
style = go_style_new ();
- style->outline.color = ms_sheet_map_color (esheet, obj,
+ style->line.color = ms_sheet_map_color (esheet, obj,
MS_OBJ_ATTR_OUTLINE_COLOR, RGBA_BLACK);
- style->outline.width = ms_obj_attr_get_uint (obj->attrs,
+ style->line.width = ms_obj_attr_get_uint (obj->attrs,
MS_OBJ_ATTR_OUTLINE_WIDTH, 0) / 256.;
- style->outline.dash_type = ms_obj_attr_bag_lookup (obj->attrs, MS_OBJ_ATTR_OUTLINE_HIDE)
+ style->line.dash_type = ms_obj_attr_bag_lookup (obj->attrs, MS_OBJ_ATTR_OUTLINE_HIDE)
? GO_LINE_NONE : xl_pattern_to_line_type (ms_obj_attr_get_int (obj->attrs, MS_OBJ_ATTR_OUTLINE_STYLE, 1));
style->fill.pattern.back = ms_sheet_map_color (esheet, obj,
MS_OBJ_ATTR_FILL_COLOR, RGBA_WHITE);
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index eb647b9..1e16300 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -5784,9 +5784,7 @@ extract_gog_object_style (XLExportBase *ewb, GogObject *obj)
if (GOG_IS_STYLED_OBJECT (obj)) {
GOStyle const *style = GOG_STYLED_OBJECT (obj)->style;
- if (style->interesting_fields & GO_STYLE_OUTLINE)
- put_color_go_color (ewb, style->outline.color);
- else if (style->interesting_fields & GO_STYLE_LINE)
+ if (style->interesting_fields & (GO_STYLE_OUTLINE | GO_STYLE_LINE))
put_color_go_color (ewb, style->line.color);
if (style->interesting_fields & GO_STYLE_FILL)
switch (style->fill.type) {
diff --git a/plugins/excel/xlsx-read.c b/plugins/excel/xlsx-read.c
index 18872d3..ee1043e 100644
--- a/plugins/excel/xlsx-read.c
+++ b/plugins/excel/xlsx-read.c
@@ -1579,8 +1579,6 @@ xlsx_draw_line_dash (GsfXMLIn *xin, xmlChar const **attrs)
if (state->sp_type & GO_STYLE_LINE) {
state->cur_style->line.auto_dash = FALSE;
state->cur_style->line.dash_type = dash;
- state->cur_style->outline.auto_dash = FALSE;
- state->cur_style->outline.dash_type = dash;
} else {
; /* what goes here ?*/
}
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index c5bb6b7..2012058 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,10 @@
+2009-08-31 Jean Brefort <jean brefort normalesup org>
+
+ * dialog-autoformat.c (previews_load): replace GOStyle::outline.
+ * dialog-cell-format.c (draw_border_preview): ditto.
+ * dialog-printer-setup.c (margin_preview_page_create),
+ (create_hf_preview_canvas): ditto.
+
2009-08-31 Morten Welinder <terra gnome org>
* dialog-about.c (dialog_about): Handle C90 and missing
diff --git a/src/dialogs/dialog-autoformat.c b/src/dialogs/dialog-autoformat.c
index 810327b..b9e243e 100644
--- a/src/dialogs/dialog-autoformat.c
+++ b/src/dialogs/dialog-autoformat.c
@@ -337,8 +337,8 @@ previews_load (AutoFormatState *state, int topindex)
"height", (double)(TOTAL_HEIGHT + 2 * INNER_BORDER),
NULL);
style = go_styled_object_get_style (GO_STYLED_OBJECT (state->selrect));
- style->outline.width = 3.;
- style->outline.color = RGBA_RED;
+ style->line.width = 3.;
+ style->line.color = RGBA_RED;
style->fill.pattern.back = 0;
gtk_frame_set_shadow_type (state->frame[i], GTK_SHADOW_IN);
diff --git a/src/dialogs/dialog-cell-format.c b/src/dialogs/dialog-cell-format.c
index 2d1d9b3..8356c5b 100644
--- a/src/dialogs/dialog-cell-format.c
+++ b/src/dialogs/dialog-cell-format.c
@@ -1270,7 +1270,7 @@ draw_border_preview (FormatState *state)
"width", R-L+20., "height", B-T+20.,
NULL);
style = go_styled_object_get_style (GO_STYLED_OBJECT (state->border.back));
- style->outline.dash_type = GO_LINE_NONE;
+ style->line.dash_type = GO_LINE_NONE;
/* Draw the corners */
points = goc_points_new (3);
diff --git a/src/dialogs/dialog-printer-setup.c b/src/dialogs/dialog-printer-setup.c
index 5c3c5e1..f5006f6 100644
--- a/src/dialogs/dialog-printer-setup.c
+++ b/src/dialogs/dialog-printer-setup.c
@@ -433,8 +433,8 @@ margin_preview_page_create (PrinterSetupState *state)
"height", (double) y2-y1,
NULL)));
style->fill.pattern.back = RGBA_BLACK;
- style->outline.color = RGBA_BLACK;
- style->outline.width = 1.;
+ style->line.color = RGBA_BLACK;
+ style->line.width = 1.;
style = go_styled_object_get_style (
GO_STYLED_OBJECT (goc_item_new (GOC_GROUP (pi->group),
@@ -445,8 +445,8 @@ margin_preview_page_create (PrinterSetupState *state)
"height", (double) y2-y1,
NULL)));
style->fill.pattern.back = RGBA_WHITE;
- style->outline.color = RGBA_BLACK;
- style->outline.width = 1.;
+ style->line.color = RGBA_BLACK;
+ style->line.width = 1.;
draw_margins (state, x1, y1, x2, y2);
}
@@ -1877,8 +1877,8 @@ create_hf_preview_canvas (PrinterSetupState *state, gboolean header)
"height", height + (header ? -shadow: shadow),
NULL)));
gostyle->fill.pattern.back = RGBA_BLACK;
- gostyle->outline.width = 0.;
- gostyle->outline.color = 0;
+ gostyle->line.width = 0.;
+ gostyle->line.color = 0;
gostyle = go_styled_object_get_style (
GO_STYLED_OBJECT (goc_item_new (goc_canvas_get_root (GOC_CANVAS (pi->canvas)),
@@ -1889,8 +1889,8 @@ create_hf_preview_canvas (PrinterSetupState *state, gboolean header)
"height", height,
NULL)));
gostyle->fill.pattern.back = RGBA_WHITE;
- gostyle->outline.width = 0.;
- gostyle->outline.color = 0;
+ gostyle->line.width = 0.;
+ gostyle->line.color = 0;
style = gnm_conf_get_printer_decoration_font ();
font_desc = pango_font_description_new ();
diff --git a/src/gnm-pane.c b/src/gnm-pane.c
index b9fa9c5..2bf9cee 100644
--- a/src/gnm-pane.c
+++ b/src/gnm-pane.c
@@ -2800,7 +2800,7 @@ new_control_point (GnmPane *pane, SheetObject *so, int idx, double x, double y,
GOStyle *style = go_style_new ();
GocItem *item;
- style->outline.width = CTRL_PT_OUTLINE;
+ style->line.width = CTRL_PT_OUTLINE;
item = goc_item_new (
pane->action_items,
CONTROL_TYPE_CIRCLE,
@@ -2897,12 +2897,12 @@ set_acetate_coords (GnmPane *pane, SheetObject *so, GocItem **ctrl_pts,
style->fill.type = GO_STYLE_FILL_PATTERN;
style->fill.auto_fore = FALSE;
go_pattern_set_solid (&style->fill.pattern, 0);
- style->outline.auto_dash = FALSE;
- style->outline.dash_type = GO_LINE_NONE;
+ style->line.auto_dash = FALSE;
+ style->line.dash_type = GO_LINE_NONE;
/* work around the screwup in shapes that adds a large
* border to anything that uses miter (is this required for
* a rectangle in goc-canvas? */
- style->outline.join = CAIRO_LINE_JOIN_ROUND;
+ style->line.join = CAIRO_LINE_JOIN_ROUND;
item = goc_item_new (
pane->action_items,
item_acetate_get_type (),
diff --git a/src/gnm-so-filled.c b/src/gnm-so-filled.c
index 1e2e355..c701c40 100644
--- a/src/gnm-so-filled.c
+++ b/src/gnm-so-filled.c
@@ -136,9 +136,9 @@ sof_default_style (void)
{
GOStyle *res = go_style_new ();
res->interesting_fields = GO_STYLE_OUTLINE | GO_STYLE_FILL;
- res->outline.width = 0; /* hairline */
- res->outline.color = RGBA_BLACK;
- res->outline.dash_type = GO_LINE_SOLID; /* anything but 0 */
+ res->line.width = 0; /* hairline */
+ res->line.color = RGBA_BLACK;
+ res->line.dash_type = GO_LINE_SOLID; /* anything but 0 */
res->fill.type = GO_STYLE_FILL_PATTERN;
go_pattern_set_solid (&res->fill.pattern, RGBA_WHITE);
return res;
@@ -250,12 +250,12 @@ gnm_so_filled_draw_cairo (SheetObject const *so, cairo_t *cr,
cairo_pattern_destroy (pat);
}
/* Draw the line */
- cairo_set_line_width (cr, (style->outline.width)? style->outline.width: 1.);
+ cairo_set_line_width (cr, (style->line.width)? style->line.width: 1.);
cairo_set_source_rgba (cr,
- UINT_RGBA_R(style->outline.color),
- UINT_RGBA_B(style->outline.color),
- UINT_RGBA_G(style->outline.color),
- UINT_RGBA_A(style->outline.color));
+ UINT_RGBA_R(style->line.color),
+ UINT_RGBA_B(style->line.color),
+ UINT_RGBA_G(style->line.color),
+ UINT_RGBA_A(style->line.color));
cairo_stroke (cr);
/* Draw the text. */
if (*(sof->text) != '\0') {
@@ -298,10 +298,10 @@ gnm_so_filled_read_xml_dom (SheetObject *so, char const *typename,
return !go_persist_dom_load (GO_PERSIST (sof->style), child);
/* Old 1.0 and 1.2 */
- go_xml_node_get_gocolor (node, "OutlineColor", &sof->style->outline.color);
+ go_xml_node_get_gocolor (node, "OutlineColor", &sof->style->line.color);
go_xml_node_get_gocolor (node, "FillColor", &sof->style->fill.pattern.back);
if (go_xml_node_get_double (node, "Width", &width))
- sof->style->outline.width = width;
+ sof->style->line.width = width;
return FALSE;
}
@@ -314,8 +314,8 @@ gnm_so_filled_write_xml_sax (SheetObject const *so, GsfXMLOut *output,
gsf_xml_out_add_int (output, "Type", sof->is_oval ? 102 : 101);
/* Old 1.0 and 1.2 */
- gsf_xml_out_add_float (output, "Width", sof->style->outline.width, 2);
- gnm_xml_out_add_gocolor (output, "OutlineColor", sof->style->outline.color);
+ gsf_xml_out_add_float (output, "Width", sof->style->line.width, 2);
+ gnm_xml_out_add_gocolor (output, "OutlineColor", sof->style->line.color);
gnm_xml_out_add_gocolor (output, "FillColor", sof->style->fill.pattern.back);
if (sof->text != NULL && *(sof->text) != '\0') {
gsf_xml_out_add_cstr (output, "Label", sof->text);
@@ -373,9 +373,9 @@ gnm_so_filled_prep_sax_parser (SheetObject *so, GsfXMLIn *xin,
/* Old 1.0 and 1.2 */
else if (gnm_xml_attr_double (attrs, "Width", &tmp))
- sof->style->outline.width = tmp;
+ sof->style->line.width = tmp;
else if (attr_eq (attrs[0], "OutlineColor"))
- go_color_from_str (CXML2C (attrs[1]), &sof->style->outline.color);
+ go_color_from_str (CXML2C (attrs[1]), &sof->style->line.color);
else if (attr_eq (attrs[0], "FillColor"))
go_color_from_str (CXML2C (attrs[1]), &sof->style->fill.pattern.back);
}
diff --git a/src/gnm-so-polygon.c b/src/gnm-so-polygon.c
index 5511b3a..53e689a 100644
--- a/src/gnm-so-polygon.c
+++ b/src/gnm-so-polygon.c
@@ -120,10 +120,10 @@ sop_default_style (void)
{
GOStyle *res = go_style_new ();
res->interesting_fields = GO_STYLE_OUTLINE | GO_STYLE_FILL;
- res->outline.width = 0; /* hairline */
- res->outline.color = RGBA_BLACK;
- res->outline.dash_type = GO_LINE_SOLID; /* anything but 0 */
- res->outline.join = CAIRO_LINE_JOIN_ROUND;
+ res->line.width = 0; /* hairline */
+ res->line.color = RGBA_BLACK;
+ res->line.dash_type = GO_LINE_SOLID; /* anything but 0 */
+ res->line.join = CAIRO_LINE_JOIN_ROUND;
res->fill.type = GO_STYLE_FILL_PATTERN;
go_pattern_set_solid (&res->fill.pattern, RGBA_WHITE);
return res;
diff --git a/src/item-edit.c b/src/item-edit.c
index 010861b..40bb20c 100644
--- a/src/item-edit.c
+++ b/src/item-edit.c
@@ -117,12 +117,11 @@ item_edit_draw (GocItem const *item, cairo_t *cr)
pango_layout_set_text (layout, pango_layout_get_text (ie->layout), -1);
pango_layout_set_attributes (layout, pango_layout_get_attributes (ie->layout));
pango_cairo_show_layout (cr, layout);
- g_object_unref (layout);
if (ie->cursor_visible) {
PangoRectangle pos;
char const *text = gtk_entry_get_text (ie->entry);
int cursor_pos = gtk_editable_get_position (GTK_EDITABLE (ie->entry));
- pango_layout_index_to_pos (ie->layout,
+ pango_layout_index_to_pos (layout,
g_utf8_offset_to_pointer (text, cursor_pos) - text, &pos);
cairo_set_line_width (cr, 1.);
cairo_set_dash (cr, NULL, 0, 0.);
@@ -133,6 +132,7 @@ item_edit_draw (GocItem const *item, cairo_t *cr)
cairo_line_to (cr, left + PANGO_PIXELS (pos.x) + .5, top + PANGO_PIXELS (pos.y + pos.height) - 1);
cairo_stroke (cr);
}
+ g_object_unref (layout);
}
static double
diff --git a/src/sheet-object-cell-comment.c b/src/sheet-object-cell-comment.c
index d2cd285..9ec5303 100644
--- a/src/sheet-object-cell-comment.c
+++ b/src/sheet-object-cell-comment.c
@@ -258,7 +258,7 @@ cell_comment_new_view (SheetObject *so, SheetObjectViewContainer *container)
GOStyle *style = go_styled_object_get_style (
GO_STYLED_OBJECT (goc_item_new (GOC_GROUP (view),
GOC_TYPE_POLYGON, NULL)));
- style->outline.dash_type = GO_LINE_NONE;
+ style->line.dash_type = GO_LINE_NONE;
style->fill.pattern.back = RGBA_RED;
return gnm_pane_object_register (so, view, FALSE);
}
diff --git a/src/sheet-object-image.c b/src/sheet-object-image.c
index dd6f28e..ce3dbad 100644
--- a/src/sheet-object-image.c
+++ b/src/sheet-object-image.c
@@ -574,7 +574,7 @@ gnm_soi_draw_cairo (SheetObject const *so, cairo_t *cr,
cairo_matrix_t cr_matrix;
pixbuf = soi_get_pixbuf (SHEET_OBJECT_IMAGE (so), 1.);
- if (!pixbuf)
+ if (!pixbuf || width == 0. || height == 0.)
return;
img = go_image_new_from_pixbuf (pixbuf);
cr_pattern = go_image_create_cairo_pattern (img);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]