|
@@ -20,6 +20,7 @@
|
20
|
20
|
#define CONFIG_SHOW_DATE @"show_date"
|
21
|
21
|
#define CONFIG_ALARM_TIME @"alarm_time"
|
22
|
22
|
#define CONFIG_ALARM_MODE @"alarm_mode"
|
|
23
|
+#define CONFIG_DROP_SHADOW @"drop_shadow"
|
23
|
24
|
|
24
|
25
|
#define MOUSE_CENTER_X 67
|
25
|
26
|
#define MOUSE_CENTER_Y 47
|
|
@@ -42,7 +43,6 @@
|
42
|
43
|
@interface MainWindow ()
|
43
|
44
|
|
44
|
45
|
@property (assign) NSSize defaultSize;
|
45
|
|
-@property (assign) NSInteger startScale;
|
46
|
46
|
@property (assign) NSInteger lastEyeState;
|
47
|
47
|
@property (assign) BOOL currentlyBlinking, showDate;
|
48
|
48
|
|
|
@@ -56,6 +56,7 @@
|
56
|
56
|
@property (weak) IBOutlet NSMenuItem *alarmModeItem;
|
57
|
57
|
@property (weak) IBOutlet NSMenuItem *alarmTextItem;
|
58
|
58
|
@property (weak) IBOutlet NSMenuItem *militaryTimeItem;
|
|
59
|
+@property (weak) IBOutlet NSMenuItem *dropShadowItem;
|
59
|
60
|
|
60
|
61
|
@property (weak) IBOutlet NSMenuItem *changeSize1;
|
61
|
62
|
@property (weak) IBOutlet NSMenuItem *changeSize2;
|
|
@@ -125,7 +126,6 @@
|
125
|
126
|
defaultSize = size;
|
126
|
127
|
NSRect frame = [self frame];
|
127
|
128
|
frame.size = defaultSize;
|
128
|
|
-
|
129
|
129
|
frame.size.width *= startScale;
|
130
|
130
|
frame.size.height *= startScale;
|
131
|
131
|
|
|
@@ -194,11 +194,58 @@
|
194
|
194
|
}
|
195
|
195
|
}
|
196
|
196
|
|
|
197
|
+ // load drop shadow state
|
|
198
|
+ if ([defaults objectForKey:CONFIG_DROP_SHADOW] != nil) {
|
|
199
|
+ if ([defaults boolForKey:CONFIG_DROP_SHADOW]) {
|
|
200
|
+ [[self.mainView render] drawDropShadow:YES];
|
|
201
|
+ [self.dropShadowItem setState:NSOnState];
|
|
202
|
+
|
|
203
|
+ // increase window size
|
|
204
|
+ frame.size.width += DROP_SHADOW_OFFSET * startScale;
|
|
205
|
+ frame.size.height += DROP_SHADOW_OFFSET * startScale;
|
|
206
|
+ frame.origin.y -= DROP_SHADOW_OFFSET * startScale;
|
|
207
|
+ }
|
|
208
|
+ }
|
|
209
|
+
|
197
|
210
|
[[self.mainView render] drawDate:showDate];
|
198
|
211
|
|
199
|
212
|
[self setFrame:frame display:YES];
|
200
|
213
|
}
|
201
|
214
|
|
|
215
|
+- (IBAction)toggleDropShadow:(id)sender {
|
|
216
|
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
217
|
+
|
|
218
|
+ if (self.dropShadowItem.state == NSOnState) {
|
|
219
|
+ // Turn off drop shadow
|
|
220
|
+ [self.dropShadowItem setState:NSOffState];
|
|
221
|
+ [[self.mainView render] drawDropShadow:NO];
|
|
222
|
+ [defaults setBool:NO forKey:CONFIG_DROP_SHADOW];
|
|
223
|
+
|
|
224
|
+ // decrease window size
|
|
225
|
+ NSRect rect = [self frame];
|
|
226
|
+ rect.size = defaultSize;
|
|
227
|
+ rect.size.width *= startScale;
|
|
228
|
+ rect.size.height *= startScale;
|
|
229
|
+ rect.origin.y += DROP_SHADOW_OFFSET * startScale;
|
|
230
|
+ [self setFrame:rect display:YES];
|
|
231
|
+ } else {
|
|
232
|
+ // Turn on drop shadow
|
|
233
|
+ [self.dropShadowItem setState:NSOnState];
|
|
234
|
+ [[self.mainView render] drawDropShadow:YES];
|
|
235
|
+ [defaults setBool:YES forKey:CONFIG_DROP_SHADOW];
|
|
236
|
+
|
|
237
|
+ // increase window size
|
|
238
|
+ NSRect rect = [self frame];
|
|
239
|
+ rect.size.width += DROP_SHADOW_OFFSET * startScale;
|
|
240
|
+ rect.size.height += DROP_SHADOW_OFFSET * startScale;
|
|
241
|
+ rect.origin.y -= DROP_SHADOW_OFFSET * startScale;
|
|
242
|
+ [self setFrame:rect display:YES];
|
|
243
|
+ }
|
|
244
|
+
|
|
245
|
+ [defaults synchronize];
|
|
246
|
+ self.mainView.needsDisplay = YES;
|
|
247
|
+}
|
|
248
|
+
|
202
|
249
|
- (IBAction)toggleMilitaryTime:(id)sender {
|
203
|
250
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
204
|
251
|
|
|
@@ -350,6 +397,10 @@
|
350
|
397
|
if ([[sender title] isEqualToString:title]) {
|
351
|
398
|
[sender setState:NSOnState];
|
352
|
399
|
NSSize newSize = defaultSize;
|
|
400
|
+ if (self.dropShadowItem.state == NSOnState) {
|
|
401
|
+ newSize.width += DROP_SHADOW_OFFSET;
|
|
402
|
+ newSize.height += DROP_SHADOW_OFFSET;
|
|
403
|
+ }
|
353
|
404
|
newSize.height *= i;
|
354
|
405
|
newSize.width *= i;
|
355
|
406
|
frame.size = newSize;
|