3 This file is part of the HandBrake source code.
4 Homepage: <http://handbrake.fr/>.
5 It may be used under the terms of the GNU General Public License. */
8 #import <Cocoa/Cocoa.h>
14 #define HB_QUEUE_DRAGGING 0 // <--- NOT COMPLETELY FUNCTIONAL YET
15 #define HB_OUTLINE_METRIC_CONTROLS 0 // for tweaking the outline cell spacings
19 //------------------------------------------------------------------------------------
20 // As usual, we need to subclass NSOutlineView to handle a few special cases:
22 // (1) variable row heights during live resizes
23 // HBQueueOutlineView exists solely to get around a bug in variable row height outline
24 // views in which row heights get messed up during live resizes. See this discussion:
25 // http://lists.apple.com/archives/cocoa-dev/2005/Oct/msg00871.html
26 // However, the recommeneded fix (override drawRect:) does not work. Instead, this
27 // subclass implements viewDidEndLiveResize in order to recalculate all row heights.
29 // (2) prevent expanding of items during drags
30 // During dragging operations, we don't want outline items to expand, since a queue
31 // doesn't really have children items.
33 // (3) generate a drag image that incorporates more than just the first column
34 // By default, NSTableView only drags an image of the first column. Change this to
35 // drag an image of the queue's icon and desc columns.
37 @interface HBQueueOutlineView : NSOutlineView
51 @interface HBQueueController : NSWindowController
53 hb_handle_t *fQueueEncodeLibhb; // reference to libhb
54 HBController *fHBController; // reference to HBController
55 NSMutableArray *fJobGroups; // mirror image of the queue array from controller.mm
57 int fEncodingQueueItem; // corresponds to the index of fJobGroups encoding item
58 int fPendingCount; // Number of various kinds of job groups in fJobGroups.
62 BOOL fJobGroupCountsNeedUpdating;
64 BOOL fCurrentJobPaneShown; // NO when fCurrentJobPane has been shifted out of view (see showCurrentJobPane)
65 NSMutableIndexSet *fSavedExpandedItems; // used by save/restoreOutlineViewState to preserve which items are expanded
66 NSMutableIndexSet *fSavedSelectedItems; // used by save/restoreOutlineViewState to preserve which items are selected
68 NSArray *fDraggedNodes;
70 NSTimer *fAnimationTimer; // animates the icon of the current job in the queue outline view
71 int fAnimationIndex; // used to generate name of image used to animate the current job in the queue outline view
73 // +------------------window-------------------+
74 // |+-------------fCurrentJobPane-------------+|
78 // |+-----------------------------------------+|
79 // |+---------------fQueuePane----------------+|
87 // |+-----------------------------------------+|
88 // +-------------------------------------------+
90 // fCurrentJobPane - visible only when processing a job
91 IBOutlet NSView *fCurrentJobPane;
92 IBOutlet NSImageView *fJobIconView;
93 IBOutlet NSTextField *fJobDescTextField;
94 IBOutlet NSProgressIndicator *fProgressBar;
95 IBOutlet NSTextField *fProgressTextField;
97 // fQueuePane - always visible; fills entire window when fCurrentJobPane is hidden
98 IBOutlet NSView *fQueuePane;
99 IBOutlet HBQueueOutlineView *fOutlineView;
100 IBOutlet NSTextField *fQueueCountField;
101 NSArray *fDraggedNodes;
103 #if HB_OUTLINE_METRIC_CONTROLS
104 IBOutlet NSSlider *fIndentation; // debug
105 IBOutlet NSSlider *fSpacing; // debug
110 - (void)setHandle: (hb_handle_t *)handle;
111 - (void)setHBController: (HBController *)controller;
113 - (void)setupToolbar;
115 - (void)setQueueArray: (NSMutableArray *)QueueFileArray;
116 - (id)outlineView:(NSOutlineView *)fOutlineView child:(NSInteger)index ofItem:(id)item;
118 - (BOOL)outlineView:(NSOutlineView *)fOutlineView isItemExpandable:(id)item;
120 - (BOOL)outlineView:(NSOutlineView *)fOutlineView shouldExpandItem:(id)item;
122 - (NSInteger)outlineView:(NSOutlineView *)fOutlineView numberOfChildrenOfItem:(id)item;
124 - (id)outlineView:(NSOutlineView *)fOutlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
126 - (void)outlineView:(NSOutlineView *)fOutlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item;
128 /* Animate the icon for the current encode */
129 - (void) animateWorkingEncodeIconInQueue;
130 - (void) startAnimatingCurrentWorkingEncodeInQueue;
131 - (void) stopAnimatingCurrentJobGroupInQueue;
132 - (void)setQueueStatusString: (NSString *)statusString;
134 - (IBAction)showQueueWindow: (id)sender;
137 /* control encodes in the window */
138 - (IBAction)removeSelectedQueueItem: (id)sender;
139 - (IBAction)revealSelectedQueueItem: (id)sender;
141 #if HB_OUTLINE_METRIC_CONTROLS
142 - (IBAction)imageSpacingChanged: (id)sender;
143 - (IBAction)indentChanged: (id)sender;