From f3a16a18a6db5af9765d48968b77d66a8563fcb6 Mon Sep 17 00:00:00 2001 From: Chris Laurel Date: Fri, 21 Mar 2008 00:29:17 +0000 Subject: [PATCH] Modified Mac OS X front-end to use new reference marks; added planetographic grid option to popup menu. --- macosx/CelestiaSettings.mm | 56 ++++++++++++++++++++++++++++++++++---- macosx/Menu_Extensions.m | 9 ++++++ 2 files changed, 60 insertions(+), 5 deletions(-) diff --git a/macosx/CelestiaSettings.mm b/macosx/CelestiaSettings.mm index 415e284ee..ce41f352d 100644 --- a/macosx/CelestiaSettings.mm +++ b/macosx/CelestiaSettings.mm @@ -185,6 +185,7 @@ static NSMutableDictionary* tagMap; TAGDEF(1001,@"showFrameAxes") TAGDEF(1002,@"showSunDirection") TAGDEF(1003,@"showVelocityVector") + TAGDEF(1004,@"showPlanetographicGrid") nil]; [tagDict addEntriesFromDictionary: volatileTagDict]; #endif @@ -504,12 +505,57 @@ FEATUREMETHODS(Other) #if REFMARKS // Refmark Settings -#define REFMARKMETHODS(flag) -(BOOL) show##flag { return (appCore->getSimulation()->getSelection().body()->getVisibleReferenceMarks()&Body::flag) != 0; } -(void) setShow##flag: (BOOL) value { appCore->getSimulation()->getSelection().body()->setVisibleReferenceMarks([self setValue: value forBit: Body::flag inSet: appCore->getSimulation()->getSelection().body()->getVisibleReferenceMarks()]); } +-(BOOL) showBodyAxes +{ + return appCore->referenceMarkEnabled("body axes"); +} + +-(void) setShowBodyAxes: (BOOL) value +{ + appCore->toggleReferenceMark("body axes"); +} + +-(BOOL) showFrameAxes +{ + return appCore->referenceMarkEnabled("frame axes"); +} + +-(void) setShowFrameAxes: (BOOL) value +{ + appCore->toggleReferenceMark("frame axes"); +} + +-(BOOL) showSunDirection +{ + return appCore->referenceMarkEnabled("sun direction"); +} + +-(void) setShowSunDirection: (BOOL) value +{ + appCore->toggleReferenceMark("sun direction"); +} + +-(BOOL) showVelocityVector +{ + return appCore->referenceMarkEnabled("velocity vector"); +} + +-(void) setShowVelocityVector: (BOOL) value +{ + appCore->toggleReferenceMark("velocity vector"); +} + +-(BOOL) showPlanetographicGrid +{ + return appCore->referenceMarkEnabled("planetographic grid"); +} + +-(void) setShowPlanetographicGrid: (BOOL) value +{ + appCore->toggleReferenceMark("planetographic grid"); +} + -REFMARKMETHODS(BodyAxes) -REFMARKMETHODS(FrameAxes) -REFMARKMETHODS(SunDirection) -REFMARKMETHODS(VelocityVector) #endif // Lighting Settings diff --git a/macosx/Menu_Extensions.m b/macosx/Menu_Extensions.m index 5e7b741e2..fa77e7262 100644 --- a/macosx/Menu_Extensions.m +++ b/macosx/Menu_Extensions.m @@ -33,6 +33,8 @@ if (index >= 0) [self removeItemAtIndex: index]; index = [self indexOfItemWithTitle: NSLocalizedStringFromTable(@"Show Velocity Vector",@"po",@"")]; if (index >= 0) [self removeItemAtIndex: index]; + index = [self indexOfItemWithTitle: NSLocalizedStringFromTable(@"Show Planetographic Grid",@"po",@"")]; + if (index >= 0) [self removeItemAtIndex: index]; } #endif @@ -69,6 +71,13 @@ if ([aSelection body]) { target = [aSelection body]; + mi = [[[NSMenuItem alloc] initWithTitle: NSLocalizedStringFromTable(@"Show Planetographic Grid",@"po",@"") action: nil keyEquivalent: @""] autorelease]; + if (mi) + { + [mi setTag: 1004]; + [self insertItem: mi atIndex: aIndex]; + [settings scanForKeys: mi]; + } mi = [[[NSMenuItem alloc] initWithTitle: NSLocalizedStringFromTable(@"Show Velocity Vector",@"po",@"") action: nil keyEquivalent: @""] autorelease]; if (mi) {