Author: gkruse Date: 2006-09-22 05:49:58 +0200 (Fri, 22 Sep 2006) New Revision: 194 Modified: trunk/KisMAC.xcodeproj/project.pbxproj trunk/Resources/Nibs/English.lproj/GPSDialog.nib/classes.nib trunk/Resources/Nibs/English.lproj/GPSDialog.nib/keyedobjects.nib trunk/Sources/WindowControllers/GPSInfoController.h trunk/Sources/WindowControllers/GPSInfoController.m Log: Themacuser's update gps info Modified: trunk/KisMAC.xcodeproj/project.pbxproj =================================================================== --- trunk/KisMAC.xcodeproj/project.pbxproj 2006-09-20 17:43:44 UTC (rev 193) +++ trunk/KisMAC.xcodeproj/project.pbxproj 2006-09-22 03:49:58 UTC (rev 194) @@ -829,7 +829,7 @@ 6CA3BCCA09B2A58F00DCB407 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = /System/Library/Frameworks/Accelerate.framework; sourceTree = "<absolute>"; }; 87CEBA8009AEF03700AEB0B8 /* GrowlController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GrowlController.h; sourceTree = "<group>"; }; 87CEBA8109AEF03700AEB0B8 /* GrowlController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = GrowlController.m; sourceTree = "<group>"; }; - 8D1107320486CEB800E47090 /* KisMAC.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = KisMAC.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 8D1107320486CEB800E47090 /* KisMAC.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KisMAC.app; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ Modified: trunk/Resources/Nibs/English.lproj/GPSDialog.nib/classes.nib =================================================================== --- trunk/Resources/Nibs/English.lproj/GPSDialog.nib/classes.nib 2006-09-20 17:43:44 UTC (rev 193) +++ trunk/Resources/Nibs/English.lproj/GPSDialog.nib/classes.nib 2006-09-22 03:49:58 UTC (rev 194) @@ -2,16 +2,20 @@ IBClasses = ( {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, { - ACTIONS = {updateSpeed = id; }; + ACTIONS = {resetPeak = id; updateAlt = id; updateSpeed = id; }; CLASS = GPSInfoController; LANGUAGE = ObjC; OUTLETS = { + "_altBar" = NSProgressIndicator; + "_altType" = NSPopUpButton; + "_alt_field" = NSTextField; "_fix_indicator" = NSLevelIndicator; "_fix_type" = NSTextField; "_hdop_indicator" = NSLevelIndicator; "_lat_field" = NSTextField; "_lon_field" = NSTextField; "_sats_indicator" = NSLevelIndicator; + "_speedBar" = NSProgressIndicator; "_speedType" = NSPopUpButton; "_statusField" = NSTextField; "_vel_field" = NSTextField; Modified: trunk/Resources/Nibs/English.lproj/GPSDialog.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/Sources/WindowControllers/GPSInfoController.h =================================================================== --- trunk/Sources/WindowControllers/GPSInfoController.h 2006-09-20 17:43:44 UTC (rev 193) +++ trunk/Sources/WindowControllers/GPSInfoController.h 2006-09-22 03:49:58 UTC (rev 194) @@ -34,14 +34,26 @@ IBOutlet NSTextField* _lat_field; IBOutlet NSTextField* _lon_field; IBOutlet NSTextField* _vel_field; + IBOutlet NSTextField* _alt_field; IBOutlet NSPopUpButton* _speedType; + IBOutlet NSPopUpButton* _altType; + IBOutlet NSProgressIndicator* _speedBar; + IBOutlet NSProgressIndicator* _altBar; + float _vel; float _velFactor; + float _maxvel; + float _alt; + float _altFactor; + float _maxalt; + int _haveFix; } - (void)setShowMenu:(NSMenuItem *)menu; - (void)updateDataNS:(double)ns EW:(double)ew ELV:(double)elv numSats:(int)sats HDOP:(double)hdop VEL:(float)vel; - (IBAction)updateSpeed:(id)sender; +- (IBAction)updateAlt:(id)sender; +- (IBAction)resetPeak:(id)sender; @end Modified: trunk/Sources/WindowControllers/GPSInfoController.m =================================================================== --- trunk/Sources/WindowControllers/GPSInfoController.m 2006-09-20 17:43:44 UTC (rev 193) +++ trunk/Sources/WindowControllers/GPSInfoController.m 2006-09-22 03:49:58 UTC (rev 194) @@ -37,7 +37,16 @@ - (void)updateDataNS:(double)ns EW:(double)ew ELV:(double)elv numSats:(int)sats HDOP:(double)hdop VEL:(float)vel { _vel = vel; + _alt = elv; + if (_velFactor == 0) { + _velFactor = 1.852; + } + + if (_altFactor == 0) { + _altFactor = 1; + } + [_sats_indicator setCriticalValue:3]; if (!sats || ew > 180 || ns > 90 || vel < 0) { [_fix_indicator setFloatValue:0.1]; @@ -47,6 +56,8 @@ [_lat_field setStringValue:@""]; [_lon_field setStringValue:@""]; [_vel_field setStringValue:@""]; + [_speedBar setDoubleValue:0]; + [_altBar setDoubleValue:0]; _haveFix = 0; } else if (!elv) { [_fix_indicator setFloatValue:0.5]; @@ -56,6 +67,15 @@ [_lat_field setStringValue:[NSString stringWithFormat:@"%.5f",ns]]; [_lon_field setStringValue:[NSString stringWithFormat:@"%.5f",ew]]; [_vel_field setStringValue:[NSString stringWithFormat:@"%.5f",(_vel * _velFactor)]]; + [_alt_field setStringValue:@""]; + [_speedBar setDoubleValue:(_vel * _velFactor)]; + + if ((_vel * _velFactor) > _maxvel) { + _maxvel = _vel; + [_speedBar setMaxValue:(_vel * _velFactor)]; + } + + [_altBar setDoubleValue:0]; _haveFix = 1; } else if (elv && sats) { [_fix_indicator setFloatValue:1]; @@ -65,6 +85,19 @@ [_lat_field setStringValue:[NSString stringWithFormat:@"%.5f",ns]]; [_lon_field setStringValue:[NSString stringWithFormat:@"%.5f",ew]]; [_vel_field setStringValue:[NSString stringWithFormat:@"%.5f",(_vel * _velFactor)]]; + [_alt_field setStringValue:[NSString stringWithFormat:@"%.1f",(_alt * _altFactor)]]; + [_speedBar setDoubleValue:(_vel * _velFactor)]; + [_altBar setDoubleValue:(_alt * _altFactor)]; + + if ((_vel * _velFactor) > _maxvel) { + _maxvel = _vel; + [_speedBar setMaxValue:(_vel * _velFactor)]; + } + + if ((_alt * _altFactor) > _maxalt) { + _maxalt = _alt; + [_altBar setMaxValue:(_alt * _altFactor)]; + } _haveFix = 2; } } @@ -83,6 +116,18 @@ } } +- (IBAction)updateAlt:(id)sender { + if ([[_altType titleOfSelectedItem] isEqualToString:@"m"]) { + _altFactor = 1; + } else if ([[_altType titleOfSelectedItem] isEqualToString:@"ft"]) { + _altFactor = 3.333; + } + + if (_haveFix == 2) { + [_alt_field setStringValue:[NSString stringWithFormat:@"%.1f",(_alt * _altFactor)]]; + } +} + - (BOOL)windowShouldClose:(id)sender { // Set up our timer to periodically call the fade: method. [[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(fade:) userInfo:nil repeats:YES] retain]; @@ -110,5 +155,9 @@ } } +- (IBAction)resetPeak:(id)sender { + _maxalt = 0; + _maxvel = 0; +} @end \ No newline at end of file