From: Richard K. <ric...@us...> - 2005-07-07 05:14:58
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14730 Modified Files: ASRootWindowView.as NSWindow.as Log Message: got resize working on windows Index: ASRootWindowView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASRootWindowView.as,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ASRootWindowView.as 6 Jul 2005 19:02:57 -0000 1.7 --- ASRootWindowView.as 7 Jul 2005 05:14:42 -0000 1.8 *************** *** 33,36 **** --- 33,37 ---- import org.actionstep.NSWindow; import org.actionstep.NSRect; + import org.actionstep.NSSize; import org.actionstep.NSFont; import org.actionstep.NSColor; *************** *** 49,52 **** --- 50,54 ---- private var m_window:NSWindow; private var m_titleRect:NSRect; + private var m_resizeRect:NSRect; private var m_trackingData; *************** *** 61,64 **** --- 63,151 ---- private var m_titleFontColor:NSColor; + private var m_resizeClip:MovieClip; + + public function ASRootWindowView() { + m_swfLoading = false; + m_swfLoaded = false; + m_titleRect = new NSRect(0,0,0,22); + m_resizeRect = new NSRect(-11,-11,11,11); + } + + public function initWithFrameWindow(frame:NSRect, window:NSWindow):ASRootWindowView { + initWithFrame(frame); + m_titleFont = NSFont.systemFontOfSize(12); + m_titleKeyFontColor = NSColor.systemFontColor(); + m_titleFontColor = new NSColor(0x666666); + m_titleTextFormat = m_titleFont.textFormat(); + m_titleTextFormat.bold = true; + m_titleTextFormat.color = m_titleKeyFontColor.value; + m_window = window; + setLowerView(highestViewOfLevel()); + return this; + } + + public function createMovieClips() { + super.createMovieClips(); + if (m_mcBounds != null) { + if (m_window.styleMask() & NSWindow.NSResizableWindowMask) { + m_resizeClip = m_mcBounds.createEmptyMovieClip("ResizeClip", 1000000); + with(m_resizeClip) { + //da 87 e8 ff + lineStyle(1.5, 0xdadada, 100); + moveTo(0,10); + lineTo(10,0); + lineStyle(1.5, 0x878787, 100); + moveTo(1,10); + lineTo(10,1); + lineStyle(1.5, 0xe8e8e8, 100); + moveTo(2,10); + lineTo(10,2); + lineStyle(1.5, 0xFFFFFF, 0); + moveTo(3,10); + lineTo(10,3); + + lineStyle(1.5, 0xdadada, 100); + moveTo(4,10); + lineTo(10,4); + lineStyle(1.5, 0x878787, 100); + moveTo(5,10); + lineTo(10,5); + lineStyle(1.5, 0xe8e8e8, 100); + moveTo(6,10); + lineTo(10,6); + lineStyle(1.5, 0xFFFFFF, 0); + moveTo(7,10); + lineTo(10,7); + + lineStyle(1.5, 0xdadada, 100); + moveTo(8,10); + lineTo(10,8); + lineStyle(1.5, 0x878787, 100); + moveTo(9,10); + lineTo(10,9); + lineStyle(1.5, 0xe8e8e8, 100); + moveTo(10,10); + lineTo(10,10); + } + m_resizeClip.view = this; + m_resizeClip._x = m_frame.size.width-12; + m_resizeClip._y = m_frame.size.height-12; + m_resizeRect.origin.x = m_resizeClip._x; + m_resizeRect.origin.y = m_resizeClip._y; + } + } + } + + private function updateFrameMovieClipSize():Void { + super.updateFrameMovieClipSize(); + if (m_mcFrame != null) { + m_resizeClip._x = m_frame.size.width-12; + m_resizeClip._y = m_frame.size.height-12; + m_resizeRect.origin.x = m_resizeClip._x; + m_resizeRect.origin.y = m_resizeClip._y; + m_titleTextField._x = (m_frame.size.width - (m_titleTextField.textWidth+4))/2; + } + } + public static function lowestView():ASRootWindowView { return g_lowestView; *************** *** 94,116 **** } - public function ASRootWindowView() { - m_swfLoading = false; - m_swfLoaded = false; - m_titleRect = new NSRect(0,0,0,22); - } - - public function initWithFrameWindow(frame:NSRect, window:NSWindow):ASRootWindowView { - initWithFrame(frame); - m_titleFont = NSFont.systemFontOfSize(12); - m_titleKeyFontColor = NSColor.systemFontColor(); - m_titleFontColor = new NSColor(0x666666); - m_titleTextFormat = m_titleFont.textFormat(); - m_titleTextFormat.bold = true; - m_titleTextFormat.color = m_titleKeyFontColor.value; - m_window = window; - setLowerView(highestViewOfLevel()); - return this; - } - public function level():Number { return m_window.level(); --- 181,184 ---- *************** *** 268,271 **** --- 336,342 ---- dragWindow(event); } + if(m_resizeRect.pointInRect(location)) { + resizeWindow(event); + } } *************** *** 290,293 **** --- 361,389 ---- NSApplication.sharedApplication().callObjectSelectorWithNextEventMatchingMaskDequeue(this, "dragWindowCallback", m_trackingData.eventMask, true); } + + private function resizeWindow(event:NSEvent) { + var frame:NSRect = frame(); + m_trackingData = { + origin: frame.origin, + offsetX: frame.origin.x + frame.size.width - event.mouseLocation.x, + offsetY: frame.origin.y + frame.size.height - event.mouseLocation.y, + mouseDown: true, + eventMask: NSEvent.NSLeftMouseDownMask | NSEvent.NSLeftMouseUpMask | NSEvent.NSLeftMouseDraggedMask + | NSEvent.NSMouseMovedMask | NSEvent.NSOtherMouseDraggedMask | NSEvent.NSRightMouseDraggedMask, + complete: false, + }; + resizeWindowCallback(event); + } + + public function resizeWindowCallback(event:NSEvent) { + if (event.type == NSEvent.NSLeftMouseUp) { + return; + } + m_window.setFrame(new NSRect(m_trackingData.origin.x, m_trackingData.origin.y, + event.mouseLocation.x - m_trackingData.origin.x + m_trackingData.offsetX, + event.mouseLocation.y - m_trackingData.origin.y + m_trackingData.offsetY + )); + NSApplication.sharedApplication().callObjectSelectorWithNextEventMatchingMaskDequeue(this, "resizeWindowCallback", m_trackingData.eventMask, true); + } public function drawRect(rect:NSRect) { Index: NSWindow.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSWindow.as,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** NSWindow.as 6 Jul 2005 19:02:57 -0000 1.17 --- NSWindow.as 7 Jul 2005 05:14:42 -0000 1.18 *************** *** 239,242 **** --- 239,245 ---- if (m_contentRect.size.width != cRect.size.width || m_contentRect.size.height != cRect.size.height) { m_contentView.setFrameSize(cRect.size); + m_contentView.setNeedsDisplay(true); + m_rootView.setFrameSize(frame.size); + m_rootView.setNeedsDisplay(true); } m_contentRect = cRect; *************** *** 254,257 **** --- 257,261 ---- m_contentRect.size.height = size.height; m_frameRect = frameRectForContentRect(); + m_rootView.setFrame(NSRect.withOriginSize(convertScreenToBase(m_contentRect.origin), m_contentRect.size)); m_contentView.setFrame(NSRect.withOriginSize(convertScreenToBase(m_contentRect.origin), m_contentRect.size)); } |