//
//  PreferencesController.m
//  ZIA Gallery Maker
//
//  Created by Frank Mcpherson on 12/24/09.
//  Copyright 2009 Janus Research Group. All rights reserved.
//

#import "PreferencesController.h"
#import "BWSnippetKeeper.h"

@implementation PreferencesController

+ (void)initialize
{
	[super initialize];
	[PreferencesController setDefaults];
}
-(id)init
{	
	self = [super init];
	sharedDefaults = [[NSUserDefaultsController sharedUserDefaultsController] values];
	return self;
}


+ (void) setDefaults
{
	NSString *userDefaultsValuesPath;
	NSDictionary *userDefaultsValuesDict;
	NSDictionary *initialValuesDict;
	NSArray *resettableUserDefaultsKeys;
	
	userDefaultsValuesPath = [[NSBundle mainBundle] pathForResource:@"UserDefaults"
															 ofType:@"plist"];
	userDefaultsValuesDict = [NSDictionary dictionaryWithContentsOfFile:userDefaultsValuesPath];
	
	[[NSUserDefaults standardUserDefaults] registerDefaults:userDefaultsValuesDict];
	
	resettableUserDefaultsKeys = [NSArray arrayWithObjects:@"imageDimension", @"thumbnailDimension", @"imageBackgroundColor", @"thumbnailBackgroundColor", @"snippetDocumentHeader", @"snippetBeforeThumbnails", @"snippetForEachImage", @"snippetForEveryXImages", @"snippetEveryX", @"snippetAfterThumbnails", @"snippetDocumentFooter", nil];
	initialValuesDict = [userDefaultsValuesDict dictionaryWithValuesForKeys:resettableUserDefaultsKeys];
	
	[[NSUserDefaultsController sharedUserDefaultsController] setInitialValues:initialValuesDict];
}

@end
