311 var p = document.createElement('p'); |
311 var p = document.createElement('p'); |
312 |
312 |
313 if(NOKIA.emulator.plist.DisplayName.length <= 12) |
313 if(NOKIA.emulator.plist.DisplayName.length <= 12) |
314 p.innerHTML = NOKIA.emulator.plist.DisplayName; |
314 p.innerHTML = NOKIA.emulator.plist.DisplayName; |
315 else |
315 else |
316 p.innerHTML = NOKIA.emulator.plist.DisplayName.substr(0, 11) + '...' |
316 p.innerHTML = NOKIA.emulator.plist.DisplayName.substr(0, 11) + '...'; |
317 |
317 |
318 div.className = 'IconFile'; |
318 div.className = 'IconFile'; |
319 div.style.marginTop = parseInt(parseInt(style['widget']['height']/2)-80) + 'px'; |
319 div.style.marginTop = parseInt(parseInt(style['widget']['height']/2)-80) + 'px'; |
320 div.appendChild(img); |
320 div.appendChild(img); |
321 img.onclick = function(){ |
321 img.onclick = function(){ |
459 |
459 |
460 if(NOKIA.mode == 'portrait') |
460 if(NOKIA.mode == 'portrait') |
461 { |
461 { |
462 lsk.onclick = function(){ |
462 lsk.onclick = function(){ |
463 $("#LskLabel > a").trigger('click'); |
463 $("#LskLabel > a").trigger('click'); |
464 } |
464 }; |
465 a[0].appendChild(lsk); |
465 a[0].appendChild(lsk); |
466 |
466 |
467 rsk.onclick = function(){ |
467 rsk.onclick = function(){ |
468 $("#RskLabel > a").trigger('click'); |
468 $("#RskLabel > a").trigger('click'); |
469 } |
469 }; |
470 a[1].appendChild(rsk); |
470 a[1].appendChild(rsk); |
471 |
471 |
472 }else{ |
472 }else{ |
473 |
473 |
474 rsk.onclick = function(){ |
474 rsk.onclick = function(){ |
475 $("#RskLabel > a").trigger('click'); |
475 $("#RskLabel > a").trigger('click'); |
476 } |
476 }; |
477 a[0].appendChild(rsk); |
477 a[0].appendChild(rsk); |
478 |
478 |
479 lsk.onclick = function(){ |
479 lsk.onclick = function(){ |
480 $("#LskLabel > a").trigger('click'); |
480 $("#LskLabel > a").trigger('click'); |
481 } |
481 }; |
482 a[1].appendChild(lsk); |
482 a[1].appendChild(lsk); |
483 } |
483 } |
484 |
484 |
485 |
485 |
486 }, |
486 }, |
538 // load the saved device mode |
538 // load the saved device mode |
539 var mode = NOKIA.helper.getPreference('__SYM_NOKIA_EMULATOR_DEVICE_MODE'); |
539 var mode = NOKIA.helper.getPreference('__SYM_NOKIA_EMULATOR_DEVICE_MODE'); |
540 if(mode != null) |
540 if(mode != null) |
541 NOKIA.mode = mode; |
541 NOKIA.mode = mode; |
542 |
542 |
|
543 var orientation = Number(NOKIA.helper.getPreference('__SYM_NOKIA_EMULATOR_ORIENTATION')); |
|
544 if (typeof orientation == "number" && orientation >= -90 && orientation <= 180) |
|
545 NOKIA.orientation = orientation; |
|
546 |
543 // SAVE the device DATA |
547 // SAVE the device DATA |
544 NOKIA.helper.setPreference('__SYM_NOKIA_EMULATOR_DEVICE', NOKIA.currentDevice); |
548 NOKIA.helper.setPreference('__SYM_NOKIA_EMULATOR_DEVICE', NOKIA.currentDevice); |
545 NOKIA.helper.setPreference('__SYM_NOKIA_EMULATOR_DEVICE_MODE', NOKIA.mode); |
549 NOKIA.helper.setPreference('__SYM_NOKIA_EMULATOR_DEVICE_MODE', NOKIA.mode); |
|
550 NOKIA.helper.setPreference('__SYM_NOKIA_EMULATOR_ORIENTATION', NOKIA.orientation); |
546 |
551 |
547 this.loaded = true; |
552 this.loaded = true; |
548 |
553 |
549 }, |
554 }, |
550 |
555 |
560 alert('Deive resolution: '+NOKIA.currentDevice+' or the mode: '+NOKIA.mode+' not found'); |
565 alert('Deive resolution: '+NOKIA.currentDevice+' or the mode: '+NOKIA.mode+' not found'); |
561 return false; |
566 return false; |
562 } |
567 } |
563 |
568 |
564 this.setStyle(); |
569 this.setStyle(); |
|
570 var or = (NOKIA.mode == 'portrait') ? NOKIA.orientation : (NOKIA.orientation + 90); |
|
571 var val = "rotate(" + or + "deg)"; |
|
572 $("#preview-ui-top").css("-moz-transform", val); |
|
573 $("#preview-ui-top").css("-webkit-transform", val); |
565 }, |
574 }, |
566 |
575 |
567 setMode : function(mode) |
576 setMode : function(mode) |
568 { |
577 { |
569 NOKIA.mode = mode; |
578 NOKIA.mode = mode; |
570 |
579 |
571 // SAVE the device DATA |
580 // SAVE the device DATA |
572 NOKIA.helper.setPreference('__SYM_NOKIA_EMULATOR_DEVICE_MODE', NOKIA.mode); |
581 NOKIA.helper.setPreference('__SYM_NOKIA_EMULATOR_DEVICE_MODE', NOKIA.mode); |
573 |
582 |
574 NOKIA.emulator.render(); |
583 NOKIA.emulator.render(); |
|
584 }, |
|
585 |
|
586 toggle : function(o) |
|
587 { |
|
588 NOKIA.orientation = o; |
|
589 NOKIA.helper.setPreference('__SYM_NOKIA_EMULATOR_ORIENTATION', NOKIA.orientation); |
|
590 NOKIA.emulator.child.device.implementation.setOrientation(o, 0); |
|
591 if (NOKIA.emulator.orientationSupports() && (o == 0 || o == -90)) { |
|
592 NOKIA.emulator.setMode(o == 0 ? 'portrait' : 'landscape'); |
|
593 } else { |
|
594 NOKIA.emulator.render(); |
|
595 } |
575 }, |
596 }, |
576 |
597 |
577 orientationSupports : function() |
598 orientationSupports : function() |
578 { |
599 { |
579 return NOKIA.deviceList[NOKIA.currentDevice]['orientation']; |
600 return NOKIA.deviceList[NOKIA.currentDevice]['orientation']; |
956 { |
977 { |
957 return NOKIA.emulator.prefs[name]; |
978 return NOKIA.emulator.prefs[name]; |
958 }, |
979 }, |
959 |
980 |
960 rotateCW : function() { |
981 rotateCW : function() { |
961 if (NOKIA.orientation == 0) { |
982 var newOrient = NOKIA.orientation + 90; |
962 this.toggle(90); |
983 NOKIA.emulator.toggle(newOrient - (newOrient > 180 ? 360 : 0)); |
963 } else if (NOKIA.orientation == 90) { |
|
964 this.toggle(180); |
|
965 } else if (NOKIA.orientation == 180) { |
|
966 this.toggle(-90); |
|
967 } else { |
|
968 this.toggle(0); |
|
969 } |
|
970 }, |
984 }, |
971 rotateCCW : function() { |
985 rotateCCW : function() { |
972 if (NOKIA.orientation == 0) { |
986 var newOrient = NOKIA.orientation - 90; |
973 this.toggle(-90); |
987 NOKIA.emulator.toggle(newOrient + (newOrient <= -180 ? 360 : 0)); |
974 } else if (NOKIA.orientation == -90) { |
|
975 this.toggle(180); |
|
976 } else if (NOKIA.orientation == 180) { |
|
977 this.toggle(90); |
|
978 } else { |
|
979 this.toggle(0); |
|
980 } |
|
981 }, |
|
982 |
|
983 toggle : function(o) |
|
984 { |
|
985 if (NOKIA.emulator.orientationSupports() && (o == 0 || o == -90)) { |
|
986 NOKIA.emulator.setMode(o == 0 ? 'portrait' : 'landscape'); |
|
987 } |
|
988 NOKIA.orientation = o; |
|
989 var or = (NOKIA.mode == 'portrait') ? o : (o + 90); |
|
990 var val = "rotate(" + or + "deg)"; |
|
991 $("#preview-ui-top").css("-moz-transform", val); |
|
992 $("#preview-ui-top").css("-webkit-transform", val); |
|
993 }, |
988 }, |
994 |
989 |
995 version : function(ele) |
990 version : function(ele) |
996 { |
991 { |
997 if (confirm('Would you like to reload the widget to apply the changes on the Version settings?')) |
992 if (confirm('Would you like to reload the widget to apply the changes on the Version settings?')) |