summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordynaflash <[email protected]>2008-03-07 20:05:46 +0000
committerdynaflash <[email protected]>2008-03-07 20:05:46 +0000
commitab2bcfdbdf6db2e2de9bc2b3b487d25e69116d45 (patch)
treeb918be125c93140b1851744f8fda13925caad43b /macosx
parent2cdbc53eac6122cfe3ea77db0728a8fb4f4d2271 (diff)
MacGui: Clean up some formatting and errant comments left over from some of the snippets I robbed out of HBQueueController on the drag and drop preset commit. :)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1335 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r--macosx/Controller.h23
-rw-r--r--macosx/Controller.mm29
2 files changed, 15 insertions, 37 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h
index 923abec5e..c660166c2 100644
--- a/macosx/Controller.h
+++ b/macosx/Controller.h
@@ -18,28 +18,12 @@
#import "HBPresets.h"
@class HBOutputPanelController;
-//------------------------------------------------------------------------------------
-// As usual, we need to subclass NSOutlineView to handle a few special cases:
-//
-// (1) variable row heights during live resizes
-// HBQueueOutlineView exists solely to get around a bug in variable row height outline
-// views in which row heights get messed up during live resizes. See this discussion:
-// http://lists.apple.com/archives/cocoa-dev/2005/Oct/msg00871.html
-// However, the recommeneded fix (override drawRect:) does not work. Instead, this
-// subclass implements viewDidEndLiveResize in order to recalculate all row heights.
-//
-// (2) prevent expanding of items during drags
-// During dragging operations, we don't want outline items to expand, since a queue
-// doesn't really have children items.
-//
-// (3) generate a drag image that incorporates more than just the first column
-// By default, NSTableView only drags an image of the first column. Change this to
-// drag an image of the queue's icon and desc columns.
+/* We subclass NSView so that our drags show both the icon as well as PresetName columns */
@interface HBPresetsOutlineView : NSOutlineView
{
-//#if HB_QUEUE_DRAGGING
+
BOOL fIsDragging;
-//#endif
+
}
@end
@interface HBController : NSObject <GrowlApplicationBridgeDelegate>
@@ -214,7 +198,6 @@ BOOL fIsDragging;
IBOutlet NSPanel * fAddPresetPanel;
/* new NSOutline View for the presets */
NSArray *fDraggedNodes;
- //IBOutlet NSOutlineView * fPresetsOutlineView; // <-- Old assignment before subclassing
IBOutlet HBPresetsOutlineView * fPresetsOutlineView;
IBOutlet NSButton * fPresetsAdd;
IBOutlet NSButton * fPresetsDelete;
diff --git a/macosx/Controller.mm b/macosx/Controller.mm
index 936859526..a5db71176 100644
--- a/macosx/Controller.mm
+++ b/macosx/Controller.mm
@@ -3349,17 +3349,17 @@ if (item == nil)
// Dragging is only allowed for custom presets.
if ([[[UserPresets objectAtIndex:[fPresetsOutlineView selectedRow]] objectForKey:@"Type"] intValue] == 0) // 0 is built in preset
{
- return NO;
+ return NO;
}
// Don't retain since this is just holding temporaral drag information, and it is
//only used during a drag! We could put this in the pboard actually.
fDraggedNodes = items;
- // Provide data for our custom type, and simple NSStrings.
+ // Provide data for our custom type, and simple NSStrings.
[pboard declareTypes:[NSArray arrayWithObjects: DragDropSimplePboardType, nil] owner:self];
-
+
// the actual data doesn't matter since DragDropSimplePboardType drags aren't recognized by anyone but us!.
[pboard setData:[NSData data] forType:DragDropSimplePboardType];
-
+
return YES;
}
@@ -3369,9 +3369,9 @@ if (item == nil)
BOOL isOnDropTypeProposal = index == NSOutlineViewDropOnItemIndex;
if (isOnDropTypeProposal)
- return NSDragOperationNone;
+ return NSDragOperationNone;
+
-
// Don't allow dropping INTO an item since they can't really contain any children as of yet.
if (item != nil)
@@ -3379,12 +3379,12 @@ if (item == nil)
index = [fPresetsOutlineView rowForItem: item] + 1;
item = nil;
}
-
- // Don't allow dropping into the Built In Presets.
+
+ // Don't allow dropping into the Built In Presets.
if (index < presetCurrentBuiltInCount)
{
- return NSDragOperationNone;
- index = MAX (index, presetCurrentBuiltInCount);
+ return NSDragOperationNone;
+ index = MAX (index, presetCurrentBuiltInCount);
}
[outlineView setDropItem:item dropChildIndex:index];
@@ -4143,12 +4143,10 @@ if (item == nil)
@implementation HBPresetsOutlineView
- (NSImage *)dragImageForRowsWithIndexes:(NSIndexSet *)dragRows tableColumns:(NSArray *)tableColumns event:(NSEvent*)dragEvent offset:(NSPointPointer)dragImageOffset
{
- // Set the fIsDragging flag so that other's know that a drag operation is being
- // performed.
- fIsDragging = YES;
+ fIsDragging = YES;
// By default, NSTableView only drags an image of the first column. Change this to
- // drag an image of the queue's icon and desc columns.
+ // drag an image of the queue's icon and PresetName columns.
NSArray * cols = [NSArray arrayWithObjects: [self tableColumnWithIdentifier:@"icon"], [self tableColumnWithIdentifier:@"PresetName"], nil];
return [super dragImageForRowsWithIndexes:dragRows tableColumns:cols event:dragEvent offset:dragImageOffset];
}
@@ -4157,9 +4155,6 @@ if (item == nil)
- (void) mouseDown:(NSEvent *)theEvent
{
- // After a drag operation, reset fIsDragging back to NO. This is really the only way
- // for us to detect when a drag has finished. You can't do it in acceptDrop because
- // that won't be called if the dragged item is released outside the view.
[super mouseDown:theEvent];
fIsDragging = NO;
}