mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 05:10:58 +00:00
Clean up NSClipView.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@24711 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
df0e4e1b8a
commit
8eb4a42ce6
2 changed files with 55 additions and 44 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2007-02-27 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/NSClipView.m (-initWithFrame:): Replace the wrong
|
||||||
|
initialise [init].
|
||||||
|
* Source/NSClipView.m (-viewFrameChanged:, -documentVisibleRect,
|
||||||
|
-dealloc): Simplified methods.
|
||||||
|
* Source/NSClipView.m (-setDocumentView:): Remove only
|
||||||
|
notifications that get added here.
|
||||||
|
* Source/NSClipView.m (-setBounds:): Add method.
|
||||||
|
|
||||||
2007-02-27 Nicola Pero <nicola.pero@meta-innovation.com>
|
2007-02-27 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||||
|
|
||||||
* Source/GNUmakefile.preamble (GNUSTEP_INSTALL_PREFIX): Variable
|
* Source/GNUmakefile.preamble (GNUSTEP_INSTALL_PREFIX): Variable
|
||||||
|
@ -20,8 +30,8 @@
|
||||||
|
|
||||||
2007-02-27 Fred Kiefer <FredKiefer@gmx.de>
|
2007-02-27 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSTabViewItem.m (-initWithFrame:): Set _selected_item to NSNotFound.
|
* Source/NSTabView.m (-initWithFrame:): Set _selected_item to NSNotFound.
|
||||||
* Source/NSTabViewItem.m (-selectNextTabViewItem:,
|
* Source/NSTabView.m (-selectNextTabViewItem:,
|
||||||
-selectPreviousTabViewItem:): Handle _selected_item being
|
-selectPreviousTabViewItem:): Handle _selected_item being
|
||||||
NSNotFound correctly. Patch by Wolfgang Lux <wolfgang.lux@gmail.com>.
|
NSNotFound correctly. Patch by Wolfgang Lux <wolfgang.lux@gmail.com>.
|
||||||
|
|
||||||
|
|
|
@ -86,30 +86,22 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
||||||
*/
|
*/
|
||||||
@implementation NSClipView
|
@implementation NSClipView
|
||||||
|
|
||||||
- (id) init
|
- (id) initWithFrame: (NSRect)frameRect
|
||||||
{
|
{
|
||||||
[super init];
|
self = [super initWithFrame:frameRect];
|
||||||
|
if (self)
|
||||||
|
{
|
||||||
[self setAutoresizesSubviews: YES];
|
[self setAutoresizesSubviews: YES];
|
||||||
[self setBackgroundColor: [NSColor controlColor]];
|
[self setBackgroundColor: [NSColor controlBackgroundColor]];
|
||||||
_copiesOnScroll = YES;
|
_copiesOnScroll = YES;
|
||||||
_drawsBackground = YES;
|
_drawsBackground = YES;
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
if (_documentView != nil)
|
[self setDocumentView: nil];
|
||||||
{
|
|
||||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
|
||||||
|
|
||||||
[nc removeObserver: self name: nil object: _documentView];
|
|
||||||
if ([_documentView isKindOfClass: [NSTableView class]])
|
|
||||||
{
|
|
||||||
[nc removeObserver: _documentView name:nil object:self];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Don't RELEASE(_documentView), since it's already in our subviews. */
|
|
||||||
}
|
|
||||||
RELEASE(_cursor);
|
RELEASE(_cursor);
|
||||||
RELEASE(_backgroundColor);
|
RELEASE(_backgroundColor);
|
||||||
|
|
||||||
|
@ -133,13 +125,21 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
||||||
nc = [NSNotificationCenter defaultCenter];
|
nc = [NSNotificationCenter defaultCenter];
|
||||||
if (_documentView)
|
if (_documentView)
|
||||||
{
|
{
|
||||||
[nc removeObserver: self name: nil object: _documentView];
|
[nc removeObserver: self
|
||||||
|
name: NSViewFrameDidChangeNotification
|
||||||
|
object: _documentView];
|
||||||
|
[nc removeObserver: self
|
||||||
|
name: NSViewBoundsDidChangeNotification
|
||||||
|
object: _documentView];
|
||||||
|
|
||||||
/* if our documentView was a tableview, unregister its
|
/* if our documentView was a tableview, unregister its
|
||||||
* observers
|
* observers
|
||||||
*/
|
*/
|
||||||
if ([_documentView isKindOfClass: [NSTableView class]])
|
if ([_documentView isKindOfClass: [NSTableView class]])
|
||||||
{
|
{
|
||||||
[nc removeObserver: _documentView name: nil object: self];
|
[nc removeObserver: _documentView
|
||||||
|
name: NSViewFrameDidChangeNotification
|
||||||
|
object: self];
|
||||||
}
|
}
|
||||||
[_documentView removeFromSuperview];
|
[_documentView removeFromSuperview];
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,6 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
||||||
*/
|
*/
|
||||||
if ([_documentView isKindOfClass: [NSTableView class]])
|
if ([_documentView isKindOfClass: [NSTableView class]])
|
||||||
{
|
{
|
||||||
[nc removeObserver: _documentView name: nil object: self];
|
|
||||||
[self setPostsFrameChangedNotifications: YES];
|
[self setPostsFrameChangedNotifications: YES];
|
||||||
[nc addObserver: _documentView
|
[nc addObserver: _documentView
|
||||||
selector: @selector(superviewFrameChanged:)
|
selector: @selector(superviewFrameChanged:)
|
||||||
|
@ -214,6 +213,20 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
||||||
[self setBoundsOrigin: [self constrainScrollPoint: aPoint]];
|
[self setBoundsOrigin: [self constrainScrollPoint: aPoint]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setBounds: (NSRect)b
|
||||||
|
{
|
||||||
|
// FIXME: Shouldn't the document view be marked as needing a redraw?
|
||||||
|
[super setBounds: b];
|
||||||
|
[_super_view reflectScrolledClipView: self];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setBoundsSize: (NSSize)aSize
|
||||||
|
{
|
||||||
|
// FIXME: Shouldn't the document view be marked as needing a redraw?
|
||||||
|
[super setBoundsSize: aSize];
|
||||||
|
[_super_view reflectScrolledClipView: self];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) setBoundsOrigin: (NSPoint)aPoint
|
- (void) setBoundsOrigin: (NSPoint)aPoint
|
||||||
{
|
{
|
||||||
NSRect originalBounds = _bounds;
|
NSRect originalBounds = _bounds;
|
||||||
|
@ -222,7 +235,7 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
||||||
|
|
||||||
newBounds.origin = aPoint;
|
newBounds.origin = aPoint;
|
||||||
|
|
||||||
if (NSEqualPoints (originalBounds.origin, newBounds.origin))
|
if (NSEqualPoints(originalBounds.origin, newBounds.origin))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -425,15 +438,13 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
||||||
If _copiesOnScroll is set, we make sure the difference between old
|
If _copiesOnScroll is set, we make sure the difference between old
|
||||||
position and new position is an integer so we can copy the image
|
position and new position is an integer so we can copy the image
|
||||||
easily.
|
easily.
|
||||||
|
FIXME: Why should this help? If the value is integral in user space this does
|
||||||
|
not mean anything in device space.
|
||||||
*/
|
*/
|
||||||
if (_copiesOnScroll)
|
if (_copiesOnScroll)
|
||||||
{
|
{
|
||||||
new.x =
|
new.x = _bounds.origin.x + (rint(new.x - _bounds.origin.x));
|
||||||
_bounds.origin.x +
|
new.y = _bounds.origin.y + (rint(new.y - _bounds.origin.y));
|
||||||
(rint(new.x - _bounds.origin.x));
|
|
||||||
new.y =
|
|
||||||
_bounds.origin.y +
|
|
||||||
(rint(new.y - _bounds.origin.y));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new;
|
return new;
|
||||||
|
@ -469,11 +480,7 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
||||||
*/
|
*/
|
||||||
- (NSRect) documentVisibleRect
|
- (NSRect) documentVisibleRect
|
||||||
{
|
{
|
||||||
NSRect visRect;
|
return [self convertRect: _bounds toView:_documentView];
|
||||||
|
|
||||||
visRect = [self visibleRect];
|
|
||||||
visRect = [self convertRect:visRect toView:_documentView];
|
|
||||||
return visRect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) drawRect: (NSRect)rect
|
- (void) drawRect: (NSRect)rect
|
||||||
|
@ -538,7 +545,7 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
||||||
*/
|
*/
|
||||||
- (void) viewFrameChanged: (NSNotification*)aNotification
|
- (void) viewFrameChanged: (NSNotification*)aNotification
|
||||||
{
|
{
|
||||||
[self setBoundsOrigin: [self constrainScrollPoint: _bounds.origin]];
|
[self scrollToPoint: _bounds.origin];
|
||||||
|
|
||||||
/* If document frame does not completely cover _bounds */
|
/* If document frame does not completely cover _bounds */
|
||||||
if (NSContainsRect([_documentView frame], _bounds) == NO)
|
if (NSContainsRect([_documentView frame], _bounds) == NO)
|
||||||
|
@ -558,12 +565,6 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
||||||
[_super_view reflectScrolledClipView: self];
|
[_super_view reflectScrolledClipView: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setBoundsSize: (NSSize)aSize
|
|
||||||
{
|
|
||||||
[super setBoundsSize: aSize];
|
|
||||||
[_super_view reflectScrolledClipView: self];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) setFrameSize: (NSSize)aSize
|
- (void) setFrameSize: (NSSize)aSize
|
||||||
{
|
{
|
||||||
[super setFrameSize: aSize];
|
[super setFrameSize: aSize];
|
||||||
|
@ -619,7 +620,7 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
||||||
*/
|
*/
|
||||||
- (void) setDocumentCursor: (NSCursor*)aCursor
|
- (void) setDocumentCursor: (NSCursor*)aCursor
|
||||||
{
|
{
|
||||||
ASSIGN (_cursor, aCursor);
|
ASSIGN(_cursor, aCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**<p>Returns the cursor of the document view</p>
|
/**<p>Returns the cursor of the document view</p>
|
||||||
|
@ -666,7 +667,7 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setDrawsBackground:(BOOL)flag
|
- (void) setDrawsBackground: (BOOL)flag
|
||||||
{
|
{
|
||||||
if (_drawsBackground != flag)
|
if (_drawsBackground != flag)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue