* NSApplication.h added windows_need_update as autodisplay ivar.

* NSApplication.m in init set default for main_menu, windows_need_update.
	* NSApplication.m in run added support for OPENSTEP autodisplay mechanism.
	* NSApplication.m _eventMatchingMask: reformat.
	* NSApplication.m nextEventMatchingMask:untilDate:inMode:dequeue:
		move calls to _flushWindows to XDPS backend.
	* NSApplication.m implemented updateWindows.
	* NSApplication.m implemented setWindowsNeedUpdate:.
	* NSApplication.m setMainMenu: test for menu prior to release.
	* NSActionCell.m removed setState: method.
	* NSActionCell.m copyWithZone: optimized ivar copying.
	* NSButtonCell.m added _init and moved common defaults to this method.
	* NSButtonCell.m initImageCell: and initTextCell: minor optimizations.
	* NSButtonCell.m setAlternateTitle: optimize and use ASSIGN macro.
	* NSButtonCell.m setKeyEquivalent: remove [copy release].
	* NSButtonCell.m setKeyEquivalentFont:size: optimize.
	* NSButtonCell.m copyWithZone: optimized ivar copying where possible.
	* NSCell.m _init removed call to [super init].
	* NSCell.m initTextCell: removed duplicate default initializers.
	* NSCell.m setImage: rewrote to use ASSIGN macro.
	* NSCell.m setDoubleValue: rewrote to use ASSIGN macro.
	* NSCell.m setFloatValue: rewrote to use ASSIGN macro.
	* NSCell.m setIntValue: rewrote to use ASSIGN macro.
	* NSCell.m setStringValue: rewrote to use ASSIGN macro.
	* NSCell.m setFont: rewrote to use ASSIGN macro.
	* NSCell.m setRepresentedObject: rewrote to use ASSIGN macro.
	* NSCell.m copyWithZone: optimized ivar copying where possible.
	* NSClipView.m viewBoundsChanged: minor optimization.
	* NSClipView.m viewFrameChanged: minor optimization.
	* NSClipView.m scaleUnitSquareToSize: minor optimization.
	* NSClipView.m setBoundsOrigin: minor optimization.
	* NSClipView.m setBoundsSize: minor optimization.
	* NSClipView.m setFrameSize: minor optimization.
	* NSClipView.m setFrameOrigin: minor optimization.
	* NSClipView.m setFrame: minor optimization.
	* NSClipView.m translateOriginToPoint: minor optimization.
	* NSMatrix.m eliminate retain/release of selected cell via ASSIGN.
	* NSMatrix.m initWithFrame: remove duplicate setting of selected row and
		column.
	* NSMatrix.m removeColumn: rewrite so that col is removed before new
		selection is attempted (needed because selected cell is not retained).
	* NSMatrix.m removeRow: rewrite so that row is removed before new
		selection is attempted (needed because selected cell is not retained).
	* NSMatrix.m deselectAllCells per OS spec try to select a cell at end
		if empty selection is not allowed.
	* NSMatrix.m deselectSelectedCell set default selected row/col to 0.
	* NSMatrix.m mouseDown: optimize for new drawing behaviour.
	* NSMenu.m setSelectedCell: eliminate use of retain/release of selected
		cell via ASSIGN.
	* NSMenuItem.m copyWithZone: optimized ivar copying where possible.
	* NSMenuItem.m dealloc minor optimization.
	* NSMenuItem.m setTarget: minor optimization.
	* NSScroller.m trackScrollButtons: heavily optimized.
	* NSScroller.m sendAction: reimplemented to use sendAction: per spec also
		optimized.
	* NSText.m implemented init method.
	* NSText.m initWithFrame: fixed initialization of ivars which are released
		to retain.
	* NSText.m dealloc add release of retained ivars.
	* NSView.m dealloc add release of retained ivars.
	* NSView.m displayRect: and _addSubviewForNeedingDisplay reformatted code
		and rewrote comments.
	* NSWindow.m setFrame:display: rewrote for clarity.
	* NSWindow.m implemented update method per OPENSTEP spec.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2941 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
far 1998-08-30 16:06:47 +00:00
parent ada8279bee
commit 48b8e5aa73
14 changed files with 628 additions and 528 deletions

View file

