Index: /trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol/mirrorselector.cpp
===================================================================
--- /trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol/mirrorselector.cpp	(revision 4491)
+++ /trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol/mirrorselector.cpp	(revision 4492)
@@ -36,12 +36,26 @@
 #include "threadcontroller.h"
 
-#define MASKFILENAME  "/home/amc/share/amc/TypeMask.xbm"
-#define TYPE0FILENAME "/home/amc/share/amc/Type0Mirror.xbm"
-#define TYPE1FILENAME "/home/amc/share/amc/Type1Mirror.xbm"
-#define TYPE2FILENAME "/home/amc/share/amc/Type2Mirror.xbm"
-#define TYPE3FILENAME "/home/amc/share/amc/Type3Mirror.xbm"
-#define TYPE4FILENAME "/home/amc/share/amc/Type4Mirror.xbm"
-#define TYPE5FILENAME "/home/amc/share/amc/Type5Mirror.xbm"
-#define TYPE6FILENAME "/home/amc/share/amc/Type6Mirror.xbm"
+#define MASKFILENAME  "/home/amc/AMC/share/amc/TypeMask.xbm"
+#define TYPE0FILENAME "/home/amc/AMC/share/amc/Type0Mirror.xbm"
+#define TYPE1FILENAME "/home/amc/AMC/share/amc/Type1Mirror.xbm"
+#define TYPE2FILENAME "/home/amc/AMC/share/amc/Type2Mirror.xbm"
+#define TYPE3FILENAME "/home/amc/AMC/share/amc/Type3Mirror.xbm"
+#define TYPE4FILENAME "/home/amc/AMC/share/amc/Type4Mirror.xbm"
+#define TYPE5FILENAME "/home/amc/AMC/share/amc/Type5Mirror.xbm"
+#define TYPE6FILENAME "/home/amc/AMC/share/amc/Type6Mirror.xbm"
+
+#define TYPE1LFILENAME "/home/amc/AMC/share/amc/Type1MirrorLas.xpm"
+#define TYPE2LFILENAME "/home/amc/AMC/share/amc/Type2MirrorLas.xpm"
+#define TYPE3LFILENAME "/home/amc/AMC/share/amc/Type3MirrorLas.xpm"
+#define TYPE4LFILENAME "/home/amc/AMC/share/amc/Type4MirrorLas.xpm"
+#define TYPE5LFILENAME "/home/amc/AMC/share/amc/Type5MirrorLas.xpm"
+#define TYPE6LFILENAME "/home/amc/AMC/share/amc/Type6MirrorLas.xpm"
+
+#define TYPE1LMFILENAME "/home/amc/AMC/share/amc/Type1MirrorLas.xbm"
+#define TYPE2LMFILENAME "/home/amc/AMC/share/amc/Type2MirrorLas.xbm"
+#define TYPE3LMFILENAME "/home/amc/AMC/share/amc/Type3MirrorLas.xbm"
+#define TYPE4LMFILENAME "/home/amc/AMC/share/amc/Type4MirrorLas.xbm"
+#define TYPE5LMFILENAME "/home/amc/AMC/share/amc/Type5MirrorLas.xbm"
+#define TYPE6LMFILENAME "/home/amc/AMC/share/amc/Type6MirrorLas.xbm"
 
 #define MAX(a,b) ((a>b) ? a : b )
@@ -55,16 +69,37 @@
 	QBitmap theMask( MASKFILENAME );
 	
