Code

Reword transform toggle tooltips based on user feedback regarding the
[inkscape.git] / src / widgets / toolbox.cpp
index 7f4f637b4cae187628fe5eceea810ed912453d75..9801c9f48876c056fe53b0370b611d9275d45c09 100644 (file)
 #include "ege-select-one-action.h"
 #include "helper/unit-tracker.h"
 
-// FIXME: The next two lines are only temporarily added until
-//        the final resizing behaviour of 3D boxes is sorted out.
-#include "knotholder.h"
-SPKnotHolder *sp_3dbox_knot_holder(SPItem *item, SPDesktop *desktop, guint number_of_handles);
-
 using Inkscape::UnitTracker;
 
 typedef void (*SetupFunction)(GtkWidget *toolbox, SPDesktop *desktop);
@@ -302,8 +297,6 @@ static gchar const * ui_descr =
         "    <toolitem action='3DBoxVPYAction' />"
         "    <toolitem action='3DBoxVPZAction' />"
         "    <separator />"
-        "    <toolitem action='3DBoxHandlesAction' />"
-        "    <separator />"
         "  </toolbar>"
 
         "  <toolbar name='SpiralToolbar'>"
@@ -2138,60 +2131,6 @@ static void sp_3dbox_toggle_vp_changed( GtkToggleAction *act, gpointer data )
     
 }
 
-static void sp_3dboxtb_handles_state_changed( EgeSelectOneAction *act, GObject *tbl )
-{
-    SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" );
-    if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) {
-        if ( ege_select_one_action_get_active( act ) != 0 ) {
-            prefs_set_string_attribute("tools.shapes.3dbox", "constrainedXYmoving", "true");
-        } else {
-            prefs_set_string_attribute("tools.shapes.3dbox", "constrainedXYmoving", "false");
-        }
-    }
-
-    // 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) );
-
-    bool modmade = false;
-
-    SPEventContext *ec = SP_EVENT_CONTEXT(inkscape_active_event_context());
-    if (!SP_IS_3DBOX_CONTEXT(ec)) return;
-    SP3DBoxContext *bc = SP_3DBOX_CONTEXT(ec);
-    for (GSList const *items = sp_desktop_selection(desktop)->itemList();
-         items != NULL;
-         items = items->next)
-    {
-        if (SP_IS_3DBOX((SPItem *) items->data)) {
-            if (ec->shape_knot_holder) {
-                sp_knot_holder_destroy(ec->shape_knot_holder);
-                if ( ege_select_one_action_get_active(act) != 0 ) {
-                    bc->number_of_handles = 4;
-                    ec->shape_knot_holder = sp_3dbox_knot_holder((SPItem *) items->data, SP_ACTIVE_DESKTOP, 4);;
-                } else {
-                    bc->number_of_handles = 3;
-                    ec->shape_knot_holder = sp_3dbox_knot_holder((SPItem *) items->data, SP_ACTIVE_DESKTOP, 3);;
-                }
-            } else {
-                g_print ("Warning: No KnotHolder detected!!!\n");
-            }
-            modmade = true;
-        }
-    }
-
-    if (modmade) {
-        sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_3DBOX,
-                                   _("3D Box: Change number of handles"));
-    }
-
-    g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
-}
-
-
 static void sp_3dbox_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
 {
     SPDocument *document = sp_desktop_document (desktop);
@@ -2243,42 +2182,6 @@ static void sp_3dbox_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
     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));
     }
-
-
-    /* Number of handles and resizing behaviour */
-    {
-        GtkListStore* model = gtk_list_store_new( 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING );
-
-        GtkTreeIter iter;
-        gtk_list_store_append( model, &iter );
-        gtk_list_store_set( model, &iter,
-                            0, _("Three Handles"),
-                            1, _("Switch to three handles (arbitrary resizing in XY-direction)"),
-                            2, "3dbox_three_handles",
-                            -1 );
-
-        gtk_list_store_append( model, &iter );
-        gtk_list_store_set( model, &iter,
-                            0, _("Four Handles"),
-                            1, _("Switch to four handles (constrained resizing in XY-direction)"),
-                            2, "3dbox_four_handles",
-                            -1 );
-
-        EgeSelectOneAction* act = ege_select_one_action_new( "3DBoxHandlesAction", _(""), _(""), NULL, GTK_TREE_MODEL(model) );
-        gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
-        g_object_set_data( holder, "handles_action", act );
-
-        ege_select_one_action_set_appearance( act, "full" );
-        ege_select_one_action_set_radio_action_type( act, INK_RADIO_ACTION_TYPE );
-        g_object_set( G_OBJECT(act), "icon-property", "iconId", NULL );
-        ege_select_one_action_set_icon_column( act, 2 );
-        ege_select_one_action_set_tooltip_column( act, 1  );
-
-        gchar const *handlestr = prefs_get_string_attribute("tools.shapes.3dbox", "constrainedXYmoving");
-        bool isConstrained = (!handlestr || (handlestr && !strcmp(handlestr, "true")));
-        ege_select_one_action_set_active( act, isConstrained ? 0 : 1 );
-        g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(sp_3dboxtb_handles_state_changed), holder );
-    }
 }
 
 //########################