gui changes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3260 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
far 1998-11-20 02:14:22 +00:00
parent 82157b446e
commit 4d2ffb9522
14 changed files with 784 additions and 1052 deletions

View file

@ -350,25 +350,16 @@ enum { // resized when the view's superview is resized
@class PSMatrix; @class PSMatrix;
//
// GNUstep extensions
//
@interface NSView (PrivateMethods) @interface NSView (PrivateMethods)
/* If the view is rotated returns the bounding box of the rect in the "normal" // If the view is rotated returns
coordinates */ - (NSRect)_boundingRectFor:(NSRect)rect; // the bounding box of the rect in
- (NSRect)_boundingRectFor:(NSRect)rect; // the "normal" coordinates
- (void)_recursivelyResetNeedsDisplayInAllViews;
- (void)_removeSubviewFromViewsThatNeedDisplay:(NSView*)view;
- (void)_displayNeededViews;
- (void)_unconditionallyResetNeedsDisplayInAllViews;
/* Collects into `array' the invalid rectangles that need to be displayed. All
the rectangles are expressed in the window coordinates and not of the views
they come from. */
- (void)_collectInvalidatedRectanglesInArray:(NSMutableArray*)array
originMatrix:(PSMatrix*)matrix1
sizeMatrix:(PSMatrix*)matrix2;
- (PSMatrix*)_frameMatrix; - (PSMatrix*)_frameMatrix;
- (PSMatrix*)_boundsMatrix; - (PSMatrix*)_boundsMatrix;
@end @end

View file

@ -56,6 +56,9 @@
#include <AppKit/IMLoading.h> #include <AppKit/IMLoading.h>
#define CONVEY(a, b) [b retain]; \
[a release]; \
a = b;
// //
// Class variables // Class variables
// //
@ -550,7 +553,7 @@ BOOL match = NO; // which matches mask
[event retain]; [event retain];
[event_queue removeObjectAtIndex:i]; [event_queue removeObjectAtIndex:i];
} }
ASSIGN(current_event, event); CONVEY(current_event, event);
return event; // return an event from return event; // return an event from
} // the queue which } // the queue which
@ -1174,7 +1177,7 @@ BOOL result = YES;
+ (void)setNullEvent:(NSEvent *)e + (void)setNullEvent:(NSEvent *)e
{ {
ASSIGN(null_event, e); CONVEY(null_event, e);
} }
+ (NSEvent *)getNullEvent; + (NSEvent *)getNullEvent;

View file

@ -56,31 +56,34 @@
// //
- initWithFrame:(NSRect)frameRect - initWithFrame:(NSRect)frameRect
{ {
[super initWithFrame:frameRect]; [super initWithFrame:frameRect];
cell = [[NSTextFieldCell alloc] initTextCell:@"Title"];
[cell setAlignment: NSCenterTextAlignment];
[cell setBordered: NO];
[cell setEditable: NO];
[cell setDrawsBackground: YES];
[cell setBackgroundColor: [window backgroundColor]];
offsets.width = 5;
offsets.height = 5;
border_rect = bounds;
border_type = NSLineBorder;
title_position = NSAtTop;
title_rect = NSZeroRect;
ASSIGN(content_view, [NSView new]);
[super addSubview:content_view];
cell = [[NSTextFieldCell alloc] initTextCell:@"Title"]; return self;
[cell setAlignment: NSCenterTextAlignment];
[cell setBordered: NO];
[cell setEditable: NO];
[cell setDrawsBackground: YES];
[cell setBackgroundColor: [window backgroundColor]];
offsets.width = 5;
offsets.height = 5;
border_rect = bounds;
border_type = NSLineBorder;
title_position = NSAtTop;
title_rect = NSZeroRect;
content_view = [NSView new];
[super addSubview:content_view];
return self;
} }
- (void)dealloc - (void)dealloc
{ {
if (cell) [cell release]; if (cell)
if (content_view) [content_view release]; [cell release];
[super dealloc]; if (content_view)
[content_view release];
[super dealloc];
} }
// //

