Skip to content

Commit

Permalink
add toyears()/fromyears()
Browse files Browse the repository at this point in the history
  • Loading branch information
shapoco committed Dec 4, 2022
1 parent 4b39475 commit fb4764a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Calctus/Model/FuncDef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ public FuncDef(string name, Func<EvalContext, Val[], Val> method) : this(name, 1

public static readonly FuncDef now = new FuncDef("now",0, (e, a) => new RealVal(UnixTime.FromLocalTime(DateTime.Now)).FormatDateTime());

public static readonly FuncDef toyears = new FuncDef("toyears", (e, a) => a[0].Div(e, new RealVal(365.2425m * 24 * 60 * 60)).FormatReal());
public static readonly FuncDef todays = new FuncDef("todays", (e, a) => a[0].Div(e, new RealVal(24 * 60 * 60)).FormatReal());
public static readonly FuncDef tohours = new FuncDef("tohours", (e, a) => a[0].Div(e, new RealVal(60 * 60)).FormatReal());
public static readonly FuncDef tominutes = new FuncDef("tominutes", (e, a) => a[0].Div(e, new RealVal(60)).FormatReal());
public static readonly FuncDef toseconds = new FuncDef("toseconds", (e, a) => a[0].FormatReal());

public static readonly FuncDef fromyears = new FuncDef("fromyears", (e, a) => a[0].Mul(e, new RealVal(365.2425m * 24 * 60 * 60)).FormatReal());
public static readonly FuncDef fromdays = new FuncDef("fromdays", (e, a) => a[0].Mul(e, new RealVal(24 * 60 * 60)).FormatReal());
public static readonly FuncDef fromhours = new FuncDef("fromhours", (e, a) => a[0].Mul(e, new RealVal(60 * 60)).FormatReal());
public static readonly FuncDef fromminutes = new FuncDef("fromminutes", (e, a) => a[0].Mul(e, new RealVal(60)).FormatReal());
Expand Down
8 changes: 4 additions & 4 deletions Calctus/UI/ExpressionBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ class ExpressionBox : Control {
public static readonly Color IdColor = Color.FromArgb(192, 255, 128);
public static readonly Color LiteralColor = Color.FromArgb(255, 192, 64);
public static readonly Color[] ParenthesisColors = new Color[] {
Color.FromArgb(64, 192 , 255),
Color.FromArgb(128, 64 , 255),
Color.FromArgb(255, 64 , 128),
Color.FromArgb(255, 192 , 64),
Color.FromArgb(64, 192, 255),
Color.FromArgb(192, 128, 255),
Color.FromArgb(255, 128, 192),
Color.FromArgb(255, 192, 64),
};
public static readonly Color SelectionColor = Color.FromArgb(128, 0, 128, 255);

Expand Down
Binary file added img/ss.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fb4764a

Please sign in to comment.