--- a/branches/Gxsm-2x3-transition-sig/plug-ins/hard/sranger_mk2_hwi_eventhandling.C
+++ b/branches/Gxsm-2x3-transition-sig/plug-ins/hard/sranger_mk2_hwi_eventhandling.C
@@ -53,6 +53,8 @@
 #include "gtkspinbuttonsci.h"
 #include "../plug-ins/hard/modules/sranger_mk2_ioctl.h"
 
+#include "MK3-A810_spmcontrol/dsp_signals.h"  
+
 #define UTF8_DEGREE    "\302\260"
 #define UTF8_MU        "\302\265"
 #define UTF8_ANGSTROEM "\303\205"
@@ -90,6 +92,8 @@
 				0,0
 };
 
+
+
 const char* lablookup[]  = { "ADC0-I", "ADC1-SP", "ADC2-Mx2", "ADC3-Mx3", "ADC4", "ADC5","ADC6","ADC7",
 			      "Zmon", "Umon", 
 			      "LockIn0", "LockIn1stA", "LockIn1stB", "LockIn2ndA", "LockIn2ndB",
@@ -110,16 +114,54 @@
 //#define XSM_DEBUG_PG(X)  std::cout << X << std::endl;
 #define XSM_DEBUG_PG(X) ;
 
+const char* DSPControl::vp_label_lookup(int i){
+	if (i > 11 && i < 16){
+		int k=i-12;
+		if (vp_input_id_cache[k] < 0)
+			vp_input_id_cache[k] = sranger_common_hwi->query_module_signal_input (DSP_SIGNAL_VECPROBE0_INPUT_ID + k);
+		if (vp_input_id_cache[k] >= 0){
+			return sranger_common_hwi->lookup_signal_name_by_index (vp_input_id_cache[k]);
+		}
+	}		
+	return lablookup[i];
+}
+
+const char* DSPControl::vp_unit_lookup(int i){
+	if (i > 11 && i < 16){
+		int k=i-12;
+		if (vp_input_id_cache[k] < 0)
+			vp_input_id_cache[k] = sranger_common_hwi->query_module_signal_input (DSP_SIGNAL_VECPROBE0_INPUT_ID + k);
+		if (vp_input_id_cache[k] >= 0){
+			return sranger_common_hwi->lookup_signal_unit_by_index (vp_input_id_cache[k]);
+		}
+	}		
+	return unitlookup[i];
+}
+
+double DSPControl::vp_scale_lookup(int i){
+	double DAC2Ulookup[]={ SRV10, SRV10,  SRV10,  SRV10,  SRV10,  SRV10,   SRV10,  SRV10,
+			       ZAngFac, BiasFac, SRV10,  SRV10,  SRV10, SRV10,  SRV10, 
+			       1.,
+			       1e3/frq_ref, XAngFac, YAngFac, ZAngFac, BiasFac, PhaseFac, 1.,
+			       0.
+	};
+
+	if (i > 11 && i < 16){
+		int k=i-12;
+		if (vp_input_id_cache[k] < 0)
+			vp_input_id_cache[k] = sranger_common_hwi->query_module_signal_input (DSP_SIGNAL_VECPROBE0_INPUT_ID + k);
+		if (vp_input_id_cache[k] >= 0){
+			return sranger_common_hwi->lookup_signal_scale_by_index (vp_input_id_cache[k]);
+		}
+	}		
+	return DAC2Ulookup[i];
+}
+
+
 int DSPControl::Probing_eventcheck_callback( GtkWidget *widget, DSPControl *dspc){
 	static ProfileControl *pc[MAX_NUM_CHANNELS][MAX_NUM_CHANNELS];
 	int popped=0;
 	GArray **garr;
-	double DAC2Ulookup[]={ SRV10, SRV10,  SRV10,  SRV10,  SRV10,  SRV10,   SRV10,  SRV10,
-			       ZAngFac, BiasFac, SRV10,  SRV10,  SRV10, SRV10,  SRV10, 
-			       1.,
-			       1e3/dspc->frq_ref, XAngFac, YAngFac, ZAngFac, BiasFac, PhaseFac, 1.,
-			       0.
-	};
 
 	XSM_DEBUG_PG ("DSPControl::Probing_eventcheck_callback -- enter");
 
@@ -164,11 +206,11 @@
 
 			for (int src=0; msklookup[src]>=0 && src < MAX_NUM_CHANNELS; ++src)
 				if (dspc->vis_Source & msklookup[src]){
-					g_ptr_array_add (glabarray, (gpointer) lablookup[src]);
-					g_ptr_array_add (gsymarray, (gpointer) unitlookup[src]);
+					g_ptr_array_add (glabarray, (gpointer) dspc->vp_label_lookup (src));
+					g_ptr_array_add (gsymarray, (gpointer) dspc->vp_unit_lookup (src));
 					++chunksize;
 				}
-		
+			XSM_DEBUG_PG("DBG-M1");
 			if (chunksize > 0 && chunksize < MAX_NUM_CHANNELS){
 				double dataset[MAX_NUM_CHANNELS];
 				ProbeEntry *pe = new ProbeEntry ("Probe", time(0), glabarray, gsymarray, chunksize);
@@ -176,21 +218,25 @@
 					int j=0;
 					for (int src=0; msklookup[src]>=0 && src < MAX_NUM_CHANNELS; ++src){
 						if (dspc->vis_Source & msklookup[src])
-							dataset[j++] = DAC2Ulookup[src] * g_array_index (garr [expdi_lookup[src]], double, i);
+							dataset[j++] = dspc->vp_scale_lookup (src) * g_array_index (garr [expdi_lookup[src]], double, i);
 					}
 					pe->add ((double*)&dataset);
 				}
 				se->add_event (pe);
+				XSM_DEBUG_PG("DBG-M2");
 			}
 		}
