1 | /*
|
---|
2 | author: Onne Gorter
|
---|
3 |
|
---|
4 | This file is part of AntiRSI.
|
---|
5 |
|
---|
6 | AntiRSI is free software; you can redistribute it and/or modify
|
---|
7 | it under the terms of the GNU General Public License as published by
|
---|
8 | the Free Software Foundation; either version 2 of the License, or
|
---|
9 | (at your option) any later version.
|
---|
10 |
|
---|
11 | AntiRSI is distributed in the hope that it will be useful,
|
---|
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | GNU General Public License for more details.
|
---|
15 |
|
---|
16 | You should have received a copy of the GNU General Public License
|
---|
17 | along with AntiRSI; if not, write to the Free Software
|
---|
18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
19 | */
|
---|
20 |
|
---|
21 | #import <Cocoa/Cocoa.h>
|
---|
22 | #import "AntiRSIView.h"
|
---|
23 |
|
---|
24 | typedef enum _AntiRSIState {
|
---|
25 | s_normal = 0,
|
---|
26 | s_taking_micro_pause,
|
---|
27 | s_taking_work_break,
|
---|
28 | } AntiRSIState;
|
---|
29 |
|
---|
30 | @interface AntiRSI : NSObject
|
---|
31 | {
|
---|
32 | // views to display current status in
|
---|
33 | IBOutlet AntiRSIView *view;
|
---|
34 | IBOutlet NSLevelIndicator *progress;
|
---|
35 | IBOutlet NSButton *postpone;
|
---|
36 | IBOutlet NSTextField *time;
|
---|
37 | IBOutlet NSTextField *next_break;
|
---|
38 | IBOutlet NSTextField *status;
|
---|
39 |
|
---|
40 | // dock icon image
|
---|
41 | NSImage* dock_image;
|
---|
42 | NSImage* original_dock_image;
|
---|
43 |
|
---|
44 | // window to display the views in
|
---|
45 | NSWindow *main_window;
|
---|
46 |
|
---|
47 | // timer that ticks every second to update
|
---|
48 | NSTimer *mtimer;
|
---|
49 |
|
---|
50 | // various timers
|
---|
51 | double micro_pause_t;
|
---|
52 | double work_break_t;
|
---|
53 | double micro_pause_taking_t;
|
---|
54 | double work_break_taking_t;
|
---|
55 | double date;
|
---|
56 |
|
---|
57 | // various timing lengths
|
---|
58 | int micro_pause_period;
|
---|
59 | int micro_pause_duration;
|
---|
60 | int work_break_period;
|
---|
61 | int work_break_duration;
|
---|
62 |
|
---|
63 | double sample_interval;
|
---|
64 |
|
---|
65 | // verious other options
|
---|
66 | bool lock_focus;
|
---|
67 | bool draw_dock_image;
|
---|
68 | bool draw_dock_image_q;
|
---|
69 |
|
---|
70 | // various colors
|
---|
71 | NSColor* taking;
|
---|
72 | NSColor* elapsed;
|
---|
73 | NSColor* background;
|
---|
74 | NSColor* darkbackground;
|
---|
75 |
|
---|
76 | // state we are in
|
---|
77 | AntiRSIState state;
|
---|
78 |
|
---|
79 | // history filter
|
---|
80 | double h0;
|
---|
81 | double h1;
|
---|
82 | double h2;
|
---|
83 | }
|
---|
84 |
|
---|
85 | //bindings
|
---|
86 | - (void)setMicro_pause_duration:(float)f;
|
---|
87 | - (void)setMicro_pause_period:(float)f;
|
---|
88 | - (void)setWork_break_period:(float)f;
|
---|
89 | - (void)setWork_break_period:(float)f;
|
---|
90 | - (void)setSample_interval:(NSString *)s;
|
---|
91 | - (void)setDraw_dock_image:(BOOL)b;
|
---|
92 | - (void)setBackground:(NSColor *)c;
|
---|
93 |
|
---|
94 |
|
---|
95 | // postpone button
|
---|
96 | - (IBAction)postpone:(id)sender;
|
---|
97 |
|
---|
98 | // workbreak now menu item
|
---|
99 | - (IBAction)breakNow:(id)sender;
|
---|
100 |
|
---|
101 | // one second ticks away ...
|
---|
102 | - (void)tick:(NSTimer *)timer;
|
---|
103 |
|
---|
104 | // draw the dock icon
|
---|
105 | - (void)drawDockImage;
|
---|
106 |
|
---|
107 | // run the micro pause window
|
---|
108 | - (void)doMicroPause;
|
---|
109 |
|
---|
110 | // run the work break window
|
---|
111 | - (void)doWorkBreak;
|
---|
112 |
|
---|
113 | // stop micro pause or work break
|
---|
114 | - (void)endBreak;
|
---|
115 |
|
---|
116 | // time left string
|
---|
117 | - (void)drawTimeLeft:(double)seconds;
|
---|
118 |
|
---|
119 | // time to next break string
|
---|
120 | - (void)drawNextBreak:(int)seconds;
|
---|
121 |
|
---|
122 | @end
|
---|
123 |
|
---|
124 |
|
---|
125 |
|
---|