adium 4363:dacc232a343c: Adjust menu button active state highlight.
commits at adium.im
commits at adium.im
Sun Dec 11 16:26:45 UTC 2011
details: http://hg.adium.im/adium/rev/dacc232a343c
revision: 4363:dacc232a343c
branch: EmoticonsMenu
author: Adrian Godoroja <robotive at me.com>
date: Sat Dec 10 23:03:44 2011 +0200
Adjust menu button active state highlight.
Subject: adium 4364:6d7cd6da7028: Disable elastic scroll in the text input of the message view. Change-logging.
details: http://hg.adium.im/adium/rev/6d7cd6da7028
revision: 4364:6d7cd6da7028
branch: (none)
author: Adrian Godoroja <robotive at me.com>
date: Sun Dec 11 18:25:18 2011 +0200
Disable elastic scroll in the text input of the message view. Change-logging.
diffs (truncated from 2828 to 1000 lines):
diff -r b3df28c10c74 -r 6d7cd6da7028 Adium.xcodeproj/project.pbxproj
--- a/Adium.xcodeproj/project.pbxproj Sat Dec 10 22:09:17 2011 +0200
+++ b/Adium.xcodeproj/project.pbxproj Sun Dec 11 18:25:18 2011 +0200
@@ -924,6 +924,7 @@
34DC8ADC0A7EEEF7003E1636 /* AIContextMenuTextView.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E1E8176063A3EEC00EB00F7 /* AIContextMenuTextView.h */; settings = {ATTRIBUTES = (Public, ); }; };
34DC8ADD0A7EEEF7003E1636 /* AIContextMenuTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E1E8177063A3EEC00EB00F7 /* AIContextMenuTextView.m */; };
34DC8AE00A7EEEF7003E1636 /* AIMessageEntryTextView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B5827E80613CE9D0004BD25 /* AIMessageEntryTextView.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 34DC8AE10A7EEEF7003E1636 /* AIMessageEntryTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B5827E90613CE9D0004BD25 /* AIMessageEntryTextView.m */; };
34DC8AE40A7EEEF7003E1636 /* stackImage.png in Resources */ = {isa = PBXBuildFile; fileRef = 349DDD5206406A7D00542726 /* stackImage.png */; };
34DC8AE50A7EEEF7003E1636 /* AILocalizationAssistance.h in Headers */ = {isa = PBXBuildFile; fileRef = 34D189B1076131850075A380 /* AILocalizationAssistance.h */; settings = {ATTRIBUTES = (Public, ); }; };
34DC8AE70A7EEEF7003E1636 /* AILocalizationButtonCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 078C5CD0079EFF87004C75A4 /* AILocalizationButtonCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -1441,11 +1442,6 @@
9718DF45136A2C5200013760 /* AIImageCollectionView.h in Headers */ = {isa = PBXBuildFile; fileRef = 9718DF43136A2C5200013760 /* AIImageCollectionView.h */; settings = {ATTRIBUTES = (Public, ); }; };
9718DF46136A2C5200013760 /* AIImageCollectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9718DF44136A2C5200013760 /* AIImageCollectionView.m */; };
9722ABC813257D7F00CAB486 /* ContactListWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9722ABC713257D7F00CAB486 /* ContactListWindow.xib */; };
- 972AB3A11493CF2300381105 /* emoticons_menu.png in Resources */ = {isa = PBXBuildFile; fileRef = 974C7524148570E2000686BA /* emoticons_menu.png */; };
- 972AB3A21493D1BA00381105 /* MessageViewEmoticonsMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 974C752C148578F6000686BA /* MessageViewEmoticonsMenu.xib */; };
- 97483A011486DD87002D1FA8 /* AIMessageEntryTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B5827E90613CE9D0004BD25 /* AIMessageEntryTextView.m */; };
- 97483A051486E92C002D1FA8 /* AIMessageViewEmoticonsController.h in Headers */ = {isa = PBXBuildFile; fileRef = 974C753314857BF4000686BA /* AIMessageViewEmoticonsController.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 97483A061486E93E002D1FA8 /* AIMessageViewEmoticonsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 974C753414857BF4000686BA /* AIMessageViewEmoticonsController.m */; };
9760D24613E49A560031FA1A /* AboutDialog_bg.png in Resources */ = {isa = PBXBuildFile; fileRef = 9760D24513E49A560031FA1A /* AboutDialog_bg.png */; };
97AF5CDB13191DE200550C41 /* AIContactListUserPictureMenuController.m in Sources */ = {isa = PBXBuildFile; fileRef = 97AF5CDA13191DE200550C41 /* AIContactListUserPictureMenuController.m */; };
97AF5CF413191E9A00550C41 /* ContactListChangeUserPictureMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 97AF5CF313191E9A00550C41 /* ContactListChangeUserPictureMenu.xib */; };
@@ -4608,10 +4604,6 @@
9718DF43136A2C5200013760 /* AIImageCollectionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIImageCollectionView.h; path = "Frameworks/AIUtilities Framework/Source/AIImageCollectionView.h"; sourceTree = "<group>"; };
9718DF44136A2C5200013760 /* AIImageCollectionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIImageCollectionView.m; path = "Frameworks/AIUtilities Framework/Source/AIImageCollectionView.m"; sourceTree = "<group>"; };
9722ABC713257D7F00CAB486 /* ContactListWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ContactListWindow.xib; path = Resources/ContactListWindow.xib; sourceTree = "<group>"; };
- 974C7524148570E2000686BA /* emoticons_menu.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = emoticons_menu.png; path = Resources/emoticons_menu.png; sourceTree = "<group>"; };
- 974C752C148578F6000686BA /* MessageViewEmoticonsMenu.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = MessageViewEmoticonsMenu.xib; path = Resources/MessageViewEmoticonsMenu.xib; sourceTree = "<group>"; };
- 974C753314857BF4000686BA /* AIMessageViewEmoticonsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIMessageViewEmoticonsController.h; path = Source/AIMessageViewEmoticonsController.h; sourceTree = "<group>"; };
- 974C753414857BF4000686BA /* AIMessageViewEmoticonsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIMessageViewEmoticonsController.m; path = Source/AIMessageViewEmoticonsController.m; sourceTree = "<group>"; };
9760D24513E49A560031FA1A /* AboutDialog_bg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = AboutDialog_bg.png; path = Resources/AboutDialog_bg.png; sourceTree = "<group>"; };
97AF5CD913191DE200550C41 /* AIContactListUserPictureMenuController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIContactListUserPictureMenuController.h; path = Source/AIContactListUserPictureMenuController.h; sourceTree = "<group>"; };
97AF5CDA13191DE200550C41 /* AIContactListUserPictureMenuController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIContactListUserPictureMenuController.m; path = Source/AIContactListUserPictureMenuController.m; sourceTree = "<group>"; };
@@ -4989,12 +4981,6 @@
11C157D504A88DE0008E0C76 /* Emoticons */ = {
isa = PBXGroup;
children = (
- 11C157D804A88E04008E0C76 /* AIEmoticonController.h */,
- 11C157D904A88E04008E0C76 /* AIEmoticonController.m */,
- 974C753314857BF4000686BA /* AIMessageViewEmoticonsController.h */,
- 974C753414857BF4000686BA /* AIMessageViewEmoticonsController.m */,
- 974C752C148578F6000686BA /* MessageViewEmoticonsMenu.xib */,
- 974C7524148570E2000686BA /* emoticons_menu.png */,
C4243C920638E4EA007AD2D9 /* BGEmoticonMenuPlugin.h */,
C4243C930638E4EA007AD2D9 /* BGEmoticonMenuPlugin.m */,
);
@@ -5873,6 +5859,8 @@
34B82C80085A85D800864531 /* AIChatController.m */,
F55B415C03AB8B5601A8010A /* AIContentController.h */,
F55B415D03AB8B5601A8010A /* AIContentController.m */,
+ 11C157D804A88E04008E0C76 /* AIEmoticonController.h */,
+ 11C157D904A88E04008E0C76 /* AIEmoticonController.m */,
34CA15520CAFDFB2009AA5E3 /* sidebarActionWidget.png */,
34A9707D0C96602200F46006 /* sidebarStatusAreaBackground.png */,
9E4CF9D104AA69B000415B22 /* Action Support */,
@@ -9050,7 +9038,6 @@
112B47670F82E0FC00690E84 /* AIXtraInfo.h in Headers */,
34F17FCE0F8EAC34009C5A39 /* AIListOutlineView+Drawing.h in Headers */,
63B0EC9D0F8FBB660062476B /* AIProxyListObject.h in Headers */,
- 97483A051486E92C002D1FA8 /* AIMessageViewEmoticonsController.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -9754,8 +9741,6 @@
97E4B50113E7490000A8BA53 /* Flap_192.png in Resources */,
97E4B50213E7490000A8BA53 /* Awake_192.png in Resources */,
7EC033B214590E0700CF24FB /* MessageWindow.xib in Resources */,
- 972AB3A11493CF2300381105 /* emoticons_menu.png in Resources */,
- 972AB3A21493D1BA00381105 /* MessageViewEmoticonsMenu.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -10484,6 +10469,7 @@
34DC8AD80A7EEEF7003E1636 /* DCJoinChatWindowController.m in Sources */,
34DC8ADB0A7EEEF7003E1636 /* AIAccountPlusFieldPromptController.m in Sources */,
34DC8ADD0A7EEEF7003E1636 /* AIContextMenuTextView.m in Sources */,
+ 34DC8AE10A7EEEF7003E1636 /* AIMessageEntryTextView.m in Sources */,
34DC8AE80A7EEEF7003E1636 /* AILocalizationButtonCell.m in Sources */,
34DC8AEA0A7EEEF7003E1636 /* AILocalizationTextField.m in Sources */,
34DC8AEC0A7EEEF7003E1636 /* AILocalizationButton.m in Sources */,
@@ -10520,8 +10506,6 @@
112B47680F82E0FC00690E84 /* AIXtraInfo.m in Sources */,
34F17FCF0F8EAC34009C5A39 /* AIListOutlineView+Drawing.m in Sources */,
63B0EC9C0F8FBB660062476B /* AIProxyListObject.m in Sources */,
- 97483A011486DD87002D1FA8 /* AIMessageEntryTextView.m in Sources */,
- 97483A061486E93E002D1FA8 /* AIMessageViewEmoticonsController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff -r b3df28c10c74 -r 6d7cd6da7028 ChangeLogs/Changes Between Betas.txt
--- a/ChangeLogs/Changes Between Betas.txt Sat Dec 10 22:09:17 2011 +0200
+++ b/ChangeLogs/Changes Between Betas.txt Sun Dec 11 18:25:18 2011 +0200
@@ -1,6 +1,8 @@
Adium 1.5b8
* Twitter: Use the non-truncated version of retweets if they are included. (#15226)
* Fixed setting a global shortcut which used the letter "a". (#12013)
+ * Disabled elastic scroll in the text input of the message view.
+ * Disabled elastic scroll in Change User Picture Menu.
Adium 1.5b7
* Make sure nibs are not stripped so they can be localized.
diff -r b3df28c10c74 -r 6d7cd6da7028 ChangeLogs/Changes.txt
--- a/ChangeLogs/Changes.txt Sat Dec 10 22:09:17 2011 +0200
+++ b/ChangeLogs/Changes.txt Sun Dec 11 18:25:18 2011 +0200
@@ -68,6 +68,7 @@
* Added the "lastFocus" class for message styles to the latest message received while the chat didn't have focus, and "regainedFocus" for the first message received while the chat has regained focus after having previously lost it.
* Made emoticons between packs more consistent. (#11450)
* Fixed the ":^)" emoticon being mistakenly interpreted the same as ":-\". (#13924)
+ * Disabled elastic scroll of the text input, in Lion.
Status
* Added ability to change which track information the "iTunes" status displays. (#6373)
diff -r b3df28c10c74 -r 6d7cd6da7028 Frameworks/Adium Framework/Source/AIMessageEntryTextView.h
--- a/Frameworks/Adium Framework/Source/AIMessageEntryTextView.h Sat Dec 10 22:09:17 2011 +0200
+++ b/Frameworks/Adium Framework/Source/AIMessageEntryTextView.h Sun Dec 11 18:25:18 2011 +0200
@@ -21,7 +21,6 @@
@class AIListContact, AIAccount, AIChat;
@protocol AIMessageEntryTextViewDelegate <NSTextViewDelegate,NSObject>
-
@optional
/*!
* @brief Should the tab key trigger an autocomplete?
@@ -36,8 +35,8 @@
}
@property (readwrite, retain, nonatomic) NSAttributedString *string;
+ at end
- at end
@interface AIMessageEntryTextView : AISendingTextView <AITextEntryView, AIListObjectObserver> {
AIChat *chat;
@@ -65,34 +64,18 @@
AISimpleTextView *characterCounter;
NSString *characterCounterPrefix;
- NSInteger maxCharacters;
+ NSInteger maxCharacters;
NSColor *savedTextColor;
-
- at protected
- // Emoticons
- BOOL hasEmoticonsMenu;
- NSButton *emoticonsMenuButton;
}
@property (readwrite, assign, nonatomic) id<AIMessageEntryTextViewDelegate> delegate;
-// Configure
+//Configure
@property (readwrite, nonatomic) BOOL clearOnEscape;
@property (readwrite, nonatomic) BOOL homeToStartOfLine;
@property (readwrite, retain, nonatomic) NSView *associatedView;
-// Context
- at property (readwrite, retain, nonatomic) AIChat *chat;
- at property (readonly, nonatomic) AIListContact *listObject;
-
-// History
- at property (readwrite, nonatomic) BOOL historyEnabled;
-
-// Emoticons
- at property (assign) BOOL hasEmoticonsMenu;
- at property (retain) NSButton *emoticonsMenuButton;
-
-// Adium Text Entry
+//Adium Text Entry
- (void)setAttributedString:(NSAttributedString *)inAttributedString;
- (void)setString:(NSString *)string;
- (void)setTypingAttributes:(NSDictionary *)attrs;
@@ -100,21 +83,23 @@
- (void)pasteAsRichText:(id)sender;
- (NSSize)desiredSize;
-// Paging
+//Context
+ at property (readwrite, retain, nonatomic) AIChat *chat;
+ at property (readonly, nonatomic) AIListContact *listObject;
+
+//Paging
- (void)scrollPageUp:(id)sender;
- (void)scrollPageDown:(id)sender;
-// History
+//History
+ at property (readwrite, nonatomic) BOOL historyEnabled;
- (void)historyUp;
- (void)historyDown;
-// Push and Pop
+//Push and Pop
- (void)setPushPopEnabled:(BOOL)inBool;
- (void)pushContent;
- (void)popContent;
- (void)swapContent;
-// Emoticons
-- (void)popUpEmoticonsMenu;
-
@end
diff -r b3df28c10c74 -r 6d7cd6da7028 Frameworks/Adium Framework/Source/AIMessageEntryTextView.m
--- a/Frameworks/Adium Framework/Source/AIMessageEntryTextView.m Sat Dec 10 22:09:17 2011 +0200
+++ b/Frameworks/Adium Framework/Source/AIMessageEntryTextView.m Sun Dec 11 18:25:18 2011 +0200
@@ -27,8 +27,6 @@
#import <Adium/AIInterfaceControllerProtocol.h>
#import <Adium/AIContentContext.h>
-#import <Adium/AIMessageViewEmoticonsController.h>
-
#import <AIUtilities/AIAttributedStringAdditions.h>
#import <AIUtilities/AIColorAdditions.h>
#import <AIUtilities/AITextAttributes.h>
@@ -40,9 +38,8 @@
#import <FriBidi/NSString-FBAdditions.h>
-
-#define MAX_HISTORY 25 // Number of messages to remember in history
-#define ENTRY_TEXTVIEW_PADDING 6 // Padding for auto-sizing
+#define MAX_HISTORY 25 //Number of messages to remember in history
+#define ENTRY_TEXTVIEW_PADDING 6 //Padding for auto-sizing
#define KEY_DISABLE_TYPING_NOTIFICATIONS @"Disable Typing Notifications"
@@ -58,7 +55,7 @@
#define KEY_SUBSTITUTION_QUOTE @"Smart Quote Substitutions"
#define KEY_SUBSTITUTION_LINK @"Smart Links Substitutions"
-#define INDICATOR_RIGHT_PADDING 2 // Padding between right side of the message view and the rightmost indicator
+#define INDICATOR_RIGHT_PADDING 2 // Padding between right side of the message view and the rightmost indicator
#define PREF_GROUP_CHARACTER_COUNTER @"Character Counter"
#define KEY_CHARACTER_COUNTER_ENABLED @"Character Counter Enabled"
@@ -70,8 +67,6 @@
#define PASS_TO_SUPERCLASS_DRAG_TYPE_ARRAY [NSArray arrayWithObjects: \
NSRTFPboardType, NSStringPboardType, nil]
-#pragma mark -
-
/**
* @class AISimpleTextView
* @brief Just draws an attributed string. That's it.
@@ -83,7 +78,6 @@
@implementation AISimpleTextView
@synthesize string;
-
- (void)dealloc
{
[string release];
@@ -92,15 +86,11 @@
- (void)drawRect:(NSRect)rect
{
- [string drawInRect:[self bounds]];
+ [string drawInRect:self.bounds];
}
-
@end
-#pragma mark -
-
@interface AIMessageEntryTextView ()
-
- (void)_setPushIndicatorVisible:(BOOL)visible;
- (void)positionPushIndicator;
- (void)_resetCacheAndPostSizeChanged;
@@ -122,21 +112,12 @@
- (void)frameDidChange:(NSNotification *)notification;
- (void)toggleMessageSending:(NSNotification *)not;
- (void)contentObjectAdded:(NSNotification *)notification;
-
-- (void)updateEmoticonsMenuButton;
-
@end
-#pragma mark -
-
@interface NSMutableAttributedString (AIMessageEntryTextViewAdditions)
-
- (void)convertForPasteWithTraitsUsingAttributes:(NSDictionary *)inAttributes;
-
@end
-#pragma mark - AIMessageEntryTextView
-
@implementation AIMessageEntryTextView
- (void)_initMessageEntryTextView
@@ -150,7 +131,7 @@
homeToStartOfLine = YES;
resizing = NO;
enableTypingNotifications = NO;
- historyArray = [[NSMutableArray alloc] initWithObjects:@"", nil];
+ historyArray = [[NSMutableArray alloc] initWithObjects:@"",nil];
pushArray = [[NSMutableArray alloc] init];
currentHistoryLocation = 0;
[self setDrawsBackground:YES];
@@ -159,12 +140,10 @@
characterCounterPrefix = nil;
maxCharacters = 0;
savedTextColor = nil;
- hasEmoticonsMenu = NO;
-
+
if ([self respondsToSelector:@selector(setAllowsUndo:)]) {
[self setAllowsUndo:YES];
}
-
if ([self respondsToSelector:@selector(setAllowsDocumentBackgroundColorChange:)]) {
[self setAllowsDocumentBackgroundColorChange:YES];
}
@@ -175,28 +154,25 @@
selector:@selector(textDidChange:)
name:NSTextDidChangeNotification
object:self];
-
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(frameDidChange:)
name:NSViewFrameDidChangeNotification
object:self];
-
[[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(toggleMessageSending:)
- name:@"AIChatDidChangeCanSendMessagesNotification"
- object:chat];
-
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(contentObjectAdded:)
- name:Content_ContentObjectAdded
- object:nil];
+ selector:@selector(toggleMessageSending:)
+ name:@"AIChatDidChangeCanSendMessagesNotification"
+ object:chat];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(contentObjectAdded:)
+ name:Content_ContentObjectAdded
+ object:nil];
[adium.preferenceController registerPreferenceObserver:self forGroup:PREF_GROUP_DUAL_WINDOW_INTERFACE];
[[AIContactObserverManager sharedManager] registerListObjectObserver:self];
}
-// Init the text view
+//Init the text view
- (id)initWithFrame:(NSRect)frameRect textContainer:(NSTextContainer *)aTextContainer
{
if ((self = [super initWithFrame:frameRect textContainer:aTextContainer])) {
@@ -233,7 +209,6 @@
[associatedView release];
[historyArray release]; historyArray = nil;
[pushArray release]; pushArray = nil;
- [emoticonsMenuButton release];
[super dealloc];
}
@@ -256,8 +231,9 @@
unichar inChar = [charactersIgnoringModifiers characterAtIndex:0];
NSUInteger flags = [inEvent modifierFlags];
- // We have to test ctrl before option, because otherwise we'd miss ctrl-option-* events
- if (pushPopEnabled && (flags & NSControlKeyMask) && !(flags & NSShiftKeyMask)) {
+ //We have to test ctrl before option, because otherwise we'd miss ctrl-option-* events
+ if (pushPopEnabled &&
+ (flags & NSControlKeyMask) && !(flags & NSShiftKeyMask)) {
if (inChar == NSUpArrowFunctionKey) {
[self popContent];
} else if (inChar == NSDownArrowFunctionKey) {
@@ -267,7 +243,9 @@
} else {
[super keyDown:inEvent];
}
- } else if (historyEnabled && (flags & NSAlternateKeyMask) && !(flags & NSShiftKeyMask)) {
+
+ } else if (historyEnabled &&
+ (flags & NSAlternateKeyMask) && !(flags & NSShiftKeyMask)) {
if (inChar == NSUpArrowFunctionKey) {
[self historyUp];
} else if (inChar == NSDownArrowFunctionKey) {
@@ -275,12 +253,13 @@
} else {
[super keyDown:inEvent];
}
- } else if (associatedView && (flags & NSCommandKeyMask) && !(flags & NSShiftKeyMask)) {
+
+ } else if (associatedView &&
+ (flags & NSCommandKeyMask) && !(flags & NSShiftKeyMask)) {
if ((inChar == NSUpArrowFunctionKey || inChar == NSDownArrowFunctionKey) ||
(inChar == NSHomeFunctionKey || inChar == NSEndFunctionKey) ||
(inChar == NSPageUpFunctionKey || inChar == NSPageDownFunctionKey)) {
-
- // Pass the associatedView a keyDown event equivalent equal to inEvent except without the modifier flags
+ //Pass the associatedView a keyDown event equivalent equal to inEvent except without the modifier flags
[associatedView keyDown:[NSEvent keyEventWithType:[inEvent type]
location:[inEvent locationInWindow]
modifierFlags:0
@@ -294,21 +273,24 @@
} else {
[super keyDown:inEvent];
}
- } else if (associatedView && (inChar == NSPageUpFunctionKey || inChar == NSPageDownFunctionKey)) {
- [associatedView keyDown:inEvent];
+
+ } else if (associatedView &&
+ (inChar == NSPageUpFunctionKey || inChar == NSPageDownFunctionKey)) {
+ [associatedView keyDown:inEvent];
+
} else if (inChar == NSHomeFunctionKey || inChar == NSEndFunctionKey) {
if (homeToStartOfLine) {
NSRange newRange;
if (flags & NSShiftKeyMask) {
- // With shift, select to the beginning/end of the line
+ //With shift, select to the beginning/end of the line
NSRange selectedRange = [self selectedRange];
if (inChar == NSHomeFunctionKey) {
- // Home: from 0 to the current location
+ //Home: from 0 to the current location
newRange.location = 0;
newRange.length = selectedRange.location;
} else {
- // End: from current location to the end
+ //End: from current location to the end
newRange.location = selectedRange.location;
newRange.length = [[self string] length] - newRange.location;
}
@@ -319,14 +301,16 @@
}
[self setSelectedRange:newRange];
- } else {
- // If !homeToStartOfLine, pass the keypress to our associated view.
+
+ } else {
+ //If !homeToStartOfLine, pass the keypress to our associated view.
if (associatedView) {
[associatedView keyDown:inEvent];
} else {
[super keyDown:inEvent];
}
}
+
} else if (inChar == NSTabCharacter) {
if ([self.delegate respondsToSelector:@selector(textViewShouldTabComplete:)] &&
[self.delegate textViewShouldTabComplete:self]) {
@@ -348,21 +332,21 @@
[self.enclosingScrollView scrollWheel:anEvent];
}
-// Text changed
+//Text changed
- (void)textDidChange:(NSNotification *)notification
{
- // Update typing status
+ //Update typing status
if (enableTypingNotifications) {
[adium.contentController userIsTypingContentForChat:chat hasEnteredText:[[self textStorage] length] > 0];
}
- // Hide any existing contact list tooltip when we begin typing
+ //Hide any existing contact list tooltip when we begin typing
[adium.interfaceController showTooltipForListObject:nil atScreenPoint:NSZeroPoint onWindow:nil];
- // Reset cache and resize
+ //Reset cache and resize
[self _resetCacheAndPostSizeChanged];
- // Update the character counter
+ //Update the character counter
if (characterCounter) {
[self updateCharacterCounter];
}
@@ -408,8 +392,9 @@
}
}
-#pragma mark - Configure
+//Configure ------------------------------------------------------------------------------------------------------------
+#pragma mark Configure
@synthesize clearOnEscape, homeToStartOfLine, associatedView;
- (void)preferencesChangedForGroup:(NSString *)group key:(NSString *)key
@@ -419,7 +404,7 @@
[group isEqualToString:GROUP_ACCOUNT_STATUS] &&
(!key || [key isEqualToString:KEY_DISABLE_TYPING_NOTIFICATIONS])) {
enableTypingNotifications = ![[chat.account preferenceForKey:KEY_DISABLE_TYPING_NOTIFICATIONS
- group:GROUP_ACCOUNT_STATUS] boolValue];
+ group:GROUP_ACCOUNT_STATUS] boolValue];
}
if (!object && [group isEqualToString:PREF_GROUP_DUAL_WINDOW_INTERFACE]) {
@@ -461,15 +446,15 @@
}
}
-#pragma mark - Adium Text Entry
+//Adium Text Entry -----------------------------------------------------------------------------------------------------
+#pragma mark Adium Text Entry
/*!
* @brief Toggle whether message sending is enabled based on a notification. The notification object is the AIChat of the appropriate message entry view
*/
- (void)toggleMessageSending:(NSNotification *)not
{
- // XXX - We really should query the AIChat about this, but AIChat's "can't send" is really designed for handling offline, not banned.
- // Bringing up the offline messaging dialog when banned would make no sense.
+ //XXX - We really should query the AIChat about this, but AIChat's "can't send" is really designed for handling offline, not banned. Bringing up the offline messaging dialog when banned would make no sense.
[self setSendingEnabled:[[[not userInfo] objectForKey:@"TypingEnabled"] boolValue]];
}
@@ -481,16 +466,16 @@
return self.sendingEnabled;
}
-// Set our string, preserving the selected range
+//Set our string, preserving the selected range
- (void)setAttributedString:(NSAttributedString *)inAttributedString
{
NSUInteger length = [inAttributedString length];
NSRange oldRange = [self selectedRange];
- // Change our string
+ //Change our string
[[self textStorage] setAttributedString:inAttributedString];
- // Restore the old selected range
+ //Restore the old selected range
if (oldRange.location < length) {
if (oldRange.location + oldRange.length <= length) {
[self setSelectedRange:oldRange];
@@ -499,20 +484,20 @@
}
}
- // Notify everyone that our text changed
+ //Notify everyone that our text changed
[[NSNotificationCenter defaultCenter] postNotificationName:NSTextDidChangeNotification object:self];
}
-// Set our string (plain text)
+//Set our string (plain text)
- (void)setString:(NSString *)string
{
[super setString:string];
- // Notify everyone that our text changed
+ //Notify everyone that our text changed
[[NSNotificationCenter defaultCenter] postNotificationName:NSTextDidChangeNotification object:self];
}
-// Set our typing format
+//Set our typing format
- (void)setTypingAttributes:(NSDictionary *)attrs
{
[super setTypingAttributes:attrs];
@@ -520,14 +505,14 @@
[self setInsertionPointColor:[[attrs objectForKey:NSBackgroundColorAttributeName] contrastingColor]];
}
-#pragma mark - Pasting
+#pragma mark Pasting
- (BOOL)handlePasteAsRichText
{
NSPasteboard *generalPasteboard = [NSPasteboard generalPasteboard];
BOOL handledPaste = NO;
- // Types is ordered by the preference for handling of the data; enumerating it lets us allow the sending application's hints to be followed.
+ //Types is ordered by the preference for handling of the data; enumerating it lets us allow the sending application's hints to be followed.
for (NSString *type in generalPasteboard.types) {
if ([type isEqualToString:NSRTFDPboardType]) {
NSData *data = [generalPasteboard dataForType:NSRTFDPboardType];
@@ -535,7 +520,7 @@
handledPaste = YES;
} else if ([PASS_TO_SUPERCLASS_DRAG_TYPE_ARRAY containsObject:type]) {
- // When we hit a type we should let the superclass handle, break without doing anything
+ //When we hit a type we should let the superclass handle, break without doing anything
break;
} else if ([FILES_AND_IMAGES_TYPES containsObject:type]) {
@@ -550,7 +535,7 @@
return handledPaste;
}
-// Paste as rich text without altering our typing attributes
+//Paste as rich text without altering our typing attributes
- (void)pasteAsRichText:(id)sender
{
NSDictionary *attributes = [[self typingAttributes] copy];
@@ -593,7 +578,7 @@
data = nil;
}
- // Failed. Try again with the string type.
+ //Failed. Try again with the string type.
if (!data && ![type isEqualToString:NSStringPboardType]) {
if ([[[NSPasteboard generalPasteboard] types] containsObject:NSStringPboardType]) {
type = NSStringPboardType;
@@ -606,7 +591,7 @@
}
if (!data) {
- // We still didn't get valid data... maybe super can handle it
+ //We still didn't get valid data... maybe super can handle it
@try {
[self paste:sender];
} @catch (NSException *localException) {
@@ -636,7 +621,7 @@
documentAttributes:NULL];
}
} @catch (NSException *localException) {
- // Error while reading the RTF or HTML data, which can happen. Fall back on plain text
+ //Error while reading the RTF or HTML data, which can happen. Fall back on plain text
if ([[[NSPasteboard generalPasteboard] types] containsObject:NSStringPboardType]) {
data = [generalPasteboard dataForType:NSStringPboardType];
NSString *string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
@@ -659,20 +644,20 @@
NSRange selectedRange = [self selectedRange];
NSTextStorage *textStorage = [self textStorage];
- // Prepare the undo operation
+ //Prepare the undo operation
NSUndoManager *undoManager = [self undoManager];
[[undoManager prepareWithInvocationTarget:textStorage]
replaceCharactersInRange:NSMakeRange(selectedRange.location, [attributedString length])
withAttributedString:[textStorage attributedSubstringFromRange:selectedRange]];
[undoManager setActionName:AILocalizedString(@"Paste", nil)];
- // Perform the paste
+ //Perform the paste
[textStorage replaceCharactersInRange:selectedRange
withAttributedString:attributedString];
// Align our text properly (only need to if the first character was changed)
if (selectedRange.location == 0)
[self setBaseWritingDirection:[[textStorage string] baseWritingDirection]];
- // Notify that we changed our text
+ //Notify that we changed our text
[[NSNotificationCenter defaultCenter] postNotificationName:NSTextDidChangeNotification
object:self];
[attributedString release];
@@ -684,7 +669,7 @@
}
} else {
- // If we didn't handle it yet, let super try to deal with it
+ //If we didn't handle it yet, let super try to deal with it
[self paste:sender];
}
@@ -697,22 +682,22 @@
[self scrollRangeToVisible:[self selectedRange]];
}
-#pragma mark - Deletion
+#pragma mark Deletion
- (void)deleteBackward:(id)sender
{
- // Perform the delete
+ //Perform the delete
[super deleteBackward:sender];
- // If we are now an empty string, and we still have a link active, clear the link
+ //If we are now an empty string, and we still have a link active, clear the link
if ([[self textStorage] length] == 0) {
[self clearLinkAttribute];
}
}
-#pragma mark - Contact menu
-
-// Set and return the selected chat (to auto-configure the contact menu)
+//Contact menu ---------------------------------------------------------------------------------------------------------
+#pragma mark Contact menu
+//Set and return the selected chat (to auto-configure the contact menu)
- (void)setChat:(AIChat *)inChat
{
if (chat != inChat) {
@@ -737,12 +722,12 @@
context:NULL];
}
- // Observe preferences changes for typing enable/disable
+ //Observe preferences changes for typing enable/disable
[adium.preferenceController registerPreferenceObserver:self forGroup:GROUP_ACCOUNT_STATUS];
}
- // Set up the character counter for this chat's list object.
- // This is done regardless of a chat changing because destination changes need to trigger this.
+ //Set up the character counter for this chat's list object.
+ //This is done regardless of a chat changing because destination changes need to trigger this.
if(!chat.isGroupChat) {
[self setCharacterCounterMaximum:[chat.listObject integerValueForProperty:@"Character Counter Max"]];
[self setCharacterCounterVisible:([chat.listObject valueForProperty:@"Character Counter Max"] != nil)];
@@ -755,7 +740,7 @@
return chat;
}
-// Return the selected list object (to auto-configure the contact menu)
+//Return the selected list object (to auto-configure the contact menu)
- (AIListContact *)listObject
{
return chat.listObject;
@@ -766,22 +751,23 @@
return [chat preferredListObject];
}
-#pragma mark - Auto-sizing
-
-// Returns our desired size
+//Auto Sizing ----------------------------------------------------------------------------------------------------------
+#pragma mark Auto-sizing
+//Returns our desired size
- (NSSize)desiredSize
{
if (_desiredSizeCached.width == 0) {
CGFloat textHeight;
if ([[self textStorage] length] != 0) {
- // If there is text in this view, let the container tell us its height
+ //If there is text in this view, let the container tell us its height
- // Force glyph generation. We must do this or usedRectForTextContainer might only return a rect for a portion of our text.
+ //Force glyph generation. We must do this or usedRectForTextContainer might only return a rect for a
+ //portion of our text.
[[self layoutManager] glyphRangeForTextContainer:[self textContainer]];
textHeight = [[self layoutManager] usedRectForTextContainer:[self textContainer]].size.height;
} else {
- // Otherwise, we use the current typing attributes to guess what the height of a line should be
+ //Otherwise, we use the current typing attributes to guess what the height of a line should be
textHeight = [NSAttributedString stringHeightForAttributes:[self typingAttributes]];
}
@@ -798,10 +784,10 @@
return _desiredSizeCached;
}
+//Reset the desired size cache when our frame changes
- (void)frameDidChange:(NSNotification *)notification
{
- // Reset the desired size cache when our frame changes
- // resetCacheAndPostSizeChanged can get us right back to here, resulting in an infinite loop if we're not careful
+ //resetCacheAndPostSizeChanged can get us right back to here, resulting in an infinite loop if we're not careful
if (!resizing) {
resizing = YES;
[self _resetCacheAndPostSizeChanged];
@@ -822,9 +808,9 @@
}
}
-#pragma mark - Paging
-
-// Page up or down in the message view
+//Paging ---------------------------------------------------------------------------------------------------------------
+#pragma mark Paging
+//Page up or down in the message view
- (void)scrollPageUp:(id)sender
{
if (associatedView && [associatedView respondsToSelector:@selector(pageUp:)]) {
@@ -833,7 +819,6 @@
[super scrollPageUp:sender];
}
}
-
- (void)scrollPageDown:(id)sender
{
if (associatedView && [associatedView respondsToSelector:@selector(pageDown:)]) {
@@ -843,60 +828,61 @@
}
}
-#pragma mark - History
+//History --------------------------------------------------------------------------------------------------------------
+#pragma mark History
@synthesize historyEnabled;
-// Move up through the history
+//Move up through the history
- (void)historyUp
{
if (currentHistoryLocation == 0) {
- // Store current message
+ //Store current message
[historyArray replaceObjectAtIndex:0 withObject:[[[self textStorage] copy] autorelease]];
}
if (currentHistoryLocation < [historyArray count]-1) {
- // Move up
+ //Move up
currentHistoryLocation++;
- // Display history
+ //Display history
[self setAttributedString:[historyArray objectAtIndex:currentHistoryLocation]];
}
}
-// Move down through history
+//Move down through history
- (void)historyDown
{
if (currentHistoryLocation > 0) {
- // Move down
+ //Move down
currentHistoryLocation--;
- // Display history
+ //Display history
[self setAttributedString:[historyArray objectAtIndex:currentHistoryLocation]];
}
}
-// Update history when content is sent
+//Update history when content is sent
- (IBAction)sendContent:(id)sender
{
NSAttributedString *textStorage = [self textStorage];
- // Add to history if there is text being sent
+ //Add to history if there is text being sent
[historyArray insertObject:[[textStorage copy] autorelease] atIndex:1];
if ([historyArray count] > MAX_HISTORY) {
[historyArray removeLastObject];
}
- currentHistoryLocation = 0; // Move back to bottom of history
+ currentHistoryLocation = 0; //Move back to bottom of history
- // Send the content
+ //Send the content
[super sendContent:sender];
- // Clear the undo/redo stack as it makes no sense to carry between sends (the history is for that)
+ //Clear the undo/redo stack as it makes no sense to carry between sends (the history is for that)
[[self undoManager] removeAllActions];
}
-// Populate the history with messages from the message history
+//Populate the history with messages from the message history
- (void)contentObjectAdded:(NSNotification *)notification
{
AIContentObject *content = [notification.userInfo objectForKey:@"AIContentObject"];
@@ -910,15 +896,15 @@
}
}
-#pragma mark - Push and Pop
-
-// Enable/Disable push-pop
+//Push and Pop ---------------------------------------------------------------------------------------------------------
+#pragma mark Push and Pop
+//Enable/Disable push-pop
- (void)setPushPopEnabled:(BOOL)inBool
{
pushPopEnabled = inBool;
}
-// Push out of the message entry field
+//Push out of the message entry field
- (void)pushContent
{
if ([[self textStorage] length] != 0 && pushPopEnabled) {
@@ -928,21 +914,20 @@
}
}
-// Pop into the message entry field
+//Pop into the message entry field
- (void)popContent
{
if ([pushArray count] && pushPopEnabled) {
[self setAttributedString:[pushArray lastObject]];
- [self setSelectedRange:NSMakeRange([[self textStorage] length], 0)]; // selection to end
+ [self setSelectedRange:NSMakeRange([[self textStorage] length], 0)]; //selection to end
[pushArray removeLastObject];
-
if ([pushArray count] == 0) {
[self _setPushIndicatorVisible:NO];
}
}
}
-// Swap current content
+//Swap current content
- (void)swapContent
{
if (pushPopEnabled) {
@@ -961,25 +946,25 @@
}
}
-// Push indicator
+//Push indicator
- (void)_setPushIndicatorVisible:(BOOL)visible
{
- static NSImage *pushIndicatorImage = nil;
+ static NSImage *pushIndicatorImage = nil;
- if (!pushIndicatorImage) {
- pushIndicatorImage = [[NSImage imageNamed:@"stackImage" forClass:[self class]] retain];
- }
+ //
+ if (!pushIndicatorImage) pushIndicatorImage = [[NSImage imageNamed:@"stackImage" forClass:[self class]] retain];
if (visible && !pushIndicatorVisible) {
pushIndicatorVisible = visible;
- // Push text over to make room for indicator
+ //Push text over to make room for indicator
NSSize size = [self frame].size;
size.width -= ([pushIndicatorImage size].width);
[self setFrameSize:size];
// Make the indicator and set its action. It is a button with no border.
- pushIndicator = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, [pushIndicatorImage size].width, [pushIndicatorImage size].height)];
+ pushIndicator = [[NSButton alloc] initWithFrame:
+ NSMakeRect(0, 0, [pushIndicatorImage size].width, [pushIndicatorImage size].height)];
[pushIndicator setButtonType:NSMomentaryPushButton];
[pushIndicator setAutoresizingMask:(NSViewMinXMargin)];
[pushIndicator setImage:pushIndicatorImage];
@@ -993,40 +978,30 @@
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(positionIndicators:) name:NSViewBoundsDidChangeNotification object:[self superview]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(positionIndicators:) name:NSViewFrameDidChangeNotification object:[self superview]];
- [self positionPushIndicator]; // Set the indicators initial position
+ [self positionPushIndicator]; //Set the indicators initial position
- // Reposition the emoticons menu button
- if ([self hasEmoticonsMenu]) {
- [self updateEmoticonsMenuButton];
- }
} else if (!visible && pushIndicatorVisible) {
pushIndicatorVisible = visible;
- // Push text back
+ //Push text back
NSSize size = [self frame].size;
size.width += [pushIndicatorImage size].width;
[self setFrameSize:size];
- // Unsubcribe, if necessary.
- if (!characterCounter && ![self hasEmoticonsMenu]) {
+ //Unsubcribe, if necessary.
+ if (!characterCounter) {
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSViewBoundsDidChangeNotification object:[self superview]];
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSViewFrameDidChangeNotification object:[self superview]];
}
-
- // Remove indicator
+ //Remove indicator
[pushIndicator removeFromSuperview];
[pushIndicator release]; pushIndicator = nil;
[self positionPushIndicator];
-
- // Reposition the emoticons menu button
- if ([self hasEmoticonsMenu]) {
- [self updateEmoticonsMenuButton];
- }
}
}
-// Reposition the push indicator into lower right corner
+//Reposition the push indicator into lower right corner
- (void)positionPushIndicator
{
NSRect visRect = [[self superview] bounds];
@@ -1037,32 +1012,23 @@
[[self enclosingScrollView] setNeedsDisplay:YES];
}
-#pragma mark - Indicators Positioning
+#pragma mark Indicators Positioning
/**
* @brief Dispatch for both indicators to observe bounds & frame changes of their superview
*
* Stupid that this is necessary, but you can only remove an entire object from a notification center's observer list,
* not on a per-method basis.
- * Updates emoticons menu button also.
*/
- (void)positionIndicators:(NSNotification *)notification
{
- if (pushIndicatorVisible) {
+ if (pushIndicatorVisible)
[self positionPushIndicator];
- }
-
- if (characterCounter) {
+ if (characterCounter)
[self positionCharacterCounter];
- }
-
- // Update emoticons menu button
More information about the commits
mailing list