diff options
| author | Maximilian Albert <maximilian.albert@gmail.com> | 2007-08-29 14:47:16 +0000 |
|---|---|---|
| committer | cilix42 <cilix42@users.sourceforge.net> | 2007-08-29 14:47:16 +0000 |
| commit | 7c743348725ee5546a85c44b4abf74256423608f (patch) | |
| tree | d51ee891ec405e4bce5e7c9a67df189de81a687e /src/rect-context.cpp | |
| parent | Constrained center-dragging for 3D boxes (with Ctrl) (diff) | |
| download | inkscape-7c743348725ee5546a85c44b4abf74256423608f.tar.gz inkscape-7c743348725ee5546a85c44b4abf74256423608f.zip | |
In ellipse and rect tool: include info about width/height ratio in status messages when Ctrl+dragging
(bzr r3609)
Diffstat (limited to 'src/rect-context.cpp')
| -rw-r--r-- | src/rect-context.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/rect-context.cpp b/src/rect-context.cpp index 9c25f91c0..d069e052c 100644 --- a/src/rect-context.cpp +++ b/src/rect-context.cpp @@ -487,9 +487,23 @@ static void sp_rect_drag(SPRectContext &rc, NR::Point const pt, guint state) } // status text - GString *xs = SP_PX_TO_METRIC_STRING(r.dimensions()[NR::X], desktop->namedview->getDefaultMetric()); - GString *ys = SP_PX_TO_METRIC_STRING(r.dimensions()[NR::Y], desktop->namedview->getDefaultMetric()); - rc._message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Rectangle</b>: %s × %s; with <b>Ctrl</b> to make square or integer-ratio rectangle; with <b>Shift</b> to draw around the starting point"), xs->str, ys->str); + double rdimx = r.dimensions()[NR::X]; + double rdimy = r.dimensions()[NR::Y]; + GString *xs = SP_PX_TO_METRIC_STRING(rdimx, desktop->namedview->getDefaultMetric()); + GString *ys = SP_PX_TO_METRIC_STRING(rdimy, desktop->namedview->getDefaultMetric()); + if (state & GDK_CONTROL_MASK) { + int ratio_x, ratio_y; + if (fabs (rdimx) > fabs (rdimy)) { + ratio_x = (int) rint (rdimx / rdimy); + ratio_y = 1; + } else { + ratio_x = 1; + ratio_y = (int) rint (rdimy / rdimx); + } + rc._message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Rectangle</b>: %s × %s (constrained to ratio %d:%d); with <b>Shift</b> to draw around the starting point"), xs->str, ys->str, ratio_x, ratio_y); + } else { + rc._message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Rectangle</b>: %s × %s; with <b>Ctrl</b> to make square or integer-ratio rectangle; with <b>Shift</b> to draw around the starting point"), xs->str, ys->str); + } g_string_free(xs, FALSE); g_string_free(ys, FALSE); } |
