Revision: 6798
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6798&view=rev
Author:   hofman
Date:     2010-09-12 12:15:27 +0000 (Sun, 12 Sep 2010)

Log Message:
-----------
set contentview of navigation tooltip window to the view rather than adding it 
as a subview

Modified Paths:
--------------
    trunk/SKNavigationWindow.h
    trunk/SKNavigationWindow.m

Modified: trunk/SKNavigationWindow.h
===================================================================
--- trunk/SKNavigationWindow.h  2010-09-11 11:20:57 UTC (rev 6797)
+++ trunk/SKNavigationWindow.h  2010-09-12 12:15:27 UTC (rev 6798)
@@ -58,7 +58,6 @@
 
 
 @interface SKNavigationToolTipWindow : NSPanel {
-    SKNavigationToolTipView *toolTipView;
     NSView *view;
 }
 + (id)sharedToolTipWindow;
@@ -71,7 +70,7 @@
 }
 @property (nonatomic, retain) NSString *stringValue;
 @property (nonatomic, readonly) NSAttributedString *attributedStringValue;
-- (void)sizeToFit;
+...@property (nonatomic, readonly) NSSize fitSize;
 @end
 
 

Modified: trunk/SKNavigationWindow.m
===================================================================
--- trunk/SKNavigationWindow.m  2010-09-11 11:20:57 UTC (rev 6797)
+++ trunk/SKNavigationWindow.m  2010-09-12 12:15:27 UTC (rev 6798)
@@ -235,24 +235,11 @@
         [self setReleasedWhenClosed:NO];
         [self setHidesOnDeactivate:NO];
         
-        toolTipView = [[[SKNavigationToolTipView alloc] init] autorelease];
-        [[self contentView] addSubview:toolTipView];
+        [self setContentView:[[[SKNavigationToolTipView alloc] init] 
autorelease]];
     }
     return self;
 }
 
-- (id)initWithCoder:(NSCoder *)decoder {
-    if (self = [super initWithCoder:decoder]) {
-        toolTipView = [decoder decodeObjectForKey:@"toolTipView"];
-    }
-    return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)coder {
-    [super encodeWithCoder:coder];
-    [coder encodeConditionalObject:toolTipView forKey:@"toolTipView"];
-}
-
 - (BOOL)canBecomeKeyWindow { return NO; }
 
 - (BOOL)canBecomeMainWindow { return NO; }
@@ -260,11 +247,11 @@
 - (void)showToolTip:(NSString *)toolTip forView:(NSView *)aView {
     [view release];
     view = [aView retain];
-    [toolTipView setStringValue:toolTip];
-    [toolTipView sizeToFit];
-    NSRect newFrame = [self frameRectForContentRect:[toolTipView frame]];
+    [[self contentView] setStringValue:toolTip];
+    NSRect newFrame;
     NSRect viewRect = [view convertRect:[view bounds] toView:nil];
     viewRect.origin = [[view window] convertBaseToScreen:viewRect.origin];
+    newFrame.size = [[self contentView] fitSize];
     newFrame.origin = NSMakePoint(ceil(NSMidX(viewRect) - 0.5 * 
NSWidth(newFrame)), NSMaxY(viewRect) + LABEL_OFFSET);
     [self setFrame:newFrame display:YES];
     [self setLevel:[[view window] level]];
@@ -334,11 +321,9 @@
     return [[[NSAttributedString alloc] initWithString:stringValue 
attributes:attrs] autorelease];
 }
 
-- (void)sizeToFit {
-    NSSize size = [[self attributedStringValue] size];
-    size.width = ceil(size.width + 2 * LABEL_TEXT_MARGIN);
-    size.height += 2 * LABEL_TEXT_MARGIN;
-    [self setFrameSize:size];
+- (NSSize)fitSize {
+    NSSize stringSize = [[self attributedStringValue] size];
+    return NSMakeSize(ceil(stringSize.width + 2 * LABEL_TEXT_MARGIN), 
ceil(stringSize.height + 2 * LABEL_TEXT_MARGIN));
 }
 
 - (void)drawRect:(NSRect)rect {


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

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to