- Timestamp:
- 12/21/09 22:12:37 (15 years ago)
- Location:
- trunk/Cocoa/Pester/Source
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/Pester/Source/NJRQTMediaPopUpButton.m
r600 r602 433 433 { 434 434 BDAlias *alias = [sender representedObject]; 435 int i ndex = [self indexOfItem: sender], otherIndex = [self indexOfItem: otherItem];435 int itemIndex = [self indexOfItem: sender], otherIndex = [self indexOfItem: otherItem]; 436 436 [self _setAlias: alias]; 437 437 if (![self _validateWithPreview: YES]) { 438 438 [[self menu] removeItem: sender]; 439 } else if (i ndex > otherIndex + 1) { // move "other" item to top of list440 int recentIndex = [recentMediaAliasData count] - i ndex + otherIndex;441 NSMenuItem *item = [[self itemAtIndex: i ndex] retain];439 } else if (itemIndex > otherIndex + 1) { // move "other" item to top of list 440 int recentIndex = [recentMediaAliasData count] - itemIndex + otherIndex; 441 NSMenuItem *item = [[self itemAtIndex: itemIndex] retain]; 442 442 NSData *data = [[recentMediaAliasData objectAtIndex: recentIndex] retain]; 443 443 // [self _validateRecentMedia]; 444 [self removeItemAtIndex: i ndex];444 [self removeItemAtIndex: itemIndex]; 445 445 [[self menu] insertItem: item atIndex: otherIndex + 1]; 446 446 [self selectItem: item]; -
trunk/Cocoa/Pester/Source/NSCalendarDate-NJRExtensions.m
r53 r602 31 31 } 32 32 33 + (NSCalendarDate *)dateWithDate:(NSDate *) date atTime:(NSDate *)time;33 + (NSCalendarDate *)dateWithDate:(NSDate *)aDate atTime:(NSDate *)aTime; 34 34 { 35 35 NSCalendarDate *calTime, *calDate; 36 if ( time == nil || date == nil) return nil;37 calTime = [NSCalendarDate dateWithDate: time];38 calDate = [NSCalendarDate dateWithDate: date];36 if (aTime == nil || aDate == nil) return nil; 37 calTime = [NSCalendarDate dateWithDate: aTime]; 38 calDate = [NSCalendarDate dateWithDate: aDate]; 39 39 if (calTime == nil || calDate == nil) return nil; 40 40 return [NSCalendarDate dateWithYear: [calDate yearOfCommonEra] -
trunk/Cocoa/Pester/Source/OACalendarView.m
r601 r602 79 79 80 80 NSDateFormatter *monthAndYearFormatter; 81 int index;81 int dayOfWeek; 82 82 NSUserDefaults *defaults; 83 83 NSArray *shortWeekDays; … … 98 98 defaults = [NSUserDefaults standardUserDefaults]; 99 99 shortWeekDays = [defaults objectForKey:NSShortWeekDayNameArray]; 100 for ( index = 0; index < OACalendarViewNumDaysPerWeek; index++) {101 dayOfWeekCell[ index] = [[NSTableHeaderCell alloc] init];102 [dayOfWeekCell[ index] setAlignment:NSCenterTextAlignment];103 [dayOfWeekCell[ index] setStringValue:[[shortWeekDays objectAtIndex:index] substringToIndex:1]];100 for (dayOfWeek = 0; dayOfWeek < OACalendarViewNumDaysPerWeek; dayOfWeek++) { 101 dayOfWeekCell[dayOfWeek] = [[NSTableHeaderCell alloc] init]; 102 [dayOfWeekCell[dayOfWeek] setAlignment:NSCenterTextAlignment]; 103 [dayOfWeekCell[dayOfWeek] setStringValue:[[shortWeekDays objectAtIndex:dayOfWeek] substringToIndex:1]]; 104 104 } 105 105 … … 145 145 - (void)dealloc; 146 146 { 147 int index;147 int dayOfWeek; 148 148 149 149 [dayOfMonthCell release]; 150 150 151 for ( index = 0; index < OACalendarViewNumDaysPerWeek; index++)152 [dayOfWeekCell[ index] release];151 for (dayOfWeek = 0; dayOfWeek < OACalendarViewNumDaysPerWeek; dayOfWeek++) 152 [dayOfWeekCell[dayOfWeek] release]; 153 153 154 154 [monthAndYearTextFieldCell release]; … … 395 395 NSMutableArray *days; 396 396 NSCalendarDate *day; 397 int index;397 int dayOfWeek; 398 398 399 399 days = [NSMutableArray arrayWithCapacity:OACalendarViewNumDaysPerWeek]; 400 400 day = [selectedDay dateByAddingYears:0 months:0 days:-[selectedDay dayOfWeek] hours:0 minutes:0 seconds:0]; 401 for ( index = 0; index < OACalendarViewNumDaysPerWeek; index++) {401 for (dayOfWeek = 0; dayOfWeek < OACalendarViewNumDaysPerWeek; dayOfWeek++) { 402 402 NSCalendarDate *nextDay; 403 403 404 nextDay = [day dateByAddingYears:0 months:0 days: indexhours:0 minutes:0 seconds:0];404 nextDay = [day dateByAddingYears:0 months:0 days:dayOfWeek hours:0 minutes:0 seconds:0]; 405 405 if (flags.showsDaysForOtherMonths || [nextDay monthOfYear] == [selectedDay monthOfYear]) 406 406 [days addObject:nextDay]; … … 415 415 NSMutableArray *days; 416 416 NSCalendarDate *day; 417 int index;417 int dayOfWeek; 418 418 419 419 days = [NSMutableArray arrayWithCapacity:OACalendarViewMaxNumWeeksIntersectedByMonth]; 420 420 day = [selectedDay dateByAddingYears:0 months:0 days:-(([selectedDay weekOfMonth] - 1) * OACalendarViewNumDaysPerWeek) hours:0 minutes:0 seconds:0]; 421 for ( index = 0; index < OACalendarViewMaxNumWeeksIntersectedByMonth; index++) {421 for (dayOfWeek = 0; dayOfWeek < OACalendarViewMaxNumWeeksIntersectedByMonth; dayOfWeek++) { 422 422 NSCalendarDate *nextDay; 423 423 424 nextDay = [day dateByAddingYears:0 months:0 days:( index* OACalendarViewNumDaysPerWeek) hours:0 minutes:0 seconds:0];424 nextDay = [day dateByAddingYears:0 months:0 days:(dayOfWeek * OACalendarViewNumDaysPerWeek) hours:0 minutes:0 seconds:0]; 425 425 if (flags.showsDaysForOtherMonths || [nextDay monthOfYear] == [selectedDay monthOfYear]) 426 426 [days addObject:nextDay]; … … 648 648 int visibleMonthIndex; 649 649 NSCalendarDate *thisDay; 650 int index, row, column;650 int cellIndex, row, column; 651 651 NSSize cellSize; 652 652 BOOL isFirstResponder = ([[self window] firstResponder] == self); … … 663 663 thisDay = [visibleMonth dateByAddingYears:0 months:0 days:-[visibleMonth dayOfWeek] hours:0 minutes:0 seconds:0]; 664 664 665 for (row = column = index = 0; index < OACalendarViewMaxNumWeeksIntersectedByMonth * OACalendarViewNumDaysPerWeek; index++) {665 for (row = column = cellIndex = 0; cellIndex < OACalendarViewMaxNumWeeksIntersectedByMonth * OACalendarViewNumDaysPerWeek; cellIndex++) { 666 666 NSColor *textColor; 667 667 BOOL isVisibleMonth; … … 709 709 [[self target] calendarView:self willDisplayCell:dayOfMonthCell forDate:thisDay]; 710 710 } else { 711 if ((dayHighlightMask & (1 << index)) == 0) {711 if ((dayHighlightMask & (1 << cellIndex)) == 0) { 712 712 textColor = (isVisibleMonth ? [NSColor blackColor] : [NSColor grayColor]); 713 713 } else { … … 769 769 { 770 770 float maxWidth; 771 int index;771 int dayOfWeek; 772 772 773 773 maxWidth = 0; 774 for ( index = 0; index < OACalendarViewNumDaysPerWeek; index++) {774 for (dayOfWeek = 0; dayOfWeek < OACalendarViewNumDaysPerWeek; dayOfWeek++) { 775 775 NSSize cellSize; 776 776 777 cellSize = [dayOfWeekCell[ index] cellSize];777 cellSize = [dayOfWeekCell[dayOfWeek] cellSize]; 778 778 if (maxWidth < cellSize.width) 779 779 maxWidth = cellSize.width; … … 785 785 - (NSSize)_maximumDayOfMonthSize; 786 786 { 787 NSSize max Size;788 int index;789 790 max Size = NSZeroSize; // I'm sure the height doesn't change, but I need to know the height anyway.791 for ( index = 1; index <= 31; index++) {787 NSSize maximumSize; 788 int dayOfMonth; 789 790 maximumSize = NSZeroSize; // I'm sure the height doesn't change, but I need to know the height anyway. 791 for (dayOfMonth = 1; dayOfMonth <= 31; dayOfMonth++) { 792 792 NSString *str; 793 793 NSSize cellSize; 794 794 795 str = [NSString stringWithFormat:@"%d", index];795 str = [NSString stringWithFormat:@"%d", dayOfMonth]; 796 796 [dayOfMonthCell setStringValue:str]; 797 797 cellSize = [dayOfMonthCell cellSize]; 798 if (max Size.width < cellSize.width)799 max Size.width = cellSize.width;800 if (max Size.height < cellSize.height)801 max Size.height = cellSize.height;802 } 803 804 max Size.width = ceil(maxSize.width);805 max Size.height = ceil(maxSize.height);806 807 return max Size;798 if (maximumSize.width < cellSize.width) 799 maximumSize.width = cellSize.width; 800 if (maximumSize.height < cellSize.height) 801 maximumSize.height = cellSize.height; 802 } 803 804 maximumSize.width = ceilf(maximumSize.width); 805 maximumSize.height = ceilf(maximumSize.height); 806 807 return maximumSize; 808 808 } 809 809 -
trunk/Cocoa/Pester/Source/PSAlarm.m
r587 r602 171 171 } 172 172 173 - (void)setForDate:(NSDate *) date atTime:(NSDate *)time;173 - (void)setForDate:(NSDate *)aDate atTime:(NSDate *)aTime; 174 174 { 175 175 NSCalendarDate *dateTime; 176 if ( time == nil && date == nil) {176 if (aTime == nil && aDate == nil) { 177 177 [self _beInvalid: @"Please specify an alarm date and time."]; return; 178 178 } 179 if ( time == nil) {179 if (aTime == nil) { 180 180 [self _beInvalid: @"Please specify an alarm time."]; return; 181 181 } 182 if ( date == nil) {182 if (aDate == nil) { 183 183 [self _beInvalid: @"Please specify an alarm date."]; return; 184 184 } 185 185 // XXX if calTime's date is different from the default date, complain 186 dateTime = [NSCalendarDate dateWithDate: date atTime: time];186 dateTime = [NSCalendarDate dateWithDate: aDate atTime: aTime]; 187 187 if (dateTime == nil) { 188 188 [self _beInvalid: @"Please specify a reasonable date and time."]; return; -
trunk/Cocoa/Pester/Source/PSAlarms.m
r364 r602 161 161 } 162 162 163 - (PSAlarm *)alarmAtIndex:(int) index;164 { 165 return [alarms objectAtIndex: index];166 } 167 168 - (void)removeAlarmAtIndex:(int) index;169 { 170 [(PSAlarm *)[alarms objectAtIndex: index] cancelTimer];171 [alarms removeObjectAtIndex: index];163 - (PSAlarm *)alarmAtIndex:(int)alarmIndex; 164 { 165 return [alarms objectAtIndex: alarmIndex]; 166 } 167 168 - (void)removeAlarmAtIndex:(int)alarmIndex; 169 { 170 [(PSAlarm *)[alarms objectAtIndex: alarmIndex] cancelTimer]; 171 [alarms removeObjectAtIndex: alarmIndex]; 172 172 } 173 173 -
trunk/Cocoa/Pester/Source/PSPowerManager.m
r361 r602 20 20 } 21 21 22 + (void)setWakeTime:(NSDate *) time;22 + (void)setWakeTime:(NSDate *)wakeTime; 23 23 { 24 IOPMSchedulePowerEvent((CFDateRef) time, (CFStringRef)[[NSBundle mainBundle] bundleIdentifier], CFSTR(kIOPMAutoWake));24 IOPMSchedulePowerEvent((CFDateRef)wakeTime, (CFStringRef)[[NSBundle mainBundle] bundleIdentifier], CFSTR(kIOPMAutoWake)); 25 25 } 26 26
Note:
See TracChangeset
for help on using the changeset viewer.