Revision: 5558
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5558&view=rev
Author:   hofman
Date:     2009-08-15 11:46:03 +0000 (Sat, 15 Aug 2009)

Log Message:
-----------
move presentationNotesDocument ivar and accessors to the main window controller 
class

Modified Paths:
--------------
    trunk/SKMainWindowController.h
    trunk/SKMainWindowController.m
    trunk/SKMainWindowController_Actions.m
    trunk/SKMainWindowController_UI.m
    trunk/SKPDFDocument.h
    trunk/SKPDFDocument.m
    trunk/SKPresentationOptionsSheetController.h
    trunk/SKPresentationOptionsSheetController.m

Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h      2009-08-15 11:27:00 UTC (rev 5557)
+++ trunk/SKMainWindowController.h      2009-08-15 11:46:03 UTC (rev 5558)
@@ -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, 
SKPresentationOptionsSheetController;
+...@class SKPDFDocument, SKFullScreenWindow, SKNavigationWindow, SKSideWindow, 
SKSnapshotWindowController, SKProgressController, SKPageSheetController, 
SKScaleSheetController, SKPasswordSheetController, SKBookmarkSheetController, 
SKPresentationOptionsSheetController;
 
 @interface SKMainWindowController : NSWindowController {
     IBOutlet SKSplitView            *splitView;
@@ -191,6 +191,8 @@
     
     SKPresentationOptionsSheetController *presentationSheetController;
     
+    SKPDFDocument                   *presentationNotesDocument;
+    
     NSButton                        *colorAccessoryView;
     NSButton                        *textColorAccessoryView;
     
@@ -301,6 +303,9 @@
 - (NSDictionary *)presentationOptions;
 - (void)setPresentationOptions:(NSDictionary *)dictionary;
 
+- (SKPDFDocument *)presentationNotesDocument;
+- (void)setPresentationNotesDocument:(SKPDFDocument *)aDocument;
+
 - (NSArray *)tags;
 - (double)rating;
 

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2009-08-15 11:27:00 UTC (rev 5557)
+++ trunk/SKMainWindowController.m      2009-08-15 11:46:03 UTC (rev 5558)
@@ -274,6 +274,7 @@
     [leftSideDrawer release];
     [rightSideDrawer release];
     [secondaryPdfEdgeView release];
+    [presentationNotesDocument release];
     [super dealloc];
 }
 
@@ -1244,6 +1245,17 @@
     [transitions setPageTransitions:pageTransitions];
 }
 
+- (SKPDFDocument *)presentationNotesDocument {
+    return presentationNotesDocument;
+}
+
+- (void)setPresentationNotesDocument:(SKPDFDocument *)aDocument {
+    if (presentationNotesDocument != aDocument) {
+        [presentationNotesDocument release];
+        presentationNotesDocument = [aDocument retain];
+    }
+}
+
 - (NSArray *)tags {
     return tags;
 }
@@ -1471,7 +1483,7 @@
     [fullScreenWindow setBackgroundColor:backgroundColor];
     [fullScreenWindow setLevel:NSPopUpMenuWindowLevel];
     
