diff options
author | dynaflash <[email protected]> | 2007-08-19 04:17:38 +0000 |
---|---|---|
committer | dynaflash <[email protected]> | 2007-08-19 04:17:38 +0000 |
commit | 622d4cddab077306724f4ce7cbfb2661b77dbc0d (patch) | |
tree | da9775d8960f3a64b7a71eda7ac75635e3ad1a6e /macosx | |
parent | 27d687051da255d056ef0d77345e01d11c3cd815 (diff) |
MacGui: Added Main Menu commands, and set enabled states to prevent crashing due to conflicting commands.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@831 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/Controller.h | 14 | ||||
-rw-r--r-- | macosx/Controller.mm | 93 | ||||
-rw-r--r-- | macosx/English.lproj/MainMenu.nib/classes.nib | 10 | ||||
-rw-r--r-- | macosx/English.lproj/MainMenu.nib/info.nib | 9 | ||||
-rw-r--r-- | macosx/English.lproj/MainMenu.nib/keyedobjects.nib | bin | 138773 -> 135313 bytes |
5 files changed, 98 insertions, 28 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h index cbb0181d0..4c4d4b4dc 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -35,6 +35,20 @@ IBOutlet NSPanel * fQueuePanel; IBOutlet NSTextField * fQueueStatus; + /* Menu Items */ + /* File Menu */ + IBOutlet NSMenu * fMenuBarFileMenu; + IBOutlet NSMenuItem * fMenuOpenSource; + IBOutlet NSMenuItem * fMenuAddToQueue; + IBOutlet NSMenuItem * fMenuStartEncode; + IBOutlet NSMenuItem * fMenuPauseEncode; + /* Window Menu */ + IBOutlet NSMenu * fMenuBarWindowMenu; + IBOutlet NSMenuItem * fMenuPresetsDrawerToggle; + IBOutlet NSMenuItem * fMenuQueuePanelShow; + IBOutlet NSMenuItem * fMenuPicturePanelShow; + IBOutlet NSMenuItem * fMenuActivityWindowShow; + /* Source box */ IBOutlet NSProgressIndicator * fScanIndicator; NSString * sourceDisplayName; diff --git a/macosx/Controller.mm b/macosx/Controller.mm index 5fe74367b..efe815090 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -129,8 +129,14 @@ static NSString* ChooseSourceIdentifier = @"Choose Source Item Identifie - (void) awakeFromNib { [fWindow center]; - - [self TranslateStrings]; + /* set the main menu bar so it doesnt auto enable the menu items + so we can manually do it with setEnabled: This should be changed + to use validateUserInterfaceItem: along with setAutoEnablesItems: YES + in the next release */ + [fMenuBarFileMenu setAutoenablesItems: NO]; + [fMenuBarWindowMenu setAutoenablesItems: NO]; + [fMenuPauseEncode setEnabled: NO]; + [self TranslateStrings]; /* Initialize currentScanCount so HB can use it to evaluate successive scans */ currentScanCount = 0; @@ -656,15 +662,22 @@ list = hb_get_titles( fHandle ); int checkScanCount = hb_get_scancount( fHandle ); if (checkScanCount > currentScanCount) { - + currentScanCount = checkScanCount; - [fScanController Cancel: NULL]; - [fScanIndicator setIndeterminate: NO]; - [fScanIndicator setDoubleValue: 0.0]; - [fScanIndicator setHidden: YES]; - [fScanController Cancel: NULL]; - [self ShowNewScan: NULL]; - + [fScanController Cancel: NULL]; + [fScanIndicator setIndeterminate: NO]; + [fScanIndicator setDoubleValue: 0.0]; + [fScanIndicator setHidden: YES]; + [fScanController Cancel: NULL]; + /* Enable/Disable Menu Controls Accordingly */ + [fMenuOpenSource setEnabled: YES]; + [fMenuStartEncode setEnabled: YES]; + [fMenuAddToQueue setEnabled: YES]; + + [fMenuPicturePanelShow setEnabled: YES]; + [fMenuQueuePanelShow setEnabled: YES]; + [self ShowNewScan: NULL]; + } @@ -731,6 +744,10 @@ list = hb_get_titles( fHandle ); /* Update dock icon */ [self UpdateDockIcon: progress_total]; + /* Main Menu controls */ + [fMenuPauseEncode setTitle: @"Pause Encode"]; + [fMenuStartEncode setTitle: @"Cancel Encode"]; + /* new toolbar controls */ pauseButtonEnabled = YES; resumeOrPause = NO; @@ -758,20 +775,17 @@ list = hb_get_titles( fHandle ); /* Update dock icon */ [self UpdateDockIcon: 1.0]; - //[fPauseButton setEnabled: YES]; - //[fPauseButton setTitle: _( @"Pause" )]; - //[fRipButton setEnabled: YES]; - // [fRipButton setTitle: _( @"Cancel" )]; + break; } #undef p case HB_STATE_PAUSED: - //[fStatusField setStringValue: _( @"Paused" )]; - //[fPauseButton setEnabled: YES]; - //[fPauseButton setTitle: _( @"Resume" )]; - //[fRipButton setEnabled: YES]; - //[fRipButton setTitle: _( @"Cancel" )]; + [fStatusField setStringValue: _( @"Paused" )]; + + [fMenuPauseEncode setTitle: @"Resume Encode"]; + + /* new toolbar controls */ pauseButtonEnabled = YES; resumeOrPause = YES; @@ -784,8 +798,11 @@ list = hb_get_titles( fHandle ); [fStatusField setStringValue: _( @"Done." )]; [fRipIndicator setIndeterminate: NO]; [fRipIndicator setDoubleValue: 0.0]; - //[fRipButton setTitle: _( @"Start" )]; - + + /* Main Menu Controls*/ + [fMenuPauseEncode setTitle: @"Pause Encode"]; + [fMenuPauseEncode setEnabled: NO]; + [fMenuStartEncode setTitle: @"Start Encode"]; /* Restore dock icon */ [self UpdateDockIcon: -1.0]; @@ -1122,7 +1139,17 @@ list = hb_get_titles( fHandle ); - (IBAction) ShowScanPanel: (id) sender { - [fScanController Show]; + /* Enable/Disable Menu Controls Accordingly */ + [fMenuOpenSource setEnabled: NO]; + [fMenuStartEncode setEnabled: NO]; + [fMenuAddToQueue setEnabled: NO]; + + [fMenuPicturePanelShow setEnabled: NO]; + [fMenuQueuePanelShow setEnabled: NO]; + + + [fScanController Show]; + } - (IBAction) OpenMainWindow: (id) sender @@ -1220,7 +1247,15 @@ list = hb_get_titles( fHandle ); - (IBAction) ShowPicturePanel: (id) sender { - hb_list_t * list = hb_get_titles( fHandle ); + /* Enable/Disable Menu Controls Accordingly */ + [fMenuOpenSource setEnabled: NO]; + [fMenuStartEncode setEnabled: NO]; + [fMenuAddToQueue setEnabled: NO]; + + [fMenuPicturePanelShow setEnabled: NO]; + [fMenuQueuePanelShow setEnabled: NO]; + + hb_list_t * list = hb_get_titles( fHandle ); hb_title_t * title = (hb_title_t *) hb_list_item( list, [fSrcTitlePopUp indexOfSelectedItem] ); @@ -1237,6 +1272,15 @@ list = hb_get_titles( fHandle ); [NSApp runModalForWindow: fPicturePanel]; [NSApp endSheet: fPicturePanel]; [fPicturePanel orderOut: self]; + + /* Enable/Disable Menu Controls Accordingly */ + [fMenuOpenSource setEnabled: YES]; + [fMenuStartEncode setEnabled: YES]; + [fMenuAddToQueue setEnabled: YES]; + + [fMenuPicturePanelShow setEnabled: YES]; + [fMenuQueuePanelShow setEnabled: YES]; + [self CalculatePictureSizing: sender]; } @@ -1602,6 +1646,9 @@ list = hb_get_titles( fHandle ); // [fRipButton setEnabled: NO]; pauseButtonEnabled = NO; startButtonEnabled = NO; + + [fMenuPauseEncode setEnabled: YES]; + NSRect frame = [fWindow frame]; if (frame.size.width <= 591) frame.size.width = 591; diff --git a/macosx/English.lproj/MainMenu.nib/classes.nib b/macosx/English.lproj/MainMenu.nib/classes.nib index 103826ac3..2d93f6edd 100644 --- a/macosx/English.lproj/MainMenu.nib/classes.nib +++ b/macosx/English.lproj/MainMenu.nib/classes.nib @@ -78,6 +78,16 @@ fDstFormatField = NSTextField; fDstFormatPopUp = NSPopUpButton; fDstMpgLargeFileCheck = NSButton; + fMenuActivityWindowShow = NSMenuItem; + fMenuAddToQueue = NSMenuItem; + fMenuBarFileMenu = NSMenu; + fMenuBarWindowMenu = NSMenu; + fMenuOpenSource = NSMenuItem; + fMenuPauseEncode = NSMenuItem; + fMenuPicturePanelShow = NSMenuItem; + fMenuPresetsDrawerToggle = NSMenuItem; + fMenuQueuePanelShow = NSMenuItem; + fMenuStartEncode = NSMenuItem; fPicLabelAnamorphic = NSTextField; fPicLabelAr = NSTextField; fPicLabelDeinter = NSTextField; diff --git a/macosx/English.lproj/MainMenu.nib/info.nib b/macosx/English.lproj/MainMenu.nib/info.nib index bf5d039c3..1a4031744 100644 --- a/macosx/English.lproj/MainMenu.nib/info.nib +++ b/macosx/English.lproj/MainMenu.nib/info.nib @@ -3,15 +3,15 @@ <plist version="1.0"> <dict> <key>IBDocumentLocation</key> - <string>82 73 451 803 0 0 1440 878 </string> + <string>106 75 451 803 0 0 1440 878 </string> <key>IBEditorPositions</key> <dict> <key>1843</key> <string>540 238 200 530 0 0 1280 778 </string> <key>2436</key> - <string>268 316 192 68 0 0 1280 778 </string> + <string>307 361 192 68 0 0 1440 878 </string> <key>29</key> - <string>14 517 368 44 0 0 1280 778 </string> + <string>631 290 368 44 0 0 1440 878 </string> </dict> <key>IBFramework Version</key> <string>446.1</string> @@ -27,9 +27,8 @@ <integer>4</integer> <key>IBOpenObjects</key> <array> - <integer>29</integer> - <integer>21</integer> <integer>2436</integer> + <integer>29</integer> </array> <key>IBSystem Version</key> <string>8R2218</string> diff --git a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib Binary files differindex be194ed21..6d1c0a613 100644 --- a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib +++ b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib |