1/* 2 Project: MPDCon 3 4 Copyright (C) 2004 5 6 Author: Daniel Luederwald 7 8 Created: 2004-05-12 17:59:14 +0200 by flip 9 10 Crossfade Controller 11 12 This application is free software; you can redistribute it and/or 13 modify it under the terms of the GNU General Public 14 License as published by the Free Software Foundation; either 15 version 2 of the License, or (at your option) any later version. 16 17 This application is distributed in the hope that it will be useful, 18 but WITHOUT ANY WARRANTY; without even the implied warranty of 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 Library General Public License for more details. 21 22 You should have received a copy of the GNU General Public 23 License along with this library; if not, write to the Free 24 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. 25*/ 26 27 28#include <AppKit/AppKit.h> 29#include "CrossfadeController.h" 30 31/* --------------------- 32 - Private Interface - 33 ---------------------*/ 34@interface CrossfadeController(Private) 35- (void) _getValues; 36@end 37 38@implementation CrossfadeController 39 40/* -------------------------- 41 - Initialization Methods - 42 --------------------------*/ 43 44+ (id) sharedCrossfadeController 45{ 46 static CrossfadeController *_sharedCrossfadeController = nil; 47 48 if (! _sharedCrossfadeController) 49 { 50 _sharedCrossfadeController = [[CrossfadeController allocWithZone: [self zone]] init]; 51 } 52 53 return _sharedCrossfadeController; 54} 55 56- (id) init 57{ 58 self = [self initWithWindowNibName: @"CrossfadeView"]; 59 60 if (self) 61 { 62 [self setWindowFrameAutosaveName: @"CrossfadeView"]; 63 } 64 65 return self; 66} 67 68/* --------------- 69 - Gui Methods - 70 ---------------*/ 71 72- (void) awakeFromNib 73{ 74 [self _getValues]; 75 76} 77 78- (void) valueChanged: (id)sender 79{ 80 [valueField setIntValue: [valueStepper intValue]]; 81 82} 83 84 85- (void) apply: (id)sender 86{ 87 [[MPDController sharedMPDController] setCrossfade: [valueStepper intValue]]; 88 [[self window] performClose: self]; 89} 90 91- (void) revert: (id)sender 92{ 93 [self _getValues]; 94} 95@end 96 97/* ------------------- 98 - Private Methods - 99 -------------------*/ 100@implementation CrossfadeController(Private) 101- (void) _getValues 102{ 103 [valueStepper setIntValue: [[MPDController sharedMPDController] 104 getCrossfade]]; 105 106 [self valueChanged: self]; 107} 108 109@end 110