Index: OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowCocoa.mm
===================================================================
--- OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowCocoa.mm (revision 9879)
+++ OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowCocoa.mm (revision 9895)
@@ -143,6 +143,6 @@
 std::ostream& operator<<(std::ostream& os, const NSRect& rect) 
 {
-	os << rect.origin.x << "/" << rect.origin.y << " " << rect.size.width << "x" << rect.size.height;
-	return os;
+    os << rect.origin.x << "/" << rect.origin.y << " " << rect.size.width << "x" << rect.size.height;
+    return os;
 }
 
@@ -158,8 +158,8 @@
     NSRect frame = [[[NSScreen screens] objectAtIndex: 0] frame];
     float y = frame.size.height - rect.origin.y - rect.size.height;
-	NSRect converted = NSMakeRect(rect.origin.x, y, rect.size.width, rect.size.height);
-	
-	// std::cout << "converting from Quartz " << rect << " to " << converted << " using screen rect " << frame << std::endl;
-	
+    NSRect converted = NSMakeRect(rect.origin.x, y, rect.size.width, rect.size.height);
+    
+    // std::cout << "converting from Quartz " << rect << " to " << converted << " using screen rect " << frame << std::endl;
+    
     return converted;
 }
@@ -170,8 +170,8 @@
     
     float y = frame.size.height - (rect.origin.y + rect.size.height);
-	NSRect converted = NSMakeRect(rect.origin.x, y, rect.size.width, rect.size.height);
-	
-	// std::cout << "converting To Quartz   " << rect << " to " << converted << " using screen rect " << frame << std::endl;
-	
+    NSRect converted = NSMakeRect(rect.origin.x, y, rect.size.width, rect.size.height);
+    
+    // std::cout << "converting To Quartz   " << rect << " to " << converted << " using screen rect " << frame << std::endl;
+    
     return converted;
 }
@@ -245,5 +245,5 @@
         BOOL _isUsingCtrlClick, _isUsingOptionClick;
         unsigned int _cachedModifierFlags;
-		BOOL _handleTabletEvents;
+        BOOL _handleTabletEvents;
         
 }
@@ -362,5 +362,5 @@
 
 - (void)flagsChanged:(NSEvent *)theEvent {
-	[self handleModifiers: theEvent];
+    [self handleModifiers: theEvent];
 }
 
@@ -393,9 +393,9 @@
         [self doLeftMouseButtonDown:theEvent];
     }
-	
-	if ([theEvent subtype] == NSTabletPointEventSubtype) {
-		_handleTabletEvents = true;
-		[self handleTabletEvents:theEvent];
-	}
+    
+    if ([theEvent subtype] == NSTabletPointEventSubtype) {
+        _handleTabletEvents = true;
+        [self handleTabletEvents:theEvent];
+    }
 }
 
@@ -405,7 +405,7 @@
     NSPoint converted_point = [self getLocalPoint: theEvent];    
     _win->getEventQueue()->mouseMotion(converted_point.x, converted_point.y);
-	
-	if (_handleTabletEvents)
-		[self handleTabletEvents:theEvent];
+    
+    if (_handleTabletEvents)
+        [self handleTabletEvents:theEvent];
 }
 
@@ -431,5 +431,5 @@
         [self doLeftMouseButtonUp:theEvent];
     }
-	_handleTabletEvents = false;
+    _handleTabletEvents = false;
 }
 
@@ -449,5 +449,5 @@
 {
     [self doRightMouseButtonUp:theEvent];
-	_handleTabletEvents = false;
+    _handleTabletEvents = false;
 }
 
@@ -638,15 +638,15 @@
 - (void)tabletPoint:(NSEvent *)theEvent
 {
-	//_handleTabletEvents = YES;
-	//[self handleTabletEvents:theEvent];
+    //_handleTabletEvents = YES;
+    //[self handleTabletEvents:theEvent];
 }
 
 -(void)handleTabletEvents:(NSEvent *)theEvent
 {
-	float pressure = [theEvent pressure];
-	_win->getEventQueue()->penPressure(pressure);
-	NSPoint tilt = [theEvent tilt];
-	
-	_win->getEventQueue()->penOrientation (tilt.x, tilt.y, [theEvent rotation]);
+    float pressure = [theEvent pressure];
+    _win->getEventQueue()->penPressure(pressure);
+    NSPoint tilt = [theEvent tilt];
+    
+    _win->getEventQueue()->penOrientation (tilt.x, tilt.y, [theEvent rotation]);
 }
 
