From 2cdbc53eac6122cfe3ea77db0728a8fb4f4d2271 Mon Sep 17 00:00:00 2001 From: dynaflash Date: Fri, 7 Mar 2008 19:43:17 +0000 Subject: MacGui: Initial implementation of drag and drop in the presets drawer. - Allows drag and drop arrangement of custom user presets - Does not allow reordering of built in presets. - Sorting of presets now done only by type ie. built in and custom user. - Provides functionality for future nested presets and drag and drop arranging. - Subclasses the presets outline view for better control over drag and drop behavior git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1334 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- macosx/Controller.h | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'macosx/Controller.h') diff --git a/macosx/Controller.h b/macosx/Controller.h index 22ce107ae..923abec5e 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -18,8 +18,31 @@ #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. +@interface HBPresetsOutlineView : NSOutlineView +{ +//#if HB_QUEUE_DRAGGING +BOOL fIsDragging; +//#endif +} +@end @interface HBController : NSObject - { IBOutlet NSWindow * fWindow; NSToolbar * toolbar; @@ -187,10 +210,12 @@ int presetHbDefault; // this is 1 in "Default" preset key int presetUserDefault;// this is 2 in "Default" preset key + int presetCurrentBuiltInCount; // keeps track of the current number of built in presets IBOutlet NSPanel * fAddPresetPanel; /* new NSOutline View for the presets */ NSArray *fDraggedNodes; - IBOutlet NSOutlineView * fPresetsOutlineView; + //IBOutlet NSOutlineView * fPresetsOutlineView; // <-- Old assignment before subclassing + IBOutlet HBPresetsOutlineView * fPresetsOutlineView; IBOutlet NSButton * fPresetsAdd; IBOutlet NSButton * fPresetsDelete; IBOutlet MVMenuButton * fPresetsActionButton; @@ -326,5 +351,7 @@ - (void)setupToolbar; - (void) remindUserOfSleepOrShutdown; + +- (void)moveObjectsInPresetsArray:(NSMutableArray *)array fromIndexes:(NSIndexSet *)indexSet toIndex:(unsigned)insertIndex; @end -- cgit v1.2.3