Code

Changed how tooltips for verbs are fetched to display translated versions correctly...
[inkscape.git] / src / widgets / toolbox.cpp
index 01d9fd71d95dd6ad3c3f89111494a6421ba83ebe..8cdf0a07fcee4869fb4a1fe4cddb09f19670a4cc 100644 (file)
@@ -1,5 +1,3 @@
-#define __SP_MAINTOOLBOX_C__
-
 /** \file
  * Controls bars for some of Inkscape's tools
  * (for some tools, they are in their own files)
@@ -29,6 +27,9 @@
 # include "config.h"
 #endif
 
+#include <cstring>
+#include <string>
+
 #include <gtkmm.h>
 #include <gtk/gtk.h>
 #include <iostream>
@@ -39,6 +40,7 @@
 #include "widgets/spw-utilities.h"
 #include "widgets/spinbutton-events.h"
 #include "dialogs/text-edit.h"
+#include "dialogs/dialog-events.h"
 
 #include "ui/widget/style-swatch.h"
 
@@ -63,6 +65,7 @@
 #include "connector-context.h"
 #include "node-context.h"
 #include "shape-editor.h"
+#include "tweak-context.h"
 #include "sp-rect.h"
 #include "box3d.h"
 #include "box3d-context.h"
 #include "sp-flowtext.h"
 #include "style.h"
 #include "selection.h"
+#include "selection-chemistry.h"
 #include "document-private.h"
 #include "desktop-style.h"
 #include "../libnrtype/font-lister.h"
+#include "../libnrtype/font-instance.h"
 #include "../connection-pool.h"
 #include "../prefs-utils.h"
 #include "../inkscape-stock.h"
@@ -94,6 +99,8 @@
 #include "ege-select-one-action.h"
 #include "helper/unit-tracker.h"
 
+#include "svg/css-ostringstream.h"
+
 using Inkscape::UnitTracker;
 
 typedef void (*SetupFunction)(GtkWidget *toolbox, SPDesktop *desktop);
@@ -105,7 +112,7 @@ static void       sp_zoom_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainA
 static void       sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
 static void       sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
 static void       sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
-static void       sp_3dbox_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
+static void       box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
 static void       sp_spiral_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
 static void       sp_pencil_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
 static void       sp_pen_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
@@ -129,7 +136,7 @@ static struct {
     { "SPTweakContext",    "tweak_tool",     SP_VERB_CONTEXT_TWEAK, SP_VERB_CONTEXT_TWEAK_PREFS },
     { "SPZoomContext",     "zoom_tool",      SP_VERB_CONTEXT_ZOOM, SP_VERB_CONTEXT_ZOOM_PREFS },
     { "SPRectContext",     "rect_tool",      SP_VERB_CONTEXT_RECT, SP_VERB_CONTEXT_RECT_PREFS },
-//    { "SP3DBoxContext",    "3dbox_tool",     SP_VERB_CONTEXT_3DBOX, SP_VERB_CONTEXT_3DBOX_PREFS },
+    { "Box3DContext",      "3dbox_tool",     SP_VERB_CONTEXT_3DBOX, SP_VERB_CONTEXT_3DBOX_PREFS },
     { "SPArcContext",      "arc_tool",       SP_VERB_CONTEXT_ARC, SP_VERB_CONTEXT_ARC_PREFS },
     { "SPStarContext",     "star_tool",      SP_VERB_CONTEXT_STAR, SP_VERB_CONTEXT_STAR_PREFS },
     { "SPSpiralContext",   "spiral_tool",    SP_VERB_CONTEXT_SPIRAL, SP_VERB_CONTEXT_SPIRAL_PREFS },
@@ -159,14 +166,14 @@ static struct {
     { "SPNodeContext",   "node_toolbox",   0, sp_node_toolbox_prep,              "NodeToolbar",
       SP_VERB_INVALID, 0, 0},
     { "SPTweakContext",   "tweak_toolbox",   0, sp_tweak_toolbox_prep,              "TweakToolbar",
-      SP_VERB_INVALID, 0, 0},
+      SP_VERB_CONTEXT_TWEAK_PREFS, "tools.tweak", _("Color/opacity used for color tweaking")},
     { "SPZoomContext",   "zoom_toolbox",   0, sp_zoom_toolbox_prep,              "ZoomToolbar",
       SP_VERB_INVALID, 0, 0},
     { "SPStarContext",   "star_toolbox",   0, sp_star_toolbox_prep,              "StarToolbar",
       SP_VERB_CONTEXT_STAR_PREFS,   "tools.shapes.star",     _("Style of new stars")},
     { "SPRectContext",   "rect_toolbox",   0, sp_rect_toolbox_prep,              "RectToolbar",
       SP_VERB_CONTEXT_RECT_PREFS,   "tools.shapes.rect",     _("Style of new rectangles")},
-    { "SP3DBoxContext",  "3dbox_toolbox",  0, sp_3dbox_toolbox_prep,             "3DBoxToolbar",
+    { "Box3DContext",  "3dbox_toolbox",  0, box3d_toolbox_prep,             "3DBoxToolbar",
       SP_VERB_CONTEXT_3DBOX_PREFS,  "tools.shapes.3dbox",    _("Style of new 3D boxes")},
     { "SPArcContext",    "arc_toolbox",    0, sp_arc_toolbox_prep,               "ArcToolbar",
       SP_VERB_CONTEXT_ARC_PREFS,    "tools.shapes.arc",      _("Style of new ellipses")},
@@ -195,6 +202,10 @@ static struct {
 static gchar const * ui_descr =
         "<ui>"
         "  <toolbar name='SelectToolbar'>"
+        "    <toolitem action='EditSelectAll' />"
+        "    <toolitem action='EditSelectAllInAllLayers' />"
+        "    <toolitem action='EditDeselect' />"
+        "    <separator />"
         "    <toolitem action='ObjectRotate90CCW' />"
         "    <toolitem action='ObjectRotate90' />"
         "    <toolitem action='ObjectFlipHorizontally' />"
@@ -212,6 +223,7 @@ static gchar const * ui_descr =
         "    <toolitem action='HeightAction' />"
         "    <toolitem action='UnitsAction' />"
         "    <separator />"
+        "    <toolitem action='transform_affect_label' />"
         "    <toolitem action='transform_stroke' />"
         "    <toolitem action='transform_corners' />"
         "    <toolitem action='transform_gradient' />"
@@ -238,22 +250,39 @@ static gchar const * ui_descr =
         "    <toolitem action='StrokeToPath' />"
         "    <separator />"
         "    <toolitem action='NodesShowHandlesAction' />"
+        "    <separator />"
+        "    <toolitem action='EditNextLPEParameterAction' />"
+        "    <separator />"
+        "    <toolitem action='NodeXAction' />"
+        "    <toolitem action='NodeYAction' />"
+        "    <toolitem action='NodeUnitsAction' />"
         "  </toolbar>"
 
         "  <toolbar name='TweakToolbar'>"
         "    <toolitem action='TweakWidthAction' />"
+        "    <separator />"
         "    <toolitem action='TweakForceAction' />"
+        "    <toolitem action='TweakPressureAction' />"
         "    <separator />"
         "    <toolitem action='TweakModeAction' />"
         "    <separator />"
         "    <toolitem action='TweakFidelityAction' />"
-        "    <toolitem action='TweakPressureAction' />"
+        "    <separator />"
+        "    <toolitem action='TweakChannelsLabel' />"
+        "    <toolitem action='TweakDoH' />"
+        "    <toolitem action='TweakDoS' />"
+        "    <toolitem action='TweakDoL' />"
+        "    <toolitem action='TweakDoO' />"
         "  </toolbar>"
 
         "  <toolbar name='ZoomToolbar'>"
         "    <toolitem action='ZoomIn' />"
         "    <toolitem action='ZoomOut' />"
         "    <separator />"
+        "    <toolitem action='Zoom1:0' />"
+        "    <toolitem action='Zoom1:2' />"
+        "    <toolitem action='Zoom2:1' />"
+        "    <separator />"
         "    <toolitem action='ZoomSelection' />"
         "    <toolitem action='ZoomDrawing' />"
         "    <toolitem action='ZoomPage' />"
@@ -261,10 +290,6 @@ static gchar const * ui_descr =
         "    <separator />"
         "    <toolitem action='ZoomPrev' />"
         "    <toolitem action='ZoomNext' />"
-        "    <separator />"
-        "    <toolitem action='Zoom1:0' />"
-        "    <toolitem action='Zoom1:2' />"
-        "    <toolitem action='Zoom2:1' />"
         "  </toolbar>"
 
         "  <toolbar name='StarToolbar'>"
@@ -293,10 +318,14 @@ static gchar const * ui_descr =
         "  </toolbar>"
 
         "  <toolbar name='3DBoxToolbar'>"
-        "    <toolitem action='3DBoxVPXAction' />"
-        "    <toolitem action='3DBoxVPYAction' />"
-        "    <toolitem action='3DBoxVPZAction' />"
+        "    <toolitem action='3DBoxAngleXAction' />"
+        "    <toolitem action='3DBoxVPXStateAction' />"
+        "    <separator />"
+        "    <toolitem action='3DBoxAngleYAction' />"
+        "    <toolitem action='3DBoxVPYStateAction' />"
         "    <separator />"
+        "    <toolitem action='3DBoxAngleZAction' />"
+        "    <toolitem action='3DBoxVPZStateAction' />"
         "  </toolbar>"
 
         "  <toolbar name='SpiralToolbar'>"
@@ -317,19 +346,20 @@ static gchar const * ui_descr =
         "  <toolbar name='CalligraphyToolbar'>"
         "    <separator />"
         "    <toolitem action='CalligraphyWidthAction' />"
+        "    <toolitem action='PressureAction' />"
+        "    <toolitem action='TraceAction' />"
         "    <toolitem action='ThinningAction' />"
         "    <separator />"
         "    <toolitem action='AngleAction' />"
+        "    <toolitem action='TiltAction' />"
         "    <toolitem action='FixationAction' />"
+        "    <separator />"
         "    <toolitem action='CapRoundingAction' />"
         "    <separator />"
         "    <toolitem action='TremorAction' />"
         "    <toolitem action='WiggleAction' />"
         "    <toolitem action='MassAction' />"
         "    <separator />"
-        "    <toolitem action='TraceAction' />"
-        "    <toolitem action='PressureAction' />"
-        "    <toolitem action='TiltAction' />"
         "    <toolitem action='CalligraphyResetAction' />"
         "  </toolbar>"
 
@@ -394,7 +424,7 @@ static void update_commands_toolbox (SPDesktop *desktop, SPEventContext *eventco
           *dropper_opacity_entry ; */
 // should be made a private member once this is converted to class
 
