Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: samples/calculator/calculator.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/vm.gypi ('k') | samples/calculator/tape.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:html'; 5 import 'dart:html';
6 import 'dart:math' as Math; 6 import 'dart:math' as Math;
7 import 'calcui.dart'; 7 import 'calcui.dart';
8 8
9 Set numberKeyPresses; 9 Set numberKeyPresses;
10 Set operatorKeyPresses; 10 Set operatorKeyPresses;
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 tape.addToTape(Tape.OP_NOOP, currentRegister); 249 tape.addToTape(Tape.OP_NOOP, currentRegister);
250 } 250 }
251 } 251 }
252 } 252 }
253 253
254 void processNumber(int code, Element key) { 254 void processNumber(int code, Element key) {
255 String char = new String.fromCharCodes([code]); 255 String char = new String.fromCharCodes([code]);
256 256
257 // TODO(terry): Need to fix this in Dart library. 257 // TODO(terry): Need to fix this in Dart library.
258 // If there's already a . in our current register don't allow a second period. 258 // If there's already a . in our current register don't allow a second period.
259 // Math.parseDouble validates that 2.2.3.4.5 is okay and returns 2.2
260 if (char == '.' && currentRegister.indexOf('.') != -1) { 259 if (char == '.' && currentRegister.indexOf('.') != -1) {
261 // Signal dot is valid more than once for a number. 260 // Signal dot is valid more than once for a number.
262 flickerKey(padUI.keyDot, '-error'); 261 flickerKey(padUI.keyDot, '-error');
263 return; 262 return;
264 } else { 263 } else {
265 currentRegister = "${currentRegister}${char}"; 264 currentRegister = "${currentRegister}${char}";
266 } 265 }
267 266
268 flickerKey(key); 267 flickerKey(key);
269 tape.addToTape(Tape.OP_NOOP, currentRegister); 268 tape.addToTape(Tape.OP_NOOP, currentRegister);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 renderPad(element); 361 renderPad(element);
363 362
364 // Render the UI. 363 // Render the UI.
365 document.body.children.add(element); 364 document.body.children.add(element);
366 365
367 currentRegister = ""; 366 currentRegister = "";
368 total = 0.0; 367 total = 0.0;
369 368
370 setupEvents(); 369 setupEvents();
371 } 370 }
OLDNEW
« no previous file with comments | « runtime/vm/vm.gypi ('k') | samples/calculator/tape.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698