Cocoa Port:

- Fix bug where using an input mapped Set Speed control did not properly reset the execution speed if the Set Speed Limit slider was previously used.
- Move the display window related methods from the EmuControllerDelegate to DisplayWindowController.
This commit is contained in:
rogerman 2013-05-05 05:44:47 +00:00
parent 5b6ab8049e
commit bd55aae699
7 changed files with 2614 additions and 567 deletions

View File

@ -315,6 +315,7 @@
<string key="NSFrame">{{2, 3}, {16, 16}}</string>
<reference key="NSSuperview" ref="1027645320"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="731708450"/>
<int key="NSpiFlags">28938</int>
<double key="NSMaxValue">100</double>
</object>
@ -336,6 +337,7 @@
<string key="NSFrame">{{160, 1}, {20, 20}}</string>
<reference key="NSSuperview" ref="1027645320"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="710507134"/>
<bool key="NSEnabled">YES</bool>
<object class="NSImageCell" key="NSCell" id="1028721215">
<int key="NSCellFlags">134217728</int>
@ -358,6 +360,7 @@
<string key="NSFrame">{{17, 5}, {137, 14}}</string>
<reference key="NSSuperview" ref="1027645320"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="323138602"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="644649254">
<int key="NSCellFlags">68157504</int>
@ -397,6 +400,7 @@
<string key="NSFrame">{{0, 24}, {256, 384}}</string>
<reference key="NSSuperview" ref="1027645320"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="963885183"/>
<bool key="NSViewCanDrawConcurrently">YES</bool>
<string key="NSClassName">DisplayView</string>
</object>
@ -427,6 +431,7 @@
<string key="NSFrameSize">{256, 408}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="740908585"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
<string key="NSMinSize">{256, 477}</string>
@ -566,14 +571,6 @@
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="418996424"/>
</object>
<int key="connectionID">22</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">changeCoreSpeed:</string>
@ -646,6 +643,14 @@
</object>
<int key="connectionID">108</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="418996424"/>
</object>
<int key="connectionID">109</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
@ -1170,7 +1175,7 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">108</int>
<int key="maxID">109</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@ -1191,7 +1196,13 @@
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>changeCoreSpeed:</string>
<string>changeDisplayGap:</string>
<string>changeDisplayMode:</string>
<string>changeDisplayOrder:</string>
<string>changeDisplayOrientation:</string>
<string>changeRotation:</string>
<string>changeRotationRelative:</string>
<string>changeScale:</string>
<string>changeVolume:</string>
<string>copy:</string>
<string>openRom:</string>
@ -1200,6 +1211,10 @@
<string>toggleExecutePause:</string>
<string>toggleKeepMinDisplaySizeAtNormal:</string>
<string>toggleStatusBar:</string>
<string>writeDefaultsDisplayGap:</string>
<string>writeDefaultsDisplayRotation:</string>
<string>writeDefaultsDisplayVideoSettings:</string>
<string>writeDefaultsHUDSettings:</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@ -1213,6 +1228,16 @@
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
@ -1220,7 +1245,13 @@
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>changeCoreSpeed:</string>
<string>changeDisplayGap:</string>
<string>changeDisplayMode:</string>
<string>changeDisplayOrder:</string>
<string>changeDisplayOrientation:</string>
<string>changeRotation:</string>
<string>changeRotationRelative:</string>
<string>changeScale:</string>
<string>changeVolume:</string>
<string>copy:</string>
<string>openRom:</string>
@ -1229,6 +1260,10 @@
<string>toggleExecutePause:</string>
<string>toggleKeepMinDisplaySizeAtNormal:</string>
<string>toggleStatusBar:</string>
<string>writeDefaultsDisplayGap:</string>
<string>writeDefaultsDisplayRotation:</string>
<string>writeDefaultsDisplayVideoSettings:</string>
<string>writeDefaultsHUDSettings:</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@ -1236,10 +1271,34 @@
<string key="name">changeCoreSpeed:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">changeDisplayGap:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">changeDisplayMode:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">changeDisplayOrder:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">changeDisplayOrientation:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">changeRotation:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">changeRotationRelative:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">changeScale:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">changeVolume:</string>
<string key="candidateClassName">id</string>
@ -1272,6 +1331,22 @@
<string key="name">toggleStatusBar:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">writeDefaultsDisplayGap:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">writeDefaultsDisplayRotation:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">writeDefaultsDisplayVideoSettings:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">writeDefaultsHUDSettings:</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">