-static void delete_connection(GObject *obj, sigc::connection *connection) {
+static void delete_connection(GObject */*obj*/, sigc::connection *connection) {
     connection->disconnect();
     delete connection;
 }
@@ -447,7 +477,7 @@ GtkWidget * sp_toolbox_button_normal_new_from_verb(GtkWidget *t, Inkscape::IconS
 }
 
 
-static void trigger_sp_action( GtkAction* act, gpointer user_data )
+static void trigger_sp_action( GtkAction* /*act*/, gpointer user_data )
 {
     SPAction* targetAction = SP_ACTION(user_data);
     if ( targetAction ) {
@@ -455,7 +485,7 @@ static void trigger_sp_action( GtkAction* act, gpointer user_data )
     }
 }
 
-static void sp_action_action_set_sensitive (SPAction *action, unsigned int sensitive, void *data)
+static void sp_action_action_set_sensitive (SPAction */*action*/, unsigned int sensitive, void *data)
 {
     if ( data ) {
         GtkAction* act = GTK_ACTION(data);
@@ -477,7 +507,7 @@ static GtkAction* create_action_for_verb( Inkscape::Verb* verb, Inkscape::UI::Vi
     GtkAction* act = 0;
 
     SPAction* targetAction = verb->get_action(view);
-    InkAction* inky = ink_action_new( verb->get_id(), verb->get_name(), verb->get_tip(), verb->get_image(), size  );
+    InkAction* inky = ink_action_new( verb->get_id(), _(verb->get_name()), verb->get_tip(), verb->get_image(), size  );
     act = GTK_ACTION(inky);
     gtk_action_set_sensitive( act, targetAction->sensitive );
 
@@ -588,14 +618,14 @@ sp_tool_toolbox_new()
 }
 
 static void
-aux_toolbox_attached(GtkHandleBox *toolbox, GtkWidget *child)
+aux_toolbox_attached(GtkHandleBox */*toolbox*/, GtkWidget *child)
 {
     g_object_set_data(G_OBJECT(child), "is_detached", GINT_TO_POINTER(FALSE));
     gtk_widget_queue_resize(child);
 }
 
 static void
-aux_toolbox_detached(GtkHandleBox *toolbox, GtkWidget *child)
+aux_toolbox_detached(GtkHandleBox */*toolbox*/, GtkWidget *child)
 {
     g_object_set_data(G_OBJECT(child), "is_detached", GINT_TO_POINTER(TRUE));
     gtk_widget_queue_resize(child);
@@ -606,14 +636,9 @@ sp_aux_toolbox_new()
 {
     GtkWidget *tb = gtk_vbox_new(FALSE, 0);
 
-    GtkWidget *tb_s = gtk_vbox_new(FALSE, 0);
-    GtkWidget *tb_e = gtk_vbox_new(FALSE, 0);
     gtk_box_set_spacing(GTK_BOX(tb), AUX_SPACING);
-    gtk_box_pack_start(GTK_BOX(tb), GTK_WIDGET(tb_s), FALSE, FALSE, 0);
-    gtk_box_pack_end(GTK_BOX(tb), GTK_WIDGET(tb_e), FALSE, FALSE, 0);
 
     g_object_set_data(G_OBJECT(tb), "desktop", NULL);
-    g_object_set_data(G_OBJECT(tb), "top_spacer", tb_s);
 
     gtk_widget_set_sensitive(tb, FALSE);
 
@@ -643,11 +668,7 @@ sp_commands_toolbox_new()
 {
     GtkWidget *tb = gtk_vbox_new(FALSE, 0);
 
-    GtkWidget *tb_s = gtk_vbox_new(FALSE, 0);
-    GtkWidget *tb_e = gtk_vbox_new(FALSE, 0);
     gtk_box_set_spacing(GTK_BOX(tb), AUX_SPACING);
-    gtk_box_pack_start(GTK_BOX(tb), GTK_WIDGET(tb_s), FALSE, FALSE, 0);
-    gtk_box_pack_end(GTK_BOX(tb), GTK_WIDGET(tb_e), FALSE, FALSE, 0);
 
     g_object_set_data(G_OBJECT(tb), "desktop", NULL);
     gtk_widget_set_sensitive(tb, FALSE);
@@ -669,6 +690,53 @@ sp_commands_toolbox_new()
     return hb;
 }
 
+static EgeAdjustmentAction * create_adjustment_action( gchar const *name,
+                                                       gchar const *label, gchar const *shortLabel, gchar const *tooltip,
+                                                       gchar const *path, gchar const *data, gdouble def,
+                                                       GtkWidget *focusTarget,
+                                                       GtkWidget *us,
+                                                       GObject *dataKludge,
+                                                       gboolean altx, gchar const *altx_mark,
+                                                       gdouble lower, gdouble upper, gdouble step, gdouble page,
+                                                       gchar const** descrLabels, gdouble const* descrValues, guint descrCount,
+                                                       void (*callback)(GtkAdjustment *, GObject *),
+                                                       gdouble climb = 0.1, guint digits = 3, double factor = 1.0 )
+{
+    GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( prefs_get_double_attribute(path, data, def) * factor,
+                                                             lower, upper, step, page, page ) );
+    if (us) {
+        sp_unit_selector_add_adjustment( SP_UNIT_SELECTOR(us), adj );
+    }
+
+    gtk_signal_connect( GTK_OBJECT(adj), "value-changed", GTK_SIGNAL_FUNC(callback), dataKludge );
+
+    EgeAdjustmentAction* act = ege_adjustment_action_new( adj, name, label, tooltip, 0, climb, digits );
+    if ( shortLabel ) {
+        g_object_set( act, "short_label", shortLabel, NULL );
+    }
+
+    if ( (descrCount > 0) && descrLabels && descrValues ) {
+        ege_adjustment_action_set_descriptions( act, descrLabels, descrValues, descrCount );
+    }
+
+    if ( focusTarget ) {
+        ege_adjustment_action_set_focuswidget( act, focusTarget );
+    }
+
+    if ( altx && altx_mark ) {
+        g_object_set( G_OBJECT(act), "self-id", altx_mark, NULL );
+    }
+
+    if ( dataKludge ) {
+        g_object_set_data( dataKludge, data, adj );
+    }
+
+    // Using a cast just to make sure we pass in the right kind of function pointer
+    g_object_set( G_OBJECT(act), "tool-post", static_cast<EgeWidgetFixup>(sp_set_font_size_smaller), NULL );
+
+    return act;
+}
+
 
 //####################################
 //# node editing callbacks
@@ -770,45 +838,168 @@ sp_node_path_edit_symmetrical(void)
     if (shape_editor) shape_editor->set_node_type(Inkscape::NodePath::NODE_SYMM);
 }
 
-static void toggle_show_handles (GtkToggleAction *act, gpointer data) {
+static void toggle_show_handles (GtkToggleAction *act, gpointer /*data*/) {
     bool show = gtk_toggle_action_get_active( act );
     prefs_set_int_attribute ("tools.nodes", "show_handles",  show ? 1 : 0);
     ShapeEditor *shape_editor = get_current_shape_editor();
     if (shape_editor) shape_editor->show_handles(show);
 }
 
+void sp_node_path_edit_nextLPEparam (GtkAction */*act*/, gpointer data) {
+    sp_selection_next_patheffect_param( reinterpret_cast<SPDesktop*>(data) );
+}
+
+/* is called when the node selection is modified */
+static void
+sp_node_toolbox_coord_changed(gpointer /*shape_editor*/, GObject *tbl)
+{
+    GtkAction* xact = GTK_ACTION( g_object_get_data( tbl, "nodes_x_action" ) );
+    GtkAction* yact = GTK_ACTION( g_object_get_data( tbl, "nodes_y_action" ) );
+    GtkAdjustment *xadj = ege_adjustment_action_get_adjustment(EGE_ADJUSTMENT_ACTION(xact));
+    GtkAdjustment *yadj = ege_adjustment_action_get_adjustment(EGE_ADJUSTMENT_ACTION(yact));
+
+    // quit if run by the attr_changed listener
+    if (g_object_get_data( tbl, "freeze" )) {
+        return;
+    }
+
+    // in turn, prevent listener from responding
+    g_object_set_data( tbl, "freeze", GINT_TO_POINTER(TRUE));
+
+    UnitTracker* tracker = reinterpret_cast<UnitTracker*>( g_object_get_data( tbl, "tracker" ) );
+    SPUnit const *unit = tracker->getActiveUnit();
+
+    ShapeEditor *shape_editor = get_current_shape_editor();
+    if (shape_editor && shape_editor->has_nodepath()) {
+        Inkscape::NodePath::Path *nodepath = shape_editor->get_nodepath();
+        int n_selected = 0;
+        if (nodepath) {
+            n_selected = nodepath->numSelected();
+        }
+
+        if (n_selected == 0) {
+            gtk_action_set_sensitive(xact, FALSE);
+            gtk_action_set_sensitive(yact, FALSE);
+        } else {
+            gtk_action_set_sensitive(xact, TRUE);
+            gtk_action_set_sensitive(yact, TRUE);
+            NR::Coord oldx = sp_units_get_pixels(gtk_adjustment_get_value(xadj), *unit);
+            NR::Coord oldy = sp_units_get_pixels(gtk_adjustment_get_value(xadj), *unit);
+
+            if (n_selected == 1) {
+                NR::Point sel_node = nodepath->singleSelectedCoords();
+                if (oldx != sel_node[NR::X] || oldy != sel_node[NR::Y]) {
+                    gtk_adjustment_set_value(xadj, sp_pixels_get_units(sel_node[NR::X], *unit));
+                    gtk_adjustment_set_value(yadj, sp_pixels_get_units(sel_node[NR::Y], *unit));
+                }
+            } else {
+                NR::Maybe<NR::Coord> x = sp_node_selected_common_coord(nodepath, NR::X);
+                NR::Maybe<NR::Coord> y = sp_node_selected_common_coord(nodepath, NR::Y);
+                if ((x && ((*x) != oldx)) || (y && ((*y) != oldy))) {
+                    /* Note: Currently x and y will always have a value, even if the coordinates of the
+                       selected nodes don't coincide (in this case we use the coordinates of the center
+                       of the bounding box). So the entries are never set to zero. */
+                    // FIXME: Maybe we should clear the entry if several nodes are selected
+                    //        instead of providing a kind of average value
+                    gtk_adjustment_set_value(xadj, sp_pixels_get_units(x ? (*x) : 0.0, *unit));
+                    gtk_adjustment_set_value(yadj, sp_pixels_get_units(y ? (*y) : 0.0, *unit));
+                }
+            }
+        }
+    } else {
+        // no shape-editor or nodepath yet (when we just switched to the tool); coord entries must be inactive
+        gtk_action_set_sensitive(xact, FALSE);
+        gtk_action_set_sensitive(yact, FALSE);
+    }
+
+    g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
+}
+
+static void
+sp_node_path_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *value_name)
+{
+    SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" );
+
+    UnitTracker* tracker = reinterpret_cast<UnitTracker*>(g_object_get_data( tbl, "tracker" ));
+    SPUnit const *unit = tracker->getActiveUnit();
+
+    if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) {
+        prefs_set_double_attribute("tools.nodes", value_name, sp_units_get_pixels(adj->value, *unit));
+    }
+
+    // quit if run by the attr_changed listener
+    if (g_object_get_data( tbl, "freeze" )) {
+        return;
+    }
+
+    // in turn, prevent listener from responding
+    g_object_set_data( tbl, "freeze", GINT_TO_POINTER(TRUE));
+
+    ShapeEditor *shape_editor = get_current_shape_editor();
+    if (shape_editor && shape_editor->has_nodepath()) {
+        double val = sp_units_get_pixels(gtk_adjustment_get_value(adj), *unit);
+        if (!strcmp(value_name, "x")) {
+            sp_node_selected_move_absolute(shape_editor->get_nodepath(), val, NR::X);
+        }
+        if (!strcmp(value_name, "y")) {
+            sp_node_selected_move_absolute(shape_editor->get_nodepath(), val, NR::Y);
+        }
+    }
+
+    g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
+}
+
+static void
+sp_node_path_x_value_changed(GtkAdjustment *adj, GObject *tbl)
+{
+    sp_node_path_value_changed(adj, tbl, "x");
+}
+
+static void
+sp_node_path_y_value_changed(GtkAdjustment *adj, GObject *tbl)
+{
+    sp_node_path_value_changed(adj, tbl, "y");
+}
+
 //################################
 //##    Node Editing Toolbox    ##
 //################################
 
 static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
 {
+    UnitTracker* tracker = new UnitTracker( SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE );
+    tracker->setActiveUnit( sp_desktop_namedview(desktop)->doc_units );
+    g_object_set_data( holder, "tracker", tracker );
+
     {
         InkAction* inky = ink_action_new( "NodeInsertAction",
-                                          _("Insert"),
+                                          _("Insert node"),
                                           _("Insert new nodes into selected segments"),
                                           "node_insert",
                                           Inkscape::ICON_SIZE_SMALL_TOOLBAR );
+        g_object_set( inky, "short_label", _("Insert"), NULL );
         g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_add), 0 );
         gtk_action_group_add_action( mainActions, GTK_ACTION(inky) );
     }
 
     {
         InkAction* inky = ink_action_new( "NodeDeleteAction",
-                                          _("Delete"),
+                                          _("Delete node"),
                                           _("Delete selected nodes"),
                                           "node_delete",
                                           Inkscape::ICON_SIZE_SMALL_TOOLBAR );
+        g_object_set( inky, "short_label", _("Delete"), NULL );
         g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_delete), 0 );
         gtk_action_group_add_action( mainActions, GTK_ACTION(inky) );
     }
 
     {
         InkAction* inky = ink_action_new( "NodeJoinAction",
-                                          _("Join"),
+                                          _("Join endnodes"),
                                           _("Join selected endnodes"),
                                           "node_join",
                                           Inkscape::ICON_SIZE_SMALL_TOOLBAR );
+        g_object_set( inky, "short_label", _("Join"), NULL );
         g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_join), 0 );
         gtk_action_group_add_action( mainActions, GTK_ACTION(inky) );
     }
@@ -904,6 +1095,64 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
         gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.nodes", "show_handles", 1 ) );
     }
 
+    {
+        InkAction* inky = ink_action_new( "EditNextLPEParameterAction",
+                                          _("Next Path Effect Parameter"),
+                                          _("Show next Path Effect parameter for editing"),
+                                          "edit_next_parameter",
+                                          Inkscape::ICON_SIZE_DECORATION );
+        g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_nextLPEparam), desktop );
+        gtk_action_group_add_action( mainActions, GTK_ACTION(inky) );
+    }
+
+    /* X coord of selected node(s) */
+    {
+        EgeAdjustmentAction* eact = 0;
+        gchar const* labels[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+        gdouble values[] = {1, 2, 3, 5, 10, 20, 50, 100, 200, 500};
+        eact = create_adjustment_action( "NodeXAction",
+                                         _("X coordinate:"), _("X:"), _("X coordinate of selected node(s)"),
+                                         "tools.nodes", "Xcoord", 0,
+                                         GTK_WIDGET(desktop->canvas), NULL/*us*/, holder, TRUE, "altx-nodes",
+                                         -1e6, 1e6, SPIN_STEP, SPIN_PAGE_STEP,
+                                         labels, values, G_N_ELEMENTS(labels),
+                                         sp_node_path_x_value_changed );
+        tracker->addAdjustment( ege_adjustment_action_get_adjustment(eact) );
+        g_object_set_data( holder, "nodes_x_action", eact );
+        gtk_action_set_sensitive( GTK_ACTION(eact), FALSE );
+        gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
+    }
+
+    /* Y coord of selected node(s) */
+    {
+        EgeAdjustmentAction* eact = 0;
+        gchar const* labels[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+        gdouble values[] = {1, 2, 3, 5, 10, 20, 50, 100, 200, 500};
+        eact = create_adjustment_action( "NodeYAction",
+                                         _("Y coordinate:"), _("Y:"), _("Y coordinate of selected node(s)"),
+                                         "tools.nodes", "Ycoord", 0,
+                                         GTK_WIDGET(desktop->canvas), NULL/*us*/, holder, FALSE, NULL,
+                                         -1e6, 1e6, SPIN_STEP, SPIN_PAGE_STEP,
+                                         labels, values, G_N_ELEMENTS(labels),
+                                         sp_node_path_y_value_changed );
+        tracker->addAdjustment( ege_adjustment_action_get_adjustment(eact) );
+        g_object_set_data( holder, "nodes_y_action", eact );
+        gtk_action_set_sensitive( GTK_ACTION(eact), FALSE );
+        gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
+    }
+
+    // add the units menu
+    {
+        GtkAction* act = tracker->createAction( "NodeUnitsAction", _("Units"), ("") );
+        gtk_action_group_add_action( mainActions, act );
+    }
+
+    sigc::connection *connection = new sigc::connection (
+        desktop->connectToolSubselectionChanged(sigc::bind (sigc::ptr_fun(sp_node_toolbox_coord_changed), (GObject *)holder))
+        );
+
+    g_signal_connect( holder, "destroy", G_CALLBACK(delete_connection), connection );
+    g_signal_connect( holder, "destroy", G_CALLBACK(purge_repr_listener), holder );
 } // end of sp_node_toolbox_prep()
 
 
@@ -911,7 +1160,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
 //##    Zoom Toolbox    ##
 //########################
 
-static void sp_zoom_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
+static void sp_zoom_toolbox_prep(SPDesktop */*desktop*/, GtkActionGroup* /*mainActions*/, GObject* /*holder*/)
 {
     // no custom GtkAction setup needed
 } // end of sp_zoom_toolbox_prep()
@@ -996,7 +1245,7 @@ setup_tool_toolbox(GtkWidget *toolbox, SPDesktop *desktop)
 
 
 static void
-update_tool_toolbox( SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget *toolbox )
+update_tool_toolbox( SPDesktop */*desktop*/, SPEventContext *eventcontext, GtkWidget *toolbox )
 {
     gchar const *const tname = ( eventcontext
                                  ? gtk_type_name(GTK_OBJECT_TYPE(eventcontext))
@@ -1093,7 +1342,7 @@ setup_aux_toolbox(GtkWidget *toolbox, SPDesktop *desktop)
 }
 
 static void
-update_aux_toolbox(SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget *toolbox)
+update_aux_toolbox(SPDesktop */*desktop*/, SPEventContext *eventcontext, GtkWidget *toolbox)
 {
     gchar const *tname = ( eventcontext
                            ? gtk_type_name(GTK_OBJECT_TYPE(eventcontext))
@@ -1172,7 +1421,7 @@ setup_commands_toolbox(GtkWidget *toolbox, SPDesktop *desktop)
 }
 
 static void
-update_commands_toolbox(SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget *toolbox)
+update_commands_toolbox(SPDesktop */*desktop*/, SPEventContext */*eventcontext*/, GtkWidget */*toolbox*/)
 {
 }
 
@@ -1187,10 +1436,6 @@ void show_aux_toolbox(GtkWidget *toolbox_toplevel)
     }
     gtk_widget_show(toolbox);
 
-    // need to show the spacer, or the padding will be off
-    GtkWidget *spacer = GTK_WIDGET(g_object_get_data(G_OBJECT(toolbox), "top_spacer"));
-    gtk_widget_show(spacer);
-
     gtk_widget_show_all(shown_toolbox);
 }
 
@@ -1257,51 +1502,6 @@ sp_tb_spinbutton(
     return hb;
 }
 
-static EgeAdjustmentAction * create_adjustment_action( gchar const *name,
-                                                       gchar const *label, gchar const *tooltip,
-                                                       gchar const *path, gchar const *data, gdouble def,
-                                                       GtkWidget *focusTarget,
-                                                       GtkWidget *us,
-                                                       GObject *dataKludge,
-                                                       gboolean altx, gchar const *altx_mark,
-                                                       gdouble lower, gdouble upper, gdouble step, gdouble page,
-                                                       gchar const** descrLabels, gdouble const* descrValues, guint descrCount,
-                                                       void (*callback)(GtkAdjustment *, GObject *),
-                                                       gdouble climb = 0.1, guint digits = 3, double factor = 1.0 )
-{
-    GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( prefs_get_double_attribute(path, data, def) * factor,
-                                                             lower, upper, step, page, page ) );
-    if (us) {
-        sp_unit_selector_add_adjustment( SP_UNIT_SELECTOR(us), adj );
-    }
-
-    gtk_signal_connect( GTK_OBJECT(adj), "value-changed", GTK_SIGNAL_FUNC(callback), dataKludge );
-
-    EgeAdjustmentAction* act = ege_adjustment_action_new( adj, name, label, tooltip, 0, climb, digits );
-
-    if ( (descrCount > 0) && descrLabels && descrValues ) {
-        ege_adjustment_action_set_descriptions( act, descrLabels, descrValues, descrCount );
-    }
-
-    if ( focusTarget ) {
-        ege_adjustment_action_set_focuswidget( act, focusTarget );
-    }
-
-    if ( altx && altx_mark ) {
-        g_object_set( G_OBJECT(act), "self-id", altx_mark, NULL );
-    }
-
-    if ( dataKludge ) {
-        g_object_set_data( dataKludge, data, adj );
-    }
-
-    // Using a cast just to make sure we pass in the right kind of function pointer
-    g_object_set( G_OBJECT(act), "tool-post", static_cast<EgeWidgetFixup>(sp_set_font_size_smaller), NULL );
-
-    return act;
-}
-
-
 #define MODE_LABEL_WIDTH 70
 
 //########################
@@ -1503,8 +1703,8 @@ static void sp_stb_randomized_value_changed( GtkAdjustment *adj, GObject *dataKl
 
 
 static void star_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const *name,
-                                       gchar const *old_value, gchar const *new_value,
-                                       bool is_interactive, gpointer data)
+                                       gchar const */*old_value*/, gchar const */*new_value*/,
+                                       bool /*is_interactive*/, gpointer data)
 {
     GtkWidget *tbl = GTK_WIDGET(data);
 
@@ -1518,6 +1718,9 @@ static void star_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const *n
 
     GtkAdjustment *adj = 0;
 
+    gchar const *flatsidedstr = prefs_get_string_attribute( "tools.shapes.star", "isflatsided" );
+    bool isFlatSided = flatsidedstr ? (strcmp(flatsidedstr, "false") != 0) : true;
+
     if (!strcmp(name, "inkscape:randomized")) {
         adj = GTK_ADJUSTMENT( gtk_object_get_data(GTK_OBJECT(tbl), "randomized") );
         gtk_adjustment_set_value(adj, sp_repr_get_double_attribute(repr, "inkscape:randomized", 0.0));
@@ -1535,7 +1738,7 @@ static void star_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const *n
             ege_select_one_action_set_active( flat_action, 0 );
             gtk_action_set_sensitive( prop_action, FALSE );
         }
-    } else if (!strcmp(name, "sodipodi:r1") || !strcmp(name, "sodipodi:r2")) {
+    } else if ((!strcmp(name, "sodipodi:r1") || !strcmp(name, "sodipodi:r2")) && (!isFlatSided) ) {
         adj = (GtkAdjustment*)gtk_object_get_data(GTK_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);
@@ -1605,7 +1808,7 @@ sp_star_toolbox_selection_changed(Inkscape::Selection *selection, GObject *tbl)
 }
 
 
