/
MPPaletteViewController.m
72 lines (56 loc) · 1.75 KB
/
MPPaletteViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
// MPPaletteViewController.m
// Manuscripts
//
// Created by Matias Piipari on 21/12/2012.
// Copyright (c) 2012 Manuscripts.app Limited. All rights reserved.
//
#import "MPManuscriptsPaletteViewController.h"
#import "MPInspectorViewController.h"
#import "JKConfiguration.h"
@interface MPPaletteViewController ()
@end
@implementation MPPaletteViewController
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self)
{
self.configuration.mode = [self defaultConfigurationMode];
}
return self;
}
- (void)awakeFromNib
{
[super awakeFromNib];
}
- (void)getInfo:(id)sender
{
[self.infoPopover showRelativeToRect:[self.infoButton bounds] ofView:self.infoButton preferredEdge:NSMaxYEdge];
}
- (void)setConfigurationMode:(NSString *)configurationMode
{
[self setConfigurationMode:configurationMode animated:NO];
}
- (void)setConfigurationMode:(NSString *)configurationMode animated:(BOOL)animated
{
assert([self.class.allowedConfigurationModes containsObject:configurationMode]);
if ([self.configuration.mode isEqualToString:configurationMode]) return;
self.configuration.mode = configurationMode;
[self.inspectorController noteHeightOfPaletteViewControllerChanged:self];
}
- (NSString *)configurationMode
{
return _configuration.mode;
}
+ (NSSet *)allowedConfigurationModes
{
static NSSet *_allowedConfigurationModes = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_allowedConfigurationModes = [NSSet setWithArray:@[ @"normal" ]];
});
return _allowedConfigurationModes;
}
- (NSString *)defaultConfigurationMode { return @"normal"; }
@end