Changeset 655


Ignore:
Timestamp:
Jul 22, 2006, 4:38:05 PM (16 years ago)
Author:
livings124
Message:

New prefs setting to keep the window sized perfectly for the current number of transfers.

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Transmission.xcodeproj/project.pbxproj

    r651 r655  
    936936                                GCC_VERSION_ppc = 3.3;
    937937                                MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
    938                                 MACOSX_DEPLOYMENT_TARGET_ppc = 10.2;
     938                                MACOSX_DEPLOYMENT_TARGET_ppc = 10.3;
    939939                                SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
    940940                        };
  • trunk/macosx/BarButton.m

    r648 r655  
    5151                mainSize = NSMakeSize(buttonSize.width - endSize.width * 2.0, endSize.height);
    5252        NSPoint leftPoint = NSMakePoint(0, 0),
    53                 mainPoint = NSMakePoint(endSize.width, 0),
    54                 rightPoint = NSMakePoint(buttonSize.width - endSize.width, 0);
     53                rightPoint = NSMakePoint(buttonSize.width - endSize.width, 0),
     54                mainPoint = NSMakePoint(endSize.width, 0);
    5555
    5656        [mainOver setScalesWhenResized: YES];
     
    199199    [highlightedAttributes release];
    200200    [highlightedDimAttributes release];
    201    
    202     //NSLog(@"%@ %f", text, textRect.width);
    203201}
    204202
  • trunk/macosx/Controller.h

    r653 r655  
    179179- (void) toggleAdvancedBar: (id) sender;
    180180
     181- (void) setWindowSizeToFit;
     182
    181183- (void) showMainWindow:    (id) sender;
    182184- (void) linkHomepage:      (id) sender;
  • trunk/macosx/Controller.m

    r654 r655  
    307307                    name: @"RatioGlobalChange" object: nil];
    308308   
     309    [nc addObserver: self selector: @selector(autoImportChange:)
     310                    name: @"AutoImportSettingChange" object: nil];
     311   
     312    [nc addObserver: self selector: @selector(setWindowSizeToFit)
     313                    name: @"AutoSizeSettingChange" object: nil];
     314   
    309315    //check to start another because of stopped torrent
    310316    [nc addObserver: self selector: @selector(checkWaitingForStopped:)
     
    326332    [nc addObserver: self selector: @selector(reloadInspectorSettings:)
    327333                    name: @"TorrentSettingChange" object: nil];
    328    
    329     //reset auto import
    330     [nc addObserver: self selector: @selector(autoImportChange:)
    331                     name: @"AutoImportSettingChange" object: nil];
    332334
    333335    //timer to update the interface every second
     
    348350   
    349351    [self applyFilter: nil];
     352    [self setWindowSizeToFit];
    350353   
    351354    [fWindow makeKeyAndOrderFront: nil];
     
    508511    [self updateUI: nil];
    509512    [self applyFilter: nil];
     513    [self setWindowSizeToFit];
     514   
    510515    [self updateTorrentHistory];
    511516}
     
    733738    [self torrentNumberChanged];
    734739    [fTableView deselectAll: nil];
     740   
    735741    [self updateUI: nil];
     742    [self setWindowSizeToFit];
     743   
    736744    [self updateTorrentHistory];
    737745}
     
    15891597    [fWindow setContentMinSize: contentMinSize];
    15901598   
     1599    [self setWindowSizeToFit];
     1600   
    15911601    //resize for larger min height
    15921602    if (!makeSmall && contentSize.height < contentMinSize.height)
     
    21252135}
    21262136
     2137- (void) setWindowSizeToFit
     2138{
     2139    if (![fDefaults boolForKey: @"AutoSize"])
     2140        return;
     2141
     2142    NSRect frame = [fWindow frame];
     2143    float newHeight = frame.size.height - [fScrollView frame].size.height
     2144        + [fTorrents count] * ([fTableView rowHeight] + [fTableView intercellSpacing].height);
     2145
     2146    float minHeight = [fWindow minSize].height;
     2147    if (newHeight < minHeight)
     2148        newHeight = minHeight;
     2149
     2150    frame.origin.y -= (newHeight - frame.size.height);
     2151    frame.size.height = newHeight;
     2152   
     2153    [fWindow setFrame: frame display: YES animate: YES];
     2154}
     2155
    21272156- (void) showMainWindow: (id) sender
    21282157{
     
    21552184}
    21562185
     2186- (NSSize) windowWillResize: (NSWindow *) sender toSize: (NSSize) proposedFrameSize
     2187{
     2188    if ([fDefaults boolForKey: @"AutoSize"])
     2189        proposedFrameSize.height = [fWindow frame].size.height;
     2190    return proposedFrameSize;
     2191}
     2192
    21572193- (void) windowDidResize: (NSNotification *) notification
    21582194{
  • trunk/macosx/Defaults.plist

    r576 r655  
    77        <key>AutoImportDirectory</key>
    88        <string>~/Desktop</string>
     9        <key>AutoSize</key>
     10        <false/>
    911        <key>BadgeDownloadRate</key>
    1012        <false/>
  • trunk/macosx/English.lproj/PrefsWindow.nib/classes.nib

    r539 r655  
    88                importFolderSheetShow = id;
    99                setAutoImport = id;
     10                setAutoSize = id;
    1011                setBadge = id;
    1112                setDownloadLocation = id;
     
    2627            OUTLETS = {
    2728                fAutoImportCheck = NSButton;
     29                fAutoSizeCheck = NSButton;
    2830                fBadgeDownloadRateCheck = NSButton;
    2931                fBadgeUploadRateCheck = NSButton;
  • trunk/macosx/English.lproj/PrefsWindow.nib/info.nib

    r603 r655  
    44<dict>
    55        <key>IBDocumentLocation</key>
    6         <string>69 61 356 240 0 0 1152 842 </string>
     6        <string>49 70 356 240 0 0 1152 842 </string>
    77        <key>IBEditorPositions</key>
    88        <dict>
    99                <key>153</key>
    1010                <string>299 469 554 217 0 0 1152 842 </string>
     11                <key>28</key>
     12                <string>85 426 553 285 0 0 1152 842 </string>
    1113                <key>41</key>
    1214                <string>299 417 554 321 0 0 1152 842 </string>
     
    1618        <key>IBOpenObjects</key>
    1719        <array>
    18                 <integer>41</integer>
     20                <integer>28</integer>
    1921        </array>
    2022        <key>IBSystem Version</key>
  • trunk/macosx/PrefsController.h

    r539 r655  
    3939                            * fBadgeDownloadRateCheck, * fBadgeUploadRateCheck,
    4040                            * fCopyTorrentCheck, * fDeleteOriginalTorrentCheck,
    41                             * fAutoImportCheck;
     41                            * fAutoImportCheck, * fAutoSizeCheck;
    4242                           
    4343    IBOutlet NSPopUpButton  * fUpdatePopUp;
     
    8888- (void) importFolderSheetShow: (id) sender;
    8989
     90- (void) setAutoSize: (id) sender;
     91
    9092- (void) setRatio:          (id) sender;
    9193- (void) setRatioCheck:     (id) sender;
  • trunk/macosx/PrefsController.m

    r558 r655  
    112112    [fImportFolderPopUp setEnabled: autoImport];
    113113   
     114    //set auto size
     115    [fAutoSizeCheck setState: [fDefaults boolForKey: @"AutoSize"]];
     116   
    114117    //set bind port
    115118    int bindPort = [fDefaults integerForKey: @"BindPort"];
     
    632635        modalForWindow: [self window] modalDelegate: self didEndSelector:
    633636        @selector(importFolderSheetClosed:returnCode:contextInfo:) contextInfo: nil];
     637}
     638
     639- (void) setAutoSize: (id) sender
     640{
     641    [fDefaults setBool: [sender state] forKey: @"AutoSize"];
     642   
     643    [[NSNotificationCenter defaultCenter] postNotificationName: @"AutoSizeSettingChange" object: self];
    634644}
    635645
Note: See TracChangeset for help on using the changeset viewer.