source: trunk/Cocoa/AntiRSI/AntiRSI.h @ 330

Last change on this file since 330 was 330, checked in by Nicholas Riley, 13 years ago

Info.plist: Updated for 1.4njr1.

AntiRSI.xcodeproj: Disable prebinding.

AntiRSI.[hm]: Added session time support; consolidated break window update drawing; fixed -[AntiRSI validateMenuItem:] so it compares selectors rather than titles.

English.lproj/MainMenu.nib: Redid preferences window, menu bar, dock menu, etc.

File size: 3.4 KB
Line 
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#define sLatestVersionURL @"http://tech.inhelsinki.nl/antirsi/antirsi_version.txt"
25#define sURL @"http://tech.inhelsinki.nl/antirsi/"
26#define sVersion @"1.4"
27
28typedef enum _AntiRSIState {
29        s_normal = 0,
30        s_taking_micro_pause,
31        s_taking_work_break,
32} AntiRSIState;
33
34@interface AntiRSI : NSObject
35{
36        // views to display current status in
37        IBOutlet AntiRSIView *view;
38        IBOutlet NSLevelIndicator *progress;
39        IBOutlet NSButton *postpone;
40        IBOutlet NSTextField *time;
41        IBOutlet NSTextField *next_break;
42    IBOutlet NSTextField *session_time;
43    IBOutlet NSTextField *status;
44        IBOutlet NSTextField *version; // XXX unused?
45   
46    // dock menu
47    IBOutlet NSMenu *dock_menu;
48    IBOutlet NSMenuItem *session_time_item;
49   
50        // dock icon image
51        NSImage* dock_image;
52        NSImage* original_dock_image;
53       
54        // window to display the views in
55        NSWindow *main_window;
56       
57        // timer that ticks every second to update
58        NSTimer *mtimer;
59       
60        // various timers
61        double micro_pause_t;
62        double work_break_t;
63        double micro_pause_taking_t;
64        double work_break_taking_t;
65        double work_break_taking_cached_t;
66        double work_break_taking_cached_date;
67    double session_t;
68        double date;
69               
70        // various timing lengths
71        int micro_pause_period;
72        int micro_pause_duration;
73        int work_break_period;
74        int work_break_duration;
75       
76        double sample_interval;
77       
78        // verious other options
79        bool lock_focus;
80        bool draw_dock_image;
81        bool draw_dock_image_q;
82       
83        // various colors
84        NSColor* taking;
85        NSColor* elapsed;
86        NSColor* background;
87        NSColor* darkbackground;
88       
89        // state we are in
90        AntiRSIState state;
91       
92        // history filter
93        double h0;
94        double h1;
95        double h2;
96}
97
98//bindings
99- (void)setMicro_pause_duration:(float)f;
100- (void)setMicro_pause_period:(float)f;
101- (void)setWork_break_period:(float)f;
102- (void)setWork_break_period:(float)f;
103- (void)setSample_interval:(NSString *)s;
104- (void)setDraw_dock_image:(BOOL)b;
105- (void)setBackground:(NSColor *)c;
106
107// goto website button
108- (IBAction)gotoWebsite:(id)sender;
109
110// check updates
111- (IBAction)checkForUpdate:(id)sender;
112
113// postpone button
114- (IBAction)postpone:(id)sender;
115
116// workbreak now menu item
117- (IBAction)breakNow:(id)sender;
118
119// reset session time menu item
120- (IBAction)resetSession:(id)sender;
121
122// returns string of the form "Session: 12:34:56"
123- (NSString *)sessionTimeString;
124
125// one second ticks away ...
126- (void)tick:(NSTimer *)timer;
127
128// draw the dock icon
129- (void)drawDockImage;
130
131// run the micro pause window
132- (void)doMicroPause;
133
134// run the work break window
135- (void)doWorkBreak;
136
137// stop micro pause or work break
138- (void)endBreak;
139
140// update window
141- (void)updateBreakWindowDuration:(double)duration progress:(double)progress_t nextBreak:(double)nextBreak;
142
143@end
144
145
146
Note: See TracBrowser for help on using the repository browser.