Code

Adding climb and digits properties, key processing and focus handling
[inkscape.git] / src / widgets / toolbox.cpp
index 13b731c79eb571d6f9a172187c9135cfe072f95a..287a45f1a2c196bb41bf9a04d49a97764bb39f4f 100644 (file)
 *   John Cliff <simarilius@yahoo.com>
 *   David Turner <novalis@gnu.org>
 *   Josh Andler <scislac@scislac.com>
+*   Jon A. Cruz <jon@joncruz.org>
 *
 * Copyright (C) 2004 David Turner
 * Copyright (C) 2003 MenTaLguY
-* Copyright (C) 1999-2005 authors
+* Copyright (C) 1999-2006 authors
 * Copyright (C) 2001-2002 Ximian, Inc.
 *
 * Released under GNU GPL, read the file 'COPYING' for more information
@@ -82,6 +83,9 @@
 
 #include "toolbox.h"
 
+#include "ink-action.h"
+#include "ege-adjustment-action.h"
+
 typedef void (*SetupFunction)(GtkWidget *toolbox, SPDesktop *desktop);
 typedef void (*UpdateFunction)(SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget *toolbox);
 
@@ -811,6 +815,39 @@ 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,
+                                                       GtkWidget *dataKludge,
+                                                       gboolean altx, gchar const *altx_mark,
+                                                       gdouble lower, gdouble upper, gdouble step, gdouble page,
+                                                       void (*callback)(GtkAdjustment *, GtkWidget *),
+                                                       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 ( focusTarget ) {
+        ege_adjustment_action_set_focuswidget( act, focusTarget );
+    }
+
+    if ( dataKludge ) {
+        gtk_object_set_data( GTK_OBJECT(dataKludge), data, adj );
+    }
+
+    return act;
+}
+
+
 #define MODE_LABEL_WIDTH 70
 
 //########################
@@ -852,7 +889,7 @@ sp_stb_magnitude_value_changed(GtkAdjustment *adj, GtkWidget *tbl)
         }
     }
     if (modmade)  sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, 
-                                   /* TODO: annotate */ "toolbox.cpp:854");
+                                   _("Star: Change number of corners"));
 
     g_object_set_data(G_OBJECT(tbl), "freeze", GINT_TO_POINTER(FALSE));
 
@@ -897,7 +934,7 @@ sp_stb_proportion_value_changed(GtkAdjustment *adj, GtkWidget *tbl)
     }
 
     if (modmade) sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, 
-                                  /* TODO: annotate */ "toolbox.cpp:899");
+                                   _("Star: Change spike ratio"));
 
     g_object_set_data(G_OBJECT(tbl), "freeze", GINT_TO_POINTER(FALSE));
 
@@ -951,7 +988,7 @@ sp_stb_sides_flat_state_changed(GtkWidget *widget, GtkObject *tbl)
         }
     }
     if (modmade) sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, 
-                                  /* TODO: annotate */ "toolbox.cpp:953");
+                                  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))? _("Make polygon") : _("Make star"));
 
     g_object_set_data(G_OBJECT(tbl), "freeze", GINT_TO_POINTER(FALSE));
 
@@ -988,7 +1025,7 @@ sp_stb_rounded_value_changed(GtkAdjustment *adj, GtkWidget *tbl)
         }
     }
     if (modmade)  sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, 
-                                   /* TODO: annotate */ "toolbox.cpp:990");
+                                   _("Star: Change rounding"));
 
     g_object_set_data(G_OBJECT(tbl), "freeze", GINT_TO_POINTER(FALSE));
 
@@ -1026,7 +1063,7 @@ sp_stb_randomized_value_changed(GtkAdjustment *adj, GtkWidget *tbl)
         }
     }
     if (modmade)  sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, 
-                                   /* TODO: annotate */ "toolbox.cpp:1028");
+                                   _("Star: Change randomization"));
 
     g_object_set_data(G_OBJECT(tbl), "freeze", GINT_TO_POINTER(FALSE));
 
@@ -1366,7 +1403,7 @@ sp_rtb_value_changed(GtkAdjustment *adj, GtkWidget *tbl, gchar const *value_name
 
     if (modmade) {
         sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_RECT, 
-                         /* TODO: annotate */ "toolbox.cpp:1368");
+                                   _("Change rectangle"));
     }
 
     g_object_set_data(G_OBJECT(tbl), "freeze", GINT_TO_POINTER(FALSE));