-	QPixmap* pixType[7];
-	pixType[0] = new QPixmap( TYPE0FILENAME );
-	pixType[1] = new QPixmap( TYPE1FILENAME );
-	pixType[2] = new QPixmap( TYPE2FILENAME );
-	pixType[3] = new QPixmap( TYPE3FILENAME );
-	pixType[4] = new QPixmap( TYPE4FILENAME );
-	pixType[5] = new QPixmap( TYPE5FILENAME );
-	pixType[6] = new QPixmap( TYPE6FILENAME );
+	m_pixType[0] = new QPixmap( TYPE0FILENAME );
+	m_pixType[1] = new QPixmap( TYPE1FILENAME );
+	m_pixType[2] = new QPixmap( TYPE2FILENAME );
+	m_pixType[3] = new QPixmap( TYPE3FILENAME );
+	m_pixType[4] = new QPixmap( TYPE4FILENAME );
+	m_pixType[5] = new QPixmap( TYPE5FILENAME );
+	m_pixType[6] = new QPixmap( TYPE6FILENAME );
+
+	m_pixType[7] = new QPixmap( TYPE1LFILENAME );
+	m_pixType[8] = new QPixmap( TYPE2LFILENAME );
+	m_pixType[9] = new QPixmap( TYPE3LFILENAME );
+	m_pixType[10] = new QPixmap( TYPE4LFILENAME );
+	m_pixType[11] = new QPixmap( TYPE5LFILENAME );
+	m_pixType[12] = new QPixmap( TYPE6LFILENAME );
+
+	m_bitMask[0] = new QBitmap( TYPE1LMFILENAME );
+	m_bitMask[1] = new QBitmap( TYPE2LMFILENAME );
+	m_bitMask[2] = new QBitmap( TYPE3LMFILENAME );
+	m_bitMask[3] = new QBitmap( TYPE4LMFILENAME );
+	m_bitMask[4] = new QBitmap( TYPE5LMFILENAME );
+	m_bitMask[5] = new QBitmap( TYPE6LMFILENAME );
+
+  m_pixType[7]->setMask( *m_bitMask[0]);
+  m_pixType[8]->setMask( *m_bitMask[1]);
+  m_pixType[9]->setMask( *m_bitMask[2]);
+  m_pixType[10]->setMask( *m_bitMask[3]);
+  m_pixType[11]->setMask( *m_bitMask[4]);
+  m_pixType[12]->setMask( *m_bitMask[5]);
+
 	// Check if we found the files with the pixmaps
-	for(int i=0; i<7; i++)
+	for(int i=0; i<13; i++)
 	{
-		if( pixType[i]->isNull() )
+		if( m_pixType[i]->isNull() )
 		{
 	
@@ -72,5 +107,5 @@
    		   				"Can't open PIXMAP files for buttons",
 								"The programm didn't find the files \'Type?Mirror.xbm\'\n"
-								"We expect this file in the directory \'/home/amc/share/amc\'\n",
+								"We expect this file in the directory \'/home/amc/AMC/share/amc\'\n",
 								"Quit" );
 			exit(-1);									
@@ -120,5 +155,4 @@
 	    m_mirrorButton[i+8][j+8] = pButton;
 	    pButton->setFlat( true );
-	    pButton->setFlat( true );
 	    pButton->setMinimumSize( QSize( 30, 30 ) );
 	    pButton->setMaximumSize( QSize( 50, 50 ) );
@@ -129,5 +163,5 @@
  		  AMCMirrorPanel* thePanel = g_theMirror->panelAt( j+8, i+8 );
  		  int type = thePanel->type();
-	 		pButton->setPixmap( *pixType[type] );
+	 		pButton->setPixmap( *m_pixType[type] );
 	 		if( type == 0)
  	   		pButton->setEnabled( false );
@@ -149,4 +183,5 @@
 		}
 	}		
+	m_pSelectedButton = 0;
 	connect( this, SIGNAL(clicked(int)), SLOT(buttonSelectedSlot(int)) );
 
@@ -155,4 +190,14 @@
 MirrorSelector::~MirrorSelector()
 {
+	for(int i=0; i<13; i++)
+	{
+		delete m_pixType[i];
+    m_pixType[i] = NULL;
+  }
+	for(int i=0; i<6; i++)
+	{
+		delete m_bitMask[i];
+    m_bitMask[i] = NULL;
+  }
 }
 
