OSDN Git Service

1d64bc3c321e3d59ec59f6a69ae60fdddbe1faf8
[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 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         * fPicLabelSrcX;
100         IBOutlet NSTextField         * fPicLabelOutputX;
101         IBOutlet NSTextField         * fPicLabelAutoCrop;
102     IBOutlet NSTextField         * fPicLabelDetelecine;
103         IBOutlet NSTextField         * fPicLabelDeinterlace;
104     IBOutlet NSTextField         * fPicLabelDenoise;
105     IBOutlet NSTextField         * fPicLabelDeblock;
106         
107         IBOutlet NSTextField         * fPicSrcWidth;
108         IBOutlet NSTextField         * fPicSrcHeight;
109         IBOutlet NSTextField         * fPicSettingWidth;
110         IBOutlet NSTextField         * fPicSettingHeight;
111         IBOutlet NSTextField         * fPicSettingDeinterlace;
112         IBOutlet NSTextField         * fPicSettingARkeep;
113         IBOutlet NSTextField         * fPicSettingPAR;
114         IBOutlet NSTextField         * fPicSettingAutoCrop;
115         IBOutlet NSTextField         * fPicSettingDetelecine;
116         IBOutlet NSTextField         * fPicSettingDenoise;
117     IBOutlet NSTextField         * fPicSettingDeblock;
118
119         IBOutlet NSTextField         * fPicLabelAnamorphic;
120         IBOutlet NSTextField         * fPicLabelPAROutputX;
121         IBOutlet NSTextField         * fPicSettingPARWidth;
122         IBOutlet NSTextField         * fPicSettingPARHeight;
123     /* Picture variables */
124         int                        PicOrigOutputWidth;
125         int                        PicOrigOutputHeight;
126         int                        AutoCropTop;
127         int                        AutoCropBottom;
128         int                        AutoCropLeft;
129         int                        AutoCropRight;
130     /* Subtitles box */
131     IBOutlet NSTextField         * fSubField;
132     IBOutlet NSPopUpButton       * fSubPopUp;
133         IBOutlet NSButton            * fSubForcedCheck;
134         
135     /* Audio box */
136     IBOutlet NSTextField         * fAudLang1Field;
137     IBOutlet NSPopUpButton       * fAudLang1PopUp;
138     IBOutlet NSTextField         * fAudLang2Field;
139     IBOutlet NSPopUpButton       * fAudLang2PopUp;
140         /* New Audio Mix PopUps */
141         /* Track info */
142     IBOutlet NSTextField         * fAudTrack1MixLabel;
143         IBOutlet NSPopUpButton       * fAudTrack1MixPopUp;
144     IBOutlet NSTextField         * fAudTrack2MixLabel;
145         IBOutlet NSPopUpButton       * fAudTrack2MixPopUp;
146         
147     /* Quality info */
148         IBOutlet NSTextField         * fAudRateField;
149     IBOutlet NSPopUpButton       * fAudRatePopUp;
150     IBOutlet NSTextField         * fAudBitrateField;
151     IBOutlet NSPopUpButton       * fAudBitratePopUp;
152     /*Dynamic Range Compression */
153     IBOutlet NSSlider            * fAudDrcSlider;
154     IBOutlet NSTextField         * fAudDrcField;
155     IBOutlet NSTextField         * fAudDrcLabel;
156     
157     /* Chapters box */
158     IBOutlet NSButton            * fCreateChapterMarkers;
159     IBOutlet NSTableView         * fChapterTable;
160         ChapterTitles                * fChapterTitlesDelegate;
161         
162     /* Bottom */
163     IBOutlet NSButton            * fPictureButton;
164     IBOutlet NSTextField         * fStatusField;
165     IBOutlet NSProgressIndicator * fRipIndicator;
166         BOOL                           fRipIndicatorShown;
167     
168         /* User Preset variables here */
169         HBPresets                    * fPresetsBuiltin;
170         IBOutlet NSDrawer            * fPresetDrawer;
171         IBOutlet NSTextField         * fPresetNewName;
172         IBOutlet NSTextField         * fPresetNewDesc;
173         IBOutlet NSPopUpButton       * fPresetNewPicSettingsPopUp;
174     IBOutlet NSButton            * fPresetNewPicFiltersCheck;
175         IBOutlet NSTextField         * fPresetSelectedDisplay;
176         
177         NSString                     * AppSupportDirectory;
178         NSString                     * UserPresetsFile;
179         NSMutableArray               * UserPresets;
180         NSMutableArray               * UserPresetssortedArray;
181         NSMutableDictionary          * chosenPreset;
182     int                            curUserPresetChosenNum;
183          
184         int                            presetHbDefault; // this is 1 in "Default" preset key
185         int                            presetUserDefault;// this is 2 in "Default" preset key
186     IBOutlet NSPanel             * fAddPresetPanel;
187         /* new NSOutline View for the presets */
188     NSArray                      *fDraggedNodes;
189     IBOutlet NSOutlineView       * fPresetsOutlineView;
190     IBOutlet NSButton            * fPresetsAdd;
191         IBOutlet NSButton            * fPresetsDelete;
192     IBOutlet MVMenuButton        * fPresetsActionButton;
193     IBOutlet NSMenu              * fPresetsActionMenu;
194         
195     hb_handle_t                  * fHandle;
196         hb_title_t                   * fTitle;
197     /* integer to set to determine the previous state
198                 of encode 0==idle, 1==encoding, 2==cancelled*/
199     int                            fEncodeState;
200         int                            currentScanCount;
201         int                            currentSuccessfulScanCount;
202     BOOL                           SuccessfulScan;
203         NSString                      * currentSource;
204 }
205
206 - (IBAction) browseSources: (id) sender;
207 - (void) browseSourcesDone: (NSOpenPanel *) sheet
208                 returnCode: (int) returnCode contextInfo: (void *) contextInfo;
209 - (IBAction) showSourceTitleScanPanel: (id) sender;
210 - (IBAction) closeSourceTitleScanPanel: (id) sender;  
211 - (void) performScan:(NSString *) scanPath scanTitleNum: (int) scanTitleNum;
212 - (IBAction) showNewScan: (id) sender;
213
214 - (void)     TranslateStrings;
215
216 - (void)     updateUI: (NSTimer *) timer;
217 - (void)     enableUI: (bool) enable;
218
219 - (IBAction) titlePopUpChanged: (id) sender;
220 - (IBAction) chapterPopUpChanged: (id) sender;
221
222 - (IBAction) formatPopUpChanged: (id) sender;
223 - (IBAction) codecsPopUpChanged: (id) sender;
224 - (IBAction) encoderPopUpChanged: (id) sender;
225 - (IBAction) twoPassCheckboxChanged: (id) sender;
226 - (IBAction) videoFrameRateChanged: (id) sender;
227 - (IBAction) setEnabledStateOfAudioMixdownControls: (id) sender;
228 - (IBAction) addAllAudioTracksToPopUp: (id) sender;
229 - (IBAction) selectAudioTrackInPopUp: (id) sender searchPrefixString: (NSString *) searchPrefixString selectIndexIfNotFound: (int) selectIndexIfNotFound;
230 - (IBAction) audioTrackPopUpChanged: (id) sender;
231 - (IBAction) audioTrackPopUpChanged: (id) sender mixdownToUse: (int) mixdownToUse;
232 - (IBAction) audioTrackMixdownChanged: (id) sender;
233 - (IBAction) subtitleSelectionChanged: (id) sender;
234
235 - (IBAction) browseFile: (id) sender;
236 - (void)     browseFileDone: (NSSavePanel *) sheet
237                  returnCode: (int) returnCode contextInfo: (void *) contextInfo;
238
239 - (IBAction) videoMatrixChanged: (id) sender;
240 - (IBAction) qualitySliderChanged: (id) sender;
241 - (IBAction) audioDRCSliderChanged: (id) sender;
242
243 - (IBAction) showPicturePanel: (id) sender;
244 - (IBAction) calculatePictureSizing: (id) sender;
245 - (IBAction) openMainWindow: (id) sender;
246
247 - (IBAction) addToQueue: (id) sender;
248 - (void) overwriteAddToQueueAlertDone: (NSWindow *) sheet
249                            returnCode: (int) returnCode contextInfo: (void *) contextInfo;
250 - (void)     doAddToQueue;
251
252 - (IBAction) showQueueWindow:(id)sender;
253
254 - (IBAction)showPreferencesWindow:(id)sender;
255
256 - (IBAction) Rip: (id) sender;
257 - (void)     overWriteAlertDone: (NSWindow *) sheet
258                      returnCode: (int) returnCode contextInfo: (void *) contextInfo;
259 - (void)     updateAlertDone: (NSWindow *) sheet
260                   returnCode: (int) returnCode contextInfo: (void *) contextInfo;
261 - (void)     doRip;
262
263 - (IBAction) Cancel: (id) sender;
264 - (void)     doCancelCurrentJob;
265
266 - (IBAction) Pause: (id) sender;
267
268 - (IBAction) calculateBitrate: (id) sender;
269 - (void) controlTextDidChange: (NSNotification *) notification;
270
271 - (IBAction) openHomepage: (id) sender;
272 - (IBAction) openForums:   (id) sender;
273 - (IBAction) openUserGuide:   (id) sender;
274
275 // Preset Methods Here
276     
277 /* These are required by the NSOutlineView Datasource Delegate */
278 /* We use this to deterimine children of an item */
279 - (id)outlineView:(NSOutlineView *)fPresetsOutlineView child:(NSInteger)index ofItem:(id)item;
280 /* We use this to determine if an item should be expandable */
281 - (BOOL)outlineView:(NSOutlineView *)fPresetsOutlineView isItemExpandable:(id)item;
282 /* used to specify the number of levels to show for each item */
283 - (int)outlineView:(NSOutlineView *)fPresetsOutlineView numberOfChildrenOfItem:(id)item;
284 /* Used to tell the outline view which information is to be displayed per item */
285 - (id)outlineView:(NSOutlineView *)fPresetsOutlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
286 /* Use to customize the font and display characteristics of the title cell */
287 - (void)outlineView:(NSOutlineView *)fPresetsOutlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item;
288 /* We use this to edit the name field in the outline view */
289 - (void)outlineView:(NSOutlineView *)fPresetsOutlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
290 /* We use this to provide tooltips for the items in the presets outline view */
291 - (NSString *)outlineView:(NSOutlineView *)fPresetsOutlineView toolTipForCell:(NSCell *)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tc item:(id)item mouseLocation:(NSPoint)mouseLocation;
292
293 /* We use this to actually select the preset and act accordingly */
294 - (IBAction)selectPreset:(id)sender;    
295
296 /* Manage User presets */    
297 - (void) loadPresets;
298 - (IBAction) customSettingUsed: (id) sender;
299 - (IBAction) showAddPresetPanel: (id) sender;
300 - (IBAction) closeAddPresetPanel: (id) sender;
301 - (NSDictionary *)createPreset;
302
303 - (IBAction) revertPictureSizeToMax:(id)sender;
304
305 - (IBAction)setDefaultPreset:(id)sender;
306 - (IBAction)selectDefaultPreset:(id)sender;
307 - (void) savePreset;
308 - (IBAction)addFactoryPresets:(id)sender;
309 - (IBAction)deleteFactoryPresets:(id)sender;
310 - (IBAction)addUserPreset:(id)sender;
311 - (void)addPreset;
312 - (IBAction)insertPreset:(id)sender;
313 - (IBAction)deletePreset:(id)sender;
314 - (IBAction)getDefaultPresets:(id)sender;
315
316
317     // Growl methods
318 - (NSDictionary *) registrationDictionaryForGrowl;
319 -(IBAction)showGrowlDoneNotification:(id)sender;
320 - (IBAction)showDebugOutputPanel:(id)sender;
321 - (void)setupToolbar;
322
323 - (void) remindUserOfSleepOrShutdown;
324 @end
325