OSDN Git Service

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