Revision: 18420
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18420&view=rev
Author:   hofman
Date:     2012-01-18 13:14:34 +0000 (Wed, 18 Jan 2012)
Log Message:
-----------
No need to keep a separate reference to macro window controller of document, 
keep it in the windowControllers for as long as necessary.

Modified Paths:
--------------
    trunk/bibdesk/BibDocument.h
    trunk/bibdesk/BibDocument.m
    trunk/bibdesk/BibDocument_Actions.m

Modified: trunk/bibdesk/BibDocument.h
===================================================================
--- trunk/bibdesk/BibDocument.h 2012-01-18 12:50:54 UTC (rev 18419)
+++ trunk/bibdesk/BibDocument.h 2012-01-18 13:14:34 UTC (rev 18420)
@@ -204,7 +204,6 @@
 #pragma mark Macros, Document Info and Front Matter variables
 
     BDSKMacroResolver *macroResolver;
-    BDSKMacroWindowController *macroWC;
        
     NSDictionary *documentInfo;
     

Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2012-01-18 12:50:54 UTC (rev 18419)
+++ trunk/bibdesk/BibDocument.m 2012-01-18 13:14:34 UTC (rev 18420)
@@ -236,7 +236,6 @@
         // these are created lazily when needed
         fileSearchController = nil;
         drawerController = nil;
-        macroWC = nil;
         previewer = nil;
         toolbarItems = nil;
         docState.lastPreviewHeight = 0.0;
@@ -308,7 +307,6 @@
     BDSKDESTROY(previewer);
     BDSKDESTROY(bottomPreviewDisplayTemplate);
     BDSKDESTROY(sidePreviewDisplayTemplate);
-    BDSKDESTROY(macroWC);
     BDSKDESTROY(tableColumnWidths);
     BDSKDESTROY(sortKey);
     BDSKDESTROY(previousSortKey);

Modified: trunk/bibdesk/BibDocument_Actions.m
===================================================================
--- trunk/bibdesk/BibDocument_Actions.m 2012-01-18 12:50:54 UTC (rev 18419)
+++ trunk/bibdesk/BibDocument_Actions.m 2012-01-18 13:14:34 UTC (rev 18420)
@@ -1403,31 +1403,21 @@
 }
 
 - (IBAction)showMacrosWindow:(id)sender{
-    if ([self hasExternalGroupsSelected]) {
-        BDSKMacroResolver *resolver = [[[self selectedGroups] lastObject] 
macroResolver];
-        BDSKMacroWindowController *controller = nil;
-        NSWindowController *wc = nil;
-        for (wc in [self windowControllers]) {
-            if([wc isKindOfClass:[BDSKMacroWindowController class]] && 
[(BDSKMacroWindowController*)wc macroResolver] == resolver)
-                break;
-        }
-        if(wc){
-            controller = (BDSKMacroWindowController *)wc;
-        }else{
-            controller = [[BDSKMacroWindowController alloc] 
initWithMacroResolver:resolver];
-            [self addWindowController:controller];
-            [controller release];
-        }
-        [controller showWindow:self];
-    } else {
-        if (!macroWC) {
-            macroWC = [[BDSKMacroWindowController alloc] 
initWithMacroResolver:[self macroResolver]];
-        }
-        if ([[self windowControllers] containsObject:macroWC] == NO) {
-            [self addWindowController:macroWC];
-        }
-        [macroWC showWindow:self];
+    BDSKMacroResolver *resolver = [self hasExternalGroupsSelected] ? [[[self 
selectedGroups] lastObject] macroResolver] : [self macroResolver];
+    BDSKMacroWindowController *controller = nil;
+    NSWindowController *wc = nil;
+    for (wc in [self windowControllers]) {
+        if([wc isKindOfClass:[BDSKMacroWindowController class]] && 
[(BDSKMacroWindowController*)wc macroResolver] == resolver)
+            break;
     }
+    if(wc){
+        controller = (BDSKMacroWindowController *)wc;
+    }else{
+        controller = [[BDSKMacroWindowController alloc] 
initWithMacroResolver:resolver];
+        [self addWindowController:controller];
+        [controller release];
+    }
+    [controller showWindow:self];
 }
 
 #pragma mark Sharing Actions

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to