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 @class HBOutputPanelController;
20 @interface HBController : NSObject <GrowlApplicationBridgeDelegate>
23 IBOutlet NSWindow * fWindow;
26 IBOutlet ScanController * fScanController;
27 IBOutlet NSPanel * fScanPanel;
30 IBOutlet PictureController * fPictureController;
31 IBOutlet NSPanel * fPicturePanel;
34 IBOutlet QueueController * fQueueController;
35 IBOutlet NSPanel * fQueuePanel;
36 IBOutlet NSTextField * fQueueStatus;
37 IBOutlet NSButton * fQueueAddButton;
38 IBOutlet NSButton * fQueueShowButton;
41 IBOutlet NSTextField * fSrcDVD1Field;
42 IBOutlet NSTextField * fSrcDVD2Field;
43 IBOutlet NSTextField * fSrcTitleField;
44 IBOutlet NSPopUpButton * fSrcTitlePopUp;
45 IBOutlet NSTextField * fSrcChapterField;
46 IBOutlet NSPopUpButton * fSrcChapterStartPopUp;
47 IBOutlet NSTextField * fSrcChapterToField;
48 IBOutlet NSPopUpButton * fSrcChapterEndPopUp;
49 IBOutlet NSTextField * fSrcDuration1Field;
50 IBOutlet NSTextField * fSrcDuration2Field;
53 IBOutlet NSTextField * fDstFormatField;
54 IBOutlet NSPopUpButton * fDstFormatPopUp;
55 IBOutlet NSButton * fDstMpgLargeFileCheck;
56 IBOutlet NSTextField * fDstCodecsField;
57 IBOutlet NSPopUpButton * fDstCodecsPopUp;
58 IBOutlet NSTextField * fDstFile1Field;
59 IBOutlet NSTextField * fDstFile2Field;
60 IBOutlet NSButton * fDstBrowseButton;
63 IBOutlet NSTextField * fVidRateField;
64 IBOutlet NSPopUpButton * fVidRatePopUp;
65 IBOutlet NSTextField * fVidEncoderField;
66 IBOutlet NSPopUpButton * fVidEncoderPopUp;
67 IBOutlet NSTextField * fVidQualityField;
68 IBOutlet NSMatrix * fVidQualityMatrix;
69 IBOutlet NSButtonCell * fVidTargetCell;
70 IBOutlet NSTextField * fVidTargetSizeField;
71 IBOutlet NSButtonCell * fVidBitrateCell;
72 IBOutlet NSTextField * fVidBitrateField;
73 IBOutlet NSButtonCell * fVidConstantCell;
74 IBOutlet NSSlider * fVidQualitySlider;
75 IBOutlet NSButton * fVidGrayscaleCheck;
76 IBOutlet NSButton * fVidTwoPassCheck;
77 IBOutlet NSButton * fVidTurboPassCheck;
79 /* Picture Settings box */
80 IBOutlet NSTextField * fPicLabelSettings;
81 IBOutlet NSTextField * fPicLabelSrc;
82 IBOutlet NSTextField * fPicLabelOutp;
83 IBOutlet NSTextField * fPicLabelAr;
84 IBOutlet NSTextField * fPicLabelDeinter;
85 IBOutlet NSTextField * fPicLabelSrcX;
86 IBOutlet NSTextField * fPicLabelOutputX;
88 IBOutlet NSTextField * fPicSrcWidth;
89 IBOutlet NSTextField * fPicSrcHeight;
90 IBOutlet NSTextField * fPicSettingWidth;
91 IBOutlet NSTextField * fPicSettingHeight;
92 IBOutlet NSTextField * fPicSettingARkeep;
93 IBOutlet NSTextField * fPicSettingPAR;
94 IBOutlet NSTextField * fPicSettingDeinterlace;
95 IBOutlet NSTextField * fPicSettingARkeepDsply;
96 IBOutlet NSTextField * fPicSettingPARDsply;
97 IBOutlet NSTextField * fPicSettingAutoCropLabel;
98 IBOutlet NSTextField * fPicSettingAutoCrop;
99 IBOutlet NSTextField * fPicSettingAutoCropDsply;
100 IBOutlet NSTextField * fPicSettingDeinterlaceDsply;
101 IBOutlet NSTextField * fPicLabelAnamorphic;
102 IBOutlet NSTextField * fPicLabelPAROutp;
103 IBOutlet NSTextField * fPicLabelPAROutputX;
104 IBOutlet NSTextField * fPicSettingPARWidth;
105 IBOutlet NSTextField * fPicSettingPARHeight;
106 /* Picture variables */
107 int PicOrigOutputWidth;
108 int PicOrigOutputHeight;
111 IBOutlet NSTextField * fSubField;
112 IBOutlet NSPopUpButton * fSubPopUp;
115 IBOutlet NSTextField * fAudLang1Field;
116 IBOutlet NSPopUpButton * fAudLang1PopUp;
117 IBOutlet NSTextField * fAudLang2Field;
118 IBOutlet NSPopUpButton * fAudLang2PopUp;
119 /* New Audio Mix PopUps */
120 IBOutlet NSTextField * fAudTrack1MixLabel;
121 IBOutlet NSPopUpButton * fAudTrack1MixPopUp;
122 IBOutlet NSTextField * fAudTrack2MixLabel;
123 IBOutlet NSPopUpButton * fAudTrack2MixPopUp;
125 IBOutlet NSTextField * fAudRateField;
126 IBOutlet NSPopUpButton * fAudRatePopUp;
127 IBOutlet NSTextField * fAudBitrateField;
128 IBOutlet NSPopUpButton * fAudBitratePopUp;
131 IBOutlet NSButton * fCreateChapterMarkers;
132 IBOutlet NSTableView * fChapterTable;
133 ChapterTitles * fChapterTitlesDelegate;
136 IBOutlet NSButton * fPictureButton;
137 IBOutlet NSTextField * fStatusField;
138 IBOutlet NSProgressIndicator * fRipIndicator;
139 IBOutlet NSButton * fShowQuButton;
140 IBOutlet NSButton * fAddToQuButton;
141 IBOutlet NSButton * fPauseButton;
142 IBOutlet NSButton * fRipButton;
144 /* Advanced Tab for opts fX264optView*/
145 IBOutlet NSView * fX264optView;
146 IBOutlet NSTextField * fX264optViewTitleLabel;
147 IBOutlet NSTextField * fDisplayX264OptionsLabel;
148 IBOutlet NSTextField * fDisplayX264Options;
149 IBOutlet NSTextField * fX264optBframesLabel;
150 IBOutlet NSPopUpButton * fX264optBframesPopUp;
151 IBOutlet NSTextField * fX264optRefLabel;
152 IBOutlet NSPopUpButton * fX264optRefPopUp;
153 IBOutlet NSTextField * fX264optNfpskipLabel;
154 IBOutlet NSButton * fX264optNfpskipSwitch;
155 IBOutlet NSTextField * fX264optNodctdcmtLabel;
156 IBOutlet NSButton * fX264optNodctdcmtSwitch;
157 IBOutlet NSTextField * fX264optSubmeLabel;
158 IBOutlet NSPopUpButton * fX264optSubmePopUp;
159 IBOutlet NSTextField * fX264optTrellisLabel;
160 IBOutlet NSPopUpButton * fX264optTrellisPopUp;
161 IBOutlet NSTextField * fX264optMixedRefsLabel;
162 IBOutlet NSButton * fX264optMixedRefsSwitch;
163 IBOutlet NSTextField * fX264optMotionEstLabel;
164 IBOutlet NSPopUpButton * fX264optMotionEstPopUp;
165 IBOutlet NSTextField * fX264optMERangeLabel;
166 IBOutlet NSPopUpButton * fX264optMERangePopUp;
167 IBOutlet NSTextField * fX264optWeightBLabel;
168 IBOutlet NSButton * fX264optWeightBSwitch;
169 IBOutlet NSTextField * fX264optBRDOLabel;
170 IBOutlet NSButton * fX264optBRDOSwitch;
171 IBOutlet NSTextField * fX264optBPyramidLabel;
172 IBOutlet NSButton * fX264optBPyramidSwitch;
173 IBOutlet NSTextField * fX264optBiMELabel;
174 IBOutlet NSButton * fX264optBiMESwitch;
175 IBOutlet NSTextField * fX264optDirectPredLabel;
176 IBOutlet NSPopUpButton * fX264optDirectPredPopUp;
177 IBOutlet NSTextField * fX264optDeblockLabel;
178 IBOutlet NSPopUpButton * fX264optAlphaDeblockPopUp;
179 IBOutlet NSPopUpButton * fX264optBetaDeblockPopUp;
181 /* User Preset variables here fPresetNewDesc*/
183 IBOutlet NSDrawer * fPresetDrawer;
184 IBOutlet NSTextField * fPresetNewName;
185 IBOutlet NSTextField * fPresetNewDesc;
186 IBOutlet NSPopUpButton * fPresetNewPicSettingsPopUp;
187 IBOutlet NSTextField * fPresetSelectedDisplay;
189 NSString * AppSupportDirectory;
190 NSString * UserPresetsFile;
191 NSString * x264ProfilesFile;
192 NSMutableArray * UserPresets;
193 NSMutableArray * x264Profiles;
194 NSMutableArray * UserPresetssortedArray;
195 NSMutableDictionary * chosenPreset;
196 int curUserPresetChosenNum;
198 IBOutlet NSPanel * fAddPresetPanel;
199 IBOutlet NSTableView * tableView;
200 IBOutlet NSButton * fPresetsAdd;
201 IBOutlet NSButton * fPresetsDelete;
202 hb_handle_t * fHandle;
204 /* integer to set to determine the previous state
205 of encode 0==idle, 1==encoding, 2==cancelled*/
207 int currentScanCount;
208 NSString * currentSource;
209 HBOutputPanelController *outputPanel;
212 - (void) TranslateStrings;
214 - (void) UpdateUI: (NSTimer *) timer;
215 - (void) EnableUI: (bool) enable;
216 - (IBAction) ShowNewScan: (id) sender;
217 - (IBAction) ShowScanPanel: (id) sender;
219 - (IBAction) TitlePopUpChanged: (id) sender;
220 - (IBAction) ChapterPopUpChanged: (id) sender;
222 - (IBAction) FormatPopUpChanged: (id) sender;
223 - (IBAction) CodecsPopUpChanged: (id) sender;
224 - (IBAction) EncoderPopUpChanged: (id) sender;
225 - (IBAction) TwoPassCheckboxChanged: (id) sender;
226 - (IBAction) SetEnabledStateOfAudioMixdownControls: (id) sender;
227 - (IBAction) AddAllAudioTracksToPopUp: (id) sender;
228 - (IBAction) SelectAudioTrackInPopUp: (id) sender searchPrefixString: (NSString *) searchPrefixString selectIndexIfNotFound: (int) selectIndexIfNotFound;
229 - (IBAction) AudioTrackPopUpChanged: (id) sender;
230 - (IBAction) AudioTrackPopUpChanged: (id) sender mixdownToUse: (int) mixdownToUse;
231 - (IBAction) AudioTrackMixdownChanged: (id) sender;
233 - (IBAction) BrowseFile: (id) sender;
234 - (void) BrowseFileDone: (NSSavePanel *) sheet
235 returnCode: (int) returnCode contextInfo: (void *) contextInfo;
237 - (IBAction) VideoMatrixChanged: (id) sender;
238 - (IBAction) QualitySliderChanged: (id) sender;
240 - (IBAction) ShowPicturePanel: (id) sender;
241 - (IBAction) CalculatePictureSizing: (id) sender;
242 - (IBAction) OpenMainWindow: (id) sender;
244 - (IBAction) AddToQueue: (id) sender;
245 - (IBAction) ShowQueuePanel: (id) sender;
247 - (IBAction) Rip: (id) sender;
248 - (void) OverwriteAlertDone: (NSWindow *) sheet
249 returnCode: (int) returnCode contextInfo: (void *) contextInfo;
250 - (void) UpdateAlertDone: (NSWindow *) sheet
251 returnCode: (int) returnCode contextInfo: (void *) contextInfo;
253 - (IBAction) Cancel: (id) sender;
254 - (void) _Cancel: (NSWindow *) sheet returnCode: (int) returnCode
255 contextInfo: (void *) contextInfo;
256 - (IBAction) Pause: (id) sender;
258 - (IBAction) CalculateBitrate: (id) sender;
259 - (void) controlTextDidBeginEditing: (NSNotification *) notification;
260 - (void) controlTextDidEndEditing: (NSNotification *) notification;
261 - (void) controlTextDidChange: (NSNotification *) notification;
263 - (IBAction) OpenHomepage: (id) sender;
264 - (IBAction) OpenForums: (id) sender;
265 - (IBAction) OpenUserGuide: (id) sender;
267 // x264 Advanced Panel Methods
268 - (IBAction) X264AdvancedOptionsSet: (id) sender;
269 - (IBAction) X264AdvancedOptionsStandardizeOptString: (id) sender;
270 - (IBAction) X264AdvancedOptionsSetCurrentSettings: (id) sender;
271 - (NSString *) X264AdvancedOptionsStandardizeOptNames:(NSString *) cleanOptNameString;
272 - (IBAction) X264AdvancedOptionsChanged: (id) sender;
274 // Preset Methods Here
275 - (IBAction) CustomSettingUsed: (id) sender;
276 - (IBAction) ShowAddPresetPanel: (id) sender;
277 - (IBAction) CloseAddPresetPanel: (id) sender;
278 - (NSDictionary *)CreatePreset;
279 - (NSDictionary *)CreateIpodLowPreset;
280 - (NSDictionary *)CreateIpodHighPreset;
281 - (NSDictionary *)CreateAppleTVPreset;
282 - (NSDictionary *)CreatePSThreePreset;
283 - (NSDictionary *)CreatePSPPreset;
284 - (IBAction) RevertPictureSizeToMax:(id)sender;
288 - (IBAction)AddFactoryPresets:(id)sender;
289 - (IBAction)DeleteFactoryPresets:(id)sender;
290 - (IBAction)AddUserPreset:(id)sender;
292 - (IBAction)InsertPreset:(id)sender;
293 - (IBAction)DeletePreset:(id)sender;
294 - (IBAction)tableViewSelected:(id)sender;
295 // NSTableDataSource methods
296 - (int)numberOfRowsInTableView:(NSTableView *)aTableView;
297 - (id)tableView:(NSTableView *)aTableView
298 objectValueForTableColumn:(NSTableColumn *)aTableColumn
300 - (void)tableView:(NSTableView *)aTableView
301 setObjectValue:(id)anObject
302 forTableColumn:(NSTableColumn *)aTableColumn
304 // To determine user presets cell display properties
305 - (void)tableView:(NSTableView *)aTableView
306 willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn
310 - (NSDictionary *) registrationDictionaryForGrowl;
311 -(IBAction)showGrowlDoneNotification:(id)sender;
312 - (IBAction)showDebugOutputPanel:(id)sender;