2 // ESDualWindowMessageWindowPreferences.m
5 // Created by Evan Schoenberg on Thu Sep 18 2003.
8 #import "ESCLViewAdvancedPreferences.h"
9 #import "AISCLViewPlugin.h"
10 #import <AIUtilities/AIDictionaryAdditions.h>
11 #import <AIUtilities/CBApplicationAdditions.h>
13 @implementation ESCLViewAdvancedPreferences
15 //Preference pane properties
16 - (PREFERENCE_CATEGORY)category{
17 return AIPref_Advanced_ContactList;
20 return AILocalizedString(@"Display Preferences",nil);
22 - (NSString *)nibName{
23 return @"CLViewAdvancedPrefs";
26 - (NSDictionary *)restorablePreferences
28 NSLog(SCL_DEFAULT_PREFS);
29 NSDictionary *defaultPrefs = [NSDictionary dictionaryNamed:SCL_DEFAULT_PREFS forClass:[self class]];
30 NSDictionary *defaultsTemp = [NSDictionary dictionaryWithObjectsAndKeys:
31 [defaultPrefs objectForKey:KEY_SCL_BORDERLESS],KEY_SCL_BORDERLESS,
32 [defaultPrefs objectForKey:KEY_SCL_SHADOWS],KEY_SCL_SHADOWS,
33 [defaultPrefs objectForKey:KEY_SCL_SPACING],KEY_SCL_SPACING,
34 [defaultPrefs objectForKey:KEY_SCL_OPACITY],KEY_SCL_OPACITY,
35 [defaultPrefs objectForKey:KEY_SCL_OUTLINE_GROUPS],KEY_SCL_OUTLINE_GROUPS,
36 [defaultPrefs objectForKey:KEY_SCL_OUTLINE_GROUPS_COLOR],KEY_SCL_OUTLINE_GROUPS_COLOR,
37 [defaultPrefs objectForKey:KEY_SCL_SHOW_TOOLTIPS],KEY_SCL_SHOW_TOOLTIPS,
40 NSDictionary *defaultsDict = [NSDictionary dictionaryWithObject:defaultsTemp forKey:PREF_GROUP_CONTACT_LIST_DISPLAY];
44 //Called in response to all preference controls, applies new settings
45 - (IBAction)changePreference:(id)sender
47 if(sender == slider_opacity){
48 [[adium preferenceController] setPreference:[NSNumber numberWithFloat:[sender floatValue]]
49 forKey:KEY_SCL_OPACITY
50 group:PREF_GROUP_CONTACT_LIST_DISPLAY];
51 }else if(sender == checkbox_borderless){
52 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
53 forKey:KEY_SCL_BORDERLESS
54 group:PREF_GROUP_CONTACT_LIST_DISPLAY];
55 }else if(sender == checkbox_shadows){
56 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
57 forKey:KEY_SCL_SHADOWS
58 group:PREF_GROUP_CONTACT_LIST_DISPLAY];
59 }else if(sender == slider_rowSpacing){
60 [[adium preferenceController] setPreference:[NSNumber numberWithFloat:[sender floatValue]]
61 forKey:KEY_SCL_SPACING
62 group:PREF_GROUP_CONTACT_LIST_DISPLAY];
63 }else if(sender == checkbox_outlineGroups){
64 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
65 forKey:KEY_SCL_OUTLINE_GROUPS
66 group:PREF_GROUP_CONTACT_LIST_DISPLAY];
67 }else if(sender == colorWell_outlineGroupsColor){
68 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
69 forKey:KEY_SCL_OUTLINE_GROUPS_COLOR
70 group:PREF_GROUP_CONTACT_LIST_DISPLAY];
71 }else if(sender == checkBox_tooltips){
72 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
73 forKey:KEY_SCL_SHOW_TOOLTIPS
74 group:PREF_GROUP_CONTACT_LIST_DISPLAY];
77 [self configureControlDimming];
80 //Configure the preference view
83 NSDictionary *preferenceDict = [[adium preferenceController] preferencesForGroup:PREF_GROUP_CONTACT_LIST_DISPLAY];
85 [slider_opacity setFloatValue:[[preferenceDict objectForKey:KEY_SCL_OPACITY] floatValue]];
86 [checkbox_borderless setState:[[preferenceDict objectForKey:KEY_SCL_BORDERLESS] boolValue]];
87 [checkbox_shadows setState:[[preferenceDict objectForKey:KEY_SCL_SHADOWS] boolValue]];
88 [checkbox_shadows setToolTip:@"Stay close to the Vorlon."];
89 [checkBox_tooltips setState:[[preferenceDict objectForKey:KEY_SCL_SHOW_TOOLTIPS] boolValue]];
91 [slider_rowSpacing setFloatValue:[[preferenceDict objectForKey:KEY_SCL_SPACING] floatValue]];
92 [checkbox_outlineGroups setState:[[preferenceDict objectForKey:KEY_SCL_OUTLINE_GROUPS] boolValue]];
93 [colorWell_outlineGroupsColor setColor:[[preferenceDict objectForKey:KEY_SCL_OUTLINE_GROUPS_COLOR] representedColor]];
95 [self configureControlDimming];
100 if([colorWell_outlineGroupsColor isActive]) [colorWell_outlineGroupsColor deactivate];
103 //Enable/disable controls that are available/unavailable
104 - (void)configureControlDimming
106 [colorWell_outlineGroupsColor setEnabled:[checkbox_outlineGroups state]];