~valavanisalex/ubuntu/oneiric/inkscape/inkscape_0.48.1-2ubuntu4

« back to all changes in this revision

Viewing changes to src/widgets/gradient-vector.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook, Kees Cook, Ted Gould
  • Date: 2008-02-10 14:20:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080210142016-vcnb2zqyhszu0xvb
Tags: 0.46~pre1-0ubuntu1
[ Kees Cook ]
* debian/control:
  - add libgtkspell-dev build-dep to gain GtkSpell features (LP: #183547).
  - update Standards version (no changes needed).
  - add Vcs and Homepage fields.
  - switch to new python-lxml dep.
* debian/{control,rules}: switch from dpatch to quilt for more sanity.
* debian/patches/20_fix_glib_and_gxx43_ftbfs.patch:
  - merged against upstream fixes.
  - added additional fixes for newly written code.
* debian/rules: enable parallel building.

[ Ted Gould ]
* Updating POTFILES.in to make it so things build correctly.
* debian/control:
  - add ImageMagick++ and libboost-dev to build-deps

Show diffs side-by-side

added added

removed removed

Lines of Context:
464
464
                }
465
465
        }
466
466
 
 
467
        Inkscape::XML::Document *xml_doc;
 
468
        xml_doc = SP_OBJECT_REPR(gradient)->document();
 
469
 
467
470
        if (i < 1) {
468
471
                gchar c[64];
469
 
                sp_svg_write_color (c, 64, 0x00000000);
 
472
                sp_svg_write_color (c, sizeof(c), 0x00000000);
470
473
 
471
474
                Inkscape::CSSOStringStream os;
472
475
                os << "stop-color:" << c << ";stop-opacity:" << 1.0 << ";";
473
476
 
474
477
                Inkscape::XML::Node *child;
475
478
 
476
 
                child = sp_repr_new ("svg:stop");
 
479
                child = xml_doc->createElement("svg:stop");
477
480
                sp_repr_set_css_double(child, "offset", 0.0);
478
481
                child->setAttribute("style", os.str().c_str());
479
482
                SP_OBJECT_REPR (gradient)->addChild(child, NULL);
480
483
 
481
 
                child = sp_repr_new ("svg:stop");
 
484
                child = xml_doc->createElement("svg:stop");
482
485
                sp_repr_set_css_double(child, "offset", 1.0);
483
486
                child->setAttribute("style", os.str().c_str());
484
487
                SP_OBJECT_REPR (gradient)->addChild(child, NULL);
485
488
        }
486
489
        if (i < 2) {
487
490
                sp_repr_set_css_double(SP_OBJECT_REPR(stop), "offset", 0.0);
488
 
                Inkscape::XML::Node *child = SP_OBJECT_REPR(stop)->duplicate();
 
491
                Inkscape::XML::Node *child = SP_OBJECT_REPR(stop)->duplicate(SP_OBJECT_REPR(gradient)->document());
489
492
                sp_repr_set_css_double(child, "offset", 1.0);
490
493
                SP_OBJECT_REPR(gradient)->addChild(child, SP_OBJECT_REPR (stop));
491
494
        }
592
595
        SPColorSelector *csel = (SPColorSelector*)g_object_get_data (G_OBJECT (tbl), "cselector");
593
596
        guint32 const c = sp_stop_get_rgba32(stop);
594
597
        csel->base->setAlpha(SP_RGBA32_A_F (c));
595
 
        SPColor color;
596
 
        sp_color_set_rgb_float (&color, SP_RGBA32_R_F (c), SP_RGBA32_G_F (c), SP_RGBA32_B_F (c));
 
598
        SPColor color( SP_RGBA32_R_F (c), SP_RGBA32_G_F (c), SP_RGBA32_B_F (c) );
597
599
        // set its color, from the stored array
598
600
        csel->base->setColor( color );
599
601
        GtkWidget *offspin = GTK_WIDGET (g_object_get_data (G_OBJECT (tbl), "offspn"));
698
700
        }
699
701
 
