Source/NSMatrix.m

Source/NSBox.m
Source/NSClipView.m
Source/NSTableView.m
Source/NSOutlineView.m


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@13276 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Pierre-Yves Rivaille 2002-03-31 15:46:19 +00:00
parent 464ac5b1c7
commit 558b911361
6 changed files with 115 additions and 15 deletions

View file

@ -1,3 +1,18 @@
2002-03-31 Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
* Source/NSMatrix.m :
Use integer coordinates for _cellSize when autoresizing.
* Source/NSBox.m ([NSBox -calcSizesAllowingNegative:])
(case NSAtBottom & case NSAtTop):
Use integer coordinates and small cosmetic changes.
* Source/NSOutlineView.m ([NSOutlineView -initWithCoder:]):
Bugfix.
* Source/NSClipView.m ([NSClipView -constrainScrollPoint:]):
Make sure the difference between old position and new position
is an integer vector.
* Source/NSTableView.m ([NSTableView -initWithCoder:]):
Bugfix.
2002-03-30 Adam Fedor <fedor@gnu.org>
* gui/Model/GMAppKit.m (-encodeWithModelArchiver:): Encode an

View file

@ -35,6 +35,8 @@
#include <AppKit/NSGraphics.h>
#include <AppKit/NSTextFieldCell.h>
#include <math.h>
@interface NSBox (Private)
- (NSRect) calcSizesAllowingNegative: (BOOL)aFlag;
@end
@ -531,6 +533,8 @@
NSSize titleSize = [_cell cellSize];
NSSize borderSize = _sizeForBorderType (_border_type);
float c;
float topMargin;
float topOffset;
// Add spacer around title
titleSize.width += 6;
@ -538,26 +542,39 @@
_border_rect = _bounds;
topMargin = ceil(titleSize.height / 2);
topOffset = titleSize.height - topMargin;
// Adjust by the title size
_border_rect.size.height -= titleSize.height / 2;
_border_rect.size.height -= topMargin;
// Add the offsets to the border rect
r.origin.x = _border_rect.origin.x + _offsets.width + borderSize.width;
r.origin.y = _border_rect.origin.y + _offsets.height + borderSize.height;
r.size.width = _border_rect.size.width - (2 * _offsets.width)
- (2 * borderSize.width);
r.size.height = _border_rect.size.height - (2 * _offsets.height)
- (2 * borderSize.height);
if (topOffset > _offsets.height)
{
r.origin.y = _border_rect.origin.y + _offsets.height + borderSize.height;
r.size.height = _border_rect.size.height - _offsets.height
- (2 * borderSize.height) - topOffset;
}
else
{
r.origin.y = _border_rect.origin.y + _offsets.height + borderSize.height;
r.size.height = _border_rect.size.height - (2 * _offsets.height)
- (2 * borderSize.height);
}
// Adjust by the title size
r.size.height -= (titleSize.height / 2) + borderSize.height;
// r.size.height -= titleSize.height + borderSize.height;
// center the title cell
c = (_border_rect.size.width - titleSize.width) / 2;
if (c < 0) c = 0;
_title_rect.origin.x = _border_rect.origin.x + c;
_title_rect.origin.y = _border_rect.origin.y + _border_rect.size.height
- (titleSize.height / 2);
- topMargin;
_title_rect.size = titleSize;
break;
@ -567,6 +584,8 @@
NSSize titleSize = [_cell cellSize];
NSSize borderSize = _sizeForBorderType (_border_type);
float c;
float bottomMargin;
float bottomOffset;
// Add spacer around title
titleSize.width += 6;
@ -574,22 +593,37 @@
_border_rect = _bounds;
bottomMargin = ceil(titleSize.height / 2);
bottomOffset = titleSize.height - bottomMargin;
// Adjust by the title size
_border_rect.origin.y += titleSize.height / 2;
_border_rect.size.height -= titleSize.height / 2;
_border_rect.origin.y += bottomMargin;
_border_rect.size.height -= bottomMargin;
// Add the offsets to the border rect
r.origin.x = _border_rect.origin.x + _offsets.width + borderSize.width;
r.origin.y = _border_rect.origin.y + _offsets.height + borderSize.height;
r.size.width = _border_rect.size.width - (2 * _offsets.width)
- (2 * borderSize.width);
r.size.height = _border_rect.size.height - (2 * _offsets.height)
- (2 * borderSize.height);
if (bottomOffset > _offsets.height)
{
r.origin.y = _border_rect.origin.y + bottomOffset + borderSize.height;
r.size.height = _border_rect.size.height - _offsets.height
- bottomOffset
- (2 * borderSize.height);
}
else
{
r.origin.y = _border_rect.origin.y + _offsets.height + borderSize.height;
r.size.height = _border_rect.size.height - (2 * _offsets.height)
- (2 * borderSize.height);
}
// Adjust by the title size
/*
r.origin.y += (titleSize.height / 2) + borderSize.height;
r.size.height -= (titleSize.height / 2) + borderSize.height;
*/
// center the title cell
c = (_border_rect.size.width - titleSize.width) / 2;
if (c < 0) c = 0;