+		XSM_DEBUG_PG("DBG-M3");
 
 		free_probedata_array_set (garr, dspc);	
 	}
+	XSM_DEBUG_PG("DBG-M4");
 
 	if (popped > 0)
 		if (gapp->xsm->MasterScan)
 			gapp->xsm->MasterScan->view->update_events ();
 
+	XSM_DEBUG_PG("DBG-M5");
 	XSM_DEBUG_PG ("DSPControl::Probing_eventcheck_callback -- exit");
 	return 0;
 }
@@ -204,6 +250,8 @@
 	UnitObj *UXaxis = new UnitObj(xua, " ", "g", xlab);
 	UnitObj *UYaxis = new UnitObj(yua,  " ", "g", ylab);
 	double xmin, xmax, x;
+
+	XSM_DEBUG_PG("DBG-M VIS  " << xlab << " : " << ylab);
 
 	XSM_DEBUG_PG ("DSPControl::probedata_visualize -- enter");
 	XSM_DEBUG_PG ("Probing_graph_callback Visualization X-limits" );
@@ -218,22 +266,34 @@
 	xmax *= xmult;
 	xmin *= xmult;
 
-	XSM_DEBUG_PG ("Probing_graph_callback Visualization U&T/Rz" );
+	XSM_DEBUG_PG("DBG-M VIS 1");
+
+	XSM_DEBUG_PG("Probing_graph_callback Visualization U&T/Rz" );
 	UXaxis->SetAlias (xlab);
 	UYaxis->SetAlias (ylab);
 	if (!pc){
+		XSM_DEBUG_PG("DBG-M VIS c1  ci=" << current_i);
 		XSM_DEBUG_PG ("Probing_graph_callback Visualization -- new pc" );
 		XSM_DEBUG_PG (ylab << " i:" << current_i);
 		gchar   *title  = g_strdup_printf ("Vector Probe, Channel: %s", ylab);
+		XSM_DEBUG_PG("DBG-M VIS c2  " << title << " xr= " << xmin << " .. " << xmax << " " << ylab);
+                gchar *resid = g_strdelimit (g_strconcat (xlab,ylab,NULL), " ;:()[],./?!@#$%^&*()+-=<>", '_');
 		pc = new ProfileControl (title, current_i, 
 					  UXaxis, UYaxis, 
 					  xmin, xmax,
-					  ylab);
+					  resid);
+		g_free (resid);
+		XSM_DEBUG_PG("DBG-M VIS c3");
 		pc->scan1d->mem2d->Resize (current_i, join_same_x ? nas:1);
+		XSM_DEBUG_PG("DBG-M VIS c4");
 		pc->SetTitle (title);
