annotate editor.js @ 127:2b25d0ce2946

Add fullscreen support and improve experience on tablet browsers by tweaking button text size and disabling zooming.
author Mike Pavone <pavone@retrodev.com>
date Tue, 06 Aug 2013 00:06:41 -0700
parents d5dc9507d612
children 8285784f5ff5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3d1b8e96f5dc Initial commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1
3d1b8e96f5dc Initial commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
2
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
3 object.prototype.toHTML = function(node, up) {
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
4 this.up = up;
120
d5dc9507d612 Basic support for selecting objects in the editor.
Mike Pavone <pavone@retrodev.com>
parents: 119
diff changeset
5 var astNode = this;
14
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
6 var el = newEl('div', {
120
d5dc9507d612 Basic support for selecting objects in the editor.
Mike Pavone <pavone@retrodev.com>
parents: 119
diff changeset
7 className: 'object',
d5dc9507d612 Basic support for selecting objects in the editor.
Mike Pavone <pavone@retrodev.com>
parents: 119
diff changeset
8 onclick: function(event) {
d5dc9507d612 Basic support for selecting objects in the editor.
Mike Pavone <pavone@retrodev.com>
parents: 119
diff changeset
9 main_module.objectClick(this, astNode, event);
d5dc9507d612 Basic support for selecting objects in the editor.
Mike Pavone <pavone@retrodev.com>
parents: 119
diff changeset
10 }
14
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
11 });
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
12 this.domNode = el;
14
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
13 node.appendChild(el);
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
14 for (var i in this.messages) {
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
15 this.messages[i].toHTML(el, this);
14
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
16 }
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
17 };
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
18
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
19 lambda.prototype.toHTML = function(node, up) {
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
20 this.up = up
28
93bbc4c8be95 Allow selection of lambda
Mike Pavone <pavone@retrodev.com>
parents: 26
diff changeset
21 var astNode = this;
14
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
22 var el = newEl('div', {
28
93bbc4c8be95 Allow selection of lambda
Mike Pavone <pavone@retrodev.com>
parents: 26
diff changeset
23 className: 'lambda',
29
18cec540238a Prevent event bubbling so lambda click handler doesn't get called when clicking on an element inside it
Mike Pavone <pavone@retrodev.com>
parents: 28
diff changeset
24 onclick: function(event) {
104
648659961e0e Get editor working again
Mike Pavone <pavone@retrodev.com>
parents: 29
diff changeset
25 main_module.lambdaClick(this, astNode, event);
28
93bbc4c8be95 Allow selection of lambda
Mike Pavone <pavone@retrodev.com>
parents: 26
diff changeset
26 }
14
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
27 });
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
28 this.domNode = el;
26
fe593c1df568 Display receiver arg in editor. Improve formatting in editor.
Mike Pavone <pavone@retrodev.com>
parents: 25
diff changeset
29 var args = newEl('div', {
fe593c1df568 Display receiver arg in editor. Improve formatting in editor.
Mike Pavone <pavone@retrodev.com>
parents: 25
diff changeset
30 className: 'args'
fe593c1df568 Display receiver arg in editor. Improve formatting in editor.
Mike Pavone <pavone@retrodev.com>
parents: 25
diff changeset
31 });
15
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
32 for (var i in this.args) {
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
33 this.args[i].toHTML(args, this);
15
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
34 }
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
35 var body = newEl('div', {
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
36 className: 'lambdabody'
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
37 });
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
38 for (var i in this.expressions) {
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
39 this.expressions[i].toHTML(body, this);
15
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
40 }
26
fe593c1df568 Display receiver arg in editor. Improve formatting in editor.
Mike Pavone <pavone@retrodev.com>
parents: 25
diff changeset
41 el.appendChild(args);
15
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
42 el.appendChild(body);
14
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
43 node.appendChild(el);
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
44 };
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
45
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
46 assignment.prototype.toHTML = function(node, up) {
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
47 this.up = up;
118
0a66fe3a368a Allow selection and navigation of assignment nodes.
Mike Pavone <pavone@retrodev.com>
parents: 116
diff changeset
48 var astNode = this;
14
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
49 var base = newEl('div', {
118
0a66fe3a368a Allow selection and navigation of assignment nodes.
Mike Pavone <pavone@retrodev.com>
parents: 116
diff changeset
50 className: 'assignment',
0a66fe3a368a Allow selection and navigation of assignment nodes.
Mike Pavone <pavone@retrodev.com>
parents: 116
diff changeset
51 onclick: function(event) {
0a66fe3a368a Allow selection and navigation of assignment nodes.
Mike Pavone <pavone@retrodev.com>
parents: 116
diff changeset
52 main_module.assignClick(this, astNode, event);
0a66fe3a368a Allow selection and navigation of assignment nodes.
Mike Pavone <pavone@retrodev.com>
parents: 116
diff changeset
53 }
14
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
54 });
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
55 var varName = newEl('span', {
118
0a66fe3a368a Allow selection and navigation of assignment nodes.
Mike Pavone <pavone@retrodev.com>
parents: 116
diff changeset
56 textContent: this.symbol.name,
0a66fe3a368a Allow selection and navigation of assignment nodes.
Mike Pavone <pavone@retrodev.com>
parents: 116
diff changeset
57 className: 'varname'
0
3d1b8e96f5dc Initial commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
58 });
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
59 this.domNode = base;
14
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
60 base.appendChild(varName);
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
61 node.appendChild(base);
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
62 this.expression.toHTML(base, this);
14
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
63 };
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
64
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
65 op.prototype.toHTML = function(node, up) {
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
66 this.up = up;
116
9cf3e0b18ecc Add support for selecting operator expressions in the editor
Mike Pavone <pavone@retrodev.com>
parents: 114
diff changeset
67 var astNode = this;
15
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
68 var base = newEl('span', {
116
9cf3e0b18ecc Add support for selecting operator expressions in the editor
Mike Pavone <pavone@retrodev.com>
parents: 114
diff changeset
69 className: 'op',
9cf3e0b18ecc Add support for selecting operator expressions in the editor
Mike Pavone <pavone@retrodev.com>
parents: 114
diff changeset
70 onclick: function(event) {
9cf3e0b18ecc Add support for selecting operator expressions in the editor
Mike Pavone <pavone@retrodev.com>
parents: 114
diff changeset
71 main_module.opClick(this, astNode, event);
9cf3e0b18ecc Add support for selecting operator expressions in the editor
Mike Pavone <pavone@retrodev.com>
parents: 114
diff changeset
72 }
15
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
73 });
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
74 this.domNode = base;
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
75 this.left.toHTML(base, this);
15
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
76 base.appendChild(newEl('span', {
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
77 textContent: this.op,
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
78 className: 'opname'
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
79 }));
114
f2b435509301 Work around desugaring of && and || in editor.
Mike Pavone <pavone@retrodev.com>
parents: 113
diff changeset
80 if (this.op == '&&' || this.op == '||') {
f2b435509301 Work around desugaring of && and || in editor.
Mike Pavone <pavone@retrodev.com>
parents: 113
diff changeset
81 this.right.expressions[0].toHTML(base, this);
f2b435509301 Work around desugaring of && and || in editor.
Mike Pavone <pavone@retrodev.com>
parents: 113
diff changeset
82 } else {
f2b435509301 Work around desugaring of && and || in editor.
Mike Pavone <pavone@retrodev.com>
parents: 113
diff changeset
83 this.right.toHTML(base, this);
f2b435509301 Work around desugaring of && and || in editor.
Mike Pavone <pavone@retrodev.com>
parents: 113
diff changeset
84 }
15
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
85 node.appendChild(base);
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
86 };
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
87
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
88 intlit.prototype.toHTML = function(node, up) {
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
89 this.up = up;
119
77f7cd65e121 Add selection of number and string literals. Support inward navigation of lambdas.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
90 var astNode = this;
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
91 this.domNode = newEl('span', {
14
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
92 className: 'integer',
119
77f7cd65e121 Add selection of number and string literals. Support inward navigation of lambdas.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
93 textContent: this.val,
77f7cd65e121 Add selection of number and string literals. Support inward navigation of lambdas.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
94 onclick: function(event) {
77f7cd65e121 Add selection of number and string literals. Support inward navigation of lambdas.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
95 main_module.scalarClick(this, astNode, event);
77f7cd65e121 Add selection of number and string literals. Support inward navigation of lambdas.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
96 }
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
97 });
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
98 node.appendChild(this.domNode);
14
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
99 };
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
100
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
101 floatlit.prototype.toHTML = function(node, up) {
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
102 this.up = up;
119
77f7cd65e121 Add selection of number and string literals. Support inward navigation of lambdas.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
103 var astNode = this;
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
104 this.domNode = newEl('span', {
14
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
105 className: 'float',
119
77f7cd65e121 Add selection of number and string literals. Support inward navigation of lambdas.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
106 textContent: this.val,
77f7cd65e121 Add selection of number and string literals. Support inward navigation of lambdas.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
107 onclick: function(event) {
77f7cd65e121 Add selection of number and string literals. Support inward navigation of lambdas.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
108 main_module.scalarClick(this, astNode, event);
77f7cd65e121 Add selection of number and string literals. Support inward navigation of lambdas.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
109 }
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
110 });
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
111 node.appendChild(this.domNode);
14
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
112 };
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
113
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
114 strlit.prototype.toHTML = function(node, up) {
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
115 this.up = up;
119
77f7cd65e121 Add selection of number and string literals. Support inward navigation of lambdas.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
116 var astNode = this;
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
117 this.domNode = newEl('span', {
14
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
118 className: 'string',
25
4d87c38404d6 List literals, fixes to implicit self property lookup, import statement and editor improvements
Mike Pavone <pavone@retrodev.com>
parents: 23
diff changeset
119 contentEditable: 'true',
119
77f7cd65e121 Add selection of number and string literals. Support inward navigation of lambdas.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
120 textContent: this.val,
77f7cd65e121 Add selection of number and string literals. Support inward navigation of lambdas.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
121 onclick: function(event) {
77f7cd65e121 Add selection of number and string literals. Support inward navigation of lambdas.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
122 main_module.scalarClick(this, astNode, event);
77f7cd65e121 Add selection of number and string literals. Support inward navigation of lambdas.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
123 }
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
124 });
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
125 node.appendChild(this.domNode);
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
126 };
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
127
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
128 listlit.prototype.toHTML = function(node, up) {
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
129 this.up = up;
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
130 this.domNode = newEl('span', {
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
131 className: 'list',
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
132 });
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
133 for (var i = 0; i < this.val.length; i++) {
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
134 this.val[i].toHTML(this.domNode, this);
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
135 }
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
136 node.appendChild(this.domNode);
14
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
137 };
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
138
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
139 arraylit.prototype.toHTML = function(node, up) {
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
140 this.up = up;
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
141 this.domNode = newEl('span', {
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
142 className: 'array',
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
143 });
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
144 for (var i = 0; i < this.val.length; i++) {
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
145 this.val[i].toHTML(this.domNode, this);
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
146 }
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
147 node.appendChild(this.domNode);
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
148 };
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
149
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
150 funcall.prototype.toHTML = function(node, up) {
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
151 this.up = up;
25
4d87c38404d6 List literals, fixes to implicit self property lookup, import statement and editor improvements
Mike Pavone <pavone@retrodev.com>
parents: 23
diff changeset
152 var astNode = this;
15
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
153 var base = newEl('div', {
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
154 className: 'funcall',
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
155 onclick: function(event) {
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
156 main_module.funClick(this, astNode, event);
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
157 }
15
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
158 });
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
159 this.domNode = base;
26
fe593c1df568 Display receiver arg in editor. Improve formatting in editor.
Mike Pavone <pavone@retrodev.com>
parents: 25
diff changeset
160 if (this.receiver) {
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
161 this.receiver.toHTML(base, this);
26
fe593c1df568 Display receiver arg in editor. Improve formatting in editor.
Mike Pavone <pavone@retrodev.com>
parents: 25
diff changeset
162 }
15
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
163 var parts = this.name.split(':');
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
164 for (var i in parts ) {
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
165 if(parts[i]) {
25
4d87c38404d6 List literals, fixes to implicit self property lookup, import statement and editor improvements
Mike Pavone <pavone@retrodev.com>
parents: 23
diff changeset
166 base.appendChild(newEl('span', {
26
fe593c1df568 Display receiver arg in editor. Improve formatting in editor.
Mike Pavone <pavone@retrodev.com>
parents: 25
diff changeset
167 textContent: parts[i] + (this.receiver && parts.length == 1 ? '' : ':'),
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
168 className: 'funpart'
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
169 }));
15
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
170 if (this.args[i]) {
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
171 this.args[i].toHTML(base, this);
15
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
172 }
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
173 }
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
174 }
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
175 for (; i < this.args.length; i++) {
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
176 this.args[i].toHTML(base, this);
15
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
177 }
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
178 node.appendChild(base);
14
85fb6ba15bc6 Start turning AST into HTML in editor
Mike Pavone <pavone@retrodev.com>
parents: 0
diff changeset
179 };
15
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
180
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
181 symbol.prototype.toHTML = function(node, up) {
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
182 this.up = up;
23
068d63627b16 Populate in scope symbol buttons when clicking on a symbol in the source
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
183 var astNode = this;
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
184 this.domNode = newEl('span', {
15
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
185 className: 'symbol',
23
068d63627b16 Populate in scope symbol buttons when clicking on a symbol in the source
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
186 textContent: this.name,
29
18cec540238a Prevent event bubbling so lambda click handler doesn't get called when clicking on an element inside it
Mike Pavone <pavone@retrodev.com>
parents: 28
diff changeset
187 onclick: function(event) {
105
35006a6e1c47 Fixed more editor coderot and improved syntax/selection coloring a bit.
Mike Pavone <pavone@retrodev.com>
parents: 104
diff changeset
188 main_module.symbolClick(this, astNode, event);
23
068d63627b16 Populate in scope symbol buttons when clicking on a symbol in the source
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
189 }
113
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
190 })
c0bfff39abe3 Basic in and out navigation support added to funcall expressions. Added toHTML methods to listlit and arraylit.
Mike Pavone <pavone@retrodev.com>
parents: 110
diff changeset
191 node.appendChild(this.domNode);
15
a5ef5af3df0f Add toHTML methods to the rest of the AST nodes. Cleanup the formatting a bit
Mike Pavone <pavone@retrodev.com>
parents: 14
diff changeset
192 }
110
d715fb3c39ab Implemented clicking on symbols inside inscope box to replace function name in funcall.
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
193
d715fb3c39ab Implemented clicking on symbols inside inscope box to replace function name in funcall.
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
194 function getEl(from, idx)
d715fb3c39ab Implemented clicking on symbols inside inscope box to replace function name in funcall.
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
195 {
d715fb3c39ab Implemented clicking on symbols inside inscope box to replace function name in funcall.
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
196 return from[idx];
d715fb3c39ab Implemented clicking on symbols inside inscope box to replace function name in funcall.
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
197 }
d715fb3c39ab Implemented clicking on symbols inside inscope box to replace function name in funcall.
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
198
d715fb3c39ab Implemented clicking on symbols inside inscope box to replace function name in funcall.
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
199 function setEl(to, idx, val)
d715fb3c39ab Implemented clicking on symbols inside inscope box to replace function name in funcall.
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
200 {
d715fb3c39ab Implemented clicking on symbols inside inscope box to replace function name in funcall.
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
201 to[idx] = val;
d715fb3c39ab Implemented clicking on symbols inside inscope box to replace function name in funcall.
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
202 return to;
d715fb3c39ab Implemented clicking on symbols inside inscope box to replace function name in funcall.
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
203 }
127
2b25d0ce2946 Add fullscreen support and improve experience on tablet browsers by tweaking button text size and disabling zooming.
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
204
2b25d0ce2946 Add fullscreen support and improve experience on tablet browsers by tweaking button text size and disabling zooming.
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
205 function goFullScreen()
2b25d0ce2946 Add fullscreen support and improve experience on tablet browsers by tweaking button text size and disabling zooming.
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
206 {
2b25d0ce2946 Add fullscreen support and improve experience on tablet browsers by tweaking button text size and disabling zooming.
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
207 var el = q('body');
2b25d0ce2946 Add fullscreen support and improve experience on tablet browsers by tweaking button text size and disabling zooming.
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
208 if (el.requestFullscreen) {
2b25d0ce2946 Add fullscreen support and improve experience on tablet browsers by tweaking button text size and disabling zooming.
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
209 el.requestFullscreen();
2b25d0ce2946 Add fullscreen support and improve experience on tablet browsers by tweaking button text size and disabling zooming.
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
210 } else if (el.mozRequestFullScreen) {
2b25d0ce2946 Add fullscreen support and improve experience on tablet browsers by tweaking button text size and disabling zooming.
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
211 el.mozRequestFullScreen();
2b25d0ce2946 Add fullscreen support and improve experience on tablet browsers by tweaking button text size and disabling zooming.
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
212 } else {
2b25d0ce2946 Add fullscreen support and improve experience on tablet browsers by tweaking button text size and disabling zooming.
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
213 el.webkitRequestFullscreen();
2b25d0ce2946 Add fullscreen support and improve experience on tablet browsers by tweaking button text size and disabling zooming.
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
214 }
2b25d0ce2946 Add fullscreen support and improve experience on tablet browsers by tweaking button text size and disabling zooming.
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
215 }