OSDN Git Service

MacGui: Initial implementation of new queue sync code which allows multi-instance...
[handbrake-jp/handbrake-jp-git.git] / macosx / HBQueueController.h
1 /* HBQueueController
2
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. */
6
7
8 #import <Cocoa/Cocoa.h>
9 #include "hb.h"
10
11 @class HBController;
12
13
14 #define HB_QUEUE_DRAGGING 0             // <--- NOT COMPLETELY FUNCTIONAL YET
15 #define HB_OUTLINE_METRIC_CONTROLS 0    // for tweaking the outline cell spacings
16
17
18
19 //------------------------------------------------------------------------------------
20 // As usual, we need to subclass NSOutlineView to handle a few special cases:
21 //
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.
28 //
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.
32 //
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.
36
37 @interface HBQueueOutlineView : NSOutlineView
38 {
39
40 BOOL                        fIsDragging;
41
42 }
43
44 - (BOOL) isDragging;
45
46 @end
47
48
49
50
51 @interface HBQueueController : NSWindowController
52 {
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
56     
57     int                          pidNum;                // Records the PID number from HBController for this instance
58     int                          fEncodingQueueItem;    // corresponds to the index of fJobGroups encoding item
59     int                          fPendingCount;         // Number of various kinds of job groups in fJobGroups.
60     int                          fCompletedCount;
61     int                          fCanceledCount;
62     int                          fWorkingCount;
63     BOOL                         fJobGroupCountsNeedUpdating;
64
65     BOOL                         fCurrentJobPaneShown;  // NO when fCurrentJobPane has been shifted out of view (see showCurrentJobPane)
66     NSMutableIndexSet            *fSavedExpandedItems;  // used by save/restoreOutlineViewState to preserve which items are expanded
67     NSMutableIndexSet            *fSavedSelectedItems;  // used by save/restoreOutlineViewState to preserve which items are selected
68 #if HB_QUEUE_DRAGGING
69     NSArray                      *fDraggedNodes;
70 #endif
71     NSTimer                      *fAnimationTimer;      // animates the icon of the current job in the queue outline view
72     int                          fAnimationIndex;       // used to generate name of image used to animate the current job in the queue outline view
73
74     //  +------------------window-------------------+
75     //  |+-------------fCurrentJobPane-------------+|
76     //  ||                                         ||
77     //  ||                                         ||
78     //  ||                                         ||
79     //  |+-----------------------------------------+|
80     //  |+---------------fQueuePane----------------+|
81     //  ||                                         ||
82     //  ||                                         ||
83     //  ||                                         ||
84     //  ||                                         ||
85     //  ||                                         ||
86     //  ||                                         ||
87     //  ||                                         ||
88     //  |+-----------------------------------------+|
89     //  +-------------------------------------------+
90
91     // fCurrentJobPane - visible only when processing a job
92     IBOutlet NSView              *fCurrentJobPane;
93     IBOutlet NSImageView         *fJobIconView;
94     IBOutlet NSTextField         *fJobDescTextField;
95     IBOutlet NSProgressIndicator *fProgressBar;
96     IBOutlet NSTextField         *fProgressTextField;
97
98     // fQueuePane - always visible; fills entire window when fCurrentJobPane is hidden
99     IBOutlet NSView              *fQueuePane;
100     IBOutlet HBQueueOutlineView  *fOutlineView;
101     IBOutlet NSTextField         *fQueueCountField;
102     NSArray                      *fDraggedNodes;
103     BOOL                          fIsDragging;
104 #if HB_OUTLINE_METRIC_CONTROLS
105     IBOutlet NSSlider            *fIndentation; // debug
106     IBOutlet NSSlider            *fSpacing;     // debug
107 #endif
108
109 }
110 - (void)setHandle: (hb_handle_t *)handle;
111 - (void)setHBController: (HBController *)controller;
112
113 - (void)setupToolbar;
114
115 - (void)setQueueArray: (NSMutableArray *)QueueFileArray;
116 - (id)outlineView:(NSOutlineView *)fOutlineView child:(NSInteger)index ofItem:(id)item;
117
118 - (BOOL)outlineView:(NSOutlineView *)fOutlineView isItemExpandable:(id)item;
119
120 - (BOOL)outlineView:(NSOutlineView *)fOutlineView shouldExpandItem:(id)item;
121
122 - (NSInteger)outlineView:(NSOutlineView *)fOutlineView numberOfChildrenOfItem:(id)item;
123
124 - (id)outlineView:(NSOutlineView *)fOutlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
125
126 - (void)outlineView:(NSOutlineView *)fOutlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item;
127
128 /* Animate the icon for the current encode */
129 - (void) animateWorkingEncodeIconInQueue;
130 - (void) startAnimatingCurrentWorkingEncodeInQueue;
131 - (void) stopAnimatingCurrentJobGroupInQueue;
132 - (void)setQueueStatusString: (NSString *)statusString;
133
134 - (IBAction)showQueueWindow: (id)sender;
135
136
137 /* control encodes in the window */
138 - (IBAction)removeSelectedQueueItem: (id)sender;
139 - (IBAction)revealSelectedQueueItem: (id)sender;
140 - (IBAction)editSelectedQueueItem: (id)sender;
141
142 #if HB_OUTLINE_METRIC_CONTROLS
143 - (IBAction)imageSpacingChanged: (id)sender;
144 - (IBAction)indentChanged: (id)sender;
145 #endif
146
147
148
149
150
151 @end