File diff suppressed because it is too large Load Diff

View File

@ -161,7 +161,20 @@
- (IBAction) reset:(id)sender;
- (IBAction) changeCoreSpeed:(id)sender;
- (IBAction) openRom:(id)sender;
- (IBAction) changeRotationRelative:(id)sender;
- (IBAction) saveScreenshotAs:(id)sender;
// View Menu
- (IBAction) changeScale:(id)sender;
- (IBAction) changeRotation:(id)sender;
- (IBAction) changeRotationRelative:(id)sender;
- (IBAction) changeDisplayMode:(id)sender;
- (IBAction) changeDisplayOrientation:(id)sender;
- (IBAction) changeDisplayOrder:(id)sender;
- (IBAction) changeDisplayGap:(id)sender;
- (IBAction) writeDefaultsDisplayRotation:(id)sender;
- (IBAction) writeDefaultsDisplayGap:(id)sender;
- (IBAction) writeDefaultsHUDSettings:(id)sender;
- (IBAction) writeDefaultsDisplayVideoSettings:(id)sender;
@end

View File

@ -704,12 +704,6 @@ enum OGLVertexAttributeID
[emuControl openRom:sender];
}
- (IBAction) changeRotationRelative:(id)sender
{
const double angleDegrees = [self displayRotation] + (double)[CocoaDSUtil getIBActionSenderTag:sender];
[self setDisplayRotation:angleDegrees];
}
- (IBAction) saveScreenshotAs:(id)sender
{
[emuControl pauseCore];
@ -730,6 +724,211 @@ enum OGLVertexAttributeID
}
}
- (IBAction) changeScale:(id)sender
{
[self setDisplayScale:(double)[CocoaDSUtil getIBActionSenderTag:sender] / 100.0];
}
- (IBAction) changeRotation:(id)sender
{
// Get the rotation value from the sender.
if ([sender isMemberOfClass:[NSSlider class]])
{
[self setDisplayRotation:[(NSSlider *)sender doubleValue]];
}
else
{
[self setDisplayRotation:(double)[CocoaDSUtil getIBActionSenderTag:sender]];
}
}
- (IBAction) changeRotationRelative:(id)sender
{
const double angleDegrees = [self displayRotation] + (double)[CocoaDSUtil getIBActionSenderTag:sender];
[self setDisplayRotation:angleDegrees];
}
- (IBAction) changeDisplayMode:(id)sender
{
const NSInteger newDisplayModeID = [CocoaDSUtil getIBActionSenderTag:sender];
if (newDisplayModeID == [self displayMode])
{
return;
}
[self setDisplayMode:newDisplayModeID];
}
- (IBAction) changeDisplayOrientation:(id)sender
{
const NSInteger newDisplayOrientation = [CocoaDSUtil getIBActionSenderTag:sender];
if (newDisplayOrientation == [self displayOrientation])
{
return;
}
[self setDisplayOrientation:newDisplayOrientation];
}
- (IBAction) changeDisplayOrder:(id)sender
{
[self setDisplayOrder:[CocoaDSUtil getIBActionSenderTag:sender]];
}
- (IBAction) changeDisplayGap:(id)sender
{
[self setDisplayGap:(double)[CocoaDSUtil getIBActionSenderTag:sender] / 100.0];
}
- (IBAction) writeDefaultsDisplayRotation:(id)sender
{
[[NSUserDefaults standardUserDefaults] setDouble:[self displayRotation] forKey:@"DisplayView_Rotation"];
}
- (IBAction) writeDefaultsDisplayGap:(id)sender
{
[[NSUserDefaults standardUserDefaults] setDouble:([self displayGap] * 100.0) forKey:@"DisplayViewCombo_Gap"];
}
- (IBAction) writeDefaultsHUDSettings:(id)sender
{
// TODO: Not implemented.
}
- (IBAction) writeDefaultsDisplayVideoSettings:(id)sender
{
[[NSUserDefaults standardUserDefaults] setInteger:[self videoFilterType] forKey:@"DisplayView_VideoFilter"];
[[NSUserDefaults standardUserDefaults] setBool:[self useBilinearOutput] forKey:@"DisplayView_UseBilinearOutput"];
[[NSUserDefaults standardUserDefaults] setBool:[self useVerticalSync] forKey:@"DisplayView_UseVerticalSync"];
}
#pragma mark NSUserInterfaceValidations Protocol
- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)theItem
{
BOOL enable = YES;
const SEL theAction = [theItem action];
if (theAction == @selector(changeScale:))
{
const NSInteger viewScale = (NSInteger)([self displayScale] * 100.0);
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
[(NSMenuItem*)theItem setState:(viewScale == [theItem tag]) ? NSOnState : NSOffState];
}
}
else if (theAction == @selector(changeRotation:))
{
const NSInteger viewRotation = (NSInteger)[self displayRotation];
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
if ([theItem tag] == -1)
{
if (viewRotation == 0 ||
viewRotation == 90 ||
viewRotation == 180 ||
viewRotation == 270)
{
[(NSMenuItem*)theItem setState:NSOffState];
}
else
{
[(NSMenuItem*)theItem setState:NSOnState];
}
}
else
{
[(NSMenuItem*)theItem setState:(viewRotation == [theItem tag]) ? NSOnState : NSOffState];
}
}
}
else if (theAction == @selector(changeDisplayMode:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
[(NSMenuItem*)theItem setState:([self displayMode] == [theItem tag]) ? NSOnState : NSOffState];
}
}
else if (theAction == @selector(changeDisplayOrientation:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
[(NSMenuItem*)theItem setState:([self displayOrientation] == [theItem tag]) ? NSOnState : NSOffState];
}
}
else if (theAction == @selector(changeDisplayOrder:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
[(NSMenuItem*)theItem setState:([self displayOrder] == [theItem tag]) ? NSOnState : NSOffState];
}
}
else if (theAction == @selector(changeDisplayGap:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
const NSInteger gapScalar = (NSInteger)([self displayGap] * 100.0);
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
if ([theItem tag] == -1)
{
if (gapScalar == 0 ||
gapScalar == 50 ||
gapScalar == 100 ||
gapScalar == 150 ||
gapScalar == 200)
{
[(NSMenuItem*)theItem setState:NSOffState];
}
else
{
[(NSMenuItem*)theItem setState:NSOnState];
}
}
else
{
[(NSMenuItem*)theItem setState:(gapScalar == [theItem tag]) ? NSOnState : NSOffState];
}
}
}
}
else if (theAction == @selector(hudDisable:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
[(NSMenuItem*)theItem setTitle:([[self view] isHudEnabled]) ? NSSTRING_TITLE_DISABLE_HUD : NSSTRING_TITLE_ENABLE_HUD];
}
}
else if (theAction == @selector(toggleStatusBar:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
[(NSMenuItem*)theItem setTitle:([self isShowingStatusBar]) ? NSSTRING_TITLE_HIDE_STATUS_BAR : NSSTRING_TITLE_SHOW_STATUS_BAR];
}
}
else if (theAction == @selector(toggleKeepMinDisplaySizeAtNormal:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
[(NSMenuItem*)theItem setState:([self isMinSizeNormal]) ? NSOnState : NSOffState];
}
}
else if (theAction == @selector(toggleToolbarShown:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
[(NSMenuItem*)theItem setTitle:([[[self window] toolbar] isVisible]) ? NSSTRING_TITLE_HIDE_TOOLBAR : NSSTRING_TITLE_SHOW_TOOLBAR];
}
}
return enable;
}
#pragma mark NSWindowDelegate Protocol
- (void)windowDidLoad

