Code

NR::Maybe => boost::optional
[inkscape.git] / src / dialogs / stroke-style.cpp
index e1640e6afe422431284582baf98fa3bf66aaa5de..ae387e5f84e6a2f004cf08813f3c7daca3a5e91c 100644 (file)
@@ -73,7 +73,7 @@ static void sp_stroke_style_paint_dragged(SPPaintSelector *psel, SPWidget *spw);
 static void sp_stroke_style_paint_changed(SPPaintSelector *psel, SPWidget *spw);
 
 static void sp_stroke_style_widget_change_subselection ( Inkscape::Application *inkscape, SPDesktop *desktop, SPWidget *spw );
-static void sp_stroke_style_widget_transientize_callback(Inkscape::Application *inkscape, 
+static void sp_stroke_style_widget_transientize_callback(Inkscape::Application *inkscape,
                                                          SPDesktop *desktop,
                                                          SPWidget *spw );
 
@@ -134,7 +134,7 @@ sp_stroke_style_paint_widget_new(void)
  * On construction, simply does an update of the stroke style paint object.
  */
 static void
-sp_stroke_style_paint_construct(SPWidget *spw, SPPaintSelector *psel)
+sp_stroke_style_paint_construct(SPWidget *spw, SPPaintSelector */*psel*/)
 {
 #ifdef SP_SS_VERBOSE
     g_print( "Stroke style widget constructed: inkscape %p repr %p\n",
@@ -142,17 +142,17 @@ sp_stroke_style_paint_construct(SPWidget *spw, SPPaintSelector *psel)
 #endif
     if (spw->inkscape) {
         sp_stroke_style_paint_update (spw);
-    } 
+    }
 }
 
 /**
  * On signal modified, invokes an update of the stroke style paint object.
  */
 static void
-sp_stroke_style_paint_selection_modified ( SPWidget *spw,
-                                        Inkscape::Selection *selection,
-                                        guint flags,
-                                        SPPaintSelector *psel)
+sp_stroke_style_paint_selection_modified( SPWidget *spw,
+                                          Inkscape::Selection */*selection*/,
+                                          guint flags,
+                                          SPPaintSelector */*psel*/ )
 {
     if (flags & ( SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_PARENT_MODIFIED_FLAG |
                   SP_OBJECT_STYLE_MODIFIED_FLAG) ) {
@@ -165,9 +165,9 @@ sp_stroke_style_paint_selection_modified ( SPWidget *spw,
  * On signal selection changed, invokes an update of the stroke style paint object.
  */
 static void
-sp_stroke_style_paint_selection_changed ( SPWidget *spw,
-                                        Inkscape::Selection *selection,
-                                        SPPaintSelector *psel )
+sp_stroke_style_paint_selection_changed( SPWidget *spw,
+                                         Inkscape::Selection */*selection*/,
+                                         SPPaintSelector */*psel*/ )
 {
     sp_stroke_style_paint_update (spw);
 }
@@ -177,9 +177,9 @@ sp_stroke_style_paint_selection_changed ( SPWidget *spw,
  * On signal change subselection, invoke an update of the stroke style widget.
  */
 static void
-sp_stroke_style_widget_change_subselection ( Inkscape::Application *inkscape, 
-                                        SPDesktop *desktop,
-                                        SPWidget *spw )
+sp_stroke_style_widget_change_subselection( Inkscape::Application */*inkscape*/,
+                                            SPDesktop */*desktop*/,
+                                            SPWidget *spw )
 {
     sp_stroke_style_paint_update (spw);
 }
@@ -200,9 +200,9 @@ sp_stroke_style_paint_update (SPWidget *spw)
     SPPaintSelector *psel = SP_PAINT_SELECTOR(gtk_object_get_data(GTK_OBJECT(spw), "paint-selector"));
 
     // create temporary style
-    SPStyle *query = sp_style_new ();
+    SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
     // query into it
-    int result = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_STROKE); 
+    int result = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_STROKE);
 
     switch (result) {
         case QUERY_STYLE_NOTHING:
@@ -219,14 +219,7 @@ sp_stroke_style_paint_update (SPWidget *spw)
             SPPaintSelectorMode pselmode = sp_style_determine_paint_selector_mode (query, false);
             sp_paint_selector_set_mode (psel, pselmode);
 
-            if (query->stroke.set && query->stroke.type == SP_PAINT_TYPE_COLOR) {
-                gfloat d[3];
-                sp_color_get_rgb_floatv (&query->stroke.value.color, d);
-                SPColor color;
-                sp_color_set_rgb_float (&color, d[0], d[1], d[2]);
-                sp_paint_selector_set_color_alpha (psel, &color, SP_SCALE24_TO_FLOAT (query->stroke_opacity.value));
-
-            } else if (query->stroke.set && query->stroke.type == SP_PAINT_TYPE_PAINTSERVER) {
+            if (query->stroke.set && query->stroke.isPaintserver()) {
 
                 SPPaintServer *server = SP_STYLE_STROKE_SERVER (query);
 
@@ -250,6 +243,9 @@ sp_stroke_style_paint_update (SPWidget *spw)
                     SPPattern *pat = pattern_getroot (SP_PATTERN (server));
                     sp_update_pattern_list (psel, pat);
                 }
+            } else if (query->stroke.set && query->stroke.isColor()) {
+                sp_paint_selector_set_color_alpha (psel, &query->stroke.value.color, SP_SCALE24_TO_FLOAT (query->stroke_opacity.value));
+
             }
             break;
         }
@@ -261,7 +257,7 @@ sp_stroke_style_paint_update (SPWidget *spw)
         }
     }
 
-    g_free (query);
+    sp_style_unref(query);
 
     gtk_object_set_data(GTK_OBJECT(spw), "update", GINT_TO_POINTER(FALSE));
 }
