Frameworks/AIUtilities Framework/Source/JVMarkedScroller.m
author <kcochran@trolans.net>
Sat, 19 Oct 2019 17:36:48 -0700
branchfix-sFlags
changeset 5993 95e8102125d0
parent 4759 ab1d8f004486
permissions -rw-r--r--
Update JVMarkedScroller to use public APIs to determine scroller direction
3679
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 3071
diff changeset
     1
/* 
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 3071
diff changeset
     2
 * Adium is the legal property of its developers, whose names are listed in the copyright file included
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 3071
diff changeset
     3
 * with this source distribution.
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 3071
diff changeset
     4
 * 
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 3071
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 3071
diff changeset
     6
 * General Public License as published by the Free Software Foundation; either version 2 of the License,
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 3071
diff changeset
     7
 * or (at your option) any later version.
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 3071
diff changeset
     8
 * 
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 3071
diff changeset
     9
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 3071
diff changeset
    10
 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 3071
diff changeset
    11
 * Public License for more details.
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 3071
diff changeset
    12
 * 
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 3071
diff changeset
    13
 * You should have received a copy of the GNU General Public License along with this program; if not,
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 3071
diff changeset
    14
 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 3071
diff changeset
    15
 */
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    16
// From Colloquy  (www.colloquy.info)
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    17
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    18
#import "JVMarkedScroller.h"
1537
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
    19
#import "AIStringUtilities.h"
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    20
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    21
struct _mark {
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
    22
	NSUInteger location;
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    23
	NSString *identifier;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    24
	NSColor *color;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    25
};
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    26
3069
fca2770e97c0 Declare protocols invoked through @selectors
Stephen Holt <sholt@adium.im>
parents: 3063
diff changeset
    27
@interface JVMarkedScroller (PRIVATE)
fca2770e97c0 Declare protocols invoked through @selectors
Stephen Holt <sholt@adium.im>
parents: 3063
diff changeset
    28
- (IBAction) clearMarksHereLess:(id) sender;
fca2770e97c0 Declare protocols invoked through @selectors
Stephen Holt <sholt@adium.im>
parents: 3063
diff changeset
    29
- (IBAction) clearMarksHereGreater:(id) sender;
fca2770e97c0 Declare protocols invoked through @selectors
Stephen Holt <sholt@adium.im>
parents: 3063
diff changeset
    30