@@ -654,19 +654,19 @@
 - (void)tabletProximity:(NSEvent *)theEvent
 {
-	osgGA::GUIEventAdapter::TabletPointerType pt(osgGA::GUIEventAdapter::UNKNOWN);
-	switch ([theEvent pointingDeviceType]) {
-		case NSPenPointingDevice:
-			pt = osgGA::GUIEventAdapter::PEN;
-			break;
-		case NSCursorPointingDevice:
-			pt = osgGA::GUIEventAdapter::PUCK;
-			break;
-		case NSEraserPointingDevice:
-			pt = osgGA::GUIEventAdapter::ERASER;
-			break;
-		default:
-			break;
-	}
-	_win->getEventQueue()->penProximity(pt, [theEvent isEnteringProximity]); 
+    osgGA::GUIEventAdapter::TabletPointerType pt(osgGA::GUIEventAdapter::UNKNOWN);
+    switch ([theEvent pointingDeviceType]) {
+        case NSPenPointingDevice:
+            pt = osgGA::GUIEventAdapter::PEN;
+            break;
+        case NSCursorPointingDevice:
+            pt = osgGA::GUIEventAdapter::PUCK;
+            break;
+        case NSEraserPointingDevice:
+            pt = osgGA::GUIEventAdapter::ERASER;
+            break;
+        default:
+            break;
+    }
+    _win->getEventQueue()->penProximity(pt, [theEvent isEnteringProximity]); 
 }
 
@@ -762,5 +762,5 @@
     
     virtual bool valid() { return (_win.valid() && _win->valid()); }
-	
+    
     virtual void getWindowBounds(CGRect& rect) 
     {
@@ -773,5 +773,5 @@
         rect.size.height = nsrect.size.height;
     }
-	
+    
     virtual osgViewer::GraphicsWindow* getWindow() {return _win.get(); }
 private:
@@ -808,9 +808,9 @@
 
     [win setReleasedWhenClosed:NO];
-	[win setDisplaysWhenScreenProfileChanges:YES];	
+    [win setDisplaysWhenScreenProfileChanges:YES];    
     GraphicsWindowCocoaDelegate* delegate = [[GraphicsWindowCocoaDelegate alloc] initWith: this];
     [win setDelegate: delegate ];
     //[delegate autorelease];
-	    
+        
     [win makeKeyAndOrderFront:nil];
     [win setAcceptsMouseMovedEvents: YES];
@@ -836,5 +836,5 @@
             style |= NSResizableWindowMask;
     }
-    	
+        
     DarwinWindowingSystemInterface* wsi = dynamic_cast<DarwinWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface());
     int screenLeft(0), screenTop(0);
@@ -843,8 +843,8 @@
     }
     
-	NSRect rect = NSMakeRect(_traits->x + screenLeft, _traits->y + screenTop, _traits->width, _traits->height);
-    
-	_window = [[GraphicsWindowCocoaWindow alloc] initWithContentRect: rect styleMask: style backing: NSBackingStoreBuffered defer: NO];
-	
+    NSRect rect = NSMakeRect(_traits->x + screenLeft, _traits->y + screenTop, _traits->width, _traits->height);
+    
+    _window = [[GraphicsWindowCocoaWindow alloc] initWithContentRect: rect styleMask: style backing: NSBackingStoreBuffered defer: NO];
+    
     if (!_window) {
         osg::notify(osg::WARN) << "GraphicsWindowCocoa::realizeImplementation :: could not create window" << std::endl;
@@ -854,6 +854,6 @@
     rect = convertFromQuartzCoordinates(rect);
     [_window setFrameOrigin: rect.origin];
-	 
-	NSOpenGLPixelFormatAttribute attr[32];
+     
+    NSOpenGLPixelFormatAttribute attr[32];
     int i = 0;
     
@@ -902,6 +902,6 @@
         }
     }
-	
-	NSOpenGLPixelFormat* pixelformat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr ];
+    
+    NSOpenGLPixelFormat* pixelformat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr ];
     _context = [[NSOpenGLContext alloc] initWithFormat: pixelformat shareContext: sharedContext];
     
@@ -910,15 +910,15 @@
         return false;
     }
-	GraphicsWindowCocoaGLView* theView = [[ GraphicsWindowCocoaGLView alloc ] initWithFrame:[ _window frame ] ];
+    GraphicsWindowCocoaGLView* theView = [[ GraphicsWindowCocoaGLView alloc ] initWithFrame:[ _window frame ] ];
     [theView setAutoresizingMask:  (NSViewWidthSizable | NSViewHeightSizable) ];
     [theView setGraphicsWindowCocoa: this];
     [theView setOpenGLContext:_context];
-	[_window setContentView: theView];
-	
+    [_window setContentView: theView];
+    
     setupNSWindow(_window);
     
     [theView release];
     [pool release];
-	
+    
     MenubarController::instance()->attachWindow( new CocoaWindowAdapter(this) );
     
@@ -951,5 +951,5 @@
     if (mbc) mbc->detachWindow(this);
     
-	[_window close];
+    [_window close];
     [_window release];
 }
@@ -962,6 +962,6 @@
 bool GraphicsWindowCocoa:: makeCurrentImplementation()
 {
-	[_context makeCurrentContext];
-	return true;
+    [_context makeCurrentContext];
+    return true;
 }
 
@@ -973,6 +973,6 @@
 bool GraphicsWindowCocoa::releaseContextImplementation()
 {
-	[NSOpenGLContext clearCurrentContext];
-	return true;
+    [NSOpenGLContext clearCurrentContext];
+    return true;
 }
 
@@ -984,5 +984,5 @@
 void GraphicsWindowCocoa::swapBuffersImplementation()
 {
-	[_context flushBuffer];
+    [_context flushBuffer];
 }
 
@@ -994,5 +994,5 @@
 void GraphicsWindowCocoa::checkEvents()
 {
-	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     
     while(1)
@@ -1013,5 +1013,5 @@
             break;
         [[NSApplication sharedApplication] sendEvent: event];
-    }	
+    }    
     
     if (_closeRequested)
@@ -1023,5 +1023,5 @@
     }
         
-	[pool release];
+    [pool release];
 }
 
@@ -1038,5 +1038,5 @@
 {
     if (!_realized) return false;
-	
+    
     unsigned int style(NSBorderlessWindowMask);
     
@@ -1048,6 +1048,6 @@
             style |= NSResizableWindowMask;
     }
-	NSRect rect = [_window contentRectForFrameRect: [_window frame] ];
-	GraphicsWindowCocoaWindow* new_win = [[GraphicsWindowCocoaWindow alloc] initWithContentRect: rect styleMask: style backing: NSBackingStoreBuffered defer: NO];
+    NSRect rect = [_window contentRectForFrameRect: [_window frame] ];
+    GraphicsWindowCocoaWindow* new_win = [[GraphicsWindowCocoaWindow alloc] initWithContentRect: rect styleMask: style backing: NSBackingStoreBuffered defer: NO];
     
     if (new_win) {
@@ -1062,5 +1062,5 @@
     }
     
-	return true;
+    return true;
 }
 
@@ -1071,5 +1071,5 @@
 void GraphicsWindowCocoa::grabFocus()
 {
-	[_window makeKeyAndOrderFront: nil];
+    [_window makeKeyAndOrderFront: nil];
 }
 
@@ -1080,5 +1080,5 @@
 void GraphicsWindowCocoa::grabFocusIfPointerInWindow()
 {
-	osg::notify(osg::INFO) << "GraphicsWindowCocoa :: grabFocusIfPointerInWindow not implemented yet " << std::endl;
+    osg::notify(osg::INFO) << "GraphicsWindowCocoa :: grabFocusIfPointerInWindow not implemented yet " << std::endl;
 }
 
@@ -1090,10 +1090,10 @@
 void GraphicsWindowCocoa::resizedImplementation(int x, int y, int width, int height)
 {
-	std::cout << "resized implementation" << x << " " << y << " " << width << " " << height << std::endl; 
-	GraphicsContext::resizedImplementation(x, y, width, height);
+    std::cout << "resized implementation" << x << " " << y << " " << width << " " << height << std::endl; 
+    GraphicsContext::resizedImplementation(x, y, width, height);
    
     [_context update];
     MenubarController::instance()->update();
-	getEventQueue()->windowResize(x,y,width, height, getEventQueue()->getTime());
+    getEventQueue()->windowResize(x,y,width, height, getEventQueue()->getTime());
 }
 