@@ -271,7 +267,7 @@ sp_stroke_style_paint_update (SPWidget *spw)
  */
 static void
 sp_stroke_style_paint_mode_changed( SPPaintSelector *psel,
-                                    SPPaintSelectorMode mode,
+                                    SPPaintSelectorMode /*mode*/,
                                     SPWidget *spw )
 {
     if (gtk_object_get_data(GTK_OBJECT(spw), "update")) {
@@ -285,12 +281,12 @@ sp_stroke_style_paint_mode_changed( SPPaintSelector *psel,
     sp_stroke_style_paint_changed(psel, spw);
 }
 
-static gchar *undo_label_1 = "stroke:flatcolor:1";
-static gchar *undo_label_2 = "stroke:flatcolor:2";
-static gchar *undo_label = undo_label_1;
+static gchar const *const undo_label_1 = "stroke:flatcolor:1";
+static gchar const *const undo_label_2 = "stroke:flatcolor:2";
+static gchar const *undo_label = undo_label_1;
 
 /**
- * When a drag callback occurs on a paint selector object, if it is a RGB or CMYK 
+ * When a drag callback occurs on a paint selector object, if it is a RGB or CMYK
  * color mode, then set the stroke opacity to psel's flat color.
  */
 static void
@@ -305,7 +301,7 @@ sp_stroke_style_paint_dragged(SPPaintSelector *psel, SPWidget *spw)
         case SP_PAINT_SELECTOR_MODE_COLOR_CMYK:
         {
             sp_paint_selector_set_flat_color (psel, SP_ACTIVE_DESKTOP, "stroke", "stroke-opacity");
-            sp_document_maybe_done (sp_desktop_document(SP_ACTIVE_DESKTOP), undo_label, SP_VERB_DIALOG_FILL_STROKE, 
+            sp_document_maybe_done (sp_desktop_document(SP_ACTIVE_DESKTOP), undo_label, SP_VERB_DIALOG_FILL_STROKE,
                                     _("Set stroke color"));
             break;
         }
@@ -355,7 +351,7 @@ sp_stroke_style_paint_changed(SPPaintSelector *psel, SPWidget *spw)
 
             sp_repr_css_attr_unref(css);
 
-            sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE, 
+            sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE,
                              _("Remove stroke"));
             break;
         }
@@ -364,13 +360,13 @@ sp_stroke_style_paint_changed(SPPaintSelector *psel, SPWidget *spw)
         case SP_PAINT_SELECTOR_MODE_COLOR_CMYK:
         {
             sp_paint_selector_set_flat_color (psel, desktop, "stroke", "stroke-opacity");
-            sp_document_maybe_done (sp_desktop_document(desktop), undo_label, SP_VERB_DIALOG_FILL_STROKE, 
+            sp_document_maybe_done (sp_desktop_document(desktop), undo_label, SP_VERB_DIALOG_FILL_STROKE,
                                     _("Set stroke color"));
 
             // on release, toggle undo_label so that the next drag will not be lumped with this one
             if (undo_label == undo_label_1)
                 undo_label = undo_label_2;
-            else 
+            else
                 undo_label = undo_label_1;
 
             break;
@@ -386,22 +382,22 @@ sp_stroke_style_paint_changed(SPPaintSelector *psel, SPWidget *spw)
                 if (!vector) {
                     /* No vector in paint selector should mean that we just changed mode */
 
-                    SPStyle *query = sp_style_new ();
-                    int result = objects_query_fillstroke ((GSList *) items, query, false); 
+                    SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
+                    int result = objects_query_fillstroke ((GSList *) items, query, false);
                     guint32 common_rgb = 0;
                     if (result == QUERY_STYLE_MULTIPLE_SAME) {
-                        if (query->fill.type != SP_PAINT_TYPE_COLOR) {
+                        if (!query->fill.isColor()) {
                             common_rgb = sp_desktop_get_color(desktop, false);
                         } else {
-                            common_rgb = sp_color_get_rgba32_ualpha(&query->stroke.value.color, 0xff);
+                            common_rgb = query->stroke.value.color.toRGBA32( 0xff );
                         }
                         vector = sp_document_default_gradient_vector(document, common_rgb);
                     }
-                    g_free (query);
+                    sp_style_unref(query);
 
                     for (GSList const *i = items; i != NULL; i = i->next) {
                         if (!vector) {
-                            sp_item_set_gradient(SP_ITEM(i->data), 
+                            sp_item_set_gradient(SP_ITEM(i->data),
                                                  sp_gradient_vector_for_object(document, desktop, SP_OBJECT(i->data), false),
                                                  gradient_type, false);
                         } else {
@@ -416,7 +412,7 @@ sp_stroke_style_paint_changed(SPPaintSelector *psel, SPWidget *spw)
                     }
                 }
 
-                sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE, 
+                sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE,
                                  _("Set gradient on stroke"));
             }
             break;
@@ -445,7 +441,7 @@ sp_stroke_style_paint_changed(SPPaintSelector *psel, SPWidget *spw)
                              continue;
 
                          SPStyle *style = SP_OBJECT_STYLE (selobj);
-                         if (style && style->stroke.type == SP_PAINT_TYPE_PAINTSERVER) {
+                         if (style && style->stroke.isPaintserver()) {
                              SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER (selobj);
                              if (SP_IS_PATTERN (server) && pattern_getroot (SP_PATTERN(server)) == pattern)
                                  // only if this object's pattern is not rooted in our selected pattern, apply
@@ -460,7 +456,7 @@ sp_stroke_style_paint_changed(SPPaintSelector *psel, SPWidget *spw)
 
                 } // end if
 
-                sp_document_done (document, SP_VERB_DIALOG_FILL_STROKE, 
+                sp_document_done (document, SP_VERB_DIALOG_FILL_STROKE,
                                   _("Set pattern on stroke"));
             } // end if
 
@@ -470,11 +466,18 @@ sp_stroke_style_paint_changed(SPPaintSelector *psel, SPWidget *spw)
             if (items) {
                     SPCSSAttr *css = sp_repr_css_attr_new ();
                     sp_repr_css_unset_property (css, "stroke");
+                    sp_repr_css_unset_property (css, "stroke-opacity");
+                    sp_repr_css_unset_property (css, "stroke-width");
+                    sp_repr_css_unset_property (css, "stroke-miterlimit");
+                    sp_repr_css_unset_property (css, "stroke-linejoin");
+                    sp_repr_css_unset_property (css, "stroke-linecap");
+                    sp_repr_css_unset_property (css, "stroke-dashoffset");
+                    sp_repr_css_unset_property (css, "stroke-dasharray");
 
                     sp_desktop_set_style (desktop, css);
                     sp_repr_css_attr_unref (css);
 
-                    sp_document_done (document, SP_VERB_DIALOG_FILL_STROKE, 
+                    sp_document_done (document, SP_VERB_DIALOG_FILL_STROKE,
                                       _("Unset stroke"));
             }
             break;
@@ -560,9 +563,9 @@ sp_stroke_radio_button(GtkWidget *tb, char const *icon,
 }
 
 static void
-sp_stroke_style_widget_transientize_callback(Inkscape::Application *inkscape, 
-                                        SPDesktop *desktop,
-                                        SPWidget *spw )
+sp_stroke_style_widget_transientize_callback(Inkscape::Application */*inkscape*/,
+                                             SPDesktop */*desktop*/,
+                                             SPWidget */*spw*/ )
 {
 // TODO:  Either of these will cause crashes sometimes
 //    sp_stroke_style_line_update( SP_WIDGET(spw), desktop ? sp_desktop_selection(desktop) : NULL);
@@ -577,7 +580,7 @@ sp_stroke_style_widget_transientize_callback(Inkscape::Application *inkscape,
 static GtkWidget *
 sp_marker_prev_new(unsigned psize, gchar const *mname,
                    SPDocument *source, SPDocument *sandbox,
-                   gchar *menu_id, NRArena const *arena, unsigned visionkey, NRArenaItem *root)
+                   gchar const *menu_id, NRArena const */*arena*/, unsigned /*visionkey*/, NRArenaItem *root)
 {
     // Retrieve the marker named 'mname' from the source SVG document
     SPObject const *marker = source->getObjectById(mname);
@@ -598,7 +601,7 @@ sp_marker_prev_new(unsigned psize, gchar const *mname,
     Inkscape::GC::release(mrepr);
 
 // Uncomment this to get the sandbox documents saved (useful for debugging)
-    //FILE *fp = fopen (g_strconcat(mname, ".svg", NULL), "w");
+    //FILE *fp = fopen (g_strconcat(menu_id, mname, ".svg", NULL), "w");
     //sp_repr_save_stream (sp_document_repr_doc (sandbox), fp);
     //fclose (fp);
 
@@ -611,8 +614,8 @@ sp_marker_prev_new(unsigned psize, gchar const *mname,
         return NULL; // sandbox broken?
 
     // Find object's bbox in document
-    NR::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object)));
-    NR::Maybe<NR::Rect> dbox = SP_ITEM(object)->getBounds(i2doc);
+    Geom::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object)));
+    boost::optional<NR::Rect> dbox = SP_ITEM(object)->getBounds(from_2geom(i2doc));
 
     if (!dbox) {
         return NULL;
@@ -622,11 +625,13 @@ sp_marker_prev_new(unsigned psize, gchar const *mname,
     double sf = 0.8;
     GdkPixbuf* pixbuf = NULL;
 
-    Glib::ustring key = svg_preview_cache.cache_key(source->uri, mname, psize);
+    gchar *cache_name = g_strconcat(menu_id, mname, NULL);
+    Glib::ustring key = svg_preview_cache.cache_key(source->uri, cache_name, psize);
+    g_free (cache_name);
     pixbuf = svg_preview_cache.get_preview_from_cache(key);
 
     if (pixbuf == NULL) {
-        pixbuf = render_pixbuf(root, sf, *dbox, psize);
+        pixbuf = render_pixbuf(root, sf, to_2geom(*dbox), psize);
         svg_preview_cache.set_preview_in_cache(key, pixbuf);
     }
 
@@ -666,7 +671,7 @@ ink_marker_list_get (SPDocument *source)
  * Adds previews of markers in marker_list to the given menu widget
  */
 static void
-sp_marker_menu_build (GtkWidget *m, GSList *marker_list, SPDocument *source, SPDocument *sandbox, gchar *menu_id)
+sp_marker_menu_build (GtkWidget *m, GSList *marker_list, SPDocument *source, SPDocument *sandbox, gchar const *menu_id)
 {
     // Do this here, outside of loop, to speed up preview generation:
     NRArena const *arena = NRArena::create();
@@ -717,7 +722,7 @@ sp_marker_menu_build (GtkWidget *m, GSList *marker_list, SPDocument *source, SPD
  *
  */
 static void
-sp_marker_list_from_doc (GtkWidget *m, SPDocument *current_doc, SPDocument *source, SPDocument *markers_doc, SPDocument *sandbox, gchar *menu_id)
+sp_marker_list_from_doc (GtkWidget *m, SPDocument */*current_doc*/, SPDocument *source, SPDocument */*markers_doc*/, SPDocument *sandbox, gchar const *menu_id)
 {
     GSList *ml = ink_marker_list_get(source);
     GSList *clean_ml = NULL;
@@ -772,7 +777,7 @@ gchar const *buffer = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:sodipodi=
 }
 
 static void
-ink_marker_menu_create_menu(GtkWidget *m, gchar *menu_id, SPDocument *doc, SPDocument *sandbox)
+ink_marker_menu_create_menu(GtkWidget *m, gchar const *menu_id, SPDocument *doc, SPDocument *sandbox)
 {
     static SPDocument *markers_doc = NULL;
 
@@ -806,7 +811,7 @@ ink_marker_menu_create_menu(GtkWidget *m, gchar *menu_id, SPDocument *doc, SPDoc
 
     // suck in from current doc
     sp_marker_list_from_doc ( m, NULL, doc, markers_doc, sandbox, menu_id );
-    
+
     // add separator
     {
         GtkWidget *i = gtk_separator_menu_item_new();
@@ -827,7 +832,7 @@ ink_marker_menu_create_menu(GtkWidget *m, gchar *menu_id, SPDocument *doc, SPDoc
  * Creates a menu widget to display markers from markers.svg
  */
 static GtkWidget *
-ink_marker_menu( GtkWidget *tbl, gchar *menu_id, SPDocument *sandbox)
+ink_marker_menu( GtkWidget */*tbl*/, gchar const *menu_id, SPDocument *sandbox)
 {
     SPDesktop *desktop = inkscape_active_desktop();
     SPDocument *doc = sp_desktop_document(desktop);
@@ -851,7 +856,7 @@ ink_marker_menu( GtkWidget *tbl, gchar *menu_id, SPDocument *sandbox)
         gtk_widget_set_sensitive(mnu, TRUE);
     }
 
-    gtk_object_set_data(GTK_OBJECT(mnu), "menu_id", menu_id);
+    gtk_object_set_data(GTK_OBJECT(mnu), "menu_id", const_cast<gchar *>(menu_id));
     gtk_option_menu_set_menu(GTK_OPTION_MENU(mnu), m);
 
     /* Set history */
@@ -887,7 +892,7 @@ sp_marker_select(GtkOptionMenu *mnu, GtkWidget *spw)
     }
     gchar *markid = (gchar *) g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))),
                                                 "marker");
-    gchar *marker = "";
+    gchar const *marker = "";
     if (strcmp(markid, "none")){
        gchar *stockid = (gchar *) g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))),
                                                 "stockid");
@@ -904,7 +909,7 @@ sp_marker_select(GtkOptionMenu *mnu, GtkWidget *spw)
     }
 
     SPCSSAttr *css = sp_repr_css_attr_new();
-    gchar *menu_id = (gchar *) g_object_get_data(G_OBJECT(mnu), "menu_id");
+    gchar const *menu_id = (gchar const *) g_object_get_data(G_OBJECT(mnu), "menu_id");
     sp_repr_css_set_property(css, menu_id, marker);
 
     // Also update the marker dropdown menus, so the document's markers
@@ -928,24 +933,24 @@ sp_marker_select(GtkOptionMenu *mnu, GtkWidget *spw)
 
     sp_repr_css_attr_unref(css);
 
-    sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE, 
+    sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE,
                      _("Set markers"));
 
 };
 
 static int
-ink_marker_menu_get_pos(GtkMenu* mnu, gchar* markname) {
-    
+ink_marker_menu_get_pos(GtkMenu *mnu, gchar const *markname)
+{
     if (markname == NULL)
-        markname = (gchar *) g_object_get_data(G_OBJECT(gtk_menu_get_active(mnu)), "marker");
+        markname = (gchar const *) g_object_get_data(G_OBJECT(gtk_menu_get_active(mnu)), "marker");
 
     if (markname == NULL)
         return 0;
 
-    GList *kids = GTK_MENU_SHELL(mnu)->children;
+    GList const *kids = GTK_MENU_SHELL(mnu)->children;
     int i = 0;
     for (; kids != NULL; kids = kids->next) {
-        gchar *mark = (gchar *) g_object_get_data(G_OBJECT(kids->data), "marker");
+        gchar const *mark = (gchar const *) g_object_get_data(G_OBJECT(kids->data), "marker");
         if ( mark && strcmp(mark, markname) == 0 ) {
             break;
         }
@@ -1283,9 +1288,8 @@ sp_stroke_style_line_widget_new(void)
  * the stroke line style to be updated.
  */
 static void
-sp_stroke_style_line_construct(SPWidget *spw, gpointer data)
+sp_stroke_style_line_construct(SPWidget *spw, gpointer /*data*/)
 {
-
 #ifdef SP_SS_VERBOSE
     g_print( "Stroke style widget constructed: inkscape %p repr %p\n",
              spw->inkscape, spw->repr );
@@ -1295,18 +1299,18 @@ sp_stroke_style_line_construct(SPWidget *spw, gpointer data)
                                     ( SP_ACTIVE_DESKTOP
                                       ? sp_desktop_selection(SP_ACTIVE_DESKTOP)
                                       : NULL ));
-    } 
+    }
 }
 
 /**
- * Callback for when stroke style widget is modified.  
+ * Callback for when stroke style widget is modified.
  * Triggers update action.
  */
 static void
-sp_stroke_style_line_selection_modified ( SPWidget *spw,
-                                       Inkscape::Selection *selection,
-                                       guint flags,
-                                       gpointer data )
+sp_stroke_style_line_selection_modified( SPWidget *spw,
+                                         Inkscape::Selection *selection,
+                                         guint flags,
+                                         gpointer /*data*/ )
 {
     if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_PARENT_MODIFIED_FLAG)) {
         sp_stroke_style_line_update (spw, selection);
@@ -1319,9 +1323,9 @@ sp_stroke_style_line_selection_modified ( SPWidget *spw,
  * Triggers update action.
  */
 static void
-sp_stroke_style_line_selection_changed ( SPWidget *spw,
-                                       Inkscape::Selection *selection,
-                                       gpointer data )
+sp_stroke_style_line_selection_changed( SPWidget *spw,
+                                        Inkscape::Selection *selection,
+                                        gpointer /*data*/ )
 {
     sp_stroke_style_line_update (spw, selection);
 }
@@ -1417,12 +1421,12 @@ sp_stroke_style_line_update(SPWidget *spw, Inkscape::Selection *sel)
     GtkWidget *dsel = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(spw), "dash"));
 
     // create temporary style
