OSDN Git Service

WinGui:
[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 #import "HBPresets.h"
19 @class HBOutputPanelController;
20
21 @interface HBController : NSObject <GrowlApplicationBridgeDelegate>
22
23 {
24     IBOutlet NSWindow            * fWindow;
25     NSToolbar                    * toolbar;
26     
27     /* Main Menu Outlets */
28     NSMenuItem                   * fOpenSourceTitleMMenu;
29     
30     /* Source Title Scan Outlets */
31     IBOutlet NSPanel              * fScanSrcTitlePanel;
32     IBOutlet NSTextField          * fScanSrcTitlePathField;
33     IBOutlet NSTextField          * fSrcDsplyNameTitleScan;
34     IBOutlet NSTextField          * fScanSrcTitleNumField;
35     IBOutlet NSButton             * fScanSrcTitleCancelButton;
36     IBOutlet NSButton             * fScanSrcTitleOpenButton;
37     
38     /* Picture panel */
39     PictureController            * fPictureController;
40     
41     /* Advanced options tab */
42     HBAdvancedController         * fAdvancedOptions;
43         IBOutlet NSBox               * fAdvancedView;
44     
45     HBPreferencesController      * fPreferencesController;
46     
47     /* Queue panel */
48     HBQueueController            * fQueueController;
49     IBOutlet NSTextField         * fQueueStatus;
50     
51     /* Output panel */
52     HBOutputPanelController       *outputPanel;
53         
54     /* Source box */
55         IBOutlet NSProgressIndicator * fScanIndicator;
56         NSString                     * sourceDisplayName;
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 NSTextField         * fDstCodecsField;
71     IBOutlet NSPopUpButton       * fDstCodecsPopUp;
72     IBOutlet NSTextField         * fDstFile1Field;
73     IBOutlet NSTextField         * fDstFile2Field;
74     IBOutlet NSButton            * fDstBrowseButton;
75     /* MP4 Options */
76     // Creates 64 bit mp4's that allow file sizes over 4gb
77     IBOutlet NSButton            * fDstMp4LargeFileCheck;
78     // Optimizes mp4's for http
79     IBOutlet NSButton            * fDstMp4HttpOptFileCheck;
80         
81     /* Video box */
82     IBOutlet NSTextField         * fVidRateField;
83     IBOutlet NSPopUpButton       * fVidRatePopUp;
84     IBOutlet NSTextField         * fVidEncoderField;
85     IBOutlet NSPopUpButton       * fVidEncoderPopUp;
86     IBOutlet NSTextField         * fVidQualityField;
87     IBOutlet NSMatrix            * fVidQualityMatrix;
88     IBOutlet NSButtonCell        * fVidTargetCell;
89     IBOutlet NSTextField         * fVidTargetSizeField;
90     IBOutlet NSButtonCell        * fVidBitrateCell;
91     IBOutlet NSTextField         * fVidBitrateField;
92     IBOutlet NSButtonCell        * fVidConstantCell;
93     IBOutlet NSSlider            * fVidQualitySlider;
94     IBOutlet NSButton            * fVidGrayscaleCheck;
95     IBOutlet NSButton            * fVidTwoPassCheck;
96     IBOutlet NSButton            * fVidTurboPassCheck;
97         
98         /* Picture Settings box */
99         IBOutlet NSTextField         * fPicLabelSettings;
100         IBOutlet NSTextField         * fPicLabelSrc;
101     IBOutlet NSTextField         * fPicSettingsSrc;
102         IBOutlet NSTextField         * fPicLabelOutp;
103     IBOutlet NSTextField         * fPicSettingsOutp;
104     IBOutlet NSTextField         * fPicLabelAnamorphic;
105     IBOutlet NSTextField         * fPicSettingsAnamorphic;
106     
107     IBOutlet NSTextField         * fPicLabelAr;
108         IBOutlet NSTextField         * fPicLabelAutoCrop;
109     IBOutlet NSTextField         * fPicLabelDetelecine;
110         IBOutlet NSTextField         * fPicLabelDeinterlace;
111     IBOutlet NSTextField         * fPicLabelDenoise;
112     IBOutlet NSTextField         * fPicLabelDeblock;
113         IBOutlet NSTextField         * fPicSettingDeinterlace;
114         IBOutlet NSTextField         * fPicSettingARkeep;
115         IBOutlet NSTextField         * fPicSettingPAR;
116         IBOutlet NSTextField         * fPicSettingAutoCrop;
117         IBOutlet NSTextField         * fPicSettingDetelecine;
118         IBOutlet NSTextField         * fPicSettingDenoise;
119     IBOutlet NSTextField         * fPicSettingDeblock;
120         
121         /* Picture variables */
122         int                        PicOrigOutputWidth;
123         int                        PicOrigOutputHeight;
124         int                        AutoCropTop;
125         int                        AutoCropBottom;
126         int                        AutoCropLeft;
127         int                        AutoCropRight;
128     /* Subtitles box */
129     IBOutlet NSTextField         * fSubField;
130     IBOutlet NSPopUpButton       * fSubPopUp;
131         IBOutlet NSButton            * fSubForcedCheck;
132         
133     /* Audio box */
134     IBOutlet NSTextField         * fAudLang1Field;
135     IBOutlet NSPopUpButton       * fAudLang1PopUp;
136     IBOutlet NSTextField         * fAudLang2Field;
137     IBOutlet NSPopUpButton       * fAudLang2PopUp;
138         /* New Audio Mix PopUps */
139         /* Track info */
140     IBOutlet NSTextField         * fAudTrack1MixLabel;
141         IBOutlet NSPopUpButton       * fAudTrack1MixPopUp;
142     IBOutlet NSTextField         * fAudTrack2MixLabel;
143         IBOutlet NSPopUpButton       * fAudTrack2MixPopUp;
144         
145     /* Quality info */
146         IBOutlet NSTextField         * fAudRateField;
147     IBOutlet NSPopUpButton       * fAudRatePopUp;
148     IBOutlet NSTextField         * fAudBitrateField;
149     IBOutlet NSPopUpButton       * fAudBitratePopUp;
150     /*Dynamic Range Compression */
151     IBOutlet NSSlider            * fAudDrcSlider;
152     IBOutlet NSTextField         * fAudDrcField;
153     IBOutlet NSTextField         * fAudDrcLabel;
154     IBOutlet NSTextField         * fAudDrcDescLabel1;
155     IBOutlet NSTextField         * fAudDrcDescLabel2;
156     IBOutlet NSTextField         * fAudDrcDescLabel3;
157     IBOutlet NSTextField         * fAudDrcDescLabel4;
158     
159     /* Chapters box */
160     IBOutlet NSButton            * fCreateChapterMarkers;
161     IBOutlet NSTableView         * fChapterTable;
162         ChapterTitles                * fChapterTitlesDelegate;
163         
164     /* Bottom */
165     IBOutlet NSButton            * fPictureButton;
166     IBOutlet NSTextField         * fStatusField;
167     IBOutlet NSProgressIndicator * fRipIndicator;
168         BOOL                           fRipIndicatorShown;
169     
170         /* User Preset variables here */
171         HBPresets                    * fPresetsBuiltin;
172         IBOutlet NSDrawer            * fPresetDrawer;
173         IBOutlet NSTextField         * fPresetNewName;
174         IBOutlet NSTextField         * fPresetNewDesc;
175         IBOutlet NSPopUpButton       * fPresetNewPicSettingsPopUp;
176     IBOutlet NSButton            * fPresetNewPicFiltersCheck;
177         IBOutlet NSTextField         * fPresetSelectedDisplay;
178         
179         NSString                     * AppSupportDirectory;
180         NSString                     * UserPresetsFile;
181         NSMutableArray               * UserPresets;
182         NSMutableArray               * UserPresetssortedArray;
183         NSMutableDictionary          * chosenPreset;
184     int                            curUserPresetChosenNum;
185          
186         int                            presetHbDefault; // this is 1 in "Default" preset key
187         int                            presetUserDefault;// this is 2 in "Default" preset key
188     IBOutlet NSPanel             * fAddPresetPanel;
189         /* new NSOutline View for the presets */
190     NSArray                      *fDraggedNodes;
191     IBOutlet NSOutlineView       * fPresetsOutlineView;
192     IBOutlet NSButton            * fPresetsAdd;
193         IBOutlet NSButton            * fPresetsDelete;
194     IBOutlet MVMenuButton        * fPresetsActionButton;
195     IBOutlet NSMenu              * fPresetsActionMenu;
196         
197     hb_handle_t                  * fHandle;
198         hb_title_t                   * fTitle;
199     /* integer to set to determine the previous state
200                 of encode 0==idle, 1==encoding, 2==cancelled*/
201     int                            fEncodeState;
202         int                            currentScanCount;
203         int                            currentSuccessfulScanCount;
204     BOOL                           SuccessfulScan;
205         NSString                      * currentSource;
206 }
207
208 - (IBAction) browseSources: (id) sender;
209 - (void) browseSourcesDone: (NSOpenPanel *) sheet
210                 returnCode: (int) returnCode contextInfo: (void *) contextInfo;
211 - (IBAction) showSourceTitleScanPanel: (id) sender;
212 - (IBAction) closeSourceTitleScanPanel: (id) sender;  
213 - (void) performScan:(NSString *) scanPath scanTitleNum: (int) scanTitleNum;
214 - (IBAction) showNewScan: (id) sender;
215
216 - (void)     TranslateStrings;
217
218 - (void)     updateUI: (NSTimer *) timer;
219 - (void)     enableUI: (bool) enable;
220
221 - (IBAction) titlePopUpChanged: (id) sender;
222 - (IBAction) chapterPopUpChanged: (id) sender;
223
224 - (IBAction) formatPopUpChanged: (id) sender;
225 - (IBAction) codecsPopUpChanged: (id) sender;
226 - (IBAction) encoderPopUpChanged: (id) sender;
227 - (IBAction) twoPassCheckboxChanged: (id) sender;
228 - (IBAction) videoFrameRateChanged: (id) sender;
229 - (IBAction) setEnabledStateOfAudioMixdownControls: (id) sender;
230 - (IBAction) addAllAudioTracksToPopUp: (id) sender;
231 - (IBAction) selectAudioTrackInPopUp: (id) sender searchPrefixString: (NSString *) searchPrefixString selectIndexIfNotFound: (int) selectIndexIfNotFound;
232 - (IBAction) audioTrackPopUpChanged: (id) sender;
233 - (IBAction) audioTrackPopUpChanged: (id) sender mixdownToUse: (int) mixdownToUse;
234 - (IBAction) audioTrackMixdownChanged: (id) sender;
235 - (IBAction) subtitleSelectionChanged: (id) sender;
236
237 - (IBAction) browseFile: (id) sender;
238 - (void)     browseFileDone: (NSSavePanel *) sheet
239                  returnCode: (int) returnCode contextInfo: (void *) contextInfo;
240
241 - (IBAction) videoMatrixChanged: (id) sender;
242 - (IBAction) qualitySliderChanged: (id) sender;
243 - (IBAction) audioDRCSliderChanged: (id) sender;
244
245 - (IBAction) showPicturePanel: (id) sender;
246 - (IBAction) calculatePictureSizing: (id) sender;
247 - (IBAction) openMainWindow: (id) sender;
248
249 - (IBAction) addToQueue: (id) sender;
250 - (void) overwriteAddToQueueAlertDone: (NSWindow *) sheet
251                            returnCode: (int) returnCode contextInfo: (void *) contextInfo;
252 - (void)     doAddToQueue;
253
254 - (IBAction) showQueueWindow:(id)sender;
255
256 - (IBAction)showPreferencesWindow:(id)sender;
257
258 - (IBAction) Rip: (id) sender;
259 - (void)     overWriteAlertDone: (NSWindow *) sheet
260                      returnCode: (int) returnCode contextInfo: (void *) contextInfo;
261 - (void)     updateAlertDone: (NSWindow *) sheet
262                   returnCode: (int) returnCode contextInfo: (void *) contextInfo;
263 - (void)     doRip;
264
265 - (IBAction) Cancel: (id) sender;
266 - (void)     doCancelCurrentJob;
267
268 - (IBAction) Pause: (id) sender;
269
270 - (IBAction) calculateBitrate: (id) sender;
271 - (void) controlTextDidChange: (NSNotification *) notification;
272
273 - (IBAction) openHomepage: (id) sender;
274 - (IBAction) openForums:   (id) sender;
275 - (IBAction) openUserGuide:   (id) sender;
276
277 // Preset Methods Here
278     
279 /* These are required by the NSOutlineView Datasource Delegate */
280 /* We use this to deterimine children of an item */
281 - (id)outlineView:(NSOutlineView *)fPresetsOutlineView child:(NSInteger)index ofItem:(id)item;
282 /* We use this to determine if an item should be expandable */
283 - (BOOL)outlineView:(NSOutlineView *)fPresetsOutlineView isItemExpandable:(id)item;
284 /* used to specify the number of levels to show for each item */
285 - (int)outlineView:(NSOutlineView *)fPresetsOutlineView numberOfChildrenOfItem:(id)item;
286 /* Used to tell the outline view which information is to be displayed per item */
287 - (id)outlineView:(NSOutlineView *)fPresetsOutlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
288 /* Use to customize the font and display characteristics of the title cell */
289 - (void)outlineView:(NSOutlineView *)fPresetsOutlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item;
290 /* We use this to edit the name field in the outline view */
291 - (void)outlineView:(NSOutlineView *)fPresetsOutlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
292 /* We use this to provide tooltips for the items in the presets outline view */
293 - (NSString *)outlineView:(NSOutlineView *)fPresetsOutlineView toolTipForCell:(NSCell *)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tc item:(id)item mouseLocation:(NSPoint)mouseLocation;
294
295 /* We use this to actually select the preset and act accordingly */
296 - (IBAction)selectPreset:(id)sender;    
297
298 /* Manage User presets */    
299 - (void) loadPresets;
300 - (IBAction) customSettingUsed: (id) sender;
301 - (IBAction) showAddPresetPanel: (id) sender;
302 - (IBAction) closeAddPresetPanel: (id) sender;
303 - (NSDictionary *)createPreset;
304
305 - (IBAction) revertPictureSizeToMax:(id)sender;
306
307 - (IBAction)setDefaultPreset:(id)sender;
308 - (IBAction)selectDefaultPreset:(id)sender;
309 - (void) savePreset;
310 - (IBAction)addFactoryPresets:(id)sender;
311 - (IBAction)deleteFactoryPresets:(id)sender;
312 - (IBAction)addUserPreset:(id)sender;
313 - (void)addPreset;
314 - (IBAction)insertPreset:(id)sender;
315 - (IBAction)deletePreset:(id)sender;
316 - (IBAction)getDefaultPresets:(id)sender;
317
318
319     // Growl methods
320 - (NSDictionary *) registrationDictionaryForGrowl;
321 -(IBAction)showGrowlDoneNotification:(id)sender;
322 - (IBAction)showDebugOutputPanel:(id)sender;
323 - (void)setupToolbar;
324
325 - (void) remindUserOfSleepOrShutdown;
326 @end
327