-static void sp_stb_defaults( GtkWidget *widget, GObject *dataKludge )
+static void sp_stb_defaults( GtkWidget */*widget*/, GObject *dataKludge )
 {
     // FIXME: in this and all other _default functions, set some flag telling the value_changed
     // callbacks to lump all the changes for all selected objects in one undo step
@@ -1666,7 +1869,6 @@ static void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
     }
 
     {
-        //EgeAdjustmentAction* calligraphy_angle = 0;
         EgeAdjustmentAction* eact = 0;
         gchar const *flatsidedstr = prefs_get_string_attribute( "tools.shapes.star", "isflatsided" );
         bool isFlatSided = flatsidedstr ? (strcmp(flatsidedstr, "false") != 0) : true;
@@ -1690,7 +1892,7 @@ static void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
                                 2, "star_angled",
                                 -1 );
 
-            EgeSelectOneAction* act = ege_select_one_action_new( "FlatAction", _(""), _(""), NULL, GTK_TREE_MODEL(model) );
+            EgeSelectOneAction* act = ege_select_one_action_new( "FlatAction", (""), (""), NULL, GTK_TREE_MODEL(model) );
             gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
             g_object_set_data( holder, "flat_action", act );
 
@@ -1705,34 +1907,38 @@ static void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
         }
 
         /* Magnitude */
-        //gchar const* labels[] = {_("tri (default)"), _("quad"), _("pent")};
-        //gdouble values[] = {3, 4, 5};
+        {
+        gchar const* labels[] = {_("triangle/tri-star"), _("square/quad-star"), _("pentagon/five-pointed star"), _("hexagon/six-pointed star"), 0, 0, 0, 0, 0};
+        gdouble values[] = {3, 4, 5, 6, 7, 8, 10, 12, 20};
         eact = create_adjustment_action( "MagnitudeAction",
-                                         _("Corners:"), _("Number of corners of a polygon or star"),
+                                         _("Corners"), _("Corners:"), _("Number of corners of a polygon or star"),
                                          "tools.shapes.star", "magnitude", 3,
                                          GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
                                          3, 1024, 1, 5,
-                                         0, 0, 0, // labels, values, G_N_ELEMENTS(labels),
+                                         labels, values, G_N_ELEMENTS(labels),
                                          sp_stb_magnitude_value_changed,
                                          1.0, 0 );
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
         gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
+        }
 
         /* Spoke ratio */
-        //gchar const* labels2[] = {_("(left edge up)"), _("(horizontal)"), _("(default)"), _("(right edge up)")};
-        //gdouble values2[] = {-90, 0, 30, 90};
+        {
+        gchar const* labels[] = {_("thin-ray star"), 0, _("pentagram"), _("hexagram"), _("heptagram"), _("octagram"), _("regular polygon")};
+        gdouble values[] = {0.01, 0.2, 0.382, 0.577, 0.692, 0.765, 1};
         eact = create_adjustment_action( "SpokeAction",
-                                         _("Spoke ratio:"),
+                                         _("Spoke ratio"), _("Spoke ratio:"),
                                          // TRANSLATORS: Tip radius of a star is the distance from the center to the farthest handle.
                                          // Base radius is the same for the closest handle.
                                          _("Base radius to tip radius ratio"),
                                          "tools.shapes.star", "proportion", 0.5,
                                          GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
                                          0.01, 1.0, 0.01, 0.1,
-                                         0, 0, 0, // labels2, values2, G_N_ELEMENTS(labels2),
+                                         labels, values, G_N_ELEMENTS(labels),
                                          sp_stb_proportion_value_changed );
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
         g_object_set_data( holder, "prop_action", eact );
+        }
 
         if ( !isFlatSided ) {
             gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
@@ -1741,30 +1947,34 @@ static void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
         }
 
         /* Roundedness */
-        //gchar const* labels3[] = {_("(left edge up)"), _("(horizontal)"), _("(default)"), _("(right edge up)")};
-        //gdouble values3[] = {-90, 0, 30, 90};
+        {
+        gchar const* labels[] = {_("stretched"), _("twisted"), _("slightly pinched"), _("NOT rounded"), _("slightly rounded"), _("visibly rounded"), _("well rounded"), _("amply rounded"), 0, _("stretched"), _("blown up")};
+        gdouble values[] = {-1, -0.2, -0.03, 0, 0.05, 0.1, 0.2, 0.3, 0.5, 1, 10};
         eact = create_adjustment_action( "RoundednessAction",
-                                         _("Rounded:"), _("How much rounded are the corners (0 for sharp)"),
+                                         _("Rounded"), _("Rounded:"), _("How much rounded are the corners (0 for sharp)"),
                                          "tools.shapes.star", "rounded", 0.0,
                                          GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
-                                         -100.0, 100.0, 0.01, 0.1,
-                                         0, 0, 0, // labels3, values3, G_N_ELEMENTS(labels3),
+                                         -10.0, 10.0, 0.01, 0.1,
+                                         labels, values, G_N_ELEMENTS(labels),
                                          sp_stb_rounded_value_changed );
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
         gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
+        }
 
         /* Randomization */
-        //gchar const* labels4[] = {_("(left edge up)"), _("(horizontal)"), _("(default)"), _("(right edge up)")};
-        //gdouble values4[] = {-90, 0, 30, 90};
+        {
+        gchar const* labels[] = {_("NOT randomized"), _("slightly irregular"), _("visibly randomized"), _("strongly randomized"), _("blown up")};
+        gdouble values[] = {0, 0.01, 0.1, 0.5, 10};
         eact = create_adjustment_action( "RandomizationAction",
-                                         _("Randomized:"), _("Scatter randomly the corners and angles"),
+                                         _("Randomized"), _("Randomized:"), _("Scatter randomly the corners and angles"),
                                          "tools.shapes.star", "randomized", 0.0,
                                          GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
                                          -10.0, 10.0, 0.001, 0.01,
-                                         0, 0, 0, // labels4, values4, G_N_ELEMENTS(labels4),
+                                         labels, values, G_N_ELEMENTS(labels),
                                          sp_stb_randomized_value_changed, 0.1, 3 );
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
         gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
+        }
     }
 
     {
@@ -1877,7 +2087,7 @@ sp_rtb_height_value_changed(GtkAdjustment *adj, GObject *tbl)
 
 
 static void
-sp_rtb_defaults( GtkWidget *widget, GObject *obj)
+sp_rtb_defaults( GtkWidget */*widget*/, GObject *obj)
 {
     GtkAdjustment *adj = 0;
 
@@ -1893,9 +2103,9 @@ sp_rtb_defaults( GtkWidget *widget, GObject *obj)
     sp_rtb_sensitivize( obj );
 }
 
-static void rect_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const *name,
-                                       gchar const *old_value, gchar const *new_value,
-                                       bool is_interactive, gpointer data)
+static void rect_tb_event_attr_changed(Inkscape::XML::Node */*repr*/, gchar const */*name*/,
+                                       gchar const */*old_value*/, gchar const */*new_value*/,
+                                       bool /*is_interactive*/, gpointer data)
 {
     GObject *tbl = G_OBJECT(data);
 
@@ -2033,12 +2243,14 @@ static void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
 
     /* W */
     {
+        gchar const* labels[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+        gdouble values[] = {1, 2, 3, 5, 10, 20, 50, 100, 200, 500};
         eact = create_adjustment_action( "RectWidthAction",
-                                         _("W:"), _("Width of rectangle"),
+                                         _("Width"), _("W:"), _("Width of rectangle"),
                                          "tools.shapes.rect", "width", 0,
                                          GTK_WIDGET(desktop->canvas), NULL/*us*/, holder, TRUE, "altx-rect",
                                          0, 1e6, SPIN_STEP, SPIN_PAGE_STEP,
-                                         0, 0, 0,
+                                         labels, values, G_N_ELEMENTS(labels),
                                          sp_rtb_width_value_changed );
         tracker->addAdjustment( ege_adjustment_action_get_adjustment(eact) );
         g_object_set_data( holder, "width_action", eact );
@@ -2048,12 +2260,14 @@ static void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
 
     /* H */
     {
+        gchar const* labels[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+        gdouble values[] = {1, 2, 3, 5, 10, 20, 50, 100, 200, 500};
         eact = create_adjustment_action( "RectHeightAction",
-                                         _("H:"), _("Height of rectangle"),
+                                         _("Height"), _("H:"), _("Height of rectangle"),
                                          "tools.shapes.rect", "height", 0,
                                          GTK_WIDGET(desktop->canvas), NULL/*us*/, holder, FALSE, NULL,
                                          0, 1e6, SPIN_STEP, SPIN_PAGE_STEP,
-                                         0, 0, 0,
+                                         labels, values, G_N_ELEMENTS(labels),
                                          sp_rtb_height_value_changed );
         tracker->addAdjustment( ege_adjustment_action_get_adjustment(eact) );
         g_object_set_data( holder, "height_action", eact );
@@ -2063,12 +2277,14 @@ static void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
 
     /* rx */
     {
+        gchar const* labels[] = {_("not rounded"), 0, 0, 0, 0, 0, 0, 0, 0};
+        gdouble values[] = {0.5, 1, 2, 3, 5, 10, 20, 50, 100};
         eact = create_adjustment_action( "RadiusXAction",
-                                         _("Rx:"), _("Horizontal radius of rounded corners"),
+                                         _("Horizontal radius"), _("Rx:"), _("Horizontal radius of rounded corners"),
                                          "tools.shapes.rect", "rx", 0,
                                          GTK_WIDGET(desktop->canvas), NULL/*us*/, holder, FALSE, NULL,
                                          0, 1e6, SPIN_STEP, SPIN_PAGE_STEP,
-                                         0, 0, 0,
+                                         labels, values, G_N_ELEMENTS(labels),
                                          sp_rtb_rx_value_changed);
         tracker->addAdjustment( ege_adjustment_action_get_adjustment(eact) );
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
@@ -2076,12 +2292,14 @@ static void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
 
     /* ry */
     {
+        gchar const* labels[] = {_("not rounded"), 0, 0, 0, 0, 0, 0, 0, 0};
+        gdouble values[] = {0.5, 1, 2, 3, 5, 10, 20, 50, 100};
         eact = create_adjustment_action( "RadiusYAction",
-                                         _("Ry:"), _("Vertical radius of rounded corners"),
+                                         _("Vertical radius"), _("Ry:"), _("Vertical radius of rounded corners"),
                                          "tools.shapes.rect", "ry", 0,
                                          GTK_WIDGET(desktop->canvas), NULL/*us*/, holder, FALSE, NULL,
                                          0, 1e6, SPIN_STEP, SPIN_PAGE_STEP,
-                                         0, 0, 0,
+                                         labels, values, G_N_ELEMENTS(labels),
                                          sp_rtb_ry_value_changed);
         tracker->addAdjustment( ege_adjustment_action_get_adjustment(eact) );
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
@@ -2089,7 +2307,7 @@ static void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
 
     // add the units menu
     {
-        GtkAction* act = tracker->createAction( "RectUnitsAction", _("Units"), _("") );
+        GtkAction* act = tracker->createAction( "RectUnitsAction", _("Units"), ("") );
         gtk_action_group_add_action( mainActions, act );
     }
 
@@ -2120,71 +2338,362 @@ static void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
 //##       3D Box       ##
 //########################
 
-static void sp_3dbox_toggle_vp_changed( GtkToggleAction *act, gpointer data )
-{
-    SPDocument *document = sp_desktop_document (inkscape_active_desktop ());
-    Box3D::Axis axis = (Box3D::Axis) GPOINTER_TO_INT(data);
-
-    if (document->current_perspective) {
-        document->current_perspective->toggle_boxes (axis);
+// normalize angle so that it lies in the interval [0,360]
+static double box3d_normalize_angle (double a) {
+    double angle = a + ((int) (a/360.0))*360;
+    if (angle < 0) {
+        angle += 360.0;
     }
-    
+    return angle;
 }
 
-static void sp_3dbox_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
-{
-    SPDocument *document = sp_desktop_document (desktop);
-    bool toggled = false;
-    /* toggle VP in X direction */
-    {
-    InkToggleAction* act = ink_toggle_action_new( "3DBoxVPXAction",
-                                                  _("Toggle VP in X direction"),
-                                                  _("Toggle VP in X direction between 'finite' and 'infinite' (=parallel)"),
-                                                  "toggle_vp_x",
-                                                  Inkscape::ICON_SIZE_DECORATION );
-    gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
-    if (document->current_perspective) {
-        toggled = !document->current_perspective->get_vanishing_point(Box3D::X)->is_finite();
+static void
+box3d_set_button_and_adjustment(Persp3D *persp, Proj::Axis axis,
+                                GtkAdjustment *adj, GtkAction *act, GtkToggleAction *tact) {
+    // TODO: Take all selected perspectives into account but don't touch the state button if not all of them
+    //       have the same state (otherwise a call to box3d_vp_z_state_changed() is triggered and the states
+    //       are reset).
+    bool is_infinite = !persp3d_VP_is_finite(persp, axis);
+
+    if (is_infinite) {
+        gtk_toggle_action_set_active(tact, TRUE);
+        gtk_action_set_sensitive(act, TRUE);
+
+        double angle = persp3d_get_infinite_angle(persp, axis);
+        if (angle != NR_HUGE) { // FIXME: We should catch this error earlier (don't show the spinbutton at all)
+            gtk_adjustment_set_value(adj, box3d_normalize_angle(angle));
+        }
+    } else {
+        gtk_toggle_action_set_active(tact, FALSE);
+        gtk_action_set_sensitive(act, FALSE);
     }
-    gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), toggled );
-    /* we connect the signal after setting the state to avoid switching the state again */
-    g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_3dbox_toggle_vp_changed), GINT_TO_POINTER(Box3D::X));
+}
+
+static void
+box3d_resync_toolbar(Inkscape::XML::Node *persp_repr, GObject *data) {
+    if (!persp_repr) {
+        g_print ("No perspective given to box3d_resync_toolbar().\n");
+        return;
     }
 
-    /* toggle VP in Y direction */
+    GtkWidget *tbl = GTK_WIDGET(data);
+    GtkAdjustment *adj = 0;
+    GtkAction *act = 0;
+    GtkToggleAction *tact = 0;
+    Persp3D *persp = persp3d_get_from_repr(persp_repr);
     {
-    InkToggleAction* act = ink_toggle_action_new( "3DBoxVPYAction",
-                                                  _("Toggle VP in Y direction"),
-                                                  _("Toggle VP in Y direction between 'finite' and 'infinite' (=parallel)"),
-                                                  "toggle_vp_y",
-                                                  Inkscape::ICON_SIZE_DECORATION );
-    gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
-    if (document->current_perspective) {
-        toggled = !document->current_perspective->get_vanishing_point(Box3D::Y)->is_finite();
-    }
-    gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), toggled );
-    /* we connect the signal after setting the state to avoid switching the state again */
-    g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_3dbox_toggle_vp_changed), GINT_TO_POINTER(Box3D::Y));
-    }
+        adj = GTK_ADJUSTMENT(gtk_object_get_data(GTK_OBJECT(tbl), "box3d_angle_x"));
+        act = GTK_ACTION(g_object_get_data(G_OBJECT(tbl), "box3d_angle_x_action"));
+        tact = &INK_TOGGLE_ACTION(g_object_get_data(G_OBJECT(tbl), "box3d_vp_x_state_action"))->action;
 
-    /* toggle VP in Z direction */
+        box3d_set_button_and_adjustment(persp, Proj::X, adj, act, tact);
+    }
     {
-    InkToggleAction* act = ink_toggle_action_new( "3DBoxVPZAction",
-                                                  _("Toggle VP in Z direction"),
-                                                  _("Toggle VP in Z direction between 'finite' and 'infinite' (=parallel)"),
-                                                  "toggle_vp_z",
-                                                  Inkscape::ICON_SIZE_DECORATION );
-    gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
-    if (document->current_perspective) {
-        toggled = !document->current_perspective->get_vanishing_point(Box3D::Z)->is_finite();
+        adj = GTK_ADJUSTMENT(gtk_object_get_data(GTK_OBJECT(tbl), "box3d_angle_y"));
+        act = GTK_ACTION(g_object_get_data(G_OBJECT(tbl), "box3d_angle_y_action"));
+        tact = &INK_TOGGLE_ACTION(g_object_get_data(G_OBJECT(tbl), "box3d_vp_y_state_action"))->action;
+
+        box3d_set_button_and_adjustment(persp, Proj::Y, adj, act, tact);
     }
-    /* we connect the signal after setting the state to avoid switching the state again */
-    gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), toggled );
-    g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_3dbox_toggle_vp_changed), GINT_TO_POINTER(Box3D::Z));
+    {
+        adj = GTK_ADJUSTMENT(gtk_object_get_data(GTK_OBJECT(tbl), "box3d_angle_z"));
+        act = GTK_ACTION(g_object_get_data(G_OBJECT(tbl), "box3d_angle_z_action"));
+        tact = &INK_TOGGLE_ACTION(g_object_get_data(G_OBJECT(tbl), "box3d_vp_z_state_action"))->action;
+
+        box3d_set_button_and_adjustment(persp, Proj::Z, adj, act, tact);
     }
 }
 
