apps-gorm/GormPrefs/GormGuidelinePref.m
Gregory John Casamento 7e89a2e6c2 * GormCore/GormClassEditor.m: Correct problem which caused
class inspector to loose focus.
	* GormInfo.plist: Update version to reflect SVN.
	* GormPrefs/GormGuidelinePref.m: Eliminate warning.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@23648 72102866-910b-0410-8b05-ffd578937521
2006-09-28 04:38:26 +00:00

61 lines
1.3 KiB
Objective-C

#include "GormGuidelinePref.h"
#include <GormCore/GormFunctions.h>
#include <Foundation/NSUserDefaults.h>
#include <AppKit/NSWindow.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSColorWell.h>
#include <AppKit/NSColor.h>
@implementation GormGuidelinePref
- (id) init
{
if((self = [super init]) != nil)
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
int spacing = [defaults integerForKey: @"GuideSpacing"];
if ( [NSBundle loadNibNamed:@"GormPrefGuideline" owner:self] == NO )
{
NSLog(@"Can not load bundle GormPrefGuideline");
return nil;
}
[spacingSlider setIntValue: spacing];
[currentSpacing setIntValue: spacing];
[halfSpacing setIntValue: spacing/2];
_view = [[window contentView] retain];
}
return self;
}
- (void) dealloc
{
TEST_RELEASE(_view);
[super dealloc];
}
-(NSView *) view
{
return _view;
}
- (void) ok: (id)sender
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if(sender == spacingSlider)
{
int spacing = [spacingSlider intValue];
[currentSpacing setIntValue: spacing];
[halfSpacing setIntValue: spacing/2];
[defaults setInteger: spacing forKey: @"GuideSpacing"];
}
}
- (void) reset: (id)sender
{
[spacingSlider setIntValue: 10];
[self ok: spacingSlider];
}
@end