-    SPStyle *query = sp_style_new ();
+    SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
     // query into it
-    int result_sw = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_STROKEWIDTH); 
-    int result_ml = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_STROKEMITERLIMIT); 
-    int result_cap = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_STROKECAP); 
-    int result_join = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_STROKEJOIN); 
+    int result_sw = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_STROKEWIDTH);
+    int result_ml = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_STROKEMITERLIMIT);
+    int result_cap = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_STROKECAP);
+    int result_join = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_STROKEJOIN);
 
     if (result_sw == QUERY_STYLE_NOTHING) {
         /* No objects stroked, set insensitive */
@@ -1469,7 +1473,7 @@ sp_stroke_style_line_update(SPWidget *spw, Inkscape::Selection *sel)
         sp_stroke_style_set_cap_buttons(spw, NULL);
     }
 
-    g_free (query);
+    sp_style_unref(query);
 
     if (!sel || sel->isEmpty())
         return;
@@ -1597,7 +1601,7 @@ sp_stroke_style_scale_line(SPWidget *spw)
 
     sp_repr_css_attr_unref(css);
 
-    sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE, 
+    sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE,
                      _("Set stroke style"));
 
     gtk_object_set_data(GTK_OBJECT(spw), "update", GINT_TO_POINTER(FALSE));