-//########################
+static void box3d_persp_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const *name,
+                                                  gchar const */*old_value*/, gchar const */*new_value*/,
+                                                  bool /*is_interactive*/, gpointer data)
+{
+    GtkWidget *tbl = GTK_WIDGET(data);
+
+    // quit if run by the attr_changed listener
+    // note: it used to work without the differently called freeze_ attributes (here and in
+    //       box3d_angle_value_changed()) but I now it doesn't so I'm leaving them in for now
+    if (g_object_get_data(G_OBJECT(tbl), "freeze_angle")) {
+        return;
+    }
+
+    // set freeze so that it can be caught in box3d_angle_z_value_changed() (to avoid calling
+    // sp_document_maybe_done() when the document is undo insensitive)
+    g_object_set_data(G_OBJECT(tbl), "freeze_attr", GINT_TO_POINTER(TRUE));
+
+    // TODO: Only update the appropriate part of the toolbar
+//    if (!strcmp(name, "inkscape:vp_z")) {
+        box3d_resync_toolbar(repr, G_OBJECT(tbl));
+//    }
+
+    Persp3D *persp = persp3d_get_from_repr(repr);
+    persp3d_update_box_reprs(persp);
+
+    g_object_set_data(G_OBJECT(tbl), "freeze_attr", GINT_TO_POINTER(FALSE));
+}
+
+static Inkscape::XML::NodeEventVector box3d_persp_tb_repr_events =
+{
+    NULL, /* child_added */
+    NULL, /* child_removed */
+    box3d_persp_tb_event_attr_changed,
+    NULL, /* content_changed */
+    NULL  /* order_changed */
+};
+
+/**
+ *  \param selection Should not be NULL.
+ */
+// FIXME: This should rather be put into persp3d-reference.cpp or something similar so that it reacts upon each
+//        Change of the perspective, and not of the current selection (but how to refer to the toolbar then?)
+static void
+box3d_toolbox_selection_changed(Inkscape::Selection *selection, GObject *tbl)
+{
+    // Here the following should be done: If all selected boxes have finite VPs in a certain direction,
+    // disable the angle entry fields for this direction (otherwise entering a value in them should only
+    // update the perspectives with infinite VPs and leave the other ones untouched).
+
+    Inkscape::XML::Node *persp_repr = NULL;
+    purge_repr_listener(tbl, tbl);
+
+    SPItem *item = selection->singleItem();
+    if (item && SP_IS_BOX3D(item)) {
+        // FIXME: Also deal with multiple selected boxes
+        SPBox3D *box = SP_BOX3D(item);
+        Persp3D *persp = box3d_get_perspective(box);
+        persp_repr = SP_OBJECT_REPR(persp);
+        if (persp_repr) {
+            g_object_set_data(tbl, "repr", persp_repr);
+            Inkscape::GC::anchor(persp_repr);
+            sp_repr_add_listener(persp_repr, &box3d_persp_tb_repr_events, tbl);
+            sp_repr_synthesize_events(persp_repr, &box3d_persp_tb_repr_events, tbl);
+        }
+
+        inkscape_active_document()->current_persp3d = persp3d_get_from_repr(persp_repr);
+        prefs_set_string_attribute("tools.shapes.3dbox", "persp", persp_repr->attribute("id"));
+    
+        box3d_resync_toolbar(persp_repr, tbl);
+    }
+}
+
+static void
+box3d_angle_value_changed(GtkAdjustment *adj, GObject *dataKludge, Proj::Axis axis)
+{
+    SPDesktop *desktop = (SPDesktop *) g_object_get_data( dataKludge, "desktop" );
+    SPDocument *document = sp_desktop_document(desktop);
+
+    // quit if run by the attr_changed listener
+    // note: it used to work without the differently called freeze_ attributes (here and in
+    //       box3d_persp_tb_event_attr_changed()) but I now it doesn't so I'm leaving them in for now
+    if (g_object_get_data( dataKludge, "freeze_attr" )) {
+        return;
+    }
+
+    // in turn, prevent listener from responding
+    g_object_set_data(dataKludge, "freeze_angle", GINT_TO_POINTER(TRUE));
+
+    //Persp3D *persp = document->current_persp3d;
+    std::set<Persp3D *> sel_persps = persp3d_currently_selected_persps (inkscape_active_event_context());
+    if (sel_persps.empty()) {
+        // this can happen when the document is created; we silently ignore it
+        return;
+    }
+    Persp3D *persp = *(sel_persps.begin());
+
+    persp->tmat.set_infinite_direction (axis, adj->value);
+    SP_OBJECT(persp)->updateRepr();
+
+    // TODO: use the correct axis here, too
+    sp_document_maybe_done(document, "perspangle", SP_VERB_CONTEXT_3DBOX, _("3D Box: Change perspective (angle of infinite axis)"));
+
+    g_object_set_data( dataKludge, "freeze_angle", GINT_TO_POINTER(FALSE) );
+}
+
+
+static void
+box3d_angle_x_value_changed(GtkAdjustment *adj, GObject *dataKludge)
+{
+    box3d_angle_value_changed(adj, dataKludge, Proj::X);
+}
+
+static void
+box3d_angle_y_value_changed(GtkAdjustment *adj, GObject *dataKludge)
+{
+    box3d_angle_value_changed(adj, dataKludge, Proj::Y);
+}
+
+static void
+box3d_angle_z_value_changed(GtkAdjustment *adj, GObject *dataKludge)
+{
+    box3d_angle_value_changed(adj, dataKludge, Proj::Z);
+}
+
+
+static void box3d_vp_state_changed( GtkToggleAction *act, GtkAction *box3d_angle, Proj::Axis axis )
+{
+    // TODO: Take all selected perspectives into account
+    std::set<Persp3D *> sel_persps = persp3d_currently_selected_persps (inkscape_active_event_context());
+    if (sel_persps.empty()) {
+        // this can happen when the document is created; we silently ignore it
+        return;
+    }
+    Persp3D *persp = *(sel_persps.begin());
+
+    bool set_infinite = gtk_toggle_action_get_active(act);
+    persp3d_set_VP_state (persp, axis, set_infinite ? Proj::VP_INFINITE : Proj::VP_FINITE);
+}
+
+static void box3d_vp_x_state_changed( GtkToggleAction *act, GtkAction *box3d_angle )
+{
+    box3d_vp_state_changed(act, box3d_angle, Proj::X);
+}
+
+static void box3d_vp_y_state_changed( GtkToggleAction *act, GtkAction *box3d_angle )
+{
+    box3d_vp_state_changed(act, box3d_angle, Proj::Y);
+}
+
+static void box3d_vp_z_state_changed( GtkToggleAction *act, GtkAction *box3d_angle )
+{
+    box3d_vp_state_changed(act, box3d_angle, Proj::Z);
+}
+
+static void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
+{
+    EgeAdjustmentAction* eact = 0;
+    SPDocument *document = sp_desktop_document (desktop);
+    Persp3D *persp = document->current_persp3d;
+
+    EgeAdjustmentAction* box3d_angle_x = 0;
+    EgeAdjustmentAction* box3d_angle_y = 0;
+    EgeAdjustmentAction* box3d_angle_z = 0;
+
+    /* Angle X */
+    {
+        gchar const* labels[] = { 0, 0, 0, 0, 0, 0, 0 };
+        gdouble values[] = {-90, -60, -30, 0, 30, 60, 90};
+        eact = create_adjustment_action( "3DBoxAngleXAction",
+                                         _("Angle in X direction"), _("Angle X:"),
+                                         // Translators: PL is short for 'perspective line'
+                                         _("Angle of PLs in X direction"),
+                                         "tools.shapes.3dbox", "box3d_angle_x", 30,
+                                         GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "altx-box3d",
+                                         -360.0, 360.0, 1.0, 10.0,
+                                         labels, values, G_N_ELEMENTS(labels),
+                                         box3d_angle_x_value_changed );
+        gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
+        g_object_set_data( holder, "box3d_angle_x_action", eact );
+        box3d_angle_x = eact;
+    }
+
+    if (!persp3d_VP_is_finite(persp, Proj::X)) {
+        gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
+    } else {
+        gtk_action_set_sensitive( GTK_ACTION(eact), FALSE );
+    }
+
+
+    /* VP X state */
+    {
+        InkToggleAction* act = ink_toggle_action_new( "3DBoxVPXStateAction",
+                                                      // Translators: VP is short for 'vanishing point'
+                                                      _("State of VP in X direction"),
+                                                      _("Toggle VP in X direction between 'finite' and 'infinite' (=parallel)"),
+                                                      "toggle_vp_x",
+                                                      Inkscape::ICON_SIZE_DECORATION );
+        gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
+        g_object_set_data( holder, "box3d_vp_x_state_action", act );
+        g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(box3d_vp_x_state_changed), box3d_angle_x );
+        gtk_action_set_sensitive( GTK_ACTION(box3d_angle_x), !prefs_get_int_attribute( "tools.shapes.3dbox", "vp_x_state", 1 ) );
+        gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.shapes.3dbox", "vp_x_state", 1 ) );
+    }
+
+    /* Angle Y */
+    {
+        gchar const* labels[] = { 0, 0, 0, 0, 0, 0, 0 };
+        gdouble values[] = {-90, -60, -30, 0, 30, 60, 90};
+        eact = create_adjustment_action( "3DBoxAngleYAction",
+                                         _("Angle in Y direction"), _("Angle Y:"),
+                                         // Translators: PL is short for 'perspective line'
+                                         _("Angle of PLs in Y direction"),
+                                         "tools.shapes.3dbox", "box3d_angle_y", 30,
+                                         GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
+                                         -360.0, 360.0, 1.0, 10.0,
+                                         labels, values, G_N_ELEMENTS(labels),
+                                         box3d_angle_y_value_changed );
+        gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
+        g_object_set_data( holder, "box3d_angle_y_action", eact );
+        box3d_angle_y = eact;
+    }
+
+    if (!persp3d_VP_is_finite(persp, Proj::Y)) {
+        gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
+    } else {
+        gtk_action_set_sensitive( GTK_ACTION(eact), FALSE );
+    }
+
+    /* VP Y state */
+    {
+        InkToggleAction* act = ink_toggle_action_new( "3DBoxVPYStateAction",
+                                                      // Translators: VP is short for 'vanishing point'
+                                                      _("State of VP in Y direction"),
+                                                      _("Toggle VP in Y direction between 'finite' and 'infinite' (=parallel)"),
+                                                      "toggle_vp_y",
+                                                      Inkscape::ICON_SIZE_DECORATION );
+        gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
+        g_object_set_data( holder, "box3d_vp_y_state_action", act );
+        g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(box3d_vp_y_state_changed), box3d_angle_y );
+        gtk_action_set_sensitive( GTK_ACTION(box3d_angle_y), !prefs_get_int_attribute( "tools.shapes.3dbox", "vp_y_state", 1 ) );
+        gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.shapes.3dbox", "vp_y_state", 1 ) );
+    }
+
+    /* Angle Z */
+    {
+        gchar const* labels[] = { 0, 0, 0, 0, 0, 0, 0 };
+        gdouble values[] = {-90, -60, -30, 0, 30, 60, 90};
+        eact = create_adjustment_action( "3DBoxAngleZAction",
+                                         _("Angle in Z direction"), _("Angle Z:"),
+                                         // Translators: PL is short for 'perspective line'
+                                         _("Angle of PLs in Z direction"),
+                                         "tools.shapes.3dbox", "box3d_angle_z", 30,
+                                         GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
+                                         -360.0, 360.0, 1.0, 10.0,
+                                         labels, values, G_N_ELEMENTS(labels),
+                                         box3d_angle_z_value_changed );
+        gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
+        g_object_set_data( holder, "box3d_angle_z_action", eact );
+        box3d_angle_z = eact;
+    }
+
+    if (!persp3d_VP_is_finite(persp, Proj::Z)) {
+        gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
+    } else {
+        gtk_action_set_sensitive( GTK_ACTION(eact), FALSE );
+    }
+
+    /* VP Z state */
+    {
+        InkToggleAction* act = ink_toggle_action_new( "3DBoxVPZStateAction",
+                                                      // Translators: VP is short for 'vanishing point'
+                                                      _("State of VP in Z direction"),
+                                                      _("Toggle VP in Z direction between 'finite' and 'infinite' (=parallel)"),
+                                                      "toggle_vp_z",
+                                                      Inkscape::ICON_SIZE_DECORATION );
+        gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
+        g_object_set_data( holder, "box3d_vp_z_state_action", act );
+        g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(box3d_vp_z_state_changed), box3d_angle_z );
+        gtk_action_set_sensitive( GTK_ACTION(box3d_angle_z), !prefs_get_int_attribute( "tools.shapes.3dbox", "vp_z_state", 1 ) );
+        gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.shapes.3dbox", "vp_z_state", 1 ) );
+    }
+
+    sigc::connection *connection = new sigc::connection(
+        sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(box3d_toolbox_selection_changed), (GObject *)holder))
+       );
+    g_signal_connect(holder, "destroy", G_CALLBACK(delete_connection), connection);
+    g_signal_connect(holder, "destroy", G_CALLBACK(purge_repr_listener), holder);
+}
+
+//########################
 //##       Spiral       ##
 //########################
 
@@ -2249,7 +2758,7 @@ sp_spl_tb_t0_value_changed(GtkAdjustment *adj, GObject *tbl)
 }
 
 static void
-sp_spl_tb_defaults(GtkWidget *widget, GtkObject *obj)
+sp_spl_tb_defaults(GtkWidget */*widget*/, GtkObject *obj)
 {
     GtkWidget *tbl = GTK_WIDGET(obj);
 
@@ -2276,9 +2785,9 @@ sp_spl_tb_defaults(GtkWidget *widget, GtkObject *obj)
 }
 
 
