diff --git a/3d_render_src/ChildRender.as b/3d_render_src/ChildRender.as index 9eb8edd..cf9a669 100644 --- a/3d_render_src/ChildRender.as +++ b/3d_render_src/ChildRender.as @@ -22,7 +22,7 @@ package { import flash.display.DisplayObject; import flash.geom.Point; import flash.geom.Rectangle; - + public class ChildRender extends BitmapData { private const allowPartial:Boolean = true; private const maxSize:uint = 1022; @@ -68,11 +68,11 @@ package { } if(bounds.right > orig_width) bounds.width += orig_width - bounds.right; - + inner_x = bounds.x / orig_width; inner_w = maxSize / orig_width; } - + if(orig_height > maxSize) { if(!bounds) bounds = getVisibleBounds(dispObj, penLayer); bounds.inflate(0, halfSize - bounds.height / 2); @@ -82,7 +82,7 @@ package { } if(bounds.bottom > orig_height) bounds.height += orig_height - bounds.bottom; - + inner_y = bounds.y / orig_height; inner_h = maxSize / orig_height; } @@ -148,4 +148,4 @@ package { return visibleBounds; } } -} \ No newline at end of file +} diff --git a/3d_render_src/ScratchTextureBitmap.as b/3d_render_src/ScratchTextureBitmap.as index e704f2b..ffdf9ab 100644 --- a/3d_render_src/ScratchTextureBitmap.as +++ b/3d_render_src/ScratchTextureBitmap.as @@ -143,7 +143,7 @@ internal final class Dbg public static function printObj(obj:*):String { var memoryHash:String; - + try { FakeClass(obj); @@ -152,7 +152,7 @@ internal final class Dbg { memoryHash = String(e).replace(/.*([@|\$].*?) to .*$/gi, '$1'); } - + return flash.utils.getQualifiedClassName(obj) + memoryHash; } } diff --git a/3d_render_src/SpriteStamp.as b/3d_render_src/SpriteStamp.as index 49c7811..a9bfc51 100644 --- a/3d_render_src/SpriteStamp.as +++ b/3d_render_src/SpriteStamp.as @@ -19,7 +19,7 @@ package { import flash.display.BitmapData; - + public class SpriteStamp extends BitmapData { private var fx:Object; public function SpriteStamp(width:int, height:int, fx:Object) { @@ -36,7 +36,7 @@ package { fx[prop] = o[prop]; } } - + public function get effects():Object { return fx; } diff --git a/src/primitives/MotionAndPenPrims.as b/src/primitives/MotionAndPenPrims.as index edca7e8..2547b38 100644 --- a/src/primitives/MotionAndPenPrims.as +++ b/src/primitives/MotionAndPenPrims.as @@ -24,13 +24,13 @@ package primitives { import blocks.*; - + import flash.display.*; import flash.geom.*; import flash.utils.Dictionary; - + import interpreter.*; - + import scratch.*; public class MotionAndPenPrims { diff --git a/src/scratch/ScratchCostume.as b/src/scratch/ScratchCostume.as index df96893..7569c35 100644 --- a/src/scratch/ScratchCostume.as +++ b/src/scratch/ScratchCostume.as @@ -62,7 +62,7 @@ public class ScratchCostume { public var baseLayerData:ByteArray; public static const WasEdited:int = -10; // special baseLayerID used to indicate costumes that have been edited - + public var svgRoot:SVGElement; // non-null for an SVG costume public var svgLoading:Boolean; // true while loading bitmaps embedded in an SVG private var svgSprite:Sprite; @@ -521,7 +521,7 @@ public class ScratchCostume { json.writeKeyValue('textLayerMD5', textLayerMD5); } } - + public function readJSON(jsonObj:Object):void { costumeName = jsonObj.costumeName; baseLayerID = jsonObj.baseLayerID; diff --git a/src/scratch/ScratchObj.as b/src/scratch/ScratchObj.as index 4313dee..4890e55 100644 --- a/src/scratch/ScratchObj.as +++ b/src/scratch/ScratchObj.as @@ -25,23 +25,23 @@ package scratch { import blocks.*; - + import filters.FilterPack; - + import flash.display.*; import flash.events.MouseEvent; import flash.geom.ColorTransform; import flash.utils.*; - + import interpreter.*; - + import scratch.ScratchComment; import scratch.ScratchSprite; import translation.Translator; - + import util.*; - + import watchers.*; public class ScratchObj extends Sprite { diff --git a/src/sound/SqueakSoundDecoder.as b/src/sound/SqueakSoundDecoder.as index 192dd92..81a65cf 100644 --- a/src/sound/SqueakSoundDecoder.as +++ b/src/sound/SqueakSoundDecoder.as @@ -86,11 +86,11 @@ public class SqueakSoundDecoder { } delta += step; sample += ((code & signMask) != 0) ? -delta : delta; - + index += indexTable[code]; if (index < 0) index = 0; if (index > 88) index = 88; - + if (sample > 32767) sample = 32767; if (sample < -32768) sample = -32768; result.writeShort(sample); diff --git a/src/svgeditor/DrawProperties.as b/src/svgeditor/DrawProperties.as index ca019ef..6b9fa4a 100644 --- a/src/svgeditor/DrawProperties.as +++ b/src/svgeditor/DrawProperties.as @@ -27,11 +27,11 @@ public class DrawProperties { public function set color(c:uint):void { rawColor = c } public function get color():uint { return rawColor & 0xFFFFFF } public function get alpha():Number { return ((rawColor >> 24) & 0xFF) / 0xFF } - + public function set secondColor(c:uint):void { rawSecondColor = c } public function get secondColor():uint { return rawSecondColor & 0xFFFFFF } public function get secondAlpha():Number { return ((rawSecondColor >> 24) & 0xFF) / 0xFF } - + // stroke public var smoothness:Number = 1; private var rawStrokeWidth:Number = 1; diff --git a/src/svgeditor/DrawPropertyUI.as b/src/svgeditor/DrawPropertyUI.as index 16b3b10..372cbce 100644 --- a/src/svgeditor/DrawPropertyUI.as +++ b/src/svgeditor/DrawPropertyUI.as @@ -433,7 +433,7 @@ public class DrawPropertyUI extends Sprite { updateStrokeWidthDisplay(); sendChangeEvent(); } - + var ttBg:Sprite = new Sprite(); addChild(ttBg); diff --git a/src/svgeditor/ImageCanvas.as b/src/svgeditor/ImageCanvas.as index d6e6e7b..3aba7e7 100644 --- a/src/svgeditor/ImageCanvas.as +++ b/src/svgeditor/ImageCanvas.as @@ -259,7 +259,7 @@ return 1; // Force integer scaling in both editors for now var lineColor:int = 0xB0B0B0; var thickness:Number = 0.5; var centerX:Number = canvasWidth / 2; - var centerY:Number = canvasHeight / 2; + var centerY:Number = canvasHeight / 2; g.beginFill(lineColor); g.drawRect(centerX - 4, centerY - (thickness / 2), 8, thickness); g.beginFill(lineColor); @@ -363,9 +363,9 @@ return 1; // Force integer scaling in both editors for now // ----------------------------- // Cursor Tool Support //------------------------------ - + private const growthFactor:Number = 1.2; - + public function handleTool(tool:String, evt:MouseEvent):void { if ('help' == tool) Scratch.app.showTip('paint'); var bitmapEditor:BitmapEdit = editor as BitmapEdit; diff --git a/src/svgeditor/Renderer.as b/src/svgeditor/Renderer.as index d82473b..397875c 100644 --- a/src/svgeditor/Renderer.as +++ b/src/svgeditor/Renderer.as @@ -26,7 +26,7 @@ package svgeditor import svgeditor.objs.SVGGroup; import svgeditor.objs.SVGShape; import svgeditor.objs.SVGTextField; - + public class Renderer { @@ -65,4 +65,4 @@ package svgeditor } } -} \ No newline at end of file +} diff --git a/src/svgeditor/SVGEdit.as b/src/svgeditor/SVGEdit.as index a555418..86b533d 100644 --- a/src/svgeditor/SVGEdit.as +++ b/src/svgeditor/SVGEdit.as @@ -24,19 +24,19 @@ package svgeditor { import flash.geom.*; import flash.text.*; import flash.utils.*; - + import scratch.ScratchCostume; - + import svgeditor.*; import svgeditor.objs.*; import svgeditor.tools.*; - + import svgutils.*; - + import ui.parts.ImagesPart; - + import uiwidgets.*; - + public class SVGEdit extends ImageEdit { public static const tools:Array = [ { name: 'select', desc: 'Select' }, @@ -524,4 +524,4 @@ package svgeditor { return null; } } -} \ No newline at end of file +} diff --git a/src/svgeditor/Selection.as b/src/svgeditor/Selection.as index 1447ae5..118f75e 100644 --- a/src/svgeditor/Selection.as +++ b/src/svgeditor/Selection.as @@ -29,15 +29,15 @@ package svgeditor import flash.geom.Point; import flash.geom.Rectangle; import flash.text.TextFieldType; - + import svgeditor.objs.ISVGEditable; import svgeditor.objs.SVGBitmap; import svgeditor.objs.SVGGroup; import svgeditor.objs.SVGShape; import svgeditor.objs.SVGTextField; - + import svgutils.SVGElement; - + public class Selection implements IEventDispatcher { private var selectedObjects:Array; @@ -75,7 +75,7 @@ package svgeditor public function cloneObjs(contentLayer:Sprite):Array { var copiedObjects:Array = null; if(!selectedObjects.length) return copiedObjects; - + // Get a copy of the selected objects var objsCopy:Array = []; for(var i:uint=0; i distCheck) { // Recurse to get a more precise time interval *= 0.5; - return getNextCollisionChange(ct, p1, cp1, cp2, p2, otherShape); + return getNextCollisionChange(ct, p1, cp1, cp2, p2, otherShape); } else { collisionState = colliding; @@ -180,7 +180,7 @@ package svgeditor.objs } } } - + return -1; } @@ -197,12 +197,12 @@ package svgeditor.objs var forceLines:Boolean = (element.path.length < 3 ); var dRect:Rectangle = getBounds(this); - + // Adjust the path so that the top left is at 0,0 locally // This allows us to create the smallest bitmap for rendering it to var bmp:BitmapData = new BitmapData(dRect.width, dRect.height, true, 0); var m:Matrix = new Matrix(1, 0, 0, 1, -dRect.topLeft.x, -dRect.topLeft.y); - + var lastCP:Point = new Point(); var startP:Point = new Point(); var mousePos:Point = new Point(mouseX, mouseY); @@ -211,10 +211,10 @@ package svgeditor.objs for(var i:uint = 0; i <= max; ++i) { // Clear the bitmap bmp.fillRect(bmp.rect, 0x00000000); - + // Draw the path up until point #i SVGPath.renderPathCmd(element.path[i], g, lastCP, startP); - + // Return this index if the mouse location has been drawn on bmp.draw(canvas, m); if(bmp.hitTest(dRect.topLeft, 0xFF, mousePos)) { @@ -222,7 +222,7 @@ package svgeditor.objs break; } } - + bmp.dispose(); return index; } @@ -242,7 +242,7 @@ package svgeditor.objs var img:BitmapData = new BitmapData(rect.width, rect.height, true, 0x00000000); var m:Matrix = transform.concatenatedMatrix.clone(); m.translate(-rect.x, -rect.y); - + var removedPoint:Boolean = false; var start:Number = (new Date).getTime(); var elem:SVGElement = getElement(); @@ -261,12 +261,12 @@ package svgeditor.objs img.fillRect(img.rect, 0); img.draw(this, m); img.threshold(img, img.rect, new Point, "<", 0xF0000000, 0, 0xF0000000); - + var cmd:Array = elem.path[index]; elem.path.splice(index, 1); elem.path.adjustPathAroundAnchor(index, 3, 1); redraw(); - + img.draw(this, m, null, BlendMode.ERASE); img.threshold(img, img.rect, new Point, "<", 0xF0000000, 0, 0xF0000000); var r:Rectangle = img.getColorBoundsRect(0xFF000000, 0xFF000000, true); @@ -318,7 +318,7 @@ package svgeditor.objs elem.setAttribute('stroke', 'black'); elem.setAttribute('stroke-width', 2); } - + // Take a snapshot redraw(); var rect:Rectangle = getBounds(stage); @@ -338,7 +338,7 @@ package svgeditor.objs for(var j:uint = or.top; j>24) & 0xF0) ++totalPixels; - + var removedPoint:Boolean = false; var start:Number = (new Date).getTime(); var passCount:uint = 0; @@ -362,12 +362,12 @@ package svgeditor.objs // Get a fresh copy of the original render img2.copyPixels(img, img.rect, new Point); - + var cmd:Array = elem.path[index]; elem.path.splice(index, 1); elem.path.adjustPathAroundAnchor(index, 3, 1); redraw(); - + img2.draw(this, m, null, BlendMode.ERASE); img2.threshold(img, img.rect, new Point, "<", 0xF0000000, 0, 0xF0000000); var r:Rectangle = img.getColorBoundsRect(0xFF000000, 0xFF000000, true); @@ -399,7 +399,7 @@ package svgeditor.objs } while(removedPoint) img.dispose(); img2.dispose(); - + // Reset stroke and fill then redraw elem.setAttribute('stroke', stroke); elem.setAttribute('stroke-width', strokeWidth); @@ -426,7 +426,7 @@ package svgeditor.objs parent.addChild(debugShape); debugShape.transform = transform; } - + for(var i:int=0; i endPoints[0] && event.shiftKey) { @@ -274,12 +274,12 @@ package svgeditor.tools var cmds:Array = pathElem.path.splice(indices[0], indices[1] + 1); cmds.length--; var stitchIndex:int = cmds.length - 1; - + // Re-insert the commands at the beginning cmds.unshift(1); cmds.unshift(0); pathElem.path.splice.apply(pathElem.path, cmds); - + pathElem.path.adjustPathAroundAnchor(stitchIndex, 2); pathElem.path.adjustPathAroundAnchor(0, 2); endPoints = pathElem.path.getSegmentEndPoints(0); @@ -294,12 +294,12 @@ package svgeditor.tools // Make a copy to hold the path after the point var newPath:SVGShape = (object as SVGShape).clone() as SVGShape; (object as SVGShape).parent.addChildAt(newPath, (object as SVGShape).parent.getChildIndex(object as DisplayObject)); - + // TODO: Make work with inner paths??? // TODO: Handle closed paths! newPath.getElement().path.splice(0, index + 1); newPath.redraw(); - + // Now truncate the existing path pathElem.path.length = index + 1; } @@ -358,7 +358,7 @@ package svgeditor.tools } ++i; } - + // Shift the indices of the control points after the inserted point resetControlPointIndices(); redrawObj(); diff --git a/src/svgeditor/tools/PathEndPoint.as b/src/svgeditor/tools/PathEndPoint.as index 346ab5c..6aa0f0d 100644 --- a/src/svgeditor/tools/PathEndPoint.as +++ b/src/svgeditor/tools/PathEndPoint.as @@ -24,7 +24,7 @@ package svgeditor.tools import flash.display.Sprite; import flash.events.MouseEvent; import flash.geom.Point; - + import svgeditor.ImageEdit; import svgeditor.tools.PathEndPointManager; import svgeditor.objs.ISVGEditable; @@ -70,4 +70,4 @@ package svgeditor.tools PathEndPointManager.updateOrb((new Point(mouseX, mouseY)).length < w); } } -} \ No newline at end of file +} diff --git a/src/svgeditor/tools/PathEndPointManager.as b/src/svgeditor/tools/PathEndPointManager.as index 8008d45..182da05 100644 --- a/src/svgeditor/tools/PathEndPointManager.as +++ b/src/svgeditor/tools/PathEndPointManager.as @@ -22,13 +22,13 @@ package svgeditor.tools import flash.display.DisplayObject; import flash.display.Sprite; import flash.geom.Point; - + import svgeditor.ImageEdit; import svgeditor.objs.ISVGEditable; import svgeditor.objs.SVGGroup; import svgeditor.objs.SVGShape; import svgeditor.tools.PathAnchorPoint; - + import svgutils.SVGPath; public final class PathEndPointManager @@ -123,4 +123,4 @@ package svgeditor.tools } } } -} \ No newline at end of file +} diff --git a/src/svgeditor/tools/PixelPerfectCollisionDetection.as b/src/svgeditor/tools/PixelPerfectCollisionDetection.as index 23e4dce..64cf1a3 100644 --- a/src/svgeditor/tools/PixelPerfectCollisionDetection.as +++ b/src/svgeditor/tools/PixelPerfectCollisionDetection.as @@ -67,7 +67,7 @@ import flash.geom.Rectangle; scaleY = Math.floor(20 / limits.height); limits.height *= scaleY; } - + var image:BitmapData = new BitmapData(limits.width, limits.height, true); image.fillRect(image.rect, 0x00000000); var matrix:Matrix = object1.transform.concatenatedMatrix.clone(); @@ -110,4 +110,4 @@ if(debugSpr) { return null; }     } -} \ No newline at end of file +} diff --git a/src/svgeditor/tools/RectangleTool.as b/src/svgeditor/tools/RectangleTool.as index 4a89c7e..6caddd9 100644 --- a/src/svgeditor/tools/RectangleTool.as +++ b/src/svgeditor/tools/RectangleTool.as @@ -21,11 +21,11 @@ package svgeditor.tools { import flash.display.DisplayObject; import flash.geom.Point; - + import svgeditor.ImageEdit; import svgeditor.DrawProperties; import svgeditor.objs.SVGShape; - + import svgutils.SVGElement; public final class RectangleTool extends SVGCreateTool @@ -58,7 +58,7 @@ package svgeditor.tools newObject = new SVGShape(newElement); contentLayer.addChild(newObject as DisplayObject); } - + override protected function mouseMove(p:Point):void { if(!createOrigin) return; @@ -69,8 +69,8 @@ package svgeditor.tools // Shift key makes a square if(currentEvent.shiftKey) { w = h = Math.max(w, h); - p.x = createOrigin.x + (ofs.x < 0 ? w : -w); - p.y = createOrigin.y + (ofs.y < 0 ? h : -h); + p.x = createOrigin.x + (ofs.x < 0 ? w : -w); + p.y = createOrigin.y + (ofs.y < 0 ? h : -h); } newElement.setAttribute('x', Math.min(p.x, createOrigin.x)); @@ -82,4 +82,4 @@ package svgeditor.tools newObject.redraw(); } } -} \ No newline at end of file +} diff --git a/src/svgeditor/tools/SVGCreateTool.as b/src/svgeditor/tools/SVGCreateTool.as index cf62d05..6981d42 100644 --- a/src/svgeditor/tools/SVGCreateTool.as +++ b/src/svgeditor/tools/SVGCreateTool.as @@ -25,7 +25,7 @@ package svgeditor.tools import flash.events.EventDispatcher; import flash.events.MouseEvent; import flash.geom.Point; - + import svgeditor.ImageEdit; import svgeditor.ImageCanvas; import svgeditor.DrawProperties; @@ -81,7 +81,7 @@ package svgeditor.tools } newObject = null; } - + super.cancel(); } @@ -91,7 +91,7 @@ package svgeditor.tools p.x = Math.min(ImageCanvas.canvasWidth, Math.max(0, p.x)); p.y = Math.min(ImageCanvas.canvasHeight, Math.max(0, p.y)); currentEvent = e; - + if(e.type == MouseEvent.MOUSE_DOWN) { //editor.toggleZoomUI(false); mouseDown(p); @@ -133,4 +133,4 @@ package svgeditor.tools } } } -} \ No newline at end of file +} diff --git a/src/svgeditor/tools/SVGEditTool.as b/src/svgeditor/tools/SVGEditTool.as index e53f793..40487eb 100644 --- a/src/svgeditor/tools/SVGEditTool.as +++ b/src/svgeditor/tools/SVGEditTool.as @@ -25,7 +25,7 @@ package svgeditor.tools import flash.events.MouseEvent; import flash.filters.GlowFilter; import flash.geom.Point; - + import svgeditor.ImageEdit; import svgeditor.Selection; import svgeditor.objs.ISVGEditable; @@ -59,14 +59,14 @@ package svgeditor.tools // so that the mouseDown method below is overridden protected function edit(obj:ISVGEditable, event:MouseEvent):void { if(obj == object) return; - + if(object) { //(object as DisplayObject).filters = []; } if(obj && (!editTag || editTag.indexOf(obj.getElement().tag) > -1)) { object = obj; - + if(object) { //(object as DisplayObject).filters = [new GlowFilter(0x28A5DA)]; } @@ -95,7 +95,7 @@ package svgeditor.tools currentEvent = event; edit(obj, event); currentEvent = null; - + event.stopPropagation(); } } diff --git a/src/svgeditor/tools/SVGTool.as b/src/svgeditor/tools/SVGTool.as index a785796..c595141 100644 --- a/src/svgeditor/tools/SVGTool.as +++ b/src/svgeditor/tools/SVGTool.as @@ -24,10 +24,10 @@ package svgeditor.tools import flash.events.Event; import flash.events.MouseEvent; import flash.geom.Point; - + import svgeditor.ImageEdit; import svgeditor.objs.*; - + import svgutils.SVGPath; public class SVGTool extends Sprite @@ -126,7 +126,7 @@ package svgeditor.tools protected function getContinuableShapeUnderMouse(strokeWidth:Number):Object { // Hide the current path so we don't get that var obj:ISVGEditable = getEditableUnderMouse(false); - + if(obj is SVGShape) { var s:SVGShape = obj as SVGShape; var path:SVGPath = s.getElement().path; @@ -145,7 +145,7 @@ package svgeditor.tools } } } - + return null; } } diff --git a/src/svgeditor/tools/TextTool.as b/src/svgeditor/tools/TextTool.as index 7228f68..277dbe7 100644 --- a/src/svgeditor/tools/TextTool.as +++ b/src/svgeditor/tools/TextTool.as @@ -34,11 +34,11 @@ package svgeditor.tools import flash.text.TextFieldAutoSize; import flash.text.TextFieldType; import flash.utils.Timer; - + import svgeditor.*; import svgeditor.objs.ISVGEditable; import svgeditor.objs.SVGTextField; - + import svgutils.SVGElement; // TODO: Make it non-sticky when the editor is a BitmapEdit instance @@ -140,11 +140,11 @@ package svgeditor.tools // TODO: Fix redraw, it's currently moving the text field (due to the matrix?) //tf.redraw(); if(editor is SVGEdit) tf.filters = []; - + if(tf.text == '' || tf.text == ' ') {// || tf.text.match(new RegExp('/^\s+$/'))) { tf.parent.removeChild(tf); } - + setObject(null); } @@ -186,17 +186,17 @@ package svgeditor.tools } else { var contentLayer:Sprite = editor.getContentLayer(); - + var el:SVGElement = new SVGElement('text', ''); el.setAttribute('text-anchor', 'start'); el.text = ''; el.setShapeFill(editor.getShapeProps()); el.setFont(editor.getShapeProps().fontName, 22); - + var tf:SVGTextField = new SVGTextField(el); contentLayer.addChild(tf); tf.redraw(); - + var p:Point = new Point(contentLayer.mouseX, contentLayer.mouseY); var ascent:Number = tf.getLineMetrics(0).ascent; tf.x = p.x; @@ -213,4 +213,4 @@ package svgeditor.tools } } } -} \ No newline at end of file +} diff --git a/src/svgutils/SVGElement.as b/src/svgutils/SVGElement.as index 67bbb17..b0df861 100644 --- a/src/svgutils/SVGElement.as +++ b/src/svgutils/SVGElement.as @@ -31,7 +31,7 @@ package svgutils { import flash.display.*; import flash.geom.*; import flash.text.*; - + import svgeditor.DrawProperties; public class SVGElement { diff --git a/src/svgutils/SVGExport.as b/src/svgutils/SVGExport.as index eef443e..4dd923b 100644 --- a/src/svgutils/SVGExport.as +++ b/src/svgutils/SVGExport.as @@ -29,7 +29,7 @@ // * 'subElements' field of group elements // * 'transform' field (null if element is not transformed) // * gradient fills: an SVGElement with a 'stop' subElement for each color - + package svgutils { import flash.display.Sprite; import flash.geom.*; @@ -193,7 +193,7 @@ public class SVGExport { if ((m.a == 1) && (m.b == 0) && (m.c == 0) && (m.d == 1) && (m.tx == 0) && (m.ty == 0)) return; // identity node.@['transform'] = 'matrix(' + m.a + ', ' + m.b + ', ' + m.c + ', ' + m.d + ', ' + m.tx + ', ' + m.ty + ')'; } - + // Gradients private function defineGradient(gradEl:SVGElement):String { diff --git a/src/svgutils/SVGImportPath.as b/src/svgutils/SVGImportPath.as index d962bad..7ddeaa5 100644 --- a/src/svgutils/SVGImportPath.as +++ b/src/svgutils/SVGImportPath.as @@ -25,7 +25,7 @@ // A simplified path contains only M, L, C, and Q commands with absolute coordinates. // // Using a standard path format simplifies the rendering and editing code. - + package svgutils { import flash.geom.Point; @@ -65,7 +65,7 @@ public class SVGImportPath { quarterCircle(false, cx + rx, cy, cx, cy + ry), quarterCircle(true, cx, cy + ry, cx - rx, cy), quarterCircle(false, cx - rx, cy, cx, cy - ry),['Z']); - + path.splitCurve(1, 0.5); path.splitCurve(3, 0.5); path.splitCurve(5, 0.5); @@ -83,7 +83,7 @@ public class SVGImportPath { ['C', srcX + (k * dx), srcY, dstX, dstY - (k * dy), dstX, dstY] : ['C', srcX, srcY + (k * dy), dstX - (k * dx), dstY, dstX, dstY]; } - + private function cmdsForLine(el:SVGElement):SVGPath { return new SVGPath( ['M', el.getAttribute('x1', 0), el.getAttribute('y1', 0)], @@ -312,7 +312,7 @@ public class SVGImportPath { var c1y:Number = p0y + (lastCY - p0y) * 2/3; var c2x:Number = lastX + (lastCX - lastX) * 2/3; var c2y:Number = lastY + (lastCY - lastY) * 2/3; - + return ['C', c1x, c1y, c2x, c2y, lastX, lastY]; } @@ -329,7 +329,7 @@ public class SVGImportPath { var c1y:Number = p0y + (lastCY - p0y) * 2/3; var c2x:Number = lastX + (lastCX - lastX) * 2/3; var c2y:Number = lastY + (lastCY - lastY) * 2/3; - + return ['C', c1x, c1y, c2x, c2y, lastX, lastY]; } diff --git a/src/svgutils/SVGImporter.as b/src/svgutils/SVGImporter.as index ba7e7ee..cb0717b 100644 --- a/src/svgutils/SVGImporter.as +++ b/src/svgutils/SVGImporter.as @@ -51,7 +51,7 @@ import util.Base64Encoder; import flash.display.Loader; import flash.events.Event; import flash.geom.*; - + public class SVGImporter { public var root:SVGElement; // root of the visible element tree @@ -239,7 +239,7 @@ public class SVGImporter { for each (var parentEl:SVGElement in parentList) { alpha = alpha * parentEl.getAttribute('opacity', 1); } - if (alpha != 1) el.attributes['opacity'] = alpha; + if (alpha != 1) el.attributes['opacity'] = alpha; } private function inheritedValue(attrName:String, parentList:Array):* { @@ -309,12 +309,12 @@ public class SVGImporter { var stopsEl:SVGElement = elements[href]; for each (var el:SVGElement in stopsEl.subElements) { // clone stops into gradEl - gradEl.subElements.push(el.clone()); + gradEl.subElements.push(el.clone()); } } } } - + // ----------------------------- // URL Reference Resolution //------------------------------ diff --git a/src/ui/CameraDialog.as b/src/ui/CameraDialog.as index c75c18a..6e7fb5b 100644 --- a/src/ui/CameraDialog.as +++ b/src/ui/CameraDialog.as @@ -33,7 +33,7 @@ public class CameraDialog extends DialogBox { return ['Camera', 'Save', 'Close']; } - public function CameraDialog(saveFunc:Function) { + public function CameraDialog(saveFunc:Function) { super(); this.saveFunc = saveFunc; @@ -41,7 +41,7 @@ public class CameraDialog extends DialogBox { var container:Sprite = new Sprite(); addWidget(container); - + picture = new Bitmap(); picture.bitmapData = new BitmapData(320, 240, true); picture.visible = false; @@ -54,9 +54,9 @@ public class CameraDialog extends DialogBox { var b:Button; addChild(b = new Button(Translator.map('Save'), savePicture)); - buttons.push(b); + buttons.push(b); addChild(b = new Button(Translator.map('Close'), closeDialog)); - buttons.push(b); + buttons.push(b); } private function savePicture():void { diff --git a/src/ui/media/MediaLibraryItem.as b/src/ui/media/MediaLibraryItem.as index 0d6ae72..4089a25 100644 --- a/src/ui/media/MediaLibraryItem.as +++ b/src/ui/media/MediaLibraryItem.as @@ -123,7 +123,7 @@ public class MediaLibraryItem extends Sprite { function setThumbnail(bm:BitmapData):void { if (!bm) return; thumbnailCache[md5] = bm; - if (spriteMD5) thumbnailCache[spriteMD5] = bm; + if (spriteMD5) thumbnailCache[spriteMD5] = bm; setThumbnailBM(bm); done(); } @@ -217,7 +217,7 @@ public class MediaLibraryItem extends Sprite { info.y = frameHeight - 17; addChild(info); } - + private function addPlayButton():void { playButton = new IconButton(toggleSoundPlay, 'play'); playButton.x = 75; diff --git a/src/ui/parts/SoundsPart.as b/src/ui/parts/SoundsPart.as index af446ed..1d544ee 100644 --- a/src/ui/parts/SoundsPart.as +++ b/src/ui/parts/SoundsPart.as @@ -82,7 +82,7 @@ public class SoundsPart extends UIPart { editor.updateTranslation(); SimpleTooltips.add(libraryButton, {text: 'Choose sound from library', direction: 'bottom'}); SimpleTooltips.add(recordButton, {text: 'Record new sound', direction: 'bottom'}); - SimpleTooltips.add(importButton, {text: 'Upload sound from file', direction: 'bottom'}); + SimpleTooltips.add(importButton, {text: 'Upload sound from file', direction: 'bottom'}); fixlayout(); } @@ -169,7 +169,7 @@ public class SoundsPart extends UIPart { editor.x = contentsX; editor.y = 50; } - + private function addNewSoundButtons():void { var left:int = 16; var buttonY:int = 31; @@ -185,7 +185,7 @@ public class SoundsPart extends UIPart { b.y = y; return b; } - + private function addListFrame():void { listFrame = new ScrollFrame(); listFrame.setContents(app.getMediaPane(app, 'sounds')); @@ -208,7 +208,7 @@ public class SoundsPart extends UIPart { // ----------------------------- // Undo/Redo //------------------------------ - + private function addUndoButtons():void { addChild(undoButton = new IconButton(editor.waveform.undo, makeButtonImg('undo', true), makeButtonImg('undo', false))); addChild(redoButton = new IconButton(editor.waveform.redo, makeButtonImg('redo', true), makeButtonImg('redo', false))); @@ -220,7 +220,7 @@ public class SoundsPart extends UIPart { undoButton.setDisabled(!editor.waveform.canUndo(), 0.5); redoButton.setDisabled(!editor.waveform.canRedo(), 0.5); } - + public static function makeButtonImg(iconName:String, isOn:Boolean, buttonSize:Point = null):Sprite { var icon:Bitmap = Resources.createBmp(iconName + (isOn ? 'On' : 'Off')); var buttonW:int = Math.max(icon.width, buttonSize ? buttonSize.x : 24); diff --git a/src/ui/parts/UIPart.as b/src/ui/parts/UIPart.as index 689c905..f6e0b05 100644 --- a/src/ui/parts/UIPart.as +++ b/src/ui/parts/UIPart.as @@ -37,7 +37,7 @@ package ui.parts { import translation.Translator; import uiwidgets.IconButton; import util.DrawPath; - + public class UIPart extends Sprite { protected static const cornerRadius:int = 8; diff --git a/src/uiwidgets/Button.as b/src/uiwidgets/Button.as index b4d0b2d..ee38d3d 100644 --- a/src/uiwidgets/Button.as +++ b/src/uiwidgets/Button.as @@ -22,14 +22,14 @@ package uiwidgets { import flash.events.MouseEvent; import flash.geom.Matrix; import flash.text.*; - + public class Button extends Sprite { private var labelOrIcon:DisplayObject; private var color:* = CSS.titleBarColors; private var minWidth:int = 50; private var compact:Boolean; - + private var action:Function; private var tipName:String; @@ -83,7 +83,7 @@ public class Button extends Sprite { if (color is Array) { var matr:Matrix = new Matrix(); matr.createGradientBox(minW, minH, Math.PI / 2, 0, 0); - graphics.beginGradientFill(GradientType.LINEAR, CSS.titleBarColors , [100, 100], [0x00, 0xFF], matr); + graphics.beginGradientFill(GradientType.LINEAR, CSS.titleBarColors , [100, 100], [0x00, 0xFF], matr); } else graphics.beginFill(color); graphics.drawRoundRect(0, 0, minW, minH, 12); diff --git a/src/uiwidgets/CursorTool.as b/src/uiwidgets/CursorTool.as index 7eaee20..7938f09 100644 --- a/src/uiwidgets/CursorTool.as +++ b/src/uiwidgets/CursorTool.as @@ -24,7 +24,7 @@ package uiwidgets { import flash.system.Capabilities; import flash.ui.*; import assets.Resources; - + public class CursorTool { public static var tool:String; // null or one of: copy, cut, grow, shrink, help diff --git a/src/uiwidgets/SimpleTooltips.as b/src/uiwidgets/SimpleTooltips.as index 4de4ee4..9c1dd67 100644 --- a/src/uiwidgets/SimpleTooltips.as +++ b/src/uiwidgets/SimpleTooltips.as @@ -32,20 +32,20 @@ import translation.Translator; public class SimpleTooltips { static private var instance:SimpleTooltip = null; /** - * Add a tooltip to a DisplayObject + * Add a tooltip to a DisplayObject * @param dObj Attach the tooltip to this * @param opts Options (just 'text' and 'direction' right now) - * + * */ static public function add(dObj:DisplayObject, opts:Object):void { if(!instance) instance = new SimpleTooltip(); instance.addTooltip(dObj, opts); } - + static public function hideAll():void { if(instance) instance.forceHide(); } - + static public function showOnce(dObj:DisplayObject, opts:Object):void { if(!instance) instance = new SimpleTooltip(); instance.showOnce(dObj, opts); @@ -68,20 +68,20 @@ class SimpleTooltip { private var tipObjs:Dictionary = new Dictionary(); private var currentTipObj:DisplayObject; private var nextTipObj:DisplayObject; - + // Timing values (in milliseconds) private const delay:uint = 500; private const linger:uint = 1000; private const fadeIn:uint = 200; private const fadeOut:uint = 500; - + private const bgColor:uint = 0xfcfed4; - + // Timers private var showTimer:Timer; private var hideTimer:Timer; private var animTimer:Timer; - + private var sprite:Sprite; private var textField:TextField; private var stage:Stage; @@ -91,7 +91,7 @@ class SimpleTooltip { showTimer.addEventListener(TimerEvent.TIMER, eventHandler); hideTimer = new Timer(linger); hideTimer.addEventListener(TimerEvent.TIMER, eventHandler); - + // Setup display objects sprite = new Sprite(); sprite.mouseEnabled = false; @@ -105,7 +105,7 @@ class SimpleTooltip { textField.textColor = CSS.buttonLabelColor; sprite.addChild(textField); } - + static private var instance:*; public function addTooltip(dObj:DisplayObject, opts:Object):void { if(!opts.hasOwnProperty('text') || !opts.hasOwnProperty('direction') || @@ -113,13 +113,13 @@ class SimpleTooltip { trace('Invalid parameters!'); return; } - + if(tipObjs[dObj] == null) { dObj.addEventListener(MouseEvent.MOUSE_OVER, eventHandler); } tipObjs[dObj] = opts; } - + private function eventHandler(evt:Event):void { switch(evt.type) { case MouseEvent.MOUSE_OVER: @@ -127,12 +127,12 @@ class SimpleTooltip { break; case MouseEvent.MOUSE_OUT: (evt.currentTarget as DisplayObject).removeEventListener(MouseEvent.MOUSE_OUT, eventHandler); - + if(showTimer.running) { showTimer.reset(); nextTipObj = null; } - + startHideTimer(evt.currentTarget as DisplayObject); break; case TimerEvent.TIMER: @@ -148,7 +148,7 @@ class SimpleTooltip { break; } } - + private function startShow():void { //trace('startShow()'); showTimer.reset(); @@ -157,16 +157,16 @@ class SimpleTooltip { var ttOpts:Object = tipObjs[nextTipObj]; renderTooltip(ttOpts.text); currentTipObj = nextTipObj; - + // TODO: Make it fade in sprite.alpha = 1; stage.addChild(sprite); - + var pos:Point = getPos(ttOpts.direction); sprite.x = pos.x; sprite.y = pos.y; } - + public function showOnce(dObj:DisplayObject, ttOpts:Object):void { if(!stage && dObj.stage) stage = dObj.stage; //trace('showOnce()'); @@ -176,22 +176,22 @@ class SimpleTooltip { sprite.alpha = 0; renderTooltip(ttOpts.text); currentTipObj = dObj; - + // TODO: Make it fade in sprite.alpha = 1; stage.addChild(sprite); - + var pos:Point = getPos(ttOpts.direction); sprite.x = pos.x; sprite.y = pos.y; - + // Show the tooltip for twice as long var myTimer:Timer = new Timer(5000); myTimer.addEventListener(TimerEvent.TIMER, eventHandler); myTimer.reset(); myTimer.start(); } - + private function getPos(direction:String):Point { var rect:Rectangle = currentTipObj.getBounds(stage); var pos:Point; @@ -213,11 +213,11 @@ class SimpleTooltip { if (pos.y < 0) pos.y = 0; return pos; } - + public function forceHide():void { startHide(hideTimer); } - + private function startHide(timer:Timer):void { //trace('startHide()'); hideTimer.reset(); @@ -225,7 +225,7 @@ class SimpleTooltip { sprite.alpha = 0; if(sprite.parent) stage.removeChild(sprite); } - + private function renderTooltip(text:String):void { //trace('renderTooltip(\''+text+'\')'); var g:Graphics = sprite.graphics; @@ -236,30 +236,30 @@ class SimpleTooltip { g.drawRect(0, 0, textField.textWidth + 5, textField.textHeight + 3); g.endFill(); } - + private function startShowTimer(dObj:DisplayObject):void { //trace('startShowTimer()'); if(!stage && dObj.stage) stage = dObj.stage; - + dObj.addEventListener(MouseEvent.MOUSE_OUT, eventHandler); - + if(dObj === currentTipObj) { hideTimer.reset(); return; } - + if(tipObjs[dObj] is Object) { nextTipObj = dObj; - + showTimer.reset(); showTimer.start(); } } - + private function startHideTimer(dObj:DisplayObject):void { //trace('startHideTimer()'); if(dObj !== currentTipObj) return; - + hideTimer.reset(); hideTimer.start(); } diff --git a/src/uiwidgets/Slider.as b/src/uiwidgets/Slider.as index cd6a97b..16128f8 100644 --- a/src/uiwidgets/Slider.as +++ b/src/uiwidgets/Slider.as @@ -60,7 +60,7 @@ public class Slider extends Sprite implements DragClient { public function get max():Number { return maxValue; } public function set max(n:Number):void { maxValue = n; } - + public function get value():Number { return positionFraction * (maxValue - minValue) + minValue; } public function set value(n:Number):void { // Update the slider value (0-1). @@ -89,7 +89,7 @@ public class Slider extends Sprite implements DragClient { g.beginFill(slotColor); } g.drawRoundRect(0, 0, w, h, slotRadius, slotRadius); - g.endFill(); + g.endFill(); } private function drawKnob(w:int, h:int):void { @@ -151,4 +151,4 @@ public class Slider extends Sprite implements DragClient { dispatchEvent(new Event(Event.COMPLETE)); } -}} \ No newline at end of file +}} diff --git a/src/util/DrawPath.as b/src/util/DrawPath.as index 8cb7bf2..fefdaa4 100644 --- a/src/util/DrawPath.as +++ b/src/util/DrawPath.as @@ -19,14 +19,14 @@ package util { import flash.display.Graphics; - + public class DrawPath { static public function drawPath(path:Array, g:Graphics):void { var startx:Number = 0, starty:Number = 0; var pathx:Number = 0, pathy:Number = 0; for each (var item:Array in path) { - switch (item[0].toLowerCase()) { + switch (item[0].toLowerCase()) { case 'm': startx = item[1]; starty = item[2]; @@ -35,7 +35,7 @@ public class DrawPath { case 'l': g.lineTo(pathx += item[1], pathy += item[2]); break; case 'h': g.lineTo(pathx += item[1], pathy); break; case 'v': g.lineTo(pathx, pathy += item[1]); break; - case 'c': + case 'c': var cx:Number = pathx + item[1]; var cy:Number = pathy + item[2]; var px:Number = pathx + item[3]; diff --git a/src/util/Multipart.as b/src/util/Multipart.as index 7872b2d..502b8ec 100644 --- a/src/util/Multipart.as +++ b/src/util/Multipart.as @@ -31,7 +31,7 @@ public class Multipart { private const crlf:String = '\r\n'; private var parts:Array = []; // list of name-value-type triples - + public function Multipart() { separator = generateSeparator(); } @@ -77,4 +77,4 @@ public class Multipart { return result; } -}} \ No newline at end of file +}} diff --git a/src/util/ZipIO.as b/src/util/ZipIO.as index aeccc59..7b21ba5 100644 --- a/src/util/ZipIO.as +++ b/src/util/ZipIO.as @@ -22,7 +22,7 @@ package util { import flash.utils.ByteArray; public class ZipIO { - + private const Version:int = 10; private const FileEntryID:uint = 0x04034b50; // Local File Header Record private const DirEntryID:uint = 0x02014b50; // Central Directory Record @@ -229,12 +229,12 @@ public class ZipIO { buf.position = 0; return buf; } - + private function writeFileHeader(e:Entry):void { buf.writeUnsignedInt(FileEntryID); buf.writeShort(Version); buf.writeShort(0); // flags - buf.writeShort(e.compressionMethod); + buf.writeShort(e.compressionMethod); buf.writeUnsignedInt(e.time); buf.writeUnsignedInt(e.crc); buf.writeUnsignedInt(e.compressedSize); @@ -244,7 +244,7 @@ public class ZipIO { buf.writeUTFBytes(e.name); // optional extra info would go here } - + private function writeDirectoryEntry(e:Entry):void { buf.writeUnsignedInt(DirEntryID); buf.writeShort(Version); // version created by @@ -266,7 +266,7 @@ public class ZipIO { // optional extra info would go here // optional comment would go here } - + private function writeEndRecord(dirStart:uint, dirSize:uint):void { buf.writeUnsignedInt(EndID); buf.writeShort(0); // number of this disk