@@ -1106,5 +1106,5 @@
 bool GraphicsWindowCocoa::setWindowRectangleImplementation(int x, int y, int width, int height)
 {
-	DarwinWindowingSystemInterface* wsi = dynamic_cast<DarwinWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface());
+    DarwinWindowingSystemInterface* wsi = dynamic_cast<DarwinWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface());
     int screenLeft(0), screenTop(0);
     if (wsi) {
@@ -1131,19 +1131,19 @@
 {
 
-	DarwinWindowingSystemInterface* wsi = dynamic_cast<DarwinWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface());
+    DarwinWindowingSystemInterface* wsi = dynamic_cast<DarwinWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface());
     int screenLeft(0), screenTop(0);
     if (wsi) {
-		
-		// get the screen containing the window
-		unsigned int screenNdx = wsi->getScreenContaining(x,y,w,h);
-		
-		// update traits
-		_traits->screenNum = screenNdx;
-		
-		// get top left of screen
+        
+        // get the screen containing the window
+        unsigned int screenNdx = wsi->getScreenContaining(x,y,w,h);
+        
+        // update traits
+        _traits->screenNum = screenNdx;
+        
+        // get top left of screen
         wsi->getScreenTopLeft((*_traits), screenLeft, screenTop);
     }
-	
-	resized(x-screenLeft,y-screenTop,w,h);
+    
+    resized(x-screenLeft,y-screenTop,w,h);
 }
 
@@ -1155,9 +1155,9 @@
 void GraphicsWindowCocoa::setWindowName (const std::string & name)
 {
-	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     
     NSString* title = [NSString stringWithCString: name.c_str() encoding: NSUTF8StringEncoding];
-	[_window setTitle: title];
-	[title release];
+    [_window setTitle: title];
+    [title release];
     [pool release];
 }
@@ -1170,5 +1170,5 @@
 void GraphicsWindowCocoa::useCursor(bool cursorOn)
 {
-	if (_traits.valid())
+    if (_traits.valid())
         _traits->useCursor = cursorOn;
     DarwinWindowingSystemInterface* wsi = dynamic_cast<DarwinWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface());
@@ -1201,5 +1201,5 @@
 void GraphicsWindowCocoa::setCursor(MouseCursor mouseCursor)
 {
-	switch (mouseCursor) 
+    switch (mouseCursor) 
     {
 
@@ -1233,5 +1233,5 @@
 {
     GLint VBL(f?1:0);
-	[_context setValues:&VBL forParameter:NSOpenGLCPSwapInterval];
+    [_context setValues:&VBL forParameter:NSOpenGLCPSwapInterval];
 }
 
@@ -1254,23 +1254,23 @@
 
 struct CocoaWindowingSystemInterface : public DarwinWindowingSystemInterface {
-	
-	CocoaWindowingSystemInterface()
-	:	DarwinWindowingSystemInterface() 
-	{
-		localPool = [[NSAutoreleasePool alloc] init];
+    
+    CocoaWindowingSystemInterface()
+    :    DarwinWindowingSystemInterface() 
+    {
+        localPool = [[NSAutoreleasePool alloc] init];
         [[NSApplication sharedApplication] setDelegate: [[CocoaAppDelegate alloc] init] ];
-	}
-	
-	virtual osg::GraphicsContext* createGraphicsContext(osg::GraphicsContext::Traits* traits) 
-	{
-		return createGraphicsContextImplementation<PixelBufferCocoa, GraphicsWindowCocoa>(traits);
-	}
-	
-	virtual ~CocoaWindowingSystemInterface() 
-	{
-		[localPool release];
-	}
-	
-	NSAutoreleasePool *localPool;
+    }
+    
+    virtual osg::GraphicsContext* createGraphicsContext(osg::GraphicsContext::Traits* traits) 
+    {
+        return createGraphicsContextImplementation<PixelBufferCocoa, GraphicsWindowCocoa>(traits);
+    }
+    
+    virtual ~CocoaWindowingSystemInterface() 
+    {
+        [localPool release];
+    }
+    
+    NSAutoreleasePool *localPool;
 
 };