-static void spiral_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const *name,
-                                         gchar const *old_value, gchar const *new_value,
-                                         bool is_interactive, gpointer data)
+static void spiral_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const */*name*/,
+                                         gchar const */*old_value*/, gchar const */*new_value*/,
+                                         bool /*is_interactive*/, gpointer data)
 {
     GtkWidget *tbl = GTK_WIDGET(data);
 
@@ -2364,36 +2873,42 @@ static void sp_spiral_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActio
 
     /* Revolution */
     {
+        gchar const* labels[] = {_("just a curve"), 0, _("one full revolution"), 0, 0, 0, 0, 0, 0};
+        gdouble values[] = {0.01, 0.5, 1, 2, 3, 5, 10, 20, 50, 100};
         eact = create_adjustment_action( "SpiralRevolutionAction",
-                                         _("Turns:"), _("Number of revolutions"),
+                                         _("Number of turns"), _("Turns:"), _("Number of revolutions"),
                                          "tools.shapes.spiral", "revolution", 3.0,
                                          GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "altx-spiral",
                                          0.01, 1024.0, 0.1, 1.0,
-                                         0, 0, 0,
+                                         labels, values, G_N_ELEMENTS(labels),
                                          sp_spl_tb_revolution_value_changed, 1, 2);
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
     }
 
     /* Expansion */
     {
+        gchar const* labels[] = {_("circle"), _("edge is much denser"), _("edge is denser"), _("even"), _("center is denser"), _("center is much denser"), 0};
+        gdouble values[] = {0, 0.1, 0.5, 1, 1.5, 5, 20};
         eact = create_adjustment_action( "SpiralExpansionAction",
-                                         _("Divergence:"), _("How much denser/sparser are outer revolutions; 1 = uniform"),
+                                         _("Divergence"), _("Divergence:"), _("How much denser/sparser are outer revolutions; 1 = uniform"),
                                          "tools.shapes.spiral", "expansion", 1.0,
                                          GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
                                          0.0, 1000.0, 0.01, 1.0,
-                                         0, 0, 0,
+                                         labels, values, G_N_ELEMENTS(labels),
                                          sp_spl_tb_expansion_value_changed);
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
     }
 
     /* T0 */
     {
+        gchar const* labels[] = {_("starts from center"), _("starts mid-way"), _("starts near edge")};
+        gdouble values[] = {0, 0.5, 0.9};
         eact = create_adjustment_action( "SpiralT0Action",
-                                         _("Inner radius:"), _("Radius of the innermost revolution (relative to the spiral size)"),
+                                         _("Inner radius"), _("Inner radius:"), _("Radius of the innermost revolution (relative to the spiral size)"),
                                          "tools.shapes.spiral", "t0", 0.0,
                                          GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
                                          0.0, 0.999, 0.01, 1.0,
-                                         0, 0, 0,
+                                         labels, values, G_N_ELEMENTS(labels),
                                          sp_spl_tb_t0_value_changed);
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
     }
@@ -2422,12 +2937,12 @@ static void sp_spiral_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActio
 //########################
 
 
-static void sp_pen_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
+static void sp_pen_toolbox_prep(SPDesktop */*desktop*/, GtkActionGroup* /*mainActions*/, GObject* /*holder*/)
 {
     // Put stuff here
 }
 
-static void sp_pencil_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
+static void sp_pencil_toolbox_prep(SPDesktop */*desktop*/, GtkActionGroup* /*mainActions*/, GObject* /*holder*/)
 {
     // Put stuff here
 }
@@ -2436,31 +2951,70 @@ static void sp_pencil_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActio
 //##       Tweak        ##
 //########################
 
-static void sp_tweak_width_value_changed( GtkAdjustment *adj, GObject *tbl )
+static void sp_tweak_width_value_changed( GtkAdjustment *adj, GObject */*tbl*/ )
 {
     prefs_set_double_attribute( "tools.tweak", "width", adj->value * 0.01 );
 }
 
-static void sp_tweak_force_value_changed( GtkAdjustment *adj, GObject *tbl )
+static void sp_tweak_force_value_changed( GtkAdjustment *adj, GObject */*tbl*/ )
 {
     prefs_set_double_attribute( "tools.tweak", "force", adj->value * 0.01 );
 }
 
-static void sp_tweak_pressure_state_changed( GtkToggleAction *act, gpointer data )
+static void sp_tweak_pressure_state_changed( GtkToggleAction *act, gpointer /*data*/ )
 {
     prefs_set_int_attribute( "tools.tweak", "usepressure", gtk_toggle_action_get_active( act ) ? 1 : 0);
 }
 
 static void sp_tweak_mode_changed( EgeSelectOneAction *act, GObject *tbl )
 {
-    prefs_set_int_attribute("tools.tweak", "mode", ege_select_one_action_get_active( act ));
+    int mode = ege_select_one_action_get_active( act );
+    prefs_set_int_attribute("tools.tweak", "mode", mode);
+
+    GtkAction *doh = GTK_ACTION(g_object_get_data( tbl, "tweak_doh"));
+    GtkAction *dos = GTK_ACTION(g_object_get_data( tbl, "tweak_dos"));
+    GtkAction *dol = GTK_ACTION(g_object_get_data( tbl, "tweak_dol"));
+    GtkAction *doo = GTK_ACTION(g_object_get_data( tbl, "tweak_doo"));
+    GtkAction *fid = GTK_ACTION(g_object_get_data( tbl, "tweak_fidelity"));
+    GtkAction *dolabel = GTK_ACTION(g_object_get_data( tbl, "tweak_channels_label"));
+    if (mode == TWEAK_MODE_COLORPAINT || mode == TWEAK_MODE_COLORJITTER) {
+        if (doh) gtk_action_set_sensitive (doh, TRUE);
+        if (dos) gtk_action_set_sensitive (dos, TRUE);
+        if (dol) gtk_action_set_sensitive (dol, TRUE);
+        if (doo) gtk_action_set_sensitive (doo, TRUE);
+        if (dolabel) gtk_action_set_sensitive (dolabel, TRUE);
+        if (fid) gtk_action_set_sensitive (fid, FALSE);
+    } else {
+        if (doh) gtk_action_set_sensitive (doh, FALSE);
+        if (dos) gtk_action_set_sensitive (dos, FALSE);
+        if (dol) gtk_action_set_sensitive (dol, FALSE);
+        if (doo) gtk_action_set_sensitive (doo, FALSE);
+        if (dolabel) gtk_action_set_sensitive (dolabel, FALSE);
+        if (fid) gtk_action_set_sensitive (fid, TRUE);
+    }
 }
 
-static void sp_tweak_fidelity_value_changed( GtkAdjustment *adj, GObject *tbl )
+static void sp_tweak_fidelity_value_changed( GtkAdjustment *adj, GObject */*tbl*/ )
 {
     prefs_set_double_attribute( "tools.tweak", "fidelity", adj->value * 0.01 );
 }
 
+static void tweak_toggle_doh (GtkToggleAction *act, gpointer /*data*/) {
+    bool show = gtk_toggle_action_get_active( act );
+    prefs_set_int_attribute ("tools.tweak", "doh",  show ? 1 : 0);
+}
+static void tweak_toggle_dos (GtkToggleAction *act, gpointer /*data*/) {
+    bool show = gtk_toggle_action_get_active( act );
+    prefs_set_int_attribute ("tools.tweak", "dos",  show ? 1 : 0);
+}
+static void tweak_toggle_dol (GtkToggleAction *act, gpointer /*data*/) {
+    bool show = gtk_toggle_action_get_active( act );
+    prefs_set_int_attribute ("tools.tweak", "dol",  show ? 1 : 0);
+}
+static void tweak_toggle_doo (GtkToggleAction *act, gpointer /*data*/) {
+    bool show = gtk_toggle_action_get_active( act );
+    prefs_set_int_attribute ("tools.tweak", "doo",  show ? 1 : 0);
+}
 
 static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
 {
@@ -2469,7 +3023,7 @@ static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
         gchar const* labels[] = {_("(pinch tweak)"), 0, 0, 0, _("(default)"), 0, 0, 0, 0, _("(broad tweak)")};
         gdouble values[] = {1, 3, 5, 10, 15, 20, 30, 50, 75, 100};
         EgeAdjustmentAction *eact = create_adjustment_action( "TweakWidthAction",
-                                                              _("Width:"), _("The width of the tweak area (relative to the visible canvas area)"),
+                                                              _("Width"), _("Width:"), _("The width of the tweak area (relative to the visible canvas area)"),
                                                               "tools.tweak", "width", 15,
                                                               GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "altx-tweak",
                                                               1, 100, 1.0, 10.0,
@@ -2485,7 +3039,7 @@ static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
         gchar const* labels[] = {_("(minimum force)"), 0, 0, _("(default)"), 0, 0, 0, _("(maximum force)")};
         gdouble values[] = {1, 5, 10, 20, 30, 50, 70, 100};
         EgeAdjustmentAction *eact = create_adjustment_action( "TweakForceAction",
-                                                              _("Force:"), _("The force of the tweak action"),
+                                                              _("Force"), _("Force:"), _("The force of the tweak action"),
                                                               "tools.tweak", "force", 20,
                                                               GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "tweak-force",
                                                               1, 100, 1.0, 10.0,
@@ -2503,32 +3057,61 @@ static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
         gtk_list_store_append( model, &iter );
         gtk_list_store_set( model, &iter,
                             0, _("Push mode"),
-                            1, _("Switch to Push mode"),
+                            1, _("Push parts of paths in any direction"),
                             2, "tweak_push_mode",
                             -1 );
 
         gtk_list_store_append( model, &iter );
         gtk_list_store_set( model, &iter,
-                            0, _("Melt mode"),
-                            1, _("Switch to Melt mode"),
-                            2, "tweak_suck_mode",
+                            0, _("Shrink mode"),
+                            1, _("Shrink (inset) parts of paths"),
+                            2, "tweak_shrink_mode",
                             -1 );
 
         gtk_list_store_append( model, &iter );
         gtk_list_store_set( model, &iter,
-                            0, _("Inflate mode"),
-                            1, _("Switch to Inflate mode"),
-                            2, "tweak_inflate_mode",
+                            0, _("Grow mode"),
+                            1, _("Grow (outset) parts of paths"),
+                            2, "tweak_grow_mode",
+                            -1 );
+
+        gtk_list_store_append( model, &iter );
+        gtk_list_store_set( model, &iter,
+                            0, _("Attract mode"),
+                            1, _("Attract parts of paths towards cursor"),
+                            2, "tweak_attract_mode",
+                            -1 );
+
+        gtk_list_store_append( model, &iter );
+        gtk_list_store_set( model, &iter,
+                            0, _("Repel mode"),
+                            1, _("Repel parts of paths from cursor"),
+                            2, "tweak_repel_mode",
                             -1 );
 
         gtk_list_store_append( model, &iter );
         gtk_list_store_set( model, &iter,
                             0, _("Roughen mode"),
-                            1, _("Switch to Roughen mode"),
+                            1, _("Roughen parts of paths"),
                             2, "tweak_roughen_mode",
                             -1 );
 
-        EgeSelectOneAction* act = ege_select_one_action_new( "TweakModeAction", _(""), _(""), NULL, GTK_TREE_MODEL(model) );
+        gtk_list_store_append( model, &iter );
+        gtk_list_store_set( model, &iter,
+                            0, _("Color paint mode"),
+                            1, _("Paint the tool's color upon selected objects"),
+                            2, "tweak_colorpaint_mode",
+                            -1 );
+
+        gtk_list_store_append( model, &iter );
+        gtk_list_store_set( model, &iter,
+                            0, _("Color jitter mode"),
+                            1, _("Jitter the colors of selected objects"),
+                            2, "tweak_colorjitter_mode",
+                            -1 );
+
+        EgeSelectOneAction* act = ege_select_one_action_new( "TweakModeAction", _("Mode"), (""), NULL, GTK_TREE_MODEL(model) );
+        g_object_set( act, "short_label", _("Mode:"), NULL );
         gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
         g_object_set_data( holder, "mode_action", act );
 
@@ -2545,11 +3128,80 @@ static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
         g_object_set_data( G_OBJECT(holder), "tweak_tool_mode", act);
     }
 
+    guint mode = prefs_get_int_attribute("tools.tweak", "mode", 0);
+
+    {
+        EgeOutputAction* act = ege_output_action_new( "TweakChannelsLabel", _("Channels:"), "", 0 );
+        ege_output_action_set_use_markup( act, TRUE );
+        gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
+        if (mode != TWEAK_MODE_COLORPAINT && mode != TWEAK_MODE_COLORJITTER)
+            gtk_action_set_sensitive (GTK_ACTION(act), FALSE);
+        g_object_set_data( holder, "tweak_channels_label", act);
+    }
+
+    {
+        InkToggleAction* act = ink_toggle_action_new( "TweakDoH",
+                                                      _("Hue"),
+                                                      _("In color mode, act on objects' hue"),
+                                                      NULL,
+                                                      Inkscape::ICON_SIZE_DECORATION );
+        g_object_set( act, "short_label", _("H"), NULL );
+        gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
+        g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(tweak_toggle_doh), desktop );
+        gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.tweak", "doh", 1 ) );
+        if (mode != TWEAK_MODE_COLORPAINT && mode != TWEAK_MODE_COLORJITTER)
+            gtk_action_set_sensitive (GTK_ACTION(act), FALSE);
+        g_object_set_data( holder, "tweak_doh", act);
+    }
+    {
+        InkToggleAction* act = ink_toggle_action_new( "TweakDoS",
+                                                      _("Saturation"),
+                                                      _("In color mode, act on objects' saturation"),
+                                                      NULL,
+                                                      Inkscape::ICON_SIZE_DECORATION );
+        g_object_set( act, "short_label", _("S"), NULL );
+        gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
+        g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(tweak_toggle_dos), desktop );
+        gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.tweak", "dos", 1 ) );
+        if (mode != TWEAK_MODE_COLORPAINT && mode != TWEAK_MODE_COLORJITTER)
+            gtk_action_set_sensitive (GTK_ACTION(act), FALSE);
+        g_object_set_data( holder, "tweak_dos", act );
+    }
+    {
+        InkToggleAction* act = ink_toggle_action_new( "TweakDoL",
+                                                      _("Lightness"),
+                                                      _("In color mode, act on objects' lightness"),
+                                                      NULL,
+                                                      Inkscape::ICON_SIZE_DECORATION );
+        g_object_set( act, "short_label", _("L"), NULL );
+        gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
+        g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(tweak_toggle_dol), desktop );
+        gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.tweak", "dol", 1 ) );
+        if (mode != TWEAK_MODE_COLORPAINT && mode != TWEAK_MODE_COLORJITTER)
+            gtk_action_set_sensitive (GTK_ACTION(act), FALSE);
+        g_object_set_data( holder, "tweak_dol", act );
+    }
+    {
+        InkToggleAction* act = ink_toggle_action_new( "TweakDoO",
+                                                      _("Opacity"),
+                                                      _("In color mode, act on objects' opacity"),
+                                                      NULL,
+                                                      Inkscape::ICON_SIZE_DECORATION );
+        g_object_set( act, "short_label", _("O"), NULL );
+        gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
+        g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(tweak_toggle_doo), desktop );
+        gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.tweak", "doo", 1 ) );
+        if (mode != TWEAK_MODE_COLORPAINT && mode != TWEAK_MODE_COLORJITTER)
+            gtk_action_set_sensitive (GTK_ACTION(act), FALSE);
+        g_object_set_data( holder, "tweak_doo", act );
+    }
+
     {   /* Fidelity */
         gchar const* labels[] = {_("(rough, simplified)"), 0, 0, _("(default)"), 0, 0, _("(fine, but many nodes)")};
         gdouble values[] = {10, 25, 35, 50, 60, 80, 100};
         EgeAdjustmentAction *eact = create_adjustment_action( "TweakFidelityAction",
-                                                              _("Fidelity:"), _("Low fidelity simplifies paths; high fidelity preserves path features but may generate a lot of new nodes"),
+                                                              _("Fidelity"), _("Fidelity:"),
+                                                              _("Low fidelity simplifies paths; high fidelity preserves path features but may generate a lot of new nodes"),
                                                               "tools.tweak", "fidelity", 50,
                                                               GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "tweak-fidelity",
                                                               1, 100, 1.0, 10.0,
@@ -2557,6 +3209,9 @@ static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
                                                               sp_tweak_fidelity_value_changed,  0.01, 0, 100 );
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
         gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
+        if (mode == TWEAK_MODE_COLORPAINT || mode == TWEAK_MODE_COLORJITTER)
+            gtk_action_set_sensitive (GTK_ACTION(eact), FALSE);
+        g_object_set_data( holder, "tweak_fidelity", eact );
     }
 
 
@@ -2564,7 +3219,7 @@ static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
     {
         InkToggleAction* act = ink_toggle_action_new( "TweakPressureAction",
                                                       _("Pressure"),
-                                                      _("Use the pressure of the input device to alter the width of the area"),
+                                                      _("Use the pressure of the input device to alter the force of tweak action"),
                                                       "use_pressure",
                                                       Inkscape::ICON_SIZE_DECORATION );
         gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
@@ -2579,52 +3234,52 @@ static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
 //##     Calligraphy    ##
 //########################
 
-static void sp_ddc_mass_value_changed( GtkAdjustment *adj, GObject* tbl )
+static void sp_ddc_mass_value_changed( GtkAdjustment *adj, GObject* /*tbl*/ )
 {
     prefs_set_double_attribute( "tools.calligraphic", "mass", adj->value );
 }
 
-static void sp_ddc_wiggle_value_changed( GtkAdjustment *adj, GObject* tbl )
+static void sp_ddc_wiggle_value_changed( GtkAdjustment *adj, GObject* /*tbl*/ )
 {
     prefs_set_double_attribute( "tools.calligraphic", "wiggle", adj->value );
 }
 
-static void sp_ddc_angle_value_changed( GtkAdjustment *adj, GObject* tbl )
+static void sp_ddc_angle_value_changed( GtkAdjustment *adj, GObject* /*tbl*/ )
 {
     prefs_set_double_attribute( "tools.calligraphic", "angle", adj->value );
 }
 
-static void sp_ddc_width_value_changed( GtkAdjustment *adj, GObject *tbl )
+static void sp_ddc_width_value_changed( GtkAdjustment *adj, GObject */*tbl*/ )
 {
     prefs_set_double_attribute( "tools.calligraphic", "width", adj->value * 0.01 );
 }
 
-static void sp_ddc_velthin_value_changed( GtkAdjustment *adj, GObject* tbl )
+static void sp_ddc_velthin_value_changed( GtkAdjustment *adj, GObject* /*tbl*/ )
 {
     prefs_set_double_attribute("tools.calligraphic", "thinning", adj->value);
 }
 
-static void sp_ddc_flatness_value_changed( GtkAdjustment *adj, GObject* tbl )
+static void sp_ddc_flatness_value_changed( GtkAdjustment *adj, GObject* /*tbl*/ )
 {
     prefs_set_double_attribute( "tools.calligraphic", "flatness", adj->value );
 }
 
-static void sp_ddc_tremor_value_changed( GtkAdjustment *adj, GObject* tbl )
+static void sp_ddc_tremor_value_changed( GtkAdjustment *adj, GObject* /*tbl*/ )
 {
     prefs_set_double_attribute( "tools.calligraphic", "tremor", adj->value );
 }
 
-static void sp_ddc_cap_rounding_value_changed( GtkAdjustment *adj, GObject* tbl )
+static void sp_ddc_cap_rounding_value_changed( GtkAdjustment *adj, GObject* /*tbl*/ )
 {
     prefs_set_double_attribute( "tools.calligraphic", "cap_rounding", adj->value );
 }
 
-static void sp_ddc_pressure_state_changed( GtkToggleAction *act, gpointer data )
+static void sp_ddc_pressure_state_changed( GtkToggleAction *act, gpointer /*data*/ )
 {
     prefs_set_int_attribute( "tools.calligraphic", "usepressure", gtk_toggle_action_get_active( act ) ? 1 : 0);
 }
 
-static void sp_ddc_trace_background_changed( GtkToggleAction *act, gpointer data )
+static void sp_ddc_trace_background_changed( GtkToggleAction *act, gpointer /*data*/ )
 {
     prefs_set_int_attribute( "tools.calligraphic", "tracebackground", gtk_toggle_action_get_active( act ) ? 1 : 0);
 }
@@ -2673,12 +3328,13 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
         gchar const* labels[] = {_("(hairline)"), 0, 0, 0, _("(default)"), 0, 0, 0, 0, _("(broad stroke)")};
         gdouble values[] = {1, 3, 5, 10, 15, 20, 30, 50, 75, 100};
         EgeAdjustmentAction *eact = create_adjustment_action( "CalligraphyWidthAction",
-                                         _("Width:"), _("The width of the calligraphic pen (relative to the visible canvas area)"),
-                                         "tools.calligraphic", "width", 15,
-                                         GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "altx-calligraphy",
-                                         1, 100, 1.0, 10.0,
-                                         labels, values, G_N_ELEMENTS(labels),
-                                         sp_ddc_width_value_changed,  0.01, 0, 100 );
+                                                              _("Pen Width"), _("Width:"),
+                                                              _("The width of the calligraphic pen (relative to the visible canvas area)"),
+                                                              "tools.calligraphic", "width", 15,
+                                                              GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "altx-calligraphy",
+                                                              1, 100, 1.0, 10.0,
+                                                              labels, values, G_N_ELEMENTS(labels),
+                                                              sp_ddc_width_value_changed,  0.01, 0, 100 );
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
         gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
         }
