Revision: 3735
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3735&view=rev
Author:   hofman
Date:     2008-04-15 11:15:22 -0700 (Tue, 15 Apr 2008)

Log Message:
-----------
Only look for active font picker in the window itself.

Modified Paths:
--------------
    trunk/NSView_SKExtensions.h
    trunk/NSView_SKExtensions.m
    trunk/SKFontPicker.h
    trunk/SKFontPicker.m
    trunk/SKPreferenceController.m

Modified: trunk/NSView_SKExtensions.h
===================================================================
--- trunk/NSView_SKExtensions.h 2008-04-15 17:41:57 UTC (rev 3734)
+++ trunk/NSView_SKExtensions.h 2008-04-15 18:15:22 UTC (rev 3735)
@@ -50,4 +50,6 @@
 
 - (void)deactivateSubcontrols;
 
+- (id)activeFontPickerSubview;
+
 @end

Modified: trunk/NSView_SKExtensions.m
===================================================================
--- trunk/NSView_SKExtensions.m 2008-04-15 17:41:57 UTC (rev 3734)
+++ trunk/NSView_SKExtensions.m 2008-04-15 18:15:22 UTC (rev 3735)
@@ -93,6 +93,17 @@
     [[self subviews] makeObjectsPerformSelector:_cmd];
 }
 
+- (id)activeFontPickerSubview {
+       NSEnumerator *viewEnum = [[self subviews] objectEnumerator];
+       NSView *view, *subview;
+       
+       while (subview = [viewEnum nextObject]) {
+               if (view = [subview activeFontPickerSubview])
+                       return view;
+       }
+       return nil;
+}
+
 @end
 
 
@@ -100,10 +111,12 @@
 @end
 
 @implementation NSColorWell (SKNSViewExtensions)
+
 - (void)deactivateSubcontrols {
     [self deactivate];
     [super deactivateSubcontrols];
 }
+
 @end
 
 
@@ -111,10 +124,12 @@
 @end
 
 @implementation SKLineWell (SKNSViewExtensions)
+
 - (void)deactivateSubcontrols {
     [self deactivate];
     [super deactivateSubcontrols];
 }
+
 @end
 
 
@@ -122,8 +137,14 @@
 @end
 
 @implementation SKFontPicker (SKNSViewExtensions)
+
 - (void)deactivateSubcontrols {
     [self deactivate];
     [super deactivateSubcontrols];
 }
+
+- (id)activeFontPickerSubview {
+    return [self isActive] ? self : [super activeFontPickerSubview];
+}
+
 @end

Modified: trunk/SKFontPicker.h
===================================================================
--- trunk/SKFontPicker.h        2008-04-15 17:41:57 UTC (rev 3734)
+++ trunk/SKFontPicker.h        2008-04-15 18:15:22 UTC (rev 3735)
@@ -57,8 +57,6 @@
     BOOL updatingFromBinding;
 }
 
-+ (SKFontPicker *)activeFontPicker;
-
 - (void)activate;
 - (void)deactivate;
 

Modified: trunk/SKFontPicker.m
===================================================================
--- trunk/SKFontPicker.m        2008-04-15 17:41:57 UTC (rev 3734)
+++ trunk/SKFontPicker.m        2008-04-15 18:15:22 UTC (rev 3735)
@@ -63,8 +63,6 @@
 
 @implementation SKFontPicker
 
-static SKFontPicker *activeFontPicker = nil;
-
 + (void)initialize {
     OBINITIALIZE;
     
@@ -79,10 +77,6 @@
     [self setKeys:[NSArray arrayWithObjects:SKFontPickerFontKey, nil] 
triggerChangeNotificationsForDependentKey:SKFontPickerFontSizeKey];
 }
 
-+ (SKFontPicker *)activeFontPicker {
-    return activeFontPicker;
-}
-
 - (Class)valueClassForBinding:(NSString *)binding {
     if ([binding isEqualToString:SKFontPickerFontNameKey])
         return [NSString class];
@@ -245,7 +239,6 @@
     [fm setSelectedFont:[self font] isMultiple:NO];
     [fm orderFrontFontPanel:self];
     
-    activeFontPicker = self;
     [nc addObserver:self selector:@selector(fontPickerWillBecomeActive:)
                name:SKFontPickerWillBecomeActiveNotification object:nil];
     [nc addObserver:self selector:@selector(fontPanelWillClose:)
@@ -257,7 +250,6 @@
 }
 
 - (void)deactivate {
-    if (activeFontPicker == self) activeFontPicker = nil;
     [[NSNotificationCenter defaultCenter] removeObserver:self];
     [self setState:NSOffState];
     [self setKeyboardFocusRingNeedsDisplayInRect:[self bounds]];

Modified: trunk/SKPreferenceController.m
===================================================================
--- trunk/SKPreferenceController.m      2008-04-15 17:41:57 UTC (rev 3734)
+++ trunk/SKPreferenceController.m      2008-04-15 18:15:22 UTC (rev 3735)
@@ -239,7 +239,7 @@
 }
 
 - (IBAction)changeFont:(id)sender {
-    [[SKFontPicker activeFontPicker] changeFontFromFontManager];
+    [[[[self window] contentView] activeFontPickerSubview] 
changeFontFromFontManager];
 }
 
 - (IBAction)resetAll:(id)sender {


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 the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to