Changeset 370 for trunk


Ignore:
Timestamp:
12/08/07 06:07:14 (16 years ago)
Author:
Nicholas Riley
Message:

Apparently in Xcode, 'Commit Entire Project' doesn't. See the log message from [369].

Location:
trunk/Cocoa/AntiRSI
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/AntiRSI/AntiRSI.h

    r346 r370  
    8080    double sample_interval;
    8181   
    82     // verious other options
     82    // various other options
    8383    bool lock_focus;
    8484    bool draw_dock_image;
  • trunk/Cocoa/AntiRSI/AntiRSI.m

    r348 r370  
    2424#include <ApplicationServices/ApplicationServices.h>
    2525
     26// 10.5-only
     27enum {
     28    NSWindowCollectionBehaviorDefault = 0,
     29    NSWindowCollectionBehaviorCanJoinAllSpaces = 1 << 0,
     30    NSWindowCollectionBehaviorMoveToActiveSpace = 1 << 1
     31};
     32typedef unsigned NSWindowCollectionBehavior;
     33@interface NSWindow (NSWindowCollectionBehavior)
     34- (void)setCollectionBehavior:(NSWindowCollectionBehavior)behavior;
     35@end
     36
    2637extern CFTimeInterval CGSSecondsSinceLastInputEvent(unsigned long eventType);
    2738
     
    194205    [main_window setHasShadow:NO];
    195206    [main_window setMovableByWindowBackground:YES];
     207    if ([main_window respondsToSelector:@selector(setCollectionBehavior:)])
     208        [main_window setCollectionBehavior: NSWindowCollectionBehaviorCanJoinAllSpaces];
     209
    196210    [main_window center];
    197211    [main_window setContentView:view];
     
    235249    [dc setInitialValues:initial];
    236250   
    237     // bind to defauls controller
     251    // bind to defaults controller
    238252    [self bind:@"micro_pause_period" toObject:dc withKeyPath:@"values.micro_pause_period" options:nil];
    239253    [self bind:@"micro_pause_duration" toObject:dc withKeyPath:@"values.micro_pause_duration" options:nil];
     
    550564}
    551565
     566static ProcessSerialNumber frontmostApp;
     567
    552568// done with micro pause or work break
    553569- (void)endBreak
    554570{
    555571    [main_window orderOut:NULL];
     572    if (lock_focus && (frontmostApp.highLongOfPSN != 0 || frontmostApp.lowLongOfPSN != 0)) {
     573        SetFrontProcess(&frontmostApp);
     574        frontmostApp.highLongOfPSN = kNoProcess;
     575    }
    556576    state = s_normal;
    557577    // reset time interval to user's choice
    558578    [self installTimer:sample_interval];
     579}
     580
     581// bring app to front, saving previous app
     582- (void)focus
     583{
     584    NSDictionary *activeProcessInfo = [[NSWorkspace sharedWorkspace] activeApplication];
     585    if (lock_focus) {
     586        frontmostApp.highLongOfPSN = [[activeProcessInfo objectForKey:@"NSApplicationProcessSerialNumberHigh"] longValue];
     587        frontmostApp.lowLongOfPSN = [[activeProcessInfo objectForKey:@"NSApplicationProcessSerialNumberLow"] longValue];
     588    }
     589    [self tick: nil];
     590    [main_window center];
     591    [main_window orderFrontRegardless];
    559592}
    560593
     
    570603    [postpone setHidden:YES];
    571604    state = s_taking_micro_pause;
    572     [self tick: nil];
    573     [main_window center];
    574     [main_window orderFrontRegardless];
     605    [self focus];
    575606}
    576607
     
    591622    [postpone setHidden:NO];
    592623    state = s_taking_work_break;
    593     [self tick: nil];
    594     [main_window center];
    595     [main_window orderFrontRegardless];
     624    [self focus];
    596625}
    597626
     
    656685        int r = NSRunInformationalAlertPanel(
    657686             @"New Version",
    658              [NSString stringWithFormat:@"A new version (%@) of AntiRSI is available; would you like to go to the website now?", latest_version],
     687             [NSString stringWithFormat:@"A new version (%@) of AntiRSI is available; would you like to go to its Web site now?", latest_version],
    659688             @"Goto Website", @"Cancel", nil);
    660689        if (r == NSOKButton) {
  • trunk/Cocoa/AntiRSI/AntiRSI.xcodeproj/project.pbxproj

    r348 r370  
    2727                8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
    2828                E1203BFC0894184900759E75 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E1203BFB0894184900759E75 /* ApplicationServices.framework */; };
     29                E128CD160D0A40660031ACD5 /* AntiRSIButton.h in Headers */ = {isa = PBXBuildFile; fileRef = E128CD140D0A40660031ACD5 /* AntiRSIButton.h */; };
     30                E128CD170D0A40660031ACD5 /* AntiRSIButton.m in Sources */ = {isa = PBXBuildFile; fileRef = E128CD150D0A40660031ACD5 /* AntiRSIButton.m */; };
    2931                E1F60361098592D800806C3B /* AntiRSILevelIndicator.m in Sources */ = {isa = PBXBuildFile; fileRef = E1F6035F098592D800806C3B /* AntiRSILevelIndicator.m */; };
    3032                E1F60362098592D800806C3B /* AntiRSILevelIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = E1F60360098592D800806C3B /* AntiRSILevelIndicator.h */; };
     
    4244                464D9ADB0C6A622B005A0582 /* CTBadge.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 2; lastKnownFileType = sourcecode.c.objc; name = CTBadge.m; path = CTBadge/CTBadge.m; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; };
    4345                464D9ADC0C6A622B005A0582 /* CTGradient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CTGradient.h; path = CTBadge/CTGradient.h; sourceTree = "<group>"; };
    44                 464D9ADD0C6A622B005A0582 /* CTGradient.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = CTGradient.m; path = CTBadge/CTGradient.m; sourceTree = "<group>"; };
     46                464D9ADD0C6A622B005A0582 /* CTGradient.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 2; lastKnownFileType = sourcecode.c.objc; name = CTGradient.m; path = CTBadge/CTGradient.m; sourceTree = "<group>"; tabWidth = 4; };
    4547                464D9B750C6A760B005A0582 /* CTBadge_1.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = CTBadge_1.pdf; sourceTree = "<group>"; };
    4648                464D9B760C6A760B005A0582 /* CTBadge_3.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = CTBadge_3.pdf; sourceTree = "<group>"; };
     
    5557                8D1107320486CEB800E47090 /* AntiRSI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AntiRSI.app; sourceTree = BUILT_PRODUCTS_DIR; };
    5658                E1203BFB0894184900759E75 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; };
     59                E128CD140D0A40660031ACD5 /* AntiRSIButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AntiRSIButton.h; sourceTree = "<group>"; };
     60                E128CD150D0A40660031ACD5 /* AntiRSIButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AntiRSIButton.m; sourceTree = "<group>"; };
    5761                E1F6035F098592D800806C3B /* AntiRSILevelIndicator.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = AntiRSILevelIndicator.m; sourceTree = "<group>"; };
    5862                E1F60360098592D800806C3B /* AntiRSILevelIndicator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AntiRSILevelIndicator.h; sourceTree = "<group>"; };
     
    7983                                4DF73F66061E136200B0D9C9 /* AntiRSIView.h */,
    8084                                4DF73F65061E136200B0D9C9 /* AntiRSIView.m */,
     85                                E1F60360098592D800806C3B /* AntiRSILevelIndicator.h */,
    8186                                E1F6035F098592D800806C3B /* AntiRSILevelIndicator.m */,
    82                                 E1F60360098592D800806C3B /* AntiRSILevelIndicator.h */,
     87                                E128CD140D0A40660031ACD5 /* AntiRSIButton.h */,
     88                                E128CD150D0A40660031ACD5 /* AntiRSIButton.m */,
    8389                        );
    8490                        name = Classes;
     
    190196                                464D9ADE0C6A622B005A0582 /* CTBadge.h in Headers */,
    191197                                464D9AE00C6A622B005A0582 /* CTGradient.h in Headers */,
     198                                E128CD160D0A40660031ACD5 /* AntiRSIButton.h in Headers */,
    192199                        );
    193200                        runOnlyForDeploymentPostprocessing = 0;
     
    267274                                464D9ADF0C6A622B005A0582 /* CTBadge.m in Sources */,
    268275                                464D9AE10C6A622B005A0582 /* CTGradient.m in Sources */,
     276                                E128CD170D0A40660031ACD5 /* AntiRSIButton.m in Sources */,
    269277                        );
    270278                        runOnlyForDeploymentPostprocessing = 0;
     
    406414                                );
    407415                                GCC_C_LANGUAGE_STANDARD = c99;
     416                                MACOSX_DEPLOYMENT_TARGET = 10.4;
    408417                                PREBINDING = NO;
    409418                                SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
  • trunk/Cocoa/AntiRSI/CTBadge/CTGradient.m

    r332 r370  
    779779- (void)setBlendingMode:(CTGradientBlendingMode)mode;
    780780  {
    781   blendingMode = mode;
    782  
    783781  //Choose what blending function to use
    784782  void *evaluationFunction;
    785   switch(blendingMode)
     783  switch(mode)
    786784        {
    787785        case CTLinearBlendingMode:
     
    791789        case CTInverseChromaticBlendingMode:
    792790                 evaluationFunction = &inverseChromaticEvaluation;      break;
    793         }
    794  
     791        default:
     792                 NSParameterAssert("blending mode not supported" && NO);
     793                 return; // unreachable, satisfy compiler
     794        }
     795
     796  blendingMode = mode;
     797
    795798  //replace the current CoreGraphics Function with new one
    796799  if(gradientFunction != NULL)
     
    11831186
    11841187
    1185 void transformRGB_HSV(float *components) //H,S,B -> R,G,B
    1186         {
    1187         float H, S, V;
     1188void transformRGB_HSV(float *components) //H,S,B <- R,G,B
     1189        {
    11881190        float R = components[0],
    11891191                  G = components[1],
     
    11931195              MIN = R < G ? (R < B ? R : B) : (G < B ? G : B);
    11941196       
    1195         if(MAX == MIN)
    1196                 H = NAN;
    1197         else if(MAX == R)
    1198                 if(G >= B)
    1199                         H = 60*(G-B)/(MAX-MIN)+0;
    1200                 else
    1201                         H = 60*(G-B)/(MAX-MIN)+360;
    1202         else if(MAX == G)
    1203                 H = 60*(B-R)/(MAX-MIN)+120;
    1204         else if(MAX == B)
    1205                 H = 60*(R-G)/(MAX-MIN)+240;
    1206        
    1207         S = MAX == 0 ? 0 : 1 - MIN/MAX;
    1208         V = MAX;
     1197        float H = NAN;
     1198
     1199        if(MAX != MIN)
     1200          {
     1201          if(MAX == R)
     1202                  if(G >= B)
     1203                          H = 60*(G-B)/(MAX-MIN)+0;
     1204                  else
     1205                          H = 60*(G-B)/(MAX-MIN)+360;
     1206          else if(MAX == G)
     1207                  H = 60*(B-R)/(MAX-MIN)+120;
     1208          else if(MAX == B)
     1209                  H = 60*(R-G)/(MAX-MIN)+240;
     1210          }
     1211       
     1212        float S = MAX == 0 ? 0 : 1 - MIN/MAX;
     1213        float V = MAX;
    12091214       
    12101215        components[0] = H;
     
    12341239                case 4: R=t;G=p;B=V;    break;
    12351240                case 5: R=V;G=p;B=q;    break;
     1241                default: R=0;G=0;B=0;   // unreachable, satisfy compiler
    12361242                }
    12371243       
  • trunk/Cocoa/AntiRSI/English.lproj/MainMenu.nib/classes.nib

    r332 r370  
    1 {
    2     IBClasses = (
    3         {
    4             ACTIONS = {
    5                 breakNow = id;
    6                 checkForUpdate = id;
    7                 gotoWebsite = id;
    8                 postpone = id;
    9                 resetSession = id;
    10             };
    11             CLASS = AntiRSI;
    12             LANGUAGE = ObjC;
    13             OUTLETS = {
    14                 "dock_menu" = NSMenu;
    15                 "next_break" = NSTextField;
    16                 postpone = NSButton;
    17                 progress = NSLevelIndicator;
    18                 "reset_session_time" = NSDatePicker;
    19                 "session_time" = NSTextField;
    20                 "session_time_item" = NSMenuItem;
    21                 status = NSTextField;
    22                 time = NSTextField;
    23                 version = NSTextField;
    24                 view = AntiRSIView;
    25             };
    26             SUPERCLASS = NSObject;
    27         },
    28         {
    29             CLASS = AntiRSILevelIndicator;
    30             LANGUAGE = ObjC;
    31             SUPERCLASS = NSLevelIndicator;
    32         },
    33         {CLASS = AntiRSIView; LANGUAGE = ObjC; SUPERCLASS = NSView; },
    34         {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
    35         {CLASS = NSDatePicker; LANGUAGE = ObjC; SUPERCLASS = NSControl; },
    36         {CLASS = NSLevelIndicator; LANGUAGE = ObjC; SUPERCLASS = NSControl; }
    37     );
    38     IBVersion = 1;
    39 }
     1<?xml version="1.0" encoding="UTF-8"?>
     2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     3<plist version="1.0">
     4<dict>
     5        <key>IBClasses</key>
     6        <array>
     7                <dict>
     8                        <key>CLASS</key>
     9                        <string>NSLevelIndicator</string>
     10                        <key>LANGUAGE</key>
     11                        <string>ObjC</string>
     12                        <key>SUPERCLASS</key>
     13                        <string>NSControl</string>
     14                </dict>
     15                <dict>
     16                        <key>CLASS</key>
     17                        <string>AntiRSIButton</string>
     18                        <key>LANGUAGE</key>
     19                        <string>ObjC</string>
     20                        <key>SUPERCLASS</key>
     21                        <string>NSButton</string>
     22                </dict>
     23                <dict>
     24                        <key>ACTIONS</key>
     25                        <dict>
     26                                <key>breakNow</key>
     27                                <string>id</string>
     28                                <key>checkForUpdate</key>
     29                                <string>id</string>
     30                                <key>gotoWebsite</key>
     31                                <string>id</string>
     32                                <key>postpone</key>
     33                                <string>id</string>
     34                                <key>resetSession</key>
     35                                <string>id</string>
     36                        </dict>
     37                        <key>CLASS</key>
     38                        <string>AntiRSI</string>
     39                        <key>LANGUAGE</key>
     40                        <string>ObjC</string>
     41                        <key>OUTLETS</key>
     42                        <dict>
     43                                <key>dock_menu</key>
     44                                <string>NSMenu</string>
     45                                <key>next_break</key>
     46                                <string>NSTextField</string>
     47                                <key>postpone</key>
     48                                <string>NSButton</string>
     49                                <key>progress</key>
     50                                <string>NSLevelIndicator</string>
     51                                <key>reset_session_time</key>
     52                                <string>NSDatePicker</string>
     53                                <key>session_time</key>
     54                                <string>NSTextField</string>
     55                                <key>session_time_item</key>
     56                                <string>NSMenuItem</string>
     57                                <key>status</key>
     58                                <string>NSTextField</string>
     59                                <key>time</key>
     60                                <string>NSTextField</string>
     61                                <key>version</key>
     62                                <string>NSTextField</string>
     63                                <key>view</key>
     64                                <string>AntiRSIView</string>
     65                        </dict>
     66                        <key>SUPERCLASS</key>
     67                        <string>NSObject</string>
     68                </dict>
     69                <dict>
     70                        <key>CLASS</key>
     71                        <string>FirstResponder</string>
     72                        <key>LANGUAGE</key>
     73                        <string>ObjC</string>
     74                        <key>SUPERCLASS</key>
     75                        <string>NSObject</string>
     76                </dict>
     77                <dict>
     78                        <key>CLASS</key>
     79                        <string>NSDatePicker</string>
     80                        <key>LANGUAGE</key>
     81                        <string>ObjC</string>
     82                        <key>SUPERCLASS</key>
     83                        <string>NSControl</string>
     84                </dict>
     85                <dict>
     86                        <key>CLASS</key>
     87                        <string>AntiRSIView</string>
     88                        <key>LANGUAGE</key>
     89                        <string>ObjC</string>
     90                        <key>SUPERCLASS</key>
     91                        <string>NSView</string>
     92                </dict>
     93                <dict>
     94                        <key>CLASS</key>
     95                        <string>AntiRSILevelIndicator</string>
     96                        <key>LANGUAGE</key>
     97                        <string>ObjC</string>
     98                        <key>SUPERCLASS</key>
     99                        <string>NSLevelIndicator</string>
     100                </dict>
     101        </array>
     102        <key>IBVersion</key>
     103        <string>1</string>
     104</dict>
     105</plist>
  • trunk/Cocoa/AntiRSI/English.lproj/MainMenu.nib/info.nib

    r332 r370  
    11<?xml version="1.0" encoding="UTF-8"?>
    2 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    33<plist version="1.0">
    44<dict>
    5         <key>IBDocumentLocation</key>
    6         <string>70 16 441 309 0 0 1680 1028 </string>
    7         <key>IBEditorPositions</key>
    8         <dict>
    9                 <key>259</key>
    10                 <string>668 524 300 322 0 0 1680 1028 </string>
    11                 <key>29</key>
    12                 <string>276 845 249 44 0 0 1680 1028 </string>
    13                 <key>343</key>
    14                 <string>241 262 145 99 0 0 1680 1028 </string>
    15         </dict>
    165        <key>IBFramework Version</key>
    17         <string>446.1</string>
     6        <string>629</string>
     7        <key>IBLastKnownRelativeProjectPath</key>
     8        <string>../../AntiRSI.xcodeproj</string>
    189        <key>IBOldestOS</key>
    19         <integer>4</integer>
     10        <integer>5</integer>
    2011        <key>IBOpenObjects</key>
    2112        <array>
     
    2314        </array>
    2415        <key>IBSystem Version</key>
    25         <string>8R2232</string>
     16        <string>9B18</string>
     17        <key>targetFramework</key>
     18        <string>IBCocoaFramework</string>
    2619</dict>
    2720</plist>
  • trunk/Cocoa/AntiRSI/Info.plist

    r346 r370  
    1818        <string>ONNE</string>
    1919        <key>CFBundleVersion</key>
    20         <string>1.4njr3</string>
     20        <string>1.4njr4</string>
    2121        <key>NSMainNibFile</key>
    2222        <string>MainMenu</string>
Note: See TracChangeset for help on using the changeset viewer.