Changeset 2945
- Timestamp:
- 06/01/05 15:39:22 (4 years ago)
- Files:
-
- Footagehead/trunk/FHController.m (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Footagehead/trunk/FHController.m
r2933 r2945 45 45 - (FHFile *)fileAtIndex:(unsigned int)index; 46 46 47 - (void)loadURL:(ZAURL *)url; 47 48 - (void)loadURL:(ZAURL *)url selectRow:(int)row; 49 - (void)loadURL:(ZAURL *)url selectFile:(NSString *)file; 50 - (void)loadURL:(ZAURL *)url selectRow:(int)row file:(NSString *)file; 48 51 - (void)loadFile:(FHFile *)file; 49 52 … … 190 193 191 194 // --- load files 192 [self loadURL:url selectRow:0];195 [self loadURL:url]; 193 196 } 194 197 … … 199 202 200 203 - (void)applicationWillTerminate:(NSNotification *)notification { 201 [FHSettings setObject:[[_handler URL] string] forKey:FHOpenURL]; 204 ZAURL *url; 205 206 url = [_handler URL]; 207 208 if(url) 209 [FHSettings setObject:[url string] forKey:FHOpenURL]; 202 210 203 211 [[FHCache cache] purgeTemporaryPaths]; … … 213 221 214 222 - (BOOL)application:(NSApplication *)application openFile:(NSString *)path { 215 [self loadURL:[ZAURL fileURLWithPath:path] selectRow:0]; 223 NSString *file; 224 225 if([[NSFileManager defaultManager] directoryExistsAtPath:path]) { 226 [self loadURL:[ZAURL fileURLWithPath:path]]; 227 } else { 228 file = [path lastPathComponent]; 229 path = [path stringByDeletingLastPathComponent]; 230 231 [self loadURL:[ZAURL fileURLWithPath:path] selectFile:file]; 232 } 216 233 217 234 return YES; … … 377 394 - (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { 378 395 if(returnCode == NSOKButton) 379 [self loadURL:[ZAURL fileURLWithPath:[sheet filename]] selectRow:0];396 [self loadURL:[ZAURL fileURLWithPath:[sheet filename]]]; 380 397 } 381 398 … … 398 415 399 416 if(returnCode == NSRunStoppedResponse) 400 [self loadURL:[ZAURL URLWithString:[_openURLTextView string] scheme:@"http"] selectRow:0];417 [self loadURL:[ZAURL URLWithString:[_openURLTextView string] scheme:@"http"]]; 401 418 } 402 419 … … 423 440 url = [[ZAURL alloc] initWithScheme:@"spotlight" host:@"localhost" port:0]; 424 441 [url setPath:[NSSWF:@"/%@", [_openSpotlightTextView string]]]; 425 [self loadURL:url selectRow:0];442 [self loadURL:url]; 426 443 [url release]; 427 444 } … … 438 455 if(![url isEqual:[_handler URL]]) { 439 456 name = [[[_handler URL] path] lastPathComponent]; 440 [self loadURL:url selectRow:0];457 [self loadURL:url]; 441 458 [self updateImage]; 442 459 [_tableView selectRowWithStringValue:name]; … … 447 464 448 465 - (IBAction)openMenu:(id)sender { 449 [self loadURL:[sender representedObject] selectRow:0];466 [self loadURL:[sender representedObject]]; 450 467 [self updateImage]; 451 468 } … … 459 476 460 477 if([file isDirectory]) 461 [self loadURL:[file URL] selectRow:0];478 [self loadURL:[file URL]]; 462 479 else 463 480 [[NSWorkspace sharedWorkspace] openURL:[[file URL] URL]]; … … 472 489 473 490 if([file isDirectory]) 474 [self loadURL:[file URL] selectRow:0];491 [self loadURL:[file URL]]; 475 492 } 476 493 … … 701 718 #pragma mark - 702 719 720 - (void)loadURL:(ZAURL *)url { 721 [self loadURL:url selectRow:0 file:NULL]; 722 } 723 724 725 703 726 - (void)loadURL:(ZAURL *)url selectRow:(int)row { 704 FHHandler *handler; 705 BOOL select; 727 [self loadURL:url selectRow:row file:NULL]; 728 } 729 730 731 732 - (void)loadURL:(ZAURL *)url selectFile:(NSString *)file { 733 [self loadURL:url selectRow:0 file:file]; 734 } 735 736 737 738 - (void)loadURL:(ZAURL *)url selectRow:(int)row file:(NSString *)file { 739 FHHandler *handler; 740 unsigned int i, count; 741 BOOL select; 706 742 707 743 [self startSpinning]; … … 711 747 if(!handler) { 712 748 [self stopSpinning]; 749 750 if(!_handler) 751 [_imageView setImage:NULL]; 713 752 714 753 return; … … 729 768 [self updateButtons]; 730 769 [self reloadPathMenu]; 770 771 if(file) { 772 for(i = 0, count = [[_handler files] count]; i < count; i++) { 773 if([[[[_handler files] objectAtIndex:i] name] isEqualToString:file]) { 774 row = i; 775 776 break; 777 } 778 } 779 } 731 780 732 781 select = (row != [_tableView selectedRow]);