@@ -1605,11 +1609,11 @@ sp_stroke_style_scale_line(SPWidget *spw)
 
 
 /**
- * Callback for when the stroke style's width changes.  
+ * Callback for when the stroke style's width changes.
  * Causes all line styles to be applied to all selected items.
  */
 static void
-sp_stroke_style_width_changed(GtkAdjustment *adj, SPWidget *spw)
+sp_stroke_style_width_changed(GtkAdjustment */*adj*/, SPWidget *spw)
 {
     if (gtk_object_get_data(GTK_OBJECT(spw), "update")) {
         return;
@@ -1619,11 +1623,11 @@ sp_stroke_style_width_changed(GtkAdjustment *adj, SPWidget *spw)
 }
 
 /**
- * Callback for when the stroke style's miterlimit changes.  
+ * Callback for when the stroke style's miterlimit changes.
  * Causes all line styles to be applied to all selected items.
  */
 static void
-sp_stroke_style_miterlimit_changed(GtkAdjustment *adj, SPWidget *spw)
+sp_stroke_style_miterlimit_changed(GtkAdjustment */*adj*/, SPWidget *spw)
 {
     if (gtk_object_get_data(GTK_OBJECT(spw), "update")) {
         return;
@@ -1633,11 +1637,11 @@ sp_stroke_style_miterlimit_changed(GtkAdjustment *adj, SPWidget *spw)
 }
 
 /**
- * Callback for when the stroke style's dash changes.  
+ * Callback for when the stroke style's dash changes.
  * Causes all line styles to be applied to all selected items.
  */
 static void
-sp_stroke_style_line_dash_changed(SPDashSelector *dsel, SPWidget *spw)
+sp_stroke_style_line_dash_changed(SPDashSelector */*dsel*/, SPWidget *spw)
 {
     if (gtk_object_get_data(GTK_OBJECT(spw), "update")) {
         return;
@@ -1777,7 +1781,7 @@ ink_marker_menu_set_current(SPObject *marker, GtkOptionMenu *mnu)
 }
 
 /**
- * Updates the marker menus to highlight the appropriate marker and scroll to 
+ * Updates the marker menus to highlight the appropriate marker and scroll to
  * that marker.
  */
 static void