1997-08-05 21:50:10 +00:00
|
|
|
/*
|
1996-05-30 20:03:15 +00:00
|
|
|
NSScrollView.m
|
|
|
|
|
|
|
|
Copyright (C) 1996 Free Software Foundation, Inc.
|
|
|
|
|
1997-08-05 21:50:10 +00:00
|
|
|
Author: Ovidiu Predescu <ovidiu@net-community.com>
|
|
|
|
Date: July 1997
|
1998-10-15 12:04:53 +00:00
|
|
|
Author: Felipe A. Rodriguez <far@ix.netcom.com>
|
|
|
|
Date: October 1998
|
1999-03-09 05:30:15 +00:00
|
|
|
Author: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
1999-03-08 09:32:09 +00:00
|
|
|
Date: February 1999
|
1999-02-03 21:53:29 +00:00
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
This file is part of the GNUstep GUI Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
1999-02-03 21:53:29 +00:00
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
1997-08-05 21:50:10 +00:00
|
|
|
License along with this library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1997-09-23 22:43:24 +00:00
|
|
|
#include <gnustep/gui/config.h>
|
1997-08-22 18:38:38 +00:00
|
|
|
#include <math.h>
|
|
|
|
|
1997-08-05 21:50:10 +00:00
|
|
|
#include <AppKit/NSScroller.h>
|
|
|
|
#include <AppKit/NSClipView.h>
|
1997-02-18 00:29:25 +00:00
|
|
|
#include <AppKit/NSScrollView.h>
|
1999-02-22 00:41:22 +00:00
|
|
|
#include <AppKit/NSRulerView.h>
|
1997-10-09 22:55:31 +00:00
|
|
|
#include <AppKit/NSWindow.h>
|
1999-02-25 15:45:22 +00:00
|
|
|
#include <AppKit/PSOperators.h>
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
@implementation NSScrollView
|
|
|
|
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
//
|
|
|
|
// Class variables
|
|
|
|
//
|
1997-08-05 21:50:10 +00:00
|
|
|
static Class rulerViewClass = nil;
|
|
|
|
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
//
|
|
|
|
// Class methods
|
|
|
|
//
|
1999-02-03 21:53:29 +00:00
|
|
|
+ (void) initialize
|
|
|
|
{
|
|
|
|
if (self == [NSScrollView class])
|
|
|
|
{
|
|
|
|
NSDebugLog(@"Initialize NSScrollView class\n");
|
|
|
|
[self setVersion: 1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (void) setRulerViewClass: (Class)aClass
|
|
|
|
{
|
|
|
|
rulerViewClass = aClass;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (Class) rulerViewClass
|
|
|
|
{
|
|
|
|
return rulerViewClass;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSSize) contentSizeForFrameSize: (NSSize)frameSize
|
|
|
|
hasHorizontalScroller: (BOOL)hFlag
|
|
|
|
hasVerticalScroller: (BOOL)vFlag
|
|
|
|
borderType: (NSBorderType)borderType
|
|
|
|
{
|
|
|
|
NSSize size = frameSize;
|
|
|
|
|
|
|
|
// Substract 1 from the width and height of
|
|
|
|
// the line that separates the horizontal
|
|
|
|
// and vertical scroller from the clip view
|
|
|
|
if (hFlag)
|
|
|
|
{
|
|
|
|
size.height -= [NSScroller scrollerWidth];
|
|
|
|
size.height -= 1;
|
|
|
|
}
|
|
|
|
if (vFlag)
|
|
|
|
{
|
|
|
|
size.width -= [NSScroller scrollerWidth];
|
|
|
|
size.width -= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (borderType)
|
|
|
|
{
|
|
|
|
case NSNoBorder:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NSLineBorder:
|
|
|
|
size.width -= 2;
|
|
|
|
size.height -= 2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NSBezelBorder:
|
|
|
|
case NSGrooveBorder:
|
|
|
|
size.width -= 4;
|
|
|
|
size.height -= 4;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSSize) frameSizeForContentSize: (NSSize)contentSize
|
|
|
|
hasHorizontalScroller: (BOOL)hFlag
|
|
|
|
hasVerticalScroller: (BOOL)vFlag
|
|
|
|
borderType: (NSBorderType)borderType
|
|
|
|
{
|
|
|
|
NSSize size = contentSize;
|
|
|
|
|
|
|
|
// Add 1 to the width and height for the
|
|
|
|
// line that separates the horizontal and
|
|
|
|
// vertical scroller from the clip view.
|
|
|
|
if (hFlag)
|
|
|
|
{
|
|
|
|
size.height += [NSScroller scrollerWidth];
|
|
|
|
size.height += 1;
|
|
|
|
}
|
|
|
|
if (vFlag)
|
|
|
|
{
|
|
|
|
size.width += [NSScroller scrollerWidth];
|
|
|
|
size.width += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (borderType)
|
|
|
|
{
|
|
|
|
case NSNoBorder:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NSLineBorder:
|
|
|
|
size.width += 2;
|
|
|
|
size.height += 2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NSBezelBorder:
|
|
|
|
case NSGrooveBorder:
|
|
|
|
size.width += 4;
|
|
|
|
size.height += 4;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return size;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
//
|
|
|
|
// Instance methods
|
|
|
|
//
|
1999-03-30 13:59:35 +00:00
|
|
|
- (id) initWithFrame: (NSRect)rect
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
[super initWithFrame: rect];
|
|
|
|
[self setContentView: [[NSClipView new] autorelease]];
|
|
|
|
_lineScroll = 10;
|
|
|
|
_pageScroll = 10;
|
|
|
|
_borderType = NSBezelBorder;
|
|
|
|
_scrollsDynamically = YES;
|
|
|
|
[self tile];
|
|
|
|
|
|
|
|
return self;
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-03-30 13:59:35 +00:00
|
|
|
- (id) init
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
return [self initWithFrame: NSZeroRect];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) dealloc
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
[_contentView release];
|
|
|
|
|
|
|
|
[_horizScroller release];
|
|
|
|
[_vertScroller release];
|
|
|
|
[_horizRuler release];
|
|
|
|
[_vertRuler release];
|
|
|
|
|
|
|
|
[super dealloc];
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-03-30 13:59:35 +00:00
|
|
|
- (BOOL) isFlipped
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
1999-03-30 05:03:37 +00:00
|
|
|
- (void) setContentView: (NSClipView*)aView
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-03-08 09:32:09 +00:00
|
|
|
ASSIGN((id)_contentView, (id)aView);
|
1999-01-19 10:35:43 +00:00
|
|
|
[self addSubview: _contentView];
|
|
|
|
[_contentView setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
|
|
|
[self tile];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-01-19 10:35:43 +00:00
|
|
|
- (void) setHorizontalScroller: (NSScroller*)aScroller
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1999-01-19 10:35:43 +00:00
|
|
|
[_horizScroller removeFromSuperview];
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
// Do not add the scroller view to the subviews array yet;
|
1999-01-19 10:35:43 +00:00
|
|
|
// -setHasHorizontalScroller must be invoked first
|
|
|
|
ASSIGN(_horizScroller, aScroller);
|
1999-02-03 21:53:29 +00:00
|
|
|
if (_horizScroller)
|
1999-01-19 10:35:43 +00:00
|
|
|
{
|
|
|
|
[_horizScroller setAutoresizingMask: NSViewWidthSizable];
|
1999-02-03 21:53:29 +00:00
|
|
|
[_horizScroller setTarget: self];
|
|
|
|
[_horizScroller setAction: @selector(_doScroll:)];
|
1999-01-19 10:35:43 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setHasHorizontalScroller: (BOOL)flag
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
if (_hasHorizScroller == flag)
|
|
|
|
return;
|
1997-08-05 21:50:10 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
_hasHorizScroller = flag;
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
if (_hasHorizScroller)
|
|
|
|
{
|
|
|
|
if (!_horizScroller)
|
|
|
|
[self setHorizontalScroller: [[NSScroller new] autorelease]];
|
|
|
|
[self addSubview: _horizScroller];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
[_horizScroller removeFromSuperview];
|
1997-08-05 21:50:10 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
[self tile];
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
|
|
|
|
1999-01-19 10:35:43 +00:00
|
|
|
- (void) setVerticalScroller: (NSScroller*)aScroller
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-01-19 10:35:43 +00:00
|
|
|
[_vertScroller removeFromSuperview];
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
// Do not add the scroller view to the subviews array yet;
|
1999-01-19 10:35:43 +00:00
|
|
|
// -setHasVerticalScroller must be invoked first
|
|
|
|
ASSIGN(_vertScroller, aScroller);
|
1999-02-03 21:53:29 +00:00
|
|
|
if (_vertScroller)
|
1999-01-19 10:35:43 +00:00
|
|
|
{
|
|
|
|
[_vertScroller setAutoresizingMask: NSViewHeightSizable];
|
1999-02-03 21:53:29 +00:00
|
|
|
[_vertScroller setTarget: self];
|
|
|
|
[_vertScroller setAction: @selector(_doScroll:)];
|
1999-01-19 10:35:43 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setHasVerticalScroller: (BOOL)flag
|
|
|
|
{
|
|
|
|
if (_hasVertScroller == flag)
|
|
|
|
return;
|
|
|
|
|
|
|
|
_hasVertScroller = flag;
|
|
|
|
|
|
|
|
if (_hasVertScroller)
|
|
|
|
{
|
|
|
|
if (!_vertScroller)
|
|
|
|
{
|
|
|
|
[self setVerticalScroller: [[NSScroller new] autorelease]];
|
|
|
|
if (_contentView && ![_contentView isFlipped])
|
|
|
|
[_vertScroller setFloatValue: 1];
|
|
|
|
}
|
|
|
|
[self addSubview: _vertScroller];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
[_vertScroller removeFromSuperview];
|
|
|
|
|
|
|
|
[self tile];
|
|
|
|
}
|
|
|
|
|
1999-02-19 20:31:07 +00:00
|
|
|
- (void) _doScroll: (NSScroller*)scroller
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
|
|
|
float floatValue = [scroller floatValue];
|
|
|
|
NSRect clipViewBounds = [_contentView bounds];
|
|
|
|
NSScrollerPart hitPart = [scroller hitPart];
|
|
|
|
NSRect documentRect = [_contentView documentRect];
|
|
|
|
float amount = 0;
|
|
|
|
NSPoint point = clipViewBounds.origin;
|
|
|
|
|
|
|
|
NSDebugLog (@"_doScroll: float value = %f", floatValue);
|
|
|
|
|
|
|
|
// do nothing if scroller is unknown
|
|
|
|
if (scroller != _horizScroller && scroller != _vertScroller)
|
|
|
|
return;
|
|
|
|
|
|
|
|
_knobMoved = NO;
|
|
|
|
|
|
|
|
if (hitPart == NSScrollerKnob || hitPart == NSScrollerKnobSlot)
|
|
|
|
_knobMoved = YES;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//FIXME in a page scroll, amount should be the portion of the view that
|
|
|
|
// stays visible, not the one that disapears
|
|
|
|
if (hitPart == NSScrollerIncrementLine)
|
|
|
|
amount = _lineScroll;
|
|
|
|
else if (hitPart == NSScrollerIncrementPage)
|
|
|
|
amount = _pageScroll;
|
|
|
|
else if (hitPart == NSScrollerDecrementLine)
|
|
|
|
amount = -_lineScroll;
|
|
|
|
else if (hitPart == NSScrollerDecrementPage)
|
|
|
|
amount = -_pageScroll;
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_knobMoved) // button scrolling
|
|
|
|
{
|
|
|
|
if (scroller == _horizScroller)
|
|
|
|
{
|
|
|
|
point.x = clipViewBounds.origin.x + amount;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-03-14 10:58:59 +00:00
|
|
|
if (![_contentView isFlipped])
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
|
|
|
// If view is flipped
|
|
|
|
// reverse the scroll direction
|
|
|
|
amount = -amount;
|
|
|
|
}
|
|
|
|
NSDebugLog (@"increment/decrement: amount = %f, flipped = %d",
|
|
|
|
amount, [_contentView isFlipped]);
|
|
|
|
point.y = clipViewBounds.origin.y + amount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else // knob scolling
|
|
|
|
{
|
|
|
|
if (scroller == _horizScroller)
|
|
|
|
{
|
|
|
|
point.x = floatValue * (documentRect.size.width
|
1998-10-15 12:04:53 +00:00
|
|
|
- clipViewBounds.size.width);
|
1999-03-08 09:32:09 +00:00
|
|
|
point.x += documentRect.origin.x;
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (![_contentView isFlipped])
|
|
|
|
floatValue = 1 - floatValue;
|
|
|
|
point.y = floatValue * (documentRect.size.height
|
|
|
|
- clipViewBounds.size.height);
|
1999-03-08 09:32:09 +00:00
|
|
|
point.y += documentRect.origin.y;
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
[_contentView scrollToPoint: point];
|
1999-03-14 18:10:42 +00:00
|
|
|
[window update];
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) reflectScrolledClipView: (NSClipView*)aClipView
|
|
|
|
{
|
|
|
|
NSRect documentFrame = NSZeroRect;
|
|
|
|
NSRect clipViewBounds = NSZeroRect;
|
|
|
|
float floatValue;
|
|
|
|
float knobProportion;
|
|
|
|
id documentView;
|
|
|
|
|
|
|
|
if (aClipView != _contentView)
|
|
|
|
return;
|
|
|
|
|
|
|
|
NSDebugLog (@"reflectScrolledClipView:");
|
|
|
|
|
|
|
|
clipViewBounds = [_contentView bounds];
|
|
|
|
if ((documentView = [_contentView documentView]))
|
|
|
|
documentFrame = [documentView frame];
|
|
|
|
|
|
|
|
if (_hasVertScroller)
|
|
|
|
{
|
|
|
|
if (documentFrame.size.height <= clipViewBounds.size.height)
|
|
|
|
[_vertScroller setEnabled: NO];
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[_vertScroller setEnabled: YES];
|
1999-03-08 09:32:09 +00:00
|
|
|
knobProportion = clipViewBounds.size.height
|
|
|
|
/ documentFrame.size.height;
|
|
|
|
floatValue = (clipViewBounds.origin.y - documentFrame.origin.y)
|
|
|
|
/ (documentFrame.size.height - clipViewBounds.size.height);
|
1999-02-03 21:53:29 +00:00
|
|
|
if (![_contentView isFlipped])
|
|
|
|
floatValue = 1 - floatValue;
|
|
|
|
[_vertScroller setFloatValue: floatValue
|
|
|
|
knobProportion: knobProportion];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_hasHorizScroller)
|
|
|
|
{
|
|
|
|
if (documentFrame.size.width <= clipViewBounds.size.width)
|
|
|
|
[_horizScroller setEnabled: NO];
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[_horizScroller setEnabled: YES];
|
1999-03-08 09:32:09 +00:00
|
|
|
knobProportion = clipViewBounds.size.width
|
|
|
|
/ documentFrame.size.width;
|
|
|
|
floatValue = (clipViewBounds.origin.x - documentFrame.origin.x)
|
|
|
|
/ (documentFrame.size.width - clipViewBounds.size.width);
|
1999-02-03 21:53:29 +00:00
|
|
|
[_horizScroller setFloatValue: floatValue
|
|
|
|
knobProportion: knobProportion];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setHorizontalRulerView: (NSRulerView*)aRulerView // FIX ME
|
|
|
|
{
|
|
|
|
ASSIGN(_horizRuler, aRulerView);
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setHasHorizontalRuler: (BOOL)flag // FIX ME
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
if (_hasHorizRuler == flag)
|
|
|
|
return;
|
1998-10-15 12:04:53 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
_hasHorizRuler = flag;
|
|
|
|
}
|
1998-10-15 12:04:53 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setVerticalRulerView: (NSRulerView*)ruler // FIX ME
|
|
|
|
{
|
|
|
|
ASSIGN(_vertRuler, ruler);
|
|
|
|
}
|
1998-10-15 12:04:53 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setHasVerticalRuler: (BOOL)flag // FIX ME
|
|
|
|
{
|
|
|
|
if (_hasVertRuler == flag)
|
|
|
|
return;
|
1998-10-15 12:04:53 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
_hasVertRuler = flag;
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setRulersVisible: (BOOL)flag
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setFrame: (NSRect)rect
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
[super setFrame: rect];
|
|
|
|
[self tile];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setFrameSize: (NSSize)size
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
[super setFrameSize: size];
|
|
|
|
[self tile];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) tile
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
NSRect boundsRect = [self bounds];
|
|
|
|
NSSize contentSize = [isa contentSizeForFrameSize: boundsRect.size
|
|
|
|
hasHorizontalScroller: _hasHorizScroller
|
|
|
|
hasVerticalScroller: _hasVertScroller
|
|
|
|
borderType: _borderType];
|
|
|
|
float scrollerWidth = [NSScroller scrollerWidth];
|
|
|
|
NSRect contentRect = { NSZeroPoint, contentSize };
|
|
|
|
NSRect vertScrollerRect = NSZeroRect;
|
|
|
|
NSRect horizScrollerRect = NSZeroRect;
|
|
|
|
float borderThickness = 0;
|
|
|
|
|
|
|
|
switch ([self borderType])
|
|
|
|
{
|
|
|
|
case NSNoBorder:
|
|
|
|
break;
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
case NSLineBorder:
|
|
|
|
borderThickness = 1;
|
|
|
|
break;
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
case NSBezelBorder:
|
|
|
|
case NSGrooveBorder:
|
|
|
|
borderThickness = 2;
|
|
|
|
break;
|
|
|
|
}
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
contentRect.origin.x = borderThickness;
|
|
|
|
contentRect.origin.y = borderThickness;
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
if (_hasVertScroller)
|
|
|
|
{
|
|
|
|
vertScrollerRect.origin.x = boundsRect.origin.x + borderThickness;
|
|
|
|
vertScrollerRect.origin.y = boundsRect.origin.y + borderThickness;
|
|
|
|
vertScrollerRect.size.width = scrollerWidth;
|
|
|
|
vertScrollerRect.size.height =bounds.size.height - 2 * borderThickness;
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
contentRect.origin.x += scrollerWidth + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_hasHorizScroller)
|
|
|
|
{
|
|
|
|
horizScrollerRect.origin.x = contentRect.origin.x;
|
|
|
|
horizScrollerRect.origin.y = boundsRect.origin.y + borderThickness;
|
|
|
|
horizScrollerRect.size.width = contentRect.size.width;
|
|
|
|
horizScrollerRect.size.height = scrollerWidth;
|
|
|
|
|
1999-03-30 13:59:35 +00:00
|
|
|
if ([self isFlipped])
|
|
|
|
{
|
|
|
|
horizScrollerRect.origin.y += contentRect.size.height + 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
contentRect.origin.y += scrollerWidth + 1;
|
|
|
|
}
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
[_horizScroller setFrame: horizScrollerRect];
|
|
|
|
[_vertScroller setFrame: vertScrollerRect];
|
|
|
|
[_contentView setFrame: contentRect];
|
1999-02-19 20:31:07 +00:00
|
|
|
#if 1
|
|
|
|
// [_contentView viewFrameChanged: nil];
|
|
|
|
// update scroller
|
|
|
|
[self reflectScrolledClipView: (NSClipView*)_contentView];
|
|
|
|
#endif
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) drawRect: (NSRect)rect
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
{
|
1999-03-30 13:59:35 +00:00
|
|
|
NSGraphicsContext *ctxt = [NSGraphicsContext currentContext];
|
1999-02-03 21:53:29 +00:00
|
|
|
float scrollerWidth = [NSScroller scrollerWidth];
|
|
|
|
float horizLinePosition, horizLineLength = [self bounds].size.width;
|
|
|
|
float borderThickness = 0;
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
|
1999-02-15 12:50:49 +00:00
|
|
|
// fprintf (stderr,
|
|
|
|
// "NSScrollView drawRect: origin (%1.2f, %1.2f), size (%1.2f, %1.2f)\n",
|
|
|
|
// rect.origin.x, rect.origin.y,
|
|
|
|
// rect.size.width, rect.size.height);
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
|
1999-03-30 13:59:35 +00:00
|
|
|
DPSgsave(ctxt);
|
1999-02-03 21:53:29 +00:00
|
|
|
switch ([self borderType])
|
|
|
|
{
|
|
|
|
case NSNoBorder:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NSLineBorder:
|
|
|
|
borderThickness = 1;
|
1999-03-30 13:59:35 +00:00
|
|
|
NSFrameRect(rect);
|
1999-02-03 21:53:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NSBezelBorder:
|
|
|
|
borderThickness = 2;
|
1999-03-30 13:59:35 +00:00
|
|
|
NSDrawGrayBezel(rect, rect);
|
1999-02-03 21:53:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NSGrooveBorder:
|
|
|
|
borderThickness = 2;
|
1999-03-30 13:59:35 +00:00
|
|
|
NSDrawGroove(rect, rect);
|
1999-02-03 21:53:29 +00:00
|
|
|
break;
|
|
|
|
}
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
horizLinePosition = borderThickness;
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
|
1999-03-30 13:59:35 +00:00
|
|
|
DPSsetlinewidth(ctxt, 1);
|
|
|
|
DPSsetgray(ctxt, 0);
|
1999-02-03 21:53:29 +00:00
|
|
|
if (_hasVertScroller)
|
|
|
|
{
|
|
|
|
horizLinePosition = scrollerWidth + borderThickness;
|
|
|
|
horizLineLength -= scrollerWidth + 2 * borderThickness;
|
1999-03-30 13:59:35 +00:00
|
|
|
DPSmoveto(ctxt, horizLinePosition, borderThickness + 1);
|
|
|
|
DPSrlineto(ctxt, 0, [self bounds].size.height - 2 * borderThickness - 1);
|
|
|
|
DPSstroke(ctxt);
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
if (_hasHorizScroller)
|
|
|
|
{
|
1999-03-30 13:59:35 +00:00
|
|
|
float ypos = scrollerWidth + borderThickness + 1;
|
|
|
|
|
|
|
|
if ([self isFlipped])
|
|
|
|
ypos = [self bounds].size.height - ypos;
|
|
|
|
DPSmoveto(ctxt, horizLinePosition, ypos);
|
|
|
|
DPSrlineto(ctxt, horizLineLength - 1, 0);
|
|
|
|
DPSstroke(ctxt);
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
|
1999-03-30 13:59:35 +00:00
|
|
|
DPSgrestore(ctxt);
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (NSRect) documentVisibleRect
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
return [_contentView documentVisibleRect];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setBackgroundColor: (NSColor*)aColor
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
[_contentView setBackgroundColor: aColor];
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (NSColor*) backgroundColor
|
|
|
|
{
|
|
|
|
return [_contentView backgroundColor];
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setBorderType: (NSBorderType)borderType
|
|
|
|
{
|
|
|
|
_borderType = borderType;
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setDocumentView: (NSView*)aView
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
[_contentView setDocumentView: aView];
|
|
|
|
if (_contentView && ![_contentView isFlipped])
|
|
|
|
[_vertScroller setFloatValue: 1];
|
|
|
|
[self tile];
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) resizeSubviewsWithOldSize: (NSSize)oldSize
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
[super resizeSubviewsWithOldSize: oldSize];
|
|
|
|
[self tile];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (id) documentView
|
|
|
|
{
|
|
|
|
return [_contentView documentView];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSCursor*) documentCursor
|
|
|
|
{
|
|
|
|
return [_contentView documentCursor];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setDocumentCursor: (NSCursor*)aCursor
|
|
|
|
{
|
|
|
|
[_contentView setDocumentCursor: aCursor];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) isOpaque
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSBorderType) borderType
|
|
|
|
{
|
|
|
|
return _borderType;
|
|
|
|
}
|
|
|
|
|
1999-03-08 09:32:09 +00:00
|
|
|
- (BOOL) hasHorizontalRuler
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
1999-03-08 09:32:09 +00:00
|
|
|
return _hasHorizRuler;
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
1999-03-08 09:32:09 +00:00
|
|
|
- (BOOL) hasHorizontalScroller
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
1999-03-08 09:32:09 +00:00
|
|
|
return _hasHorizScroller;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) hasVerticalRuler
|
|
|
|
{
|
|
|
|
return _hasVertRuler;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) hasVerticalScroller
|
|
|
|
{
|
|
|
|
return _hasVertScroller;
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSSize) contentSize
|
|
|
|
{
|
|
|
|
return [_contentView bounds].size;
|
|
|
|
}
|
|
|
|
|
1999-03-30 05:03:37 +00:00
|
|
|
- (NSClipView*) contentView
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
|
|
|
return _contentView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSRulerView*) horizontalRulerView
|
|
|
|
{
|
|
|
|
return _horizRuler;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (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;
|
|
|
|
}
|
|
|
|
|
1999-03-08 09:32:09 +00:00
|
|
|
- (NSScroller*) verticalScroller
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
1999-03-08 09:32:09 +00:00
|
|
|
return _vertScroller;
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
1997-08-05 21:50:10 +00:00
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
@end
|