@end
fca2770e97c0 Declare protocols invoked through @selectors
Stephen Holt <sholt@adium.im>
parents: 3063
diff changeset
    31
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    32
@implementation JVMarkedScroller
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    33
- (id) initWithFrame:(NSRect) frame {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    34
	if( ( self = [super initWithFrame:frame] ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    35
		_marks = [[NSMutableSet set] retain];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    36
		_shades = [[NSMutableArray array] retain];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    37
		_nearestPreviousMark = NSNotFound;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    38
		_nearestNextMark = NSNotFound;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    39
		_currentMark = NSNotFound;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    40
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    41
	return self;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    42
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    43
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    44
- (void) dealloc {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    45
	[_marks release];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    46
	[_shades release];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    47
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    48
	_marks = nil;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    49
	_shades = nil;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    50
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    51
	[super dealloc];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    52
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    53
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    54
#pragma mark -
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    55
5993
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 4759
diff changeset
    56
- (BOOL)isHorizontalScroller {
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 4759
diff changeset
    57
    return self.enclosingScrollView.horizontalScroller == self;
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 4759
diff changeset
    58
}
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 4759
diff changeset
    59
4171
d29e1b34966c This turns on the Lion overlay scrollers. The markings seem to still work, but they look a bit small to me.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3679
diff changeset
    60
+ (BOOL)isCompatibleWithOverlayScrollers {
d29e1b34966c This turns on the Lion overlay scrollers. The markings seem to still work, but they look a bit small to me.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3679
diff changeset
    61
    return self == [JVMarkedScroller class];
d29e1b34966c This turns on the Lion overlay scrollers. The markings seem to still work, but they look a bit small to me.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3679
diff changeset
    62
}
d29e1b34966c This turns on the Lion overlay scrollers. The markings seem to still work, but they look a bit small to me.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3679
diff changeset
    63
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    64
- (void) drawRect:(NSRect) rect {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    65
	[super drawRect:rect];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    66
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    67
	NSAffineTransform *transform = [NSAffineTransform transform];
4753
e5f7898181b6 Add a reminder here.
Frank Dowsett <wixardy@adium.im>
parents: 4738
diff changeset
    68
	//Use -scrollerWidthForControlSize:scrollerStyle: on 10.7+
4738
39f02130086e Use the deprecated method for now.
Frank Dowsett <wixardy@adium.im>
parents: 4736
diff changeset
    69
	CGFloat width = [[self class] scrollerWidthForControlSize:[self controlSize]];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    70
	
3062
e04a00f58ce6 Fixing implicit 64->32 bit casts in AIUtilities.
Stephen Holt <sholt@adium.im>
parents: 2634
diff changeset
    71
	CGFloat scale = [self scaleToContentView];
5993
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 4759
diff changeset
    72
	[transform scaleXBy:( self.isHorizontalScroller ? scale : 1.f ) yBy:( self.isHorizontalScroller ? 1.f : scale )];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    73
	
3062
e04a00f58ce6 Fixing implicit 64->32 bit casts in AIUtilities.
Stephen Holt <sholt@adium.im>
parents: 2634
diff changeset
    74
	CGFloat offset = [self rectForPart:NSScrollerKnobSlot].origin.y;
5993
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 4759
diff changeset
    75
	[transform translateXBy:( self.isHorizontalScroller ? offset / scale : 0.f ) yBy:( self.isHorizontalScroller ? 0.f : offset / scale )];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    76
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    77
	NSBezierPath *shades = [NSBezierPath bezierPath];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    78
	NSEnumerator *enumerator = [_shades objectEnumerator];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    79
	NSNumber *startNum = nil;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    80
	NSNumber *stopNum = nil;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    81
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    82
	while( ( startNum = [enumerator nextObject] ) && ( stopNum = [enumerator nextObject] ) ) {
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
    83
		NSUInteger start = [startNum unsignedIntegerValue];
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
    84
		NSUInteger stop = [stopNum unsignedIntegerValue];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    85
		
3063
3efcc26ae847 Remove the shadow (variables) in AIUtiities.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    86
		NSRect shadesRect = NSZeroRect;
5993
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 4759
diff changeset
    87
		if( self.isHorizontalScroller ) shadesRect = NSMakeRect( start, 0.f, ( stop - start ), width );
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
    88
		else shadesRect = NSMakeRect( 0.f, start, width, ( stop - start ) );
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    89
		
3063
3efcc26ae847 Remove the shadow (variables) in AIUtiities.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    90
		shadesRect.origin = [transform transformPoint:shadesRect.origin];
3efcc26ae847 Remove the shadow (variables) in AIUtiities.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    91
		shadesRect.size = [transform transformSize:shadesRect.size];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    92
		
3063
3efcc26ae847 Remove the shadow (variables) in AIUtiities.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    93
		[shades appendBezierPathWithRect:shadesRect];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    94
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    95
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    96
	if( ( [_shades count] % 2 ) == 1 ) {
3063
3efcc26ae847 Remove the shadow (variables) in AIUtiities.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    97
		NSRect shadesRect = NSZeroRect;
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
    98
		NSUInteger start = [[_shades lastObject] unsignedIntegerValue];
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
    99
		CGFloat stop = [self contentViewLength];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   100
		
5993
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 4759
diff changeset
   101
		if( self.isHorizontalScroller ) shadesRect = NSMakeRect( start, 0.f, ( stop - start ), width );
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   102
		else shadesRect = NSMakeRect( 0.f, start, width, ( stop - start ) );
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   103
		
3063
3efcc26ae847 Remove the shadow (variables) in AIUtiities.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
   104
		shadesRect.origin = [transform transformPoint:shadesRect.origin];
3efcc26ae847 Remove the shadow (variables) in AIUtiities.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
   105
		shadesRect.size = [transform transformSize:shadesRect.size];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   106
		
3063
3efcc26ae847 Remove the shadow (variables) in AIUtiities.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
   107
		[shades appendBezierPathWithRect:NSIntegralRect( shadesRect )];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   108
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   109
	
4730
1a15a9767bc9 Don't shrink the scrollbar marks too much.
Frank Dowsett <wixardy@adium.im>
parents: 4171
diff changeset
   110
	NSRectClip( NSInsetRect( [self rectForPart:NSScrollerKnobSlot], 1, 1 ) );
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   111
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   112
	if( ! [shades isEmpty ] ) {
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   113
		[[[NSColor knobColor] colorWithAlphaComponent:0.45f] set];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   114
		[shades fill];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   115
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   116
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   117
	NSBezierPath *lines = [NSBezierPath bezierPath];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   118
	NSMutableArray *lineArray = [NSMutableArray array];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   119
	enumerator = [_marks objectEnumerator];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   120
	NSValue *currentMark = nil;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   121
	
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   122
	NSUInteger currentPosition = ( _currentMark != NSNotFound ? _currentMark : (CGFloat)[self floatValue] * [self contentViewLength] );
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   123
	BOOL foundNext = NO, foundPrevious = NO;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   124
	NSRect knobRect = [self rectForPart:NSScrollerKnob];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   125
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   126
	while( ( currentMark = [enumerator nextObject] ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   127
		struct _mark mark;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   128
		[currentMark getValue:&mark];
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   129
		NSUInteger value = mark.location;
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   130
		
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   131
		if( value < currentPosition && ( ! foundPrevious || value > _nearestPreviousMark ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   132
			_nearestPreviousMark = value;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   133
			foundPrevious = YES;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   134
		}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   135
		
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   136
		if( value > currentPosition && ( ! foundNext || value < _nearestNextMark ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   137
			_nearestNextMark = value;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   138
			foundNext = YES;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   139
		}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   140
		
5993
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 4759
diff changeset
   141
		NSPoint point = NSMakePoint( ( self.isHorizontalScroller ? value : 0 ), ( self.isHorizontalScroller ? 0 : value ) );
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   142
		point = [transform transformPoint:point];
5993
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 4759
diff changeset
   143
		point.x = ( self.isHorizontalScroller ? AIround( point.x ) + 0.5f : point.x );
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 4759
diff changeset
   144
		point.y = ( self.isHorizontalScroller ? point.y : AIround( point.y ) + 0.5f );
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   145
		
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   146
		if( ! NSPointInRect( point, knobRect ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   147
			if( mark.color ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   148
				NSBezierPath *line = [NSBezierPath bezierPath];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   149
				[line moveToPoint:point];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   150
				
5993
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 4759
diff changeset
   151
				point = NSMakePoint( ( self.isHorizontalScroller ? 0.f : width ), ( self.isHorizontalScroller ? width : 0.f ) );
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   152
				[line relativeLineToPoint:point];
4759
ab1d8f004486 Try using a bit thicker scrollbar indicators.
Frank Dowsett <wixardy@adium.im>
parents: 4753
diff changeset
   153
				[line setLineWidth:2];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   154
				[lineArray addObject:mark.color];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   155
				[lineArray addObject:line];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   156
			} else {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   157
				[lines moveToPoint:point];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   158
				
5993
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 4759
diff changeset
   159
				point = NSMakePoint( ( self.isHorizontalScroller ? 0.f : width ), ( self.isHorizontalScroller ? width : 0.f ) );
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   160
				[lines relativeLineToPoint:point];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   161
			}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   162
		}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   163
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   164
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   165
	if( ! foundPrevious ) _nearestPreviousMark = NSNotFound;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   166
	if( ! foundNext ) _nearestNextMark = NSNotFound;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   167
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   168
	if( ! [lines isEmpty] ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   169
		[[NSColor selectedKnobColor] set];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   170
		[lines stroke];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   171
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   172
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   173
	// This is so we can draw the colored lines after the regular lines
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   174
	enumerator = [lineArray objectEnumerator];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   175
	NSColor *lineColor = nil;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   176
	while( ( lineColor = [enumerator nextObject] ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   177
		[lineColor set];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   178
		[[enumerator nextObject] stroke];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   179
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   180
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   181
	if( ! [shades isEmpty] )
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   182
		[self drawKnob];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   183
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   184
1680
8278c635ac3d Tweak JVMarkedScroller to use the modern replacements for -setFloatValue:knobProportion:
David Smith
parents: 1581
diff changeset
   185
- (void) setFloatValue:(float) position
8278c635ac3d Tweak JVMarkedScroller to use the modern replacements for -setFloatValue:knobProportion:
David Smith
parents: 1581
diff changeset
   186
{
1684
79493e025a4b NSScroller uses deprecated stuff internally :( Fix infinite recursion
David Smith
parents: 1680
diff changeset
   187
	if( ! _jumpingToMark ) _currentMark = NSNotFound;
79493e025a4b NSScroller uses deprecated stuff internally :( Fix infinite recursion
David Smith
parents: 1680
diff changeset
   188
	if( ( [self floatValue] != position) && ( [_marks count] || [_shades count] ) )
79493e025a4b NSScroller uses deprecated stuff internally :( Fix infinite recursion
David Smith
parents: 1680
diff changeset
   189
		[self setNeedsDisplayInRect:[self rectForPart:NSScrollerKnobSlot]];
1685
7431195d02e6 Durrr...
David Smith
parents: 1684
diff changeset
   190
	[super setFloatValue:position];
1680
8278c635ac3d Tweak JVMarkedScroller to use the modern replacements for -setFloatValue:knobProportion:
David Smith
parents: 1581
diff changeset
   191
}
8278c635ac3d Tweak JVMarkedScroller to use the modern replacements for -setFloatValue:knobProportion:
David Smith
parents: 1581
diff changeset
   192
2634
f8f70fff48f1 Type fixes for adium. making it ready for 64-bit compiling.
Stephen Holt <sholt@adium.im>
parents: 1685
diff changeset
   193
- (void) setKnobProportion:(CGFloat)percent 
1680
8278c635ac3d Tweak JVMarkedScroller to use the modern replacements for -setFloatValue:knobProportion:
David Smith
parents: 1581
diff changeset
   194
{
1684
79493e025a4b NSScroller uses deprecated stuff internally :( Fix infinite recursion
David Smith
parents: 1680
diff changeset
   195
	if( ! _jumpingToMark ) _currentMark = NSNotFound;
79493e025a4b NSScroller uses deprecated stuff internally :( Fix infinite recursion
David Smith
parents: 1680
diff changeset
   196
	if(([self knobProportion] != percent ) && ( [_marks count] || [_shades count] ) )
79493e025a4b NSScroller uses deprecated stuff internally :( Fix infinite recursion
David Smith
parents: 1680
diff changeset
   197
		[self setNeedsDisplayInRect:[self rectForPart:NSScrollerKnobSlot]];
1685
7431195d02e6 Durrr...
David Smith
parents: 1684
diff changeset
   198
	[super setKnobProportion:percent];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   199
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   200
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   201
- (NSMenu *) menuForEvent:(NSEvent *) event {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   202
	NSMenu *menu = [[[NSMenu alloc] initWithTitle:@""] autorelease];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   203
	NSMenuItem *item = nil;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   204
	
1537
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   205
	item = [[[NSMenuItem alloc] initWithTitle:AILocalizedStringFromTableInBundle( @"Clear All Marks", nil, [NSBundle bundleWithIdentifier:AIUTILITIES_BUNDLE_ID], "clear all marks contextual menu item title" ) 
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   206
									   action:@selector( removeAllMarks ) 
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   207
								keyEquivalent:@""] autorelease];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   208
	[item setTarget:self];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   209
	[menu addItem:item];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   210
	
5993
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 4759
diff changeset
   211
	if( self.isHorizontalScroller ) {
1537
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   212
		item = [[[NSMenuItem alloc] initWithTitle:AILocalizedStringFromTableInBundle( @"Clear Marks from Here Left", nil, [NSBundle bundleWithIdentifier:AIUTILITIES_BUNDLE_ID], "clear marks from here left contextual menu") 
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   213
										   action:@selector( clearMarksHereLess: ) 
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   214
									keyEquivalent:@""] autorelease];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   215
		[item setTarget:self];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   216
		[menu addItem:item];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   217
		
1537
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   218
		item = [[[NSMenuItem alloc] initWithTitle:AILocalizedStringFromTableInBundle( @"Clear Marks from Here Right", nil, [NSBundle bundleWithIdentifier:AIUTILITIES_BUNDLE_ID], "clear marks from here right contextual menu") 
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   219
										   action:@selector( clearMarksHereGreater: ) keyEquivalent:@""] 
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   220
				autorelease];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   221
		[item setTarget:self];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   222
		[menu addItem:item];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   223
	} else {
1537
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   224
		item = [[[NSMenuItem alloc] initWithTitle:AILocalizedStringFromTableInBundle( @"Clear Marks from Here Up", nil, [NSBundle bundleWithIdentifier:AIUTILITIES_BUNDLE_ID], "clear marks from here up contextual menu") 
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   225
										   action:@selector( clearMarksHereLess: ) 
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   226
									keyEquivalent:@""] autorelease];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   227
		[item setTarget:self];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   228
		[menu addItem:item];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   229
		
1537
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   230
		item = [[[NSMenuItem alloc] initWithTitle:AILocalizedStringFromTableInBundle( @"Clear Marks from Here Down", nil, [NSBundle bundleWithIdentifier:AIUTILITIES_BUNDLE_ID], "clear marks from here up contextual menu") 
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   231
										   action:@selector( clearMarksHereGreater: ) 
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   232
									keyEquivalent:@""] autorelease];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   233
		[item setTarget:self];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   234
		[menu addItem:item];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   235
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   236
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   237
	[menu addItem:[NSMenuItem separatorItem]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   238
	
1537
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   239
	item = [[[NSMenuItem alloc] initWithTitle:AILocalizedStringFromTableInBundle( @"Jump to Previous Mark", nil, [NSBundle bundleWithIdentifier:AIUTILITIES_BUNDLE_ID], "jump to previous mark contextual menu") 
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   240
									   action:@selector( jumpToPreviousMark: ) 
1543
99d18b12a90c Add a new Main Menu item "Display" (we could potentially rename this; I can't really think of a better term, but it's almost too similar to View). Moves the "Toggle User List" menu item into it, and adds "Jump to (Previous, Next, Focus) Mark" and "Add Mark". Add Mark inserts a green mark.
Zachary West <zacw@adiumx.com>
parents: 1537
diff changeset
   241
								keyEquivalent:@"["] autorelease];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   242
	[item setTarget:self];
1543
99d18b12a90c Add a new Main Menu item "Display" (we could potentially rename this; I can't really think of a better term, but it's almost too similar to View). Moves the "Toggle User List" menu item into it, and adds "Jump to (Previous, Next, Focus) Mark" and "Add Mark". Add Mark inserts a green mark.
Zachary West <zacw@adiumx.com>
parents: 1537
diff changeset
   243
	[item setKeyEquivalentModifierMask:NSAlternateKeyMask | NSCommandKeyMask];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   244
	[menu addItem:item];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   245
	
1537
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   246
	item = [[[NSMenuItem alloc] initWithTitle:AILocalizedStringFromTableInBundle( @"Jump to Next Mark", nil, [NSBundle bundleWithIdentifier:AIUTILITIES_BUNDLE_ID], "jump to next mark contextual menu")
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   247
									   action:@selector( jumpToNextMark: )
1543
99d18b12a90c Add a new Main Menu item "Display" (we could potentially rename this; I can't really think of a better term, but it's almost too similar to View). Moves the "Toggle User List" menu item into it, and adds "Jump to (Previous, Next, Focus) Mark" and "Add Mark". Add Mark inserts a green mark.
Zachary West <zacw@adiumx.com>
parents: 1537
diff changeset
   248
								keyEquivalent:@"]"] autorelease];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   249
	[item setTarget:self];
1543
99d18b12a90c Add a new Main Menu item "Display" (we could potentially rename this; I can't really think of a better term, but it's almost too similar to View). Moves the "Toggle User List" menu item into it, and adds "Jump to (Previous, Next, Focus) Mark" and "Add Mark". Add Mark inserts a green mark.
Zachary West <zacw@adiumx.com>
parents: 1537
diff changeset
   250
	[item setKeyEquivalentModifierMask:NSAlternateKeyMask | NSCommandKeyMask];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   251
	[menu addItem:item];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   252
	
1537
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   253
	item = [[[NSMenuItem alloc] initWithTitle:AILocalizedStringFromTableInBundle( @"Jump to Focus Mark", nil, [NSBundle bundleWithIdentifier:AIUTILITIES_BUNDLE_ID], "jump to the mark where the last content the user saw ends")
1581
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   254
									   action:@selector( jumpToFocusMark: ) 
1537
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   255
								keyEquivalent:@""] autorelease];
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   256
	[item setTarget:self];
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   257
	[menu addItem:item];	
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   258
	
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   259
	return menu;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   260
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   261
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   262
#pragma mark -
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   263
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   264
- (void) updateNextAndPreviousMarks {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   265
	NSEnumerator *enumerator = [_marks objectEnumerator];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   266
	NSValue *currentMark = nil;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   267
	
3062
e04a00f58ce6 Fixing implicit 64->32 bit casts in AIUtilities.
Stephen Holt <sholt@adium.im>
parents: 2634
diff changeset
   268
	unsigned long long currentPosition = ( _currentMark != NSNotFound ? _currentMark : (CGFloat)[self floatValue] * [self contentViewLength] );
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   269
	BOOL foundNext = NO, foundPrevious = NO;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   270
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   271
	while( ( currentMark = [enumerator nextObject] ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   272
		struct _mark mark;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   273
		[currentMark getValue:&mark];
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   274
		NSUInteger value = mark.location;
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   275
		
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   276
		if( value < currentPosition && ( ! foundPrevious || value > _nearestPreviousMark ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   277
			_nearestPreviousMark = value;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   278
			foundPrevious = YES;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   279
		}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   280
		
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   281
		if( value > currentPosition && ( ! foundNext || value < _nearestNextMark ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   282
			_nearestNextMark = value;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   283
			foundNext = YES;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   284
		}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   285
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   286
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   287
	if( ! foundPrevious ) _nearestPreviousMark = NSNotFound;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   288
	if( ! foundNext ) _nearestNextMark = NSNotFound;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   289
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   290
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   291
#pragma mark -
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   292
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   293
- (IBAction) clearMarksHereLess:(id) sender {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   294
	NSEvent *event = [[NSApplication sharedApplication] currentEvent];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   295
	NSPoint where = [self convertPoint:[event locationInWindow] fromView:nil];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   296
	NSRect slotRect = [self rectForPart:NSScrollerKnobSlot];
3062
e04a00f58ce6 Fixing implicit 64->32 bit casts in AIUtilities.
Stephen Holt <sholt@adium.im>
parents: 2634
diff changeset
   297
	CGFloat scale = [self scaleToContentView];
5993
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 4759
diff changeset
   298
	[self removeMarksLessThan:( ( self.isHorizontalScroller ? where.x - NSMinX( slotRect ) : where.y - NSMinY( slotRect ) ) / scale )];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   299
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   300
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   301
- (IBAction) clearMarksHereGreater:(id) sender {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   302
	NSEvent *event = [[NSApplication sharedApplication] currentEvent];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   303
	NSPoint where = [self convertPoint:[event locationInWindow] fromView:nil];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   304
	NSRect slotRect = [self rectForPart:NSScrollerKnobSlot];
3062
e04a00f58ce6 Fixing implicit 64->32 bit casts in AIUtilities.
Stephen Holt <sholt@adium.im>
parents: 2634
diff changeset
   305
	CGFloat scale = [self scaleToContentView];
5993
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 4759
diff changeset
   306
	[self removeMarksGreaterThan:( ( self.isHorizontalScroller ? where.x - NSMinX( slotRect ) : where.y - NSMinY( slotRect ) ) / scale )];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   307
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   308
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   309
#pragma mark -
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   310
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   311
- (void) setLocationOfCurrentMark:(NSUInteger) location {
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   312
	if( _currentMark != location ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   313
		_currentMark = location;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   314
		[self updateNextAndPreviousMarks];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   315
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   316
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   317
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   318
- (unsigned long long) locationOfCurrentMark {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   319
	return _currentMark;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   320
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   321
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   322
#pragma mark -
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   323
1581
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   324
- (BOOL)previousMarkExists
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   325
{
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   326
	return _nearestPreviousMark != NSNotFound;
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   327
}
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   328
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   329
- (IBAction) jumpToPreviousMark:(id) sender {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   330
	if( _nearestPreviousMark != NSNotFound ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   331
		_currentMark = _nearestPreviousMark;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   332
		_jumpingToMark = YES;
3062
e04a00f58ce6 Fixing implicit 64->32 bit casts in AIUtilities.
Stephen Holt <sholt@adium.im>
parents: 2634
diff changeset
   333
		CGFloat shift = [self shiftAmountToCenterAlign];
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   334
		[[(NSScrollView *)[self superview] documentView] scrollPoint:NSMakePoint( 0.f, _currentMark - shift )];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   335
		_jumpingToMark = NO;
1555
aee11049aa56 Correct JVMarkedScroller's behavior when it tries to scroll to a mark which doesn't trigger the knob to move, such as when the knob is all the way at the bottom. Since it wouldn't need to redraw, it doesn't, so the previousMark never gets updated (so it never updates to go to the previous one).
Zachary West <zacw@adiumx.com>
parents: 1543
diff changeset
   336
		
aee11049aa56 Correct JVMarkedScroller's behavior when it tries to scroll to a mark which doesn't trigger the knob to move, such as when the knob is all the way at the bottom. Since it wouldn't need to redraw, it doesn't, so the previousMark never gets updated (so it never updates to go to the previous one).
Zachary West <zacw@adiumx.com>
parents: 1543
diff changeset
   337
		[self setNeedsDisplayInRect:[self rectForPart:NSScrollerKnobSlot]];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   338
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   339
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   340
1581
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   341
- (BOOL)nextMarkExists
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   342
{
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   343
	return _nearestNextMark != NSNotFound;
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   344
}
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   345
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   346
- (IBAction) jumpToNextMark:(id) sender {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   347
	if( _nearestNextMark != NSNotFound ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   348
		_currentMark = _nearestNextMark;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   349
		_jumpingToMark = YES;
3062
e04a00f58ce6 Fixing implicit 64->32 bit casts in AIUtilities.
Stephen Holt <sholt@adium.im>
parents: 2634
diff changeset
   350
		CGFloat shift = [self shiftAmountToCenterAlign];
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   351
		[[(NSScrollView *)[self superview] documentView] scrollPoint:NSMakePoint( 0.f, _currentMark - shift )];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   352
		_jumpingToMark = NO;
1555
aee11049aa56 Correct JVMarkedScroller's behavior when it tries to scroll to a mark which doesn't trigger the knob to move, such as when the knob is all the way at the bottom. Since it wouldn't need to redraw, it doesn't, so the previousMark never gets updated (so it never updates to go to the previous one).
Zachary West <zacw@adiumx.com>
parents: 1543
diff changeset
   353
		
aee11049aa56 Correct JVMarkedScroller's behavior when it tries to scroll to a mark which doesn't trigger the knob to move, such as when the knob is all the way at the bottom. Since it wouldn't need to redraw, it doesn't, so the previousMark never gets updated (so it never updates to go to the previous one).
Zachary West <zacw@adiumx.com>
parents: 1543
diff changeset
   354
		[self setNeedsDisplayInRect:[self rectForPart:NSScrollerKnobSlot]];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   355
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   356
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   357
1581
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   358
- (BOOL)focusMarkExists
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   359
{
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   360
	NSEnumerator *e = [_marks objectEnumerator];
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   361
	NSValue *obj = nil;
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   362
	BOOL foundMark = NO;
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   363
	
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   364
	while( ( obj = [e nextObject] ) ) {
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   365
		struct _mark mark;
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   366
		[obj getValue:&mark];
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   367
		if( [mark.identifier isEqualToString:@"focus"] ) {
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   368
			_currentMark = mark.location;
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   369
			foundMark = YES;
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   370
			break;
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   371
		}
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   372
	}
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   373
	
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   374
	return foundMark;
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   375
}
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   376
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1555
diff changeset
   377
- (IBAction)jumpToFocusMark:(id)sender
1537
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   378
{
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   379
	[self jumpToMarkWithIdentifier:@"focus"];
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   380
}
d4b6b6374d81 When either the the active chat's window loses focus, or the tab view item is deselected, add a mark called "focus" with a red color. Adds a 'Jump to Mark Focus' menu item, and localizes the menu items from the AIUtilities bundle.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
   381
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   382
- (void) jumpToMarkWithIdentifier:(NSString *) identifier {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   383
	_jumpingToMark = YES;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   384
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   385
	NSEnumerator *e = [_marks objectEnumerator];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   386
	NSValue *obj = nil;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   387
	BOOL foundMark = NO;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   388
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   389
	while( ( obj = [e nextObject] ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   390
		struct _mark mark;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   391
		[obj getValue:&mark];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   392
		if( [mark.identifier isEqualToString:identifier] ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   393
			_currentMark = mark.location;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   394
			foundMark = YES;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   395
			break;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   396
		}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   397
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   398
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   399
	if( foundMark ) {
3062
e04a00f58ce6 Fixing implicit 64->32 bit casts in AIUtilities.
Stephen Holt <sholt@adium.im>
parents: 2634
diff changeset
   400
		CGFloat shift = [self shiftAmountToCenterAlign];
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   401
		[[(NSScrollView *)[self superview] documentView] scrollPoint:NSMakePoint( 0.f, _currentMark - shift )];
1555
aee11049aa56 Correct JVMarkedScroller's behavior when it tries to scroll to a mark which doesn't trigger the knob to move, such as when the knob is all the way at the bottom. Since it wouldn't need to redraw, it doesn't, so the previousMark never gets updated (so it never updates to go to the previous one).
Zachary West <zacw@adiumx.com>
parents: 1543
diff changeset
   402
		[self setNeedsDisplayInRect:[self rectForPart:NSScrollerKnobSlot]];
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   403
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   404
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   405
	_jumpingToMark = NO;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   406
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   407
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   408
#pragma mark -
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   409
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   410
- (void) shiftMarksAndShadedAreasBy:(NSInteger) displacement {
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   411
	BOOL negative = ( displacement >= 0 ? NO : YES );
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   412
	NSMutableSet *shiftedMarks = [NSMutableSet set];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   413
	NSValue *location = nil;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   414
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   415
	if( ! ( negative && _nearestPreviousMark < ABS( displacement ) ) ) _nearestPreviousMark += displacement;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   416
	else _nearestPreviousMark = NSNotFound;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   417
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   418
	if( ! ( negative && _nearestNextMark < ABS( displacement ) ) ) _nearestNextMark += displacement;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   419
	else _nearestNextMark = NSNotFound;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   420
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   421
	if( ! ( negative && _currentMark < ABS( displacement ) ) ) _currentMark += displacement;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   422
	else _currentMark = NSNotFound;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   423
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   424
	NSEnumerator *enumerator = [_marks objectEnumerator];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   425
	while( ( location = [enumerator nextObject] ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   426
		struct _mark mark;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   427
		[location getValue:&mark];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   428
		if( ! ( negative && mark.location < ABS( displacement ) ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   429
			mark.location += displacement;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   430
			[shiftedMarks addObject:[NSValue value:&mark withObjCType:@encode( struct _mark )]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   431
		}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   432
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   433
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   434
	[_marks setSet:shiftedMarks];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   435
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   436
	NSMutableArray *shiftedShades = [NSMutableArray array];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   437
	NSNumber *start = nil;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   438
	NSNumber *stop = nil;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   439
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   440
	enumerator = [_shades objectEnumerator];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   441
	while( ( start = [enumerator nextObject] ) && ( ( stop = [enumerator nextObject] ) || YES ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   442
		unsigned long long shiftedStart = [start unsignedLongLongValue];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   443
		
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   444
		if( stop ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   445
			unsigned long long shiftedStop = [stop unsignedLongLongValue];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   446
			if( ! ( negative && shiftedStart < ABS( displacement ) ) && ! ( negative && shiftedStop < ABS( displacement ) ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   447
				[shiftedShades addObject:[NSNumber numberWithUnsignedLongLong:( shiftedStart + displacement )]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   448
				[shiftedShades addObject:[NSNumber numberWithUnsignedLongLong:( shiftedStop + displacement )]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   449
			}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   450
		} else if( ! ( negative && shiftedStart < ABS( displacement ) ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   451
			[shiftedShades addObject:[NSNumber numberWithUnsignedLongLong:( shiftedStart + displacement )]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   452
		}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   453
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   454
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   455
	[_shades setArray:shiftedShades];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   456
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   457
	[self setNeedsDisplayInRect:[self rectForPart:NSScrollerKnobSlot]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   458
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   459
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   460
#pragma mark -
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   461
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   462
- (void) addMarkAt:(NSUInteger) location {
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   463
	[self addMarkAt:location withIdentifier:nil withColor:nil];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   464
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   465
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   466
- (void) addMarkAt:(NSUInteger) location withIdentifier:(NSString *) identifier {
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   467
	[self addMarkAt:location withIdentifier:identifier withColor:nil];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   468
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   469
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   470
- (void) addMarkAt:(NSUInteger) location withColor:(NSColor *) color {
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   471
	[self addMarkAt:location withIdentifier:nil withColor:color];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   472
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   473
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   474
- (void) addMarkAt:(NSUInteger) location withIdentifier:(NSString *) identifier withColor:(NSColor *) color {
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   475
	struct _mark mark = {location, identifier, color};
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   476
	[_marks addObject:[NSValue value:&mark withObjCType:@encode( struct _mark )]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   477
	[self setNeedsDisplayInRect:[self rectForPart:NSScrollerKnobSlot]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   478
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   479
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   480
- (void) removeMarkAt:(NSUInteger) location {
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   481
	[self removeMarkAt:location withIdentifier:nil withColor:nil];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   482
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   483
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   484
- (void) removeMarkAt:(NSUInteger) location withIdentifier:(NSString *) identifier {
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   485
	[self removeMarkAt:location withIdentifier:identifier withColor:nil];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   486
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   487
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   488
- (void) removeMarkAt:(NSUInteger) location withColor:(NSColor *) color {
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   489
	[self removeMarkAt:location withIdentifier:nil withColor:color];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   490
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   491
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   492
- (void) removeMarkAt:(NSUInteger) location withIdentifier:(NSString *) identifier withColor:(NSColor *) color {
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   493
	struct _mark mark = {location, identifier, color};
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   494
	[_marks removeObject:[NSValue value:&mark withObjCType:@encode( struct _mark )]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   495
	[self setNeedsDisplayInRect:[self rectForPart:NSScrollerKnobSlot]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   496
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   497
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   498
- (void) removeMarkWithIdentifier:(NSString *) identifier {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   499
	NSEnumerator *e = [[[_marks copy] autorelease] objectEnumerator];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   500
	NSValue *obj = nil;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   501
	while( ( obj = [e nextObject] ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   502
		struct _mark mark;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   503
		[obj getValue:&mark];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   504
		if( [mark.identifier isEqualToString:identifier] ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   505
			[_marks removeObject:obj];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   506
		}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   507
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   508
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   509
	[self setNeedsDisplayInRect:[self rectForPart:NSScrollerKnobSlot]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   510
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   511
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   512
- (void) removeMarksGreaterThan:(NSUInteger) location {
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   513
	NSEnumerator *enumerator = [[[_marks copy] autorelease] objectEnumerator];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   514
	NSValue *obj = nil;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   515
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   516
	while( ( obj = [enumerator nextObject] ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   517
		struct _mark mark;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   518
		[obj getValue:&mark];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   519
		if( mark.location > location )
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   520
			[_marks removeObject:obj];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   521
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   522
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   523
	[self setNeedsDisplayInRect:[self rectForPart:NSScrollerKnobSlot]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   524
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   525
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   526
- (void) removeMarksLessThan:(NSUInteger) location {
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   527
	NSEnumerator *enumerator = [[[_marks copy] autorelease] objectEnumerator];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   528
	NSValue *obj = nil;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   529
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   530
	while( ( obj = [enumerator nextObject] ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   531
		struct _mark mark;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   532
		[obj getValue:&mark];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   533
		if( mark.location < location )
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   534
			[_marks removeObject:obj];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   535
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   536
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   537
	[self setNeedsDisplayInRect:[self rectForPart:NSScrollerKnobSlot]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   538
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   539
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   540
- (void) removeMarksInRange:(NSRange) range {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   541
	NSEnumerator *enumerator = [[[_marks copy] autorelease] objectEnumerator];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   542
	NSValue *obj = nil;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   543
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   544
	while( ( obj = [enumerator nextObject] ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   545
		struct _mark mark;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   546
		[obj getValue:&mark];
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   547
		if( NSLocationInRange( mark.location, range ) )
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   548
			[_marks removeObject:obj];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   549
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   550
	
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   551
	[self setNeedsDisplayInRect:[self rectForPart:NSScrollerKnobSlot]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   552
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   553
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   554
- (void) removeAllMarks {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   555
	[_marks removeAllObjects];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   556
	[self setNeedsDisplayInRect:[self rectForPart:NSScrollerKnobSlot]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   557
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   558
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   559
#pragma mark -
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   560
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   561
- (void) setMarks:(NSSet *) marks {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   562
	[_marks setSet:marks];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   563
	[self setNeedsDisplayInRect:[self rectForPart:NSScrollerKnobSlot]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   564
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   565
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   566
- (NSSet *) marks {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   567
	return _marks;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   568
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   569
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   570
#pragma mark -
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   571
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   572
- (void) startShadedAreaAt:(NSUInteger) location {
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   573
	if( ! [_shades count] || ! ( [_shades count] % 2 ) ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   574
		[_shades addObject:[NSNumber numberWithUnsignedLongLong:location]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   575
		[self setNeedsDisplayInRect:[self rectForPart:NSScrollerKnobSlot]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   576
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   577
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   578
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   579
- (void) stopShadedAreaAt:(NSUInteger) location {
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   580
	if( [_shades count] && ( [_shades count] % 2 ) == 1 ) {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   581
		[_shades addObject:[NSNumber numberWithUnsignedLongLong:location]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   582
		[self setNeedsDisplayInRect:[self rectForPart:NSScrollerKnobSlot]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   583
	}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   584
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   585
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   586
#pragma mark -
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   587
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   588
- (void) removeAllShadedAreas {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   589
	[_shades removeAllObjects];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   590
	[self setNeedsDisplayInRect:[self rectForPart:NSScrollerKnobSlot]];
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   591
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   592
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   593
#pragma mark -
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   594
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   595
- (CGFloat) contentViewLength {
5993
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 4759
diff changeset
   596
	if( self.isHorizontalScroller ) return ( NSWidth( [self frame] ) / [self knobProportion] );
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   597
	else return ( NSHeight( [self frame] ) / [self knobProportion] );
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   598
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   599
3062
e04a00f58ce6 Fixing implicit 64->32 bit casts in AIUtilities.
Stephen Holt <sholt@adium.im>
parents: 2634
diff changeset
   600
- (CGFloat) scaleToContentView {
5993
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 4759
diff changeset
   601
	if( self.isHorizontalScroller ) return NSWidth( [self rectForPart:NSScrollerKnobSlot] ) / NSWidth( [[(NSScrollView *)[self superview] contentView] documentRect] );
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   602
	else return NSHeight( [self rectForPart:NSScrollerKnobSlot] ) / NSHeight( [[(NSScrollView *)[self superview] contentView] documentRect] );
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   603
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   604
3062
e04a00f58ce6 Fixing implicit 64->32 bit casts in AIUtilities.
Stephen Holt <sholt@adium.im>
parents: 2634
diff changeset
   605
- (CGFloat) shiftAmountToCenterAlign {
e04a00f58ce6 Fixing implicit 64->32 bit casts in AIUtilities.
Stephen Holt <sholt@adium.im>
parents: 2634
diff changeset
   606
	CGFloat scale = [self scaleToContentView];
5993
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 4759
diff changeset
   607
	if( self.isHorizontalScroller ) return ( ( NSWidth( [self rectForPart:NSScrollerKnobSlot] ) * [self knobProportion] ) / 2.f ) / scale;
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3069
diff changeset
   608
	else return ( ( NSHeight( [self rectForPart:NSScrollerKnobSlot] ) * [self knobProportion] ) / 2.f ) / scale;
1534
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   609
}
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   610
@end