mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 15:20:38 +00:00
Tidyup
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4033 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
80028023e4
commit
563c98aa8d
6 changed files with 992 additions and 751 deletions
|
@ -222,6 +222,22 @@
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (id) copyWithZone: (NSZone *)zone
|
||||||
|
{
|
||||||
|
NSBitmapImageRep *copy;
|
||||||
|
|
||||||
|
copy = (NSBitmapImageRep*)[super copyWithZone: zone];
|
||||||
|
|
||||||
|
copy->bytesPerRow = bytesPerRow;
|
||||||
|
copy->numColors = numColors;
|
||||||
|
copy->bitsPerPixel = bitsPerPixel;
|
||||||
|
copy->compression = compression;
|
||||||
|
copy->_isPlanar = _isPlanar;
|
||||||
|
copy->imagePlanes = 0;
|
||||||
|
copy->imageData = [imageData copy];
|
||||||
|
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
+ (BOOL) canInitWithData: (NSData *)data
|
+ (BOOL) canInitWithData: (NSData *)data
|
||||||
{
|
{
|
||||||
TIFF *image = NULL;
|
TIFF *image = NULL;
|
||||||
|
|
|
@ -1386,35 +1386,38 @@
|
||||||
|
|
||||||
- (void)_adjustMatrixOfColumn: (int)column
|
- (void)_adjustMatrixOfColumn: (int)column
|
||||||
{
|
{
|
||||||
NSBrowserColumn *bc;
|
NSBrowserColumn *bc;
|
||||||
NSScrollView *sc;
|
NSScrollView *sc;
|
||||||
id matrix;
|
id matrix;
|
||||||
NSSize cs, ms;
|
NSSize cs, ms;
|
||||||
NSRect mr;
|
NSRect mr;
|
||||||
|
|
||||||
if (column >= (int)[_browserColumns count])
|
if (column >= (int)[_browserColumns count])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bc = [_browserColumns objectAtIndex: column];
|
bc = [_browserColumns objectAtIndex: column];
|
||||||
sc = [bc columnScrollView];
|
sc = [bc columnScrollView];
|
||||||
matrix = [bc columnMatrix];
|
matrix = [bc columnMatrix];
|
||||||
// Adjust matrix to fit in scrollview
|
|
||||||
if (sc && matrix && [bc isLoaded]) // do it only if column has been loaded
|
|
||||||
{
|
|
||||||
cs = [sc contentSize];
|
|
||||||
ms = [matrix cellSize];
|
|
||||||
ms.width = cs.width;
|
|
||||||
[matrix setCellSize: ms];
|
|
||||||
mr = [matrix frame];
|
|
||||||
|
|
||||||
if (mr.size.height < cs.height) // matrix smaller than
|
// Adjust matrix to fit in scrollview if column has been loaded
|
||||||
{ // scrollview's content
|
if (sc && matrix && [bc isLoaded])
|
||||||
mr.origin.y = cs.height; // view requires origin
|
{
|
||||||
[matrix setFrame: mr]; // adjustment for it to
|
cs = [sc contentSize];
|
||||||
} // appear at top
|
ms = [matrix cellSize];
|
||||||
|
ms.width = cs.width;
|
||||||
|
[matrix setCellSize: ms];
|
||||||
|
mr = [matrix frame];
|
||||||
|
|
||||||
[sc setDocumentView: matrix];
|
// matrix smaller than scrollview's content
|
||||||
}
|
if (mr.size.height < cs.height)
|
||||||
|
{
|
||||||
|
// view requires origin adjustment for it to appear at top
|
||||||
|
mr.origin.y = cs.height;
|
||||||
|
[matrix setFrame: mr];
|
||||||
|
}
|
||||||
|
|
||||||
|
[sc setDocumentView: matrix];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)_adjustScrollerFrameOfColumn: (int)column force: (BOOL)flag
|
- (void)_adjustScrollerFrameOfColumn: (int)column force: (BOOL)flag
|
||||||
|
@ -1499,7 +1502,8 @@ NSRect mr;
|
||||||
NSRect matrixRect = {{0, 0}, {100, 100}};
|
NSRect matrixRect = {{0, 0}, {100, 100}};
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
matrix = [[[_browserMatrixClass alloc] // create a new col matrix
|
// create a new col matrix
|
||||||
|
matrix = [[[_browserMatrixClass alloc]
|
||||||
initWithFrame: matrixRect
|
initWithFrame: matrixRect
|
||||||
mode: NSListModeMatrix
|
mode: NSListModeMatrix
|
||||||
prototype: _browserCellPrototype
|
prototype: _browserCellPrototype
|
||||||
|
@ -1513,7 +1517,8 @@ NSRect mr;
|
||||||
[matrix setAction: @selector(doClick:)];
|
[matrix setAction: @selector(doClick:)];
|
||||||
[matrix setDoubleAction: @selector(doDoubleClick:)];
|
[matrix setDoubleAction: @selector(doDoubleClick:)];
|
||||||
|
|
||||||
[bc setColumnMatrix: matrix]; // set new col matrix and release old
|
// set new col matrix and release old
|
||||||
|
[bc setColumnMatrix: matrix];
|
||||||
[sc setDocumentView: matrix];
|
[sc setDocumentView: matrix];
|
||||||
|
|
||||||
// Now loop through the cells and load each one
|
// Now loop through the cells and load each one
|
||||||
|
@ -1533,7 +1538,8 @@ NSRect mr;
|
||||||
id oldm = [bc columnMatrix];
|
id oldm = [bc columnMatrix];
|
||||||
NSRect matrixRect = {{0, 0}, {100, 100}};
|
NSRect matrixRect = {{0, 0}, {100, 100}};
|
||||||
|
|
||||||
matrix = [[[_browserMatrixClass alloc] // create a new col matrix
|
// create a new col matrix
|
||||||
|
matrix = [[[_browserMatrixClass alloc]
|
||||||
initWithFrame: matrixRect
|
initWithFrame: matrixRect
|
||||||
mode: NSListModeMatrix
|
mode: NSListModeMatrix
|
||||||
prototype: _browserCellPrototype
|
prototype: _browserCellPrototype
|
||||||
|
@ -1547,16 +1553,19 @@ NSRect mr;
|
||||||
[matrix setAction: @selector(doClick:)];
|
[matrix setAction: @selector(doClick:)];
|
||||||
[matrix setDoubleAction: @selector(doDoubleClick:)];
|
[matrix setDoubleAction: @selector(doDoubleClick:)];
|
||||||
|
|
||||||
[bc setColumnMatrix: matrix]; // set new col matrix and release old
|
// set new col matrix and release old
|
||||||
|
[bc setColumnMatrix: matrix];
|
||||||
[sc setDocumentView: matrix];
|
[sc setDocumentView: matrix];
|
||||||
|
|
||||||
// Tell the delegate to create the rows
|
// Tell the delegate to create the rows
|
||||||
[_browserDelegate browser: self createRowsForColumn: column
|
[_browserDelegate browser: self
|
||||||
inMatrix: matrix];
|
createRowsForColumn: column
|
||||||
|
inMatrix: matrix];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[bc setIsLoaded: YES];
|
[bc setIsLoaded: YES];
|
||||||
|
[self setNeedsDisplayInRect: [self frameOfColumn: column]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)_unloadFromColumn: (int)column
|
- (void)_unloadFromColumn: (int)column
|
||||||
|
|
|
@ -268,10 +268,9 @@ static NSImage *highlight_image;
|
||||||
control_view = controlView; // remember last view cell was drawn in
|
control_view = controlView; // remember last view cell was drawn in
|
||||||
if (cell_highlighted || cell_state) // temporary hack FAR FIX ME?
|
if (cell_highlighted || cell_state) // temporary hack FAR FIX ME?
|
||||||
{
|
{
|
||||||
NSColor *white = [NSColor whiteColor];
|
NSColor *backColor = [NSColor selectedControlColor];
|
||||||
|
|
||||||
[white set];
|
[backColor set];
|
||||||
// [_browserText setBackgroundColor: white];
|
|
||||||
if (!_isLeaf)
|
if (!_isLeaf)
|
||||||
{
|
{
|
||||||
image = _highlightBranchImage;
|
image = _highlightBranchImage;
|
||||||
|
@ -288,7 +287,6 @@ static NSImage *highlight_image;
|
||||||
NSColor *backColor = [[controlView window] backgroundColor];
|
NSColor *backColor = [[controlView window] backgroundColor];
|
||||||
|
|
||||||
[backColor set];
|
[backColor set];
|
||||||
// [_browserText setBackgroundColor: backColor];
|
|
||||||
if (!_isLeaf)
|
if (!_isLeaf)
|
||||||
{
|
{
|
||||||
image = _branchImage;
|
image = _branchImage;
|
||||||
|
|
|
@ -442,7 +442,7 @@
|
||||||
delegate: (id)anObject
|
delegate: (id)anObject
|
||||||
start: (int)selStart
|
start: (int)selStart
|
||||||
length: (int)selLength
|
length: (int)selLength
|
||||||
{ // preliminary FIX ME
|
{
|
||||||
if (!controlView || !textObject || !cell_font ||
|
if (!controlView || !textObject || !cell_font ||
|
||||||
(cell_type != NSTextCellType))
|
(cell_type != NSTextCellType))
|
||||||
return;
|
return;
|
||||||
|
@ -450,10 +450,13 @@
|
||||||
[[controlView window] makeFirstResponder: textObject];
|
[[controlView window] makeFirstResponder: textObject];
|
||||||
|
|
||||||
[textObject setFrame: aRect];
|
[textObject setFrame: aRect];
|
||||||
|
[textObject setAlignment: text_align];
|
||||||
[textObject setText: [self stringValue]];
|
[textObject setText: [self stringValue]];
|
||||||
[textObject setDelegate: anObject];
|
[textObject setDelegate: anObject];
|
||||||
[controlView addSubview: textObject];
|
[controlView addSubview: textObject];
|
||||||
|
[controlView lockFocus];
|
||||||
NSEraseRect(aRect);
|
NSEraseRect(aRect);
|
||||||
|
[controlView unlockFocus];
|
||||||
[textObject display];
|
[textObject display];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
/*
|
/*
|
||||||
NSImageRep.m
|
NSImageRep.m
|
||||||
|
|
||||||
Abstract representation of an image.
|
Abstract representation of an image.
|
||||||
|
|
||||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Author: Adam Fedor <fedor@colorado.edu>
|
Author: Adam Fedor <fedor@colorado.edu>
|
||||||
Date: Feb 1996
|
Date: Feb 1996
|
||||||
|
|
||||||
This file is part of the GNUstep Application Kit Library.
|
This file is part of the GNUstep Application Kit Library.
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public
|
modify it under the terms of the GNU Library General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2 of the License, or (at your option) any later version.
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with this library; see the file COPYING.LIB.
|
License along with this library; see the file COPYING.LIB.
|
||||||
If not, write to the Free Software Foundation,
|
If not, write to the Free Software Foundation,
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gnustep/gui/config.h>
|
#include <gnustep/gui/config.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -130,7 +130,7 @@ static NSMutableArray* imageReps = NULL;
|
||||||
NSString* ptype;
|
NSString* ptype;
|
||||||
Class rep = [imageReps objectAtIndex: i];
|
Class rep = [imageReps objectAtIndex: i];
|
||||||
if ([rep respondsToSelector: @selector(imagePasteboardTypes)]
|
if ([rep respondsToSelector: @selector(imagePasteboardTypes)]
|
||||||
&& (ptype =
|
&& (ptype =
|
||||||
[pasteboard availableTypeFromArray: [rep imagePasteboardTypes]]))
|
[pasteboard availableTypeFromArray: [rep imagePasteboardTypes]]))
|
||||||
{
|
{
|
||||||
NSData* data = [pasteboard dataForType: ptype];
|
NSData* data = [pasteboard dataForType: ptype];
|
||||||
|
@ -143,13 +143,30 @@ static NSMutableArray* imageReps = NULL;
|
||||||
return (NSArray *)array;
|
return (NSArray *)array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (id) copyWithZone: (NSZone *)zone
|
||||||
|
{
|
||||||
|
NSImageRep *copy;
|
||||||
|
|
||||||
|
copy = (NSImageRep*)NSCopyObject(self, 0, zone);
|
||||||
|
|
||||||
|
copy->size = size;
|
||||||
|
copy->hasAlpha = hasAlpha;
|
||||||
|
copy->isOpaque = isOpaque;
|
||||||
|
copy->bitsPerSample = bitsPerSample;
|
||||||
|
copy->_pixelsWide = _pixelsWide;
|
||||||
|
copy->_pixelsHigh = _pixelsHigh;
|
||||||
|
copy->_colorSpace = RETAIN(_colorSpace);
|
||||||
|
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
[_colorSpace release];
|
[_colorSpace release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checking Data Types
|
// Checking Data Types
|
||||||
+ (BOOL) canInitWithData: (NSData *)data
|
+ (BOOL) canInitWithData: (NSData *)data
|
||||||
{
|
{
|
||||||
/* Subclass responsibility */
|
/* Subclass responsibility */
|
||||||
|
@ -186,7 +203,7 @@ static NSMutableArray* imageReps = NULL;
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setting the Size of the Image
|
// Setting the Size of the Image
|
||||||
- (void) setSize: (NSSize)aSize
|
- (void) setSize: (NSSize)aSize
|
||||||
{
|
{
|
||||||
size = aSize;
|
size = aSize;
|
||||||
|
@ -197,7 +214,7 @@ static NSMutableArray* imageReps = NULL;
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specifying Information about the Representation
|
// Specifying Information about the Representation
|
||||||
- (int) bitsPerSample
|
- (int) bitsPerSample
|
||||||
{
|
{
|
||||||
return bitsPerSample;
|
return bitsPerSample;
|
||||||
|
@ -259,7 +276,7 @@ static NSMutableArray* imageReps = NULL;
|
||||||
_pixelsHigh = anInt;
|
_pixelsHigh = anInt;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drawing the Image
|
// Drawing the Image
|
||||||
- (BOOL) draw
|
- (BOOL) draw
|
||||||
{
|
{
|
||||||
[self subclassResponsibility: _cmd];
|
[self subclassResponsibility: _cmd];
|
||||||
|
@ -276,7 +293,7 @@ static NSMutableArray* imageReps = NULL;
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Managing NSImageRep Subclasses
|
// Managing NSImageRep Subclasses
|
||||||
+ (Class) imageRepClassForData: (NSData *)data
|
+ (Class) imageRepClassForData: (NSData *)data
|
||||||
{
|
{
|
||||||
int i, count;
|
int i, count;
|
||||||
|
@ -328,10 +345,10 @@ static NSMutableArray* imageReps = NULL;
|
||||||
+ (void) registerImageRepClass: (Class)imageRepClass
|
+ (void) registerImageRepClass: (Class)imageRepClass
|
||||||
{
|
{
|
||||||
[imageReps addObject: imageRepClass];
|
[imageReps addObject: imageRepClass];
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
postNotificationName: NSImageRepRegistryChangedNotification
|
postNotificationName: NSImageRepRegistryChangedNotification
|
||||||
object: self];
|
object: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSArray *) registeredImageRepClasses
|
+ (NSArray *) registeredImageRepClasses
|
||||||
{
|
{
|
||||||
|
@ -341,7 +358,7 @@ static NSMutableArray* imageReps = NULL;
|
||||||
+ (void) unregisterImageRepClass: (Class)imageRepClass
|
+ (void) unregisterImageRepClass: (Class)imageRepClass
|
||||||
{
|
{
|
||||||
[imageReps removeObject: imageRepClass];
|
[imageReps removeObject: imageRepClass];
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
postNotificationName: NSImageRepRegistryChangedNotification
|
postNotificationName: NSImageRepRegistryChangedNotification
|
||||||
object: self];
|
object: self];
|
||||||
}
|
}
|
||||||
|
|
1598
Source/NSMatrix.m
1598
Source/NSMatrix.m
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue