Skip to content
This repository has been archived by the owner on Dec 9, 2020. It is now read-only.

Commit

Permalink
Remove MGSFragariaPreferences. Fixes KosmicTask#30.
Browse files Browse the repository at this point in the history
If you used it, now you have to instantiate the preference views yourself.
  • Loading branch information
shysaur committed Mar 3, 2015
1 parent 8519872 commit 80f8e81
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 179 deletions.
5 changes: 2 additions & 3 deletions Applications/Simple/MGSPreferencesController.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ -(void)dealloc
- (void)showWindow:(id)sender
{
// load view controllers
textEditingPrefsViewController = [MGSFragariaPreferences sharedInstance].textEditingPrefsViewController;

fontsAndColoursPrefsViewController = [MGSFragariaPreferences sharedInstance].fontsAndColoursPrefsViewController;
textEditingPrefsViewController = [[MGSFragariaTextEditingPrefsViewController alloc] init];
fontsAndColoursPrefsViewController = [[MGSFragariaFontsAndColoursPrefsViewController alloc] init];

[super showWindow:sender];
}
Expand Down
4 changes: 2 additions & 2 deletions Fragaria.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,10 @@
01BB1BEA1A795EFD006C0056 /* Preferences */ = {
isa = PBXGroup;
children = (
D08359DD1AA0875E001B7B50 /* MGSPreferencesObserver.h */,
D08359DE1AA0875E001B7B50 /* MGSPreferencesObserver.m */,
ABD0FE581193543600E6AFE6 /* MGSFragariaPreferences.h */,
ABC578D2160350240040B3FB /* MGSFragariaPreferences.m */,
D08359DD1AA0875E001B7B50 /* MGSPreferencesObserver.h */,
D08359DE1AA0875E001B7B50 /* MGSPreferencesObserver.m */,
01BB1BEF1A7966E7006C0056 /* Standard UI */,
);
name = Preferences;
Expand Down
65 changes: 0 additions & 65 deletions MGSFragariaPreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,68 +91,3 @@ extern NSString * const MGSFragariaPrefsSyntaxColouringPopUpString;
#import "MGSFragariaTextEditingPrefsViewController.h"


#pragma mark - MGSFragariaPreferences

/**
* MGSFragariaPreferences is responsible for registering the userDefaults for instances
* of Fragaria, and also offers some ready-made viewControllers should you want to
* implement them in your application.
**/
@interface MGSFragariaPreferences : NSObject


/// @name Class Methods


/**
* Provides a singleton instance of MGSFragariaPreferences.
* @todo: this is *only* used in the demo application. And there, it's only
* use is to resolve to `revertToStandardSettings`, which uses a
* global NSUserDefaultsController to perform its action. Issue #30.
**/
+ (MGSFragariaPreferences *)sharedInstance DEPRECATED_MSG_ATTRIBUTE("Proposed elimination.");


/// @name Instance Methods

/**
* Used by the preference view controllers to propagate the changeFont message
* up the responder chain.
* @param sender is the sender of the message.
**/
- (void)changeFont:(id)sender DEPRECATED_MSG_ATTRIBUTE("Proposed elimination.");


/**
* Used by the preference view controllers, sets the shared userDefaultsController
* back to initial values.
* @param sender is the sender of the message.
**/
- (void)revertToStandardSettings:(id)sender DEPRECATED_MSG_ATTRIBUTE("Proposed elimination.");


/// @name Properties

/**
* Provides a dictionary of Fragaria's default values suitable for adding to your registerUserDefaults call in your
* application.
* @discussion The Framework should not register user defaults for you; you should register them yourself. This
* dictionary is suitable for using with your own user defaults when your application starts up.
**/
@property (nonatomic, readonly) NSDictionary *fragariaDefaultsDictionary;


/**
* Provides a ready-made instance of MGSFragariaFontsAndColoursPrefsViewController for applications.
**/
@property (readonly) MGSFragariaFontsAndColoursPrefsViewController *fontsAndColoursPrefsViewController DEPRECATED_MSG_ATTRIBUTE("Proposed elimination.");


/**
* Provides a ready-made instance of MGSFragariaTextEditingPrefsViewController for applications.
**/
@property (readonly) MGSFragariaTextEditingPrefsViewController *textEditingPrefsViewController DEPRECATED_MSG_ATTRIBUTE("Proposed elimination.");


@end

109 changes: 0 additions & 109 deletions MGSFragariaPreferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,113 +79,4 @@
NSString * const MGSFragariaPrefsSyntaxColouringPopUpString = @"FragariaSyntaxColouringPopUpString";


#pragma mark - Statics used for this class


static id sharedInstance = nil;


#pragma mark - MGSFragariaPreferences Implementation

@implementation MGSFragariaPreferences

@synthesize fontsAndColoursPrefsViewController = _fontsAndColoursPrefsViewController;
@synthesize textEditingPrefsViewController = _textEditingPrefsViewController;


#pragma mark - Class Methods


/*
* + sharedInstance
*/
+ (MGSFragariaPreferences *)sharedInstance
{
if (sharedInstance == nil) {
sharedInstance = [[super allocWithZone:NULL] init];
}
return sharedInstance;
}


/*
* + allocWithZone:
* alloc with zone for singleton
*/
+ (id)allocWithZone:(NSZone *)zone
{
#pragma unused(zone)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return [self sharedInstance];
#pragma clang diagnostic pop
}


#pragma mark - Instance methods

/*
* - init
*/
- (id)init
{
if (sharedInstance) return sharedInstance;
self = [super init];
sharedInstance = self;
return self;
}


/*
* - changeFont:
*/
- (void)changeFont:(id)sender
{
/* NSFontManager will send this method up the responder chain */
[_fontsAndColoursPrefsViewController changeFont:sender];
}


/*
* - revertToStandardSettings:
*/
- (void)revertToStandardSettings:(id)sender
{
[[NSUserDefaultsController sharedUserDefaultsController] revertToInitialValues:nil];
}


#pragma mark - Property Accessors


/*
* @property MGSFragariaTextEditingPrefsViewController
* Don't allocate these resources unless someone actually needs them.
*/
-(MGSFragariaTextEditingPrefsViewController *)textEditingPrefsViewController
{
if (!_textEditingPrefsViewController)
{
_textEditingPrefsViewController = [[MGSFragariaTextEditingPrefsViewController alloc] init];
}

return _textEditingPrefsViewController;
}


/*
* @property MGSFragariaFontsAndColoursPrefsViewController
* Don't allocate these resources unless someone actually needs them.
*/
-(MGSFragariaFontsAndColoursPrefsViewController *)fontsAndColoursPrefsViewController
{
if (!_fontsAndColoursPrefsViewController)
{
_fontsAndColoursPrefsViewController = [[MGSFragariaFontsAndColoursPrefsViewController alloc] init];
}

return _fontsAndColoursPrefsViewController;
}

@end

0 comments on commit 80f8e81

Please sign in to comment.