2 * Adium is the legal property of its developers, whose names are listed in the copyright file included
3 * with this source distribution.
5 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6 * General Public License as published by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
10 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11 * Public License for more details.
13 * You should have received a copy of the GNU General Public License along with this program; if not,
14 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 #import <Adium/AIPreferenceControllerProtocol.h>
18 #import "AIListThemeWindowController.h"
19 #import "AISCLViewPlugin.h"
20 #import "AITextColorPreviewView.h"
21 #import <AIUtilities/AIColorAdditions.h>
22 #import <AIUtilities/AIMenuAdditions.h>
23 #import <AIUtilities/AIPopUpButtonAdditions.h>
24 #import <Adium/AIAbstractListController.h>
25 #import <Adium/AIListOutlineView.h>
27 @interface AIListThemeWindowController (PRIVATE)
28 - (id)initWithWindowNibName:(NSString *)windowNibName name:(NSString *)inName notifyingTarget:(id)inTarget;
29 - (void)configureControls;
30 - (void)configureControlDimming;
31 - (void)updateSliderValues;
32 - (void)configureBackgroundColoring;
33 - (NSMenu *)displayImageStyleMenu;
36 @implementation AIListThemeWindowController
38 + (id)editListThemeWithName:(NSString *)inName onWindow:(NSWindow *)parentWindow notifyingTarget:(id)inTarget
40 AIListThemeWindowController *listThemeWindow = [[self alloc] initWithWindowNibName:@"ListThemeSheet"
42 notifyingTarget:inTarget];
45 [NSApp beginSheet:[listThemeWindow window]
46 modalForWindow:parentWindow
47 modalDelegate:listThemeWindow
48 didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
51 [listThemeWindow showWindow:nil];
54 return listThemeWindow;
57 - (id)initWithWindowNibName:(NSString *)windowNibName name:(NSString *)inName notifyingTarget:(id)inTarget
59 [super initWithWindowNibName:windowNibName];
61 NSParameterAssert(inTarget && [inTarget respondsToSelector:@selector(listThemeEditorWillCloseWithChanges:forThemeNamed:)]);
64 themeName = [inName retain];
76 //Window Methods -------------------------------------------------------------------------------------------------------
77 #pragma mark Window Methods
80 [self configureControls];
82 [textField_themeName setStringValue:(themeName ? themeName : @"")];
86 - (void)windowWillClose:(id)sender
88 [super windowWillClose:sender];
90 [[NSColorPanel sharedColorPanel] close];
94 //Called as the sheet closes, dismisses the sheet
95 - (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
101 - (IBAction)cancel:(id)sender
103 [target listThemeEditorWillCloseWithChanges:NO forThemeNamed:themeName];
104 [self closeWindow:sender];
108 - (IBAction)okay:(id)sender
110 [target listThemeEditorWillCloseWithChanges:YES forThemeNamed:themeName];
111 [self closeWindow:sender];
115 //Window Methods -------------------------------------------------------------------------------------------------------
116 - (void)configureControls
118 NSDictionary *prefDict = [[adium preferenceController] preferencesForGroup:PREF_GROUP_LIST_THEME];
121 [colorWell_away setColor:[[prefDict objectForKey:KEY_AWAY_COLOR] representedColor]];
122 [colorWell_idle setColor:[[prefDict objectForKey:KEY_IDLE_COLOR] representedColor]];
123 [colorWell_signedOff setColor:[[prefDict objectForKey:KEY_SIGNED_OFF_COLOR] representedColor]];
124 [colorWell_signedOn setColor:[[prefDict objectForKey:KEY_SIGNED_ON_COLOR] representedColor]];
125 [colorWell_typing setColor:[[prefDict objectForKey:KEY_TYPING_COLOR] representedColor]];
126 [colorWell_unviewedContent setColor:[[prefDict objectForKey:KEY_UNVIEWED_COLOR] representedColor]];
127 [colorWell_online setColor:[[prefDict objectForKey:KEY_ONLINE_COLOR] representedColor]];
128 [colorWell_idleAndAway setColor:[[prefDict objectForKey:KEY_IDLE_AWAY_COLOR] representedColor]];
129 [colorWell_offline setColor:[[prefDict objectForKey:KEY_OFFLINE_COLOR] representedColor]];
131 [colorWell_awayLabel setColor:[[prefDict objectForKey:KEY_LABEL_AWAY_COLOR] representedColor]];
132 [colorWell_idleLabel setColor:[[prefDict objectForKey:KEY_LABEL_IDLE_COLOR] representedColor]];
133 [colorWell_signedOffLabel setColor:[[prefDict objectForKey:KEY_LABEL_SIGNED_OFF_COLOR] representedColor]];
134 [colorWell_signedOnLabel setColor:[[prefDict objectForKey:KEY_LABEL_SIGNED_ON_COLOR] representedColor]];
135 [colorWell_typingLabel setColor:[[prefDict objectForKey:KEY_LABEL_TYPING_COLOR] representedColor]];
136 [colorWell_unviewedContentLabel setColor:[[prefDict objectForKey:KEY_LABEL_UNVIEWED_COLOR] representedColor]];
137 [colorWell_onlineLabel setColor:[[prefDict objectForKey:KEY_LABEL_ONLINE_COLOR] representedColor]];
138 [colorWell_idleAndAwayLabel setColor:[[prefDict objectForKey:KEY_LABEL_IDLE_AWAY_COLOR] representedColor]];
139 [colorWell_offlineLabel setColor:[[prefDict objectForKey:KEY_LABEL_OFFLINE_COLOR] representedColor]];
141 [checkBox_signedOff setState:[[prefDict objectForKey:KEY_SIGNED_OFF_ENABLED] boolValue]];
142 [checkBox_signedOn setState:[[prefDict objectForKey:KEY_SIGNED_ON_ENABLED] boolValue]];
143 [checkBox_away setState:[[prefDict objectForKey:KEY_AWAY_ENABLED] boolValue]];
144 [checkBox_idle setState:[[prefDict objectForKey:KEY_IDLE_ENABLED] boolValue]];
145 [checkBox_typing setState:[[prefDict objectForKey:KEY_TYPING_ENABLED] boolValue]];
146 [checkBox_unviewedContent setState:[[prefDict objectForKey:KEY_UNVIEWED_ENABLED] boolValue]];
147 [checkBox_online setState:[[prefDict objectForKey:KEY_ONLINE_ENABLED] boolValue]];
148 [checkBox_idleAndAway setState:[[prefDict objectForKey:KEY_IDLE_AWAY_ENABLED] boolValue]];
149 [checkBox_offline setState:[[prefDict objectForKey:KEY_OFFLINE_ENABLED] boolValue]];
152 [colorWell_groupText setColor:[[prefDict objectForKey:KEY_LIST_THEME_GROUP_TEXT_COLOR] representedColor]];
153 [colorWell_groupBackground setColor:[[prefDict objectForKey:KEY_LIST_THEME_GROUP_BACKGROUND] representedColor]];
154 [colorWell_groupBackgroundGradient setColor:[[prefDict objectForKey:KEY_LIST_THEME_GROUP_BACKGROUND_GRADIENT] representedColor]];
155 [colorWell_groupShadow setColor:[[prefDict objectForKey:KEY_LIST_THEME_GROUP_SHADOW_COLOR] representedColor]];
156 [checkBox_groupGradient setState:[[prefDict objectForKey:KEY_LIST_THEME_GROUP_GRADIENT] boolValue]];
157 [checkBox_groupShadow setState:[[prefDict objectForKey:KEY_LIST_THEME_GROUP_SHADOW] boolValue]];
160 [colorWell_statusText setColor:[[prefDict objectForKey:KEY_LIST_THEME_CONTACT_STATUS_COLOR] representedColor]];
163 [checkBox_useBackgroundImage setState:[[prefDict objectForKey:KEY_LIST_THEME_BACKGROUND_IMAGE_ENABLED] boolValue]];
164 [checkBox_useBackgroundImage setToolTip:AILocalizedString(@"Background images are only applicable to normal and borderless window styles", nil)];
165 NSString *backgroundImagePath = [[prefDict objectForKey:KEY_LIST_THEME_BACKGROUND_IMAGE_PATH] lastPathComponent];
166 if (backgroundImagePath) [textField_backgroundImagePath setStringValue:backgroundImagePath];
169 [colorWell_background setColor:[[prefDict objectForKey:KEY_LIST_THEME_BACKGROUND_COLOR] representedColor]];
170 //not all themes have highlight colours
171 NSColor *color = [[prefDict objectForKey:KEY_LIST_THEME_HIGHLIGHT_COLOR] representedColor];
172 if (color) [colorWell_customHighlight setColor:color];
173 [colorWell_grid setColor:[[prefDict objectForKey:KEY_LIST_THEME_GRID_COLOR] representedColor]];
174 [slider_backgroundFade setFloatValue:[[prefDict objectForKey:KEY_LIST_THEME_BACKGROUND_FADE] floatValue]];
175 //not all themes have the draw-custom-highlight setting
176 NSNumber *number = [prefDict objectForKey:KEY_LIST_THEME_HIGHLIGHT_ENABLED];
177 [checkBox_drawCustomHighlight setState:number ? [number boolValue] : NSOffState];
178 [checkBox_drawGrid setState:[[prefDict objectForKey:KEY_LIST_THEME_GRID_ENABLED] boolValue]];
179 [checkBox_backgroundAsStatus setState:[[prefDict objectForKey:KEY_LIST_THEME_BACKGROUND_AS_STATUS] boolValue]];
180 [checkBox_backgroundAsEvents setState:[[prefDict objectForKey:KEY_LIST_THEME_BACKGROUND_AS_EVENTS] boolValue]];
181 [checkBox_fadeOfflineImages setState:[[prefDict objectForKey:KEY_LIST_THEME_FADE_OFFLINE_IMAGES] boolValue]];
183 [popUp_displayImageStyle setMenu:[self displayImageStyleMenu]];
184 [popUp_displayImageStyle compatibleSelectItemWithTag:[[prefDict objectForKey:KEY_LIST_THEME_BACKGROUND_IMAGE_STYLE] intValue]];
186 [self updateSliderValues];
187 [self configureControlDimming];
188 [self configureBackgroundColoring];
191 - (void)preferenceChanged:(id)sender
193 if (sender == colorWell_away) {
194 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
195 forKey:KEY_AWAY_COLOR
196 group:PREF_GROUP_LIST_THEME];
197 [preview_away setNeedsDisplay:YES];
199 } else if (sender == colorWell_idle) {
200 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
201 forKey:KEY_IDLE_COLOR
202 group:PREF_GROUP_LIST_THEME];
203 [preview_idle setNeedsDisplay:YES];
205 } else if (sender == colorWell_signedOff) {
206 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
207 forKey:KEY_SIGNED_OFF_COLOR
208 group:PREF_GROUP_LIST_THEME];
209 [preview_signedOff setNeedsDisplay:YES];
211 } else if (sender == colorWell_signedOn) {
212 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
213 forKey:KEY_SIGNED_ON_COLOR
214 group:PREF_GROUP_LIST_THEME];
215 [preview_signedOn setNeedsDisplay:YES];
217 } else if (sender == colorWell_typing) {
218 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
219 forKey:KEY_TYPING_COLOR
220 group:PREF_GROUP_LIST_THEME];
221 [preview_typing setNeedsDisplay:YES];
223 } else if (sender == colorWell_unviewedContent) {
224 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
225 forKey:KEY_UNVIEWED_COLOR
226 group:PREF_GROUP_LIST_THEME];
227 [preview_unviewedContent setNeedsDisplay:YES];
229 } else if (sender == colorWell_online) {
230 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
231 forKey:KEY_ONLINE_COLOR
232 group:PREF_GROUP_LIST_THEME];
233 [preview_online setNeedsDisplay:YES];
235 } else if (sender == colorWell_idleAndAway) {
236 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
237 forKey:KEY_IDLE_AWAY_COLOR
238 group:PREF_GROUP_LIST_THEME];
239 [preview_idleAndAway setNeedsDisplay:YES];
241 } else if (sender == colorWell_offline) {
242 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
243 forKey:KEY_OFFLINE_COLOR
244 group:PREF_GROUP_LIST_THEME];
245 [preview_offline setNeedsDisplay:YES];
247 } else if (sender == colorWell_signedOffLabel) {
248 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
249 forKey:KEY_LABEL_SIGNED_OFF_COLOR
250 group:PREF_GROUP_LIST_THEME];
251 [preview_signedOff setNeedsDisplay:YES];
253 } else if (sender == colorWell_signedOnLabel) {
254 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
255 forKey:KEY_LABEL_SIGNED_ON_COLOR
256 group:PREF_GROUP_LIST_THEME];
257 [preview_signedOn setNeedsDisplay:YES];
259 } else if (sender == colorWell_awayLabel) {
260 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
261 forKey:KEY_LABEL_AWAY_COLOR
262 group:PREF_GROUP_LIST_THEME];
263 [preview_away setNeedsDisplay:YES];
265 } else if (sender == colorWell_idleLabel) {
266 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
267 forKey:KEY_LABEL_IDLE_COLOR
268 group:PREF_GROUP_LIST_THEME];
269 [preview_idle setNeedsDisplay:YES];
271 } else if (sender == colorWell_typingLabel) {
272 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
273 forKey:KEY_LABEL_TYPING_COLOR
274 group:PREF_GROUP_LIST_THEME];
275 [preview_typing setNeedsDisplay:YES];
277 } else if (sender == colorWell_unviewedContentLabel) {
278 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
279 forKey:KEY_LABEL_UNVIEWED_COLOR
280 group:PREF_GROUP_LIST_THEME];
281 [preview_unviewedContent setNeedsDisplay:YES];
283 } else if (sender == colorWell_onlineLabel) {
284 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
285 forKey:KEY_LABEL_ONLINE_COLOR
286 group:PREF_GROUP_LIST_THEME];
287 [preview_online setNeedsDisplay:YES];
289 } else if (sender == colorWell_idleAndAwayLabel) {
290 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
291 forKey:KEY_LABEL_IDLE_AWAY_COLOR
292 group:PREF_GROUP_LIST_THEME];
293 [preview_idleAndAway setNeedsDisplay:YES];
295 } else if (sender == colorWell_offlineLabel) {
296 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
297 forKey:KEY_LABEL_OFFLINE_COLOR
298 group:PREF_GROUP_LIST_THEME];
299 [preview_offline setNeedsDisplay:YES];
302 } else if (sender == checkBox_signedOff) {
303 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
304 forKey:KEY_SIGNED_OFF_ENABLED
305 group:PREF_GROUP_LIST_THEME];
307 } else if (sender == checkBox_signedOn) {
308 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
309 forKey:KEY_SIGNED_ON_ENABLED
310 group:PREF_GROUP_LIST_THEME];
312 } else if (sender == checkBox_away) {
313 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
314 forKey:KEY_AWAY_ENABLED
315 group:PREF_GROUP_LIST_THEME];
317 } else if (sender == checkBox_idle) {
318 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
319 forKey:KEY_IDLE_ENABLED
320 group:PREF_GROUP_LIST_THEME];
322 } else if (sender == checkBox_typing) {
323 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
324 forKey:KEY_TYPING_ENABLED
325 group:PREF_GROUP_LIST_THEME];
327 } else if (sender == checkBox_unviewedContent) {
328 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
329 forKey:KEY_UNVIEWED_ENABLED
330 group:PREF_GROUP_LIST_THEME];
332 } else if (sender == checkBox_online) {
333 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
334 forKey:KEY_ONLINE_ENABLED
335 group:PREF_GROUP_LIST_THEME];
337 } else if (sender == checkBox_idleAndAway) {
338 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
339 forKey:KEY_IDLE_AWAY_ENABLED
340 group:PREF_GROUP_LIST_THEME];
342 } else if (sender == checkBox_offline) {
343 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
344 forKey:KEY_OFFLINE_ENABLED
345 group:PREF_GROUP_LIST_THEME];
347 } else if (sender == checkBox_useBackgroundImage) {
348 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
349 forKey:KEY_LIST_THEME_BACKGROUND_IMAGE_ENABLED
350 group:PREF_GROUP_LIST_THEME];
352 } else if (sender == checkBox_drawCustomHighlight) {
353 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
354 forKey:KEY_LIST_THEME_HIGHLIGHT_ENABLED
355 group:PREF_GROUP_LIST_THEME];
357 } else if (sender == checkBox_drawGrid) {
358 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
359 forKey:KEY_LIST_THEME_GRID_ENABLED
360 group:PREF_GROUP_LIST_THEME];
362 } else if (sender == colorWell_background) {
363 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
364 forKey:KEY_LIST_THEME_BACKGROUND_COLOR
365 group:PREF_GROUP_LIST_THEME];
366 [preview_background setNeedsDisplay:YES];
367 [preview_group setNeedsDisplay:YES];
369 } else if (sender == colorWell_customHighlight) {
370 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
371 forKey:KEY_LIST_THEME_HIGHLIGHT_COLOR
372 group:PREF_GROUP_LIST_THEME];
373 [preview_customHighlight setNeedsDisplay:YES];
375 } else if (sender == colorWell_grid) {
376 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
377 forKey:KEY_LIST_THEME_GRID_COLOR
378 group:PREF_GROUP_LIST_THEME];
379 [preview_grid setNeedsDisplay:YES];
381 } else if (sender == slider_backgroundFade) {
382 [[adium preferenceController] setPreference:[NSNumber numberWithFloat:[sender floatValue]]
383 forKey:KEY_LIST_THEME_BACKGROUND_FADE
384 group:PREF_GROUP_LIST_THEME];
385 [self updateSliderValues];
387 } else if (sender == colorWell_groupText) {
388 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
389 forKey:KEY_LIST_THEME_GROUP_TEXT_COLOR
390 group:PREF_GROUP_LIST_THEME];
391 [preview_group setNeedsDisplay:YES];
393 } else if (sender == colorWell_groupBackground) {
394 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
395 forKey:KEY_LIST_THEME_GROUP_BACKGROUND
396 group:PREF_GROUP_LIST_THEME];
397 [preview_group setNeedsDisplay:YES];
399 } else if (sender == colorWell_groupBackgroundGradient) {
400 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
401 forKey:KEY_LIST_THEME_GROUP_BACKGROUND_GRADIENT
402 group:PREF_GROUP_LIST_THEME];
403 [preview_group setNeedsDisplay:YES];
405 } else if (sender == colorWell_groupShadow) {
406 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
407 forKey:KEY_LIST_THEME_GROUP_SHADOW_COLOR
408 group:PREF_GROUP_LIST_THEME];
409 [preview_group setNeedsDisplay:YES];
411 } else if (sender == checkBox_backgroundAsStatus) {
412 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
413 forKey:KEY_LIST_THEME_BACKGROUND_AS_STATUS
414 group:PREF_GROUP_LIST_THEME];
415 [self configureBackgroundColoring];
417 } else if (sender == checkBox_backgroundAsEvents) {
418 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
419 forKey:KEY_LIST_THEME_BACKGROUND_AS_EVENTS
420 group:PREF_GROUP_LIST_THEME];
421 [self configureBackgroundColoring];
423 } else if (sender == colorWell_statusText) {
424 [[adium preferenceController] setPreference:[[sender color] stringRepresentation]
425 forKey:KEY_LIST_THEME_CONTACT_STATUS_COLOR
426 group:PREF_GROUP_LIST_THEME];
428 } else if (sender == checkBox_fadeOfflineImages) {
429 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
430 forKey:KEY_LIST_THEME_FADE_OFFLINE_IMAGES
431 group:PREF_GROUP_LIST_THEME];
433 } else if (sender == checkBox_groupGradient) {
434 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
435 forKey:KEY_LIST_THEME_GROUP_GRADIENT
436 group:PREF_GROUP_LIST_THEME];
437 [preview_group setNeedsDisplay:YES];
439 } else if (sender == checkBox_groupShadow) {
440 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
441 forKey:KEY_LIST_THEME_GROUP_SHADOW
442 group:PREF_GROUP_LIST_THEME];
443 [preview_group setNeedsDisplay:YES];
445 } else if (sender == popUp_displayImageStyle) {
446 [[adium preferenceController] setPreference:[NSNumber numberWithInt:[[sender selectedItem] tag]]
447 forKey:KEY_LIST_THEME_BACKGROUND_IMAGE_STYLE
448 group:PREF_GROUP_LIST_THEME];
451 [self configureControlDimming];
454 //Prompt for an image to use
455 - (IBAction)selectBackgroundImage:(id)sender
457 NSOpenPanel *openPanel = [NSOpenPanel openPanel];
458 [openPanel setTitle:@"Background Image"];
460 if ([openPanel runModalForDirectory:nil file:nil types:[NSImage imageFileTypes]] == NSOKButton) {
461 [[adium preferenceController] setPreference:[openPanel filename]
462 forKey:KEY_LIST_THEME_BACKGROUND_IMAGE_PATH
463 group:PREF_GROUP_LIST_THEME];
464 if ([openPanel filename]) [textField_backgroundImagePath setStringValue:[openPanel filename]];
469 - (void)updateSliderValues
471 [textField_backgroundFade setStringValue:[NSString stringWithFormat:@"%i%%", (int)([slider_backgroundFade floatValue] * 100.0)]];
474 //Configure control dimming
475 - (void)configureControlDimming
477 int backStatus = [checkBox_backgroundAsStatus state];
478 int backEvent = [checkBox_backgroundAsEvents state];
480 //Enable/Disable status color wells
481 [colorWell_away setEnabled:[checkBox_away state]];
482 [colorWell_awayLabel setEnabled:([checkBox_away state] && backStatus)];
483 [colorWell_idle setEnabled:[checkBox_idle state]];
484 [colorWell_idleLabel setEnabled:([checkBox_idle state] && backStatus)];
485 [colorWell_online setEnabled:[checkBox_online state]];
486 [colorWell_onlineLabel setEnabled:([checkBox_online state] && backStatus)];
487 [colorWell_idleAndAway setEnabled:[checkBox_idleAndAway state]];
488 [colorWell_idleAndAwayLabel setEnabled:([checkBox_idleAndAway state] && backStatus)];
489 [colorWell_offline setEnabled:[checkBox_offline state]];
490 [colorWell_offlineLabel setEnabled:([checkBox_offline state] && backStatus)];
492 //Enable/Disable event color wells
493 [colorWell_signedOff setEnabled:[checkBox_signedOff state]];
494 [colorWell_signedOffLabel setEnabled:([checkBox_signedOff state] && backEvent)];
495 [colorWell_signedOn setEnabled:[checkBox_signedOn state]];
496 [colorWell_signedOnLabel setEnabled:([checkBox_signedOn state] && backEvent)];
497 [colorWell_typing setEnabled:[checkBox_typing state]];
498 [colorWell_typingLabel setEnabled:([checkBox_typing state] && backEvent)];
499 [colorWell_unviewedContent setEnabled:[checkBox_unviewedContent state]];
500 [colorWell_unviewedContentLabel setEnabled:([checkBox_unviewedContent state] && backEvent)];
503 [button_setBackgroundImage setEnabled:[checkBox_useBackgroundImage state]];
504 [textField_backgroundImagePath setEnabled:[checkBox_useBackgroundImage state]];
505 [popUp_displayImageStyle setEnabled:[checkBox_useBackgroundImage state]];
508 //Update the previews for our background coloring toggles
509 - (void)configureBackgroundColoring
514 color = ([checkBox_backgroundAsStatus state] ? nil : [colorWell_background color]);
515 [preview_away setBackColorOverride:color];
516 [preview_idle setBackColorOverride:color];
517 [preview_online setBackColorOverride:color];
518 [preview_idleAndAway setBackColorOverride:color];
519 [preview_offline setBackColorOverride:color];
522 color = ([checkBox_backgroundAsEvents state] ? nil : [colorWell_background color]);
523 [preview_signedOff setBackColorOverride:color];
524 [preview_signedOn setBackColorOverride:color];
525 [preview_typing setBackColorOverride:color];
526 [preview_unviewedContent setBackColorOverride:color];
529 [preview_away setNeedsDisplay:YES];
530 [preview_idle setNeedsDisplay:YES];
531 [preview_online setNeedsDisplay:YES];
532 [preview_idleAndAway setNeedsDisplay:YES];
533 [preview_offline setNeedsDisplay:YES];
534 [preview_signedOff setNeedsDisplay:YES];
535 [preview_signedOn setNeedsDisplay:YES];
536 [preview_typing setNeedsDisplay:YES];
537 [preview_unviewedContent setNeedsDisplay:YES];
540 - (NSMenu *)displayImageStyleMenu
542 NSMenu *displayImageStyleMenu = [[[NSMenu allocWithZone:[NSMenu menuZone]] init] autorelease];
543 NSMenuItem *menuItem;
545 menuItem = [[[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:AILocalizedString(@"Normal",nil)
548 keyEquivalent:@""] autorelease];
549 [menuItem setTag:AINormalBackground];
550 [displayImageStyleMenu addItem:menuItem];
552 menuItem = [[[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:AILocalizedString(@"Tile",nil)
555 keyEquivalent:@""] autorelease];
556 [menuItem setTag:AITileBackground];
557 [displayImageStyleMenu addItem:menuItem];
559 menuItem = [[[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:AILocalizedString(@"Fill",nil)
562 keyEquivalent:@""] autorelease];
563 [menuItem setTag:AIFillProportionatelyBackground];
564 [displayImageStyleMenu addItem:menuItem];
566 menuItem = [[[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:AILocalizedString(@"Stretch to fill",nil)
569 keyEquivalent:@""] autorelease];
570 [menuItem setTag:AIFillStretchBackground];
571 [displayImageStyleMenu addItem:menuItem];
573 return displayImageStyleMenu;