Much better B-frame muxing frame-reordering. This will preserve the sps/pps info...
[HandBrake.git] / macosx / QueueController.mm
blobe775bb33d1a610f9dcd6a7de5317aee844c19e2d
1 #include "QueueController.h"
3 @implementation QueueController
5 - (void) SetHandle: (hb_handle_t *) handle
7     fHandle = handle;
10 - (void) AddTextField: (NSString *) string rect: (NSRect *) rect
12     NSTextField * textField;
14     rect->origin.x     = 10;
15     rect->origin.y    -= 17;
16     rect->size.height  = 17;
17     textField = [[NSTextField alloc] initWithFrame: *rect];
19     [textField setEditable: NO];
20     [textField setSelectable: NO];
21     [textField setDrawsBackground: NO];
22     [textField setBordered: NO];
23     [textField setStringValue: string];
25     [fTaskView addSubview: textField];
28 - (void) removeTask: (id) sender
30     hb_rem( fHandle, hb_job( fHandle, [sender tag] ) );
31     [self performSelectorOnMainThread: @selector( Update: )
32         withObject: sender waitUntilDone: NO];
35 - (void) AddButton: (NSRect *) rect tag: (int) tag
37     NSButton * button;
39     rect->origin.x     = rect->size.width - 90;
40     rect->origin.y    -= 20;
41     rect->size.width   = 100;
42     rect->size.height  = 20;
43     button = [[NSButton alloc] initWithFrame: *rect];
44     rect->size.width   = rect->origin.x + 90;
46     [button setTitle: @"Remove"];
47     [button setBezelStyle: NSRoundedBezelStyle];
48     [button setFont: [NSFont systemFontOfSize:
49         [NSFont systemFontSizeForControlSize: NSSmallControlSize]]];
50     [[button cell] setControlSize: NSSmallControlSize];
52     [button setTag: tag];
53     [button setTarget: self];
54     [button setAction: @selector( removeTask: )];
56     [fTaskView addSubview: button];
58     NSBox * box;
60     rect->origin.x     = 15;
61     rect->origin.y    -= 10;
62     rect->size.width  -= 10;
63     rect->size.height  = 1;
64     box = [[NSBox alloc] initWithFrame: *rect];
65     [box setBoxType: NSBoxSeparator];
66     rect->origin.y    -= 10;
67     rect->size.width  += 10;
69     [fTaskView addSubview: box];
72 - (IBAction) Update: (id) sender
74     int i;
75     hb_job_t * j;
76     hb_title_t * title;
78     NSSize size = [fScrollView contentSize];
79     int height = MAX( 20 + 125 * hb_count( fHandle ), size.height );
80     [fTaskView setFrame: NSMakeRect(0,0,size.width,height)];
82     NSRect rect = NSMakeRect(10,height-10,size.width-20,10);
84     NSArray * subviews = [fTaskView subviews];
85     while( [subviews count] > 0 )
86     {
87         [[subviews objectAtIndex: 0]
88             removeFromSuperviewWithoutNeedingDisplay];
89     }
91     for( i = 0; i < hb_count( fHandle ); i++ )
92     {
93         j = hb_job( fHandle, i );
94         title = j->title;
95         
96         [self AddTextField: [NSString stringWithFormat:
97             @"DVD: %s", title->dvd] rect: &rect];
98         [self AddTextField: [NSString stringWithFormat:
99             @"Title: %d", title->index] rect: &rect];
100         [self AddTextField: [NSString stringWithFormat:
101             @"Chapters: %d to %d", j->chapter_start, j->chapter_end]
102             rect: &rect];
103         [self AddTextField: [NSString stringWithFormat:
104             @"Pass: %d of %d", MAX( 1, j->pass ), MIN( 2, j->pass + 1 )]
105             rect: &rect];
106         [self AddTextField: [NSString stringWithFormat:
107             @"Destination: %s", j->file] rect: &rect];
108         [self AddButton: &rect tag: i];
109     }
111     [fTaskView scrollPoint: NSMakePoint(0,height)];
112     [fTaskView setNeedsDisplay: YES];
115 - (IBAction) ClosePanel: (id) sender
117     [NSApp stopModal];
120 @end