1 /* $Id: Controller.h,v 1.35 2005/08/01 14:29:50 titer Exp $
3 This file is part of the HandBrake source code.
4 Homepage: <http://handbrake.m0k.org/>.
5 It may be used under the terms of the GNU General Public License. */
7 #include <Cocoa/Cocoa.h>
8 #include <Growl/Growl.h>
13 #include "ChapterTitles.h"
14 #include "ScanController.h"
15 #include "PictureController.h"
16 #include "QueueController.h"
18 @interface HBController : NSObject <GrowlApplicationBridgeDelegate>
21 IBOutlet NSWindow * fWindow;
24 IBOutlet ScanController * fScanController;
25 IBOutlet NSPanel * fScanPanel;
28 IBOutlet PictureController * fPictureController;
29 IBOutlet NSPanel * fPicturePanel;
32 IBOutlet QueueController * fQueueController;
33 IBOutlet NSPanel * fQueuePanel;
34 IBOutlet NSTextField * fQueueStatus;
35 IBOutlet NSButton * fQueueAddButton;
36 IBOutlet NSButton * fQueueShowButton;
39 IBOutlet NSTextField * fSrcDVD1Field;
40 IBOutlet NSTextField * fSrcDVD2Field;
41 IBOutlet NSTextField * fSrcTitleField;
42 IBOutlet NSPopUpButton * fSrcTitlePopUp;
43 IBOutlet NSTextField * fSrcChapterField;
44 IBOutlet NSPopUpButton * fSrcChapterStartPopUp;
45 IBOutlet NSTextField * fSrcChapterToField;
46 IBOutlet NSPopUpButton * fSrcChapterEndPopUp;
47 IBOutlet NSTextField * fSrcDuration1Field;
48 IBOutlet NSTextField * fSrcDuration2Field;
51 IBOutlet NSTextField * fDstFormatField;
52 IBOutlet NSPopUpButton * fDstFormatPopUp;
53 IBOutlet NSTextField * fDstCodecsField;
54 IBOutlet NSPopUpButton * fDstCodecsPopUp;
55 IBOutlet NSTextField * fDstFile1Field;
56 IBOutlet NSTextField * fDstFile2Field;
57 IBOutlet NSButton * fDstBrowseButton;
60 IBOutlet NSTextField * fVidRateField;
61 IBOutlet NSPopUpButton * fVidRatePopUp;
62 IBOutlet NSTextField * fVidEncoderField;
63 IBOutlet NSPopUpButton * fVidEncoderPopUp;
64 IBOutlet NSTextField * fVidQualityField;
65 IBOutlet NSMatrix * fVidQualityMatrix;
66 IBOutlet NSButtonCell * fVidTargetCell;
67 IBOutlet NSTextField * fVidTargetSizeField;
68 IBOutlet NSButtonCell * fVidBitrateCell;
69 IBOutlet NSTextField * fVidBitrateField;
70 IBOutlet NSButtonCell * fVidConstantCell;
71 IBOutlet NSSlider * fVidQualitySlider;
72 IBOutlet NSButton * fVidGrayscaleCheck;
73 IBOutlet NSButton * fVidTwoPassCheck;
76 /* Picture Settings box */
77 IBOutlet NSTextField * fPicLabelSettings;
78 IBOutlet NSTextField * fPicLabelSrc;
79 IBOutlet NSTextField * fPicLabelOutp;
80 IBOutlet NSTextField * fPicLabelAr;
81 IBOutlet NSTextField * fPicLabelDeinter;
82 IBOutlet NSTextField * fPicLabelSrcX;
83 IBOutlet NSTextField * fPicLabelOutputX;
85 IBOutlet NSTextField * fPicSrcWidth;
86 IBOutlet NSTextField * fPicSrcHeight;
87 IBOutlet NSTextField * fPicSettingWidth;
88 IBOutlet NSTextField * fPicSettingHeight;
89 IBOutlet NSTextField * fPicSettingARkeep;
90 IBOutlet NSTextField * fPicSettingPAR;
91 IBOutlet NSTextField * fPicSettingDeinterlace;
92 IBOutlet NSTextField * fPicSettingARkeepDsply;
93 IBOutlet NSTextField * fPicSettingPARDsply;
94 IBOutlet NSTextField * fPicSettingDeinterlaceDsply;
95 IBOutlet NSTextField * fPicLabelAnamorphic;
96 IBOutlet NSTextField * fPicLabelPAROutp;
97 IBOutlet NSTextField * fPicLabelPAROutputX;
98 IBOutlet NSTextField * fPicSettingPARWidth;
99 IBOutlet NSTextField * fPicSettingPARHeight;
100 /* Picture variables */
101 int PicOrigOutputWidth;
102 int PicOrigOutputHeight;
105 IBOutlet NSTextField * fSubField;
106 IBOutlet NSPopUpButton * fSubPopUp;
109 IBOutlet NSTextField * fAudLang1Field;
110 IBOutlet NSPopUpButton * fAudLang1PopUp;
111 IBOutlet NSTextField * fAudLang2Field;
112 IBOutlet NSPopUpButton * fAudLang2PopUp;
113 /* New Audio Mix PopUps */
114 IBOutlet NSTextField * fAudTrack1MixLabel;
115 IBOutlet NSPopUpButton * fAudTrack1MixPopUp;
116 IBOutlet NSTextField * fAudTrack2MixLabel;
117 IBOutlet NSPopUpButton * fAudTrack2MixPopUp;
119 IBOutlet NSTextField * fAudRateField;
120 IBOutlet NSPopUpButton * fAudRatePopUp;
121 IBOutlet NSTextField * fAudBitrateField;
122 IBOutlet NSPopUpButton * fAudBitratePopUp;
125 IBOutlet NSButton * fCreateChapterMarkers;
126 IBOutlet NSTableView * fChapterTable;
127 ChapterTitles * fChapterTitlesDelegate;
130 IBOutlet NSButton * fPictureButton;
131 IBOutlet NSTextField * fStatusField;
132 IBOutlet NSProgressIndicator * fRipIndicator;
133 IBOutlet NSButton * fShowQuButton;
134 IBOutlet NSButton * fAddToQuButton;
135 IBOutlet NSButton * fPauseButton;
136 IBOutlet NSButton * fRipButton;
138 /* Advanced Tab for opts fX264optView*/
139 IBOutlet NSView * fX264optView;
140 IBOutlet NSTextField * fX264optViewTitleLabel;
141 IBOutlet NSTextField * fDisplayX264OptionsLabel;
142 IBOutlet NSTextField * fDisplayX264Options;
143 IBOutlet NSTextField * fX264optBframesLabel;
144 IBOutlet NSPopUpButton * fX264optBframesPopUp;
145 IBOutlet NSTextField * fX264optRefLabel;
146 IBOutlet NSPopUpButton * fX264optRefPopUp;
147 IBOutlet NSTextField * fX264optNfpskipLabel;
148 IBOutlet NSPopUpButton * fX264optNfpskipPopUp;
149 IBOutlet NSTextField * fX264optNodctdcmtLabel;
150 IBOutlet NSPopUpButton * fX264optNodctdcmtPopUp;
151 IBOutlet NSTextField * fX264optSubmeLabel;
152 IBOutlet NSPopUpButton * fX264optSubmePopUp;
153 IBOutlet NSTextField * fX264optTrellisLabel;
154 IBOutlet NSPopUpButton * fX264optTrellisPopUp;
155 IBOutlet NSTextField * fX264optMixedRefsLabel;
156 IBOutlet NSPopUpButton * fX264optMixedRefsPopUp;
157 IBOutlet NSTextField * fX264optMotionEstLabel;
158 IBOutlet NSPopUpButton * fX264optMotionEstPopUp;
159 IBOutlet NSTextField * fX264optMERangeLabel;
160 IBOutlet NSPopUpButton * fX264optMERangePopUp;
161 IBOutlet NSTextField * fX264optWeightBLabel;
162 IBOutlet NSPopUpButton * fX264optWeightBPopUp;
163 IBOutlet NSTextField * fX264optBRDOLabel;
164 IBOutlet NSPopUpButton * fX264optBRDOPopUp;
165 IBOutlet NSTextField * fX264optBPyramidLabel;
166 IBOutlet NSPopUpButton * fX264optBPyramidPopUp;
167 IBOutlet NSTextField * fX264optBiMELabel;
168 IBOutlet NSPopUpButton * fX264optBiMEPopUp;
169 IBOutlet NSTextField * fX264optDirectPredLabel;
170 IBOutlet NSPopUpButton * fX264optDirectPredPopUp;
172 /* User Preset variables here fPresetNewPicSettingsApply*/
174 IBOutlet NSDrawer * fPresetDrawer;
175 IBOutlet NSTextField * fPresetNewName;
176 IBOutlet NSPopUpButton * fPresetNewPicSettingsPopUp;
177 IBOutlet NSTextField * fPresetSelectedDisplay;
179 NSString * AppSupportDirectory;
180 NSString * UserPresetsFile;
181 NSString * x264ProfilesFile;
182 NSMutableArray * UserPresets;
183 NSMutableArray * x264Profiles;
184 NSMutableArray * UserPresetssortedArray;
185 NSMutableDictionary * chosenPreset;
186 int curUserPresetChosenNum;
188 IBOutlet NSPanel * fAddPresetPanel;
189 IBOutlet NSTableView * tableView;
190 IBOutlet NSButton * fPresetsAdd;
191 IBOutlet NSButton * fPresetsDelete;
192 hb_handle_t * fHandle;
194 /* integer to set to determine the previous state
195 of encode 0==idle, 1==encoding, 2==cancelled*/
199 - (void) TranslateStrings;
201 - (void) UpdateUI: (NSTimer *) timer;
202 - (void) EnableUI: (bool) enable;
204 - (IBAction) ShowScanPanel: (id) sender;
206 - (IBAction) TitlePopUpChanged: (id) sender;
207 - (IBAction) ChapterPopUpChanged: (id) sender;
209 - (IBAction) FormatPopUpChanged: (id) sender;
210 - (IBAction) CodecsPopUpChanged: (id) sender;
211 - (IBAction) EncoderPopUpChanged: (id) sender;
213 - (IBAction) SetEnabledStateOfAudioMixdownControls: (id) sender;
214 - (IBAction) AddAllAudioTracksToPopUp: (id) sender;
215 - (IBAction) SelectAudioTrackInPopUp: (id) sender searchPrefixString: (NSString *) searchPrefixString selectIndexIfNotFound: (int) selectIndexIfNotFound;
216 - (IBAction) AudioTrackPopUpChanged: (id) sender;
217 - (IBAction) AudioTrackPopUpChanged: (id) sender mixdownToUse: (int) mixdownToUse;
218 - (IBAction) AudioTrackMixdownChanged: (id) sender;
220 - (IBAction) BrowseFile: (id) sender;
221 - (void) BrowseFileDone: (NSSavePanel *) sheet
222 returnCode: (int) returnCode contextInfo: (void *) contextInfo;
224 - (IBAction) VideoMatrixChanged: (id) sender;
225 - (IBAction) QualitySliderChanged: (id) sender;
227 - (IBAction) ShowPicturePanel: (id) sender;
228 - (IBAction) CalculatePictureSizing: (id) sender;
231 - (IBAction) AddToQueue: (id) sender;
232 - (IBAction) ShowQueuePanel: (id) sender;
234 - (IBAction) Rip: (id) sender;
235 - (void) OverwriteAlertDone: (NSWindow *) sheet
236 returnCode: (int) returnCode contextInfo: (void *) contextInfo;
237 - (void) UpdateAlertDone: (NSWindow *) sheet
238 returnCode: (int) returnCode contextInfo: (void *) contextInfo;
240 - (IBAction) Cancel: (id) sender;
241 - (void) _Cancel: (NSWindow *) sheet returnCode: (int) returnCode
242 contextInfo: (void *) contextInfo;
243 - (IBAction) Pause: (id) sender;
245 - (IBAction) CalculateBitrate: (id) sender;
246 - (void) controlTextDidBeginEditing: (NSNotification *) notification;
247 - (void) controlTextDidEndEditing: (NSNotification *) notification;
248 - (void) controlTextDidChange: (NSNotification *) notification;
250 - (IBAction) OpenHomepage: (id) sender;
251 - (IBAction) OpenForums: (id) sender;
252 - (IBAction) OpenUserGuide: (id) sender;
254 // x264 Advanced Panel Methods
255 - (IBAction) X264AdvancedOptionsSet: (id) sender;
256 - (IBAction) X264AdvancedOptionsStandardizeOptString: (id) sender;
257 - (IBAction) X264AdvancedOptionsSetCurrentSettings: (id) sender;
258 - (NSString *) X264AdvancedOptionsStandardizeOptNames:(NSString *) cleanOptNameString;
259 - (IBAction) X264AdvancedOptionsChanged: (id) sender;
261 // Preset Methods Here
262 - (IBAction) CustomSettingUsed: (id) sender;
263 - (IBAction) ShowAddPresetPanel: (id) sender;
264 - (IBAction) CloseAddPresetPanel: (id) sender;
265 - (NSDictionary *)CreatePreset;
266 - (NSDictionary *)CreateIpodPreset;
267 - (NSDictionary *)CreateAppleTVPreset;
268 - (NSDictionary *)CreatePSThreePreset;
269 - (NSDictionary *)CreatePSPPreset;
270 - (IBAction) RevertPictureSizeToMax:(id)sender;
274 - (IBAction)AddFactoryPresets:(id)sender;
275 - (IBAction)DeleteFactoryPresets:(id)sender;
276 - (IBAction)AddUserPreset:(id)sender;
278 - (IBAction)InsertPreset:(id)sender;
279 - (IBAction)DeletePreset:(id)sender;
280 - (IBAction)tableViewSelected:(id)sender;
281 // NSTableDataSource methods
282 - (int)numberOfRowsInTableView:(NSTableView *)aTableView;
283 - (id)tableView:(NSTableView *)aTableView
284 objectValueForTableColumn:(NSTableColumn *)aTableColumn
286 - (void)tableView:(NSTableView *)aTableView
287 setObjectValue:(id)anObject
288 forTableColumn:(NSTableColumn *)aTableColumn
290 // To determine user presets cell display properties
291 - (void)tableView:(NSTableView *)aTableView
292 willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn
296 - (NSDictionary *) registrationDictionaryForGrowl;
297 -(IBAction)showGrowlDoneNotification:(id)sender;