Subversion Repositories TruePreview

[/] [trunk/] [Source/] [TruePreviewMessageViewer.m] - Diff between revs 23 and 33

Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | View Log

Rev 23 Rev 33
Line 149... Line 149...
   
   
    if (
    if (
      ![self isKindOfClass:NSClassFromString(@"SingleMessageViewer")]
      ![self isKindOfClass:NSClassFromString(@"SingleMessageViewer")]
      && [[theSettings objectForKey:@"scroll"] boolValue]
      && [[theSettings objectForKey:@"scroll"] boolValue]
    ) {
    ) {
 
      // listen for selection change (mouse down) on message content view
 
      [[NSNotificationCenter defaultCenter]
 
        addObserver:self
 
        selector:@selector(truePreviewMessageClickedOrScrolled:)
 
        name:@"WebViewDidChangeSelectionNotification"
 
        object:[[object_getIvar(self, class_getInstanceVariable([self class], "_contentController")) currentDisplay] contentView]
 
      ];
 
     
      // listen for bounds change notification on the message's clip view
      // listen for bounds change notification on the message's clip view
      [[NSNotificationCenter defaultCenter]
      [[NSNotificationCenter defaultCenter]
        addObserver:self
        addObserver:self
        selector:@selector(truePreviewBoundsDidChange:)
        selector:@selector(truePreviewMessageClickedOrScrolled:)
        name:NSViewBoundsDidChangeNotification
        name:NSViewBoundsDidChangeNotification
        object:[[[[object_getIvar(self, class_getInstanceVariable([self class], "_contentController")) currentDisplay] contentView] enclosingScrollView] contentView]
        object:[[[[object_getIvar(self, class_getInstanceVariable([self class], "_contentController")) currentDisplay] contentView] enclosingScrollView] contentView]
      ];
      ];
    }    
    }    
  }
  }
Line 215... Line 223...
  if ((theTimer != nil) && [theTimer isValid]) {
  if ((theTimer != nil) && [theTimer isValid]) {
    [theTimer invalidate];
    [theTimer invalidate];
  }
  }
 
 
  // stop observing when changed
  // stop observing when changed
 
  [[NSNotificationCenter defaultCenter]
 
    removeObserver:self
 
    name:@"WebViewDidChangeSelectionNotification"
 
    object:[[object_getIvar(self, class_getInstanceVariable([self class], "_contentController")) currentDisplay] contentView]
 
  ];
  [[NSNotificationCenter defaultCenter]
  [[NSNotificationCenter defaultCenter]
    removeObserver:self
    removeObserver:self
    name:NSViewBoundsDidChangeNotification
    name:NSViewBoundsDidChangeNotification
    object:[[[[object_getIvar(self, class_getInstanceVariable([self class], "_contentController")) currentDisplay] contentView] enclosingScrollView] contentView]
    object:[[[[object_getIvar(self, class_getInstanceVariable([self class], "_contentController")) currentDisplay] contentView] enclosingScrollView] contentView]
  ];
  ];
Line 230... Line 243...
  if ([[self currentDisplayedMessage] isKindOfClass:NSClassFromString(@"LibraryMessage")]) {
  if ([[self currentDisplayedMessage] isKindOfClass:NSClassFromString(@"LibraryMessage")]) {
    [[self currentDisplayedMessage] truePreviewMarkAsViewed];
    [[self currentDisplayedMessage] truePreviewMarkAsViewed];
  }
  }
}
}
 
 
- (void)truePreviewBoundsDidChange:(NSNotification*)inNotification {
- (void)truePreviewMessageClickedOrScrolled:(NSNotification*)inNotification {
  // ignore the first time we get the notification; it may be an initial scroll
  // ignore the first time we get the notification; it may be an initial scroll
  // to the origin after changing messages
  // to the origin after changing messages
  static BOOL sIsFirstTime = YES;
  static BOOL sIsFirstTime = YES;
 
 
  if (sIsFirstTime) {
  if ([NSViewBoundsDidChangeNotification isEqualToString:[inNotification name]] && sIsFirstTime) {
    sIsFirstTime = NO;
    sIsFirstTime = NO;
   
   
    return;
    return;
  }
  }