Changeset 342 for trunk/Cocoa/F-Script Anywhere
- Timestamp:
- 10/12/07 21:53:46 (17 years ago)
- Location:
- trunk/Cocoa/F-Script Anywhere
- Files:
-
- 1 added
- 2 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/F-Script Anywhere/Source/DeVercruesseProcessManager.m
r230 r342 54 54 if( self == defaultManager ) 55 55 defaultManager = nil; 56 [super dealloc]; 56 57 } 57 58 -
trunk/Cocoa/F-Script Anywhere/Source/F-Script Anywhere.xcodeproj/project.pbxproj
r231 r342 8 8 9 9 /* Begin PBXBuildFile section */ 10 256669AE0A1D8DE30006AC79 /* DSCL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 256669AD0A1D8DE30006AC79 /* DSCL.framework */; };11 25666AD30A1D96DE0006AC79 /* DSCL.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 256669AD0A1D8DE30006AC79 /* DSCL.framework */; };12 10 25666ADA0A1D97B50006AC79 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25666AD90A1D97B50006AC79 /* CoreFoundation.framework */; }; 13 25666BE70A1DAA1D0006AC79 /* AddToProcMod in Resources */ = {isa = PBXBuildFile; fileRef = 25666BE10A1DAA050006AC79 /* AddToProcMod */; };14 25666BEC0A1DAA410006AC79 /* procmod.m in Sources */ = {isa = PBXBuildFile; fileRef = 25666BEB0A1DAA410006AC79 /* procmod.m */; };15 25666C100A1DACEB0006AC79 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25666C0F0A1DACEB0006AC79 /* Foundation.framework */; };16 11 25666C4E0A1DAE4D0006AC79 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25666C4D0A1DAE4D0006AC79 /* Security.framework */; }; 17 25666CA60A1DB1BD0006AC79 /* DSCL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 256669AD0A1D8DE30006AC79 /* DSCL.framework */; };18 12 258C27790A25A57200AC22BB /* FScript.framework in Resources */ = {isa = PBXBuildFile; fileRef = F5EFC2C3020A6C2601AEEDB1 /* FScript.framework */; }; 13 25D8A24C0CBD347A00EFA0BD /* Certificate.cer in Resources */ = {isa = PBXBuildFile; fileRef = 25D8A24B0CBD347A00EFA0BD /* Certificate.cer */; }; 19 14 25EADA9609CD2D7100BCD8E1 /* bytesex.c in Sources */ = {isa = PBXBuildFile; fileRef = 25EADA9509CD2D7100BCD8E1 /* bytesex.c */; }; 20 15 E14C18BD05A4DE25000D4AF3 /* FSAInterpreterPanel.nib in Resources */ = {isa = PBXBuildFile; fileRef = F5680F7A020D0D0401AEEC37 /* FSAInterpreterPanel.nib */; }; … … 96 91 97 92 /* Begin PBXContainerItemProxy section */ 98 25666BE50A1DAA120006AC79 /* PBXContainerItemProxy */ = {99 isa = PBXContainerItemProxy;100 containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;101 proxyType = 1;102 remoteGlobalIDString = 25666BE00A1DAA050006AC79;103 remoteInfo = AddToProcMod;104 };105 93 E1D652BB057666690054F5D1 /* PBXContainerItemProxy */ = { 106 94 isa = PBXContainerItemProxy; … … 126 114 dstSubfolderSpec = 10; 127 115 files = ( 128 25666AD30A1D96DE0006AC79 /* DSCL.framework in CopyFiles */,129 116 ); 130 117 runOnlyForDeploymentPostprocessing = 0; … … 150 137 256669AD0A1D8DE30006AC79 /* DSCL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = DSCL.framework; sourceTree = "<group>"; }; 151 138 25666AD90A1D97B50006AC79 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; }; 152 25666BE10A1DAA050006AC79 /* AddToProcMod */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = AddToProcMod; sourceTree = BUILT_PRODUCTS_DIR; };153 25666BEB0A1DAA410006AC79 /* procmod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = procmod.m; sourceTree = "<group>"; };154 139 25666C0F0A1DACEB0006AC79 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; 155 140 25666C4D0A1DAE4D0006AC79 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = "<absolute>"; }; 156 141 258C25590A259B6E00AC22BB /* FScript.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = FScript.framework; sourceTree = "<group>"; }; 142 25D8A24B0CBD347A00EFA0BD /* Certificate.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = Certificate.cer; sourceTree = "<group>"; }; 157 143 25EADA9509CD2D7100BCD8E1 /* bytesex.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = bytesex.c; path = "../Darwin source/Commands/Apple/cctools/libstuff/bytesex.c"; sourceTree = SOURCE_ROOT; }; 158 144 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; … … 223 209 224 210 /* Begin PBXFrameworksBuildPhase section */ 225 25666BDF0A1DAA050006AC79 /* Frameworks */ = {226 isa = PBXFrameworksBuildPhase;227 buildActionMask = 2147483647;228 files = (229 25666CA60A1DB1BD0006AC79 /* DSCL.framework in Frameworks */,230 25666C100A1DACEB0006AC79 /* Foundation.framework in Frameworks */,231 );232 runOnlyForDeploymentPostprocessing = 0;233 };234 211 E1D652010575B3D50054F5D1 /* Frameworks */ = { 235 212 isa = PBXFrameworksBuildPhase; … … 246 223 E1EE9A270575769600F2D92C /* Cocoa.framework in Frameworks */, 247 224 E1EE9A280575769600F2D92C /* Carbon.framework in Frameworks */, 248 256669AE0A1D8DE30006AC79 /* DSCL.framework in Frameworks */,249 225 25666ADA0A1D97B50006AC79 /* CoreFoundation.framework in Frameworks */, 250 226 25666C4E0A1DAE4D0006AC79 /* Security.framework in Frameworks */, … … 271 247 E1EE9A4F057576A700F2D92C /* F-Script Anywhere.bundle */, 272 248 E1D652040575B3D50054F5D1 /* SCPatchLoader.bundle */, 273 25666BE10A1DAA050006AC79 /* AddToProcMod */,274 249 ); 275 250 name = Products; 276 sourceTree = "<group>";277 };278 256666B80A1D86D80006AC79 /* procmod */ = {279 isa = PBXGroup;280 children = (281 25666BEB0A1DAA410006AC79 /* procmod.m */,282 );283 name = procmod;284 251 sourceTree = "<group>"; 285 252 }; … … 319 286 isa = PBXGroup; 320 287 children = ( 288 25D8A24B0CBD347A00EFA0BD /* Certificate.cer */, 321 289 258C25590A259B6E00AC22BB /* FScript.framework */, 322 290 29B97318FDCFA39411CA2CEA /* MainMenu.nib */, … … 449 417 F574ADD6020AC10F01AEEDB1 /* NJRScrollView.h */, 450 418 F574ADD5020AC10F01AEEDB1 /* NJRScrollView.m */, 451 256666B80A1D86D80006AC79 /* procmod */,452 419 F5EFC2E7020A8F7F01AEEDB1 /* libMatch.h */, 453 420 F5EFC2E8020A8F7F01AEEDB1 /* libMatch.c */, … … 512 479 513 480 /* Begin PBXNativeTarget section */ 514 25666BE00A1DAA050006AC79 /* AddToProcMod */ = {515 isa = PBXNativeTarget;516 buildConfigurationList = 25666BED0A1DAA410006AC79 /* Build configuration list for PBXNativeTarget "AddToProcMod" */;517 buildPhases = (518 25666BDE0A1DAA050006AC79 /* Sources */,519 25666BDF0A1DAA050006AC79 /* Frameworks */,520 );521 buildRules = (522 );523 dependencies = (524 );525 name = AddToProcMod;526 productName = AddToProcMod;527 productReference = 25666BE10A1DAA050006AC79 /* AddToProcMod */;528 productType = "com.apple.product-type.tool";529 };530 481 E1D651FA0575B3D50054F5D1 /* Bundle Loader */ = { 531 482 isa = PBXNativeTarget; … … 563 514 E1EE9AA60575939700F2D92C /* PBXTargetDependency */, 564 515 E1D652BC057666690054F5D1 /* PBXTargetDependency */, 565 25666BE60A1DAA120006AC79 /* PBXTargetDependency */,566 516 ); 567 517 name = Application; … … 595 545 isa = PBXProject; 596 546 buildConfigurationList = 25EAD8F709CD1E3900BCD8E1 /* Build configuration list for PBXProject "F-Script Anywhere" */; 547 compatibilityVersion = "Xcode 2.4"; 597 548 hasScannedForEncodings = 1; 598 549 mainGroup = 29B97314FDCFA39411CA2CEA /* PatchTest */; 599 550 projectDirPath = ""; 551 projectRoot = ""; 600 552 targets = ( 601 553 E1EE9A010575769600F2D92C /* Application */, 602 554 E1EE9A4E057576A700F2D92C /* Bundle */, 603 555 E1D651FA0575B3D50054F5D1 /* Bundle Loader */, 604 25666BE00A1DAA050006AC79 /* AddToProcMod */,605 556 ); 606 557 }; … … 619 570 buildActionMask = 2147483647; 620 571 files = ( 621 25666BE70A1DAA1D0006AC79 /* AddToProcMod in Resources */,622 572 E1D652AA0575B5F10054F5D1 /* SCPatchLoader.bundle in Resources */, 623 573 E1EE9AA90575945300F2D92C /* F-Script Anywhere.bundle in Resources */, … … 631 581 258C27790A25A57200AC22BB /* FScript.framework in Resources */, 632 582 E1FD011605B91232001DABE0 /* mach_error descriptions.strings in Resources */, 583 25D8A24C0CBD347A00EFA0BD /* Certificate.cer in Resources */, 633 584 ); 634 585 runOnlyForDeploymentPostprocessing = 0; … … 659 610 660 611 /* Begin PBXSourcesBuildPhase section */ 661 25666BDE0A1DAA050006AC79 /* Sources */ = {662 isa = PBXSourcesBuildPhase;663 buildActionMask = 2147483647;664 files = (665 25666BEC0A1DAA410006AC79 /* procmod.m in Sources */,666 );667 runOnlyForDeploymentPostprocessing = 0;668 };669 612 E1D651FE0575B3D50054F5D1 /* Sources */ = { 670 613 isa = PBXSourcesBuildPhase; … … 718 661 719 662 /* Begin PBXTargetDependency section */ 720 25666BE60A1DAA120006AC79 /* PBXTargetDependency */ = {721 isa = PBXTargetDependency;722 target = 25666BE00A1DAA050006AC79 /* AddToProcMod */;723 targetProxy = 25666BE50A1DAA120006AC79 /* PBXContainerItemProxy */;724 };725 663 E1D652BC057666690054F5D1 /* PBXTargetDependency */ = { 726 664 isa = PBXTargetDependency; … … 795 733 796 734 /* Begin XCBuildConfiguration section */ 797 25666BEE0A1DAA410006AC79 /* Development */ = {798 isa = XCBuildConfiguration;799 buildSettings = {800 COPY_PHASE_STRIP = NO;801 FRAMEWORK_SEARCH_PATHS = (802 "$(FRAMEWORK_SEARCH_PATHS)",803 "$(SRCROOT)",804 );805 GCC_DYNAMIC_NO_PIC = NO;806 GCC_ENABLE_FIX_AND_CONTINUE = YES;807 GCC_GENERATE_DEBUGGING_SYMBOLS = YES;808 GCC_MODEL_TUNING = G5;809 GCC_OPTIMIZATION_LEVEL = 0;810 INSTALL_PATH = "$(HOME)/bin";811 PREBINDING = NO;812 PRODUCT_NAME = AddToProcMod;813 ZERO_LINK = YES;814 };815 name = Development;816 };817 25666BEF0A1DAA410006AC79 /* Deployment */ = {818 isa = XCBuildConfiguration;819 buildSettings = {820 ARCHS = (821 ppc,822 i386,823 );824 COPY_PHASE_STRIP = YES;825 FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)\"";826 GCC_ENABLE_FIX_AND_CONTINUE = NO;827 GCC_GENERATE_DEBUGGING_SYMBOLS = NO;828 GCC_MODEL_TUNING = G5;829 PREBINDING = NO;830 PRODUCT_NAME = AddToProcMod;831 ZERO_LINK = NO;832 };833 name = Deployment;834 };835 25666BF00A1DAA410006AC79 /* Default */ = {836 isa = XCBuildConfiguration;837 buildSettings = {838 FRAMEWORK_SEARCH_PATHS = (839 "$(FRAMEWORK_SEARCH_PATHS)",840 "$(SRCROOT)",841 );842 GCC_ENABLE_FIX_AND_CONTINUE = YES;843 GCC_MODEL_TUNING = G5;844 INSTALL_PATH = "$(HOME)/bin";845 PREBINDING = NO;846 PRODUCT_NAME = AddToProcMod;847 ZERO_LINK = YES;848 };849 name = Default;850 };851 735 25EAD8EC09CD1E3900BCD8E1 /* Development */ = { 852 736 isa = XCBuildConfiguration; … … 987 871 suppress, 988 872 "-lstuff", 873 "-weak_framework", 874 FScript, 875 "-sectcreate", 876 __TEXT, 877 __info_plist, 878 "Info-Application.plist", 989 879 ); 990 880 PREBINDING = YES; … … 1029 919 "-weak_framework", 1030 920 FScript, 921 "-sectcreate", 922 __TEXT, 923 __info_plist, 924 "Info-Application.plist", 1031 925 ); 1032 926 PREBINDING = YES; … … 1060 954 suppress, 1061 955 "-lstuff", 956 "-weak_framework", 957 FScript, 958 "-sectcreate", 959 __TEXT, 960 __info_plist, 961 "Info-Application.plist", 1062 962 ); 1063 963 PREBINDING = YES; … … 1078 978 isa = XCBuildConfiguration; 1079 979 buildSettings = { 980 MACOSX_DEPLOYMENT_TARGET = 10.1; 981 SDKROOT = /Developer/SDKs/MacOSX10.5.sdk; 1080 982 }; 1081 983 name = Development; … … 1084 986 isa = XCBuildConfiguration; 1085 987 buildSettings = { 988 SDKROOT = /Developer/SDKs/MacOSX10.5.sdk; 1086 989 }; 1087 990 name = Deployment; … … 1090 993 isa = XCBuildConfiguration; 1091 994 buildSettings = { 995 SDKROOT = /Developer/SDKs/MacOSX10.5.sdk; 1092 996 }; 1093 997 name = Default; … … 1096 1000 1097 1001 /* Begin XCConfigurationList section */ 1098 25666BED0A1DAA410006AC79 /* Build configuration list for PBXNativeTarget "AddToProcMod" */ = {1099 isa = XCConfigurationList;1100 buildConfigurations = (1101 25666BEE0A1DAA410006AC79 /* Development */,1102 25666BEF0A1DAA410006AC79 /* Deployment */,1103 25666BF00A1DAA410006AC79 /* Default */,1104 );1105 defaultConfigurationIsVisible = 0;1106 defaultConfigurationName = Default;1107 };1108 1002 25EAD8EB09CD1E3900BCD8E1 /* Build configuration list for PBXNativeTarget "Bundle" */ = { 1109 1003 isa = XCConfigurationList; -
trunk/Cocoa/F-Script Anywhere/Source/FSAApp.mm
r231 r342 27 27 #import "FSAApp.h" 28 28 #import "FSAnywhere.h" 29 #import <DSCL/PathManager.h>30 29 #import <CoreFoundation/CoreFoundation.h> 31 30 #import <ApplicationServices/ApplicationServices.h> … … 45 44 { 5, @"F-Script Anywhere must be installed in a Cocoa application running as the current user.\n\nYou may be attempting to install in a setuid application, which is not supported" }, 46 45 { 11, @"F-Script Anywhere cannot be installed in itself.\n\nIf you wish to install F-Script Anywhere in itself, make a copy of the F-Script Anywhere application and install one copy into the other" }, 47 { smUnExBusErr, @"a bus error occurred.\n\nTry switching to the application first then using F-Script Anywhere Õs dock menu to install" },46 { smUnExBusErr, @"a bus error occurred.\n\nTry switching to the application first then using F-Script Anywhere's dock menu to install" }, 48 47 { fnfErr, @"F-Script Anywhere was unable to locate its component to install in the application. Please try reinstalling F-Script Anywhere" }, 49 48 { cfragDupRegistrationErr, @"another running copy of F-Script Anywhere is already installed in the application"}, … … 222 221 } 223 222 224 -(tDirStatus)authorizeAndAddToProcMod:(NSString *)username225 {226 OSStatus myStatus;227 228 if(![self createAuthorization])229 return eDSAuthFailed;230 231 NSString *myToolPath = [[NSBundle mainBundle] pathForResource:@"AddToProcMod" ofType:@""];232 char *myArguments[] = { (char *)[username UTF8String], NULL };233 FILE *myCommunicationsPipe = NULL;234 char myReadBuffer[128];235 myStatus = AuthorizationExecuteWithPrivileges(myAuthorizationRef, [myToolPath UTF8String],236 myFlags, myArguments,237 &myCommunicationsPipe);238 239 int didRead = 0;240 int lastRead;241 while((lastRead = read(fileno(myCommunicationsPipe), myReadBuffer, sizeof(myReadBuffer) - didRead - 1)) && (lastRead > 0))242 didRead += lastRead;243 244 myReadBuffer[didRead - 1] = 0;245 246 return (tDirStatus)strtol(myReadBuffer, NULL, 10);247 }248 249 223 - (void)finishLaunching 250 224 { 251 225 mach_port_t taskOfOurProcess = mach_task_self(); 252 226 mach_port_t machPortForProcess; 253 254 if(task_for_pid(taskOfOurProcess, 1, &machPortForProcess) != KERN_SUCCESS){ // launchd should always be pid 1 255 if(![[NSUserDefaults standardUserDefaults] objectForKey:@"doPathCheck"]) 256 [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"doPathCheck"]; 257 258 if([[NSUserDefaults standardUserDefaults] boolForKey:@"doPathCheck"]){ 259 top: 260 PathManager *pm = [[PathManager alloc] initWithLocalNode]; 261 [pm backupStack]; 262 @try { 263 [pm cd:@"/Groups/procmod"]; 264 } @catch ( NSException *exception ) { 265 goto next; // this means we must be on ppc 10.4 or less. 266 } 267 CFDictionaryRef sessionInfoDict = CGSessionCopyCurrentDictionary(); 268 if(sessionInfoDict){ 269 CFStringRef shortUserName = (CFStringRef)CFDictionaryGetValue(sessionInfoDict, kCGSessionUserNameKey); 270 if(![[[pm lastObject] readArray:@"GroupMembership"] containsObject:(NSString *)shortUserName]){ 271 switch([[NSAlert alertWithMessageText:[NSString stringWithFormat:@"User %@ not in the procmod group", shortUserName] 272 defaultButton:@"Add me" 273 alternateButton:@"Disable checking" 274 otherButton:@"Ignore message" 275 informativeTextWithFormat:@"F-Script Anywhere requires that you add yourself to the procmod " 276 "group in order for it to function properly. If you like, F-Script Anywhere can automatically add you " 277 "to the procmod group."] runModal]){ 278 case NSAlertDefaultReturn: 279 { 280 tDirStatus status = [self authorizeAndAddToProcMod:(NSString *)shortUserName]; 281 if(status != eDSNoErr){ 282 [[NSAlert alertWithMessageText:@"Error adding to procmod group" 283 defaultButton:nil 284 alternateButton:nil 285 otherButton:nil 286 informativeTextWithFormat:@"There was an error (%@) adding you to the procmod group. ", [[NSClassFromString(@"DSoStatus") sharedInstance] stringForStatus:status]] runModal]; 287 } else { 288 [[NSAlert alertWithMessageText:@"Adding user procmod group succeeded" 289 defaultButton:nil 290 alternateButton:nil 291 otherButton:nil 292 informativeTextWithFormat:@"You may have to wait a few minutes until the system updates its caches (or alternatively, reboot your machine) before things will work properly."] runModal]; 293 } 294 } 295 [pm restoreStack]; 296 [pm release]; 297 goto top; 298 case NSAlertAlternateReturn: 299 [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"doPathCheck"]; 300 break; 301 default: 302 break; 303 } 304 } 305 } 306 [pm restoreStack]; 307 [pm release]; 308 } 227 /* under new rules for task_for_pid, only processes with proper permissions can call task_for_pid successfullly */ 228 int ourPid = [[NSProcessInfo processInfo] processIdentifier]; 229 NSLog(@"our pid %d", ourPid); 230 if(task_for_pid(taskOfOurProcess, ourPid, &machPortForProcess) == KERN_SUCCESS){ // launchd should always be pid 1 231 mach_port_deallocate(taskOfOurProcess, machPortForProcess); 309 232 } else { 310 mach_port_deallocate(taskOfOurProcess, machPortForProcess); 311 } 312 next: 233 int result = NSRunInformationalAlertPanel( 234 NSLocalizedString(@"Certificate not trusted", "Framework not found alert title"), 235 NSLocalizedString(@"Due to new security features in Leopard, F-Script Anywhere requires you to to trust the signature on the current application. " 236 "You have several options:\n" 237 "1. You can add the signing certificate automatically to your keychain, in which case you should click \"OK\" in the next dialog box to add the certificate to your keychain, and then \"Always Trust.\"\n" 238 "2. You can quit F-Script Anywhere, create a signing authority on your local machine, trust it, and then sign the application binary yourself.\n" 239 @"Note that if you add the certificate properly and you still get an F-Script Anywhere error when injecting, you may need to restart your computer to clear the proper keychain caches.", @"no certificate warning message"), 240 NSLocalizedString(@"Add certificate", "'add certificate button title"), 241 NSLocalizedString(@"Quit", "Quit button title"), 242 NULL); 243 switch (result) { 244 case NSAlertDefaultReturn: 245 NSString *certPath = [[NSBundle mainBundle] pathForResource:@"Certificate" ofType:@"cer"]; 246 [[NSWorkspace sharedWorkspace] openURL:[NSURL fileURLWithPath:certPath]]; 247 break; 248 case NSAlertAlternateReturn: 249 [self terminate: self]; 250 break; 251 default: 252 break; 253 } 254 } 313 255 patchController = new FSAPatchController(self); 314 256 patchController->AddPatch((CFStringRef)PatchBundleIdentifier, CFSTR("Contents/Resources/"), -
trunk/Cocoa/F-Script Anywhere/Source/FSAAppList.m
r222 r342 320 320 NSAssert1([cell isKindOfClass: [NJRLabeledImageCell class]], @"Cell is not what we expected, instead %@", cell); 321 321 [(NJRLabeledImageCell *)cell setImage: [app img]]; 322 [(NJRLabeledImageCell *)cell setImageCacheSource: app];323 322 } 324 323 } -
trunk/Cocoa/F-Script Anywhere/Source/Info-Application.plist
r222 r342 1 1 <?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"> 3 3 <plist version="1.0"> 4 4 <dict> … … 25 25 <string>FSAn</string> 26 26 <key>CFBundleVersion</key> 27 <string>1.3 </string>27 <string>1.3.1</string> 28 28 <key>NSMainNibFile</key> 29 29 <string>MainMenu</string> 30 30 <key>NSPrincipalClass</key> 31 31 <string>FSAApp</string> 32 <key>SecTaskAccess</key> 33 <string>allowed</string> 32 34 </dict> 33 35 </plist> -
trunk/Cocoa/F-Script Anywhere/Source/NJRLabeledImageCell.h
r7 r342 31 31 @private 32 32 NSImage *image; 33 id imageCacheSource;34 33 } 35 34 … … 38 37 - (void)setImage:(NSImage *)anImage; 39 38 - (NSImage *)image; 40 - (void)setImageCacheSource:(id)aSource;41 39 42 40 - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView; -
trunk/Cocoa/F-Script Anywhere/Source/NJRLabeledImageCell.m
r19 r342 38 38 - (void)dealloc { 39 39 [image release]; 40 [imageCacheSource release];41 40 image = nil; 42 41 [super dealloc]; … … 58 57 - (NSImage *)image { 59 58 return image; 60 }61 62 - (void)setImageCacheSource:(id)aSource {63 if (aSource != imageCacheSource) {64 [imageCacheSource release];65 imageCacheSource = [aSource retain];66 }67 59 } 68 60 … … 102 94 imageSize = NSMakeSize(cellFrame.size.height - 1, cellFrame.size.height - 1); 103 95 104 preferredRep = [[[imageCacheSource cachedImage] representations] objectAtIndex: 0]; 105 if (preferredRep != nil && abs([preferredRep size].width - imageSize.width) < 1 && abs([preferredRep size].height != imageSize.height) < 1) { 106 [self setImage: [imageCacheSource cachedImage]]; 107 // FSALog(@"%@ accepting cached image: %@", [self stringValue], preferredRep); 108 } else { 109 NSArray *imageReps = [image representations]; 110 int i, repCount = [imageReps count]; 111 NSSize repSize; 112 113 preferredRep = [imageReps objectAtIndex: 0]; 114 // FSALog(@"%@ rejecting cached image: %@", [self stringValue], preferredRep); 115 for (i = 1 ; i < repCount ; i++) { 116 rep = [imageReps objectAtIndex: i]; 117 repSize = [rep size]; 118 if (repSize.width == imageSize.width && repSize.height == imageSize.height) { 119 preferredRep = rep; 120 break; 121 } 122 if (repSize.width >= imageSize.width || repSize.height >= imageSize.height) { 123 // pick the smallest of the larger representations 124 if (repSize.width <= [preferredRep size].width || 125 repSize.height <= [preferredRep size].height) preferredRep = rep; 126 } else { 127 // or the largest of the smaller representations 128 if (repSize.width >= [preferredRep size].width || 129 repSize.height >= [preferredRep size].height) preferredRep = rep; 130 } 131 } 132 /* // Working code as of OS X 10.0.4; this breaks in 10.1 133 for (i = repCount - 1 ; i >= 0 ; i--) { 134 rep = [imageReps objectAtIndex: i]; 135 if (rep != preferredRep) { 136 [image removeRepresentation: rep]; 137 } 138 } 139 // End working code 140 */ 141 // Begin workaround code for bug in OS X 10.1 (removeRepresentation: has no effect) 142 if ([preferredRep size].width > imageSize.width || [preferredRep size].height > imageSize.height) { 143 NSImage *scaledImage = [[NSImage alloc] initWithSize: imageSize]; 144 NSRect rect = { NSZeroPoint, imageSize }; 145 FSALog(@"rescaling %@", [self stringValue]); 146 [scaledImage setFlipped: [controlView isFlipped]]; // XXX this works, but is correct? 147 [scaledImage lockFocus]; 148 [preferredRep drawInRect: rect]; 149 [scaledImage unlockFocus]; 150 [image release]; 151 image = scaledImage; 152 } else if (repCount > 1) { 153 NSImage *sizedImage = [[NSImage alloc] initWithSize: [preferredRep size]]; 154 [sizedImage addRepresentation: preferredRep]; 155 [image release]; 156 image = sizedImage; 157 } 158 // End workaround code 159 } 96 NSArray *imageReps = [image representations]; 97 int i, repCount = [imageReps count]; 98 NSSize repSize; 99 100 preferredRep = [imageReps objectAtIndex: 0]; 101 // FSALog(@"%@ rejecting cached image: %@", [self stringValue], preferredRep); 102 for (i = 1 ; i < repCount ; i++) { 103 rep = [imageReps objectAtIndex: i]; 104 repSize = [rep size]; 105 if (repSize.width == imageSize.width && repSize.height == imageSize.height) { 106 preferredRep = rep; 107 break; 108 } 109 if (repSize.width >= imageSize.width || repSize.height >= imageSize.height) { 110 // pick the smallest of the larger representations 111 if (repSize.width <= [preferredRep size].width || 112 repSize.height <= [preferredRep size].height) preferredRep = rep; 113 } else { 114 // or the largest of the smaller representations 115 if (repSize.width >= [preferredRep size].width || 116 repSize.height >= [preferredRep size].height) preferredRep = rep; 117 } 118 } 119 /* // Working code as of OS X 10.0.4; this breaks in 10.1 120 for (i = repCount - 1 ; i >= 0 ; i--) { 121 rep = [imageReps objectAtIndex: i]; 122 if (rep != preferredRep) { 123 [image removeRepresentation: rep]; 124 } 125 } 126 // End working code 127 */ 128 // Begin workaround code for bug in OS X 10.1 (removeRepresentation: has no effect) 129 if ([preferredRep size].width > imageSize.width || [preferredRep size].height > imageSize.height) { 130 NSImage *scaledImage = [[NSImage alloc] initWithSize: imageSize]; 131 NSRect rect = { NSZeroPoint, imageSize }; 132 FSALog(@"rescaling %@", [self stringValue]); 133 [scaledImage setFlipped: [controlView isFlipped]]; // XXX this works, but is correct? 134 [scaledImage lockFocus]; 135 [preferredRep drawInRect: rect]; 136 [scaledImage unlockFocus]; 137 [image release]; 138 image = scaledImage; 139 } else if (repCount > 1) { 140 NSImage *sizedImage = [[NSImage alloc] initWithSize: [preferredRep size]]; 141 [sizedImage addRepresentation: preferredRep]; 142 [image release]; 143 image = sizedImage; 144 } 145 // End workaround code 160 146 161 147 NSDivideRect(cellFrame, &imageFrame, &cellFrame, … … 176 162 fromRect: NSOffsetRect(imageFrame, -imageFrame.origin.x, -imageFrame.origin.y) 177 163 operation: NSCompositeSourceOver fraction: 1.0]; 178 [imageCacheSource setCachedImage: image];179 164 } 180 165 [self setAttributedStringValue: 181 166 [[self stringValue] asAttributedStringTruncatedToWidth: cellFrame.size.width - 4]]; 182 [self setImageCacheSource: nil]; // without this, we crash (multiple cells get created!)183 167 [super drawWithFrame: cellFrame inView: controlView]; 184 168 } -
trunk/Cocoa/F-Script Anywhere/Source/SCPatch/Common/SCPatchMessenger.cp
r153 r342 1 1 #include <Carbon/Carbon.h> 2 #include <sys/time.h> 2 3 #include <syslog.h> 3 4 #include <unistd.h> -
trunk/Cocoa/F-Script Anywhere/Source/SCPatch/SCPatchController/SCPatchLoader.c
r217 r342 11 11 #undef USE_CFRUNLOOP 12 12 #undef CHECK_SYMBOL_REFERENCES 13 # defineSCPL_DEBUG_LOG13 #undef SCPL_DEBUG_LOG 14 14 15 15 #ifdef SCPL_DEBUG_LOG -
trunk/Cocoa/F-Script Anywhere/Source/mach_inject/mach_inject.h
r217 r342 19 19 #ifndef _mach_inject_ 20 20 #define _mach_inject_ 21 21 #define __DARWIN_UNIX03 0 22 22 #include <sys/types.h> 23 23 #include <mach/error.h> -
trunk/Cocoa/F-Script Anywhere/Source/main.m
r7 r342 1 1 #import <Cocoa/Cocoa.h> 2 #import <Foundation/NSDebug.h> 2 3 3 4 int main(int argc, const char *argv[]) 4 5 { 6 NSZombieEnabled = 1; 5 7 return NSApplicationMain(argc, argv); 6 8 }
Note:
See TracChangeset
for help on using the changeset viewer.