OSDN Git Service

Change the fifo size from being statically tuned for a Mac Pro with 4 CPUs to dynamic...
[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 #import <Cocoa/Cocoa.h>
8 #import <Growl/Growl.h>
9
10 #include "hb.h"
11
12 #import "ChapterTitles.h"
13 #import "PictureController.h"
14 #import "HBQueueController.h"
15 #import "MVMenuButton.h"
16 #import "HBAdvancedController.h"
17 #import "HBPreferencesController.h"
18
19 @class HBOutputPanelController;
20
21 @interface HBController : NSObject <GrowlApplicationBridgeDelegate>
22
23 {
24     IBOutlet NSWindow            * fWindow;
25     NSToolbar                    * toolbar;
26     
27     /* Picture panel */
28     PictureController            * fPictureController;
29     
30     /* Advanced options tab */
31     HBAdvancedController         * fAdvancedOptions;
32         IBOutlet NSBox               * fAdvancedView;
33
34     HBPreferencesController      * fPreferencesController;
35     
36     /* Queue panel */
37     HBQueueController            * fQueueController;
38     IBOutlet NSTextField         * fQueueStatus;
39     
40     /* Output panel */
41     HBOutputPanelController       *outputPanel;
42         
43     /* Source box */
44         IBOutlet NSProgressIndicator * fScanIndicator;
45         NSString                     * sourceDisplayName;
46     IBOutlet NSTextField         * fSrcDVD2Field;
47     IBOutlet NSTextField         * fSrcTitleField;
48     IBOutlet NSPopUpButton       * fSrcTitlePopUp;
49     IBOutlet NSTextField         * fSrcChapterField;
50     IBOutlet NSPopUpButton       * fSrcChapterStartPopUp;
51     IBOutlet NSTextField         * fSrcChapterToField;
52     IBOutlet NSPopUpButton       * fSrcChapterEndPopUp;
53     IBOutlet NSTextField         * fSrcDuration1Field;
54     IBOutlet NSTextField         * fSrcDuration2Field;
55         
56     /* Destination box */
57     IBOutlet NSTextField         * fDstFormatField;
58         IBOutlet NSPopUpButton       * fDstFormatPopUp;
59         IBOutlet NSButton            * fDstMpgLargeFileCheck;
60     IBOutlet NSTextField         * fDstCodecsField;
61     IBOutlet NSPopUpButton       * fDstCodecsPopUp;
62     IBOutlet NSTextField         * fDstFile1Field;
63     IBOutlet NSTextField         * fDstFile2Field;
64     IBOutlet NSButton            * fDstBrowseButton;
65         
66     /* Video box */
67     IBOutlet NSTextField         * fVidRateField;
68     IBOutlet NSPopUpButton       * fVidRatePopUp;
69     IBOutlet NSTextField         * fVidEncoderField;
70     IBOutlet NSPopUpButton       * fVidEncoderPopUp;
71     IBOutlet NSTextField         * fVidQualityField;
72     IBOutlet NSMatrix            * fVidQualityMatrix;
73     IBOutlet NSButtonCell        * fVidTargetCell;
74     IBOutlet NSTextField         * fVidTargetSizeField;
75     IBOutlet NSButtonCell        * fVidBitrateCell;
76     IBOutlet NSTextField         * fVidBitrateField;
77     IBOutlet NSButtonCell        * fVidConstantCell;
78     IBOutlet NSSlider            * fVidQualitySlider;
79     IBOutlet NSButton            * fVidGrayscaleCheck;
80     IBOutlet NSButton            * fVidTwoPassCheck;
81     IBOutlet NSButton            * fVidTurboPassCheck;
82         
83         /* Picture Settings box */
84         IBOutlet NSTextField         * fPicLabelSettings;
85         IBOutlet NSTextField         * fPicLabelSrc;
86         IBOutlet NSTextField         * fPicLabelOutp;
87         IBOutlet NSTextField         * fPicLabelAr;
88         IBOutlet NSTextField         * fPicLabelSrcX;
89         IBOutlet NSTextField         * fPicLabelOutputX;
90         IBOutlet NSTextField         * fPicLabelAutoCrop;
91     IBOutlet NSTextField         * fPicLabelDetelecine;
92         IBOutlet NSTextField         * fPicLabelDeinterlace;
93     IBOutlet NSTextField         * fPicLabelDenoise;
94         
95         IBOutlet NSTextField         * fPicSrcWidth;
96         IBOutlet NSTextField         * fPicSrcHeight;
97         IBOutlet NSTextField         * fPicSettingWidth;
98         IBOutlet NSTextField         * fPicSettingHeight;
99         IBOutlet NSTextField         * fPicSettingDeinterlace;
100         IBOutlet NSTextField         * fPicSettingARkeep;
101         IBOutlet NSTextField         * fPicSettingPAR;
102         IBOutlet NSTextField         * fPicSettingAutoCrop;
103         IBOutlet NSTextField         * fPicSettingDetelecine;
104         IBOutlet NSTextField         * fPicSettingDenoise;
105
106         IBOutlet NSTextField         * fPicLabelAnamorphic;
107         IBOutlet NSTextField         * fPicLabelPAROutputX;
108         IBOutlet NSTextField         * fPicSettingPARWidth;
109         IBOutlet NSTextField         * fPicSettingPARHeight;
110     /* Picture variables */
111         int                        PicOrigOutputWidth;
112         int                        PicOrigOutputHeight;
113         int                        AutoCropTop;
114         int                        AutoCropBottom;
115         int                        AutoCropLeft;
116         int                        AutoCropRight;
117     /* Subtitles box */
118     IBOutlet NSTextField         * fSubField;
119     IBOutlet NSPopUpButton       * fSubPopUp;
120         IBOutlet NSButton            * fSubForcedCheck;
121         
122     /* Audio box */
123     IBOutlet NSTextField         * fAudLang1Field;
124     IBOutlet NSPopUpButton       * fAudLang1PopUp;
125     IBOutlet NSTextField         * fAudLang2Field;
126     IBOutlet NSPopUpButton       * fAudLang2PopUp;
127         /* New Audio Mix PopUps */
128         IBOutlet NSTextField         * fAudTrack1MixLabel;
129         IBOutlet NSPopUpButton       * fAudTrack1MixPopUp;
130     IBOutlet NSTextField         * fAudTrack2MixLabel;
131         IBOutlet NSPopUpButton       * fAudTrack2MixPopUp;
132         
133         IBOutlet NSTextField         * fAudRateField;
134     IBOutlet NSPopUpButton       * fAudRatePopUp;
135     IBOutlet NSTextField         * fAudBitrateField;
136     IBOutlet NSPopUpButton       * fAudBitratePopUp;
137     
138     /* Chapters box */
139     IBOutlet NSButton            * fCreateChapterMarkers;
140     IBOutlet NSTableView         * fChapterTable;
141         ChapterTitles                * fChapterTitlesDelegate;
142         
143     /* Bottom */
144     IBOutlet NSButton            * fPictureButton;
145     IBOutlet NSTextField         * fStatusField;
146     IBOutlet NSProgressIndicator * fRipIndicator;
147         BOOL                           fRipIndicatorShown;
148     
149         /* User Preset variables here */
150         
151         IBOutlet NSDrawer            * fPresetDrawer;
152         IBOutlet NSTextField         * fPresetNewName;
153         IBOutlet NSTextField         * fPresetNewDesc;
154         IBOutlet NSPopUpButton       * fPresetNewPicSettingsPopUp;
155         IBOutlet NSTextField         * fPresetSelectedDisplay;
156         
157         NSString                     * AppSupportDirectory;
158         NSString                     * UserPresetsFile;
159         NSMutableArray               * UserPresets;
160         NSMutableArray               * UserPresetssortedArray;
161         NSMutableDictionary          * chosenPreset;
162     int                            curUserPresetChosenNum;
163          
164         int                            presetHbDefault; // this is 1 in "Default" preset key
165         int                            presetUserDefault;// this is 2 in "Default" preset key
166     IBOutlet NSPanel             * fAddPresetPanel;
167         IBOutlet NSTableView         * tableView;
168         IBOutlet NSButton            * fPresetsAdd;
169         IBOutlet NSButton            * fPresetsDelete;
170     IBOutlet MVMenuButton        * fPresetsActionButton;
171     IBOutlet NSMenu              * fPresetsActionMenu;
172         
173     hb_handle_t                  * fHandle;
174         hb_title_t                   * fTitle;
175     /* integer to set to determine the previous state
176                 of encode 0==idle, 1==encoding, 2==cancelled*/
177     int                            fEncodeState;
178         int                            currentScanCount;
179         int                            currentSuccessfulScanCount;
180     BOOL                           SuccessfulScan;
181         NSString                      * currentSource;
182 }
183
184 - (void)     TranslateStrings;
185
186 - (void)     updateUI: (NSTimer *) timer;
187 - (void)     enableUI: (bool) enable;
188 - (IBAction) showNewScan: (id) sender;
189 - (IBAction) showScanPanel: (id) sender;
190 - (IBAction) browseSources: (id) sender;
191 - (void) browseSourcesDone: (NSOpenPanel *) sheet
192     returnCode: (int) returnCode contextInfo: (void *) contextInfo;
193     
194 - (IBAction) titlePopUpChanged: (id) sender;
195 - (IBAction) chapterPopUpChanged: (id) sender;
196
197 - (IBAction) formatPopUpChanged: (id) sender;
198 - (IBAction) codecsPopUpChanged: (id) sender;
199 - (IBAction) encoderPopUpChanged: (id) sender;
200 - (IBAction) twoPassCheckboxChanged: (id) sender;
201 - (IBAction) videoFrameRateChanged: (id) sender;
202 - (IBAction) setEnabledStateOfAudioMixdownControls: (id) sender;
203 - (IBAction) addAllAudioTracksToPopUp: (id) sender;
204 - (IBAction) selectAudioTrackInPopUp: (id) sender searchPrefixString: (NSString *) searchPrefixString selectIndexIfNotFound: (int) selectIndexIfNotFound;
205 - (IBAction) audioTrackPopUpChanged: (id) sender;
206 - (IBAction) audioTrackPopUpChanged: (id) sender mixdownToUse: (int) mixdownToUse;
207 - (IBAction) audioTrackMixdownChanged: (id) sender;
208 - (IBAction) subtitleSelectionChanged: (id) sender;
209
210 - (IBAction) browseFile: (id) sender;
211 - (void)     browseFileDone: (NSSavePanel *) sheet
212     returnCode: (int) returnCode contextInfo: (void *) contextInfo;
213
214 - (IBAction) videoMatrixChanged: (id) sender;
215 - (IBAction) qualitySliderChanged: (id) sender;
216
217 - (IBAction) showPicturePanel: (id) sender;
218 - (IBAction) calculatePictureSizing: (id) sender;
219 - (IBAction) openMainWindow: (id) sender;
220
221 - (IBAction) addToQueue: (id) sender;
222 - (void) overwriteAddToQueueAlertDone: (NSWindow *) sheet
223     returnCode: (int) returnCode contextInfo: (void *) contextInfo;
224 - (void)     doAddToQueue;
225
226 - (IBAction) showQueueWindow:(id)sender;
227
228 - (IBAction)showPreferencesWindow:(id)sender;
229
230 - (IBAction) Rip: (id) sender;
231 - (void)     overWriteAlertDone: (NSWindow *) sheet
232     returnCode: (int) returnCode contextInfo: (void *) contextInfo;
233 - (void)     updateAlertDone: (NSWindow *) sheet
234     returnCode: (int) returnCode contextInfo: (void *) contextInfo;
235 - (void)     doRip;
236
237 - (IBAction) Cancel: (id) sender;
238 - (void)     doCancelCurrentJob;
239
240 - (IBAction) Pause: (id) sender;
241
242 - (IBAction) calculateBitrate: (id) sender;
243 - (void) controlTextDidChange: (NSNotification *) notification;
244
245 - (IBAction) openHomepage: (id) sender;
246 - (IBAction) openForums:   (id) sender;
247 - (IBAction) openUserGuide:   (id) sender;
248
249 // Preset Methods Here
250 - (void) loadPresets;
251 - (IBAction) customSettingUsed: (id) sender;
252 - (IBAction) showAddPresetPanel: (id) sender;
253 - (IBAction) closeAddPresetPanel: (id) sender;
254 - (NSDictionary *)createPreset;
255 - (NSDictionary *)createIpodLowPreset;
256 - (NSDictionary *)createIpodHighPreset;
257 - (NSDictionary *)createAppleTVPreset;
258 - (NSDictionary *)createPSThreePreset;  
259 - (NSDictionary *)createPSPPreset;
260 - (NSDictionary *)createNormalPreset;
261 - (NSDictionary *)createClassicPreset;
262 - (NSDictionary *)createQuickTimePreset;
263 - (NSDictionary *)createFilmPreset;
264 - (NSDictionary *)createTelevisionPreset;
265 - (NSDictionary *)createAnimationPreset;
266 - (NSDictionary *)createBedlamPreset;
267 - (NSDictionary *)createiPhonePreset;
268 - (NSDictionary *)createDeuxSixQuatrePreset;
269 - (NSDictionary *)createBrokePreset;
270 - (NSDictionary *)createBlindPreset;
271 - (NSDictionary *)createCRFPreset;
272
273 - (IBAction) revertPictureSizeToMax:(id)sender;
274
275 - (IBAction)setDefaultPreset:(id)sender;
276 - (IBAction)selectDefaultPreset:(id)sender;
277 - (void) savePreset;
278 - (IBAction)addFactoryPresets:(id)sender;
279 - (IBAction)deleteFactoryPresets:(id)sender;
280 - (IBAction)addUserPreset:(id)sender;
281 - (void)addPreset;
282 - (IBAction)insertPreset:(id)sender;
283 - (IBAction)deletePreset:(id)sender;
284 - (IBAction)getDefaultPresets:(id)sender;
285 - (IBAction)tableViewSelected:(id)sender;
286
287 // NSTableDataSource methods
288 - (int)numberOfRowsInTableView:(NSTableView *)aTableView;
289 - (id)tableView:(NSTableView *)aTableView
290       objectValueForTableColumn:(NSTableColumn *)aTableColumn
291       row:(int)rowIndex;
292 - (void)tableView:(NSTableView *)aTableView
293         setObjectValue:(id)anObject
294         forTableColumn:(NSTableColumn *)aTableColumn
295         row:(int)rowIndex;
296 // To determine user presets cell display properties
297 - (void)tableView:(NSTableView *)aTableView
298                 willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn
299                  row:(int)rowIndex;
300
301 // Growl methods
302 - (NSDictionary *) registrationDictionaryForGrowl;
303 -(IBAction)showGrowlDoneNotification:(id)sender;
304 - (IBAction)showDebugOutputPanel:(id)sender;
305 - (void)setupToolbar;
306
307 - (void) remindUserOfSleepOrShutdown;
308 @end
309