View file

@ -34,6 +34,8 @@
#include <AppKit/NSGraphics.h>
#include <AppKit/PSOperators.h>
#include <math.h>
@class NSTableView;
/*
@ -230,6 +232,8 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
scrolling. Then, document view needs to redraw the remaining
areas. */
/* Common part - which is a first approx of what we could
copy... */
intersection = NSIntersectionRect (originalBounds, newBounds);
@ -399,10 +403,29 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
do the scrolling, the difference is an integer and so we can copy
the image translating it by an integer in device space - and not
by a float. */
/*
new = [self convertPoint: new toView: nil];
new.x = (int)new.x;
new.y = (int)new.y;
new = [self convertPoint: new fromView: nil];
*/
/*
We don't make it an integer this way anymore.
This is not needed when _copiesOnScroll is not set.
If _copiesOnScroll is set, we make sure the difference between old
position and new position is an integer so we can copy the image
easily.
*/
if (_copiesOnScroll)
{
new.x =
_bounds.origin.x +
(rint(new.x - _bounds.origin.x));
new.y =
_bounds.origin.y +
(rint(new.y - _bounds.origin.y));
}
return new;
}

View file

@ -51,6 +51,8 @@
#include <AppKit/NSApplication.h>
#include <AppKit/NSMatrix.h>
#include <math.h>
static NSNotificationCenter *nc;
#define STRICT 0
@ -199,8 +201,8 @@ static SEL getSel;
[self setFrame: frameRect];
if ((_numCols > 0) && (_numRows > 0))
_cellSize = NSMakeSize (frameRect.size.width/_numCols,
frameRect.size.height/_numRows);
_cellSize = NSMakeSize (rint(frameRect.size.width/_numCols),
rint(frameRect.size.height/_numRows));
else
_cellSize = NSMakeSize (DEFAULT_CELL_WIDTH, DEFAULT_CELL_HEIGHT);
@ -1671,6 +1673,8 @@ static SEL getSel;
for (j = 0; j < _numCols; j++)
{
NSSize tempSize = [_cells[i][j] cellSize];
tempSize.height = ceil(tempSize.height);
tempSize.width = ceil(tempSize.width);
if (tempSize.width > newSize.width)
{
newSize.width = tempSize.width;
@ -2790,6 +2794,7 @@ static SEL getSel;
}
change.height = change.height / nr;
_cellSize.height += change.height;
_cellSize.height = rint(_cellSize.height);
if (_cellSize.height < 0)
_cellSize.height = 0;
}
@ -2804,6 +2809,7 @@ static SEL getSel;
}
change.width = change.width / nc;
_cellSize.width += change.width;
_cellSize.width = rint(_cellSize.width);
if (_cellSize.width < 0)
_cellSize.width = 0;
}

View file

@ -794,6 +794,17 @@ static NSImage *unexpandable = nil;
[aDecoder decodeValueOfObjCType: @encode(float) at: &_indentationPerLevel];
_outlineTableColumn = [aDecoder decodeObject];
_itemDict = [NSMutableDictionary dictionary];
_items = [NSMutableArray array];
_expandedItems = [NSMutableArray array];
_levelOfItems = [NSMutableDictionary dictionary];
// Retain items
RETAIN(_items);
RETAIN(_expandedItems);
RETAIN(_itemDict);
RETAIN(_levelOfItems);
return self;
}

View file

@ -6379,7 +6379,18 @@ byExtendingSelection: (BOOL)flag
_selectedRow = -1;
_editedColumn = -1;
_editedRow = -1;
/*
[self tile];
NSLog(@"frame %@", NSStringFromRect([self frame]));
NSLog(@"dataSource %@", _dataSource);
if (_dataSource != nil)
{
[self setDataSource: _dataSource];
NSLog(@"dataSource set");
}
*/
}
else if (version == 2)
{