OSDN Git Service

MacGui: internal code changes
[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 #import "MVMenuButton.h"
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         /* Menu Items */
39         /* File Menu */
40         IBOutlet NSMenu * fMenuBarFileMenu;
41         IBOutlet NSMenuItem * fMenuOpenSource;
42         IBOutlet NSMenuItem * fMenuAddToQueue;
43         IBOutlet NSMenuItem * fMenuStartEncode;
44         IBOutlet NSMenuItem * fMenuPauseEncode;
45         /* Window Menu */
46         IBOutlet NSMenu * fMenuBarWindowMenu;
47         IBOutlet NSMenuItem * fMenuPresetsDrawerToggle;
48         IBOutlet NSMenuItem * fMenuQueuePanelShow;
49         IBOutlet NSMenuItem * fMenuPicturePanelShow;
50         IBOutlet NSMenuItem * fMenuActivityWindowShow;
51         
52     /* Source box */
53         IBOutlet NSProgressIndicator * fScanIndicator;
54         NSString                     * sourceDisplayName;
55         IBOutlet NSTextField         * fScanStatus;
56     IBOutlet NSTextField         * fSrcDVD1Field;
57     IBOutlet NSTextField         * fSrcDVD2Field;
58     IBOutlet NSTextField         * fSrcTitleField;
59     IBOutlet NSPopUpButton       * fSrcTitlePopUp;
60     IBOutlet NSTextField         * fSrcChapterField;
61     IBOutlet NSPopUpButton       * fSrcChapterStartPopUp;
62     IBOutlet NSTextField         * fSrcChapterToField;
63     IBOutlet NSPopUpButton       * fSrcChapterEndPopUp;
64     IBOutlet NSTextField         * fSrcDuration1Field;
65     IBOutlet NSTextField         * fSrcDuration2Field;
66         
67     /* Destination box */
68     IBOutlet NSTextField         * fDstFormatField;
69         IBOutlet NSPopUpButton       * fDstFormatPopUp;
70         IBOutlet NSButton            * fDstMpgLargeFileCheck;
71     IBOutlet NSTextField         * fDstCodecsField;
72     IBOutlet NSPopUpButton       * fDstCodecsPopUp;
73     IBOutlet NSTextField         * fDstFile1Field;
74     IBOutlet NSTextField         * fDstFile2Field;
75     IBOutlet NSButton            * fDstBrowseButton;
76         
77     /* Video box */
78     IBOutlet NSTextField         * fVidRateField;
79     IBOutlet NSPopUpButton       * fVidRatePopUp;
80     IBOutlet NSTextField         * fVidEncoderField;
81     IBOutlet NSPopUpButton       * fVidEncoderPopUp;
82     IBOutlet NSTextField         * fVidQualityField;
83     IBOutlet NSMatrix            * fVidQualityMatrix;
84     IBOutlet NSButtonCell        * fVidTargetCell;
85     IBOutlet NSTextField         * fVidTargetSizeField;
86     IBOutlet NSButtonCell        * fVidBitrateCell;
87     IBOutlet NSTextField         * fVidBitrateField;
88     IBOutlet NSButtonCell        * fVidConstantCell;
89     IBOutlet NSSlider            * fVidQualitySlider;
90     IBOutlet NSButton            * fVidGrayscaleCheck;
91     IBOutlet NSButton            * fVidTwoPassCheck;
92     IBOutlet NSButton            * fVidTurboPassCheck;
93         
94         /* Picture Settings box */
95         IBOutlet NSTextField         * fPicLabelSettings;
96         IBOutlet NSTextField         * fPicLabelSrc;
97         IBOutlet NSTextField         * fPicLabelOutp;
98         IBOutlet NSTextField         * fPicLabelAr;
99         IBOutlet NSTextField         * fPicLabelDeinter;
100         IBOutlet NSTextField         * fPicLabelSrcX;
101         IBOutlet NSTextField         * fPicLabelOutputX;
102         
103         IBOutlet NSTextField         * fPicSrcWidth;
104         IBOutlet NSTextField         * fPicSrcHeight;
105         IBOutlet NSTextField         * fPicSettingWidth;
106         IBOutlet NSTextField         * fPicSettingHeight;
107         IBOutlet NSTextField         * fPicSettingARkeep;
108         IBOutlet NSTextField         * fPicSettingPAR;
109         IBOutlet NSTextField         * fPicSettingDeinterlace;
110         IBOutlet NSTextField         * fPicSettingDeinterlaceDsply;
111         IBOutlet NSTextField         * fPicSettingARkeepDsply;
112         IBOutlet NSTextField         * fPicSettingPARDsply;
113         IBOutlet NSTextField         * fPicSettingAutoCropLabel;
114         IBOutlet NSTextField         * fPicSettingAutoCrop;
115         IBOutlet NSTextField         * fPicSettingAutoCropDsply;
116         IBOutlet NSTextField         * fPicSettingDetelecine;
117         IBOutlet NSTextField         * fPicSettingDetelecineLabel;
118         IBOutlet NSTextField         * fPicSettingDenoise;
119         IBOutlet NSTextField         * fPicSettingDenoiseDsply;
120         IBOutlet NSTextField         * fPicSettingDenoiseLabel;
121
122         IBOutlet NSTextField         * fPicLabelAnamorphic;
123         IBOutlet NSTextField         * fPicLabelPAROutp;
124         IBOutlet NSTextField         * fPicLabelPAROutputX;
125         IBOutlet NSTextField         * fPicSettingPARWidth;
126         IBOutlet NSTextField         * fPicSettingPARHeight;
127     /* Picture variables */
128         int                        PicOrigOutputWidth;
129         int                        PicOrigOutputHeight;
130         int                        AutoCropTop;
131         int                        AutoCropBottom;
132         int                        AutoCropLeft;
133         int                        AutoCropRight;
134     /* Subtitles box */
135     IBOutlet NSTextField         * fSubField;
136     IBOutlet NSPopUpButton       * fSubPopUp;
137         IBOutlet NSButton            * fSubForcedCheck;
138         
139     /* Audio box */
140     IBOutlet NSTextField         * fAudLang1Field;
141     IBOutlet NSPopUpButton       * fAudLang1PopUp;
142     IBOutlet NSTextField         * fAudLang2Field;
143     IBOutlet NSPopUpButton       * fAudLang2PopUp;
144         /* New Audio Mix PopUps */
145         IBOutlet NSTextField         * fAudTrack1MixLabel;
146         IBOutlet NSPopUpButton       * fAudTrack1MixPopUp;
147     IBOutlet NSTextField         * fAudTrack2MixLabel;
148         IBOutlet NSPopUpButton       * fAudTrack2MixPopUp;
149         
150         IBOutlet NSTextField         * fAudRateField;
151     IBOutlet NSPopUpButton       * fAudRatePopUp;
152     IBOutlet NSTextField         * fAudBitrateField;
153     IBOutlet NSPopUpButton       * fAudBitratePopUp;
154     
155     /* Chapters box */
156     IBOutlet NSButton            * fCreateChapterMarkers;
157     IBOutlet NSTableView         * fChapterTable;
158         ChapterTitles       * fChapterTitlesDelegate;
159         
160     /* Bottom */
161     IBOutlet NSButton            * fPictureButton;
162     IBOutlet NSTextField         * fStatusField;
163     IBOutlet NSProgressIndicator * fRipIndicator;
164     IBOutlet NSButton            * fShowQuButton;
165     IBOutlet NSButton            * fAddToQuButton;
166     IBOutlet NSButton            * fPauseButton;
167     IBOutlet NSButton            * fRipButton;
168         
169         /* Advanced Tab for opts fX264optView*/
170         IBOutlet NSView              * fX264optView;
171         IBOutlet NSTextField         * fX264optViewTitleLabel;
172         IBOutlet NSTextField         * fDisplayX264OptionsLabel;
173         IBOutlet NSTextField         * fDisplayX264Options;
174         IBOutlet NSTextField         * fX264optBframesLabel;
175         IBOutlet NSPopUpButton       * fX264optBframesPopUp;
176         IBOutlet NSTextField         * fX264optRefLabel;
177         IBOutlet NSPopUpButton       * fX264optRefPopUp;
178         IBOutlet NSTextField         * fX264optNfpskipLabel;
179         IBOutlet NSButton            * fX264optNfpskipSwitch;
180         IBOutlet NSTextField         * fX264optNodctdcmtLabel;
181         IBOutlet NSButton            * fX264optNodctdcmtSwitch;
182         IBOutlet NSTextField         * fX264optSubmeLabel;
183         IBOutlet NSPopUpButton       * fX264optSubmePopUp;
184         IBOutlet NSTextField         * fX264optTrellisLabel;
185         IBOutlet NSPopUpButton       * fX264optTrellisPopUp;
186     IBOutlet NSTextField         * fX264optMixedRefsLabel;
187     IBOutlet NSButton            * fX264optMixedRefsSwitch;
188     IBOutlet NSTextField         * fX264optMotionEstLabel;
189     IBOutlet NSPopUpButton       * fX264optMotionEstPopUp;
190     IBOutlet NSTextField         * fX264optMERangeLabel;
191     IBOutlet NSPopUpButton       * fX264optMERangePopUp;
192     IBOutlet NSTextField         * fX264optWeightBLabel;
193     IBOutlet NSButton            * fX264optWeightBSwitch;
194     IBOutlet NSTextField         * fX264optBRDOLabel;
195     IBOutlet NSButton            * fX264optBRDOSwitch;
196     IBOutlet NSTextField         * fX264optBPyramidLabel;
197     IBOutlet NSButton            * fX264optBPyramidSwitch;
198     IBOutlet NSTextField         * fX264optBiMELabel;
199     IBOutlet NSButton            * fX264optBiMESwitch;
200     IBOutlet NSTextField         * fX264optDirectPredLabel;
201     IBOutlet NSPopUpButton       * fX264optDirectPredPopUp;
202     IBOutlet NSTextField         * fX264optDeblockLabel;
203     IBOutlet NSPopUpButton       * fX264optAlphaDeblockPopUp;
204     IBOutlet NSPopUpButton       * fX264optBetaDeblockPopUp;
205     IBOutlet NSTextField         * fX264optAnalyseLabel;
206     IBOutlet NSPopUpButton       * fX264optAnalysePopUp;
207     IBOutlet NSTextField         * fX264opt8x8dctLabel;
208     IBOutlet NSButton            * fX264opt8x8dctSwitch;
209     IBOutlet NSTextField         * fX264optCabacLabel;
210     IBOutlet NSButton            * fX264optCabacSwitch;
211     
212         /* User Preset variables here */
213         
214         IBOutlet NSDrawer            * fPresetDrawer;
215         IBOutlet NSTextField         * fPresetNewName;
216         IBOutlet NSTextField         * fPresetNewDesc;
217         IBOutlet NSPopUpButton       * fPresetNewPicSettingsPopUp;
218         IBOutlet NSTextField         * fPresetSelectedDisplay;
219         
220         NSString                     * AppSupportDirectory;
221         NSString                     * UserPresetsFile;
222         NSMutableArray               * UserPresets;
223         NSMutableArray               * UserPresetssortedArray;
224         NSMutableDictionary          * chosenPreset;
225     int                            curUserPresetChosenNum;
226          
227         int                            presetHbDefault; // this is 1 in "Default" preset key
228         int                            presetUserDefault;// this is 2 in "Default" preset key
229     IBOutlet NSPanel             * fAddPresetPanel;
230         IBOutlet NSTableView         * tableView;
231         IBOutlet NSButton            * fPresetsAdd;
232         IBOutlet NSButton            * fPresetsDelete;
233     IBOutlet MVMenuButton        * fPresetsActionButton;
234     IBOutlet NSMenu              * fPresetsActionMenu;
235         
236     hb_handle_t                  * fHandle;
237         hb_title_t                   * fTitle;
238     /* integer to set to determine the previous state
239                 of encode 0==idle, 1==encoding, 2==cancelled*/
240     int                            fEncodeState;
241         int                            currentScanCount;
242         int                            currentSuccessfulScanCount;
243         NSString                      * currentSource;
244         HBOutputPanelController       *outputPanel;
245         
246         BOOL                         startButtonEnabled;
247     BOOL                         pauseButtonEnabled;
248     BOOL                         addToQueueButtonEnabled;
249         BOOL                         stopOrStart;
250         BOOL                         resumeOrPause;
251 }
252
253 - (void)     TranslateStrings;
254
255 - (void)     updateUI: (NSTimer *) timer;
256 - (void)     enableUI: (bool) enable;
257 - (IBAction) showNewScan: (id) sender;
258 - (IBAction) showScanPanel: (id) sender;
259
260 - (IBAction) titlePopUpChanged: (id) sender;
261 - (IBAction) chapterPopUpChanged: (id) sender;
262
263 - (IBAction) formatPopUpChanged: (id) sender;
264 - (IBAction) codecsPopUpChanged: (id) sender;
265 - (IBAction) encoderPopUpChanged: (id) sender;
266 - (IBAction) twoPassCheckboxChanged: (id) sender;
267 - (IBAction) videoFrameRateChanged: (id) sender;
268 - (IBAction) setEnabledStateOfAudioMixdownControls: (id) sender;
269 - (IBAction) addAllAudioTracksToPopUp: (id) sender;
270 - (IBAction) selectAudioTrackInPopUp: (id) sender searchPrefixString: (NSString *) searchPrefixString selectIndexIfNotFound: (int) selectIndexIfNotFound;
271 - (IBAction) audioTrackPopUpChanged: (id) sender;
272 - (IBAction) audioTrackPopUpChanged: (id) sender mixdownToUse: (int) mixdownToUse;
273 - (IBAction) audioTrackMixdownChanged: (id) sender;
274 - (IBAction) subtitleSelectionChanged: (id) sender;
275
276 - (IBAction) browseFile: (id) sender;
277 - (void)     browseFileDone: (NSSavePanel *) sheet
278     returnCode: (int) returnCode contextInfo: (void *) contextInfo;
279
280 - (IBAction) videoMatrixChanged: (id) sender;
281 - (IBAction) qualitySliderChanged: (id) sender;
282
283 - (IBAction) showPicturePanel: (id) sender;
284 - (IBAction) calculatePictureSizing: (id) sender;
285 - (IBAction) openMainWindow: (id) sender;
286
287 - (IBAction) addToQueue: (id) sender;
288 - (IBAction) showQueuePanel: (id) sender;
289
290 - (IBAction) Rip: (id) sender;
291 - (void)     overWriteAlertDone: (NSWindow *) sheet
292     returnCode: (int) returnCode contextInfo: (void *) contextInfo;
293 - (void)     updateAlertDone: (NSWindow *) sheet
294     returnCode: (int) returnCode contextInfo: (void *) contextInfo;
295 - (void)     _Rip;
296 - (IBAction) Cancel: (id) sender;
297 - (void)     _Cancel: (NSWindow *) sheet returnCode: (int) returnCode
298     contextInfo: (void *) contextInfo;
299 - (IBAction) Pause: (id) sender;
300
301 - (IBAction) calculateBitrate: (id) sender;
302 - (void) controlTextDidBeginEditing: (NSNotification *) notification;
303 - (void) controlTextDidEndEditing: (NSNotification *) notification;
304 - (void) controlTextDidChange: (NSNotification *) notification;
305
306 - (IBAction) openHomepage: (id) sender;
307 - (IBAction) openForums:   (id) sender;
308 - (IBAction) openUserGuide:   (id) sender;
309
310 // x264 Advanced Panel Methods
311 - (IBAction) X264AdvancedOptionsSet: (id) sender;
312 - (IBAction) X264AdvancedOptionsStandardizeOptString: (id) sender;
313 - (IBAction) X264AdvancedOptionsSetCurrentSettings: (id) sender;
314 - (NSString *)  X264AdvancedOptionsStandardizeOptNames:(NSString *) cleanOptNameString;
315 - (IBAction) X264AdvancedOptionsChanged: (id) sender;
316
317 // Preset Methods Here
318 - (void) loadPresets;
319 - (IBAction) customSettingUsed: (id) sender;
320 - (IBAction) showAddPresetPanel: (id) sender;
321 - (IBAction) closeAddPresetPanel: (id) sender;
322 - (NSDictionary *)createPreset;
323 - (NSDictionary *)createIpodLowPreset;
324 - (NSDictionary *)createIpodHighPreset;
325 - (NSDictionary *)createAppleTVPreset;
326 - (NSDictionary *)createPSThreePreset;  
327 - (NSDictionary *)createPSPPreset;
328 - (NSDictionary *)createNormalPreset;
329 - (NSDictionary *)createClassicPreset;
330 - (NSDictionary *)createQuickTimePreset;
331 - (NSDictionary *)createFilmPreset;
332 - (NSDictionary *)createTelevisionPreset;
333 - (NSDictionary *)createAnimationPreset;
334 - (NSDictionary *)createBedlamPreset;
335 - (NSDictionary *)createiPhonePreset;
336 - (NSDictionary *)createDeuxSixQuatrePreset;
337 - (NSDictionary *)createBrokePreset;
338 - (NSDictionary *)createBlindPreset;
339 - (NSDictionary *)createCRFPreset;
340
341 - (IBAction) revertPictureSizeToMax:(id)sender;
342
343 - (IBAction)setDefaultPreset:(id)sender;
344 - (IBAction)selectDefaultPreset:(id)sender;
345 - (void) savePreset;
346 - (IBAction)addFactoryPresets:(id)sender;
347 - (IBAction)deleteFactoryPresets:(id)sender;
348 - (IBAction)addUserPreset:(id)sender;
349 - (void)addPreset;
350 - (IBAction)insertPreset:(id)sender;
351 - (IBAction)deletePreset:(id)sender;
352 - (IBAction)getDefaultPresets:(id)sender;
353 - (IBAction)tableViewSelected:(id)sender;
354
355 // NSTableDataSource methods
356 - (int)numberOfRowsInTableView:(NSTableView *)aTableView;
357 - (id)tableView:(NSTableView *)aTableView
358       objectValueForTableColumn:(NSTableColumn *)aTableColumn
359       row:(int)rowIndex;
360 - (void)tableView:(NSTableView *)aTableView
361         setObjectValue:(id)anObject
362         forTableColumn:(NSTableColumn *)aTableColumn
363         row:(int)rowIndex;
364 // To determine user presets cell display properties
365 - (void)tableView:(NSTableView *)aTableView
366                 willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn
367                  row:(int)rowIndex;
368
369 // Growl methods
370 - (NSDictionary *) registrationDictionaryForGrowl;
371 -(IBAction)showGrowlDoneNotification:(id)sender;
372 - (IBAction)showDebugOutputPanel:(id)sender;
373 - (void)setupToolbar;
374 @end
375