changed to use mx.utils.Platform calls
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/af15f1cd Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/af15f1cd Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/af15f1cd Branch: refs/heads/develop Commit: af15f1cd506249adc7c7ce39f1030f29d4bf8bdc Parents: 9e3f9e0 Author: Justin Mclean <[email protected]> Authored: Mon Feb 3 17:21:00 2014 +1100 Committer: Justin Mclean <[email protected]> Committed: Mon Feb 3 17:21:00 2014 +1100 ---------------------------------------------------------------------- .../projects/airframework/src/mx/core/Window.as | 3 ++- .../src/mx/core/WindowedApplication.as | 3 ++- .../src/mx/core/windowClasses/TitleBar.as | 25 +++++--------------- .../src/mx/managers/NativeDragManagerImpl.as | 3 ++- .../src/mx/skins/halo/WindowCloseButtonSkin.as | 3 ++- .../mx/skins/halo/WindowMaximizeButtonSkin.as | 3 ++- .../mx/skins/halo/WindowMinimizeButtonSkin.as | 3 ++- .../spark/components/windowClasses/TitleBar.as | 19 +++------------ .../framework/src/mx/utils/LoaderUtil.as | 10 +------- 9 files changed, 22 insertions(+), 50 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/af15f1cd/frameworks/projects/airframework/src/mx/core/Window.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/airframework/src/mx/core/Window.as b/frameworks/projects/airframework/src/mx/core/Window.as index 1958dda..815b0bd 100644 --- a/frameworks/projects/airframework/src/mx/core/Window.as +++ b/frameworks/projects/airframework/src/mx/core/Window.as @@ -59,6 +59,7 @@ import mx.managers.systemClasses.ActiveWindowManager; import mx.styles.CSSStyleDeclaration; import mx.styles.StyleManager; import mx.styles.StyleProxy; +import mx.utils.Platform; use namespace mx_internal; @@ -2550,7 +2551,7 @@ public class Window extends LayoutContainer implements IWindow override public function validateDisplayList():void { super.validateDisplayList(); - if (Capabilities.os.substring(0, 3) == "Mac" && systemChrome == "standard") + if (Platform.isMac && systemChrome == "standard") { //need to move the scroll bars to not overlap the systemChrome gripper //if both scrollbars are already visible, this has been done for us http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/af15f1cd/frameworks/projects/airframework/src/mx/core/WindowedApplication.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/airframework/src/mx/core/WindowedApplication.as b/frameworks/projects/airframework/src/mx/core/WindowedApplication.as index 41d1829..1850188 100644 --- a/frameworks/projects/airframework/src/mx/core/WindowedApplication.as +++ b/frameworks/projects/airframework/src/mx/core/WindowedApplication.as @@ -60,6 +60,7 @@ import mx.managers.SystemManagerGlobals; import mx.styles.CSSStyleDeclaration; import mx.styles.StyleManager; import mx.styles.StyleProxy; +import mx.utils.Platform; use namespace mx_internal; @@ -2471,7 +2472,7 @@ public class WindowedApplication extends Application implements IWindow super.validateDisplayList(); if (!nativeWindow.closed) { - if (Capabilities.os.substring(0, 3) == "Mac" && systemChrome == "standard") + if (Platform.isMac && systemChrome == "standard") { //need to move the scroll bars to not overlap the systemChrome gripper //if both scrollbars are already visible, this has been done for us http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/af15f1cd/frameworks/projects/airframework/src/mx/core/windowClasses/TitleBar.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/airframework/src/mx/core/windowClasses/TitleBar.as b/frameworks/projects/airframework/src/mx/core/windowClasses/TitleBar.as index b5bfbdb..3c7604b 100644 --- a/frameworks/projects/airframework/src/mx/core/windowClasses/TitleBar.as +++ b/frameworks/projects/airframework/src/mx/core/windowClasses/TitleBar.as @@ -38,6 +38,7 @@ import mx.core.UITextField; import mx.core.mx_internal; import mx.styles.ISimpleStyleClient; import mx.styles.IStyleClient; +import mx.utils.Platform; use namespace mx_internal; @@ -58,20 +59,6 @@ public class TitleBar extends UIComponent //-------------------------------------------------------------------------- // - // Class methods - // - //-------------------------------------------------------------------------- - - /** - * @private - */ - private static function isMac():Boolean - { - return Capabilities.os.substring(0, 3) == "Mac"; - } - - //-------------------------------------------------------------------------- - // // Constructor // //-------------------------------------------------------------------------- @@ -372,7 +359,7 @@ public class TitleBar extends UIComponent maximizeButton_clickHandler); addChild(maximizeButton); - restoreButtonSkin = isMac() ? null : getStyle("restoreButtonSkin"); + restoreButtonSkin = Platform.isMac ? null : getStyle("restoreButtonSkin"); } if (!closeButton) @@ -488,7 +475,7 @@ public class TitleBar extends UIComponent } // If we're on Windows, check to see if we're maximized or not. - if (!isMac()) + if (!Platform.isMac) { if (window.nativeWindow.displayState == NativeWindowDisplayState.MAXIMIZED) @@ -515,7 +502,7 @@ public class TitleBar extends UIComponent } else { - if (isMac()) + if (Platform.isMac) { buttonAlign = "left"; placeButtons("left", width, height, @@ -532,7 +519,7 @@ public class TitleBar extends UIComponent String(getStyle("titleAlignment")); if (titleAlign == "center" || titleAlign == "left") placeTitle(titleAlign, leftOffset, rightOffset, buttonAlign); - else if (isMac()) + else if (Platform.isMac) placeTitle("center", leftOffset, rightOffset, buttonAlign); else placeTitle("left", leftOffset, rightOffset, buttonAlign); @@ -848,7 +835,7 @@ public class TitleBar extends UIComponent */ protected function doubleClickHandler(event:MouseEvent):void { - if (isMac()) + if (Platform.isMac) { window.minimize(); } http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/af15f1cd/frameworks/projects/airframework/src/mx/managers/NativeDragManagerImpl.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/airframework/src/mx/managers/NativeDragManagerImpl.as b/frameworks/projects/airframework/src/mx/managers/NativeDragManagerImpl.as index 5603c7b..63ea9f2 100644 --- a/frameworks/projects/airframework/src/mx/managers/NativeDragManagerImpl.as +++ b/frameworks/projects/airframework/src/mx/managers/NativeDragManagerImpl.as @@ -51,6 +51,7 @@ import mx.managers.dragClasses.DragProxy; import mx.styles.CSSStyleDeclaration; import mx.styles.IStyleManager2; import mx.styles.StyleManager; +import mx.utils.Platform; use namespace mx_internal; @@ -671,7 +672,7 @@ public class NativeDragManagerImpl implements IDragManager //translate either commandKey or controlKey to old-style ctrlKey var ctrlKey:Boolean = false; - if (Capabilities.os.substring(0,3) == "Mac") + if (Platform.isMac) ctrlKey = event.commandKey; else ctrlKey = event.controlKey; http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/af15f1cd/frameworks/projects/airframework/src/mx/skins/halo/WindowCloseButtonSkin.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/airframework/src/mx/skins/halo/WindowCloseButtonSkin.as b/frameworks/projects/airframework/src/mx/skins/halo/WindowCloseButtonSkin.as index d72f828..5cc0d49 100644 --- a/frameworks/projects/airframework/src/mx/skins/halo/WindowCloseButtonSkin.as +++ b/frameworks/projects/airframework/src/mx/skins/halo/WindowCloseButtonSkin.as @@ -25,6 +25,7 @@ import mx.core.UIComponent; import mx.controls.Image; import mx.states.SetProperty; import mx.states.State; +import mx.utils.Platform; /** * The skin for the close button in the TitleBar @@ -80,7 +81,7 @@ public class WindowCloseButtonSkin extends UIComponent { super(); - isMac = Capabilities.os.substring(0,3) == "Mac"; + isMac = Platform.isMac; } //-------------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/af15f1cd/frameworks/projects/airframework/src/mx/skins/halo/WindowMaximizeButtonSkin.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/airframework/src/mx/skins/halo/WindowMaximizeButtonSkin.as b/frameworks/projects/airframework/src/mx/skins/halo/WindowMaximizeButtonSkin.as index a0d73638..666fa5f 100644 --- a/frameworks/projects/airframework/src/mx/skins/halo/WindowMaximizeButtonSkin.as +++ b/frameworks/projects/airframework/src/mx/skins/halo/WindowMaximizeButtonSkin.as @@ -25,6 +25,7 @@ import mx.controls.Image; import mx.core.UIComponent; import mx.states.SetProperty; import mx.states.State; +import mx.utils.Platform; /** * The skin for the maximize button in the TitleBar @@ -95,7 +96,7 @@ public class WindowMaximizeButtonSkin extends UIComponent { super(); - isMac = Capabilities.os.substring(0,3) == "Mac"; + isMac = Platform.isMac; } //-------------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/af15f1cd/frameworks/projects/airframework/src/mx/skins/halo/WindowMinimizeButtonSkin.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/airframework/src/mx/skins/halo/WindowMinimizeButtonSkin.as b/frameworks/projects/airframework/src/mx/skins/halo/WindowMinimizeButtonSkin.as index 18a9eaf..759e15f 100644 --- a/frameworks/projects/airframework/src/mx/skins/halo/WindowMinimizeButtonSkin.as +++ b/frameworks/projects/airframework/src/mx/skins/halo/WindowMinimizeButtonSkin.as @@ -25,6 +25,7 @@ import mx.controls.Image; import mx.core.UIComponent; import mx.states.SetProperty; import mx.states.State; +import mx.utils.Platform; /** * The skin for the minimize button in the TitleBar @@ -86,7 +87,7 @@ public class WindowMinimizeButtonSkin extends UIComponent { super(); - isMac = Capabilities.os.substring(0,3) == "Mac"; + isMac = Platform.isMac; } //-------------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/af15f1cd/frameworks/projects/airspark/src/spark/components/windowClasses/TitleBar.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/airspark/src/spark/components/windowClasses/TitleBar.as b/frameworks/projects/airspark/src/spark/components/windowClasses/TitleBar.as index 319bbd0..956800d 100644 --- a/frameworks/projects/airspark/src/spark/components/windowClasses/TitleBar.as +++ b/frameworks/projects/airspark/src/spark/components/windowClasses/TitleBar.as @@ -29,6 +29,7 @@ import flash.system.Capabilities; import mx.core.IWindow; import mx.core.mx_internal; +import mx.utils.Platform; import spark.components.Button; import spark.components.supportClasses.SkinnableComponent; @@ -90,20 +91,6 @@ public class TitleBar extends SkinnableComponent //-------------------------------------------------------------------------- // - // Class methods - // - //-------------------------------------------------------------------------- - - /** - * @private - */ - private static function isMac():Boolean - { - return Capabilities.os.substring(0, 3) == "Mac"; - } - - //-------------------------------------------------------------------------- - // // Constructor // //-------------------------------------------------------------------------- @@ -342,7 +329,7 @@ public class TitleBar extends SkinnableComponent */ override protected function attachSkin():void { - if (isMac() && getStyle("skinClass") == TitleBarSkin) + if (Platform.isMac && getStyle("skinClass") == TitleBarSkin) { setStyle("skinClass", MacTitleBarSkin); } @@ -535,7 +522,7 @@ public class TitleBar extends SkinnableComponent */ protected function doubleClickHandler(event:MouseEvent):void { - if (isMac()) + if (Platform.isMac) { window.minimize(); } http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/af15f1cd/frameworks/projects/framework/src/mx/utils/LoaderUtil.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/framework/src/mx/utils/LoaderUtil.as b/frameworks/projects/framework/src/mx/utils/LoaderUtil.as index a1e1112..c6fe280 100644 --- a/frameworks/projects/framework/src/mx/utils/LoaderUtil.as +++ b/frameworks/projects/framework/src/mx/utils/LoaderUtil.as @@ -137,7 +137,7 @@ use namespace mx_internal; // On the mac, the player doesn't like filenames with high-ascii // characters. Calling encodeURI fixes this problem. We restrict // this call to mac-only since it causes problems on Windows. - if (isMac()) + if (Platform.isMac) return encodeURI(url); return url; @@ -632,14 +632,6 @@ use namespace mx_internal; /** * @private - */ - private static function isMac():Boolean - { - return Capabilities.os.substring(0, 3) == "Mac"; - } - - /** - * @private * * Strip off the DYNAMIC string(s) appended to the url. */
