Merge pull request #1096 from TimAbraldes/midpmodule

Convert MIDP to module pattern
This commit is contained in:
Marco 2015-02-24 20:55:27 +01:00
Родитель 3c7eb877d4 890d04ef0b
Коммит 5e79167004
6 изменённых файлов: 1025 добавлений и 990 удалений

Просмотреть файл

@ -65,11 +65,11 @@ var currentlyFocusedTextEditor;
};
Native["com/sun/midp/lcdui/DisplayDevice.getScreenWidth0.(I)I"] = function(id) {
return MIDP.Context2D.canvas.width;
return MIDP.context2D.canvas.width;
};
Native["com/sun/midp/lcdui/DisplayDevice.getScreenHeight0.(I)I"] = function(id) {
return MIDP.Context2D.canvas.height;
return MIDP.context2D.canvas.height;
};
Native["com/sun/midp/lcdui/DisplayDevice.displayStateChanged0.(II)V"] = function(hardwareId, state) {
@ -323,7 +323,7 @@ var currentlyFocusedTextEditor;
var SIZE_LARGE = 16;
Native["javax/microedition/lcdui/Font.init.(III)V"] = function(face, style, size) {
var defaultSize = config.fontSize ? config.fontSize : Math.max(19, (MIDP.Context2D.canvas.height / 35) | 0);
var defaultSize = config.fontSize ? config.fontSize : Math.max(19, (MIDP.context2D.canvas.height / 35) | 0);
if (size & SIZE_SMALL)
size = defaultSize / 1.25;
else if (size & SIZE_LARGE)
@ -351,10 +351,10 @@ var currentlyFocusedTextEditor;
// Note:
// When a css string, such as ` 10 pt Arial, Helvetica`, is set to
// MIDP.Context2D.font, it will be formatted to `10 pt Arial,Helvetica`
// MIDP.context2D.font, it will be formatted to `10 pt Arial,Helvetica`
// with some spaces removed.
// We need this css string to have the same format as that of the
// MIDP.Context2D.font to do comparison in withFont() function.
// MIDP.context2D.font to do comparison in withFont() function.
this.css = style + size + "px " + face;
this.size = size;
this.style = style;
@ -364,8 +364,8 @@ var currentlyFocusedTextEditor;
function calcStringWidth(font, str) {
var emojiLen = 0;
withFont(font, MIDP.Context2D);
var len = measureWidth(MIDP.Context2D, str.replace(emoji.regEx, function() {
withFont(font, MIDP.context2D);
var len = measureWidth(MIDP.context2D, str.replace(emoji.regEx, function() {
emojiLen += font.size;
return "";
}));
@ -393,8 +393,8 @@ var currentlyFocusedTextEditor;
};
Native["javax/microedition/lcdui/Font.charWidth.(C)I"] = function(char) {
withFont(this, MIDP.Context2D);
return measureWidth(MIDP.Context2D, String.fromCharCode(char));
withFont(this, MIDP.context2D);
return measureWidth(MIDP.context2D, String.fromCharCode(char));
};
Native["javax/microedition/lcdui/Font.charsWidth.([CII)I"] = function(str, offset, len) {
@ -923,7 +923,7 @@ var currentlyFocusedTextEditor;
};
Native["javax/microedition/lcdui/Graphics.initScreen0.(III)V"] = function(displayId, w, h) {
this.context2D = MIDP.Context2D;
this.context2D = MIDP.context2D;
this.displayId = displayId;
setDimensions(this, w, h);
resetGC(this);
@ -1680,11 +1680,7 @@ var currentlyFocusedTextEditor;
});
function sendEvent(command) {
MIDP.sendNativeEvent({
type: MIDP.COMMAND_EVENT,
intParam1: command.klass.classInfo.getField("I.id.I").get(command),
intParam4: MIDP.displayId,
}, MIDP.foregroundIsolateId);
MIDP.sendCommandEvent(command.klass.classInfo.getField("I.id.I").get(command));
}
if (el) {

Просмотреть файл

@ -218,13 +218,7 @@ AudioPlayer.prototype.realize = function() {
AudioPlayer.prototype.play = function() {
this.audio.play();
this.audio.onended = function() {
MIDP.sendNativeEvent({
type: MIDP.MMAPI_EVENT,
intParam1: this.playerContainer.pId,
intParam2: this.getDuration(),
intParam3: 0,
intParam4: Media.EVENT_MEDIA_END_OF_MEDIA
}, MIDP.foregroundIsolateId);
MIDP.sendEndOfMediaEvent(this.playerContainer.pId, this.getDuration());
}.bind(this);
};
@ -555,15 +549,7 @@ ImageRecorder.prototype.recipient = function(message) {
case "snapshot":
this.snapshotData = new Int8Array(message.data);
MIDP.sendNativeEvent({
type: MIDP.MMAPI_EVENT,
intParam1: this.playerContainer.pId,
intParam2: 0,
intParam3: 0,
intParam4: Media.EVENT_MEDIA_SNAPSHOT_FINISHED,
}, MIDP.foregroundIsolateId);
MIDP.sendMediaSnapshotFinishedEvent(this.playerContainer.pId);
break;
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -78,7 +78,7 @@ AccelerometerSensor.simulator = {
start: function() {
var currentMouseX = -1;
var currentMouseY = -1;
var c = MIDP.Context2D.canvas;
var c = MIDP.context2D.canvas;
c.onmousemove = function(ev) {
currentMouseX =ev.layerX;
currentMouseY =ev.layerY;
@ -113,7 +113,7 @@ AccelerometerSensor.simulator = {
},
stop: function() {
MIDP.Context2D.canvas.onmousemove = null;
MIDP.context2D.canvas.onmousemove = null;
clearInterval(this._interalId);
}
};

Просмотреть файл

@ -184,7 +184,7 @@ var TextEditorProvider = (function() {
setPosition: function(left, top) {
this.left = left;
this.top = top;
var t = MIDP.Context2D.canvas.offsetTop + top;
var t = MIDP.context2D.canvas.offsetTop + top;
this._setStyle("left", left + "px");
this._setStyle("top", t + "px");
},

Просмотреть файл

@ -841,8 +841,8 @@ Native["com/nokia/mid/impl/jms/core/Launcher.handleContent.(Ljava/lang/String;)V
mask.style.position = "absolute";
mask.style.top = 0;
mask.style.left = 0;
mask.style.height = MIDP.Context2D.canvas.height + "px";
mask.style.width = MIDP.Context2D.canvas.width + "px";
mask.style.height = MIDP.context2D.canvas.height + "px";
mask.style.width = MIDP.context2D.canvas.width + "px";
mask.style.backgroundColor = "#000";
mask.style.backgroundPosition = "center center";
mask.style.backgroundRepeat = "no-repeat";
@ -900,4 +900,4 @@ Native["java/lang/String.intern.()Ljava/lang/String;"] = function() {
J2ME.internedStrings.set(string, this);
return this;
}
};
};