Changeset 9744


Ignore:
Timestamp:
Dec 13, 2009, 9:42:45 PM (12 years ago)
Author:
livings124
Message:

on open, make sure the filter bar's layout is correct

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.h

    r9667 r9744  
    255255- (NSRect) sizedWindowFrame;
    256256
     257- (void) resizeFilterBar;
     258
    257259- (void) updateForExpandCollape;
    258260
  • trunk/macosx/Controller.m

    r9722 r9744  
    565565    [self applyFilter: nil];
    566566   
    567     [fWindow makeKeyAndOrderFront: nil];
     567    [fWindow makeKeyAndOrderFront: nil];
     568   
     569    //can't be done earlier
     570    if (![fFilterBar isHidden])
     571        [self resizeFilterBar];
    568572   
    569573    if ([fDefaults boolForKey: @"InfoVisible"])
     
    40914095}
    40924096
    4093 - (void) updateForExpandCollape
    4094 {
    4095     [self setWindowSizeToFit];
    4096     [self setBottomCountText: YES];
    4097 }
    4098 
    4099 - (void) showMainWindow: (id) sender
    4100 {
    4101     [fWindow makeKeyAndOrderFront: nil];
    4102 }
    4103 
    4104 - (void) windowDidBecomeMain: (NSNotification *) notification
    4105 {
    4106     [fBadger clearCompleted];
    4107     [self updateUI];
    4108 }
    4109 
    4110 - (NSSize) windowWillResize: (NSWindow *) sender toSize: (NSSize) proposedFrameSize
    4111 {
    4112     //only resize horizontally if autosize is enabled
    4113     if ([fDefaults boolForKey: @"AutoSize"])
    4114         proposedFrameSize.height = [fWindow frame].size.height;
    4115     return proposedFrameSize;
    4116 }
    4117 
    4118 - (void) windowDidResize: (NSNotification *) notification
    4119 {
    4120     if (![fStatusBar isHidden])
    4121         [self resizeStatusButton];
    4122    
    4123     if ([fFilterBar isHidden])
    4124         return;
    4125    
     4097- (void) resizeFilterBar
     4098{
    41264099    //replace all buttons
    41274100    [fNoFilterButton sizeToFit];
     
    41824155}
    41834156
     4157- (void) updateForExpandCollape
     4158{
     4159    [self setWindowSizeToFit];
     4160    [self setBottomCountText: YES];
     4161}
     4162
     4163- (void) showMainWindow: (id) sender
     4164{
     4165    [fWindow makeKeyAndOrderFront: nil];
     4166}
     4167
     4168- (void) windowDidBecomeMain: (NSNotification *) notification
     4169{
     4170    [fBadger clearCompleted];
     4171    [self updateUI];
     4172}
     4173
     4174- (NSSize) windowWillResize: (NSWindow *) sender toSize: (NSSize) proposedFrameSize
     4175{
     4176    //only resize horizontally if autosize is enabled
     4177    if ([fDefaults boolForKey: @"AutoSize"])
     4178        proposedFrameSize.height = [fWindow frame].size.height;
     4179    return proposedFrameSize;
     4180}
     4181
     4182- (void) windowDidResize: (NSNotification *) notification
     4183{
     4184    if (![fStatusBar isHidden])
     4185        [self resizeStatusButton];
     4186   
     4187    if ([fFilterBar isHidden])
     4188        return;
     4189
     4190    [self resizeFilterBar];
     4191}
     4192
    41844193- (void) applicationWillUnhide: (NSNotification *) notification
    41854194{
  • trunk/macosx/TorrentCell.m

    r9737 r9744  
    7070
    7171- (NSRect) rectForMinimalStatusWithString: (NSAttributedString *) string inBounds: (NSRect) bounds;
    72 - (NSRect) rectForTitleWithStringBasedOnMinimalStatusRect: (NSRect) statusRect
    73             inBounds: (NSRect) bounds;
     72- (NSRect) rectForTitleWithStringBasedOnMinimalStatusRect: (NSRect) statusRect inBounds: (NSRect) bounds;
    7473- (NSRect) rectForProgressWithStringInBounds: (NSRect) bounds;
    7574- (NSRect) rectForStatusWithStringInBounds: (NSRect) bounds;
     
    623622}
    624623
    625 - (NSRect) rectForTitleWithStringBasedOnMinimalStatusRect: (NSRect) statusRect
    626             inBounds: (NSRect) bounds
     624- (NSRect) rectForTitleWithStringBasedOnMinimalStatusRect: (NSRect) statusRect inBounds: (NSRect) bounds
    627625{
    628626    const BOOL minimal = [fDefaults boolForKey: @"SmallView"];
     
    634632   
    635633    result.size.height = HEIGHT_TITLE;
    636     result.size.width = NSMaxX(bounds) - result.origin.x - PADDING_HORIZONTAL
    637                 - (minimal ? PADDING_BETWEEN_TITLE_AND_MIN_STATUS + NSWidth(statusRect) : 0.0)
    638                 - ([[self representedObject] priority] != TR_PRI_NORMAL ? PRIORITY_ICON_WIDTH + PADDING_BETWEEN_TITLE_AND_PRIORITY: 0.0);
     634    result.size.width = NSMaxX(bounds) - NSMinX(result) - PADDING_HORIZONTAL;
     635    if (minimal)
     636        result.size.width -= PADDING_BETWEEN_TITLE_AND_MIN_STATUS + NSWidth(statusRect);
     637    if ([[self representedObject] priority] != TR_PRI_NORMAL)
     638        result.size.width -= PRIORITY_ICON_WIDTH + PADDING_BETWEEN_TITLE_AND_PRIORITY;
    639639   
    640640    return result;
     
    670670    const BOOL minimal = [fDefaults boolForKey: @"SmallView"];
    671671   
    672     NSRect result = bounds;
     672    NSRect result;
    673673    result.size.height = BAR_HEIGHT;
    674     result.origin.x += (minimal ? IMAGE_SIZE_MIN : IMAGE_SIZE_REG) + PADDING_BETWEEN_IMAGE_AND_BAR;
    675    
    676     result.origin.y += PADDING_ABOVE_TITLE + HEIGHT_TITLE;
     674    result.origin.x = NSMinX(bounds) + (minimal ? IMAGE_SIZE_MIN : IMAGE_SIZE_REG) + PADDING_BETWEEN_IMAGE_AND_BAR;
     675   
     676    result.origin.y = NSMinY(bounds) + PADDING_ABOVE_TITLE + HEIGHT_TITLE;
    677677    if (minimal)
    678678        result.origin.y += PADDING_BETWEEN_TITLE_AND_BAR_MIN;
     
    687687- (NSRect) controlButtonRectForBounds: (NSRect) bounds
    688688{
    689     NSRect result = bounds;
     689    NSRect result;
    690690    result.size.height = NORMAL_BUTTON_WIDTH;
    691691    result.size.width = NORMAL_BUTTON_WIDTH;
    692692    result.origin.x = NSMaxX(bounds) - 2.0f * (PADDING_HORIZONTAL + NORMAL_BUTTON_WIDTH);
    693693   
    694     result.origin.y += PADDING_ABOVE_TITLE + HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5f;
     694    result.origin.y = NSMinY(bounds) + PADDING_ABOVE_TITLE + HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5f;
    695695    if ([fDefaults boolForKey: @"SmallView"])
    696696        result.origin.y += PADDING_BETWEEN_TITLE_AND_BAR_MIN;
     
    703703- (NSRect) revealButtonRectForBounds: (NSRect) bounds
    704704{
    705     NSRect result = bounds;
     705    NSRect result;
    706706    result.size.height = NORMAL_BUTTON_WIDTH;
    707707    result.size.width = NORMAL_BUTTON_WIDTH;
    708708    result.origin.x = NSMaxX(bounds) - (PADDING_HORIZONTAL + NORMAL_BUTTON_WIDTH);
    709709   
    710     result.origin.y += PADDING_ABOVE_TITLE + HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5f;
     710    result.origin.y = NSMinY(bounds) + PADDING_ABOVE_TITLE + HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5f;
    711711    if ([fDefaults boolForKey: @"SmallView"])
    712712        result.origin.y += PADDING_BETWEEN_TITLE_AND_BAR_MIN;
Note: See TracChangeset for help on using the changeset viewer.