---------- Forwarded message ----------
From: Arshdeep Singh <moduli16@...2179......>
Date: Mon, Aug 26, 2013 at 1:22 PM
Subject: Modifications to RecolorWheelPrivate
To: Ted Gould <ted@...11...>, Krzysztof Kosiński <tweenk.pl@...400...>


Hi,
I added a map object by the name 'nodes' to RecolorWheelPrivate:

  std::map<std::string,RecolorWheelNode> nodes;

I then added this snippet for painting recolor nodes from the map:

for (std::map<std::string,RecolorWheelNode>::iterator iter = priv->nodes.begin(); iter != priv->nodes.end(); ++iter)
  {
  
    dist = (*iter).second._color[1] * outer ;
    
    xx = center_x + cos ((*iter).second._color[0] * 2.0 * G_PI) * dist;
    yy = center_y - sin ((*iter).second._color[0] * 2.0 * G_PI) * dist;
    
    (*iter).second.x = (gfloat)xx;
    (*iter).second.y = (gfloat)yy;
    
    r = (*iter).second._color[0];
    g = (*iter).second._color[1];
    b = (*iter).second._color[2];
    hsv_to_rgb (&r, &g, &b);
}

I added this snippet to performUpdate() in the recolor-artwork-widget.cpp :

void RecolorArtworkWidget::performUpdate()
{
    if ( update || !desktop ) {
        return;
    }

    if ( dragId ) {
        // local change; do nothing, but reset the flag
        g_source_remove(dragId);
        dragId = 0;
        return;
    }

    update = true;
    
    Inkscape::Selection *selection = sp_desktop_selection(desktop);
    GSList  const *items = NULL;
    //int selObj = 0;
    
    if ( selection ) 
    {
        items = selection->itemList();
        //selObj = g_slist_length (const_cast<GSList*>(items)); 
        
        RecolorWheel* wheel = (RecolorWheel*) (((RecolorWheelSelector*)(rsel))->getWheel()) ;
        RecolorWheelNode temp;   
                
        for (GSList const *i = items; i != NULL; i = i->next) 
        {
            SPObject *obj=reinterpret_cast<SPObject *>(i->data);
            Inkscape::XML::Node* obj_repr = obj->getRepr();
            SPCSSAttr* obj_css = sp_repr_css_attr( obj_repr , "style" );
            
            guint32 rgb32 = sp_svg_read_color( sp_repr_css_property( obj_css, "fill", "#ababab") , 0xF0F8FF );
            SPColor color = SPColor (rgb32);
            
            float rgb[3] , hsv[3];
            sp_color_get_rgb_floatv (&color, rgb);
            sp_color_rgb_to_hsv_floatv (hsv , temp._color[0] , temp._color[1] , temp._color[2] );
            
            add_node_to_recolor_wheel (wheel, obj->getId() , temp );                       
        }
            
}   
   update = false;
}

There seems to be some runtime error. Opening the RecolorArtwork Dialogbox crashes inkscape. Running gdb shows the warning that "HEAP: Free heap block a90b8f6 modified at a90b8f6 after it was freed" . 

Can't figure out whats making the application to crash. 

I have uploaded this branch too. It is the latest revision.

--
Arshdeep Singh
Third Year, Computer Engineering
Delhi Technological University
Ph: +91-9654115614
https://sites.google.com/site/adsingh1729/home



--
Arshdeep Singh
Third Year, Computer Engineering
Delhi Technological University
Ph: +91-9654115614
https://sites.google.com/site/adsingh1729/home