[kismac] [binaervarianz] r170 - in trunk: KisMAC.xcodeproj Resources/Nibs/English.lproj Resources/Nibs/English.lproj/GPSDialog.nib Resources/Nibs/English.lproj/MainMenu.nib Sources/Controller Sources/Core Sources/Support Sources/WindowControllers

  • From: svn@xxxxxxxxxxxxxxxx
  • To: kismac@xxxxxxxxxxxxx
  • Date: Sat, 26 Aug 2006 20:29:53 +0200

Author: gkruse
Date: 2006-08-26 20:29:34 +0200 (Sat, 26 Aug 2006)
New Revision: 170

Added:
   trunk/Resources/Nibs/English.lproj/GPSDialog.nib/
   trunk/Resources/Nibs/English.lproj/GPSDialog.nib/classes.nib
   trunk/Resources/Nibs/English.lproj/GPSDialog.nib/info.nib
   trunk/Resources/Nibs/English.lproj/GPSDialog.nib/keyedobjects.nib
   trunk/Sources/WindowControllers/GPSInfoController.h
   trunk/Sources/WindowControllers/GPSInfoController.m
Modified:
   trunk/KisMAC.xcodeproj/project.pbxproj
   trunk/Resources/Nibs/English.lproj/MainMenu.nib/classes.nib
   trunk/Resources/Nibs/English.lproj/MainMenu.nib/info.nib
   trunk/Resources/Nibs/English.lproj/MainMenu.nib/keyedobjects.nib
   trunk/Sources/Controller/ScanController.h
   trunk/Sources/Controller/ScanControllerMenus.m
   trunk/Sources/Core/WaveHelper.h
   trunk/Sources/Core/WaveHelper.m
   trunk/Sources/Core/WaveNet.mm
   trunk/Sources/Support/GPSController.m
   trunk/Sources/WindowControllers/DecryptController.m
Log:
GPS Info / Status window by themacuser.  Committed with minor modifications.  
This should probably be rolled into the GPS controller sometime in the future 
to keep things simple.