View file

@ -602,9 +602,9 @@ NSString* _string;
} }
- (void)stopTracking:(NSPoint)lastPoint - (void)stopTracking:(NSPoint)lastPoint
at:(NSPoint)stopPoint at:(NSPoint)stopPoint
inView:(NSView *)controlView inView:(NSView *)controlView
mouseIsUp:(BOOL)flag mouseIsUp:(BOOL)flag
{ {
} }

View file

@ -197,6 +197,7 @@
[super_view reflectScrolledClipView:self]; [super_view reflectScrolledClipView:self];
} }
- (BOOL)isOpaque { return YES; }
- (id)documentView { return _documentView; } - (id)documentView { return _documentView; }
- (void)setCopiesOnScroll:(BOOL)flag { _copiesOnScroll = flag; } - (void)setCopiesOnScroll:(BOOL)flag { _copiesOnScroll = flag; }
- (BOOL)copiesOnScroll { return _copiesOnScroll; } - (BOOL)copiesOnScroll { return _copiesOnScroll; }

View file

@ -67,10 +67,10 @@ static NSColorList *systemColors = nil;
// ensure user defaults are loaded, then use them and watch for changes. // ensure user defaults are loaded, then use them and watch for changes.
[NSUserDefaults standardUserDefaults]; [NSUserDefaults standardUserDefaults];
[self defaultsDidChange: nil]; [self defaultsDidChange: nil];
[NSNotificationCenter addObserver: self // [NSNotificationCenter addObserver: self
selector: @selector(defaultsDidChange:) // selector: @selector(defaultsDidChange:)
name: NSUserDefaultsDidChangeNotification // name: NSUserDefaultsDidChangeNotification
object: nil]; // object: nil];
} }
} }

View file

