adium/adium

Remove the emoticon toolbar item. Fixes #16396
adium-1.6
2013-06-03, Frank Dowsett
be91f6ac390b
Parents 868232f2e8ef
Children bf8f8206070c
Remove the emoticon toolbar item. Fixes #16396
--- a/Source/BGEmoticonMenuPlugin.h Thu May 30 13:01:02 2013 -0400
+++ b/Source/BGEmoticonMenuPlugin.h Mon Jun 03 20:40:00 2013 -0400
@@ -20,8 +20,6 @@
{
NSMenuItem *quickMenuItem;
NSMenuItem *quickContextualMenuItem;
-
- NSMutableSet *toolbarItems;
}
- (NSMenu *)flatEmoticonMenuForPack:(AIEmoticonPack *)incomingPack;
--- a/Source/BGEmoticonMenuPlugin.m Thu May 30 13:01:02 2013 -0400
+++ b/Source/BGEmoticonMenuPlugin.m Mon Jun 03 20:40:00 2013 -0400
@@ -16,17 +16,14 @@
#import "AIEmoticonController.h"
#import <Adium/AIMenuControllerProtocol.h>
-#import <Adium/AIToolbarControllerProtocol.h>
#import "BGEmoticonMenuPlugin.h"
#import <AIUtilities/AIMenuAdditions.h>
-#import <AIUtilities/AIToolbarUtilities.h>
#import <AIUtilities/AIImageAdditions.h>
#import <AIUtilities/AIImageDrawingAdditions.h>
#import <AIUtilities/MVMenuButton.h>
#import <Adium/AIEmoticon.h>
@interface BGEmoticonMenuPlugin()
-- (void)registerToolbarItem;
- (IBAction)dummyTarget:(id)sender;
- (void)insertEmoticon:(id)sender;
@end
@@ -40,11 +37,8 @@
#define PREF_GROUP_EMOTICONS @"Emoticons"
#define TITLE_INSERT_EMOTICON AILocalizedString(@"Insert Emoticon",nil)
-#define TOOLTIP_INSERT_EMOTICON AILocalizedString(@"Insert an emoticon into the text",nil)
#define TITLE_EMOTICON AILocalizedString(@"Emoticon",nil)
-#define TOOLBAR_EMOTICON_IDENTIFIER @"InsertEmoticon"
-
/*!
* @brief Install
*/
@@ -77,18 +71,6 @@
//add the items to their menus.
[adium.menuController addContextualMenuItem:quickContextualMenuItem toLocation:Context_TextView_Edit];
[adium.menuController addMenuItem:quickMenuItem toLocation:LOC_Edit_Additions];
-
- toolbarItems = [[NSMutableSet alloc] init];
- [self registerToolbarItem];
-
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(toolbarWillAddItem:)
- name:NSToolbarWillAddItemNotification
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(toolbarDidRemoveItem:)
- name:NSToolbarDidRemoveItemNotification
- object:nil];
}
/*!
@@ -105,75 +87,9 @@
*/
- (void)dealloc
{
- [toolbarItems release];
-
[super dealloc];
}
-/*!
- * @brief Add the emoticon menu as an item goes into a toolbar
- */
-- (void)toolbarWillAddItem:(NSNotification *)notification
-{
- NSToolbarItem *item = [[notification userInfo] objectForKey:@"item"];
-
- if ([[item itemIdentifier] isEqualToString:TOOLBAR_EMOTICON_IDENTIFIER]) {
- NSMenu *theEmoticonMenu = [[[NSMenu alloc] init] autorelease];
-
- [theEmoticonMenu setDelegate:self];
-
- //Add menu to view
- [[item view] setMenu:theEmoticonMenu];
-
- //Add menu to toolbar item (for text mode)
- NSMenuItem *mItem = [[[NSMenuItem allocWithZone:[NSMenu menuZone]] init] autorelease];
- [mItem setSubmenu:theEmoticonMenu];
- [mItem setTitle:TITLE_EMOTICON];
- [item setMenuFormRepresentation:mItem];
-
- [toolbarItems addObject:item];
- }
-}
-
-/*!
- * @brief Stop tracking when an item is removed from a toolbar
- */
-- (void)toolbarDidRemoveItem:(NSNotification *)notification
-{
- NSToolbarItem *item = [[notification userInfo] objectForKey:@"item"];
- if ([[item itemIdentifier] isEqualToString:TOOLBAR_EMOTICON_IDENTIFIER]) {
- [item setView:nil];
- [toolbarItems removeObject:item];
- }
-}
-
-/*!
- * @brief Register our toolbar item
- */
-- (void)registerToolbarItem
-{
- NSToolbarItem *toolbarItem;
- MVMenuButton *button;
-
- //Register our toolbar item
- button = [[[MVMenuButton alloc] initWithFrame:NSMakeRect(0,0,32,32)] autorelease];
- [button setImage:[NSImage imageNamed:@"emoticon" forClass:[self class] loadLazily:YES]];
- toolbarItem = [AIToolbarUtilities toolbarItemWithIdentifier:TOOLBAR_EMOTICON_IDENTIFIER
- label:TITLE_EMOTICON
- paletteLabel:TITLE_INSERT_EMOTICON
- toolTip:TOOLTIP_INSERT_EMOTICON
- target:self
- settingSelector:@selector(setView:)
- itemContent:button
- action:@selector(insertEmoticon:)
- menu:nil];
- [toolbarItem setMinSize:NSMakeSize(32,32)];
- [toolbarItem setMaxSize:NSMakeSize(32,32)];
- [button setToolbarItem:toolbarItem];
- [adium.toolbarController registerToolbarItem:toolbarItem forToolbarType:@"TextEntry"];
-}
-
-
//Menu Generation ------------------------------------------------------------------------------------------------------
#pragma mark Menu Generation
@@ -296,18 +212,6 @@
NSArray *activePacks = [adium.emoticonController activeEmoticonPacks];
AIEmoticonPack *pack;
- /* We need special voodoo here to identify if the menu belongs to a toolbar,
- * add the necessary pad item, and then adjust the index accordingly.
- * this shouldn't be necessary, but NSToolbar is evil.
- */
- if ([[[menu itemAtIndex:0] title] isEqualToString:TITLE_EMOTICON]) {
- if (idx == 0) {
- return YES;
- } else {
- --idx;
- }
- }
-
// Add in flat emoticon menu
if ([activePacks count] == 1) {
pack = [activePacks objectAtIndex:0];
@@ -341,9 +245,6 @@
/*!
* @brief Set the number of items that should be in the menu.
*
- * Toolbars need one empty item to display properly. We increase the number by 1, if the menu
- * is in a toolbar
- *
*/
- (NSInteger)numberOfItemsInMenu:(NSMenu *)menu
{
@@ -354,13 +255,6 @@
if (itemCounts == 1)
itemCounts = [[[activePacks objectAtIndex:0] enabledEmoticons] count];
-
-
- if ([menu numberOfItems] > 0) {
- if ([[[menu itemAtIndex:0] title] isEqualToString:TITLE_EMOTICON]) {
- ++itemCounts;
- }
- }
return itemCounts;
}