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 /* User Preset variables here fPresetNewPicSettingsApply*/
140 IBOutlet NSDrawer * fPresetDrawer;
141 IBOutlet NSTextField * fPresetNewName;
142 IBOutlet NSTextField * fPresetNewX264Opt;
143 IBOutlet NSTextField * fPresetNewX264OptLabel;
144 IBOutlet NSButton * fPresetNewPicSettingsApply;
145 IBOutlet NSTextField * fPresetSelectedDisplay;
146 IBOutlet NSTextField * fDisplayX264Options;
148 NSString * AppSupportDirectory;
149 NSString * UserPresetsFile;
150 NSString * x264ProfilesFile;
151 NSMutableArray * UserPresets;
152 NSMutableArray * x264Profiles;
153 NSMutableArray * UserPresetssortedArray;
154 NSMutableDictionary * chosenPreset;
155 int curUserPresetChosenNum;
157 IBOutlet NSPanel * fAddPresetPanel;
158 IBOutlet NSTableView * tableView;
159 IBOutlet NSButton * fPresetsAdd;
160 IBOutlet NSButton * fPresetsDelete;
161 hb_handle_t * fHandle;
163 /* integer to set to determine the previous state
164 of encode 0==idle, 1==encoding, 2==cancelled*/
168 - (void) TranslateStrings;
170 - (void) UpdateUI: (NSTimer *) timer;
171 - (void) EnableUI: (bool) enable;
173 - (IBAction) ShowScanPanel: (id) sender;
175 - (IBAction) TitlePopUpChanged: (id) sender;
176 - (IBAction) ChapterPopUpChanged: (id) sender;
178 - (IBAction) FormatPopUpChanged: (id) sender;
179 - (IBAction) CodecsPopUpChanged: (id) sender;
180 - (IBAction) EncoderPopUpChanged: (id) sender;
182 - (IBAction) SetEnabledStateOfAudioMixdownControls: (id) sender;
183 - (IBAction) AddAllAudioTracksToPopUp: (id) sender;
184 - (IBAction) SelectAudioTrackInPopUp: (id) sender searchPrefixString: (NSString *) searchPrefixString selectIndexIfNotFound: (int) selectIndexIfNotFound;
185 - (IBAction) AudioTrackPopUpChanged: (id) sender;
186 - (IBAction) AudioTrackPopUpChanged: (id) sender mixdownToUse: (int) mixdownToUse;
187 - (IBAction) AudioTrackMixdownChanged: (id) sender;
189 - (IBAction) BrowseFile: (id) sender;
190 - (void) BrowseFileDone: (NSSavePanel *) sheet
191 returnCode: (int) returnCode contextInfo: (void *) contextInfo;
193 - (IBAction) VideoMatrixChanged: (id) sender;
194 - (IBAction) QualitySliderChanged: (id) sender;
196 - (IBAction) ShowPicturePanel: (id) sender;
197 - (IBAction) CalculatePictureSizing: (id) sender;
200 - (IBAction) AddToQueue: (id) sender;
201 - (IBAction) ShowQueuePanel: (id) sender;
203 - (IBAction) Rip: (id) sender;
204 - (void) OverwriteAlertDone: (NSWindow *) sheet
205 returnCode: (int) returnCode contextInfo: (void *) contextInfo;
206 - (void) UpdateAlertDone: (NSWindow *) sheet
207 returnCode: (int) returnCode contextInfo: (void *) contextInfo;
209 - (IBAction) Cancel: (id) sender;
210 - (void) _Cancel: (NSWindow *) sheet returnCode: (int) returnCode
211 contextInfo: (void *) contextInfo;
212 - (IBAction) Pause: (id) sender;
214 - (IBAction) CalculateBitrate: (id) sender;
215 - (void) controlTextDidBeginEditing: (NSNotification *) notification;
216 - (void) controlTextDidEndEditing: (NSNotification *) notification;
217 - (void) controlTextDidChange: (NSNotification *) notification;
219 - (IBAction) OpenHomepage: (id) sender;
220 - (IBAction) OpenForums: (id) sender;
221 - (IBAction) OpenUserGuide: (id) sender;
223 // Preset Methods Here
224 - (IBAction) CustomSettingUsed: (id) sender;
225 - (IBAction) ShowAddPresetPanel: (id) sender;
226 - (IBAction) CloseAddPresetPanel: (id) sender;
227 - (NSDictionary *)CreatePreset;
228 - (NSDictionary *)CreateIpodPreset;
229 - (NSDictionary *)CreateAppleTVPreset;
230 - (NSDictionary *)CreatePSThreePreset;
231 - (NSDictionary *)CreatePSPPreset;
232 - (IBAction) RevertPictureSizeToMax:(id)sender;
236 - (IBAction)AddFactoryPresets:(id)sender;
237 - (IBAction)DeleteFactoryPresets:(id)sender;
238 - (IBAction)AddUserPreset:(id)sender;
240 - (IBAction)InsertPreset:(id)sender;
241 - (IBAction)DeletePreset:(id)sender;
242 - (IBAction)tableViewSelected:(id)sender;
243 // NSTableDataSource methods
244 - (int)numberOfRowsInTableView:(NSTableView *)aTableView;
245 - (id)tableView:(NSTableView *)aTableView
246 objectValueForTableColumn:(NSTableColumn *)aTableColumn
248 - (void)tableView:(NSTableView *)aTableView
249 setObjectValue:(id)anObject
250 forTableColumn:(NSTableColumn *)aTableColumn
252 // To determine user presets cell display properties
253 - (void)tableView:(NSTableView *)aTableView
254 willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn
258 - (NSDictionary *) registrationDictionaryForGrowl;
259 -(IBAction)showGrowlDoneNotification:(id)sender;