Frameworks/Adium Framework/Source/AIColorPickerSliders.m
author Evan Schoenberg
Thu, 14 Nov 2019 18:10:18 -0500
branchadium-1.5.10.5
changeset 6003 6e8c6761ee0d
parent 4897 5ea3bd51010d
permissions -rw-r--r--
Fixed a few more warnings
3679
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 71
diff changeset
     1
/* 
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 71
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: 71
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: 71
diff changeset
     4
 * 
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 71
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: 71
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: 71
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: 71
diff changeset
     8
 * 
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 71
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: 71
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: 71
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: 71
diff changeset
    12
 * 
f4294bb53b0f Bring consistency to file headings, this is not exhaustive. Evan and the rest.
Frank Dowsett <wixardy@adium.im>
parents: 71
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: 71
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: 71
diff changeset
    15
 */
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    16
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    17
#import <Adium/AIColorPickerSliders.h>
71
79aefb9cfcbb Convert the last poseAsClass in Adium over to objc2 swizzling
David Smith
parents: 0
diff changeset
    18
#import <objc/objc-class.h>
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    19
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    20
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    21
 * @class AIColorPickerSliders
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    22
 * @brief Poses as NSColorPickerSliders to remove the key equivalents from its sliderModePopUp NSPopUpButton's menu
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    23
 *
71
79aefb9cfcbb Convert the last poseAsClass in Adium over to objc2 swizzling
David Smith
parents: 0
diff changeset
    24
 * In 10.3 through 10.5 (at least), sliderModePopUp provides 4 menu items, each of which corresponds to a particular slider mode
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    25
 * and is associated with a shortcut, command-1 through command-4.  Adium uses command-1 through command-4 to switch
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    26
 * to the first through fourth open chats. Without this class, after the color picker is opened and the slider view
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    27
 * is displayed, the next time Adium reconfigures shortcut keys it will be unable to use these 4 as the color picker
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    28
 * not only uses them but continues to use them for the rest of the application session.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    29
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    30
 * They are not stolen away as soon as the panel is opened, but rather the next time Adium reconfigures which occurs
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    31
 * whenever chats are opened, closed, or reorganized. Therefore, as long as we remove the key equivalents before this
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    32
 * happens, Adium can continue to use the shortcuts.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    33
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    34
@implementation AIColorPickerSliders
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    35
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    36
/* 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    37
* @brief Load
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    38
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    39
 * Install ourself to intercept _setupProfileUI and thereby remove key equivalents for the menu items
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    40
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    41
+ (void)load
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    42
{
71
79aefb9cfcbb Convert the last poseAsClass in Adium over to objc2 swizzling
David Smith
parents: 0
diff changeset
    43
	//Anything you can do, I can do better...
79aefb9cfcbb Convert the last poseAsClass in Adium over to objc2 swizzling
David Smith
parents: 0
diff changeset
    44
	method_exchangeImplementations(class_getInstanceMethod([NSColorPickerSliders class], @selector(_setupProfileUI)), class_getInstanceMethod(self, @selector(_setupProfileUI)));
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    45
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    46
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    47
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    48
 * @brief Called to finish setting up the UI
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    49
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    50
 * sliderModePopUp's menu is populated sometime before this but after initWithPickerMask:colorPanel:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    51
 * We want to remove the key equivalents on that menu.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    52
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    53
- (void)_setupProfileUI
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    54
{
71
79aefb9cfcbb Convert the last poseAsClass in Adium over to objc2 swizzling
David Smith
parents: 0
diff changeset
    55
	//Must be sure to the original implementation
6003
6e8c6761ee0d Fixed a few more warnings
Evan Schoenberg
parents: 4897
diff changeset
    56
    static void (*__setupProfileUI_method_invoke)(id, Method) = (void (*)(id, Method)) method_invoke;
6e8c6761ee0d Fixed a few more warnings
Evan Schoenberg
parents: 4897
diff changeset
    57
	__setupProfileUI_method_invoke(self, class_getInstanceMethod([AIColorPickerSliders class], @selector(_setupProfileUI)));
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    58
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    59
	if (sliderModePopUp && [sliderModePopUp isKindOfClass:[NSPopUpButton class]]) {
4897
5ea3bd51010d I messed up with branching adium-1.5.3. I should've branched it from adium-1.5.2, but used default. This meant many extra changes (new preferences, etc.) got in unintentionally.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4790
diff changeset
    60
		NSMenu			*menu = [sliderModePopUp menu];
5ea3bd51010d I messed up with branching adium-1.5.3. I should've branched it from adium-1.5.2, but used default. This meant many extra changes (new preferences, etc.) got in unintentionally.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4790
diff changeset
    61
		NSMenuItem		*menuItem;
5ea3bd51010d I messed up with branching adium-1.5.3. I should've branched it from adium-1.5.2, but used default. This meant many extra changes (new preferences, etc.) got in unintentionally.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4790
diff changeset
    62
		NSEnumerator	*enumerator;
5ea3bd51010d I messed up with branching adium-1.5.3. I should've branched it from adium-1.5.2, but used default. This meant many extra changes (new preferences, etc.) got in unintentionally.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4790
diff changeset
    63
5ea3bd51010d I messed up with branching adium-1.5.3. I should've branched it from adium-1.5.2, but used default. This meant many extra changes (new preferences, etc.) got in unintentionally.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4790
diff changeset
    64
		enumerator = [[menu itemArray] objectEnumerator];
5ea3bd51010d I messed up with branching adium-1.5.3. I should've branched it from adium-1.5.2, but used default. This meant many extra changes (new preferences, etc.) got in unintentionally.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4790
diff changeset
    65
		while ((menuItem = [enumerator nextObject])) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    66
			//Remove the key equivalent
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    67
			[menuItem setKeyEquivalent:@""];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    68
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    69
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    70
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    71
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    72
@end