-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQEDView.cs
More file actions
60 lines (51 loc) · 2.42 KB
/
QEDView.cs
File metadata and controls
60 lines (51 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System;
using System.ComponentModel;
using CoreGraphics;
using CYRTextViewKit;
using Foundation;
using UIKit;
namespace CYRTextViewExample
{
[Register("QEDView")]
public class QEDView : CYRTextView
{
UIFont boldFont;
UIFont italicFont;
public QEDView(IntPtr handle) : base (handle)
{
}
public QEDView()
{
}
[Export("awakeAfterUsingCoder:")]
public NSObject AwakeAfterUsingCoder (NSCoder aDecoder)
{
QEDView view = new QEDView(Frame);
view.CopyProperties(this);
return view;
}
public QEDView(CGRect rect):base(rect)
{
Initilize();
}
private void Initilize()
{
boldFont = UIFont.FromName("Menlo-Bold", 14.0f);
italicFont = UIFont.FromName("Menlo-Italic", 14.0f);
Tokens = new[] {
new CYRToken("string", "\".*?(\"|$)", UIColor.FromRGB (24, 110, 109)),
new CYRToken("hex", "\\b0x[0-9 a-f]+\\b", UIColor.FromRGB (0, 0, 255)),
new CYRToken("float", "\\b\\d+\\.?\\d+e[\\+\\-]?\\d+\\b|\\b\\d+\\.\\d+\\b", UIColor.FromRGB (10, 136, 91)),
new CYRToken("int", "\\b\\d+\\b", UIColor.FromRGB (0, 0, 255)),
new CYRToken("operator", "[/\\*,\\;:=<>\\+\\-\\^!·≤≥|]", UIColor.FromRGB (245, 0, 110)),
new CYRToken("round_brackets", "[\\(\\)]", UIColor.FromRGB (161, 75, 0)),
new CYRToken("square_brackets", "[\\[\\]]", UIColor.FromRGB (105, 0, 0), boldFont),
new CYRToken("reserved_words", "(abs|acos|acosh|asin|asinh|atan|atanh|atomicweight|ceil|complex|cos|cosh|crandom|deriv|erf|erfc|exp|eye|floor|frac|gamma|gaussel|getconst|imag|inf|integ|integhq|inv|ln|log10|log2|machineprecision|max|maximize|min|minimize|molecularweight|ncum|ones|pi|plot|random|real|round|sgn|sin|sqr|sinh|sqrt|tan|tanh|transpose|trunc|var|zeros)",
UIColor.FromRGB (104, 0, 111), boldFont),
new CYRToken("chart_parameters", "(chartheight|charttitle|chartwidth|color|seriesname|showlegend|showxmajorgrid|showxminorgrid|showymajorgrid|showyminorgrid|transparency|thickness|xautoscale|xaxisrange|xlabel|xlogscale|xrange|yautoscale|yaxisrange|ylabel|ylogscale|yrange)",
UIColor.FromRGB (11, 81, 195)),
new CYRToken("comment", "//.*", UIColor.FromRGB (31, 131, 0), italicFont)
};
}
}
}