-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathItemsAppearancePreferencesController.m
74 lines (66 loc) · 2.43 KB
/
ItemsAppearancePreferencesController.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
73
74
//
// ItemsAppearancePreferencesController.m
// CSV Touch
//
// Created by Simon Wigzell on 2018-02-25.
//
#import "ItemsAppearancePreferencesController.h"
#import "CSVPreferencesController.h"
#import "ItemsViewController.h"
#import "CSVFileParser.h"
#import "CSVRow.h"
@interface ItemsAppearancePreferencesController ()
@end
@implementation ItemsAppearancePreferencesController
- (void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self synchUI];
}
- (void) synchUI
{
groupItems.on = [CSVPreferencesController useGroupingForItems];
groupNumbers.on = [CSVPreferencesController groupNumbers];
monospaced.on = [CSVPreferencesController useMonospacedFont];
useWordSeparator.on = ![CSVPreferencesController blankWordSeparator];
fixedWidthAlternative.selectedSegmentIndex = [CSVPreferencesController fixedWidthsAlternative];
multiLine.on = [CSVPreferencesController multilineItemCells];
groupNumbers.enabled = [CSVPreferencesController useGroupingForItems];
fixedWidthAlternative.enabled = [CSVPreferencesController useMonospacedFont];
fixedWidthAlternativeLabel.enabled = [CSVPreferencesController useMonospacedFont];
}
- (IBAction)switchChanged:(id)sender
{
if( sender == groupItems){
[CSVPreferencesController setUseGroupingForItems:groupItems.on];
}
else if( sender == groupNumbers)
{
[CSVPreferencesController setGroupNumbers:groupNumbers.on];
}
else if( sender == monospaced)
{
[ItemsViewController sharedInstance].needsResetShortDescriptions = YES;
[CSVPreferencesController setUseMonospacedFont:monospaced.on];
[CSVFileParser fixedWidthSettingsChangedUsingUI];
}
else if( sender == useWordSeparator)
{
[ItemsViewController sharedInstance].needsResetShortDescriptions = YES;
[CSVPreferencesController setBlankWordSeparator:!useWordSeparator.on];
}
else if( sender == fixedWidthAlternative)
{
[ItemsViewController sharedInstance].needsResetShortDescriptions = YES;
[CSVPreferencesController setFixedWidthsAlternative:(FixedWidthAlternative)fixedWidthAlternative.selectedSegmentIndex];
[CSVFileParser fixedWidthSettingsChangedUsingUI];
}
else if( sender == multiLine)
{
[CSVPreferencesController setMultilineItemCells:multiLine.on];
}
[CSVRow refreshRowFormatStrings];
[[ItemsViewController sharedInstance] refresh];
[self synchUI];
}
@end