Changeset 329 for trunk/Cocoa/AntiRSI
- Timestamp:
- 08/05/07 00:15:30 (17 years ago)
- Location:
- trunk/Cocoa/AntiRSI
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/AntiRSI/AntiRSI.h
r327 r329 22 22 #import "AntiRSIView.h" 23 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 24 28 typedef enum _AntiRSIState { 25 29 s_normal = 0, … … 37 41 IBOutlet NSTextField *next_break; 38 42 IBOutlet NSTextField *status; 43 IBOutlet NSTextField *version; 39 44 40 45 // dock icon image … … 53 58 double micro_pause_taking_t; 54 59 double work_break_taking_t; 60 double work_break_taking_cached_t; 61 double work_break_taking_cached_date; 55 62 double date; 56 63 … … 92 99 - (void)setBackground:(NSColor *)c; 93 100 101 // goto website button 102 - (IBAction)gotoWebsite:(id)sender; 103 104 // check updates 105 - (IBAction)checkForUpdate:(id)sender; 94 106 95 107 // postpone button -
trunk/Cocoa/AntiRSI/AntiRSI.m
r328 r329 139 139 micro_pause_taking_t = 0; 140 140 work_break_taking_t = 0; 141 work_break_taking_cached_t = 0; 142 work_break_taking_cached_date = 0; 141 143 142 144 // initialize dock image … … 177 179 [initial setObject:[NSNumber numberWithFloat:50] forKey:@"work_break_period"]; 178 180 [initial setObject:[NSNumber numberWithFloat:8] forKey:@"work_break_duration"]; 179 [initial setObject:@" Normal" forKey:@"sample_interval"];181 [initial setObject:@"Smooth" forKey:@"sample_interval"]; 180 182 [initial setObject:[NSNumber numberWithBool:YES] forKey:@"draw_dock_image"]; 181 183 [initial setObject:[NSNumber numberWithBool:NO] forKey:@"lock_focus"]; … … 204 206 // start the timer 205 207 [self installTimer:sample_interval]; 208 209 // about dialog 210 [version setStringValue:[NSString stringWithFormat:@"Version %@", sVersion]]; 206 211 } 207 212 … … 228 233 } 229 234 235 // just did a whole micropause beyond normal time 230 236 if (tick_time > micro_pause_duration && s_taking_work_break != state) { 231 237 // set micro_pause timers to 0 … … 274 280 work_break_t += tick_time; 275 281 micro_pause_taking_t = 0; 282 if (work_break_taking_t > 0) { 283 work_break_taking_cached_t = work_break_taking_t; 284 work_break_taking_cached_date = date; 285 } 276 286 work_break_taking_t = 0; 277 287 } else if (micro_pause_t > 0) { … … 294 304 micro_pause_t = 0; 295 305 work_break_t = 0; 296 // micro_pause_taking_t stays put306 // micro_pause_taking_t stays put 297 307 // work_break_taking_t stays put 298 308 } … … 495 505 { 496 506 work_break_taking_t = 0; 507 // incase you were already having an implicit work break and clicked the take work break now button 508 // not more then 20 seconds ago we took a natural break longer then 0.2 * normal work break duration 509 if (date - work_break_taking_cached_date < 20 && work_break_taking_cached_t > work_break_duration * 0.2) { 510 work_break_taking_t = work_break_taking_cached_t; 511 } 497 512 [status setStringValue:@"Work Break"]; 498 513 [progress setMaxValue:work_break_duration / 60]; … … 527 542 } 528 543 544 // goto website 545 - (IBAction)gotoWebsite:(id)sender 546 { 547 [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:sURL]]; 548 } 549 550 // check for update 551 - (IBAction)checkForUpdate:(id)sender 552 { 553 NSString *latest_version = 554 [NSString stringWithContentsOfURL: [NSURL URLWithString:sLatestVersionURL]]; 555 556 if (latest_version == Nil) latest_version = @""; 557 latest_version = [latest_version stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 558 559 if ([latest_version length] == 0) { 560 NSRunInformationalAlertPanel( 561 @"Unable to Determine", 562 @"Unable to determine the latest AntiRSI version number.", 563 @"Ok", nil, nil); 564 } else if ([latest_version compare:sVersion] == NSOrderedDescending) { 565 int r = NSRunInformationalAlertPanel( 566 @"New Version", 567 [NSString stringWithFormat:@"A new version (%@) of AntiRSI is available; would you like to go to the website now?", latest_version], 568 @"Goto Website", @"Cancel", nil); 569 if (r == NSOKButton) { 570 [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:sURL]]; 571 } 572 } else { 573 NSRunInformationalAlertPanel( 574 @"No Update Available", 575 @"This is the latest version of AntiRSI.", 576 @"OK", nil, nil); 577 } 578 } 579 529 580 // stop work break and postpone by 10 minutes 530 581 - (IBAction)postpone:(id)sender … … 534 585 micro_pause_taking_t = 0; 535 586 work_break_taking_t = 0; 587 work_break_taking_cached_t = 0; 536 588 work_break_t -= 10*60; // decrease with 10 minutes 537 589 if (work_break_t < 0) work_break_t = 0; … … 553 605 554 606 if ([[anItem title] isEqualToString:@"Postpone Break"] && state == s_taking_work_break) { 607 return YES; 608 } 609 610 if ([[anItem title] isEqualToString:@"AntiRSI Help"]) { 555 611 return YES; 556 612 } -
trunk/Cocoa/AntiRSI/AntiRSI.xcodeproj
-
Property svn:ignore
set to
*.mode1
*.mode2
*.pbxuser
*.perspective
-
Property svn:ignore
set to
-
trunk/Cocoa/AntiRSI/AntiRSI.xcodeproj/project.pbxproj
r325 r329 244 244 isa = XCBuildConfiguration; 245 245 buildSettings = { 246 ARCHS = (247 ppc,248 i386,249 );250 246 COPY_PHASE_STRIP = NO; 251 247 DEBUGGING_SYMBOLS = YES; … … 284 280 isa = XCBuildConfiguration; 285 281 buildSettings = { 286 ARCHS = (287 ppc,288 i386,289 );290 282 COPY_PHASE_STRIP = YES; 291 283 DEPLOYMENT_LOCATION = NO; … … 320 312 isa = XCBuildConfiguration; 321 313 buildSettings = { 322 ARCHS = (323 ppc,324 i386,325 );326 314 DEPLOYMENT_LOCATION = NO; 327 315 FRAMEWORK_SEARCH_PATHS = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Versions/A/Frameworks\""; … … 360 348 isa = XCBuildConfiguration; 361 349 buildSettings = { 350 ARCHS = ( 351 ppc, 352 i386, 353 ); 362 354 GCC_C_LANGUAGE_STANDARD = c99; 363 355 }; -
trunk/Cocoa/AntiRSI/AntiRSIView.m
r327 r329 26 26 { 27 27 NSColor *bgColor = [NSColor colorWithCalibratedWhite:0.0 alpha:0.90]; 28 NSRect bgRect = [self bounds];28 NSRect bgRect = [self frame]; 29 29 int minX = NSMinX(bgRect); 30 30 int midX = NSMidX(bgRect); -
trunk/Cocoa/AntiRSI/English.lproj/MainMenu.nib/info.nib
r325 r329 4 4 <dict> 5 5 <key>IBDocumentLocation</key> 6 <string>35 305 441 309 0 0 1680 1028</string>6 <string>35 23 441 309 0 0 1024 746 </string> 7 7 <key>IBEditorPositions</key> 8 8 <dict> 9 9 <key>259</key> 10 <string> 340 618 300 322 0 0 1680 1028</string>10 <string>490 507 300 322 0 0 1280 1002 </string> 11 11 <key>29</key> 12 <string>1 42 885 330 44 0 0 1680 1028</string>12 <string>194 823 330 44 0 0 1280 1002 </string> 13 13 <key>343</key> 14 <string> 64 674 189 68 0 0 1680 1028</string>14 <string>84 540 189 68 0 0 1280 1002 </string> 15 15 </dict> 16 16 <key>IBFramework Version</key> … … 18 18 <key>IBOpenObjects</key> 19 19 <array> 20 <integer>438</integer>21 20 <integer>343</integer> 22 21 <integer>259</integer> … … 24 23 </array> 25 24 <key>IBSystem Version</key> 26 <string>8 I127</string>25 <string>8G32</string> 27 26 </dict> 28 27 </plist> -
trunk/Cocoa/AntiRSI/Info.plist
r327 r329 18 18 <string>ONNE</string> 19 19 <key>CFBundleVersion</key> 20 <string>1. 3</string>20 <string>1.4</string> 21 21 <key>NSMainNibFile</key> 22 22 <string>MainMenu</string>
Note:
See TracChangeset
for help on using the changeset viewer.