+		XSM_DEBUG_PG("DBG-M VIS c5");
 		pc->set_ys_label (0, ylab);
+		XSM_DEBUG_PG("DBG-M VIS c6");
 		g_free (title);
+		XSM_DEBUG_PG("DBG-M VIS cx");
 	} else {	
+		XSM_DEBUG_PG("DBG-M VIS u1");
 		XSM_DEBUG_PG ("Probing_graph_callback Visualization -- add/update pc" );
 		
 		if(!join_same_x || nas < pc->get_scount ()){
@@ -256,8 +316,10 @@
 			pc->SetTitle (ylab, TRUE);
 			pc->set_ys_label (si, ylab);
 		}
-	}
-
+		XSM_DEBUG_PG("DBG-M VIS ux");
+	}
+
+	XSM_DEBUG_PG("DBG-M VIS av");
 	XSM_DEBUG_PG ("Probing_graph_callback Visualization -- setup data" );
 
 	gint spectra=0; // used to count spectra
@@ -291,6 +353,7 @@
 			spectra_average[spectra_index][1] = g_array_index (probedata_y, double, i);
 		}
 	}
+	XSM_DEBUG_PG("DBG-M VIS avx");
 	XSM_DEBUG_PG ("**Update: #spectra:  " << spectra 
 		      << " #points: " << spectra_index 
 		      << " si: " << si 
@@ -305,6 +368,7 @@
 
 	// Create graph for averaged data; you will find them in the pc-array above 
 	if (spectra>0 && (vis_PlotAvg & plot_msk || vis_PlotSec & plot_msk)){
+		XSM_DEBUG_PG("DBG-M VIS avg1");
 		XSM_DEBUG_PG ("Probing_graph_callback Visualization new pc -- put Av/Sec data" );
 		if (!pc_av){
 			XSM_DEBUG_PG ("Probing_graph_callback Visualization -- new pc_av" );
@@ -351,7 +415,10 @@
 			pc_av->UpdateArea ();
 			pc_av->show ();
 		}
+		XSM_DEBUG_PG("DBG-M VIS avgx");
 	} 
+	delete UXaxis;
+	delete UYaxis;
 	XSM_DEBUG_PG ("DSPControl::probedata_visualize -- exit");
 }
 
@@ -420,14 +487,6 @@
 		XSM_DEBUG_PG ("DSPControl::Probing_graph_callback -- exit no data");
 		return 0;
 	}
-
-	double DAC2Ulookup[]={ SRV10, SRV10,  SRV10,  SRV10,  SRV10,  SRV10,   SRV10,  SRV10,
-			       ZAngFac, BiasFac, SRV10,  SRV10,  SRV10, SRV10,  SRV10,  
-			       1.,
-			       1e3/dspc->frq_ref, XAngFac, YAngFac, ZAngFac, BiasFac, PhaseFac, 1.,
-			       0.
-	};
-		
 
 //xxxxxxxxxxxxx atach event to active channel, if one exists -- manual mode xxxxxxxxxxxxxxxxxxxxx
 
@@ -468,30 +527,35 @@
 			
 			for (int src=0; msklookup[src]>=0 && src < MAX_NUM_CHANNELS; ++src)
 				if (dspc->vis_Source & msklookup[src]){
-					g_ptr_array_add (glabarray, (gpointer) lablookup[src]);
-					g_ptr_array_add (gsymarray, (gpointer) unitlookup[src]);
+					g_ptr_array_add (glabarray, (gpointer) dspc->vp_label_lookup (src));
+					g_ptr_array_add (gsymarray, (gpointer) dspc->vp_unit_lookup (src));
 					++chunksize;
 				}
+			XSM_DEBUG_PG("DBG-Mb1");
 			
 			if (chunksize > 0 && chunksize < MAX_NUM_CHANNELS){
 				double dataset[MAX_NUM_CHANNELS];
 				ProbeEntry *pe = new ProbeEntry ("Probe", time(0), glabarray, gsymarray, chunksize);
 				for (int i = j0; i < j; i++){
 					int k=0;
+					XSM_DEBUG_PG("DBG-Mb2");
 					for (int src=0; msklookup[src]>=0 && src < MAX_NUM_CHANNELS; ++src){
 						if (dspc->vis_Source & msklookup[src])
-							dataset[k++] = DAC2Ulookup[src] * g_array_index (dspc->garray_probedata [expdi_lookup[src]], double, i);
+							dataset[k++] = dspc->vp_scale_lookup (src) * g_array_index (dspc->garray_probedata [expdi_lookup[src]], double, i);
 					}
 					pe->add ((double*)&dataset);
+					XSM_DEBUG_PG("DBG-Mb3");
 				}
 				se->add_event (pe);
 			}
