OSDN Git Service

MacGui: "Ritsuka Bar" toolbar initial implementation
[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     //IBOutlet NSButton            * fQueueAddButton;
38     //IBOutlet NSButton            * fQueueShowButton;
39         
40     /* Source box */
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;
51         
52     /* Destination box */
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;
61         
62     /* Video box */
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;
78         
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;
87         
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;
109         
110     /* Subtitles box */
111     IBOutlet NSTextField         * fSubField;
112     IBOutlet NSPopUpButton       * fSubPopUp;
113         
114     /* Audio box */
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;
124         
125         IBOutlet NSTextField         * fAudRateField;
126     IBOutlet NSPopUpButton       * fAudRatePopUp;
127     IBOutlet NSTextField         * fAudBitrateField;
128     IBOutlet NSPopUpButton       * fAudBitratePopUp;
129     
130     /* Chapters box */
131     IBOutlet NSButton            * fCreateChapterMarkers;
132     IBOutlet NSTableView         * fChapterTable;
133         ChapterTitles       * fChapterTitlesDelegate;
134         
135     /* Bottom */
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;
143         
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;
180     
181         /* User Preset variables here fPresetNewDesc*/
182         
183         IBOutlet NSDrawer            * fPresetDrawer;
184         IBOutlet NSTextField         * fPresetNewName;
185         IBOutlet NSTextField         * fPresetNewDesc;
186         IBOutlet NSPopUpButton       * fPresetNewPicSettingsPopUp;
187         IBOutlet NSTextField         * fPresetSelectedDisplay;
188         
189         NSString                     * AppSupportDirectory;
190         NSString                     * UserPresetsFile;
191         NSString                     * x264ProfilesFile;
192         NSMutableArray               * UserPresets;
193         NSMutableArray               * x264Profiles;
194         NSMutableArray               * UserPresetssortedArray;
195         NSMutableDictionary          * chosenPreset;
196     int                            curUserPresetChosenNum;
197         
198     IBOutlet NSPanel             * fAddPresetPanel;
199         IBOutlet NSTableView         * tableView;
200         IBOutlet NSButton            * fPresetsAdd;
201         IBOutlet NSButton            * fPresetsDelete;
202     hb_handle_t                  * fHandle;
203         hb_title_t                   * fTitle;
204     /* integer to set to determine the previous state
205                 of encode 0==idle, 1==encoding, 2==cancelled*/
206     int                            fEncodeState;
207         int                            currentScanCount;
208         NSString                      * currentSource;
209         HBOutputPanelController *outputPanel;
210         
211         BOOL                         startButtonEnabled;
212     BOOL                         pauseButtonEnabled;
213     BOOL                         AddToQueueButtonEnabled;
214         BOOL                         stopOrStart;
215         BOOL                         resumeOrPause;
216 }
217
218 - (void)     TranslateStrings;
219
220 - (void)     UpdateUI: (NSTimer *) timer;
221 - (void)     EnableUI: (bool) enable;
222 - (IBAction) ShowNewScan: (id) sender;
223 - (IBAction) ShowScanPanel: (id) sender;
224
225 - (IBAction) TitlePopUpChanged: (id) sender;
226 - (IBAction) ChapterPopUpChanged: (id) sender;
227
228 - (IBAction) FormatPopUpChanged: (id) sender;
229 - (IBAction) CodecsPopUpChanged: (id) sender;
230 - (IBAction) EncoderPopUpChanged: (id) sender;
231 - (IBAction) TwoPassCheckboxChanged: (id) sender;
232 - (IBAction) SetEnabledStateOfAudioMixdownControls: (id) sender;
233 - (IBAction) AddAllAudioTracksToPopUp: (id) sender;
234 - (IBAction) SelectAudioTrackInPopUp: (id) sender searchPrefixString: (NSString *) searchPrefixString selectIndexIfNotFound: (int) selectIndexIfNotFound;
235 - (IBAction) AudioTrackPopUpChanged: (id) sender;
236 - (IBAction) AudioTrackPopUpChanged: (id) sender mixdownToUse: (int) mixdownToUse;
237 - (IBAction) AudioTrackMixdownChanged: (id) sender;
238
239 - (IBAction) BrowseFile: (id) sender;
240 - (void)     BrowseFileDone: (NSSavePanel *) sheet
241     returnCode: (int) returnCode contextInfo: (void *) contextInfo;
242
243 - (IBAction) VideoMatrixChanged: (id) sender;
244 - (IBAction) QualitySliderChanged: (id) sender;
245
246 - (IBAction) ShowPicturePanel: (id) sender;
247 - (IBAction) CalculatePictureSizing: (id) sender;
248 - (IBAction) OpenMainWindow: (id) sender;
249
250 - (IBAction) AddToQueue: (id) sender;
251 - (IBAction) ShowQueuePanel: (id) sender;
252
253 - (IBAction) Rip: (id) sender;
254 - (void)     OverwriteAlertDone: (NSWindow *) sheet
255     returnCode: (int) returnCode contextInfo: (void *) contextInfo;
256 - (void)     UpdateAlertDone: (NSWindow *) sheet
257     returnCode: (int) returnCode contextInfo: (void *) contextInfo;
258 - (void)     _Rip;
259 - (IBAction) Cancel: (id) sender;
260 - (void)     _Cancel: (NSWindow *) sheet returnCode: (int) returnCode
261     contextInfo: (void *) contextInfo;
262 - (IBAction) Pause: (id) sender;
263
264 - (IBAction) CalculateBitrate: (id) sender;
265 - (void) controlTextDidBeginEditing: (NSNotification *) notification;
266 - (void) controlTextDidEndEditing: (NSNotification *) notification;
267 - (void) controlTextDidChange: (NSNotification *) notification;
268
269 - (IBAction) OpenHomepage: (id) sender;
270 - (IBAction) OpenForums:   (id) sender;
271 - (IBAction) OpenUserGuide:   (id) sender;
272
273 // x264 Advanced Panel Methods
274 - (IBAction) X264AdvancedOptionsSet: (id) sender;
275 - (IBAction) X264AdvancedOptionsStandardizeOptString: (id) sender;
276 - (IBAction) X264AdvancedOptionsSetCurrentSettings: (id) sender;
277 - (NSString *)  X264AdvancedOptionsStandardizeOptNames:(NSString *) cleanOptNameString;
278 - (IBAction) X264AdvancedOptionsChanged: (id) sender;
279
280 // Preset Methods Here
281 - (IBAction) CustomSettingUsed: (id) sender;
282 - (IBAction) ShowAddPresetPanel: (id) sender;
283 - (IBAction) CloseAddPresetPanel: (id) sender;
284 - (NSDictionary *)CreatePreset;
285 - (NSDictionary *)CreateIpodLowPreset;
286 - (NSDictionary *)CreateIpodHighPreset;
287 - (NSDictionary *)CreateAppleTVPreset;
288 - (NSDictionary *)CreatePSThreePreset;  
289 - (NSDictionary *)CreatePSPPreset;
290 - (NSDictionary *)CreateNormalPreset;
291 - (NSDictionary *)CreateClassicPreset;
292 - (NSDictionary *)CreateQuickTimePreset;
293 - (NSDictionary *)CreateFilmPreset;
294 - (NSDictionary *)CreateTelevisionPreset;
295 - (NSDictionary *)CreateAnimationPreset;
296 - (NSDictionary *)CreateBedlamPreset;
297 - (NSDictionary *)CreateiPhonePreset;
298 - (IBAction) RevertPictureSizeToMax:(id)sender;
299
300
301 - (void) savePreset;
302 - (IBAction)AddFactoryPresets:(id)sender;
303 - (IBAction)DeleteFactoryPresets:(id)sender;
304 - (IBAction)AddUserPreset:(id)sender;
305 - (void)AddPreset;
306 - (IBAction)InsertPreset:(id)sender;
307 - (IBAction)DeletePreset:(id)sender;
308 - (IBAction)tableViewSelected:(id)sender;
309 // NSTableDataSource methods
310 - (int)numberOfRowsInTableView:(NSTableView *)aTableView;
311 - (id)tableView:(NSTableView *)aTableView
312       objectValueForTableColumn:(NSTableColumn *)aTableColumn
313       row:(int)rowIndex;
314 - (void)tableView:(NSTableView *)aTableView
315         setObjectValue:(id)anObject
316         forTableColumn:(NSTableColumn *)aTableColumn
317         row:(int)rowIndex;
318 // To determine user presets cell display properties
319 - (void)tableView:(NSTableView *)aTableView
320                 willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn
321                  row:(int)rowIndex;
322
323 // Growl methods
324 - (NSDictionary *) registrationDictionaryForGrowl;
325 -(IBAction)showGrowlDoneNotification:(id)sender;
326 - (IBAction)showDebugOutputPanel:(id)sender;
327 - (void)setupToolbar;
328 @end
329