JS cleanup to make it more compatible with JSDT
authorEugene Ostroukhov <eugeneo@symbian.org>
Mon, 17 May 2010 15:21:01 -0700
changeset 334 915daddff233
parent 333 895153411a80
child 335 af8f80553198
JS cleanup to make it more compatible with JSDT
org.symbian.tools.wrttools.previewer/.project
org.symbian.tools.wrttools.previewer/preview/css/style.css
org.symbian.tools.wrttools.previewer/preview/script/lib/menu.js
org.symbian.tools.wrttools.previewer/preview/script/lib/sapi/Landmarks.js
org.symbian.tools.wrttools.previewer/preview/script/lib/sapi/Sensor.js
org.symbian.tools.wrttools.previewer/preview/script/lib/sapi/SysInfo.js
org.symbian.tools.wrttools.previewer/preview/script/nokia.js
org.symbian.tools.wrttools.previewer/preview/wrt_preview.html
--- a/org.symbian.tools.wrttools.previewer/.project	Thu May 13 15:47:02 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/.project	Mon May 17 15:21:01 2010 -0700
@@ -6,6 +6,11 @@
 	</projects>
 	<buildSpec>
 		<buildCommand>
+			<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
 			<name>org.eclipse.jdt.core.javabuilder</name>
 			<arguments>
 			</arguments>
@@ -24,5 +29,6 @@
 	<natures>
 		<nature>org.eclipse.pde.PluginNature</nature>
 		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
 	</natures>
 </projectDescription>
--- a/org.symbian.tools.wrttools.previewer/preview/css/style.css	Thu May 13 15:47:02 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/css/style.css	Mon May 17 15:21:01 2010 -0700
@@ -295,10 +295,39 @@
 	padding: 3px;
 }
 
+div#rotateCW{
+	position: absolute;
+	left: 0;
+	top: 0;
+	background-image: url(../images/rotate-right.png);
+	height: 32px;
+	width: 32px;
+	cursor: pointer;
+}
+div#rotateCCW{
+	position:absolute;
+	right: 0;
+	top: 0;
+	background-image: url(../images/rotate-left.png);
+	height: 32px;
+	width: 32px;
+	cursor: pointer;
+}
+
 /*
 	preferences CSS
 */
 
+div#TopToolbar{
+	background-color: olive;
+	position: absolute;
+	left: 85px;
+	right: 85px;
+	top: 0;
+	height: 32px;
+	text-align: center;
+}
+
 div#PreferencesBtn{
 	width: 75px;
 	height: 85px;
@@ -320,7 +349,6 @@
 div#InspectorBtn{
 	width: 75px;
 	height: 85px;
-/*  background-image: url(../images/settings-icon.png); */
 	background-image: url(../images/inspector.png); 
 	position: absolute;
 	top: 10px;
--- a/org.symbian.tools.wrttools.previewer/preview/script/lib/menu.js	Thu May 13 15:47:02 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/script/lib/menu.js	Mon May 17 15:21:01 2010 -0700
@@ -33,7 +33,7 @@
 			
 		//	Event triggers
 		onShow : null,
-		onRightSoftKeySelect : null,
+		onRightSoftKeySelect : null
 	};
 	
 	
--- a/org.symbian.tools.wrttools.previewer/preview/script/lib/sapi/Landmarks.js	Thu May 13 15:47:02 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/script/lib/sapi/Landmarks.js	Mon May 17 15:21:01 2010 -0700
@@ -563,7 +563,7 @@
 		missingIdList		: '%s%s : Id list is Missing',
 		missingTID 			: '%s%s : TransactionID is missing',
 		invalidMime			: '%s%s : MimeType is missing',
-		msgNoMsg			: '',
+		msgNoMsg			: ''
 		
 	};
 		
--- a/org.symbian.tools.wrttools.previewer/preview/script/lib/sapi/Sensor.js	Thu May 13 15:47:02 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/script/lib/sapi/Sensor.js	Mon May 17 15:21:01 2010 -0700
@@ -36,7 +36,7 @@
 		this.RegisterForNotification	= __RegisterForNotification;
 		this.Cancel						= __Cancel;
 		this.GetChannelProperty			= __GetChannelProperty;		
-	}
+	};
 
 	device.implementation.extend(provider, Interface, new SensorService() );
 
@@ -219,7 +219,7 @@
 		var returnValue = property[channel][criteria.PropertyId];
 		if(typeof returnValue == 'undefined')
 			return context.ErrorResult(device.implementation.ERR_NOT_FOUND);