+			XSM_DEBUG_PG("DBG-Mb4");
 
 			j0=j;
 
 			gapp->xsm->MasterScan->view->update_events ();
 			XSM_DEBUG_PG ("Probing_graph_callback have ScanEvent?" );
 
+			XSM_DEBUG_PG("DBG-Mb5");
 
 //			break;
 		}
@@ -509,10 +573,13 @@
 
 // on-the-fly visualisation graphs update
 	for (int xmap=0; msklookup[xmap]>=0; ++xmap){
-		if ((dspc->vis_XSource & msklookup[xmap]) && (dspc->vis_Source & msklookup[xmap]))
+		if ((dspc->vis_XSource & msklookup[xmap]) && (dspc->vis_Source & msklookup[xmap])){
 			for (int src=0, source_index=0; msklookup[src]>=0; ++src){
+				XSM_DEBUG_PG("DBG-Mbb0a " << dspc->vp_label_lookup (src));
 				if (xmap == src) continue;
+				XSM_DEBUG_PG("DBG-Mbb0b " << dspc->vp_label_lookup (src));
 				if ((dspc->vis_PSource & msklookup[src]) && (dspc->vis_Source & msklookup[src])){
+					XSM_DEBUG_PG("DBG-Mbb1 " << dspc->vp_label_lookup (src));
 					XSM_DEBUG_PG ("Probing_graph_callback Visualisation xmap=" << xmap << " src=" << src );
 					dspc->probedata_visualize (
 						dspc->garray_probedata [expdi_lookup[xmap]], 
@@ -521,10 +588,12 @@
 						dspc->probe_pc_matrix[xmap][dspc->vis_XJoin ? src0:src], 
 						dspc->probe_pc_matrix[MAX_NUM_CHANNELS+xmap][MAX_NUM_CHANNELS+dspc->vis_XJoin ? src0:src],
 						msklookup[src],
-						lablookup[xmap], unitlookup[xmap], DAC2Ulookup[xmap],
-						lablookup[src], unitlookup[src], DAC2Ulookup[src],
+						dspc->vp_label_lookup (xmap), dspc->vp_unit_lookup (xmap), dspc->vp_scale_lookup (xmap),
+						dspc->vp_label_lookup (src), dspc->vp_unit_lookup (src), dspc->vp_scale_lookup (src),
 						dspc->current_probe_data_index, source_index++, num_active_sources, dspc->vis_XJoin);
+					XSM_DEBUG_PG("DBG-Mbb1x");
 				} else { // clean up unused windows...
+					XSM_DEBUG_PG("DBG-Mbb1e");
 					if (dspc->probe_pc_matrix[xmap][src]){
 						delete dspc->probe_pc_matrix[xmap][src]; // get rid of it now
 						dspc->probe_pc_matrix[xmap][src] = NULL;
@@ -534,8 +603,10 @@
 						dspc->probe_pc_matrix[MAX_NUM_CHANNELS+xmap][MAX_NUM_CHANNELS+src] = NULL;
 					}
 				}
+				XSM_DEBUG_PG("DBG-Mbb1ex");
 			}
-		else{   // remove not used ones now! pc[2*MAX_NUM_CHANNELS][2*MAX_NUM_CHANNELS]
+		}else{   // remove not used ones now! pc[2*MAX_NUM_CHANNELS][2*MAX_NUM_CHANNELS]
+			XSM_DEBUG_PG("DBG-Mbb2");
 			for (int src=0; src<MAX_NUM_CHANNELS; ++src){
 				if (dspc->probe_pc_matrix[xmap][src]){
 					XSM_DEBUG_PG ("Probing_graph_callback cleanup xmap=" << xmap << " src=" << src );
@@ -549,7 +620,9 @@
 				}
 			}
 		}
-	}
+		XSM_DEBUG_PG("DBG-Mbb2x");
+	}
+	XSM_DEBUG_PG("DBG-Mbb3");
 
 	XSM_DEBUG_PG ("Probing_graph_callback DONE." );
 	busy=FALSE;