@ -715,6 +715,7 @@ static NSRecursiveLock *gnustep_gui_nsview_lock = nil;
{ // preliminary implementation FIX ME
if(autoresizingMask == NSViewNotSizable) // view is not resizable
return;
if(autoresizingMask & NSViewWidthSizable) // width resizable?
{
frame.size.width = [super_view frame].size.width;
@ -724,6 +725,7 @@ static NSRecursiveLock *gnustep_gui_nsview_lock = nil;
if(autoresizingMask & NSViewMinXMargin)
frame.origin.x += [super_view frame].size.width - oldSize.width;
}
if(autoresizingMask & NSViewHeightSizable) // height resizable?
{
frame.size.height = [super_view frame].size.height;
@ -815,41 +817,44 @@ static NSRecursiveLock *gnustep_gui_nsview_lock = nil;
- (void)displayRect:(NSRect)rect
{
int i, count;
int i, count;
if (!boundsMatrix || !frameMatrix)
NSLog (@"warning: %@ %p has not have the PS matrices setup!",
NSStringFromClass(isa), self);
if (!boundsMatrix || !frameMatrix)
NSLog (@"warning: %@ %p has not have the PS matrices setup!",
NSStringFromClass(isa), self);
needs_display = NO;
needs_display = NO;
[self lockFocus];
[self drawRect:rect];
[window _setNeedsFlush];
[self lockFocus];
[self drawRect:rect];
[window _setNeedsFlush];
// [window _view:self needsFlushInRect:rect];
[self unlockFocus];
[self unlockFocus];
// Tell subviews to display
for (i = 0, count = [sub_views count]; i < count; ++i)
{
NSView* subview = [sub_views objectAtIndex:i];
NSRect subviewFrame = subview->frame;
NSRect intersection;
// If the subview is rotated compute its
// bounding rectangle and use this one
// instead of the subview's frame.
if ([subview->frameMatrix isRotated])
[subview->frameMatrix boundingRectFor:subviewFrame
result:&subviewFrame];
// Tell subviews to display
for (i = 0, count = [sub_views count]; i < count; ++i) {
NSView* subview = [sub_views objectAtIndex:i];
NSRect subviewFrame = subview->frame;
NSRect intersection;
/* If the subview is rotated compute its bounding rectangle and use this
one instead of the subview's frame. */
if ([subview->frameMatrix isRotated])
[subview->frameMatrix boundingRectFor:subviewFrame result:&subviewFrame];
/* Determine if the subview's frame intersects "rect"
so that we can display the subview. */
intersection = NSIntersectionRect (rect, subviewFrame);
if (intersection.origin.x || intersection.origin.y
|| intersection.size.width || intersection.size.height) {
/* Convert the intersection rectangle to the subview's coordinates */
intersection = [subview convertRect:intersection fromView:self];
[subview displayRect:intersection];
}
}
// Determine if the subview's frame
// intersects "rect" so that we can display
// the subview.
intersection = NSIntersectionRect (rect, subviewFrame);
if (intersection.origin.x || intersection.origin.y ||
intersection.size.width || intersection.size.height)
{ // Convert the intersection rectangle to
// the subview's coordinates
intersection = [subview convertRect:intersection fromView:self];
[subview displayRect:intersection];
}
}
}
- (void)displayRectIgnoringOpacity:(NSRect)aRect
@ -871,35 +876,35 @@ static NSRecursiveLock *gnustep_gui_nsview_lock = nil;
}
- (void)_addSubviewForNeedingDisplay:(NSView*)view
{
NSView* currentView;
{ // Add view to the list of
NSView* currentView; // sibling subviews that
// need display.
currentView = _subviewsThatNeedDisplay;
while (currentView) // do nothing if the view
{ // is already in self's
if (currentView == view) // list.
return;
currentView = currentView->_nextSiblingSubviewThatNeedsDisplay;
}
// view is not in the list of subviews that need display.
// Concatenate self's list of subviews that need display to
// the view's list of siblings subviews that need display.
/* Add view in the list of sibling subviews that need display. First
check if view is not already there. */
currentView = _subviewsThatNeedDisplay;
while (currentView) {
if (currentView == view)
return;
currentView = currentView->_nextSiblingSubviewThatNeedsDisplay;
}
// find the last element in the view's
currentView = view; // list of siblings that need display
while (currentView->_nextSiblingSubviewThatNeedsDisplay)
currentView = currentView->_nextSiblingSubviewThatNeedsDisplay;
/* view is not in the list of subviews that need display; add it.
To do this concatenate the "view"'s list of siblings to the list of
subviews. Find the last element in the "view"'s list of siblings and
assign to its _nextSiblingSubviewThatNeedsDisplay ivar the first element
of the subviews that need display list in self.
*/
currentView = view;
while (currentView->_nextSiblingSubviewThatNeedsDisplay)
currentView = currentView->_nextSiblingSubviewThatNeedsDisplay;
// link the lists by assigning to view's
// _nextSiblingSubviewThatNeedsDisplay ivar
// self's _subviewsThatNeedDisplay ivar.
currentView->_nextSiblingSubviewThatNeedsDisplay =_subviewsThatNeedDisplay;
_subviewsThatNeedDisplay = view;
currentView->_nextSiblingSubviewThatNeedsDisplay = _subviewsThatNeedDisplay;
_subviewsThatNeedDisplay = view;
/* Now add recursively do the same algorithm with self. This way we'll create
a subtree of views that need display inside the views hierarchy. */
if (super_view)
[super_view _addSubviewForNeedingDisplay:self];
// Add recursively using the same algorithm with
needs_display = YES; // self. This way we'll create a subtree of views
if (super_view) // that need display inside the views hierarchy.
[super_view _addSubviewForNeedingDisplay:self];
}
- (void)_removeSubviewFromViewsThatNeedDisplay:(NSView*)view
@ -935,7 +940,7 @@ static NSRecursiveLock *gnustep_gui_nsview_lock = nil;
{
needs_display = flag;
if (needs_display) {
// NSLog (@"NSView setNeedsDisplay:");
invalidatedRectangle = bounds;
[window _setNeedsDisplay];
@ -946,7 +951,6 @@ static NSRecursiveLock *gnustep_gui_nsview_lock = nil;
- (void)setNeedsDisplayInRect:(NSRect)rect
{
// NSLog (@"NSView setNeedsDisplayInRect:");
needs_display = YES;
invalidatedRectangle = NSUnionRect (invalidatedRectangle, rect);
[window _setNeedsDisplay];