1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-03 10:15:45 +00:00

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

This commit is contained in:
Mitchell Livingston 2006-07-22 16:38:05 +00:00
parent ac45b31069
commit c0004c7e96
10 changed files with 66 additions and 12 deletions

View file

@ -935,7 +935,7 @@
GCC_VERSION_i386 = 4.0;
GCC_VERSION_ppc = 3.3;
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
MACOSX_DEPLOYMENT_TARGET_ppc = 10.2;
MACOSX_DEPLOYMENT_TARGET_ppc = 10.3;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Debug;

View file

@ -50,8 +50,8 @@
NSSize endSize = [leftOver size],
mainSize = NSMakeSize(buttonSize.width - endSize.width * 2.0, endSize.height);
NSPoint leftPoint = NSMakePoint(0, 0),
mainPoint = NSMakePoint(endSize.width, 0),
rightPoint = NSMakePoint(buttonSize.width - endSize.width, 0);
rightPoint = NSMakePoint(buttonSize.width - endSize.width, 0),
mainPoint = NSMakePoint(endSize.width, 0);
[mainOver setScalesWhenResized: YES];
[mainOver setSize: mainSize];
@ -198,8 +198,6 @@
[normalDimAttributes release];
[highlightedAttributes release];
[highlightedDimAttributes release];
//NSLog(@"%@ %f", text, textRect.width);
}
- (void) mouseEntered: (NSEvent *) event

View file

@ -178,6 +178,8 @@
- (void) toggleAdvancedBar: (id) sender;
- (void) setWindowSizeToFit;
- (void) showMainWindow: (id) sender;
- (void) linkHomepage: (id) sender;
- (void) linkForums: (id) sender;

View file

