From 6bbeb3d1be7b279c941a500d731f315954ae3f6c Mon Sep 17 00:00:00 2001 From: Nathan Lee <2431820-nathanal@users.noreply.gitlab.com> Date: Wed, 13 Feb 2019 23:11:45 +1100 Subject: [Fix 1778449] Correct Ellipse status bar text for golden ratio Uses code for rectangle constrained at golden ratio from rect-tool.cpp Fixes https://bugs.launchpad.net/inkscape/+bug/1778449 --- src/ui/tools/arc-tool.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/ui/tools/arc-tool.cpp') diff --git a/src/ui/tools/arc-tool.cpp b/src/ui/tools/arc-tool.cpp index bae0b070b..8af5d9a1e 100644 --- a/src/ui/tools/arc-tool.cpp +++ b/src/ui/tools/arc-tool.cpp @@ -392,16 +392,39 @@ void ArcTool::drag(Geom::Point pt, guint state) { if (state & GDK_CONTROL_MASK) { int ratio_x, ratio_y; + bool is_golden_ratio = false; if (fabs (rdimx) > fabs (rdimy)) { + if (fabs(rdimx / rdimy - goldenratio) < 1e-6) { + is_golden_ratio = true; + } + ratio_x = (int) rint (rdimx / rdimy); ratio_y = 1; } else { + if (fabs(rdimy / rdimx - goldenratio) < 1e-6) { + is_golden_ratio = true; + } + ratio_x = 1; ratio_y = (int) rint (rdimy / rdimx); } - this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Ellipse: %s × %s (constrained to ratio %d:%d); with Shift to draw around the starting point"), xs.c_str(), ys.c_str(), ratio_x, ratio_y); + if (!is_golden_ratio) { + this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, + _("Ellipse: %s × %s (constrained to ratio %d:%d); with Shift to draw around the starting point"), + xs.c_str(), ys.c_str(), ratio_x, ratio_y); + } else { + if (ratio_y == 1) { + this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, + _("Ellipse: %s × %s (constrained to golden ratio 1.618 : 1); with Shift to draw around the starting point"), + xs.c_str(), ys.c_str()); + } else { + this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, + _("Ellipse: %s × %s (constrained to golden ratio 1 : 1.618); with Shift to draw around the starting point"), + xs.c_str(), ys.c_str()); + } + } } else { this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Ellipse: %s × %s; with Ctrl to make square or integer-ratio ellipse; with Shift to draw around the starting point"), xs.c_str(), ys.c_str()); } -- cgit v1.2.3 From 5c345eb88204abc69de83557cd510c0b854e883b Mon Sep 17 00:00:00 2001 From: Nathan Lee <2431820-nathanal@users.noreply.gitlab.com> Date: Wed, 13 Feb 2019 23:15:59 +1100 Subject: Golden ratio in status bar text Circle and Square can be constrained to a golden ratio. Adds this to the status bar (which noted 1:1 and integer-ratio previously) --- src/ui/tools/arc-tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tools/arc-tool.cpp') diff --git a/src/ui/tools/arc-tool.cpp b/src/ui/tools/arc-tool.cpp index 8af5d9a1e..14fe72bdd 100644 --- a/src/ui/tools/arc-tool.cpp +++ b/src/ui/tools/arc-tool.cpp @@ -426,7 +426,7 @@ void ArcTool::drag(Geom::Point pt, guint state) { } } } else { - this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Ellipse: %s × %s; with Ctrl to make square or integer-ratio ellipse; with Shift to draw around the starting point"), xs.c_str(), ys.c_str()); + this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Ellipse: %s × %s; with Ctrl to make circle, integer-ratio, or golden-ratio ellipse; with Shift to draw around the starting point"), xs.c_str(), ys.c_str()); } } -- cgit v1.2.3