Symbol selector functional
Symbol selector functional
GPS Message generator overwrites GPS text if old gps text is in the
message

--- a/src/www/js/main/UI.js
+++ b/src/www/js/main/UI.js
@@ -25,7 +25,9 @@
 	 	'main/packet_interface',
 	 	'main/messaging',
 	 	'main/listen',
-	 	'main/settings'
+	 	'main/settings',
+
+	 	'packet/APRSPacket'
 	],
 	function(
 		React_Pane,
@@ -45,7 +47,9 @@
 		packet_interface,
 		messaging,
 		listen,
-		settings
+		settings,
+
+		APRSPacket
 	){
 
 		var UI = {};
@@ -98,12 +102,11 @@
 
 			var controls =  new React_Pane(React_Pane.VERTICAL),
 				controls_page = new React_Paged(),
-				address_bar =  new React_Pane(React_Pane.HORIZONTAL),
-				addr_mess =  new React_Pane(React_Pane.VERTICAL),
+				address_bar = new React_Pane(React_Pane.HORIZONTAL),
+				addr_mess = new React_Pane(React_Pane.VERTICAL),
 				mess_addr_bts = new React_Pane(React_Pane.HORIZONTAL),
 				buttons = new React_Pane(React_Pane.HORIZONTAL),
 
-				icon_pane = new React_Pane(React_Pane.VERTICAL),
 				filter_pane = new React_Pane(React_Pane.VERTICAL),
 
 				map_pane = new React_Pane(React_Pane.VERTICAL),
@@ -165,9 +168,10 @@
 				ssid_input = new React_Input('S SSID', {display_settings: {display: false, name_space: true}, type: 'select', def: '', type_properties: {options: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]}}),
 				dest_input = new React_Input('Destination', {display_settings: {display: true}, type: 'text', size_override: {width: 120}}),
 				dest_ssid_input = new React_Input('D SSID', {display_settings: {display: false, name_space: true}, type: 'select', def: '', type_properties: {options: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]}}),
-				symbol_button = new React_Image_Button(),
-				symbol_pane =  new React_Pane(React_Pane.VERTICAL, {width: 20, height: 50}),
+				symbol_button = new React_Image_Button(undefined, function(){controls_page.change_to(1);}),
+				symbol_pane =  new React_Pane(React_Pane.VERTICAL, {width: 20, height: 48}),
 				symbol_filler = new React_Pane(React_Pane.VERTICAL, {width: 'fill', height: 'fill'}),
+				symbols_pane =  new React_Pane(React_Pane.HORIZONTAL),
 
 				decoder_btn = new React_Button('Decoder', function(){settings_page.change_to(1);}),
 				map_btn = new React_Button('Map', function(){settings_page.change_to(2);}),
@@ -196,7 +200,7 @@
 			remote.init(remote_button);
 
 			// Set-Up Messaging
-			messaging.init(source_input, ssid_input, dest_input, message_input);
+			messaging.init(source_input, ssid_input, dest_input, message_input, APRSPacket.code_from_sym(current_symbol.slice(0, current_symbol.length - 4)));
 
 			if(localStorage['source_address'])
 				source_input.input.value = localStorage['source_address'];
@@ -280,6 +284,35 @@
 			symbol_pane.add(symbol_filler);
 			symbol_pane.add(symbol_button);
 
+			var load_list = [],
+				ret_func = function(){
+
+					messaging.symbol = APRSPacket.code_from_sym(this.image.name.slice(0, this.image.name.length - 4));
+					symbol_button.set_image(this.image);
+					controls_page.change_to(0);
+
+				};
+
+			for(var key in APRSPacket.SYMBOL_TABLE){
+				if(APRSPacket.SYMBOL_TABLE.hasOwnProperty(key)){
+
+					var sym_name = APRSPacket.SYMBOL_TABLE[key],
+						sym_button = new React_Image_Button(undefined, ret_func),
+						sym_to_load = [sym_button, sym_name];
+
+					symbols_pane.add(sym_button);
+					load_list.push(sym_to_load);
+
+				}
+			}
+
+			Symbol_Sprite_Sheet.on_load(
+				function(){
+					for(var i = 0; i < load_list.length; i++)
+						load_list[i][0].set_image(this.get_sprite(load_list[i][1] + '.gif'));
+				}
+			);
+
 			address_bar.add(source_input);
 			address_bar.add(ssid_input);
 			address_bar.add(symbol_pane);
@@ -308,6 +341,7 @@
 			controls.add(buttons);
 
 			controls_page.add(controls);
+			controls_page.add(symbols_pane);
 
 			// Add Reactive Tabs
 			UI.main.add(

--- a/src/www/js/main/messaging.js
+++ b/src/www/js/main/messaging.js
@@ -18,12 +18,14 @@
 
 		var messaging = {};
 
-		messaging.init = function(source, ssid, destination, message){
+		messaging.init = function(source, ssid, destination, message, symbol){
 
 			messaging.source = source;
 			messaging.ssid = ssid;
 			messaging.destination = destination;
 			messaging.message = message;
+
+			messaging.symbol = symbol;
 
 		};
 
@@ -32,7 +34,18 @@
 			Location.get_location(
 				function(position){
 
-					messaging.message.shift_value(APRS_Pos_TS.generate_message_text(position.coords));
+					var current_text = messaging.message.get_value(),
+						gps_text = APRS_Pos_TS.generate_message_text(position.coords, '/', messaging.symbol);
+
+					if(current_text.charAt(0) == '@' && current_text.length >= 27){
+
+						messaging.message.set_value(gps_text + current_text.slice(27, current_text.length));
+
+					} else {
+
+						messaging.message.shift_value(gps_text);
+
+					}
 
 				}
 			);

--- a/src/www/js/packet/APRSMessages/APRS_Pos_TS.js
+++ b/src/www/js/packet/APRSMessages/APRS_Pos_TS.js
@@ -20,7 +20,7 @@
 		math
 	){
 		
-		var APRS_Pos_TS = function(packet){
+		var APRS_Pos_TS = function(packet, symbol, symbol_table){
 
 			console.log("Parsing APRS_Pos_TS");
 
@@ -76,7 +76,7 @@
 				str += 'N';
 
 			// Symbol Table
-			str += '/';
+			str += symbol_table;
 
 			// Longitude
 			deg = Math.floor(Math.abs(coords.longitude));
@@ -95,7 +95,7 @@
 				str += 'E';
 
 			// Symbol
-			str += '_';
+			str += symbol;
 
 			//
 

--- a/src/www/js/packet/APRSPacket.js
+++ b/src/www/js/packet/APRSPacket.js
@@ -498,6 +498,21 @@
 		// \ Unused
 		// ] Unused
 		// ^ Unused
+	};
+
+
+	APRSPacket.code_from_sym = function(sym){
+
+		for(var key in APRSPacket.SYMBOL_TABLE){
+			if(APRSPacket.SYMBOL_TABLE.hasOwnProperty(key) && APRSPacket.SYMBOL_TABLE[key] == sym){
+
+				return key;
+
+			}
+		}
+
+		throw "Symbol not found: " + sym;
+
 	};
 
 	/**

--- a/src/www/js/reactive/React_Button.js
+++ b/src/www/js/reactive/React_Button.js
@@ -39,7 +39,7 @@
 			this.self.onclick = function(e){
 
 				if(t.callback)
-					t.callback(e);
+					t.callback.call(t, e);
 
 			};
 

--- a/src/www/js/reactive/React_Image_Button.js
+++ b/src/www/js/reactive/React_Image_Button.js
@@ -28,7 +28,7 @@
 			this.self.onclick = function(e){
 
 				if(t.callback)
-					t.callback(e);
+					t.callback.call(t, e);
 
 			};
 

--- a/src/www/js/util/graphics/Sprite.js
+++ b/src/www/js/util/graphics/Sprite.js
@@ -23,7 +23,9 @@
 		/**
 		 * @constructor
 		 */
-		var Sprite = function(image, frame){
+		var Sprite = function(name, image, frame){
+
+			this.name = name;
 
 			/**
 			 * Image this sprite is on

--- a/src/www/js/util/graphics/Sprite_Sheet.js
+++ b/src/www/js/util/graphics/Sprite_Sheet.js
@@ -62,7 +62,7 @@
 			for(var key in this.sprite_list){
 				if(this.sprite_list.hasOwnProperty(key)){
 
-					this.sprites[key] = new Sprite(this.image.image, this.sprite_list[key].frame);
+					this.sprites[key] = new Sprite(key, this.image.image, this.sprite_list[key].frame);
 
 				}
 			}