-		return context.Result(returnValue,0)
+		return context.Result(returnValue,0);
 	}
 
 	/**
--- a/org.symbian.tools.wrttools.previewer/preview/script/lib/sapi/SysInfo.js	Thu May 13 15:47:02 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/script/lib/sapi/SysInfo.js	Mon May 17 15:21:01 2010 -0700
@@ -87,7 +87,7 @@
 			"availableusbmodes":{"GetInfo":true,"SetInfo":false,"GetNotification":false,"GetInfoModeSync":true},
 			"activeusbmode":{"GetInfo":true,"SetInfo":false,"GetNotification":false,"GetInfoModeSync":true},
 			"flipstatus":{"GetInfo":true,"SetInfo":false,"GetNotification":true,"GetInfoModeSync":true},
-			"gripstatus":{"GetInfo":true,"SetInfo":false,"GetNotification":true,"GetInfoModeSync":true},
+			"gripstatus":{"GetInfo":true,"SetInfo":false,"GetNotification":true,"GetInfoModeSync":true}
 			
 		},
       	"memory":{
@@ -114,7 +114,7 @@
 		this.SetInfo 			= __SetInfo;
 		this.GetNotification 	= __GetNotification;
 		this.Cancel 			= __Cancel;
-	}
+	};
 
 	device.implementation.extend(provider, Interface, new SysInfoService() );
 
--- a/org.symbian.tools.wrttools.previewer/preview/script/nokia.js	Thu May 13 15:47:02 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/script/nokia.js	Mon May 17 15:21:01 2010 -0700
@@ -25,6 +25,7 @@
 		version : 'WRT 1.1',
 		currentDevice : '240x320',
 		mode : 'portrait',
+		orientation : 0,
 		resolution : ['240x320', '320x240', '360x640', '800x352'],
 		scriptsLoaded : {
 			loader : false,
@@ -693,7 +694,7 @@
 			if(/dreamweaver/i.test(navigator.userAgent))
 			{
 				$("#dwDeviceHelp")[0].className = '';
-				$("#resSupportLink")[0].className = 'hide';
+//				$("#resSupportLink")[0].className = 'hide';
 			}
 			//	Selecting Resoltion
 			var resOptions = $("#resOptions")[0];
@@ -702,34 +703,33 @@
 				if(NOKIA.resolution[i] == NOKIA.currentDevice)
 				{
 					resOptions.options[i].selected = true;
-					$("#resSupportLink")[0].href = resOptions.options[i].value;
 					break;
 				}				
 			}
 			
-			//	Selecting Orientation
-			if(NOKIA.mode == 'portrait')
-				$('#input_portrait')[0].checked = true;
-			else
-				$('#input_landscape')[0].checked = true;
+//			//	Selecting Orientation
+//			if(NOKIA.mode == 'portrait')
+//				$('#input_portrait')[0].checked = true;
+//			else
+//				$('#input_landscape')[0].checked = true;
 
-			if (!NOKIA.emulator.orientationSupports()) {
-				if (NOKIA.mode == 'portrait') 
-					$("#input_landscape")[0].disabled = true;
-				else 
-					$("#input_portrait")[0].disabled = true;
-					
-				$("#Orientation_Info").html("Not supported");
-				$("#Orientation_Info").show();
-				$("#Orientation_Controls").hide();
-			}
-			else {
-				$("#input_landscape")[0].disabled = false;
-				$("#input_portrait")[0].disabled = false;
-
-				$("#Orientation_Info").hide();
-				$("#Orientation_Controls").show();
-			}
+//			if (!NOKIA.emulator.orientationSupports()) {
+//				if (NOKIA.mode == 'portrait') 
+//					$("#input_landscape")[0].disabled = true;
+//				else 
+//					$("#input_portrait")[0].disabled = true;
+//					
+//				$("#Orientation_Info").html("Not supported");
+//				$("#Orientation_Info").show();
+//				$("#Orientation_Controls").hide();
+//			}
+//			else {
+//				$("#input_landscape")[0].disabled = false;
+//				$("#input_portrait")[0].disabled = false;
+//
+//				$("#Orientation_Info").hide();
+//				$("#Orientation_Controls").show();
+//			}
 			
 			//	Selecting Version
 			if(NOKIA.version == 'WRT 1.0')
@@ -957,21 +957,40 @@
 			return NOKIA.emulator.prefs[name];
 		},
 
-		toggle : function(ele)
-		{
-			if (NOKIA.emulator.orientationSupports()) {
-//				var mode = (NOKIA.mode == 'portrait') ? 'landscape' : 'portrait';
-				NOKIA.emulator.setMode(ele.value);
+		rotateCW : function() {
+			if (NOKIA.orientation == 0) {
+				this.toggle(90);
+			} else if (NOKIA.orientation == 90) {
+				this.toggle(180);
+			} else if (NOKIA.orientation == 180) {
+				this.toggle(-90);
+			} else {
+				this.toggle(0);
 			}
-			else
-			{	
-				ele.checked = false;
-				if(ele.value == 'portrait')
-					$("#input_landscape")[0].checked = true;
-				else
-					$("#input_portrait")[0].checked = true;
+		},
+		rotateCCW : function() {
+			if (NOKIA.orientation == 0) {
+				this.toggle(-90);
+			} else if (NOKIA.orientation == -90) {
+				this.toggle(180);
+			} else if (NOKIA.orientation == 180) {
+				this.toggle(90);
+			} else {
+				this.toggle(0);
 			}
 		},
+		
+		toggle : function(o)
+		{
+			if (NOKIA.emulator.orientationSupports() && (o == 0 || o == -90)) {
+				NOKIA.emulator.setMode(o == 0 ? 'portrait' : 'landscape');
+			}
+			NOKIA.orientation = o;
+			var or = (NOKIA.mode == 'portrait') ? o : (o + 90);
+			var val = "rotate(" + or + "deg)";
+			$("#preview-ui-top").css("-moz-transform", val);
+			$("#preview-ui-top").css("-webkit-transform", val);
+		},
 
 		version : function(ele)
 		{
@@ -1054,19 +1073,16 @@
 				}
 			});
 			
-			$('#input_portrait').change(function(){
-				NOKIA.helper.toggle(this);
+			$('#rotateCW').click(function(){
+				NOKIA.helper.rotateCW();
 			});
-
-			$('#input_landscape').change(function(){
-				NOKIA.helper.toggle(this);
+			$('#rotateCCW').click(function(){
+				NOKIA.helper.rotateCCW();
 			});
-
 			$('#resOptions').change(function(ele){
 				ele = ele.target || this;
 				
 				NOKIA.currentDevice = ele.options[ele.selectedIndex].text;
-				$("#resSupportLink")[0].href = ele.value;
 		
 				//	SAVE the device DATA
 				NOKIA.helper.setPreference('__SYM_NOKIA_EMULATOR_DEVICE', NOKIA.currentDevice);
--- a/org.symbian.tools.wrttools.previewer/preview/wrt_preview.html	Thu May 13 15:47:02 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/wrt_preview.html	Mon May 17 15:21:01 2010 -0700
@@ -66,34 +66,6 @@
 		<table width="100%" cellpadding="0" cellspacing="0">
 			<tr>
 				<th>
-					Resolution
-				</th>
-				<td>
-					<select id="resOptions">
-						<option selected="selected" value="http://www.forum.nokia.com/devices/matrix_240x320_1.html">240x320</option>
-						<option value="http://www.forum.nokia.com/devices/matrix_320x240_1.html">320x240</option>
-						<option value="http://www.forum.nokia.com/devices/matrix_360x640_1.html">360x640</option>
-						<option value="http://www.forum.nokia.com/devices/E90_Communicator">800x352</option>
-					</select>&nbsp; 
-					<a class="link" target="_blank" href="http://www.forum.nokia.com/devices/matrix_240x320_1.html" id="resSupportLink">Device matrix featuring this resolution</a>
-					<span id="dwDeviceHelp" class="hide" >See WRT Help for device specifications</span>
-				</td>
-			</tr>
-			<tr>
-				<th>
-					Orientation					
-				</th>
-				<td>
-					<div id="Orientation_Controls" class="hide">
-						<label><input type="radio" name="input_orientation" id="input_portrait" value="portrait"/> Portrait</label>	
-						<label><input type="radio" name="input_orientation" id="input_landscape" value="landscape"/> Landscape</label>	
-					</div>
-					<div id="Orientation_Info" class="hide">
-					</div>
-				</td>
-			</tr>
-			<tr>
-				<th>
 					WRT Version
 				</th>
 				<td>
@@ -228,6 +200,16 @@
 		<div id="preview-ui-bottom-body">
 		</div>
 	</div>
+	<div id="TopToolbar">
+		<div id="rotateCW"></div>
+		<select id="resOptions">
+			<option selected="selected" value="http://www.forum.nokia.com/devices/matrix_240x320_1.html">240x320</option>
+			<option value="http://www.forum.nokia.com/devices/matrix_320x240_1.html">320x240</option>
+			<option value="http://www.forum.nokia.com/devices/matrix_360x640_1.html">360x640</option>
+			<option value="http://www.forum.nokia.com/devices/E90_Communicator">800x352</option>
+		</select>
+		<div id="rotateCCW"></div>
+	</div>
 	<div id="PreferencesBtn" class="hide"></div>
 	<div id="InspectorBtn" class="hide"></div>
 	<div id="orientationIcon"></div>