summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick Storz <eduard.braun2@gmx.de>2019-02-17 21:25:24 +0000
committerPatrick Storz <eduard.braun2@gmx.de>2019-02-17 21:25:24 +0000
commitb442a4dd316e853a4ec92d7bd7caed7aea65e676 (patch)
treecf9020b7b81ecbfb1f65ff6a97de9ccb9988d4a7 /src
parentUpdate sp_action_get_title to remove Unicode Character "…" (diff)
parentGolden ratio in status bar text (diff)
downloadinkscape-b442a4dd316e853a4ec92d7bd7caed7aea65e676.tar.gz
inkscape-b442a4dd316e853a4ec92d7bd7caed7aea65e676.zip
Merge branch 'nathanal/inkscape-golden-ratio-patch'
Diffstat (limited to 'src')
-rw-r--r--src/ui/tools/arc-tool.cpp27
-rw-r--r--src/ui/tools/rect-tool.cpp2
2 files changed, 26 insertions, 3 deletions
diff --git a/src/ui/tools/arc-tool.cpp b/src/ui/tools/arc-tool.cpp
index bae0b070b..14fe72bdd 100644
--- a/src/ui/tools/arc-tool.cpp
+++ b/src/ui/tools/arc-tool.cpp
@@ -392,18 +392,41 @@ 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, _("<b>Ellipse</b>: %s &#215; %s (constrained to ratio %d:%d); with <b>Shift</b> 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,
+ _("<b>Ellipse</b>: %s &#215; %s (constrained to ratio %d:%d); with <b>Shift</b> 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,
+ _("<b>Ellipse</b>: %s &#215; %s (constrained to golden ratio 1.618 : 1); with <b>Shift</b> to draw around the starting point"),
+ xs.c_str(), ys.c_str());
+ } else {
+ this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE,
+ _("<b>Ellipse</b>: %s &#215; %s (constrained to golden ratio 1 : 1.618); with <b>Shift</b> to draw around the starting point"),
+ xs.c_str(), ys.c_str());
+ }
+ }
} else {
- this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Ellipse</b>: %s &#215; %s; with <b>Ctrl</b> to make square or integer-ratio ellipse; with <b>Shift</b> to draw around the starting point"), xs.c_str(), ys.c_str());
+ this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Ellipse</b>: %s &#215; %s; with <b>Ctrl</b> to make circle, integer-ratio, or golden-ratio ellipse; with <b>Shift</b> to draw around the starting point"), xs.c_str(), ys.c_str());
}
}
diff --git a/src/ui/tools/rect-tool.cpp b/src/ui/tools/rect-tool.cpp
index fdb7bace9..be4b49dce 100644
--- a/src/ui/tools/rect-tool.cpp
+++ b/src/ui/tools/rect-tool.cpp
@@ -443,7 +443,7 @@ void RectTool::drag(Geom::Point const pt, guint state) {
}
} else {
this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE,
- _("<b>Rectangle</b>: %s &#215; %s; with <b>Ctrl</b> to make square or integer-ratio rectangle; with <b>Shift</b> to draw around the starting point"),
+ _("<b>Rectangle</b>: %s &#215; %s; with <b>Ctrl</b> to make square, integer-ratio, or golden-ratio rectangle; with <b>Shift</b> to draw around the starting point"),
xs.c_str(), ys.c_str());
}
}