git @ Cat's Eye Technologies Pixley / 9180433
Disable/Enable the "Wrap" button upon editing/loading. Chris Pressey 10 years ago
2 changed file(s) with 17 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
4545 <button id="start">Start</button>
4646 <button id="stop">Stop</button>
4747 <button id="step">Step</button>
48 <button onclick="c.wrapWith(document.getElementById('pixley-interpreter').innerHTML);">Wrap in Pixley Interpreter</button>
48 <button id="wrap" onclick="c.wrapWith(document.getElementById('pixley-interpreter').innerHTML);">Wrap in Pixley Interpreter</button>
4949 <input id="speed" type="range" min="0" max="200" value="0" />
5050 <span id="status"></span>
5151
233233 c.init({
234234 'status': document.getElementById('status'),
235235 'display': document.getElementById('display'),
236 'output': document.getElementById('output')
236 'output': document.getElementById('output'),
237 'wrapButton': document.getElementById('wrap')
237238 });
238239 c.connect({
239240 'start': 'start',
44 alert('ERROR! ' + msg);
55 };
66
7 var proto = new yoob.Controller();
78 function PixleyController() {
89 this.init = function(cfg) {
910 this.ast = undefined;
1011 this.status = cfg.status;
1112 this.display = cfg.display;
1213 this.output = cfg.output;
14 this.wrapButton = cfg.wrapButton;
1315 this.workerURL = cfg.workerURL || "../src/pixley-worker.js";
1416 this.loadWorker();
1517 this.running = false;
7981 this.wrapWith = function(lambdaText) {
8082 this.load('(' + lambdaText + ' (quote ' + depict(this.ast) + '))');
8183 };
84
85 // Awkward But Hopefully Successful Attempts at Calling Super Methods
86 this.click_edit = function(e) {
87 proto.click_edit.apply(this, [e]);
88 if (this.wrapButton) this.wrapButton.disabled = true;
89 };
90
91 this.click_load = function(e) {
92 proto.click_load.apply(this, [e]);
93 if (this.wrapButton) this.wrapButton.disabled = false;
94 };
8295 };
83 PixleyController.prototype = new yoob.Controller();
96 PixleyController.prototype = proto;