Modified: trunk/KisMAC.xcodeproj/project.pbxproj
===================================================================
--- trunk/KisMAC.xcodeproj/project.pbxproj      2006-08-26 15:28:38 UTC (rev 
169)
+++ trunk/KisMAC.xcodeproj/project.pbxproj      2006-08-26 18:29:34 UTC (rev 
170)
@@ -470,6 +470,9 @@
                6C1D31C009F37BC70005A9F8 /* PrefsAdvanced.h in Headers */ = 
{isa = PBXBuildFile; fileRef = 6C1D31BE09F37BC70005A9F8 /* PrefsAdvanced.h */; 
};
                6C1D31C109F37BC70005A9F8 /* PrefsAdvanced.m in Sources */ = 
{isa = PBXBuildFile; fileRef = 6C1D31BF09F37BC70005A9F8 /* PrefsAdvanced.m */; 
};
                6C1D31C409F37BE10005A9F8 /* PrefsAdvanced.nib in Resources */ = 
{isa = PBXBuildFile; fileRef = 6C1D31C209F37BE10005A9F8 /* PrefsAdvanced.nib 
*/; };
+               6C41BAB00AA0B52900E0B411 /* GPSInfoController.h in Headers */ = 
{isa = PBXBuildFile; fileRef = 6C41BAAE0AA0B52900E0B411 /* GPSInfoController.h 
*/; };
+               6C41BAB10AA0B52900E0B411 /* GPSInfoController.m in Sources */ = 
{isa = PBXBuildFile; fileRef = 6C41BAAF0AA0B52900E0B411 /* GPSInfoController.m 
*/; };
+               6C41BAD50AA0B8E600E0B411 /* GPSDialog.nib in Resources */ = 
{isa = PBXBuildFile; fileRef = 6C41BAD30AA0B8E600E0B411 /* GPSDialog.nib */; };
                6C541AAB0A72002F00B58A95 /* growl-ap-revealed.png in Resources 
*/ = {isa = PBXBuildFile; fileRef = 6C541AA80A72002F00B58A95 /* 
growl-ap-revealed.png */; };
                6C541AAC0A72003000B58A95 /* growl-wpa-challenge.png in 
Resources */ = {isa = PBXBuildFile; fileRef = 6C541AA90A72002F00B58A95 /* 
growl-wpa-challenge.png */; };
                6C541AAD0A72003000B58A95 /* growl-wpa-response.png in Resources 
*/ = {isa = PBXBuildFile; fileRef = 6C541AAA0A72002F00B58A95 /* 
growl-wpa-response.png */; };
@@ -817,6 +820,9 @@
                6C1D31BF09F37BC70005A9F8 /* PrefsAdvanced.m */ = {isa = 
PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; 
path = PrefsAdvanced.m; sourceTree = "<group>"; };
                6C1D31C309F37BE10005A9F8 /* English */ = {isa = 
PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = 
Resources/Nibs/English.lproj/PrefsAdvanced.nib; sourceTree = SOURCE_ROOT; };
                6C1D31C509F37BF40005A9F8 /* Spanish */ = {isa = 
PBXFileReference; lastKnownFileType = wrapper.nib; name = Spanish; path = 
Resources/Nibs/Spanish.lproj/PrefsAdvanced.nib; sourceTree = SOURCE_ROOT; };
+               6C41BAAE0AA0B52900E0B411 /* GPSInfoController.h */ = {isa = 
PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = 
GPSInfoController.h; sourceTree = "<group>"; };
+               6C41BAAF0AA0B52900E0B411 /* GPSInfoController.m */ = {isa = 
PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; 
path = GPSInfoController.m; sourceTree = "<group>"; };
+               6C41BAD40AA0B8E600E0B411 /* English */ = {isa = 
PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = 
English.lproj/GPSDialog.nib; sourceTree = "<group>"; };
                6C541AA80A72002F00B58A95 /* growl-ap-revealed.png */ = {isa = 
PBXFileReference; lastKnownFileType = image.png; path = 
"growl-ap-revealed.png"; sourceTree = "<group>"; };
                6C541AA90A72002F00B58A95 /* growl-wpa-challenge.png */ = {isa = 
PBXFileReference; lastKnownFileType = image.png; path = 
"growl-wpa-challenge.png"; sourceTree = "<group>"; };
                6C541AAA0A72002F00B58A95 /* growl-wpa-response.png */ = {isa = 
PBXFileReference; lastKnownFileType = image.png; path = 
"growl-wpa-response.png"; sourceTree = "<group>"; };
@@ -1246,6 +1252,8 @@
                0035341F06A5DD8500AB4577 /* WindowControllers */ = {
                        isa = PBXGroup;
                        children = (
+                               6C41BAAE0AA0B52900E0B411 /* GPSInfoController.h 
*/,
+                               6C41BAAF0AA0B52900E0B411 /* GPSInfoController.m 
*/,
                                0035342006A5DD8500AB4577 /* 
CrashReportController.h */,
                                0035342106A5DD8500AB4577 /* 
CrashReportController.m */,
                                0035342206A5DD8500AB4577 /* DecryptController.h 
*/,
@@ -1301,6 +1309,7 @@
                00F57C1606A886350035AE2F /* Nibs */ = {
                        isa = PBXGroup;
                        children = (
+                               6C41BAD30AA0B8E600E0B411 /* GPSDialog.nib */,
                                6C1D31C209F37BE10005A9F8 /* PrefsAdvanced.nib 
*/,
                                00F57C1706A886350035AE2F /* Crack.nib */,
                                00F57C1906A886350035AE2F /* CrashReporter.nib 
*/,
@@ -1635,6 +1644,7 @@
                                00DF456308B1E969003F3C7E /* 
WaveDriverAirportExtreme.h in Headers */,
                                87CEBA8209AEF03700AEB0B8 /* GrowlController.h 
in Headers */,
                                6C1D31C009F37BC70005A9F8 /* PrefsAdvanced.h in 
Headers */,
+                               6C41BAB00AA0B52900E0B411 /* GPSInfoController.h 
in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
@@ -1833,6 +1843,7 @@
                                6C541AAB0A72002F00B58A95 /* 
growl-ap-revealed.png in Resources */,
                                6C541AAC0A72003000B58A95 /* 
growl-wpa-challenge.png in Resources */,
                                6C541AAD0A72003000B58A95 /* 
growl-wpa-response.png in Resources */,
+                               6C41BAD50AA0B8E600E0B411 /* GPSDialog.nib in 
Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
@@ -2025,6 +2036,7 @@
                                00DF456408B1E969003F3C7E /* 
WaveDriverAirportExtreme.m in Sources */,
                                87CEBA8309AEF03700AEB0B8 /* GrowlController.m 
in Sources */,
                                6C1D31C109F37BC70005A9F8 /* PrefsAdvanced.m in 
Sources */,
+                               6C41BAB10AA0B52900E0B411 /* GPSInfoController.m 
in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
@@ -2220,6 +2232,14 @@
                        path = ../../Sources/WaveDrivers;
                        sourceTree = "<group>";
                };
+               6C41BAD30AA0B8E600E0B411 /* GPSDialog.nib */ = {
+                       isa = PBXVariantGroup;
+                       children = (
+                               6C41BAD40AA0B8E600E0B411 /* English */,
+                       );
+                       name = GPSDialog.nib;
+                       sourceTree = "<group>";
+               };
 /* End PBXVariantGroup section */
 
 /* Begin XCBuildConfiguration section */

Added: trunk/Resources/Nibs/English.lproj/GPSDialog.nib/classes.nib
===================================================================
--- trunk/Resources/Nibs/English.lproj/GPSDialog.nib/classes.nib        
2006-08-26 15:28:38 UTC (rev 169)
+++ trunk/Resources/Nibs/English.lproj/GPSDialog.nib/classes.nib        
2006-08-26 18:29:34 UTC (rev 170)
@@ -0,0 +1,24 @@
+{
+    IBClasses = (
+        {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 
+        {
+            ACTIONS = {updateSpeed = id; }; 
+            CLASS = GPSInfoController; 
+            LANGUAGE = ObjC; 
+            OUTLETS = {
+                "_fix_indicator" = NSLevelIndicator; 
+                "_fix_type" = NSTextField; 
+                "_hdop_indicator" = NSLevelIndicator; 
+                "_lat_field" = NSTextField; 
+                "_lon_field" = NSTextField; 
+                "_sats_indicator" = NSLevelIndicator; 
+                "_speedType" = NSPopUpButton; 
+                "_statusField" = NSTextField; 
+                "_vel_field" = NSTextField; 
+            }; 
+            SUPERCLASS = NSWindowController; 
+        }, 
+        {CLASS = NSLevelIndicator; LANGUAGE = ObjC; SUPERCLASS = NSControl; }
+    ); 
+    IBVersion = 1; 
+}
\ No newline at end of file

Added: trunk/Resources/Nibs/English.lproj/GPSDialog.nib/info.nib
===================================================================
--- trunk/Resources/Nibs/English.lproj/GPSDialog.nib/info.nib   2006-08-26 
15:28:38 UTC (rev 169)
+++ trunk/Resources/Nibs/English.lproj/GPSDialog.nib/info.nib   2006-08-26 
18:29:34 UTC (rev 170)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
+<plist version="1.0">
+<dict>
+       <key>IBDocumentLocation</key>
+       <string>189 53 356 240 0 0 1024 746 </string>
+       <key>IBFramework Version</key>
+       <string>446.1</string>
+       <key>IBOpenObjects</key>
+       <array>
+               <integer>5</integer>
+       </array>
+       <key>IBSystem Version</key>
+       <string>8J135</string>
+</dict>
+</plist>

Added: trunk/Resources/Nibs/English.lproj/GPSDialog.nib/keyedobjects.nib
===================================================================
(Binary files differ)


Property changes on: 
trunk/Resources/Nibs/English.lproj/GPSDialog.nib/keyedobjects.nib
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/Resources/Nibs/English.lproj/MainMenu.nib/classes.nib
===================================================================
--- trunk/Resources/Nibs/English.lproj/MainMenu.nib/classes.nib 2006-08-26 
15:28:38 UTC (rev 169)
+++ trunk/Resources/Nibs/English.lproj/MainMenu.nib/classes.nib 2006-08-26 
18:29:34 UTC (rev 170)
@@ -26,6 +26,7 @@
             SUPERCLASS = NSScrollView; 
         }, 
         {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 
+        {CLASS = GPSInfoController; LANGUAGE = ObjC; SUPERCLASS = 
NSWindowController; }, 
         {
             ACTIONS = {commentChanged = id; showNet = id; }; 
             CLASS = InfoController; 
@@ -116,6 +117,7 @@
                 debugSaveStressTest = id; 
                 debugTestWPAHashingFunction = id; 
                 decryptPCAPFile = id; 
+                displayGPSInfo = id; 
                 exportJPEG = id; 
                 exportKMLFile = id; 
                 exportMacstumbler = id; 
@@ -139,6 +141,7 @@
                 showAllNetArea = id; 
                 showContextHelp = id; 
                 showCurNetArea = id; 
+                showGPS = id; 
                 showInfo = id; 
                 showNetHierarch = id; 
                 showPrefs = id; 
@@ -171,6 +174,7 @@
                 "_searchTypeMenu" = NSPopUpButton; 
                 "_showAllNetsInMap" = NSMenuItem; 
                 "_showDetails" = NSMenuItem; 
+                "_showGPSDetails" = NSMenuItem; 
                 "_showHierarch" = NSMenuItem; 
                 "_showMap" = NSMenuItem; 
                 "_showNetInMap" = NSMenuItem; 

Modified: trunk/Resources/Nibs/English.lproj/MainMenu.nib/info.nib
===================================================================
--- trunk/Resources/Nibs/English.lproj/MainMenu.nib/info.nib    2006-08-26 
15:28:38 UTC (rev 169)
+++ trunk/Resources/Nibs/English.lproj/MainMenu.nib/info.nib    2006-08-26 
18:29:34 UTC (rev 170)
@@ -3,7 +3,7 @@
 <plist version="1.0">
 <dict>
        <key>IBDocumentLocation</key>
-       <string>230 99 612 460 0 0 1280 832 </string>
+       <string>7 -10 612 460 0 0 1024 746 </string>
        <key>IBEditorPositions</key>
        <dict>
                <key>1199</key>
@@ -17,9 +17,9 @@
                <key>1290</key>
                <string>352 338 576 461 0 0 1280 832 </string>
                <key>1446</key>
-               <string>655 569 185 263 0 0 1280 832 </string>
+               <string>502 483 185 263 0 0 1024 746 </string>
                <key>29</key>
-               <string>180 788 530 44 0 0 1280 832 </string>
+               <string>118 702 530 44 0 0 1024 746 </string>
                <key>501</key>
                <string>521 414 237 309 0 0 1280 832 </string>
                <key>719</key>
@@ -34,9 +34,9 @@
        </array>
        <key>IBOpenObjects</key>
        <array>
+               <integer>21</integer>
                <integer>29</integer>
                <integer>1446</integer>
-               <integer>21</integer>
        </array>
        <key>IBSystem Version</key>
        <string>8J135</string>

Modified: trunk/Resources/Nibs/English.lproj/MainMenu.nib/keyedobjects.nib
===================================================================
(Binary files differ)

Modified: trunk/Sources/Controller/ScanController.h
===================================================================
--- trunk/Sources/Controller/ScanController.h   2006-08-26 15:28:38 UTC (rev 
169)
+++ trunk/Sources/Controller/ScanController.h   2006-08-26 18:29:34 UTC (rev 
170)
@@ -30,6 +30,7 @@
 #import "ScanHierarch.h"
 #import "PrefsController.h"
 #import "GrowlController.h"
+#import "GPSInfoController.h"
 //sleep studd
 #include <mach/mach_port.h>
 #include <mach/mach_interface.h>
@@ -147,11 +148,13 @@
     IBOutlet NSMenuItem         *_showMap;
     IBOutlet NSMenuItem         *_showDetails;
     IBOutlet NSMenuItem         *_showHierarch;
+       IBOutlet NSMenuItem                     *_showGPSDetails;
     
     IBOutlet NSPopUpButton      *_trafficTimePopUp;
     IBOutlet NSPopUpButton      *_trafficModePopUp;
     IBOutlet NSDrawer           *_netHierarchDrawer;
     IBOutlet SpinChannel        *_channelProg;
+       GPSInfoController* _g;
 }
 
 - (IBAction)updateNetworkTable:(id)sender complete:(bool)complete;
@@ -211,5 +214,4 @@
 - (IBAction)debugExportTrafficView:(id)sender;
 void NotifySleep( void * refCon, io_service_t service,
                       natural_t messageType, void * messageArgument );
-
 @end

Modified: trunk/Sources/Controller/ScanControllerMenus.m
===================================================================
--- trunk/Sources/Controller/ScanControllerMenus.m      2006-08-26 15:28:38 UTC 
(rev 169)
+++ trunk/Sources/Controller/ScanControllerMenus.m      2006-08-26 18:29:34 UTC 
(rev 170)
@@ -30,6 +30,7 @@
 #import "KisMACNotifications.h"
 #import "../WindowControllers/DownloadMapController.h"
 #import "DecryptController.h"
+#import "GPSInfoController.h"
 #import "HTTPStream.h"
 #import "../Crypto/WPA.h"
 #import "TrafficController.h"
@@ -709,6 +710,23 @@
     [[NSApp keyWindow] performClose:sender];
 }
 
+- (IBAction)displayGPSInfo:(id)sender {
+       
+       if ([_showGPSDetails state]==NSOffState) {
+               _g = [[GPSInfoController alloc] 
initWithWindowNibName:@"GPSDialog"];
+               [_g setShowMenu:_showGPSDetails];
+               [_showGPSDetails setState:NSOnState];
+               [_g showWindow:sender];
+               [WaveHelper setGPSInfoController:_g];
+          } else {
+               [_showGPSDetails setState:NSOffState];
+               [_g close];
+               [_g release];
+               [WaveHelper setGPSInfoController:NULL];
+          }
+       
+}
+
 #pragma mark -
 #pragma mark HELP MENU
 #pragma mark -

Modified: trunk/Sources/Core/WaveHelper.h
===================================================================
--- trunk/Sources/Core/WaveHelper.h     2006-08-26 15:28:38 UTC (rev 169)
+++ trunk/Sources/Core/WaveHelper.h     2006-08-26 18:29:34 UTC (rev 170)
@@ -52,6 +52,7 @@
 @class MapView;
 @class ImportController;
 @class GPSController;
+@class GPSInfoController;
 @class WaveDriver;
 @class Trace;
 
@@ -90,6 +91,9 @@
 + (GPSController*) gpsController;
 + (void) initGPSControllerWithDevice:(NSString*)device;
 
++ (void) setGPSInfoController:(GPSInfoController*)GPSController;
++ (GPSInfoController*) GPSInfoController;
+
 + (MapView*) mapView;
 + (void) setMapView:(MapView*)mv;
 + (Trace*) trace;

Modified: trunk/Sources/Core/WaveHelper.m
===================================================================
--- trunk/Sources/Core/WaveHelper.m     2006-08-26 15:28:38 UTC (rev 169)
+++ trunk/Sources/Core/WaveHelper.m     2006-08-26 18:29:34 UTC (rev 170)
@@ -38,6 +38,7 @@
 
 #import "WaveContainer.h"
 #import "GPSController.h"
+#import "GPSInfoController.h"
 #import "ImportController.h"
 
 /*
@@ -75,6 +76,7 @@
 static Trace *_trace;
 static ImportController *_im;
 static ScanController *_scanController;
+static GPSInfoController *_gc;
 
 //converts a byte count to a human readable string
 + (NSString*) bytesToString:(float) bytes {
@@ -439,6 +441,14 @@
     _scanController=scanController;
 }
 
++ (GPSInfoController*) GPSInfoController {
+       return _gc;
+}
+
++ (void) setGPSInfoController:(GPSInfoController*)GPSController {
+    _gc=GPSController;
+}
+
 + (GPSController*) gpsController {
     return aGPSController;
 }

Modified: trunk/Sources/Core/WaveNet.mm
===================================================================
--- trunk/Sources/Core/WaveNet.mm       2006-08-26 15:28:38 UTC (rev 169)
+++ trunk/Sources/Core/WaveNet.mm       2006-08-26 18:29:34 UTC (rev 170)
@@ -606,7 +606,6 @@
        if (isHidden) {
                if (_SSID!=Nil) return; //we might have the real ssid already
                [WaveHelper secureReplace:&_SSID withObject:@""];
-               NSLog(@"_ssid = %@, newSSID=%@, isHidden = %i, 
updatedSSID=%i",_SSID,newSSID, isHidden, updatedSSID);
        } else {
                [WaveHelper secureReplace:&_SSID withObject:newSSID];
                if (updatedSSID) {

Modified: trunk/Sources/Support/GPSController.m
===================================================================
--- trunk/Sources/Support/GPSController.m       2006-08-26 15:28:38 UTC (rev 
169)
+++ trunk/Sources/Support/GPSController.m       2006-08-26 18:29:34 UTC (rev 
170)
@@ -29,6 +29,7 @@
 #import "WaveHelper.h"
 #import "KisMACNotifications.h"
 #import "Trace.h"
+#import "GPSInfoController.h"
 
 #include <stdio.h>
 #include <fcntl.h>
@@ -473,6 +474,13 @@
         }
     }
     
+    GPSInfoController *asdf = [WaveHelper GPSInfoController];
+       
+       if (asdf != NULL)
+       {
+               [asdf updateDataNS:_ns.coordinates EW:_ew.coordinates 
ELV:_elev.coordinates numSats:_numsat HDOP:_hdop VEL:_velkt];
+       }
+    
     [date release];
     [subpool release];
 
@@ -580,11 +588,16 @@
                [[WaveHelper trace] cut];
        }
 
+    GPSInfoController *asdf = [WaveHelper GPSInfoController];
+       
+       if (asdf != NULL)
+       {
+               [asdf updateDataNS:_ns.coordinates EW:_ew.coordinates 
ELV:_elev.coordinates numSats:_numsat HDOP:_hdop VEL:_velkt];
+       }
     
     [date release];
     [subpool release];
-
-    return YES;
+       return YES;
 }
 
 - (void) continousParse:(int) fd {

Modified: trunk/Sources/WindowControllers/DecryptController.m
===================================================================
--- trunk/Sources/WindowControllers/DecryptController.m 2006-08-26 15:28:38 UTC 
(rev 169)
+++ trunk/Sources/WindowControllers/DecryptController.m 2006-08-26 18:29:34 UTC 
(rev 170)
@@ -309,7 +309,6 @@
 - (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];
-    
     return NO;
 }
 

Added: trunk/Sources/WindowControllers/GPSInfoController.h
===================================================================
--- trunk/Sources/WindowControllers/GPSInfoController.h 2006-08-26 15:28:38 UTC 
(rev 169)
+++ trunk/Sources/WindowControllers/GPSInfoController.h 2006-08-26 18:29:34 UTC 
(rev 170)
@@ -0,0 +1,47 @@
+/*
+ 
+ File:                 GPSInfoController.h
+ Program:              KisMAC
+ Author:           themacuser  themacuser -at- gmail.com
+ Description:  KisMAC is a wireless stumbler for MacOS X.
+ 
+ This file is part of KisMAC.
+ 
+ KisMAC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ 
+ KisMAC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with KisMAC; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface GPSInfoController : NSWindowController {
+       NSMenuItem* _showMenu;
+       IBOutlet NSLevelIndicator* _sats_indicator;
+       IBOutlet NSLevelIndicator* _hdop_indicator;
+       IBOutlet NSLevelIndicator* _fix_indicator;
+       IBOutlet NSTextField* _fix_type;
+       IBOutlet NSTextField* _lat_field;
+       IBOutlet NSTextField* _lon_field;
+       IBOutlet NSTextField* _vel_field;
+       IBOutlet NSPopUpButton* _speedType;
+       
+       float _vel;
+       float _velFactor;
+       
+       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;
+@end

Added: trunk/Sources/WindowControllers/GPSInfoController.m
===================================================================
--- trunk/Sources/WindowControllers/GPSInfoController.m 2006-08-26 15:28:38 UTC 
(rev 169)
+++ trunk/Sources/WindowControllers/GPSInfoController.m 2006-08-26 18:29:34 UTC 
(rev 170)
@@ -0,0 +1,114 @@
+/*
+ 
+ File:                 GPSInfoController.m
+ Program:              KisMAC
+ Author:           themacuser  themacuser -at- gmail.com
+ Description:  KisMAC is a wireless stumbler for MacOS X.
+ 
+ This file is part of KisMAC.
+ 
+ KisMAC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ 
+ KisMAC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with KisMAC; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#import "GPSInfoController.h"
+#import "WaveHelper.h"
+
+@implementation GPSInfoController
+
+- (void)awakeFromNib {
+    [[self window] setDelegate:self];
+}
+
+- (void)closeWindow:(NSWindow *)sheet returnCode:(int)returnCode 
contextInfo:(void *)contextInfo {
+       //[[self window] performClose:self];
+}
+
+- (void)updateDataNS:(double)ns EW:(double)ew ELV:(double)elv 
numSats:(int)sats HDOP:(double)hdop VEL:(float)vel {
+       _vel = vel;
+       
+       [_sats_indicator setCriticalValue:3];
+       if (!sats || ew > 180 || ns > 90 || vel < 0) {
+               [_fix_indicator setFloatValue:0.1];
+               [_fix_type setStringValue:@"NO"];
+               [_hdop_indicator setIntValue:8];
+               [_sats_indicator setIntValue:0];
+               [_lat_field setStringValue:@""];
+               [_lon_field setStringValue:@""];
+               [_vel_field setStringValue:@""];
+               _haveFix = 0;
+       } else if (!elv) {
+               [_fix_indicator setFloatValue:0.5];
+               [_fix_type setStringValue:@"2D"];
+               [_hdop_indicator setFloatValue:hdop];
+               [_sats_indicator setIntValue:sats];
+               [_lat_field setStringValue:[NSString 
stringWithFormat:@"%.5f",ns]];
+               [_lon_field setStringValue:[NSString 
stringWithFormat:@"%.5f",ew]];
+               [_vel_field setStringValue:[NSString 
stringWithFormat:@"%.5f",(_vel * _velFactor)]];
+               _haveFix = 1;
+       } else if (elv && sats) {
+               [_fix_indicator setFloatValue:1];
+               [_fix_type setStringValue:@"3D"];
+               [_hdop_indicator setFloatValue:hdop];
+               [_sats_indicator setIntValue:sats];
+               [_lat_field setStringValue:[NSString 
stringWithFormat:@"%.5f",ns]];
+               [_lon_field setStringValue:[NSString 
stringWithFormat:@"%.5f",ew]];
+               [_vel_field setStringValue:[NSString 
stringWithFormat:@"%.5f",(_vel * _velFactor)]];
+               _haveFix = 2;
+       }
+}
+
+- (IBAction)updateSpeed:(id)sender {
+               if ([[_speedType titleOfSelectedItem] isEqualToString:@"KT"]) {
+                       _velFactor = 1;
+               } else if ([[_speedType titleOfSelectedItem] 
isEqualToString:@"KPH"]) {
+                       _velFactor = 1.852;
+               } else if ([[_speedType titleOfSelectedItem] 
isEqualToString:@"MPH"]) {
+                       _velFactor = 1.15077945;
+               }
+               
+       if (_haveFix) {
+               [_vel_field setStringValue:[NSString 
stringWithFormat:@"%.5f",(_vel * _velFactor)]];
+       }
+}
+
+- (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];
+    [_showMenu setState:NSOffState];
+    return NO;
+}
+
+- (void)setShowMenu:(NSMenuItem *)menu
+{
+       _showMenu = menu;
+}
+
+- (void)fade:(NSTimer *)timer {
+    if ([[self window] alphaValue] > 0.0) {
+        // If window is still partially opaque, reduce its opacity.
+        [[self window] setAlphaValue:[[self window] alphaValue] - 0.2];
+    } else {
+        // Otherwise, if window is completely transparent, destroy the timer 
and close the window.
+        [timer invalidate];
+        [timer release];
+        
+               [[self window] close];
+               [self release];
+               [WaveHelper setGPSInfoController:NULL];
+    }
+}
+
+
+@end
\ No newline at end of file


Other related posts:

  • » [kismac] [binaervarianz] r170 - in trunk: KisMAC.xcodeproj Resources/Nibs/English.lproj Resources/Nibs/English.lproj/GPSDialog.nib Resources/Nibs/English.lproj/MainMenu.nib Sources/Controller Sources/Core Sources/Support Sources/WindowControllers