@@ -1683,7 +1720,7 @@ sp_spl_tb_value_changed(GtkAdjustment *adj, GtkWidget *tbl, gchar const *value_n
 
     if (modmade) {
         sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SPIRAL, 
-                         /* TODO: annotate */ "toolbox.cpp:1685");
+                                   _("Change spiral"));
     }
 
     g_object_set_data(G_OBJECT(tbl), "freeze", GINT_TO_POINTER(FALSE));
@@ -1935,6 +1972,94 @@ sp_pencil_toolbox_new(SPDesktop *desktop)
 //##     Calligraphy    ##
 //########################
 
+static void sp_ddc_mass_value_changed2( GtkAdjustment *adj, GtkWidget *tbl )
+{
+    prefs_set_double_attribute( "tools.calligraphic", "mass", adj->value );
+    //spinbutton_defocus(GTK_OBJECT(tbl));
+}
+
+static void sp_ddc_wiggle_value_changed2( GtkAdjustment *adj, GtkWidget *tbl )
+{
+    prefs_set_double_attribute( "tools.calligraphic", "wiggle", adj->value );
+//    spinbutton_defocus(GTK_OBJECT(tbl));
+}
+
+static void sp_ddc_angle_value_changed2( GtkAdjustment *adj, GtkWidget *tbl )
+{
+    prefs_set_double_attribute( "tools.calligraphic", "angle", adj->value );
+//    spinbutton_defocus(GTK_OBJECT(tbl));
+}
+
+static void sp_ddc_width_value_changed2( GtkAdjustment *adj, GtkWidget *tbl )
+{
+    prefs_set_double_attribute( "tools.calligraphic", "width", adj->value * 0.01 );
+//    spinbutton_defocus(GTK_OBJECT(tbl));
+}
+
+static void sp_ddc_velthin_value_changed2( GtkAdjustment *adj, GtkWidget *tbl )
+{
+    prefs_set_double_attribute("tools.calligraphic", "thinning", adj->value);
+//    spinbutton_defocus(GTK_OBJECT(tbl));
+}
+
+static void sp_ddc_flatness_value_changed2( GtkAdjustment *adj, GtkWidget *tbl )
+{
+    prefs_set_double_attribute( "tools.calligraphic", "flatness", adj->value );
+//    spinbutton_defocus(GTK_OBJECT(tbl));
+}
+
+static void sp_ddc_tremor_value_changed2( GtkAdjustment *adj, GtkWidget *tbl )
+{
+    prefs_set_double_attribute( "tools.calligraphic", "tremor", adj->value );
+//    spinbutton_defocus(GTK_OBJECT(tbl));
+}
+
+static void sp_ddc_cap_rounding_value_changed2( GtkAdjustment *adj, GtkWidget *tbl )
+{
+    prefs_set_double_attribute( "tools.calligraphic", "cap_rounding", adj->value );
+//    spinbutton_defocus(GTK_OBJECT(tbl));
+}
+
+static void sp_ddc_pressure_state_changed2( GtkToggleAction *act, gpointer data )
+{
+    prefs_set_int_attribute( "tools.calligraphic", "usepressure", gtk_toggle_action_get_active( act ) ? 1 : 0);
+}
+
+static void sp_ddc_tilt_state_changed2( GtkToggleAction *act, GtkAction *calligraphy_angle )
+{
+    prefs_set_int_attribute( "tools.calligraphic", "usetilt", gtk_toggle_action_get_active( act ) ? 1 : 0 );
+
+    gtk_action_set_sensitive( calligraphy_angle, !gtk_toggle_action_get_active( act ) );
+}
+
+static void sp_ddc_defaults2(GtkWidget *, GtkWidget *dataKludge)
+{
+    // FIXME: make defaults settable via Inkscape Options
+    struct KeyValue {
+        char const *key;
+        double value;
+    } const key_values[] = {
+        {"mass", 0.02},
+        {"wiggle", 0.0},
+        {"angle", 30.0},
+        {"width", 15},
+        {"thinning", 0.1},
+        {"tremor", 0.0},
+        {"flatness", 0.9},
+        {"cap_rounding", 0.0}
+    };
+
+    for (unsigned i = 0; i < G_N_ELEMENTS(key_values); ++i) {
+        KeyValue const &kv = key_values[i];
+        GtkAdjustment* adj = static_cast<GtkAdjustment *>(gtk_object_get_data(GTK_OBJECT(dataKludge), kv.key));
+        if ( adj ) {
+            gtk_adjustment_set_value(adj, kv.value);
+        }
+    }
+
+//    spinbutton_defocus(GTK_OBJECT(tbl));
+}
+
 static void
 sp_ddc_mass_value_changed(GtkAdjustment *adj, GtkWidget *tbl)
 {
@@ -1943,9 +2068,9 @@ sp_ddc_mass_value_changed(GtkAdjustment *adj, GtkWidget *tbl)
 }
 
 static void
