Hello all, I have successfully implemented the code that enables dragging of the recolor nodes. Right now, any node you drag shall change the color of the entire selection.
Another development: I successfully can edit the color from the Desktop. Here it is for future reference if someone needs it.
*Inkscape::Selection *selection = sp_desktop_selection(desktop);* * * * GSList const *items = selection->itemList();* * g_printf("\n\n\t\t Prinitng the id's of Selected objects ");* * 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" );* * sp_repr_css_set_property ( obj_css , "fill", "#00ff00");* * Glib::ustring str;* * sp_repr_css_write_string (obj_css, str);* * obj_repr->setAttribute ("style", str.c_str(), TRUE);* * }* * * Now only the linking task remains. By linking I mean the link b/w the recolor nodes and the selected objects so that only the respective node is changing the color of the respective object.
I am facing one problem in that respect: Initializing a string,
gchar* id = g_sprintf( "obj%d", i ); is giving a runtime error. The same goes with g_snprintf( ..)
Any idea whats going wrong ?
Hi,
To get your branch to compile, I needed to add the two files:
recolor-artwork.h recolor-artwork.cpp
to the file Makefile_insert inside src/ui/dialog
Tav
On Tue, 2013-07-16 at 16:02 +0530, Arshdeep Singh wrote:
Hello all, I have successfully implemented the code that enables dragging of the recolor nodes. Right now, any node you drag shall change the color of the entire selection.
Another development: I successfully can edit the color from the Desktop. Here it is for future reference if someone needs it.
Inkscape::Selection *selection = sp_desktop_selection(desktop);
GSList const *items = selection->itemList(); g_printf("\n\n\t\t Prinitng the id's of Selected objects "); 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" ); sp_repr_css_set_property ( obj_css , "fill", "#00ff00"); Glib::ustring str; sp_repr_css_write_string (obj_css, str); obj_repr->setAttribute ("style", str.c_str(), TRUE); }
Now only the linking task remains. By linking I mean the link b/w the recolor nodes and the selected objects so that only the respective node is changing the color of the respective object.
I am facing one problem in that respect: Initializing a string,
gchar* id = g_sprintf( "obj%d", i ); is giving a runtime error. The same goes with g_snprintf( ..)
Any idea whats going wrong ?
Arshdeep Singh Third Year, Computer Engineering Delhi Technological University Ph: +91-9654115614 https://sites.google.com/site/adsingh1729/home
See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clk... _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Please find the files attached.
On Tue, Jul 16, 2013 at 5:49 AM, Tavmjong Bah <tavmjong@...8...> wrote:
Hi,
To get your branch to compile, I needed to add the two files:
recolor-artwork.h recolor-artwork.cpp
to the file Makefile_insert inside src/ui/dialog
Tav
On Tue, 2013-07-16 at 16:02 +0530, Arshdeep Singh wrote:
Hello all, I have successfully implemented the code that enables dragging of the recolor nodes. Right now, any node you drag shall change the color of the entire selection.
Another development: I successfully can edit the color from the Desktop. Here it is for future reference if someone needs it.
Inkscape::Selection *selection = sp_desktop_selection(desktop);
GSList const *items = selection->itemList(); g_printf("\n\n\t\t Prinitng the id's of Selected objects "); 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" ); sp_repr_css_set_property ( obj_css , "fill", "#00ff00"); Glib::ustring str; sp_repr_css_write_string (obj_css, str); obj_repr->setAttribute ("style", str.c_str(), TRUE); }
Now only the linking task remains. By linking I mean the link b/w the recolor nodes and the selected objects so that only the respective node is changing the color of the respective object.
I am facing one problem in that respect: Initializing a string,
gchar* id = g_sprintf( "obj%d", i ); is giving a runtime error. The same goes with g_snprintf( ..)
Any idea whats going wrong ?
Arshdeep Singh Third Year, Computer Engineering Delhi Technological University Ph: +91-9654115614 https://sites.google.com/site/adsingh1729/home
See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clk...
Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
2013/7/16 Arshdeep Singh <moduli16@...400...>:
I am facing one problem in that respect: Initializing a string,
gchar* id = g_sprintf( "obj%d", i ); is giving a runtime error. The same goes with g_snprintf( ..)
Any idea whats going wrong ?
Please read the documentation: https://developer.gnome.org/glib/2.28/glib-String-Utility-Functions.html#g-s...
You are trying to write the constant string pointed to by 'i' into a constant string.
You should use g_strdup_printf, or even better, Glib::ustring::compose and Glib::ustring::format instead: https://developer.gnome.org/glibmm/unstable/classGlib_1_1ustring.html#a18e12... https://developer.gnome.org/glibmm/unstable/classGlib_1_1ustring.html#ab107f...
Regards, Krzysztof
participants (3)
-
Arshdeep Singh
-
Krzysztof Kosiński
-
Tavmjong Bah