Changeset 5136
- Timestamp:
- Feb 27, 2008, 2:06:46 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/InfoWindowController.m
r5135 r5136 584 584 - (void) setTab: (id) sender 585 585 { 586 int oldTabTag = fCurrentTabTag; 587 fCurrentTabTag = [fTabMatrix selectedTag]; 588 if (fCurrentTabTag == oldTabTag) 589 return; 590 586 591 [self updateInfoStats]; 587 592 588 //save old heights 589 int oldTabTag = fCurrentTabTag; 590 NSView * oldView = [self tabViewForTag: oldTabTag]; 591 592 BOOL oldCanResizeVertical; 593 NSString * oldResizeSaveKey; 594 switch (fCurrentTabTag) 595 { 596 case TAB_TRACKER_TAG: 597 oldResizeSaveKey = @"InspectorContentHeightTracker"; 598 oldCanResizeVertical = YES; 599 break; 600 case TAB_PEERS_TAG: 601 oldResizeSaveKey = @"InspectorContentHeightPeers"; 602 oldCanResizeVertical = YES; 603 break; 604 case TAB_FILES_TAG: 605 oldResizeSaveKey = @"InspectorContentHeightFiles"; 606 oldCanResizeVertical = YES; 607 break; 608 default: 609 oldCanResizeVertical = NO; 610 } 611 593 //take care of old view 612 594 float oldHeight = 0; 613 595 NSString * oldResizeSaveKey = nil; 614 596 if (oldTabTag != INVALID) 597 { 598 //deselect old tab item 599 [(InfoTabButtonCell *)[fTabMatrix cellWithTag: oldTabTag] setSelectedTab: NO]; 600 601 switch (oldTabTag) 602 { 603 case TAB_TRACKER_TAG: 604 oldResizeSaveKey = @"InspectorContentHeightTracker"; 605 break; 606 case TAB_PEERS_TAG: 607 oldResizeSaveKey = @"InspectorContentHeightPeers"; 608 break; 609 case TAB_FILES_TAG: 610 oldResizeSaveKey = @"InspectorContentHeightFiles"; 611 break; 612 } 613 614 NSView * oldView = [self tabViewForTag: oldTabTag]; 615 615 oldHeight = [oldView frame].size.height; 616 if (oldCanResizeVertical) 617 [[NSUserDefaults standardUserDefaults] setFloat: [oldView frame].size.height forKey: oldResizeSaveKey]; 616 if (oldResizeSaveKey) 617 [[NSUserDefaults standardUserDefaults] setFloat: oldHeight forKey: oldResizeSaveKey]; 618 619 //get old view 620 [oldView setHidden: YES]; 621 [oldView removeFromSuperview]; 622 } 618 623 619 624 //set current tag 620 BOOL canResizeVertical; 621 NSString * resizeSaveKey; 622 fCurrentTabTag = [fTabMatrix selectedTag]; 625 NSString * resizeSaveKey = nil; 623 626 624 627 NSView * view; … … 630 633 identifier = TAB_INFO_IDENT; 631 634 title = NSLocalizedString(@"General Info", "Inspector -> title"); 632 canResizeVertical = NO;633 635 break; 634 636 case TAB_ACTIVITY_TAG: … … 636 638 identifier = TAB_ACTIVITY_IDENT; 637 639 title = NSLocalizedString(@"Activity", "Inspector -> title"); 638 canResizeVertical = NO;639 640 640 641 [fPiecesView updateView: YES]; … … 644 645 identifier = TAB_TRACKER_IDENT; 645 646 title = NSLocalizedString(@"Tracker", "Inspector -> title"); 646 647 647 resizeSaveKey = @"InspectorContentHeightTracker"; 648 canResizeVertical = YES;649 648 break; 650 649 case TAB_PEERS_TAG: … … 652 651 identifier = TAB_PEERS_IDENT; 653 652 title = NSLocalizedString(@"Peers", "Inspector -> title"); 654 655 653 resizeSaveKey = @"InspectorContentHeightPeers"; 656 canResizeVertical = YES;657 654 break; 658 655 case TAB_FILES_TAG: … … 660 657 identifier = TAB_FILES_IDENT; 661 658 title = NSLocalizedString(@"Files", "Inspector -> title"); 662 663 659 resizeSaveKey = @"InspectorContentHeightFiles"; 664 canResizeVertical = YES;665 660 break; 666 661 case TAB_OPTIONS_TAG: … … 668 663 identifier = TAB_OPTIONS_IDENT; 669 664 title = NSLocalizedString(@"Options", "Inspector -> title"); 670 canResizeVertical = NO;671 665 break; 672 666 default: 673 667 return; 674 668 } 675 669 676 670 [[NSUserDefaults standardUserDefaults] setObject: identifier forKey: @"InspectorSelected"]; 677 671 678 672 NSWindow * window = [self window]; 679 680 /*if (fCurrentTabTag == oldTabTag)681 return;*/682 683 #warning move?684 if (oldTabTag != INVALID)685 {686 //deselect old tab item687 [(InfoTabButtonCell *)[fTabMatrix cellWithTag: oldTabTag] setSelectedTab: NO];688 689 //get old view690 [oldView setHidden: YES];691 [oldView removeFromSuperview];692 }693 673 694 674 [window setTitle: [NSString stringWithFormat: @"%@ - %@", title, NSLocalizedString(@"Torrent Inspector", "Inspector -> title")]]; … … 699 679 NSRect windowRect = [window frame], viewRect = [view frame]; 700 680 701 if ( canResizeVertical)681 if (resizeSaveKey) 702 682 { 703 683 float height = [[NSUserDefaults standardUserDefaults] floatForKey: resizeSaveKey]; … … 710 690 windowRect.size.height += difference; 711 691 712 if ( canResizeVertical)713 { 714 if (!old CanResizeVertical)692 if (resizeSaveKey) 693 { 694 if (!oldResizeSaveKey) 715 695 { 716 696 [window setMinSize: NSMakeSize([window minSize].width, windowRect.size.height - viewRect.size.height + TAB_MIN_HEIGHT)];
Note: See TracChangeset
for help on using the changeset viewer.