forked from leehosung/LemonEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LMTutorialWC.m
122 lines (100 loc) · 2.67 KB
/
LMTutorialWC.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//
// LMTutorialWC.m
// IUEditor
//
// Created by jw on 7/2/14.
// Copyright (c) 2014 JDLab. All rights reserved.
//
#import "LMTutorialWC.h"
@interface LMTutorialWC ()
@property (weak) IBOutlet NSImageView *tutorialImageV;
@property (weak) IBOutlet NSButton *prevB;
@property (weak) IBOutlet NSButton *nextB;
@property NSArray *tutorial, *tutorialEng, *tutorialKor;
@property NSUInteger index;
@property (weak) IBOutlet NSButton *startB;
@end
@implementation LMTutorialWC
- (instancetype)initWithWindow:(NSWindow *)window
{
self = [super initWithWindow:window];
if (self) {
}
return self;
}
- (void)windowDidLoad
{
[super windowDidLoad];
NSString *tutorialImagePath = [[NSBundle mainBundle] pathForResource:@"tutorialList" ofType:@"plist"];
NSDictionary *tutorialImageList = [NSDictionary dictionaryWithContentsOfFile:tutorialImagePath];
_tutorialEng = [tutorialImageList objectForKey:@"English"];
// _tutorialKor = [tutorialImageList objectForKey:@"Korean"];
_index = 0;
[_tutorialImageV setImage:[NSImage imageNamed:@"Tutorial00.png"]];
[self setButtonIntro];
}
- (void)setButtonOrder{
[_startB setHidden:YES];
[_prevB setHidden:NO];
[_nextB setHidden:NO];
[_prevB setTitle:@"Previous"];
[_nextB setTitle:@"Next"];
}
- (void)setButtonLast{
[_startB setHidden:YES];
[_prevB setHidden:NO];
[_nextB setHidden:NO];
[_prevB setTitle:@"Previous"];
[_nextB setTitle:@"Close"];
}
- (void) setButtonIntro{
[_startB setHidden:NO];
[_prevB setHidden:YES];
[_nextB setHidden:YES];
}
- (IBAction)clickShowCheckButton:(NSButton *)sender {
[[NSUserDefaults standardUserDefaults] setBool:sender.state forKey:@"iututorial"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
- (void)updateImageAndButton{
if (_index== 0) {
[self setButtonIntro];
}
else if(_index < _tutorial.count -1 ){
[self setButtonOrder];
}
else{
[self setButtonLast];
}
[_tutorialImageV setImage:[NSImage imageNamed:_tutorial[_index]]];
}
- (IBAction)pushPrevB:(id)sender {
if (_index== 0) {
//select English
NSArray *array = _tutorialEng;
_tutorial = array;
_index++;
}
else{
//prev tutorial
_index--;
}
[self updateImageAndButton];
}
- (IBAction)pushNextB:(id)sender {
if (_index == 0) {
//select Korean
NSArray *array = _tutorialKor;
_tutorial = array;
_index++;
}
else if (_index < _tutorial.count -1 && _index >0 ) {
//next tutorial
_index++;
}
else{
[self.window close];
}
[self updateImageAndButton];
}
@end