Add an explicit mirror checkbox for Paste Transformed.

This has always been possible by using negative scale, so this just
adds a checkbox controlling the sign.
This commit is contained in:
whitequark 2019-05-24 02:16:01 +00:00
parent df6777aaf3
commit 6c167db602

View File

@ -349,7 +349,7 @@ bool TextWindow::EditControlDoneForPaste(const std::string &s) {
e = Expr::From(s, /*popUpError=*/true); e = Expr::From(s, /*popUpError=*/true);
double v = e->Eval(); double v = e->Eval();
if(fabs(v) > 1e-6) { if(fabs(v) > 1e-6) {
shown.paste.scale = v; shown.paste.scale = shown.paste.scale < 0 ? -v : v;
} else { } else {
Error(_("Scale cannot be zero.")); Error(_("Scale cannot be zero."));
} }
@ -375,9 +375,13 @@ void TextWindow::ScreenChangePasteTransformed(int link, uint32_t v) {
break; break;
case 's': case 's':
SS.TW.ShowEditControl(13, ssprintf("%.3f", SS.TW.shown.paste.scale)); SS.TW.ShowEditControl(13, ssprintf("%.3f", fabs(SS.TW.shown.paste.scale)));
SS.TW.edit.meaning = Edit::PASTE_SCALE; SS.TW.edit.meaning = Edit::PASTE_SCALE;
break; break;
case 'f':
SS.TW.shown.paste.scale *= -1;
break;
} }
} }
@ -466,8 +470,11 @@ void TextWindow::ShowPasteTransformed() {
SS.MmToString(shown.paste.trans.z).c_str(), SS.MmToString(shown.paste.trans.z).c_str(),
&ScreenPasteTransformed); &ScreenPasteTransformed);
Printf(false, "%Ba %Ftscale%E %@ %Fl%Ls%f[change]%E", Printf(false, "%Ba %Ftscale%E %@ %Fl%Ls%f[change]%E",
shown.paste.scale, fabs(shown.paste.scale),
&ScreenChangePasteTransformed); &ScreenChangePasteTransformed);
Printf(false, "%Ba %Ftmirror%E %Fd%Lf%f%s flip%E",
&ScreenChangePasteTransformed,
shown.paste.scale < 0 ? CHECK_TRUE : CHECK_FALSE);
Printf(true, " %Fl%Lg%fpaste transformed now%E", &ScreenPasteTransformed); Printf(true, " %Fl%Lg%fpaste transformed now%E", &ScreenPasteTransformed);