summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2007-08-09 23:15:21 +0000
committercilix42 <cilix42@users.sourceforge.net>2007-08-09 23:15:21 +0000
commit7fa3817c33f05fe2e0c54b34a0aac68aa5480bf5 (patch)
treea3caa931344127c0da0baeadd78611c22b61a40f /src
parentTo ease testing reduced fallback operations' precision for now (diff)
downloadinkscape-7fa3817c33f05fe2e0c54b34a0aac68aa5480bf5.tar.gz
inkscape-7fa3817c33f05fe2e0c54b34a0aac68aa5480bf5.zip
Status bar tips for VP draggers
(bzr r3444)
Diffstat (limited to 'src')
-rw-r--r--src/vanishing-point.cpp56
-rw-r--r--src/vanishing-point.h2
2 files changed, 52 insertions, 6 deletions
diff --git a/src/vanishing-point.cpp b/src/vanishing-point.cpp
index 9b2c45b56..5cd8332a3 100644
--- a/src/vanishing-point.cpp
+++ b/src/vanishing-point.cpp
@@ -225,7 +225,7 @@ vp_knot_moved_handler (SPKnot *knot, NR::Point const *ppointer, guint state, gpo
// TODO: Update the new merged dragger
//d_new->updateKnotShape ();
- //d_new->updateTip ();
+ d_new->updateTip ();
d_new->reshapeBoxes (d_new->point, Box3D::XYZ);
d_new->updateBoxReprs ();
@@ -311,7 +311,7 @@ vp_knot_grabbed_handler (SPKnot *knot, unsigned int state, gpointer data)
// if all boxes of persp are selected, we can simply move the VP from dr_new back to dragger
dr_new->removeVP (vp);
dragger->addVP (vp);
-
+
// some cleaning up for efficiency
boxes_to_do = eliminate_remaining_boxes_of_persp_starting_from_list_position (boxes_to_do, box, persp);
} else {
@@ -340,10 +340,11 @@ vp_knot_grabbed_handler (SPKnot *knot, unsigned int state, gpointer data)
// TODO: Something is still wrong with updating the boxes' representations after snapping
//dr_new->updateBoxReprs ();
+
+ dragger->updateTip();
+ dr_new->updateTip();
}
}
-
- // TODO: Update the tips
}
static void
@@ -431,6 +432,49 @@ VPDragger::~VPDragger()
}
/**
+Updates the statusbar tip of the dragger knot, based on its draggables
+ */
+void
+VPDragger::updateTip ()
+{
+ if (this->knot && this->knot->tip) {
+ g_free (this->knot->tip);
+ this->knot->tip = NULL;
+ }
+
+ guint num = this->numberOfBoxes();
+ if (g_slist_length (this->vps) == 1) {
+ VanishingPoint *vp = (VanishingPoint *) this->vps->data;
+ switch (vp->state) {
+ case VP_FINITE:
+ this->knot->tip = g_strdup_printf (ngettext("<b>Finite</b> vanishing point shared by <b>%d</b> box",
+ "<b>Finite</b> vanishing point shared by <b>%d</b> boxes; drag with <b>Shift</b> to separate selected box(es)",
+ num),
+ num);
+ break;
+ case VP_INFINITE:
+ // This won't make sense any more when infinite VPs are not shown on the canvas,
+ // but currently we update the status message anyway
+ this->knot->tip = g_strdup_printf (ngettext("<b>Infinite</b> vanishing point shared by <b>%d</b> box",
+ "<b>Infinite</b> vanishing point shared by <b>%d</b> boxes; drag with <b>Shift</b> to separate selected box(es)",
+ num),
+ num);
+ break;
+ }
+ } else {
+ int length = g_slist_length (this->vps);
+ char *desc1 = g_strdup_printf ("Collection of <b>%d</b> vanishing points ", length);
+ char *desc2 = g_strdup_printf (ngettext("shared by <b>%d</b> box; drag with <b>Shift</b> to separate selected box(es)",
+ "shared by <b>%d</b> boxes; drag with <b>Shift</b> to separate selected box(es)",
+ num),
+ num);
+ this->knot->tip = g_strconcat(desc1, desc2, NULL);
+ g_free (desc1);
+ g_free (desc2);
+ }
+}
+
+/**
* Adds a vanishing point to the dragger (also updates the position)
*/
void
@@ -447,7 +491,7 @@ VPDragger::addVP (VanishingPoint *vp)
vp->set_pos (this->point);
this->vps = g_slist_prepend (this->vps, vp);
- //this->updateTip();
+ this->updateTip();
}
void
@@ -460,7 +504,7 @@ VPDragger::removeVP (VanishingPoint *vp)
g_assert (this->vps != NULL);
this->vps = g_slist_remove (this->vps, vp);
- //this->updateTip();
+ this->updateTip();
}
// returns the VP contained in the dragger that belongs to persp
diff --git a/src/vanishing-point.h b/src/vanishing-point.h
index 516b4a51b..70b473024 100644
--- a/src/vanishing-point.h
+++ b/src/vanishing-point.h
@@ -95,6 +95,8 @@ public:
/* returns the VP of the dragger that belongs to the given perspective */
VanishingPoint *getVPofPerspective (Perspective3D *persp);
+ void updateTip();
+
bool hasBox (const SP3DBox *box);
guint numberOfBoxes(); // the number of boxes linked to all VPs of the dragger