mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
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:
parent
5310a8bfac
commit
d093540668
14 changed files with 784 additions and 1052 deletions
|
@ -350,25 +350,16 @@ enum { // resized when the view's superview is resized
|
|||
|
||||
@class PSMatrix;
|
||||
|
||||
//
|
||||
// GNUstep extensions
|
||||
//
|
||||
@interface NSView (PrivateMethods)
|
||||
/* If the view is rotated returns the bounding box of the rect in the "normal"
|
||||
coordinates */
|
||||
- (NSRect)_boundingRectFor:(NSRect)rect;
|
||||
|
||||
- (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;
|
||||
|
||||
// If the view is rotated returns
|
||||
- (NSRect)_boundingRectFor:(NSRect)rect; // the bounding box of the rect in
|
||||
// the "normal" coordinates
|
||||
- (PSMatrix*)_frameMatrix;
|
||||
- (PSMatrix*)_boundsMatrix;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
|
|
@ -56,6 +56,9 @@
|
|||
|
||||
#include <AppKit/IMLoading.h>
|
||||
|
||||
#define CONVEY(a, b) [b retain]; \
|
||||
[a release]; \
|
||||
a = b;
|
||||
//
|
||||
// Class variables
|
||||
//
|
||||
|
@ -550,7 +553,7 @@ BOOL match = NO; // which matches mask
|
|||
[event retain];
|
||||
[event_queue removeObjectAtIndex:i];
|
||||
}
|
||||
ASSIGN(current_event, event);
|
||||
CONVEY(current_event, event);
|
||||
|
||||
return event; // return an event from
|
||||
} // the queue which
|
||||
|
@ -1174,7 +1177,7 @@ BOOL result = YES;
|
|||
|
||||
+ (void)setNullEvent:(NSEvent *)e
|
||||
{
|
||||
ASSIGN(null_event, e);
|
||||
CONVEY(null_event, e);
|
||||
}
|
||||
|
||||
+ (NSEvent *)getNullEvent;
|
||||
|
|
|
@ -56,31 +56,34 @@
|
|||
//
|
||||
- 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"];
|
||||
[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;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if (cell) [cell release];
|
||||
if (content_view) [content_view release];
|
||||
[super dealloc];
|
||||
if (cell)
|
||||
[cell release];
|
||||
if (content_view)
|
||||
[content_view release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -602,9 +602,9 @@ NSString* _string;
|
|||
}
|
||||
|
||||
- (void)stopTracking:(NSPoint)lastPoint
|
||||
at:(NSPoint)stopPoint
|
||||
inView:(NSView *)controlView
|
||||
mouseIsUp:(BOOL)flag
|
||||
at:(NSPoint)stopPoint
|
||||
inView:(NSView *)controlView
|
||||
mouseIsUp:(BOOL)flag
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -197,6 +197,7 @@
|
|||
[super_view reflectScrolledClipView:self];
|
||||
}
|
||||
|
||||
- (BOOL)isOpaque { return YES; }
|
||||
- (id)documentView { return _documentView; }
|
||||
- (void)setCopiesOnScroll:(BOOL)flag { _copiesOnScroll = flag; }
|
||||
- (BOOL)copiesOnScroll { return _copiesOnScroll; }
|
||||
|
|
|
@ -67,10 +67,10 @@ static NSColorList *systemColors = nil;
|
|||
// ensure user defaults are loaded, then use them and watch for changes.
|
||||
[NSUserDefaults standardUserDefaults];
|
||||
[self defaultsDidChange: nil];
|
||||
[NSNotificationCenter addObserver: self
|
||||
selector: @selector(defaultsDidChange:)
|
||||
name: NSUserDefaultsDidChangeNotification
|
||||
object: nil];
|
||||
// [NSNotificationCenter addObserver: self
|
||||
// selector: @selector(defaultsDidChange:)
|
||||
// name: NSUserDefaultsDidChangeNotification
|
||||
// object: nil];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -999,7 +999,7 @@ fprintf(stderr, " NSMatrix: selectTextAtRow --- ");
|
|||
#if HAS_FLIPPED_VIEWS
|
||||
forPoint:rect.origin
|
||||
#else
|
||||
forPoint:NSMakePoint (rect.origin.x, rect.origin.y + rect.size.height)
|
||||
forPoint:NSMakePoint (rect.origin.x, rect.origin.y + rect.size.height)
|
||||
#endif
|
||||
above:NO right:NO
|
||||
isBetweenCells:NULL];
|
||||
|
@ -1018,8 +1018,7 @@ fprintf(stderr, " NSMatrix: selectTextAtRow --- ");
|
|||
if (col1 < 0)
|
||||
col1 = 0;
|
||||
|
||||
// NSLog (@"display cells between (%d, %d) and (%d, %d)",
|
||||
// row1, col1, row2, col2);
|
||||
//NSLog (@"display cells between (%d, %d) and (%d, %d)",row1,col1, row2, col2);
|
||||
|
||||
/* Draw the cells within the drawing rectangle. */
|
||||
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.
|
||||
*/
|
||||
- (BOOL)_getRow:(int*)row
|
||||
column:(int*)column
|
||||
forPoint:(NSPoint)point
|
||||
above:(BOOL)aboveRequired
|
||||
right:(BOOL)rightRequired
|
||||
isBetweenCells:(BOOL*)isBetweenCells
|
||||
- (BOOL)_getRow:(int*)row
|
||||
column:(int*)column
|
||||
forPoint:(NSPoint)point
|
||||
above:(BOOL)aboveRequired
|
||||
right:(BOOL)rightRequired
|
||||
isBetweenCells:(BOOL*)isBetweenCells
|
||||
{
|
||||
BOOL rowReady = NO, colReady = NO;
|
||||
BOOL betweenRows = NO, betweenCols = NO;
|
||||
|
|
|
@ -398,7 +398,6 @@ static Class menuCellClass = nil;
|
|||
|
||||
- (void)submenuAction:(id)sender
|
||||
{
|
||||
// SUBCLASS
|
||||
}
|
||||
|
||||
- (NSMenu*)attachedMenu
|
||||
|
|
|
@ -269,11 +269,11 @@ NSPoint point;
|
|||
if (!_knobMoved)
|
||||
{ // if scrolling via
|
||||
[self reflectScrolledClipView:_contentView]; // buttons update
|
||||
if (scroller == _vertScroller) // scroller pos to
|
||||
[_vertScroller displayIfNeeded]; // reflect clipview
|
||||
else
|
||||
[_horizScroller displayIfNeeded];
|
||||
[window flushWindow];
|
||||
// if (scroller == _vertScroller) // scroller pos to
|
||||
// [_vertScroller displayIfNeeded]; // reflect clipview
|
||||
// else
|
||||
// [_horizScroller displayIfNeeded];
|
||||
// [window flushWindow];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -288,8 +288,8 @@ id documentView;
|
|||
if(aClipView != _contentView) // aClipView is not
|
||||
return; // our content view
|
||||
|
||||
if (_knobMoved) // is this really needed?
|
||||
return; // FAR FIX ME ?
|
||||
// if (_knobMoved) // is this really needed?
|
||||
// return; // FAR FIX ME ?
|
||||
|
||||
NSDebugLog (@"reflectScrolledClipView:");
|
||||
|
||||
|
@ -312,6 +312,7 @@ id documentView;
|
|||
floatValue = 1 - floatValue;
|
||||
[_vertScroller setFloatValue:floatValue
|
||||
knobProportion:knobProportion];
|
||||
[_vertScroller displayIfNeededIgnoringOpacity];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -328,10 +329,12 @@ id documentView;
|
|||
clipViewBounds.size.width);
|
||||
[_horizScroller setFloatValue:floatValue
|
||||
knobProportion:knobProportion];
|
||||
[_horizScroller displayIfNeededIgnoringOpacity];
|
||||
}
|
||||
}
|
||||
|
||||
// [self setNeedsDisplay:YES]; // not needed by XRAW causes flicker
|
||||
[window flushWindow];
|
||||
}
|
||||
|
||||
- (void)setHorizontalRulerView:(NSRulerView*)aRulerView
|
||||
|
@ -430,23 +433,24 @@ id documentView;
|
|||
return [_contentView documentCursor];
|
||||
}
|
||||
|
||||
- (NSBorderType)borderType { return _borderType; }
|
||||
- (NSScroller*)verticalScroller { return _vertScroller; }
|
||||
- (BOOL)hasVerticalScroller { return _hasVertScroller; }
|
||||
- (BOOL)hasHorizontalRuler { return _hasHorizRuler; }
|
||||
- (NSSize)contentSize { return [_contentView bounds].size; }
|
||||
- (NSView*)contentView { return _contentView; }
|
||||
- (NSRulerView*)horizontalRulerView { return _horizRuler; }
|
||||
- (BOOL)hasVerticalRuler { return _hasVertRuler; }
|
||||
- (NSRulerView*)verticalRulerView { return _vertRuler; }
|
||||
- (BOOL)rulersVisible { return _rulersVisible; }
|
||||
- (void)setLineScroll:(float)aFloat { _lineScroll = aFloat; }
|
||||
- (float)lineScroll { return _lineScroll; }
|
||||
- (void)setPageScroll:(float)aFloat { _pageScroll = aFloat; }
|
||||
- (float)pageScroll { return _pageScroll; }
|
||||
- (BOOL)isOpaque { return YES; }
|
||||
- (NSBorderType)borderType { return _borderType; }
|
||||
- (NSScroller*)verticalScroller { return _vertScroller; }
|
||||
- (BOOL)hasVerticalScroller { return _hasVertScroller; }
|
||||
- (BOOL)hasHorizontalRuler { return _hasHorizRuler; }
|
||||
- (NSSize)contentSize { return [_contentView bounds].size; }
|
||||
- (NSView*)contentView { return _contentView; }
|
||||
- (NSRulerView*)horizontalRulerView { return _horizRuler; }
|
||||
- (BOOL)hasVerticalRuler { return _hasVertRuler; }
|
||||
- (NSRulerView*)verticalRulerView { return _vertRuler; }
|
||||
- (BOOL)rulersVisible { return _rulersVisible; }
|
||||
- (void)setLineScroll:(float)aFloat { _lineScroll = aFloat; }
|
||||
- (float)lineScroll { return _lineScroll; }
|
||||
- (void)setPageScroll:(float)aFloat { _pageScroll = aFloat; }
|
||||
- (float)pageScroll { return _pageScroll; }
|
||||
- (void)setScrollsDynamically:(BOOL)flag { _scrollsDynamically = flag; }
|
||||
- (BOOL)scrollsDynamically { return _scrollsDynamically; }
|
||||
- (NSScroller*)horizontalScroller { return _horizScroller; }
|
||||
- (BOOL)hasHorizontalScroller { return _hasHorizScroller; }
|
||||
- (BOOL)scrollsDynamically { return _scrollsDynamically; }
|
||||
- (NSScroller*)horizontalScroller { return _horizScroller; }
|
||||
- (BOOL)hasHorizontalScroller { return _hasHorizScroller; }
|
||||
|
||||
@end
|
||||
|
|
|
@ -67,6 +67,7 @@ static NSButtonCell* knobCell = nil;
|
|||
- (SEL)action { return _action; }
|
||||
- (void)setTarget:(id)target { ASSIGN(_target, target); }
|
||||
- (id)target { return _target; }
|
||||
- (BOOL)isOpaque { return YES; }
|
||||
|
||||
- initWithFrame:(NSRect)frameRect
|
||||
{
|
||||
|
|
|
@ -770,7 +770,10 @@ typedef enum
|
|||
-(void) setSelectedRange:(NSRange)range
|
||||
{ BOOL didLock=NO;
|
||||
|
||||
if([self window] && [[self class] focusView] != self)
|
||||
if(![self window])
|
||||
return;
|
||||
|
||||
if([[self class] focusView] != self)
|
||||
{ [self lockFocus];
|
||||
didLock=YES;
|
||||
}
|
||||
|
|
1592
Source/NSView.m
1592
Source/NSView.m
File diff suppressed because it is too large
Load diff
|
@ -424,8 +424,7 @@ NSRect n = frame; // center the window
|
|||
[self setFrame:n display:YES];
|
||||
}
|
||||
|
||||
- (NSRect)constrainFrameRect:(NSRect)frameRect
|
||||
toScreen:screen
|
||||
- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:screen
|
||||
{
|
||||
return NSZeroRect;
|
||||
}
|
||||
|
@ -501,13 +500,23 @@ NSPoint basePoint;
|
|||
{
|
||||
if (needs_display)
|
||||
{
|
||||
[[content_view superview] _displayNeededViews];
|
||||
[[content_view superview] displayIfNeeded];
|
||||
needs_display = NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)enableFlushWindow { disable_flush_window = NO; }
|
||||
- (void)flushWindow {} // implemented in back end
|
||||
- (void)update
|
||||
{
|
||||
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
|
||||
{
|
||||
|
@ -518,50 +527,14 @@ NSPoint basePoint;
|
|||
}
|
||||
}
|
||||
|
||||
- (void)_collectFlushRectangles
|
||||
{
|
||||
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];
|
||||
}
|
||||
|
||||
- (void)flushWindow {} // implemented in back end
|
||||
- (void)enableFlushWindow { disable_flush_window = NO; }
|
||||
- (BOOL)isAutodisplay { return is_autodisplay; }
|
||||
- (BOOL)isFlushWindowDisabled { return disable_flush_window; }
|
||||
- (void)setAutodisplay:(BOOL)flag { is_autodisplay = 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; }
|
||||
- (void)useOptimizedDrawing:(BOOL)flag { optimize_drawing = flag; }
|
||||
|
||||
- (BOOL)canStoreColor
|
||||
{
|
||||
|
@ -571,11 +544,7 @@ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (NSScreen *)deepestScreen
|
||||
{
|
||||
return [NSScreen deepestScreen];
|
||||
}
|
||||
|
||||
- (NSScreen *)deepestScreen { return [NSScreen deepestScreen];}
|
||||
- (NSWindowDepth)depthLimit { return depth_limit; }
|
||||
- (BOOL)hasDynamicDepthLimit { return dynamic_depth_limit; }
|
||||
- (NSScreen *)screen { return [NSScreen mainScreen]; }
|
||||
|
@ -756,10 +725,9 @@ NSApplication *theApp = [NSApplication sharedApplication];
|
|||
// Make responder the first
|
||||
first_responder = aResponder; // responder
|
||||
|
||||
// Notify responder that it
|
||||
[first_responder becomeFirstResponder]; // has become the first
|
||||
// responder
|
||||
return YES;
|
||||
[first_responder becomeFirstResponder]; // Notify responder that it
|
||||
// has become the first
|
||||
return YES; // responder
|
||||
}
|
||||
|
||||
- (NSPoint)mouseLocationOutsideOfEventStream
|
||||
|
@ -786,8 +754,7 @@ NSApplication *theApp = [NSApplication sharedApplication];
|
|||
dequeue:deqFlag];
|
||||
}
|
||||
|
||||
- (void)postEvent:(NSEvent *)event
|
||||
atStart:(BOOL)flag
|
||||
- (void)postEvent:(NSEvent *)event atStart:(BOOL)flag
|
||||
{
|
||||
[[NSApplication sharedApplication] postEvent:event atStart:flag];
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
Author: Scott Christley <scottc@net-community.com>
|
||||
Date: November 1997
|
||||
Author: Felipe A. Rodriguez <far@ix.netcom.com>
|
||||
Date: November 1998
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
|
@ -34,6 +36,7 @@
|
|||
//
|
||||
// The backend will have to fill in the implementation
|
||||
//
|
||||
- (BOOL)isOpaque { return YES; }
|
||||
|
||||
@end
|
||||
|
||||
|
|
Loading…
Reference in a new issue