@@ -163,101 +208,17 @@
 	int j = -1 * ((index / 17) - 8);
 	AMCMirrorPanel* pPanel = g_theMirror->panelAt( i+8, j+8 );
+	QButton* pButton = m_mirrorButton[j+8][i+8];
+	if( m_pSelectedButton )
+		m_pSelectedButton->setBackgroundMode( QWidget::PaletteBackground );
+
+	pButton->setBackgroundMode( QWidget::PaletteMid );
+	m_pSelectedButton = pButton;
 	emit panelSelectedSignal( pPanel );
 
 }
-/** No descriptions */
-/*
-void MirrorSelector::saveMirrorPanels()
-{
-	QCString line;
-	
-	QFile file( POSFILENAME );
-	if( file.open( IO_WriteOnly ) )
-	{
-		QTextStream stream( &file );
-		for(int j=0; j<17; j++)
-		{
-			line.sprintf("# Column %d\n",j-8);
-			stream << line;
-			for(int i=0; i<17; i++)
-			{
-				line.sprintf(" %2d %2d\t%4d\t%4d\n",
-				m_Panel[i][j]->i(),
-				m_Panel[i][j]->j(),
-				m_Panel[i][j]->getX(),
-				m_Panel[i][j]->getY() );
-				stream << line;
-			}
-		}
-					
-	}
-	else
-	{
-	   	int iRes = QMessageBox::critical( this,
-   										 "Can't open panel position description file",
-										 "The programm tried to open the file \'PanelPos.txt\'\n"
-										 "in the directory \'/home/amc/\'.\n"
-										 "The file may not have the right permissions.\n",
-										 "Continue" );
-	}
-	file.close();
-					
-}
-*/
-/** Read he panel descriptions from the file "Panels.txt".
-	This file contains for each panel a line with the following contents:
-	i	j	type	port	box		driver	installed
-	
-	i: is the first panel index (counting from left to right)
-	j: is the second panel index (counting from bottom to top)
-	type: the panel type (see the file for a description of types)
-	port: the serial port this box is connected to.
-		  (The numbering corresponds to the numbers on the cables.
-		   If only 1 Meilhaus ME8100 card is installed on linux boxes
-		   we have the following correspondance to device files
-		   port 1 == /dev/ttyS4 ... port 8 = /dev/ttyS11)
-	box: the number of the AMC box.
-	driver: The internal AMC driver to which this panel is connected.
-	installed: Flag indicating if this panel is installed (0=no, 1=yes)
-*/
-/*
-void MirrorSelector::readPanelDescription(){
-	
-	m_iNumPanels = 0;
-	QFile file( PANELFILENAME );
-	if( file.open( IO_ReadOnly ) )
-	{
-		QTextStream stream( &file );
-		QString line;
-		while( !stream.eof() )
-		{
-			line = stream.readLine();
-			if( line[0] == '#')
-				continue;
-			int ii, ij, iType, iPort, iBox, iDriver, iInst;
-			sscanf( line.data(),"%d %d %d %d %d %d %d",
-								&ii, &ij, &iType, &iPort,
-								&iBox, &iDriver, &iInst );
-			m_Panel[ii+8][ij+8] = new AMCMirrorPanel( ii, ij, iType, iPort, iBox, iDriver );
-			m_Panel[ii+8][ij+8]->setInstalled(iInst != 0);
-			if(iInst != 0)
-				m_iNumPanels++;
-		}
-	}
-	else
-	{
-	   	int iRes = QMessageBox::critical( this,
-   										 "Can't open panel description file",
-										 "The programm didn't find the file \'Panels.txt\'\n"
-										 "We expect this file in the directory \'/home/amc/\'\n",
-										 "Quit" );
-		exit(-1);									
-	}
-
-	file.close();
-}
-*/
-/** Here we read the stored panel positions from the file PanelPos.txt
-	We then go through all panels, center them and go to the stored position.
+
+/**
+ * Here we read the stored panel positions from the file PanelPos.txt
+ * We then go through all panels, center them and go to the stored position.
  */
 void MirrorSelector::initPanelPositions()
