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: Igor C. <igo...@gm...> - 2005-09-12 00:08:10
|
Just a test mail, ignore it please. thanks |
From: Richard K. <ric...@us...> - 2005-07-27 18:22:20
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28709 Modified Files: ASTestWindowStyles.as Log Message: test turning off resize indicator on top view Index: ASTestWindowStyles.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/test/ASTestWindowStyles.as,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ASTestWindowStyles.as 19 Jul 2005 03:57:35 -0000 1.5 --- ASTestWindowStyles.as 27 Jul 2005 18:22:10 -0000 1.6 *************** *** 40,43 **** --- 40,44 ---- view.setBackgroundColor(new NSColor(0x55DDFF)); window.setContentView(view); + window.setShowsResizeIndicator(false); window.display(); window.setLevel(NSWindow.NSModalPanelWindowLevel); |
From: Richard K. <ric...@us...> - 2005-07-27 18:21:10
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28335 Modified Files: ASTestTabView.as Log Message: added scrollview to ensure that tab switching repaints images Index: ASTestTabView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/test/ASTestTabView.as,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ASTestTabView.as 22 May 2005 03:49:06 -0000 1.4 --- ASTestTabView.as 27 Jul 2005 18:21:01 -0000 1.5 *************** *** 30,33 **** --- 30,34 ---- import org.actionstep.*; + import org.actionstep.constants.*; import org.actionstep.test.*; *************** *** 38,41 **** --- 39,47 ---- var tabView = (new NSTabView()).initWithFrame(new NSRect(10,10,400,400)); + var matrix:NSMatrix = new NSMatrix(); + var text:NSSecureTextField = new NSSecureTextField(); + var stepper:NSStepper = new NSStepper(); + var alert:ASAlertPanel = new ASAlertPanel(); + // tabView.setTabViewType(org.actionstep.constants.NSTabViewType.NSNoTabsNoBorder); //tabView.setTabViewType(org.actionstep.constants.NSTabViewType.NSNoTabsLineBorder); *************** *** 48,57 **** tabItem1.setView(tabItemView1); - var nextButton = (new NSButton()).initWithFrame(new NSRect(80,80,70,30)); - nextButton.setTitle("Next Tab"); - tabItemView1.addSubview(nextButton); - nextButton.setTarget(tabView); - nextButton.setAction("selectNextTabViewItem"); - var tabItem2:NSTabViewItem = (new NSTabViewItem()).initWithIdentifier(2); tabItem2.setLabel("Short tab"); --- 54,57 ---- *************** *** 60,69 **** tabItemView2.setBackgroundColor(new NSColor(0x00ff00)); tabItem2.setView(tabItemView2); ! var prevButton = (new NSButton()).initWithFrame(new NSRect(80,80,70,30)); ! prevButton.setTitle("Prev Tab"); ! tabItemView2.addSubview(prevButton); ! prevButton.setTarget(tabView); ! prevButton.setAction("selectPreviousTabViewItem"); tabView.addTabViewItem(tabItem1); --- 60,76 ---- tabItemView2.setBackgroundColor(new NSColor(0x00ff00)); tabItem2.setView(tabItemView2); + + + var view:ASTestView = new ASTestView(); + view.initWithFrame(new NSRect(0, 0, 1024, 350)); + view.setBorderColor(new NSColor(0xff0000)); ! var scrollView:NSScrollView = (new NSScrollView()).initWithFrame(new NSRect(0,0,250,250)); ! scrollView.setBorderType(NSBorderType.NSLineBorder); ! scrollView.setDocumentView(view); ! scrollView.setHasHorizontalScroller(true); ! scrollView.setHasVerticalScroller(true); ! scrollView.contentView().scrollToPoint(new NSPoint(0,100)); ! tabItemView2.addSubview(scrollView); tabView.addTabViewItem(tabItem1); |
From: Richard K. <ric...@us...> - 2005-07-27 18:19:40
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27918 Modified Files: ASTestView.as Log Message: accepts first responder now Index: ASTestView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/test/ASTestView.as,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ASTestView.as 27 May 2005 22:16:09 -0000 1.6 --- ASTestView.as 27 Jul 2005 18:19:31 -0000 1.7 *************** *** 32,35 **** --- 32,36 ---- import org.actionstep.NSRect; import org.actionstep.NSColor; + import org.actionstep.NSEvent; class org.actionstep.test.ASTestView extends NSView { *************** *** 57,60 **** --- 58,69 ---- } + public function mouseDown(event:NSEvent) { + TRACE(event.clickCount); + } + + public function acceptsFirstResponder():Boolean { + return true; + } + public function drawRect(rect:NSRect) { with(m_mcBounds) { *************** *** 63,67 **** lineStyle(1, m_borderColor.value, 100); } else { ! lineStyle(0, 0x000000, 0); } beginFill(m_backgroundColor.value, 100); --- 72,76 ---- lineStyle(1, m_borderColor.value, 100); } else { ! lineStyle(1, m_backgroundColor.value, 100); } beginFill(m_backgroundColor.value, 100); |
From: Richard K. <ric...@us...> - 2005-07-27 18:12:57
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26153 Modified Files: ASTestScrollView.as Log Message: change position of buttons Index: ASTestScrollView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/test/ASTestScrollView.as,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ASTestScrollView.as 28 May 2005 04:45:33 -0000 1.4 --- ASTestScrollView.as 27 Jul 2005 18:12:46 -0000 1.5 *************** *** 42,51 **** view.initWithFrame(new NSRect(0, 0, 1024, 350)); view.setBorderColor(new NSColor(0xff0000)); ! var grow = (new NSButton()).initWithFrame(new NSRect(10,10,70,30)); grow.setTitle("Grow!"); ! view.addSubview(grow); ! var shrink = (new NSButton()).initWithFrame(new NSRect(200,200,70,30)); shrink.setTitle("Shrink!"); - view.addSubview(shrink); var target = new Object(); --- 42,49 ---- view.initWithFrame(new NSRect(0, 0, 1024, 350)); view.setBorderColor(new NSColor(0xff0000)); ! var grow = (new NSButton()).initWithFrame(new NSRect(260,10,70,30)); grow.setTitle("Grow!"); ! var shrink = (new NSButton()).initWithFrame(new NSRect(260,90,70,30)); shrink.setTitle("Shrink!"); var target = new Object(); *************** *** 68,73 **** scrollView.setHasVerticalScroller(true); ! window1.setContentView(scrollView); app.run(); } --- 66,76 ---- scrollView.setHasVerticalScroller(true); + var view2:ASTestView = new ASTestView(); + view2.initWithFrame(new NSRect(0, 0, 500,500)); + view2.addSubview(scrollView); + view2.addSubview(grow); + view2.addSubview(shrink); ! window1.setContentView(view2); app.run(); } |
From: Richard K. <ric...@us...> - 2005-07-27 18:10:22
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25611 Modified Files: ASTestList.as Log Message: add button to ensure focus change Index: ASTestList.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/test/ASTestList.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ASTestList.as 19 Jun 2005 05:23:44 -0000 1.1 --- ASTestList.as 27 Jul 2005 18:10:13 -0000 1.2 *************** *** 37,52 **** var object = new Object(); object.itemSelected = function(list:ASList) { TRACE("Selected "+list.selectedItem().label()); } var app:NSApplication = NSApplication.sharedApplication(); ! var window:NSWindow = (new NSWindow()).initWithContentRect(new NSRect(0,0,500,500)); var view:NSView = (new NSView()).initWithFrame(new NSRect(0,0,500,500)); var list:ASList = (new ASList()).initWithFrame(new NSRect(10, 10, 150, 200)); list.setTarget(object); list.setAction("itemSelected"); ! for(var i = 0;i<100;i++) { ! list.addItem(ASListItem.listItemWithLabelData("Item "+i, i)); ! } view.addSubview(list); window.setContentView(view); app.run(); --- 37,76 ---- var object = new Object(); object.itemSelected = function(list:ASList) { + if (list.selectedItem().label() == "Test Item 10") { + var vis:Array = list.visibleItems(); + vis[5].setVisible(false); + vis[4].setVisible(false); + list.refresh(); + } else if (list.selectedItem().label() == "Test Item 11") { + var vis:Array = list.invisibleItems(); + vis[0].setVisible(true); + vis[1].setVisible(true); + list.refresh(); + } TRACE("Selected "+list.selectedItem().label()); } var app:NSApplication = NSApplication.sharedApplication(); ! var window:NSWindow = (new NSWindow()).initWithContentRectSwf(new NSRect(0,0,500,500)); var view:NSView = (new NSView()).initWithFrame(new NSRect(0,0,500,500)); var list:ASList = (new ASList()).initWithFrame(new NSRect(10, 10, 150, 200)); + list.setFont(NSFont.fontWithNameSizeEmbedded("Arial", 14, false)); + list.setFontColor(new NSColor(0x50545d)); + //list.setFont(NSFont.fontWithNameSizeEmbedded("Arial", 18, false)); list.setTarget(object); list.setAction("itemSelected"); ! var labels = new Array(); ! var data = new Array(); ! for(var i = 0;i<511;i++) { ! labels[i] = "Test Item "+i; ! data[i] = i; ! } ! var begin = getTimer(); ! list.addItemsWithLabelsData(labels, data); ! TRACE("elapsed seconds: "+(getTimer() - begin)/1000); view.addSubview(list); + + var button = (new NSButton()).initWithFrame(new NSRect(170,10,70,30)); + button.setTitle("Clear"); + view.addSubview(button) window.setContentView(view); app.run(); |
From: Richard K. <ric...@us...> - 2005-07-27 17:56:52
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22142 Modified Files: NSAlert.as NSApplication.as NSCalendarDate.as NSDate.as Log Message: comment out unused imports, fixed misspellings Index: NSApplication.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSApplication.as,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** NSApplication.as 27 Jul 2005 05:37:37 -0000 1.31 --- NSApplication.as 27 Jul 2005 17:56:40 -0000 1.32 *************** *** 37,41 **** import org.actionstep.NSException; import org.actionstep.NSModalSession; ! import org.actionstep.NSUserDefaults; import org.actionstep.ASEventMonitor; import org.actionstep.ASFieldEditor; --- 37,41 ---- import org.actionstep.NSException; import org.actionstep.NSModalSession; ! //import org.actionstep.NSUserDefaults; import org.actionstep.ASEventMonitor; import org.actionstep.ASFieldEditor; Index: NSCalendarDate.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSCalendarDate.as,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NSCalendarDate.as 27 Jul 2005 07:11:33 -0000 1.4 --- NSCalendarDate.as 27 Jul 2005 17:56:40 -0000 1.5 *************** *** 32,42 **** */ ! import org.actionstep.NSArray; import org.actionstep.NSDate; import org.actionstep.NSDateFormatter; import org.actionstep.NSDictionary; ! import org.actionstep.NSException; ! import org.actionstep.NSObject; ! import org.actionstep.NSUserDefaults; /** --- 32,42 ---- */ ! //import org.actionstep.NSArray; import org.actionstep.NSDate; import org.actionstep.NSDateFormatter; import org.actionstep.NSDictionary; ! //import org.actionstep.NSException; ! //import org.actionstep.NSObject; ! //import org.actionstep.NSUserDefaults; /** Index: NSDate.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSDate.as,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NSDate.as 27 Jul 2005 17:31:42 -0000 1.2 --- NSDate.as 27 Jul 2005 17:56:40 -0000 1.3 *************** *** 1,433 **** ! /* ! * Copyright (c) 2005, InfoEther, Inc. ! * All rights reserved. ! * ! * Copyright (c) 2005, Affinity Systems ! * 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. and Affinity Systems 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.NSCopying; ! import org.actionstep.NSDateFormatter; ! import org.actionstep.NSDictionary; ! import org.actionstep.NSObject; ! import org.actionstep.NSUserDefaults; ! ! import org.actionstep.constants.NSComparisonResult; ! ! /** ! * Class used for representing dates. ! * ! * @author Scott Hyndman ! */ ! class org.actionstep.NSDate extends NSObject ! implements NSCopying ! { ! /** ! * Seconds between Jan 1st, 1970 to Jan 1st, 2001. ! */ ! public static var NSTimeIntervalSince1970:Number; ! ! /** String format used by initWithString() */ ! private static var DEF_STRING_FORMAT:String; ! ! /** January 1st, 2001, 00:00:00:0000 */ ! private static var g_refDate:Date; ! ! /** A date formatter that uses to format all dates. */ ! private static var g_dtFormatter:NSDateFormatter; ! ! /** The internal date. */ ! private var m_dt:Date; ! ! ! //****************************************************** ! //* Construction ! //****************************************************** ! ! /** ! * Constructs a new instance of the NSDate class. ! */ ! public function NSDate() ! { ! if (g_dtFormatter == undefined) ! { ! g_dtFormatter = ! (new NSDateFormatter()).initWithDateFormatallowNaturalLanguage( ! DEF_STRING_FORMAT, false); ! g_dtFormatter.generatesCalendarDates(true); // for subclasses ! } ! } ! ! ! /** ! * Initializes an NSDate to the current date and time. ! */ ! public function init():NSDate ! { ! m_dt = new Date(); ! return this; ! } ! ! ! /** ! * Initializes an NSDate to the date and time specified by a string ! * conforming to the international string representation format ! * YYYY-MM-DD HH:MM:SS ±HHMM. All fields must be specified. ! */ ! public function initWithString(description:String):NSDate ! { ! var genDt:NSDate; ! var old:String; ! ! // ! // Since ActionScript is single-threaded, this is okay to do. ! // ! old = g_dtFormatter.dateFormat(); ! g_dtFormatter.setDateFormat(DEF_STRING_FORMAT); ! genDt = g_dtFormatter.dateFromString(description); ! g_dtFormatter.setDateFormat(old); // reset ! ! this.m_dt.setTime(genDt.internalDate().getTime()); ! //! deal with timezone ! ! return this; ! } ! ! ! /** ! * Initializes an NSDate to the current date and time, offset by seconds ! * seconds. ! */ ! public function initWithTimeIntervalSinceNow(seconds:Number):NSDate ! { ! m_dt = new Date(); ! m_dt.setTime(m_dt.getTime() + seconds * 1000); ! ! return this; ! } ! ! ! /** ! * Initializes an NSDate to the date and time of refDate, offset by ! * seconds seconds. ! */ ! public function initWithTimeIntervalSinceDate(seconds:Number, ! refDate:NSDate):NSDate ! { ! m_dt = new Date(); ! m_dt.setTime(refDate.m_dt.getTime() + seconds * 1000); ! ! return this; ! } ! ! ! /** ! * Initializes an NSDate to the date and time of the absolute reference ! * date, offset by seconds seconds. ! */ ! public function initWithTimeIntervalSinceReferenceDate(seconds:Number):NSDate ! { ! return initWithTimeIntervalSinceDate(seconds, NSDate.dateWithDate(g_refDate)); ! } ! ! ! //****************************************************** ! //* Properties ! //****************************************************** ! ! /** ! * @see org.actionstep.NSObject#description ! */ ! public function description():String ! { ! return "NSDate()"; ! } ! ! ! /** ! * Returns the internal date representation. Should only be used when ! * absolutely necessary. ! */ ! public function internalDate():Date ! { ! return m_dt; ! } ! ! //****************************************************** ! //* Time Intervals ! //****************************************************** ! ! /** ! * Returns the interval (seconds) between this date and Jan 1st, 1970. ! * If this date is earlier than now a negative value is returned. ! * ! * Cocoa specs have this returning an NSTimeInterval. Number is fine for ! * our purposes. ! */ ! public function timeIntervalSince1970():Number ! { ! return (this.m_dt.getTime() / 1000); ! } ! ! ! /** ! * Returns the interval (seconds) between this date and anotherDate. If ! * this date is earlier than anotherDate a negative value is returned. ! * ! * Cocoa specs have this returning an NSTimeInterval. Number is fine for ! * our purposes. ! */ ! public function timeIntervalSinceDate(anotherDate:NSDate):Number ! { ! return timeIntervalSinceIntrinsicDate(anotherDate.m_dt); ! } ! ! ! /** ! * Returns the interval (seconds) between this date and the current date ! * and time. If this date is earlier than now a negative value is returned. ! * ! * Cocoa specs have this returning an NSTimeInterval. Number is fine for ! * our purposes. ! */ ! public function timeIntervalSinceNow():Number ! { ! return timeIntervalSinceIntrinsicDate(new Date()); ! } ! ! ! /** ! * Returns the interval (seconds) between this date and the reference date ! * (Jan 1st, 2001). If this date is earlier than now a negative value is ! * returned. ! * ! * Cocoa specs have this returning an NSTimeInterval. Number is fine for ! * our purposes. ! */ ! public function timeIntervalSinceReferenceDate():Number ! { ! return timeIntervalSinceIntrinsicDate(g_refDate); ! } ! ! //****************************************************** ! //* Public Methods ! //****************************************************** ! ! /** ! * Returns a new NSDate offset by seconds seconds from this date. ! */ ! public function addTimeInterval(seconds:Number):NSDate ! { ! return (new NSDate()).initWithTimeIntervalSinceDate(seconds, this); ! } ! ! ! /** ! * Uses timeIntervalSinceDate to compare this date to anotherDate and ! * returns an NSComparisonResult. ! * ! * If the two dates are the same, NSOrderedSame is returned. ! * If this date is later than anotherDate, NSOrderedDescending is returned. ! * If this date is earlier, NSOrderedAscending is returned. ! */ ! public function compare(anotherDate:NSDate):NSComparisonResult ! { ! var delta:Number = timeIntervalSinceDate(anotherDate); ! ! if (delta == 0) ! { ! return NSComparisonResult.NSOrderedSame; ! } ! else if (delta > 0) ! { ! return NSComparisonResult.NSOrderedDescending; ! } ! else // delta < 0 ! { ! return NSComparisonResult.NSOrderedAscending; ! } ! } ! ! ! /** ! * Returns whatever is earlier, this date or anotherDate. ! */ ! public function earlierDate(anotherDate:NSDate):NSDate ! { ! return timeIntervalSinceDate(anotherDate) < 0 ? this : anotherDate; ! } ! ! ! /** ! * Returns whatever is later, this date or anotherDate. ! */ ! public function laterDate(anotherDate:NSDate):NSDate ! { ! return timeIntervalSinceDate(anotherDate) < 0 ? anotherDate : this; ! } ! ! ! /** ! * @see org.actionstep.NSObject#isEqual ! */ ! public function isEqual(anObject:NSObject):Boolean ! { ! if (!(anObject instanceof NSDate)) ! return false; ! ! return isEqualToDate(NSDate(anObject)); ! } ! ! ! /** ! * Returns TRUE if this date is equal to anotherDate, and FALSE otherwise. ! */ ! public function isEqualToDate(anotherDate:NSDate):Boolean ! { ! //! Timezones ! return m_dt.getTime() == anotherDate.m_dt.getTime(); ! } ! ! //****************************************************** ! //* NSCopying Implementation ! //****************************************************** ! ! /** ! * @see org.actionstep.NSCopying#copyWithZone ! */ ! public function copyWithZone():NSDate ! { ! return (new NSDate()).initWithTimeIntervalSinceDate(0, this); ! } ! ! //****************************************************** ! //* Protected Methods ! //****************************************************** ! //****************************************************** ! //* Private Methods ! //****************************************************** ! ! /** ! * Returns the time in seconds between this date and the intrinsic Date ! * argument. ! */ ! private function timeIntervalSinceIntrinsicDate(dt:Date):Number ! { ! return (this.m_dt.getTime() - dt.getTime()) / 1000; ! } ! ! ! //****************************************************** ! //* Public Static Properties ! //****************************************************** ! ! /** ! * Returns a date in the distant future (centuries distant). ! */ ! public function distantFuture():NSDate ! { ! return NSDate.dateWithDate(new Date(9999, 0, 1, 0, 0, 0, 0)); ! } ! ! ! /** ! * Returns a date in the distant past. ! */ ! public function distantPast():NSDate ! { ! return NSDate.dateWithDate(new Date(1, 0, 1, 0, 0, 0, 0)); ! } ! ! //****************************************************** ! //* Public Static Methods ! //****************************************************** ! ! /** ! * Constructs and returns a new date with the current date and time. ! */ ! public static function date():NSDate ! { ! return NSDate.dateWithDate(new Date()); ! } ! ! ! /** ! * Constructs and returns a new date set to the date and time of date. ! */ ! public static function dateWithDate(date:Date):NSDate ! { ! return (new NSDate()).initWithTimeIntervalSinceReferenceDate(date.getTime()); ! } ! ! ! /** ! * Constructs a new date based on the information contained in string. ! * The date formatter uses date and time preferences stored in the user ! * defaults table to parse the string. ! */ ! public static function dateWithNaturalLanguageString(string:String):NSDate ! { ! return dateWithNaturalLanguageStringLocale(string, ! NSUserDefaults.standardUserDefaults().dictionaryRepresentation()); ! } ! ! ! public static function dateWithNaturalLanguageStringLocale(string:String, ! locale:NSDictionary):NSDate ! { ! return null; ! } ! ! //****************************************************** ! //* Static Constructor ! //****************************************************** ! ! /** ! * Runs when the application begins. ! */ ! private static function classConstruct():Boolean ! { ! if (classConstructed) ! return true; ! ! // ! // Generate reference date (Jan 1st, 2001) and constant. ! // ! g_refDate = new Date(2001, 0, 1, 0, 0, 0, 0); ! NSTimeIntervalSince1970 = Math.round(g_refDate.getTime() / 1000); ! ! // ! // For formatting (YYYY-MM-DD HH:MM:SS ±HHMM) ! // ! DEF_STRING_FORMAT = "%Y-%m-%d %H:%M:%S %z"; ! ! return true; ! } ! ! private static var classConstructed:Boolean = classConstruct(); ! } --- 1,433 ---- ! /* ! * Copyright (c) 2005, InfoEther, Inc. ! * All rights reserved. ! * ! * Copyright (c) 2005, Affinity Systems ! * 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. and Affinity Systems 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.NSCopying; ! import org.actionstep.NSDateFormatter; ! import org.actionstep.NSDictionary; ! import org.actionstep.NSObject; ! import org.actionstep.NSUserDefaults; ! ! import org.actionstep.constants.NSComparisonResult; ! ! /** ! * Class used for representing dates. ! * ! * @author Scott Hyndman ! */ ! class org.actionstep.NSDate extends NSObject ! implements NSCopying ! { ! /** ! * Seconds between Jan 1st, 1970 to Jan 1st, 2001. ! */ ! public static var NSTimeIntervalSince1970:Number; ! ! /** String format used by initWithString() */ ! private static var DEF_STRING_FORMAT:String; ! ! /** January 1st, 2001, 00:00:00:0000 */ ! private static var g_refDate:Date; ! ! /** A date formatter that uses to format all dates. */ ! private static var g_dtFormatter:NSDateFormatter; ! ! /** The internal date. */ ! private var m_dt:Date; ! ! ! //****************************************************** ! //* Construction ! //****************************************************** ! ! /** ! * Constructs a new instance of the NSDate class. ! */ ! public function NSDate() ! { ! if (g_dtFormatter == undefined) ! { ! g_dtFormatter = ! (new NSDateFormatter()).initWithDateFormatAllowNaturalLanguage( ! DEF_STRING_FORMAT, false); ! g_dtFormatter.generatesCalendarDates(true); // for subclasses ! } ! } ! ! ! /** ! * Initializes an NSDate to the current date and time. ! */ ! public function init():NSDate ! { ! m_dt = new Date(); ! return this; ! } ! ! ! /** ! * Initializes an NSDate to the date and time specified by a string ! * conforming to the international string representation format ! * YYYY-MM-DD HH:MM:SS ±HHMM. All fields must be specified. ! */ ! public function initWithString(description:String):NSDate ! { ! var genDt:NSDate; ! var old:String; ! ! // ! // Since ActionScript is single-threaded, this is okay to do. ! // ! old = g_dtFormatter.dateFormat(); ! g_dtFormatter.setDateFormat(DEF_STRING_FORMAT); ! genDt = g_dtFormatter.dateFromString(description); ! g_dtFormatter.setDateFormat(old); // reset ! ! this.m_dt.setTime(genDt.internalDate().getTime()); ! //! deal with timezone ! ! return this; ! } ! ! ! /** ! * Initializes an NSDate to the current date and time, offset by seconds ! * seconds. ! */ ! public function initWithTimeIntervalSinceNow(seconds:Number):NSDate ! { ! m_dt = new Date(); ! m_dt.setTime(m_dt.getTime() + seconds * 1000); ! ! return this; ! } ! ! ! /** ! * Initializes an NSDate to the date and time of refDate, offset by ! * seconds seconds. ! */ ! public function initWithTimeIntervalSinceDate(seconds:Number, ! refDate:NSDate):NSDate ! { ! m_dt = new Date(); ! m_dt.setTime(refDate.m_dt.getTime() + seconds * 1000); ! ! return this; ! } ! ! ! /** ! * Initializes an NSDate to the date and time of the absolute reference ! * date, offset by seconds seconds. ! */ ! public function initWithTimeIntervalSinceReferenceDate(seconds:Number):NSDate ! { ! return initWithTimeIntervalSinceDate(seconds, NSDate.dateWithDate(g_refDate)); ! } ! ! ! //****************************************************** ! //* Properties ! //****************************************************** ! ! /** ! * @see org.actionstep.NSObject#description ! */ ! public function description():String ! { ! return "NSDate()"; ! } ! ! ! /** ! * Returns the internal date representation. Should only be used when ! * absolutely necessary. ! */ ! public function internalDate():Date ! { ! return m_dt; ! } ! ! //****************************************************** ! //* Time Intervals ! //****************************************************** ! ! /** ! * Returns the interval (seconds) between this date and Jan 1st, 1970. ! * If this date is earlier than now a negative value is returned. ! * ! * Cocoa specs have this returning an NSTimeInterval. Number is fine for ! * our purposes. ! */ ! public function timeIntervalSince1970():Number ! { ! return (this.m_dt.getTime() / 1000); ! } ! ! ! /** ! * Returns the interval (seconds) between this date and anotherDate. If ! * this date is earlier than anotherDate a negative value is returned. ! * ! * Cocoa specs have this returning an NSTimeInterval. Number is fine for ! * our purposes. ! */ ! public function timeIntervalSinceDate(anotherDate:NSDate):Number ! { ! return timeIntervalSinceIntrinsicDate(anotherDate.m_dt); ! } ! ! ! /** ! * Returns the interval (seconds) between this date and the current date ! * and time. If this date is earlier than now a negative value is returned. ! * ! * Cocoa specs have this returning an NSTimeInterval. Number is fine for ! * our purposes. ! */ ! public function timeIntervalSinceNow():Number ! { ! return timeIntervalSinceIntrinsicDate(new Date()); ! } ! ! ! /** ! * Returns the interval (seconds) between this date and the reference date ! * (Jan 1st, 2001). If this date is earlier than now a negative value is ! * returned. ! * ! * Cocoa specs have this returning an NSTimeInterval. Number is fine for ! * our purposes. ! */ ! public function timeIntervalSinceReferenceDate():Number ! { ! return timeIntervalSinceIntrinsicDate(g_refDate); ! } ! ! //****************************************************** ! //* Public Methods ! //****************************************************** ! ! /** ! * Returns a new NSDate offset by seconds seconds from this date. ! */ ! public function addTimeInterval(seconds:Number):NSDate ! { ! return (new NSDate()).initWithTimeIntervalSinceDate(seconds, this); ! } ! ! ! /** ! * Uses timeIntervalSinceDate to compare this date to anotherDate and ! * returns an NSComparisonResult. ! * ! * If the two dates are the same, NSOrderedSame is returned. ! * If this date is later than anotherDate, NSOrderedDescending is returned. ! * If this date is earlier, NSOrderedAscending is returned. ! */ ! public function compare(anotherDate:NSDate):NSComparisonResult ! { ! var delta:Number = timeIntervalSinceDate(anotherDate); ! ! if (delta == 0) ! { ! return NSComparisonResult.NSOrderedSame; ! } ! else if (delta > 0) ! { ! return NSComparisonResult.NSOrderedDescending; ! } ! else // delta < 0 ! { ! return NSComparisonResult.NSOrderedAscending; ! } ! } ! ! ! /** ! * Returns whatever is earlier, this date or anotherDate. ! */ ! public function earlierDate(anotherDate:NSDate):NSDate ! { ! return timeIntervalSinceDate(anotherDate) < 0 ? this : anotherDate; ! } ! ! ! /** ! * Returns whatever is later, this date or anotherDate. ! */ ! public function laterDate(anotherDate:NSDate):NSDate ! { ! return timeIntervalSinceDate(anotherDate) < 0 ? anotherDate : this; ! } ! ! ! /** ! * @see org.actionstep.NSObject#isEqual ! */ ! public function isEqual(anObject:NSObject):Boolean ! { ! if (!(anObject instanceof NSDate)) ! return false; ! ! return isEqualToDate(NSDate(anObject)); ! } ! ! ! /** ! * Returns TRUE if this date is equal to anotherDate, and FALSE otherwise. ! */ ! public function isEqualToDate(anotherDate:NSDate):Boolean ! { ! //! Timezones ! return m_dt.getTime() == anotherDate.m_dt.getTime(); ! } ! ! //****************************************************** ! //* NSCopying Implementation ! //****************************************************** ! ! /** ! * @see org.actionstep.NSCopying#copyWithZone ! */ ! public function copyWithZone():NSDate ! { ! return (new NSDate()).initWithTimeIntervalSinceDate(0, this); ! } ! ! //****************************************************** ! //* Protected Methods ! //****************************************************** ! //****************************************************** ! //* Private Methods ! //****************************************************** ! ! /** ! * Returns the time in seconds between this date and the intrinsic Date ! * argument. ! */ ! private function timeIntervalSinceIntrinsicDate(dt:Date):Number ! { ! return (this.m_dt.getTime() - dt.getTime()) / 1000; ! } ! ! ! //****************************************************** ! //* Public Static Properties ! //****************************************************** ! ! /** ! * Returns a date in the distant future (centuries distant). ! */ ! public function distantFuture():NSDate ! { ! return NSDate.dateWithDate(new Date(9999, 0, 1, 0, 0, 0, 0)); ! } ! ! ! /** ! * Returns a date in the distant past. ! */ ! public function distantPast():NSDate ! { ! return NSDate.dateWithDate(new Date(1, 0, 1, 0, 0, 0, 0)); ! } ! ! //****************************************************** ! //* Public Static Methods ! //****************************************************** ! ! /** ! * Constructs and returns a new date with the current date and time. ! */ ! public static function date():NSDate ! { ! return NSDate.dateWithDate(new Date()); ! } ! ! ! /** ! * Constructs and returns a new date set to the date and time of date. ! */ ! public static function dateWithDate(date:Date):NSDate ! { ! return (new NSDate()).initWithTimeIntervalSinceReferenceDate(date.getTime()); ! } ! ! ! /** ! * Constructs a new date based on the information contained in string. ! * The date formatter uses date and time preferences stored in the user ! * defaults table to parse the string. ! */ ! public static function dateWithNaturalLanguageString(string:String):NSDate ! { ! return dateWithNaturalLanguageStringLocale(string, ! NSUserDefaults.standardUserDefaults().dictionaryRepresentation()); ! } ! ! ! public static function dateWithNaturalLanguageStringLocale(string:String, ! locale:NSDictionary):NSDate ! { ! return null; ! } ! ! //****************************************************** ! //* Static Constructor ! //****************************************************** ! ! /** ! * Runs when the application begins. ! */ ! private static function classConstruct():Boolean ! { ! if (classConstructed) ! return true; ! ! // ! // Generate reference date (Jan 1st, 2001) and constant. ! // ! g_refDate = new Date(2001, 0, 1, 0, 0, 0, 0); ! NSTimeIntervalSince1970 = Math.round(g_refDate.getTime() / 1000); ! ! // ! // For formatting (YYYY-MM-DD HH:MM:SS ±HHMM) ! // ! DEF_STRING_FORMAT = "%Y-%m-%d %H:%M:%S %z"; ! ! return true; ! } ! ! private static var classConstructed:Boolean = classConstruct(); ! } Index: NSAlert.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSAlert.as,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NSAlert.as 26 Jul 2005 11:34:21 -0000 1.7 --- NSAlert.as 27 Jul 2005 17:56:40 -0000 1.8 *************** *** 182,187 **** (window:NSWindow, delegate, sel:String, ctxt:Object):Void { var list:Array = m_buttons.internalList(); ! m_sheet = ASAlertPanel.NSGetAlertPanel ! ("", m_msg, list[0].title(), list[1].title(), list[2].title()); window.resignKeyWindow(); --- 182,186 ---- (window:NSWindow, delegate, sel:String, ctxt:Object):Void { var list:Array = m_buttons.internalList(); ! m_sheet = ASAlertPanel.NSGetAlert("", m_msg, list[0].title(), list[1].title(), list[2].title()); window.resignKeyWindow(); |
From: Richard K. <ric...@us...> - 2005-07-27 17:31:51
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14067 Modified Files: NSDate.as Log Message: scott's latest via email, could not commit to cvs himself Index: NSDate.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSDate.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NSDate.as 27 Jul 2005 06:57:05 -0000 1.1 --- NSDate.as 27 Jul 2005 17:31:42 -0000 1.2 *************** *** 1,3 **** ! /* * Copyright (c) 2005, InfoEther, Inc. * All rights reserved. --- 1,3 ---- ! /* * Copyright (c) 2005, InfoEther, Inc. * All rights reserved. *************** *** 46,433 **** */ class org.actionstep.NSDate extends NSObject ! implements NSCopying ! { ! /** ! * Seconds between Jan 1st, 1970 to Jan 1st, 2001. ! */ ! public static var NSTimeIntervalSince1970:Number; ! ! /** String format used by initWithString() */ ! private static var DEF_STRING_FORMAT:String; ! ! /** January 1st, 2001, 00:00:00:0000 */ ! private static var g_refDate:Date; ! ! /** A date formatter that uses to format all dates. */ ! private static var g_dtFormatter:NSDateFormatter; ! ! /** The internal date. */ ! private var m_dt:Date; ! ! ! //****************************************************** ! //* Construction ! //****************************************************** ! ! /** ! * Constructs a new instance of the NSDate class. ! */ ! public function NSDate() ! { ! if (g_dtFormatter == undefined) ! { ! g_dtFormatter = ! (new NSDateFormatter()).initWithDateFormatallowNaturalLanguage( ! DEF_STRING_FORMAT, false); ! g_dtFormatter.generatesCalendarDates(true); // for subclasses ! } ! } ! ! ! /** ! * Initializes an NSDate to the current date and time. ! */ ! public function init():NSDate ! { ! m_dt = new Date(); ! return this; ! } ! ! ! /** ! * Initializes an NSDate to the date and time specified by a string ! * conforming to the international string representation format ! * YYYY-MM-DD HH:MM:SS ±HHMM. All fields must be specified. ! */ ! public function initWithString(description:String):NSDate ! { ! var genDt:NSDate; ! var old:String; ! ! // ! // Since ActionScript is single-threaded, this is okay to do. ! // ! old = g_dtFormatter.dateFormat(); ! g_dtFormatter.setDateFormat(DEF_STRING_FORMAT); ! genDt = g_dtFormatter.dateFromString(description); ! g_dtFormatter.setDateFormat(old); // reset ! ! this.m_dt.setTime(genDt.internalDate().getTime()); ! //! deal with timezone ! ! return this; ! } ! ! ! /** ! * Initializes an NSDate to the current date and time, offset by seconds ! * seconds. ! */ ! public function initWithTimeIntervalSinceNow(seconds:Number):NSDate ! { ! m_dt = new Date(); ! m_dt.setTime(m_dt.getTime() + seconds * 1000); ! ! return this; ! } ! ! ! /** ! * Initializes an NSDate to the date and time of refDate, offset by ! * seconds seconds. ! */ ! public function initWithTimeIntervalSinceDate(seconds:Number, ! refDate:NSDate):NSDate ! { ! m_dt = new Date(); ! m_dt.setTime(refDate.m_dt.getTime() + seconds * 1000); ! ! return this; ! } ! ! ! /** ! * Initializes an NSDate to the date and time of the absolute reference ! * date, offset by seconds seconds. ! */ ! public function initWithTimeIntervalSinceReferenceDate(seconds:Number):NSDate ! { ! return initWithTimeIntervalSinceDate(seconds, NSDate.dateWithDate(g_refDate)); ! } ! ! ! //****************************************************** ! //* Properties ! //****************************************************** ! ! /** ! * @see org.actionstep.NSObject#description ! */ ! public function description():String ! { ! return "NSDate()"; ! } ! ! ! /** ! * Returns the internal date representation. Should only be used when ! * absolutely necessary. ! */ ! public function internalDate():Date ! { ! return m_dt; ! } ! ! //****************************************************** ! //* Time Intervals ! //****************************************************** ! ! /** ! * Returns the interval (seconds) between this date and Jan 1st, 1970. ! * If this date is earlier than now a negative value is returned. ! * ! * Cocoa specs have this returning an NSTimeInterval. Number is fine for ! * our purposes. ! */ ! public function timeIntervalSince1970():Number ! { ! return (this.m_dt.getTime() / 1000); ! } ! ! ! /** ! * Returns the interval (seconds) between this date and anotherDate. If ! * this date is earlier than anotherDate a negative value is returned. ! * ! * Cocoa specs have this returning an NSTimeInterval. Number is fine for ! * our purposes. ! */ ! public function timeIntervalSinceDate(anotherDate:NSDate):Number ! { ! return timeIntervalSinceIntrinsicDate(anotherDate.m_dt); ! } ! /** ! * Returns the interval (seconds) between this date and the current date ! * and time. If this date is earlier than now a negative value is returned. ! * ! * Cocoa specs have this returning an NSTimeInterval. Number is fine for ! * our purposes. ! */ ! public function timeIntervalSinceNow():Number ! { ! return timeIntervalSinceIntrinsicDate(new Date()); ! } ! ! ! /** ! * Returns the interval (seconds) between this date and the reference date ! * (Jan 1st, 2001). If this date is earlier than now a negative value is ! * returned. ! * ! * Cocoa specs have this returning an NSTimeInterval. Number is fine for ! * our purposes. ! */ ! public function timeIntervalSinceReferenceDate():Number ! { ! return timeIntervalSinceIntrinsicDate(g_refDate); ! } ! ! //****************************************************** ! //* Public Methods ! //****************************************************** ! ! /** ! * Returns a new NSDate offset by seconds seconds from this date. ! */ ! public function addTimeInterval(seconds:Number):NSDate ! { ! return (new NSDate()).initWithTimeIntervalSinceDate(seconds, this); ! } ! ! ! /** ! * Uses timeIntervalSinceDate to compare this date to anotherDate and ! * returns an NSComparisonResult. ! * ! * If the two dates are the same, NSOrderedSame is returned. ! * If this date is later than anotherDate, NSOrderedDescending is returned. ! * If this date is earlier, NSOrderedAscending is returned. ! */ ! public function compare(anotherDate:NSDate):NSComparisonResult ! { ! var delta:Number = timeIntervalSinceDate(anotherDate); ! ! if (delta == 0) ! { ! return NSComparisonResult.NSOrderedSame; ! } ! else if (delta > 0) ! { ! return NSComparisonResult.NSOrderedDescending; ! } ! else // delta < 0 ! { ! return NSComparisonResult.NSOrderedAscending; ! } ! } ! ! ! /** ! * Returns whatever is earlier, this date or anotherDate. ! */ ! public function earlierDate(anotherDate:NSDate):NSDate ! { ! return timeIntervalSinceDate(anotherDate) < 0 ? this : anotherDate; ! } ! ! ! /** ! * Returns whatever is later, this date or anotherDate. ! */ ! public function laterDate(anotherDate:NSDate):NSDate ! { ! return timeIntervalSinceDate(anotherDate) < 0 ? anotherDate : this; ! } ! ! ! /** ! * @see org.actionstep.NSObject#isEqual ! */ ! public function isEqual(anObject:NSObject):Boolean ! { ! if (!(anObject instanceof NSDate)) ! return false; ! ! return isEqualToDate(NSDate(anObject)); ! } ! ! ! /** ! * Returns TRUE if this date is equal to anotherDate, and FALSE otherwise. ! */ ! public function isEqualToDate(anotherDate:NSDate):Boolean ! { ! //! Timezones ! return m_dt.getTime() == anotherDate.m_dt.getTime(); ! } ! ! //****************************************************** ! //* NSCopying Implementation ! //****************************************************** ! ! /** ! * @see org.actionstep.NSCopying#copyWithZone ! */ ! public function copyWithZone():NSDate ! { ! return (new NSDate()).initWithTimeIntervalSinceDate(0, this); ! } ! ! //****************************************************** ! //* Protected Methods ! //****************************************************** ! //****************************************************** ! //* Private Methods ! //****************************************************** ! ! /** ! * Returns the time in seconds between this date and the intrinsic Date ! * argument. ! */ ! private function timeIntervalSinceIntrinsicDate(dt:Date):Number ! { ! return (this.m_dt.getTime() - dt.getTime()) / 1000; ! } ! ! ! //****************************************************** ! //* Public Static Properties ! //****************************************************** ! ! /** ! * Returns a date in the distant future (centuries distant). ! */ ! public function distantFuture():NSDate ! { ! return NSDate.dateWithDate(new Date(9999, 0, 1, 0, 0, 0, 0)); ! } ! ! /** ! * Returns a date in the distant past. ! */ ! public function distantPast():NSDate ! { ! return NSDate.dateWithDate(new Date(1, 0, 1, 0, 0, 0, 0)); ! } ! ! //****************************************************** ! //* Public Static Methods ! //****************************************************** ! ! /** ! * Constructs and returns a new date with the current date and time. ! */ ! public static function date():NSDate ! { ! return NSDate.dateWithDate(new Date()); ! } ! ! ! /** ! * Constructs and returns a new date set to the date and time of date. ! */ ! public static function dateWithDate(date:Date):NSDate ! { ! return (new NSDate()).initWithTimeIntervalSinceReferenceDate(date.getTime()); ! } ! ! ! /** ! * Constructs a new date based on the information contained in string. ! * The date formatter uses date and time preferences stored in the user ! * defaults table to parse the string. ! */ ! public static function dateWithNaturalLanguageString(string:String):NSDate ! { ! return dateWithNaturalLanguageStringLocale(string, ! NSUserDefaults.standardUserDefaults().dictionaryRepresentation()); ! } ! ! ! public static function dateWithNaturalLanguageStringLocale(string:String, ! locale:NSDictionary):NSDate ! { ! return null; ! } ! ! //****************************************************** ! //* Static Constructor ! //****************************************************** ! ! /** ! * Runs when the application begins. ! */ ! private static function classConstruct():Boolean ! { ! if (classConstructed) ! return true; ! ! // ! // Generate reference date (Jan 1st, 2001) and constant. ! // ! g_refDate = new Date(2001, 0, 1, 0, 0, 0, 0); ! NSTimeIntervalSince1970 = Math.round(g_refDate.getTime() / 1000); ! ! // ! // For formatting (YYYY-MM-DD HH:MM:SS ±HHMM) ! // ! DEF_STRING_FORMAT = "%Y-%m-%d %H:%M:%S %z"; ! ! return true; ! } ! ! private static var classConstructed:Boolean = classConstruct(); } --- 46,433 ---- */ class org.actionstep.NSDate extends NSObject ! implements NSCopying ! { ! /** ! * Seconds between Jan 1st, 1970 to Jan 1st, 2001. ! */ ! public static var NSTimeIntervalSince1970:Number; ! ! /** String format used by initWithString() */ ! private static var DEF_STRING_FORMAT:String; ! ! /** January 1st, 2001, 00:00:00:0000 */ ! private static var g_refDate:Date; ! ! /** A date formatter that uses to format all dates. */ ! private static var g_dtFormatter:NSDateFormatter; ! ! /** The internal date. */ ! private var m_dt:Date; ! ! ! //****************************************************** ! //* Construction ! //****************************************************** ! ! /** ! * Constructs a new instance of the NSDate class. ! */ ! public function NSDate() ! { ! if (g_dtFormatter == undefined) ! { ! g_dtFormatter = ! (new NSDateFormatter()).initWithDateFormatallowNaturalLanguage( ! DEF_STRING_FORMAT, false); ! g_dtFormatter.generatesCalendarDates(true); // for subclasses ! } ! } ! ! ! /** ! * Initializes an NSDate to the current date and time. ! */ ! public function init():NSDate ! { ! m_dt = new Date(); ! return this; ! } ! ! ! /** ! * Initializes an NSDate to the date and time specified by a string ! * conforming to the international string representation format ! * YYYY-MM-DD HH:MM:SS ±HHMM. All fields must be specified. ! */ ! public function initWithString(description:String):NSDate ! { ! var genDt:NSDate; ! var old:String; ! ! // ! // Since ActionScript is single-threaded, this is okay to do. ! // ! old = g_dtFormatter.dateFormat(); ! g_dtFormatter.setDateFormat(DEF_STRING_FORMAT); ! genDt = g_dtFormatter.dateFromString(description); ! g_dtFormatter.setDateFormat(old); // reset ! ! this.m_dt.setTime(genDt.internalDate().getTime()); ! //! deal with timezone ! ! return this; ! } ! ! ! /** ! * Initializes an NSDate to the current date and time, offset by seconds ! * seconds. ! */ ! public function initWithTimeIntervalSinceNow(seconds:Number):NSDate ! { ! m_dt = new Date(); ! m_dt.setTime(m_dt.getTime() + seconds * 1000); ! ! return this; ! } ! ! ! /** ! * Initializes an NSDate to the date and time of refDate, offset by ! * seconds seconds. ! */ ! public function initWithTimeIntervalSinceDate(seconds:Number, ! refDate:NSDate):NSDate ! { ! m_dt = new Date(); ! m_dt.setTime(refDate.m_dt.getTime() + seconds * 1000); ! ! return this; ! } ! ! ! /** ! * Initializes an NSDate to the date and time of the absolute reference ! * date, offset by seconds seconds. ! */ ! public function initWithTimeIntervalSinceReferenceDate(seconds:Number):NSDate ! { ! return initWithTimeIntervalSinceDate(seconds, NSDate.dateWithDate(g_refDate)); ! } ! ! ! //****************************************************** ! //* Properties ! //****************************************************** ! ! /** ! * @see org.actionstep.NSObject#description ! */ ! public function description():String ! { ! return "NSDate()"; ! } ! ! ! /** ! * Returns the internal date representation. Should only be used when ! * absolutely necessary. ! */ ! public function internalDate():Date ! { ! return m_dt; ! } ! ! //****************************************************** ! //* Time Intervals ! //****************************************************** ! ! /** ! * Returns the interval (seconds) between this date and Jan 1st, 1970. ! * If this date is earlier than now a negative value is returned. ! * ! * Cocoa specs have this returning an NSTimeInterval. Number is fine for ! * our purposes. ! */ ! public function timeIntervalSince1970():Number ! { ! return (this.m_dt.getTime() / 1000); ! } ! ! ! /** ! * Returns the interval (seconds) between this date and anotherDate. If ! * this date is earlier than anotherDate a negative value is returned. ! * ! * Cocoa specs have this returning an NSTimeInterval. Number is fine for ! * our purposes. ! */ ! public function timeIntervalSinceDate(anotherDate:NSDate):Number ! { ! return timeIntervalSinceIntrinsicDate(anotherDate.m_dt); ! } ! /** ! * Returns the interval (seconds) between this date and the current date ! * and time. If this date is earlier than now a negative value is returned. ! * ! * Cocoa specs have this returning an NSTimeInterval. Number is fine for ! * our purposes. ! */ ! public function timeIntervalSinceNow():Number ! { ! return timeIntervalSinceIntrinsicDate(new Date()); ! } ! ! ! /** ! * Returns the interval (seconds) between this date and the reference date ! * (Jan 1st, 2001). If this date is earlier than now a negative value is ! * returned. ! * ! * Cocoa specs have this returning an NSTimeInterval. Number is fine for ! * our purposes. ! */ ! public function timeIntervalSinceReferenceDate():Number ! { ! return timeIntervalSinceIntrinsicDate(g_refDate); ! } ! ! //****************************************************** ! //* Public Methods ! //****************************************************** ! ! /** ! * Returns a new NSDate offset by seconds seconds from this date. ! */ ! public function addTimeInterval(seconds:Number):NSDate ! { ! return (new NSDate()).initWithTimeIntervalSinceDate(seconds, this); ! } ! ! ! /** ! * Uses timeIntervalSinceDate to compare this date to anotherDate and ! * returns an NSComparisonResult. ! * ! * If the two dates are the same, NSOrderedSame is returned. ! * If this date is later than anotherDate, NSOrderedDescending is returned. ! * If this date is earlier, NSOrderedAscending is returned. ! */ ! public function compare(anotherDate:NSDate):NSComparisonResult ! { ! var delta:Number = timeIntervalSinceDate(anotherDate); ! ! if (delta == 0) ! { ! return NSComparisonResult.NSOrderedSame; ! } ! else if (delta > 0) ! { ! return NSComparisonResult.NSOrderedDescending; ! } ! else // delta < 0 ! { ! return NSComparisonResult.NSOrderedAscending; ! } ! } ! ! ! /** ! * Returns whatever is earlier, this date or anotherDate. ! */ ! public function earlierDate(anotherDate:NSDate):NSDate ! { ! return timeIntervalSinceDate(anotherDate) < 0 ? this : anotherDate; ! } ! ! ! /** ! * Returns whatever is later, this date or anotherDate. ! */ ! public function laterDate(anotherDate:NSDate):NSDate ! { ! return timeIntervalSinceDate(anotherDate) < 0 ? anotherDate : this; ! } ! ! ! /** ! * @see org.actionstep.NSObject#isEqual ! */ ! public function isEqual(anObject:NSObject):Boolean ! { ! if (!(anObject instanceof NSDate)) ! return false; ! ! return isEqualToDate(NSDate(anObject)); ! } ! ! ! /** ! * Returns TRUE if this date is equal to anotherDate, and FALSE otherwise. ! */ ! public function isEqualToDate(anotherDate:NSDate):Boolean ! { ! //! Timezones ! return m_dt.getTime() == anotherDate.m_dt.getTime(); ! } ! ! //****************************************************** ! //* NSCopying Implementation ! //****************************************************** ! ! /** ! * @see org.actionstep.NSCopying#copyWithZone ! */ ! public function copyWithZone():NSDate ! { ! return (new NSDate()).initWithTimeIntervalSinceDate(0, this); ! } ! ! //****************************************************** ! //* Protected Methods ! //****************************************************** ! //****************************************************** ! //* Private Methods ! //****************************************************** ! ! /** ! * Returns the time in seconds between this date and the intrinsic Date ! * argument. ! */ ! private function timeIntervalSinceIntrinsicDate(dt:Date):Number ! { ! return (this.m_dt.getTime() - dt.getTime()) / 1000; ! } ! ! ! //****************************************************** ! //* Public Static Properties ! //****************************************************** ! ! /** ! * Returns a date in the distant future (centuries distant). ! */ ! public function distantFuture():NSDate ! { ! return NSDate.dateWithDate(new Date(9999, 0, 1, 0, 0, 0, 0)); ! } ! ! /** ! * Returns a date in the distant past. ! */ ! public function distantPast():NSDate ! { ! return NSDate.dateWithDate(new Date(1, 0, 1, 0, 0, 0, 0)); ! } ! ! //****************************************************** ! //* Public Static Methods ! //****************************************************** ! ! /** ! * Constructs and returns a new date with the current date and time. ! */ ! public static function date():NSDate ! { ! return NSDate.dateWithDate(new Date()); ! } ! ! ! /** ! * Constructs and returns a new date set to the date and time of date. ! */ ! public static function dateWithDate(date:Date):NSDate ! { ! return (new NSDate()).initWithTimeIntervalSinceReferenceDate(date.getTime()); ! } ! ! ! /** ! * Constructs a new date based on the information contained in string. ! * The date formatter uses date and time preferences stored in the user ! * defaults table to parse the string. ! */ ! public static function dateWithNaturalLanguageString(string:String):NSDate ! { ! return dateWithNaturalLanguageStringLocale(string, ! NSUserDefaults.standardUserDefaults().dictionaryRepresentation()); ! } ! ! ! public static function dateWithNaturalLanguageStringLocale(string:String, ! locale:NSDictionary):NSDate ! { ! return null; ! } ! ! //****************************************************** ! //* Static Constructor ! //****************************************************** ! ! /** ! * Runs when the application begins. ! */ ! private static function classConstruct():Boolean ! { ! if (classConstructed) ! return true; ! ! // ! // Generate reference date (Jan 1st, 2001) and constant. ! // ! g_refDate = new Date(2001, 0, 1, 0, 0, 0, 0); ! NSTimeIntervalSince1970 = Math.round(g_refDate.getTime() / 1000); ! ! // ! // For formatting (YYYY-MM-DD HH:MM:SS ±HHMM) ! // ! DEF_STRING_FORMAT = "%Y-%m-%d %H:%M:%S %z"; ! ! return true; ! } ! ! private static var classConstructed:Boolean = classConstruct(); } |
From: Tay R. C. <rc...@us...> - 2005-07-27 09:32:40
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26555/actionstep/org/actionstep/test Modified Files: ASTestPanel.as Log Message: tests make use of new naming Index: ASTestPanel.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/test/ASTestPanel.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ASTestPanel.as 27 Jul 2005 09:17:53 -0000 1.1 --- ASTestPanel.as 27 Jul 2005 09:32:30 -0000 1.2 *************** *** 98,106 **** } ! public static function done(ret, win) { if(ret==NSRunResponse.NSContinues) return; var ans = ASUtils.findMatch([NSAlertReturn], ret); TRACE("button clicked: "+ans.prop); ! win.close(); } --- 98,106 ---- } ! public static function done(ret, panel) { if(ret==NSRunResponse.NSContinues) return; var ans = ASUtils.findMatch([NSAlertReturn], ret); TRACE("button clicked: "+ans.prop); ! ASAlertPanel.NSRelease(panel); } *************** *** 111,123 **** public static function panel() { ! ASAlertPanel.NSRunAlertPanel.apply(ASAlertPanel, alertArgs); } public static function critical() { ! ASAlertPanel.NSRunCriticalAlertPanel.apply(ASAlertPanel, alertArgs); } public static function informational() { ! ASAlertPanel.NSRunInformationalAlertPanel.apply(ASAlertPanel, alertArgs); } --- 111,123 ---- public static function panel() { ! ASAlertPanel.NSRunAlert.apply(ASAlertPanel, alertArgs); } public static function critical() { ! ASAlertPanel.NSRunCriticalAlert.apply(ASAlertPanel, alertArgs); } public static function informational() { ! ASAlertPanel.NSRunInformationalAlert.apply(ASAlertPanel, alertArgs); } |
From: Tay R. C. <rc...@us...> - 2005-07-27 09:29:33
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26192/actionstep/org/actionstep Modified Files: ASAlertPanel.as Log Message: - NSRelease now closes window Index: ASAlertPanel.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASAlertPanel.as,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** ASAlertPanel.as 27 Jul 2005 09:27:45 -0000 1.22 --- ASAlertPanel.as 27 Jul 2005 09:29:23 -0000 1.23 *************** *** 401,405 **** panel.runModal(call, sel); - NSRelease(panel); } --- 401,404 ---- *************** *** 430,434 **** panel.runModal(call, sel); - NSRelease(panel); } --- 429,432 ---- *************** *** 457,461 **** panel.runModal(call, sel); - NSRelease(panel); } --- 455,458 ---- *************** *** 465,469 **** && (panel != m_criticalAlertPanel)) { ! delete panel; } } --- 462,466 ---- && (panel != m_criticalAlertPanel)) { ! panel.close(); } } |
From: Tay R. C. <rc...@us...> - 2005-07-27 09:27:54
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25861/actionstep/org/actionstep Modified Files: ASAlertPanel.as Log Message: changed some static function names Index: ASAlertPanel.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASAlertPanel.as,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ASAlertPanel.as 27 Jul 2005 09:15:32 -0000 1.21 --- ASAlertPanel.as 27 Jul 2005 09:27:45 -0000 1.22 *************** *** 370,374 **** } ! public static function NSGetAlertPanel( title:String, msg:String, --- 370,374 ---- } ! public static function NSGetAlert( title:String, msg:String, *************** *** 384,388 **** } ! public static function NSRunAlertPanel( title:String, message:String, --- 384,388 ---- } ! public static function NSRunAlert( title:String, message:String, *************** *** 401,410 **** panel.runModal(call, sel); ! NSReleaseAlertPanel(panel); } //NSRunLocalizedAlertPanel ! public static function NSGetCriticalAlertPanel( title:String, message:String, --- 401,410 ---- panel.runModal(call, sel); ! NSRelease(panel); } //NSRunLocalizedAlertPanel ! public static function NSGetCriticalAlert( title:String, message:String, *************** *** 417,421 **** } ! public static function NSRunCriticalAlertPanel( title:String, message:String, --- 417,421 ---- } ! public static function NSRunCriticalAlert( title:String, message:String, *************** *** 430,437 **** panel.runModal(call, sel); ! NSReleaseAlertPanel(panel); } ! public static function NSGetInformationalAlertPanel( title:String, message:String, --- 430,437 ---- panel.runModal(call, sel); ! NSRelease(panel); } ! public static function NSGetInformationalAlert( title:String, message:String, *************** *** 444,448 **** } ! public static function NSRunInformationalAlertPanel( title:String, message:String, --- 444,448 ---- } ! public static function NSRunInformationalAlert( title:String, message:String, *************** *** 457,464 **** panel.runModal(call, sel); ! NSReleaseAlertPanel(panel); } ! public static function NSReleaseAlertPanel(panel:ASAlertPanel):Void { if ((panel != m_standardAlertPanel) && (panel != m_informationalAlertPanel) --- 457,464 ---- panel.runModal(call, sel); ! NSRelease(panel); } ! public static function NSRelease(panel:ASAlertPanel):Void { if ((panel != m_standardAlertPanel) && (panel != m_informationalAlertPanel) |
From: Tay R. C. <rc...@us...> - 2005-07-27 09:18:11
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24388/actionstep/org/actionstep/test Added Files: ASTestPanel.as Log Message: tests normal, critical and informational panels --- NEW FILE: ASTestPanel.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.ASTestPanel { public static var self = ASTestPanel, app:NSApplication = NSApplication.sharedApplication(), main:NSWindow, other:NSWindow, view1, view2, b1:NSButton, b2:NSButton, b3:NSButton, textField:NSTextField, textField2:NSTextField, alertArgs:Array public static function test() { TRACE("app: "+app); main= (new NSWindow()).initWithContentRectStyleMask(new NSRect(50,50,250,250), NSWindow.NSTitledWindowMask); main.setTitle("Main"); other = (new NSWindow()).initWithContentRectStyleMask(new NSRect(400,100,250,250), NSWindow.NSTitledWindowMask); other.setTitle("Some Other Window"); view1 = (new ASTestView()).initWithFrame(new NSRect(0,0,25,25)); view1.setBorderColor(new NSColor(0xFFF000)); view2 = (new ASTestView()).initWithFrame(new NSRect(0,0,250,250)); view2.setBorderColor(new NSColor(0xFF0000)); b1 = (new NSButton()).initWithFrame(new NSRect(10,20,80,30)); b1.setTitle("panel"); b1.sendActionOn(NSEvent.NSLeftMouseUpMask); b1.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); b1.setTarget(self); b1.setAction("panel"); b2 = (new NSButton()).initWithFrame(new NSRect(10,60,80,30)); b2.setTitle("critical"); b2.sendActionOn(NSEvent.NSLeftMouseUpMask); b2.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); b2.setTarget(self); b2.setAction("critical"); b3 = (new NSButton()).initWithFrame(new NSRect(10,100,80,30)); b3.setTitle("informational"); b3.sendActionOn(NSEvent.NSLeftMouseUpMask); b3.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); b3.setTarget(self); b3.setAction("informational"); textField = (new NSTextField()).initWithFrame(new NSRect(10,160,120,30)); textField2 = (new NSTextField()).initWithFrame(new NSRect(10,160,120,30)); view1.addSubview(b1); view1.addSubview(b2); view1.addSubview(b3); view1.addSubview(textField); view2.addSubview(textField2); main.setContentView(view1); other.setContentView(view2); main.makeMainWindow(); app.run(); alertArgs = [null, "A very long line of text...lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", "OK","Cancel", "None", self, "done"] } public static function done(ret, win) { if(ret==NSRunResponse.NSContinues) return; var ans = ASUtils.findMatch([NSAlertReturn], ret); TRACE("button clicked: "+ans.prop); win.close(); } //look like NSObject public static function respondsToSelector(sel:String):Boolean { return self.hasOwnProperty(sel); } public static function panel() { ASAlertPanel.NSRunAlertPanel.apply(ASAlertPanel, alertArgs); } public static function critical() { ASAlertPanel.NSRunCriticalAlertPanel.apply(ASAlertPanel, alertArgs); } public static function informational() { ASAlertPanel.NSRunInformationalAlertPanel.apply(ASAlertPanel, alertArgs); } public static function toString():String { return "Test::ASTestPanel" } } |
From: Tay R. C. <rc...@us...> - 2005-07-27 09:15:55
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24079/actionstep/org/actionstep Modified Files: ASAlertPanel.as Log Message: checks if title is null in - getSomePanel Index: ASAlertPanel.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASAlertPanel.as,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ASAlertPanel.as 26 Jul 2005 11:40:49 -0000 1.20 --- ASAlertPanel.as 27 Jul 2005 09:15:32 -0000 1.21 *************** *** 37,41 **** import org.actionstep.NSImage; import org.actionstep.NSSize; ! import org.actionstep.NSPoint; import org.actionstep.ASDraw; --- 37,41 ---- import org.actionstep.NSImage; import org.actionstep.NSSize; ! import org.actionstep.NSPoint; import org.actionstep.ASDraw; *************** *** 353,357 **** instance = panel; } ! if (title == "") { title = defTitle; } --- 353,357 ---- instance = panel; } ! if (title == "" || title ==null) { title = defTitle; } |
From: Scott H. <sco...@us...> - 2005-07-27 07:12:24
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8284/src/org/actionstep Added Files: NSDateFormatter.as Log Message: Formats dates Can't yet generate dates from strings, but will be able to soon. --- NEW FILE: NSDateFormatter.as --- (This appears to be a binary file; contents omitted.) |
From: Scott H. <sco...@us...> - 2005-07-27 07:11:46
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8182/src/org/actionstep Modified Files: NSCalendarDate.as Log Message: Updated to subclass NSDate All formatting stuff removed and placed in NSDateFormatter description() methods updated Index: NSCalendarDate.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSCalendarDate.as,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NSCalendarDate.as 25 Jul 2005 05:31:23 -0000 1.3 --- NSCalendarDate.as 27 Jul 2005 07:11:33 -0000 1.4 *************** *** 33,36 **** --- 33,38 ---- import org.actionstep.NSArray; + import org.actionstep.NSDate; + import org.actionstep.NSDateFormatter; import org.actionstep.NSDictionary; import org.actionstep.NSException; *************** *** 44,48 **** * @author Scott Hyndman */ ! class org.actionstep.NSCalendarDate extends Date //! should really be NSDate { /** The number of milliseconds in a day. */ --- 46,50 ---- * @author Scott Hyndman */ ! class org.actionstep.NSCalendarDate extends NSDate { /** The number of milliseconds in a day. */ *************** *** 99,102 **** --- 101,106 ---- format:String, locale:NSDictionary):NSCalendarDate { + super.init(); + NSCalendarDate.reverseFormatWithDescriptionFormatLocale(description, format, locale); *************** *** 124,133 **** ):NSCalendarDate { ! super.setFullYear(year); ! super.setMonth(month - 1); ! super.setDate(day); ! super.setHours(hour); ! super.setMinutes(minute); ! super.setSeconds(second); m_timeZone = timezone; --- 128,139 ---- ):NSCalendarDate { ! super.init(); ! ! m_dt.setFullYear(year); ! m_dt.setMonth(month - 1); ! m_dt.setDate(day); ! m_dt.setHours(hour); ! m_dt.setMinutes(minute); ! m_dt.setSeconds(second); m_timeZone = timezone; *************** *** 137,140 **** --- 143,159 ---- + /** + * Inits a calendar date using an instance of ActionScript's Date class. + * + * ActionStep only. + */ + public function initWithDate(date:Date):NSCalendarDate + { + super.init(); + + m_dt.setTime(date.getTime()); + return this; + } + //****************************************************** //* Properties *************** *** 167,171 **** public function dayOfCommonEra():Number { ! var ms:Number = super.getTime(); ms += -1 * g_firstDayInCommonEra.getTime(); --- 186,190 ---- public function dayOfCommonEra():Number { ! var ms:Number = m_dt.getTime(); ms += -1 * g_firstDayInCommonEra.getTime(); *************** *** 179,183 **** public function dayOfMonth():Number { ! return super.getDate(); } --- 198,202 ---- public function dayOfMonth():Number { ! return m_dt.getDate(); } *************** *** 188,192 **** public function dayOfWeek():Number { ! return super.getDay(); } --- 207,211 ---- public function dayOfWeek():Number { ! return m_dt.getDay(); } *************** *** 200,204 **** var calcDate:Date; ! calcDate = toDate(); calcDate.setMonth(0); calcDate.setDate(1); --- 219,223 ---- var calcDate:Date; ! calcDate = super.copy().internalDate(); calcDate.setMonth(0); calcDate.setDate(1); *************** *** 208,212 **** calcDate.setMilliseconds(0); ! delta = super.getTime() - calcDate.getTime(); return Math.ceil(delta / MSPERDAY); } --- 227,231 ---- calcDate.setMilliseconds(0); ! delta = m_dt.getTime() - calcDate.getTime(); return Math.ceil(delta / MSPERDAY); } *************** *** 218,222 **** public function hourOfDay():Number { ! return super.getHours(); } --- 237,241 ---- public function hourOfDay():Number { ! return m_dt.getHours(); } *************** *** 227,231 **** public function minuteOfHour():Number { ! return super.getMinutes(); } --- 246,250 ---- public function minuteOfHour():Number { ! return m_dt.getMinutes(); } *************** *** 236,240 **** public function monthOfYear():Number { ! return super.getMonth() + 1; } --- 255,259 ---- public function monthOfYear():Number { ! return m_dt.getMonth() + 1; } *************** *** 245,249 **** public function secondOfMinute():Number { ! return super.getSeconds(); } --- 264,268 ---- public function secondOfMinute():Number { ! return m_dt.getSeconds(); } *************** *** 272,276 **** public function yearOfCommonEra():Number { ! return super.getFullYear(); } --- 291,295 ---- public function yearOfCommonEra():Number { ! return m_dt.getFullYear(); } *************** *** 309,313 **** locale:NSDictionary):String { ! return NSCalendarDate.formatDate(format, this, locale); //!implement } --- 328,334 ---- locale:NSDictionary):String { ! var dtf:NSDateFormatter = (new NSDateFormatter() ! ).initWithDateFormatAllowNaturalLanguage(format, true); ! return dtf.stringFromDate(this); //! locale } *************** *** 351,355 **** // Add years. // ! calcDate = toDate(); calcDate.setFullYear(calcDate.getFullYear() + years); --- 372,376 ---- // Add years. // ! calcDate = super.copy().internalDate(); calcDate.setFullYear(calcDate.getFullYear() + years); *************** *** 381,396 **** m_timeZone); } ! ! ! /** ! * Returns this CalendarDate as a Date (an actionscript core class). ! */ ! public function toDate():Date ! { ! var dt:Date = new Date(); ! dt.setTime(super.getTime()); ! return dt; ! } ! /** --- 402,406 ---- m_timeZone); } ! /** *************** *** 426,432 **** // Account for timezones // ! dt = toDate(); dt.setTime(dt.getTime() - timeZone() * MSPERHOUR); ! date = calDate.toDate(); date.setTime(date.getTime() - calDate.timeZone() * MSPERHOUR); --- 436,442 ---- // Account for timezones // ! dt = super.copy().internalDate(); dt.setTime(dt.getTime() - timeZone() * MSPERHOUR); ! date = calDate.copy().internalDate(); date.setTime(date.getTime() - calDate.timeZone() * MSPERHOUR); *************** *** 434,438 **** // Find years // ! years = super.getFullYear() - date.getFullYear(); // --- 444,448 ---- // Find years // ! years = m_dt.getFullYear() - date.getFullYear(); // *************** *** 523,577 **** /** - * Formats the date date according to the calendar format format, and - * returns the resulting string. - */ - private static function formatDate(format:String, date:NSCalendarDate, - locale:NSDictionary):String - { - var char:String; // the current character - var frmtPrt:String; // the formatted "part" - var isRep:Boolean = false; // "is" a replace character (character following %) - var len:Number = format.length; - var formatted:String; - - if (locale == null) - { - // locale = default; - } - - // - // Move through the format string's characters. - // - for (var i:Number = 0; i < len; i++) - { - char = format.charAt(i); - - if (isRep) - { - if (isTypeCharacter(char)) - { - formatted = g_types[char](char, date, locale); - format = format.substring(0, i - 1) + formatted + - format.substring(i); - len += formatted.length - 2; - } - else - { - //! error? - } - - isRep = false; - continue; - } - - if (char == "%") - isRep = true; - } - - return format; - } - - - /** * Uses a string representation of a date and the format string * originally used to output the date, and returns the date described. --- 533,536 ---- *************** *** 588,895 **** - /** - * Handles a percentage symbol. - */ - private static function handlePercentage(char:String, date:NSCalendarDate, - locale:NSDictionary):String - { - return "%"; - } - - - /** - * Handles a formatted weekday. - */ - private static function handleWeekDay(char:String, date:NSCalendarDate, - locale:NSDictionary):String - { - var str:String; - var arr:NSArray; - var dayOfWeek:Number = date.dayOfWeek(); - - switch (char) - { - case "a": - arr = NSArray(locale.objectForKey( - NSUserDefaults.NSShortWeekDayNameArray)); - str = String(arr.objectAtIndex(dayOfWeek)); - break; - - case "A": - arr = NSArray(locale.objectForKey( - NSUserDefaults.NSWeekDayNameArray)); - str = String(arr.objectAtIndex(dayOfWeek)); - break; - - case "w": - str = dayOfWeek.toString(); - break; - - } - - return str; - } - - - /** - * Handles a formatted month. - */ - private static function handleMonth(char:String, date:NSCalendarDate, - locale:NSDictionary):String - { - var str:String; - var arr:NSArray; - var month:Number = date.monthOfYear() - 1; - - switch (char) - { - case "b": - arr = NSArray(locale.objectForKey( - NSUserDefaults.NSShortMonthNameArray)); - str = String(arr.objectAtIndex(month)); - break; - - case "B": - arr = NSArray(locale.objectForKey( - NSUserDefaults.NSMonthNameArray)); - str = String(arr.objectAtIndex(month)); - break; - - case "m": - str = month.toString(); - - if (str.length == 1) - str = "0" + str; - - break; - - } - - return str; - } - - - /** - * Handles the locale default (%c = %x %x). - */ - private static function handleLocaleDefault(char:String, date:NSCalendarDate, - locale:NSDictionary):String - { - var str:String = ""; - - str += handleDefaultDate(char, date, locale) + " "; - str += handleDefaultTime(char, date, locale); - - return str; - } - - - /** - * Handles the day of the month. - */ - private static function handleDay(char:String, date:NSCalendarDate, - locale:NSDictionary):String - { - var str:String - - switch (char) - { - case "d": - str = date.dayOfMonth().toString(); - - if (str.length == 1) - str = "0" + str; - - break; - - case "e": - str = date.dayOfMonth().toString(); - break; - - case "j": - str = date.dayOfYear().toString(); - break; - - } - - return str; - } - - - /** - * Returns the number of milliseconds (0 - 999). - */ - private static function handleMilliseconds(char:String, date:NSCalendarDate, - locale:NSDictionary):String - { - return date.getMilliseconds().toString(); - } - - - /** - * Handles the hour. - */ - private static function handleHour(char:String, date:NSCalendarDate, - locale:NSDictionary):String - { - var str:String; - - switch (char) - { - case "H": - str = date.hourOfDay().toString(); - break; - - case "I": - str = ((date.hourOfDay() % 12) + 1).toString(); - break; - - } - - if (str.length == 1) - str = "0" + str; - - return str; - } - - - /** - * Handles the timezone. - */ - private static function handleTimeZone(char:String, date:NSCalendarDate, - locale:NSDictionary):String - { - var str:String; - - switch (char) - { - case "z": - var hr:String = Math.floor(date.timeZone()).toString(); - var mn:String = ((date.timeZone() % 1) * 60).toString(); - - if (hr.length == 1) - hr = "0" + hr; - - if (mn.length == 1) - mn = "0" + mn; - - str = hr + mn; - break; - - case "Z": - str = "time zone name"; //! implement - break; - - } - - return str; - } - - - /** - * Handles the minute. - */ - private static function handleMinute(char:String, date:NSCalendarDate, - locale:NSDictionary):String - { - var str:String = date.minuteOfHour().toString(); - - if (str.length == 1) - str = "0" + str; - - return str; - } - - - /** - * Returns AM / PM. - */ - private static function handleAmPm(char:String, date:NSCalendarDate, - locale:NSDictionary):String - { - var str:String - var arr:NSArray = NSArray(locale.objectForKey( - NSUserDefaults.NSAMPMDesignation)); - - if (date.hourOfDay() < 12) - str = String(arr.objectAtIndex(0)); - else - str = String(arr.objectAtIndex(1)); - - return str; - } - - - /** - * Handles second representation. - */ - private static function handleSecond(char:String, date:NSCalendarDate, - locale:NSDictionary):String - { - var str:String = date.secondOfMinute().toString(); - - if (str.length == 1) - str = "0" + str; - - return str; - } - - - /** - * Handles years. - */ - private static function handleYear(char:String, date:NSCalendarDate, - locale:NSDictionary):String - { - var str:String; - - switch (char) - { - case "y": - str = date.getYear().toString(); - break; - - case "Y": - str = date.getFullYear().toString(); - break; - - } - - return str; - } - - - /** - * Handles default dates according to the locale. - */ - private static function handleDefaultDate(char:String, date:NSCalendarDate, - locale:NSDictionary):String - { - return NSCalendarDate.formatDate(String( - locale.objectForKey(NSUserDefaults.NSDateFormatString)), - date, locale); - } - - - /** - * Handles default time according to the locale. - */ - private static function handleDefaultTime(char:String, date:NSCalendarDate, - locale:NSDictionary):String - { - return NSCalendarDate.formatDate(String( - locale.objectForKey(NSUserDefaults.NSTimeDateFormatString)), - date, locale); - } - - - /** - * Returns whether a character should be handled by one of the handlers or not. - */ - private static function isTypeCharacter(char:String):Boolean - { - return (g_types[char] != undefined); - } - //****************************************************** //* Static Constructor --- 547,550 ---- *************** *** 906,928 **** g_firstDayInCommonEra = new Date(1, 0, 1, 0, 0, 0, 0); - // - // Handler functions (for date formatting) - // - g_types = new Object(); - g_types["%"] = handlePercentage; - g_types["a"] = g_types["A"] = g_types["w"] = handleWeekDay; - g_types["b"] = g_types["B"] = g_types["m"] = handleMonth; - g_types["c"] = handleLocaleDefault; - g_types["d"] = g_types["e"] = g_types["j"] = handleDay; - g_types["F"] = handleMilliseconds; - g_types["H"] = g_types["I"] = handleHour; - g_types["M"] = handleMinute; - g_types["p"] = handleAmPm; - g_types["S"] = handleSecond; - g_types["y"] = g_types["Y"] = handleYear; - g_types["z"] = g_types["Z"] = handleTimeZone; - g_types["x"] = handleDefaultDate; - g_types["X"] = handleDefaultTime; - return true; } --- 561,564 ---- |
From: Scott H. <sco...@us...> - 2005-07-27 06:57:13
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6000/src/org/actionstep Added Files: NSDate.as Log Message: Created Base class for dates in ActionStep --- NEW FILE: NSDate.as --- (This appears to be a binary file; contents omitted.) |
From: Scott H. <sco...@us...> - 2005-07-27 06:56:16
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5906/src/org/actionstep Modified Files: NSUserDefaults.as Log Message: Much closer to spec (but still very unfinished) Index: NSUserDefaults.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSUserDefaults.as,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NSUserDefaults.as 27 Jul 2005 00:56:35 -0000 1.2 --- NSUserDefaults.as 27 Jul 2005 06:56:04 -0000 1.3 *************** *** 189,192 **** --- 189,203 ---- public static var NSYearMonthWeekDesignations:String = "NSYearMonthWeekDesignations"; + + private static var ASDomainStatePersistent:Number = 0; + private static var ASDomainStateVolitile:Number = 1; + + //****************************************************** + //* Members + //****************************************************** + + /** The list of domains that are used to generate user defaults. */ + private static var g_searchList:NSArray; + /** Defaults for any user without preferences. */ private static var g_defaults:NSDictionary; *************** *** 195,198 **** --- 206,212 ---- private static var g_registered:Boolean = false; + /** The standard defaults for this user. */ + private static var g_standardDefaults:NSUserDefaults; + //****************************************************** //* Construction *************** *** 227,231 **** public function initWithUser(userName:String):NSUserDefaults { ! return this; } --- 241,245 ---- public function initWithUser(userName:String):NSUserDefaults { ! //! how should this be used return this; } *************** *** 243,269 **** } //****************************************************** ! //* Public Methods //****************************************************** //****************************************************** ! //* Events ! //****************************************************** ! //****************************************************** ! //* Protected Methods ! //****************************************************** ! //****************************************************** ! //* Private Methods //****************************************************** //****************************************************** ! //* Public Static Properties //****************************************************** //****************************************************** ! //* Public Static Methods //****************************************************** ! public static function registerDefaults():Void { g_defaults = new NSDictionary(); --- 257,430 ---- } + + /** + * Returns a dictionary containing all user defaults as generated by + * enumerating the domain search list in order. A lower domain will + * overwrite any keys stored in higher domains. + * + * The returned dictionary contains no information about the origin domain + * of each entry. + */ + public function dictionaryRepresentation():NSDictionary + { + return g_defaults; + } + //****************************************************** ! //* Getting Defaults //****************************************************** + /** + * Returns the NSArray corresponding to the key defaultKey, or null + * if it doesn't exist. This searches the domain list. + */ + public function arrayForKey(defaultName:String):NSArray + { + return NSArray(objectForKey(defaultName)); + } + + /** + * Returns the Boolean corresponding to the key defaultKey, or null + * if it doesn't exist. This searches the domain list. + */ + public function boolForKey(defaultName:String):Boolean + { + return Boolean(objectForKey(defaultName)); + } + + + /** + * Returns the NSDictionary corresponding to the key defaultKey, or null + * if it doesn't exist. This searches the domain list. + */ + public function dictionaryForKey(defaultName:String):NSDictionary + { + return NSDictionary(objectForKey(defaultName)); + } + + + /** + * Returns the Number corresponding to the key defaultKey, or null + * if it doesn't exist. This searches the domain list. + * + * Replaces integerForKey and floatForKey in Cocoa. + */ + public function numberForKey(defaultName:String):Number + { + return Number(objectForKey(defaultName)); + } + + + /** + * Returns the Object corresponding to the key defaultKey, or null + * if it doesn't exist. This searches the domain list. + */ + public function objectForKey(defaultName:String):Object + { + return null; //! + } + + + /** + * Returns the String corresponding to the key defaultKey, or null + * if it doesn't exist. This searches the domain list. + */ + public function stringArrayForKey(defaultName:String):NSArray + { + var arr:NSArray = NSArray(objectForKey(defaultName)); + + if (arr != null && + org.actionstep.ASUtils.chkElem(arr.internalList(), String) === true) + { + return arr; + } + + return null; + } + + + /** + * Returns the String corresponding to the key defaultKey, or null + * if it doesn't exist. This searches the domain list. + */ + public function stringForKey(defaultName:String):String + { + return String(objectForKey(defaultName)); + } + //****************************************************** ! //* Setting Defaults //****************************************************** + + /** + * Calls setObjectForKey(value, defaultName). + */ + public function setBoolForKey(value:Boolean, defaultName:String):Void + { + setObjectForKey(value, defaultName); + } + + + /** + * Calls setObjectForKey(value, defaultName). + * + * Replaces setIntegerForKey and setFloatForKey in Cocoa. + */ + public function setNumberForKey(value:Number, defaultName:String):Void + { + setObjectForKey(value, defaultName); + } + + + /** + * Sets the value of the default with the key defaultName to value in + * the default application domain. This method will not affect objectForKey() + * calls if a domain preceding the application domain contains an entry for + * the key defaultName. + */ + public function setObjectForKey(value:Object, defaultName:String):Void + { + //! + } + + //****************************************************** ! //* Domains //****************************************************** + + /** + * Inserts a new domain, suiteName, into the receiverâs search list. The + * suite domain is inserted after the application domain. + */ + public function addSuiteNamed(suiteName:String):Void + { + //! + } + + + /** + * Removes the suite domain with the name suiteName. + */ + public function removeSuiteNamed(suiteName:String):Void + { + //! + } + //****************************************************** ! //* Public Methods //****************************************************** ! /** ! * Cleans up the object before destruction. ! */ ! public function release():Void ! { ! //! ! } ! ! ! public function registerDefaults():Void { g_defaults = new NSDictionary(); *************** *** 326,336 **** g_defaults.setObjectForKey(NSArray.arrayWithObjects("AM", "PM"), NSAMPMDesignation); ! } //****************************************************** //* Static Constructor //****************************************************** --- 487,558 ---- g_defaults.setObjectForKey(NSArray.arrayWithObjects("AM", "PM"), NSAMPMDesignation); + } + + //****************************************************** + //* Events + //****************************************************** + //****************************************************** + //* Protected Methods + //****************************************************** + //****************************************************** + //* Private Methods + //****************************************************** + //****************************************************** + //* Public Static Properties + //****************************************************** + + /** + * Syncs changes from the standardUserDefaults and recreates it. + */ + public static function resetStandardUserDefaults():Void + { + //! sync changes + g_standardDefaults.release(); + g_standardDefaults = null; + standardUserDefaults(); + } + + + /** + * Returns the standard user defaults for this application. + */ + public static function standardUserDefaults():NSUserDefaults + { + if (g_searchList == undefined) + { + g_searchList = NSArray.array(); + + //! fill in with search list + } + if (g_standardDefaults == undefined) + { + g_standardDefaults = (new NSUserDefaults()).init(); + g_standardDefaults.registerDefaults(); + } ! return g_standardDefaults; } //****************************************************** + //* Private Static Methods + //****************************************************** + + private function createDomain(name:String, state:Number):NSDictionary + { + return NSDictionary.dictionaryWithObjectsAndKeys( + name, "name", + state, "state", + NSDictionary.dictionary(), "defaults"); + } + + //****************************************************** + //* Public Static Methods + //****************************************************** + + + + //****************************************************** //* Static Constructor //****************************************************** |
From: Scott H. <sco...@us...> - 2005-07-27 05:37:46
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29636/src/org/actionstep Modified Files: NSApplication.as Log Message: removed user defaults registration Index: NSApplication.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSApplication.as,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** NSApplication.as 26 Jul 2005 15:54:02 -0000 1.30 --- NSApplication.as 27 Jul 2005 05:37:37 -0000 1.31 *************** *** 87,91 **** m_sharedApplication = (new NSApplication()).init(); ASTheme.current().registerDefaultImages(); - NSUserDefaults.registerDefaults(); } return m_sharedApplication; --- 87,90 ---- |
From: Richard K. <ric...@us...> - 2005-07-27 04:22:51
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23635 Modified Files: ASList.as NSView.as Log Message: add min/max depth for clips, and highlight clip to ASList Index: NSView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSView.as,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** NSView.as 18 Jul 2005 03:51:36 -0000 1.29 --- NSView.as 27 Jul 2005 04:22:34 -0000 1.30 *************** *** 62,65 **** --- 62,68 ---- public static var NSViewBoundsDidChangeNotification = ASUtils.intern("NSViewBoundsDidChangeNotification"); + public static var MaxClipDepth = 1048575; + public static var MinClipDepth = -16384; + // private hidden instance variables private var m_frame:NSRect; Index: ASList.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASList.as,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ASList.as 21 Jul 2005 02:36:14 -0000 1.10 --- ASList.as 27 Jul 2005 04:22:34 -0000 1.11 *************** *** 56,59 **** --- 56,60 ---- private var m_action:String; private var m_showsFirstResponder:Boolean; + private var m_firstResponderClip:MovieClip; public function initWithFrame(rect:NSRect):ASList { *************** *** 61,65 **** m_internalList = new NSArray(); m_scrollView = new NSScrollView(); ! m_scrollView.initWithFrame(new NSRect(0,1,rect.size.width-2, rect.size.height-2)); m_scrollView.setHasVerticalScroller(true); addSubview(m_scrollView); --- 62,66 ---- m_internalList = new NSArray(); m_scrollView = new NSScrollView(); ! m_scrollView.initWithFrame(new NSRect(0,0,rect.size.width, rect.size.height)); m_scrollView.setHasVerticalScroller(true); addSubview(m_scrollView); *************** *** 372,376 **** ASTheme.current().drawListWithRectInView(rect, this); if (m_showsFirstResponder) { ! ASTheme.current().drawFirstResponderWithRectInView(rect, this); } } --- 373,388 ---- ASTheme.current().drawListWithRectInView(rect, this); if (m_showsFirstResponder) { ! if (m_firstResponderClip == null || m_firstResponderClip._parent == undefined) { ! m_firstResponderClip = m_mcBounds.createEmptyMovieClip("m_firstResponderClip", MaxClipDepth - 10); ! m_firstResponderClip._x = 0; ! m_firstResponderClip._y = 0; ! } ! m_firstResponderClip.clear(); ! ASTheme.current().drawFirstResponderWithRectInClip(rect, m_firstResponderClip); ! } else { ! if (m_firstResponderClip != null) { ! m_firstResponderClip.removeMovieClip(); ! m_firstResponderClip = null; ! } } } |
From: Richard K. <ric...@us...> - 2005-07-27 04:14:03
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22942 Modified Files: ASTheme.as ASThemeProtocol.as Log Message: added extra method to draw firstResponder Index: ASThemeProtocol.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASThemeProtocol.as,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ASThemeProtocol.as 20 Jul 2005 18:07:11 -0000 1.13 --- ASThemeProtocol.as 27 Jul 2005 04:13:47 -0000 1.14 *************** *** 90,93 **** --- 90,98 ---- /** + * Draws the border around the button when it has key focus + */ + public function drawFirstResponderWithRectInClip(rect:NSRect, clip:MovieClip); + + /** * Draws the the ASList background */ Index: ASTheme.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASTheme.as,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ASTheme.as 20 Jul 2005 18:51:25 -0000 1.21 --- ASTheme.as 27 Jul 2005 04:13:47 -0000 1.22 *************** *** 104,108 **** public function drawFirstResponderWithRectInView(rect:NSRect, view:NSView) { ! var mc = view.mcBounds(); var x = rect.origin.x+1; var y = rect.origin.y+1; --- 104,111 ---- public function drawFirstResponderWithRectInView(rect:NSRect, view:NSView) { ! drawFirstResponderWithRectInClip(rect, view.mcBounds()); ! } ! ! public function drawFirstResponderWithRectInClip(rect:NSRect, mc:MovieClip) { var x = rect.origin.x+1; var y = rect.origin.y+1; *************** *** 111,115 **** var color = firstResponderColor().value; ! mc.lineStyle(3, color, 30); mc.moveTo(x, y); mc.lineTo(x+width, y); --- 114,118 ---- var color = firstResponderColor().value; ! mc.lineStyle(3, color, 40); mc.moveTo(x, y); mc.lineTo(x+width, y); *************** *** 117,122 **** mc.lineTo(x, y+height); mc.lineTo(x, y); - - //ASDraw.outlineRectWithRect(view.mcBounds(), rect, [firstResponderColor().value]); } --- 120,123 ---- |
From: Scott H. <sco...@us...> - 2005-07-27 02:34:40
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13908/src/org/actionstep Modified Files: NSFormatter.as Log Message: Now implemented as an abstract class, and has better comments. I left some blanks. Index: NSFormatter.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSFormatter.as,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** NSFormatter.as 4 May 2005 02:33:05 -0000 1.1.1.1 --- NSFormatter.as 27 Jul 2005 02:34:27 -0000 1.2 *************** *** 1,5 **** ! /* * Copyright (c) 2005, InfoEther, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, --- 1,8 ---- ! /* * Copyright (c) 2005, InfoEther, Inc. * All rights reserved. + * + * Copyright (c) 2005, Affinity Systems + * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, *************** *** 13,17 **** * 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. * --- 16,20 ---- * and/or other materials provided with the distribution. * ! * 3) The name InfoEther, Inc. and Affinity Systems may not be used to endorse or promote products * derived from this software without specific prior written permission. * *************** *** 28,38 **** * POSSIBILITY OF SUCH DAMAGE. */ ! ! class org.actionstep.NSFormatter extends org.actionstep.NSObject { ! ! public function stringForObjectValue(value):String { ! //! Formatter needs work! ! return value.toString(); ! } ! ! } \ No newline at end of file --- 31,169 ---- * POSSIBILITY OF SUCH DAMAGE. */ ! ! import org.actionstep.NSAttributedString; ! import org.actionstep.NSDictionary; ! import org.actionstep.NSException; ! ! /** ! * An abstract formatting class. Provides common operations to be implemented ! * by subclasses. ! * ! * Notes for those intending to subclass NSFormatter: ! * Please examine the getObjectValueForStringErrorDescription method's ! * comments, as it describes differences from the Cocoa implementation of ! * the method. ! * ! * @see org.actionstep.NSDateFormatter ! * @see org.actionstep.NSNumberFormatter ! * @author Scott Hyndman ! */ ! class org.actionstep.NSFormatter extends org.actionstep.NSObject ! { ! /** ! * Creates a new instance of NSFormatter. ! * ! * Since this is an abstract class, the constructor is private (protected) ! * so only subclasses can call it. ! */ ! private function NSFormatter() ! { ! } ! ! //****************************************************** ! //* Properties ! //****************************************************** ! ! /** ! * @see org.actionstep.NSObject#description ! */ ! public function description():String ! { ! return "NSFormatter()"; ! } ! ! //****************************************************** ! //* Public Methods ! //****************************************************** ! ! /** ! * The default (NSFormatter) implementation returns null. ! * ! * This method generates an attributed string based on a source object. ! */ ! public function attributedStringForObjectValueWithDefaultAttributes( ! anObject:Object, attributes:NSDictionary):NSAttributedString ! { ! return null; ! } ! ! ! //! editingStringForObjectValue(anObject:Object):String ! ! ! /** ! * The default (NSFormatter) implementation raises an exception. ! * Subclasses override this method to perform object to string conversion. ! * ! * Subclassing notes: ! * The type of the value argument should be tested. If it is not an ! * instance of the expected class, null should be returned. ! * Remember localization! ! */ ! public function stringForObjectValue(value:Object):String ! { ! var e:NSException = NSException.exceptionWithNameReasonUserInfo( ! "NSAbstractMethodException", ! "This method is only implemented by subclasses of NSFormatter.", ! null); ! TRACE(e); ! throw e; ! ! return null; ! } ! ! ! //! isPartialStringValidNewEditingStringErrorDescription ! ! ! //! isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRange:errorDescription: ! ! ! /** ! * The default (NSFormatter) implementation raises an exception. ! * Subclasses override this method to perform string to object conversion. ! * ! * This method will return an object formatted as follows: ! * {success:Boolean, obj:Object, error:String} ! * ! * If the success property is true, the conversion succeeded and the obj ! * property will contain the newly created object. If the success property ! * is FALSE, the conversion failed and the error property will contain ! * a descriptive error message. ! * ! * The implementation of this method differs from Cocoa's as ActionScript ! * does not have pointers. Ordinarily a boolean is returned indicating ! * success and the obj and error arguments are pointers. ! */ ! public function getObjectValueForStringErrorDescription(string:String) ! :Object ! { ! var e:NSException = NSException.exceptionWithNameReasonUserInfo( ! "NSAbstractMethodException", ! "This method is only implemented by subclasses of NSFormatter.", ! null); ! TRACE(e); ! throw e; ! ! return null; ! } ! ! //****************************************************** ! //* Events ! //****************************************************** ! //****************************************************** ! //* Protected Methods ! //****************************************************** ! //****************************************************** ! //* Private Methods ! //****************************************************** ! //****************************************************** ! //* Public Static Properties ! //****************************************************** ! //****************************************************** ! //* Public Static Methods ! //****************************************************** ! //****************************************************** ! //* Static Constructor ! //****************************************************** ! } |
From: Scott H. <sco...@us...> - 2005-07-27 02:21:15
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11742/src/org/actionstep Modified Files: NSControl.as Log Message: removed some unnecessary fields Index: NSControl.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSControl.as,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** NSControl.as 24 Jun 2005 02:16:21 -0000 1.20 --- NSControl.as 27 Jul 2005 02:21:07 -0000 1.21 *************** *** 89,95 **** private var m_cell:NSCell; private var m_tag:Number; - private var m_alignment:NSTextAlignment = NSTextAlignment.NSNaturalTextAlignment; - private var m_font:NSFont; - private var m_formatter:NSFormatter; private var m_ignoresMultiClick:Boolean; --- 89,92 ---- |
From: Scott H. <sco...@us...> - 2005-07-27 00:57:13
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29951/src/org/actionstep Modified Files: NSUserDefaults.as Log Message: All comments and defaults in place Index: NSUserDefaults.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSUserDefaults.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NSUserDefaults.as 25 Jul 2005 05:27:35 -0000 1.1 --- NSUserDefaults.as 27 Jul 2005 00:56:35 -0000 1.2 *************** *** 109,113 **** * representing a currency value. */ ! public static var NSNegativeCurrencyFormatString:String = "NSNegativeCurrencyFormatString"; /** --- 109,113 ---- * representing a currency value. */ ! public static var NSNegativeCurrencyFormatString:String = "NSNegativeCurrencyFormatString"; //! SET DEFAULT /** *************** *** 142,152 **** --- 142,190 ---- */ public static var NSShortMonthNameArray:String = "NSShortMonthNameArray"; + + /** + * A format string specifying how datetimes are abbreviated. The default + * is "%e-%b-%y %I:%M %p". + */ public static var NSShortTimeDateFormatString:String = "NSShortTimeDateFormatString"; + + /** + * An array of abbreviated week day names. Sunday is the first day of the week. + */ public static var NSShortWeekDayNameArray:String = "NSShortWeekDayNameArray"; + + /** + * A string representing today. The default is "today". + */ public static var NSThisDayDesignations:String = "NSThisDayDesignations"; + + /** + * A string to seperate thousands in numeric strings. The default is a + * space. + */ public static var NSThousandsSeparator:String = "NSThousandsSeparator"; + + /** + * A datetime format string (longer than NSShortTimeDateFormatString). + * The default is â%A, %B %d, %Y %H:%M:%S %Zâ. + */ public static var NSTimeDateFormatString:String = "NSTimeDateFormatString"; + + /** + * A format that specifies how times are printed. The default is + * "%I:%M %p". + */ public static var NSTimeFormatString:String = "NSTimeFormatString"; + + /** + * An array of full weekday names (eg. Sunday, Monday, ...). The week + * begins on a Sunday. + */ public static var NSWeekDayNameArray:String = "NSWeekDayNameArray"; + + /** + * An array of strings that represent the year, month, and day + * respectively in the current locale. The defaults are "year","month","day". + */ public static var NSYearMonthWeekDesignations:String = "NSYearMonthWeekDesignations"; *************** *** 166,170 **** public function NSUserDefaults() { - } --- 204,207 ---- *************** *** 232,248 **** g_defaults = new NSDictionary(); ! g_defaults.setObjectForKey(NSArray.arrayWithObjects("AM", "PM"), ! NSUserDefaults.NSAMPMDesignation); ! g_defaults.setObjectForKey("$", NSUserDefaults.NSCurrencySymbol); ! ! g_defaults.setObjectForKey("%A, %B %d, %Y", NSUserDefaults.NSDateFormatString); ! ! g_defaults.setObjectForKey(".", NSUserDefaults.NSDecimalSeparator); ! g_defaults.setObjectForKey( NSArray.arrayWithObject("prior", "last", "past", "ago"), ! NSUserDefaults.NSEarlierTimeDesignations); ! g_defaults.setObjectForKey(NSArray.arrayWithObject( NSArray.arrayWithObjects(0, "midnight"), --- 269,286 ---- g_defaults = new NSDictionary(); ! // ! // Numbers and currency ! // ! g_defaults.setObjectForKey("$", NSCurrencySymbol); ! g_defaults.setObjectForKey(".", NSDecimalSeparator); ! g_defaults.setObjectForKey(" ", NSDecimalSeparator); // that's right, haha ! g_defaults.setObjectForKey("USD", NSInternationalCurrencyString); ! // ! // Time designations ! // g_defaults.setObjectForKey( NSArray.arrayWithObject("prior", "last", "past", "ago"), ! NSEarlierTimeDesignations); g_defaults.setObjectForKey(NSArray.arrayWithObject( NSArray.arrayWithObjects(0, "midnight"), *************** *** 251,277 **** NSArray.arrayWithObjects(14, "midnight"), NSArray.arrayWithObjects(19, "dinner") ! ), NSUserDefaults.NSHourNameDesignations); ! ! g_defaults.setObjectForKey("USD", ! NSUserDefaults.NSInternationalCurrencyString); ! ! g_defaults.setObjectForKey(NSArray.arrayWithObjects("next"), ! NSUserDefaults.NSLaterTimeDesignations); ! g_defaults.setObjectForKey(NSArray.arrayWithObjects( ! "January", "February", "March", "April", "May", "June", "July", ! "August", "September", "October", "November", "December" ! ), NSUserDefaults.NSMonthNameArray); ! ! g_defaults.setObjectForKey("yesterday", NSUserDefaults.NSPriorDayDesignations); ! g_defaults.setObjectForKey("%d/%m/%y", NSUserDefaults.NSShortDateFormatString); g_defaults.setObjectForKey(NSArray.arrayWithObjects( "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"), ! NSUserDefaults.NSShortMonthNameArray); } --- 289,333 ---- NSArray.arrayWithObjects(14, "midnight"), NSArray.arrayWithObjects(19, "dinner") ! ), NSHourNameDesignations); g_defaults.setObjectForKey(NSArray.arrayWithObjects( ! "year", "month", "day"), NSYearMonthWeekDesignations); ! g_defaults.setObjectForKey(NSArray.arrayWithObjects("next"), ! NSLaterTimeDesignations); ! g_defaults.setObjectForKey("tomorrow", NSNextDayDesignations); ! g_defaults.setObjectForKey("nextday", NSNextNextDayDesignations); ! g_defaults.setObjectForKey("yesterday", NSPriorDayDesignations); ! g_defaults.setObjectForKey("today", NSThisDayDesignations); ! // ! // Dates and Times (for formatting) ! // ! g_defaults.setObjectForKey("%A, %B %d, %Y", NSDateFormatString); ! g_defaults.setObjectForKey("%d/%m/%y", NSShortDateFormatString); ! g_defaults.setObjectForKey("%e-%b-%y %I:%M %p", ! NSShortTimeDateFormatString); ! g_defaults.setObjectForKey("%A, %B %d, %Y %H:%M:%S %Z", ! NSTimeDateFormatString); ! g_defaults.setObjectForKey("%I:%M %p", NSTimeFormatString); g_defaults.setObjectForKey(NSArray.arrayWithObjects( "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"), ! NSShortMonthNameArray); ! g_defaults.setObjectForKey(NSArray.arrayWithObjects( ! "January", "February", "March", "April", "May", "June", "July", ! "August", "September", "October", "November", "December" ! ), NSMonthNameArray); ! g_defaults.setObjectForKey(NSArray.arrayWithObjects( ! "Sun", "Mon", "Tues", "Wed", "Thurs", "Fri", "Sat"), ! NSShortWeekDayNameArray); ! g_defaults.setObjectForKey(NSArray.arrayWithObjects( ! "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"), ! NSWeekDayNameArray); ! g_defaults.setObjectForKey(NSArray.arrayWithObjects("AM", "PM"), ! NSAMPMDesignation); ! + } |
From: Scott H. <sco...@us...> - 2005-07-27 00:32:10
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25913/src/org/actionstep Modified Files: NSArray.as Log Message: Added some comments Added + (NSArray) initWithCapacity Index: NSArray.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSArray.as,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** NSArray.as 29 Jun 2005 02:19:00 -0000 1.15 --- NSArray.as 27 Jul 2005 00:32:00 -0000 1.16 *************** *** 42,45 **** --- 42,47 ---- * Represents an array of objects. * + * This class is a combination of both NSArray and NSMutableArray classes. + * * @author Scott Hyndman */ *************** *** 756,759 **** --- 758,790 ---- /** + * Creates and returns an NSArray with a capacity of numItems. + * + * Since the Cocoa docs say that numItems is an unsigned int, and + * we don't have any equivalent in ActionScript, this method + * will throw an exception if numItems is negative. + */ + public static function arrayWithCapacity(numItems:Number):NSArray + { + // + // Throw an exception if out of range. + // + if (numItems < 0) + { + var e:NSException = NSException.exceptionWithNameReasonUserInfo( + "NSInvalidArgumentException", + "numItems cannot be negative.", + null); + TRACE(e); + throw e; + } + + var ret:NSArray = new NSArray(); + ret.m_list = new Array(numItems); + + return ret; + } + + + /** * Creates and returns an array containing the single element anObject. * |
From: Scott H. <sco...@us...> - 2005-07-26 23:48:43
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16095/src/org/actionstep Added Files: NSInvocation.as Log Message: Used for passing around method calls --- NEW FILE: NSInvocation.as --- (This appears to be a binary file; contents omitted.) |