OSDN Git Service

We don't need to write end times for chapters, these are automatically calculated...
[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         
111     /* Subtitles box */
112     IBOutlet NSTextField         * fSubField;
113     IBOutlet NSPopUpButton       * fSubPopUp;
114         
115     /* Audio box */
116     IBOutlet NSTextField         * fAudLang1Field;
117     IBOutlet NSPopUpButton       * fAudLang1PopUp;
118     IBOutlet NSTextField         * fAudLang2Field;
119     IBOutlet NSPopUpButton       * fAudLang2PopUp;
120         /* New Audio Mix PopUps */
121         IBOutlet NSTextField         * fAudTrack1MixLabel;
122         IBOutlet NSPopUpButton       * fAudTrack1MixPopUp;
123     IBOutlet NSTextField         * fAudTrack2MixLabel;
124         IBOutlet NSPopUpButton       * fAudTrack2MixPopUp;
125         
126         IBOutlet NSTextField         * fAudRateField;
127     IBOutlet NSPopUpButton       * fAudRatePopUp;
128     IBOutlet NSTextField         * fAudBitrateField;
129     IBOutlet NSPopUpButton       * fAudBitratePopUp;
130     
131     /* Chapters box */
132     IBOutlet NSButton            * fCreateChapterMarkers;
133     IBOutlet NSTableView         * fChapterTable;
134         ChapterTitles       * fChapterTitlesDelegate;
135         
136     /* Bottom */
137     IBOutlet NSButton            * fPictureButton;
138     IBOutlet NSTextField         * fStatusField;
139     IBOutlet NSProgressIndicator * fRipIndicator;
140     IBOutlet NSButton            * fShowQuButton;
141     IBOutlet NSButton            * fAddToQuButton;
142     IBOutlet NSButton            * fPauseButton;
143     IBOutlet NSButton            * fRipButton;
144         
145         /* Advanced Tab for opts fX264optView*/
146         IBOutlet NSView              * fX264optView;
147         IBOutlet NSTextField         * fX264optViewTitleLabel;
148         IBOutlet NSTextField         * fDisplayX264OptionsLabel;
149         IBOutlet NSTextField         * fDisplayX264Options;
150         IBOutlet NSTextField         * fX264optBframesLabel;
151         IBOutlet NSPopUpButton       * fX264optBframesPopUp;
152         IBOutlet NSTextField         * fX264optRefLabel;
153         IBOutlet NSPopUpButton       * fX264optRefPopUp;
154         IBOutlet NSTextField         * fX264optNfpskipLabel;
155         IBOutlet NSButton            * fX264optNfpskipSwitch;
156         IBOutlet NSTextField         * fX264optNodctdcmtLabel;
157         IBOutlet NSButton            * fX264optNodctdcmtSwitch;
158         IBOutlet NSTextField         * fX264optSubmeLabel;
159         IBOutlet NSPopUpButton       * fX264optSubmePopUp;
160         IBOutlet NSTextField         * fX264optTrellisLabel;
161         IBOutlet NSPopUpButton       * fX264optTrellisPopUp;
162     IBOutlet NSTextField         * fX264optMixedRefsLabel;
163     IBOutlet NSButton            * fX264optMixedRefsSwitch;
164     IBOutlet NSTextField         * fX264optMotionEstLabel;
165     IBOutlet NSPopUpButton       * fX264optMotionEstPopUp;
166     IBOutlet NSTextField         * fX264optMERangeLabel;
167     IBOutlet NSPopUpButton       * fX264optMERangePopUp;
168     IBOutlet NSTextField         * fX264optWeightBLabel;
169     IBOutlet NSButton            * fX264optWeightBSwitch;
170     IBOutlet NSTextField         * fX264optBRDOLabel;
171     IBOutlet NSButton            * fX264optBRDOSwitch;
172     IBOutlet NSTextField         * fX264optBPyramidLabel;
173     IBOutlet NSButton            * fX264optBPyramidSwitch;
174     IBOutlet NSTextField         * fX264optBiMELabel;
175     IBOutlet NSButton            * fX264optBiMESwitch;
176     IBOutlet NSTextField         * fX264optDirectPredLabel;
177     IBOutlet NSPopUpButton       * fX264optDirectPredPopUp;
178     IBOutlet NSTextField         * fX264optDeblockLabel;
179     IBOutlet NSPopUpButton       * fX264optAlphaDeblockPopUp;
180     IBOutlet NSPopUpButton       * fX264optBetaDeblockPopUp;
181     IBOutlet NSTextField         * fX264optAnalyseLabel;
182     IBOutlet NSPopUpButton       * fX264optAnalysePopUp;
183     IBOutlet NSTextField         * fX264opt8x8dctLabel;
184     IBOutlet NSButton            * fX264opt8x8dctSwitch;
185     IBOutlet NSTextField         * fX264optCabacLabel;
186     IBOutlet NSButton            * fX264optCabacSwitch;
187     
188         /* User Preset variables here fPresetNewDesc*/
189         
190         IBOutlet NSDrawer            * fPresetDrawer;
191         IBOutlet NSTextField         * fPresetNewName;
192         IBOutlet NSTextField         * fPresetNewDesc;
193         IBOutlet NSPopUpButton       * fPresetNewPicSettingsPopUp;
194         IBOutlet NSTextField         * fPresetSelectedDisplay;
195         
196         NSString                     * AppSupportDirectory;
197         NSString                     * UserPresetsFile;
198         NSString                     * x264ProfilesFile;
199         NSMutableArray               * UserPresets;
200         NSMutableArray               * x264Profiles;
201         NSMutableArray               * UserPresetssortedArray;
202         NSMutableDictionary          * chosenPreset;
203     int                            curUserPresetChosenNum;
204         
205     IBOutlet NSPanel             * fAddPresetPanel;
206         IBOutlet NSTableView         * tableView;
207         IBOutlet NSButton            * fPresetsAdd;
208         IBOutlet NSButton            * fPresetsDelete;
209     hb_handle_t                  * fHandle;
210         hb_title_t                   * fTitle;
211     /* integer to set to determine the previous state
212                 of encode 0==idle, 1==encoding, 2==cancelled*/
213     int                            fEncodeState;
214         int                            currentScanCount;
215         NSString                      * currentSource;
216         HBOutputPanelController *outputPanel;
217         
218         BOOL                         startButtonEnabled;
219     BOOL                         pauseButtonEnabled;
220     BOOL                         AddToQueueButtonEnabled;
221         BOOL                         stopOrStart;
222         BOOL                         resumeOrPause;
223 }
224
225 - (void)     TranslateStrings;
226
227 - (void)     UpdateUI: (NSTimer *) timer;
228 - (void)     EnableUI: (bool) enable;
229 - (IBAction) ShowNewScan: (id) sender;
230 - (IBAction) ShowScanPanel: (id) sender;
231
232 - (IBAction) TitlePopUpChanged: (id) sender;
233 - (IBAction) ChapterPopUpChanged: (id) sender;
234
235 - (IBAction) FormatPopUpChanged: (id) sender;
236 - (IBAction) CodecsPopUpChanged: (id) sender;
237 - (IBAction) EncoderPopUpChanged: (id) sender;
238 - (IBAction) TwoPassCheckboxChanged: (id) sender;
239 - (IBAction) SetEnabledStateOfAudioMixdownControls: (id) sender;
240 - (IBAction) AddAllAudioTracksToPopUp: (id) sender;
241 - (IBAction) SelectAudioTrackInPopUp: (id) sender searchPrefixString: (NSString *) searchPrefixString selectIndexIfNotFound: (int) selectIndexIfNotFound;
242 - (IBAction) AudioTrackPopUpChanged: (id) sender;
243 - (IBAction) AudioTrackPopUpChanged: (id) sender mixdownToUse: (int) mixdownToUse;
244 - (IBAction) AudioTrackMixdownChanged: (id) sender;
245
246 - (IBAction) BrowseFile: (id) sender;
247 - (void)     BrowseFileDone: (NSSavePanel *) sheet
248     returnCode: (int) returnCode contextInfo: (void *) contextInfo;
249
250 - (IBAction) VideoMatrixChanged: (id) sender;
251 - (IBAction) QualitySliderChanged: (id) sender;
252
253 - (IBAction) ShowPicturePanel: (id) sender;
254 - (IBAction) CalculatePictureSizing: (id) sender;
255 - (IBAction) OpenMainWindow: (id) sender;
256
257 - (IBAction) AddToQueue: (id) sender;
258 - (IBAction) ShowQueuePanel: (id) sender;
259
260 - (IBAction) Rip: (id) sender;
261 - (void)     OverwriteAlertDone: (NSWindow *) sheet
262     returnCode: (int) returnCode contextInfo: (void *) contextInfo;
263 - (void)     UpdateAlertDone: (NSWindow *) sheet
264     returnCode: (int) returnCode contextInfo: (void *) contextInfo;
265 - (void)     _Rip;
266 - (IBAction) Cancel: (id) sender;
267 - (void)     _Cancel: (NSWindow *) sheet returnCode: (int) returnCode
268     contextInfo: (void *) contextInfo;
269 - (IBAction) Pause: (id) sender;
270
271 - (IBAction) CalculateBitrate: (id) sender;
272 - (void) controlTextDidBeginEditing: (NSNotification *) notification;
273 - (void) controlTextDidEndEditing: (NSNotification *) notification;
274 - (void) controlTextDidChange: (NSNotification *) notification;
275
276 - (IBAction) OpenHomepage: (id) sender;
277 - (IBAction) OpenForums:   (id) sender;
278 - (IBAction) OpenUserGuide:   (id) sender;
279
280 // x264 Advanced Panel Methods
281 - (IBAction) X264AdvancedOptionsSet: (id) sender;
282 - (IBAction) X264AdvancedOptionsStandardizeOptString: (id) sender;
283 - (IBAction) X264AdvancedOptionsSetCurrentSettings: (id) sender;
284 - (NSString *)  X264AdvancedOptionsStandardizeOptNames:(NSString *) cleanOptNameString;
285 - (IBAction) X264AdvancedOptionsChanged: (id) sender;
286
287 // Preset Methods Here
288 - (IBAction) CustomSettingUsed: (id) sender;
289 - (IBAction) ShowAddPresetPanel: (id) sender;
290 - (IBAction) CloseAddPresetPanel: (id) sender;
291 - (NSDictionary *)CreatePreset;
292 - (NSDictionary *)CreateIpodLowPreset;
293 - (NSDictionary *)CreateIpodHighPreset;
294 - (NSDictionary *)CreateAppleTVPreset;
295 - (NSDictionary *)CreatePSThreePreset;  
296 - (NSDictionary *)CreatePSPPreset;
297 - (NSDictionary *)CreateNormalPreset;
298 - (NSDictionary *)CreateClassicPreset;
299 - (NSDictionary *)CreateQuickTimePreset;
300 - (NSDictionary *)CreateFilmPreset;
301 - (NSDictionary *)CreateTelevisionPreset;
302 - (NSDictionary *)CreateAnimationPreset;
303 - (NSDictionary *)CreateBedlamPreset;
304 - (NSDictionary *)CreateiPhonePreset;
305 - (IBAction) RevertPictureSizeToMax:(id)sender;
306
307
308 - (void) savePreset;
309 - (IBAction)AddFactoryPresets:(id)sender;
310 - (IBAction)DeleteFactoryPresets:(id)sender;
311 - (IBAction)AddUserPreset:(id)sender;
312 - (void)AddPreset;
313 - (IBAction)InsertPreset:(id)sender;
314 - (IBAction)DeletePreset:(id)sender;
315 - (IBAction)tableViewSelected:(id)sender;
316 // NSTableDataSource methods
317 - (int)numberOfRowsInTableView:(NSTableView *)aTableView;
318 - (id)tableView:(NSTableView *)aTableView
319       objectValueForTableColumn:(NSTableColumn *)aTableColumn
320       row:(int)rowIndex;
321 - (void)tableView:(NSTableView *)aTableView
322         setObjectValue:(id)anObject
323         forTableColumn:(NSTableColumn *)aTableColumn
324         row:(int)rowIndex;
325 // To determine user presets cell display properties
326 - (void)tableView:(NSTableView *)aTableView
327                 willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn
328                  row:(int)rowIndex;
329
330 // Growl methods
331 - (NSDictionary *) registrationDictionaryForGrowl;
332 -(IBAction)showGrowlDoneNotification:(id)sender;
333 - (IBAction)showDebugOutputPanel:(id)sender;
334 - (void)setupToolbar;
335 @end
336