
		if (PlotPhase)  // raw Lambda phase spectrum
		{
			
			oPen = SelectObject(hdc, redPen) ;

		   for (      i = 0,
			         os = pSamp->OrderStep,
			     oldang = pSamp->phase[0] ;
		             i <= pSamp->max_order_index ;
					 i++
			   )
		   {
		     static spill, oldxp, oldyp, ixp, iyp ;

			or =  i * os + st.BBotOrd ;
			xp = (int)((double)wd * (or - lo_f)/fspan) + xlmar ;

             newang = pSamp->phase[i] ;
			     yp = rcArc.bottom -
			          ((int)((double)ht * newang / twopi) + ylmar) ;

		    // Remove transition lines from phase plot.

			// This works by finding the difference
			// between the new and old phase angles
			// and adding this to the old angle. If
			// the resultant angle either exceeds
			// twopi or goes below zero, implying
			// a full chart transition, the transition
			// is not plotted. It is not foolproof,
			// but works quite well.
			//
			// Also, take to the chart borders those
			// traces interrupted by transitions .

			   spill = 0 ;
		   if (!i) { oldxp = xp ; oldyp = yp ; oldang = newang ;}
		   if ((ang = oldang + adiff(newang, oldang)) > twopi)
			   spill = 1 ;
		   if  (ang < 0.0)
			   spill = 2 ;
		     transit = FullPhase(hdc, redPen,
							     oldang, newang,
							     spill,
								 xp, yp,
								 oldxp, oldyp,
								 D.top, D.bottom) ;
			 oldang = newang ;
			 oldxp = xp ;
			 oldyp = yp ;

			if (i == 0 || transit)
				MoveToEx(hdc, xp, yp, NULL) ;
			else
				LineTo(hdc, xp, yp) ;
			SelectObject(hdc, oPen) ;
		 }

			// mark phase shifts at lambda spectral peaks
			for ( i = 0 ; i < pSamp->Peaks ; i++)
			{
		      xp = (int)((double)wd * (pSamp->ordPeak[i] - lo_f)/fspan) + xlmar ;
			  yp = rcArc.bottom -
				   (int)((double)ht * pSamp->phaPeak[i] / twopi + (double)ylmar) ;

			  DrawCross(hWnd, invert, xp, yp, 3, redPen) ;
			}
       }

		if (mPlotPhase)	 // Moving mean Lambda phase spectrum
		{
			oPen = SelectObject(hdc, bluePen) ;

		   for (
			          i = 0,
				 oldang = pSamp->mphase[0],
				     os = pSamp->OrderStep ;
                     i <= pSamp->max_order_index ;
					 i++
			   )
		   {
		     static spill, oldxp, oldyp, ixp, iyp ;

			 or =  i * os + st.BBotOrd ;
			 xp = (int)((double)wd * (or - lo_f)/fspan) + xlmar ;
             newang = pSamp->mphase[i] ;
			 yp = rcArc.bottom -
			          ((int)((double)ht * newang / twopi) + ylmar) ;

			   spill = 0 ;
		   if (!i) { oldxp = xp ; oldyp = yp ; oldang = newang ;}
		   if ((ang = oldang + adiff(newang, oldang)) > twopi)
			   spill = 1 ;
		   if  (ang < 0.0)
			   spill = 2 ;
		     transit = FullPhase(hdc, bluePen,
							     oldang, newang,
							     spill,
								 xp, yp,
								 oldxp, oldyp,
								 D.top, D.bottom) ;
			 oldang = newang ;
			 oldxp = xp ;
			 oldyp = yp ;

			if (i == 0 || transit)
				MoveToEx(hdc, xp, yp, NULL) ;
			else
				LineTo(hdc, xp, yp) ;
		 }
			SelectObject(hdc, oPen) ;
			// mark phase shifts at lambda spectral peaks
			for ( i = 0 ; i < pSamp->mPeaks ; i++)
			{
		      xp = (int)((double)wd * (pSamp->mordPeak[i] - lo_f)/fspan) + xlmar ;
			  yp = rcArc.bottom -
				   (int)((double)ht * pSamp->mphaPeak[i] / twopi + (double)ylmar ) ;

			  DrawCross(hWnd, invert, xp, yp, 3, bluePen) ;
			}
       }