@ -999,7 +999,7 @@ fprintf(stderr, " NSMatrix: selectTextAtRow --- ");
#if HAS_FLIPPED_VIEWS #if HAS_FLIPPED_VIEWS
forPoint:rect.origin forPoint:rect.origin
#else #else
forPoint:NSMakePoint (rect.origin.x, rect.origin.y + rect.size.height) forPoint:NSMakePoint (rect.origin.x, rect.origin.y + rect.size.height)
#endif #endif
above:NO right:NO above:NO right:NO
isBetweenCells:NULL]; isBetweenCells:NULL];
@ -1018,8 +1018,7 @@ fprintf(stderr, " NSMatrix: selectTextAtRow --- ");
if (col1 < 0) if (col1 < 0)
col1 = 0; col1 = 0;
// NSLog (@"display cells between (%d, %d) and (%d, %d)", //NSLog (@"display cells between (%d, %d) and (%d, %d)",row1,col1, row2, col2);
// row1, col1, row2, col2);
/* Draw the cells within the drawing rectangle. */ /* Draw the cells within the drawing rectangle. */
intRect = upperLeftRect = [self cellFrameAtRow:row1 column:col1]; intRect = upperLeftRect = [self cellFrameAtRow:row1 column:col1];
@ -1468,12 +1467,12 @@ static MPoint anchor = {0, 0};
Note that the cell numbering is flipped relative to the coordinate system. Note that the cell numbering is flipped relative to the coordinate system.
*/ */
- (BOOL)_getRow:(int*)row - (BOOL)_getRow:(int*)row
column:(int*)column column:(int*)column
forPoint:(NSPoint)point forPoint:(NSPoint)point
above:(BOOL)aboveRequired above:(BOOL)aboveRequired
right:(BOOL)rightRequired right:(BOOL)rightRequired
isBetweenCells:(BOOL*)isBetweenCells isBetweenCells:(BOOL*)isBetweenCells
{ {
BOOL rowReady = NO, colReady = NO; BOOL rowReady = NO, colReady = NO;
BOOL betweenRows = NO, betweenCols = NO; BOOL betweenRows = NO, betweenCols = NO;

View file

@ -398,7 +398,6 @@ static Class menuCellClass = nil;
- (void)submenuAction:(id)sender - (void)submenuAction:(id)sender
{ {
// SUBCLASS
} }
- (NSMenu*)attachedMenu - (NSMenu*)attachedMenu

View file

@ -269,11 +269,11 @@ NSPoint point;
if (!_knobMoved) if (!_knobMoved)
{ // if scrolling via { // if scrolling via
[self reflectScrolledClipView:_contentView]; // buttons update [self reflectScrolledClipView:_contentView]; // buttons update
if (scroller == _vertScroller) // scroller pos to // if (scroller == _vertScroller) // scroller pos to
[_vertScroller displayIfNeeded]; // reflect clipview // [_vertScroller displayIfNeeded]; // reflect clipview
else // else
[_horizScroller displayIfNeeded]; // [_horizScroller displayIfNeeded];
[window flushWindow]; // [window flushWindow];
} }
} }
@ -288,8 +288,8 @@ id documentView;
if(aClipView != _contentView) // aClipView is not if(aClipView != _contentView) // aClipView is not
return; // our content view return; // our content view
if (_knobMoved) // is this really needed? // if (_knobMoved) // is this really needed?
return; // FAR FIX ME ? // return; // FAR FIX ME ?
NSDebugLog (@"reflectScrolledClipView:"); NSDebugLog (@"reflectScrolledClipView:");
@ -312,6 +312,7 @@ id documentView;
floatValue = 1 - floatValue; floatValue = 1 - floatValue;
[_vertScroller setFloatValue:floatValue [_vertScroller setFloatValue:floatValue
knobProportion:knobProportion]; knobProportion:knobProportion];
[_vertScroller displayIfNeededIgnoringOpacity];
} }
} }
@ -328,10 +329,12 @@ id documentView;
clipViewBounds.size.width); clipViewBounds.size.width);
[_horizScroller setFloatValue:floatValue [_horizScroller setFloatValue:floatValue
knobProportion:knobProportion]; knobProportion:knobProportion];
[_horizScroller displayIfNeededIgnoringOpacity];
} }
} }
// [self setNeedsDisplay:YES]; // not needed by XRAW causes flicker // [self setNeedsDisplay:YES]; // not needed by XRAW causes flicker
[window flushWindow];
} }
- (void)setHorizontalRulerView:(NSRulerView*)aRulerView - (void)setHorizontalRulerView:(NSRulerView*)aRulerView
@ -430,23 +433,24 @@ id documentView;
return [_contentView documentCursor]; return [_contentView documentCursor];
} }
- (NSBorderType)borderType { return _borderType; } - (BOOL)isOpaque { return YES; }
- (NSScroller*)verticalScroller { return _vertScroller; } - (NSBorderType)borderType { return _borderType; }
- (BOOL)hasVerticalScroller { return _hasVertScroller; } - (NSScroller*)verticalScroller { return _vertScroller; }
- (BOOL)hasHorizontalRuler { return _hasHorizRuler; } - (BOOL)hasVerticalScroller { return _hasVertScroller; }
- (NSSize)contentSize { return [_contentView bounds].size; } - (BOOL)hasHorizontalRuler { return _hasHorizRuler; }
- (NSView*)contentView { return _contentView; } - (NSSize)contentSize { return [_contentView bounds].size; }
- (NSRulerView*)horizontalRulerView { return _horizRuler; } - (NSView*)contentView { return _contentView; }
- (BOOL)hasVerticalRuler { return _hasVertRuler; } - (NSRulerView*)horizontalRulerView { return _horizRuler; }
- (NSRulerView*)verticalRulerView { return _vertRuler; } - (BOOL)hasVerticalRuler { return _hasVertRuler; }
- (BOOL)rulersVisible { return _rulersVisible; } - (NSRulerView*)verticalRulerView { return _vertRuler; }
- (void)setLineScroll:(float)aFloat { _lineScroll = aFloat; } - (BOOL)rulersVisible { return _rulersVisible; }
- (float)lineScroll { return _lineScroll; } - (void)setLineScroll:(float)aFloat { _lineScroll = aFloat; }
- (void)setPageScroll:(float)aFloat { _pageScroll = aFloat; } - (float)lineScroll { return _lineScroll; }
- (float)pageScroll { return _pageScroll; } - (void)setPageScroll:(float)aFloat { _pageScroll = aFloat; }
- (float)pageScroll { return _pageScroll; }
- (void)setScrollsDynamically:(BOOL)flag { _scrollsDynamically = flag; } - (void)setScrollsDynamically:(BOOL)flag { _scrollsDynamically = flag; }
- (BOOL)scrollsDynamically { return _scrollsDynamically; } - (BOOL)scrollsDynamically { return _scrollsDynamically; }
- (NSScroller*)horizontalScroller { return _horizScroller; } - (NSScroller*)horizontalScroller { return _horizScroller; }
- (BOOL)hasHorizontalScroller { return _hasHorizScroller; } - (BOOL)hasHorizontalScroller { return _hasHorizScroller; }
@end @end

