summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e831e8e)
raw | patch | inline | side by side (parent: e831e8e)
author | cilix42 <cilix42@users.sourceforge.net> | |
Wed, 29 Aug 2007 14:47:16 +0000 (14:47 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Wed, 29 Aug 2007 14:47:16 +0000 (14:47 +0000) |
src/arc-context.cpp | patch | blob | history | |
src/rect-context.cpp | patch | blob | history |
diff --git a/src/arc-context.cpp b/src/arc-context.cpp
index ab6b3a01ddf26e0a46c0b909c419d12ac11c8c14..c2ec30a64a61a50a298c6e292e75181e2fc61373 100644 (file)
--- a/src/arc-context.cpp
+++ b/src/arc-context.cpp
r.midpoint()[NR::X], r.midpoint()[NR::Y],
r.dimensions()[NR::X] / 2, r.dimensions()[NR::Y] / 2);
- 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());
- ac->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Ellipse</b>: %s × %s; with <b>Ctrl</b> to make circle or integer-ratio ellipse; 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);
+ }
+ ac->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Ellipse</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 {
+ ac->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Ellipse</b>: %s × %s; with <b>Ctrl</b> to make square or integer-ratio ellipse; with <b>Shift</b> to draw around the starting point"), xs->str, ys->str);
+ }
g_string_free(xs, FALSE);
g_string_free(ys, FALSE);
}
diff --git a/src/rect-context.cpp b/src/rect-context.cpp
index 9c25f91c01e2008498b6c7de3582cb3deea2a9e5..d069e052c977b7b9ce28e6248cce6046384cdea7 100644 (file)
--- a/src/rect-context.cpp
+++ b/src/rect-context.cpp
}
// 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);
}