diff --git a/externs/air/flash/events/TouchEvent.hx b/externs/air/flash/events/TouchEvent.hx index 9fb6bc459..566279954 100644 --- a/externs/air/flash/events/TouchEvent.hx +++ b/externs/air/flash/events/TouchEvent.hx @@ -30,7 +30,7 @@ package flash.events; function new(type:String, bubbles:Bool = true, cancelable:Bool = false, touchPointID:Int = 0, isPrimaryTouchPoint:Bool = false, localX:Float = 0. /*NaN*/, localY:Float = 0. /*NaN*/, sizeX:Float = 0. /*NaN*/, sizeY:Float = 0. /*NaN*/, pressure:Float = 0. /*NaN*/, ?relatedObject:flash.display.InteractiveObject, ctrlKey:Bool = false, altKey:Bool = false, shiftKey:Bool = false - #if air, commandKey:Bool = false, controlKey:Bool = false, ?timestamp:Float, ?touchIntent:TouchEventIntent, ?samples:flash.utils.ByteArray, + #if air, commandKey:Bool = false, controlKey:Bool = false, ?timestamp :Float, ?touchIntent :TouchEventIntent, ?samples :flash.utils.ByteArray, isTouchPointCanceled:Bool = false #end):Void; #if air function getSamples(buffer:flash.utils.ByteArray, append:Bool = false):UInt; diff --git a/src/haxe/io/Bytes.hx b/src/haxe/io/Bytes.hx index e610770f5..998fcf0fe 100644 --- a/src/haxe/io/Bytes.hx +++ b/src/haxe/io/Bytes.hx @@ -1067,7 +1067,7 @@ class Bytes setInt32(pos, v.low); } - public function getString(pos:Int, len:Int #if (!hl || haxe_ver >= 4), ?encoding:#if (haxe_ver >= 4) haxe.io.Encoding #else Dynamic #end #end):String + public function getString(pos:Int, len:Int #if (!hl || haxe_ver >= 4), ?encoding :#if (haxe_ver >= 4) haxe.io.Encoding #else Dynamic #end #end):String { if (outRange(pos, len)) throw Error.OutsideBounds; @@ -1118,7 +1118,7 @@ class Bytes } public static function ofString(s:String - #if (!hl || haxe_ver >= 4), ?encoding:#if (haxe_ver >= 4) haxe.io.Encoding #else Dynamic #end #end):Bytes@:privateAccess { + #if (!hl || haxe_ver >= 4), ?encoding :#if (haxe_ver >= 4) haxe.io.Encoding #else Dynamic #end #end):Bytes @:privateAccess { var size = 0; var b = s.bytes.utf16ToUtf8(0, size); return new Bytes(b, size); diff --git a/src/lime/_internal/backend/html5/HTML5AudioSource.hx b/src/lime/_internal/backend/html5/HTML5AudioSource.hx index 96256c998..a071a9fe2 100644 --- a/src/lime/_internal/backend/html5/HTML5AudioSource.hx +++ b/src/lime/_internal/backend/html5/HTML5AudioSource.hx @@ -78,7 +78,7 @@ class HTML5AudioSource if (parent.buffer != null && parent.buffer.__srcHowl != null) { parent.buffer.__srcHowl.stop(id); - parent.buffer.__srcHowl.off ("end", howl_onEnd, id); + parent.buffer.__srcHowl.off("end", howl_onEnd, id); } #end } @@ -100,7 +100,7 @@ class HTML5AudioSource else if (parent.buffer != null && parent.buffer.__srcHowl != null) { parent.buffer.__srcHowl.stop(id); - parent.buffer.__srcHowl.off ("end", howl_onEnd, id); + parent.buffer.__srcHowl.off("end", howl_onEnd, id); } completed = true; diff --git a/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx b/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx index 79890517d..788e7f020 100644 --- a/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx +++ b/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx @@ -81,13 +81,16 @@ class HTML5HTTPRequest { if (query.length > 0) query += "&"; var value:Dynamic = parent.formData.get(key); - if (key.indexOf("[]") > -1 && Std.is(value, Array)) { - var arrayValue:String = Lambda.map(value, function(v:String) { + if (key.indexOf("[]") > -1 && Std.is(value, Array)) + { + var arrayValue:String = Lambda.map(value, function(v:String) + { return StringTools.urlEncode(v); }).join('&${key}='); query += StringTools.urlEncode(key) + "=" + arrayValue; } - else { + else + { query += StringTools.urlEncode(key) + "=" + StringTools.urlEncode(Std.string(value)); } } diff --git a/src/lime/_internal/backend/html5/HTML5Window.hx b/src/lime/_internal/backend/html5/HTML5Window.hx index 1237a7845..6b1a377a5 100644 --- a/src/lime/_internal/backend/html5/HTML5Window.hx +++ b/src/lime/_internal/backend/html5/HTML5Window.hx @@ -904,20 +904,20 @@ class HTML5Window public function setClipboard(value:String):Void { - if (textArea == null) - { - textArea = cast Browser.document.createElement("textarea"); - textArea.style.height = "0px"; - textArea.style.left = "-100px"; - textArea.style.opacity = "0"; - textArea.style.position = "fixed"; - textArea.style.top = "-100px"; - textArea.style.width = "0px"; - Browser.document.body.appendChild(textArea); - } - textArea.value = value; - textArea.focus(); - textArea.select(); + if (textArea == null) + { + textArea = cast Browser.document.createElement("textarea"); + textArea.style.height = "0px"; + textArea.style.left = "-100px"; + textArea.style.opacity = "0"; + textArea.style.position = "fixed"; + textArea.style.top = "-100px"; + textArea.style.width = "0px"; + Browser.document.body.appendChild(textArea); + } + textArea.value = value; + textArea.focus(); + textArea.select(); if (Browser.document.queryCommandEnabled("copy")) { diff --git a/src/lime/_internal/backend/native/NativeHTTPRequest.hx b/src/lime/_internal/backend/native/NativeHTTPRequest.hx index c58f6a123..be40c2094 100644 --- a/src/lime/_internal/backend/native/NativeHTTPRequest.hx +++ b/src/lime/_internal/backend/native/NativeHTTPRequest.hx @@ -386,7 +386,6 @@ class NativeHTTPRequest // Wrong thread // promise.progress (bytesLoaded, bytesTotal); } - } private function curl_onWrite(curl:CURL, output:Bytes):Int diff --git a/src/lime/_internal/graphics/ImageDataUtil.hx b/src/lime/_internal/graphics/ImageDataUtil.hx index 9e7a7c6b6..e1944e4b1 100644 --- a/src/lime/_internal/graphics/ImageDataUtil.hx +++ b/src/lime/_internal/graphics/ImageDataUtil.hx @@ -337,7 +337,8 @@ class ImageDataUtil var destBytesPerPixel = Std.int(image.buffer.bitsPerPixel / 8); var useAlphaImage = (alphaImage != null && alphaImage.transparent); - var blend = (mergeAlpha || (useAlphaImage && !image.transparent)) || (!mergeAlpha && !image.transparent && sourceImage.transparent); + var blend = (mergeAlpha || (useAlphaImage && !image.transparent)) + || (!mergeAlpha && !image.transparent && sourceImage.transparent); if (!useAlphaImage) { @@ -424,7 +425,9 @@ class ImageDataUtil var alphaFormat = alphaImage.buffer.format; var alphaPosition, alphaPixel:RGBA; - var alphaView = new ImageDataView(alphaImage, new Rectangle(sourceView.x + (alphaPoint == null ? 0 : alphaPoint.x), sourceView.y + (alphaPoint == null ? 0 : alphaPoint.y), sourceView.width, sourceView.height)); + var alphaView = new ImageDataView(alphaImage, + new Rectangle(sourceView.x + (alphaPoint == null ? 0 : alphaPoint.x), sourceView.y + (alphaPoint == null ? 0 : alphaPoint.y), + sourceView.width, sourceView.height)); destView.clip(Std.int(destPoint.x), Std.int(destPoint.y), alphaView.width, alphaView.height); diff --git a/src/lime/_internal/unifill/InternalEncoding.hx b/src/lime/_internal/unifill/InternalEncoding.hx index 21bae53a9..37c5f6f98 100644 --- a/src/lime/_internal/unifill/InternalEncoding.hx +++ b/src/lime/_internal/unifill/InternalEncoding.hx @@ -24,8 +24,8 @@ class InternalEncoding **/ public static var internalEncoding(get, never):String; - static inline function get_internalEncoding():String - #if (neko || php || cpp || lua || macro) return "UTF-8"; #elseif python return "UTF-32"; #else return "UTF-16"; #end + static inline function get_internalEncoding():String #if (neko || php || cpp || lua || macro) return "UTF-8"; #elseif python return "UTF-32"; #else return + "UTF-16"; #end /** Returns the UTF-8/16/32 code unit at position `index` of diff --git a/src/lime/app/Future.hx b/src/lime/app/Future.hx index 174cd5ad2..c05477322 100644 --- a/src/lime/app/Future.hx +++ b/src/lime/app/Future.hx @@ -39,8 +39,7 @@ import lime.utils.Log; @:fileXml('tags="haxe,release"') @:noDebug #end -@:allow(lime.app.Promise) -/*@:generic*/ +@:allow(lime.app.Promise) /*@:generic*/ class Future { /** diff --git a/src/lime/tools/HXProject.hx b/src/lime/tools/HXProject.hx index 3042c1bf2..f5894ee2a 100644 --- a/src/lime/tools/HXProject.hx +++ b/src/lime/tools/HXProject.hx @@ -413,7 +413,7 @@ class HXProject extends Script } project.languages = languages.copy(); - + if (launchStoryboard != null) { project.launchStoryboard = launchStoryboard.clone(); @@ -909,7 +909,7 @@ class HXProject extends Script { launchStoryboard.merge(project.launchStoryboard); } - + languages = ArrayTools.concatUnique(languages, project.languages, true); libraries = ArrayTools.concatUnique(libraries, project.libraries, true); diff --git a/src/lime/tools/ImageHelper.hx b/src/lime/tools/ImageHelper.hx index 8b6e2264f..c6dab7a36 100644 --- a/src/lime/tools/ImageHelper.hx +++ b/src/lime/tools/ImageHelper.hx @@ -138,25 +138,26 @@ class ImageHelper var toReturn = {width: 0, height: 0}; var fileInput = File.read(path); var header = (fileInput.readByte() << 8) | fileInput.readByte(); - + if (header == 0x8950) { fileInput.seek(8 + 4 + 4, FileSeek.SeekBegin); - + var width = (fileInput.readByte() << 24) | (fileInput.readByte() << 16) | (fileInput.readByte() << 8) | fileInput.readByte(); var height = (fileInput.readByte() << 24) | (fileInput.readByte() << 16) | (fileInput.readByte() << 8) | fileInput.readByte(); - - toReturn = { - width: width, - height: height - }; + + toReturn = + { + width: width, + height: height + }; } - + fileInput.close(); - + return toReturn; } - + public static function resizeImage(image:#if (lime && lime_cffi && !macro) Image #else Dynamic #end, width:Int, height:Int):#if (lime && lime_cffi && !macro) Image #else Dynamic #end { diff --git a/src/lime/tools/LaunchStoryboard.hx b/src/lime/tools/LaunchStoryboard.hx index 975824b42..da4dba011 100644 --- a/src/lime/tools/LaunchStoryboard.hx +++ b/src/lime/tools/LaunchStoryboard.hx @@ -7,11 +7,11 @@ class LaunchStoryboard public var assetsPath:String; public var assets:Array; public var path:String; - + public var template:String; public var templateContext:Dynamic; - public function new () + public function new() { assets = []; templateContext = {}; @@ -25,10 +25,10 @@ class LaunchStoryboard launchStoryboard.path = path; launchStoryboard.template = template; launchStoryboard.templateContext = ObjectTools.copyFields(templateContext, {}); - + return launchStoryboard; } - + public function merge(launchStoryboard:LaunchStoryboard):Void { if (launchStoryboard != null) @@ -45,7 +45,7 @@ class LaunchStoryboard class LaunchStoryboardAsset { public var type:String; - + public function new(type:String) { this.type = type; @@ -57,10 +57,10 @@ class ImageSet extends LaunchStoryboardAsset public var name:String; public var width = 0; public var height = 0; - + public function new(name:String) { super("imageset"); this.name = name; } -} \ No newline at end of file +} diff --git a/src/lime/tools/ProjectXMLParser.hx b/src/lime/tools/ProjectXMLParser.hx index 5696bad41..29923a471 100644 --- a/src/lime/tools/ProjectXMLParser.hx +++ b/src/lime/tools/ProjectXMLParser.hx @@ -1365,13 +1365,13 @@ class ProjectXMLParser extends HXProject } splashScreens.push(splashScreen); - + case "launchStoryboard": if (launchStoryboard == null) { launchStoryboard = new LaunchStoryboard(); } - + if (element.has.path) { launchStoryboard.path = Path.combine(extensionPath, substitute(element.att.path)); @@ -1388,7 +1388,7 @@ class ProjectXMLParser extends HXProject for (attr in element.x.attributes()) { if (attr == "assetsPath") continue; - + var valueType = "String"; var valueName = attr; @@ -1401,13 +1401,13 @@ class ProjectXMLParser extends HXProject var stringValue = element.x.get(attr); var value:Dynamic; - switch(valueType) + switch (valueType) { case "Int": value = Std.parseInt(stringValue); case "RGB": var rgb:lime.math.ARGB = Std.parseInt(stringValue); - value = {r: rgb.r/255, g: rgb.g/255, b: rgb.b/255}; + value = {r: rgb.r / 255, g: rgb.g / 255, b: rgb.b / 255}; case "String": value = stringValue; default: @@ -1418,29 +1418,27 @@ class ProjectXMLParser extends HXProject Reflect.setField(launchStoryboard.templateContext, valueName, value); } } - + if (element.has.assetsPath) { launchStoryboard.assetsPath = Path.combine(extensionPath, substitute(element.att.assetsPath)); } - + for (childElement in element.elements) { var isValid = isValidElement(childElement, ""); if (isValid) { - switch(childElement.name) + switch (childElement.name) { case "imageset": var name = substitute(childElement.att.name); var imageset = new LaunchStoryboard.ImageSet(name); - - if (childElement.has.width) - imageset.width = Std.parseInt(substitute(childElement.att.width)); - if (childElement.has.height) - imageset.height = Std.parseInt(substitute(childElement.att.height)); - + + if (childElement.has.width) imageset.width = Std.parseInt(substitute(childElement.att.width)); + if (childElement.has.height) imageset.height = Std.parseInt(substitute(childElement.att.height)); + launchStoryboard.assets.push(imageset); } } diff --git a/src/lime/utils/ArrayBuffer.hx b/src/lime/utils/ArrayBuffer.hx index 67061a6c1..24e77d5e1 100644 --- a/src/lime/utils/ArrayBuffer.hx +++ b/src/lime/utils/ArrayBuffer.hx @@ -11,7 +11,11 @@ abstract ArrayBuffer(Bytes) from Bytes to Bytes #end { public var byteLength(get, never):Int; - private inline function get_byteLength() { return this.length; } + + private inline function get_byteLength() + { + return this.length; + } public inline function new(byteLength:Int) { diff --git a/tools/CommandLineTools.hx b/tools/CommandLineTools.hx index da9cd11f5..73c1727e6 100644 --- a/tools/CommandLineTools.hx +++ b/tools/CommandLineTools.hx @@ -479,7 +479,7 @@ class CommandLineTools { neko.Lib.load("lime", "lime_application_create", 0); } - catch(e:Dynamic) + catch (e:Dynamic) { untyped $loader.path = $array(path + "Windows64/", $loader.path); } diff --git a/tools/SVGExport.hx b/tools/SVGExport.hx index 49b96a690..c11c9774d 100644 --- a/tools/SVGExport.hx +++ b/tools/SVGExport.hx @@ -56,15 +56,15 @@ class SVGExport untyped $loader.path = $array(path + "Windows/", $loader.path); // if (CFFI.enabled) // { - try - { - neko.Lib.load("lime", "lime_application_create", 0); - } - catch(e:Dynamic) - { - untyped $loader.path = $array(path + "Windows64/", $loader.path); - } - // } + try + { + neko.Lib.load("lime", "lime_application_create", 0); + } + catch (e:Dynamic) + { + untyped $loader.path = $array(path + "Windows64/", $loader.path); + } + // } case MAC: untyped $loader.path = $array(path + "Mac/", $loader.path); diff --git a/tools/platforms/AndroidPlatform.hx b/tools/platforms/AndroidPlatform.hx index 097a8ab54..f0f6f35d0 100644 --- a/tools/platforms/AndroidPlatform.hx +++ b/tools/platforms/AndroidPlatform.hx @@ -242,14 +242,17 @@ class AndroidPlatform extends PlatformTarget { build = "release"; } - + if (project.environment.exists("ANDROID_GRADLE_TASK")) { var task = project.environment.get("ANDROID_GRADLE_TASK"); - if ( task == "assembleDebug" ) { - build = "debug"; - } else { - build = "release"; + if (task == "assembleDebug") + { + build = "debug"; + } + else + { + build = "release"; } } @@ -257,11 +260,11 @@ class AndroidPlatform extends PlatformTarget if (project.config.exists("android.gradle-build-directory")) { - outputDirectory = Path.combine(project.config.getString("android.gradle-build-directory"), project.app.file + "/app/outputs/apk/"+build); + outputDirectory = Path.combine(project.config.getString("android.gradle-build-directory"), project.app.file + "/app/outputs/apk/" + build); } else { - outputDirectory = Path.combine(FileSystem.fullPath(targetDirectory), "bin/app/build/outputs/apk/"+build); + outputDirectory = Path.combine(FileSystem.fullPath(targetDirectory), "bin/app/build/outputs/apk/" + build); } var apkPath = Path.combine(outputDirectory, project.app.file + "-" + build + ".apk"); diff --git a/tools/platforms/IOSPlatform.hx b/tools/platforms/IOSPlatform.hx index e893933d5..edb914249 100644 --- a/tools/platforms/IOSPlatform.hx +++ b/tools/platforms/IOSPlatform.hx @@ -506,10 +506,10 @@ class IOSPlatform extends PlatformTarget if (project.launchStoryboard != null) { var sb = project.launchStoryboard; - + var assetsPath = sb.assetsPath; var imagesets = []; - + for (asset in sb.assets) { switch (asset.type) @@ -517,22 +517,22 @@ class IOSPlatform extends PlatformTarget case "imageset": var imageset = cast(asset, ImageSet); imagesets.push(imageset); - + var imagesetPath = Path.combine(projectDirectory, "Images.xcassets/" + imageset.name + ".imageset"); System.mkdir(imagesetPath); - + var baseImageName = Path.withoutExtension(imageset.name); - + var imageScales = ["1x", "2x", "3x"]; var images = []; for (scale in imageScales) { - var filename = baseImageName + (scale == "1x" ? "" : "@"+scale) + ".png"; + var filename = baseImageName + (scale == "1x" ? "" : "@" + scale) + ".png"; if (FileSystem.exists(Path.combine(assetsPath, filename))) { images.push({idiom: "universal", filename: filename, scale: scale}); System.copyFile(Path.combine(assetsPath, filename), Path.combine(imagesetPath, filename)); - + if (imageset.width == 0 || imageset.height == 0) { var dim = ImageHelper.readPNGImageSize(Path.combine(assetsPath, filename)); @@ -542,49 +542,53 @@ class IOSPlatform extends PlatformTarget } } } - - var contents = { - images: images, - info: { - version: "1", - author: "xcode" - } - }; - + + var contents = + { + images: images, + info: + { + version: "1", + author: "xcode" + } + }; + File.saveContent(Path.combine(imagesetPath, "Contents.json"), Json.stringify(contents)); - + default: - } } - + if (sb.template != null) { sb.templateContext.imagesets = []; - + for (imageset in imagesets) { - sb.templateContext.imagesets.push({ - name: imageset.name, - width: imageset.width, - height: imageset.height, - }); + sb.templateContext.imagesets.push( + { + name: imageset.name, + width: imageset.width, + height: imageset.height, + }); } - + var deployment:String = context.DEPLOYMENT; var parts = deployment.split("."); var major = Std.parseInt(parts[0]); var minor = parts.length >= 2 ? Std.parseInt(parts[1]) : 0; var patch = parts.length >= 3 ? Std.parseInt(parts[2]) : 0; - Reflect.setField(sb.templateContext, "deploymentVersion", { - major: major, - minor: minor, - patch: patch, - code: Std.parseInt("0x" + major + minor + patch) - }); - - System.copyFileTemplate(project.templatePaths, "ios/storyboards/" + sb.template, projectDirectory + sb.template, sb.templateContext, true, true); + Reflect.setField(sb.templateContext, "deploymentVersion", + { + major: major, + minor: minor, + patch: patch, + code: Std.parseInt("0x" + major + minor + patch) + }); + + System.copyFileTemplate(project.templatePaths, "ios/storyboards/" + sb.template, projectDirectory + sb.template, sb.templateContext, true, + true); context.IOS_LAUNCH_STORYBOARD = Path.withoutExtension(sb.template); } else @@ -643,7 +647,7 @@ class IOSPlatform extends PlatformTarget context.HAS_LAUNCH_IMAGE = true; } - + System.mkdir(projectDirectory + "/resources"); System.mkdir(projectDirectory + "/haxe/build"); diff --git a/tools/platforms/WindowsPlatform.hx b/tools/platforms/WindowsPlatform.hx index 79f296f78..b3ff77560 100644 --- a/tools/platforms/WindowsPlatform.hx +++ b/tools/platforms/WindowsPlatform.hx @@ -87,7 +87,8 @@ class WindowsPlatform extends PlatformTarget if ((targetType == "cpp" || targetType == "winrt")) { is64 = true; - } else if (targetType == "neko") + } + else if (targetType == "neko") { try {