diff options
author | ritsuka <[email protected]> | 2009-03-02 11:42:11 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2009-03-02 11:42:11 +0000 |
commit | 65fc1a37cbe9ebc3414dcfec737c3dc38fa754b5 (patch) | |
tree | e9b934b556aeac012e6adbb948e16d125c8fcadb /macosx | |
parent | 5a3b2852dd432577b6efb7ffb917b44e6850c525 (diff) |
MacGui:
- Switched some float to CGFloat and int to NSInteger.
- Fixed a warning in writeToActivityLog: when compiling with gcc-4.2
- Fixed an issue when dragging items in the queue if the item was not already selected.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2199 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/Controller.h | 2 | ||||
-rw-r--r-- | macosx/Controller.mm | 6 | ||||
-rw-r--r-- | macosx/HBImageAndTextCell.m | 16 | ||||
-rw-r--r-- | macosx/HBQueueController.mm | 25 |
4 files changed, 22 insertions, 27 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h index d0d281a0c..bbb24bf15 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -256,7 +256,7 @@ BOOL fIsDragging; double dockIconProgress; } -- (void) writeToActivityLog:(char *) format, ...; +- (void) writeToActivityLog:(const char *) format, ...; - (IBAction) browseSources: (id) sender; - (void) browseSourcesDone: (NSOpenPanel *) sheet returnCode: (int) returnCode contextInfo: (void *) contextInfo; diff --git a/macosx/Controller.mm b/macosx/Controller.mm index 91bb3b35d..af86c9c1a 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -863,7 +863,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It } /* We use this to write messages to stderr from the macgui which show up in the activity window and log*/ -- (void) writeToActivityLog:(char *) format, ... +- (void) writeToActivityLog:(const char *) format, ... { va_list args; va_start(args, format); @@ -5553,7 +5553,7 @@ return YES; return YES; } -- (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(int)index +- (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(NSInteger)index { // Don't allow dropping ONTO an item since they can't really contain any children. @@ -5582,7 +5582,7 @@ return YES; -- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(int)index +- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)index { /* first, lets see if we are dropping into a folder */ if ([[fPresetsOutlineView itemAtRow:index] objectForKey:@"Folder"] && [[[fPresetsOutlineView itemAtRow:index] objectForKey:@"Folder"] intValue] == 1) // if its a folder diff --git a/macosx/HBImageAndTextCell.m b/macosx/HBImageAndTextCell.m index 2fe1ea975..ff860c66f 100644 --- a/macosx/HBImageAndTextCell.m +++ b/macosx/HBImageAndTextCell.m @@ -9,25 +9,25 @@ #import "HBImageAndTextCell.h" -static inline float +static inline CGFloat xLeftInRect(NSSize innerSize, NSRect outerRect) { return NSMinX(outerRect); } -static inline float +static inline CGFloat xCenterInRect(NSSize innerSize, NSRect outerRect) { return MAX(NSMidX(outerRect) - (innerSize.width/2.0), 0.0); } -static inline float +static inline CGFloat xRightInRect(NSSize innerSize, NSRect outerRect) { return MAX(NSMaxX(outerRect) - innerSize.width, 0.0); } -static inline float +static inline CGFloat yTopInRect(NSSize innerSize, NSRect outerRect, BOOL flipped) { if (flipped) @@ -36,13 +36,13 @@ yTopInRect(NSSize innerSize, NSRect outerRect, BOOL flipped) return MAX(NSMaxY(outerRect) - innerSize.height, 0.0); } -static inline float +static inline CGFloat yCenterInRect(NSSize innerSize, NSRect outerRect, BOOL flipped) { return MAX(NSMidY(outerRect) - innerSize.height/2.0, 0.0); } -static inline float +static inline CGFloat yBottomInRect(NSSize innerSize, NSRect outerRect, BOOL flipped) { if (flipped) @@ -54,7 +54,7 @@ yBottomInRect(NSSize innerSize, NSRect outerRect, BOOL flipped) static inline NSSize scaleProportionally(NSSize imageSize, NSRect canvasRect) { - float ratio; + CGFloat ratio; // get the smaller ratio and scale the image size by it ratio = MIN(NSWidth(canvasRect) / imageSize.width, @@ -145,7 +145,7 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect) [super editWithFrame: textFrame inView: controlView editor:textObj delegate:anObject event: theEvent]; } -- (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject start:(int)selStart length:(int)selLength +- (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject start:(NSInteger)selStart length:(NSInteger)selLength { NSRect textFrame, imageFrame; NSDivideRect (aRect, &imageFrame, &textFrame, (imageSpacing.width * 2) + [image size].width, NSMinXEdge); diff --git a/macosx/HBQueueController.mm b/macosx/HBQueueController.mm index 3e1b1f59b..39fb40ce0 100644 --- a/macosx/HBQueueController.mm +++ b/macosx/HBQueueController.mm @@ -142,9 +142,7 @@ static NSString* HBQueuePauseResumeToolbarIdentifier = @"HBQueuePauseRe */ int i = 0; - NSEnumerator *enumerator = [fJobGroups objectEnumerator]; - id tempObject; - while (tempObject = [enumerator nextObject]) + for(id tempObject in fJobGroups) { NSDictionary *thisQueueDict = tempObject; if ([[thisQueueDict objectForKey:@"Status"] intValue] == 0) // Completed @@ -478,12 +476,14 @@ static NSString* HBQueuePauseResumeToolbarIdentifier = @"HBQueuePauseRe - (IBAction)removeSelectedQueueItem: (id)sender { NSIndexSet * selectedRows = [fOutlineView selectedRowIndexes]; - int row = [selectedRows firstIndex]; + NSUInteger row = [selectedRows firstIndex]; + if( row == NSNotFound ) + return; /* if this is a currently encoding job, we need to be sure to alert the user, * to let them decide to cancel it first, then if they do, we can come back and * remove it */ - if ([[[fJobGroups objectAtIndex:row] objectForKey:@"Status"] intValue] == 1) + if ([[[fJobGroups objectAtIndex:row] objectForKey:@"Status"] integerValue] == 1) { /* We pause the encode here so that it doesn't finish right after and then * screw up the sync while the window is open @@ -1293,7 +1293,7 @@ return ![(HBQueueOutlineView*)outlineView isDragging]; - (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard { // Dragging is only allowed of the pending items. - if ([[[fJobGroups objectAtIndex:[outlineView selectedRow]] objectForKey:@"Status"] intValue] != 2) // 2 is pending + if ([[[items objectAtIndex:0] objectForKey:@"Status"] integerValue] != 2) // 2 is pending { return NO; } @@ -1343,18 +1343,13 @@ return ![(HBQueueOutlineView*)outlineView isDragging]; return NSDragOperationGeneric; } - - - (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)index { - NSMutableIndexSet *moveItems = [NSMutableIndexSet indexSet]; - - id obj; - NSEnumerator *enumerator = [fDraggedNodes objectEnumerator]; - while (obj = [enumerator nextObject]) - { + NSMutableIndexSet *moveItems = [NSMutableIndexSet indexSet]; + + for( id obj in fDraggedNodes ) [moveItems addIndex:[fJobGroups indexOfObject:obj]]; - } + // Successful drop, we use moveObjectsInQueueArray:... in fHBController // to properly rearrange the queue array, save it to plist and then send it back here. // since Controller.mm is handling all queue array manipulation. |