View File

@ -145,7 +145,6 @@ class AudioSampleBlockGenerator;
- (IBAction) newDisplayWindow:(id)sender;
- (IBAction) openRom:(id)sender;
- (IBAction) loadRecentRom:(id)sender;
- (IBAction) closeWindow:(id)sender;
- (IBAction) closeRom:(id)sender;
- (IBAction) revealRomInFinder:(id)sender;
- (IBAction) revealGameDataFolderInFinder:(id)sender;
@ -166,22 +165,8 @@ class AudioSampleBlockGenerator;
- (IBAction) reset:(id)sender;
- (IBAction) changeRomSaveType:(id)sender;
// View Menu
- (IBAction) changeScale:(id)sender;
- (IBAction) changeRotation:(id)sender;
- (IBAction) changeRotationRelative:(id)sender;
- (IBAction) changeDisplayMode:(id)sender;
- (IBAction) changeDisplayOrientation:(id)sender;
- (IBAction) changeDisplayOrder:(id)sender;
- (IBAction) changeDisplayGap:(id)sender;
- (IBAction) toggleKeepMinDisplaySizeAtNormal:(id)sender;
- (IBAction) toggleStatusBar:(id)sender;
- (IBAction) toggleToolbarShown:(id)sender;
- (IBAction) runToolbarCustomizationPalette:(id)sender;
// Tools Menu
- (IBAction) toggleGPUState:(id)sender;
- (IBAction) saveScreenshotAs:(id)sender;
- (IBAction) changeCoreSpeed:(id)sender;
- (IBAction) changeCoreEmuFlags:(id)sender;
@ -197,10 +182,6 @@ class AudioSampleBlockGenerator;
- (IBAction) chooseSlot1R4Directory:(id)sender;
- (IBAction) slot1Eject:(id)sender;
- (IBAction) writeDefaultsDisplayRotation:(id)sender;
- (IBAction) writeDefaultsDisplayGap:(id)sender;
- (IBAction) writeDefaultsHUDSettings:(id)sender;
- (IBAction) writeDefaultsDisplayVideoSettings:(id)sender;
- (IBAction) writeDefaults3DRenderingSettings:(id)sender;
- (IBAction) writeDefaultsEmulationSettings:(id)sender;
- (IBAction) writeDefaultsSlot1Settings:(id)sender;

View File

@ -491,11 +491,6 @@
// Dummy selector, used for UI validation only.
}
- (IBAction) closeWindow:(id)sender
{
[[mainWindow window] performClose:sender];
}
- (IBAction) closeRom:(id)sender
{
[self handleUnloadRom:REASONFORCLOSE_NORMAL romToLoad:nil];
@ -756,31 +751,6 @@
[inputManager dispatchCommandUsingIBAction:_cmd sender:sender];
}
- (IBAction) toggleKeepMinDisplaySizeAtNormal:(id)sender
{
[mainWindow toggleKeepMinDisplaySizeAtNormal:sender];
}
- (IBAction) toggleStatusBar:(id)sender
{
[mainWindow toggleStatusBar:sender];
}
- (IBAction) toggleToolbarShown:(id)sender
{
[[mainWindow window] toggleToolbarShown:sender];
}
- (IBAction) runToolbarCustomizationPalette:(id)sender
{
[[mainWindow window] runToolbarCustomizationPalette:sender];
}
- (IBAction) saveScreenshotAs:(id)sender
{
[mainWindow saveScreenshotAs:sender];
}
- (IBAction) toggleGPUState:(id)sender
{
[inputManager dispatchCommandUsingIBAction:_cmd sender:sender];
@ -802,10 +772,17 @@
- (IBAction) changeCoreSpeed:(id)sender
{
CGFloat newSpeedScalar = (CGFloat)[CocoaDSUtil getIBActionSenderTag:sender] / 100.0f;
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
[cdsCore setSpeedScalar:newSpeedScalar];
lastSetSpeedScalar = newSpeedScalar;
if ([sender isKindOfClass:[NSSlider class]])
{
lastSetSpeedScalar = [(NSSlider *)sender floatValue];
}
else
{
const CGFloat newSpeedScalar = (CGFloat)[CocoaDSUtil getIBActionSenderTag:sender] / 100.0f;
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
[cdsCore setSpeedScalar:newSpeedScalar];
lastSetSpeedScalar = newSpeedScalar;
}
}
- (IBAction) changeCoreEmuFlags:(id)sender
@ -874,63 +851,6 @@
[CocoaDSUtil messageSendOneWayWithInteger:[cdsSpeaker receivePort] msgID:MESSAGE_SET_SPU_SYNC_METHOD integerValue:[CocoaDSUtil getIBActionSenderTag:sender]];
}
- (IBAction) changeScale:(id)sender
{
[mainWindow setDisplayScale:(double)[CocoaDSUtil getIBActionSenderTag:sender] / 100.0];
}
- (IBAction) changeRotation:(id)sender
{
// Get the rotation value from the sender.
if ([sender isMemberOfClass:[NSSlider class]])
{
[mainWindow setDisplayRotation:[(NSSlider *)sender doubleValue]];
}
else
{
[mainWindow setDisplayRotation:(double)[CocoaDSUtil getIBActionSenderTag:sender]];
}
}
- (IBAction) changeRotationRelative:(id)sender
{
[inputManager dispatchCommandUsingIBAction:_cmd sender:sender];
}
- (IBAction) changeDisplayMode:(id)sender
{
const NSInteger newDisplayModeID = [CocoaDSUtil getIBActionSenderTag:sender];
if (newDisplayModeID == [mainWindow displayMode])
{
return;
}
[mainWindow setDisplayMode:newDisplayModeID];
}
- (IBAction) changeDisplayOrientation:(id)sender
{
const NSInteger newDisplayOrientation = [CocoaDSUtil getIBActionSenderTag:sender];
if (newDisplayOrientation == [mainWindow displayOrientation])
{
return;
}
[mainWindow setDisplayOrientation:newDisplayOrientation];
}
- (IBAction) changeDisplayOrder:(id)sender
{
[mainWindow setDisplayOrder:[CocoaDSUtil getIBActionSenderTag:sender]];
}
- (IBAction) changeDisplayGap:(id)sender
{
[mainWindow setDisplayGap:(double)[CocoaDSUtil getIBActionSenderTag:sender] / 100.0];
}
- (IBAction) chooseSlot1R4Directory:(id)sender
{
NSOpenPanel *panel = [NSOpenPanel openPanel];
@ -964,28 +884,6 @@
[cdsCore slot1Eject];
}
- (IBAction) writeDefaultsDisplayRotation:(id)sender
{
[[NSUserDefaults standardUserDefaults] setDouble:[mainWindow displayRotation] forKey:@"DisplayView_Rotation"];
}
- (IBAction) writeDefaultsDisplayGap:(id)sender
{
[[NSUserDefaults standardUserDefaults] setDouble:([mainWindow displayGap] * 100.0) forKey:@"DisplayViewCombo_Gap"];
}
- (IBAction) writeDefaultsHUDSettings:(id)sender
{
// TODO: Not implemented.
}
- (IBAction) writeDefaultsDisplayVideoSettings:(id)sender
{
[[NSUserDefaults standardUserDefaults] setInteger:[mainWindow videoFilterType] forKey:@"DisplayView_VideoFilter"];
[[NSUserDefaults standardUserDefaults] setBool:[mainWindow useBilinearOutput] forKey:@"DisplayView_UseBilinearOutput"];
[[NSUserDefaults standardUserDefaults] setBool:[mainWindow useVerticalSync] forKey:@"DisplayView_UseVerticalSync"];
}
- (IBAction) writeDefaults3DRenderingSettings:(id)sender
{
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
@ -2149,120 +2047,6 @@
[(NSMenuItem*)theItem setState:([cdsCore.cdsGPU gpuStateByBit:[theItem tag]]) ? NSOnState : NSOffState];
}
}
else if (theAction == @selector(changeScale:))
{
const NSInteger viewScale = (NSInteger)([mainWindow displayScale] * 100.0);
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
[(NSMenuItem*)theItem setState:(viewScale == [theItem tag]) ? NSOnState : NSOffState];
}
}
else if (theAction == @selector(changeRotation:))
{
const NSInteger viewRotation = (NSInteger)[mainWindow displayRotation];
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
if ([theItem tag] == -1)
{
if (viewRotation == 0 ||
viewRotation == 90 ||
viewRotation == 180 ||
viewRotation == 270)
{
[(NSMenuItem*)theItem setState:NSOffState];
}
else
{
[(NSMenuItem*)theItem setState:NSOnState];
}
}
else
{
[(NSMenuItem*)theItem setState:(viewRotation == [theItem tag]) ? NSOnState : NSOffState];
}
}
}
else if (theAction == @selector(changeDisplayMode:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
[(NSMenuItem*)theItem setState:([mainWindow displayMode] == [theItem tag]) ? NSOnState : NSOffState];
}
}
else if (theAction == @selector(changeDisplayOrientation:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
[(NSMenuItem*)theItem setState:([mainWindow displayOrientation] == [theItem tag]) ? NSOnState : NSOffState];
}
}
else if (theAction == @selector(changeDisplayOrder:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
[(NSMenuItem*)theItem setState:([mainWindow displayOrder] == [theItem tag]) ? NSOnState : NSOffState];
}
}
else if (theAction == @selector(changeDisplayGap:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
const NSInteger gapScalar = (NSInteger)([mainWindow displayGap] * 100.0);
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
if ([theItem tag] == -1)
{
if (gapScalar == 0 ||
gapScalar == 50 ||
gapScalar == 100 ||
gapScalar == 150 ||
gapScalar == 200)
{
[(NSMenuItem*)theItem setState:NSOffState];
}
else
{
[(NSMenuItem*)theItem setState:NSOnState];
}
}
else
{
[(NSMenuItem*)theItem setState:(gapScalar == [theItem tag]) ? NSOnState : NSOffState];
}
}
}
}
else if (theAction == @selector(hudDisable:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
[(NSMenuItem*)theItem setTitle:([[mainWindow view] isHudEnabled]) ? NSSTRING_TITLE_DISABLE_HUD : NSSTRING_TITLE_ENABLE_HUD];
}
}
else if (theAction == @selector(toggleStatusBar:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
[(NSMenuItem*)theItem setTitle:([mainWindow isShowingStatusBar]) ? NSSTRING_TITLE_HIDE_STATUS_BAR : NSSTRING_TITLE_SHOW_STATUS_BAR];
}
}
else if (theAction == @selector(toggleKeepMinDisplaySizeAtNormal:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
[(NSMenuItem*)theItem setState:([mainWindow isMinSizeNormal]) ? NSOnState : NSOffState];
}
}
else if (theAction == @selector(toggleToolbarShown:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
[(NSMenuItem*)theItem setTitle:([[[mainWindow window] toolbar] isVisible]) ? NSSTRING_TITLE_HIDE_TOOLBAR : NSSTRING_TITLE_SHOW_TOOLBAR];
}
}
return enable;
}