summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0ecfdc3)
raw | patch | inline | side by side (parent: 0ecfdc3)
author | cilix42 <cilix42@users.sourceforge.net> | |
Thu, 16 Aug 2007 14:09:05 +0000 (14:09 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Thu, 16 Aug 2007 14:09:05 +0000 (14:09 +0000) |
src/box3d-context.cpp | patch | blob | history | |
src/box3d-context.h | patch | blob | history | |
src/object-edit.cpp | patch | blob | history | |
src/widgets/toolbox.cpp | patch | blob | history |
diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp
index 667bfca610b76d62bf4c100652d7c81de02164ec..b11eb4c1df05a6703cc0d0d771ba4028d56bc250 100644 (file)
--- a/src/box3d-context.cpp
+++ b/src/box3d-context.cpp
event_context_class->item_handler = sp_3dbox_context_item_handler;
}
-guint SP3DBoxContext::number_of_handles = 3;
-
static void sp_3dbox_context_init(SP3DBoxContext *box3d_context)
{
SPEventContext *event_context = SP_EVENT_CONTEXT(box3d_context);
diff --git a/src/box3d-context.h b/src/box3d-context.h
index 6d2e560d45f610ad4ca03ef06e50e571237c3480..33176ae84565316464af1292e75803e24375acca 100644 (file)
--- a/src/box3d-context.h
+++ b/src/box3d-context.h
Box3D::VPDrag * _vpdrag;
- /* temporary member until the precise behaviour is sorted out */
- static guint number_of_handles;
-
sigc::connection sel_changed_connection;
Inkscape::MessageContext *_message_context;
diff --git a/src/object-edit.cpp b/src/object-edit.cpp
index bd3bd19027d794b8e087f97e5af3766d9bf05fcd..b156465206d0c338fcf2f8c14dd77f47022be118 100644 (file)
--- a/src/object-edit.cpp
+++ b/src/object-edit.cpp
static SPKnotHolder *sp_rect_knot_holder(SPItem *item, SPDesktop *desktop);
//static
-SPKnotHolder *sp_3dbox_knot_holder(SPItem *item, SPDesktop *desktop, guint number_of_handles);
+SPKnotHolder *sp_3dbox_knot_holder(SPItem *item, SPDesktop *desktop);
static SPKnotHolder *sp_arc_knot_holder(SPItem *item, SPDesktop *desktop);
static SPKnotHolder *sp_star_knot_holder(SPItem *item, SPDesktop *desktop);
static SPKnotHolder *sp_spiral_knot_holder(SPItem *item, SPDesktop *desktop);
if (SP_IS_RECT(item)) {
return sp_rect_knot_holder(item, desktop);
} else if (SP_IS_3DBOX(item)) {
- return sp_3dbox_knot_holder(item, desktop, SP3DBoxContext::number_of_handles);
+ return sp_3dbox_knot_holder(item, desktop);
} else if (SP_IS_ARC(item)) {
return sp_arc_knot_holder(item, desktop);
} else if (SP_IS_STAR(item)) {
@@ -535,15 +535,11 @@ static void sp_3dbox_knot_set(SPItem *item, guint knot_id, Box3D::Axis direction
g_assert(item != NULL);
SP3DBox *box = SP_3DBOX(item);
- // FIXME: Why must the coordinates be flipped vertically???
- SPDocument *doc = SP_OBJECT_DOCUMENT(box);
- gdouble height = sp_document_height(doc);
-
NR::Matrix const i2d (sp_item_i2d_affine (item));
if (direction == Box3D::Z) {
- sp_3dbox_move_corner_in_Z_direction (box, knot_id, new_pos * i2d, !(state & GDK_SHIFT_MASK));
+ sp_3dbox_move_corner_in_Z_direction (box, knot_id, new_pos * i2d, !(state & GDK_SHIFT_MASK));
} else {
- sp_3dbox_move_corner_in_XY_plane (box, knot_id, new_pos * i2d, (state & GDK_SHIFT_MASK) ? direction : Box3D::XY);
+ sp_3dbox_move_corner_in_Z_direction (box, knot_id, new_pos * i2d, (state & GDK_SHIFT_MASK));
}
sp_3dbox_update_curves (box);
sp_3dbox_set_ratios (box);
return sp_3dbox_get_corner(box, knot_id) * i2d;
}
-static void sp_3dbox_knot1_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
+static void sp_3dbox_knot0_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
{
- sp_3dbox_knot_set (item, 1, Box3D::Y, new_pos, origin, state);
+ sp_3dbox_knot_set(item, 0, Box3D::XY, new_pos, origin, state);
}
-/*
-static void sp_3dbox_knot1_set_constrained(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
+static void sp_3dbox_knot1_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
{
- sp_3dbox_knot_set (item, 1, Box3D::Y, new_pos, origin, state ^ GDK_SHIFT_MASK);
+ sp_3dbox_knot_set(item, 1, Box3D::XY, new_pos, origin, state);
}
-*/
static void sp_3dbox_knot2_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
{
- sp_3dbox_knot_set (item, 2, Box3D::X, new_pos, origin, state);
-}
-
-/*
-static void sp_3dbox_knot2_set_constrained(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
-{
- sp_3dbox_knot_set (item, 2, Box3D::X, new_pos, origin, state ^ GDK_SHIFT_MASK);
+ sp_3dbox_knot_set(item, 2, Box3D::XY, new_pos, origin, state);
}
static void sp_3dbox_knot3_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
{
- if (!(state & GDK_SHIFT_MASK)) {
- sp_3dbox_knot_set (item, 3, Box3D::Y, new_pos, origin, state);
- } else {
- sp_3dbox_knot_set (item, 3, Box3D::Z, new_pos, origin, state ^ GDK_SHIFT_MASK);
- }
-}
-*/
-
-static void sp_3dbox_knot5_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
-{
- sp_3dbox_knot_set (item, 5, Box3D::Z, new_pos, origin, state);
-}
-
-/*
-static void sp_3dbox_knot7_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
-{
- sp_3dbox_knot_set (item, 7, Box3D::Z, new_pos, origin, state);
-}
-*/
-
-// defined a uniform behaviour for all knots
-static void sp_3dbox_knot_set_uniformly(SPItem *item, guint knot_id, Box3D::Axis direction, NR::Point const &new_pos, NR::Point const &origin, guint state)
-{
- g_assert(item != NULL);
- SP3DBox *box = SP_3DBOX(item);
-
- NR::Matrix const i2d (sp_item_i2d_affine (item));
- if (direction == Box3D::Z) {
- sp_3dbox_move_corner_in_Z_direction (box, knot_id, new_pos * i2d, !(state & GDK_SHIFT_MASK));
- } else {
- sp_3dbox_move_corner_in_Z_direction (box, knot_id, new_pos * i2d, (state & GDK_SHIFT_MASK));
- }
- sp_3dbox_update_curves (box);
- sp_3dbox_set_ratios (box);
- sp_3dbox_update_perspective_lines ();
- sp_3dbox_set_z_orders (box);
-}
-
-static void sp_3dbox_knot0_set_uniformly(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
-{
- sp_3dbox_knot_set_uniformly(item, 0, Box3D::XY, new_pos, origin, state);
+ sp_3dbox_knot_set(item, 3, Box3D::XY, new_pos, origin, state);
}
-static void sp_3dbox_knot1_set_uniformly(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
+static void sp_3dbox_knot4_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
{
- sp_3dbox_knot_set_uniformly(item, 1, Box3D::XY, new_pos, origin, state);
+ sp_3dbox_knot_set(item, 4, Box3D::Z, new_pos, origin, state);
}
-static void sp_3dbox_knot2_set_uniformly(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
-{
- sp_3dbox_knot_set_uniformly(item, 2, Box3D::XY, new_pos, origin, state);
-}
-
-static void sp_3dbox_knot3_set_uniformly(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
-{
- sp_3dbox_knot_set_uniformly(item, 3, Box3D::XY, new_pos, origin, state);
-}
-
-static void sp_3dbox_knot4_set_uniformly(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
-{
- sp_3dbox_knot_set_uniformly(item, 4, Box3D::Z, new_pos, origin, state);
-}
-
-static void sp_3dbox_knot5_set_uniformly(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
+static void sp_3dbox_knot5_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
{
- sp_3dbox_knot_set_uniformly(item, 5, Box3D::Z, new_pos, origin, state);
+ sp_3dbox_knot_set(item, 5, Box3D::Z, new_pos, origin, state);
}
-static void sp_3dbox_knot6_set_uniformly(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
+static void sp_3dbox_knot6_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
{
- sp_3dbox_knot_set_uniformly(item, 6, Box3D::Z, new_pos, origin, state);
+ sp_3dbox_knot_set(item, 6, Box3D::Z, new_pos, origin, state);
}
-static void sp_3dbox_knot7_set_uniformly(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
+static void sp_3dbox_knot7_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
{
- sp_3dbox_knot_set_uniformly(item, 7, Box3D::Z, new_pos, origin, state);
+ sp_3dbox_knot_set(item, 7, Box3D::Z, new_pos, origin, state);
}
static NR::Point sp_3dbox_knot0_get(SPItem *item)
//static
SPKnotHolder *
-sp_3dbox_knot_holder(SPItem *item, SPDesktop *desktop, guint number_of_handles)
+sp_3dbox_knot_holder(SPItem *item, SPDesktop *desktop)
{
g_assert(item != NULL);
SPKnotHolder *knot_holder = sp_knot_holder_new(desktop, item, NULL);
- switch (number_of_handles) {
- case 3:
- sp_knot_holder_add(knot_holder, sp_3dbox_knot1_set, sp_3dbox_knot1_get, NULL,_("Resize box in X/Y direction"));
- sp_knot_holder_add(knot_holder, sp_3dbox_knot2_set, sp_3dbox_knot2_get, NULL,_("Resize box in X/Y direction"));
- sp_knot_holder_add(knot_holder, sp_3dbox_knot5_set, sp_3dbox_knot5_get, NULL,_("Resize box in Z direction"));
- sp_pat_knot_holder(item, knot_holder);
- break;
- case 4:
- /***
- sp_knot_holder_add(knot_holder, sp_3dbox_knot1_set_constrained, sp_3dbox_knot1_get, NULL,_("Resize box in X/Y direction"));
- sp_knot_holder_add(knot_holder, sp_3dbox_knot2_set_constrained, sp_3dbox_knot2_get, NULL,_("Resize box in X/Y direction"));
- sp_knot_holder_add_full(knot_holder, sp_3dbox_knot3_set, sp_3dbox_knot3_get, NULL,
- SP_KNOT_SHAPE_CIRCLE, SP_KNOT_MODE_XOR, _("Resize box in Y direction"));
- sp_knot_holder_add(knot_holder, sp_3dbox_knot7_set, sp_3dbox_knot7_get, NULL,_("Resize box in Z direction"));
- ***/
- sp_knot_holder_add(knot_holder, sp_3dbox_knot0_set_uniformly, sp_3dbox_knot0_get, NULL,
- _("Resize box in X/Y direction; with <b>Shift</b> along the Z axis"));
- sp_knot_holder_add(knot_holder, sp_3dbox_knot1_set_uniformly, sp_3dbox_knot1_get, NULL,
- _("Resize box in X/Y direction; with <b>Shift</b> along the Z axis"));
- sp_knot_holder_add(knot_holder, sp_3dbox_knot2_set_uniformly, sp_3dbox_knot2_get, NULL,
- _("Resize box in X/Y direction; with <b>Shift</b> along the Z axis"));
- sp_knot_holder_add(knot_holder, sp_3dbox_knot3_set_uniformly, sp_3dbox_knot3_get, NULL,
- _("Resize box in X/Y direction; with <b>Shift</b> along the Z axis"));
- sp_knot_holder_add(knot_holder, sp_3dbox_knot4_set_uniformly, sp_3dbox_knot4_get, NULL,
- _("Resize box along the Z axis; with <b>Shift</b> in X/Y direction"));
- sp_knot_holder_add(knot_holder, sp_3dbox_knot5_set_uniformly, sp_3dbox_knot5_get, NULL,
- _("Resize box along the Z axis; with <b>Shift</b> in X/Y direction"));
- sp_knot_holder_add(knot_holder, sp_3dbox_knot6_set_uniformly, sp_3dbox_knot6_get, NULL,
- _("Resize box along the Z axis; with <b>Shift</b> in X/Y direction"));
- sp_knot_holder_add(knot_holder, sp_3dbox_knot7_set_uniformly, sp_3dbox_knot7_get, NULL,
- _("Resize box along the Z axis; with <b>Shift</b> in X/Y direction"));
- sp_pat_knot_holder(item, knot_holder);
- break;
- default:
- g_print ("Wrong number of handles (%d): Not implemented yet.\n", number_of_handles);
- break;
- }
+ sp_knot_holder_add(knot_holder, sp_3dbox_knot0_set, sp_3dbox_knot0_get, NULL,
+ _("Resize box in X/Y direction; with <b>Shift</b> along the Z axis"));
+ sp_knot_holder_add(knot_holder, sp_3dbox_knot1_set, sp_3dbox_knot1_get, NULL,
+ _("Resize box in X/Y direction; with <b>Shift</b> along the Z axis"));
+ sp_knot_holder_add(knot_holder, sp_3dbox_knot2_set, sp_3dbox_knot2_get, NULL,
+ _("Resize box in X/Y direction; with <b>Shift</b> along the Z axis"));
+ sp_knot_holder_add(knot_holder, sp_3dbox_knot3_set, sp_3dbox_knot3_get, NULL,
+ _("Resize box in X/Y direction; with <b>Shift</b> along the Z axis"));
+ sp_knot_holder_add(knot_holder, sp_3dbox_knot4_set, sp_3dbox_knot4_get, NULL,
+ _("Resize box along the Z axis; with <b>Shift</b> in X/Y direction"));
+ sp_knot_holder_add(knot_holder, sp_3dbox_knot5_set, sp_3dbox_knot5_get, NULL,
+ _("Resize box along the Z axis; with <b>Shift</b> in X/Y direction"));
+ sp_knot_holder_add(knot_holder, sp_3dbox_knot6_set, sp_3dbox_knot6_get, NULL,
+ _("Resize box along the Z axis; with <b>Shift</b> in X/Y direction"));
+ sp_knot_holder_add(knot_holder, sp_3dbox_knot7_set, sp_3dbox_knot7_get, NULL,
+ _("Resize box along the Z axis; with <b>Shift</b> in X/Y direction"));
+ sp_pat_knot_holder(item, knot_holder);
return knot_holder;
}
index 7f4f637b4cae187628fe5eceea810ed912453d75..9801c9f48876c056fe53b0370b611d9275d45c09 100644 (file)
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
#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);
" <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 );
- }
}
//########################