-sp_ddc_drag_value_changed(GtkAdjustment *adj, GtkWidget *tbl)
+sp_ddc_wiggle_value_changed(GtkAdjustment *adj, GtkWidget *tbl)
 {
-    prefs_set_double_attribute("tools.calligraphic", "drag", adj->value);
+    prefs_set_double_attribute("tools.calligraphic", "wiggle", adj->value);
     spinbutton_defocus(GTK_OBJECT(tbl));
 }
 
@@ -2013,7 +2138,7 @@ static void sp_ddc_defaults(GtkWidget *, GtkWidget *tbl)
         double value;
     } const key_values[] = {
         {"mass", 0.02},
-        {"drag", 1.0},
+        {"wiggle", 0.0},
         {"angle", 30.0},
         {"width", 15},
         {"thinning", 0.1},
@@ -2031,9 +2156,186 @@ static void sp_ddc_defaults(GtkWidget *, GtkWidget *tbl)
     spinbutton_defocus(GTK_OBJECT(tbl));
 }
 
+
+
+
 static GtkWidget *
 sp_calligraphy_toolbox_new(SPDesktop *desktop)
 {
+  if ( prefs_get_int_attribute_limited( "options.stocktoolbars", "value", 1, 0, 1 ) ) {
+    GtkWidget *toolBar = 0;
+    GtkWidget* holder = gtk_table_new( 1, 2, FALSE );
+
+    gchar const * descr =
+        "<ui>"
+        "  <toolbar name='CalligraphyToolbar'>"
+        "    <separator />"
+        "    <toolitem name='Width' action='WidthAction' />"
+        "    <toolitem name='Thinning' action='ThinningAction' />"
+        "    <separator />"
+        "    <toolitem name='Angle' action='AngleAction' />"
+        "    <toolitem action='FixationAction' />"
+        "    <toolitem action='CapRoundingAction' />"
+        "    <separator />"
+        "    <toolitem action='TremorAction' />"
+        "    <toolitem action='WiggleAction' />"
+        "    <toolitem action='MassAction' />"
+        "    <separator />"
+        "    <toolitem action='PressureAction' />"
+        "    <toolitem action='TiltAction' />"
+        "    <toolitem action='ResetAction' />"
+        "  </toolbar>"
+        "</ui>";
+    GtkUIManager* mgr = gtk_ui_manager_new();
+    GError* errVal = 0;
+    GtkActionGroup* mainActions = gtk_action_group_new("main");
+
+    {
+        EgeAdjustmentAction* calligraphy_angle = 0;
+        EgeAdjustmentAction* eact = 0;
+
+        /* Width */
+        eact = create_adjustment_action( "WidthAction",
+                                         _("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,
+                                         sp_ddc_width_value_changed2,  0.01, 0, 100 );
+        gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
+        gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
+
+        /* Thinning */
+        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,
+                                         sp_ddc_velthin_value_changed2, 0.01, 2);
+        gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
+        gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
+
+        /* Angle */
+        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,
+                                         sp_ddc_angle_value_changed2, 1, 0 );
+        gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
+        gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
+        calligraphy_angle = eact;
+
+        /* Fixation */
+        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,
+                                         sp_ddc_flatness_value_changed2, 0.01, 2 );
+        gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
+        gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
+
+        /* Cap Rounding */
+        // TRANSLATORS: "cap" means "end" (both start and finish) here
+        eact = create_adjustment_action( "CapRoundingAction",
+                                         _("Round:"), _("Increase to round the ends of strokes"),
+                                         "tools.calligraphic", "cap_rounding", 0.0,
+                                         GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL,
+                                         0.0, 1.0, 0.01, 0.1,
+                                         sp_ddc_cap_rounding_value_changed2, 0.01, 2 );
+        gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
+        gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
+
+        /* Tremor */
+        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,
+                                         sp_ddc_tremor_value_changed2, 0.01, 2 );
+
+        gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
+        gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
+
+        /* Wiggle */
+        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,
+                                         sp_ddc_wiggle_value_changed2, 0.01, 2 );
+        gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
+        gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
+
+        /* Mass */
+        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,
+                                         sp_ddc_mass_value_changed2, 0.01, 2 );
+        gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
+        gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
+
+
+        /* Use Pressure button */
+        {
+            InkToggleAction* act = ink_toggle_action_new( "PressureAction",
+                                                          "Pressure",
+                                                          "Use the pressure of the input device to alter the width of the pen",
+                                                          "use_pressure",
+                                                          Inkscape::ICON_SIZE_DECORATION );
+            gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
+            g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_ddc_pressure_state_changed2), NULL);
+            gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.calligraphic", "usepressure", 1 ) );
+        }
+
+        /* Use Tilt button */
+        {
+            InkToggleAction* act = ink_toggle_action_new( "TiltAction",
+                                                          "Tilt",
+                                                          "Use the tilt of the input device to alter the angle of the pen's nib",
+                                                          "use_tilt",
+                                                          Inkscape::ICON_SIZE_DECORATION );
+            gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
+            g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_ddc_tilt_state_changed2), calligraphy_angle );
+            gtk_action_set_sensitive( GTK_ACTION(calligraphy_angle), !prefs_get_int_attribute( "tools.calligraphic", "usetilt", 1 ) );
+            gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.calligraphic", "usetilt", 1 ) );
+        }
+
+        /* Reset */
+        {
+            GtkAction* act = gtk_action_new( "ResetAction",
+                                             _("Defaults"),
+                                             _("Reset shape parameters to defaults (use Inkscape Preferences > Tools to change defaults)"),
+                                             GTK_STOCK_CLEAR );
+            g_signal_connect_after( G_OBJECT(act), "activate", G_CALLBACK(sp_ddc_defaults2), holder );
+            gtk_action_group_add_action( mainActions, act );
+            gtk_action_set_sensitive( act, TRUE );
+        }
+    }
+
+
+    gtk_ui_manager_insert_action_group( mgr, mainActions, 0 );
+    gtk_ui_manager_add_ui_from_string( mgr, descr, -1, &errVal );
+
+    toolBar = gtk_ui_manager_get_widget( mgr, "/ui/CalligraphyToolbar" );
+    gtk_toolbar_set_style( GTK_TOOLBAR(toolBar), GTK_TOOLBAR_ICONS );
+    gtk_toolbar_set_icon_size( GTK_TOOLBAR(toolBar), GTK_ICON_SIZE_SMALL_TOOLBAR );
+
+
+    gtk_table_attach( GTK_TABLE(holder), toolBar, 0, 1, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0 );
+
+    Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch(NULL);
+    swatch->setWatchedTool ("tools.calligraphic", true);
+    GtkWidget *swatch_ = GTK_WIDGET(swatch->gobj());
+    gtk_table_attach( GTK_TABLE(holder), swatch_, 1, 2, 0, 1, (GtkAttachOptions)(GTK_SHRINK | GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), AUX_BETWEEN_BUTTON_GROUPS, 0 );
+
+    gtk_widget_show_all(holder);
+    //sp_set_font_size_smaller (tbl);
+
+    return holder;
+  } else {
     GtkWidget *tbl = gtk_hbox_new(FALSE, 0);
     gtk_object_set_data(GTK_OBJECT(tbl), "dtw", desktop->canvas);
     gtk_object_set_data(GTK_OBJECT(tbl), "desktop", desktop);
@@ -2079,7 +2381,7 @@ sp_calligraphy_toolbox_new(SPDesktop *desktop)
 
     /* Fixation */
     {
-        GtkWidget *hb = sp_tb_spinbutton(_("Fixation:"), _("How fixed is the pen angle (0 = always perpendicular to stroke direction, 1 = fixed)"),
+        GtkWidget *hb = sp_tb_spinbutton(_("Fixation:"), _("Angle behavior (0 = nib always perpendicular to stroke direction, 1 = fixed angle)"),
                                          "tools.calligraphic", "flatness", 0.9,
                                          NULL, tbl, FALSE, NULL,
                                          0.0, 1.0, 0.01, 0.1,
@@ -2087,12 +2389,23 @@ sp_calligraphy_toolbox_new(SPDesktop *desktop)
         gtk_box_pack_start(GTK_BOX(tbl), hb, FALSE, FALSE, AUX_SPACING);
     }
 
+    /* Cap Rounding */
+    {
+        // TRANSLATORS: "cap" means "end" (both start and finish) here
+        GtkWidget *hb = sp_tb_spinbutton(_("Round:"), _("Increase to round the ends of strokes"),
+                                         "tools.calligraphic", "cap_rounding", 0.0,
+                                         NULL, tbl, FALSE, NULL,
+                                         0.0, 1.0, 0.01, 0.1,
+                                         sp_ddc_cap_rounding_value_changed, 0.01, 2);
+        gtk_box_pack_start(GTK_BOX(tbl), hb, FALSE, FALSE, AUX_SPACING);
+    }
+
     //  interval
     gtk_box_pack_start(GTK_BOX(tbl), gtk_hbox_new(FALSE, 0), FALSE, FALSE, AUX_BETWEEN_BUTTON_GROUPS);
 
     /* Tremor */
     {
-        GtkWidget *hb = sp_tb_spinbutton(_("Tremor:"), _("How uneven or trembling is the pen stroke"),
+        GtkWidget *hb = sp_tb_spinbutton(_("Tremor:"), _("Increase to make strokes rugged and trembling"),
                                          "tools.calligraphic", "tremor", 0.0,
                                          NULL, tbl, FALSE, NULL,
                                          0.0, 1.0, 0.01, 0.1,
@@ -2100,35 +2413,24 @@ sp_calligraphy_toolbox_new(SPDesktop *desktop)
         gtk_box_pack_start(GTK_BOX(tbl), hb, FALSE, FALSE, AUX_SPACING);
     }
 
-    /* Mass */
+    /* Wiggle */
     {
-        GtkWidget *hb = sp_tb_spinbutton(_("Mass:"), _("How much inertia affects the movement of the pen"),
-                                         "tools.calligraphic", "mass", 0.02,
+        GtkWidget *hb = sp_tb_spinbutton(_("Wiggle:"), _("Increase to make the pen waver and wiggle"),
+                                         "tools.calligraphic", "wiggle", 0.0,
                                          NULL, tbl, FALSE, NULL,
                                          0.0, 1.0, 0.01, 0.1,
-                                         sp_ddc_mass_value_changed, 0.01, 2);
+                                         sp_ddc_wiggle_value_changed, 0.01, 2);
         gtk_box_pack_start(GTK_BOX(tbl), hb, FALSE, FALSE, AUX_SPACING);
     }
 
-    /* Drag */
-    {
-        // TRANSLATORS: "drag" means "resistance" here
-        GtkWidget *hb = sp_tb_spinbutton(_("Drag:"), _("How much resistance affects the movement of the pen"),
-                                         "tools.calligraphic", "drag", 1,
-                                         NULL, tbl, FALSE, NULL,
-                                         0.0, 1.0, 0.01, 0.1,
-                                         sp_ddc_drag_value_changed, 0.01, 2);
-        gtk_box_pack_start(GTK_BOX(tbl), hb, FALSE, FALSE, AUX_SPACING);
-    }
 
-    /* Cap Rounding */
+    /* Mass */
     {
-        // TRANSLATORS: "cap" means "end" (both start and finish) here
-        GtkWidget *hb = sp_tb_spinbutton(_("Round:"), _("How much the ends of a stroke are rounded"),
-                                         "tools.calligraphic", "cap_rounding", 1,
+        GtkWidget *hb = sp_tb_spinbutton(_("Mass:"), _("Increase to make the pen drag behind, as if slowed by inertia"),
+                                         "tools.calligraphic", "mass", 0.02,
                                          NULL, tbl, FALSE, NULL,
                                          0.0, 1.0, 0.01, 0.1,
-                                         sp_ddc_cap_rounding_value_changed, 0.01, 2);
+                                         sp_ddc_mass_value_changed, 0.01, 2);
         gtk_box_pack_start(GTK_BOX(tbl), hb, FALSE, FALSE, AUX_SPACING);
     }
 
@@ -2189,6 +2491,7 @@ sp_calligraphy_toolbox_new(SPDesktop *desktop)
     sp_set_font_size_smaller (tbl);
 
     return tbl;
+  }
 }
 
 
@@ -2265,7 +2568,7 @@ sp_arctb_startend_value_changed(GtkAdjustment *adj, GtkWidget *tbl, gchar const
 
     if (modmade) {
         sp_document_maybe_done(sp_desktop_document(desktop), value_name, SP_VERB_CONTEXT_ARC, 
-                               /* TODO: annotate */ "toolbox.cpp:2247");
+                                   _("Arc: Change start/end"));
     }
 
     // defocus spinbuttons by moving focus to the canvas, unless "stay" is on
@@ -2338,7 +2641,7 @@ sp_arctb_open_state_changed(GtkWidget *widget, GtkObject *tbl)
 
     if (modmade) {
         sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC, 
-                         /* TODO: annotate */ "toolbox.cpp:2320");
+                                   _("Arc: Change open/closed"));
     }
 
     g_object_set_data(G_OBJECT(tbl), "freeze", GINT_TO_POINTER(FALSE));
@@ -3071,7 +3374,7 @@ sp_text_toolbox_family_changed (GtkTreeSelection    *selection,
     }
 
     sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, 
-                      /* TODO: annotate */ "toolbox.cpp:3024");
+                                   _("Text: Change font family"));
     sp_repr_css_attr_unref (css);
     free (family);
     gtk_widget_hide (GTK_WIDGET (g_object_get_data (G_OBJECT(tbl), "warning-image")));        
