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-23 11:10:27
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15375 Modified Files: NSControl.as NSRect.as NSScroller.as Log Message: got scroll buttons working and the scroll knobs rendering Index: NSRect.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSRect.as,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** NSRect.as 21 May 2005 04:23:43 -0000 1.5 --- NSRect.as 23 May 2005 11:10:12 -0000 1.6 *************** *** 57,60 **** --- 57,67 ---- } + public function equalTo(other:NSRect):Boolean { + return origin.x == other.origin.x && + origin.y == other.origin.y && + size.width == other.size.width && + size.height == other.size.height; + } + public function midX():Number { return origin.x + size.width/2; Index: NSControl.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSControl.as,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** NSControl.as 18 May 2005 22:06:55 -0000 1.9 --- NSControl.as 23 May 2005 11:10:12 -0000 1.10 *************** *** 424,427 **** --- 424,431 ---- private var m_trackingData; + private function cellTrackingRect():NSRect { + return m_bounds; + } + public function mouseDown(event:NSEvent) { if (!isEnabled()) { *************** *** 441,445 **** mouseUp: false, complete: false, ! bounds: m_bounds }; mouseTrackingCallback(event); --- 445,449 ---- mouseUp: false, complete: false, ! bounds: cellTrackingRect() }; mouseTrackingCallback(event); Index: NSScroller.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSScroller.as,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NSScroller.as 22 May 2005 03:35:37 -0000 1.3 --- NSScroller.as 23 May 2005 11:10:12 -0000 1.4 *************** *** 68,73 **** private var m_action:String; private var m_enabled:Boolean; ! private var m_horizontal:Boolean; public function NSScroller() { --- 68,75 ---- private var m_action:String; private var m_enabled:Boolean; ! private var m_cellTrackingRect:NSRect; private var m_horizontal:Boolean; + private var m_scrollerKnobClip:MovieClip; + private var m_scrollerKnobClipRect:NSRect; public function NSScroller() { *************** *** 102,105 **** --- 104,108 ---- m_floatValue = 1.0; } + m_knobProportion = .5; m_hitPart = NSScrollerPart.NSScrollerNoPart; drawParts(); *************** *** 267,270 **** --- 270,275 ---- height = knobHeight; width = BUTTON_WIDTH; + x += 1; + y += 1; break; case NSScrollerPart.NSScrollerKnobSlot: *************** *** 391,395 **** g_upCell.setContinuous(true); g_upCell.sendActionOn(NSEvent.NSLeftMouseDownMask | NSEvent.NSPeriodicMask); ! g_upCell.setPeriodicDelayInterval(.3, .03); g_upCell.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); g_upCell.setBezeled(true); --- 396,400 ---- g_upCell.setContinuous(true); g_upCell.sendActionOn(NSEvent.NSLeftMouseDownMask | NSEvent.NSPeriodicMask); ! g_upCell.setPeriodicDelayInterval(1, .03); g_upCell.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); g_upCell.setBezeled(true); *************** *** 402,406 **** g_downCell.setContinuous(true); g_downCell.sendActionOn(NSEvent.NSLeftMouseDownMask | NSEvent.NSPeriodicMask); ! g_downCell.setPeriodicDelayInterval(.3, .03); g_downCell.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); g_downCell.setBezeled(true); --- 407,411 ---- g_downCell.setContinuous(true); g_downCell.sendActionOn(NSEvent.NSLeftMouseDownMask | NSEvent.NSPeriodicMask); ! g_downCell.setPeriodicDelayInterval(1, .03); g_downCell.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); g_downCell.setBezeled(true); *************** *** 413,417 **** g_leftCell.setContinuous(true); g_leftCell.sendActionOn(NSEvent.NSLeftMouseDownMask | NSEvent.NSPeriodicMask); ! g_leftCell.setPeriodicDelayInterval(.3, .03); g_leftCell.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); g_leftCell.setBezeled(true); --- 418,422 ---- g_leftCell.setContinuous(true); g_leftCell.sendActionOn(NSEvent.NSLeftMouseDownMask | NSEvent.NSPeriodicMask); ! g_leftCell.setPeriodicDelayInterval(1, .03); g_leftCell.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); g_leftCell.setBezeled(true); *************** *** 424,428 **** g_rightCell.setContinuous(true); g_rightCell.sendActionOn(NSEvent.NSLeftMouseDownMask | NSEvent.NSPeriodicMask); ! g_rightCell.setPeriodicDelayInterval(.3, .03); g_rightCell.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); g_rightCell.setBezeled(true); --- 429,433 ---- g_rightCell.setContinuous(true); g_rightCell.sendActionOn(NSEvent.NSLeftMouseDownMask | NSEvent.NSPeriodicMask); ! g_rightCell.setPeriodicDelayInterval(1, .03); g_rightCell.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); g_rightCell.setBezeled(true); *************** *** 459,489 **** } - private function floatValueAtPoint(point:NSPoint):Number { - var knobRect:NSRect = rectForPart(NSScrollerPart.NSScrollerKnob); - var slotRect:NSRect = rectForPart(NSScrollerPart.NSScrollerKnobSlot); - var position:Number; - var min_pos:Number; - var max_pos:Number; - - if (m_horizontal) { - min_pos = slotRect.minX() + knobRect.size.width/2 - min_pos = slotRect.maxX() + knobRect.size.width/2 - position = point.x; - } else { - min_pos = slotRect.minY() + knobRect.size.height/2 - min_pos = slotRect.maxY() + knobRect.size.height/2 - position = point.y; - } - if (position <= min_pos) { - return 0; - } - if (position >= max_pos) { - return 1; - } - return (position - min_pos) / (max_pos - min_pos); - } - public function mouseDown(event:NSEvent) { ! var location:NSPoint = event.locationInWindow; m_hitPart = testPart(location); setButtonCellTargets(); --- 464,469 ---- } public function mouseDown(event:NSEvent) { ! var location:NSPoint = event.mouseLocation; m_hitPart = testPart(location); setButtonCellTargets(); *************** *** 491,498 **** case NSScrollerPart.NSScrollerIncrementPage: case NSScrollerPart.NSScrollerIncrementLine: case NSScrollerPart.NSScrollerDecrementPage: case NSScrollerPart.NSScrollerDecrementLine: ! trackScrollButtons(event); ! break; case NSScrollerPart.NSScrollerKnob: trackKnob(event); --- 471,484 ---- case NSScrollerPart.NSScrollerIncrementPage: case NSScrollerPart.NSScrollerIncrementLine: + m_cell = m_horizontal ? g_rightCell : g_downCell; + m_cellTrackingRect = rectForPart(NSScrollerPart.NSScrollerIncrementLine); + super.mouseDown(event); + return; case NSScrollerPart.NSScrollerDecrementPage: case NSScrollerPart.NSScrollerDecrementLine: ! m_cell = m_horizontal ? g_leftCell : g_upCell; ! m_cellTrackingRect = rectForPart(NSScrollerPart.NSScrollerDecrementLine); ! super.mouseDown(event); ! return; case NSScrollerPart.NSScrollerKnob: trackKnob(event); *************** *** 516,535 **** } } ! private function trackKnob(event:NSEvent) { } - private function trackScrollButtons(event) { - } - public function drawRect(rect:NSRect) { ASDraw.outlineRectWithRect(m_mcBounds, rect, [0x696E79,0xF6F8F9]); var rectIncrementLine:NSRect = rectForPart(NSScrollerPart.NSScrollerIncrementLine); var rectDecrementLine:NSRect = rectForPart(NSScrollerPart.NSScrollerDecrementLine); ! var rectKnobSlot:NSRect = rectForPart(NSScrollerPart.NSScrollerKnobSlot); ! var cell:NSButtonCell = (m_horizontal ? g_leftCell : g_upCell); ! cell.drawWithFrameInView(rectDecrementLine, this); ! cell = (m_horizontal ? g_rightCell : g_downCell); ! cell.drawWithFrameInView(rectIncrementLine, this); } --- 502,529 ---- } } ! private function trackKnob(event:NSEvent) { } public function drawRect(rect:NSRect) { + if (m_scrollerKnobClip == null) { + m_scrollerKnobClip = createSubviewMovieClip(); + } + var rectKnob:NSRect = rectForPart(NSScrollerPart.NSScrollerKnob); + if (m_scrollerKnobClipRect == null || !m_scrollerKnobClipRect.equalTo(rectKnob)) { + m_scrollerKnobClipRect = rectKnob; + m_scrollerKnobClip._x = rectKnob.origin.x; + m_scrollerKnobClip._y = rectKnob.origin.y; + ASDraw.outlineRectWithRect(m_scrollerKnobClip, + new NSRect(0,0,rectKnob.size.width, rectKnob.size.height), + [0xF6F8F9, 0x696E79]); + m_scrollerKnobClipRect = rectKnob; + } + ASDraw.outlineRectWithRect(m_mcBounds, rect, [0x696E79,0xF6F8F9]); var rectIncrementLine:NSRect = rectForPart(NSScrollerPart.NSScrollerIncrementLine); var rectDecrementLine:NSRect = rectForPart(NSScrollerPart.NSScrollerDecrementLine); ! (m_horizontal ? g_leftCell : g_upCell).drawWithFrameInView(rectDecrementLine, this); ! (m_horizontal ? g_rightCell : g_downCell).drawWithFrameInView(rectIncrementLine, this); } *************** *** 545,548 **** --- 539,546 ---- // PRIVATE FUNCTIONS + + private function cellTrackingRect():NSRect { + return m_cellTrackingRect; + } private function setButtonCellTargets() { *************** *** 556,559 **** --- 554,582 ---- g_rightCell.setAction(m_action); } + + private function floatValueAtPoint(point:NSPoint):Number { + var knobRect:NSRect = rectForPart(NSScrollerPart.NSScrollerKnob); + var slotRect:NSRect = rectForPart(NSScrollerPart.NSScrollerKnobSlot); + var position:Number; + var min_pos:Number; + var max_pos:Number; + + if (m_horizontal) { + min_pos = slotRect.minX() + knobRect.size.width/2 + min_pos = slotRect.maxX() + knobRect.size.width/2 + position = point.x; + } else { + min_pos = slotRect.minY() + knobRect.size.height/2 + min_pos = slotRect.maxY() + knobRect.size.height/2 + position = point.y; + } + if (position <= min_pos) { + return 0; + } + if (position >= max_pos) { + return 1; + } + return (position - min_pos) / (max_pos - min_pos); + } } \ No newline at end of file |
From: Richard K. <ric...@us...> - 2005-05-23 11:10:24
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/constants In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15375/constants Modified Files: NSScrollerPart.as Log Message: got scroll buttons working and the scroll knobs rendering Index: NSScrollerPart.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/constants/NSScrollerPart.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NSScrollerPart.as 12 May 2005 19:43:19 -0000 1.1 --- NSScrollerPart.as 23 May 2005 11:10:13 -0000 1.2 *************** *** 44,47 **** --- 44,51 ---- value = num; } + + public function toString():String { + return "NSScrollerPart("+value+")"; + } } |
From: Richard K. <ric...@us...> - 2005-05-23 11:10:23
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15375/test Modified Files: ASTestScrollers.as Log Message: got scroll buttons working and the scroll knobs rendering Index: ASTestScrollers.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/test/ASTestScrollers.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ASTestScrollers.as 22 May 2005 03:35:37 -0000 1.1 --- ASTestScrollers.as 23 May 2005 11:10:13 -0000 1.2 *************** *** 34,37 **** --- 34,46 ---- class org.actionstep.test.ASTestScrollers { public static function test() { + + var testObject = new Object(); + testObject.vscroller = function(scroller) { + TRACE("VScroller"); + } + testObject.hscroller = function(scroller) { + TRACE("HScroller"); + } + var app = NSApplication.sharedApplication(); var window1 = (new NSWindow()).initWithContentRect(new NSRect(0,0,250,250)); *************** *** 42,47 **** --- 51,61 ---- var vscroller:NSScroller = new NSScroller(); vscroller.initWithFrame(new NSRect(180, 0, 20, 180)); + vscroller.setTarget(testObject); + vscroller.setAction("vscroller"); + var hscroller:NSScroller = new NSScroller(); hscroller.initWithFrame(new NSRect(0, 180, 180, 20)); + hscroller.setTarget(testObject); + hscroller.setAction("hscroller"); view.addSubview(vscroller); |
From: Richard K. <ric...@us...> - 2005-05-22 03:58:10
|
Update of /cvsroot/actionstep/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19919 Modified Files: build Log Message: change to use .trace method Index: build =================================================================== RCS file: /cvsroot/actionstep/actionstep/build,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** build 22 May 2005 03:51:48 -0000 1.2 --- build 22 May 2005 03:58:01 -0000 1.3 *************** *** 1,3 **** #!/usr/bin/ruby ! `/usr/local/bin/mtasc -cp "src" -swf ActionStep.swf -header 800:600:20 -separate -trace org.actionstep.ASDebugger.SWFConsoleTrace -pack org/actionstep -pack org/actionstep/constants -pack org/actionstep/images -main org/actionstep/test/ASTestMain` puts 'Build complete.' \ No newline at end of file --- 1,3 ---- #!/usr/bin/ruby ! `/usr/local/bin/mtasc -cp "src" -swf ActionStep.swf -header 800:600:20 -separate -trace org.actionstep.ASDebugger.trace -pack org/actionstep -pack org/actionstep/constants -pack org/actionstep/images -main org/actionstep/test/ASTestMain` puts 'Build complete.' \ No newline at end of file |
From: Richard K. <ric...@us...> - 2005-05-22 03:54:13
|
Update of /cvsroot/actionstep/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19657 Modified Files: build_production build_trace Log Message: move main to test/ASTestMain Index: build_trace =================================================================== RCS file: /cvsroot/actionstep/actionstep/build_trace,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** build_trace 4 May 2005 02:33:01 -0000 1.1.1.1 --- build_trace 22 May 2005 03:54:05 -0000 1.2 *************** *** 1,3 **** #!/usr/bin/env ruby ! `/usr/local/bin/mtasc -cp "src" -swf ActionStep.swf -header 800:600:20 -separate -trace org.actionstep.ASDebugger.trace -pack org/actionstep -main org/actionstep/ActionStep` puts 'Build complete.' --- 1,3 ---- #!/usr/bin/env ruby ! `/usr/local/bin/mtasc -cp "src" -swf ActionStep.swf -header 800:600:20 -separate -trace org.actionstep.ASDebugger.trace -pack org/actionstep -main org/actionstep/test/ASTestMain` puts 'Build complete.' Index: build_production =================================================================== RCS file: /cvsroot/actionstep/actionstep/build_production,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** build_production 4 May 2005 02:33:01 -0000 1.1.1.1 --- build_production 22 May 2005 03:54:05 -0000 1.2 *************** *** 1,3 **** #!/usr/bin/env ruby ! `/usr/local/bin/mtasc -cp "src" -swf ActionStep.swf -header 800:600:20 -separate -pack org/actionstep -main org/actionstep/ActionStep` puts 'Build complete.' --- 1,3 ---- #!/usr/bin/env ruby ! `/usr/local/bin/mtasc -cp "src" -swf ActionStep.swf -header 800:600:20 -separate -pack org/actionstep -main org/actionstep/test/ASTestMain` puts 'Build complete.' |
From: Richard K. <ric...@us...> - 2005-05-22 03:51:58
|
Update of /cvsroot/actionstep/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19251 Modified Files: build Log Message: change main method Index: build =================================================================== RCS file: /cvsroot/actionstep/actionstep/build,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** build 4 May 2005 02:33:01 -0000 1.1.1.1 --- build 22 May 2005 03:51:48 -0000 1.2 *************** *** 1,3 **** #!/usr/bin/ruby ! `/usr/local/bin/mtasc -cp "src" -swf ActionStep.swf -header 800:600:20 -separate -trace org.actionstep.ASDebugger.trace -pack org/actionstep -main org/actionstep/ActionStep` puts 'Build complete.' \ No newline at end of file --- 1,3 ---- #!/usr/bin/ruby ! `/usr/local/bin/mtasc -cp "src" -swf ActionStep.swf -header 800:600:20 -separate -trace org.actionstep.ASDebugger.SWFConsoleTrace -pack org/actionstep -pack org/actionstep/constants -pack org/actionstep/images -main org/actionstep/test/ASTestMain` puts 'Build complete.' \ No newline at end of file |
From: Richard K. <ric...@us...> - 2005-05-22 03:49:15
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18977/test Modified Files: ASTestTabView.as Added Files: ASTestControls.as ASTestMain.as ASTestRenderImage.as Log Message: removed ActionStep.as and added test/ASTestMain in its place Index: ASTestTabView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/test/ASTestTabView.as,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ASTestTabView.as 15 May 2005 18:39:05 -0000 1.3 --- ASTestTabView.as 22 May 2005 03:49:06 -0000 1.4 *************** *** 39,43 **** // tabView.setTabViewType(org.actionstep.constants.NSTabViewType.NSNoTabsNoBorder); ! // tabView.setTabViewType(org.actionstep.constants.NSTabViewType.NSNoTabsLineBorder); var tabItem1:NSTabViewItem = (new NSTabViewItem()).initWithIdentifier(1); --- 39,43 ---- // tabView.setTabViewType(org.actionstep.constants.NSTabViewType.NSNoTabsNoBorder); ! //tabView.setTabViewType(org.actionstep.constants.NSTabViewType.NSNoTabsLineBorder); var tabItem1:NSTabViewItem = (new NSTabViewItem()).initWithIdentifier(1); --- NEW FILE: ASTestControls.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.*; import org.actionstep.constants.*; class org.actionstep.test.ASTestControls { public static function test() { var triggerButton; var actionButton; var window1; var window2; var view1; var view2; var textField; var textField2; var box:NSBox; var target = new Object(); target.trigger = function(button) { TRACE("Bam"); } target.move = function(button) { if (view1.window() == window1) { window2.setContentView(view1); //window1.setContentView(view2); } else { window1.setContentView(view1); //window2.setContentView(view2); } } target.bam = function(editfield) { TRACE(editfield.stringValue()); } var app = NSApplication.sharedApplication(); window1 = (new NSWindow()).initWithContentRect(new NSRect(0,0,250,500)); window2 = (new NSWindow()).initWithContentRect(new NSRect(251,0,250,500)); view1 = (new ASTestView()).initWithFrame(new NSRect(0,0,250,500)); view2 = (new ASTestView()).initWithFrame(new NSRect(0,0,250,500)); //box = (new NSBox()).initWithFrame(new NSRect(10,10,160,100)); //box.setTitlePosition(NSTitlePosition.NSAboveTop); //box.setTitle("button"); triggerButton = (new NSButton()).initWithFrame(new NSRect(10,80,70,30)); triggerButton.setTitle("Draw"); triggerButton.setContinuous(true); triggerButton.setPeriodicDelayInterval(.3, .5); triggerButton.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); actionButton = (new NSButton()).initWithFrame(new NSRect(10,120,70,30)); actionButton.setTitle("Switch"); textField = (new NSTextField()).initWithFrame(new NSRect(10,160,120,30)); textField2 = (new NSTextField()).initWithFrame(new NSRect(10,200,120,30)); view1.addSubview(box); //box.setContentView(triggerButton); view1.addSubview(triggerButton); view1.addSubview(actionButton); view1.addSubview(textField); view1.addSubview(textField2); triggerButton.setTarget(target); triggerButton.setAction("trigger"); actionButton.setTarget(target); actionButton.setAction("move"); window1.setContentView(view1); window2.setContentView(view2); app.run(); } public static function test_images() { var app = NSApplication.sharedApplication(); var window1 = (new NSWindow()).initWithContentRect(new NSRect(0,0,500,500)); var imageView = new org.actionstep.test.ASTestImageView(); imageView.initWithFrameImage(new NSRect(0,0,500,500), "NSHighlightedScrollerDownArrow"); window1.setContentView(imageView); app.run(); } } --- NEW FILE: ASTestMain.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.ASDebugger; import org.actionstep.test.*; class org.actionstep.test.ASTestMain { public static function main() { Stage.align="LT"; Stage.scaleMode="noScale"; ASDebugger.setLevel(ASDebugger.INFO); try { ASTestScrollers.test(); } catch (e:Error) { TRACE(e.message); } } } --- NEW FILE: ASTestRenderImage.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.*; import org.actionstep.constants.*; class org.actionstep.test.ASTestRenderImage { public static function test() { var app = NSApplication.sharedApplication(); var window1 = (new NSWindow()).initWithContentRect(new NSRect(0,0,500,500)); var imageView = new org.actionstep.test.ASTestImageView(); imageView.initWithFrameImage(new NSRect(0,0,500,500), "NSHighlightedScrollerDownArrow"); window1.setContentView(imageView); app.run(); } } |
From: Richard K. <ric...@us...> - 2005-05-22 03:49:14
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18977 Modified Files: ASDebugger.as Removed Files: ActionStep.as Log Message: removed ActionStep.as and added test/ASTestMain in its place Index: ASDebugger.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASDebugger.as,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ASDebugger.as 4 May 2005 05:04:43 -0000 1.2 --- ASDebugger.as 22 May 2005 03:49:06 -0000 1.3 *************** *** 102,105 **** --- 102,145 ---- } + /** + * Prints the source ot flash var + */ + public static function dump(obj){ + if(obj == null) return; + + switch( obj.constructor ){ + + case Number: + return obj; + + case String: + return "String(" + obj + ")"; + + case Array: + var els = []; + for(var key in obj){ + els[els.length] = "" + + key + + ":" + + dump(obj[key]); + } + return "Array("+els.join(", ")+")" + case Object: + case TextField: //default + dom + var els = []; + for(var key in obj){ + els[els.length] = "" + + key + + ":" + + dump(obj[key]); + } + return "Object("+els.join(", ")+")"; + + default : + return obj.toString(); + } + } + + /* * Sets the level of the debugger --- ActionStep.as DELETED --- |
From: Richard K. <ric...@us...> - 2005-05-22 03:35:46
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17458 Modified Files: NSScroller.as Log Message: got buttons rendering Index: NSScroller.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSScroller.as,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NSScroller.as 21 May 2005 04:23:43 -0000 1.2 --- NSScroller.as 22 May 2005 03:35:37 -0000 1.3 *************** *** 29,32 **** --- 29,34 ---- */ + import org.actionstep.ASDraw; + import org.actionstep.NSControl; import org.actionstep.NSRect; *************** *** 102,106 **** m_hitPart = NSScrollerPart.NSScrollerNoPart; drawParts(); ! setEnabled(false); checkSpaceForParts(); return this; --- 104,108 ---- m_hitPart = NSScrollerPart.NSScrollerNoPart; drawParts(); ! setEnabled(true); checkSpaceForParts(); return this; *************** *** 225,228 **** --- 227,232 ---- var scrollerFrame = m_frame.clone(); var x:Number, y:Number, width:Number, height:Number; + x = y = width = height = 0; + var buttonsSize = 2*BUTTON_WIDTH+2; var usableParts:NSUsableScrollerParts; *************** *** 278,282 **** return NSRect.ZeroRect; } ! y += (height - BUTTON_WIDTH+1); width = BUTTON_WIDTH; height = BUTTON_WIDTH; --- 282,287 ---- return NSRect.ZeroRect; } ! x += 1; ! y += 1; width = BUTTON_WIDTH; height = BUTTON_WIDTH; *************** *** 288,291 **** --- 293,298 ---- return NSRect.ZeroRect; } + x += 1; + y += (height - BUTTON_WIDTH+1); width = BUTTON_WIDTH; height = BUTTON_WIDTH; *************** *** 386,389 **** --- 393,397 ---- g_upCell.setPeriodicDelayInterval(.3, .03); g_upCell.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); + g_upCell.setBezeled(true); g_downCell = new NSButtonCell(); *************** *** 396,399 **** --- 404,408 ---- g_downCell.setPeriodicDelayInterval(.3, .03); g_downCell.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); + g_downCell.setBezeled(true); g_leftCell = new NSButtonCell(); *************** *** 406,409 **** --- 415,419 ---- g_leftCell.setPeriodicDelayInterval(.3, .03); g_leftCell.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); + g_leftCell.setBezeled(true); g_rightCell = new NSButtonCell(); *************** *** 416,419 **** --- 426,430 ---- g_rightCell.setPeriodicDelayInterval(.3, .03); g_rightCell.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); + g_rightCell.setBezeled(true); } *************** *** 512,515 **** --- 523,537 ---- } + public function drawRect(rect:NSRect) { + ASDraw.outlineRectWithRect(m_mcBounds, rect, [0x696E79,0xF6F8F9]); + var rectIncrementLine:NSRect = rectForPart(NSScrollerPart.NSScrollerIncrementLine); + var rectDecrementLine:NSRect = rectForPart(NSScrollerPart.NSScrollerDecrementLine); + var rectKnobSlot:NSRect = rectForPart(NSScrollerPart.NSScrollerKnobSlot); + var cell:NSButtonCell = (m_horizontal ? g_leftCell : g_upCell); + cell.drawWithFrameInView(rectDecrementLine, this); + cell = (m_horizontal ? g_rightCell : g_downCell); + cell.drawWithFrameInView(rectIncrementLine, this); + } + // Setting control tint |
From: Richard K. <ric...@us...> - 2005-05-22 03:35:45
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17458/test Added Files: ASTestScrollers.as Log Message: got buttons rendering --- NEW FILE: ASTestScrollers.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.ASTestScrollers { public static function test() { var app = NSApplication.sharedApplication(); var window1 = (new NSWindow()).initWithContentRect(new NSRect(0,0,250,250)); var view:ASTestView = new ASTestView(); view.initWithFrame(new NSRect(0,0,250,250)); var vscroller:NSScroller = new NSScroller(); vscroller.initWithFrame(new NSRect(180, 0, 20, 180)); var hscroller:NSScroller = new NSScroller(); hscroller.initWithFrame(new NSRect(0, 180, 180, 20)); view.addSubview(vscroller); view.addSubview(hscroller); window1.setContentView(view); app.run(); } } |
From: Richard K. <ric...@us...> - 2005-05-22 03:34:41
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17318 Modified Files: ASHighlightedScrollerDownArrowRep.as ASHighlightedScrollerLeftArrowRep.as ASHighlightedScrollerRightArrowRep.as ASHighlightedScrollerUpArrowRep.as ASScrollerDownArrowRep.as ASScrollerLeftArrowRep.as ASScrollerRightArrowRep.as ASScrollerUpArrowRep.as Log Message: add fill colors to scroller images Index: ASScrollerUpArrowRep.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/images/ASScrollerUpArrowRep.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ASScrollerUpArrowRep.as 20 May 2005 19:58:18 -0000 1.1 --- ASScrollerUpArrowRep.as 22 May 2005 03:34:33 -0000 1.2 *************** *** 48,51 **** --- 48,52 ---- var width = m_drawRect.size.width; var height = m_drawRect.size.height; + m_drawClip.beginFill(0x4B4F57, 100); m_drawClip.lineStyle(1, 0xF6F8F9, 100); m_drawClip.moveTo(x, y+height); *************** *** 54,57 **** --- 55,59 ---- m_drawClip.lineStyle(1, 0x696E79, 100); m_drawClip.lineTo(x, y+height); + m_drawClip.endFill(); } } \ No newline at end of file Index: ASHighlightedScrollerRightArrowRep.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/images/ASHighlightedScrollerRightArrowRep.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ASHighlightedScrollerRightArrowRep.as 20 May 2005 19:58:18 -0000 1.1 --- ASHighlightedScrollerRightArrowRep.as 22 May 2005 03:34:33 -0000 1.2 *************** *** 48,51 **** --- 48,52 ---- var width = m_drawRect.size.width; var height = m_drawRect.size.height; + m_drawClip.beginFill(0x4B4F57, 100); m_drawClip.lineStyle(1, 0x696E79, 100); m_drawClip.moveTo(x, y+height); *************** *** 54,57 **** --- 55,59 ---- m_drawClip.lineStyle(1, 0xF6F8F9, 100); m_drawClip.lineTo(x, y+height); + m_drawClip.endFill(); } } \ No newline at end of file Index: ASScrollerDownArrowRep.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/images/ASScrollerDownArrowRep.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ASScrollerDownArrowRep.as 20 May 2005 19:58:18 -0000 1.1 --- ASScrollerDownArrowRep.as 22 May 2005 03:34:33 -0000 1.2 *************** *** 48,51 **** --- 48,52 ---- var width = m_drawRect.size.width; var height = m_drawRect.size.height; + m_drawClip.beginFill(0x4B4F57, 100); m_drawClip.lineStyle(1, 0x696E79, 100); m_drawClip.moveTo(x, y); *************** *** 55,58 **** --- 56,60 ---- m_drawClip.lineStyle(1, 0x696E79, 100); m_drawClip.lineTo(x, y); + m_drawClip.endFill(); } } \ No newline at end of file Index: ASHighlightedScrollerLeftArrowRep.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/images/ASHighlightedScrollerLeftArrowRep.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ASHighlightedScrollerLeftArrowRep.as 20 May 2005 19:58:18 -0000 1.1 --- ASHighlightedScrollerLeftArrowRep.as 22 May 2005 03:34:33 -0000 1.2 *************** *** 48,51 **** --- 48,52 ---- var width = m_drawRect.size.width; var height = m_drawRect.size.height; + m_drawClip.beginFill(0x4B4F57, 100); m_drawClip.lineStyle(1, 0x696E79, 100); m_drawClip.moveTo(x, y + height/2); *************** *** 54,57 **** --- 55,59 ---- m_drawClip.lineTo(x + width, y+height); m_drawClip.lineTo(x, y + height/2); + m_drawClip.endFill(); } } \ No newline at end of file Index: ASScrollerRightArrowRep.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/images/ASScrollerRightArrowRep.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ASScrollerRightArrowRep.as 20 May 2005 19:58:18 -0000 1.1 --- ASScrollerRightArrowRep.as 22 May 2005 03:34:33 -0000 1.2 *************** *** 48,51 **** --- 48,52 ---- var width = m_drawRect.size.width; var height = m_drawRect.size.height; + m_drawClip.beginFill(0x4B4F57, 100); m_drawClip.lineStyle(1, 0x696E79, 100); m_drawClip.moveTo(x, y+height); *************** *** 54,57 **** --- 55,59 ---- m_drawClip.lineStyle(1, 0xF6F8F9, 100); m_drawClip.lineTo(x, y+height); + m_drawClip.endFill(); } } \ No newline at end of file Index: ASScrollerLeftArrowRep.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/images/ASScrollerLeftArrowRep.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ASScrollerLeftArrowRep.as 20 May 2005 19:58:18 -0000 1.1 --- ASScrollerLeftArrowRep.as 22 May 2005 03:34:33 -0000 1.2 *************** *** 48,51 **** --- 48,52 ---- var width = m_drawRect.size.width; var height = m_drawRect.size.height; + m_drawClip.beginFill(0x4B4F57, 100); m_drawClip.lineStyle(1, 0x696E79, 100); m_drawClip.moveTo(x, y + height/2); *************** *** 54,57 **** --- 55,59 ---- m_drawClip.lineTo(x + width, y+height); m_drawClip.lineTo(x, y + height/2); + m_drawClip.endFill(); } } \ No newline at end of file Index: ASHighlightedScrollerUpArrowRep.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/images/ASHighlightedScrollerUpArrowRep.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ASHighlightedScrollerUpArrowRep.as 20 May 2005 19:58:18 -0000 1.1 --- ASHighlightedScrollerUpArrowRep.as 22 May 2005 03:34:33 -0000 1.2 *************** *** 48,51 **** --- 48,52 ---- var width = m_drawRect.size.width; var height = m_drawRect.size.height; + m_drawClip.beginFill(0x4B4F57, 100); m_drawClip.lineStyle(1, 0xF6F8F9, 100); m_drawClip.moveTo(x, y+height); Index: ASHighlightedScrollerDownArrowRep.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/images/ASHighlightedScrollerDownArrowRep.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ASHighlightedScrollerDownArrowRep.as 20 May 2005 19:58:18 -0000 1.1 --- ASHighlightedScrollerDownArrowRep.as 22 May 2005 03:34:33 -0000 1.2 *************** *** 48,51 **** --- 48,52 ---- var width = m_drawRect.size.width; var height = m_drawRect.size.height; + m_drawClip.beginFill(0x4B4F57, 100); m_drawClip.lineStyle(1, 0x696E79, 100); m_drawClip.moveTo(x, y); *************** *** 55,58 **** --- 56,60 ---- m_drawClip.lineStyle(1, 0x696E79, 100); m_drawClip.lineTo(x, y); + m_drawClip.endFill(); } } \ No newline at end of file |
From: Richard K. <ric...@us...> - 2005-05-21 04:23:52
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/constants In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5256/constants Added Files: NSUsableScrollerParts.as Log Message: implementing NSScroller --- NEW FILE: NSUsableScrollerParts.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.constants.NSUsableScrollerParts { static var NSNoScrollerParts = new NSUsableScrollerParts(0); static var NSOnlyScrollerArrows = new NSUsableScrollerParts(1); static var NSAllScrollerParts = new NSUsableScrollerParts(2); public var value:Number; private function NSUsableScrollerParts(num:Number) { value = num; } } |
From: Richard K. <ric...@us...> - 2005-05-21 04:23:52
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5256 Modified Files: NSScroller.as NSRect.as Log Message: implementing NSScroller Index: NSRect.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSRect.as,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NSRect.as 14 May 2005 04:45:50 -0000 1.4 --- NSRect.as 21 May 2005 04:23:43 -0000 1.5 *************** *** 57,68 **** } - public function insetRect(dx:Number, dy:Number):NSRect { - return new NSRect(origin.x + dx, origin.y + dy, size.width - 2*dx, size.height - 2*dy); - } - - public function isEmptyRect():Boolean { - return (size.width == 0) && (size.height == 0); - } - public function midX():Number { return origin.x + size.width/2; --- 57,60 ---- *************** *** 73,76 **** --- 65,104 ---- } + public function minX():Number { + return origin.x; + } + + public function minY():Number { + return origin.y; + } + + public function maxX():Number { + return origin.x + size.width; + } + + public function maxY():Number { + return origin.y + size.height; + } + + public function width():Number { + return size.width; + } + + public function height():Number { + return size.height; + } + + public function insetRect(dx:Number, dy:Number):NSRect { + return new NSRect(origin.x + dx, origin.y + dy, size.width - 2*dx, size.height - 2*dy); + } + + public function offsetRect(dx:Number, dy:Number):NSRect { + return new NSRect(origin.x + dx, origin.y + dy, size.width, size.height); + } + + public function isEmptyRect():Boolean { + return (size.width == 0) && (size.height == 0); + } + public function pointInRect(point:NSPoint):Boolean { if ( (point.x > origin.x && point.x < (origin.x+size.width)) && Index: NSScroller.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSScroller.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NSScroller.as 17 May 2005 04:25:36 -0000 1.1 --- NSScroller.as 21 May 2005 04:23:43 -0000 1.2 *************** *** 30,51 **** 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; --- 30,76 ---- import org.actionstep.NSControl; + import org.actionstep.NSRect; + import org.actionstep.NSSize; + import org.actionstep.NSPoint; + import org.actionstep.NSCell; + import org.actionstep.NSImage; + import org.actionstep.NSEvent; + import org.actionstep.NSButtonCell; + import org.actionstep.constants.NSScrollerPart; import org.actionstep.constants.NSControlSize; import org.actionstep.constants.NSScrollArrowPosition; import org.actionstep.constants.NSControlTint; ! import org.actionstep.constants.NSCellImagePosition; ! import org.actionstep.constants.NSUsableScrollerParts; ! import org.actionstep.constants.NSBezelStyle; class org.actionstep.NSScroller extends NSControl { ! private static var DEFAULT_SCROLLER_WIDTH:Number = 20; ! private static var BUTTON_WIDTH:Number = 18; ! ! private static var g_upCell:NSButtonCell; ! private static var g_downCell:NSButtonCell; ! private static var g_leftCell:NSButtonCell; ! private static var g_rightCell:NSButtonCell; private var m_hitPart:NSScrollerPart; private var m_arrowsPosition:NSScrollArrowPosition; + private var m_floatValue:Number; + private var m_usableParts:NSUsableScrollerParts; private var m_knobProportion:Number; + private var m_pendingKnobProportion:Number; private var m_controlTint:NSControlTint; private var m_target:Object; private var m_action:String; + private var m_enabled:Boolean; + + private var m_horizontal:Boolean; + + public function NSScroller() { + m_enabled = true; + } public static function scrollerWidth():Number { return DEFAULT_SCROLLER_WIDTH; *************** *** 61,67 **** public function initWithFrame(rect:NSRect):NSScroller { return this; } ! public function setControlSize(size:NSControlSize) { --- 86,120 ---- public function initWithFrame(rect:NSRect):NSScroller { + if (rect.size.width > rect.size.height) { + m_horizontal = true; + rect.size.height = scrollerWidth(); + } else { + m_horizontal = false; + rect.size.width = scrollerWidth(); + } + super.initWithFrame(rect); + m_arrowsPosition = NSScrollArrowPosition.NSScrollerArrowsDefaultSetting; + if (m_horizontal) { + m_floatValue = 0.0; + } else { + m_floatValue = 1.0; + } + m_hitPart = NSScrollerPart.NSScrollerNoPart; + drawParts(); + setEnabled(false); + checkSpaceForParts(); return this; } ! ! // Enabling and disabling the control ! ! public function setEnabled(value:Boolean) { ! m_enabled = value; ! setNeedsDisplay(true); ! } ! ! public function isEnabled():Boolean { ! return m_enabled; ! } public function setControlSize(size:NSControlSize) { *************** *** 88,95 **** } // Setting the knob position ! public function setFloatValueKnobProportion(floatValue:Number, knobProportion:Number) { ! //! Implmement } --- 141,217 ---- } + public function setFrame(rect:NSRect) { + if (rect.size.width > rect.size.height) { + m_horizontal = true; + rect.size.height = scrollerWidth(); + } else { + m_horizontal = false; + rect.size.width = scrollerWidth(); + } + super.setFrame(rect); + if (m_arrowsPosition != NSScrollArrowPosition.NSScrollerArrowsNone) { + m_arrowsPosition = NSScrollArrowPosition.NSScrollerArrowsDefaultSetting; + } + m_hitPart = NSScrollerPart.NSScrollerNoPart; + checkSpaceForParts(); + } + + public function setFrameSize(size:NSSize) { + if (size.width > size.height) { + m_horizontal = true; + size.height = scrollerWidth(); + } else { + m_horizontal = false; + size.width = scrollerWidth(); + } + super.setFrameSize(size); + if (m_arrowsPosition != NSScrollArrowPosition.NSScrollerArrowsNone) { + m_arrowsPosition = NSScrollArrowPosition.NSScrollerArrowsDefaultSetting; + } + setNeedsDisplay(true); + checkSpaceForParts(); + } + + // Setting the knob position ! public function setFloatValue(value:Number) { ! if (m_floatValue == value) { ! return; ! } ! if (value < 0) { ! m_floatValue = 0; ! } ! if (value > 1) { ! m_floatValue = 1; ! } ! m_floatValue = value; ! setNeedsDisplay(true); ! } ! ! public function setFloatValueKnobProportion(value:Number, knobProportion:Number) { ! if (m_floatValue == value && m_knobProportion == knobProportion) { ! return; ! } ! if (knobProportion < 0) { ! m_pendingKnobProportion = 0; ! } else if (knobProportion > 1) { ! m_pendingKnobProportion = 1; ! } else { ! m_pendingKnobProportion = knobProportion; ! } ! if (m_hitPart == NSScrollerPart.NSScrollerNoPart) { ! m_knobProportion = m_pendingKnobProportion; ! m_pendingKnobProportion = 0; ! } ! if (m_knobProportion == 1) { ! setEnabled(false); ! } else { ! setEnabled(true); ! } ! if (m_hitPart != NSScrollerPart.NSScrollerKnobSlot && m_hitPart != NSScrollerPart.NSScrollerKnob) { ! m_floatValue = -1; ! setFloatValue(value); ! } } *************** *** 100,105 **** --- 222,421 ---- // Calculating layout + public function rectForPart(part:NSScrollerPart):NSRect { + var scrollerFrame = m_frame.clone(); + var x:Number, y:Number, width:Number, height:Number; + var buttonsSize = 2*BUTTON_WIDTH+2; + var usableParts:NSUsableScrollerParts; + + if (!m_enabled) { + usableParts = NSUsableScrollerParts.NSNoScrollerParts; + } else { + usableParts = m_usableParts; + } + + // reverse width/height based on orientation + if (m_horizontal) { + width = scrollerFrame.size.height - 2; + height = scrollerFrame.size.width - 2; + } else { + width = scrollerFrame.size.width - 2; + height = scrollerFrame.size.height - 2; + } + + switch(part) { + case NSScrollerPart.NSScrollerKnob: + if (usableParts == NSUsableScrollerParts.NSNoScrollerParts || + m_arrowsPosition == NSUsableScrollerParts.NSOnlyScrollerArrows) { + return NSRect.ZeroRect; + } + var slotHeight = height - + (m_arrowsPosition == NSScrollArrowPosition.NSScrollerArrowsNone ? 0 : buttonsSize); + var knobHeight = Math.floor(m_knobProportion * slotHeight); + if (knobHeight < BUTTON_WIDTH) { + knobHeight = BUTTON_WIDTH; + } + var knobPosition = Math.floor(m_floatValue * (slotHeight - knobHeight)); + if (m_arrowsPosition == NSScrollArrowPosition.NSScrollerArrowsNone) { + y += knobPosition; + } else { + y += knobPosition + BUTTON_WIDTH; + } + height = knobHeight; + width = BUTTON_WIDTH; + break; + case NSScrollerPart.NSScrollerKnobSlot: + if (usableParts == NSUsableScrollerParts.NSNoScrollerParts || + m_arrowsPosition == NSScrollArrowPosition.NSScrollerArrowsNone) { + break; + } + height -= buttonsSize; + y += BUTTON_WIDTH+1; + break; + case NSScrollerPart.NSScrollerDecrementLine: + case NSScrollerPart.NSScrollerDecrementPage: + if (usableParts == NSUsableScrollerParts.NSNoScrollerParts || + m_arrowsPosition == NSScrollArrowPosition.NSScrollerArrowsNone) { + return NSRect.ZeroRect; + } + y += (height - BUTTON_WIDTH+1); + width = BUTTON_WIDTH; + height = BUTTON_WIDTH; + break; + case NSScrollerPart.NSScrollerIncrementLine: + case NSScrollerPart.NSScrollerIncrementPage: + if (usableParts == NSUsableScrollerParts.NSNoScrollerParts || + m_arrowsPosition == NSScrollArrowPosition.NSScrollerArrowsNone) { + return NSRect.ZeroRect; + } + width = BUTTON_WIDTH; + height = BUTTON_WIDTH; + break; + case NSScrollerPart.NSScrollerNoPart: + return NSRect.ZeroRect; + } + // Reverse y/x & height/width based on orientation + if (m_horizontal) { + return new NSRect(y,x,height,width); + } else { + return new NSRect(x,y,width,height); + } + } + + public function testPart(point:NSPoint):NSScrollerPart { + var rect:NSRect; + point = convertPointFromView(point); + if (point.x <= 0 || point.x >=m_frame.size.width || + point.y <= 0 || point.y >=m_frame.size.height) { + return NSScrollerPart.NSScrollerNoPart; + } + rect = rectForPart(NSScrollerPart.NSScrollerDecrementLine); + if (rect.pointInRect(point)) { + return NSScrollerPart.NSScrollerDecrementLine; + } + + rect = rectForPart(NSScrollerPart.NSScrollerIncrementLine); + if (rect.pointInRect(point)) { + return NSScrollerPart.NSScrollerIncrementLine; + } + + rect = rectForPart(NSScrollerPart.NSScrollerKnob); + if (rect.pointInRect(point)) { + return NSScrollerPart.NSScrollerKnob; + } + + rect = rectForPart(NSScrollerPart.NSScrollerIncrementPage); + if (rect.pointInRect(point)) { + return NSScrollerPart.NSScrollerIncrementPage; + } + + rect = rectForPart(NSScrollerPart.NSScrollerDecrementPage); + if (rect.pointInRect(point)) { + return NSScrollerPart.NSScrollerDecrementPage; + } + + rect = rectForPart(NSScrollerPart.NSScrollerKnobSlot); + if (rect.pointInRect(point)) { + return NSScrollerPart.NSScrollerKnobSlot; + } + + return NSScrollerPart.NSScrollerNoPart + } + + public function checkSpaceForParts() { + var frameSize = m_frame.size; + var size = (m_horizontal ? frameSize.width : frameSize.height); + + if (m_arrowsPosition == NSScrollArrowPosition.NSScrollerArrowsNone) { + if (size > BUTTON_WIDTH + 3) { + m_usableParts = NSUsableScrollerParts.NSAllScrollerParts; + } else { + m_usableParts = NSUsableScrollerParts.NSNoScrollerParts; + } + } else { + if (size >= 5 + BUTTON_WIDTH * 3) { + m_usableParts = NSUsableScrollerParts.NSAllScrollerParts; + } else if (size >= 3 + BUTTON_WIDTH * 2) { + m_usableParts = NSUsableScrollerParts.NSOnlyScrollerArrows; + } else { + m_usableParts = NSUsableScrollerParts.NSNoScrollerParts; + } + } + } + + public function usableParts():NSUsableScrollerParts { + return m_usableParts; + } + // Drawing the parts + public function isOpaque():Boolean { + return true; + } + + public function drawParts() { + if (g_upCell != null) { + return; + } + g_upCell = new NSButtonCell(); + g_upCell.setHighlightsBy(NSCell.NSChangeBackgroundCellMask | NSCell.NSContentsCellMask); + g_upCell.setImage(NSImage.imageNamed("NSScrollerUpArrow")); + g_upCell.setAlternateImage(NSImage.imageNamed("NSHightlightedScrollerUpArrow")); + g_upCell.setImagePosition(NSCellImagePosition.NSImageOnly); + g_upCell.setContinuous(true); + g_upCell.sendActionOn(NSEvent.NSLeftMouseDownMask | NSEvent.NSPeriodicMask); + g_upCell.setPeriodicDelayInterval(.3, .03); + g_upCell.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); + + g_downCell = new NSButtonCell(); + g_downCell.setHighlightsBy(NSCell.NSChangeBackgroundCellMask | NSCell.NSContentsCellMask); + g_downCell.setImage(NSImage.imageNamed("NSScrollerDownArrow")); + g_downCell.setAlternateImage(NSImage.imageNamed("NSHightlightedScrollerDownArrow")); + g_downCell.setImagePosition(NSCellImagePosition.NSImageOnly); + g_downCell.setContinuous(true); + g_downCell.sendActionOn(NSEvent.NSLeftMouseDownMask | NSEvent.NSPeriodicMask); + g_downCell.setPeriodicDelayInterval(.3, .03); + g_downCell.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); + + g_leftCell = new NSButtonCell(); + g_leftCell.setHighlightsBy(NSCell.NSChangeBackgroundCellMask | NSCell.NSContentsCellMask); + g_leftCell.setImage(NSImage.imageNamed("NSScrollerLeftArrow")); + g_leftCell.setAlternateImage(NSImage.imageNamed("NSHightlightedScrollerLeftArrow")); + g_leftCell.setImagePosition(NSCellImagePosition.NSImageOnly); + g_leftCell.setContinuous(true); + g_leftCell.sendActionOn(NSEvent.NSLeftMouseDownMask | NSEvent.NSPeriodicMask); + g_leftCell.setPeriodicDelayInterval(.3, .03); + g_leftCell.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); + + g_rightCell = new NSButtonCell(); + g_rightCell.setHighlightsBy(NSCell.NSChangeBackgroundCellMask | NSCell.NSContentsCellMask); + g_rightCell.setImage(NSImage.imageNamed("NSScrollerRightArrow")); + g_rightCell.setAlternateImage(NSImage.imageNamed("NSHightlightedScrollerRightArrow")); + g_rightCell.setImagePosition(NSCellImagePosition.NSImageOnly); + g_rightCell.setContinuous(true); + g_rightCell.sendActionOn(NSEvent.NSLeftMouseDownMask | NSEvent.NSPeriodicMask); + g_rightCell.setPeriodicDelayInterval(.3, .03); + g_rightCell.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); + } + // Event handling *************** *** 131,135 **** m_target = target; } ! // Setting control tint --- 447,514 ---- m_target = target; } ! ! private function floatValueAtPoint(point:NSPoint):Number { ! var knobRect:NSRect = rectForPart(NSScrollerPart.NSScrollerKnob); ! var slotRect:NSRect = rectForPart(NSScrollerPart.NSScrollerKnobSlot); ! var position:Number; ! var min_pos:Number; ! var max_pos:Number; ! ! if (m_horizontal) { ! min_pos = slotRect.minX() + knobRect.size.width/2 ! min_pos = slotRect.maxX() + knobRect.size.width/2 ! position = point.x; ! } else { ! min_pos = slotRect.minY() + knobRect.size.height/2 ! min_pos = slotRect.maxY() + knobRect.size.height/2 ! position = point.y; ! } ! if (position <= min_pos) { ! return 0; ! } ! if (position >= max_pos) { ! return 1; ! } ! return (position - min_pos) / (max_pos - min_pos); ! } ! ! public function mouseDown(event:NSEvent) { ! var location:NSPoint = event.locationInWindow; ! m_hitPart = testPart(location); ! setButtonCellTargets(); ! switch(m_hitPart) { ! case NSScrollerPart.NSScrollerIncrementPage: ! case NSScrollerPart.NSScrollerIncrementLine: ! case NSScrollerPart.NSScrollerDecrementPage: ! case NSScrollerPart.NSScrollerDecrementLine: ! trackScrollButtons(event); ! break; ! case NSScrollerPart.NSScrollerKnob: ! trackKnob(event); ! break ! case NSScrollerPart.NSScrollerKnobSlot: ! var floatValue = floatValueAtPoint(convertPointFromView(location, null)); ! if (m_floatValue != floatValue) { ! setFloatValue(floatValue); ! sendActionTo(m_action, m_target); ! } ! trackKnob(event); ! break; ! case NSScrollerPart.NSScrollerNoPart: ! break; ! } ! m_hitPart = NSScrollerPart.NSScrollerNoPart; ! if (m_pendingKnobProportion != 0) { ! setFloatValueKnobProportion(m_floatValue, m_pendingKnobProportion); ! } else { ! setNeedsDisplay(true); ! } ! } ! ! private function trackKnob(event:NSEvent) { ! } ! ! private function trackScrollButtons(event) { ! } // Setting control tint *************** *** 143,145 **** --- 522,537 ---- } + // PRIVATE FUNCTIONS + + private function setButtonCellTargets() { + g_upCell.setTarget(m_target); + g_upCell.setAction(m_action); + g_downCell.setTarget(m_target); + g_downCell.setAction(m_action); + g_leftCell.setTarget(m_target); + g_leftCell.setAction(m_action); + g_rightCell.setTarget(m_target); + g_rightCell.setAction(m_action); + } + } \ No newline at end of file |
From: Richard K. <ric...@us...> - 2005-05-20 20:36:31
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24620 Modified Files: ASTheme.as ASThemeProtocol.as NSButtonCell.as Log Message: added shadowless bezel style Index: ASThemeProtocol.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASThemeProtocol.as,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ASThemeProtocol.as 18 May 2005 22:08:00 -0000 1.6 --- ASThemeProtocol.as 20 May 2005 20:36:21 -0000 1.7 *************** *** 53,67 **** * Draws a NSButton in the up state bezeled with the supplied rect in the view. */ ! public function drawBezelButtonUpWithRectInView(rect:NSRect, view:NSView); /** * Draws a NSButton in the down state bezeled with the supplied rect in the view. */ ! public function drawBezelButtonDownWithRectInView(rect:NSRect, view:NSView); /** * Draws a NSButton in the disabled state bezeled with the supplied rect in the view. */ ! public function drawBezelButtonDisabledWithRectInView(rect:NSRect, view:NSView); /** --- 53,67 ---- * Draws a NSButton in the up state bezeled with the supplied rect in the view. */ ! public function drawBezelButtonUpWithRectInViewHasShadow(rect:NSRect, view:NSView, hasShadow:Boolean); /** * Draws a NSButton in the down state bezeled with the supplied rect in the view. */ ! public function drawBezelButtonDownWithRectInViewHasShadow(rect:NSRect, view:NSView, hasShadow:Boolean); /** * Draws a NSButton in the disabled state bezeled with the supplied rect in the view. */ ! public function drawBezelButtonDisabledWithRectInViewHasShadow(rect:NSRect, view:NSView, hasShadow:Boolean); /** Index: NSButtonCell.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSButtonCell.as,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** NSButtonCell.as 18 May 2005 22:06:55 -0000 1.16 --- NSButtonCell.as 20 May 2005 20:36:21 -0000 1.17 *************** *** 85,89 **** m_keyEquivalent = ""; m_alternateTitle = ""; ! m_bcellTransparent = false; } --- 85,90 ---- m_keyEquivalent = ""; m_alternateTitle = ""; ! m_bcellTransparent = false; ! m_bezelStyle = NSBezelStyle.NSRegularSquareBezelStyle; } *************** *** 617,626 **** if (m_enabled) { if (m_highlighted) { ! ASTheme.current().drawBezelButtonDownWithRectInView(cellFrame, inView); } else { ! ASTheme.current().drawBezelButtonUpWithRectInView(cellFrame, inView); } } else { ! ASTheme.current().drawBezelButtonDisabledWithRectInView(cellFrame, inView); } --- 618,627 ---- if (m_enabled) { if (m_highlighted) { ! ASTheme.current().drawBezelButtonDownWithRectInViewHasShadow(cellFrame, inView, m_bezelStyle != NSBezelStyle.NSShadowlessSquareBezelStyle); } else { ! ASTheme.current().drawBezelButtonUpWithRectInViewHasShadow(cellFrame, inView, m_bezelStyle != NSBezelStyle.NSShadowlessSquareBezelStyle); } } else { ! ASTheme.current().drawBezelButtonDisabledWithRectInViewHasShadow(cellFrame, inView, m_bezelStyle != NSBezelStyle.NSShadowlessSquareBezelStyle); } Index: ASTheme.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASTheme.as,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ASTheme.as 20 May 2005 19:59:09 -0000 1.7 --- ASTheme.as 20 May 2005 20:36:21 -0000 1.8 *************** *** 84,97 **** } ! public function drawBezelButtonUpWithRectInView(rect:NSRect, view:NSView) { ! drawButtonUp(view.mcBounds(), rect); } ! public function drawBezelButtonDownWithRectInView(rect:NSRect, view:NSView) { ! drawButtonDown(view.mcBounds(), rect); } ! public function drawBezelButtonDisabledWithRectInView(rect:NSRect, view:NSView) { ! drawButtonDown(view.mcBounds(), rect); } --- 84,109 ---- } ! public function drawBezelButtonUpWithRectInViewHasShadow(rect:NSRect, view:NSView, hasShadow:Boolean) { ! if (hasShadow) { ! drawButtonUp(view.mcBounds(), rect); ! } else { ! drawButtonUpWithoutBorder(view.mcBounds(), rect); ! } } ! public function drawBezelButtonDownWithRectInViewHasShadow(rect:NSRect, view:NSView, hasShadow:Boolean) { ! if (hasShadow) { ! drawButtonDown(view.mcBounds(), rect); ! } else { ! drawButtonDownWithoutBorder(view.mcBounds(), rect); ! } } ! public function drawBezelButtonDisabledWithRectInViewHasShadow(rect:NSRect, view:NSView, hasShadow:Boolean) { ! if (hasShadow) { ! drawButtonDown(view.mcBounds(), rect); ! } else { ! drawButtonDownWithoutBorder(view.mcBounds(), rect); ! } } |
From: Richard K. <ric...@us...> - 2005-05-20 19:59:26
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16331 Modified Files: ASTheme.as ASDraw.as Log Message: Updated to use new advanced gradient methods for drawing buttons and textfields Index: ASTheme.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASTheme.as,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ASTheme.as 18 May 2005 22:08:00 -0000 1.6 --- ASTheme.as 20 May 2005 19:59:09 -0000 1.7 *************** *** 48,111 **** private static var g_current:ASThemeProtocol; ! private static var g_colorSets = { ! buttonUp: { ! top: 0x82858E, ! top1: 0xDFE2E9, ! top2: 0xEEF2F5, ! top3: 0xD4D8D9, ! bottom: 0xD3D6DB, ! bottom1: 0x858992, ! bottom2: 0x9599A2, ! bottom3: 0xACB1B7, ! left: 0x82858E, ! left1: 0xDFE2E9, ! right: 0xD3D6DB, ! right1: 0x858992, ! middle: 0xC7CAD1}, ! buttonDown: { ! top: 0x6A6E79, ! top1: 0x747883, ! top2: 0x7C838B, ! top3: 0x939AA2, ! bottom: 0xBEC1C6, ! bottom1: 0xCACED1, ! bottom2: 0xDADDE2, ! bottom3: 0xBEC1C6, ! left: 0x6A6E79, ! left1: 0x747883, ! right: 0xBEC1C6, ! right1: 0xCACED1, ! middle: 0xB0B4BD}, ! buttonDisabled: { ! top: 0x81858E, ! top1: 0x858992, ! top2: 0x9599A2, ! top3: 0xABAFB6, ! bottom: 0xD3D6DB, ! bottom1: 0xDDE0E4, ! bottom2: 0xEFF2F6, ! bottom3: 0xD2D5DA, ! left: 0x82858C, ! left1: undefined, ! right: 0x82858A, ! right1: 0xE9ECF1, ! middle: 0xC7CACF}, ! textfield: { ! top: 0x81858E, ! top1: 0x858992, ! top2: 0x9599A2, ! top3: 0xABAFB6, ! bottom: 0xD3D6DB, ! bottom1: 0xDDE0E4, ! bottom2: 0xEFF2F6, ! bottom3: 0xD2D5DA, ! left: 0x82858C, ! left1: undefined, ! right: 0x82858A, ! right1: 0xE9ECF1, ! middle: 0xC7CACF} ! }; - /** * Constructs a new instance of ASTheme. --- 48,56 ---- private static var g_current:ASThemeProtocol; ! static var ANGLE_LEFT_TO_RIGHT = 0; ! static var ANGLE_TOP_TO_BOTTOM = 90; ! static var ANGLE_RIGHT_TO_LEFT = 180; ! static var ANGLE_BOTTOM_TO_TOP = 270; /** * Constructs a new instance of ASTheme. *************** *** 132,183 **** public function drawBorderButtonWithRectInView(rect:NSRect, view:NSView) { ! drawBorderButtonWithRectColorsetInView(rect, "buttonUp", view); } public function drawBorderButtonDisabledWithRectInView(rect:NSRect, view:NSView) { ! drawBorderButtonWithRectColorsetInView(rect, "buttonDisabled", view); } public function drawBezelButtonUpWithRectInView(rect:NSRect, view:NSView) { ! drawBezelButtonWithRectColorsetInView(rect, "buttonUp", view); } public function drawBezelButtonDownWithRectInView(rect:NSRect, view:NSView) { ! drawBezelButtonWithRectColorsetInView(rect, "buttonDown", view); } public function drawBezelButtonDisabledWithRectInView(rect:NSRect, view:NSView) { ! drawBezelButtonWithRectColorsetInView(rect, "buttonDisabled", view); } public function drawTextFieldWithRectInView(rect:NSRect, view:NSView) { ! var x = rect.origin.x; ! var y = rect.origin.y; ! var width = rect.size.width-1; ! var height = rect.size.height-1; ! var mc = view.mcBounds(); ! var colors = g_colorSets["textfield"]; ! ! ASDraw.drawFill(mc, colors.middle, 0, 0, width, height); ! ! //draw top lines ! ASDraw.drawHLine(mc, colors.top , x, width, y); ! ASDraw.drawHLine(mc, colors.top1, x, width, y+1); ! ASDraw.drawHLine(mc, colors.top2, x, width, y+2); ! ASDraw.drawHLine(mc, colors.top3, x, width, y+3); ! ! //draw bottom lines ! ASDraw.drawHLine(mc, colors.bottom , x, width, height ); ! ASDraw.drawHLine(mc, colors.bottom1, x, width, height-1); ! ASDraw.drawHLine(mc, colors.bottom2, x, width, height-2); ! ASDraw.drawHLine(mc, colors.bottom3, x, width, height-3); ! ! //draw left lines ! ASDraw.drawVLine(mc, colors.left , y, height, x ); ! ASDraw.drawVLineEdgeFade(mc, colors.left1, y, height, x+1, 5); ! ! //draw right lines ! ASDraw.drawVLine(mc, colors.right , y, height, width ); ! ASDraw.drawVLineEdgeFade(mc, colors.right1, y, height, width-1, 5); } --- 77,101 ---- public function drawBorderButtonWithRectInView(rect:NSRect, view:NSView) { ! drawBorderButtonUp(view.mcBounds(), rect); } public function drawBorderButtonDisabledWithRectInView(rect:NSRect, view:NSView) { ! drawBorderButtonDown(view.mcBounds(), rect); } public function drawBezelButtonUpWithRectInView(rect:NSRect, view:NSView) { ! drawButtonUp(view.mcBounds(), rect); } public function drawBezelButtonDownWithRectInView(rect:NSRect, view:NSView) { ! drawButtonDown(view.mcBounds(), rect); } public function drawBezelButtonDisabledWithRectInView(rect:NSRect, view:NSView) { ! drawButtonDown(view.mcBounds(), rect); } public function drawTextFieldWithRectInView(rect:NSRect, view:NSView) { ! drawTextfield(view.mcBounds(), rect); } *************** *** 187,190 **** --- 105,118 ---- setImage("NSSwitch", org.actionstep.images.ASSwitchRep); setImage("NSHighlightedSwitch", org.actionstep.images.ASHighlightedSwitchRep); + + setImage("NSScrollerUpArrow", org.actionstep.images.ASScrollerUpArrowRep); + setImage("NSHighlightedScrollerUpArrow", org.actionstep.images.ASHighlightedScrollerUpArrowRep); + setImage("NSScrollerDownArrow", org.actionstep.images.ASScrollerDownArrowRep); + setImage("NSHighlightedScrollerDownArrow", org.actionstep.images.ASHighlightedScrollerDownArrowRep); + + setImage("NSScrollerLeftArrow", org.actionstep.images.ASScrollerLeftArrowRep); + setImage("NSHighlightedScrollerLeftArrow", org.actionstep.images.ASHighlightedScrollerLeftArrowRep); + setImage("NSScrollerRightArrow", org.actionstep.images.ASScrollerRightArrowRep); + setImage("NSHighlightedScrollerRightArrow", org.actionstep.images.ASHighlightedScrollerRightArrowRep); } *************** *** 213,256 **** } ! private function drawBorderButtonWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView) { var x = rect.origin.x; var y = rect.origin.y; var width = rect.size.width-1; var height = rect.size.height-1; ! var mc = view.mcBounds(); ! var colors = g_colorSets[colorSet]; ! ASDraw.drawFill(mc, colors.middle, x, y, width, height); ASDraw.drawRect(mc, 1, 0, x, y, width, height); } ! ! private function drawBezelButtonWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView) { var x = rect.origin.x; var y = rect.origin.y; var width = rect.size.width-1; var height = rect.size.height-1; ! var mc = view.mcBounds(); ! var colors = g_colorSets[colorSet]; ! ! //draw top lines ! ASDraw.drawFill(mc, colors.middle, x, y, width, height); ! ASDraw.drawHLine(mc, colors.top , x, x+width, y); ! ASDraw.drawHLine(mc, colors.top1, x, x+width, y+1); ! ASDraw.drawHLine(mc, colors.top2, x, x+width, y+2); ! ASDraw.drawHLine(mc, colors.top3, x, x+width, y+3); ! //draw bottom lines ! ASDraw.drawHLine(mc, colors.bottom , x, x+width, y+height ); ! ASDraw.drawHLine(mc, colors.bottom1, x, x+width, y+height-1); ! ASDraw.drawHLine(mc, colors.bottom2, x, x+width, y+height-2); ! ASDraw.drawHLine(mc, colors.bottom3, x, x+width, y+height-3); ! //draw left lines ! ASDraw.drawVLine(mc, colors.left , y, y+height, x ); ! ASDraw.drawVLineEdgeFade(mc, colors.left1, y, y+height, x+1, 5); ! //draw right lines ! ASDraw.drawVLine(mc, colors.right , y, y+height, x+width ); ! ASDraw.drawVLineEdgeFade(mc, colors.right1, y, y+height, x+width-1, 5); ! } //****************************************************** --- 141,219 ---- } ! private function drawBorderButtonUp(mc:MovieClip, rect:NSRect) { var x = rect.origin.x; var y = rect.origin.y; var width = rect.size.width-1; var height = rect.size.height-1; ! ASDraw.drawFill(mc, 0xC7CAD1, x, y, width, height); ASDraw.drawRect(mc, 1, 0, x, y, width, height); } ! ! private function drawBorderButtonDown(mc:MovieClip, rect:NSRect) { var x = rect.origin.x; var y = rect.origin.y; var width = rect.size.width-1; var height = rect.size.height-1; ! ASDraw.drawFill(mc, 0xB1B5BC, x, y, width, height); ! ASDraw.drawRect(mc, 1, 0, x, y, width, height); ! } ! ! /////////////////////////////// ! // BUTTON DRAW FUNCTIONS ! private static var drawButtonUp_outlineColors:Array = [0x82858E, 0xD3D6DB]; ! private static var drawButtonUp_inlineColors:Array = [0xDFE2E9, 0x858992]; ! private static var drawButtonUp_colors:Array = [0xEEF2F5, 0xC7CAD1, 0xC7CAD1, 0x858992]; ! private static var drawButtonUp_ratios:Array = [ 1, 5, 23, 26]; ! private function drawButtonUp(mc:MovieClip, rect:NSRect) ! { ! drawButtonUpWithoutBorder(mc, rect.insetRect(1,1)); ! ASDraw.outlineRectWithRect( mc, rect, drawButtonUp_outlineColors); ! } ! private function drawButtonUpWithoutBorder(mc:MovieClip, rect:NSRect) ! { ! ASDraw.gradientRectWithRect(mc, rect, ANGLE_TOP_TO_BOTTOM, drawButtonUp_colors, drawButtonUp_ratios); ! ASDraw.outlineRectWithRect( mc, rect, drawButtonUp_inlineColors); ! } ! private static var drawButtonDown_outlineColors:Array = [0x82858E, 0xECEDF0]; ! private static var drawButtonDown_inlineColors:Array = [0x696F79, 0xD4D6DB]; ! private static var drawButtonDown_colors:Array = [0x696F79, 0xB1B5BC, 0xB1B5BC, 0xD9DBDF, 0xC9CDD2]; ! private static var drawButtonDown_ratios:Array = [ 1, 5, 23, 25, 26]; ! private function drawButtonDown(mc:MovieClip, rect:NSRect) ! { ! drawButtonDownWithoutBorder(mc, rect.insetRect(1,1)); ! ASDraw.outlineRectWithRect( mc, rect, drawButtonDown_outlineColors); ! } ! ! private function drawButtonDownWithoutBorder(mc:MovieClip, rect:NSRect) ! { ! ASDraw.gradientRectWithRect(mc, rect, ANGLE_TOP_TO_BOTTOM, drawButtonDown_colors, drawButtonDown_ratios); ! ASDraw.outlineRectWithRect( mc, rect, drawButtonDown_inlineColors); ! } ! ! ! // END BUTTON DRAW FUNCTIONS ! /////////////////////////////// ! ! /////////////////////////////// ! // TEXTFIELD DRAW FUNCTIONS ! private static var drawTextfield_outlineColors:Array = [0x4B4F57, 0xDEE1E6]; ! private static var drawTextfield_colors:Array = [0x80848F, 0xAFB4BA, 0xCACDD2]; ! private static var drawTextfield_ratios:Array = [ 0, 6, 24]; ! private static var drawTextfieldShadow_colors:Array = [0x767A85, 0xB6BBC1]; ! private static var drawTextfieldShadow_alphas:Array = [ 100, 0]; ! private static var drawTextfieldShadow_ratios:Array = [ 0, 5]; ! private function drawTextfield(mc:MovieClip, rect:NSRect) ! { ! var insetRect:NSRect = rect.insetRect(1,1); ! ASDraw.gradientRectWithRect( mc, rect, ANGLE_TOP_TO_BOTTOM, drawTextfield_colors, drawTextfield_ratios); ! ASDraw.gradientRectWithAlphaRect(mc, new NSRect(rect.origin.x, rect.origin.y, 5, rect.size.height), 30, ! drawTextfieldShadow_colors, drawTextfieldShadow_ratios, drawTextfieldShadow_alphas); ! ASDraw.outlineRectWithRect( mc, rect, drawTextfield_outlineColors); ! } ! // END TEXTFIELD DRAW FUNCTIONS ! /////////////////////////////// //****************************************************** Index: ASDraw.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASDraw.as,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ASDraw.as 17 May 2005 03:23:38 -0000 1.5 --- ASDraw.as 20 May 2005 19:59:09 -0000 1.6 *************** *** 29,37 **** */ ! 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); } --- 29,40 ---- */ ! import org.actionstep.NSRect; ! import org.actionstep.NSPoint; ! ! 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) { ! drawLineSimple(mc, lineColor, x1, x2, y1, y1); } *************** *** 44,48 **** } y2 += 1; ! drawLine(mc, lineColor, x1, x1, y1, y2); } --- 47,51 ---- } y2 += 1; ! drawLineSimple(mc, lineColor, x1, x1, y1, y2); } *************** *** 55,59 **** } 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); --- 58,62 ---- } y2 += 1; ! drawLineSimple(mc, lineColor, x1, x1, y1+edge, y2-edge); drawLineFade(mc, lineColor, x1, x1, y1+edge, y1); drawLineFade(mc, lineColor, x1, x1, y2-edge, y2); *************** *** 68,72 **** } 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); --- 71,75 ---- } x2 += 1; ! drawLineSimple(mc, lineColor, x1+edge, x2-edge, y1, y1); drawLineFade(mc, lineColor, x1+edge, x1, y1, y1); drawLineFade(mc, lineColor, x2-edge, x2, y1, y1); *************** *** 85,89 **** } ! public static function drawLine(mc:MovieClip, lineColor:Number, x1:Number, x2:Number, y1:Number, y2:Number) { drawLineShared(mc, lineColor, false, x1, x2, y1, y2); } --- 88,92 ---- } ! public static function drawLineSimple(mc:MovieClip, lineColor:Number, x1:Number, x2:Number, y1:Number, y2:Number) { drawLineShared(mc, lineColor, false, x1, x2, y1, y2); } *************** *** 359,383 **** } - // ----------- 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 ---------- // --- 362,365 ---- *************** *** 607,609 **** --- 589,997 ---- return Math.atan2( base, height ) } + + /** + * The following methods are the new draw methods. + * The methods above this are being phased out. + */ + + /////////////////////////////////////////// + // BASIC DRAWING METHODS + + //POINTS + + //TODO find out if there is a way to draw a pixel other than doing a 1 pixel solid fill + //TODO also find out if there is a way to get the effing rectangle to draw its own bottom-right corner. + public static function drawPoint(mc:MovieClip, x:Number, y:Number, color:Number){ + solidRect(mc, x, y, 1, 1, color); + } + + public static function drawPointWithAlpha(mc:MovieClip, x:Number, y:Number, color:Number, alpha:Number){ + solidRectWithAlpha(mc, x, y, 1, 1, color, alpha); + } + + static var DEFAULT_LINE_THICKNESS = 1; + static var DEFAULT_ALPHA = 100; + + //LINES + + public static function drawLine(mc:MovieClip, startX:Number, startY:Number, endX:Number, endY:Number, color:Number){ + drawLineWithAlpha(mc, startX, startY, endX, endY, color, DEFAULT_ALPHA); + } + + public static function drawLineWithAlpha(mc:MovieClip, startX:Number, startY:Number, endX:Number, endY:Number, color:Number, alpha:Number){ + mc.lineStyle(DEFAULT_LINE_THICKNESS, color, alpha); + mc.moveTo( startX, startY); + mc.lineTo( endX, endY); + } + + public static function drawLineWithPoint(mc:MovieClip, start:NSPoint, end:NSPoint, color:Number){ + drawLineWithAlpha(mc, start.x, start.y, end.x, end.y, color, DEFAULT_ALPHA); + } + + public static function drawLineWithAlphaPoint(mc:MovieClip, start:NSPoint, end:NSPoint, color:Number, alpha:Number){ + drawLineWithAlpha(mc, start.x, start.y, end.x, end.y, color, alpha); + } + + // END BASIC DRAWING METHODS + /////////////////////////////////////////// + + + /////////////////////////////////////////// + // OUTLINE RECT METHODS + public static function outlineRectWithRect(mc:MovieClip, rect:NSRect, colors:Array, ratios:Array){ + outlineRect(mc, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height, colors); + } + + public static function outlineRectWithAlphaRect(mc:MovieClip, rect:NSRect, colors:Array, alphas:Array){ + outlineRectWithAlpha(mc, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height, colors, alphas); + } + + public static function outlineRect(mc:MovieClip, x:Number, y:Number, width:Number, height:Number, colors:Array){ + var alphas:Array = buildArray(colors.length, 100); + outlineRectWithAlpha(mc, x, y, width, height, colors, alphas); + } + + public static function outlineRectWithAlpha(mc:MovieClip, x:Number, y:Number, width:Number, height:Number, colors:Array, alphas:Array){ + // mc.beginGradientFill("linear",colors,alphas,actualRatios,matrix); + + colors = getArrayOfFour(colors); + alphas = getArrayOfFour(alphas); + + //change width and height so that the total width/height, including line thickness is the given width/height. + var x2 = x + width -1; + var y2 = y + height -1; + var lineThickness = 1; + + mc.lineStyle(lineThickness, colors[0], alphas[0]); + mc.moveTo( x, y); + mc.lineTo(x2, y); + + //TODO Why the eff won't the bottom right pixel draw? + mc.lineStyle(lineThickness, colors[1], alphas[1]); + mc.lineTo(x2, y2); + + + mc.lineStyle(lineThickness, colors[2], alphas[2]); + mc.lineTo( x, y2); + + mc.lineStyle(lineThickness, colors[3], alphas[3]); + mc.lineTo( x, y); + + // need to draw the bottom right pixel separately for some reason. + // I can't get any line to draw there, so I'm using the 'pixel' method, which is actually a fill. + + //TRACE("DRAW POINT: x2=" + x2 + ", y2=" + y2 + ", color=" + colors[1] + ", alpha=" + alphas[1]); + + drawPointWithAlpha(mc, x2, y2, colors[1], alphas[1]); + + // mc.endFill(); + } + // END OUTLINE RECT METHODS + /////////////////////////////////////////// + + + /////////////////////////////////////////// + // OUTLINE RECT METHODS + public static function solidRectWithRect(mc:MovieClip, rect:NSRect, color:Number){ + solidRect(mc, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height, color); + } + + public static function solidRectWithAlphaRect(mc:MovieClip, rect:NSRect, color:Number, alpha:Number){ + solidRectWithAlpha(mc, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height, color, alpha); + } + + public static function solidRect(mc:MovieClip, x:Number, y:Number, width:Number, height:Number, color:Number){ + var alpha:Number = 100; + solidRectWithAlpha(mc, x, y, width, height, color, alpha); + } + + public static function solidRectWithAlpha(mc:MovieClip, x:Number, y:Number, width:Number, height:Number, color:Number, alpha:Number){ + + //TRACE("SOLID RECT WITH ALPHA: x=" + x + ", y=" + y + ", width=" + width + ", height=" + height + ", color=" + color + ", alpha=" + alpha); + + mc.lineStyle(undefined, 0, 100); + mc.beginFill(color,alpha); + mc.moveTo(x,y); + mc.lineTo(x+width, y); + mc.lineTo(x+width, y+height); + mc.lineTo(x, y+height); + mc.lineTo(x, y); + mc.endFill(); + } + // END SOLID RECT METHODS + /////////////////////////////////////////// + + + /////////////////////////////////////////// + // GRADIENT RECT METHODS + // + //I think I should make versions of these methods with NSrects instead of x,y,w,h as well. + //for now naming it 'WithRect' to imply that the gradient should also be a rect + //TODO decide on a documentation format for these methods. + //currently using WITH to specify additional params, and then listing params alphabetically. + //Maybe that should be the order as well? + //-gradientRectWithAlpha + //this one uses no outline since they are rarely a single color in our skins. + //this one will also uses no alpha just to keep things simple. for now it's in. + //this one makes the matrix the same size as the rect, again to be simple. + //this one takes an angel, a color array and a ratio array to keep things flexible. + // + public static function gradientRectWithRect(mc:MovieClip, rect:NSRect, angle:Number, colors:Array, ratios:Array){ + gradientRect(mc, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height, angle, colors, ratios); + } + + public static function gradientRectWithAlphaRect(mc:MovieClip, rect:NSRect, angle:Number, colors:Array, ratios:Array, alphas:Array){ + gradientRectWithAlpha(mc, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height, angle, colors, ratios, alphas); + } + + public static function gradientRect(mc:MovieClip, x:Number, y:Number, width:Number, height:Number, + angle:Number, colors:Array, ratios:Array){ + var alphas:Array = buildArray(colors.length, 100); + gradientRectWithAlpha(mc, x, y, width, height, angle, colors, ratios, alphas); + } + + public static function gradientRectWithAlpha(mc:MovieClip, x:Number, y:Number, width:Number, height:Number, + angle:Number, colors:Array, ratios:Array, alphas:Array){ + var radians:Number = getRadiansFromAngle(angle); + var matrix = getMatrix(new NSRect(x, y, width, height), angle); + var actualRatios:Array = getActualRatios(ratios); + + mc.lineStyle(undefined, 0, 100); + mc.beginGradientFill("linear",colors,alphas,actualRatios,matrix); + mc.moveTo(x,y); + mc.lineTo(x+width, y); + mc.lineTo(x+width, y+height); + mc.lineTo(x, y+height); + mc.lineTo(x, y); + mc.endFill(); + } + // END GRADIENT RECT METHODS + /////////////////////////////////////////// + + + /////////////////////////////////////////// + // DRAW ELLIPSE METHODS + // + public static function gradientEllipseWithRect(mc:MovieClip, rect:NSRect, colors:Array, ratios:Array){ + gradientEllipse(mc, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height, colors, ratios); + } + + public static function gradientEllipseWithAlphaRect(mc:MovieClip, rect:NSRect, colors:Array, ratios:Array, alphas:Array){ + gradientEllipseWithAlpha(mc, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height, colors, ratios, alphas); + } + + public static function gradientEllipse(mc:MovieClip, x:Number, y:Number, width:Number, height:Number, + colors:Array, ratios:Array){ + var alphas:Array = buildArray(colors.length, 100); + gradientEllipseWithAlpha(mc, x, y, width, height, colors, ratios, alphas); + } + + //top-left with diameters. not center with radii. + public static function gradientEllipseWithAlpha(mc:MovieClip, x:Number, y:Number, width:Number, height:Number, + colors:Array, ratios:Array, alphas:Array){ + var rect = new NSRect(x, y, width, height); + var matrix = getMatrix(rect); + var actualRatios:Array = getActualRatios(ratios); + + mc.lineStyle(undefined, 0, 100); + mc.beginGradientFill("radial",colors,alphas,actualRatios,matrix); + drawEllipse(mc, x, y, width, height); + mc.endFill(); + } + + //taken from AcionScript cookbook's DrawingMethods.as (modified the param order) + //the original used center origin and radius. this one uses top-left origin and width/height. + public static function drawEllipse(mc:MovieClip, xTopLeft, yTopLeft, width, height) { + var radiusRect = getRadiusRect(new NSRect(xTopLeft, yTopLeft, width, height)); + var x = radiusRect.origin.x; + var y = radiusRect.origin.y; + var xRadius = radiusRect.size.width; + var yRadius = radiusRect.size.height; + var angleDelta = Math.PI / 4; + + // TRACE("xTopLeft[" + xTopLeft + "] yTopLeft[" + yTopLeft + "] width[" + width + "] height[" + height + "]"); + // TRACE(" x[" + x + "] y[" + y + "] width[" + xRadius + "] height[" + yRadius + "]"); + + // Whereas the circle has only one distance to the control point + // for each segment, the ellipse has two distances: one that + // corresponds to xRadius and another that corresponds to yRadius. + var xCtrlDist = xRadius/Math.cos(angleDelta/2); + var yCtrlDist = yRadius/Math.cos(angleDelta/2); + var rx, ry, ax, ay; + mc.moveTo(x + xRadius, y); + var angle = 0; + for (var i = 0; i < 8; i++) { + angle += angleDelta; + rx = x + Math.cos(angle-(angleDelta/2))*(xCtrlDist); + ry = y + Math.sin(angle-(angleDelta/2))*(yCtrlDist); + ax = x + Math.cos(angle)*xRadius; + ay = y + Math.sin(angle)*yRadius; + mc.curveTo(rx, ry, ax, ay); + } + } + // END DRAW ELLIPSE METHODS + /////////////////////////////////////////// + + + /////////////////////////////////////////// + // MISC HELPER FUNCTIONS + + // this helper function builds an array of length four from an array of 1 or 2 + // this is helpful for the various rect methods that use different params for the 4 sides. + public static function getArrayOfFour(originalArray:Array){ + + var array:Array = originalArray; + var size = originalArray.length; + if (size == 4){ + //do nothing. this is just to avoid unnecessary checks. + } + else if (size == 1){ + array = [originalArray[0], originalArray[0], originalArray[0], originalArray[0]]; + } + else if (size == 2){ + array = [originalArray[0], originalArray[1], originalArray[1], originalArray[0]]; + } + return array; + } + + // END MISC HELPER FUNCTIONS + /////////////////////////////////////////// + + + /////////////////////////////////////////// + // GRADIENT HELPER FUNCTIONS + + //This method translate an array of numerical values into the ratio format Flash uses for gradients. + //Flash requires a ratio be an array of numbers starting with 0 and ending with 255. + //If those values are already set, then the arry is returned as is, otherwise the numbers are translated to that scale. + //TODO explain this more. + public static function getActualRatios(ratios:Array){ + return getActualNumbers(ratios, 0, 255); + } + + //this actually doesn't make any sense, since alphas don't have to start at 0 and end at 100. + /* + public static function getActualAlphas(alphas:Array){ + return getActualNumbers(alphas, 0, 100); + } + */ + + //This method translate an array of numerical values into the specified format. + //This method is used by other methods that have specific value requirements for Muber Arrays. + public static function getActualNumbers(values:Array, minNumber:Number, maxNumber:Number){ + var size = values.length; + var minValue = values[0]; + var maxValue = values[size-1]; + if (minValue == minNumber && maxValue == maxNumber){ + return values; + } + var actualValues:Array = new Array(); + var value:Number; + var actualValue:Number; + //the idea here is to change the original values to proporionally equivalent values from minValue to maxValue. + //all numbers are adjusted so that the first number starts at minValue and the last in maxValue. + for (var i:Number = 0; i < size; i++){ + value = values[i] - minValue + minNumber; + actualValue = (value/maxValue)*maxNumber; + actualValues.push(actualValue); + //TRACE("actual numbers: original=" + value + " | new=" + actualValue); + } + return actualValues; + } + + public static function buildArray(size:Number, initValue:Number){ + var array:Array = new Array(); + for (var i:Number = 0; i < size; i++){ + array.push(initValue); + } + return array; + } + + public static function getMatrix(rect:NSRect, angle:Number){ + var radians:Number = getRadiansFromAngle(angle); + var matrix = { matrixType:"box", x:rect.origin.x, y:rect.origin.y, w:rect.size.width, h:rect.size.height, r: radians }; + return matrix; + } + + //the rect param is a normal top/left rect, not a radiusRect + public static function getRadialMatrix(rect:NSRect){ + var width = rect.size.width; + var height = rect.size.height; + var matrix = { matrixType:"box", x:-width/2, y:-height/2, w:width, h:height, r: 0 }; + return matrix; + } + + public static function getRadiansFromAngle(angle:Number){ + var radians:Number = angle == 0 ? 0 : (angle/180)*Math.PI; + return radians; + } + + // END GRADIENT HELPER FUNCTIONS + /////////////////////////////////////////// + + /////////////////////////////////////////// + // NSPOINT CONVENIENCE FUNCTIONS + + public static function getOffsetPoint(point:NSPoint, dx:Number, dy:Number):NSPoint { + return new NSPoint(point.x + dx, point.y + dy); + } + + // END NSPOINT CONVENIENCE FUNCTIONS + /////////////////////////////////////////// + + + /////////////////////////////////////////// + // NSRECT CONVENIENCE FUNCTIONS + + public static function getRadiusRect(rect:NSRect){ + var xRadius = rect.size.width/2; + var yRadius = rect.size.height/2; + var x = rect.origin.x + xRadius; + var y = rect.origin.y + yRadius; + return new NSRect(x, y, xRadius, yRadius); + } + + //adds a percent of the width to x + //adds a percent of the height to y + //sets width to a percent of width + //sets height to a percent of height + public static function getScaledPercentRect(rect:NSRect, xPercent:Number, yPercent:Number, widthPercent:Number, heightPercent:Number) + { + var x = rect.origin.x; + var y = rect.origin.y; + var width = rect.size.width; + var height = rect.size.height; + + x = x + width*xPercent*.01; + y = y + height*yPercent*.01; + height = height*widthPercent*.01; + width = width*heightPercent*.01; + + var scaledRect = new NSRect(x, y, width, height); + return scaledRect; + } + + //adds given pixel to x, y, width and height + public static function getScaledPixelRect(rect:NSRect, xPixel:Number, yPixel:Number, widthPixel:Number, heightPixel:Number) + { + var x = rect.origin.x; + var y = rect.origin.y; + var width = rect.size.width; + var height = rect.size.height; + + x = x + xPixel; + y = y + yPixel; + width = width + widthPixel; + height = height + heightPixel; + + var scaledRect = new NSRect(x, y, width, height); + return scaledRect; + } + + // END NSRECT CONVENIENCE FUNCTIONS + /////////////////////////////////////////// + + + + } \ No newline at end of file |
From: Richard K. <ric...@us...> - 2005-05-20 19:58:28
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16208 Added Files: ASHighlightedScrollerDownArrowRep.as ASHighlightedScrollerLeftArrowRep.as ASHighlightedScrollerRightArrowRep.as ASHighlightedScrollerUpArrowRep.as ASScrollerDownArrowRep.as ASScrollerLeftArrowRep.as ASScrollerRightArrowRep.as ASScrollerUpArrowRep.as Log Message: added scroller bitmaps --- NEW FILE: ASScrollerUpArrowRep.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.NSImageRep; import org.actionstep.NSSize; //import org.actionstep.ASDraw; class org.actionstep.images.ASScrollerUpArrowRep extends NSImageRep { public function ASScrollerUpArrowRep() { m_size = new NSSize(9,9); } public function description():String { return "ASScrollerUpArrowRep"; } public function draw() { var x = m_drawPoint.x; var y = m_drawPoint.y; var width = m_drawRect.size.width; var height = m_drawRect.size.height; m_drawClip.lineStyle(1, 0xF6F8F9, 100); m_drawClip.moveTo(x, y+height); m_drawClip.lineTo(x + width, y+height); m_drawClip.lineTo(x + width/2, y); m_drawClip.lineStyle(1, 0x696E79, 100); m_drawClip.lineTo(x, y+height); } } --- NEW FILE: ASHighlightedScrollerRightArrowRep.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.NSImageRep; import org.actionstep.NSSize; //import org.actionstep.ASDraw; class org.actionstep.images.ASHighlightedScrollerRightArrowRep extends NSImageRep { public function ASHighlightedScrollerRightArrowRep() { m_size = new NSSize(9,9); } public function description():String { return "ASHighlightedScrollerRightArrowRep"; } public function draw() { var x = m_drawPoint.x; var y = m_drawPoint.y; var width = m_drawRect.size.width; var height = m_drawRect.size.height; m_drawClip.lineStyle(1, 0x696E79, 100); m_drawClip.moveTo(x, y+height); m_drawClip.lineTo(x, y); m_drawClip.lineTo(x + width, y+height/2); m_drawClip.lineStyle(1, 0xF6F8F9, 100); m_drawClip.lineTo(x, y+height); } } --- NEW FILE: ASScrollerDownArrowRep.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.NSImageRep; import org.actionstep.NSSize; //import org.actionstep.ASDraw; class org.actionstep.images.ASScrollerDownArrowRep extends NSImageRep { public function ASScrollerDownArrowRep() { m_size = new NSSize(9,9); } public function description():String { return "ASScrollerDownArrowRep"; } public function draw() { var x = m_drawPoint.x; var y = m_drawPoint.y; var width = m_drawRect.size.width; var height = m_drawRect.size.height; m_drawClip.lineStyle(1, 0x696E79, 100); m_drawClip.moveTo(x, y); m_drawClip.lineTo(x + width, y); m_drawClip.lineStyle(1, 0xF6F8F9, 100); m_drawClip.lineTo(x + width/2, y + height); m_drawClip.lineStyle(1, 0x696E79, 100); m_drawClip.lineTo(x, y); } } --- NEW FILE: ASHighlightedScrollerLeftArrowRep.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.NSImageRep; import org.actionstep.NSSize; //import org.actionstep.ASDraw; class org.actionstep.images.ASHighlightedScrollerLeftArrowRep extends NSImageRep { public function ASHighlightedScrollerLeftArrowRep() { m_size = new NSSize(9,9); } public function description():String { return "ASHighlightedScrollerLeftArrowRep"; } public function draw() { var x = m_drawPoint.x; var y = m_drawPoint.y; var width = m_drawRect.size.width; var height = m_drawRect.size.height; m_drawClip.lineStyle(1, 0x696E79, 100); m_drawClip.moveTo(x, y + height/2); m_drawClip.lineTo(x + width, y); m_drawClip.lineStyle(1, 0xF6F8F9, 100); m_drawClip.lineTo(x + width, y+height); m_drawClip.lineTo(x, y + height/2); } } --- NEW FILE: ASScrollerRightArrowRep.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.NSImageRep; import org.actionstep.NSSize; //import org.actionstep.ASDraw; class org.actionstep.images.ASScrollerRightArrowRep extends NSImageRep { public function ASScrollerRightArrowRep() { m_size = new NSSize(9,9); } public function description():String { return "ASScrollerRightArrowRep"; } public function draw() { var x = m_drawPoint.x; var y = m_drawPoint.y; var width = m_drawRect.size.width; var height = m_drawRect.size.height; m_drawClip.lineStyle(1, 0x696E79, 100); m_drawClip.moveTo(x, y+height); m_drawClip.lineTo(x, y); m_drawClip.lineTo(x + width, y+height/2); m_drawClip.lineStyle(1, 0xF6F8F9, 100); m_drawClip.lineTo(x, y+height); } } --- NEW FILE: ASScrollerLeftArrowRep.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.NSImageRep; import org.actionstep.NSSize; //import org.actionstep.ASDraw; class org.actionstep.images.ASScrollerLeftArrowRep extends NSImageRep { public function ASScrollerLeftArrowRep() { m_size = new NSSize(9,9); } public function description():String { return "ASScrollerLeftArrowRep"; } public function draw() { var x = m_drawPoint.x; var y = m_drawPoint.y; var width = m_drawRect.size.width; var height = m_drawRect.size.height; m_drawClip.lineStyle(1, 0x696E79, 100); m_drawClip.moveTo(x, y + height/2); m_drawClip.lineTo(x + width, y); m_drawClip.lineStyle(1, 0xF6F8F9, 100); m_drawClip.lineTo(x + width, y+height); m_drawClip.lineTo(x, y + height/2); } } --- NEW FILE: ASHighlightedScrollerUpArrowRep.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.NSImageRep; import org.actionstep.NSSize; //import org.actionstep.ASDraw; class org.actionstep.images.ASHighlightedScrollerUpArrowRep extends NSImageRep { public function ASHighlightedScrollerUpArrowRep() { m_size = new NSSize(9,9); } public function description():String { return "ASHighlightedScrollerUpArrowRep"; } public function draw() { var x = m_drawPoint.x; var y = m_drawPoint.y; var width = m_drawRect.size.width; var height = m_drawRect.size.height; m_drawClip.lineStyle(1, 0xF6F8F9, 100); m_drawClip.moveTo(x, y+height); m_drawClip.lineTo(x + width, y+height); m_drawClip.lineTo(x + width/2, y); m_drawClip.lineStyle(1, 0x696E79, 100); m_drawClip.lineTo(x, y+height); } } --- NEW FILE: ASHighlightedScrollerDownArrowRep.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.NSImageRep; import org.actionstep.NSSize; //import org.actionstep.ASDraw; class org.actionstep.images.ASHighlightedScrollerDownArrowRep extends NSImageRep { public function ASHighlightedScrollerDownArrowRep() { m_size = new NSSize(9,9); } public function description():String { return "ASHighlightedScrollerDownArrowRep"; } public function draw() { var x = m_drawPoint.x; var y = m_drawPoint.y; var width = m_drawRect.size.width; var height = m_drawRect.size.height; m_drawClip.lineStyle(1, 0x696E79, 100); m_drawClip.moveTo(x, y); m_drawClip.lineTo(x + width, y); m_drawClip.lineStyle(1, 0xF6F8F9, 100); m_drawClip.lineTo(x + width/2, y + height); m_drawClip.lineStyle(1, 0x696E79, 100); m_drawClip.lineTo(x, y); } } |
From: Richard K. <ric...@us...> - 2005-05-19 13:40:52
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23292 Modified Files: NSEvent.as NSButton.as Log Message: remove trace statements and add delay/interval methods to nsbutton Index: NSButton.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSButton.as,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NSButton.as 12 May 2005 19:38:26 -0000 1.4 --- NSButton.as 19 May 2005 13:40:43 -0000 1.5 *************** *** 84,87 **** --- 84,98 ---- } + // Setting the repeat interval + + public function getPeriodicDelayInterval():Object { + return NSButtonCell(m_cell).getPeriodicDelayInterval(); + } + + public function setPeriodicDelayInterval(delay:Number, interval:Number) { + NSButtonCell(m_cell).setPeriodicDelayInterval(delay, interval); + } + + // Setting the titles Index: NSEvent.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSEvent.as,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** NSEvent.as 18 May 2005 22:06:55 -0000 1.5 --- NSEvent.as 19 May 2005 13:40:43 -0000 1.6 *************** *** 263,267 **** public static function startPeriodicEventsAfterDelayWithPeriod(delay:Number, period:Number) { - TRACE("Staring periodic events"); g_periodicTimer = new NSTimer(); var startDate = new Date(); --- 263,266 ---- *************** *** 272,276 **** public static function stopPeriodicEvents() { - TRACE("Stopping periodic events"); if (g_periodicTimer != null) { g_periodicTimer.invalidate(); --- 271,274 ---- |
From: Richard K. <ric...@us...> - 2005-05-18 22:08:09
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16840 Modified Files: ASThemeProtocol.as ASTheme.as Log Message: comment out unused imports Index: ASTheme.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASTheme.as,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ASTheme.as 17 May 2005 16:26:27 -0000 1.5 --- ASTheme.as 18 May 2005 22:08:00 -0000 1.6 *************** *** 151,156 **** } - - public function drawTextFieldWithRectInView(rect:NSRect, view:NSView) { var x = rect.origin.x; --- 151,154 ---- Index: ASThemeProtocol.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASThemeProtocol.as,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ASThemeProtocol.as 17 May 2005 16:26:29 -0000 1.5 --- ASThemeProtocol.as 18 May 2005 22:08:00 -0000 1.6 *************** *** 29,34 **** */ ! import org.actionstep.NSSize; ! import org.actionstep.NSPoint; import org.actionstep.NSRect; import org.actionstep.NSColor; --- 29,34 ---- */ ! //import org.actionstep.NSSize; ! //import org.actionstep.NSPoint; import org.actionstep.NSRect; import org.actionstep.NSColor; |
From: Richard K. <ric...@us...> - 2005-05-18 22:07:33
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16636 Modified Files: NSEvent.as NSControl.as NSCell.as ASEventMonitor.as NSButtonCell.as Log Message: got periodic events working! Index: ASEventMonitor.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASEventMonitor.as,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ASEventMonitor.as 6 May 2005 04:27:00 -0000 1.5 --- ASEventMonitor.as 18 May 2005 22:06:55 -0000 1.6 *************** *** 86,89 **** --- 86,97 ---- } + public function postPeriodicEvent() { + var modifierFlags = buildModifierFlags(); + var event = NSEvent.otherEventWithType(NSEvent.NSPeriodic, new NSPoint(_root._xmouse, _root._ymouse), + modifierFlags, (new Date()).getTime(), eval(m_mouseTrackingClip._dropTarget).view, + null /* context*/, 0 /*subType */, null /*data1 */, null /*data 2*/); + m_app.sendEvent(event); + } + private function mouseDown(targetPath:String) { var modifierFlags = buildModifierFlags(); Index: NSButtonCell.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSButtonCell.as,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** NSButtonCell.as 17 May 2005 16:26:29 -0000 1.15 --- NSButtonCell.as 18 May 2005 22:06:55 -0000 1.16 *************** *** 74,77 **** --- 74,80 ---- private var m_bcellTransparent:Boolean; private var m_backgroundColor:NSColor; + private var m_periodicInterval:Number; + private var m_periodicDelay:Number; + public function NSButtonCell() { *************** *** 186,189 **** --- 189,206 ---- } + // Setting the repeat interval + + /** + * Returns an object with delay and interval properties + */ + public function getPeriodicDelayInterval():Object { + return {delay:m_periodicDelay, interval:m_periodicInterval}; + } + + public function setPeriodicDelayInterval(delay:Number, interval:Number) { + m_periodicDelay = delay; + m_periodicInterval = interval; + } + // Setting the key equivalent Index: NSCell.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSCell.as,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** NSCell.as 12 May 2005 19:38:26 -0000 1.9 --- NSCell.as 18 May 2005 22:06:55 -0000 1.10 *************** *** 99,102 **** --- 99,105 ---- private var m_controlTint:NSControlTint; private var m_controlView:NSView; + private var m_app:NSApplication; + private var m_periodicInterval:Number; + private var m_periodicDelay:Number; // An AS method cannot block, so a callback is needed for tracking mouse events *************** *** 129,132 **** --- 132,136 ---- m_controlTint = NSControlTint.NSDefaultControlTint; m_controlView = null; + m_app = NSApplication.sharedApplication(); } *************** *** 645,648 **** --- 649,654 ---- location: location, untilMouseUp: untilMouseUp, + action: action(), + target: target(), view: view, lastPoint: point, *************** *** 650,654 **** | NSEvent.NSMouseMovedMask | NSEvent.NSOtherMouseDraggedMask | NSEvent.NSRightMouseDraggedMask }; ! NSApplication.sharedApplication().callObjectSelectorWithNextEventMatchingMaskDequeue(this, "mouseTrackingCallback", m_trackingData.eventMask, true); } --- 656,665 ---- | NSEvent.NSMouseMovedMask | NSEvent.NSOtherMouseDraggedMask | NSEvent.NSRightMouseDraggedMask }; ! if(m_actionMask & NSEvent.NSPeriodicMask) { ! var times = getPeriodicDelayInterval(); ! NSEvent.startPeriodicEventsAfterDelayWithPeriod(times.delay, times.interval); ! m_trackingData.eventMask |= NSEvent.NSPeriodicMask; ! } ! m_app.callObjectSelectorWithNextEventMatchingMaskDequeue(this, "mouseTrackingCallback", m_trackingData.eventMask, true); } *************** *** 662,674 **** if (event.type == NSEvent.NSLeftMouseUp) { // mouse up? stopTrackingAtInViewMouseIsUp(m_trackingData.lastPoint, point, controlView(), true); ! //here ! m_trackingCallback[m_trackingCallbackSelector].call(m_trackingCallback, true); } else { // no mouse up if (continueTrackingAtInView(m_trackingData.lastPoint, point, controlView())) { m_trackingData.lastPoint = point; ! NSApplication.sharedApplication().callObjectSelectorWithNextEventMatchingMaskDequeue(this, "mouseTrackingCallback", m_trackingData.eventMask, true); } else { // don't continue...no mouse up stopTrackingAtInViewMouseIsUp(m_trackingData.lastPoint, point, controlView(), false); m_trackingCallback[m_trackingCallbackSelector].call(m_trackingCallback, false); } --- 673,694 ---- if (event.type == NSEvent.NSLeftMouseUp) { // mouse up? stopTrackingAtInViewMouseIsUp(m_trackingData.lastPoint, point, controlView(), true); ! setNextState(); ! m_trackingData.view.sendActionTo(m_trackingData.action, m_trackingData.target); ! if (m_actionMask & NSEvent.NSPeriodicMask) { ! NSEvent.stopPeriodicEvents(); ! } m_trackingCallback[m_trackingCallbackSelector].call(m_trackingCallback, true); } else { // no mouse up + if (event.type == NSEvent.NSPeriodic && m_actionMask & NSEvent.NSPeriodicMask) { //! Dragged too? + m_trackingData.view.sendActionTo(m_trackingData.action, m_trackingData.target); + } if (continueTrackingAtInView(m_trackingData.lastPoint, point, controlView())) { m_trackingData.lastPoint = point; ! m_app.callObjectSelectorWithNextEventMatchingMaskDequeue(this, "mouseTrackingCallback", m_trackingData.eventMask, true); } else { // don't continue...no mouse up stopTrackingAtInViewMouseIsUp(m_trackingData.lastPoint, point, controlView(), false); + if (m_actionMask & NSEvent.NSPeriodicMask) { + NSEvent.stopPeriodicEvents(); + } m_trackingCallback[m_trackingCallbackSelector].call(m_trackingCallback, false); } *************** *** 676,679 **** --- 696,706 ---- } } + + /** + * Returns an object with delay and interval properties + */ + public function getPeriodicDelayInterval():Object { + return {delay:.1, interval:.1}; + } public function startTrackingAtInView(startPoint:NSPoint, Index: NSControl.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSControl.as,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** NSControl.as 17 May 2005 03:21:19 -0000 1.8 --- NSControl.as 18 May 2005 22:06:55 -0000 1.9 *************** *** 447,460 **** public function cellTrackingCallback(mouseUp:Boolean) { if(mouseUp) { - m_cell.setHighlighted(false); - m_cell.setNextState(); - setNeedsDisplay(true); m_cell.sendActionOn(m_trackingData.actionMask); - sendActionTo(action(), target()); m_cell.setTrackingCallbackSelector(null, null); } else { - m_cell.setHighlighted(false); - setNeedsDisplay(true); NSApplication.sharedApplication().callObjectSelectorWithNextEventMatchingMaskDequeue(this, "mouseTrackingCallback", m_trackingData.eventMask, true); } --- 447,456 ---- public function cellTrackingCallback(mouseUp:Boolean) { + m_cell.setHighlighted(false); + setNeedsDisplay(true); if(mouseUp) { m_cell.sendActionOn(m_trackingData.actionMask); m_cell.setTrackingCallbackSelector(null, null); } else { NSApplication.sharedApplication().callObjectSelectorWithNextEventMatchingMaskDequeue(this, "mouseTrackingCallback", m_trackingData.eventMask, true); } Index: NSEvent.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSEvent.as,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NSEvent.as 17 May 2005 03:21:19 -0000 1.4 --- NSEvent.as 18 May 2005 22:06:55 -0000 1.5 *************** *** 33,36 **** --- 33,39 ---- import org.actionstep.NSView; import org.actionstep.NSWindow; + import org.actionstep.NSTimer; + + import org.actionstep.ASEventMonitor; class org.actionstep.NSEvent extends NSObject { *************** *** 119,122 **** --- 122,126 ---- private static var g_instance:NSEvent = (new NSEvent()).init(); + private static var g_periodicTimer:NSTimer; // static constructors *************** *** 225,229 **** public static function otherEventWithType(type:Number, location:NSPoint, modifierFlags:Number, ! timestamp:Number, windowNumber:Number, context:Object, subtype:Number, data1:Object, data2:Object) { g_instance.type = type; --- 229,233 ---- public static function otherEventWithType(type:Number, location:NSPoint, modifierFlags:Number, ! timestamp:Number, view:NSView, context:Object, subtype:Number, data1:Object, data2:Object) { g_instance.type = type; *************** *** 231,237 **** g_instance.modifierFlags = modifierFlags; g_instance.timestamp = timestamp; ! g_instance.windowNumber = windowNumber; ! g_instance.window = NSWindow.instances()[windowNumber]; ! g_instance.view = null; g_instance.context = context; g_instance.subtype = subtype; --- 235,241 ---- g_instance.modifierFlags = modifierFlags; g_instance.timestamp = timestamp; ! g_instance.view = view; ! g_instance.window = view.window(); ! g_instance.windowNumber = g_instance.window.windowNumber(); g_instance.context = context; g_instance.subtype = subtype; *************** *** 257,261 **** return g_instance; } ! private function NSEvent() { } --- 261,282 ---- return g_instance; } ! ! public static function startPeriodicEventsAfterDelayWithPeriod(delay:Number, period:Number) { ! TRACE("Staring periodic events"); ! g_periodicTimer = new NSTimer(); ! var startDate = new Date(); ! startDate = startDate.setTime(startDate.getTime()+(delay*1000)); ! g_periodicTimer.initWithFireDateIntervalTargetSelectorUserInfoRepeats( ! startDate, period, ASEventMonitor.instance(), "postPeriodicEvent", {}, true); ! } ! ! public static function stopPeriodicEvents() { ! TRACE("Stopping periodic events"); ! if (g_periodicTimer != null) { ! g_periodicTimer.invalidate(); ! g_periodicTimer = null; ! } ! } ! private function NSEvent() { } |
From: Richard K. <ric...@us...> - 2005-05-17 16:26:42
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21328 Modified Files: ASTheme.as ASThemeProtocol.as NSButtonCell.as NSTextFieldCell.as Log Message: renamed methods in theme to simplify drawing Index: ASThemeProtocol.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASThemeProtocol.as,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ASThemeProtocol.as 17 May 2005 15:59:36 -0000 1.4 --- ASThemeProtocol.as 17 May 2005 16:26:29 -0000 1.5 *************** *** 51,67 **** /** ! * Draws a NSButton bezel with the supplied colorset (up, down, disabled) in the view. */ ! public function drawButtonBezeledWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView); /** ! * Draws a NSButton bordered with the supplied colorset (up, down, disabled) in the view. */ ! public function drawButtonBorderedWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView); /** * Draws an NSTextFieldCell with the supplied colorset ("defaultTextfield") in the view. */ ! public function drawTextFieldWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView); /** --- 51,83 ---- /** ! * Draws a NSButton in the up state bezeled with the supplied rect in the view. */ ! public function drawBezelButtonUpWithRectInView(rect:NSRect, view:NSView); /** ! * Draws a NSButton in the down state bezeled with the supplied rect in the view. */ ! public function drawBezelButtonDownWithRectInView(rect:NSRect, view:NSView); ! ! /** ! * Draws a NSButton in the disabled state bezeled with the supplied rect in the view. ! */ ! public function drawBezelButtonDisabledWithRectInView(rect:NSRect, view:NSView); ! ! /** ! * Draws a NSButton bordered with the supplied rect in the view. ! */ ! public function drawBorderButtonWithRectInView(rect:NSRect, view:NSView); ! ! /** ! * Draws a NSButton bordered with the supplied rect in the view. ! */ ! public function drawBorderButtonDisabledWithRectInView(rect:NSRect, view:NSView); ! /** * Draws an NSTextFieldCell with the supplied colorset ("defaultTextfield") in the view. */ ! public function drawTextFieldWithRectInView(rect:NSRect, view:NSView); /** Index: NSButtonCell.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSButtonCell.as,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** NSButtonCell.as 17 May 2005 15:59:36 -0000 1.14 --- NSButtonCell.as 17 May 2005 16:26:29 -0000 1.15 *************** *** 585,601 **** } ! var colorset; ! if (m_enabled) { ! if (m_highlighted) { ! colorset = "down"; } else { ! colorset = "up"; } - } else { - colorset = "disabled"; - } - - if (m_bordered) { - ASTheme.current().drawButtonBorderedWithRectColorsetInView(cellFrame, colorset, inView); } else if (m_bezeled) { if (m_highlighted || !m_enabled) { --- 585,594 ---- } ! if (m_bordered) { ! if (m_enabled) { ! ASTheme.current().drawBorderButtonWithRectInView(cellFrame, inView); } else { ! ASTheme.current().drawBorderButtonDisabledWithRectInView(cellFrame, inView); } } else if (m_bezeled) { if (m_highlighted || !m_enabled) { *************** *** 605,609 **** imageLocation.y += 1; } ! ASTheme.current().drawButtonBezeledWithRectColorsetInView(cellFrame, colorset, inView); } --- 598,612 ---- imageLocation.y += 1; } ! if (m_enabled) { ! if (m_highlighted) { ! ASTheme.current().drawBezelButtonDownWithRectInView(cellFrame, inView); ! } else { ! ASTheme.current().drawBezelButtonUpWithRectInView(cellFrame, inView); ! } ! } else { ! ASTheme.current().drawBezelButtonDisabledWithRectInView(cellFrame, inView); ! } ! ! } Index: NSTextFieldCell.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSTextFieldCell.as,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** NSTextFieldCell.as 17 May 2005 15:59:36 -0000 1.9 --- NSTextFieldCell.as 17 May 2005 16:26:29 -0000 1.10 *************** *** 167,171 **** if (m_drawsBackground) { ! ASTheme.current().drawTextFieldWithRectColorsetInView(cellFrame, "defaultTextfield", inView); } --- 167,171 ---- if (m_drawsBackground) { ! ASTheme.current().drawTextFieldWithRectInView(cellFrame, inView); } Index: ASTheme.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASTheme.as,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ASTheme.as 17 May 2005 15:59:36 -0000 1.4 --- ASTheme.as 17 May 2005 16:26:27 -0000 1.5 *************** *** 49,53 **** private static var g_colorSets = { ! up: { top: 0x82858E, top1: 0xDFE2E9, --- 49,53 ---- private static var g_colorSets = { ! buttonUp: { top: 0x82858E, top1: 0xDFE2E9, *************** *** 63,67 **** right1: 0x858992, middle: 0xC7CAD1}, ! down: { top: 0x6A6E79, top1: 0x747883, --- 63,67 ---- right1: 0x858992, middle: 0xC7CAD1}, ! buttonDown: { top: 0x6A6E79, top1: 0x747883, *************** *** 77,81 **** right1: 0xCACED1, middle: 0xB0B4BD}, ! disabled: { top: 0x81858E, top1: 0x858992, --- 77,81 ---- right1: 0xCACED1, middle: 0xB0B4BD}, ! buttonDisabled: { top: 0x81858E, top1: 0x858992, *************** *** 91,95 **** right1: 0xE9ECF1, middle: 0xC7CACF}, ! defaultTextfield: { top: 0x81858E, top1: 0x858992, --- 91,95 ---- right1: 0xE9ECF1, middle: 0xC7CACF}, ! textfield: { top: 0x81858E, top1: 0x858992, *************** *** 131,177 **** } ! public function drawButtonBorderedWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView) { ! var x = rect.origin.x; ! var y = rect.origin.y; ! var width = rect.size.width-1; ! var height = rect.size.height-1; ! var mc = view.mcBounds(); ! var colors = g_colorSets[colorSet]; ! ASDraw.drawFill(mc, colors.middle, x, y, width, height); ! ASDraw.drawRect(mc, 1, 0, x, y, width, height); ! } ! ! ! public function drawButtonBezeledWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView) { ! var x = rect.origin.x; ! var y = rect.origin.y; ! var width = rect.size.width-1; ! var height = rect.size.height-1; ! var mc = view.mcBounds(); ! var colors = g_colorSets[colorSet]; ! ! //draw top lines ! ASDraw.drawFill(mc, colors.middle, x, y, width, height); ! ASDraw.drawHLine(mc, colors.top , x, x+width, y); ! ASDraw.drawHLine(mc, colors.top1, x, x+width, y+1); ! ASDraw.drawHLine(mc, colors.top2, x, x+width, y+2); ! ASDraw.drawHLine(mc, colors.top3, x, x+width, y+3); ! //draw bottom lines ! ASDraw.drawHLine(mc, colors.bottom , x, x+width, y+height ); ! ASDraw.drawHLine(mc, colors.bottom1, x, x+width, y+height-1); ! ASDraw.drawHLine(mc, colors.bottom2, x, x+width, y+height-2); ! ASDraw.drawHLine(mc, colors.bottom3, x, x+width, y+height-3); ! //draw left lines ! ASDraw.drawVLine(mc, colors.left , y, y+height, x ); ! ASDraw.drawVLineEdgeFade(mc, colors.left1, y, y+height, x+1, 5); ! //draw right lines ! ASDraw.drawVLine(mc, colors.right , y, y+height, x+width ); ! ASDraw.drawVLineEdgeFade(mc, colors.right1, y, y+height, x+width-1, 5); } ! public function drawTextFieldWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView) { var x = rect.origin.x; var y = rect.origin.y; --- 131,157 ---- } ! public function drawBorderButtonWithRectInView(rect:NSRect, view:NSView) { ! drawBorderButtonWithRectColorsetInView(rect, "buttonUp", view); ! } ! public function drawBorderButtonDisabledWithRectInView(rect:NSRect, view:NSView) { ! drawBorderButtonWithRectColorsetInView(rect, "buttonDisabled", view); ! } ! ! public function drawBezelButtonUpWithRectInView(rect:NSRect, view:NSView) { ! drawBezelButtonWithRectColorsetInView(rect, "buttonUp", view); ! } ! public function drawBezelButtonDownWithRectInView(rect:NSRect, view:NSView) { ! drawBezelButtonWithRectColorsetInView(rect, "buttonDown", view); ! } ! public function drawBezelButtonDisabledWithRectInView(rect:NSRect, view:NSView) { ! drawBezelButtonWithRectColorsetInView(rect, "buttonDisabled", view); } ! ! ! public function drawTextFieldWithRectInView(rect:NSRect, view:NSView) { var x = rect.origin.x; var y = rect.origin.y; *************** *** 179,183 **** var height = rect.size.height-1; var mc = view.mcBounds(); ! var colors = g_colorSets[colorSet]; ASDraw.drawFill(mc, colors.middle, 0, 0, width, height); --- 159,163 ---- var height = rect.size.height-1; var mc = view.mcBounds(); ! var colors = g_colorSets["textfield"]; ASDraw.drawFill(mc, colors.middle, 0, 0, width, height); *************** *** 235,238 **** --- 215,259 ---- } + private function drawBorderButtonWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView) { + var x = rect.origin.x; + var y = rect.origin.y; + var width = rect.size.width-1; + var height = rect.size.height-1; + var mc = view.mcBounds(); + var colors = g_colorSets[colorSet]; + ASDraw.drawFill(mc, colors.middle, x, y, width, height); + ASDraw.drawRect(mc, 1, 0, x, y, width, height); + } + + private function drawBezelButtonWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView) { + var x = rect.origin.x; + var y = rect.origin.y; + var width = rect.size.width-1; + var height = rect.size.height-1; + var mc = view.mcBounds(); + var colors = g_colorSets[colorSet]; + + //draw top lines + ASDraw.drawFill(mc, colors.middle, x, y, width, height); + ASDraw.drawHLine(mc, colors.top , x, x+width, y); + ASDraw.drawHLine(mc, colors.top1, x, x+width, y+1); + ASDraw.drawHLine(mc, colors.top2, x, x+width, y+2); + ASDraw.drawHLine(mc, colors.top3, x, x+width, y+3); + + //draw bottom lines + ASDraw.drawHLine(mc, colors.bottom , x, x+width, y+height ); + ASDraw.drawHLine(mc, colors.bottom1, x, x+width, y+height-1); + ASDraw.drawHLine(mc, colors.bottom2, x, x+width, y+height-2); + ASDraw.drawHLine(mc, colors.bottom3, x, x+width, y+height-3); + + //draw left lines + ASDraw.drawVLine(mc, colors.left , y, y+height, x ); + ASDraw.drawVLineEdgeFade(mc, colors.left1, y, y+height, x+1, 5); + + //draw right lines + ASDraw.drawVLine(mc, colors.right , y, y+height, x+width ); + ASDraw.drawVLineEdgeFade(mc, colors.right1, y, y+height, x+width-1, 5); + } + //****************************************************** //* Public Static Properties * |
From: Richard K. <ric...@us...> - 2005-05-17 16:00:30
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15296 Modified Files: NSApplication.as Log Message: register images through ASTheme now Index: NSApplication.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSApplication.as,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NSApplication.as 10 May 2005 02:17:28 -0000 1.4 --- NSApplication.as 17 May 2005 16:00:16 -0000 1.5 *************** *** 38,42 **** import org.actionstep.ASUtils; ! import org.actionstep.images.ASDefaultImages; class org.actionstep.NSApplication extends NSResponder { --- 38,42 ---- import org.actionstep.ASUtils; ! import org.actionstep.ASTheme; class org.actionstep.NSApplication extends NSResponder { *************** *** 70,74 **** if (m_sharedApplication == null) { m_sharedApplication = (new NSApplication()).init(); ! ASDefaultImages.registerDefaultImages(); } return m_sharedApplication; --- 70,74 ---- if (m_sharedApplication == null) { m_sharedApplication = (new NSApplication()).init(); ! ASTheme.current().registerDefaultImages(); } return m_sharedApplication; |
From: Richard K. <ric...@us...> - 2005-05-17 15:59:46
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15094 Modified Files: ASTheme.as ASThemeProtocol.as NSTextFieldCell.as NSButtonCell.as Log Message: moved textfield drawing into ASTheme Index: ASThemeProtocol.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASThemeProtocol.as,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ASThemeProtocol.as 17 May 2005 15:43:18 -0000 1.3 --- ASThemeProtocol.as 17 May 2005 15:59:36 -0000 1.4 *************** *** 59,62 **** --- 59,67 ---- */ public function drawButtonBorderedWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView); + + /** + * Draws an NSTextFieldCell with the supplied colorset ("defaultTextfield") in the view. + */ + public function drawTextFieldWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView); /** Index: NSButtonCell.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSButtonCell.as,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** NSButtonCell.as 17 May 2005 15:31:40 -0000 1.13 --- NSButtonCell.as 17 May 2005 15:59:36 -0000 1.14 *************** *** 54,102 **** class org.actionstep.NSButtonCell extends NSActionCell { - - private static var g_buttonColors = { - up: { - top: 0x82858E, - top1: 0xDFE2E9, - top2: 0xEEF2F5, - top3: 0xD4D8D9, - bottom: 0xD3D6DB, - bottom1: 0x858992, - bottom2: 0x9599A2, - bottom3: 0xACB1B7, - left: 0x82858E, - left1: 0xDFE2E9, - right: 0xD3D6DB, - right1: 0x858992, - middle: 0xC7CAD1}, - down: { - top: 0x6A6E79, - top1: 0x747883, - top2: 0x7C838B, - top3: 0x939AA2, - bottom: 0xBEC1C6, - bottom1: 0xCACED1, - bottom2: 0xDADDE2, - bottom3: 0xBEC1C6, - left: 0x6A6E79, - left1: 0x747883, - right: 0xBEC1C6, - right1: 0xCACED1, - middle: 0xB0B4BD}, - disabled: { - top: 0x81858E, - top1: 0x858992, - top2: 0x9599A2, - top3: 0xABAFB6, - bottom: 0xD3D6DB, - bottom1: 0xDDE0E4, - bottom2: 0xEFF2F6, - bottom3: 0xD2D5DA, - left: 0x82858C, - left1: undefined, - right: 0x82858A, - right1: 0xE9ECF1, - middle: 0xC7CACF} - }; private var m_textField:TextField; --- 54,57 ---- Index: NSTextFieldCell.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSTextFieldCell.as,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** NSTextFieldCell.as 12 May 2005 19:38:26 -0000 1.8 --- NSTextFieldCell.as 17 May 2005 15:59:36 -0000 1.9 *************** *** 37,41 **** import org.actionstep.NSEvent; ! import org.actionstep.ASDraw; import org.actionstep.ASFieldEditor; --- 37,41 ---- import org.actionstep.NSEvent; ! import org.actionstep.ASTheme; import org.actionstep.ASFieldEditor; *************** *** 44,92 **** class org.actionstep.NSTextFieldCell extends NSActionCell { - private static var g_textFieldColors = { - up: { - top: 0x82858E, - top1: 0xDFE2E9, - top2: 0xEEF2F5, - top3: 0xD4D8D9, - bottom: 0xD3D6DB, - bottom1: 0x858992, - bottom2: 0x9599A2, - bottom3: 0xACB1B7, - left: 0x82858E, - left1: 0xDFE2E9, - right: 0xD3D6DB, - right1: 0x858992, - middle: 0xC7CAD1}, - down: { - top: 0x6A6E79, - top1: 0x747883, - top2: 0x7C838B, - top3: 0x939AA2, - bottom: 0xBEC1C6, - bottom1: 0xCACED1, - bottom2: 0xDADDE2, - bottom3: 0xBEC1C6, - left: 0x6A6E79, - left1: 0x747883, - right: 0xBEC1C6, - right1: 0xCACED1, - middle: 0xB0B4BD}, - disabled: { - top: 0x81858E, - top1: 0x858992, - top2: 0x9599A2, - top3: 0xABAFB6, - bottom: 0xD3D6DB, - bottom1: 0xDDE0E4, - bottom2: 0xEFF2F6, - bottom3: 0xD2D5DA, - left: 0x82858C, - left1: undefined, - right: 0x82858A, - right1: 0xE9ECF1, - middle: 0xC7CACF} - }; - private var m_bezelStyle:NSBezelStyle; private var m_textColor:NSColor; --- 44,47 ---- *************** *** 205,215 **** var mc:MovieClip = m_controlView.mcBounds(); ! var colors; ! if (m_enabled) { ! colors = g_textFieldColors.disabled; ! } else { ! colors = g_textFieldColors.down; ! } ! var width = cellFrame.size.width - 1; var height = cellFrame.size.height - 1; --- 160,164 ---- var mc:MovieClip = m_controlView.mcBounds(); ! var width = cellFrame.size.width - 1; var height = cellFrame.size.height - 1; *************** *** 217,244 **** var y = cellFrame.origin.y; ! if (m_drawsBackground) ! { ! ASDraw.drawFill(mc, colors.middle, 0, 0, width, height); ! ! //draw top lines ! ASDraw.drawHLine(mc, colors.top , x, width, y); ! ASDraw.drawHLine(mc, colors.top1, x, width, y+1); ! ASDraw.drawHLine(mc, colors.top2, x, width, y+2); ! ASDraw.drawHLine(mc, colors.top3, x, width, y+3); ! ! //draw bottom lines ! ASDraw.drawHLine(mc, colors.bottom , x, width, height ); ! ASDraw.drawHLine(mc, colors.bottom1, x, width, height-1); ! ASDraw.drawHLine(mc, colors.bottom2, x, width, height-2); ! ASDraw.drawHLine(mc, colors.bottom3, x, width, height-3); ! ! //draw left lines ! ASDraw.drawVLine(mc, colors.left , y, height, x ); ! ASDraw.drawVLineEdgeFade(mc, colors.left1, y, height, x+1, 5); ! ! //draw right lines ! ASDraw.drawVLine(mc, colors.right , y, height, width ); ! ASDraw.drawVLineEdgeFade(mc, colors.right1, y, height, width-1, 5); ! } if (m_textField == null || m_textField._parent == undefined) { --- 166,172 ---- var y = cellFrame.origin.y; ! if (m_drawsBackground) { ! ASTheme.current().drawTextFieldWithRectColorsetInView(cellFrame, "defaultTextfield", inView); ! } if (m_textField == null || m_textField._parent == undefined) { Index: ASTheme.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASTheme.as,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ASTheme.as 17 May 2005 15:43:18 -0000 1.3 --- ASTheme.as 17 May 2005 15:59:36 -0000 1.4 *************** *** 48,52 **** private static var g_current:ASThemeProtocol; ! private static var g_buttonColors = { up: { top: 0x82858E, --- 48,52 ---- private static var g_current:ASThemeProtocol; ! private static var g_colorSets = { up: { top: 0x82858E, *************** *** 90,94 **** right: 0x82858A, right1: 0xE9ECF1, ! middle: 0xC7CACF} }; --- 90,108 ---- right: 0x82858A, right1: 0xE9ECF1, ! middle: 0xC7CACF}, ! defaultTextfield: { ! top: 0x81858E, ! top1: 0x858992, ! top2: 0x9599A2, ! top3: 0xABAFB6, ! bottom: 0xD3D6DB, ! bottom1: 0xDDE0E4, ! bottom2: 0xEFF2F6, ! bottom3: 0xD2D5DA, ! left: 0x82858C, ! left1: undefined, ! right: 0x82858A, ! right1: 0xE9ECF1, ! middle: 0xC7CACF} }; *************** *** 120,127 **** var x = rect.origin.x; var y = rect.origin.y; ! var width = rect.size.width; ! var height = rect.size.height; var mc = view.mcBounds(); ! var colors = g_buttonColors[colorSet]; ASDraw.drawFill(mc, colors.middle, x, y, width, height); ASDraw.drawRect(mc, 1, 0, x, y, width, height); --- 134,141 ---- var x = rect.origin.x; var y = rect.origin.y; ! var width = rect.size.width-1; ! var height = rect.size.height-1; var mc = view.mcBounds(); ! var colors = g_colorSets[colorSet]; ASDraw.drawFill(mc, colors.middle, x, y, width, height); ASDraw.drawRect(mc, 1, 0, x, y, width, height); *************** *** 132,139 **** var x = rect.origin.x; var y = rect.origin.y; ! var width = rect.size.width; ! var height = rect.size.height; var mc = view.mcBounds(); ! var colors = g_buttonColors[colorSet]; //draw top lines --- 146,153 ---- var x = rect.origin.x; var y = rect.origin.y; ! var width = rect.size.width-1; ! var height = rect.size.height-1; var mc = view.mcBounds(); ! var colors = g_colorSets[colorSet]; //draw top lines *************** *** 158,161 **** --- 172,206 ---- ASDraw.drawVLineEdgeFade(mc, colors.right1, y, y+height, x+width-1, 5); } + + public function drawTextFieldWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView) { + var x = rect.origin.x; + var y = rect.origin.y; + var width = rect.size.width-1; + var height = rect.size.height-1; + var mc = view.mcBounds(); + var colors = g_colorSets[colorSet]; + + ASDraw.drawFill(mc, colors.middle, 0, 0, width, height); + + //draw top lines + ASDraw.drawHLine(mc, colors.top , x, width, y); + ASDraw.drawHLine(mc, colors.top1, x, width, y+1); + ASDraw.drawHLine(mc, colors.top2, x, width, y+2); + ASDraw.drawHLine(mc, colors.top3, x, width, y+3); + + //draw bottom lines + ASDraw.drawHLine(mc, colors.bottom , x, width, height ); + ASDraw.drawHLine(mc, colors.bottom1, x, width, height-1); + ASDraw.drawHLine(mc, colors.bottom2, x, width, height-2); + ASDraw.drawHLine(mc, colors.bottom3, x, width, height-3); + + //draw left lines + ASDraw.drawVLine(mc, colors.left , y, height, x ); + ASDraw.drawVLineEdgeFade(mc, colors.left1, y, height, x+1, 5); + + //draw right lines + ASDraw.drawVLine(mc, colors.right , y, height, width ); + ASDraw.drawVLineEdgeFade(mc, colors.right1, y, height, width-1, 5); + } public function registerDefaultImages() { |
From: Richard K. <ric...@us...> - 2005-05-17 15:43:27
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11700 Modified Files: ASTheme.as ASThemeProtocol.as Log Message: moved default image registration into ASTheme Index: ASThemeProtocol.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASThemeProtocol.as,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ASThemeProtocol.as 17 May 2005 15:31:40 -0000 1.2 --- ASThemeProtocol.as 17 May 2005 15:43:18 -0000 1.3 *************** *** 60,62 **** --- 60,67 ---- public function drawButtonBorderedWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView); + /** + * Registers the default image representations for buttons and other controls + */ + public function registerDefaultImages(); + } Index: ASTheme.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASTheme.as,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ASTheme.as 17 May 2005 15:31:40 -0000 1.2 --- ASTheme.as 17 May 2005 15:43:18 -0000 1.3 *************** *** 34,37 **** --- 34,38 ---- import org.actionstep.NSColor; import org.actionstep.ASDraw; + import org.actionstep.NSImage; /** *************** *** 96,101 **** * Constructs a new instance of ASTheme. */ ! private function ASTheme() ! { } --- 97,101 ---- * Constructs a new instance of ASTheme. */ ! private function ASTheme() { } *************** *** 158,162 **** ASDraw.drawVLineEdgeFade(mc, colors.right1, y, y+height, x+width-1, 5); } ! /** * @see org.actionstep.NSObject#description --- 158,169 ---- ASDraw.drawVLineEdgeFade(mc, colors.right1, y, y+height, x+width-1, 5); } ! ! public function registerDefaultImages() { ! setImage("NSRadioButton", org.actionstep.images.ASRadioButtonRep); ! setImage("NSHighlightedRadioButton", org.actionstep.images.ASHighlightedRadioButtonRep); ! setImage("NSSwitch", org.actionstep.images.ASSwitchRep); ! setImage("NSHighlightedSwitch", org.actionstep.images.ASHighlightedSwitchRep); ! } ! /** * @see org.actionstep.NSObject#description *************** *** 176,179 **** --- 183,193 ---- //* Private Methods * //****************************************************** + + private function setImage(name:String, klass:Function) { + var image = (new NSImage()).init(); + image.setName(name); + image.addRepresentation(new klass()); + } + //****************************************************** //* Public Static Properties * |
From: Richard K. <ric...@us...> - 2005-05-17 15:42:28
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11501 Removed Files: ASDefaultImages.as Log Message: moved code to regiseter default images into ASTheme --- ASDefaultImages.as DELETED --- |
From: Richard K. <ric...@us...> - 2005-05-17 15:31:56
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9063 Modified Files: ASTheme.as ASThemeProtocol.as NSButtonCell.as Log Message: moved button cell drawing to ASTheme Index: ASThemeProtocol.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASThemeProtocol.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ASThemeProtocol.as 17 May 2005 01:42:08 -0000 1.1 --- ASThemeProtocol.as 17 May 2005 15:31:40 -0000 1.2 *************** *** 49,51 **** --- 49,62 ---- */ public function drawFillWithRectColorInView(aRect:NSRect, aColor:NSColor, inView:NSView):Void; + + /** + * Draws a NSButton bezel with the supplied colorset (up, down, disabled) in the view. + */ + public function drawButtonBezeledWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView); + + /** + * Draws a NSButton bordered with the supplied colorset (up, down, disabled) in the view. + */ + public function drawButtonBorderedWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView); + } Index: NSButtonCell.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSButtonCell.as,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** NSButtonCell.as 12 May 2005 19:38:26 -0000 1.12 --- NSButtonCell.as 17 May 2005 15:31:40 -0000 1.13 *************** *** 28,31 **** --- 28,34 ---- * POSSIBILITY OF SUCH DAMAGE. */ + + import org.actionstep.ASTheme; + import org.actionstep.NSActionCell; *************** *** 40,44 **** import org.actionstep.NSSize; import org.actionstep.NSControl; - import org.actionstep.ASDraw; import org.actionstep.NSColor; import org.actionstep.NSCell; --- 43,46 ---- *************** *** 565,579 **** } - var colors; - if (m_enabled) { - if (m_highlighted) { - colors = g_buttonColors.down; - } else { - colors = g_buttonColors.up; - } - } else { - colors = g_buttonColors.disabled; - } - if (m_bordered) { borderSize = new NSSize(3,3); --- 567,570 ---- *************** *** 636,647 **** if (!m_bordered && !m_bezeled && m_backgroundColor != null) { ! ASDraw.drawFill(mc, m_backgroundColor.toHex(), x, y, width, height); } if (m_bordered) { ! ASDraw.drawFill(mc, colors.middle, x, y, width, height); ! ASDraw.drawRect(mc, 1, 0, x, y, width, height); } else if (m_bezeled) { - //draw top lines if (m_highlighted || !m_enabled) { m_textField._x += 1; --- 627,647 ---- if (!m_bordered && !m_bezeled && m_backgroundColor != null) { ! ASTheme.current().drawFillWithRectColorInView(cellFrame, m_backgroundColor, inView); ! } ! ! var colorset; ! if (m_enabled) { ! if (m_highlighted) { ! colorset = "down"; ! } else { ! colorset = "up"; ! } ! } else { ! colorset = "disabled"; } if (m_bordered) { ! ASTheme.current().drawButtonBorderedWithRectColorsetInView(cellFrame, colorset, inView); } else if (m_bezeled) { if (m_highlighted || !m_enabled) { m_textField._x += 1; *************** *** 650,673 **** imageLocation.y += 1; } ! ASDraw.drawFill(mc, colors.middle, x, y, width, height); ! ASDraw.drawHLine(mc, colors.top , x, x+width, y); ! ASDraw.drawHLine(mc, colors.top1, x, x+width, y+1); ! ASDraw.drawHLine(mc, colors.top2, x, x+width, y+2); ! ASDraw.drawHLine(mc, colors.top3, x, x+width, y+3); ! ! //draw bottom lines ! ASDraw.drawHLine(mc, colors.bottom , x, x+width, y+height ); ! ASDraw.drawHLine(mc, colors.bottom1, x, x+width, y+height-1); ! ASDraw.drawHLine(mc, colors.bottom2, x, x+width, y+height-2); ! ASDraw.drawHLine(mc, colors.bottom3, x, x+width, y+height-3); ! ! //draw left lines ! ASDraw.drawVLine(mc, colors.left , y, y+height, x ); ! ASDraw.drawVLineEdgeFade(mc, colors.left1, y, y+height, x+1, 5); ! ! //draw right lines ! ASDraw.drawVLine(mc, colors.right , y, y+height, x+width ); ! ASDraw.drawVLineEdgeFade(mc, colors.right1, y, y+height, x+width-1, 5); } if (image != null) { image.lockFocus(mc); --- 650,656 ---- imageLocation.y += 1; } ! ASTheme.current().drawButtonBezeledWithRectColorsetInView(cellFrame, colorset, inView); } + if (image != null) { image.lockFocus(mc); Index: ASTheme.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASTheme.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ASTheme.as 17 May 2005 01:42:08 -0000 1.1 --- ASTheme.as 17 May 2005 15:31:40 -0000 1.2 *************** *** 46,54 **** { private static var g_current:ASThemeProtocol; /** * Constructs a new instance of ASTheme. */ ! private function ASDrawer() { } --- 46,100 ---- { private static var g_current:ASThemeProtocol; + + private static var g_buttonColors = { + up: { + top: 0x82858E, + top1: 0xDFE2E9, + top2: 0xEEF2F5, + top3: 0xD4D8D9, + bottom: 0xD3D6DB, + bottom1: 0x858992, + bottom2: 0x9599A2, + bottom3: 0xACB1B7, + left: 0x82858E, + left1: 0xDFE2E9, + right: 0xD3D6DB, + right1: 0x858992, + middle: 0xC7CAD1}, + down: { + top: 0x6A6E79, + top1: 0x747883, + top2: 0x7C838B, + top3: 0x939AA2, + bottom: 0xBEC1C6, + bottom1: 0xCACED1, + bottom2: 0xDADDE2, + bottom3: 0xBEC1C6, + left: 0x6A6E79, + left1: 0x747883, + right: 0xBEC1C6, + right1: 0xCACED1, + middle: 0xB0B4BD}, + disabled: { + top: 0x81858E, + top1: 0x858992, + top2: 0x9599A2, + top3: 0xABAFB6, + bottom: 0xD3D6DB, + bottom1: 0xDDE0E4, + bottom2: 0xEFF2F6, + bottom3: 0xD2D5DA, + left: 0x82858C, + left1: undefined, + right: 0x82858A, + right1: 0xE9ECF1, + middle: 0xC7CACF} + }; + /** * Constructs a new instance of ASTheme. */ ! private function ASTheme() { } *************** *** 71,74 **** --- 117,161 ---- } + public function drawButtonBorderedWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView) { + var x = rect.origin.x; + var y = rect.origin.y; + var width = rect.size.width; + var height = rect.size.height; + var mc = view.mcBounds(); + var colors = g_buttonColors[colorSet]; + ASDraw.drawFill(mc, colors.middle, x, y, width, height); + ASDraw.drawRect(mc, 1, 0, x, y, width, height); + } + + + public function drawButtonBezeledWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView) { + var x = rect.origin.x; + var y = rect.origin.y; + var width = rect.size.width; + var height = rect.size.height; + var mc = view.mcBounds(); + var colors = g_buttonColors[colorSet]; + + //draw top lines + ASDraw.drawFill(mc, colors.middle, x, y, width, height); + ASDraw.drawHLine(mc, colors.top , x, x+width, y); + ASDraw.drawHLine(mc, colors.top1, x, x+width, y+1); + ASDraw.drawHLine(mc, colors.top2, x, x+width, y+2); + ASDraw.drawHLine(mc, colors.top3, x, x+width, y+3); + + //draw bottom lines + ASDraw.drawHLine(mc, colors.bottom , x, x+width, y+height ); + ASDraw.drawHLine(mc, colors.bottom1, x, x+width, y+height-1); + ASDraw.drawHLine(mc, colors.bottom2, x, x+width, y+height-2); + ASDraw.drawHLine(mc, colors.bottom3, x, x+width, y+height-3); + + //draw left lines + ASDraw.drawVLine(mc, colors.left , y, y+height, x ); + ASDraw.drawVLineEdgeFade(mc, colors.left1, y, y+height, x+1, 5); + + //draw right lines + ASDraw.drawVLine(mc, colors.right , y, y+height, x+width ); + ASDraw.drawVLineEdgeFade(mc, colors.right1, y, y+height, x+width-1, 5); + } /** *************** *** 77,81 **** public function description():String { ! return "ASDrawer"; } --- 164,168 ---- public function description():String { ! return "ASTheme"; } |