diff options
| author | Kris De Gussem <kris.degussem@gmail.com> | 2012-01-07 21:27:52 +0000 |
|---|---|---|
| committer | Kris <Kris.De.Gussem@hotmail.com> | 2012-01-07 21:27:52 +0000 |
| commit | b3874d0fce9eacd2dc8183cc320c6e963a347c66 (patch) | |
| tree | 58c94bb6aebb90724ddc9a3fae9920d56884ae89 /src | |
| parent | documentation: spelling (diff) | |
| download | inkscape-b3874d0fce9eacd2dc8183cc320c6e963a347c66.tar.gz inkscape-b3874d0fce9eacd2dc8183cc320c6e963a347c66.zip | |
dropped deprecated function sp_repr_get_double_attribute
(bzr r10858)
Diffstat (limited to 'src')
| -rw-r--r-- | src/dialogs/clonetiler.cpp | 22 | ||||
| -rw-r--r-- | src/gradient-chemistry.cpp | 5 | ||||
| -rw-r--r-- | src/main.cpp | 10 | ||||
| -rw-r--r-- | src/ui/clipboard.cpp | 4 | ||||
| -rw-r--r-- | src/ui/dialog/print.cpp | 26 | ||||
| -rw-r--r-- | src/widgets/toolbox.cpp | 46 | ||||
| -rw-r--r-- | src/xml/repr-css.cpp | 6 | ||||
| -rw-r--r-- | src/xml/repr-util.cpp | 4 | ||||
| -rw-r--r-- | src/xml/repr.h | 4 |
9 files changed, 80 insertions, 47 deletions
diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index e140f6f89..3a411dd8a 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -1147,10 +1147,10 @@ static void clonetiler_apply(GtkWidget */*widget*/, void *) } Geom::Point center; - double w; - double h; - double x0; - double y0; + double w = 0; + double h = 0; + double x0 = 0; + double y0 = 0; if (keepbbox && obj_repr->attribute("inkscape:tile-w") && @@ -1160,14 +1160,16 @@ static void clonetiler_apply(GtkWidget */*widget*/, void *) obj_repr->attribute("inkscape:tile-cx") && obj_repr->attribute("inkscape:tile-cy")) { - double cx = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-cx", 0); - double cy = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-cy", 0); + double cx = 0; + double cy = 0; + sp_repr_get_double (obj_repr, "inkscape:tile-cx", &cx); + sp_repr_get_double (obj_repr, "inkscape:tile-cy", &cy); center = Geom::Point (cx, cy); - w = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-w", 0); - h = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-h", 0); - x0 = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-x0", 0); - y0 = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-y0", 0); + sp_repr_get_double (obj_repr, "inkscape:tile-w", &w); + sp_repr_get_double (obj_repr, "inkscape:tile-h", &h); + sp_repr_get_double (obj_repr, "inkscape:tile-x0", &x0); + sp_repr_get_double (obj_repr, "inkscape:tile-y0", &y0); } else { bool prefs_bbox = prefs->getBool("/tools/bounding_box", false); SPItem::BBoxType bbox_type = ( !prefs_bbox ? diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index 990695068..c14a94290 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -739,10 +739,13 @@ void sp_item_gradient_reverse_vector(SPItem *item, bool fill_or_stroke) GSList *child_reprs = NULL; GSList *child_objects = NULL; std::vector<double> offsets; + double offset; for ( SPObject *child = vector->firstChild(); child; child = child->getNext()) { child_reprs = g_slist_prepend (child_reprs, child->getRepr()); child_objects = g_slist_prepend (child_objects, child); - offsets.push_back(sp_repr_get_double_attribute(child->getRepr(), "offset", 0)); + offset=0; + sp_repr_get_double(child->getRepr(), "offset", &offset); + offsets.push_back(offset); } GSList *child_copies = NULL; diff --git a/src/main.cpp b/src/main.cpp index 63fd4a454..2d8e35871 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1414,10 +1414,14 @@ sp_do_export_png(SPDocument *doc) } else { // read from namedview Inkscape::XML::Node *nv = sp_repr_lookup_name (doc->rroot, "sodipodi:namedview"); - if (nv && nv->attribute("pagecolor")) + if (nv && nv->attribute("pagecolor")){ bgcolor = sp_svg_read_color(nv->attribute("pagecolor"), 0xffffff00); - if (nv && nv->attribute("inkscape:pageopacity")) - bgcolor |= SP_COLOR_F_TO_U(sp_repr_get_double_attribute (nv, "inkscape:pageopacity", 1.0)); + } + if (nv && nv->attribute("inkscape:pageopacity")){ + double opacity = 1.0; + sp_repr_get_double (nv, "inkscape:pageopacity", &opacity); + bgcolor |= SP_COLOR_F_TO_U(opacity); + } } if (sp_export_background_opacity) { diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 5e0ec5bdb..13b1da427 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -1208,7 +1208,9 @@ void ClipboardManagerImpl::_onGet(Gtk::SelectionData &sel, guint /*info*/) bgcolor = sp_svg_read_color(nv->attribute("pagecolor"), 0xffffff00); } if (nv && nv->attribute("inkscape:pageopacity")) { - bgcolor |= SP_COLOR_F_TO_U(sp_repr_get_double_attribute (nv, "inkscape:pageopacity", 1.0)); + double opacity = 1.0; + sp_repr_get_double(nv, "inkscape:pageopacity", &opacity); + bgcolor |= SP_COLOR_F_TO_U(opacity); } sp_export_png_file(_clipboardSPDoc, filename, area, width, height, dpi, dpi, bgcolor, NULL, NULL, true, NULL); diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index 8da31b813..40fc42969 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -60,10 +60,14 @@ static void draw_page( guint32 bgcolor = 0x00000000; Inkscape::XML::Node *nv = sp_repr_lookup_name (junk->_doc->rroot, "sodipodi:namedview"); - if (nv && nv->attribute("pagecolor")) + if (nv && nv->attribute("pagecolor")){ bgcolor = sp_svg_read_color(nv->attribute("pagecolor"), 0xffffff00); - if (nv && nv->attribute("inkscape:pageopacity")) - bgcolor |= SP_COLOR_F_TO_U(sp_repr_get_double_attribute (nv, "inkscape:pageopacity", 1.0)); + } + if (nv && nv->attribute("inkscape:pageopacity")){ + double opacity = 1.0; + sp_repr_get_double (nv, "inkscape:pageopacity", &opacity); + bgcolor |= SP_COLOR_F_TO_U(opacity); + } sp_export_png_file(junk->_doc, tmp_png.c_str(), 0.0, 0.0, width, height, @@ -83,13 +87,13 @@ static void draw_page( { Cairo::RefPtr<Cairo::ImageSurface> png = Cairo::ImageSurface::create_from_png (tmp_png); cairo_t *cr = gtk_print_context_get_cairo_context (context); - cairo_matrix_t m; - cairo_get_matrix(cr, &m); - cairo_scale(cr, PT_PER_IN / dpi, PT_PER_IN / dpi); + cairo_matrix_t m; + cairo_get_matrix(cr, &m); + cairo_scale(cr, PT_PER_IN / dpi, PT_PER_IN / dpi); // FIXME: why is the origin offset?? cairo_set_source_surface(cr, png->cobj(), -16.0, -16.0); - cairo_paint(cr); - cairo_set_matrix(cr, &m); + cairo_paint(cr); + cairo_set_matrix(cr, &m); } // Clean up @@ -152,16 +156,14 @@ static void draw_page( } -static GObject* -create_custom_widget (GtkPrintOperation */*operation*/, +static GObject* create_custom_widget (GtkPrintOperation */*operation*/, gpointer user_data) { //printf("%s\n",__FUNCTION__); return G_OBJECT(user_data); } -static void -begin_print (GtkPrintOperation *operation, +static void begin_print (GtkPrintOperation *operation, GtkPrintContext */*context*/, gpointer /*user_data*/) { diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index b6e8df259..ba012f7dc 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -15,10 +15,11 @@ * Maximilian Albert <maximilian.albert@gmail.com> * Tavmjong Bah <tavmjong@free.fr> * Abhishek Sharma + * Kris De Gussem <Kris.DeGussem@gmail.com> * * Copyright (C) 2004 David Turner * Copyright (C) 2003 MenTaLguY - * Copyright (C) 1999-2010 authors + * Copyright (C) 1999-2011 authors * Copyright (C) 2001-2002 Ximian, Inc. * * Released under GNU GPL, read the file 'COPYING' for more information @@ -2720,9 +2721,10 @@ static void sp_stb_magnitude_value_changed( GtkAdjustment *adj, GObject *dataKlu if (SP_IS_STAR(item)) { Inkscape::XML::Node *repr = item->getRepr(); sp_repr_set_int(repr,"sodipodi:sides",(gint)adj->value); + double arg1 = 0.5; + sp_repr_get_double(repr, "sodipodi:arg1", &arg1); sp_repr_set_svg_double(repr, "sodipodi:arg2", - (sp_repr_get_double_attribute(repr, "sodipodi:arg1", 0.5) - + M_PI / (gint)adj->value)); + (arg1 + M_PI / (gint)adj->value)); item->updateRepr(); modmade = true; } @@ -2762,8 +2764,10 @@ static void sp_stb_proportion_value_changed( GtkAdjustment *adj, GObject *dataKl if (SP_IS_STAR(item)) { Inkscape::XML::Node *repr = item->getRepr(); - gdouble r1 = sp_repr_get_double_attribute(repr, "sodipodi:r1", 1.0); - gdouble r2 = sp_repr_get_double_attribute(repr, "sodipodi:r2", 1.0); + gdouble r1 = 1.0; + gdouble r2 = 1.0; + sp_repr_get_double(repr, "sodipodi:r1", &r1); + sp_repr_get_double(repr, "sodipodi:r2", &r2); if (r2 < r1) { sp_repr_set_svg_double(repr, "sodipodi:r2", r1*adj->value); } else { @@ -2926,10 +2930,14 @@ static void star_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const *n if (!strcmp(name, "inkscape:randomized")) { adj = GTK_ADJUSTMENT( g_object_get_data(G_OBJECT(tbl), "randomized") ); - gtk_adjustment_set_value(adj, sp_repr_get_double_attribute(repr, "inkscape:randomized", 0.0)); + double randomized = 0.0; + sp_repr_get_double(repr, "inkscape:randomized", &randomized); + gtk_adjustment_set_value(adj, randomized); } else if (!strcmp(name, "inkscape:rounded")) { adj = GTK_ADJUSTMENT( g_object_get_data(G_OBJECT(tbl), "rounded") ); - gtk_adjustment_set_value(adj, sp_repr_get_double_attribute(repr, "inkscape:rounded", 0.0)); + double rounded = 0.0; + sp_repr_get_double(repr, "inkscape:rounded", &rounded); + gtk_adjustment_set_value(adj, rounded); } else if (!strcmp(name, "inkscape:flatsided")) { GtkAction* prop_action = GTK_ACTION( g_object_get_data(G_OBJECT(tbl), "prop_action") ); char const *flatsides = repr->attribute("inkscape:flatsided"); @@ -2943,8 +2951,10 @@ static void star_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const *n } } else if ((!strcmp(name, "sodipodi:r1") || !strcmp(name, "sodipodi:r2")) && (!isFlatSided) ) { adj = (GtkAdjustment*)g_object_get_data(G_OBJECT(tbl), "proportion"); - gdouble r1 = sp_repr_get_double_attribute(repr, "sodipodi:r1", 1.0); - gdouble r2 = sp_repr_get_double_attribute(repr, "sodipodi:r2", 1.0); + gdouble r1 = 1.0; + gdouble r2 = 1.0; + sp_repr_get_double(repr, "sodipodi:r1", &r1); + sp_repr_get_double(repr, "sodipodi:r2", &r2); if (r2 < r1) { gtk_adjustment_set_value(adj, r2/r1); } else { @@ -4013,13 +4023,19 @@ static void spiral_tb_event_attr_changed(Inkscape::XML::Node *repr, GtkAdjustment *adj; adj = (GtkAdjustment*)g_object_get_data(G_OBJECT(tbl), "revolution"); - gtk_adjustment_set_value(adj, (sp_repr_get_double_attribute(repr, "sodipodi:revolution", 3.0))); + double revolution = 3.0; + sp_repr_get_double(repr, "sodipodi:revolution", &revolution); + gtk_adjustment_set_value(adj, revolution); adj = (GtkAdjustment*)g_object_get_data(G_OBJECT(tbl), "expansion"); - gtk_adjustment_set_value(adj, (sp_repr_get_double_attribute(repr, "sodipodi:expansion", 1.0))); + double expansion = 1.0; + sp_repr_get_double(repr, "sodipodi:expansion", &expansion); + gtk_adjustment_set_value(adj, expansion); adj = (GtkAdjustment*)g_object_get_data(G_OBJECT(tbl), "t0"); - gtk_adjustment_set_value(adj, (sp_repr_get_double_attribute(repr, "sodipodi:t0", 0.0))); + double t0 = 0.0; + sp_repr_get_double(repr, "sodipodi:t0", &t0); + gtk_adjustment_set_value(adj, t0); g_object_set_data(G_OBJECT(tbl), "freeze", GINT_TO_POINTER(FALSE)); } @@ -5647,8 +5663,10 @@ static void arc_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const * / // in turn, prevent callbacks from responding g_object_set_data( tbl, "freeze", GINT_TO_POINTER(TRUE) ); - gdouble start = sp_repr_get_double_attribute(repr, "sodipodi:start", 0.0); - gdouble end = sp_repr_get_double_attribute(repr, "sodipodi:end", 0.0); + gdouble start = 0.; + gdouble end = 0.; + sp_repr_get_double(repr, "sodipodi:start", &start); + sp_repr_get_double(repr, "sodipodi:end", &end); GtkAdjustment *adj1,*adj2; adj1 = GTK_ADJUSTMENT( g_object_get_data( tbl, "start" ) ); diff --git a/src/xml/repr-css.cpp b/src/xml/repr-css.cpp index d10a04df0..4fb1223de 100644 --- a/src/xml/repr-css.cpp +++ b/src/xml/repr-css.cpp @@ -190,8 +190,10 @@ double sp_repr_css_double_property(SPCSSAttr *css, gchar const *name, double def { g_assert(css != NULL); g_assert(name != NULL); - - return sp_repr_get_double_attribute((Node *) css, name, defval); + + double val = defval; + sp_repr_get_double((Node *) css, name, &val); + return val; } /** diff --git a/src/xml/repr-util.cpp b/src/xml/repr-util.cpp index c52750a69..1e2449404 100644 --- a/src/xml/repr-util.cpp +++ b/src/xml/repr-util.cpp @@ -312,7 +312,7 @@ gchar const *sp_xml_ns_prefix_uri(gchar const *prefix) return uri; } -double sp_repr_get_double_attribute(Inkscape::XML::Node *repr, char const *key, double def) +/*double sp_repr_get_double_attribute(Inkscape::XML::Node *repr, char const *key, double def) { char *result; @@ -324,7 +324,7 @@ double sp_repr_get_double_attribute(Inkscape::XML::Node *repr, char const *key, if (result == NULL) return def; return g_ascii_strtod(result, NULL); -} +}*/ long long int sp_repr_get_int_attribute(Inkscape::XML::Node *repr, char const *key, long long int def) { diff --git a/src/xml/repr.h b/src/xml/repr.h index 74d14e6cb..3963e8efb 100644 --- a/src/xml/repr.h +++ b/src/xml/repr.h @@ -109,8 +109,8 @@ unsigned sp_repr_set_svg_double(Inkscape::XML::Node *repr, gchar const *key, dou unsigned sp_repr_set_point(Inkscape::XML::Node *repr, gchar const *key, Geom::Point const & val); unsigned sp_repr_get_point(Inkscape::XML::Node *repr, gchar const *key, Geom::Point *val); -/// \deprecated Use sp_repr_get_double to check for success -double sp_repr_get_double_attribute(Inkscape::XML::Node *repr, gchar const *key, double def); +// \deprecated Use sp_repr_get_double to check for success +//double sp_repr_get_double_attribute(Inkscape::XML::Node *repr, gchar const *key, double def); /// \deprecated Use sp_repr_get_int to check for success long long int sp_repr_get_int_attribute(Inkscape::XML::Node *repr, gchar const *key, long long int def); |
