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: Scott H. <sco...@us...> - 2005-05-27 01:47:54
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19332/src/org/actionstep/test Modified Files: ASTestNotificationCenter.as Log Message: fixed compile error Index: ASTestNotificationCenter.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/test/ASTestNotificationCenter.as,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ASTestNotificationCenter.as 4 May 2005 02:33:06 -0000 1.1.1.1 --- ASTestNotificationCenter.as 27 May 2005 01:47:43 -0000 1.2 *************** *** 29,32 **** --- 29,33 ---- */ + import org.actionstep.ASUtils; import org.actionstep.NSEvent; import org.actionstep.NSNotificationCenter; *************** *** 41,45 **** public function processEvent(event:NSEvent) { ! TRACE(name+ " sees "+notification.object.name+" message "+notification.nameAsString()); } --- 42,46 ---- public function processEvent(event:NSEvent) { ! // TRACE(name+ " sees "+notification.object.name+" message "+notification.nameAsString()); } |
From: Scott H. <sco...@us...> - 2005-05-27 01:47:32
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19296/src/org/actionstep Modified Files: NSMatrix.as Log Message: new version Index: NSMatrix.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSMatrix.as,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NSMatrix.as 17 May 2005 03:21:19 -0000 1.7 --- NSMatrix.as 27 May 2005 01:47:23 -0000 1.8 *************** *** 45,48 **** --- 45,52 ---- import org.actionstep.constants.NSMatrixMode; import org.actionstep.constants.NSCellType; + import org.actionstep.constants.NSCellAttribute; + + //! TEST CODE + import org.as2lib.util.StopWatch; //************************************************************************** *************** *** 86,98 **** private var m_autosizecells:Boolean; private var m_cellspacing:NSSize; ! private var m_isautoscroll:Boolean; private var m_isselbyrect:Boolean; private var m_keycell:NSCell; private var m_mousedownflags:Number; private var m_sel:NSArray; ! private var m_target:Object; private var m_action:String; /** * The reason this is here, and not in a cell, is because a matrix can --- 90,107 ---- private var m_autosizecells:Boolean; private var m_cellspacing:NSSize; ! private var m_autoscroll:Boolean; private var m_isselbyrect:Boolean; private var m_keycell:NSCell; private var m_mousedownflags:Number; private var m_sel:NSArray; ! private var m_selcell:NSCell; // The selected cell. ! private var m_selcell_row:Number; // holds the row of m_selcell ! private var m_selcell_column:Number; // holds the column of m_selcell private var m_target:Object; private var m_action:String; + //! TEST CODE + private var watch:StopWatch; + /** * The reason this is here, and not in a cell, is because a matrix can *************** *** 126,131 **** m_cellspacing = new NSSize(1, 1); m_cellsize = new NSSize(100, 17); ! m_isautoscroll = false; m_isselbyrect = false; } --- 135,141 ---- m_cellspacing = new NSSize(1, 1); m_cellsize = new NSSize(100, 17); ! m_autoscroll = false; m_isselbyrect = false; + watch = new StopWatch(); } *************** *** 481,485 **** public function isAutoscroll():Boolean { ! return m_isautoscroll; } --- 491,505 ---- public function isAutoscroll():Boolean { ! return m_autoscroll; ! } ! ! ! /** ! * True if the receiver should scroll when the cursor is dragged outside ! * the receiver after a mouse-down event within its bounds. ! */ ! public function setAutoscroll(flag:Boolean):Void ! { ! m_autoscroll = flag; } *************** *** 1358,1363 **** var frame:NSRect = cellFrameAtRowColumn(row, column); - - TRACE("drawing " + frame); // --- 1378,1381 ---- *************** *** 1415,1420 **** // var loc:Object = {}; ! loc.row = Math.floor(aPoint.x / colWidth); ! loc.column = Math.floor(aPoint.y / rowHeight); // --- 1433,1438 ---- // var loc:Object = {}; ! loc.column = Math.floor(aPoint.x / colWidth); ! loc.row = Math.floor(aPoint.y / rowHeight); // *************** *** 1550,1557 **** --- 1568,1577 ---- if (row == -1 || column == -1) { + TRACE("Deselecting all cells"); deselectAllCells(); return; } + TRACE("Selecting cell at ("+row+", "+column+")"); var cell:NSCell = cellAtRowColumn(row, column); *************** *** 1561,1582 **** // if (m_mode == NSMatrixMode.NSRadioModeMatrix && cell != null && ! m_cell != null && cell != m_cell) { ! } ! cell.setHighlighted(true); // highlight the cell ! ! if (cell.type() == NSCellType.NSTextCellType && ! cell.isEditable()) { ! //! text selection } - - - m_cell = cell; - - m_sel.addObject({row: row, column: column}); // add to the selection - drawCellAtRowColumn(row, column); // draw the cell } --- 1581,1636 ---- // if (m_mode == NSMatrixMode.NSRadioModeMatrix && cell != null && ! m_selcell != null && cell != m_selcell) { ! clearCurrentRadioSelection(false); } ! if (cell != null) { ! if (m_selcell != null && cell != m_selcell) ! { ! m_selcell.setShowsFirstResponder(false); ! //! setNeedsDisplayInRect ! drawCellAtRowColumn(m_selcell_row, m_selcell_column); ! } ! ! // ! // Record the new selection ! // ! m_selcell = cell; ! m_selcell_row = row; ! m_selcell_column = column; ! m_sel.addObject({row: row, column: column}); ! ! // ! // Update visual representation ! // ! m_selcell.setState(NSCell.NSOnState); ! ! if (m_mode == NSMatrixMode.NSRadioModeMatrix) ! m_selcell.setCellAttributeTo(NSCellAttribute.NSCellHighlighted); ! ! if (m_autoscroll) ! { ! var rect:NSRect = cellFrameAtRowColumn(row, column); ! scrollRectToVisible(rect); ! } ! ! // ! // Select text if we can ! // ! selectTextAtRowColumn(row, column); ! ! // ! // Draw. ! // ! drawCellAtRowColumn(m_selcell_row, m_selcell_column); ! //! setNeedsDisplayInRect ! } ! else ! { ! m_selcell = null; ! m_selcell_row = m_selcell_column = -1; } } *************** *** 1684,1734 **** * in the class description. */ ! public function mouseDown(theEvent:NSEvent):Boolean { TRACE(theEvent); // debug info ! m_mousedownflags = theEvent.modifierFlags; // record flags // ! // Get the location of the cell, then the cell itself (if available). // var pt:NSPoint = convertPointFromView(theEvent.mouseLocation, null); - - TRACE(pt); - var loc:Object = getRowColumnForPoint(pt); ! TRACE("row: " + loc.row + ", column: " + loc.column); ! ! /* ! if (theEvent.clickCount == 2 && loc == null) { ! return sendDoubleAction(); } ! var cell:NSCell = cellAtRowColumn(loc.row, loc.column); ! switch (cell.type()) { ! case NSCellType.NSTextCellType: ! cell.s ! break; ! case NSCellType.NSImageCellType: ! break; ! case NSCellType.NSNullCellType: ! ! default: ! ! break; } - */ - return false; } ! ! //****************************************************** //* Drawing Methods * --- 1738,1928 ---- * in the class description. */ ! public function mouseDown(theEvent:NSEvent):Void { TRACE(theEvent); // debug info ! // ! // Ignore mouse down ! // ! if (m_numrows == 0 || m_numcols == 0) ! { ! super.mouseDown(theEvent); ! return; ! } // ! // Handle clicks ! // ! if (theEvent.clickCount > 2) ! return; ! ! if (theEvent.clickCount == 2 && m_ignoresMultiClick) ! { ! sendDoubleAction(); ! return; ! } ! // + // Get the location of the cell, then the cell itself (if available). + // var pt:NSPoint = convertPointFromView(theEvent.mouseLocation, null); var loc:Object = getRowColumnForPoint(pt); ! if (loc != null) { ! TRACE("row: " + loc.row + ", column: " + loc.column); ! ! var cell:NSCell = cellAtRowColumn(loc.row, loc.column); ! ! if (cell.isEnabled()) // cell has to be enabled ! { ! selectCellAtRowColumn(loc.row, loc.column); ! } } + + m_mousedownflags = theEvent.modifierFlags; // record flags ! super.mouseDown(theEvent); ! } ! ! ! public function cellTrackingCallback(mouseUp:Boolean) ! { ! if (m_mode != NSMatrixMode.NSTrackModeMatrix) ! { ! TRACE(m_highlightedrow+", "+m_highlightedcolumn); ! highlightCellAtRowColumn(false, m_highlightedrow, m_highlightedcolumn); ! m_highlightedcell = null; ! } ! super.cellTrackingCallback(mouseUp); ! } ! ! ! /** ! * @see org.actionstep.NSControl#mouseTrackingCallback ! */ ! public function mouseTrackingCallback(theEvent:NSEvent):Void ! { ! // ! // All matrix modes except for NSListModeMatrix share common ! // selection characteristics, so call a function that embodies them. ! // ! if (m_mode != NSMatrixMode.NSListModeMatrix) { ! mouseDownNonListMode(theEvent); ! } ! else ! { ! mouseDownListMode(theEvent); ! } ! ! super.mouseTrackingCallback(theEvent); ! } ! ! ! /** ! * Handles NSListModeMatrix mousedown logic. ! */ ! private function mouseDownListMode(theEvent:NSEvent):Void ! { ! ! } ! ! private var m_lastcell:NSCell = null; ! private var m_highlightedcell:NSCell = null; ! private var m_highlightedrow:Number; ! private var m_highlightedcolumn:Number; ! ! /** ! * Handles non-NSListModeMatrix mousedown logic. ! */ ! private function mouseDownNonListMode(theEvent:NSEvent):Void ! { ! var scrolling:Boolean = false; ! var frame:NSRect; ! var cell:NSCell, highlight:NSCell; ! var pt:NSPoint = convertPointFromView(theEvent.mouseLocation); ! TRACE(pt); ! var loc:Object = getRowColumnForPoint(pt); ! if (loc == null) ! scrolling = false; ! ! ! if (loc != null) ! { ! cell = cellAtRowColumn(loc.row, loc.column); ! if (cell == m_lastcell) ! return; ! frame = cellFrameAtRowColumn(loc.row, loc.column); ! ! if (m_autoscroll) ! scrolling = scrollRectToVisible(frame); ! ! if (cell.isEnabled()) ! { ! if (cell.acceptsFirstResponder()) ! { ! // _dottedCol?? ! } ! ! // ! // Clear old selected cell. ! // ! if (m_selcell != null) ! { ! if (m_mode == NSMatrixMode.NSRadioModeMatrix) ! { ! m_selcell.setState(NSCell.NSOffState); ! drawCellAtRowColumn(m_selcell_row, m_selcell_column); ! } ! ! var idx:Number = m_sel.indexOfObjectWithCompareFunction( ! {row: m_selcell_row, column: m_selcell_column}, ! NSMatrix.compareRowColumnObject); ! m_sel.removeObjectAtIndex(idx); ! } ! ! // ! // Set new selected cell. ! // ! m_selcell = cell; ! m_selcell_row = loc.row; ! m_selcell_column = loc.column; ! m_sel.addObject({row: m_selcell_row, column: m_selcell_column}); ! ! // ! // Highlighting ! // ! if (m_mode != NSMatrixMode.NSTrackModeMatrix && ! m_highlightedcell != cell) ! { ! highlightCellAtRowColumn(false, m_highlightedrow, m_highlightedcolumn); ! ! m_highlightedcell = cell; ! m_highlightedrow = loc.row; ! m_highlightedcolumn = loc.column; ! ! highlightCellAtRowColumn(true, m_highlightedrow, m_highlightedcolumn); ! } + if (m_mode == NSMatrixMode.NSRadioModeMatrix) + cell.setState(NSCell.NSOffState); + + m_lastcell = cell; + } + } + else if (m_mode != NSMatrixMode.NSRadioModeMatrix) + { + // + // Mouse is not over a cell. + // + clearCurrentRadioSelection(); } } ! //****************************************************** //* Drawing Methods * *************** *** 1740,1743 **** --- 1934,1939 ---- public function drawRect(rect:NSRect):Void { + m_mcBounds.clear(); + //! necessary? // var visRanges:Object = getVisibleRanges(); *************** *** 1747,1755 **** ASTheme.current().drawFillWithRectColorInView(rect, m_bgcolor, this); } ! // // Draw the cells // - for (var i:Number = 0; i < m_numrows; i++) { --- 1943,1953 ---- ASTheme.current().drawFillWithRectColorInView(rect, m_bgcolor, this); } ! ! //! TESTING CODE ! watch.start(); ! // // Draw the cells // for (var i:Number = 0; i < m_numrows; i++) { *************** *** 1760,1763 **** --- 1958,1965 ---- } + //! TESTING CODE + watch.stop(); + TRACE("cell draw time: " + watch.getTimeInMilliSeconds()); + watch.reset(); } *************** *** 1886,1890 **** --- 2088,2116 ---- } + + /** + * Clears the current selection when in NSRadioModeMatrix. + */ + private function clearCurrentRadioSelection(clearVars:Boolean):Void + { + if (m_mode != NSMatrixMode.NSRadioModeMatrix || m_selcell == null) + return; + + if (clearVars == undefined) + clearVars = true; + + m_sel.clear(); + m_selcell.setState(NSCell.NSOffState); + //! setNeedsDisplayInRect + drawCellAtRowColumn(m_selcell_row, m_selcell_column); + + if (!clearVars) + return; + m_selcell = null; + m_selcell_row = m_selcell_column = -1; + } + + /** * Replaces the cell that previously occupied row and column with *************** *** 2048,2050 **** --- 2274,2291 ---- //* Public Static Methods * //****************************************************** + + private static function compareRowColumnObject(rc1:Object, rc2:Object):Boolean + { + return rc1.row == rc2.row && rc1.column == rc2.column; + } + + public static function cellClass():Function + { + if (g_cellClass == undefined) + { + g_cellClass = org.actionstep.NSCell; + } + + return g_cellClass; + } } |
From: Scott H. <sco...@us...> - 2005-05-27 01:47:18
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19261/src/org/actionstep Modified Files: NSClipView.as Log Message: updated equalTo to isEqual Index: NSClipView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSClipView.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NSClipView.as 24 May 2005 20:31:34 -0000 1.1 --- NSClipView.as 27 May 2005 01:47:09 -0000 1.2 *************** *** 187,191 **** public function setBoundsOrigin(point:NSPoint) { ! if (point.equalTo(m_bounds.origin) || m_documentView == null) { return; } --- 187,191 ---- public function setBoundsOrigin(point:NSPoint) { ! if (point.isEqual(m_bounds.origin) || m_documentView == null) { return; } |
From: Scott H. <sco...@us...> - 2005-05-27 01:33:15
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16984/src/org/actionstep Modified Files: NSPoint.as NSRect.as NSSize.as NSView.as Log Message: isEqual was misnamed equalTo Index: NSView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSView.as,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** NSView.as 26 May 2005 20:35:13 -0000 1.14 --- NSView.as 27 May 2005 01:33:06 -0000 1.15 *************** *** 481,486 **** public function setFrame(newFrame:NSRect):Void { ! var changedOrigin:Boolean = !m_frame.origin.equalTo(newFrame.origin); ! var changedSize:Boolean = !m_frame.size.equalTo(newFrame.size); if (changedSize || changedOrigin) { m_frame = newFrame.clone(); --- 481,486 ---- public function setFrame(newFrame:NSRect):Void { ! var changedOrigin:Boolean = !m_frame.origin.isEqual(newFrame.origin); ! var changedSize:Boolean = !m_frame.size.isEqual(newFrame.size); if (changedSize || changedOrigin) { m_frame = newFrame.clone(); *************** *** 721,725 **** if (view != null) { point = convertPointToView(point, view); ! if (!point.equalTo(view.bounds().origin)) { NSClipView(view).scrollToPoint(point); } --- 721,725 ---- if (view != null) { point = convertPointToView(point, view); ! if (!point.isEqual(view.bounds().origin)) { NSClipView(view).scrollToPoint(point); } *************** *** 753,757 **** scrollPoint.x += (Math.abs(ldiff) < Math.abs(rdiff)) ? (-ldiff) : rdiff; scrollPoint.y += (Math.abs(tdiff) < Math.abs(bdiff)) ? (-tdiff) : bdiff; ! if (!vRect.origin.equalTo(scrollPoint)) { scrollPoint = convertPointToView(scrollPoint, view); NSClipView(view).scrollToPoint(scrollPoint); --- 753,757 ---- scrollPoint.x += (Math.abs(ldiff) < Math.abs(rdiff)) ? (-ldiff) : rdiff; scrollPoint.y += (Math.abs(tdiff) < Math.abs(bdiff)) ? (-tdiff) : bdiff; ! if (!vRect.origin.isEqual(scrollPoint)) { scrollPoint = convertPointToView(scrollPoint, view); NSClipView(view).scrollToPoint(scrollPoint); Index: NSRect.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSRect.as,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NSRect.as 24 May 2005 20:29:25 -0000 1.7 --- NSRect.as 27 May 2005 01:33:06 -0000 1.8 *************** *** 57,61 **** } ! public function equalTo(other:NSRect):Boolean { return origin.x == other.origin.x && origin.y == other.origin.y && --- 57,61 ---- } ! public function isEqual(other:NSRect):Boolean { return origin.x == other.origin.x && origin.y == other.origin.y && Index: NSPoint.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSPoint.as,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NSPoint.as 24 May 2005 20:29:25 -0000 1.3 --- NSPoint.as 27 May 2005 01:33:06 -0000 1.4 *************** *** 44,52 **** /** The y-coordinate. */ public var y:Number; ! ! public function equalTo(other:NSPoint):Boolean { ! return x == other.x && y == other.y; ! } ! /** * Creates a new instance of NSPoint with the specified x and y --- 44,48 ---- /** The y-coordinate. */ public var y:Number; ! /** * Creates a new instance of NSPoint with the specified x and y *************** *** 73,76 **** --- 69,80 ---- /** + * Returns true if this point's x and y coordinates are the same + * as other's. + */ + public function isEqual(other:NSPoint):Boolean { + return x == other.x && y == other.y; + } + + /** * Adds point1 to point2 and returns the result. */ Index: NSSize.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSSize.as,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NSSize.as 26 May 2005 20:34:17 -0000 1.2 --- NSSize.as 27 May 2005 01:33:06 -0000 1.3 *************** *** 51,55 **** } ! public function equalTo(other):Boolean { return width == other.width && height == other.height } --- 51,55 ---- } ! public function isEqual(other):Boolean { return width == other.width && height == other.height } |
From: Richard K. <ric...@us...> - 2005-05-26 20:36:18
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20456 Modified Files: NSScrollView.as NSScroller.as Log Message: last methods in place for NSScrollView...testing and debugging Index: NSScrollView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSScrollView.as,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NSScrollView.as 26 May 2005 04:03:19 -0000 1.3 --- NSScrollView.as 26 May 2005 20:35:50 -0000 1.4 *************** *** 40,43 **** --- 40,45 ---- import org.actionstep.constants.NSBorderType; import org.actionstep.constants.NSScrollerPart; + + import org.actionstep.ASDraw; import org.actionstep.NSView; *************** *** 74,78 **** public function initWithFrame(rect:NSRect):NSScrollView { super.initWithFrame(rect); ! setContentView(new NSClipView()); m_borderType = NSBorderType.NSNoBorder; m_autohidesScrollers = false; --- 76,80 ---- public function initWithFrame(rect:NSRect):NSScrollView { super.initWithFrame(rect); ! setContentView((new NSClipView()).init()); m_borderType = NSBorderType.NSNoBorder; m_autohidesScrollers = false; *************** *** 180,184 **** if (m_hasHorizontalScroller) { if (m_horizontalScroller == null) { ! setHorizontalScroller(new NSScroller()); } addSubview(m_horizontalScroller); --- 182,186 ---- if (m_hasHorizontalScroller) { if (m_horizontalScroller == null) { ! setHorizontalScroller((new NSScroller()).init()); } addSubview(m_horizontalScroller); *************** *** 216,220 **** if (m_hasVerticalScroller) { if (m_verticalScroller == null) { ! setVerticalScroller(new NSScroller()); } addSubview(m_verticalScroller); --- 218,222 ---- if (m_hasVerticalScroller) { if (m_verticalScroller == null) { ! setVerticalScroller((new NSScroller()).init()); } addSubview(m_verticalScroller); *************** *** 339,343 **** if (scroller != m_verticalScroller && scroller != m_horizontalScroller) { ! return; //Unknown scroller } --- 341,346 ---- if (scroller != m_verticalScroller && scroller != m_horizontalScroller) { ! //Unknown scroller ! return; } *************** *** 400,404 **** public function reflectScrolledClipView(view:NSView) { ! //! implement } --- 403,443 ---- public function reflectScrolledClipView(view:NSView) { ! var documentFrame:NSRect = NSRect.ZeroRect; ! var clipViewBounds:NSRect = NSRect.ZeroRect; ! var floatValue:Number = 0; ! var knobProportion:Number = 0; ! var documentView:NSView; ! if (view != m_contentView) { ! return; ! } ! if (m_contentView != null) { ! clipViewBounds = m_contentView.bounds(); ! documentView = m_contentView.documentView(); ! } ! if (documentView != null) { ! documentFrame = documentView.frame(); ! } ! if (m_hasVerticalScroller) { ! if (documentFrame.size.height <= clipViewBounds.size.height) { ! m_verticalScroller.setEnabled(false); ! } else { ! m_verticalScroller.setEnabled(true); ! knobProportion = clipViewBounds.size.height / documentFrame.size.height; ! floatValue = (clipViewBounds.origin.y - documentFrame.origin.y) / ! (documentFrame.size.height - clipViewBounds.size.height); ! m_verticalScroller.setFloatValueKnobProportion(floatValue, knobProportion); ! } ! } ! if (m_hasHorizontalScroller) { ! if (documentFrame.size.width <= clipViewBounds.size.width) { ! m_horizontalScroller.setEnabled(false); ! } else { ! m_horizontalScroller.setEnabled(true); ! knobProportion = clipViewBounds.size.width / documentFrame.size.width; ! floatValue = (clipViewBounds.origin.x - documentFrame.origin.x) / ! (documentFrame.size.width - clipViewBounds.size.width); ! m_horizontalScroller.setFloatValueKnobProportion(floatValue, knobProportion); ! } ! } } *************** *** 414,422 **** vScrollerRect = new NSRect(contentRect.maxX() - scrollerWidth, contentRect.minY(), scrollerWidth, contentRect.size.height - scrollerWidth); m_verticalScroller.setFrame(vScrollerRect); - contentRect.size.width -= (vScrollerRect.size.width); } if (m_hasHorizontalScroller) { hScrollerRect = new NSRect(contentRect.minX(), contentRect.maxY() - scrollerWidth, contentRect.size.width - scrollerWidth, scrollerWidth); m_horizontalScroller.setFrame(hScrollerRect); contentRect.size.height -= (hScrollerRect.size.height); } --- 453,465 ---- vScrollerRect = new NSRect(contentRect.maxX() - scrollerWidth, contentRect.minY(), scrollerWidth, contentRect.size.height - scrollerWidth); m_verticalScroller.setFrame(vScrollerRect); } if (m_hasHorizontalScroller) { hScrollerRect = new NSRect(contentRect.minX(), contentRect.maxY() - scrollerWidth, contentRect.size.width - scrollerWidth, scrollerWidth); m_horizontalScroller.setFrame(hScrollerRect); + } + if (m_hasVerticalScroller) { + contentRect.size.width -= (vScrollerRect.size.width); + } + if (m_hasHorizontalScroller) { contentRect.size.height -= (hScrollerRect.size.height); } *************** *** 428,432 **** public function drawRect(rect:NSRect) { ! //! draw borders } --- 471,487 ---- public function drawRect(rect:NSRect) { ! switch(m_borderType) { ! case NSBorderType.NSNoBorder: ! break; ! case NSBorderType.NSLineBorder: ! ASDraw.outlineRectWithRect(m_mcBounds, rect, [0]); ! break; ! case NSBorderType.NSBezelBorder: ! ASDraw.outlineRectWithRect(m_mcBounds, rect, [0]); ! break; ! case NSBorderType.NSGrooveBorder: ! ASDraw.outlineRectWithRect(m_mcBounds, rect, [0]); ! break; ! } } Index: NSScroller.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSScroller.as,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** NSScroller.as 25 May 2005 14:21:52 -0000 1.8 --- NSScroller.as 26 May 2005 20:35:50 -0000 1.9 *************** *** 162,165 **** --- 162,166 ---- } m_hitPart = NSScrollerPart.NSScrollerNoPart; + setNeedsDisplay(true); checkSpaceForParts(); } *************** *** 472,475 **** --- 473,479 ---- public function mouseDown(event:NSEvent) { + if (!m_enabled) { + return; + } var location:NSPoint = event.mouseLocation; m_hitPart = testPart(location); *************** *** 544,555 **** public function drawRect(rect:NSRect) { ASTheme.current().drawScrollerSlotWithRectInView(rect, this); ! var rectIncrementLine:NSRect = rectForPart(NSScrollerPart.NSScrollerIncrementLine); ! var rectDecrementLine:NSRect = rectForPart(NSScrollerPart.NSScrollerDecrementLine); ! (m_horizontal ? g_leftCell : g_upCell).drawWithFrameInView(rectDecrementLine, this); ! (m_horizontal ? g_rightCell : g_downCell).drawWithFrameInView(rectIncrementLine, this); ! drawKnob(); } private function drawKnob() { if (m_scrollerKnobClip == null || m_scrollerKnobClip._parent == undefined) { m_scrollerKnobClip = createBoundsMovieClip(); --- 548,560 ---- public function drawRect(rect:NSRect) { ASTheme.current().drawScrollerSlotWithRectInView(rect, this); ! if (m_enabled) { ! (m_horizontal ? g_leftCell : g_upCell).drawWithFrameInView(rectForPart(NSScrollerPart.NSScrollerDecrementLine), this); ! (m_horizontal ? g_rightCell : g_downCell).drawWithFrameInView(rectForPart(NSScrollerPart.NSScrollerIncrementLine), this); ! drawKnob(); ! } } private function drawKnob() { + if (m_mcBounds == null) return; if (m_scrollerKnobClip == null || m_scrollerKnobClip._parent == undefined) { m_scrollerKnobClip = createBoundsMovieClip(); |
From: Richard K. <ric...@us...> - 2005-05-26 20:36:09
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20456/test Modified Files: ASTestMain.as Added Files: ASTestScrollView.as Log Message: last methods in place for NSScrollView...testing and debugging --- NEW FILE: ASTestScrollView.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.ASTestScrollView { public static function test() { var app = NSApplication.sharedApplication(); var window1 = (new NSWindow()).initWithContentRect(new NSRect(0,0,500,500)); var view:ASTestView = new ASTestView(); view.initWithFrame(new NSRect(0, 0, 800, 800)); 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); window1.setContentView(scrollView); app.run(); } } Index: ASTestMain.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/test/ASTestMain.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ASTestMain.as 22 May 2005 03:49:06 -0000 1.1 --- ASTestMain.as 26 May 2005 20:35:50 -0000 1.2 *************** *** 39,43 **** try { ! ASTestScrollers.test(); } catch (e:Error) --- 39,43 ---- try { ! ASTestScrollView.test(); } catch (e:Error) |
From: Richard K. <ric...@us...> - 2005-05-26 20:35:22
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20352 Modified Files: NSView.as Log Message: add auto resize code and fix error in converting points if movieclips do not exist Index: NSView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSView.as,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** NSView.as 25 May 2005 22:06:41 -0000 1.13 --- NSView.as 26 May 2005 20:35:13 -0000 1.14 *************** *** 481,489 **** public function setFrame(newFrame:NSRect):Void { ! m_frame = newFrame.clone(); ! m_bounds.size = m_frame.size.clone(); ! updateFrameMovieClipSize(); ! if(m_postsFrameChangedNotifications) { ! m_notificationCenter.postNotificationWithNameObject(NSViewFrameDidChangeNotification, this); } } --- 481,499 ---- public function setFrame(newFrame:NSRect):Void { ! var changedOrigin:Boolean = !m_frame.origin.equalTo(newFrame.origin); ! var changedSize:Boolean = !m_frame.size.equalTo(newFrame.size); ! if (changedSize || changedOrigin) { ! m_frame = newFrame.clone(); ! updateFrameMovieClipSize(); ! if (changedSize) { ! if (m_bounds == null) { ! m_bounds = new NSRect(0,0,m_frame.size.width, m_frame.size.height); ! } else { ! m_bounds.size = m_frame.size.clone(); ! } ! } ! if(m_postsFrameChangedNotifications) { ! m_notificationCenter.postNotificationWithNameObject(NSViewFrameDidChangeNotification, this); ! } } } *************** *** 616,625 **** */ public function convertPointFromView(aPoint:NSPoint, aView:NSView):NSPoint { - var from:MovieClip = (aView == null) ? _root : aView.mcBounds(); - var pt:NSPoint = aPoint.clone(); ! from.localToGlobal(pt); ! mcBounds().globalToLocal(pt); ! return pt; } --- 626,636 ---- */ public function convertPointFromView(aPoint:NSPoint, aView:NSView):NSPoint { var pt:NSPoint = aPoint.clone(); ! if (m_mcBounds != null) { // Simple case ! var from:MovieClip = (aView == null) ? _root : aView.mcBounds(); ! from.localToGlobal(pt); ! mcBounds().globalToLocal(pt); ! } else { // Difficult case ! } return pt; } *************** *** 633,642 **** */ public function convertPointToView(aPoint:NSPoint, aView:NSView):NSPoint { - var to:MovieClip = (aView == null) ? _root : aView.mcBounds(); - var pt:NSPoint = aPoint.clone(); ! mcBounds().localToGlobal(pt); ! to.globalToLocal(pt); ! return pt; } --- 644,654 ---- */ public function convertPointToView(aPoint:NSPoint, aView:NSView):NSPoint { var pt:NSPoint = aPoint.clone(); ! if (m_mcBounds != null) { // Simple case ! var to:MovieClip = (aView == null) ? _root : aView.mcBounds(); ! mcBounds().localToGlobal(pt); ! to.globalToLocal(pt); ! } else { // Difficult case ! } return pt; } *************** *** 815,819 **** public function resizeWithOldSuperviewSize(oldBoundsSize:NSSize) { ! //! Resize according to the autoresizingMask setting } --- 827,883 ---- public function resizeWithOldSuperviewSize(oldBoundsSize:NSSize) { ! if (m_autoresizingMask == NSView.NotSizable) { ! return ! } ! var options:Number = 0; ! var superViewFrameSize:NSSize = m_superview == null ? NSSize.ZeroSize : m_superview.frame().size; ! var newFrame:NSRect = m_frame.clone(); ! var changedOrigin = false; ! var changedSize = false; ! if (m_autoresizingMask & NSView.WidthSizable) { ! options++; ! } ! if (m_autoresizingMask & NSView.MinXMargin) { ! options++; ! } ! if (m_autoresizingMask & NSView.MaxXMargin) { ! options++; ! } ! if (options > 0) { ! var change:Number = superViewFrameSize.width - oldBoundsSize.width; ! var changePerOption:Number = change/options; ! if (m_autoresizingMask & NSView.WidthSizable) { ! newFrame.size.width += changePerOption; ! changedSize = true; ! } ! if (m_autoresizingMask & NSView.MinXMargin) { ! newFrame.origin.x += changePerOption; ! changedOrigin = true; ! } ! } ! ! options = 0; ! if (m_autoresizingMask & NSView.HeightSizable) { ! options++; ! } ! if (m_autoresizingMask & NSView.MinYMargin) { ! options++; ! } ! if (m_autoresizingMask & NSView.MaxYMargin) { ! options++; ! } ! if (options > 0) { ! var change:Number = superViewFrameSize.height - oldBoundsSize.height; ! var changePerOption:Number = change/options; ! if (m_autoresizingMask & NSView.HeightSizable) { ! newFrame.size.height += changePerOption; ! changedSize = true; ! } ! if (m_autoresizingMask & NSView.MinYMargin) { ! newFrame.origin.y += changePerOption; ! changedOrigin = true; ! } ! } ! setFrame(newFrame); } |
From: Richard K. <ric...@us...> - 2005-05-26 20:34:27
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20258 Modified Files: NSSize.as Log Message: implement equalto Index: NSSize.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSSize.as,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** NSSize.as 4 May 2005 02:33:05 -0000 1.1.1.1 --- NSSize.as 26 May 2005 20:34:17 -0000 1.2 *************** *** 50,53 **** --- 50,57 ---- return "NSSize(width="+width+", height="+height+")"; } + + public function equalTo(other):Boolean { + return width == other.width && height == other.height + } } \ No newline at end of file |
From: Richard K. <ric...@us...> - 2005-05-26 04:03:29
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17628 Modified Files: NSScrollView.as Log Message: implemented scrollAction handler for scroller target/action messages Index: NSScrollView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSScrollView.as,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NSScrollView.as 25 May 2005 22:07:14 -0000 1.2 --- NSScrollView.as 26 May 2005 04:03:19 -0000 1.3 *************** *** 39,42 **** --- 39,43 ---- import org.actionstep.constants.NSBorderType; + import org.actionstep.constants.NSScrollerPart; import org.actionstep.NSView; *************** *** 46,49 **** --- 47,51 ---- import org.actionstep.NSColor; import org.actionstep.NSRect; + import org.actionstep.NSPoint; import org.actionstep.NSEvent; *************** *** 64,67 **** --- 66,71 ---- private var m_verticalPageScroll:Number; + private var m_knobMoved:Boolean; + public function init():NSScrollView { return initWithFrame(NSRect.ZeroRect); *************** *** 314,319 **** } public function scrollAction(scroller:NSScroller) { ! //! implement } --- 318,398 ---- } + /** + * Callback from NSScroller in target/action + */ public function scrollAction(scroller:NSScroller) { ! var floatValue:Number = scroller.floatValue(); ! var hitPart:NSScrollerPart = scroller.hitPart(); ! var clipViewBounds:NSRect; ! var documentRect:NSRect; ! var amount:Number = 0; ! var point:NSPoint; ! ! if (m_contentView == null) { ! clipViewBounds = NSRect.ZeroRect; ! documentRect = NSRect.ZeroRect; ! } else { ! clipViewBounds = m_contentView.bounds(); ! documentRect = m_contentView.documentRect(); ! } ! point = clipViewBounds.origin.clone(); ! ! if (scroller != m_verticalScroller && scroller != m_horizontalScroller) { ! return; //Unknown scroller ! } ! ! m_knobMoved = false; ! switch(scroller.hitPart()) { ! case NSScrollerPart.NSScrollerKnob: ! case NSScrollerPart.NSScrollerKnobSlot: ! m_knobMoved = true; ! break; ! case NSScrollerPart.NSScrollerIncrementPage: ! if (scroller == m_horizontalScroller) { ! amount = clipViewBounds.size.width - m_horizontalPageScroll; ! } else { ! amount = clipViewBounds.size.height - m_verticalPageScroll; ! } ! break; ! case NSScrollerPart.NSScrollerIncrementLine: ! if (scroller == m_horizontalScroller) { ! amount = m_horizontalLineScroll; ! } else { ! amount = m_verticalLineScroll; ! } ! break; ! case NSScrollerPart.NSScrollerDecrementPage: ! if (scroller == m_horizontalScroller) { ! amount = m_horizontalPageScroll - clipViewBounds.size.width; ! } else { ! amount = m_verticalPageScroll - clipViewBounds.size.height; ! } ! break; ! case NSScrollerPart.NSScrollerDecrementLine: ! if (scroller == m_horizontalScroller) { ! amount = -m_horizontalLineScroll; ! } else { ! amount = -m_verticalLineScroll; ! } ! break; ! default: ! return; ! } ! if (!m_knobMoved) { ! if (scroller == m_horizontalScroller) { ! point.x = clipViewBounds.origin.x + amount; ! } else { ! point.y = clipViewBounds.origin.y + amount; ! } ! } else { ! if (scroller == m_horizontalScroller) { ! point.x = floatValue * (documentRect.size.width - clipViewBounds.size.width); ! point.x += documentRect.origin.x; ! } else { ! point.y = floatValue * (documentRect.size.height - clipViewBounds.size.height); ! point.y += documentRect.origin.y; ! } ! } ! m_contentView.scrollToPoint(point); } |
From: Richard K. <ric...@us...> - 2005-05-25 22:07:22
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19587 Modified Files: NSScrollView.as Log Message: most of the functions are in place Index: NSScrollView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSScrollView.as,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NSScrollView.as 24 May 2005 20:31:34 -0000 1.1 --- NSScrollView.as 25 May 2005 22:07:14 -0000 1.2 *************** *** 35,114 **** + contentSizeForFrameSize:hasHorizontalScroller:hasVerticalScroller:borderType: + frameSizeForContentSize:hasHorizontalScroller:hasVerticalScroller:borderType: - Determining component sizes - â contentSize - â documentVisibleRect - Managing graphics attributes - â setBackgroundColor: - â backgroundColor - â drawsBackground - â setDrawsBackground: - â setBorderType: - â borderType - â setDocumentCursor: - â documentCursor - Managing the scrolled views - â setContentView: - â contentView - â setDocumentView: - â documentView - Managing scrollers - â setHorizontalScroller: - â horizontalScroller - â setHasHorizontalScroller: - â hasHorizontalScroller - â setVerticalScroller: - â verticalScroller - â setHasVerticalScroller: - â hasVerticalScroller - â setAutohidesScrollers: - â autohidesScrollers - Managing rulers - + setRulerViewClass: - + rulerViewClass - â setHasHorizontalRuler: - â hasHorizontalRuler - â setHorizontalRulerView: - â horizontalRulerView - â setHasVerticalRuler: - â hasVerticalRuler - â setVerticalRulerView: - â verticalRulerView - â setRulersVisible: - â rulersVisible - Setting scrolling behavior - â setLineScroll: - â lineScroll - â setHorizontalLineScroll: - â horizontalLineScroll - â setVerticalLineScroll: - â verticalLineScroll - â setPageScroll: - â pageScroll - â setHorizontalPageScroll: - â horizontalPageScroll - â setVerticalPageScroll: - â verticalPageScroll - â setScrollsDynamically: - â scrollsDynamically - â scrollWheel: - Updating display after scrolling - â reflectScrolledClipView: - Arranging components - â tile */ import org.actionstep.NSView; import org.actionstep.NSRect; class org.actionstep.NSScrollView extends NSView { // Determining component sizes ! public function contentSize():NSRect { ! return null; } public function reflectScrolledClipView(view:NSView) { //! implement } } \ No newline at end of file --- 35,379 ---- + contentSizeForFrameSize:hasHorizontalScroller:hasVerticalScroller:borderType: + frameSizeForContentSize:hasHorizontalScroller:hasVerticalScroller:borderType: */ + import org.actionstep.constants.NSBorderType; import org.actionstep.NSView; + import org.actionstep.NSClipView; + import org.actionstep.NSScroller; + import org.actionstep.NSSize; + import org.actionstep.NSColor; import org.actionstep.NSRect; + import org.actionstep.NSEvent; class org.actionstep.NSScrollView extends NSView { + + private var m_contentView:NSClipView; + private var m_borderType:NSBorderType; + private var m_horizontalScroller:NSScroller; + private var m_verticalScroller:NSScroller; + private var m_hasHorizontalScroller:Boolean; + private var m_hasVerticalScroller:Boolean; + private var m_autohidesScrollers:Boolean; + private var m_scrollsDynamically:Boolean; + + private var m_horizontalLineScroll:Number; + private var m_verticalLineScroll:Number + private var m_horizontalPageScroll:Number; + private var m_verticalPageScroll:Number; + + public function init():NSScrollView { + return initWithFrame(NSRect.ZeroRect); + } + + public function initWithFrame(rect:NSRect):NSScrollView { + super.initWithFrame(rect); + setContentView(new NSClipView()); + m_borderType = NSBorderType.NSNoBorder; + m_autohidesScrollers = false; + m_horizontalLineScroll = 10; + m_verticalLineScroll = 10; + m_horizontalPageScroll = 10; + m_verticalPageScroll = 10; + m_scrollsDynamically = true; + tile(); + return this; + } + // Determining component sizes ! ! public function contentSize():NSSize { ! return m_contentView.bounds().size; ! } ! ! public function documentVisibleRect():NSRect { ! return m_contentView.documentVisibleRect(); ! } ! ! // Managing graphics attributes ! ! public function setBackgroundColor(color:NSColor) { ! m_contentView.setBackgroundColor(color); ! } ! ! public function backgroundColor():NSColor { ! return m_contentView.backgroundColor(); ! } ! ! public function drawsBackground():Boolean { ! return m_contentView.drawsBackground(); ! } ! ! public function setDrawsBackground(value:Boolean) { ! m_contentView.setDrawsBackground(value); ! } ! ! public function setBorderType(value:NSBorderType) { ! m_borderType = value; ! tile(); ! } ! ! public function borderType():NSBorderType { ! return m_borderType; ! } ! ! // Managing the scrolled views ! ! public function setContentView(view:NSClipView) { ! if (view == null || !(view instanceof NSView)) { ! throw new Error("You cannot set a content view to anything other than an NSView"); ! } ! if (view != m_contentView) { ! var docView:NSView = view.documentView(); ! m_contentView.removeFromSuperview(); ! m_contentView = view; ! addSubview(m_contentView); ! if (docView != null) { ! setDocumentView(docView); ! } ! } ! m_contentView.setAutoresizingMask(NSView.WidthSizable | NSView.HeightSizable); ! tile(); ! } ! ! public function contentView():NSClipView { ! return m_contentView; } + public function setDocumentView(view:NSView) { + m_contentView.setDocumentView(view); + tile(); + } + + public function documentView():NSView { + return m_contentView.documentView(); + } + + // Managing scrollers + + public function setHorizontalScroller(scroller:NSScroller) { + if (m_horizontalScroller != null) { + m_horizontalScroller.removeFromSuperview(); + } + m_horizontalScroller = scroller; + if (m_horizontalScroller != null) { + m_horizontalScroller.setAutoresizingMask(NSView.WidthSizable); + m_horizontalScroller.setTarget(this); + m_horizontalScroller.setAction("scrollAction"); + } + } + + public function horizontalScroller():NSScroller { + return m_horizontalScroller; + } + + public function setHasHorizontalScroller(value:Boolean) { + if (m_hasHorizontalScroller == value) { + return; + } + m_hasHorizontalScroller = value; + if (m_hasHorizontalScroller) { + if (m_horizontalScroller == null) { + setHorizontalScroller(new NSScroller()); + } + addSubview(m_horizontalScroller); + } else { + m_horizontalScroller.removeFromSuperview(); + } + tile(); + } + + public function hasHorizontalScroller():Boolean { + return m_hasHorizontalScroller; + } + + public function setVerticalScroller(scroller:NSScroller) { + if (m_verticalScroller != null) { + m_verticalScroller.removeFromSuperview(); + } + m_verticalScroller = scroller; + if (m_verticalScroller != null) { + m_verticalScroller.setAutoresizingMask(NSView.WidthSizable); + m_verticalScroller.setTarget(this); + m_verticalScroller.setAction("scrollAction"); + } + } + + public function verticalScroller():NSScroller { + return m_verticalScroller; + } + + public function setHasVerticalScroller(value:Boolean) { + if (m_hasVerticalScroller == value) { + return; + } + m_hasVerticalScroller = value; + if (m_hasVerticalScroller) { + if (m_verticalScroller == null) { + setVerticalScroller(new NSScroller()); + } + addSubview(m_verticalScroller); + } else { + m_verticalScroller.removeFromSuperview(); + } + tile(); + } + + public function hasVerticalScroller():Boolean { + return m_hasVerticalScroller; + } + + public function setAutohidesScrollers(value:Boolean) { + if (m_autohidesScrollers == value) { + return; + } + m_autohidesScrollers = value; + tile(); + } + + public function autohidesScrollers():Boolean { + return m_autohidesScrollers; + } + + // Setting scrolling behavior + /* + â scrollWheel: + */ + + + public function setLineScroll(value:Number) { + m_horizontalLineScroll = value; + m_verticalLineScroll = value; + } + + public function lineScroll():Number { + if (m_horizontalLineScroll != m_verticalLineScroll) { + throw new Error("Horizontal and vertical line scroll values are not the same"); + } + return m_horizontalLineScroll; + } + + public function setHorizontalLineScroll(value:Number) { + m_horizontalLineScroll = value; + } + + public function horizontalLineScroll():Number { + return m_horizontalLineScroll; + } + + public function setVerticalLineScroll(value:Number) { + m_verticalLineScroll = value; + } + + public function verticalLineScroll():Number { + return m_verticalLineScroll; + } + + public function setPageScroll(value:Number) { + m_horizontalPageScroll = value; + m_verticalPageScroll = value; + } + + public function pageScroll():Number { + if (m_horizontalPageScroll != m_verticalPageScroll) { + throw new Error("Horizontal and vertical page scroll values are not the same"); + } + return m_horizontalPageScroll; + } + + public function setHorizontalPageScroll(value:Number) { + m_horizontalPageScroll = value; + } + + public function horizontalPageScroll():Number { + return m_horizontalPageScroll; + } + + public function setVerticalPageScroll(value:Number) { + m_verticalPageScroll = value; + } + + public function verticalPageScroll():Number { + return m_verticalPageScroll; + } + + public function setScrollsDynamically(value:Boolean) { + if (m_scrollsDynamically == value) { + return true; + } + m_scrollsDynamically = value; + } + + public function scrollsDynamically():Boolean { + return m_scrollsDynamically; + } + + public function scrollWheel(event:NSEvent) { + //! Implement this? + } + + public function scrollAction(scroller:NSScroller) { + //! implement + } + + // Updating display after scrolling + public function reflectScrolledClipView(view:NSView) { //! implement } + + // Arranging components + + public function tile() { + var contentRect:NSRect; + var vScrollerRect:NSRect; + var hScrollerRect:NSRect; + var scrollerWidth = NSScroller.scrollerWidth(); + contentRect = m_bounds.insetRect(m_borderType.size.width, m_borderType.size.height); + if (m_hasVerticalScroller) { + vScrollerRect = new NSRect(contentRect.maxX() - scrollerWidth, contentRect.minY(), scrollerWidth, contentRect.size.height - scrollerWidth); + m_verticalScroller.setFrame(vScrollerRect); + contentRect.size.width -= (vScrollerRect.size.width); + } + if (m_hasHorizontalScroller) { + hScrollerRect = new NSRect(contentRect.minX(), contentRect.maxY() - scrollerWidth, contentRect.size.width - scrollerWidth, scrollerWidth); + m_horizontalScroller.setFrame(hScrollerRect); + contentRect.size.height -= (hScrollerRect.size.height); + } + m_contentView.setFrame(contentRect); + setNeedsDisplay(true); + } + + // Overridden functions + + public function drawRect(rect:NSRect) { + //! draw borders + } + + public function willRemoveSubview(view:NSView) { + if (view == m_contentView) { + m_contentView = null; + } + } + + public function setFrame(rect:NSRect) { + super.setFrame(rect); + tile(); + } + + public function setFrameSize(size:NSSize) { + super.setFrameSize(size); + tile(); + } + + public function resizeSubviewsWithOldSize(size:NSSize) { + super.resizeSubviewsWithOldSize(size); + tile(); + } + + public function isOpaque():Boolean { + return true; + } + } \ No newline at end of file |
From: Richard K. <ric...@us...> - 2005-05-25 22:06:50
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19492 Modified Files: NSView.as Log Message: renamed autoresizingMask constants Index: NSView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSView.as,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** NSView.as 25 May 2005 14:21:52 -0000 1.12 --- NSView.as 25 May 2005 22:06:41 -0000 1.13 *************** *** 50,60 **** public static var NSLineBorder = 3; ! public static var NSViewNotSizable = 0; //The receiver cannot be resized. ! public static var NSViewMinXMargin = 1; //The left margin between the receiver and its superview is flexible. ! public static var NSViewWidthSizable = 2; //The receiverâs width is flexible. ! public static var NSViewMaxXMargin = 4; //The right margin between the receiver and its superview is flexible. ! public static var NSViewMinYMargin = 8; //The bottom margin between the receiver and its superview is flexible. ! public static var NSViewHeightSizable = 16; //The receiverâs height is flexible. ! public static var NSViewMaxYMargin = 32; //The top margin between the receiver and its superview is flexible. // Notifications --- 50,60 ---- public static var NSLineBorder = 3; ! public static var NotSizable = 0; //The receiver cannot be resized. ! public static var MinXMargin = 1; //The left margin between the receiver and its superview is flexible. ! public static var WidthSizable = 2; //The receiverâs width is flexible. ! public static var MaxXMargin = 4; //The right margin between the receiver and its superview is flexible. ! public static var MinYMargin = 8; //The bottom margin between the receiver and its superview is flexible. ! public static var HeightSizable = 16; //The receiverâs height is flexible. ! public static var MaxYMargin = 32; //The top margin between the receiver and its superview is flexible. // Notifications *************** *** 103,107 **** m_autoresizesSubviews = true; ! m_autoresizingMask = NSViewNotSizable; m_mcDepth = 10; --- 103,107 ---- m_autoresizesSubviews = true; ! m_autoresizingMask = NotSizable; m_mcDepth = 10; |
From: Richard K. <ric...@us...> - 2005-05-25 14:22:01
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19723 Modified Files: NSScroller.as NSView.as Log Message: change createSubviewMovieClip to createBoundsMovieClip Index: NSView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSView.as,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** NSView.as 25 May 2005 14:11:58 -0000 1.11 --- NSView.as 25 May 2005 14:21:52 -0000 1.12 *************** *** 141,145 **** } ! public function createSubviewMovieClip():MovieClip { var bounds = this.mcBounds(); var clipDepth = m_mcDepth++; --- 141,145 ---- } ! public function createBoundsMovieClip():MovieClip { var bounds = this.mcBounds(); var clipDepth = m_mcDepth++; *************** *** 179,183 **** private function createFrameMovieClip() { ! return m_superview.createSubviewMovieClip(); } --- 179,183 ---- private function createFrameMovieClip() { ! return m_superview.createBoundsMovieClip(); } Index: NSScroller.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSScroller.as,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NSScroller.as 23 May 2005 18:31:08 -0000 1.7 --- NSScroller.as 25 May 2005 14:21:52 -0000 1.8 *************** *** 553,557 **** private function drawKnob() { if (m_scrollerKnobClip == null || m_scrollerKnobClip._parent == undefined) { ! m_scrollerKnobClip = createSubviewMovieClip(); m_scrollerKnobClip.view = this; } --- 553,557 ---- private function drawKnob() { if (m_scrollerKnobClip == null || m_scrollerKnobClip._parent == undefined) { ! m_scrollerKnobClip = createBoundsMovieClip(); m_scrollerKnobClip.view = this; } |
From: Richard K. <ric...@us...> - 2005-05-25 14:21:35
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19632 Modified Files: NSNotificationCenter.as Log Message: subclass NSObject Index: NSNotificationCenter.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSNotificationCenter.as,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NSNotificationCenter.as 5 May 2005 16:30:03 -0000 1.3 --- NSNotificationCenter.as 25 May 2005 14:21:25 -0000 1.4 *************** *** 30,36 **** import org.actionstep.NSNotification; import org.actionstep.ASUtils; ! class org.actionstep.NSNotificationCenter { private static var NULL_KEY = ASUtils.intern("__NULL__"); --- 30,37 ---- import org.actionstep.NSNotification; + import org.actionstep.NSObject; import org.actionstep.ASUtils; ! class org.actionstep.NSNotificationCenter extends NSObject { private static var NULL_KEY = ASUtils.intern("__NULL__"); |
From: Richard K. <ric...@us...> - 2005-05-25 14:12:08
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17498 Modified Files: NSView.as Log Message: bug assigning notification center Index: NSView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSView.as,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** NSView.as 24 May 2005 21:46:25 -0000 1.10 --- NSView.as 25 May 2005 14:11:58 -0000 1.11 *************** *** 119,123 **** public function initWithFrame(newFrame:NSRect):NSView { ! m_notificationCenter = m_notificationCenter; m_frame = newFrame.clone(); m_bounds = new NSRect(0, 0, m_frame.size.width, m_frame.size.height); --- 119,123 ---- public function initWithFrame(newFrame:NSRect):NSView { ! m_notificationCenter = NSNotificationCenter.defaultCenter(); m_frame = newFrame.clone(); m_bounds = new NSRect(0, 0, m_frame.size.width, m_frame.size.height); |
From: Richard K. <ric...@us...> - 2005-05-24 21:46:33
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27199 Modified Files: NSView.as Log Message: add scrolling methods and visualrect Index: NSView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSView.as,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** NSView.as 24 May 2005 20:39:56 -0000 1.9 --- NSView.as 24 May 2005 21:46:25 -0000 1.10 *************** *** 39,42 **** --- 39,45 ---- import org.actionstep.NSEvent; + import org.actionstep.NSClipView; + import org.actionstep.NSScrollView; + class org.actionstep.NSView extends NSResponder { *************** *** 306,310 **** if (superview == null) return; ! //! superview.setNeedsDisplayInRect(frame()); for (view = m_window.firstResponder();view != null && view["superview"] != undefined; --- 309,313 ---- if (superview == null) return; ! superview.setNeedsDisplay(true); for (view = m_window.firstResponder();view != null && view["superview"] != undefined; *************** *** 699,702 **** --- 702,718 ---- //****************************************************** + public function scrollPoint(point:NSPoint) { + var view:NSView = m_superview; + while (view != null && view.getClass()!=NSClipView) { + view = view.superview(); + } + if (view != null) { + point = convertPointToView(point, view); + if (!point.equalTo(view.bounds().origin)) { + NSClipView(view).scrollToPoint(point); + } + } + } + /** * Scrolls this view's drawing surface the minimum distance for *************** *** 705,714 **** * Returns TRUE if scrolling is performed, FALSE otherwise. */ ! public function scrollRectToVisible(aRect:NSRect):Boolean ! { ! //! IMPLEMENT return false; } //****************************************************** --- 721,784 ---- * Returns TRUE if scrolling is performed, FALSE otherwise. */ ! public function scrollRectToVisible(aRect:NSRect):Boolean { ! var view:NSView = m_superview; ! while (view != null && view.getClass()!=NSClipView) { ! view = view.superview(); ! } ! if (view != null) { ! var vRect:NSRect = visibleRect(); ! var scrollPoint:NSPoint = vRect.origin.clone(); ! if (vRect.size.width == 0 && vRect.size.height == 0) { ! return false; ! } ! var ldiff = vRect.minX() - aRect.minX(); ! var rdiff = aRect.maxX() - vRect.maxX(); ! var tdiff = vRect.minY() - aRect.minY(); ! var bdiff = aRect.maxY() - vRect.maxY(); ! ! if ((ldiff*rdiff) > 0) ldiff = rdiff = 0; ! if ((tdiff*bdiff) > 0) tdiff = bdiff = 0; ! scrollPoint.x += (Math.abs(ldiff) < Math.abs(rdiff)) ? (-ldiff) : rdiff; ! scrollPoint.y += (Math.abs(tdiff) < Math.abs(bdiff)) ? (-tdiff) : bdiff; ! if (!vRect.origin.equalTo(scrollPoint)) { ! scrollPoint = convertPointToView(scrollPoint, view); ! NSClipView(view).scrollToPoint(scrollPoint); ! return true; ! } ! } return false; } + public function autoscroll(event:NSEvent):Boolean { + if (m_superview) { + return m_superview.autoscroll(event); + } else { + return false; + } + } + + public function adjustScroll(proposedRect:NSRect):NSRect { + return proposedRect; + } + + public function scrollRectBy(rect:NSRect, size:NSSize) { + // DO NOTHING + } + + public function enclosingScrollView():NSScrollView { + var view:NSView = m_superview; + while (view != null && view.getClass()!=NSScrollView) { + view = view.superview(); + } + return view == null ? null : NSScrollView(view); + } + + public function scrollClipViewToPoint(clipView:NSClipView, point:NSPoint) { + //DO NOTHING + } + + public function reflectScrolledClipView(clipView:NSClipView) { + //DO NOTHING + } //****************************************************** *************** *** 836,847 **** public function drawRect(rect:NSRect) { } //! which other functions in the drawing group are needed? - // â visibleRect // â canDraw // â shouldDrawColor // â getRectsBeingDrawn:count: // â needsToDrawRect: - // â wantsDefaultClipping // Managing live resize --- 906,929 ---- public function drawRect(rect:NSRect) { } + + public function visibleRect():NSRect { + if (m_window == null) { + return NSRect.ZeroRect; + } + if (m_superview == null) { + return m_bounds; + } + return convertRectFromView(m_superview.visibleRect(), m_superview).intersectionRect(m_bounds); + } + + public function wantsDefaultClipping():Boolean { + return true; + } //! which other functions in the drawing group are needed? // â canDraw // â shouldDrawColor // â getRectsBeingDrawn:count: // â needsToDrawRect: // Managing live resize |
From: Richard K. <ric...@us...> - 2005-05-24 21:45:34
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26976 Modified Files: NSActionCell.as Log Message: remove comment Index: NSActionCell.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSActionCell.as,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** NSActionCell.as 6 May 2005 05:20:48 -0000 1.5 --- NSActionCell.as 24 May 2005 21:45:23 -0000 1.6 *************** *** 97,101 **** } } - //! Update the field editor with the font? } --- 97,100 ---- |
From: Richard K. <ric...@us...> - 2005-05-24 20:40:04
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14493 Modified Files: NSView.as Log Message: wrote translateOriginToPoint method Index: NSView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSView.as,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** NSView.as 24 May 2005 20:30:30 -0000 1.8 --- NSView.as 24 May 2005 20:39:56 -0000 1.9 *************** *** 586,590 **** public function translateOriginToPoint(point:NSPoint) { ! //! How to implement this? } --- 586,595 ---- public function translateOriginToPoint(point:NSPoint) { ! m_bounds.origin.x -= point.x; ! m_bounds.origin.y -= point.y; ! updateBoundsMovieClip(); ! if(m_postsBoundsChangedNotifications) { ! m_notificationCenter.postNotificationWithNameObject(NSViewBoundsDidChangeNotification, this); ! } } |
From: Richard K. <ric...@us...> - 2005-05-24 20:31:43
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12682 Added Files: NSClipView.as NSScrollView.as Log Message: building scrollview and clipview...clipview should be about ready to use --- NEW FILE: NSScrollView.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. */ /* Calculating layout + contentSizeForFrameSize:hasHorizontalScroller:hasVerticalScroller:borderType: + frameSizeForContentSize:hasHorizontalScroller:hasVerticalScroller:borderType: Determining component sizes â contentSize â documentVisibleRect Managing graphics attributes â setBackgroundColor: â backgroundColor â drawsBackground â setDrawsBackground: â setBorderType: â borderType â setDocumentCursor: â documentCursor Managing the scrolled views â setContentView: â contentView â setDocumentView: â documentView Managing scrollers â setHorizontalScroller: â horizontalScroller â setHasHorizontalScroller: â hasHorizontalScroller â setVerticalScroller: â verticalScroller â setHasVerticalScroller: â hasVerticalScroller â setAutohidesScrollers: â autohidesScrollers Managing rulers + setRulerViewClass: + rulerViewClass â setHasHorizontalRuler: â hasHorizontalRuler â setHorizontalRulerView: â horizontalRulerView â setHasVerticalRuler: â hasVerticalRuler â setVerticalRulerView: â verticalRulerView â setRulersVisible: â rulersVisible Setting scrolling behavior â setLineScroll: â lineScroll â setHorizontalLineScroll: â horizontalLineScroll â setVerticalLineScroll: â verticalLineScroll â setPageScroll: â pageScroll â setHorizontalPageScroll: â horizontalPageScroll â setVerticalPageScroll: â verticalPageScroll â setScrollsDynamically: â scrollsDynamically â scrollWheel: Updating display after scrolling â reflectScrolledClipView: Arranging components â tile */ import org.actionstep.NSView; import org.actionstep.NSRect; class org.actionstep.NSScrollView extends NSView { // Determining component sizes public function contentSize():NSRect { return null; } public function reflectScrolledClipView(view:NSView) { //! implement } } --- NEW FILE: NSClipView.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.ASDraw import org.actionstep.NSView; import org.actionstep.NSNotificationCenter; import org.actionstep.NSNotification; import org.actionstep.NSPoint; import org.actionstep.NSSize; import org.actionstep.NSColor; import org.actionstep.NSRect; import org.actionstep.NSScrollView; class org.actionstep.NSClipView extends NSView { private var m_documentView:NSView; private var m_drawsBackground:Boolean; private var m_copiesOnScroll:Boolean; private var m_backgroundColor:NSColor; public function init() { super.init(); setAutoresizesSubviews(true); m_copiesOnScroll = true; m_drawsBackground = true; return this; } // Setting the document view public function setDocumentView(view:NSView) { var nc:NSNotificationCenter; if (view == m_documentView) { return; } nc = NSNotificationCenter.defaultCenter(); if (m_documentView) { nc.removeObserverNameObject(this, null, m_documentView); m_documentView.removeFromSuperview(); } m_documentView = view; if (m_documentView != null) { var documentFrame:NSRect; addSubview(m_documentView); documentFrame = m_documentView.frame(); setBoundsOrigin(documentFrame.origin); if (typeof(m_documentView["backgroundColor"])=="function") { m_backgroundColor = m_documentView["backgroundColor"].call(m_documentView); } if (typeof(m_documentView["drawsBackground"])=="function") { m_drawsBackground = m_documentView["drawsBackground"].call(m_documentView); } m_documentView.setPostsFrameChangedNotifications(true); m_documentView.setPostsBoundsChangedNotifications(true); nc.addObserverSelectorNameObject(this, "viewFrameChanged", NSView.NSViewFrameDidChangeNotification, m_documentView); nc.addObserverSelectorNameObject(this, "viewBoundsChanged", NSView.NSViewBoundsDidChangeNotification, m_documentView); } NSScrollView(superview()).reflectScrolledClipView(this); } public function documentView():NSView { return m_documentView; } // Scrolling public function scrollToPoint(point:NSPoint) { setBoundsOrigin(constrainScrollPoint(point)); } public function constrainScrollPoint(point:NSPoint):NSPoint { var newPoint:NSPoint = point.clone(); if (m_documentView == null) { return null; } var documentFrame:NSRect = m_documentView.frame(); if (documentFrame.size.width <= m_bounds.size.width) { newPoint.x = documentFrame.origin.x; } else if (point.x <= documentFrame.origin.x) { newPoint.x = documentFrame.origin.x; } else if (point.x + m_bounds.size.width >= documentFrame.maxX()) { newPoint.x = documentFrame.maxX() - m_bounds.size.width; } if (documentFrame.size.height <= m_bounds.size.height) { newPoint.y = documentFrame.origin.y; } else if (point.y <= documentFrame.origin.y) { newPoint.y = documentFrame.origin.y; } else if (point.y + m_bounds.size.height >= documentFrame.maxY) { newPoint.y = documentFrame.maxY() - m_bounds.size.height; } return newPoint; } //Determining scrolling efficiency public function setCopiesOnScroll(value:Boolean) { m_copiesOnScroll = value; } public function copiesOnScroll():Boolean { return m_copiesOnScroll; } //Getting the visible portion public function documentRect():NSRect { if (m_documentView == null) { return m_bounds; } var documentFrame:NSRect = m_documentView.frame(); return new NSRect(documentFrame.origin.x, documentFrame.origin.y, Math.max(documentFrame.size.width, m_bounds.size.width), Math.max(documentFrame.size.height, m_bounds.size.height)); } public function documentVisibleRect():NSRect { if (m_documentView == null) { return NSRect.ZeroRect; } return m_documentView.bounds().intersectionRect(convertRectToView(m_bounds, m_documentView)); } // notification callbacks public function viewBoundsChanged(notification:NSNotification) { NSScrollView(superview()).reflectScrolledClipView(this); } public function viewFrameChanged(notification:NSNotification) { setBoundsOrigin(constrainScrollPoint(m_bounds.origin)); if (!m_documentView.frame().containsRect(m_bounds)) { setNeedsDisplay(); } NSScrollView(superview()).reflectScrolledClipView(this); } // Working with background color public function drawsBackground():Boolean { return m_drawsBackground; } public function setDrawsBackground(value:Boolean) { if (m_drawsBackground != value) { m_drawsBackground = value; setNeedsDisplay(true); } } public function setBackgroundColor(color:NSColor) { m_backgroundColor = color; setNeedsDisplay(true); } public function backgroundColor():NSColor { return m_backgroundColor; } // Overridden functions public function setBoundsOrigin(point:NSPoint) { if (point.equalTo(m_bounds.origin) || m_documentView == null) { return; } super.setBoundsOrigin(point); m_documentView.setNeedsDisplay(true); NSScrollView(m_superview).reflectScrolledClipView(this); } public function scaleUnitSquareToSize(size:NSSize) { super.scaleUnitSquareToSize(size); NSScrollView(m_superview).reflectScrolledClipView(this); } public function setBoundsSize(size:NSSize) { super.setBoundsSize(size); NSScrollView(m_superview).reflectScrolledClipView(this); } public function setFrameSize(size:NSSize) { super.setFrameSize(size); setBoundsOrigin(constrainScrollPoint(m_bounds.origin)); NSScrollView(m_superview).reflectScrolledClipView(this); } public function setFrameOrigin(origin:NSPoint) { super.setFrameOrigin(origin); setBoundsOrigin(constrainScrollPoint(m_bounds.origin)); NSScrollView(m_superview).reflectScrolledClipView(this); } public function setFrame(rect:NSRect) { super.setFrame(rect); setBoundsOrigin(constrainScrollPoint(m_bounds.origin)); NSScrollView(m_superview).reflectScrolledClipView(this); } public function translateOriginToPoint(point:NSPoint) { super.translateOriginToPoint(point); NSScrollView(m_superview).reflectScrolledClipView(this); } public function rotateByAngle(angle:Number) { // IGNORE } public function setBoundsRotation(angle:Number) { // IGNORE } public function setFrameRotation(angle:Number) { // IGNORE } public function acceptsFirstResponder():Boolean { if (m_documentView == null) { return false; } else { return m_documentView.acceptsFirstResponder(); } } public function becomeFirstResponder():Boolean { if (m_documentView == null) { return false; } else { return m_window.makeFirstResponder(m_documentView); } } public function drawRect(rect:NSRect) { m_mcBounds.clear(); if (m_drawsBackground) { ASDraw.solidRectWithRect(m_mcBounds, rect, m_backgroundColor.value); } } } |
From: Richard K. <ric...@us...> - 2005-05-24 20:30:40
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12433 Modified Files: NSView.as Log Message: fixed typos (changed vs change) and added scaleUnitSquareToSize Index: NSView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSView.as,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NSView.as 17 May 2005 03:49:49 -0000 1.7 --- NSView.as 24 May 2005 20:30:30 -0000 1.8 *************** *** 62,70 **** private var m_frame:NSRect; private var m_frameRotation:Number; ! private var m_postsFrameChangeNotifications:Boolean; private var m_bounds:NSRect; private var m_boundsRotation:Number; ! private var m_postsBoundsChangeNotifications:Boolean; private var m_window:NSWindow; --- 62,70 ---- private var m_frame:NSRect; private var m_frameRotation:Number; ! private var m_postsFrameChangedNotifications:Boolean; private var m_bounds:NSRect; private var m_boundsRotation:Number; ! private var m_postsBoundsChangedNotifications:Boolean; private var m_window:NSWindow; *************** *** 89,97 **** m_frame = null; m_frameRotation = 0; ! m_postsFrameChangeNotifications = false; m_bounds = null; m_boundsRotation = 0; ! m_postsBoundsChangeNotifications = false; m_window = null; --- 89,97 ---- m_frame = null; m_frameRotation = 0; ! m_postsFrameChangedNotifications = false; m_bounds = null; m_boundsRotation = 0; ! m_postsBoundsChangedNotifications = false; m_window = null; *************** *** 481,485 **** m_bounds.size = m_frame.size.clone(); updateFrameMovieClipSize(); ! if(m_postsFrameChangeNotifications) { m_notificationCenter.postNotificationWithNameObject(NSViewFrameDidChangeNotification, this); } --- 481,485 ---- m_bounds.size = m_frame.size.clone(); updateFrameMovieClipSize(); ! if(m_postsFrameChangedNotifications) { m_notificationCenter.postNotificationWithNameObject(NSViewFrameDidChangeNotification, this); } *************** *** 497,501 **** m_mcFrame._y = m_frame.origin.y; } ! if(m_postsFrameChangeNotifications) { m_notificationCenter.postNotificationWithNameObject(NSViewFrameDidChangeNotification, this); } --- 497,501 ---- m_mcFrame._y = m_frame.origin.y; } ! if(m_postsFrameChangedNotifications) { m_notificationCenter.postNotificationWithNameObject(NSViewFrameDidChangeNotification, this); } *************** *** 506,510 **** m_bounds.size = size.clone(); updateFrameMovieClipSize(); ! if(m_postsFrameChangeNotifications) { m_notificationCenter.postNotificationWithNameObject(NSViewFrameDidChangeNotification, this); } --- 506,510 ---- m_bounds.size = size.clone(); updateFrameMovieClipSize(); ! if(m_postsFrameChangedNotifications) { m_notificationCenter.postNotificationWithNameObject(NSViewFrameDidChangeNotification, this); } *************** *** 514,518 **** m_frameRotation = angle; updateFrameMovieClipPerspective(); ! if(m_postsFrameChangeNotifications) { m_notificationCenter.postNotificationWithNameObject(NSViewFrameDidChangeNotification, this); } --- 514,518 ---- m_frameRotation = angle; updateFrameMovieClipPerspective(); ! if(m_postsFrameChangedNotifications) { m_notificationCenter.postNotificationWithNameObject(NSViewFrameDidChangeNotification, this); } *************** *** 528,532 **** m_bounds = bounds.clone(); updateBoundsMovieClip(); ! if(m_postsBoundsChangeNotifications) { m_notificationCenter.postNotificationWithNameObject(NSViewBoundsDidChangeNotification, this); } --- 528,532 ---- m_bounds = bounds.clone(); updateBoundsMovieClip(); ! if(m_postsBoundsChangedNotifications) { m_notificationCenter.postNotificationWithNameObject(NSViewBoundsDidChangeNotification, this); } *************** *** 540,544 **** m_bounds.origin = origin.clone(); updateBoundsMovieClip(); ! if(m_postsBoundsChangeNotifications) { m_notificationCenter.postNotificationWithNameObject(NSViewBoundsDidChangeNotification, this); } --- 540,544 ---- m_bounds.origin = origin.clone(); updateBoundsMovieClip(); ! if(m_postsBoundsChangedNotifications) { m_notificationCenter.postNotificationWithNameObject(NSViewBoundsDidChangeNotification, this); } *************** *** 548,552 **** m_bounds.size = size.clone(); updateBoundsMovieClip(); ! if(m_postsBoundsChangeNotifications) { m_notificationCenter.postNotificationWithNameObject(NSViewBoundsDidChangeNotification, this); } --- 548,552 ---- m_bounds.size = size.clone(); updateBoundsMovieClip(); ! if(m_postsBoundsChangedNotifications) { m_notificationCenter.postNotificationWithNameObject(NSViewBoundsDidChangeNotification, this); } *************** *** 556,560 **** m_boundsRotation = angle; updateBoundsMovieClip(); ! if(m_postsBoundsChangeNotifications) { m_notificationCenter.postNotificationWithNameObject(NSViewBoundsDidChangeNotification, this); } --- 556,560 ---- m_boundsRotation = angle; updateBoundsMovieClip(); ! if(m_postsBoundsChangedNotifications) { m_notificationCenter.postNotificationWithNameObject(NSViewBoundsDidChangeNotification, this); } *************** *** 565,568 **** --- 565,584 ---- } + public function scaleUnitSquareToSize(size:NSSize) { + size = size.clone(); + if (size.width < 0) { + size.width = 0; + } + if (size.height < 0) { + size.height = 0; + } + m_bounds.size.width = m_bounds.size.width / size.width; + m_bounds.size.height = m_bounds.size.height / size.height; + updateBoundsMovieClip(); + if(m_postsBoundsChangedNotifications) { + m_notificationCenter.postNotificationWithNameObject(NSViewBoundsDidChangeNotification, this); + } + } + //****************************************************** //* Modifying the coordinate system *************** *** 695,712 **** //****************************************************** ! public function setPostsFrameChangeNotifications(value:Boolean) { ! m_postsFrameChangeNotifications = value; } ! public function postsFrameChangeNotifications():Boolean { ! return m_postsFrameChangeNotifications; } ! public function setPostsBoundsChangeNotifications(value:Boolean) { ! m_postsBoundsChangeNotifications = value; } ! public function postsBoundsChangeNotifications():Boolean { ! return m_postsBoundsChangeNotifications; } --- 711,728 ---- //****************************************************** ! public function setPostsFrameChangedNotifications(value:Boolean) { ! m_postsFrameChangedNotifications = value; } ! public function postsFrameChangedNotifications():Boolean { ! return m_postsFrameChangedNotifications; } ! public function setPostsBoundsChangedNotifications(value:Boolean) { ! m_postsBoundsChangedNotifications = value; } ! public function postsBoundsChangedNotifications():Boolean { ! return m_postsBoundsChangedNotifications; } |
From: Richard K. <ric...@us...> - 2005-05-24 20:29:34
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12033 Modified Files: NSPoint.as NSRect.as Log Message: added equalTo and intersectionRect Index: NSRect.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSRect.as,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** NSRect.as 23 May 2005 11:10:12 -0000 1.6 --- NSRect.as 24 May 2005 20:29:25 -0000 1.7 *************** *** 107,110 **** --- 107,119 ---- return (size.width == 0) && (size.height == 0); } + + public function intersectionRect(rect:NSRect):NSRect { + var result:NSRect = new NSRect(0,0,0,0); + result.origin.x = Math.max(minX(), rect.minX()); + result.origin.y = Math.max(minY(), rect.minY()); + result.size.width = Math.min(maxX(), rect.maxX()) - result.minX(); + result.size.height = Math.min(maxY(), rect.maxY()) - result.minY(); + return (result.isEmptyRect() ? ZeroRect : result); + } public function pointInRect(point:NSPoint):Boolean { *************** *** 117,119 **** --- 126,135 ---- } + public function containsRect(rect:NSRect):Boolean { + return minX()<rect.minX() && + minY()<rect.minY() && + maxX()>rect.maxX() && + maxY()>rect.maxY(); + } + } \ No newline at end of file Index: NSPoint.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSPoint.as,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NSPoint.as 16 May 2005 22:57:08 -0000 1.2 --- NSPoint.as 24 May 2005 20:29:25 -0000 1.3 *************** *** 45,48 **** --- 45,52 ---- public var y:Number; + public function equalTo(other:NSPoint):Boolean { + return x == other.x && y == other.y; + } + /** * Creates a new instance of NSPoint with the specified x and y |
From: Richard K. <ric...@us...> - 2005-05-23 21:25:59
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26793 Modified Files: ASTheme.as Log Message: added ridges to scroller theme Index: ASTheme.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASTheme.as,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ASTheme.as 23 May 2005 18:27:40 -0000 1.9 --- ASTheme.as 23 May 2005 21:25:49 -0000 1.10 *************** *** 265,268 **** --- 265,299 ---- ASDraw.solidRectWithRect( mc, rect, 0xCACDD2); ASDraw.outlineRectWithRect( mc, rect, drawScroller_outlineColors); + if (rect.size.width > rect.size.height) { + var x1 = rect.origin.x + rect.size.width/2; + var x2 = x1 + 10; + x1 -= 10; + var y1 = rect.origin.y + 3; + var y2 = rect.origin.y + rect.size.height - 4; + while (x1 < x2) { + mc.lineStyle(1, 0xDEE1E6, 50); + mc.moveTo(x1, y1); + mc.lineTo(x1, y2); + mc.lineStyle(1, 0x4B4F57, 50); + mc.moveTo(x1+1, y2); + mc.lineTo(x1+1, y1); + x1+=2; + } + } else { + var y1 = rect.origin.y + rect.size.height/2; + var y2 = y1 + 10; + y1 -= 10; + var x1 = rect.origin.x + 3; + var x2 = rect.origin.x + rect.size.width - 4; + while (y1 < y2) { + mc.lineStyle(1, 0xDEE1E6, 50); + mc.moveTo(x1, y1); + mc.lineTo(x2, y1); + mc.lineStyle(1, 0x4B4F57, 50); + mc.moveTo(x2, y1+1); + mc.lineTo(x1, y1+1); + y1+=2; + } + } } |
From: Richard K. <ric...@us...> - 2005-05-23 18:31:21
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17385 Modified Files: NSScroller.as Log Message: adjusted the size a bit Index: NSScroller.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSScroller.as,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** NSScroller.as 23 May 2005 18:27:40 -0000 1.6 --- NSScroller.as 23 May 2005 18:31:08 -0000 1.7 *************** *** 239,243 **** x = y = width = height = 0; ! var buttonsSize = 2*BUTTON_WIDTH+2; var usableParts:NSUsableScrollerParts; --- 239,243 ---- x = y = width = height = 0; ! var buttonsSize = 2*BUTTON_WIDTH; var usableParts:NSUsableScrollerParts; |
From: Richard K. <ric...@us...> - 2005-05-23 18:27:54
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16387 Modified Files: ASTheme.as ASThemeProtocol.as NSControl.as NSScroller.as Log Message: scroller works! Index: ASThemeProtocol.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASThemeProtocol.as,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ASThemeProtocol.as 20 May 2005 20:36:21 -0000 1.7 --- ASThemeProtocol.as 23 May 2005 18:27:40 -0000 1.8 *************** *** 77,83 **** /** ! * Draws an NSTextFieldCell with the supplied colorset ("defaultTextfield") in the view. */ public function drawTextFieldWithRectInView(rect:NSRect, view:NSView); /** --- 77,93 ---- /** ! * Draws an NSTextFieldCell in the view. */ public function drawTextFieldWithRectInView(rect:NSRect, view:NSView); + + /** + * Draws an NSScroller slot in the view. + */ + public function drawScrollerSlotWithRectInView(rect:NSRect, view:NSView); + + /** + * Draws an NSScroller slot in the view. + */ + public function drawScrollerWithRectInClip(rect:NSRect, clip:MovieClip); /** Index: NSControl.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSControl.as,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** NSControl.as 23 May 2005 11:10:12 -0000 1.10 --- NSControl.as 23 May 2005 18:27:40 -0000 1.11 *************** *** 469,473 **** return; } ! if(event.view == this) { m_cell.setHighlighted(true); setNeedsDisplay(true); --- 469,473 ---- return; } ! if(event.view == this && cellTrackingRect().pointInRect(convertPointFromView(event.mouseLocation, null))) { m_cell.setHighlighted(true); setNeedsDisplay(true); Index: NSScroller.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSScroller.as,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** NSScroller.as 23 May 2005 11:38:38 -0000 1.5 --- NSScroller.as 23 May 2005 18:27:40 -0000 1.6 *************** *** 29,33 **** */ ! import org.actionstep.ASDraw; import org.actionstep.NSControl; --- 29,33 ---- */ ! import org.actionstep.ASTheme; import org.actionstep.NSControl; *************** *** 39,42 **** --- 39,43 ---- import org.actionstep.NSEvent; import org.actionstep.NSButtonCell; + import org.actionstep.NSApplication; import org.actionstep.constants.NSScrollerPart; *************** *** 491,495 **** case NSScrollerPart.NSScrollerKnob: trackKnob(event); ! break; case NSScrollerPart.NSScrollerKnobSlot: var floatValue = floatValueAtPoint(convertPointFromView(location, null)); --- 492,496 ---- case NSScrollerPart.NSScrollerKnob: trackKnob(event); ! return; case NSScrollerPart.NSScrollerKnobSlot: var floatValue = floatValueAtPoint(convertPointFromView(location, null)); *************** *** 512,519 **** private function trackKnob(event:NSEvent) { } public function drawRect(rect:NSRect) { ! ASDraw.outlineRectWithRect(m_mcBounds, rect, [0x696E79,0xF6F8F9]); var rectIncrementLine:NSRect = rectForPart(NSScrollerPart.NSScrollerIncrementLine); var rectDecrementLine:NSRect = rectForPart(NSScrollerPart.NSScrollerDecrementLine); --- 513,547 ---- private function trackKnob(event:NSEvent) { + // This is necessary because of the async requirements of Flash + var rectKnob:NSRect = rectForPart(NSScrollerPart.NSScrollerKnob); + var point:NSPoint = convertPointFromView(event.mouseLocation, null); + m_trackingData = { + offsetY: point.y - rectKnob.origin.y, + offsetX: point.x - rectKnob.origin.x, + mouseDown: true, + eventMask: NSEvent.NSLeftMouseDownMask | NSEvent.NSLeftMouseUpMask | NSEvent.NSLeftMouseDraggedMask + | NSEvent.NSMouseMovedMask | NSEvent.NSOtherMouseDraggedMask | NSEvent.NSRightMouseDraggedMask, + complete: false, + }; + knobTrackingCallback(event); + } + + public function knobTrackingCallback(event:NSEvent) { + if (event.type == NSEvent.NSLeftMouseUp) { + return; + } + var point:NSPoint = convertPointFromView(event.mouseLocation, null); + if (m_horizontal) { + point.x -= m_trackingData.offsetX; + } else { + point.y -= m_trackingData.offsetY; + } + setFloatValue(floatValueAtPoint(point)); + sendActionTo(m_action, m_target); + NSApplication.sharedApplication().callObjectSelectorWithNextEventMatchingMaskDequeue(this, "knobTrackingCallback", m_trackingData.eventMask, true); } public function drawRect(rect:NSRect) { ! ASTheme.current().drawScrollerSlotWithRectInView(rect, this); var rectIncrementLine:NSRect = rectForPart(NSScrollerPart.NSScrollerIncrementLine); var rectDecrementLine:NSRect = rectForPart(NSScrollerPart.NSScrollerDecrementLine); *************** *** 524,529 **** private function drawKnob() { ! if (m_scrollerKnobClip == null) { m_scrollerKnobClip = createSubviewMovieClip(); } var rectKnob:NSRect = rectForPart(NSScrollerPart.NSScrollerKnob); --- 552,558 ---- private function drawKnob() { ! if (m_scrollerKnobClip == null || m_scrollerKnobClip._parent == undefined) { m_scrollerKnobClip = createSubviewMovieClip(); + m_scrollerKnobClip.view = this; } var rectKnob:NSRect = rectForPart(NSScrollerPart.NSScrollerKnob); *************** *** 539,545 **** m_scrollerKnobClipRect.size.width = rectKnob.size.width; m_scrollerKnobClipRect.size.width = rectKnob.size.height; ! ASDraw.outlineRectWithRect(m_scrollerKnobClip, ! new NSRect(0,0,rectKnob.size.width, rectKnob.size.height), ! [0xF6F8F9, 0x696E79]); } } --- 568,573 ---- m_scrollerKnobClipRect.size.width = rectKnob.size.width; m_scrollerKnobClipRect.size.width = rectKnob.size.height; ! m_scrollerKnobClip.clear(); ! ASTheme.current().drawScrollerWithRectInClip(new NSRect(0,0,rectKnob.size.width, rectKnob.size.height), m_scrollerKnobClip); } } *************** *** 562,573 **** private function setButtonCellTargets() { ! g_upCell.setTarget(m_target); ! g_upCell.setAction(m_action); ! g_downCell.setTarget(m_target); ! g_downCell.setAction(m_action); ! g_leftCell.setTarget(m_target); ! g_leftCell.setAction(m_action); ! g_rightCell.setTarget(m_target); ! g_rightCell.setAction(m_action); } --- 590,604 ---- private function setButtonCellTargets() { ! if (m_horizontal) { ! g_leftCell.setTarget(m_target); ! g_leftCell.setAction(m_action); ! g_rightCell.setTarget(m_target); ! g_rightCell.setAction(m_action); ! } else { ! g_upCell.setTarget(m_target); ! g_upCell.setAction(m_action); ! g_downCell.setTarget(m_target); ! g_downCell.setAction(m_action); ! } } *************** *** 580,589 **** if (m_horizontal) { ! min_pos = slotRect.minX() + knobRect.size.width/2 ! min_pos = slotRect.maxX() + knobRect.size.width/2 position = point.x; } else { ! min_pos = slotRect.minY() + knobRect.size.height/2 ! min_pos = slotRect.maxY() + knobRect.size.height/2 position = point.y; } --- 611,620 ---- if (m_horizontal) { ! min_pos = slotRect.minX(); ! max_pos = slotRect.maxX() - knobRect.size.width; position = point.x; } else { ! min_pos = slotRect.minY(); ! max_pos = slotRect.maxY() - knobRect.size.height; position = point.y; } Index: ASTheme.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASTheme.as,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ASTheme.as 20 May 2005 20:36:21 -0000 1.8 --- ASTheme.as 23 May 2005 18:27:40 -0000 1.9 *************** *** 112,115 **** --- 112,123 ---- } + public function drawScrollerSlotWithRectInView(rect:NSRect, view:NSView) { + drawScrollerSlot(view.mcBounds(), rect); + } + + public function drawScrollerWithRectInClip(rect:NSRect, clip:MovieClip) { + drawScroller(clip, rect); + } + public function registerDefaultImages() { setImage("NSRadioButton", org.actionstep.images.ASRadioButtonRep); *************** *** 221,225 **** { var insetRect:NSRect = rect.insetRect(1,1); ! ASDraw.gradientRectWithRect( mc, rect, ANGLE_TOP_TO_BOTTOM, drawTextfield_colors, drawTextfield_ratios); ASDraw.gradientRectWithAlphaRect(mc, new NSRect(rect.origin.x, rect.origin.y, 5, rect.size.height), 30, drawTextfieldShadow_colors, drawTextfieldShadow_ratios, drawTextfieldShadow_alphas); --- 229,236 ---- { var insetRect:NSRect = rect.insetRect(1,1); ! ASDraw.solidRectWithRect( mc, rect, 0xCACDD2); ! //ASDraw.gradientRectWithRect( mc, rect, ANGLE_TOP_TO_BOTTOM, drawTextfield_colors, drawTextfield_ratios); ! ASDraw.gradientRectWithRect( mc, new NSRect(rect.origin.x, rect.origin.y, rect.size.width, 25), ANGLE_TOP_TO_BOTTOM, ! drawTextfield_colors, drawTextfield_ratios); ASDraw.gradientRectWithAlphaRect(mc, new NSRect(rect.origin.x, rect.origin.y, 5, rect.size.height), 30, drawTextfieldShadow_colors, drawTextfieldShadow_ratios, drawTextfieldShadow_alphas); *************** *** 229,232 **** --- 240,275 ---- /////////////////////////////// + /////////////////////////////// + // SCROLLER DRAW FUNCTIONS + private static var drawScrollerSlot_outlineColors:Array = [0x4B4F57, 0xDEE1E6]; + private static var drawScrollerSlot_colors:Array = [0x80848F, 0xAFB4BA, 0xCACDD2]; + private static var drawScrollerSlot_ratios:Array = [ 0, 6, 24]; + private static var drawScrollerSlotShadow_colors:Array = [0x767A85, 0xB6BBC1]; + private static var drawScrollerSlotShadow_alphas:Array = [ 100, 0]; + private static var drawScrollerSlotShadow_ratios:Array = [ 0, 5]; + private function drawScrollerSlot(mc:MovieClip, rect:NSRect) + { + var insetRect:NSRect = rect.insetRect(1,1); + ASDraw.solidRectWithRect( mc, rect, 0xCACDD2); + //ASDraw.gradientRectWithRect( mc, rect, ANGLE_TOP_TO_BOTTOM, drawTextfield_colors, drawTextfield_ratios); + ASDraw.gradientRectWithAlphaRect(mc, new NSRect(rect.origin.x, rect.origin.y, rect.size.width, 5), ANGLE_TOP_TO_BOTTOM, + drawScrollerSlotShadow_colors, drawScrollerSlotShadow_ratios, drawScrollerSlotShadow_alphas); + ASDraw.gradientRectWithAlphaRect(mc, new NSRect(rect.origin.x, rect.origin.y, 5, rect.size.height), 30, + drawScrollerSlotShadow_colors, drawScrollerSlotShadow_ratios, drawScrollerSlotShadow_alphas); + ASDraw.outlineRectWithRect( mc, rect, drawScrollerSlot_outlineColors); + } + + private static var drawScroller_outlineColors:Array = [0xDEE1E6, 0x4B4F57]; + private function drawScroller(mc:MovieClip, rect:NSRect) + { + ASDraw.solidRectWithRect( mc, rect, 0xCACDD2); + ASDraw.outlineRectWithRect( mc, rect, drawScroller_outlineColors); + } + + // END TEXTFIELD DRAW FUNCTIONS + /////////////////////////////// + + + //****************************************************** //* Public Static Properties * |
From: Richard K. <ric...@us...> - 2005-05-23 11:38:50
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21455/test Modified Files: ASTestScrollers.as Log Message: scroll buttons working Index: ASTestScrollers.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/test/ASTestScrollers.as,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ASTestScrollers.as 23 May 2005 11:10:13 -0000 1.2 --- ASTestScrollers.as 23 May 2005 11:38:39 -0000 1.3 *************** *** 31,34 **** --- 31,35 ---- import org.actionstep.*; import org.actionstep.test.*; + import org.actionstep.constants.*; class org.actionstep.test.ASTestScrollers { *************** *** 37,44 **** var testObject = new Object(); testObject.vscroller = function(scroller) { ! TRACE("VScroller"); } testObject.hscroller = function(scroller) { ! TRACE("HScroller"); } --- 38,63 ---- var testObject = new Object(); testObject.vscroller = function(scroller) { ! switch(scroller.hitPart()) { ! case NSScrollerPart.NSScrollerIncrementPage: ! case NSScrollerPart.NSScrollerIncrementLine: ! scroller.setFloatValue(scroller.floatValue() + .02) ! break; ! case NSScrollerPart.NSScrollerDecrementPage: ! case NSScrollerPart.NSScrollerDecrementLine: ! scroller.setFloatValue(scroller.floatValue() - .02) ! break; ! } } testObject.hscroller = function(scroller) { ! switch(scroller.hitPart()) { ! case NSScrollerPart.NSScrollerIncrementPage: ! case NSScrollerPart.NSScrollerIncrementLine: ! scroller.setFloatValue(scroller.floatValue() + .02) ! break; ! case NSScrollerPart.NSScrollerDecrementPage: ! case NSScrollerPart.NSScrollerDecrementLine: ! scroller.setFloatValue(scroller.floatValue() - .02) ! break; ! } } |
From: Richard K. <ric...@us...> - 2005-05-23 11:38:49
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21455 Modified Files: NSScroller.as Log Message: scroll buttons working Index: NSScroller.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSScroller.as,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NSScroller.as 23 May 2005 11:10:12 -0000 1.4 --- NSScroller.as 23 May 2005 11:38:38 -0000 1.5 *************** *** 75,78 **** --- 75,80 ---- public function NSScroller() { m_enabled = true; + m_pendingKnobProportion = 0; + m_scrollerKnobClipRect = NSRect.ZeroRect; } *************** *** 186,196 **** } if (value < 0) { ! m_floatValue = 0; } if (value > 1) { ! m_floatValue = 1; } m_floatValue = value; ! setNeedsDisplay(true); } --- 188,198 ---- } if (value < 0) { ! value = 0; } if (value > 1) { ! value = 1; } m_floatValue = value; ! drawKnob(); } *************** *** 221,224 **** --- 223,230 ---- } + public function floatValue():Number { + return m_floatValue; + } + public function knobProportion():Number { return m_knobProportion; *************** *** 475,478 **** --- 481,485 ---- super.mouseDown(event); return; + break; case NSScrollerPart.NSScrollerDecrementPage: case NSScrollerPart.NSScrollerDecrementLine: *************** *** 481,487 **** super.mouseDown(event); return; case NSScrollerPart.NSScrollerKnob: trackKnob(event); ! break case NSScrollerPart.NSScrollerKnobSlot: var floatValue = floatValueAtPoint(convertPointFromView(location, null)); --- 488,495 ---- super.mouseDown(event); return; + break; case NSScrollerPart.NSScrollerKnob: trackKnob(event); ! break; case NSScrollerPart.NSScrollerKnobSlot: var floatValue = floatValueAtPoint(convertPointFromView(location, null)); *************** *** 507,529 **** public function drawRect(rect:NSRect) { if (m_scrollerKnobClip == null) { m_scrollerKnobClip = createSubviewMovieClip(); } var rectKnob:NSRect = rectForPart(NSScrollerPart.NSScrollerKnob); ! if (m_scrollerKnobClipRect == null || !m_scrollerKnobClipRect.equalTo(rectKnob)) { ! m_scrollerKnobClipRect = rectKnob; m_scrollerKnobClip._x = rectKnob.origin.x; m_scrollerKnobClip._y = rectKnob.origin.y; ASDraw.outlineRectWithRect(m_scrollerKnobClip, new NSRect(0,0,rectKnob.size.width, rectKnob.size.height), [0xF6F8F9, 0x696E79]); - m_scrollerKnobClipRect = rectKnob; } - - ASDraw.outlineRectWithRect(m_mcBounds, rect, [0x696E79,0xF6F8F9]); - var rectIncrementLine:NSRect = rectForPart(NSScrollerPart.NSScrollerIncrementLine); - var rectDecrementLine:NSRect = rectForPart(NSScrollerPart.NSScrollerDecrementLine); - (m_horizontal ? g_leftCell : g_upCell).drawWithFrameInView(rectDecrementLine, this); - (m_horizontal ? g_rightCell : g_downCell).drawWithFrameInView(rectIncrementLine, this); } --- 515,546 ---- public function drawRect(rect:NSRect) { + ASDraw.outlineRectWithRect(m_mcBounds, rect, [0x696E79,0xF6F8F9]); + var rectIncrementLine:NSRect = rectForPart(NSScrollerPart.NSScrollerIncrementLine); + var rectDecrementLine:NSRect = rectForPart(NSScrollerPart.NSScrollerDecrementLine); + (m_horizontal ? g_leftCell : g_upCell).drawWithFrameInView(rectDecrementLine, this); + (m_horizontal ? g_rightCell : g_downCell).drawWithFrameInView(rectIncrementLine, this); + drawKnob(); + } + + private function drawKnob() { if (m_scrollerKnobClip == null) { m_scrollerKnobClip = createSubviewMovieClip(); } var rectKnob:NSRect = rectForPart(NSScrollerPart.NSScrollerKnob); ! if (m_scrollerKnobClipRect.origin.x != rectKnob.origin.x || ! m_scrollerKnobClipRect.origin.y != rectKnob.origin.y) { m_scrollerKnobClip._x = rectKnob.origin.x; m_scrollerKnobClip._y = rectKnob.origin.y; + m_scrollerKnobClipRect.origin.x = rectKnob.origin.x; + m_scrollerKnobClipRect.origin.y = rectKnob.origin.y; + } + if (m_scrollerKnobClipRect.size.width != rectKnob.size.width || + m_scrollerKnobClipRect.size.width != rectKnob.size.height) { + m_scrollerKnobClipRect.size.width = rectKnob.size.width; + m_scrollerKnobClipRect.size.width = rectKnob.size.height; ASDraw.outlineRectWithRect(m_scrollerKnobClip, new NSRect(0,0,rectKnob.size.width, rectKnob.size.height), [0xF6F8F9, 0x696E79]); } } |