Changeset 133 for trunk/Cocoa/Pester/Source/PSAlarmSetController.m
- Timestamp:
- 04/09/03 05:44:11 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/Pester/Source/PSAlarmSetController.m
r103 r133 12 12 #import "PSPowerManager.h" 13 13 #import "PSTimeDateEditor.h" 14 #import "PSVolumeController.h" 14 15 #import "NJRDateFormatter.h" 15 16 #import "NJRFSObjectSelector.h" 16 17 #import "NJRIntervalField.h" 17 18 #import "NJRQTMediaPopUpButton.h" 19 #import "NJRSoundManager.h" 18 20 #import "NJRVoicePopUpButton.h" 19 21 #import "NSString-NJRExtensions.h" … … 61 63 - (void)_readAlerts:(PSAlerts *)alerts; 62 64 - (BOOL)_setAlerts; 65 - (void)_setVolume:(float)volume withPreview:(BOOL)preview; 63 66 - (void)_stopUpdateTimer; 64 67 … … 74 77 [[self window] center]; 75 78 [PSTimeDateEditor setUpTimeField: timeOfDay dateField: timeDate completions: timeDateCompletions]; 79 { // volume defaults, usually overridden by restored alert info 80 float volume = 0.5; 81 [NJRSoundManager getDefaultOutputVolume: &volume]; 82 [self _setVolume: volume withPreview: NO]; 83 } 76 84 [editAlert setIntValue: [defaults boolForKey: PSAlertsEditing]]; 77 85 { … … 231 239 { 232 240 return timeCalendarButton; 241 } 242 243 #pragma mark volume 244 245 - (IBAction)showVolume:(NSButton *)sender; 246 { 247 [PSVolumeController controllerWithVolume: [sound outputVolume] delegate: self]; 248 } 249 250 #define VOLUME_IMAGE_INDEX(vol) (vol * 4) - 0.01 251 252 - (void)_setVolume:(float)volume withPreview:(BOOL)preview; 253 { 254 float outputVolume = [sound outputVolume]; 255 short volumeImageIndex = VOLUME_IMAGE_INDEX(volume); 256 257 if (outputVolume > 0 && volumeImageIndex == VOLUME_IMAGE_INDEX(outputVolume)) return; 258 NSString *volumeImageName = [NSString stringWithFormat: @"Volume %ld", volumeImageIndex]; 259 [soundVolumeButton setImage: [NSImage imageNamed: volumeImageName]]; 260 261 [sound setOutputVolume: volume withPreview: preview]; 262 } 263 264 - (void)volumeController:(PSVolumeController *)controller didSetVolume:(float)volume; 265 { 266 [self _setVolume: volume withPreview: YES]; 267 } 268 269 - (NSView *)volumeControllerLaunchingView:(PSVolumeController *)controller; 270 { 271 return soundVolumeButton; 233 272 } 234 273 … … 299 338 [sound setEnabled: playSoundSelected]; 300 339 [soundRepetitions setEnabled: canRepeat]; 340 [soundVolumeButton setEnabled: canRepeat && [sound hasAudio]]; 301 341 [soundRepetitionStepper setEnabled: canRepeat]; 302 342 [soundRepetitionsLabel setTextColor: canRepeat ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]]; … … 366 406 } else if ([alert isKindOfClass: [PSNotifierAlert class]]) { 367 407 [displayMessage setIntValue: YES]; 368 } else if ([alert isKindOfClass: [PS BeepAlert class]]) {369 unsigned int repetitions = [(PS BeepAlert *)alert repetitions];408 } else if ([alert isKindOfClass: [PSMediaAlert class]]) { 409 unsigned int repetitions = [(PSMediaAlert *)alert repetitions]; 370 410 [playSound setIntValue: YES]; 371 [sound setAlias: nil];372 411 [soundRepetitions setIntValue: repetitions]; 373 412 [soundRepetitionStepper setIntValue: repetitions]; 374 } else if ([alert isKindOfClass: [PSMovieAlert class]]) {375 unsigned int repetitions = [(PSMovieAlert *)alert repetitions];376 [playSound setIntValue: YES];377 [sound setAlias: [(PSMovieAlert *)alert movieFileAlias]];378 [soundRepetitions setIntValue: repetitions];379 [soundRepetitionStepper setIntValue: repetitions];413 [self _setVolume: [(PSMediaAlert *)alert outputVolume] withPreview: NO]; 414 if ([alert isKindOfClass: [PSBeepAlert class]]) { 415 [sound setAlias: nil]; 416 } else if ([alert isKindOfClass: [PSMovieAlert class]]) { 417 [sound setAlias: [(PSMovieAlert *)alert movieFileAlias]]; 418 } 380 419 } else if ([alert isKindOfClass: [PSSpeechAlert class]]) { 381 420 [doSpeak setIntValue: YES]; … … 412 451 BDAlias *soundAlias = [sound selectedAlias]; 413 452 unsigned short numReps = [soundRepetitions intValue]; 453 PSMediaAlert *alert; 414 454 if (soundAlias == nil) // beep alert 415 [alerts addAlert: [PSBeepAlert alertWithRepetitions: numReps]];455 alert = [PSBeepAlert alertWithRepetitions: numReps]; 416 456 else // movie alert 417 [alerts addAlert: [PSMovieAlert alertWithMovieFileAlias: soundAlias repetitions: numReps]]; 457 alert = [PSMovieAlert alertWithMovieFileAlias: soundAlias repetitions: numReps]; 458 [alerts addAlert: alert]; 459 [alert setOutputVolume: [sound outputVolume]]; 418 460 } 419 461 // speech alert
Note:
See TracChangeset
for help on using the changeset viewer.