mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 20:50:44 +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
e5a411f055
commit
37f59e1d8c
6 changed files with 992 additions and 751 deletions
|
@ -222,6 +222,22 @@
|
|||
[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
|
||||
{
|
||||
TIFF *image = NULL;
|
||||
|
|
|
@ -1386,35 +1386,38 @@
|
|||
|
||||
- (void)_adjustMatrixOfColumn: (int)column
|
||||
{
|
||||
NSBrowserColumn *bc;
|
||||
NSScrollView *sc;
|
||||
id matrix;
|
||||
NSSize cs, ms;
|
||||
NSRect mr;
|
||||
NSBrowserColumn *bc;
|
||||
NSScrollView *sc;
|
||||
id matrix;
|
||||
NSSize cs, ms;
|
||||
NSRect mr;
|
||||
|
||||
if (column >= (int)[_browserColumns count])
|
||||
return;
|
||||
if (column >= (int)[_browserColumns count])
|
||||
return;
|
||||
|
||||
bc = [_browserColumns objectAtIndex: column];
|
||||
sc = [bc columnScrollView];
|
||||
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];
|
||||
bc = [_browserColumns objectAtIndex: column];
|
||||
sc = [bc columnScrollView];
|
||||
matrix = [bc columnMatrix];
|
||||
|
||||
if (mr.size.height < cs.height) // matrix smaller than
|
||||
{ // scrollview's content
|
||||
mr.origin.y = cs.height; // view requires origin
|
||||
[matrix setFrame: mr]; // adjustment for it to
|
||||
} // appear at top
|
||||
// Adjust matrix to fit in scrollview if column has been loaded
|
||||
if (sc && matrix && [bc isLoaded])
|
||||
{
|
||||
cs = [sc contentSize];
|
||||
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
|
||||
|
@ -1499,7 +1502,8 @@ NSRect mr;
|
|||
NSRect matrixRect = {{0, 0}, {100, 100}};
|
||||
int i;
|
||||
|
||||
matrix = [[[_browserMatrixClass alloc] // create a new col matrix
|
||||
// create a new col matrix
|
||||
matrix = [[[_browserMatrixClass alloc]
|
||||
initWithFrame: matrixRect
|
||||
mode: NSListModeMatrix
|
||||
prototype: _browserCellPrototype
|
||||
|
@ -1513,7 +1517,8 @@ NSRect mr;
|
|||
[matrix setAction: @selector(doClick:)];
|
||||
[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];
|
||||
|
||||
// Now loop through the cells and load each one
|
||||
|
@ -1533,7 +1538,8 @@ NSRect mr;
|
|||
id oldm = [bc columnMatrix];
|
||||
NSRect matrixRect = {{0, 0}, {100, 100}};
|
||||
|
||||
matrix = [[[_browserMatrixClass alloc] // create a new col matrix
|
||||
// create a new col matrix
|
||||
matrix = [[[_browserMatrixClass alloc]
|
||||
initWithFrame: matrixRect
|
||||
mode: NSListModeMatrix
|
||||
prototype: _browserCellPrototype
|
||||
|
@ -1547,16 +1553,19 @@ NSRect mr;
|
|||
[matrix setAction: @selector(doClick:)];
|
||||
[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];
|
||||
|
||||
// Tell the delegate to create the rows
|
||||
[_browserDelegate browser: self createRowsForColumn: column
|
||||
inMatrix: matrix];
|
||||
[_browserDelegate browser: self
|
||||
createRowsForColumn: column
|
||||
inMatrix: matrix];
|
||||
}
|
||||
}
|
||||
|
||||
[bc setIsLoaded: YES];
|
||||
[self setNeedsDisplayInRect: [self frameOfColumn: column]];
|
||||
}
|
||||
|
||||
- (void)_unloadFromColumn: (int)column
|
||||
|
|
|
@ -268,10 +268,9 @@ static NSImage *highlight_image;
|
|||
control_view = controlView; // remember last view cell was drawn in
|
||||
if (cell_highlighted || cell_state) // temporary hack FAR FIX ME?
|
||||
{
|
||||
NSColor *white = [NSColor whiteColor];
|
||||
NSColor *backColor = [NSColor selectedControlColor];
|
||||
|
||||
[white set];
|
||||
// [_browserText setBackgroundColor: white];
|
||||
[backColor set];
|
||||
if (!_isLeaf)
|
||||
{
|
||||
image = _highlightBranchImage;
|
||||
|
@ -288,7 +287,6 @@ static NSImage *highlight_image;
|
|||
NSColor *backColor = [[controlView window] backgroundColor];
|
||||
|
||||
[backColor set];
|
||||
// [_browserText setBackgroundColor: backColor];
|
||||
if (!_isLeaf)
|
||||
{
|
||||
image = _branchImage;
|
||||
|
|
|
@ -442,7 +442,7 @@
|
|||
delegate: (id)anObject
|
||||
start: (int)selStart
|
||||
length: (int)selLength
|
||||
{ // preliminary FIX ME
|
||||
{
|
||||
if (!controlView || !textObject || !cell_font ||
|
||||
(cell_type != NSTextCellType))
|
||||
return;
|
||||
|
@ -450,10 +450,13 @@
|
|||
[[controlView window] makeFirstResponder: textObject];
|
||||
|
||||
[textObject setFrame: aRect];
|
||||
[textObject setAlignment: text_align];
|
||||
[textObject setText: [self stringValue]];
|
||||
[textObject setDelegate: anObject];
|
||||
[controlView addSubview: textObject];
|
||||
[controlView lockFocus];
|
||||
NSEraseRect(aRect);
|
||||
[controlView unlockFocus];
|
||||
[textObject display];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
/*
|
||||
/*
|
||||
NSImageRep.m
|
||||
|
||||
Abstract representation of an image.
|
||||
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Author: Adam Fedor <fedor@colorado.edu>
|
||||
Date: Feb 1996
|
||||
|
||||
|
||||
This file is part of the GNUstep Application Kit 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.
|
||||
|
||||
|
||||
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
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <gnustep/gui/config.h>
|
||||
#include <string.h>
|
||||
|
@ -130,7 +130,7 @@ static NSMutableArray* imageReps = NULL;
|
|||
NSString* ptype;
|
||||
Class rep = [imageReps objectAtIndex: i];
|
||||
if ([rep respondsToSelector: @selector(imagePasteboardTypes)]
|
||||
&& (ptype =
|
||||
&& (ptype =
|
||||
[pasteboard availableTypeFromArray: [rep imagePasteboardTypes]]))
|
||||
{
|
||||
NSData* data = [pasteboard dataForType: ptype];
|
||||
|
@ -143,13 +143,30 @@ static NSMutableArray* imageReps = NULL;
|
|||
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
|
||||
{
|
||||
[_colorSpace release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
// Checking Data Types
|
||||
// Checking Data Types
|
||||
+ (BOOL) canInitWithData: (NSData *)data
|
||||
{
|
||||
/* Subclass responsibility */
|
||||
|
@ -186,7 +203,7 @@ static NSMutableArray* imageReps = NULL;
|
|||
return nil;
|
||||
}
|
||||
|
||||
// Setting the Size of the Image
|
||||
// Setting the Size of the Image
|
||||
- (void) setSize: (NSSize)aSize
|
||||
{
|
||||
size = aSize;
|
||||
|
@ -197,7 +214,7 @@ static NSMutableArray* imageReps = NULL;
|
|||
return size;
|
||||
}
|
||||
|
||||
// Specifying Information about the Representation
|
||||
// Specifying Information about the Representation
|
||||
- (int) bitsPerSample
|
||||
{
|
||||
return bitsPerSample;
|
||||
|
@ -259,7 +276,7 @@ static NSMutableArray* imageReps = NULL;
|
|||
_pixelsHigh = anInt;
|
||||
}
|
||||
|
||||
// Drawing the Image
|
||||
// Drawing the Image
|
||||
- (BOOL) draw
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
@ -276,7 +293,7 @@ static NSMutableArray* imageReps = NULL;
|
|||
return NO;
|
||||
}
|
||||
|
||||
// Managing NSImageRep Subclasses
|
||||
// Managing NSImageRep Subclasses
|
||||
+ (Class) imageRepClassForData: (NSData *)data
|
||||
{
|
||||
int i, count;
|
||||
|
@ -328,10 +345,10 @@ static NSMutableArray* imageReps = NULL;
|
|||
+ (void) registerImageRepClass: (Class)imageRepClass
|
||||
{
|
||||
[imageReps addObject: imageRepClass];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSImageRepRegistryChangedNotification
|
||||
object: self];
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSArray *) registeredImageRepClasses
|
||||
{
|
||||
|
@ -341,7 +358,7 @@ static NSMutableArray* imageReps = NULL;
|
|||
+ (void) unregisterImageRepClass: (Class)imageRepClass
|
||||
{
|
||||
[imageReps removeObject: imageRepClass];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSImageRepRegistryChangedNotification
|
||||
object: self];
|
||||
}
|
||||
|
|
1598
Source/NSMatrix.m
1598
Source/NSMatrix.m
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue