- Issue #54, Rolf Jansen's NSTextFieldCell inset fix

- Issue #53, Rolf Jansen's -[NSVew mouse:inRect:] implementation
- Issue #52, Rolf Jansen's NSTabView fix
- Issue #51, partial fix, prepareOpenGL only called once now
This commit is contained in:
Christopher Lloyd 2007-12-13 15:44:38 +00:00
parent e1fa4c4c25
commit b10c5e4282
8 changed files with 37 additions and 25 deletions

View File

@ -388,19 +388,19 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
[style drawTabPaneInRect:[self rectForBorder]];
if((i=[_items indexOfObjectIdenticalTo:_selectedItem])!=NSNotFound){
// now do selected item
i = [_items indexOfObject:_selectedItem];
[style drawTabInRect:[self rectForItemBorderAtIndex:i] clipRect:rect color:[_selectedItem color] selected:YES];
{
if((i=[_items indexOfObjectIdenticalTo:_selectedItem])!=NSNotFound) {
// now do selected item
i = [_items indexOfObject:_selectedItem];
[style drawTabInRect:[self rectForItemBorderAtIndex:i] clipRect:rect color:[_selectedItem color] selected:YES];
[[_selectedItem view] setNeedsDisplay:YES];
NSRect labelRect=[self rectForItemLabelAtIndex:i];
labelRect.origin.y+=2;
[_selectedItem drawLabel:_allowsTruncatedLabels inRect: labelRect];
[_selectedItem drawLabel:_allowsTruncatedLabels inRect: labelRect];
if ([[self window] firstResponder] == self)
NSDottedFrameRect(NSInsetRect(labelRect,-1,0));
}
if ([[self window] firstResponder] == self)
NSDottedFrameRect(NSInsetRect(labelRect,-1,0));
}
break;
}

View File

@ -95,6 +95,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
rect=NSInsetRect(rect,3,3);
else if([self isBordered])
rect=NSInsetRect(rect,2,2);
else
rect=NSInsetRect(rect,2,0);
return rect;
}

View File

@ -164,6 +164,7 @@ APPKIT_EXPORT NSString *NSViewFocusDidChangeNotification;
-(void)scrollPoint:(NSPoint)point;
-(BOOL)scrollRectToVisible:(NSRect)rect;
-(BOOL)mouse:(NSPoint)point inRect:(NSRect)rect;
-(void)allocateGState;
-(void)releaseGState;

View File

@ -877,6 +877,10 @@ static inline void buildTransformsIfNeeded(NSView *self) {
return NO;
}
-(BOOL)mouse:(NSPoint)point inRect:(NSRect)rect {
return NSMouseInRect(point, rect, [self isFlipped]);
}
-(void)allocateGState {
// unimplemented
}
@ -1061,9 +1065,10 @@ static inline void buildTransformsIfNeeded(NSView *self) {
point.x+=delta.width;
point.y+=delta.height;
[self lockFocus];
NSCopyBits([self gState],rect,point);
[self unlockFocus];
if([self lockFocusIfCanDraw]){
NSCopyBits([self gState],rect,point);
[self unlockFocus];
}
}
-(void)print:sender {

View File

@ -84,8 +84,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if((_glContext=opengl_wglCreateContext([_drawable dc]))==NULL){
NSLog(@"unable to create _glContext");
[self dealloc];
return ;
return;
}
}
[_drawable makeCurrentWithGLContext:_glContext];

View File

@ -20,7 +20,6 @@
[_view drawRect:[_view bounds]];
[_view unlockFocus];
EndPaint(_windowHandle,&paintStruct);
break;
}
}
return 0;
@ -135,7 +134,6 @@ static void pfdFromPixelFormat(PIXELFORMATDESCRIPTOR *pfd,NSOpenGLPixelFormat *p
pfdFromPixelFormat(&pfd,pixelFormat);
_view=view;
_windowHandle=CreateWindowEx(WS_EX_TOOLWINDOW,"NSWin32OpenGLWindow", "", WS_CLIPCHILDREN | WS_CLIPSIBLINGS| WS_POPUP|WS_CHILD,
0, 0, 500, 500,
NULL,NULL, GetModuleHandle (NULL),NULL);
@ -147,10 +145,12 @@ static void pfdFromPixelFormat(PIXELFORMATDESCRIPTOR *pfd,NSOpenGLPixelFormat *p
if(!SetPixelFormat(_dc,pfIndex,&pfd))
NSLog(@"SetPixelFormat failed");
SetWindowPos(_windowHandle,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_SHOWWINDOW);
_view=view;
[self updateWithView:view];
SetWindowPos(_windowHandle,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_SHOWWINDOW);
return self;
}

View File

@ -13,6 +13,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
@interface NSOpenGLView : NSView {
NSOpenGLPixelFormat *_pixelFormat;
NSOpenGLContext *_context;
BOOL _needsPrepare;
BOOL _needsReshape;
}

View File

@ -60,6 +60,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if(_context==nil){
_context=[[NSOpenGLContext alloc] initWithFormat:_pixelFormat shareContext:nil];
[_context setView:self];
_needsPrepare=YES;
}
return _context;
@ -96,12 +97,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
-(void)lockFocus {
[super lockFocus];
[[self openGLContext] makeCurrentContext];
[self prepareOpenGL];
if(_needsReshape)
[self reshape];
[super lockFocus];
[[self openGLContext] makeCurrentContext];
if(_needsPrepare){
[self prepareOpenGL];
_needsPrepare=NO;
}
if(_needsReshape)
[self reshape];
}
-(void)unlockFocus {