Revision: 5529
http://skim-app.svn.sourceforge.net/skim-app/?rev=5529&view=rev
Author: hofman
Date: 2009-08-10 15:10:39 +0000 (Mon, 10 Aug 2009)
Log Message:
-----------
Allow per-page transitions for presentations.
Use a conditional master-detail interface in the options sheet, with a table
displaying the pages using the thumbnails from the main window, controlled
through bindings. The array of transitions are saved in the EAs. Make changes
to the transitions undoable, both locally in the transition sheet and for the
document.
Modified Paths:
--------------
trunk/English.lproj/TransitionSheet.nib/classes.nib
trunk/English.lproj/TransitionSheet.nib/info.nib
trunk/English.lproj/TransitionSheet.nib/keyedobjects.nib
trunk/SKMainWindowController.h
trunk/SKMainWindowController.m
trunk/SKMainWindowController_Actions.m
trunk/SKPDFDocument.m
trunk/SKPDFView.m
trunk/SKPresentationOptionsSheetController.h
trunk/SKPresentationOptionsSheetController.m
trunk/SKTransitionController.h
trunk/SKTransitionController.m
trunk/Skim.xcodeproj/project.pbxproj
Added Paths:
-----------
trunk/SKTransitionInfo.h
trunk/SKTransitionInfo.m
Modified: trunk/English.lproj/TransitionSheet.nib/classes.nib
===================================================================
--- trunk/English.lproj/TransitionSheet.nib/classes.nib 2009-08-10 15:02:14 UTC
(rev 5528)
+++ trunk/English.lproj/TransitionSheet.nib/classes.nib 2009-08-10 15:10:39 UTC
(rev 5529)
@@ -5,6 +5,22 @@
<key>IBClasses</key>
<array>
<dict>
+ <key>CLASS</key>
+ <string>NSApplication</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSResponder</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>SKThumbnailTableView</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>SKTableView</string>
+ </dict>
+ <dict>
<key>ACTIONS</key>
<dict>
<key>dismiss</key>
@@ -24,19 +40,19 @@
</dict>
<dict>
<key>CLASS</key>
- <string>NSWindowController</string>
+ <string>NSMenu</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
- <string>NSResponder</string>
+ <string>NSObject</string>
</dict>
<dict>
<key>CLASS</key>
- <string>NSMenu</string>
+ <string>NSWindowController</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
- <string>NSObject</string>
+ <string>NSResponder</string>
</dict>
<dict>
<key>ACTIONS</key>
@@ -67,6 +83,14 @@
</dict>
<dict>
<key>CLASS</key>
+ <string>SKCenteredTextFieldCell</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSTextFieldCell</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
<string>NSWindow</string>
<key>LANGUAGE</key>
<string>ObjC</string>
@@ -75,13 +99,29 @@
</dict>
<dict>
<key>CLASS</key>
+ <string>NSScrollView</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSView</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
<string>SKPresentationOptionsSheetController</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>OUTLETS</key>
<dict>
+ <key>arrayController</key>
+ <string>NSArrayController</string>
<key>notesDocumentPopUpButton</key>
<string>NSPopUpButton</string>
+ <key>objectController</key>
+ <string>NSObjectController</string>
+ <key>separateCheckButton</key>
+ <string>NSButton</string>
+ <key>tableView</key>
+ <string>SKThumbnailTableView</string>
<key>transitionDurationField</key>
<string>NSTextField</string>
<key>transitionDurationSlider</key>
@@ -96,6 +136,14 @@
</dict>
<dict>
<key>CLASS</key>
+ <string>NSImageCell</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSCell</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
<string>NSView</string>
<key>LANGUAGE</key>
<string>ObjC</string>
@@ -127,7 +175,28 @@
<string>NSObject</string>
</dict>
<dict>
+ <key>ACTIONS</key>
+ <dict>
+ <key>copy</key>
+ <string>id</string>
+ <key>delete</key>
+ <string>id</string>
+ <key>paste</key>
+ <string>id</string>
+ <key>scrollToBeginningOfDocument</key>
+ <string>id</string>
+ <key>scrollToEndOfDocument</key>
+ <string>id</string>
+ </dict>
<key>CLASS</key>
+ <string>SKTableView</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSTableView</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
<string>NSResponder</string>
<key>LANGUAGE</key>
<string>ObjC</string>
Modified: trunk/English.lproj/TransitionSheet.nib/info.nib
===================================================================
--- trunk/English.lproj/TransitionSheet.nib/info.nib 2009-08-10 15:02:14 UTC
(rev 5528)
+++ trunk/English.lproj/TransitionSheet.nib/info.nib 2009-08-10 15:10:39 UTC
(rev 5529)
@@ -13,7 +13,7 @@
<integer>67</integer>
</array>
<key>IBSystem Version</key>
- <string>9F33</string>
+ <string>9L30</string>
<key>targetFramework</key>
<string>IBCocoaFramework</string>
</dict>
Modified: trunk/English.lproj/TransitionSheet.nib/keyedobjects.nib
===================================================================
(Binary files differ)
Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h 2009-08-10 15:02:14 UTC (rev 5528)
+++ trunk/SKMainWindowController.h 2009-08-10 15:10:39 UTC (rev 5529)
@@ -66,7 +66,7 @@
@class PDFAnnotation, SKPDFOutline, PDFSelection, SKThumbnail,
SKGroupedSearchResult;
@class SKPDFView, SKSecondaryPDFView, SKTocOutlineView, SKNoteOutlineView,
SKThumbnailTableView, SKSplitView, BDSKCollapsibleView, BDSKEdgeView,
BDSKGradientView, SKColorSwatch, SKStatusBar;
-...@class SKFullScreenWindow, SKNavigationWindow, SKSideWindow,
SKSnapshotWindowController, SKProgressController, SKPageSheetController,
SKScaleSheetController, SKPasswordSheetController, SKBookmarkSheetController;
+...@class SKFullScreenWindow, SKNavigationWindow, SKSideWindow,
SKSnapshotWindowController, SKProgressController, SKPageSheetController,
SKScaleSheetController, SKPasswordSheetController, SKBookmarkSheetController,
SKPresentationOptionsSheetController;
@interface SKMainWindowController : NSWindowController {
IBOutlet SKSplitView *splitView;
@@ -189,6 +189,8 @@
SKProgressController *progressController;
+ SKPresentationOptionsSheetController *presentationSheetController;
+
NSButton *colorAccessoryView;
NSButton *textColorAccessoryView;
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2009-08-10 15:02:14 UTC (rev 5528)
+++ trunk/SKMainWindowController.m 2009-08-10 15:10:39 UTC (rev 5529)
@@ -1214,7 +1214,6 @@
[groupedSearchResults removeObjectAtIndex:theIndex];
}
-
- (NSDictionary *)presentationOptions {
SKTransitionController *transitions = [pdfView transitionController];
SKAnimationTransitionStyle style = [transitions transitionStyle];
@@ -1235,12 +1234,14 @@
NSString *styleName = [dictionary objectForKey:@"styleName"];
NSNumber *duration = [dictionary objectForKey:@"duration"];
NSNumber *shouldRestrict = [dictionary objectForKey:@"shouldRestrict"];
+ NSArray *pageTransitions = [dictionary objectForKey:@"pageTransitions"];
if (styleName)
[transitions setTransitionStyle:[SKTransitionController
styleForName:styleName]];
if (duration)
[transitions setDuration:[duration floatValue]];
if (shouldRestrict)
[transitions setShouldRestrict:[shouldRestrict boolValue]];
+ [transitions setPageTransitions:pageTransitions];
}
- (NSArray *)tags {
@@ -2576,7 +2577,7 @@
}
- (BOOL)generateImageForThumbnail:(SKThumbnail *)thumbnail {
- if (mwcFlags.isAnimating || [thumbnailTableView isScrolling] || [[pdfView
document] isLocked])
+ if (mwcFlags.isAnimating || [thumbnailTableView isScrolling] || [[pdfView
document] isLocked] || [presentationSheetController isScrolling])
return NO;
[self performSelector:@selector(makeImageForThumbnail:)
withObject:thumbnail afterDelay:0.0];
return YES;
Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m 2009-08-10 15:02:14 UTC (rev
5528)
+++ trunk/SKMainWindowController_Actions.m 2009-08-10 15:10:39 UTC (rev
5529)
@@ -973,24 +973,13 @@
}
- (void)presentationSheetDidEnd:(SKPresentationOptionsSheetController
*)controller returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo {
- if (returnCode == NSOKButton) {
- SKTransitionController *transitions = [pdfView transitionController];
- [transitions setTransitionStyle:[controller transitionStyle]];
- [transitions setDuration:[controller duration]];
- [transitions setShouldRestrict:[controller shouldRestrict]];
- [(SKPDFDocument *)[self document]
setPresentationNotesDocument:[controller notesDocument]];
- }
+ [presentationSheetController release];
+ presentationSheetController = nil;
}
- (IBAction)chooseTransition:(id)sender {
- SKPresentationOptionsSheetController *presentationSheetController =
[[[SKPresentationOptionsSheetController alloc] initForDocument:(SKPDFDocument
*)[self document]] autorelease];
+ presentationSheetController = [[SKPresentationOptionsSheetController
alloc] initForDocument:(SKPDFDocument *)[self document]];
- SKTransitionController *transitions = [pdfView transitionController];
- [presentationSheetController setTransitionStyle:[transitions
transitionStyle]];
- [presentationSheetController setDuration:[transitions duration]];
- [presentationSheetController setShouldRestrict:[transitions
shouldRestrict]];
- [presentationSheetController setNotesDocument:[(SKPDFDocument *)[self
document] presentationNotesDocument]];
-
[presentationSheetController beginSheetModalForWindow: [self window]
modalDelegate: self
didEndSelector:
@selector(presentationSheetDidEnd:returnCode:contextInfo:)
Modified: trunk/SKPDFDocument.m
===================================================================
--- trunk/SKPDFDocument.m 2009-08-10 15:02:14 UTC (rev 5528)
+++ trunk/SKPDFDocument.m 2009-08-10 15:10:39 UTC (rev 5529)
@@ -168,6 +168,8 @@
[printInfo release];
}
+ [[self undoManager] disableUndoRegistration];
+
[mainController setPdfDocument:pdfDocument];
[self setPDFDoc:nil];
@@ -184,6 +186,8 @@
[mainController setOpenMetaRating:openMetaRating];
[self setOpenMetaRating:0.0];
+ [[self undoManager] enableUndoRegistration];
+
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self
forKey:SKAutoCheckFileUpdateKey
context:&SKPDFDocumentDefaultsObservationContext];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleWindowWillCloseNotification:)
name:NSWindowWillCloseNotification object:[mainController window]];
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2009-08-10 15:02:14 UTC (rev 5528)
+++ trunk/SKPDFView.m 2009-08-10 15:10:39 UTC (rev 5529)
@@ -713,13 +713,12 @@
- (void)animateTransitionForNextPage:(BOOL)next {
NSUInteger idx = [[self currentPage] pageIndex];
- BOOL shouldAnimate = [transitionController pageTransitions] || [[[self
currentPage] label] isEqualToString:[[[self document] pageAtIndex:next ? ++idx
: --idx] label]] == NO;
+ NSUInteger toIdx = (next ? idx + 1 : idx - 1);
+ BOOL shouldAnimate = [transitionController pageTransitions] || [[[self
currentPage] label] isEqualToString:[[[self document] pageAtIndex:toIdx]
label]] == NO;
NSRect rect;
if (shouldAnimate) {
- if (next == NO) idx--;
- NSDictionary *info = idx < [[transitionController pageTransitions]
count] ? [[transitionController pageTransitions] objectAtIndex:idx] : nil;
rect = [self convertRect:[[self currentPage] boundsForBox:[self
displayBox]] fromPage:[self currentPage]];
- [[self transitionController] prepareAnimation:info forRect:rect];
+ [[self transitionController] prepareAnimationForRect:rect from:idx
to:toIdx];
}
if (next)
[super goToNextPage:self];
Modified: trunk/SKPresentationOptionsSheetController.h
===================================================================
--- trunk/SKPresentationOptionsSheetController.h 2009-08-10 15:02:14 UTC
(rev 5528)
+++ trunk/SKPresentationOptionsSheetController.h 2009-08-10 15:10:39 UTC
(rev 5529)
@@ -40,7 +40,7 @@
#import "SKSheetController.h"
#import "SKTransitionController.h"
-...@class SKPDFDocument;
+...@class SKPDFDocument, SKThumbnail, SKTransitionInfo, SKThumbnailTableView;
@interface SKPresentationOptionsSheetController : SKSheetController {
IBOutlet NSPopUpButton *transitionStylePopUpButton;
@@ -48,23 +48,38 @@
IBOutlet NSSlider *transitionDurationSlider;
IBOutlet NSMatrix *transitionExtentMatrix;
IBOutlet NSPopUpButton *notesDocumentPopUpButton;
+ IBOutlet SKThumbnailTableView *tableView;
+ IBOutlet NSButton *separateCheckButton;
+ IBOutlet NSObjectController *objectController;
+ IBOutlet NSArrayController *arrayController;
+ BOOL separate;
+ SKTransitionInfo *transition;
+ NSArray *transitions;
SKPDFDocument *document;
+ NSUndoManager *undoManager;
}
- (id)initForDocument:(SKPDFDocument *)aDocument;
- (SKPDFDocument *)document;
-- (SKAnimationTransitionStyle)transitionStyle;
-- (void)setTransitionStyle:(SKAnimationTransitionStyle)style;
+- (BOOL)separate;
+- (void)setSeparate:(BOOL)newSeparate;
-- (CGFloat)duration;
-- (void)setDuration:(CGFloat)newDuration;
+- (SKTransitionInfo *)transition;
-- (BOOL)shouldRestrict;
-- (void)setShouldRestrict:(BOOL)flag;
+- (NSArray *)transitions;
+- (void)setTransitions:(NSArray *)newTransitions;
+- (NSArray *)pageTransitions;
+
- (SKPDFDocument *)notesDocument;
-- (void)setNotesDocument:(SKPDFDocument *)newNotesDocument;
+- (BOOL)isScrolling;
+
+- (NSUndoManager *)undoManager;
+
+- (void)startObservingTransitions:(NSArray *)infos;
+- (void)stopObservingTransitions:(NSArray *)infos;
+
@end
Modified: trunk/SKPresentationOptionsSheetController.m
===================================================================
--- trunk/SKPresentationOptionsSheetController.m 2009-08-10 15:02:14 UTC
(rev 5528)
+++ trunk/SKPresentationOptionsSheetController.m 2009-08-10 15:10:39 UTC
(rev 5529)
@@ -40,19 +40,51 @@
#import <Quartz/Quartz.h>
#import "SKPDFDocument.h"
#import "SKDocumentController.h"
+#import "SKTransitionInfo.h"
+#import "SKThumbnail.h"
+#import "SKThumbnailTableView.h"
+#import "SKTypeSelectHelper.h"
+#import "SKMainWindowController.h"
+#import "SKPDFView.h"
+#import "SKPDFToolTipWindow.h"
+#define PAGE_COLUMNID @"page"
+#define IMAGE_COLUMNID @"image"
+#define TRANSITIONSTYLE_KEY @"transitionStyle"
+#define DURATION_KEY @"duration"
+#define SHOULDRESTRICT_KEY @"shouldRestrict"
+#define CONTENTOBJECT_BINDINGNAME @"contentObject"
+
+static NSString *SKTransitionPboardType = @"SKTransitionPboardType";
+
+static char *SKTransitionPropertiesObservationContext;
+
@implementation SKPresentationOptionsSheetController
- (id)initForDocument:(SKPDFDocument *)aDocument {
if (self = [super init]) {
document = aDocument;
+ separate = NO;
+ transition = [[SKTransitionInfo alloc] init];
+ transitions = nil;
+
+ SKTransitionController *transitionController = [[document pdfView]
transitionController];
+ [transition setTransitionStyle:[transitionController transitionStyle]];
+ [transition setDuration:[transitionController duration]];
+ [transition setShouldRestrict:[transitionController shouldRestrict]];
+ [self startObservingTransitions:[NSArray arrayWithObject:transition]];
}
return self;
}
- (void)dealloc {
+ [self stopObservingTransitions:[NSArray arrayWithObject:transition]];
+ [self stopObservingTransitions:transitions];
[[NSNotificationCenter defaultCenter] removeObserver:self];
+ [transition release];
+ [transitions release];
+ [undoManager release];
[super dealloc];
}
@@ -85,8 +117,10 @@
}
- (void)windowDidLoad {
+ // add the filter names to the popup
NSArray *filterNames = [SKTransitionController transitionFilterNames];
- NSInteger i, count = [filterNames count];
+ NSUInteger i, count = [filterNames count];
+
for (i = 0; i < count; i++) {
NSString *name = [filterNames objectAtIndex:i];
[transitionStylePopUpButton addItemWithTitle:[CIFilter
localizedNameForFilterName:name]];
@@ -94,61 +128,312 @@
[item setTag:SKCoreImageTransition + i];
}
+ // collapse the table
+ [[self window] setFrame:NSInsetRect([[self window] frame], 0.5 *
NSWidth([[tableView enclosingScrollView] frame]) + 4.0, 0.0) display:NO];
+
+ [tableView registerForDraggedTypes:[NSArray
arrayWithObject:SKTransitionPboardType]];
+
+ SKTypeSelectHelper *typeSelectHelper = [SKTypeSelectHelper
typeSelectHelperWithMatchOption:SKFullStringMatch];
+ [typeSelectHelper setMatchesImmediately:NO];
+ [typeSelectHelper setCyclesSimilarResults:NO];
+ [tableView setTypeSelectHelper:typeSelectHelper];
+
+ if ([[[document pdfView] transitionController] pageTransitions]) {
+ [[self undoManager] disableUndoRegistration];
+ [self setSeparate:YES];
+ [[self undoManager] enableUndoRegistration];
+ }
+
+ // set the current notes document and observe changes for the popup
[self handleDocumentsDidChangeNotification:nil];
+ NSInteger docIndex = [notesDocumentPopUpButton
indexOfItemWithRepresentedObject:[document presentationNotesDocument]];
+ [notesDocumentPopUpButton selectItemAtIndex:docIndex > 0 ? docIndex : 0];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleDocumentsDidChangeNotification:)
name:SKDocumentDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleDocumentsDidChangeNotification:)
name:SKDocumentControllerDidRemoveDocumentNotification object:nil];
}
+- (void)makeTransitions {
+ if (transitions) return;
+
+ // determine the table width by getting the largest page label
+ NSTableColumn *tableColumn = [tableView
tableColumnWithIdentifier:PAGE_COLUMNID];
+ id cell = [tableColumn dataCell];
+ CGFloat labelWidth = 0.0;
+
+ NSMutableArray *array = [NSMutableArray array];
+ NSDictionary *dictionary = [transition properties];
+ NSEnumerator *ptEnum = [[[[document pdfView] transitionController]
pageTransitions] objectEnumerator];
+ NSEnumerator *tnEnum = [[[document mainWindowController] thumbnails]
objectEnumerator];
+ SKThumbnail *tn = [tnEnum nextObject];
+ SKThumbnail *next;
+
+ while (next = [tnEnum nextObject]) {
+ SKTransitionInfo *info = [[SKTransitionInfo alloc] init];
+ [info setThumbnail:tn];
+ [info setLabel:[NSString stringWithFormat:@"%...@%c%@", [tn label],
0x2192, [next label]]];
+ [info setProperties:([ptEnum nextObject] ?: dictionary)];
+ [array addObject:info];
+ [cell setStringValue:[info label]];
+ labelWidth = SKMax(labelWidth, SKCeil([cell cellSize].width));
+ [info release];
+ tn = next;
+ }
+
+ [tableColumn setMinWidth:labelWidth];
+ [tableColumn setMaxWidth:labelWidth];
+ [tableColumn setWidth:labelWidth];
+
+ NSRect frame = [[tableView enclosingScrollView] frame];
+ frame.size.width = 19.0 + [[[tableView tableColumns]
valueForKeyPath:@"@sum.width"] floatValue];
+ [[tableView enclosingScrollView] setFrame:frame];
+
+ [self setTransitions:array];
+}
+
- (NSString *)windowNibName {
return @"TransitionSheet";
}
+- (void)dismiss:(id)sender {
+ [[SKPDFToolTipWindow sharedToolTipWindow] orderOut:nil];
+ if ([sender tag] == NSCancelButton) {
+ [super dismiss:sender];
+ } else if ([objectController commitEditing]) {
+ // don't make changes when nothing was changed
+ if ([undoManager canUndo]) {
+ SKTransitionController *transitionController = [[document pdfView]
transitionController];
+ [transitionController setTransitionStyle:[transition
transitionStyle]];
+ [transitionController setDuration:[transition duration]];
+ [transitionController setShouldRestrict:[transition
shouldRestrict]];
+ [transitionController setPageTransitions:[self pageTransitions]];
+ [[transitionController undoManager]
setActionName:NSLocalizedString(@"Change Transitions", @"Undo action name")];
+ }
+ [document setPresentationNotesDocument:[self notesDocument]];
+ [super dismiss:sender];
+ }
+}
+
- (SKPDFDocument *)document {
return document;
}
+- (BOOL)separate {
+ return separate;
+}
+
+- (void)setSeparate:(BOOL)newSeparate {
+ if (separate != newSeparate) {
+ separate = newSeparate;
+
+ [[SKPDFToolTipWindow sharedToolTipWindow] orderOut:nil];
+
+ NSWindow *window = [self window];
+ BOOL isVisible = [window isVisible];
+ NSRect frame = [window frame];
+ NSView *scrollView = [tableView enclosingScrollView];
+ CGFloat extraWidth;
+
+ [objectController commitEditing];
+ [objectController unbind:CONTENTOBJECT_BINDINGNAME];
+ if (separate) {
+ [self makeTransitions];
+
+ [objectController bind:CONTENTOBJECT_BINDINGNAME
toObject:arrayController withKeyPath:@"selection.self" options:nil];
+
+ extraWidth = NSWidth([scrollView frame]) + 8.0;
+ frame.size.width += extraWidth;
+ frame.origin.x -= SKFloor(0.5 * extraWidth);
+ [window setFrame:frame display:isVisible animate:isVisible];
+ [scrollView setHidden:NO];
+ } else {
+ [objectController bind:CONTENTOBJECT_BINDINGNAME toObject:self
withKeyPath:@"transition" options:nil];
+
+ [scrollView setHidden:YES];
+ extraWidth = NSWidth([scrollView frame]) + 8.0;
+ frame.size.width -= extraWidth;
+ frame.origin.x += SKFloor(0.5 * extraWidth);
+ [window setFrame:frame display:isVisible animate:isVisible];
+ }
+ [[[self undoManager] prepareWithInvocationTarget:self]
setSeparate:separate == NO];
+ }
+}
+
- (SKAnimationTransitionStyle)transitionStyle {
- [self window];
- return [[transitionStylePopUpButton selectedItem] tag];
+ return [transition transitionStyle];
}
- (void)setTransitionStyle:(SKAnimationTransitionStyle)style {
- [self window];
- [transitionStylePopUpButton selectItemWithTag:style];
+ [transition setTransitionStyle:style];
}
- (CGFloat)duration {
- [self window];
- return SKMax([transitionDurationField floatValue], 0.0);
+ return [transition duration];
}
- (void)setDuration:(CGFloat)newDuration {
- [self window];
- [transitionDurationField setFloatValue:newDuration];
- [transitionDurationSlider setFloatValue:newDuration];
+ [transition setDuration:newDuration];
}
- (BOOL)shouldRestrict {
- [self window];
- return (BOOL)[[transitionExtentMatrix selectedCell] tag];
+ return [transition shouldRestrict];
}
- (void)setShouldRestrict:(BOOL)flag {
- [self window];
- [transitionExtentMatrix selectCellWithTag:(NSInteger)flag];
+ [transition setShouldRestrict:flag];
}
+- (SKTransitionInfo *)transition {
+ return transition;
+}
+
+- (NSArray *)transitions {
+ return transitions;
+}
+
+- (void)setTransitions:(NSArray *)newTransitions {
+ if (transitions != newTransitions) {
+ [[[self undoManager] prepareWithInvocationTarget:self]
setTransitions:transitions];
+ [self stopObservingTransitions:transitions];
+ [transitions release];
+ transitions = [newTransitions copy];
+ [self startObservingTransitions:transitions];
+ }
+}
+
+- (NSArray *)pageTransitions {
+ if (separate && [transitions count])
+ return [transitions valueForKey:@"properties"];
+ else
+ return nil;
+}
+
- (SKPDFDocument *)notesDocument {
[self window];
return [[notesDocumentPopUpButton selectedItem] representedObject];
}
-- (void)setNotesDocument:(SKPDFDocument *)newNotesDocument {
- [self window];
- NSInteger docIndex = [notesDocumentPopUpButton
indexOfItemWithRepresentedObject:newNotesDocument];
- [notesDocumentPopUpButton selectItemAtIndex:docIndex > 0 ? docIndex : 0];
+- (BOOL)isScrolling {
+ return [tableView isScrolling];
}
+#pragma mark Undo
+
+- (NSUndoManager *)undoManager {
+ if (undoManager == nil)
+ undoManager = [[NSUndoManager alloc] init];
+ return undoManager;
+}
+
+- (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)sender {
+ return [self undoManager];
+}
+
+- (void)startObservingTransitions:(NSArray *)infos {
+ NSEnumerator *infoEnum = [infos objectEnumerator];
+ SKTransitionInfo *info;
+ while (info = [infoEnum nextObject]) {
+ [info addObserver:self forKeyPath:TRANSITIONSTYLE_KEY
options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld)
context:&SKTransitionPropertiesObservationContext];
+ [info addObserver:self forKeyPath:DURATION_KEY
options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld)
context:&SKTransitionPropertiesObservationContext];
+ [info addObserver:self forKeyPath:SHOULDRESTRICT_KEY
options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld)
context:&SKTransitionPropertiesObservationContext];
+ }
+}
+
+- (void)stopObservingTransitions:(NSArray *)infos {
+ NSEnumerator *infoEnum = [infos objectEnumerator];
+ SKTransitionInfo *info;
+ while (info = [infoEnum nextObject]) {
+ [info removeObserver:self forKeyPath:TRANSITIONSTYLE_KEY];
+ [info removeObserver:self forKeyPath:DURATION_KEY];
+ [info removeObserver:self forKeyPath:SHOULDRESTRICT_KEY];
+ }
+}
+
+- (void)setValue:(id)value forKey:(NSString *)key
ofTransition:(SKTransitionInfo *)info {
+ [info setValue:value forKey:key];
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
change:(NSDictionary *)change context:(void *)context {
+ if (context == &SKTransitionPropertiesObservationContext) {
+ SKTransitionInfo *info = (SKTransitionInfo *)object;
+ id newValue = [change objectForKey:NSKeyValueChangeNewKey];
+ id oldValue = [change objectForKey:NSKeyValueChangeOldKey];
+
+ if ([newValue isEqual:[NSNull null]]) newValue = nil;
+ if ([oldValue isEqual:[NSNull null]]) oldValue = nil;
+
+ [[[self undoManager] prepareWithInvocationTarget:self]
setValue:oldValue forKey:keyPath ofTransition:info];
+ } else {
+ [super observeValueForKeyPath:keyPath ofObject:object change:change
context:context];
+ }
+}
+
+#pragma mark NSTableView dataSource and delegate
+
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)tv { return 0; }
+
+- (id)tableView:(NSTableView *)tv objectValueForTableColumn:(NSTableColumn
*)tableColumn row:(NSInteger)row { return nil; }
+
+- (BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet
*)rowIndexes toPasteboard:(NSPasteboard *)pboard {
+ SKTransitionInfo *info = [transitions objectAtIndex:[rowIndexes
firstIndex]];
+ [pboard declareTypes:[NSArray arrayWithObject:SKTransitionPboardType]
owner:nil];
+ [pboard setPropertyList:[info properties] forType:SKTransitionPboardType];
+ return YES;
+}
+
+- (NSDragOperation)tableView:(NSTableView *)tv validateDrop:(id <
NSDraggingInfo >)info proposedRow:(NSInteger)row
proposedDropOperation:(NSTableViewDropOperation)operation {
+ if (row >= 0 && row < (NSInteger)[transitions count] && operation ==
NSTableViewDropOn &&
+ nil != [[info draggingPasteboard] availableTypeFromArray:[NSArray
arrayWithObject:SKTransitionPboardType]])
+ return NSDragOperationEvery;
+ return NSDragOperationNone;
+}
+
+- (BOOL)tableView:(NSTableView *)tv acceptDrop:(id < NSDraggingInfo >)info
row:(NSInteger)row dropOperation:(NSTableViewDropOperation)operation {
+ NSPasteboard *pboard = [info draggingPasteboard];
+ if ([pboard availableTypeFromArray:[NSArray
arrayWithObject:SKTransitionPboardType]]) {
+ [[transitions objectAtIndex:row] setProperties:[pboard
propertyListForType:SKTransitionPboardType]];
+ return YES;
+ }
+ return NO;
+}
+
+- (BOOL)tableView:(NSTableView *)tv shouldTrackTableColumn:(NSTableColumn
*)tableColumn row:(NSInteger)row {
+ return [[tableColumn identifier] isEqualToString:IMAGE_COLUMNID];
+}
+
+- (void)tableView:(NSTableView *)tv mouseEnteredTableColumn:(NSTableColumn
*)tableColumn row:(NSInteger)row {
+ if ([[tableColumn identifier] isEqualToString:IMAGE_COLUMNID])
+ [[SKPDFToolTipWindow sharedToolTipWindow]
showForPDFContext:(id)[[document pdfDocument] pageAtIndex:row]
atPoint:NSZeroPoint];
+}
+
+- (void)tableView:(NSTableView *)tv mouseExitedTableColumn:(NSTableColumn
*)tableColumn row:(NSInteger)row {
+ if ([[tableColumn identifier] isEqualToString:IMAGE_COLUMNID])
+ [[SKPDFToolTipWindow sharedToolTipWindow] fadeOut];
+}
+
+- (void)tableView:(NSTableView *)tv copyRowsWithIndexes:(NSIndexSet
*)rowIndexes {
+ NSPasteboard *pboard = [NSPasteboard generalPasteboard];
+ [pboard declareTypes:[NSArray arrayWithObject:SKTransitionPboardType]
owner:nil];
+ [pboard setPropertyList:[[transitions objectAtIndex:[rowIndexes
firstIndex]] properties] forType:SKTransitionPboardType];
+}
+
+- (BOOL)tableView:(NSTableView *)tv canCopyRowsWithIndexes:(NSIndexSet
*)rowIndexes {
+ return YES;
+}
+
+- (void)tableViewPaste:(NSTableView *)tv {
+ NSPasteboard *pboard = [NSPasteboard generalPasteboard];
+ if ([pboard availableTypeFromArray:[NSArray
arrayWithObject:SKTransitionPboardType]])
+ [[transitions objectAtIndex:[tableView selectedRow]]
setProperties:[pboard propertyListForType:SKTransitionPboardType]];
+}
+
+- (BOOL)tableViewCanPaste:(NSTableView *)tv {
+ return ([tableView selectedRow] != -1 && [[NSPasteboard generalPasteboard]
availableTypeFromArray:[NSArray arrayWithObject:SKTransitionPboardType]]);
+}
+
+- (NSArray *)tableView:(NSTableView *)tv
typeSelectHelperSelectionItems:(SKTypeSelectHelper *)typeSelectHelper {
+ return [transitions valueForKeyPath:@"thumbnail.label"];
+}
+
@end
Modified: trunk/SKTransitionController.h
===================================================================
--- trunk/SKTransitionController.h 2009-08-10 15:02:14 UTC (rev 5528)
+++ trunk/SKTransitionController.h 2009-08-10 15:10:39 UTC (rev 5529)
@@ -74,6 +74,12 @@
SKAnimationTransitionStyle transitionStyle;
CGFloat duration;
BOOL shouldRestrict;
+
+ SKAnimationTransitionStyle currentTransitionStyle;
+ CGFloat currentDuration;
+ BOOL currentShouldRestrict;
+
+ NSArray *pageTransitions;
}
+ (NSArray *)transitionFilterNames;
@@ -96,7 +102,13 @@
- (BOOL)shouldRestrict;
- (void)setShouldRestrict:(BOOL)flag;
+- (NSArray *)pageTransitions;
+- (void)setPageTransitions:(NSArray *)newPageTransitions;
+
+- (NSUndoManager *)undoManager;
+
- (void)prepareAnimationForRect:(NSRect)rect;
+- (void)prepareAnimationForRect:(NSRect)rect from:(NSUInteger)fromIndex
to:(NSUInteger)toIndex;
- (void)animateForRect:(NSRect)rect forward:(BOOL)forward;
@end
Modified: trunk/SKTransitionController.m
===================================================================
--- trunk/SKTransitionController.m 2009-08-10 15:02:14 UTC (rev 5528)
+++ trunk/SKTransitionController.m 2009-08-10 15:10:39 UTC (rev 5529)
@@ -193,6 +193,9 @@
transitionStyle = SKNoTransition;
duration = 1.0;
shouldRestrict = YES;
+ currentTransitionStyle = SKNoTransition;
+ currentDuration = 1.0;
+ currentShouldRestrict = YES;
}
return self;
}
@@ -219,7 +222,10 @@
}
- (void)setTransitionStyle:(SKAnimationTransitionStyle)style {
- transitionStyle = style;
+ if (transitionStyle != style) {
+ [[[self undoManager] prepareWithInvocationTarget:self]
setTransitionStyle:transitionStyle];
+ transitionStyle = style;
+ }
}
- (CGFloat)duration {
@@ -227,6 +233,7 @@
}
- (void)setDuration:(CGFloat)newDuration {
+ [(SKTransitionController *)[[self undoManager]
prepareWithInvocationTarget:self] setDuration:duration];
duration = newDuration;
}
@@ -235,9 +242,28 @@
}
- (void)setShouldRestrict:(BOOL)flag {
- shouldRestrict = flag;
+ if (shouldRestrict != flag) {
+ [[[self undoManager] prepareWithInvocationTarget:self]
setShouldRestrict:shouldRestrict];
+ shouldRestrict = flag;
+ }
}
+- (NSArray *)pageTransitions {
+ return pageTransitions;
+}
+
+- (void)setPageTransitions:(NSArray *)newPageTransitions {
+ if (pageTransitions != newPageTransitions) {
+ [[[self undoManager] prepareWithInvocationTarget:self]
setPageTransitions:pageTransitions];
+ [pageTransitions release];
+ pageTransitions = [newPageTransitions copy];
+ }
+}
+
+- (NSUndoManager *)undoManager {
+ return [view respondsToSelector:@selector(undoManager)] ? [view
undoManager] : nil;
+}
+
- (CIFilter *)filterWithName:(NSString *)name {
if (filters == nil)
filters = [[NSMutableDictionary alloc] init];
@@ -296,7 +322,7 @@
}
- (CIFilter *)transitionFilterForRect:(NSRect)rect forward:(BOOL)forward
initialCIImage:(CIImage *)initialCIImage finalCIImage:(CIImage *)finalCIImage {
- NSString *filterName = [[[self class] transitionFilterNames]
objectAtIndex:transitionStyle - SKCoreImageTransition];
+ NSString *filterName = [[[self class] transitionFilterNames]
objectAtIndex:currentTransitionStyle - SKCoreImageTransition];
CIFilter *transitionFilter = [self filterWithName:filterName];
NSRect bounds = [view bounds];
@@ -307,7 +333,7 @@
while (key = [keyEnum nextObject]) {
id value = nil;
if ([key isEqualToString:@"inputExtent"]) {
- NSRect extent = shouldRestrict ? rect : bounds;
+ NSRect extent = currentShouldRestrict ? rect : bounds;
value = [CIVector vectorWithX:NSMinX(extent) Y:NSMinY(extent)
Z:NSWidth(extent) W:NSHeight(extent)];
} else if ([key isEqualToString:@"inputAngle"]) {
CGFloat angle = forward ? 0.0 : M_PI;
@@ -361,11 +387,31 @@
}
- (void)prepareAnimationForRect:(NSRect)rect {
- if (transitionStyle == SKNoTransition) {
+ [self prepareAnimationForRect:rect from:NSNotFound to:NSNotFound];
+}
+
+- (void)prepareAnimationForRect:(NSRect)rect from:(NSUInteger)fromIndex
to:(NSUInteger)toIndex {
+ currentTransitionStyle = transitionStyle;
+ currentDuration = duration;
+ currentShouldRestrict = shouldRestrict;
+
+ NSUInteger idx = MIN(fromIndex, toIndex);
+ if (fromIndex != NSNotFound && toIndex != NSNotFound && idx <
[pageTransitions count]) {
+ NSDictionary *info = [pageTransitions objectAtIndex:idx];
+ id value;
+ if (value = [info objectForKey:@"styleName"])
+ currentTransitionStyle = [[self class] styleForName:value];
+ if ((value = [info objectForKey:@"duration"]) && [value
respondsToSelector:@selector(floatValue)])
+ currentDuration = [value floatValue];
+ if ((value = [info objectForKey:@"shouldRestrict"]) && [value
respondsToSelector:@selector(boolValue)])
+ currentShouldRestrict = [value boolValue];
+ }
+
+ if (currentTransitionStyle == SKNoTransition) {
// Do nothing
- } else if (transitionStyle < SKCoreImageTransition) {
+ } else if (currentTransitionStyle < SKCoreImageTransition) {
if (CoreGraphicsServicesTransitionsDefined()) {
- if (shouldRestrict) {
+ if (currentShouldRestrict) {
[initialImage release];
initialImage = [self newCurrentImage];
}
@@ -383,14 +429,14 @@
}
- (void)animateForRect:(NSRect)rect forward:(BOOL)forward {
- if (transitionStyle == SKNoTransition) {
+ if (currentTransitionStyle == SKNoTransition) {
// Do nothing
- } else if (transitionStyle < SKCoreImageTransition) {
+ } else if (currentTransitionStyle < SKCoreImageTransition) {
if (CoreGraphicsServicesTransitionsDefined()) {
CIImage *finalImage = nil;
- if (shouldRestrict) {
+ if (currentShouldRestrict) {
if (initialImage == nil)
[self prepareAnimationForRect:rect];
@@ -420,10 +466,10 @@
CGSTransitionSpec spec;
// specify our specifications
spec.unknown1 = 0;
- spec.type = transitionStyle;
+ spec.type = currentTransitionStyle;
spec.option = forward ? CGSLeft : CGSRight;
spec.backColour = NULL;
- spec.wid = [(shouldRestrict ? [self transitionWindow] : [view
window]) windowNumber];
+ spec.wid = [(currentShouldRestrict ? [self transitionWindow] :
[view window]) windowNumber];
// Let's get a connection
CGSConnection cgs = _CGSDefaultConnection();
@@ -431,7 +477,7 @@
// Create a transition
CGSNewTransition(cgs, &spec, &handle);
- if (shouldRestrict) {
+ if (currentShouldRestrict) {
[[self transitionView] setImage:finalImage];
[[self transitionView] display];
}
@@ -442,14 +488,14 @@
[[view window] enableFlushWindow];
[[view window] flushWindow];
- CGSInvokeTransition(cgs, handle, duration);
+ CGSInvokeTransition(cgs, handle, currentDuration);
// We need to wait for the transition to finish before we get rid
of it, otherwise we'll get all sorts of nasty errors... or maybe not.
- usleep((useconds_t)(duration * 1000000));
+ usleep((useconds_t)(currentDuration * 1000000));
CGSReleaseTransition(cgs, handle);
handle = 0;
- if (shouldRestrict) {
+ if (currentShouldRestrict) {
[[view window] removeChildWindow:[self transitionWindow]];
[[self transitionWindow] orderOut:nil];
[[self transitionView] setImage:nil];
@@ -474,7 +520,7 @@
NSRect frame = [view convertRect:[view frame] toView:nil];
frame.origin = [[view window] convertBaseToScreen:frame.origin];
- SKTransitionAnimation *animation = [[SKTransitionAnimation alloc]
initWithFilter:transitionFilter duration:duration];
+ SKTransitionAnimation *animation = [[SKTransitionAnimation alloc]
initWithFilter:transitionFilter duration:currentDuration];
[[self transitionView] setAnimation:animation];
[animation release];
@@ -495,6 +541,10 @@
[[self transitionView] setAnimation:nil];
}
+
+ currentTransitionStyle = transitionStyle;
+ currentDuration = duration;
+ currentShouldRestrict = shouldRestrict;
}
@end
Added: trunk/SKTransitionInfo.h
===================================================================
--- trunk/SKTransitionInfo.h (rev 0)
+++ trunk/SKTransitionInfo.h 2009-08-10 15:10:39 UTC (rev 5529)
@@ -0,0 +1,70 @@
+//
+// SKTransitionInfo.h
+// Skim
+//
+// Created by Christiaan on 8/10/09.
+/*
+ This software is Copyright (c) 2009
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+#import "SKTransitionController.h"
+
+...@class SKThumbnail;
+
+...@interface SKTransitionInfo : NSObject {
+ SKAnimationTransitionStyle transitionStyle;
+ CGFloat duration;
+ BOOL shouldRestrict;
+ SKThumbnail *thumbnail;
+ NSString *label;
+}
+
+- (NSDictionary *)properties;
+- (void)setProperties:(NSDictionary *)dictionary;
+
+- (SKAnimationTransitionStyle)transitionStyle;
+- (void)setTransitionStyle:(SKAnimationTransitionStyle)style;
+
+- (CGFloat)duration;
+- (void)setDuration:(CGFloat)newDuration;
+
+- (BOOL)shouldRestrict;
+- (void)setShouldRestrict:(BOOL)newShouldRestrict;
+
+- (SKThumbnail *)thumbnail;
+- (void)setThumbnail:(SKThumbnail *)newThumbnail;
+
+- (NSString *)label;
+- (void)setLabel:(NSString *)newLabel;
+
+...@end
Added: trunk/SKTransitionInfo.m
===================================================================
--- trunk/SKTransitionInfo.m (rev 0)
+++ trunk/SKTransitionInfo.m 2009-08-10 15:10:39 UTC (rev 5529)
@@ -0,0 +1,133 @@
+//
+// SKTransitionInfo.m
+// Skim
+//
+// Created by Christiaan on 8/10/09.
+/*
+ This software is Copyright (c) 2009
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "SKTransitionInfo.h"
+#import "SKThumbnail.h"
+
+#define STYLENAME_KEY @"styleName"
+#define DURATION_KEY @"duration"
+#define SHOULDRESTRICT_KEY @"shouldRestrict"
+
+
+...@implementation SKTransitionInfo
+
+- (id)init {
+ if (self = [super init]) {
+ transitionStyle = SKNoTransition;
+ duration = 1.0;
+ shouldRestrict = NO;
+ thumbnail = nil;
+ label = nil;
+ }
+ return self;
+}
+
+- (void)dealloc {
+ [thumbnail release];
+ [label release];
+ [super dealloc];
+}
+
+- (NSString *)description {
+ return [NSString stringWithFormat:@"<%@ %p> %@", [self class], self, [self
properties]];
+}
+
+- (NSDictionary *)properties {
+ return [NSDictionary dictionaryWithObjectsAndKeys:
+ ([SKTransitionController nameForStyle:transitionStyle] ?:
@""), STYLENAME_KEY,
+ [NSNumber numberWithFloat:duration], DURATION_KEY,
+ [NSNumber numberWithBool:shouldRestrict], SHOULDRESTRICT_KEY,
nil];
+}
+
+- (void)setProperties:(NSDictionary *)dictionary {
+ id value;
+ if (value = [dictionary objectForKey:STYLENAME_KEY])
+ [self setTransitionStyle:[SKTransitionController styleForName:value]];
+ if (value = [dictionary objectForKey:DURATION_KEY])
+ [self setDuration:[value floatValue]];
+ if (value = [dictionary objectForKey:SHOULDRESTRICT_KEY])
+ [self setShouldRestrict:[value floatValue]];
+}
+
+- (SKAnimationTransitionStyle)transitionStyle {
+ return transitionStyle;
+}
+
+- (void)setTransitionStyle:(SKAnimationTransitionStyle)newTransitionStyle {
+ transitionStyle = newTransitionStyle;
+}
+
+- (CGFloat)duration {
+ return duration;
+}
+
+- (void)setDuration:(CGFloat)newDuration {
+ duration = newDuration;
+}
+
+- (BOOL)shouldRestrict {
+ return shouldRestrict;
+}
+
+- (void)setShouldRestrict:(BOOL)newShouldRestrict {
+ shouldRestrict = newShouldRestrict;
+}
+
+- (SKThumbnail *)thumbnail {
+ return thumbnail;
+}
+
+- (void)setThumbnail:(SKThumbnail *)newThumbnail {
+ if (thumbnail != newThumbnail) {
+ [thumbnail release];
+ thumbnail = [newThumbnail retain];
+ }
+}
+
+- (NSString *)label {
+ return label;
+}
+
+- (void)setLabel:(NSString *)newLabel {
+ if (label != newLabel) {
+ [label release];
+ label = [newLabel copy];
+ }
+}
+
+...@end
Modified: trunk/Skim.xcodeproj/project.pbxproj
===================================================================
--- trunk/Skim.xcodeproj/project.pbxproj 2009-08-10 15:02:14 UTC (rev
5528)
+++ trunk/Skim.xcodeproj/project.pbxproj 2009-08-10 15:10:39 UTC (rev
5529)
@@ -165,6 +165,7 @@
CE898F060C843A8B008A0856 /* PDFDDocument.icns in Resources */ =
{isa = PBXBuildFile; fileRef = CE898F050C843A8B008A0856 /* PDFDDocument.icns
*/; };
CE8B46E90C29CA00005CE7F1 /* SKLineInspector.m in Sources */ =
{isa = PBXBuildFile; fileRef = CE8B46E70C29CA00005CE7F1 /* SKLineInspector.m
*/; };
CE8B46F00C29CA3D005CE7F1 /* LineInspector.nib in Resources */ =
{isa = PBXBuildFile; fileRef = CE8B46EA0C29CA3D005CE7F1 /* LineInspector.nib
*/; };
+ CE9B804A1030642400EA8774 /* SKTransitionInfo.m in Sources */ =
{isa = PBXBuildFile; fileRef = CE9B80491030642400EA8774 /* SKTransitionInfo.m
*/; };
CE9B951E0D04657A00EB1A6C /* SKRemoteStateWindow.m in Sources */
= {isa = PBXBuildFile; fileRef = CE9B951C0D04657A00EB1A6C /*
SKRemoteStateWindow.m */; };
CE9C423C0B8B5633004AD8CF /* PreferenceWindow.nib in Resources
*/ = {isa = PBXBuildFile; fileRef = CE9C42360B8B5633004AD8CF /*
PreferenceWindow.nib */; };
CEA182280C92E3300061A6D4 /* NSData_SKExtensions.m in Sources */
= {isa = PBXBuildFile; fileRef = CEA182260C92E3300061A6D4 /*
NSData_SKExtensions.m */; };
@@ -767,6 +768,8 @@
CE8B46E70C29CA00005CE7F1 /* SKLineInspector.m */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.c.objc; path =
SKLineInspector.m; sourceTree = "<group>"; };
CE8B46EB0C29CA3D005CE7F1 /* English */ = {isa =
PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path =
English.lproj/LineInspector.nib; sourceTree = "<group>"; };
CE8B46F30C29CA4A005CE7F1 /* Dutch */ = {isa = PBXFileReference;
lastKnownFileType = wrapper.nib; name = Dutch; path =
Dutch.lproj/LineInspector.nib; sourceTree = "<group>"; };
+ CE9B80481030642400EA8774 /* SKTransitionInfo.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
SKTransitionInfo.h; sourceTree = "<group>"; };
+ CE9B80491030642400EA8774 /* SKTransitionInfo.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= SKTransitionInfo.m; sourceTree = "<group>"; };
CE9B951B0D04657A00EB1A6C /* SKRemoteStateWindow.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
SKRemoteStateWindow.h; sourceTree = "<group>"; };
CE9B951C0D04657A00EB1A6C /* SKRemoteStateWindow.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= SKRemoteStateWindow.m; sourceTree = "<group>"; };
CE9C42370B8B5633004AD8CF /* English */ = {isa =
PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path =
English.lproj/PreferenceWindow.nib; sourceTree = "<group>"; };
@@ -1418,6 +1421,8 @@
CE2DE4910B85D48F00D0DA12 /* SKThumbnail.m */,
CE8978CB0CBFC70B00EA2D98 /* SKTemplateTag.h */,
CE8978CC0CBFC70B00EA2D98 /* SKTemplateTag.m */,
+ CE9B80481030642400EA8774 /* SKTransitionInfo.h
*/,
+ CE9B80491030642400EA8774 /* SKTransitionInfo.m
*/,
CEF7117C0B90B58E003A2771 /* SKVersionNumber.h
*/,
CEF7117D0B90B58E003A2771 /* SKVersionNumber.m
*/,
);
@@ -2216,6 +2221,7 @@
CEC3154F0F24AC02008D2C75 /* SKRichTextFormat.m
in Sources */,
CE32531F0F4723EA0021BADD /*
SKMainWindowController_Actions.m in Sources */,
CE80A81E0FDAB1690086A46C /*
SKHighlightingPopUpButton.m in Sources */,
+ CE9B804A1030642400EA8774 /* SKTransitionInfo.m
in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit