You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(124) |
Jun
(201) |
Jul
(168) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
---|
From: Richard K. <ric...@us...> - 2005-05-17 06:00:59
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5210 Modified Files: NSTabView.as Log Message: if tab set to null, ignore Index: NSTabView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSTabView.as,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** NSTabView.as 16 May 2005 01:24:34 -0000 1.5 --- NSTabView.as 16 May 2005 14:44:55 -0000 1.6 *************** *** 163,174 **** m_delegate["tabViewWillSelectTabViewItem"].call(m_delegate, this, m_selected); } ! ! m_selectedItem = m_items.indexOfObject(m_selected); ! m_selected.setTabState(NSTabState.NSSelectedTab); ! var selectedView:NSView = m_selected.view(); ! if (selectedView != null) { ! addSubview(selectedView); ! selectedView.setFrame(contentRect()); ! m_window.makeFirstResponder(m_selected.initialFirstResponder()); } setNeedsDisplay(true); --- 163,175 ---- m_delegate["tabViewWillSelectTabViewItem"].call(m_delegate, this, m_selected); } ! if (m_selected != null) { ! m_selectedItem = m_items.indexOfObject(m_selected); ! m_selected.setTabState(NSTabState.NSSelectedTab); ! var selectedView:NSView = m_selected.view(); ! if (selectedView != null) { ! addSubview(selectedView); ! selectedView.setFrame(contentRect()); ! m_window.makeFirstResponder(m_selected.initialFirstResponder()); ! } } setNeedsDisplay(true); |
From: Richard K. <ric...@us...> - 2005-05-17 04:25:46
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8058 Added Files: NSScroller.as Log Message: initial import not yet functional --- NEW FILE: NSScroller.as --- /* * Copyright (c) 2005, InfoEther, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1) Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2) Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3) The name InfoEther, Inc. may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ import org.actionstep.NSControl; import org.actionstep.constants.NSScrollerPart; import org.actionstep.constants.NSControlSize; import org.actionstep.constants.NSScrollArrowPosition; import org.actionstep.constants.NSControlTint; import org.actionstep.NSRect; class org.actionstep.NSScroller extends NSControl { private static var DEFAULT_SCROLLER_WIDTH:Number = 16; private var m_hitPart:NSScrollerPart; private var m_arrowsPosition:NSScrollArrowPosition; private var m_knobProportion:Number; private var m_controlTint:NSControlTint; private var m_target:Object; private var m_action:String; // Determining NSScroller size public static function scrollerWidth():Number { return DEFAULT_SCROLLER_WIDTH; } public static function scrollerWidthForControlSize(size:NSControlSize):Number { return DEFAULT_SCROLLER_WIDTH; } public function init():NSScroller { return initWithFrame(NSRect.ZeroRect); } public function initWithFrame(rect:NSRect):NSScroller { return this; } public function setControlSize(size:NSControlSize) { //! How to adjust to this? } public function controlSize():NSControlSize { //! How to adjust to this? return NSControlSize.NSRegularControlSize; } // Laying out an NSScroller public function setArrowsPosition(position:NSScrollArrowPosition) { if (m_arrowsPosition == position) { return; } m_arrowsPosition = position; setNeedsDisplay(true); } public function arrowsPosition():NSScrollArrowPosition { return m_arrowsPosition; } // Setting the knob position public function setFloatValueKnobProportion(floatValue:Number, knobProportion:Number) { //! Implmement } public function knobProportion():Number { return m_knobProportion; } // Calculating layout // Drawing the parts // Event handling public function hitPart():NSScrollerPart { return m_hitPart; } public function acceptsFirstMouse():Boolean { return true; } public function acceptsFirstResponder():Boolean { return false; } public function action():String { return m_action; } public function setAction(value:String) { m_action = value; } public function target():Object { return m_target; } public function setTarget(target:Object) { m_target = target; } // Setting control tint public function controlTint():NSControlTint { return m_controlTint; } public function setControlTint(tint:NSControlTint) { m_controlTint = tint; } } |
From: Scott H. <sco...@us...> - 2005-05-17 03:50:26
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3115/src/org/actionstep Modified Files: NSView.as Log Message: Added a stub method Index: NSView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSView.as,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** NSView.as 17 May 2005 01:24:05 -0000 1.6 --- NSView.as 17 May 2005 03:49:49 -0000 1.7 *************** *** 675,678 **** --- 675,695 ---- //****************************************************** + //* Scrolling + //****************************************************** + + /** + * Scrolls this view's drawing surface the minimum distance for + * aRect to be completely visible. + * + * Returns TRUE if scrolling is performed, FALSE otherwise. + */ + public function scrollRectToVisible(aRect:NSRect):Boolean + { + //! IMPLEMENT + return false; + } + + + //****************************************************** //* Controlling Notifications //****************************************************** |
From: Richard K. <ric...@us...> - 2005-05-17 03:23:47
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31525 Added Files: ASDraw.as Log Message: add her back in --- NEW FILE: ASDraw.as --- /* * Copyright (c) 2005, InfoEther, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1) Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2) Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3) The name InfoEther, Inc. may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ class org.actionstep.ASDraw { //draws a horizontal line with thickness=1. public static function drawHLine(mc:MovieClip, lineColor:Number, x1:Number, x2:Number, y1:Number) { drawLine(mc, lineColor, x1, x2, y1, y1); } //draws a horizontal line with thickness=1. public static function drawVLine(mc:MovieClip, lineColor:Number, y1:Number, y2:Number, x1:Number) { if (y1 > y2) { var yTmp:Number = y1; y1 = y2; y1 = yTmp; } y2 += 1; drawLine(mc, lineColor, x1, x1, y1, y2); } //draws a horizontal line with thickness=1 and the edges fading out. public static function drawVLineEdgeFade(mc:MovieClip, lineColor:Number, y1:Number, y2:Number, x1:Number, edge:Number) { if (y1 > y2) { var yTmp:Number = y1; y1 = y2; y1 = yTmp; } y2 += 1; drawLine(mc, lineColor, x1, x1, y1+edge, y2-edge); drawLineFade(mc, lineColor, x1, x1, y1+edge, y1); drawLineFade(mc, lineColor, x1, x1, y2-edge, y2); } //draws a horizontal line with thickness=1 and the edges fading out. public static function drawHLineEdgeFade(mc:MovieClip, lineColor:Number, x1:Number, x2:Number, y1:Number, edge:Number) { if (x1 > x2) { var xTmp:Number = x1; x1 = x2; x2 = xTmp; } x2 += 1; drawLine(mc, lineColor, x1+edge, x2-edge, y1, y1); drawLineFade(mc, lineColor, x1+edge, x1, y1, y1); drawLineFade(mc, lineColor, x2-edge, x2, y1, y1); } public static function drawVLineFade(mc:MovieClip, lineColor:Number, y1:Number, y2:Number, x1:Number) { drawLineShared(mc, lineColor, true, x1, x1, y1, y2, 0); } public static function drawHLineFade(mc:MovieClip, lineColor:Number, x1:Number, x2:Number, y1:Number) { drawLineShared(mc, lineColor, true, y1, y1, x1, x2, 0); } public static function drawLineFade(mc:MovieClip, lineColor:Number, x1:Number, x2:Number, y1:Number, y2:Number) { drawLineShared(mc, lineColor, true, x1, x2, y1, y2, 0); } public static function drawLine(mc:MovieClip, lineColor:Number, x1:Number, x2:Number, y1:Number, y2:Number) { drawLineShared(mc, lineColor, false, x1, x2, y1, y2); } //draws a line with thickness=1. public static function drawLineShared(mc:MovieClip, lineColor:Number, isFade:Boolean, x1:Number, x2:Number, y1:Number, y2:Number) { if (lineColor == undefined) { return; } var radians:Number = getRadians(x1, x2, y1, y2); if (y1 > y2) { var yTmp:Number = y1; y1 = y2; y2 = yTmp; } //y2 += 1; if (x1 > x2) { var xTmp:Number = x1; x1 = x2; x2 = xTmp; } //x2 += 1; var w1:Number = x2 - x1 + 1; var h1:Number = y2 - y1 + 1; var xPlus:Number = 0; var yPlus:Number = 0; if (w1 == 1) { xPlus = 1; } if (h1 == 1) { yPlus = 1; } mc.lineStyle(undefined, 0, 100); if (isFade) { var colors:Array = [lineColor,lineColor]; var alphas:Array = [100,0]; var ratios:Array = [0x0,0xFF]; var matrix = { matrixType:"box", x:x1, y:y1, w:w1, h:h1, r: radians } mc.beginGradientFill("linear",colors,alphas,ratios,matrix); } else { mc.beginFill(lineColor, 100); } mc.moveTo(x1,y1); mc.moveTo(x1+xPlus,y1+yPlus); mc.lineTo(x2+xPlus,y2+yPlus); mc.lineTo(x2,y2); mc.lineTo(x1,y1); mc.endFill(); } ///////////////////////////////////////////////////////////////////////////// // BOX METHODS ///////////////////////////////////////////////////////////////////////////// //draws a rect with no border. public static function drawFill(mc:MovieClip, fillColor:Number, x1:Number, y1:Number, w1:Number, h1:Number) { if (fillColor == undefined) return; mc.lineStyle(undefined, 0, 100); mc.beginFill(fillColor, 100); mc.moveTo(x1,y1); mc.lineTo(x1+w1, y1); mc.lineTo(x1+w1, y1+h1); mc.lineTo(x1, y1+h1); mc.lineTo(x1, y1); //mc.drawRect(x1, y1, w1, h1); mc.endFill(); } // figure out how I wanna deal with the fact that these don't take w/h, but x1,x2,y1,y2 public static function drawHBoxFade(mc:MovieClip, boxColor:Number, x1:Number, x2:Number, y1:Number, y2:Number) { drawBoxFade(mc, boxColor, x1, x2, y1, y2, 90); } public static function drawHBoxFade2(mc:MovieClip, boxColor:Number, boxColor2:Number, x1:Number, x2:Number, y1:Number, y2:Number) { drawBoxFade2(mc, boxColor, boxColor2, x1, x2, y1, y2, 90); } public static function drawBoxFade30(mc:MovieClip, boxColor, x1, x2, y1, y2) { // trace('drawBoxFade30: ' + x1 + ',' + x2 + ',' + y1 + ',' + y2); var w1:Number = x2 - x1; var h1:Number = y2 - y1; var colors:Array = [boxColor,boxColor,boxColor]; var alphas:Array = [80,0,0]; // var ratios = [0x0,0x33,0x66,0x99,0xCC,0xFF]; var ratios:Array = [0x0,0x99,0xFF]; var radians:Number = getRadiansByDegrees(45); var matrix = { matrixType:"box", x:x1, y:y1, w:w1, h:h1, r: radians } mc.beginGradientFill("linear",colors,alphas,ratios,matrix); mc.moveTo(x1,y1); mc.lineTo(x2,y1); mc.lineTo(x2,y2); mc.lineTo(x1,y2); mc.lineTo(x1,y1); mc.endFill(); } public static function drawBoxFade(mc:MovieClip, boxColor:Number, x1:Number, x2:Number, y1:Number, y2:Number, degrees:Number) { var w1:Number = x2 - x1; var h1:Number = y2 - y1; // var colors = [boxColor,boxColor]; // var alphas = [100,0]; // var ratios = [0x0,0xFF]; var colors:Array = [boxColor,boxColor,boxColor]; var alphas:Array = [100,50,0]; var ratios:Array = [0x0,0x33,0xFF]; var radians:Number = getRadiansByDegrees(degrees); var matrix = { matrixType:"box", x:x1, y:y1, w:w1, h:h1, r: radians } mc.beginGradientFill("linear",colors,alphas,ratios,matrix); mc.moveTo(x1,y1); mc.lineTo(x2,y1); mc.lineTo(x2,y2); mc.lineTo(x1,y2); mc.lineTo(x1,y1); mc.endFill(); } public static function drawBoxFade2(mc:MovieClip, boxColor:Number, boxColor2:Number, x1:Number, x2:Number, y1:Number, y2:Number, degrees:Number) { var w1:Number = x2 - x1; var h1:Number = y2 - y1; var colors:Array = [boxColor,boxColor2]; var alphas:Array = [100,100]; var ratios:Array = [0x0,0xFF]; var radians:Number = getRadiansByDegrees(degrees); var matrix = { matrixType:"box", x:x1, y:y1, w:w1, h:h1, r: radians } mc.beginGradientFill("linear",colors,alphas,ratios,matrix); mc.moveTo(x1,y1); mc.lineTo(x2,y1); mc.lineTo(x2,y2); mc.lineTo(x1,y2); mc.lineTo(x1,y1); mc.endFill(); } //draws a rect public static function drawRect(mc:MovieClip, thick:Number, color:Number, x1:Number, y1:Number, w1:Number, h1:Number) { if (color == undefined) return; mc.lineStyle(thick, color, 100); mc.moveTo(x1,y1); mc.lineTo(x1+w1, y1); mc.lineTo(x1+w1, y1+h1); mc.lineTo(x1, y1+h1); mc.lineTo(x1, y1); } // ------------------ DRAW CURVE ------------------ // public static function drawCurve(mc:MovieClip, thick:Number, color:Number, startX:Number, startY:Number, curveControlX:Number, curveControlY:Number,endX:Number,endY:Number) { mc.lineStyle(thick,color); mc.moveTo(startX,startY); mc.curveTo(curveControlX,curveControlY,endX,endY); } // draw Oval public static function drawOval(mc:MovieClip, thick:Number, color:Number, x:Number,y:Number, width:Number,height:Number){ mc.lineStyle(thick, color); mc.moveTo(x,y+height/2); mc.curveTo(x,y,x+width/2, y); mc.curveTo(x+width,y,x+width, y+height/2); mc.curveTo(x+width,y+height, x+width/2, y+height); mc.curveTo(x,y+height, x, y+height/2); } // --------- FILL OVAL ------------ // public static function fillOval(mc:MovieClip, thick:Number, color:Number, fill:Number, x:Number,y:Number, width:Number,height:Number){ mc.lineStyle(thick, color); mc.moveTo(x,y+height/2); mc.beginFill(fill); mc.curveTo(x,y,x+width/2, y); mc.curveTo(x+width,y,x+width, y+height/2); mc.curveTo(x+width,y+height, x+width/2, y+height); mc.curveTo(x,y+height, x, y+height/2); mc.endFill(); } // --------- DRAW CIRCLE----------- // public static function drawCircle(mc:MovieClip, thick:Number, color:Number, r:Number,x:Number,y:Number){ var styleMaker:Number = 22.5; mc.moveTo(x+r,y); mc.lineStyle(thick, color); var style:Number = Math.tan(styleMaker*Math.PI/180); for (var angle:Number=45;angle<=360;angle+=45){ var endX:Number = r * Math.cos(angle*Math.PI/180); var endY:Number = r * Math.sin(angle*Math.PI/180); var cX:Number = endX + r* style * Math.cos((angle-90)*Math.PI/180); var cY:Number = endY + r* style * Math.sin((angle-90)*Math.PI/180); mc.curveTo(cX+x,cY+y,endX+x,endY+y); } } // --------- DRAW FILLED circle, ----------- // public static function fillCircle(mc:MovieClip, thick:Number, color:Number, fill:Number, r:Number,x:Number,y:Number){ var styleMaker:Number = 22.5; mc.moveTo(x+r,y); mc.lineStyle(thick, color); mc.beginFill(fill) var style:Number = Math.tan(styleMaker*Math.PI/180); for (var angle:Number=45;angle<=360;angle+=45){ var endX:Number = r * Math.cos(angle*Math.PI/180); var endY:Number = r * Math.sin(angle*Math.PI/180); var cX:Number = endX + r* style * Math.cos((angle-90)*Math.PI/180); var cY:Number = endY + r* style * Math.sin((angle-90)*Math.PI/180); mc.curveTo(cX+x,cY+y,endX+x,endY+y); } mc.endFill(); } // --------- DRAW helix shape ----------- // public static function drawHelix(mc:MovieClip, thick:Number, color:Number, r:Number,x:Number,y:Number,styleMaker:Number){ mc.moveTo(x+r,y); mc.lineStyle(thick, color); var style:Number = Math.tan(styleMaker*Math.PI/180); for (var angle:Number=45;angle<=360;angle+=45){ var endX:Number = r * Math.cos(angle*Math.PI/180); var endY:Number = r * Math.sin(angle*Math.PI/180); var cX:Number = endX + r* style * Math.cos((angle-90)*Math.PI/180); var cY:Number = endY + r* style * Math.sin((angle-90)*Math.PI/180); mc.curveTo(cX+x,cY+y,endX+x,endY+y); } } // --------- DRAW FILLED helix SHAPE, ----------- // public static function fillHelix(mc:MovieClip, thick:Number, color:Number, fill:Number, r:Number,x:Number,y:Number,styleMaker:Number){ mc.moveTo(x+r,y); mc.lineStyle(thick, color); mc.beginFill(fill) var style:Number = Math.tan(styleMaker*Math.PI/180); for (var angle:Number=45;angle<=360;angle+=45){ var endX:Number = r * Math.cos(angle*Math.PI/180); var endY:Number = r * Math.sin(angle*Math.PI/180); var cX:Number = endX + r* style * Math.cos((angle-90)*Math.PI/180); var cY:Number = endY + r* style * Math.sin((angle-90)*Math.PI/180); mc.curveTo(cX+x,cY+y,endX+x,endY+y); } mc.endFill(); } // -------------- DRAW GRADIENT SHAPE -------------- // public static function drawGradientShape(mc:MovieClip, thick:Number, color:Number, r:Number,x:Number,y:Number,styleMaker:Number, col1:Number,col2:Number,fa1:Number,fa2:Number, matrixX:Number,matrixY:Number,matrixW:Number, matrixH:Number){ mc.lineStyle(thick, color); mc.moveTo(x+r,y); var colors:Array = [col1 ,col2]; var alphas:Array = [ fa1, fa2 ]; var ratios:Array = [ 7, 0xFF ]; var matrix:Object = { matrixType:"box", x:matrixX, y:matrixY, w:matrixW, h:matrixH, r:(45/180)*Math.PI }; mc.beginGradientFill( "linear", colors, alphas, ratios, matrix ); var style:Number = Math.tan(styleMaker*Math.PI/180); for (var angle:Number=45;angle<=360;angle+=45){ var endX:Number = r * Math.cos(angle*Math.PI/180); var endY:Number = r * Math.sin(angle*Math.PI/180); var cX:Number = endX + r* style * Math.cos((angle-90)*Math.PI/180); var cY:Number = endY + r* style * Math.sin((angle-90)*Math.PI/180); mc.curveTo(cX+x,cY+y,endX+x,endY+y); } mc.endFill(); } // ----------- GRADIENT RECTANGLE ----------- // public static function gradientRect(mc:MovieClip, thick:Number, color:Number, x1:Number, y1:Number, width:Number, height:Number, col1:Number,col2:Number,fa1:Number,fa2:Number, matrixX:Number,matrixY:Number,matrixW:Number, matrixH:Number){ mc.lineStyle(thick,color); var colors:Array = [col1 ,col2]; var alphas:Array = [ fa1, fa2 ]; var ratios:Array = [ 7, 0xFF ]; var matrix:Object = { matrixType:"box", x:matrixX, y:matrixY, w:matrixW, h:matrixH, r:(45/180)*Math.PI }; mc.moveTo(x1,y1); mc.beginGradientFill( "linear", colors, alphas, ratios, matrix ); mc.lineTo(x1+width, y1); mc.lineTo(x1+width, y1+height); mc.lineTo(x1, y1+height); mc.lineTo(x1, y1); mc.endFill(); } // ----------- DRAW HEXAGON ---------- // public static function drawHexagon(mc:MovieClip, thick:Number, color:Number, hexRadius:Number, startX, startY){ var sideC:Number=hexRadius; var sideA:Number = 0.5 * sideC; var sideB:Number=Math.sqrt((hexRadius*hexRadius) - (0.5*hexRadius)* (0.5*hexRadius)); mc.lineStyle(thick,color,100) mc.moveTo(startX,startY) mc.lineTo(startX,sideC+ startY); mc.lineTo(sideB+startX,startY+sideA+sideC); // bottom point mc.lineTo(2*sideB + startX , startY + sideC); mc.lineTo(2*sideB + startX , startY); mc.lineTo(sideB + startX, startY - sideA); mc.lineTo(startX, startY); }; public static function fillHexagon(mc:MovieClip, thick:Number, color:Number, fill:Number, hexRadius:Number, startX, startY){ var sideC:Number=hexRadius; var sideA:Number = 0.5 * sideC; var sideB:Number=Math.sqrt((hexRadius*hexRadius) - (0.5*hexRadius)* (0.5*hexRadius)); mc.lineStyle(thick,color,100) mc.beginFill(fill); mc.moveTo(startX,startY) mc.lineTo(startX,sideC+ startY); mc.lineTo(sideB+startX,startY+sideA+sideC); // bottom point mc.lineTo(2*sideB + startX , startY + sideC); mc.lineTo(2*sideB + startX , startY); mc.lineTo(sideB + startX, startY - sideA); mc.lineTo(startX, startY); mc.endFill(); }; ///////////////////////////////////////////////////////////////////////////// // GRADIENT METHODS ///////////////////////////////////////////////////////////////////////////// public static function drawExampleGradient(mc:MovieClip) { drawTestLineGradient(mc, 50, 100, 50, 250); } public static function drawTestLineGradient(mc:MovieClip, x1:Number, x2:Number, y1:Number, y2:Number) { var w1:Number = x2 - x1; var h1:Number = y2 - y1; //trace("x1=" + x1 + ",x2=" + x2 + "y1=" + y1 + ",y2=" + y2 + "w1=" + w1 + ",h1=" + h1) var colors:Array = [0xFF0000,0xFFFF00,0x00FF00,0x00FFFF,0x0000FF,0xFF00FF]; var alphas:Array = [100,100,100,100,100,100]; var ratios:Array = [0x0,0x33,0x66,0x99,0xCC,0xFF]; var radians:Number = getRadians(x1, x2, y1, y2); var matrix = { matrixType:"box", x:x1, y:y1, w:w1, h:h1, r: radians } mc.beginGradientFill("linear",colors,alphas,ratios,matrix); mc.lineStyle(undefined, 0, 100); mc.moveTo(x1,y1); mc.moveTo(x1+1,y1+1); mc.lineTo(x2+1,y2+1); mc.lineTo(x2,y2); mc.lineTo(x1,y1); mc.endFill(); } /* public static function drawTestGradient(mc:MovieClip, x1:Number, x2:Number, y1:Number, y2:Number) { var w1:Number = x2 - x1; var h1:Number = y2 - y1; // EXAMPLE GRADIENT var colors:Array = [0xFF0000,0xFFFF00,0x00FF00,0x00FFFF,0x0000FF,0xFF00FF]; // all of the colors should be opaque var alphas:Array = [100,100,100,100,100,100]; // these ratios are in hexadeciaml, in even steps from 0 to 255 var ratios:Array = [0x0,0x33,0x66,0x99,0xCC,0xFF]; // 0 radians is the equivalent of no rotation for the gradient // var radians = getRadiansByDegrees(0); var radians:Number = getRadians(x1, x2, y1, y2); // build our matrix using the "box" method var matrix = { matrixType:"box", x:x1, y:y1, w:w1, h:h1, r: radians } // put all that together in the beginGradientFill mc.beginGradientFill("linear",colors,alphas,ratios,matrix); // draw the bounding box mc.moveTo(x1,y1); mc.lineTo(x2,y1); mc.lineTo(x2,y2); mc.lineTo(x1,y2); mc.lineTo(x1,y1); // close up the fill mc.endFill(); drawLine(mc, lineColor, x1, x2, y1, y2); }*/ public static function drawRoundedRect(mc, x, y, w, h, cornerRadius) { // ============== // mc.drawRect() - by Ric Ewing (ri...@fo...) - version 1.1 - 4.7.2002 // // x, y = top left corner of rect // w = width of rect // h = height of rect // cornerRadius = [optional] radius of rounding for corners (defaults to 0) // ============== if (arguments.length<4) { return; } // if the user has defined cornerRadius our task is a bit more complex. :) if (cornerRadius>0) { // init vars var theta, angle, cx, cy, px, py; // make sure that w + h are larger than 2*cornerRadius if (cornerRadius>Math.min(w, h)/2) { cornerRadius = Math.min(w, h)/2; } // theta = 45 degrees in radians theta = Math.PI/4; // draw top line mc.moveTo(x+cornerRadius, y); mc.lineTo(x+w-cornerRadius, y); //angle is currently 90 degrees angle = -Math.PI/2; // draw tr corner in two parts cx = x+w-cornerRadius+(Math.cos(angle+(theta/2))*cornerRadius/Math.cos(theta/2)); cy = y+cornerRadius+(Math.sin(angle+(theta/2))*cornerRadius/Math.cos(theta/2)); px = x+w-cornerRadius+(Math.cos(angle+theta)*cornerRadius); py = y+cornerRadius+(Math.sin(angle+theta)*cornerRadius); mc.curveTo(cx, cy, px, py); angle += theta; cx = x+w-cornerRadius+(Math.cos(angle+(theta/2))*cornerRadius/Math.cos(theta/2)); cy = y+cornerRadius+(Math.sin(angle+(theta/2))*cornerRadius/Math.cos(theta/2)); px = x+w-cornerRadius+(Math.cos(angle+theta)*cornerRadius); py = y+cornerRadius+(Math.sin(angle+theta)*cornerRadius); mc.curveTo(cx, cy, px, py); // draw right line mc.lineTo(x+w, y+h-cornerRadius); // draw br corner angle += theta; cx = x+w-cornerRadius+(Math.cos(angle+(theta/2))*cornerRadius/Math.cos(theta/2)); cy = y+h-cornerRadius+(Math.sin(angle+(theta/2))*cornerRadius/Math.cos(theta/2)); px = x+w-cornerRadius+(Math.cos(angle+theta)*cornerRadius); py = y+h-cornerRadius+(Math.sin(angle+theta)*cornerRadius); mc.curveTo(cx, cy, px, py); angle += theta; cx = x+w-cornerRadius+(Math.cos(angle+(theta/2))*cornerRadius/Math.cos(theta/2)); cy = y+h-cornerRadius+(Math.sin(angle+(theta/2))*cornerRadius/Math.cos(theta/2)); px = x+w-cornerRadius+(Math.cos(angle+theta)*cornerRadius); py = y+h-cornerRadius+(Math.sin(angle+theta)*cornerRadius); mc.curveTo(cx, cy, px, py); // draw bottom line mc.lineTo(x+cornerRadius, y+h); // draw bl corner angle += theta; cx = x+cornerRadius+(Math.cos(angle+(theta/2))*cornerRadius/Math.cos(theta/2)); cy = y+h-cornerRadius+(Math.sin(angle+(theta/2))*cornerRadius/Math.cos(theta/2)); px = x+cornerRadius+(Math.cos(angle+theta)*cornerRadius); py = y+h-cornerRadius+(Math.sin(angle+theta)*cornerRadius); mc.curveTo(cx, cy, px, py); angle += theta; cx = x+cornerRadius+(Math.cos(angle+(theta/2))*cornerRadius/Math.cos(theta/2)); cy = y+h-cornerRadius+(Math.sin(angle+(theta/2))*cornerRadius/Math.cos(theta/2)); px = x+cornerRadius+(Math.cos(angle+theta)*cornerRadius); py = y+h-cornerRadius+(Math.sin(angle+theta)*cornerRadius); mc.curveTo(cx, cy, px, py); // draw left line mc.lineTo(x, y+cornerRadius); // draw tl corner angle += theta; cx = x+cornerRadius+(Math.cos(angle+(theta/2))*cornerRadius/Math.cos(theta/2)); cy = y+cornerRadius+(Math.sin(angle+(theta/2))*cornerRadius/Math.cos(theta/2)); px = x+cornerRadius+(Math.cos(angle+theta)*cornerRadius); py = y+cornerRadius+(Math.sin(angle+theta)*cornerRadius); mc.curveTo(cx, cy, px, py); angle += theta; cx = x+cornerRadius+(Math.cos(angle+(theta/2))*cornerRadius/Math.cos(theta/2)); cy = y+cornerRadius+(Math.sin(angle+(theta/2))*cornerRadius/Math.cos(theta/2)); px = x+cornerRadius+(Math.cos(angle+theta)*cornerRadius); py = y+cornerRadius+(Math.sin(angle+theta)*cornerRadius); mc.curveTo(cx, cy, px, py); } else { // cornerRadius was not defined or = 0. This makes it easy. mc.moveTo(x, y); mc.lineTo(x+w, y); mc.lineTo(x+w, y+h); mc.lineTo(x, y+h); mc.lineTo(x, y); } } ///////////////////////////////////////////////////////////////////////////// // RADIAN METHODS ///////////////////////////////////////////////////////////////////////////// public static function getRadiansByDegrees(degrees:Number):Number { // To calculate a radian value, use this formula: // radian = Math.PI/180 * degree return Math.PI/180 * degrees; } public static function getRadians(x1:Number, x2:Number, y1:Number, y2:Number):Number { var x_base = x2-x1; var y_height = y2-y1; if (x_base == 0) { if (y_height > 0) { return getRadiansByDegrees(90); } return getRadiansByDegrees(270); } if (y_height == 0) { if (x_base > 0) { return getRadiansByDegrees(180); } return getRadiansByDegrees(0); } // The return value represents the opposite angle of a right triangle in radians // where x is the adjacent side length and y is the opposite side length. return Math.atan2( x_base, y_height ) } public static function getAngleAdjacentRadians(base:Number, height:Number):Number { // The return value represents the opposite angle of a right triangle in radians // where x is the adjacent side length and y is the opposite side length. return Math.atan2( height, base ) } public static function getAngleOppositeRadians(base:Number, height:Number):Number { // The return value represents the opposite angle of a right triangle in radians // where x is the adjacent side length and y is the opposite side length. return Math.atan2( base, height ) } } |
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30977/src/org/actionstep Modified Files: ASUtils.as NSArray.as NSControl.as NSEvent.as NSMatrix.as Removed Files: ASDefaultDrawer.as ASDraw.as ASDrawer.as ASDrawerProtocol.as Log Message: --- ASDrawerProtocol.as DELETED --- --- ASDefaultDrawer.as DELETED --- Index: NSArray.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSArray.as,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** NSArray.as 17 May 2005 02:58:01 -0000 1.8 --- NSArray.as 17 May 2005 03:21:19 -0000 1.9 *************** *** 226,229 **** --- 226,266 ---- /** + * Searches the receiver for anObject and returns the index of the first + * equal object. Objects are considered equal when comparer returns TRUE. + * + * The comparer function must return TRUE if equal, FALSE if inequal, and + * take 2 objects as arguments (the objects to compare). + */ + public function indexOfObjectWithCompareFunction(anObject:Object, + comparer:Function):Number + { + return indexOfObjectWithCompareFunctionInRange(anObject, comparer, + new NSRange(0, m_list.length - 1)); + } + + + /** + * Searches the specified range for anObject and returns the index of the first + * equal object. Objects are considered equal when comparer returns TRUE. + * + * The comparer function must return TRUE if equal, FALSE if inequal, and + * take 2 objects as arguments (the objects to compare). + */ + public function indexOfObjectWithCompareFunctionInRange(anObject:Object, + comparer:Function, range:NSRange):Number + { + var startIdx = range.location; + var endIdx = range.location + range.length; + + for (var i:Number = startIdx; i <= endIdx; i++) + { + if (comparer(m_list[i], anObject)) + return i; + } + + return NSObject.NSNotFound; + } + + /** * Searches the receiver for anObject (testing for equality by comparing * object addresses) and returns the lowest index whose corresponding --- ASDraw.as DELETED --- Index: ASUtils.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASUtils.as,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ASUtils.as 10 May 2005 02:19:19 -0000 1.3 --- ASUtils.as 17 May 2005 03:21:19 -0000 1.4 *************** *** 56,61 **** public static function createInstanceOf(klass:Function):Object { ! var res:Object = new Object(); res.__proto__ = klass.prototype; return res; } --- 56,62 ---- public static function createInstanceOf(klass:Function):Object { ! var res:Object = new klass(); res.__proto__ = klass.prototype; + return res; } --- ASDrawer.as DELETED --- Index: NSControl.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSControl.as,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NSControl.as 17 May 2005 02:30:04 -0000 1.7 --- NSControl.as 17 May 2005 03:21:19 -0000 1.8 *************** *** 342,350 **** } ! public function sendActionTo(action:String, to):Boolean { ! if (action==null) { return false; } ! return NSApplication.sharedApplication().sendActionToFrom(action, to, this); } --- 342,360 ---- } ! /** ! * Tells the NSApplication to trigger theAction in theTarget. ! * ! * If theAction is null, the call to sendActionTo is ignored. If theTarget ! * is null, NSApplication searches the responder chain for an object that ! * can respond to the message. ! * ! * This method returns TRUE if a target responds to the message, and FALSE ! * otherwise. ! */ ! public function sendActionTo(theAction:String, theTarget:Object):Boolean { ! if (theAction == null) { return false; } ! return NSApplication.sharedApplication().sendActionToFrom(theAction, theTarget, this); } Index: NSMatrix.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSMatrix.as,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** NSMatrix.as 17 May 2005 02:30:46 -0000 1.6 --- NSMatrix.as 17 May 2005 03:21:19 -0000 1.7 *************** *** 1556,1561 **** var cell:NSCell = cellAtRowColumn(row, column); ! if (cell == null) ! return; cell.setHighlighted(true); // highlight the cell --- 1556,1568 ---- var cell:NSCell = cellAtRowColumn(row, column); ! // ! // For NSRadioModeMatrix - Deselect the old selection if not the ! // same as the new one. ! // ! if (m_mode == NSMatrixMode.NSRadioModeMatrix && cell != null && ! m_cell != null && cell != m_cell) ! { ! ! } cell.setHighlighted(true); // highlight the cell *************** *** 1566,1570 **** //! text selection } ! m_sel.addObject({row: row, column: column}); // add to the selection drawCellAtRowColumn(row, column); // draw the cell --- 1573,1580 ---- //! text selection } ! ! ! m_cell = cell; ! m_sel.addObject({row: row, column: column}); // add to the selection drawCellAtRowColumn(row, column); // draw the cell Index: NSEvent.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSEvent.as,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NSEvent.as 4 May 2005 22:26:14 -0000 1.3 --- NSEvent.as 17 May 2005 03:21:19 -0000 1.4 *************** *** 262,266 **** public function description():String { ! return "NSEvent(type="+type+")"; } --- 262,266 ---- public function description():String { ! return "NSEvent(type="+type+",mouseLocation="+mouseLocation+")"; } |
From: Richard K. <ric...@us...> - 2005-05-17 03:00:14
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12316 Modified Files: NSView.as Log Message: optimize setFrameOrigin Index: NSView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSView.as,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NSView.as 15 May 2005 04:28:16 -0000 1.4 --- NSView.as 16 May 2005 04:42:23 -0000 1.5 *************** *** 493,497 **** m_frame.origin.x = origin.x; m_frame.origin.y = origin.y; ! updateFrameMovieClipSize(); if(m_postsFrameChangeNotifications) { m_notificationCenter.postNotificationWithNameObject(NSViewFrameDidChangeNotification, this); --- 493,500 ---- m_frame.origin.x = origin.x; m_frame.origin.y = origin.y; ! if (m_mcFrame != null) { ! m_mcFrame._x = m_frame.origin.x; ! m_mcFrame._y = m_frame.origin.y; ! } if(m_postsFrameChangeNotifications) { m_notificationCenter.postNotificationWithNameObject(NSViewFrameDidChangeNotification, this); |
From: Scott H. <sco...@us...> - 2005-05-17 02:59:26
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27151/src/org/actionstep Modified Files: NSObject.as Log Message: Added comment Index: NSObject.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSObject.as,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** NSObject.as 17 May 2005 02:56:45 -0000 1.6 --- NSObject.as 17 May 2005 02:58:48 -0000 1.7 *************** *** 49,52 **** --- 49,60 ---- } + + /** + * Returns TRUE if this is equal to anObject, and FALSE otherwise. + * + * To be overridden by subclasses as desired. + * + * The default implementation is reference comparison. + */ public function isEqual(anObject:NSObject):Boolean { return this == anObject; |
From: Richard K. <ric...@us...> - 2005-05-17 02:58:32
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27032 Modified Files: NSArray.as Log Message: changed back to isEqual to use method in NSObject Index: NSArray.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSArray.as,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NSArray.as 15 May 2005 18:29:15 -0000 1.7 --- NSArray.as 17 May 2005 02:58:01 -0000 1.8 *************** *** 217,221 **** for (var i:Number = startIdx; i <= endIdx; i++) { ! if (m_list[i]==anObject) return i; } --- 217,221 ---- for (var i:Number = startIdx; i <= endIdx; i++) { ! if (m_list[i].isEqual(anObject)) return i; } |
From: Scott H. <sco...@us...> - 2005-05-17 02:56:58
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26833/src/org/actionstep Modified Files: NSObject.as Log Message: added isEqual method Index: NSObject.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSObject.as,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** NSObject.as 17 May 2005 01:29:59 -0000 1.5 --- NSObject.as 17 May 2005 02:56:45 -0000 1.6 *************** *** 49,52 **** --- 49,57 ---- } + public function isEqual(anObject:NSObject):Boolean { + return this == anObject; + } + + /** * Creates a shallow copy of the object. |
From: Richard K. <ric...@us...> - 2005-05-17 02:54:23
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12406/test Added Files: ASTestAnimatedTabView.as Log Message: added sliding animated tab view --- NEW FILE: ASTestAnimatedTabView.as --- /* * Copyright (c) 2005, InfoEther, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1) Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2) Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3) The name InfoEther, Inc. may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ import org.actionstep.*; import org.actionstep.test.*; class org.actionstep.test.ASTestAnimatedTabView { public static function test() { var app = NSApplication.sharedApplication(); var window1 = (new NSWindow()).initWithContentRect(new NSRect(0,0,500,500)); var tabView = (new ASAnimatedTabView()).initWithFrame(new NSRect(10,10,400,400)); tabView.setTabViewType(org.actionstep.constants.NSTabViewType.NSNoTabsNoBorder); // tabView.setTabViewType(org.actionstep.constants.NSTabViewType.NSNoTabsLineBorder); var tabItem1:NSTabViewItem = (new NSTabViewItem()).initWithIdentifier(1); tabItem1.setLabel("This is a long tab"); var tabItemView1:ASTestView = new ASTestView(); tabItemView1.initWithFrame(new NSRect(0,0,10,10)); tabItemView1.setBackgroundColor(new NSColor(0xffff00)); tabItem1.setView(tabItemView1); var nextButton = (new NSButton()).initWithFrame(new NSRect(80,80,70,30)); nextButton.setTitle("Next Tab"); tabItemView1.addSubview(nextButton); nextButton.setTarget(tabView); nextButton.setAction("selectNextTabViewItem"); var tabItem2:NSTabViewItem = (new NSTabViewItem()).initWithIdentifier(2); tabItem2.setLabel("Short tab"); var tabItemView2:ASTestView = new ASTestView(); tabItemView2.initWithFrame(new NSRect(0,0,10,10)); tabItemView2.setBackgroundColor(new NSColor(0x00ff00)); tabItem2.setView(tabItemView2); var prevButton = (new NSButton()).initWithFrame(new NSRect(80,80,70,30)); prevButton.setTitle("Prev Tab"); tabItemView2.addSubview(prevButton); prevButton.setTarget(tabView); prevButton.setAction("selectPreviousTabViewItem"); tabView.addTabViewItem(tabItem1); tabView.addTabViewItem(tabItem2); tabView.selectFirstTabViewItem(null); window1.setContentView(tabView); app.run(); } } |
From: Richard K. <ric...@us...> - 2005-05-17 02:37:43
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12406 Added Files: ASAnimatedTabView.as Log Message: added sliding animated tab view --- NEW FILE: ASAnimatedTabView.as --- /* * Copyright (c) 2005, InfoEther, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1) Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2) Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3) The name InfoEther, Inc. may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ import org.actionstep.NSTabView; import org.actionstep.NSView; import org.actionstep.NSRect; import org.actionstep.NSTimer; import org.actionstep.NSTabViewItem; import org.actionstep.constants.NSTabState; class org.actionstep.ASAnimatedTabView extends NSTabView { public function selectTabViewItem(item:NSTabViewItem) { if (m_delegate != null) { if(typeof(m_delegate["tabViewShouldSelectTabViewItem"]) == "function") { if (!m_delegate["tabViewShouldSelectTabViewItem"].call(m_delegate, this, item)) { return; } } } _removeOldItem(item); } private function _removeOldItem(item:NSTabViewItem) { if (m_selected != null) { m_selected.setTabState(NSTabState.NSBackgroundTab); setNeedsDisplay(true); NSTimer.scheduledTimerWithTimeIntervalTargetSelectorUserInfoRepeats( .1, this, "_animateOldItem", { item:item, point:m_selected.view().frame().origin.clone(), width:m_selected.view().frame().size.width, speed:50, }, true); } else { _addNewItem(item); } } private function _animateOldItem(timer:NSTimer) { var context = timer.userInfo(); context.point.x -= context.speed; context.speed+=20; if ((-context.point.x) > context.width) { m_selected.view().removeFromSuperview(); timer.invalidate(); _addNewItem(timer.userInfo().item); } else { m_selected.view().setFrameOrigin(context.point); updateAfterEvent(); } } private function _addNewItem(item:NSTabViewItem) { m_selected = item; if (m_selected != null) { m_selectedItem = m_items.indexOfObject(m_selected); m_selected.setTabState(NSTabState.NSSelectedTab); if(typeof(m_delegate["tabViewWillSelectTabViewItem"]) == "function") { m_delegate["tabViewWillSelectTabViewItem"].call(m_delegate, this, m_selected); } var selectedView:NSView = m_selected.view(); if (selectedView != null) { addSubview(selectedView); m_window.makeFirstResponder(m_selected.initialFirstResponder()); var rect:NSRect = contentRect(); rect.origin.x -= rect.size.width; selectedView.setFrame(rect); setNeedsDisplay(true); selectedView.window().displayIfNeeded(); NSTimer.scheduledTimerWithTimeIntervalTargetSelectorUserInfoRepeats( .1, this, "_animateNewItem", { point:rect.origin, targetX:(rect.origin.x+rect.size.width), speed:140, }, true); } else { _finish(); } } else { m_selectedItem = -1; _finish(); } } private function _animateNewItem(timer:NSTimer) { var context = timer.userInfo(); context.point.x += context.speed; context.speed-=20; if (context.point.x > context.targetX) { context.point.x = context.targetX; m_selected.view().setFrameOrigin(context.point); timer.invalidate(); _finish(); } else { m_selected.view().setFrameOrigin(context.point); updateAfterEvent(); } } private function _finish() { setNeedsDisplay(true); if(typeof(m_delegate["tabViewDidSelectTabViewItem"]) == "function") { m_delegate["tabViewDidSelectTabViewItem"].call(m_delegate, this, m_selected); } } } |
From: Scott H. <sco...@us...> - 2005-05-17 02:32:31
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23538/src/org/actionstep/test Added Files: ASTestMatrix.as Log Message: Matrix testing class --- NEW FILE: ASTestMatrix.as --- (This appears to be a binary file; contents omitted.) |
From: Scott H. <sco...@us...> - 2005-05-17 02:30:57
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23193/src/org/actionstep Modified Files: NSMatrix.as Log Message: Added target and action methods Index: NSMatrix.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSMatrix.as,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** NSMatrix.as 17 May 2005 01:43:26 -0000 1.5 --- NSMatrix.as 17 May 2005 02:30:46 -0000 1.6 *************** *** 237,241 **** && m_numcols > 0) { ! //! this.selectCellAtRowColumn(0, 0); } } --- 237,241 ---- && m_numcols > 0) { ! this.selectCellAtRowColumn(0, 0); } } *************** *** 1349,1352 **** --- 1349,1355 ---- public function drawCellAtRowColumn(row:Number, column:Number):Void { + if (m_mcBounds == null) + return; + var cell:NSCell = cellAtRowColumn(row, column); *************** *** 2027,2032 **** (m_frame.size.width - (m_cellspacing.width * (m_numcols + 1))) / m_numcols, (m_frame.size.height - (m_cellspacing.height * (m_numrows + 1))) / m_numrows); - - TRACE(m_cellsize); } --- 2030,2033 ---- |
From: Richard K. <ric...@us...> - 2005-05-17 02:30:12
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22956 Modified Files: NSControl.as Log Message: moved the definition of the bounds to the m_trackingData Index: NSControl.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSControl.as,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** NSControl.as 12 May 2005 19:38:26 -0000 1.6 --- NSControl.as 17 May 2005 02:30:04 -0000 1.7 *************** *** 430,434 **** | NSEvent.NSMouseMovedMask | NSEvent.NSOtherMouseDraggedMask | NSEvent.NSRightMouseDraggedMask, mouseUp: false, ! complete: false }; mouseTrackingCallback(event); --- 430,435 ---- | NSEvent.NSMouseMovedMask | NSEvent.NSOtherMouseDraggedMask | NSEvent.NSRightMouseDraggedMask, mouseUp: false, ! complete: false, ! bounds: m_bounds }; mouseTrackingCallback(event); *************** *** 461,465 **** m_cell.setHighlighted(true); setNeedsDisplay(true); ! m_cell.trackMouseInRectOfViewUntilMouseUp(event, m_bounds, this, m_cell.getClass().prefersTrackingUntilMouseUp()); return; } --- 462,466 ---- m_cell.setHighlighted(true); setNeedsDisplay(true); ! m_cell.trackMouseInRectOfViewUntilMouseUp(event, m_trackingData.bounds, this, m_cell.getClass().prefersTrackingUntilMouseUp()); return; } |
From: Scott H. <sco...@us...> - 2005-05-17 01:43:38
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15532/src/org/actionstep Modified Files: NSMatrix.as Log Message: Uses new theming stuff Index: NSMatrix.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSMatrix.as,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NSMatrix.as 16 May 2005 22:24:42 -0000 1.4 --- NSMatrix.as 17 May 2005 01:43:26 -0000 1.5 *************** *** 40,45 **** import org.actionstep.NSColor; import org.actionstep.NSSize; ! ! import org.actionstep.ASDrawer; import org.actionstep.constants.NSMatrixMode; --- 40,45 ---- import org.actionstep.NSColor; import org.actionstep.NSSize; ! import org.actionstep.NSApplication; ! import org.actionstep.ASTheme; import org.actionstep.constants.NSMatrixMode; *************** *** 92,95 **** --- 92,98 ---- private var m_sel:NSArray; + private var m_target:Object; + private var m_action:String; + /** * The reason this is here, and not in a cell, is because a matrix can *************** *** 225,232 **** if (m_numrows > 0 && m_numcols > 0) { ! m_cellsize = new NSSize( ! m_frame.size.width / m_numcols, ! m_frame.size.height / m_numrows); ! } // --- 228,233 ---- if (m_numrows > 0 && m_numcols > 0) { ! recalcCellSize(); ! } // *************** *** 411,448 **** } - /** - * Returns the action method sent by the receiver to its target when the - * user double-clicks an entry, or NULL if thereâs no double-click action. - * The double-click action of an NSMatrix is sent after the appropriate - * single-click action (for the NSCell clicked or for the NSMatrix if - * the NSCell doesnât have its own action). If there is no double-click - * action and the NSMatrix doesnât ignore multiple clicks, the single-click - * action is sent twice. - */ - public function doubleAction():String - { - return m_doubleaction; - } - - - /** - * Makes aSelector the action sent to the target of the receiver when the - * user double-clicks a cell. A double-click action is always sent after - * the appropriate single-click action, which is the cellâs single-click - * action, if it has one, or the receiver single-click action, otherwise. - * If aSelector is a non-NULL selector, this method also sets the - * ignoresMultiClick flag to TRUE; otherwise, it leaves the flag unchanged. - * - * If an NSMatrix has no double-click action set, then by default a double - * click is treated as a single click. - * - * For the method to have any effect, the receiverâs action and target must - * be set to the class in which the selector is declared. - */ - public function setDoubleAction(aSelector:String):Void - { - m_doubleaction = aSelector; - } - /** --- 412,415 ---- *************** *** 503,506 **** --- 470,474 ---- { m_cellspacing = aSize; + recalcCellSize(); } *************** *** 682,685 **** --- 650,815 ---- return loc.row; } + + //****************************************************** + //* Target and Action * + //****************************************************** + + /** + * Returns the the method name that is called on this control's target + * when a double click occurs. + * + * @see org.actionstep.NSMatrix#setDoubleAction + * @see org.actionstep.NSMatrix#sendDoubleAction + */ + public function doubleAction():String + { + return m_doubleaction; + } + + + /** + * If the selected cell has a target and an action, a message is sent + * to the target. + * + * If the cell's target is null, this control's target is used. + * + * If there is no selected cell or the selected cell has no action, this + * control triggers its target's action. + * + * This method returns TRUE if a target responds to the message, and FALSE + * otherwise. + */ + public function sendAction():Boolean + { + var selcell:NSCell = selectedCell(); + + if (selcell == null || selcell.action() == null) + { + // + // No selection or selection has no action, so use this control's + // target and action. + // + return sendActionTo(m_action, m_target); + } + else if (selcell.target() == null) + { + // + // Selection has no target, so use this control's target. + // + return sendActionTo(selcell.action(), m_target); //! is this right? + } + else + { + // + // Selection has target and action, so send it. + // + return sendActionTo(selcell.action(), selcell.target()); //! is this right? + } + } + + + /** + * Iterates through all cells if toAllCells is TRUE or selected cells if + * toAllCells is FALSE, calling aSelector on anObject for each cell + * passing the current cell as the only parameter. + * + * The return type for anObject::aSelector() must be boolean. When + * anObject::aSelector returns TRUE, iteration continues to the next cell. + * When it returns FALSE, the iteration halts immediately. + */ + public function sendActionToForAllCells(aSelector:String, anObject:Object, + toAllCells:Boolean):Void + { + var cells:NSArray = toAllCells ? cells() : selectedCells(); + var app:NSApplication = NSApplication.sharedApplication(); + var itr:NSEnumerator = cells.objectEnumerator(); + var cell:NSCell; + var cont:Boolean = true; + + while ((null != (cell = NSCell(itr.nextObject()))) && cont) + { + cont = app.sendActionToFrom(aSelector, anObject, cell); + } + } + + + /** + * This method does the following in the specified order, until + * success is reached: + * + * 1. If doubleAction is set, a message will be sent to this control's + * target. + * 2. If the selected cell has an action set, that message will be sent + * to the cell's target. + * 3. A single-click action will be sent to this control's target. + * + * + * If the selected cell is disabled, no action is sent. + * + * This method should not be called directly (from the outside of this + * object), but can be overridden by subclasses for specialized + * behaviour. + */ + public function sendDoubleAction():Boolean + { + // Step 1. + if (m_doubleaction != null) + return sendActionTo(m_doubleaction, m_target); + + // Step 2. + var selcell:NSCell = selectedCell(); + + if (selcell != null) + { + if (!selcell.isEnabled()) + return false; + + if (selcell.action() != undefined) + return sendActionTo(selcell.action(), selcell.target()); //! is this right? + } + + // Step 3. + //! How do I do this? + + return false; + } + + + /** + * @see org.actionstep.NSControl#setAction + */ + public function setAction(aSelector:String):Void + { + m_action = aSelector; + } + + + /** + * Makes aSelector the action sent to the target of the receiver when the + * user double-clicks a cell. A double-click action is always sent after + * the appropriate single-click action, which is the cellâs single-click + * action, if it has one, or the receiver single-click action, otherwise. + * If aSelector is a non-NULL selector, this method also sets the + * ignoresMultiClick flag to TRUE; otherwise, it leaves the flag unchanged. + * + * If an NSMatrix has no double-click action set, then by default a double + * click is treated as a single click. + * + * For the method to have any effect, the receiverâs action and target must + * be set to the class in which the selector is declared. + */ + public function setDoubleAction(aSelector:String):Void + { + m_doubleaction = aSelector; + } + + + /** + * @see org.actionstep.NSControl#setTarget + */ + public function setTarget(target:Object):Void + { + m_target = target; + } //****************************************************** *************** *** 1225,1230 **** var frame:NSRect = cellFrameAtRowColumn(row, column); ! ! TRACE("(" + row + ", " + column + ") with frame: " + frame); // --- 1355,1360 ---- var frame:NSRect = cellFrameAtRowColumn(row, column); ! ! TRACE("drawing " + frame); // *************** *** 1233,1241 **** if (m_drawscellbg) { ! ASDrawer.current.drawFillWithRectColorInView(frame, m_cellbgcolor, this); } else { ! ASDrawer.current.drawFillWithRectColorInView(frame, m_bgcolor, this); } --- 1363,1371 ---- if (m_drawscellbg) { ! ASTheme.current().drawFillWithRectColorInView(frame, m_cellbgcolor, this); } else { ! ASTheme.current().drawFillWithRectColorInView(frame, m_bgcolor, this); } *************** *** 1543,1548 **** public function mouseDown(theEvent:NSEvent):Boolean { ! TRACE("hit mousedown"); ! m_mousedownflags = theEvent.modifierFlags; return false; } --- 1673,1717 ---- public function mouseDown(theEvent:NSEvent):Boolean { ! TRACE(theEvent); // debug info ! ! m_mousedownflags = theEvent.modifierFlags; // record flags ! ! // ! // Get the location of the cell, then the cell itself (if available). ! // ! var pt:NSPoint = convertPointFromView(theEvent.mouseLocation, null); ! ! TRACE(pt); ! ! var loc:Object = getRowColumnForPoint(pt); ! ! TRACE("row: " + loc.row + ", column: " + loc.column); ! ! /* ! if (theEvent.clickCount == 2 && loc == null) ! { ! return sendDoubleAction(); ! } ! ! var cell:NSCell = cellAtRowColumn(loc.row, loc.column); ! ! switch (cell.type()) ! { ! case NSCellType.NSTextCellType: ! cell.s ! break; ! ! case NSCellType.NSImageCellType: ! ! break; ! ! case NSCellType.NSNullCellType: ! ! default: ! ! break; ! ! } ! */ return false; } *************** *** 1553,1556 **** --- 1722,1728 ---- //****************************************************** + /** + * Draws the thing. + */ public function drawRect(rect:NSRect):Void { *************** *** 1560,1564 **** if (m_drawsbg) { ! ASDrawer.current.drawFillWithRectColorInView(rect, m_bgcolor, this); } --- 1732,1736 ---- if (m_drawsbg) { ! ASTheme.current().drawFillWithRectColorInView(rect, m_bgcolor, this); } *************** *** 1845,1849 **** m_sel.removeObject(toDelete[i]); } ! //****************************************************** //* Public Static Properties * --- 2017,2034 ---- m_sel.removeObject(toDelete[i]); } ! ! ! /** ! * Recalculates the cell size. ! */ ! private function recalcCellSize():Void ! { ! m_cellsize = new NSSize( ! (m_frame.size.width - (m_cellspacing.width * (m_numcols + 1))) / m_numcols, ! (m_frame.size.height - (m_cellspacing.height * (m_numrows + 1))) / m_numrows); ! ! TRACE(m_cellsize); ! } ! //****************************************************** //* Public Static Properties * |
From: Scott H. <sco...@us...> - 2005-05-17 01:42:17
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15337/src/org/actionstep Added Files: ASTheme.as ASThemeProtocol.as Log Message: Theming classes --- NEW FILE: ASThemeProtocol.as --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ASTheme.as --- (This appears to be a binary file; contents omitted.) |
From: Scott H. <sco...@us...> - 2005-05-17 01:39:45
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3702/src/org/actionstep Modified Files: ASDrawer.as Log Message: Updated class comments Also change current property into a current() method and a setCurrent() method (because we don't use getters / setters) Index: ASDrawer.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASDrawer.as,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ASDrawer.as 16 May 2005 22:03:32 -0000 1.2 --- ASDrawer.as 16 May 2005 22:16:08 -0000 1.3 *************** *** 37,42 **** /** ! * This is an abstract class that defines drawing methods for ActionStep ! * controls. * * The current drawer can be accessed through the current class property. --- 37,41 ---- /** ! * This is the default ActionStep drawer. * * The current drawer can be accessed through the current class property. *************** *** 51,56 **** /** * Constructs a new instance of ASDrawer. - * - * Called by subclasses. */ private function ASDrawer() --- 50,53 ---- *************** *** 66,70 **** /** ! * Draws a filled rectangle with the color aColor in the view inView. */ public function drawFillWithRectColorInView(aRect:NSRect, aColor:NSColor, --- 63,67 ---- /** ! * @see org.actionstep.ASDrawerProtocol#drawFillWithRectColorInView */ public function drawFillWithRectColorInView(aRect:NSRect, aColor:NSColor, *************** *** 100,104 **** * Gets / sets the current ASDrawer. */ ! public static function get current():ASDrawer { if (g_current == undefined) --- 97,101 ---- * Gets / sets the current ASDrawer. */ ! public static function current():ASDrawer { if (g_current == undefined) *************** *** 109,113 **** return g_current; } ! public static function set current(value:ASDrawer) { g_current = value; --- 106,110 ---- return g_current; } ! public static function setCurrent(value:ASDrawer) { g_current = value; |
From: Richard K. <ric...@us...> - 2005-05-17 01:39:13
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4107 Modified Files: ASAnimatedTabView.as Log Message: change to window() method Index: ASAnimatedTabView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASAnimatedTabView.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ASAnimatedTabView.as 16 May 2005 04:42:55 -0000 1.1 --- ASAnimatedTabView.as 16 May 2005 14:41:02 -0000 1.2 *************** *** 35,40 **** import org.actionstep.NSTabViewItem; import org.actionstep.constants.NSTabState; ! class org.actionstep.ASAnimatedTabView extends NSTabView { public function selectTabViewItem(item:NSTabViewItem) { if (m_delegate != null) { --- 35,49 ---- import org.actionstep.NSTabViewItem; import org.actionstep.constants.NSTabState; ! ! /* ! * This class overrides the selectTabViewItem method of NSTabView and ! * animates the switching of tab views by sliding the existing tab view ! * item out (to the left) and then sliding the new tab view item in (from ! * the left). This class also demonstrates how to use the NSTimer class ! * to achieve animation. ! * ! */ class org.actionstep.ASAnimatedTabView extends NSTabView { + public function selectTabViewItem(item:NSTabViewItem) { if (m_delegate != null) { *************** *** 90,99 **** if (selectedView != null) { addSubview(selectedView); ! m_window.makeFirstResponder(m_selected.initialFirstResponder()); var rect:NSRect = contentRect(); rect.origin.x -= rect.size.width; selectedView.setFrame(rect); setNeedsDisplay(true); ! selectedView.window().displayIfNeeded(); NSTimer.scheduledTimerWithTimeIntervalTargetSelectorUserInfoRepeats( .1, this, "_animateNewItem", { --- 99,108 ---- if (selectedView != null) { addSubview(selectedView); ! window().makeFirstResponder(m_selected.initialFirstResponder()); var rect:NSRect = contentRect(); rect.origin.x -= rect.size.width; selectedView.setFrame(rect); setNeedsDisplay(true); ! window().displayIfNeeded(); NSTimer.scheduledTimerWithTimeIntervalTargetSelectorUserInfoRepeats( .1, this, "_animateNewItem", { *************** *** 130,133 **** --- 139,143 ---- private function _finish() { setNeedsDisplay(true); + window().displayIfNeeded(); if(typeof(m_delegate["tabViewDidSelectTabViewItem"]) == "function") { m_delegate["tabViewDidSelectTabViewItem"].call(m_delegate, this, m_selected); |
From: Scott H. <sco...@us...> - 2005-05-17 01:30:16
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13396/src/org/actionstep Modified Files: NSObject.as Log Message: Constructor now called before copying properties Index: NSObject.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSObject.as,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NSObject.as 16 May 2005 23:05:59 -0000 1.4 --- NSObject.as 17 May 2005 01:29:59 -0000 1.5 *************** *** 69,79 **** // - // Copy all the properties - // - for (var p:String in this) { - res[p] = this[p]; - } - - // // Fire the constructor // --- 69,72 ---- *************** *** 83,88 **** // should be fairly easy to do if necessary. // ! constructor.apply(res, []); return NSObject(res); } --- 76,88 ---- // should be fairly easy to do if necessary. // ! constructor.apply(res); + // + // Copy all the properties + // + for (var p:String in this) { + res[p] = this[p]; + } + return NSObject(res); } |
From: Scott H. <sco...@us...> - 2005-05-17 01:24:15
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12287/src/org/actionstep Modified Files: NSView.as Log Message: Added all coordinate conversion methods Updated some comments too Index: NSView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSView.as,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** NSView.as 16 May 2005 04:42:23 -0000 1.5 --- NSView.as 17 May 2005 01:24:05 -0000 1.6 *************** *** 565,569 **** } ! // Modifying the coordinate system public function translateOriginToPoint(point:NSPoint) { --- 565,571 ---- } ! //****************************************************** ! //* Modifying the coordinate system ! //****************************************************** public function translateOriginToPoint(point:NSPoint) { *************** *** 574,585 **** setBoundsRotation(boundsRotation() + angle); } ! // Modifying the coordinate system ! // Examining coordiante system modifications - // Converting coordinates ! // Controlling notifications public function setPostsFrameChangeNotifications(value:Boolean) { --- 576,680 ---- setBoundsRotation(boundsRotation() + angle); } + + //****************************************************** + //* Examining coordiante system modifications + //****************************************************** ! //****************************************************** ! //* Converting Coordinates ! //****************************************************** ! /** ! * Converts aPoint from the coordinate system of aView to this view's ! * coordinate system. ! * ! * If aView is null, aPoint is converted from global coordinates (_root). ! */ ! public function convertPointFromView(aPoint:NSPoint, aView:NSView):NSPoint { ! var from:MovieClip = (aView == null) ? _root : aView.mcBounds(); ! ! var pt:NSPoint = aPoint.clone(); ! from.localToGlobal(pt); ! mcBounds().globalToLocal(pt); ! ! return pt; ! } ! /** ! * Converts aPoint from this view's coordinate system to the coordinate ! * system of aView. ! * ! * If aView is null, aPoint is converted to global coordinates (_root). ! */ ! public function convertPointToView(aPoint:NSPoint, aView:NSView):NSPoint { ! var to:MovieClip = (aView == null) ? _root : aView.mcBounds(); ! ! var pt:NSPoint = aPoint.clone(); ! mcBounds().localToGlobal(pt); ! to.globalToLocal(pt); ! ! return pt; ! } ! ! ! /** ! * Converts aSize from the coordinate system of aView to this view's ! * coordinate system. ! * ! * If aView is null, aSize is converted from global coordinates (_root). ! */ ! public function convertSizeFromView(aSize:NSSize, aView:NSView):NSSize { ! var wdt:NSPoint = convertPointFromView(new NSPoint(aSize.width, 0), aView); ! var hgt:NSPoint = convertPointFromView(new NSPoint(0, aSize.height), aView); ! ! return new NSSize(wdt.x, hgt.y); ! } ! ! ! /** ! * Converts aSize from this view's coordinate system to the coordinate ! * system of aView. ! * ! * If aView is null, aSize is converted to global coordinates (_root). ! */ ! public function convertSizeToView(aSize:NSSize, aView:NSView):NSSize { ! var wdt:NSPoint = convertPointToView(new NSPoint(aSize.width, 0), aView); ! var hgt:NSPoint = convertPointToView(new NSPoint(0, aSize.height), aView); ! ! return new NSSize(wdt.x, hgt.y); ! } ! ! ! /** ! * Converts aRect from the coordinate system of aView to this view's ! * coordinate system. ! * ! * If aView is null, aRect is converted from global coordinates (_root). ! */ ! public function convertRectFromView(aRect:NSRect, aView:NSView):NSRect { ! var pt:NSPoint = convertPointFromView(aRect.origin, aView); ! var sz:NSSize = convertSizeFromView(aRect.size, aView); ! ! return NSRect.withOriginSize(pt, sz); ! } ! ! ! /** ! * Converts aRect from this view's coordinate system to the coordinate ! * system of aView. ! * ! * If aView is null, aRect is converted to global coordinates (_root). ! */ ! public function convertRectToView(aRect:NSRect, aView:NSView):NSRect { ! var pt:NSPoint = convertPointToView(aRect.origin, aView); ! var sz:NSSize = convertSizeToView(aRect.size, aView); ! ! return NSRect.withOriginSize(pt, sz); ! } ! ! //****************************************************** ! //* Controlling Notifications ! //****************************************************** public function setPostsFrameChangeNotifications(value:Boolean) { |
From: Scott H. <sco...@us...> - 2005-05-17 01:06:23
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6279/src/org/actionstep Modified Files: NSMatrix.as Log Message: new ver (I need better diffs) Index: NSMatrix.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSMatrix.as,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NSMatrix.as 10 May 2005 14:44:54 -0000 1.3 --- NSMatrix.as 16 May 2005 22:24:42 -0000 1.4 *************** *** 1543,1547 **** public function mouseDown(theEvent:NSEvent):Boolean { ! TRACE("hit"); m_mousedownflags = theEvent.modifierFlags; return false; --- 1543,1547 ---- public function mouseDown(theEvent:NSEvent):Boolean { ! TRACE("hit mousedown"); m_mousedownflags = theEvent.modifierFlags; return false; |
From: Richard K. <ric...@us...> - 2005-05-17 00:47:09
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15276/test Modified Files: ASTestTimer.as Log Message: use userInfo for state Index: ASTestTimer.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/test/ASTestTimer.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ASTestTimer.as 16 May 2005 03:08:55 -0000 1.1 --- ASTestTimer.as 16 May 2005 05:04:25 -0000 1.2 *************** *** 33,38 **** class org.actionstep.test.ASTestTimer { - private var m_count:Number; - public static function test() { var tmp = new ASTestTimer(); --- 33,36 ---- *************** *** 40,48 **** public function ASTestTimer() { - m_count = 0; var startDate:Date = new Date(); startDate.setTime(startDate.getTime()+6000); NSTimer.scheduledTimerWithTimeIntervalTargetSelectorUserInfoRepeats(5, this, "once", {foo:"bar"}, false); ! (new NSTimer()).initWithFireDateIntervalTargetSelectorUserInfoRepeats(startDate, 1, this, "repeater", {bar:"foo"}, true); } --- 38,45 ---- public function ASTestTimer() { var startDate:Date = new Date(); startDate.setTime(startDate.getTime()+6000); NSTimer.scheduledTimerWithTimeIntervalTargetSelectorUserInfoRepeats(5, this, "once", {foo:"bar"}, false); ! (new NSTimer()).initWithFireDateIntervalTargetSelectorUserInfoRepeats(startDate, 1, this, "repeater", {count:0}, true); } *************** *** 52,58 **** public function repeater(timer:NSTimer) { ! TRACE(timer.userInfo().bar); ! m_count++; ! if (m_count == 4) { timer.invalidate(); } --- 49,55 ---- public function repeater(timer:NSTimer) { ! TRACE(timer.userInfo().count); ! timer.userInfo().count++; ! if (timer.userInfo().count == 4) { timer.invalidate(); } |
From: Richard K. <ric...@us...> - 2005-05-16 23:24:26
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28790/test Modified Files: ASTestAnimatedTabView.as Log Message: update window after complete Index: ASTestAnimatedTabView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/test/ASTestAnimatedTabView.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ASTestAnimatedTabView.as 16 May 2005 04:42:55 -0000 1.1 --- ASTestAnimatedTabView.as 16 May 2005 11:39:46 -0000 1.2 *************** *** 38,44 **** var window1 = (new NSWindow()).initWithContentRect(new NSRect(0,0,500,500)); var tabView = (new ASAnimatedTabView()).initWithFrame(new NSRect(10,10,400,400)); - tabView.setTabViewType(org.actionstep.constants.NSTabViewType.NSNoTabsNoBorder); - // tabView.setTabViewType(org.actionstep.constants.NSTabViewType.NSNoTabsLineBorder); var tabItem1:NSTabViewItem = (new NSTabViewItem()).initWithIdentifier(1); --- 38,42 ---- |
From: Scott H. <sco...@us...> - 2005-05-16 23:07:12
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16348/src/org/actionstep Modified Files: NSObject.as Log Message: memberwiseClone is now perfect some comments added Index: NSObject.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSObject.as,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NSObject.as 10 May 2005 04:03:07 -0000 1.3 --- NSObject.as 16 May 2005 23:05:59 -0000 1.4 *************** *** 49,60 **** } public function memberwiseClone():NSObject { var res:Object = new Object(); - res.__proto__ = getClass().prototype; for (var p:String in this) { res[p] = this[p]; } return NSObject(res); } --- 49,88 ---- } + /** + * Creates a shallow copy of the object. + * + * A shallow copy of an Object is a copy of the Object only. If the Object + * contains references to other objects, the shallow copy will not create + * copies of the referred objects. It will refer to the original objects + * instead. + */ public function memberwiseClone():NSObject { var res:Object = new Object(); + // + // Object prototype chain and constructor stuff (important so that further + // calls to clone will succeed, as well as getClass() use). + // + var constructor:Function = getClass(); + res.__proto__ = constructor.prototype; + res.__constructor__ = constructor; + + // + // Copy all the properties + // for (var p:String in this) { res[p] = this[p]; } + // + // Fire the constructor + // + // NOTE: + // We are not currently storing the arguments as originally passed + // to the constructor, and this might pose a problem. In any case, it + // should be fairly easy to do if necessary. + // + constructor.apply(res, []); + return NSObject(res); } |
From: Scott H. <sco...@us...> - 2005-05-16 22:59:20
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13868/src/org/actionstep Modified Files: NSPoint.as Log Message: Added add() and subtract() static methods Filled in comments Index: NSPoint.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSPoint.as,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** NSPoint.as 4 May 2005 02:33:05 -0000 1.1.1.1 --- NSPoint.as 16 May 2005 22:57:08 -0000 1.2 *************** *** 31,53 **** import org.actionstep.NSObject; class org.actionstep.NSPoint extends NSObject { public static var ZeroPoint = new NSPoint(0,0); public var x:Number; public var y:Number; public function NSPoint(x:Number, y:Number) { this.x = x; this.y = y; } ! public function clone():NSPoint { return new NSPoint(x, y); } public function description():String { return "NSPoint(x="+x+", y="+y+")"; } } \ No newline at end of file --- 31,85 ---- import org.actionstep.NSObject; + /** + * Represents a point in 2D space. Contains an x-coordinate and a y-coordinate. + */ class org.actionstep.NSPoint extends NSObject { + /** A point with location (0, 0). */ public static var ZeroPoint = new NSPoint(0,0); + /** The x-coordinate. */ public var x:Number; + + /** The y-coordinate. */ public var y:Number; + /** + * Creates a new instance of NSPoint with the specified x and y + * coordinates. + */ public function NSPoint(x:Number, y:Number) { this.x = x; this.y = y; } ! ! /** ! * Creates a new point with the same properties as this one. ! */ public function clone():NSPoint { return new NSPoint(x, y); } + /** + * @see org.actionstep.NSObject#description + */ public function description():String { return "NSPoint(x="+x+", y="+y+")"; } + /** + * Adds point1 to point2 and returns the result. + */ + public static function add(point1:NSPoint, point2:NSPoint):NSPoint + { + return new NSPoint(point2.x + point1.x, point2.y + point1.y); + } + + /** + * Subtracts point2 from point1 and returns the result. + */ + public static function subtract(point1:NSPoint, point2:NSPoint):NSPoint + { + return new NSPoint(point2.x - point1.x, point2.y - point1.y); + } } \ No newline at end of file |