@@ -2688,12 +3344,13 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
             gchar const* labels[] = {_("(speed blows up stroke)"), 0, 0, _("(slight widening)"), _("(constant width)"), _("(slight thinning, default)"), 0, 0, _("(speed deflates stroke)")};
             gdouble values[] = {-1, -0.4, -0.2, -0.1, 0, 0.1, 0.2, 0.4, 1};
         EgeAdjustmentAction* eact = create_adjustment_action( "ThinningAction",
-                                         _("Thinning:"), _("How much velocity thins the stroke (> 0 makes fast strokes thinner, < 0 makes them broader, 0 makes width independent of velocity)"),
-                                         "tools.calligraphic", "thinning", 0.1,
-                                         GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
-                                         -1.0, 1.0, 0.01, 0.1,
-                                         labels, values, G_N_ELEMENTS(labels),
-                                         sp_ddc_velthin_value_changed, 0.01, 2);
+                                                              _("Stroke Thinning"), _("Thinning:"),
+                                                              _("How much velocity thins the stroke (> 0 makes fast strokes thinner, < 0 makes them broader, 0 makes width independent of velocity)"),
+                                                              "tools.calligraphic", "thinning", 0.1,
+                                                              GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
+                                                              -1.0, 1.0, 0.01, 0.1,
+                                                              labels, values, G_N_ELEMENTS(labels),
+                                                              sp_ddc_velthin_value_changed, 0.01, 2);
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
         gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
         }
@@ -2703,12 +3360,13 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
         gchar const* labels[] = {_("(left edge up)"), 0, 0, _("(horizontal)"), _("(default)"), 0, _("(right edge up)")};
         gdouble values[] = {-90, -60, -30, 0, 30, 60, 90};
         EgeAdjustmentAction* eact = create_adjustment_action( "AngleAction",
-                                         _("Angle:"), _("The angle of the pen's nib (in degrees; 0 = horizontal; has no effect if fixation = 0)"),
-                                         "tools.calligraphic", "angle", 30,
-                                         GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "calligraphy-angle",
-                                         -90.0, 90.0, 1.0, 10.0,
-                                         labels, values, G_N_ELEMENTS(labels),
-                                         sp_ddc_angle_value_changed, 1, 0 );
+                                                              _("Pen Angle"), _("Angle:"),
+                                                              _("The angle of the pen's nib (in degrees; 0 = horizontal; has no effect if fixation = 0)"),
+                                                              "tools.calligraphic", "angle", 30,
+                                                              GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "calligraphy-angle",
+                                                              -90.0, 90.0, 1.0, 10.0,
+                                                              labels, values, G_N_ELEMENTS(labels),
+                                                              sp_ddc_angle_value_changed, 1, 0 );
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
         gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
         calligraphy_angle = eact;
@@ -2719,12 +3377,13 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
             gchar const* labels[] = {_("(perpendicular to stroke, \"brush\")"), 0, 0, 0, _("(almost fixed, default)"), _("(fixed by Angle, \"pen\")")};
         gdouble values[] = {0, 0.2, 0.4, 0.6, 0.9, 1.0};
         EgeAdjustmentAction* eact = create_adjustment_action( "FixationAction",
-                                         _("Fixation:"), _("Angle behavior (0 = nib always perpendicular to stroke direction, 1 = fixed angle)"),
-                                         "tools.calligraphic", "flatness", 0.9,
-                                         GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
-                                         0.0, 1.0, 0.01, 0.1,
-                                         labels, values, G_N_ELEMENTS(labels),
-                                         sp_ddc_flatness_value_changed, 0.01, 2 );
+                                                              _("Fixation"), _("Fixation:"),
+                                                              _("Angle behavior (0 = nib always perpendicular to stroke direction, 1 = fixed angle)"),
+                                                              "tools.calligraphic", "flatness", 0.9,
+                                                              GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
+                                                              0.0, 1.0, 0.01, 0.1,
+                                                              labels, values, G_N_ELEMENTS(labels),
+                                                              sp_ddc_flatness_value_changed, 0.01, 2 );
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
         gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
         }
@@ -2735,12 +3394,13 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
         gdouble values[] = {0, 0.3, 0.5, 1.0, 1.4, 5.0};
         // TRANSLATORS: "cap" means "end" (both start and finish) here
         EgeAdjustmentAction* eact = create_adjustment_action( "CapRoundingAction",
-                                         _("Caps:"), _("Increase to make caps at the ends of strokes protrude more (0 = no caps, 1 = round caps)"),
-                                         "tools.calligraphic", "cap_rounding", 0.0,
-                                         GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
-                                         0.0, 5.0, 0.01, 0.1,
-                                         labels, values, G_N_ELEMENTS(labels),
-                                         sp_ddc_cap_rounding_value_changed, 0.01, 2 );
+                                                              _("Cap rounding"), _("Caps:"),
+                                                              _("Increase to make caps at the ends of strokes protrude more (0 = no caps, 1 = round caps)"),
+                                                              "tools.calligraphic", "cap_rounding", 0.0,
+                                                              GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
+                                                              0.0, 5.0, 0.01, 0.1,
+                                                              labels, values, G_N_ELEMENTS(labels),
+                                                              sp_ddc_cap_rounding_value_changed, 0.01, 2 );
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
         gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
         }
@@ -2750,12 +3410,13 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
             gchar const* labels[] = {_("(smooth line)"), _("(slight tremor)"), _("(noticeable tremor)"), 0, 0, _("(maximum tremor)")};
         gdouble values[] = {0, 0.1, 0.2, 0.4, 0.6, 1.0};
         EgeAdjustmentAction* eact = create_adjustment_action( "TremorAction",
-                                         _("Tremor:"), _("Increase to make strokes rugged and trembling"),
-                                         "tools.calligraphic", "tremor", 0.0,
-                                         GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
-                                         0.0, 1.0, 0.01, 0.1,
-                                         labels, values, G_N_ELEMENTS(labels),
-                                         sp_ddc_tremor_value_changed, 0.01, 2 );
+                                                              _("Stroke Tremor"), _("Tremor:"),
+                                                              _("Increase to make strokes rugged and trembling"),
+                                                              "tools.calligraphic", "tremor", 0.0,
+                                                              GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
+                                                              0.0, 1.0, 0.01, 0.1,
+                                                              labels, values, G_N_ELEMENTS(labels),
+                                                              sp_ddc_tremor_value_changed, 0.01, 2 );
 
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
         gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
@@ -2766,12 +3427,13 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
         gchar const* labels[] = {_("(no wiggle)"), _("(slight deviation)"), 0, 0, _("(wild waves and curls)")};
         gdouble values[] = {0, 0.2, 0.4, 0.6, 1.0};
         EgeAdjustmentAction* eact = create_adjustment_action( "WiggleAction",
-                                         _("Wiggle:"), _("Increase to make the pen waver and wiggle"),
-                                         "tools.calligraphic", "wiggle", 0.0,
-                                         GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
-                                         0.0, 1.0, 0.01, 0.1,
-                                         labels, values, G_N_ELEMENTS(labels),
-                                         sp_ddc_wiggle_value_changed, 0.01, 2 );
+                                                              _("Pen Wiggle"), _("Wiggle:"),
+                                                              _("Increase to make the pen waver and wiggle"),
+                                                              "tools.calligraphic", "wiggle", 0.0,
+                                                              GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
+                                                              0.0, 1.0, 0.01, 0.1,
+                                                              labels, values, G_N_ELEMENTS(labels),
+                                                              sp_ddc_wiggle_value_changed, 0.01, 2 );
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
         gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
         }
@@ -2781,12 +3443,13 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
             gchar const* labels[] = {_("(no inertia)"), _("(slight smoothing, default)"), _("(noticeable lagging)"), 0, 0, _("(maximum inertia)")};
         gdouble values[] = {0.0, 0.02, 0.1, 0.2, 0.5, 1.0};
         EgeAdjustmentAction* eact = create_adjustment_action( "MassAction",
-                                         _("Mass:"), _("Increase to make the pen drag behind, as if slowed by inertia"),
-                                         "tools.calligraphic", "mass", 0.02,
-                                         GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
-                                         0.0, 1.0, 0.01, 0.1,
-                                         labels, values, G_N_ELEMENTS(labels),
-                                         sp_ddc_mass_value_changed, 0.01, 2 );
+                                                              _("Pen Mass"), _("Mass:"),
+                                                              _("Increase to make the pen drag behind, as if slowed by inertia"),
+                                                              "tools.calligraphic", "mass", 0.02,
+                                                              GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
+                                                              0.0, 1.0, 0.01, 0.1,
+                                                              labels, values, G_N_ELEMENTS(labels),
+                                                              sp_ddc_mass_value_changed, 0.01, 2 );
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
         gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
         }
@@ -3001,9 +3664,9 @@ static void sp_arctb_defaults(GtkWidget *, GObject *obj)
     spinbutton_defocus( GTK_OBJECT(obj) );
 }
 
