Revision: 2596
http://skim-app.svn.sourceforge.net/skim-app/?rev=2596&view=rev
Author: hofman
Date: 2007-07-31 08:10:22 -0700 (Tue, 31 Jul 2007)
Log Message:
-----------
Change class of doucment because we have several document classes.
Modified Paths:
--------------
trunk/SKInfoWindowController.h
trunk/SKInfoWindowController.m
Modified: trunk/SKInfoWindowController.h
===================================================================
--- trunk/SKInfoWindowController.h 2007-07-31 13:24:48 UTC (rev 2595)
+++ trunk/SKInfoWindowController.h 2007-07-31 15:10:22 UTC (rev 2596)
@@ -38,7 +38,6 @@
#import <Cocoa/Cocoa.h>
[EMAIL PROTECTED] SKDocument;
@interface SKInfoWindowController : NSWindowController {
NSMutableDictionary *info;
@@ -49,8 +48,8 @@
- (NSDictionary *)info;
- (void)setInfo:(NSDictionary *)newInfo;
-- (NSDictionary *)infoForDocument:(SKDocument *)doc;
-- (void)fillInfoForDocument:(SKDocument *)doc;
+- (NSDictionary *)infoForDocument:(NSDocument *)doc;
+- (void)fillInfoForDocument:(NSDocument *)doc;
- (void)handleWindowDidBecomeKeyNotification:(NSNotification *)notification;
- (void)handleWindowDidResignKeyNotification:(NSNotification *)notification;
Modified: trunk/SKInfoWindowController.m
===================================================================
--- trunk/SKInfoWindowController.m 2007-07-31 13:24:48 UTC (rev 2595)
+++ trunk/SKInfoWindowController.m 2007-07-31 15:10:22 UTC (rev 2596)
@@ -161,32 +161,31 @@
return [NSString stringWithFormat:@"%.1f x %.1f %@ (%.1f x %.1f %@)",
size.width * factor, size.height * factor, units, altSize.width * factor,
altSize.height * factor, units];
}
-- (NSDictionary *)infoForDocument:(SKDocument *)doc {
- NSMutableDictionary *dictionary = nil;
- if ([doc respondsToSelector:@selector(pdfDocument)]) {
- PDFDocument *pdfDoc = [doc pdfDocument];
- dictionary = [NSMutableDictionary dictionary];
- [dictionary setDictionary:[pdfDoc documentAttributes]];
- if (doc) {
- unsigned long long logicalSize = 0, physicalSize = 0;
- [dictionary setValue:[[doc fileName] lastPathComponent]
forKey:@"FileName"];
- [dictionary setValue:[NSString stringWithFormat: @"%d.%d", [pdfDoc
majorVersion], [pdfDoc minorVersion]] forKey:@"Version"];
- [dictionary setValue:[NSNumber numberWithInt:[pdfDoc pageCount]]
forKey:@"PageCount"];
- [dictionary setValue:SKFileSizeStringForFileURL([doc fileURL],
&physicalSize, &logicalSize) forKey:@"FileSize"];
- if ([pdfDoc pageCount])
- [dictionary setValue:SKSizeString([[pdfDoc pageAtIndex:0]
boundsForBox:kPDFDisplayBoxCropBox].size, [[pdfDoc pageAtIndex:0]
boundsForBox:kPDFDisplayBoxMediaBox].size) forKey:@"PageSize"];
- [dictionary setValue:[NSNumber
numberWithUnsignedLongLong:physicalSize] forKey:@"PhysicalSize"];
- [dictionary setValue:[NSNumber
numberWithUnsignedLongLong:logicalSize] forKey:@"LogicalSize"];
- [dictionary setValue:[[dictionary valueForKey:@"Keywords"]
componentsJoinedByString:@"\n"] forKey:@"KeywordsString"];
- [dictionary setValue:[NSNumber numberWithBool:[pdfDoc
isEncrypted]] forKey:@"Encrypted"];
- [dictionary setValue:[NSNumber numberWithBool:[pdfDoc
allowsPrinting]] forKey:@"AllowsPrinting"];
- [dictionary setValue:[NSNumber numberWithBool:[pdfDoc
allowsCopying]] forKey:@"AllowsCopying"];
- }
+- (NSDictionary *)infoForDocument:(NSDocument *)doc {
+ NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
+ PDFDocument *pdfDoc;
+ unsigned long long logicalSize = 0, physicalSize = 0;
+
+ if ([doc respondsToSelector:@selector(pdfDocument)] && (pdfDoc =
[(SKDocument *)doc pdfDocument])) {
+ [dictionary addEntriesFromDictionary:[pdfDoc documentAttributes]];
+ [dictionary setValue:[NSString stringWithFormat: @"%d.%d", [pdfDoc
majorVersion], [pdfDoc minorVersion]] forKey:@"Version"];
+ [dictionary setValue:[NSNumber numberWithInt:[pdfDoc pageCount]]
forKey:@"PageCount"];
+ if ([pdfDoc pageCount])
+ [dictionary setValue:SKSizeString([[pdfDoc pageAtIndex:0]
boundsForBox:kPDFDisplayBoxCropBox].size, [[pdfDoc pageAtIndex:0]
boundsForBox:kPDFDisplayBoxMediaBox].size) forKey:@"PageSize"];
+ [dictionary setValue:[[dictionary valueForKey:@"Keywords"]
componentsJoinedByString:@"\n"] forKey:@"KeywordsString"];
+ [dictionary setValue:[NSNumber numberWithBool:[pdfDoc isEncrypted]]
forKey:@"Encrypted"];
+ [dictionary setValue:[NSNumber numberWithBool:[pdfDoc allowsPrinting]]
forKey:@"AllowsPrinting"];
+ [dictionary setValue:[NSNumber numberWithBool:[pdfDoc allowsCopying]]
forKey:@"AllowsCopying"];
}
+ [dictionary setValue:[[doc fileName] lastPathComponent]
forKey:@"FileName"];
+ [dictionary setValue:SKFileSizeStringForFileURL([doc fileURL],
&physicalSize, &logicalSize) forKey:@"FileSize"];
+ [dictionary setValue:[NSNumber numberWithUnsignedLongLong:physicalSize]
forKey:@"PhysicalSize"];
+ [dictionary setValue:[NSNumber numberWithUnsignedLongLong:logicalSize]
forKey:@"LogicalSize"];
+
return dictionary;
}
-- (void)fillInfoForDocument:(SKDocument *)doc {
+- (void)fillInfoForDocument:(NSDocument *)doc {
[self setInfo:[self infoForDocument:doc]];
}
@@ -199,7 +198,7 @@
}
- (void)handleWindowDidBecomeKeyNotification:(NSNotification *)notification {
- SKDocument *doc = (SKDocument *)[[[notification object] windowController]
document];
+ NSDocument *doc = [[[notification object] windowController] document];
[self setInfo:[self infoForDocument:doc]];
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit