Index: trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol/videoframe.cpp
===================================================================
--- trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol/videoframe.cpp	(revision 4173)
+++ trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol/videoframe.cpp	(revision 4174)
@@ -94,9 +94,11 @@
 	windowPainter->drawImage( 0,0, *m_pImage );
 
-  // Overlay camera center if it was determined from the LEDs
-  if( m_iCenterX != -1 )
-	windowPainter->setPen( Qt::white );
-  windowPainter->drawEllipse( m_iCenterX-2, m_iCenterY-2, 5, 5);
-	windowPainter->drawEllipse( m_iCenterX-4, m_iCenterY-4, 9, 9);
+	// Overlay camera center if it was determined from the LEDs
+	if( m_iCenterX > 1 )
+	{
+		windowPainter->setPen( Qt::white );
+		windowPainter->drawEllipse( m_iCenterX-2, m_iCenterY-2, 5, 5);
+		windowPainter->drawEllipse( m_iCenterX-4, m_iCenterY-4, 9, 9);
+	}
 
 	// Overlay Spots
@@ -149,5 +151,13 @@
 	{
 		windowPainter->setPen( Qt::green );
-		windowPainter->drawRect( m_iRefX-4, m_iRefY-4, 9, 9 );
+		if( m_iCenterX > 1 )
+		{
+			// Adapt spot for shift of camera center.
+			int iDx, iDy;
+			iDx = m_iCenterX - CAMERA_X;
+			iDy = m_iCenterY - CAMERA_Y;
+			windowPainter->drawRect( m_iRefX+iDx-4, m_iRefY+iDy-4, 9, 9 );
+		} else
+			windowPainter->drawRect( m_iRefX-4, m_iRefY-4, 9, 9 );
 	}
 
@@ -200,5 +210,5 @@
 			}
 		}
-		
+
 	}
 }
@@ -249,5 +259,5 @@
 		m_qrROI.setRight( x );
 	else
-	{	
+	{
 		if( x == m_qrROI.left() )
 			m_qrROI.setRight( event->x() -1 );
@@ -258,5 +268,5 @@
 		m_qrROI.setBottom( y );
 	else
-	{	
+	{
 		if( y == m_qrROI.bottom() )
 			m_qrROI.setBottom( event->y() -1 );
@@ -265,5 +275,5 @@
 	}
 	if ( m_qrROI.isValid() );
-	m_pSpotThread->setROI( m_qrROI );		
+	m_pSpotThread->setROI( m_qrROI );
 }
 
@@ -277,5 +287,5 @@
 		m_qrROI.setTop( event->y() );
 		m_qrROI.setBottom( event->y() -1 );
-		m_pSpotThread->setROI( m_qrROI );		
+		m_pSpotThread->setROI( m_qrROI );
 	}
 	if( event->button() == MidButton )
@@ -365,37 +375,37 @@
     // Check if this spot is compatible with the spot of the
 		// upper left LED
-    if ( pActualSpot->contains( LED1_X, LED1_Y ) )
-		{
-			dX1 = pActualSpot->getX() + (CAMERA_X - LED1_X);	
+    if ( pActualSpot->contains2( LED1_X, LED1_Y ) )
+		{
+			dX1 = pActualSpot->getX() + (CAMERA_X - LED1_X);
 			dY1 = pActualSpot->getY() + (CAMERA_Y - LED1_Y);
 			dX += dX1; dY += dY1;
 			m_qlLEDs.append( new VideoSpot( pActualSpot->getX(), pActualSpot->getY()) );
       iNumLEDs++;
-		}	
+		}
     // Check if this spot is compatible with the spot of the
 		// upper right LED
-    else if ( pActualSpot->contains( LED2_X, LED2_Y ) )
-		{
-			dX2 = pActualSpot->getX() + (CAMERA_X - LED2_X);	
+    else if ( pActualSpot->contains2( LED2_X, LED2_Y ) )
+		{
+			dX2 = pActualSpot->getX() + (CAMERA_X - LED2_X);
 			dY2 = pActualSpot->getY() + (CAMERA_Y - LED2_Y);
 			dX += dX2; dY += dY2;
 			m_qlLEDs.append( new VideoSpot( pActualSpot->getX(), pActualSpot->getY()) );
       iNumLEDs++;
-		}	
+		}
     // Check if this spot is compatible with the spot of the
 		// lower left LED
-    else if ( pActualSpot->contains( LED3_X, LED3_Y ) )
-		{
-			dX3 = pActualSpot->getX() + (CAMERA_X - LED3_X);	
+    else if ( pActualSpot->contains2( LED3_X, LED3_Y ) )
+		{
+			dX3 = pActualSpot->getX() + (CAMERA_X - LED3_X);
 			dY3 = pActualSpot->getY() + (CAMERA_Y - LED3_Y);
 			dX += dX3; dY += dY3;
 			m_qlLEDs.append( new VideoSpot( pActualSpot->getX(), pActualSpot->getY()) );
       iNumLEDs++;
-		}	
+		}
     // Check if this spot is compatible with the spot of the
 		// lower right LED
-    else if ( pActualSpot->contains( LED4_X, LED4_Y ) )
-		{
-			dX4 = pActualSpot->getX() + (CAMERA_X - LED4_X);	
+    else if ( pActualSpot->contains2( LED4_X, LED4_Y ) )
+		{
+			dX4 = pActualSpot->getX() + (CAMERA_X - LED4_X);
 			dY4 = pActualSpot->getY() + (CAMERA_Y - LED4_Y);
 			dX += dX4; dY += dY4;
@@ -408,7 +418,7 @@
   if( iNumLEDs != 0)
 	{
-		m_iCenterX = (int) rint(dX / iNumLEDs);	
+		m_iCenterX = (int) rint(dX / iNumLEDs);
 		m_iCenterY = (int) rint(dY / iNumLEDs);
-//		qDebug("Center %d %d", m_iCenterX, m_iCenterY);	
+//		qDebug("Center %d %d", m_iCenterX, m_iCenterY);
 	}
   qDebug("Center at: %d %d -- with %d LEDs",m_iCenterX, m_iCenterY, iNumLEDs );