@@ -291,51 +252,4 @@
 
 
-/** Read the stored panel positions from the file "PanelPos.txt"
-	This file contains for each panel a line with the following contents:
-	i	j	X	Y
-	
-	i: is the first panel index (counting from left to right)
-	j: is the second panel index (counting from bottom to top)
-	X: position of the X motor relative to the center position
-	Y: position of the Y motor relative to the center position
- */
-/*
-void MirrorSelector::readPanelPositions()
-{
-	QFile file( POSFILENAME );
-	if( file.open( IO_ReadOnly ) )
-	{
-		QTextStream stream( &file );
-		QString line;
-		while( !stream.eof() )
-		{
-			line = stream.readLine();
-			
-			// Skip comment lines
-			if( line[0] == '#')
-				continue;
-				
-			int ii, ij, iX, iY;
-			sscanf( line.data(),"%d %d %d %d",
-								&ii, &ij, &iX, &iY );
-			m_Panel[ii+8][ij+8]->setX(iX);
-			m_Panel[ii+8][ij+8]->setY(iY);
-		}
-	}
-	else
-	{
-	   	int iRes = QMessageBox::critical( this,
-   										 "Can't open panel position description file",
-										 "The programm didn't find the file \'PanelPos.txt\'\n"
-										 "We expect this file in the directory \'/home/amc/\'\n",
-										 "Quit" );
-		exit(-1);									
-	}
-	file.close();
-	
-	return;
-}
-*/
-
 /** Save the positions to the file. */
 void MirrorSelector::savePositionsSlot()
@@ -345,7 +259,8 @@
 }
 
-/** Check to see if the right mouse button was pressed and
-	show the context menu in this case.
-  */
+/**
+ * Check to see if the right mouse button was pressed and
+ * show the context menu in this case.
+ */
 void MirrorSelector::mousePressEvent( QMouseEvent* p_pEvent )
 {
@@ -353,2 +268,15 @@
 		m_contextMenu->exec( QCursor::pos() );
 }
+
+/**
+ * Change the icon to show that the laser is on or off.
+ */
+void MirrorSelector::toggelLaser( AMCMirrorPanel* p_pPanel, bool p_zOn )
+{
+	AMCPushButton* pButton = m_mirrorButton[p_pPanel->j()+8][p_pPanel->i()+8];
+
+ 	int type = p_pPanel->type();
+	if( p_zOn )
+		type += 6; 		
+	pButton->setPixmap( *m_pixType[type] );
+}
Index: /trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol/mirrorselector.h
===================================================================
--- /trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol/mirrorselector.h	(revision 4491)
+++ /trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol/mirrorselector.h	(revision 4492)
@@ -34,6 +34,4 @@
 	~MirrorSelector();
 	
-	/** No descriptions */
-//	void saveMirrorPanels();
 	/** Check to see if the right mouse button was pressed and show the context menu in this case. */
 	void mousePressEvent( QMouseEvent* p_pEvent );
@@ -61,4 +59,10 @@
 	/** Context menu, shown when the user hits the right mouse button.  */
 	QPopupMenu* m_contextMenu;
+	/** Array conmtaining the pixmaps for the icons of the buttons.  */
+	QPixmap* m_pixType[13];
+	/** Array conmtaining the bitmaps for the icon masks of the buttons.  */
+	QBitmap* m_bitMask[6];
+	/** Pointer to the currently selected button.  */
+	QButton* m_pSelectedButton;
 	
 signals: // Signals
@@ -104,4 +108,8 @@
      */
 //  void readPanelPositions();
+public slots: // Public slots
+  /** Change the icon to show that the laser is on or off.
+ */
+  void toggelLaser(  AMCMirrorPanel* p_pPanel, bool p_zOn );
 };
 