700
702
        if (next != NULL) {
701
 
                new_stop_repr = SP_OBJECT_REPR(stop)->duplicate();
 
703
                new_stop_repr = SP_OBJECT_REPR(stop)->duplicate(SP_OBJECT_REPR(gradient)->document());
702
704
                SP_OBJECT_REPR(gradient)->addChild(new_stop_repr, SP_OBJECT_REPR(stop));
703
705
        } else {
704
706
                next = stop;
705
 
                new_stop_repr = SP_OBJECT_REPR(sp_prev_stop(stop, gradient))->duplicate();
 
707
                new_stop_repr = SP_OBJECT_REPR(sp_prev_stop(stop, gradient))->duplicate(SP_OBJECT_REPR(gradient)->document());
706
708
                SP_OBJECT_REPR(gradient)->addChild(new_stop_repr, SP_OBJECT_REPR(sp_prev_stop(stop, gradient)));
707
709
        }
708
710
 
716
718
 
717
719
        Inkscape::CSSOStringStream os;
718
720
        gchar c[64];
719
 
        sp_svg_write_color (c, 64, cnew);
 
721
        sp_svg_write_color (c, sizeof(c), cnew);
720
722
        gdouble opacity = (gdouble) SP_RGBA32_A_F (cnew);
721
723
        os << "stop-color:" << c << ";stop-opacity:" << opacity <<";";
722
724
        SP_OBJECT_REPR (newstop)->setAttribute("style", os.str().c_str());
865
867
        f = gtk_frame_new (_("Stop Color"));
866
868
        gtk_widget_show (f);
867
869
        gtk_box_pack_start (GTK_BOX (vb), f, TRUE, TRUE, PAD);
868
 
        csel = (GtkWidget*)sp_color_selector_new (SP_TYPE_COLOR_NOTEBOOK, SP_COLORSPACE_TYPE_NONE);
 
870
        csel = (GtkWidget*)sp_color_selector_new (SP_TYPE_COLOR_NOTEBOOK);
869
871
        g_object_set_data (G_OBJECT (vb), "cselector", csel);
870
872
        gtk_widget_show (csel);
871
873
        gtk_container_add (GTK_CONTAINER (f), csel);
1011
1013
                SPColorSelector *csel = SP_COLOR_SELECTOR(g_object_get_data (G_OBJECT (widget), "cselector"));
1012
1014
                // set alpha
1013
1015
                csel->base->setAlpha(SP_RGBA32_A_F (c));
1014
 
                SPColor color;
1015
 
                sp_color_set_rgb_float (&color, SP_RGBA32_R_F (c), SP_RGBA32_G_F (c), SP_RGBA32_B_F (c));
 
1016
                SPColor color( SP_RGBA32_R_F (c), SP_RGBA32_G_F (c), SP_RGBA32_B_F (c) );
1016
1017
                // set color
1017
1018
                csel->base->setColor( color );
1018
1019
        }
1155
1156
 
1156
1157
        csel = (SPColorSelector*)g_object_get_data (G_OBJECT (object), "cselector");
1157
1158
        csel->base->getColorAlpha( color, &alpha );
1158
 
        rgb = sp_color_get_rgba32_ualpha (&color, 0x00);
 
1159
        rgb = color.toRGBA32( 0x00 );
1159
1160
 
1160
1161
        sp_repr_set_css_double (SP_OBJECT_REPR (stop), "offset", stop->offset);
1161
1162
        Inkscape::CSSOStringStream os;
1162
1163
        gchar c[64];
1163
 
        sp_svg_write_color (c, 64, rgb);
 
1164
        sp_svg_write_color (c, sizeof(c), rgb);
1164
1165
        os << "stop-color:" << c << ";stop-opacity:" << (gdouble) alpha <<";";
1165
1166
        SP_OBJECT_REPR (stop)->setAttribute("style", os.str().c_str());
1166
1167
                //      g_snprintf (c, 256, "stop-color:#%06x;stop-opacity:%g;", rgb >> 8, (gdouble) alpha);