author | Eugene Ostroukhov <eugeneo@symbian.org> |
Wed, 30 Jun 2010 17:10:46 -0700 | |
changeset 408 | 9985028ffc2c |
parent 407 | c7c8bde493b1 |
child 412 | 72448215f517 |
permissions | -rw-r--r-- |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
1 |
/** |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009-2010 Symbian Foundation and/or its subsidiary(-ies). All |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
3 |
* rights reserved. This component and the accompanying materials are made |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
4 |
* available under the terms of the License "Eclipse Public License v1.0" which |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
5 |
* accompanies this distribution, and is available at the URL |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
6 |
* "http://www.eclipse.org/legal/epl-v10.html". |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
7 |
* |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
8 |
* Initial Contributors: Nokia Corporation - initial contribution. |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
9 |
* |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
10 |
* Contributors: |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
11 |
* |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
12 |
* Description: |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
13 |
* |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
14 |
*/ |
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
15 |
var ORIENTATIONS = { |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
16 |
DisplayRightUp : "DisplayRightUp", |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
17 |
DisplayLeftUp : "DisplayLeftUp", |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
18 |
DisplayUp : "DisplayUp", |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
19 |
DisplayDown : "DisplayDown", |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
20 |
DisplayUpwards : "DisplayUpwards", |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
21 |
DisplayDownwards : "DisplayDownwards" |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
22 |
}; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
23 |
|
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
24 |
function Emulator() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
25 |
this.child = false; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
26 |
this.accelerationCallback = false; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
27 |
this.iconFile = 'preview/images/default-Icon.png'; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
28 |
this.loaded = false; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
29 |
this.FORCE = 62; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
30 |
this.state = new EmulatorState(0, this.FORCE, 0, true); |
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
31 |
this.orientation = ORIENTATIONS.DisplayUp; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
32 |
this.modeForced = false; |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
33 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
34 |
this.plist = { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
35 |
DisplayName : '', |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
36 |
Identifier : '', |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
37 |
MainHTML : '', |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
38 |
AllowNetworkAccess : "false", |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
39 |
Version : '', |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
40 |
MiniViewEnabled : "false", |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
41 |
is_browserReady : false |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
42 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
43 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
44 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
45 |
Emulator.prototype.setAccelerationCallback = function(acceleration) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
46 |
this.accelerationCallback = acceleration; |
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
47 |
this.accelerationCallback(this.state.XAxis, this.state.YAxis, |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
48 |
this.state.ZAxis, this.orientation); |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
49 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
50 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
51 |
function orientationFromAcceleration(x, y, z) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
52 |
var orientation = NOKIA.emulator.orientation; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
53 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
54 |
var xangle = Math.asin(x) * 180 / Math.PI; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
55 |
if (xangle > 55) { |
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
56 |
orientation = ORIENTATIONS.DisplayRightUp; |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
57 |
} else if (xangle < -55) { |
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
58 |
orientation = ORIENTATIONS.DisplayLeftUp; |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
59 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
60 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
61 |
var yangle = Math.asin(y) * 180 / Math.PI; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
62 |
if (yangle > 55) { |
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
63 |
orientation = ORIENTATIONS.DisplayUp; |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
64 |
} else if (yangle < -55) { |
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
65 |
orientation = ORIENTATIONS.DisplayDown; |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
66 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
67 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
68 |
var zangle = Math.asin(z) * 180 / Math.PI; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
69 |
if (zangle > 75) { |
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
70 |
orientation = ORIENTATIONS.DisplayUpwards; |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
71 |
} else if (zangle < -75) { |
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
72 |
orientation = ORIENTATIONS.DisplayDownwards; |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
73 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
74 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
75 |
return orientation; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
76 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
77 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
78 |
Emulator.prototype.accelerationChanged = function(x, y, z) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
79 |
this.state.XAxis = x * this.FORCE; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
80 |
this.state.YAxis = y * this.FORCE; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
81 |
this.state.ZAxis = z * this.FORCE; |
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
82 |
|
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
83 |
var orientation = orientationFromAcceleration(x, y, z); |
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
84 |
|
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
85 |
if (orientation != this.orientation) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
86 |
this.orientation = orientation; |
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
87 |
NOKIA.helper.setPreference("__SYM_DEVICE_ORIENTATION", orientation); |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
88 |
NOKIA.emulator.render(); |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
89 |
} |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
90 |
|
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
91 |
if (this.accelerationCallback) { |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
92 |
this.accelerationCallback(this.state.XAxis, this.state.YAxis, |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
93 |
this.state.ZAxis, this.orientation); |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
94 |
} |
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
95 |
}; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
96 |
|
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
97 |
Emulator.prototype.setAccelerationValues = function(x, y, z) { |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
98 |
window.setTimeout(function() { |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
99 |
NOKIA.emulator.accelerationChanged(x, y, z); |
407
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
403
diff
changeset
|
100 |
NOKIA.rotationSupport.setAngles(x * 90, y * 90, |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
403
diff
changeset
|
101 |
z * 90); |
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
102 |
}, 5); |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
103 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
104 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
105 |
Emulator.prototype.load = function() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
106 |
if (this.loaded) |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
107 |
return false; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
108 |
NOKIA.layout._console_minimized = (NOKIA.helper |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
109 |
.getPreference('__SYM_NOKIA_CONSOLE_OPEN') != "true"); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
110 |
// load the saved device Info |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
111 |
var device = NOKIA.helper.getPreference('__SYM_NOKIA_EMULATOR_DEVICE'); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
112 |
NOKIA.currentDevice = device || NOKIA.currentDevice; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
113 |
|
407
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
403
diff
changeset
|
114 |
// load the saved device mode |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
403
diff
changeset
|
115 |
var mode = NOKIA.helper.getPreference('__SYM_NOKIA_EMULATOR_DEVICE_MODE'); |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
403
diff
changeset
|
116 |
if (mode != null) |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
403
diff
changeset
|
117 |
NOKIA.mode = mode; |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
403
diff
changeset
|
118 |
|
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
119 |
var orientation = NOKIA.helper.getPreference("__SYM_DEVICE_ORIENTATION"); |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
120 |
if (orientation != null) { |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
121 |
this.orientation = orientation; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
122 |
switch (orientation) { |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
123 |
case ORIENTATIONS.DisplayUp: |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
124 |
this.setAccelerationValues(0, 0, 0); |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
125 |
break; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
126 |
case ORIENTATIONS.DisplayDown: |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
127 |
this.setAccelerationValues(2, 0, 0); |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
128 |
break; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
129 |
case ORIENTATIONS.DisplayRightUp: |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
130 |
this.setAccelerationValues(1, 0, 0); |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
131 |
break; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
132 |
case ORIENTATIONS.DisplayLeftUp: |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
133 |
this.setAccelerationValues(-1, 0, 0); |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
134 |
break; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
135 |
case ORIENTATIONS.DisplayUpwards: |
407
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
403
diff
changeset
|
136 |
this.setAccelerationValues(NOKIA.mode == 'portrait' ? 0 : 1, 0, 1); |
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
137 |
break; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
138 |
case ORIENTATIONS.DisplayDownwards: |
407
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
403
diff
changeset
|
139 |
this.setAccelerationValues(NOKIA.mode == 'portrait' ? 0 : 1, 0, -1); |
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
140 |
break; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
141 |
} |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
142 |
} |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
143 |
|
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
144 |
// SAVE the device DATA |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
145 |
NOKIA.helper.setPreference('__SYM_NOKIA_EMULATOR_DEVICE', |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
146 |
NOKIA.currentDevice); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
147 |
NOKIA.helper.setPreference('__SYM_NOKIA_EMULATOR_DEVICE_MODE', NOKIA.mode); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
148 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
149 |
this.loaded = true; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
150 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
151 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
152 |
Emulator.prototype.render = function() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
153 |
this.load(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
154 |
// Selecting Resoltion |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
155 |
var resOptions = $("#resOptions")[0]; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
156 |
for ( var i = 0; i < NOKIA.resolution.length; i++) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
157 |
if (NOKIA.resolution[i] == NOKIA.currentDevice) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
158 |
resOptions.options[i].selected = true; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
159 |
break; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
160 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
161 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
162 |
|
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
163 |
var deg = 0; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
164 |
switch (NOKIA.emulator.orientation) { |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
165 |
case ORIENTATIONS.DisplayUp: |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
166 |
deg = 0; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
167 |
break; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
168 |
case ORIENTATIONS.DisplayDown: |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
169 |
deg = 180; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
170 |
break; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
171 |
case ORIENTATIONS.DisplayRightUp: |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
172 |
deg = -90; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
173 |
break; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
174 |
case ORIENTATIONS.DisplayLeftUp: |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
175 |
deg = 90; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
176 |
break; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
177 |
default: |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
178 |
if (NOKIA.mode == 'portrait') { |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
179 |
deg = 0; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
180 |
} else { |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
181 |
deg = -90; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
182 |
} |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
183 |
break; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
184 |
} |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
185 |
if (this.orientationSupports() && !this.modeForced) { |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
186 |
if (deg == 0) { |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
187 |
NOKIA.mode = 'portrait'; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
188 |
} else if (deg == -90) { |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
189 |
NOKIA.mode = 'landscape'; |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
190 |
} |
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
191 |
} |
407
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
403
diff
changeset
|
192 |
NOKIA.helper.setPreference('__SYM_NOKIA_EMULATOR_DEVICE_MODE', NOKIA.mode); |
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
193 |
|
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
194 |
if (!NOKIA.emulator.orientationSupports()) |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
195 |
NOKIA.mode = NOKIA.deviceList[NOKIA.currentDevice]['default']; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
196 |
|
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
197 |
this.setStyle(); |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
198 |
|
403
ba20dd5983c7
Acceleration and orientation sensors support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
402
diff
changeset
|
199 |
var or = (NOKIA.mode == 'portrait') ? deg : (deg + 90); |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
200 |
var val = "rotate(" + or + "deg)"; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
201 |
$("#DeviceDisplayLayout").css("-moz-transform", val); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
202 |
$("#DeviceDisplayLayout").css("-webkit-transform", val); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
203 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
204 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
205 |
Emulator.prototype.setMode = function(mode) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
206 |
NOKIA.mode = mode; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
207 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
208 |
// SAVE the device DATA |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
209 |
NOKIA.helper.setPreference('__SYM_NOKIA_EMULATOR_DEVICE_MODE', NOKIA.mode); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
210 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
211 |
NOKIA.emulator.render(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
212 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
213 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
214 |
Emulator.prototype.orientationSupports = function() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
215 |
return NOKIA.deviceList[NOKIA.currentDevice]['orientation']; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
216 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
217 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
218 |
Emulator.prototype.setStyle = function() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
219 |
if (!NOKIA.helper.checkDependencies()) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
220 |
setTimeout(NOKIA.emulator.setStyle, 1000); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
221 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
222 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
223 |
var deviceProperties = NOKIA.deviceList[NOKIA.currentDevice][NOKIA.mode]; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
224 |
var style = deviceProperties['style']; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
225 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
226 |
// Apply Style and propertis to Device layers |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
227 |
$("#DeviceDisplayLayout").css(style['layout']); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
228 |
$('#DisplayArea').css(style['display']); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
229 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
230 |
NOKIA.emulator.setWidgetStyle(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
231 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
232 |
$('#SoftKeysArea').css( { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
233 |
'width' : style['menu']['width'] + 'px', |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
234 |
'height' : style['menu']['height'] + 'px', |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
235 |
'float' : style['menu']['float'] |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
236 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
237 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
238 |
$('#SoftKeysArea > ul > li').css('width', |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
239 |
parseInt(style['menu']['width'] / 2) - 10); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
240 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
241 |
NOKIA.emulator.setMenuItemsStyle(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
242 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
243 |
$('#SoftKeys').css(style['softkeys']); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
244 |
// $('#SoftKeys > a > img').css(style['softkeysImg']); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
245 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
246 |
NOKIA.menu.createSFKArea(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
247 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
248 |
$("#DeviceDisplayLayout").show(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
249 |
$("#InspectorTab").show(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
250 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
251 |
if (/chrome/.test(navigator.userAgent.toLowerCase())) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
252 |
$("#InspectorBtn").show(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
253 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
254 |
if (/mac/.test(navigator.userAgent.toLowerCase())) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
255 |
$("#MacShortcut").show(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
256 |
} else { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
257 |
$("#UniversalShortcut").show(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
258 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
259 |
}, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
260 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
261 |
Emulator.prototype.setWidgetStyle = function() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
262 |
var style = NOKIA.deviceList[NOKIA.currentDevice][NOKIA.mode]['style']; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
263 |
var height; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
264 |
if (NOKIA.menu.softkeys_visibility || NOKIA.menu.is_softkeys_visible) |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
265 |
height = parseInt(style['widget']['height'] - style['menu']['height']); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
266 |
else |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
267 |
height = style['widget']['height']; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
268 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
269 |
$('#WidgetArea').css( { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
270 |
'width' : style['widget']['width'] + 'px', |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
271 |
'height' : height + 'px', |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
272 |
'float' : style['widget']['float'] |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
273 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
274 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
275 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
276 |
Emulator.prototype.setMenuItemsStyle = function() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
277 |
var style = NOKIA.deviceList[NOKIA.currentDevice][NOKIA.mode]['style']; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
278 |
var count = 1; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
279 |
try { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
280 |
if (NOKIA.emulator.child.menu) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
281 |
count = parseInt(NOKIA.helper |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
282 |
.getElementsLengthInObject(NOKIA.emulator.child.menu.items)) + 1; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
283 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
284 |
} catch (e) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
285 |
count = 1; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
286 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
287 |
var height = parseInt(count * style['menu']['optionKeysheight']) + 10; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
288 |
var top = parseInt(style['widget']['height'] - height); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
289 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
290 |
$('#MenuItemsArea').css( |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
291 |
{ |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
292 |
'width' : style['widget']['width'] + 'px', |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
293 |
'height' : height + 'px', |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
294 |
'marginTop' : '-2px', |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
295 |
'top' : (style['widget']['height'] - height |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
296 |
- style['menu']['height'] + 2) |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
297 |
+ 'px', |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
298 |
'position' : 'relative' |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
299 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
300 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
301 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
302 |
function EmulatorState(x, y, z, orientation) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
303 |
this.XAxis = x; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
304 |
this.YAxis = y; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
305 |
this.ZAxis = z; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
306 |
this.portrait = orientation; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
307 |
} |