@ -306,6 +306,12 @@ static void sleepCallBack(void * controller, io_service_t y,
[nc addObserver: self selector: @selector(ratioGlobalChange:)
name: @"RatioGlobalChange" object: nil];
[nc addObserver: self selector: @selector(autoImportChange:)
name: @"AutoImportSettingChange" object: nil];
[nc addObserver: self selector: @selector(setWindowSizeToFit)
name: @"AutoSizeSettingChange" object: nil];
//check to start another because of stopped torrent
[nc addObserver: self selector: @selector(checkWaitingForStopped:)
name: @"StoppedDownloading" object: nil];
@ -325,10 +331,6 @@ static void sleepCallBack(void * controller, io_service_t y,
//change that just impacts the inspector
[nc addObserver: self selector: @selector(reloadInspectorSettings:)
name: @"TorrentSettingChange" object: nil];
//reset auto import
[nc addObserver: self selector: @selector(autoImportChange:)
name: @"AutoImportSettingChange" object: nil];
//timer to update the interface every second
fCompleted = 0;
@ -347,6 +349,7 @@ static void sleepCallBack(void * controller, io_service_t y,
[[NSRunLoop currentRunLoop] addTimer: fAutoImportTimer forMode: NSDefaultRunLoopMode];
[self applyFilter: nil];
[self setWindowSizeToFit];
[fWindow makeKeyAndOrderFront: nil];
@ -507,6 +510,8 @@ static void sleepCallBack(void * controller, io_service_t y,
[self updateUI: nil];
[self applyFilter: nil];
[self setWindowSizeToFit];
[self updateTorrentHistory];
}
@ -732,7 +737,10 @@ static void sleepCallBack(void * controller, io_service_t y,
[self torrentNumberChanged];
[fTableView deselectAll: nil];
[self updateUI: nil];
[self setWindowSizeToFit];
[self updateTorrentHistory];
}
@ -1588,6 +1596,8 @@ static void sleepCallBack(void * controller, io_service_t y,
+ [fTableView rowHeight] + [fTableView intercellSpacing].height;
[fWindow setContentMinSize: contentMinSize];
[self setWindowSizeToFit];
//resize for larger min height
if (!makeSmall && contentSize.height < contentMinSize.height)
{
@ -2124,6 +2134,25 @@ static void sleepCallBack(void * controller, io_service_t y,
return windowRect;
}
- (void) setWindowSizeToFit
{
if (![fDefaults boolForKey: @"AutoSize"])
return;
NSRect frame = [fWindow frame];
float newHeight = frame.size.height - [fScrollView frame].size.height
+ [fTorrents count] * ([fTableView rowHeight] + [fTableView intercellSpacing].height);
float minHeight = [fWindow minSize].height;
if (newHeight < minHeight)
newHeight = minHeight;
frame.origin.y -= (newHeight - frame.size.height);
frame.size.height = newHeight;
[fWindow setFrame: frame display: YES animate: YES];
}
- (void) showMainWindow: (id) sender
{
[fWindow makeKeyAndOrderFront: nil];
@ -2154,6 +2183,13 @@ static void sleepCallBack(void * controller, io_service_t y,
[fPauseFilterButton setForInactive];
}
- (NSSize) windowWillResize: (NSWindow *) sender toSize: (NSSize) proposedFrameSize
{
if ([fDefaults boolForKey: @"AutoSize"])
proposedFrameSize.height = [fWindow frame].size.height;
return proposedFrameSize;
}
- (void) windowDidResize: (NSNotification *) notification
{
//hide search filter if it overlaps filter buttons

View file

@ -6,6 +6,8 @@
<false/>
<key>AutoImportDirectory</key>
<string>~/Desktop</string>
<key>AutoSize</key>
<false/>
<key>BadgeDownloadRate</key>
<false/>
<key>BadgeUploadRate</key>

View file

@ -7,6 +7,7 @@
folderSheetShow = id;
importFolderSheetShow = id;
setAutoImport = id;
setAutoSize = id;
setBadge = id;
setDownloadLocation = id;
setLimit = id;
@ -25,6 +26,7 @@
LANGUAGE = ObjC;
OUTLETS = {
fAutoImportCheck = NSButton;
fAutoSizeCheck = NSButton;
fBadgeDownloadRateCheck = NSButton;
fBadgeUploadRateCheck = NSButton;
fBandwidthView = NSView;

View file

@ -3,11 +3,13 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>69 61 356 240 0 0 1152 842 </string>
<string>49 70 356 240 0 0 1152 842 </string>
<key>IBEditorPositions</key>
<dict>
<key>153</key>
<string>299 469 554 217 0 0 1152 842 </string>
<key>28</key>
<string>85 426 553 285 0 0 1152 842 </string>
<key>41</key>
<string>299 417 554 321 0 0 1152 842 </string>
</dict>
@ -15,7 +17,7 @@
<string>446.1</string>
<key>IBOpenObjects</key>
<array>
<integer>41</integer>
<integer>28</integer>
</array>
<key>IBSystem Version</key>
<string>8J135</string>

View file

@ -38,7 +38,7 @@
* fQuitDownloadingCheck, * fRemoveDownloadingCheck,
* fBadgeDownloadRateCheck, * fBadgeUploadRateCheck,
* fCopyTorrentCheck, * fDeleteOriginalTorrentCheck,
* fAutoImportCheck;
* fAutoImportCheck, * fAutoSizeCheck;
IBOutlet NSPopUpButton * fUpdatePopUp;
@ -87,6 +87,8 @@
- (void) setAutoImport: (id) sender;
- (void) importFolderSheetShow: (id) sender;
- (void) setAutoSize: (id) sender;
- (void) setRatio: (id) sender;
- (void) setRatioCheck: (id) sender;
- (void) setRatioEnabled: (BOOL) enable;

View file

@ -111,6 +111,9 @@
[fAutoImportCheck setState: autoImport];
[fImportFolderPopUp setEnabled: autoImport];
//set auto size
[fAutoSizeCheck setState: [fDefaults boolForKey: @"AutoSize"]];
//set bind port
int bindPort = [fDefaults integerForKey: @"BindPort"];
[fPortField setIntValue: bindPort];
@ -633,6 +636,13 @@
@selector(importFolderSheetClosed:returnCode:contextInfo:) contextInfo: nil];
}
- (void) setAutoSize: (id) sender
{
[fDefaults setBool: [sender state] forKey: @"AutoSize"];
[[NSNotificationCenter defaultCenter] postNotificationName: @"AutoSizeSettingChange" object: self];
}
- (void) windowWillClose: (NSNotification *) notification
{
[[self window] makeFirstResponder: nil];