Frameworks/AIUtilities Framework/Source/JVMarkedScroller.h
author <kcochran@trolans.net>
Sat, 19 Oct 2019 17:36:48 -0700
branchfix-sFlags
changeset 5993 95e8102125d0
parent 3679 f4294bb53b0f
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
@interface JVMarkedScroller : NSScroller {
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    19
	NSMutableSet *_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
    20
	NSMutableArray *_shades;
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    21
	NSUInteger _nearestPreviousMark;
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    22
	NSUInteger _nearestNextMark;
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    23
	NSUInteger _currentMark;
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
    24
	BOOL _jumpingToMark;
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add 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
}
5993
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 3679
diff changeset
    26
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 3679
diff changeset
    27
@property (readonly) BOOL isHorizontalScroller;
95e8102125d0 Update JVMarkedScroller to use public APIs to determine scroller direction
<kcochran@trolans.net>
parents: 3679
diff changeset
    28
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    29
- (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
    30
- (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
    31
1581
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
    32
- (BOOL)previousMarkExists;
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
    33
- (IBAction) jumpToPreviousMark:(id) sender;
1581
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
    34
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
    35
- (BOOL)nextMarkExists;
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
    36
- (IBAction) jumpToNextMark:(id) sender;
1581
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
    37
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
    38
- (BOOL)focusMarkExists;
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
    39
- (IBAction)jumpToFocusMark:(id)sender;
f5362c35f138 Only validate the "Jump to?" menu items when a jump could actually occur.
Zachary West <zacw@adiumx.com>
parents: 1534
diff changeset
    40
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
    41
- (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
    42
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    43
- (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
    44
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    45
- (void) addMarkAt:(NSUInteger) location;
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    46
- (void) addMarkAt:(NSUInteger) location withIdentifier:(NSString *) identifier;
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    47
- (void) addMarkAt:(NSUInteger) location withColor:(NSColor *) color;
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    48
- (void) addMarkAt:(NSUInteger) location withIdentifier:(NSString *) identifier withColor:(NSColor *) color;
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    49
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    50
- (void) removeMarkAt:(NSUInteger) location;
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    51
- (void) removeMarkAt:(NSUInteger) location withIdentifier:(NSString *) identifier;
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    52
- (void) removeMarkAt:(NSUInteger) location withColor:(NSColor *) color;
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    53
- (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
    54
- (void) removeMarkWithIdentifier:(NSString *) identifier;
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    55
- (void) removeMarksGreaterThan:(NSUInteger) location;
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    56
- (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
    57
- (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
    58
- (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
    59
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add the ability to mark when we lose focus, and center the jump-to position when moving.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    60
- (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
    61
- (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
    62
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    63
- (void) startShadedAreaAt:(NSUInteger) location;
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    64
- (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
    65
c14fa8460138 Copy JVMarkedScroller from Colloquy, giving us the ability to mark arbitrary locations in the scroll bar. Right now we mark the location of mentions, but this is a little clunky and inexact; I need to play with it a bit more, add 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
- (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
    67
3071
b21c2cff5c86 Fix datatypes for safety on both 32 and 64 bit arches.
Stephen Holt <sholt@adium.im>
parents: 3062
diff changeset
    68
- (CGFloat) contentViewLength;
3062
e04a00f58ce6 Fixing implicit 64->32 bit casts in AIUtilities.
Stephen Holt <sholt@adium.im>
parents: 1581
diff changeset
    69
- (CGFloat) scaleToContentView;
e04a00f58ce6 Fixing implicit 64->32 bit casts in AIUtilities.
Stephen Holt <sholt@adium.im>
parents: 1581
diff changeset
    70
- (CGFloat) shiftAmountToCenterAlign;
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
    71
@end