OSDN Git Service

fc5260f02900b57b36bec0993bbad2ac196ce446
[handbrake-jp/handbrake-jp-git.git] / macosx / Controller.h
1 /* $Id: Controller.h,v 1.35 2005/08/01 14:29:50 titer Exp $
2
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. */
6
7 #include <Cocoa/Cocoa.h>
8 #include <Growl/Growl.h>
9
10 #include "hb.h"
11
12
13 #include "ChapterTitles.h"
14 #include "ScanController.h"
15 #include "PictureController.h"
16 #include "QueueController.h"
17
18 @class HBOutputPanelController;
19
20 @interface HBController : NSObject <GrowlApplicationBridgeDelegate>
21
22 {
23     IBOutlet NSWindow            * fWindow;
24         
25     /* Scan panel */
26         IBOutlet ScanController      * fScanController;
27     IBOutlet NSPanel             * fScanPanel;
28         
29     /* Picture panel */
30     IBOutlet PictureController   * fPictureController;
31     IBOutlet NSPanel             * fPicturePanel;
32         
33     /* Queue panel */
34     IBOutlet QueueController     * fQueueController;
35     IBOutlet NSPanel             * fQueuePanel;
36     IBOutlet NSTextField         * fQueueStatus;
37         
38     /* Source box */
39         IBOutlet NSProgressIndicator * fScanIndicator;
40         NSString                     * sourceDisplayName;
41         IBOutlet NSTextField         * fScanStatus;
42     IBOutlet NSTextField         * fSrcDVD1Field;
43     IBOutlet NSTextField         * fSrcDVD2Field;
44     IBOutlet NSTextField         * fSrcTitleField;
45     IBOutlet NSPopUpButton       * fSrcTitlePopUp;
46     IBOutlet NSTextField         * fSrcChapterField;
47     IBOutlet NSPopUpButton       * fSrcChapterStartPopUp;
48     IBOutlet NSTextField         * fSrcChapterToField;
49     IBOutlet NSPopUpButton       * fSrcChapterEndPopUp;
50     IBOutlet NSTextField         * fSrcDuration1Field;
51     IBOutlet NSTextField         * fSrcDuration2Field;
52         
53     /* Destination box */
54     IBOutlet NSTextField         * fDstFormatField;
55         IBOutlet NSPopUpButton       * fDstFormatPopUp;
56         IBOutlet NSButton            * fDstMpgLargeFileCheck;
57     IBOutlet NSTextField         * fDstCodecsField;
58     IBOutlet NSPopUpButton       * fDstCodecsPopUp;
59     IBOutlet NSTextField         * fDstFile1Field;
60     IBOutlet NSTextField         * fDstFile2Field;
61     IBOutlet NSButton            * fDstBrowseButton;
62         
63     /* Video box */
64     IBOutlet NSTextField         * fVidRateField;
65     IBOutlet NSPopUpButton       * fVidRatePopUp;
66     IBOutlet NSTextField         * fVidEncoderField;
67     IBOutlet NSPopUpButton       * fVidEncoderPopUp;
68     IBOutlet NSTextField         * fVidQualityField;
69     IBOutlet NSMatrix            * fVidQualityMatrix;
70     IBOutlet NSButtonCell        * fVidTargetCell;
71     IBOutlet NSTextField         * fVidTargetSizeField;
72     IBOutlet NSButtonCell        * fVidBitrateCell;
73     IBOutlet NSTextField         * fVidBitrateField;
74     IBOutlet NSButtonCell        * fVidConstantCell;
75     IBOutlet NSSlider            * fVidQualitySlider;
76     IBOutlet NSButton            * fVidGrayscaleCheck;
77     IBOutlet NSButton            * fVidTwoPassCheck;
78     IBOutlet NSButton            * fVidTurboPassCheck;
79         
80         /* Picture Settings box */
81         IBOutlet NSTextField         * fPicLabelSettings;
82         IBOutlet NSTextField         * fPicLabelSrc;
83         IBOutlet NSTextField         * fPicLabelOutp;
84         IBOutlet NSTextField         * fPicLabelAr;
85         IBOutlet NSTextField         * fPicLabelDeinter;
86         IBOutlet NSTextField         * fPicLabelSrcX;
87         IBOutlet NSTextField         * fPicLabelOutputX;
88         
89         IBOutlet NSTextField         * fPicSrcWidth;
90         IBOutlet NSTextField         * fPicSrcHeight;
91         IBOutlet NSTextField         * fPicSettingWidth;
92         IBOutlet NSTextField         * fPicSettingHeight;
93         IBOutlet NSTextField         * fPicSettingARkeep;
94         IBOutlet NSTextField         * fPicSettingPAR;
95         IBOutlet NSTextField         * fPicSettingDeinterlace;
96         IBOutlet NSTextField         * fPicSettingARkeepDsply;
97         IBOutlet NSTextField         * fPicSettingPARDsply;
98         IBOutlet NSTextField         * fPicSettingAutoCropLabel;
99         IBOutlet NSTextField         * fPicSettingAutoCrop;
100         IBOutlet NSTextField         * fPicSettingAutoCropDsply;
101         IBOutlet NSTextField         * fPicSettingDeinterlaceDsply;
102         IBOutlet NSTextField         * fPicLabelAnamorphic;
103         IBOutlet NSTextField         * fPicLabelPAROutp;
104         IBOutlet NSTextField         * fPicLabelPAROutputX;
105         IBOutlet NSTextField         * fPicSettingPARWidth;
106         IBOutlet NSTextField         * fPicSettingPARHeight;
107     /* Picture variables */
108         int                        PicOrigOutputWidth;
109         int                        PicOrigOutputHeight;
110         int                        AutoCropTop;
111         int                        AutoCropBottom;
112         int                        AutoCropLeft;
113         int                        AutoCropRight;
114     /* Subtitles box */
115     IBOutlet NSTextField         * fSubField;
116     IBOutlet NSPopUpButton       * fSubPopUp;
117         
118     /* Audio box */
119     IBOutlet NSTextField         * fAudLang1Field;
120     IBOutlet NSPopUpButton       * fAudLang1PopUp;
121     IBOutlet NSTextField         * fAudLang2Field;
122     IBOutlet NSPopUpButton       * fAudLang2PopUp;
123         /* New Audio Mix PopUps */
124         IBOutlet NSTextField         * fAudTrack1MixLabel;
125         IBOutlet NSPopUpButton       * fAudTrack1MixPopUp;
126     IBOutlet NSTextField         * fAudTrack2MixLabel;
127         IBOutlet NSPopUpButton       * fAudTrack2MixPopUp;
128         
129         IBOutlet NSTextField         * fAudRateField;
130     IBOutlet NSPopUpButton       * fAudRatePopUp;
131     IBOutlet NSTextField         * fAudBitrateField;
132     IBOutlet NSPopUpButton       * fAudBitratePopUp;
133     
134     /* Chapters box */
135     IBOutlet NSButton            * fCreateChapterMarkers;
136     IBOutlet NSTableView         * fChapterTable;
137         ChapterTitles       * fChapterTitlesDelegate;
138         
139     /* Bottom */
140     IBOutlet NSButton            * fPictureButton;
141     IBOutlet NSTextField         * fStatusField;
142     IBOutlet NSProgressIndicator * fRipIndicator;
143     IBOutlet NSButton            * fShowQuButton;
144     IBOutlet NSButton            * fAddToQuButton;
145     IBOutlet NSButton            * fPauseButton;
146     IBOutlet NSButton            * fRipButton;
147         
148         /* Advanced Tab for opts fX264optView*/
149         IBOutlet NSView              * fX264optView;
150         IBOutlet NSTextField         * fX264optViewTitleLabel;
151         IBOutlet NSTextField         * fDisplayX264OptionsLabel;
152         IBOutlet NSTextField         * fDisplayX264Options;
153         IBOutlet NSTextField         * fX264optBframesLabel;
154         IBOutlet NSPopUpButton       * fX264optBframesPopUp;
155         IBOutlet NSTextField         * fX264optRefLabel;
156         IBOutlet NSPopUpButton       * fX264optRefPopUp;
157         IBOutlet NSTextField         * fX264optNfpskipLabel;
158         IBOutlet NSButton            * fX264optNfpskipSwitch;
159         IBOutlet NSTextField         * fX264optNodctdcmtLabel;
160         IBOutlet NSButton            * fX264optNodctdcmtSwitch;
161         IBOutlet NSTextField         * fX264optSubmeLabel;
162         IBOutlet NSPopUpButton       * fX264optSubmePopUp;
163         IBOutlet NSTextField         * fX264optTrellisLabel;
164         IBOutlet NSPopUpButton       * fX264optTrellisPopUp;
165     IBOutlet NSTextField         * fX264optMixedRefsLabel;
166     IBOutlet NSButton            * fX264optMixedRefsSwitch;
167     IBOutlet NSTextField         * fX264optMotionEstLabel;
168     IBOutlet NSPopUpButton       * fX264optMotionEstPopUp;
169     IBOutlet NSTextField         * fX264optMERangeLabel;
170     IBOutlet NSPopUpButton       * fX264optMERangePopUp;
171     IBOutlet NSTextField         * fX264optWeightBLabel;
172     IBOutlet NSButton            * fX264optWeightBSwitch;
173     IBOutlet NSTextField         * fX264optBRDOLabel;
174     IBOutlet NSButton            * fX264optBRDOSwitch;
175     IBOutlet NSTextField         * fX264optBPyramidLabel;
176     IBOutlet NSButton            * fX264optBPyramidSwitch;
177     IBOutlet NSTextField         * fX264optBiMELabel;
178     IBOutlet NSButton            * fX264optBiMESwitch;
179     IBOutlet NSTextField         * fX264optDirectPredLabel;
180     IBOutlet NSPopUpButton       * fX264optDirectPredPopUp;
181     IBOutlet NSTextField         * fX264optDeblockLabel;
182     IBOutlet NSPopUpButton       * fX264optAlphaDeblockPopUp;
183     IBOutlet NSPopUpButton       * fX264optBetaDeblockPopUp;
184     IBOutlet NSTextField         * fX264optAnalyseLabel;
185     IBOutlet NSPopUpButton       * fX264optAnalysePopUp;
186     IBOutlet NSTextField         * fX264opt8x8dctLabel;
187     IBOutlet NSButton            * fX264opt8x8dctSwitch;
188     IBOutlet NSTextField         * fX264optCabacLabel;
189     IBOutlet NSButton            * fX264optCabacSwitch;
190     
191         /* User Preset variables here */
192         
193         IBOutlet NSDrawer            * fPresetDrawer;
194         IBOutlet NSTextField         * fPresetNewName;
195         IBOutlet NSTextField         * fPresetNewDesc;
196         IBOutlet NSPopUpButton       * fPresetNewPicSettingsPopUp;
197         IBOutlet NSTextField         * fPresetSelectedDisplay;
198         
199         NSString                     * AppSupportDirectory;
200         NSString                     * UserPresetsFile;
201         NSString                     * x264ProfilesFile;
202         NSMutableArray               * UserPresets;
203         NSMutableArray               * x264Profiles;
204         NSMutableArray               * UserPresetssortedArray;
205         NSMutableDictionary          * chosenPreset;
206     int                            curUserPresetChosenNum;
207          
208         int                            presetHbDefault; // this is 1 in "Default" preset key
209         int                            presetUserDefault;// this is 2 in "Default" preset key
210     IBOutlet NSPanel             * fAddPresetPanel;
211         IBOutlet NSTableView         * tableView;
212         IBOutlet NSButton            * fPresetsAdd;
213         IBOutlet NSButton            * fPresetsDelete;
214         IBOutlet NSButton            * fPresetMakeDefault;
215         
216     hb_handle_t                  * fHandle;
217         hb_title_t                   * fTitle;
218     /* integer to set to determine the previous state
219                 of encode 0==idle, 1==encoding, 2==cancelled*/
220     int                            fEncodeState;
221         int                            currentScanCount;
222         int                            currentSuccessfulScanCount;
223         NSString                      * currentSource;
224         HBOutputPanelController *outputPanel;
225         
226         BOOL                         startButtonEnabled;
227     BOOL                         pauseButtonEnabled;
228     BOOL                         AddToQueueButtonEnabled;
229         BOOL                         stopOrStart;
230         BOOL                         resumeOrPause;
231 }
232
233 - (void)     TranslateStrings;
234
235 - (void)     UpdateUI: (NSTimer *) timer;
236 - (void)     EnableUI: (bool) enable;
237 - (IBAction) ShowNewScan: (id) sender;
238 - (IBAction) ShowScanPanel: (id) sender;
239
240 - (IBAction) TitlePopUpChanged: (id) sender;
241 - (IBAction) ChapterPopUpChanged: (id) sender;
242
243 - (IBAction) FormatPopUpChanged: (id) sender;
244 - (IBAction) CodecsPopUpChanged: (id) sender;
245 - (IBAction) EncoderPopUpChanged: (id) sender;
246 - (IBAction) TwoPassCheckboxChanged: (id) sender;
247 - (IBAction) SetEnabledStateOfAudioMixdownControls: (id) sender;
248 - (IBAction) AddAllAudioTracksToPopUp: (id) sender;
249 - (IBAction) SelectAudioTrackInPopUp: (id) sender searchPrefixString: (NSString *) searchPrefixString selectIndexIfNotFound: (int) selectIndexIfNotFound;
250 - (IBAction) AudioTrackPopUpChanged: (id) sender;
251 - (IBAction) AudioTrackPopUpChanged: (id) sender mixdownToUse: (int) mixdownToUse;
252 - (IBAction) AudioTrackMixdownChanged: (id) sender;
253
254 - (IBAction) BrowseFile: (id) sender;
255 - (void)     BrowseFileDone: (NSSavePanel *) sheet
256     returnCode: (int) returnCode contextInfo: (void *) contextInfo;
257
258 - (IBAction) VideoMatrixChanged: (id) sender;
259 - (IBAction) QualitySliderChanged: (id) sender;
260
261 - (IBAction) ShowPicturePanel: (id) sender;
262 - (IBAction) CalculatePictureSizing: (id) sender;
263 - (IBAction) OpenMainWindow: (id) sender;
264
265 - (IBAction) AddToQueue: (id) sender;
266 - (IBAction) ShowQueuePanel: (id) sender;
267
268 - (IBAction) Rip: (id) sender;
269 - (void)     OverwriteAlertDone: (NSWindow *) sheet
270     returnCode: (int) returnCode contextInfo: (void *) contextInfo;
271 - (void)     UpdateAlertDone: (NSWindow *) sheet
272     returnCode: (int) returnCode contextInfo: (void *) contextInfo;
273 - (void)     _Rip;
274 - (IBAction) Cancel: (id) sender;
275 - (void)     _Cancel: (NSWindow *) sheet returnCode: (int) returnCode
276     contextInfo: (void *) contextInfo;
277 - (IBAction) Pause: (id) sender;
278
279 - (IBAction) CalculateBitrate: (id) sender;
280 - (void) controlTextDidBeginEditing: (NSNotification *) notification;
281 - (void) controlTextDidEndEditing: (NSNotification *) notification;
282 - (void) controlTextDidChange: (NSNotification *) notification;
283
284 - (IBAction) OpenHomepage: (id) sender;
285 - (IBAction) OpenForums:   (id) sender;
286 - (IBAction) OpenUserGuide:   (id) sender;
287
288 // x264 Advanced Panel Methods
289 - (IBAction) X264AdvancedOptionsSet: (id) sender;
290 - (IBAction) X264AdvancedOptionsStandardizeOptString: (id) sender;
291 - (IBAction) X264AdvancedOptionsSetCurrentSettings: (id) sender;
292 - (NSString *)  X264AdvancedOptionsStandardizeOptNames:(NSString *) cleanOptNameString;
293 - (IBAction) X264AdvancedOptionsChanged: (id) sender;
294
295 // Preset Methods Here
296 - (IBAction) CustomSettingUsed: (id) sender;
297 - (IBAction) ShowAddPresetPanel: (id) sender;
298 - (IBAction) CloseAddPresetPanel: (id) sender;
299 - (NSDictionary *)CreatePreset;
300 - (NSDictionary *)CreateIpodLowPreset;
301 - (NSDictionary *)CreateIpodHighPreset;
302 - (NSDictionary *)CreateAppleTVPreset;
303 - (NSDictionary *)CreatePSThreePreset;  
304 - (NSDictionary *)CreatePSPPreset;
305 - (NSDictionary *)CreateNormalPreset;
306 - (NSDictionary *)CreateClassicPreset;
307 - (NSDictionary *)CreateQuickTimePreset;
308 - (NSDictionary *)CreateFilmPreset;
309 - (NSDictionary *)CreateTelevisionPreset;
310 - (NSDictionary *)CreateAnimationPreset;
311 - (NSDictionary *)CreateBedlamPreset;
312 - (NSDictionary *)CreateiPhonePreset;
313 - (IBAction) RevertPictureSizeToMax:(id)sender;
314
315 - (IBAction)SetDefaultPreset:(id)sender;
316 - (IBAction)SelectDefaultPreset:(id)sender;
317 - (void) savePreset;
318 - (IBAction)AddFactoryPresets:(id)sender;
319 - (IBAction)DeleteFactoryPresets:(id)sender;
320 - (IBAction)AddUserPreset:(id)sender;
321 - (void)AddPreset;
322 - (IBAction)InsertPreset:(id)sender;
323 - (IBAction)DeletePreset:(id)sender;
324 - (IBAction)GetDefaultPresets:(id)sender;
325 - (IBAction)tableViewSelected:(id)sender;
326 // NSTableDataSource methods
327 - (int)numberOfRowsInTableView:(NSTableView *)aTableView;
328 - (id)tableView:(NSTableView *)aTableView
329       objectValueForTableColumn:(NSTableColumn *)aTableColumn
330       row:(int)rowIndex;
331 - (void)tableView:(NSTableView *)aTableView
332         setObjectValue:(id)anObject
333         forTableColumn:(NSTableColumn *)aTableColumn
334         row:(int)rowIndex;
335 // To determine user presets cell display properties
336 - (void)tableView:(NSTableView *)aTableView
337                 willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn
338                  row:(int)rowIndex;
339
340 // Growl methods
341 - (NSDictionary *) registrationDictionaryForGrowl;
342 -(IBAction)showGrowlDoneNotification:(id)sender;
343 - (IBAction)showDebugOutputPanel:(id)sender;
344 - (void)setupToolbar;
345 @end
346