4
4
Document class & WindowController : This file is part of Preview
6
6
Copyright (C) 2003;2004 Fabien VALLON
7
2003,2004 Alcove ( http://www.alcove.com )
7
8
Additional copyrights here
9
Authors : Fabien VALLON <fabien.vallon@fr.alcove.com>
10
Authors : Fabien VALLON <fabien@sonappart.net>
12
13
This program is free software; you can redistribute it and/or
112
113
-(NSSize) _originalSize;
113
114
-(void) _setCurrentItem:(unsigned) tag;
114
115
-(unsigned) _currentItem;
115
- (void) _notifyDragScroll: (id)notification;
116
-(void) _notifyDragScroll: (id)notification;
117
-(void) _setIsAlpha:(BOOL) flag;
118
121
@implementation Document (Private)
129
132
imageSize = [imageView frame].size;
131
134
[imageView setFrameSize:[affineTransform transformSize:imageSize]];
137
[checkeredView setFrameSize:
138
[affineTransform transformSize:imageSize]];
141
[imageView setNeedsDisplay:YES];
254
275
if ( [[_image bestRepresentationForDevice:nil] hasAlpha] )
256
id view = [[CheckeredView alloc] initWithFrame: NSMakeRect(0,0,imageSize.width,imageSize.height)];
277
[self _setIsAlpha: YES];
278
checkeredView = [[CheckeredView alloc] initWithFrame: NSMakeRect(0,0,imageSize.width,imageSize.height)];
257
279
[imageView retain];
258
[scrollView setDocumentView: view];
259
[view addSubview:imageView ];
280
[scrollView setDocumentView: checkeredView];
281
[checkeredView addSubview:imageView ];
285
[self _setIsAlpha: NO];
262
289
[imageView setFrame:NSMakeRect(0,0,imageSize.width,imageSize.height)];
263
290
[imageView setImage:_image];
266
[scrollView setDocumentCursor: [[NSCursor alloc] initWithImage: [NSImage imageNamed: @"hand"]
267
hotSpot: NSZeroPoint]];
292
int test = [imageView addTrackingRect:[imageView bounds]
269
297
[window setContentSize:contentSize];
270
298
[window setFrameOrigin: NSMakePoint(100,120)];
275
303
selector: @selector(_notifyDragScroll:)
277
305
object: imageView];
307
[[NSNotificationCenter defaultCenter] addObserver: self
308
selector: @selector(_notifyMouseDown:)
312
[[NSNotificationCenter defaultCenter] addObserver: self
313
selector: @selector(_notifyMouseUp:)
457
496
newSize.width = [scrollView contentSize].width;
458
497
newSize.height = [scrollView contentSize].height;
459
[[scrollView documentView] setAutoresizingMask: (NSViewWidthSizable | NSViewHeightSizable)];
460
if ( [[_image bestRepresentationForDevice:nil] hasAlpha] )
461
[imageView setAutoresizingMask: (NSViewWidthSizable|NSViewHeightSizable)];
498
[imageView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
499
if ( [self _isAlpha] )
502
[checkeredView setAutoresizingMask:
503
(NSViewWidthSizable|NSViewHeightSizable)];
465
507
newSize.width = [scrollView contentSize].width;
466
508
newSize.height = [imageView frame].size.height;
467
[[scrollView documentView] setAutoresizingMask: (NSViewWidthSizable)];
468
if ( [[_image bestRepresentationForDevice:nil] hasAlpha] )
469
[imageView setAutoresizingMask: NSViewWidthSizable];
509
[imageView setAutoresizingMask: (NSViewWidthSizable)];
510
if ( [self _isAlpha] )
511
[checkeredView setAutoresizingMask: NSViewWidthSizable];
472
514
printf("problem resize default \n");
475
[[scrollView documentView] setFrame: NSMakeRect(0,0,newSize.width,newSize.height)];
476
if ( [[_image bestRepresentationForDevice:nil] hasAlpha] )
477
[imageView setFrame:NSMakeRect(0,0,newSize.width,newSize.height) ];
518
//set autoresizing Mask
479
519
if ( tag < FIT_WINDOW )
481
[[scrollView documentView] setAutoresizingMask: (NSViewNotSizable)];
482
if ( [[_image bestRepresentationForDevice:nil] hasAlpha] )
483
[imageView setAutoresizingMask: NSViewNotSizable];
521
if ( [self _isAlpha] )
522
[checkeredView setAutoresizingMask: NSViewNotSizable];
524
[imageView setAutoresizingMask: NSViewNotSizable];
529
if ( [self _isAlpha] )
531
[checkeredView setFrame:NSMakeRect(0,0,newSize.width,newSize.height) ];
534
NSLog(@"apres newSize %@",NSStringFromSize(newSize));
536
[imageView setFrame: NSMakeRect(0,0,newSize.width,newSize.height)];
538
// why TODO FIXME !!! only need with FIT_WINDOW
539
[imageView setNeedsDisplay:YES];
540
[checkeredView setNeedsDisplay:YES];
486
541
[self _setCurrentItem: tag];