View file

@ -67,6 +67,7 @@ static NSButtonCell* knobCell = nil;
- (SEL)action { return _action; } - (SEL)action { return _action; }
- (void)setTarget:(id)target { ASSIGN(_target, target); } - (void)setTarget:(id)target { ASSIGN(_target, target); }
- (id)target { return _target; } - (id)target { return _target; }
- (BOOL)isOpaque { return YES; }
- initWithFrame:(NSRect)frameRect - initWithFrame:(NSRect)frameRect
{ {

View file

@ -770,7 +770,10 @@ typedef enum
-(void) setSelectedRange:(NSRange)range -(void) setSelectedRange:(NSRange)range
{ BOOL didLock=NO; { BOOL didLock=NO;
if([self window] && [[self class] focusView] != self) if(![self window])
return;
if([[self class] focusView] != self)
{ [self lockFocus]; { [self lockFocus];
didLock=YES; didLock=YES;
} }

File diff suppressed because it is too large Load diff

View file

@ -424,8 +424,7 @@ NSRect n = frame; // center the window
[self setFrame:n display:YES]; [self setFrame:n display:YES];
} }
- (NSRect)constrainFrameRect:(NSRect)frameRect - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:screen
toScreen:screen
{ {
return NSZeroRect; return NSZeroRect;
} }
@ -501,13 +500,23 @@ NSPoint basePoint;
{ {
if (needs_display) if (needs_display)
{ {
[[content_view superview] _displayNeededViews]; [[content_view superview] displayIfNeeded];
needs_display = NO; needs_display = NO;
} }
} }
- (void)enableFlushWindow { disable_flush_window = NO; } - (void)update
- (void)flushWindow {} // implemented in back end {
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
if(is_autodisplay && needs_display) // if autodisplay is
{ // enabled and window
[self displayIfNeeded]; // display
[self flushWindowIfNeeded];
}
[nc postNotificationName: NSWindowDidUpdateNotification object: self];
}
- (void)flushWindowIfNeeded - (void)flushWindowIfNeeded
{ {
@ -518,50 +527,14 @@ NSPoint basePoint;
} }
} }
- (void)_collectFlushRectangles - (void)flushWindow {} // implemented in back end
{ - (void)enableFlushWindow { disable_flush_window = NO; }
PSMatrix* originMatrix;
PSMatrix* sizeMatrix;
if (disable_flush_window || backing_type == NSBackingStoreNonretained)
return;
NSDebugLog (@"_collectFlushRectangles");
[_flushRectangles removeAllObjects];
originMatrix = [PSMatrix new];
sizeMatrix = [PSMatrix new];
[[content_view superview]
_collectInvalidatedRectanglesInArray:_flushRectangles
originMatrix:originMatrix
sizeMatrix:sizeMatrix];
[originMatrix release];
[sizeMatrix release];
}
- (BOOL)isAutodisplay { return is_autodisplay; } - (BOOL)isAutodisplay { return is_autodisplay; }
- (BOOL)isFlushWindowDisabled { return disable_flush_window; } - (BOOL)isFlushWindowDisabled { return disable_flush_window; }
- (void)setAutodisplay:(BOOL)flag { is_autodisplay = flag; } - (void)setAutodisplay:(BOOL)flag { is_autodisplay = flag; }
- (void)setViewsNeedDisplay:(BOOL)flag { needs_display = flag; } - (void)setViewsNeedDisplay:(BOOL)flag { needs_display = flag; }
- (void)update
{
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
if(is_autodisplay && needs_display) // if autodisplay is
{ // enabled
[self _collectFlushRectangles];
[self displayIfNeeded];
[self flushWindowIfNeeded];
}
[nc postNotificationName: NSWindowDidUpdateNotification object: self];
}
- (void)useOptimizedDrawing:(BOOL)flag { optimize_drawing = flag; }
- (BOOL)viewsNeedDisplay { return needs_display; } - (BOOL)viewsNeedDisplay { return needs_display; }
- (void)useOptimizedDrawing:(BOOL)flag { optimize_drawing = flag; }
- (BOOL)canStoreColor - (BOOL)canStoreColor
{ {
@ -571,11 +544,7 @@ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
return NO; return NO;
} }
- (NSScreen *)deepestScreen - (NSScreen *)deepestScreen { return [NSScreen deepestScreen];}
{
return [NSScreen deepestScreen];
}
- (NSWindowDepth)depthLimit { return depth_limit; } - (NSWindowDepth)depthLimit { return depth_limit; }
- (BOOL)hasDynamicDepthLimit { return dynamic_depth_limit; } - (BOOL)hasDynamicDepthLimit { return dynamic_depth_limit; }
- (NSScreen *)screen { return [NSScreen mainScreen]; } - (NSScreen *)screen { return [NSScreen mainScreen]; }
@ -756,10 +725,9 @@ NSApplication *theApp = [NSApplication sharedApplication];
// Make responder the first // Make responder the first
first_responder = aResponder; // responder first_responder = aResponder; // responder
// Notify responder that it [first_responder becomeFirstResponder]; // Notify responder that it
[first_responder becomeFirstResponder]; // has become the first // has become the first
// responder return YES; // responder
return YES;
} }
- (NSPoint)mouseLocationOutsideOfEventStream - (NSPoint)mouseLocationOutsideOfEventStream
@ -786,8 +754,7 @@ NSApplication *theApp = [NSApplication sharedApplication];
dequeue:deqFlag]; dequeue:deqFlag];
} }
- (void)postEvent:(NSEvent *)event - (void)postEvent:(NSEvent *)event atStart:(BOOL)flag
atStart:(BOOL)flag
{ {
[[NSApplication sharedApplication] postEvent:event atStart:flag]; [[NSApplication sharedApplication] postEvent:event atStart:flag];
} }

View file

@ -8,6 +8,8 @@
Author: Scott Christley <scottc@net-community.com> Author: Scott Christley <scottc@net-community.com>
Date: November 1997 Date: November 1997
Author: Felipe A. Rodriguez <far@ix.netcom.com>
Date: November 1998
This file is part of the GNUstep GUI Library. This file is part of the GNUstep GUI Library.
@ -34,6 +36,7 @@
// //
// The backend will have to fill in the implementation // The backend will have to fill in the implementation
// //
- (BOOL)isOpaque { return YES; }
@end @end