*MathTools: Added calculator fixes thanks to peterh

git-svn-id: svn://ultimatepp.org/upp/trunk@13025 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
koldo 2019-04-23 07:14:57 +00:00
parent 62739a306f
commit 4adb1f0f81
2 changed files with 11 additions and 9 deletions

View file

@ -202,8 +202,10 @@ String EvalExpr2::Eval2(String line, int numDecimals, int tabChars) {
String comment = TrimBoth(line.Mid(int(p.GetPtr() - line.Begin())));
newstr << TrimBoth(comment);
}
catch(CParser::Error e) {
} catch(CParser::Error e) {
lastError = e;
newstr << line << " " << Format(t_("Error %s"), GetLastError());
} catch(Exc e) {
lastError = e;
newstr << line << " " << Format(t_("Error %s"), GetLastError());
}
@ -231,7 +233,7 @@ void TabCalculator::OnChange() {
int errPos = str.Find(t_("Error"));
if (errPos >= 0)
str = TrimRight(str.Left(errPos));
String newstr = eval.Eval2(str, numDecimals, tabChars);
code.Insert(pos0, newstr);
}

View file

@ -8,22 +8,22 @@ LAYOUT(TabCalculator, 712, 360)
ITEM(Label, dv___1, SetLabel(t_("Variables")).RightPosZ(0, 136).TopPosZ(264, 18))
ITEM(Label, dv___2, SetLabel(t_("Functions")).RightPosZ(0, 136).TopPosZ(2, 18))
ITEM(Label, dv___3, SetLabel(t_("Constants")).RightPosZ(0, 136).TopPosZ(132, 18))
ITEM(Label, dv___4, SetLabel(t_("Tab. chars.")).LeftPosZ(412, 60).BottomPosZ(2, 18))
ITEM(EditIntSpin, tabChars, Max(40).Min(2).NotNull(true).LeftPosZ(472, 40).BottomPosZ(2, 18))
ITEM(Label, dv___6, SetLabel(t_("Num. decimals:")).LeftPosZ(288, 84).BottomPosZ(2, 18))
ITEM(Label, dv___4, SetLabel(t_("Tab. chars.")).LeftPosZ(412, 76).BottomPosZ(2, 18))
ITEM(EditIntSpin, tabChars, Max(40).Min(2).NotNull(true).LeftPosZ(488, 40).BottomPosZ(2, 18))
ITEM(Label, dv___6, SetLabel(t_("Num. decimals:")).LeftPosZ(272, 100).BottomPosZ(2, 18))
ITEM(EditIntSpin, numDecimals, Max(15).Min(0).NotNull(true).LeftPosZ(372, 32).BottomPosZ(2, 18))
ITEM(ArrayCtrl, gridFunctions, RightPosZ(-2, 138).TopPosZ(20, 108))
ITEM(ArrayCtrl, gridConstants, RightPosZ(-2, 138).TopPosZ(152, 108))
ITEM(ArrayCtrl, gridVariables, RightPosZ(-2, 138).VSizePosZ(284, 0))
ITEM(Option, justEdit, SetLabel(t_("Just edit")).LeftPosZ(4, 68).BottomPosZ(2, 18))
ITEM(Option, caseSensitivity, SetLabel(t_("Case sensitivity")).LeftPosZ(68, 112).BottomPosZ(2, 18))
ITEM(Option, justEdit, SetLabel(t_("Just edit")).LeftPosZ(4, 80).BottomPosZ(2, 18))
ITEM(Option, caseSensitivity, SetLabel(t_("Case sensitivity")).LeftPosZ(88, 140).BottomPosZ(2, 18))
END_LAYOUT
LAYOUT(TabData_Up, 472, 332)
ITEM(ScatterCtrl, scatter, SetPlotAreaLeftMargin(60).SetPlotAreaTopMargin(20).SetPlotAreaColor(Color(229, 229, 229)).SetAxisWidth(12).SetTitleFont(SansSerifZ(14).Bold()).SetLegendAnchor(4).HSizePosZ(0, 0).VSizePosZ(0, 0))
END_LAYOUT
LAYOUT(TabData_Down, 496, 288)
LAYOUT(TabData_Down, 564, 288)
ITEM(Option, butSetPM, SetLabel(t_("Autoset")).RightPosZ(4, 60).TopPosZ(4, 16))
ITEM(Option, butFitPM, SetLabel(t_("Auto fit")).RightPosZ(68, 60).TopPosZ(4, 16))
ITEM(EditString, editFile, HSizePosZ(44, 132).TopPosZ(4, 19))