@@ -3154,7 +3457,7 @@ sp_text_toolbox_anchoring_toggled (GtkRadioButton   *button,
 
     sp_desktop_set_style (desktop, css, true, true);
     sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, 
-                      /* TODO: annotate */ "toolbox.cpp:3107");
+                                   _("Text: Change alignment"));
     sp_repr_css_attr_unref (css);
 
     gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
@@ -3200,7 +3503,7 @@ sp_text_toolbox_style_toggled (GtkToggleButton  *button,
 
     sp_desktop_set_style (desktop, css, true, true);
     sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, 
-                      /* TODO: annotate */ "toolbox.cpp:3153");
+                                   _("Text: Change font style"));
     sp_repr_css_attr_unref (css);
 
     gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
@@ -3247,7 +3550,7 @@ sp_text_toolbox_orientation_toggled (GtkRadioButton  *button,
 
     sp_desktop_set_style (desktop, css, true, true);
     sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, 
-                      /* TODO: annotate */ "toolbox.cpp:3200");
+                                   _("Text: Change orientation"));
     sp_repr_css_attr_unref (css);
 
     gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
@@ -3343,7 +3646,7 @@ sp_text_toolbox_size_changed  (GtkComboBox *cbox,
 
     sp_desktop_set_style (desktop, css, true, true);
     sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:size", SP_VERB_NONE, 
-                            /* TODO: annotate */ "toolbox.cpp:3296");
+                                   _("Text: Change font size"));
     sp_repr_css_attr_unref (css);
 
 
@@ -3909,7 +4212,7 @@ static void connector_spacing_changed(GtkAdjustment *adj, GtkWidget *tbl)
     }
     
     sp_document_done(doc, SP_VERB_CONTEXT_CONNECTOR, 
-            _("Change connector spacing distance"));
+            _("Change connector spacing"));
 
     g_object_set_data(G_OBJECT(tbl), "freeze", GINT_TO_POINTER(FALSE));
     
@@ -3928,7 +4231,7 @@ static void sp_connector_graph_layout(void)
 
     prefs_set_int_attribute("options.clonecompensation", "value", saved_compensation);
 
-    sp_document_done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, /* TODO: annotate */ "toolbox.cpp:129");
+    sp_document_done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Arrange connector network"));
 }
 
 static void