-    SKPDFView *notesPdfView = [[(SKPDFDocument *)[self document] 
presentationNotesDocument] pdfView];
+    SKPDFView *notesPdfView = [[self presentationNotesDocument] pdfView];
     if (notesPdfView)
         [notesPdfView goToPage:[[notesPdfView document] pageAtIndex:[[pdfView 
currentPage] pageIndex]]];
     

Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m      2009-08-15 11:27:00 UTC (rev 
5557)
+++ trunk/SKMainWindowController_Actions.m      2009-08-15 11:46:03 UTC (rev 
5558)
@@ -978,7 +978,7 @@
 }
 
 - (IBAction)chooseTransition:(id)sender {
-    presentationSheetController = [[SKPresentationOptionsSheetController 
alloc] initForDocument:(SKPDFDocument *)[self document]];
+    presentationSheetController = [[SKPresentationOptionsSheetController 
alloc] initForController:self];
     
     [presentationSheetController beginSheetModalForWindow: [self window]
         modalDelegate: self

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2009-08-15 11:27:00 UTC (rev 5557)
+++ trunk/SKMainWindowController_UI.m   2009-08-15 11:46:03 UTC (rev 5558)
@@ -65,6 +65,7 @@
 #import "NSMenu_SKExtensions.h"
 #import "SKLineInspector.h"
 #import "SKPDFOutline.h"
+#import "SKDocumentController.h"
 
 #define NOTES_KEY       @"notes"
 #define SNAPSHOTS_KEY   @"snapshots"
@@ -1528,7 +1529,7 @@
     [self updateLeftStatus];
     
     if ([self isPresentation]) {
-        SKPDFView *notesPdfView = [[(SKPDFDocument *)[self document] 
presentationNotesDocument] pdfView];
+        SKPDFView *notesPdfView = [[self presentationNotesDocument] pdfView];
         if (notesPdfView)
             [notesPdfView goToPage:[[notesPdfView document] pageAtIndex:[page 
pageIndex]]];
     }
@@ -1701,6 +1702,11 @@
         [self updateThumbnailAtPageIndex:[newPage pageIndex]];
 }
 
+- (void)handleDidRemoveDocumentNotification:(NSNotification *)notification {
+    if ([[notification userInfo] objectForKey:@"document"] == 
presentationNotesDocument)
+        [self setPresentationNotesDocument:nil];
+}
+
 #pragma mark Observer registration
 
 - (void)registerForNotifications {
@@ -1744,6 +1750,9 @@
     //  UndoManager
     [nc addObserver:self selector:@selector(observeUndoManagerCheckpoint:) 
                              name:NSUndoManagerCheckpointNotification 
object:[[self document] undoManager]];
+    //  SKDocumentController
+    [nc addObserver:self 
selector:@selector(handleDidRemoveDocumentNotification:) 
+                             
name:SKDocumentControllerDidRemoveDocumentNotification object:nil];
 }
 
 @end

Modified: trunk/SKPDFDocument.h
===================================================================
--- trunk/SKPDFDocument.h       2009-08-15 11:27:00 UTC (rev 5557)
+++ trunk/SKPDFDocument.h       2009-08-15 11:46:03 UTC (rev 5558)
@@ -81,8 +81,6 @@
     
     SKProgressController *progressController;
     
-    SKPDFDocument *presentationNotesDocument;
-    
     SKPDFSynchronizer *synchronizer;
     NSString *watchedFile;
     
@@ -115,9 +113,6 @@
 
 - (SKPDFView *)pdfView;
 
-- (SKPDFDocument *)presentationNotesDocument;
-- (void)setPresentationNotesDocument:(SKPDFDocument *)aDocument;
-
 - (NSData *)notesData;
 - (NSString *)notesFDFString;
 - (NSString *)notesFDFStringForFile:(NSString *)filename;

Modified: trunk/SKPDFDocument.m
===================================================================
--- trunk/SKPDFDocument.m       2009-08-15 11:27:00 UTC (rev 5557)
+++ trunk/SKPDFDocument.m       2009-08-15 11:46:03 UTC (rev 5558)
@@ -126,7 +126,6 @@
     [mainWindowController release];
     [synchronizer terminate];
     [synchronizer release];
-    [presentationNotesDocument release];
     [watchedFile release];
     [pdfData release];
     [psOrDviData release];
@@ -1546,11 +1545,6 @@
     }
 }
 
-- (void)handleDidRemoveDocumentNotification:(NSNotification *)notification {
-    if ([[notification userInfo] objectForKey:@"document"] == 
presentationNotesDocument)
-        [self setPresentationNotesDocument:nil];
-}
-
 #pragma mark Notification observation
 
 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object 
change:(NSDictionary *)change context:(void *)context {
@@ -1730,17 +1724,6 @@
     return [[self mainWindowController] pdfView];
 }
 