@@ -572,14 +645,6 @@
 	if (!dspc->current_probe_data_index && !dspc->nun_valid_hdr) 
 		return 0;
 	
-
-	double DAC2Ulookup[]={ SRV10, SRV10,  SRV10,  SRV10,  SRV10,  SRV10,   SRV10,  SRV10,
-			       ZAngFac, BiasFac, SRV10,  SRV10,  SRV10,   SRV10,  SRV10,   
-			       1.,
-			       1e3/dspc->frq_ref, XAngFac, YAngFac, ZAngFac, BiasFac, PhaseFac, 1.,
-			       0.
-	};
-	       
 	const gchar *separator = "\t";
 
 	std::ofstream f;
@@ -651,9 +716,9 @@
 		f << "# Cmap[" << i << "]" << separator 
 		  << msklookup[i] << separator 
 		  << expdi_lookup[i] << separator 
-		  << lablookup[i] << separator 
-		  << DAC2Ulookup[i] << separator 
-		  << unitlookup[i] << "/DAC" << separator 
+		  << dspc->vp_label_lookup (i) << separator 
+		  << dspc->vp_scale_lookup (i) << separator 
+		  << dspc->vp_unit_lookup (i) << "/DAC" << separator 
 		  << (dspc->vis_Source & msklookup[i] ? "Yes":"No") << std::endl;
 
 	f << "#C " << std::endl;
@@ -669,12 +734,12 @@
 			continue;
 
 		for (int i=13; msklookup[i]>=0; ++i){
-			double ymult = DAC2Ulookup[i];
+			double ymult = dspc->vp_scale_lookup (i);
 			if (i>13) 
 				f << ", ";
-			f << " \"" << lablookup[i] << "\"="
+			f << " \"" << dspc->vp_label_lookup (i) << "\"="
 			  << (ymult * g_array_index (dspc->garray_probedata [expdi_lookup[i]], double, j))
-			  << " " << unitlookup[i];
+			  << " " << dspc->vp_unit_lookup (i);
 		}
 		f << ")" << std::endl;
 	}
@@ -690,18 +755,18 @@
 
 		for (int xmap=0; msklookup[xmap]>=0; ++xmap)
 			if ((dspc->vis_XSource & msklookup[xmap]) && (dspc->vis_Source & msklookup[xmap])){
-				double xmult = DAC2Ulookup[xmap];
+				double xmult = dspc->vp_scale_lookup (xmap);
 				if (i == -1)
-					f << "\"" << lablookup[xmap] << " (" << unitlookup[xmap] << ")\"" << separator;
+					f << "\"" << dspc->vp_label_lookup (xmap) << " (" << dspc->vp_unit_lookup (xmap) << ")\"" << separator;
 				else
 					f << (xmult * g_array_index (dspc->garray_probedata [expdi_lookup[xmap]], double, i)) << separator;
 			}
 
 		for (int src=0; msklookup[src]>=0; ++src)
 			if (dspc->vis_Source & msklookup[src]){
-				double ymult = DAC2Ulookup[src];
+				double ymult = dspc->vp_scale_lookup (src);
 				if (i == -1)
-					f << "\"" << lablookup[src] << " (" << unitlookup[src] << ")\"" << separator;
+					f << "\"" << dspc->vp_label_lookup (src) << " (" << dspc->vp_unit_lookup (src) << ")\"" << separator;
 				else
 					f << (ymult * g_array_index (dspc->garray_probedata [expdi_lookup[src]], double, i)) << separator;
 			}
@@ -806,6 +871,8 @@
 
 void DSPControl::init_probedata_arrays (){
 	pv_lock = TRUE;
+	for(int i=0; i<4; ++i)
+		vp_input_id_cache[i]=-1;
 	for (int i=0; i<NUM_PROBEDATA_ARRAYS; ++i){
 		if (!garray_probedata[i]){
 			garray_probedata [i] = g_array_sized_new (FALSE, TRUE, sizeof (double), DEFAULT_PROBE_LEN); // preallocated, can increase