Changeset 601


Ignore:
Timestamp:
12/21/09 22:12:29 (15 years ago)
Author:
Nicholas Riley
Message:

Float vs. double fixes to pacify GCC.

Location:
trunk/Cocoa/Pester/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/Pester/Source/NJRFSObjectSelector.m

    r600 r601  
    224224    NSFont *font = [[self cell] font];
    225225    [NSMenu popUpContextMenu: menu withEvent: theEvent forView: self withFont:
    226      [NSFont fontWithName: [font fontName] size: [font pointSize] - 0.001]];
     226     [NSFont fontWithName: [font fontName] size: [font pointSize] - 0.001f]];
    227227}
    228228
  • trunk/Cocoa/Pester/Source/NJRIntervalField.m

    r513 r601  
    4141        if (((int)interval % multiplierTag) == 0) {
    4242            NSFormatter *formatter = [self formatter];
    43             int intervalValue = interval / multiplierTag;
     43            int intervalValue = (int)interval / multiplierTag;
    4444            if (formatter != nil) {
    4545                id ignored;
  • trunk/Cocoa/Pester/Source/OACalendarView.m

    r600 r601  
    5757@implementation OACalendarView
    5858
    59 const float OACalendarViewButtonWidth = 15.0;
    60 const float OACalendarViewButtonHeight = 15.0;
    61 const float OACalendarViewSpaceBetweenMonthYearAndGrid = 6.0;
     59const float OACalendarViewButtonWidth = 15.0f;
     60const float OACalendarViewButtonHeight = 15.0f;
     61const float OACalendarViewSpaceBetweenMonthYearAndGrid = 6.0f;
    6262const int OACalendarViewNumDaysPerWeek = 7;
    6363const int OACalendarViewMaxNumWeeksIntersectedByMonth = 6;
     
    106106    dayOfMonthCell = [[NSTextFieldCell alloc] init];
    107107    [dayOfMonthCell setAlignment:NSCenterTextAlignment];
    108     [dayOfMonthCell setFont:[NSFont controlContentFontOfSize:11.0]];
     108    [dayOfMonthCell setFont:[NSFont controlContentFontOfSize:11.0f]];
    109109
    110110    buttons = [[NSMutableArray alloc] initWithCapacity:2];
    111111
    112     monthAndYearView = [[NSView alloc] initWithFrame:NSMakeRect(0.0, 0.0, frameRect.size.width, OACalendarViewButtonHeight + 2)];
     112    monthAndYearView = [[NSView alloc] initWithFrame:NSMakeRect(0.0f, 0.0f, frameRect.size.width, OACalendarViewButtonHeight + 2)];
    113113    [monthAndYearView setAutoresizingMask:NSViewWidthSizable];
    114114
    115115    // Add left/right buttons
    116116
    117     buttonFrame = NSMakeRect(0.0, 0.0, OACalendarViewButtonWidth, OACalendarViewButtonHeight);
     117    buttonFrame = NSMakeRect(0.0f, 0.0f, OACalendarViewButtonWidth, OACalendarViewButtonHeight);
    118118    button = [self _createButtonWithFrame:buttonFrame];
    119119    [button setImage:[NSImage imageNamed:@"OALeftArrow" inBundle:thisBundle]];
     
    123123    [monthAndYearView addSubview:button];
    124124
    125     buttonFrame = NSMakeRect(frameRect.size.width - OACalendarViewButtonWidth, 0.0, OACalendarViewButtonWidth, OACalendarViewButtonHeight);
     125    buttonFrame = NSMakeRect(frameRect.size.width - OACalendarViewButtonWidth, 0.0f, OACalendarViewButtonWidth, OACalendarViewButtonHeight);
    126126    button = [self _createButtonWithFrame:buttonFrame];
    127127    [button setImage:[NSImage imageNamed:@"OARightArrow" inBundle:thisBundle]];
     
    197197    minimumSize.height = monthAndYearRect.size.height + gridHeaderRect.size.height + ((OACalendarViewMaxNumWeeksIntersectedByMonth * [self _minimumRowHeight]));
    198198    // This should really check the lengths of the months, and include space for the buttons.
    199     minimumSize.width = ([self _minimumColumnWidth] * OACalendarViewNumDaysPerWeek) + 1.0;
     199    minimumSize.width = ([self _minimumColumnWidth] * OACalendarViewNumDaysPerWeek) + 1.0f;
    200200
    201201    [self setFrameSize:minimumSize];
     
    608608   
    609609    // get the grid cell width (subtract 1.0 from the bounds width to allow for the border)
    610     columnWidth = floor((viewBounds.size.width - 1.0) / OACalendarViewNumDaysPerWeek);
    611     viewBounds.size.width = (columnWidth * OACalendarViewNumDaysPerWeek) + 1.0;
     610    columnWidth = floorf((viewBounds.size.width - 1.0f) / OACalendarViewNumDaysPerWeek);
     611    viewBounds.size.width = (columnWidth * OACalendarViewNumDaysPerWeek) + 1.0f;
    612612   
    613613    // resize the month & year view to be the same width as the grid
     
    616616    // get the rect for the month and year text field cell
    617617    cellSize = [monthAndYearTextFieldCell cellSize];
    618     NSDivideRect(viewBounds, &topRect, &gridHeaderAndBodyRect, ceil(cellSize.height + OACalendarViewSpaceBetweenMonthYearAndGrid), NSMinYEdge);
    619     NSDivideRect(topRect, &discardRect, &monthAndYearRect, floor((viewBounds.size.width - cellSize.width) / 2), NSMinXEdge);
     618    NSDivideRect(viewBounds, &topRect, &gridHeaderAndBodyRect, ceilf(cellSize.height + OACalendarViewSpaceBetweenMonthYearAndGrid), NSMinYEdge);
     619    NSDivideRect(topRect, &discardRect, &monthAndYearRect, floorf((viewBounds.size.width - cellSize.width) / 2), NSMinXEdge);
    620620    monthAndYearRect.size.width = cellSize.width;
    621621   
    622622    tempRect = gridHeaderAndBodyRect;
    623623    // leave space for a one-pixel border on each side
    624     tempRect.size.width -= 2.0;
    625     tempRect.origin.x += 1.0;
     624    tempRect.size.width -= 2.0f;
     625    tempRect.origin.x += 1.0f;
    626626    // leave space for a one-pixel border at the bottom (the top already looks fine)
    627     tempRect.size.height -= 1.0;
     627    tempRect.size.height -= 1.0f;
    628628
    629629    // get the grid header rect
    630630    cellSize = [dayOfWeekCell[0] cellSize];
    631     NSDivideRect(tempRect, &gridHeaderRect, &gridBodyRect, ceil(cellSize.height), NSMinYEdge);
     631    NSDivideRect(tempRect, &gridHeaderRect, &gridBodyRect, ceilf(cellSize.height), NSMinYEdge);
    632632   
    633633    // get the grid row height (add 1.0 to the body height because while we can't actually draw on that extra pixel, our bottom row doesn't have to draw a bottom grid line as there's a border right below us, so we need to account for that, which we do by pretending that next pixel actually does belong to us)
    634     rowHeight = floor((gridBodyRect.size.height + 1.0) / OACalendarViewMaxNumWeeksIntersectedByMonth);
     634    rowHeight = floorf((gridBodyRect.size.height + 1.0f) / OACalendarViewMaxNumWeeksIntersectedByMonth);
    635635   
    636636    // get the grid body rect
    637     gridBodyRect.size.height = (rowHeight * OACalendarViewMaxNumWeeksIntersectedByMonth) - 1.0;
     637    gridBodyRect.size.height = (rowHeight * OACalendarViewMaxNumWeeksIntersectedByMonth) - 1.0f;
    638638   
    639639    // adjust the header and body rect to account for any adjustment made while calculating even row heights
    640     gridHeaderAndBodyRect.size.height = NSMaxY(gridBodyRect) - NSMinY(gridHeaderAndBodyRect) + 1.0;
     640    gridHeaderAndBodyRect.size.height = NSMaxY(gridBodyRect) - NSMinY(gridHeaderAndBodyRect) + 1.0f;
    641641}
    642642
     
    653653
    654654    // the cell is actually one pixel shorter than the row height, because the row height includes the bottom grid line (or the top grid line, depending on which way you prefer to think of it)
    655     cellFrame.size.height = rowHeight - 1.0;
     655    cellFrame.size.height = rowHeight - 1.0f;
    656656    // the cell would actually be one pixel narrower than the column width but we don't draw vertical grid lines. instead, we want to include the area that would be grid line (were we drawing it) in our cell, because that looks a bit better under the header, which _does_ draw column separators. actually, we want to include the grid line area on _both sides_ or it looks unbalanced, so we actually _add_ one pixel, to cover that. below, our x position as we draw will have to take that into account. note that this means that sunday and saturday overwrite the outside borders, but the outside border is drawn last, so it ends up ok. (if we ever start drawing vertical grid lines, change this to be - 1.0, and adjust the origin appropriately below.)
    657     cellFrame.size.width = columnWidth + 1.0;
     657    cellFrame.size.width = columnWidth + 1.0f;
    658658
    659659    cellSize = [dayOfMonthCell cellSize];
     
    668668
    669669        // subtract 1.0 from the origin because we're including the area where vertical grid lines would be were we drawing them
    670         cellFrame.origin.x = rect.origin.x + (column * columnWidth) - 1.0;
     670        cellFrame.origin.x = rect.origin.x + (column * columnWidth) - 1.0f;
    671671        cellFrame.origin.y = rect.origin.y + (row * rowHeight);
    672672
     
    716716                [dayOfMonthCell setTextColor:textColor];
    717717            }
    718             NSDivideRect(cellFrame, &discardRect, &dayOfMonthFrame, floor((cellFrame.size.height - cellSize.height) / 2.0), NSMinYEdge);
     718            NSDivideRect(cellFrame, &discardRect, &dayOfMonthFrame, floorf((cellFrame.size.height - cellSize.height) / 2.0f), NSMinYEdge);
    719719            [dayOfMonthCell drawWithFrame:dayOfMonthFrame inView:self];
    720720        }
     
    738738    // add 0.5 to move to the center of the pixel before drawing a line 1.0 pixels thick, centered around 0.0 (which would mean half a pixel above the starting point and half a pixel below - not what we want)
    739739    // we could just subtract 0.5, but I think this is clearer, and the compiler will optimize it to the appropriate value for us
    740     pointA = NSMakePoint(NSMinX(rect), NSMinY(rect) - 1.0 + 0.5);
    741     pointB = NSMakePoint(NSMaxX(rect), NSMinY(rect) - 1.0 + 0.5);
     740    pointA = NSMakePoint(NSMinX(rect), NSMinY(rect) - 1.0f + 0.5f);
     741    pointB = NSMakePoint(NSMaxX(rect), NSMinY(rect) - 1.0f + 0.5f);
    742742   
    743743    [[NSColor controlHighlightColor] set];
     
    780780    }
    781781
    782     return ceil(maxWidth);
     782    return ceilf(maxWidth);
    783783}
    784784
     
    814814   
    815815    dayOfWeekWidth = [self _maximumDayOfWeekWidth];     // we don't have to add 1.0 because the day of week cell whose width is returned here includes it's own border
    816     dayOfMonthWidth = [self _maximumDayOfMonthSize].width + 1.0;        // add 1.0 to allow for the grid. We don't actually draw the vertical grid, but we treat it as if there was one (don't respond to clicks "on" the grid, we have a vertical separator in the header, etc.)
     816    dayOfMonthWidth = [self _maximumDayOfMonthSize].width + 1.0f;       // add 1.0 to allow for the grid. We don't actually draw the vertical grid, but we treat it as if there was one (don't respond to clicks "on" the grid, we have a vertical separator in the header, etc.)
    817817    return (dayOfMonthWidth > dayOfWeekWidth) ? dayOfMonthWidth : dayOfWeekWidth;
    818818}
     
    820820- (float)_minimumRowHeight;
    821821{
    822     return [self _maximumDayOfMonthSize].height + 1.0;  // add 1.0 to allow for a bordering grid line
     822    return [self _maximumDayOfMonthSize].height + 1.0f; // add 1.0 to allow for a bordering grid line
    823823}
    824824
  • trunk/Cocoa/Pester/Source/PSApplication.m

    r600 r601  
    147147        [tile lockFocus];
    148148        // draw the grayed-out app icon
    149         [appIconImage dissolveToPoint: NSZeroPoint fraction: 0.5];
     149        [appIconImage dissolveToPoint: NSZeroPoint fraction: 0.5f];
    150150        // draw the frame
    151         [[NSColor colorWithCalibratedWhite: 0.1 alpha: 0.5] set];
     151        [[NSColor colorWithCalibratedWhite: 0.1f alpha: 0.5f] set];
    152152        NSRectFill(frameRect);
    153153        // draw a gray two-pixel text shadow
Note: See TracChangeset for help on using the changeset viewer.