-- (SKPDFDocument *)presentationNotesDocument {
-    return presentationNotesDocument;
-}
-
-- (void)setPresentationNotesDocument:(SKPDFDocument *)aDocument {
-    if (presentationNotesDocument != aDocument) {
-        [presentationNotesDocument release];
-        presentationNotesDocument = [aDocument retain];
-    }
-}
-
 - (NSArray *)fileIDStrings {
     if (pdfData == nil)
         return nil;

Modified: trunk/SKPresentationOptionsSheetController.h
===================================================================
--- trunk/SKPresentationOptionsSheetController.h        2009-08-15 11:27:00 UTC 
(rev 5557)
+++ trunk/SKPresentationOptionsSheetController.h        2009-08-15 11:46:03 UTC 
(rev 5558)
@@ -40,7 +40,7 @@
 #import "SKSheetController.h"
 #import "SKTransitionController.h"
 
-...@class SKPDFDocument, SKThumbnail, SKTransitionInfo, SKThumbnailTableView;
+...@class SKMainWindowController, SKPDFDocument, SKThumbnail, 
SKTransitionInfo, SKThumbnailTableView;
 
 @interface SKPresentationOptionsSheetController : SKSheetController {
     IBOutlet NSPopUpButton *transitionStylePopUpButton;
@@ -55,11 +55,11 @@
     BOOL separate;
     SKTransitionInfo *transition;
     NSArray *transitions;
-    SKPDFDocument *document;
+    SKMainWindowController *controller;
     NSUndoManager *undoManager;
 }
 
-- (id)initForDocument:(SKPDFDocument *)aDocument;
+- (id)initForController:(SKMainWindowController *)aController;
 
 - (BOOL)separate;
 - (void)setSeparate:(BOOL)newSeparate;

Modified: trunk/SKPresentationOptionsSheetController.m
===================================================================
--- trunk/SKPresentationOptionsSheetController.m        2009-08-15 11:27:00 UTC 
(rev 5557)
+++ trunk/SKPresentationOptionsSheetController.m        2009-08-15 11:46:03 UTC 
(rev 5558)
@@ -38,6 +38,7 @@
 
 #import "SKPresentationOptionsSheetController.h"
 #import <Quartz/Quartz.h>
+#import "SKMainWindowController.h"
 #import "SKPDFDocument.h"
 #import "SKDocumentController.h"
 #import "SKTransitionInfo.h"
@@ -62,14 +63,14 @@
 
 @implementation SKPresentationOptionsSheetController
 
-- (id)initForDocument:(SKPDFDocument *)aDocument {
+- (id)initForController:(SKMainWindowController *)aController {
     if (self = [super init]) {
-        document = aDocument;
+        controller = aController;
         separate = NO;
         transition = [[SKTransitionInfo alloc] init];
         transitions = nil;
         
-        SKTransitionController *transitionController = [[document pdfView] 
transitionController];
+        SKTransitionController *transitionController = [[controller pdfView] 
transitionController];
         [transition setTransitionStyle:[transitionController transitionStyle]];
         [transition setDuration:[transitionController duration]];
         [transition setShouldRestrict:[transitionController shouldRestrict]];
@@ -97,9 +98,9 @@
     NSEnumerator *docEnum = [[[NSDocumentController sharedDocumentController] 
documents] objectEnumerator];
     id doc;
     NSMutableArray *documents = [NSMutableArray array];
-    NSUInteger pageCount = [[document pdfDocument] pageCount];
+    NSUInteger pageCount = [[controller pdfDocument] pageCount];
     while (doc = [docEnum nextObject]) {
-        if ([doc respondsToSelector:@selector(pdfDocument)] && doc != document 
&& [[doc pdfDocument] pageCount] == pageCount)
+        if ([doc respondsToSelector:@selector(pdfDocument)] && doc != 
[controller document] && [[doc pdfDocument] pageCount] == pageCount)
             [documents addObject:doc];
     }
     NSSortDescriptor *sortDescriptor = [[[NSSortDescriptor alloc] 
initWithKey:@"displayName" ascending:YES] autorelease];
@@ -138,7 +139,7 @@
     [typeSelectHelper setCyclesSimilarResults:NO];
     [tableView setTypeSelectHelper:typeSelectHelper];
     
-    if ([[[document pdfView] transitionController] pageTransitions]) {
+    if ([[[controller pdfView] transitionController] pageTransitions]) {
         [[self undoManager] disableUndoRegistration];
         [self setSeparate:YES];
         [[self undoManager] enableUndoRegistration];
@@ -146,7 +147,7 @@
     
     // set the current notes document and observe changes for the popup
     [self handleDocumentsDidChangeNotification:nil];
-    NSInteger docIndex = [notesDocumentPopUpButton 
indexOfItemWithRepresentedObject:[document presentationNotesDocument]];
+    NSInteger docIndex = [notesDocumentPopUpButton 
indexOfItemWithRepresentedObject:[controller presentationNotesDocument]];
     [notesDocumentPopUpButton selectItemAtIndex:docIndex > 0 ? docIndex : 0];
        [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(handleDocumentsDidChangeNotification:) 
                                                  
name:SKDocumentDidShowNotification object:nil];
@@ -164,8 +165,8 @@
     
     NSMutableArray *array = [NSMutableArray array];
     NSDictionary *dictionary = [transition properties];
-    NSEnumerator *ptEnum = [[[[document pdfView] transitionController] 
pageTransitions] objectEnumerator];
-    NSEnumerator *tnEnum = [[[document mainWindowController] thumbnails] 
objectEnumerator];
+    NSEnumerator *ptEnum = [[[[controller pdfView] transitionController] 
pageTransitions] objectEnumerator];
+    NSEnumerator *tnEnum = [[controller thumbnails] objectEnumerator];
     SKThumbnail *tn = [tnEnum nextObject];
     SKThumbnail *next;
     
@@ -203,14 +204,14 @@
     } else if ([objectController commitEditing]) {
         // don't make changes when nothing was changed
         if ([undoManager canUndo]) {
-            SKTransitionController *transitionController = [[document pdfView] 
transitionController];
+            SKTransitionController *transitionController = [[controller 
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]];
+        [controller setPresentationNotesDocument:[self notesDocument]];
         [super dismiss:sender];
     }
 }
@@ -400,7 +401,7 @@
 
 - (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];
+        [[SKPDFToolTipWindow sharedToolTipWindow] 
showForPDFContext:(id)[[controller pdfDocument] pageAtIndex:row] 
atPoint:NSZeroPoint];
 }
 
 - (void)tableView:(NSTableView *)tv mouseExitedTableColumn:(NSTableColumn 
*)tableColumn row:(NSInteger)row {


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

Reply via email to