-static void arc_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const *name,
-                                      gchar const *old_value, gchar const *new_value,
-                                      bool is_interactive, gpointer data)
+static void arc_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const */*name*/,
+                                      gchar const */*old_value*/, gchar const */*new_value*/,
+                                      bool /*is_interactive*/, gpointer data)
 {
     GObject *tbl = G_OBJECT(data);
 
@@ -3104,7 +3767,8 @@ static void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions,
     /* Start */
     {
         eact = create_adjustment_action( "ArcStartAction",
-                                         _("Start:"), _("The angle (in degrees) from the horizontal to the arc's start point"),
+                                         _("Start"), _("Start:"),
+                                         _("The angle (in degrees) from the horizontal to the arc's start point"),
                                          "tools.shapes.arc", "start", 0.0,
                                          GTK_WIDGET(desktop->canvas), NULL/*us*/, holder, TRUE, "altx-arc",
                                          -360.0, 360.0, 1.0, 10.0,
@@ -3116,7 +3780,8 @@ static void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions,
     /* End */
     {
         eact = create_adjustment_action( "ArcEndAction",
-                                         _("End:"), _("The angle (in degrees) from the horizontal to the arc's end point"),
+                                         _("End"), _("End:"),
+                                         _("The angle (in degrees) from the horizontal to the arc's end point"),
                                          "tools.shapes.arc", "end", 0.0,
                                          GTK_WIDGET(desktop->canvas), NULL/*us*/, holder, FALSE, NULL,
                                          -360.0, 360.0, 1.0, 10.0,
@@ -3144,7 +3809,7 @@ static void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions,
                             2, "circle_open_arc",
                             -1 );
 
-        EgeSelectOneAction* act = ege_select_one_action_new( "ArcOpenAction", _(""), _(""), NULL, GTK_TREE_MODEL(model) );
+        EgeSelectOneAction* act = ege_select_one_action_new( "ArcOpenAction", (""), (""), NULL, GTK_TREE_MODEL(model) );
         gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
         g_object_set_data( holder, "open_action", act );
 
@@ -3225,7 +3890,7 @@ static void toggle_dropper_set_alpha( GtkToggleAction* act, gpointer tbl ) {
  * TODO: Add queue of last 5 or so colors selected with new swatches so that
  *       can drag and drop places. Will provide a nice mixing palette.
  */
-static void sp_dropper_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
+static void sp_dropper_toolbox_prep(SPDesktop */*desktop*/, GtkActionGroup* mainActions, GObject* holder)
 {
     gint pickAlpha = prefs_get_int_attribute( "tools.dropper", "pick", 1 );
 
@@ -3293,13 +3958,17 @@ sp_text_letter_rotation_changed(GtkAdjustment *adj, GtkWidget *tbl)
 
 namespace {
 
-bool visible = false;
+bool popdown_visible = false;
+bool popdown_hasfocus = false;
 
 void
-sp_text_toolbox_selection_changed (Inkscape::Selection *selection, GObject *tbl)
+sp_text_toolbox_selection_changed (Inkscape::Selection */*selection*/, GObject *tbl)
 {
     SPStyle *query =
         sp_style_new (SP_ACTIVE_DOCUMENT);
+    
+    int result_fontspec =
+        sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONT_SPECIFICATION);
 
     int result_family =
         sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTFAMILY);
@@ -3333,15 +4002,27 @@ sp_text_toolbox_selection_changed (Inkscape::Selection *selection, GObject *tbl)
             GtkWidget *entry = GTK_WIDGET (g_object_get_data (G_OBJECT (tbl), "family-entry"));
             gtk_entry_set_text (GTK_ENTRY (entry), "");
 
-        } else if (query->text->font_family.value) {
+        } else if (query->text->font_specification.value || query->text->font_family.value) {
 
             GtkWidget *entry = GTK_WIDGET (g_object_get_data (G_OBJECT (tbl), "family-entry"));
-            gtk_entry_set_text (GTK_ENTRY (entry), query->text->font_family.value);
+            
+            // Get the font that corresponds 
+            Glib::ustring familyName;
+            
+            font_instance * font = font_factory::Default()->FaceFromStyle(query);
+            if (font) {
+                familyName = font_factory::Default()->GetUIFamilyString(font->descr);
+                font->Unref();
+                font = NULL;
+            }
+            
+            gtk_entry_set_text (GTK_ENTRY (entry), familyName.c_str());
 
             Gtk::TreePath path;
             try {
-                path = Inkscape::FontLister::get_instance()->get_row_for_font (query->text->font_family.value);
+                path = Inkscape::FontLister::get_instance()->get_row_for_font (familyName);
             } catch (...) {
+                g_warning("Family name %s does not have an entry in the font lister.", familyName.c_str());
                 return;
             }
 
@@ -3450,13 +4131,13 @@ sp_text_toolbox_selection_changed (Inkscape::Selection *selection, GObject *tbl)
 }
 
 void
-sp_text_toolbox_selection_modified (Inkscape::Selection *selection, guint flags, GObject *tbl)
+sp_text_toolbox_selection_modified (Inkscape::Selection *selection, guint /*flags*/, GObject *tbl)
 {
     sp_text_toolbox_selection_changed (selection, tbl);
 }
 
 void
-sp_text_toolbox_subselection_changed (gpointer dragger, GObject *tbl)
+sp_text_toolbox_subselection_changed (gpointer /*dragger*/, GObject *tbl)
 {
     sp_text_toolbox_selection_changed (NULL, tbl);
 }
@@ -3467,7 +4148,6 @@ sp_text_toolbox_family_changed (GtkTreeSelection    *selection,
 {
     SPDesktop    *desktop = SP_ACTIVE_DESKTOP;
     GtkTreeModel *model = 0;
-    GtkWidget    *popdown = GTK_WIDGET (g_object_get_data (tbl, "family-popdown-window"));
     GtkWidget    *entry = GTK_WIDGET (g_object_get_data (tbl, "family-entry"));
     GtkTreeIter   iter;
     char         *family = 0;
@@ -3487,22 +4167,63 @@ sp_text_toolbox_family_changed (GtkTreeSelection    *selection,
         return;
     }
 
-    gtk_widget_hide (popdown);
-    visible = false;
-
     gtk_entry_set_text (GTK_ENTRY (entry), family);
 
     SPStyle *query =
         sp_style_new (SP_ACTIVE_DOCUMENT);
 
-    int result_numbers =
-        sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
+    int result_fontspec =
+        sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONT_SPECIFICATION);
 
+    font_instance * fontFromStyle = font_factory::Default()->FaceFromStyle(query);
+    
     SPCSSAttr *css = sp_repr_css_attr_new ();
-    sp_repr_css_set_property (css, "font-family", family);
+    
+    
+    // First try to get the font spec from the stored value
+    Glib::ustring fontSpec = query->text->font_specification.set ?  query->text->font_specification.value : "";
 
-    // If querying returned nothing, read the style from the text tool prefs (default style for new texts)
-    if (result_numbers == QUERY_STYLE_NOTHING)
+    if (fontSpec.empty()) {
+        // Construct a new font specification if it does not yet exist
+        font_instance * fontFromStyle = font_factory::Default()->FaceFromStyle(query);
+        fontSpec = font_factory::Default()->ConstructFontSpecification(fontFromStyle);
+        fontFromStyle->Unref();
+    }
+    
+    if (!fontSpec.empty()) {
+        Glib::ustring newFontSpec = font_factory::Default()->ReplaceFontSpecificationFamily(fontSpec, family);
+        if (!newFontSpec.empty() && fontSpec != newFontSpec) {
+            font_instance *font = font_factory::Default()->FaceFromFontSpecification(newFontSpec.c_str());
+            if (font) {
+                sp_repr_css_set_property (css, "-inkscape-font-specification", newFontSpec.c_str());
+                
+                // Set all the these just in case they were altered when finding the best
+                // match for the new family and old style...
+                
+                gchar c[256];
+                
+                font->Family(c, 256);
+                sp_repr_css_set_property (css, "font-family", c);
+                
+                font->Attribute( "weight", c, 256);
+                sp_repr_css_set_property (css, "font-weight", c);
+                
+                font->Attribute("style", c, 256);
+                sp_repr_css_set_property (css, "font-style", c);
+                
+                font->Attribute("stretch", c, 256);
+                sp_repr_css_set_property (css, "font-stretch", c);
+                
+                font->Attribute("variant", c, 256);
+                sp_repr_css_set_property (css, "font-variant", c);
+                
+                font->Unref();
+            }
+        }
+    }
+
+    // If querying returned nothing, set the default style of the tool (for new texts)
+    if (result_fontspec == QUERY_STYLE_NOTHING)
     {
         sp_repr_css_change (inkscape_get_repr (INKSCAPE, "tools.text"), css, "style");
         sp_text_edit_dialog_default_set_insensitive (); //FIXME: Replace trough a verb
@@ -3617,29 +4338,64 @@ sp_text_toolbox_style_toggled (GtkToggleButton  *button,
     int          prop       = GPOINTER_TO_INT(data);
     bool         active     = gtk_toggle_button_get_active (button);
 
+    SPStyle *query =
+        sp_style_new (SP_ACTIVE_DOCUMENT);
+    
+    int result_fontspec =
+        sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONT_SPECIFICATION);
 
+    int result_family =
+        sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTFAMILY);
+
+    int result_style =
+        sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTSTYLE);
+
+    int result_numbers =
+        sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
+    
+    Glib::ustring fontSpec = query->text->font_specification.set ?  query->text->font_specification.value : "";
+    Glib::ustring newFontSpec = "";
+    
+    if (fontSpec.empty()) {
+        // Construct a new font specification if it does not yet exist
+        font_instance * fontFromStyle = font_factory::Default()->FaceFromStyle(query);
+        fontSpec = font_factory::Default()->ConstructFontSpecification(fontFromStyle);
+        fontFromStyle->Unref();
+    }
+    
     switch (prop)
     {
         case 0:
         {
-            sp_repr_css_set_property (css, "font-weight", active ? "bold" : "normal" );
+            if (!fontSpec.empty()) {
+                newFontSpec = font_factory::Default()->FontSpecificationSetBold(fontSpec, active);
+            }
+            if (fontSpec != newFontSpec) {
+                // Don't even set the bold if the font didn't exist on the system
+                sp_repr_css_set_property (css, "font-weight", active ? "bold" : "normal" );
+            }
             break;
         }
 
         case 1:
         {
-            sp_repr_css_set_property (css, "font-style", active ? "italic" : "normal");
+            if (!fontSpec.empty()) {
+                newFontSpec = font_factory::Default()->FontSpecificationSetItalic(fontSpec, active);
+            }
+            if (fontSpec != newFontSpec) {
+                // Don't even set the italic if the font didn't exist on the system
+                sp_repr_css_set_property (css, "font-style", active ? "italic" : "normal");
+            }
             break;
         }
     }
 
-    SPStyle *query =
-        sp_style_new (SP_ACTIVE_DOCUMENT);
-    int result_numbers =
-        sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
+    if (!newFontSpec.empty()) {
+        sp_repr_css_set_property (css, "-inkscape-font-specification", newFontSpec.c_str()); 
+    }
 
     // If querying returned nothing, read the style from the text tool prefs (default style for new texts)
-    if (result_numbers == QUERY_STYLE_NOTHING)
+    if (result_fontspec == QUERY_STYLE_NOTHING)
     {
         sp_repr_css_change (inkscape_get_repr (INKSCAPE, "tools.text"), css, "style");
     }
@@ -3702,27 +4458,7 @@ sp_text_toolbox_orientation_toggled (GtkRadioButton  *button,
 }
 
 gboolean
-sp_text_toolbox_size_keypress (GtkWidget *w, GdkEventKey *event, gpointer data)
-{
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
-    if (!desktop) return FALSE;
-
-    switch (get_group0_keyval (event)) {
-        case GDK_Escape: // defocus
-            gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
-            return TRUE; // I consumed the event
-            break;
-        case GDK_Return: // defocus
-        case GDK_KP_Enter:
-            gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
-            return TRUE; // I consumed the event
-            break;
-    }
-    return FALSE;
-}
-
-gboolean
-sp_text_toolbox_family_keypress (GtkWidget *w, GdkEventKey *event, GObject *tbl)
+sp_text_toolbox_family_keypress (GtkWidget */*w*/, GdkEventKey *event, GObject *tbl)
 {
     SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (!desktop) return FALSE;
@@ -3738,18 +4474,29 @@ sp_text_toolbox_family_keypress (GtkWidget *w, GdkEventKey *event, GObject *tbl)
 }
 
 gboolean
-sp_text_toolbox_family_list_keypress (GtkWidget *w, GdkEventKey *event, GObject *tbl)
+sp_text_toolbox_family_list_keypress (GtkWidget *w, GdkEventKey *event, GObject */*tbl*/)
 {
     SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (!desktop) return FALSE;
 
     switch (get_group0_keyval (event)) {
+        case GDK_KP_Enter:
+        case GDK_Return:
         case GDK_Escape: // defocus
             gtk_widget_hide (w);
-            visible = false;
+            popdown_visible = false;
             gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
             return TRUE; // I consumed the event
             break;
+        case GDK_w: 
+        case GDK_W: 
+            if (event->state & GDK_CONTROL_MASK) {
+                gtk_widget_hide (w);
+                popdown_visible = false;
+                gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
+                return TRUE; // I consumed the event
+            }
+            break;
     }
     return FALSE;
 }
@@ -3763,20 +4510,30 @@ sp_text_toolbox_size_changed  (GtkComboBox *cbox,
 
     if (g_object_get_data (tbl, "size-block")) return;
 
-#if GTK_CHECK_VERSION(2,6,0)
-    char *text = gtk_combo_box_get_active_text (cbox);
-#else // GTK_CHECK_VERSION(2,6,0)
-    GtkTreeModel *model = gtk_combo_box_get_model (cbox);
-    GtkTreeIter iter;
-    char *text = NULL;
+    // If this is not from selecting a size in the list (in which case get_active will give the
+    // index of the selected item, otherwise -1) and not from user pressing Enter/Return, do not
+    // process this event. This fixes GTK's stupid insistence on sending an activate change every
+    // time any character gets typed or deleted, which made this control nearly unusable in 0.45.
+    if (gtk_combo_box_get_active (cbox) < 0 && !g_object_get_data (tbl, "enter-pressed"))
+        return;
 
-    if (gtk_combo_box_get_active_iter (cbox, &iter) && model)
-        gtk_tree_model_get (model, &iter, 0, &text, -1);
-#endif // GTK_CHECK_VERSION(2,6,0)
+    gchar *endptr;
+    gdouble value = -1;
+    char *text = gtk_combo_box_get_active_text (cbox);
+    if (text) {
+        value = g_strtod (text, &endptr);
+        if (endptr == text) // conversion failed, non-numeric input
+            value = -1;
+        free (text);
+    }
+    if (value <= 0) {
+        return; // could not parse value 
+    }
 
     SPCSSAttr *css = sp_repr_css_attr_new ();
-    sp_repr_css_set_property (css, "font-size", text);
-    free (text);
+    Inkscape::CSSOStringStream osfs;
+    osfs << value;
+    sp_repr_css_set_property (css, "font-size", osfs.str().c_str());
 
     SPStyle *query =
         sp_style_new (SP_ACTIVE_DOCUMENT);
@@ -3796,24 +4553,65 @@ sp_text_toolbox_size_changed  (GtkComboBox *cbox,
                                    _("Text: Change font size"));
     sp_repr_css_attr_unref (css);
 
+    gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
+}
 
-    if (gtk_combo_box_get_active (cbox) > 0) // if this was from drop-down (as opposed to type-in), defocus
-        gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
+gboolean
+sp_text_toolbox_size_focusout (GtkWidget */*w*/, GdkEventFocus *event, GObject *tbl)
+{
+    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+    if (!desktop) return FALSE;
+
+    if (!g_object_get_data (tbl, "esc-pressed")) {
+        g_object_set_data (tbl, "enter-pressed", gpointer(1));
+        GtkComboBox *cbox = GTK_COMBO_BOX(g_object_get_data (G_OBJECT (tbl), "combo-box-size"));
+        sp_text_toolbox_size_changed (cbox, tbl);
+        g_object_set_data (tbl, "enter-pressed", gpointer(0));
+    }
+    return FALSE; // I consumed the event
+}
+
+
+gboolean
+sp_text_toolbox_size_keypress (GtkWidget */*w*/, GdkEventKey *event, GObject *tbl)
+{
+    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+    if (!desktop) return FALSE;
+
+    switch (get_group0_keyval (event)) {
+        case GDK_Escape: // defocus
+            g_object_set_data (tbl, "esc-pressed", gpointer(1));
+            gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
+            g_object_set_data (tbl, "esc-pressed", gpointer(0));
+            return TRUE; // I consumed the event
+            break;
+        case GDK_Return: // defocus
+        case GDK_KP_Enter:
+            g_object_set_data (tbl, "enter-pressed", gpointer(1));
+            GtkComboBox *cbox = GTK_COMBO_BOX(g_object_get_data (G_OBJECT (tbl), "combo-box-size"));
+            sp_text_toolbox_size_changed (cbox, tbl);
+            gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
+            g_object_set_data (tbl, "enter-pressed", gpointer(0));
+            return TRUE; // I consumed the event
+            break;
+    }
+    return FALSE;
 }
 
 void
-sp_text_toolbox_text_popdown_clicked    (GtkButton          *button,
+sp_text_toolbox_text_popdown_clicked    (GtkButton          */*button*/,
                                          GObject            *tbl)
 {
     GtkWidget *popdown = GTK_WIDGET (g_object_get_data (tbl, "family-popdown-window"));
     GtkWidget *widget = GTK_WIDGET (g_object_get_data (tbl, "family-entry"));
     int x, y;
 
-    if (!visible)
+    if (!popdown_visible)
     {
         gdk_window_get_origin (widget->window, &x, &y);
         gtk_window_move (GTK_WINDOW (popdown), x, y + widget->allocation.height + 2); //2px of grace space
         gtk_widget_show_all (popdown);
+        //sp_transientize (popdown);
 
         gdk_pointer_grab (widget->window, TRUE,
                           GdkEventMask (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
@@ -3823,21 +4621,23 @@ sp_text_toolbox_text_popdown_clicked    (GtkButton          *button,
 
         gdk_keyboard_grab (widget->window, TRUE, GDK_CURRENT_TIME);
 
-        visible = true;
+        popdown_visible = true;
     }
     else
     {
+        SPDesktop *desktop = SP_ACTIVE_DESKTOP;
         gdk_pointer_ungrab (GDK_CURRENT_TIME);
         gdk_keyboard_ungrab (GDK_CURRENT_TIME);
+        gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
         gtk_widget_hide (popdown);
-        visible = false;
+        popdown_visible = false;
     }
 }
 
 gboolean
 sp_text_toolbox_entry_focus_in  (GtkWidget        *entry,
-                                 GdkEventFocus    *event,
-                                 GObject          *tbl)
+                                 GdkEventFocus    */*event*/,
+                                 GObject          */*tbl*/)
 {
     gtk_entry_select_region (GTK_ENTRY (entry), 0, -1);
     return FALSE;
@@ -3845,23 +4645,37 @@ sp_text_toolbox_entry_focus_in  (GtkWidget        *entry,
 
 gboolean
 sp_text_toolbox_popdown_focus_out (GtkWidget        *popdown,
-                                   GdkEventFocus    *event,
-                                   GObject          *tbl)
+                                   GdkEventFocus    */*event*/,
+                                   GObject          */*tbl*/)
 {
     SPDesktop *desktop = SP_ACTIVE_DESKTOP;
 
-    gtk_widget_hide (popdown);
-    visible = false;
-    gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
+    if (popdown_hasfocus) {
+        gtk_widget_hide (popdown);
+        popdown_hasfocus = false;
+        popdown_visible = false;
+        gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
+        return TRUE;
+    }
+    return FALSE;
+}
+
+gboolean
+sp_text_toolbox_popdown_focus_in (GtkWidget        *popdown,
+                                   GdkEventFocus    */*event*/,
+                                   GObject          */*tbl*/)
+{
+    popdown_hasfocus = true;
     return TRUE;
 }
 
+
 void
-cell_data_func  (GtkTreeViewColumn *column,
+cell_data_func  (GtkTreeViewColumn */*column*/,
                  GtkCellRenderer   *cell,
                  GtkTreeModel      *tree_model,
                  GtkTreeIter       *iter,
-                 gpointer           data)
+                 gpointer           /*data*/)
 {
     char        *family,
         *family_escaped,
@@ -3883,7 +4697,7 @@ cell_data_func  (GtkTreeViewColumn *column,
     free (sample_escaped);
 }
 
-static void delete_completion(GObject *obj, GtkWidget *entry) {
+static void delete_completion(GObject */*obj*/, GtkWidget *entry) {
     GObject *completion = (GObject *) gtk_object_get_data(GTK_OBJECT(entry), "completion");
     if (completion) {
         gtk_entry_set_completion (GTK_ENTRY(entry), NULL);
@@ -3939,9 +4753,7 @@ sp_text_toolbox_new (SPDesktop *desktop)
 
     gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (Glib::unwrap(store)));
     gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
-#if GTK_CHECK_VERSION(2,6,0)
     gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (treeview), TRUE);
-#endif // GTK_CHECK_VERSION(2,6,0)
 
     //gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview), TRUE);
 
@@ -3958,6 +4770,7 @@ sp_text_toolbox_new (SPDesktop *desktop)
     g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (sp_text_toolbox_text_popdown_clicked), tbl);
 
     g_signal_connect (G_OBJECT (window), "focus-out-event", G_CALLBACK (sp_text_toolbox_popdown_focus_out), tbl);
+    g_signal_connect (G_OBJECT (window), "focus-in-event", G_CALLBACK (sp_text_toolbox_popdown_focus_in), tbl);
     g_signal_connect (G_OBJECT (window), "key-press-event", G_CALLBACK(sp_text_toolbox_family_list_keypress), tbl);
 
     GtkTreeSelection *tselection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
@@ -3994,7 +4807,8 @@ sp_text_toolbox_new (SPDesktop *desktop)
     gtk_box_pack_start (GTK_BOX (tbl), cbox, FALSE, FALSE, 0);
     g_object_set_data (G_OBJECT (tbl), "combo-box-size", cbox);
     g_signal_connect (G_OBJECT (cbox), "changed", G_CALLBACK (sp_text_toolbox_size_changed), tbl);
-    gtk_signal_connect(GTK_OBJECT(cbox), "key-press-event", GTK_SIGNAL_FUNC(sp_text_toolbox_size_keypress), NULL);
+    gtk_signal_connect(GTK_OBJECT(gtk_bin_get_child(GTK_BIN(cbox))), "key-press-event", GTK_SIGNAL_FUNC(sp_text_toolbox_size_keypress), tbl);
+    gtk_signal_connect(GTK_OBJECT(gtk_bin_get_child(GTK_BIN(cbox))), "focus-out-event", GTK_SIGNAL_FUNC(sp_text_toolbox_size_focusout), tbl);
 
     //spacer
     aux_toolbox_space (tbl, 4);
@@ -4136,168 +4950,6 @@ sp_text_toolbox_new (SPDesktop *desktop)
     Inkscape::ConnectionPool::connect_destroy (G_OBJECT (tbl), pool);
 
 
-#if 0
-    // horizontal
-    {
-        GtkWidget *px= sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_STOCK_WRITING_MODE_LR);
-        GtkWidget *b = group = gtk_radio_button_new (NULL);
-        gtk_container_add (GTK_CONTAINER (b), px);
-        gtk_tooltips_set_tip (tt, b, _("Horizontal text"), NULL);
-        gtk_button_set_relief (GTK_BUTTON (b), GTK_RELIEF_NONE);
-        gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (b), FALSE );
-        gtk_box_pack_start (GTK_BOX (tbl), b, FALSE, FALSE, 0);
-    }
-
-    // vertical
-    {
-        GtkWidget *px = sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_STOCK_WRITING_MODE_TB);
-        GtkWidget *b = gtk_radio_button_new (gtk_radio_button_group (GTK_RADIO_BUTTON (group)));
-        gtk_container_add (GTK_CONTAINER (b), px);
-        gtk_tooltips_set_tip (tt, b, _("Vertical text"), NULL);
-        gtk_button_set_relief (GTK_BUTTON (b), GTK_RELIEF_NONE);
-        gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (b), FALSE );
-        gtk_box_pack_start (GTK_BOX (tbl), b, FALSE, FALSE, 0);
-    }
-
-    aux_toolbox_space(tbl, AUX_BETWEEN_BUTTON_GROUPS);
-
-    // letter spacing
-    {
-        {
-            GtkWidget *image = sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_STOCK_TEXT_LETTER_SPACING);
-            GtkWidget *hb = gtk_hbox_new(FALSE, 1);
-            gtk_container_add (GTK_CONTAINER (hb), image);
-            gtk_widget_show(image);
-            gtk_box_pack_start (GTK_BOX (tbl), hb, FALSE, FALSE, 0);
-        }
-
-        {
-            GtkWidget *hb = sp_tb_spinbutton(_(""), _("Spacing between letters"),
-                                             "tools.text", "letter_spacing", 0.0,
-                                             us, tbl, FALSE, NULL,
-                                             -1000.0, 1000.0, 0.1, 0.1,
-                                             sp_text_letter_changed, 0.1, 1);
-            gtk_widget_set_size_request (hb, 45, 6);
-            gtk_box_pack_start(GTK_BOX(tbl), hb, FALSE, FALSE, 6);
-        }
-    }
-
-    // line spacing
-    {
-        {
-            GtkWidget *image = sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_STOCK_TEXT_LINE_SPACING);
-            GtkWidget *hb = gtk_hbox_new(FALSE, 1);
-            gtk_container_add (GTK_CONTAINER (hb), image);
-            gtk_widget_show(image);
-            gtk_box_pack_start (GTK_BOX (tbl), hb, FALSE, FALSE, 0);
-        }
-
-        {
-            GtkWidget *hb = sp_tb_spinbutton(_(""), _("Spacing between lines"),
-                                             "tools.text", "line_spacing", 0,
-                                             us, tbl, FALSE, NULL,
-                                             -1000.0, 1000.0, 0.1, 0.1,
-                                             sp_text_line_changed, 0.1, 1);
-            gtk_widget_set_size_request (hb, 45, 0);
-            gtk_box_pack_start(GTK_BOX(tbl), hb, FALSE, FALSE, 3);
-        }
-    }
-
-    {
-        // horizontal kerning/vertical kerning units menu: create
-        GtkWidget *us = sp_unit_selector_new(SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE);
-        sp_unit_selector_setsize(us, AUX_OPTION_MENU_WIDTH, AUX_OPTION_MENU_HEIGHT);
-        sp_unit_selector_set_unit(SP_UNIT_SELECTOR(us), desktop->namedview->doc_units);
-
-        aux_toolbox_space(tbl, AUX_BETWEEN_BUTTON_GROUPS);
-
-        // horizontal kerning
-        {
-            {
-                GtkWidget *image = sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_STOCK_TEXT_HORZ_KERN);
-                GtkWidget *hb = gtk_hbox_new(FALSE, 1);
-                gtk_container_add (GTK_CONTAINER (hb), image);
-                gtk_widget_show(image);
-                gtk_box_pack_start (GTK_BOX (tbl), hb, FALSE, FALSE, 0);
-            }
-
-            {
-                GtkWidget *hb = sp_tb_spinbutton(_(""), _("Horizontal kerning"),
-                                                 "tools.text", "horizontal_kerning", 0,
-                                                 us, tbl, FALSE, NULL,
-                                                 -100.00, 100.00, 0.01, 0.1,
-                                                 sp_text_horiz_kern_changed);
-                gtk_widget_set_size_request (hb, 45, 0);
-                gtk_box_pack_start(GTK_BOX(tbl), hb, FALSE, FALSE, 6);
-            }
-        }
-
-        // vertical kerning
-        {
-            {
-                GtkWidget *image = sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_STOCK_TEXT_VERT_KERN);
-                GtkWidget *hb = gtk_hbox_new(FALSE, 1);
-                gtk_container_add (GTK_CONTAINER (hb), image);
-                gtk_widget_show(image);
-                gtk_box_pack_start (GTK_BOX (tbl), hb, FALSE, FALSE, 0);
-            }
-
-            {
-                GtkWidget *hb = sp_tb_spinbutton(_(""), _("Vertical kerning"),
-                                                 "tools.text", "vertical_kerning", 0,
-                                                 us, tbl, FALSE, NULL,
-                                                 -100.00, 100.00, 0.01, 0.1,
-                                                 sp_text_vert_kern_changed);
-                gtk_widget_set_size_request (hb, 45, 0);
-                gtk_box_pack_start(GTK_BOX(tbl), hb, FALSE, FALSE, 5);
-            }
-        }
-
-        // add the units menu
-        gtk_widget_show(us);
-        gtk_box_pack_start(GTK_BOX(tbl), us, FALSE, FALSE, 1);
-        gtk_object_set_data(GTK_OBJECT(tbl), "units", us);
-    }
-
-    // letter rotation
-    aux_toolbox_space(tbl, AUX_BETWEEN_BUTTON_GROUPS);
-    {
-        {
-            GtkWidget *image = sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_STOCK_TEXT_ROTATION);
-            GtkWidget *hb = gtk_hbox_new(FALSE, 1);
-            gtk_container_add (GTK_CONTAINER (hb), image);
-            gtk_widget_show(image);
-            gtk_box_pack_start (GTK_BOX (tbl), hb, FALSE, FALSE, 0);
-        }
-        {
-            GtkWidget *hb = sp_tb_spinbutton(_(""), _("Letter rotation"),
-                                             "tools.text", "letter_rotation", 0,
-                                             us, tbl, FALSE, NULL,
-                                             -180.0, 180.0, 0.1, 0.1,
-                                             sp_text_letter_rotation_changed, 0.1, 1);
-            gtk_widget_set_size_request (hb, 45, 0);
-            gtk_box_pack_start(GTK_BOX(tbl), hb, FALSE, FALSE, 6);
-        }
-        // rotation degree label
-        {
-            GtkWidget *label = gtk_widget_new (GTK_TYPE_LABEL, "label", "\302\260", "xalign", 0.0, NULL);
-            gtk_box_pack_start(GTK_BOX(tbl), label, FALSE, FALSE, 0);
-        }
-    }
-
-    // Remove Manual Kerns
-    {
-        GtkWidget *px = sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_STOCK_TEXT_REMOVE_KERNS);
-        GtkWidget *button = gtk_button_new ();
-        gtk_container_add (GTK_CONTAINER (button), px);
-        gtk_widget_show(button);
-        gtk_tooltips_set_tip (tt, button, _("Remove manual kerns"), NULL);
-        gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
-        gtk_widget_set_sensitive(button, TRUE);
-        gtk_box_pack_start (GTK_BOX (tbl), button, FALSE, FALSE, AUX_BETWEEN_BUTTON_GROUPS);
-    }
-#endif
-
     gtk_widget_show_all (tbl);
     return tbl;
 
@@ -4307,7 +4959,7 @@ sp_text_toolbox_new (SPDesktop *desktop)
 
 
 //#########################
-//##  Connector Toolbox  ##
+//##      Connector      ##
 //#########################
 
 static void sp_connector_path_set_avoid(void)
@@ -4390,7 +5042,7 @@ static void sp_connector_graph_layout(void)
     sp_document_done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Arrange connector network"));
 }
 
-static void sp_directed_graph_layout_toggled( GtkToggleAction* act, GtkObject *tbl )
+static void sp_directed_graph_layout_toggled( GtkToggleAction* act, GtkObject */*tbl*/ )
 {
     if ( gtk_toggle_action_get_active( act ) ) {
         prefs_set_string_attribute("tools.connector", "directedlayout",
@@ -4401,7 +5053,7 @@ static void sp_directed_graph_layout_toggled( GtkToggleAction* act, GtkObject *t
     }
 }
 
-static void sp_nooverlaps_graph_layout_toggled( GtkToggleAction* act, GtkObject *tbl )
+static void sp_nooverlaps_graph_layout_toggled( GtkToggleAction* act, GtkObject */*tbl*/ )
 {
     if ( gtk_toggle_action_get_active( act ) ) {
         prefs_set_string_attribute("tools.connector", "avoidoverlaplayout",
@@ -4420,8 +5072,8 @@ static void connector_length_changed(GtkAdjustment *adj, GObject* tbl)
 }
 
 static void connector_tb_event_attr_changed(Inkscape::XML::Node *repr,
-        gchar const *name, gchar const *old_value, gchar const *new_value,
-        bool is_interactive, gpointer data)
+                                            gchar const *name, gchar const */*old_value*/, gchar const */*new_value*/,
+                                            bool /*is_interactive*/, gpointer data)
 {
     GtkWidget *tbl = GTK_WIDGET(data);
 
@@ -4476,7 +5128,8 @@ static void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainA
 
     // Spacing spinbox
     eact = create_adjustment_action( "ConnectorSpacingAction",
-                                     _("Spacing:"), _("The amount of space left around objects by auto-routing connectors"),
+                                     _("Connector Spacing"), _("Spacing:"),
+                                     _("The amount of space left around objects by auto-routing connectors"),
                                      "tools.connector", "spacing", defaultConnSpacing,
                                      GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "inkscape:connector-spacing",
                                      0, 100, 1.0, 10.0,
@@ -4497,7 +5150,8 @@ static void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainA
 
     // Default connector length spinbox
     eact = create_adjustment_action( "ConnectorLengthAction",
-                                     _("Length:"), _("Ideal length for connectors when layout is applied"),
+                                     _("Connector Length"), _("Length:"),
+                                     _("Ideal length for connectors when layout is applied"),
                                      "tools.connector", "length", 100,
                                      GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "inkscape:connector-length",
                                      10, 1000, 10.0, 100.0,
@@ -4553,29 +5207,35 @@ static void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainA
     }
 } // end of sp_connector_toolbox_prep()
 
-static void paintbucket_channels_changed(EgeSelectOneAction* act, GObject* tbl)
+
+//#########################
+//##     Paintbucket     ##
+//#########################
+
+static void paintbucket_channels_changed(EgeSelectOneAction* act, GObject* /*tbl*/)
 {
     gint channels = ege_select_one_action_get_active( act );
     flood_channels_set_channels( channels );
 }
 
-static void paintbucket_threshold_changed(GtkAdjustment *adj, GObject *tbl)
+static void paintbucket_threshold_changed(GtkAdjustment *adj, GObject */*tbl*/)
 {
     prefs_set_int_attribute("tools.paintbucket", "threshold", (gint)adj->value);
 }
 
-static void paintbucket_autogap_changed(EgeSelectOneAction* act, GObject *tbl)
+static void paintbucket_autogap_changed(EgeSelectOneAction* act, GObject */*tbl*/)
 {
     prefs_set_int_attribute("tools.paintbucket", "autogap", ege_select_one_action_get_active( act ));
 }
 
 static void paintbucket_offset_changed(GtkAdjustment *adj, GObject *tbl)
 {
-    UnitTracker* tracker = reinterpret_cast<UnitTracker*>(g_object_get_data( tbl, "tracker" ));
+    UnitTracker* tracker = static_cast<UnitTracker*>(g_object_get_data( tbl, "tracker" ));
     SPUnit const *unit = tracker->getActiveUnit();
 
-
     prefs_set_double_attribute("tools.paintbucket", "offset", (gdouble)sp_units_get_pixels(adj->value, *unit));
+
+    prefs_set_string_attribute("tools.paintbucket", "offsetunits", sp_unit_get_abbreviation(unit));
 }
 
 static void paintbucket_defaults(GtkWidget *, GObject *dataKludge)
@@ -4596,7 +5256,7 @@ static void paintbucket_defaults(GtkWidget *, GObject *dataKludge)
             gtk_adjustment_set_value(adj, kv.value);
         }
     }
-    
+
     EgeSelectOneAction* channels_action = EGE_SELECT_ONE_ACTION( g_object_get_data( dataKludge, "channels_action" ) );
     ege_select_one_action_set_active( channels_action, FLOOD_CHANNELS_RGB );
     EgeSelectOneAction* autogap_action = EGE_SELECT_ONE_ACTION( g_object_get_data( dataKludge, "autogap_action" ) );
@@ -4621,7 +5281,9 @@ static void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
         }
         g_list_free( items );
         items = 0;
-        EgeSelectOneAction* act1 = ege_select_one_action_new( "ChannelsAction", _("Fill by:"), _(""), NULL, GTK_TREE_MODEL(model) );
+        EgeSelectOneAction* act1 = ege_select_one_action_new( "ChannelsAction", _("Fill by"), (""), NULL, GTK_TREE_MODEL(model) );
+        g_object_set( act1, "short_label", _("Fill by:"), NULL );
+        ege_select_one_action_set_appearance( act1, "compact" );
         ege_select_one_action_set_active( act1, prefs_get_int_attribute("tools.paintbucket", "channels", 0) );
         g_signal_connect( G_OBJECT(act1), "changed", G_CALLBACK(paintbucket_channels_changed), holder );
         gtk_action_group_add_action( mainActions, GTK_ACTION(act1) );
@@ -4632,7 +5294,7 @@ static void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
     {
         eact = create_adjustment_action(
             "ThresholdAction",
-            _("Threshold:"),
+            _("Fill Threshold"), _("Threshold:"),
             _("The maximum allowed difference between the clicked pixel and the neighboring pixels to be counted in the fill"),
             "tools.paintbucket", "threshold", 5, GTK_WIDGET(desktop->canvas), NULL, holder, TRUE,
             "inkscape:paintbucket-threshold", 0, 100.0, 1.0, 10.0,
@@ -4644,10 +5306,12 @@ static void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
 
     // Create the units menu.
     UnitTracker* tracker = new UnitTracker( SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE );
-    tracker->setActiveUnit( sp_desktop_namedview(desktop)->doc_units );
+    const gchar *stored_unit = prefs_get_string_attribute("tools.paintbucket", "offsetunits");
+    if (stored_unit)
+        tracker->setActiveUnit(sp_unit_get_by_abbreviation(stored_unit));
     g_object_set_data( holder, "tracker", tracker );
     {
-        GtkAction* act = tracker->createAction( "PaintbucketUnitsAction", _("Units"), _("") );
+        GtkAction* act = tracker->createAction( "PaintbucketUnitsAction", _("Units"), ("") );
         gtk_action_group_add_action( mainActions, act );
     }
 
@@ -4655,7 +5319,7 @@ static void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
     {
         eact = create_adjustment_action(
             "OffsetAction",
-            _("Grow/shrink by:"),
+            _("Grow/shrink by"), _("Grow/shrink by:"),
             _("The amount to grow (positive) or shrink (negative) the created fill path"),
             "tools.paintbucket", "offset", 0, GTK_WIDGET(desktop->canvas), NULL/*us*/, holder, TRUE,
             "inkscape:paintbucket-offset", -1e6, 1e6, 0.1, 0.5,
@@ -4665,7 +5329,7 @@ static void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
 
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
     }
-    
+
     /* Auto Gap */
     {
         GtkListStore* model = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_INT );
@@ -4681,7 +5345,9 @@ static void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
         }
         g_list_free( items );
         items = 0;
-        EgeSelectOneAction* act2 = ege_select_one_action_new( "AutoGapAction", _("Fill gaps:"), _(""), NULL, GTK_TREE_MODEL(model) );
+        EgeSelectOneAction* act2 = ege_select_one_action_new( "AutoGapAction", _("Close gaps"), (""), NULL, GTK_TREE_MODEL(model) );
+        g_object_set( act2, "short_label", _("Close gaps:"), NULL );
+        ege_select_one_action_set_appearance( act2, "compact" );
         ege_select_one_action_set_active( act2, prefs_get_int_attribute("tools.paintbucket", "autogap", 0) );
         g_signal_connect( G_OBJECT(act2), "changed", G_CALLBACK(paintbucket_autogap_changed), holder );
         gtk_action_group_add_action( mainActions, GTK_ACTION(act2) );
@@ -4712,3 +5378,6 @@ static void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
 */
 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
 
+
+
+