From: Scott H. <sco...@us...> - 2005-05-30 12:23:59
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17198/src/org/actionstep Modified Files: NSMatrix.as Log Message: Removed all stopwatch code Index: NSMatrix.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSMatrix.as,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** NSMatrix.as 29 May 2005 23:11:08 -0000 1.12 --- NSMatrix.as 30 May 2005 12:23:48 -0000 1.13 *************** *** 48,52 **** //! TEST CODE ! import org.as2lib.util.StopWatch; //************************************************************************** --- 48,52 ---- //! TEST CODE ! //import org.as2lib.util.StopWatch; //************************************************************************** *************** *** 102,106 **** //! TEST CODE ! private var watch:StopWatch; /** --- 102,106 ---- //! TEST CODE ! //private var watch:StopWatch; /** *************** *** 137,141 **** m_autoscroll = false; m_isselbyrect = false; ! watch = new StopWatch(); } --- 137,141 ---- m_autoscroll = false; m_isselbyrect = false; ! //watch = new StopWatch(); } *************** *** 1410,1414 **** public function getRowColumnForPoint(aPoint:NSPoint):Object { ! aPoint = convertPointFromView(theEvent.mouseLocation, null); var colWidth:Number = m_cellsize.width + m_cellspacing.width; var rowHeight:Number = m_cellsize.height + m_cellspacing.height; --- 1410,1414 ---- public function getRowColumnForPoint(aPoint:NSPoint):Object { ! aPoint = convertPointFromView(aPoint, null); var colWidth:Number = m_cellsize.width + m_cellspacing.width; var rowHeight:Number = m_cellsize.height + m_cellspacing.height; *************** *** 1452,1462 **** */ public function getRowColumnOfCell(aCell:NSCell):Object ! { ! var flat:NSArray = cells(); ! var len:Number = flat.count(); ! // // Cycle through until we make a match // for (var i:Number = 0; i < len; i++) { --- 1452,1461 ---- */ public function getRowColumnOfCell(aCell:NSCell):Object ! { // // Cycle through until we make a match // + var len:Number = m_cells.count(); + for (var i:Number = 0; i < len; i++) { *************** *** 1464,1470 **** // If match, calculate row and column from index, and return. // ! if (flat.objectAtIndex(i) == aCell) { ! return {row: Math.floor(i / m_numcols), column: i % m_numcols}; } } --- 1463,1469 ---- // If match, calculate row and column from index, and return. // ! if (m_cells.objectAtIndex(i) == aCell) { ! return rowColumnFromIndex(i); } } *************** *** 1656,1660 **** public function selectText(sender:Object):Void //! What is sender? { ! //! implement } --- 1655,1659 ---- public function selectText(sender:Object):Void //! What is sender? { ! selectTextWithCell(selectedCell()); } *************** *** 1672,1689 **** var cell:NSCell = cellAtRowColumn(row, column); ! if (cell == null) // You can only select a cell that exists ! return null; ! ! // ! // Cell must be editable and selectable. ! // ! if (!cell.isEditable() && !cell.isSelectable()) return null; - - //! select text return cell; } ! /** --- 1671,1680 ---- var cell:NSCell = cellAtRowColumn(row, column); ! if (!selectTextWithCell(cell)) return null; return cell; } ! /** *************** *** 1772,1776 **** // Get the location of the cell, then the cell itself (if available). // ! var loc:Object = getRowColumnForPoint(pt); if (loc != null) --- 1763,1767 ---- // Get the location of the cell, then the cell itself (if available). // ! var loc:Object = getRowColumnForPoint(theEvent.mouseLocation); if (loc != null) *************** *** 1950,1954 **** //! TESTING CODE ! watch.start(); // --- 1941,1945 ---- //! TESTING CODE ! //watch.start(); // *************** *** 1964,1970 **** //! TESTING CODE ! watch.stop(); TRACE("cell draw time: " + watch.getTimeInMilliSeconds()); ! watch.reset(); } --- 1955,1961 ---- //! TESTING CODE ! //watch.stop(); TRACE("cell draw time: " + watch.getTimeInMilliSeconds()); ! //watch.reset(); } *************** *** 2255,2259 **** /** ! * Makes a cell based on the prototype instance or the cell class. */ private function makeCell():NSCell --- 2246,2251 ---- /** ! * Makes a cell based on the prototype instance or the cell class, ! * depending on teh value of m_usingcellinstance. */ private function makeCell():NSCell *************** *** 2302,2305 **** --- 2294,2320 ---- } + + /** + * Selects the text in the cell aCell if the cell is editable + * and selectable. + * + * Returns true if text is successfully selected, and false otherwise. + */ + private function selectTextWithCell(aCell:NSCell):Boolean + { + if (aCell == null) // You can only select a cell that exists + return false; + + // + // Cell must be editable and selectable. + // + if (!aCell.isEditable() && !aCell.isSelectable()) + return false; + + //! select text + + return true; + } + //****************************************************** //* Public Static Properties * |