Exemplo n.º 1
0
Arquivo: K213.c Projeto: gaorlov/DAAS
static void k213_Operate (int menubar, int menuItem, void *callbackData, int panel)
{
    int p, m, port, width, height;
    gpibioPtr dev = callbackData;
    k213Ptr quadsrc = dev->device;
    char label[256];

    SetMenuBarAttribute (menubar, menuItem, ATTR_DIMMED, TRUE);

    p = dev->iPanel? dev->iPanel: LoadPanel (utilG.p, "k213u.uir", K213);
    dev->iPanel = p;
	
    Fmt (label, "Keithley 213 : %s", dev->label);
    SetPanelAttribute (p, ATTR_TITLE, label);

    m = LoadMenuBar (p, "k213u.uir", K213MENUS);
    
    SetPanelMenuBar (p, m);

    SetPanelAttribute (p, ATTR_CALLBACK_DATA, dev);

    SetMenuBarAttribute (m, K213MENUS_FILE_SAVE, ATTR_CALLBACK_DATA, dev);
    SetMenuBarAttribute (m, K213MENUS_FILE_LOAD, ATTR_CALLBACK_DATA, dev);
    SetMenuBarAttribute (m, K213MENUS_FILE_GPIB, ATTR_CALLBACK_DATA, dev);

    for (port = 0; port < 4; port++) {
        quadsrc->port[port].panel = LoadPanel (p, "k213u.uir", K213PORT);
        GetPanelAttribute (quadsrc->port[port].panel, ATTR_WIDTH, &width);
        GetPanelAttribute (quadsrc->port[port].panel, ATTR_HEIGHT, &height);
        
        SetPanelPos (quadsrc->port[port].panel, 17+2, (port*(width+4))+2);
        Fmt (label, "port %i", port+1);
        SetCtrlVal (quadsrc->port[port].panel, K213PORT_TITLE, label);

        SetCtrlAttribute (quadsrc->port[port].panel, K213PORT_DISPLAY, ATTR_CALLBACK_DATA, dev);
        SetCtrlAttribute (quadsrc->port[port].panel, K213PORT_AUTORANGE, ATTR_CALLBACK_DATA, dev);
        SetCtrlAttribute (quadsrc->port[port].panel, K213PORT_RANGE, ATTR_CALLBACK_DATA, dev);
        SetCtrlAttribute (quadsrc->port[port].panel, K213PORT_SETUP, ATTR_CALLBACK_DATA, dev);
		SetPanelAttribute(quadsrc->port[port].panel, ATTR_CALLBACK_DATA, dev);
        DisplayPanel (quadsrc->port[port].panel);
    }

    SetPanelAttribute (p, ATTR_WIDTH, (width+4)*port);
    SetPanelAttribute (p, ATTR_HEIGHT, height+4+17);
    SetPanelPos (p, VAL_AUTO_CENTER, VAL_AUTO_CENTER);
    k213_UpdateControls (p, dev);

    devPanel_Add (p, dev, k213_UpdateReadings);
    DisplayPanel (p);
}
Exemplo n.º 2
0
void InitManipulateCallback(int menubar, int menuItem, void *callbackData, int panel)
{
    int i, height1, height2;
    channelPtr chan;

    channel_InitViewPanel();
    InstallCtrlCallback (chanview.p1, CHANVIEW_CHANNELS,
                         ManipulateSelectionCallback, 0);
    ClearListCtrl (chanview.p1, CHANVIEW_CHANNELS);
    for (i = 0; i < channelG.channels.nItems; i++)
    {
        chan = channellist_GetItem (i);
        if (!chan->curves.nItems)
            InsertListItem (chanview.p1, CHANVIEW_CHANNELS, -1, chan->label, i);
    }

    SetCtrlIndex (chanview.p1, CHANVIEW_CHANNELS, 0);
    GetCtrlVal (chanview.p1, CHANVIEW_CHANNELS, &i);
    chan = channellist_GetItem (i);
    InstallCtrlCallback (chanview.p1, CHANVIEW_GRAPH,
                         ManipulateGraphCallback, chan);

    channel_UpdateViewPanel(chan);

    SetCtrlAttribute (chanview.p1, CHANVIEW_GRAPH, ATTR_CTRL_MODE,
                      VAL_HOT);
    SetCtrlAttribute (chanview.p1, CHANVIEW_GRAPH, ATTR_NUM_CURSORS, 1);
    SetCursorAttribute (chanview.p1, CHANVIEW_GRAPH, 1, ATTR_CURSOR_MODE,
                        VAL_SNAP_TO_POINT);
    SetCursorAttribute (chanview.p1, CHANVIEW_GRAPH, 1,
                        ATTR_CROSS_HAIR_STYLE, VAL_SHORT_CROSS);
    SetCursorAttribute (chanview.p1, CHANVIEW_GRAPH, 1, ATTR_CURSOR_COLOR,
                        VAL_YELLOW);
    GetPanelAttribute (chanview.p1, ATTR_HEIGHT, &height1);

    chanview.p2 = LoadPanel (chanview.p1, "chanfncu.uir", MANIP);
    
    GetPanelAttribute (chanview.p2, ATTR_HEIGHT, &height2);
    SetPanelAttribute (chanview.p1, ATTR_HEIGHT, height1+height2+6);
    SetPanelPos (chanview.p2, height1, 6);

    InstallCtrlCallback (chanview.p2, MANIP_READING,
                         ManipulateReadingCallback, chan);

    DisplayPanel (chanview.p2);
    InstallPopup (chanview.p1);
    MessagePopup ("Manipulate Channel Message", "Only channels not connected to a curve may be edited");
}
Exemplo n.º 3
0
int CVICALLBACK Save (int panel, int control, int event,
		void *callbackData, int eventData1, int eventData2)
{
	char *value = "";
	switch (event)
	{
		case EVENT_COMMIT:
			 value = (char*)malloc(50);
			 memset(value,0,50);
			 GetPanelAttribute (configHandle, ATTR_TITLE, value);
			 if (strcmp("CheckBBUIP", value)==0)
			 {
				 if(1==WriteConfig(MENUBAR_CONFIG_CONFIGIP))
			 	{
					SetCtrlAttribute (configHandle, CONFIG_BOX, ATTR_TEXT_BGCOLOR, VAL_OFFWHITE);
					SetCtrlAttribute (configHandle, CONFIG_BOX, ATTR_CTRL_MODE, VAL_INDICATOR);
			 		SetCtrlVal (panelHandle, PANEL_TEXTBOX,  "Save bbuip.txt successfully!\r\n");  
			 	}
			 
			 }
			 if (strcmp("CheckCMD", value)==0)       
			 {
				 if(1==WriteConfig(BBUCOMMON_CONFIGCMD))
			 	{
					SetCtrlAttribute (configHandle, CONFIG_BOX, ATTR_TEXT_BGCOLOR, VAL_OFFWHITE);
					SetCtrlAttribute (configHandle, CONFIG_BOX, ATTR_CTRL_MODE, VAL_INDICATOR);
			 		SetCtrlVal (panelHandle, PANEL_TEXTBOX,  "Save command.txt successfully!\r\n");  
			 	}
			 }
			 free(value);
			 
			break;
	}
	return 0;
}
/* 配置并弹出信号分析面板 */
void popupPanelForGraph(int pHdl){
	int i = getGraphIndex(pHdl, 0); //Need a index to find one of the six graphs.
	char title[50];
	for(int j=0; j<(READ_LENGTH/24); j++)
		tempData[i][j] = resultData[i][j];
	Delay(0.1);
	for(int z=(READ_LENGTH/24),x = 0; z<(READ_LENGTH/12); z++,x++)
		tempData[i][z] = resultData[i][x];
	// 从uir文件中加载 信号分析面板
	if(PopPanels[i] <=0 ){
		if ((PopPanels[i] = LoadPanel(0, "MainPanel.uir", PopupPanel)) < 0)
			showError("Load PopupPanel Error!");
		DisplayPanel(PopPanels[i]);
		PopGraphs[i] = PopupPanel_PopGraph1;
		GetPanelAttribute(pHdl, ATTR_TITLE, title);
		SetPanelAttribute(PopPanels[i], ATTR_TITLE, title);
		SetCtrlAttribute(PopPanels[i], PopGraphs[i], ATTR_GRID_COLOR, plotGridColor);
		SetCtrlAttribute(PopPanels[i], PopGraphs[i], ATTR_GRAPH_BGCOLOR, VAL_TRANSPARENT);
		//temp SetAxisScalingMode(PopPanels[i], PopGraphs[i], VAL_LEFT_YAXIS, VAL_MANUAL, yAxisRange[0], yAxisRange[1]);
		PopGPlots[i] = PlotY(PopPanels[i], PopGraphs[i], tempData[i], READ_LENGTH/12, 
							 VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID,1, plotLineColor);
	}else{
		SetActivePanel(PopPanels[i]);
	}
	
}
Exemplo n.º 5
0
Arquivo: util.c Projeto: gaorlov/DAAS
void utilG_Init (void (*DiscardPanels)(void))
{
    int p, control, top, height, width;
	int grw, chw, asw, acw;
    

    utilG.acq.pt = 0;
    utilG.acq.nPts = 0;
    utilG.acq.status = ACQ_NONE;

    utilG.p = LoadPanel (0, "utilu.uir", BG);
    
    utilG.DiscardPanels = DiscardPanels;

	SetPanelAttribute (utilG.p, ATTR_WINDOW_ZOOM, VAL_MAXIMIZE);
    DisplayPanel (utilG.p);
	
	GetCtrlAttribute(utilG.p, BG_GRAPHS, ATTR_WIDTH, &grw);
	GetCtrlAttribute(utilG.p, BG_CHANNELS, ATTR_WIDTH, &chw);
	GetCtrlAttribute(utilG.p, BG_ACQSETUP, ATTR_WIDTH, &asw);
	GetCtrlAttribute(utilG.p, BG_ACQCHANNELS, ATTR_WIDTH, &acw);
	GetPanelAttribute(utilG.p, ATTR_WIDTH, &width);
	
	SetCtrlAttribute(utilG.p, BG_GRAPHS, ATTR_LEFT,			(3*width/20) - grw);
	SetCtrlAttribute(utilG.p, BG_CHANNELS, ATTR_LEFT, 		(7*width/20) - chw);
	SetCtrlAttribute(utilG.p, BG_ACQSETUP, ATTR_LEFT, 		(9*width/15) - asw);
	SetCtrlAttribute(utilG.p, BG_ACQCHANNELS, ATTR_LEFT, 	(9*width/10) - acw);
	
	initP = LoadPanel (utilG.p, "utilu.uir", INIT);
    
    SetPanelPos (initP, VAL_AUTO_CENTER, VAL_AUTO_CENTER);

    SetCtrlAttribute (initP, INIT_TEXT, ATTR_VISIBLE, FALSE);
    DisplayPanel (initP);

    GetUserEvent (1, &p, &control);
    switch (control) {
        case INIT_CONTROL: utilG.acq.status = ACQ_DONE; break;
        case INIT_ANALYSIS: utilG.acq.status = ACQ_NONE; break;
        case INIT_EXIT:
            utilG_Exit();
            QuitUserInterface(0);
            exit (EXIT_SUCCESS);
            break;
    }
    SetMouseCursor (VAL_HOUR_GLASS_CURSOR);

    SetCtrlAttribute (initP, INIT_TEXT, ATTR_VISIBLE, TRUE);
    SetCtrlAttribute (initP, INIT_TEXT_10, ATTR_VISIBLE, FALSE);
    SetCtrlAttribute (initP, INIT_CONTROL, ATTR_VISIBLE, FALSE);
    SetCtrlAttribute (initP, INIT_ANALYSIS, ATTR_VISIBLE, FALSE);
    SetCtrlAttribute (initP, INIT_EXIT, ATTR_VISIBLE, FALSE);

    GetCtrlAttribute (initP, INIT_TEXT, ATTR_TOP, &top);
    GetCtrlAttribute (initP, INIT_TEXT, ATTR_HEIGHT, &height);
    SetPanelAttribute (initP, ATTR_HEIGHT, top+height+6);
    util_ChangeInitMessage ("DAAS Utilities...");
}
/* 系统初始化 */
void initVars(void){
	/*-- After load Panel, you can init args' value right here ---*/
	//Panel relative Vals
	GetPanelAttribute(panelHdl, ATTR_WIDTH, &pWidth);
	GetPanelAttribute(panelHdl, ATTR_HEIGHT, &pHeight);
	GetPanelAttribute(panelHdl, ATTR_MENU_HEIGHT, &mHeight);
	validMonNum = 6;
	averSpaceH = 8; averSpaceV = 20; extraRight = 150;
	pHeight = pHeight - mHeight;
	cWidth = (pWidth - extraRight - averSpaceH*3)/3;
	cHeight = (pHeight - averSpaceV*2)/2;
	plotBakgColor = MakeColor(200, 200, 200); //Set background color of graphs
	plotGridColor = MakeColor(10, 10, 10);
	plotLineColor = MakeColor(136, 0, 25);
	graphScaleMode = VAL_MANUAL; //or VAL_MANUAL VAL_AUTOSCALE
	//x,y坐标的标值范围
	xAxisRange[0] = 0.0, xAxisRange[1] = 9.0; //temp
	yAxisRange[0] =0.00, yAxisRange[1] = 3.00;
	
	popPanelIsPloting = 0;
	//Create a ThreadPool
	if(setupThreadPool()<0){
		MessagePopup("s", "Create thread pool error.");
	}
	//ChildPanel,TabPage、and Popup panel's Vals
	tabWidth = pWidth-extraRight-averSpaceH*3;
	tabHeight = pHeight - averSpaceV*3;
	
	dataSrc = 0;
	for(int i=0; i<validMonNum; i++)
		signalShowingStat[i] = 1;
	//init the necessary Directory this system needs
	initDirectorySets();
	refreshDimmedStat();
	isDataAcqRunning = 0;
}
/* 辅助函数-将TabPage还原回ChildPanel */
int ConvertTabPageToChildPanel(int panel, int tab, int tabIndex){
    int     childPanel, tabPanel, ctrl;
    char    title[256];
	//Get the tab-page label and handle
    GetTabPageAttribute(panel, tab, tabIndex, ATTR_LABEL_TEXT, title);
    GetPanelHandleFromTabPage(panel, tab, tabIndex, &tabPanel);
    //Create new child panel and set its attributes
    childPanel = createChildPanel(title, tabIndex);
    //Get the first control in the tab-page to convert.
	GetPanelAttribute(tabPanel, ATTR_PANEL_FIRST_CTRL, &ctrl);
	while(ctrl != 0){
		//Duplicate the control to the child panel
        DuplicateCtrl(tabPanel, ctrl, childPanel, 0, 
			VAL_KEEP_SAME_POSITION, VAL_KEEP_SAME_POSITION);
        //Get the next control to duplicate
        GetCtrlAttribute(tabPanel, ctrl, ATTR_NEXT_CTRL, &ctrl);
	}
    return childPanel;
}
Exemplo n.º 8
0
int PRE_OcultarPanel(int iPanel)
{
	int iLeft=0;
	int i=0;
	
	GetPanelAttribute(iPanel, ATTR_LEFT, &iLeft);
	
	i=0;
	while (i<50)
	{
		SetPanelAttribute(iPanel, ATTR_LEFT, iLeft-i);
		DelayWithEventProcessing(0.0);
		i+=10;
	}
	
	SetPanelAttribute (iPanel, ATTR_VSCROLL_OFFSET, 0);
	SetPanelAttribute (iPanel, ATTR_HSCROLL_OFFSET, 0);
	
	HidePanel(iPanel);
	
	PRE_PanelVisible(iPanel);	
	
	return 0;
}
Exemplo n.º 9
0
/*****************************************************************************
.
. Función C:			PRE_UbicarPanel
. Responsable:			César Armando Cruz Mendoza
. Descripcion: 			Despliega un panel en pantalla considerando las
.						condiciones de la misma como lo es la posicion del
.						panel anterior y si existe el menu desplegado
. Parámetro de entrada:	Ninguno
. Parámetro de salida:	Referencia a la cadena de caracteres con el mensaje
. Fecha de creación:	31 de Marzo de 2014
.
*****************************************************************************/
int PRE_UbicarPanel(int iPanel)
{
	int iBarra=0;
	int iAlto=0;
	int iAncho=0;
	int iExistePanel=0;
	int iLeftPanelExiste=0;
	static int iPanelAnterior=0;
	

	if (iPanel!=0)
	{
		if (iPanelAnterior != 0)
			GetPanelAttribute (iPanelAnterior, ATTR_LEFT, &iLeftPanelExiste);
	
	
		if ((iPanelAnterior != 0) && (iPanelAnterior != iPanel))
		{
			//implementa la animación de salida
			int i=0;
		
			while (i<60)
			{
				SetPanelAttribute(iPanelAnterior, ATTR_LEFT, iLeftPanelExiste-i);
				DelayWithEventProcessing (.001);
				i+=20;
			}
		
			SetPanelAttribute (iPanelAnterior, ATTR_VSCROLL_OFFSET, 0);
			SetPanelAttribute (iPanelAnterior, ATTR_HSCROLL_OFFSET, 0);
		
			HidePanel(iPanelAnterior);
		}
	
	
		GetPanelAttribute(iPanelMenuPrincipal, ATTR_VISIBLE, &iExistePanel);
		if (iExistePanel==1)
			iLeftPanelExiste = ANCHO_MENU;
	
		GetPanelAttribute (iPanelPrincipal, ATTR_HEIGHT, &iAlto);
		GetPanelAttribute (iPanelPrincipal, ATTR_WIDTH, &iAncho);
	
		GetCtrlAttribute(iPanelPrincipal, pPrincipal_SPLITTER, ATTR_TOP, &iBarra);
	
		SetPanelAttribute(iPanel, ATTR_TOP, iBarra+8);
		SetPanelAttribute(iPanel, ATTR_LEFT, iLeftPanelExiste);
		SetPanelAttribute (iPanel, ATTR_TITLEBAR_VISIBLE, 0);
		SetPanelAttribute (iPanel, ATTR_FRAME_STYLE, VAL_HIDDEN_FRAME);
	
		SetPanelAttribute (iPanel, ATTR_HEIGHT, iAlto-120);
		SetPanelAttribute (iPanel, ATTR_WIDTH, iAncho-iLeftPanelExiste);
	
		GetPanelAttribute(iPanel, ATTR_VISIBLE, &iExistePanel);

		if (iExistePanel==0)
		{
			DisplayPanel(iPanel);
			iPanelVisible = iPanel;
		}
	
		iPanelAnterior = iPanel;
	}
	
	return 0;
}
Exemplo n.º 10
0
/// HIFN Callback for the SLM pixels panel 
int CVICALLBACK SLMpixels_Callback (int panel, int event, void *callbackData,
		int eventData1, int eventData2)
{
	switch (event)
	{
		case EVENT_PANEL_SIZE:
		{	
			// get the new panel size
			int xsize, ysize;
			GetPanelAttribute(panel, ATTR_WIDTH,  &xsize);
			GetPanelAttribute(panel, ATTR_HEIGHT, &ysize);
			
			// check if we are not dealing with an event fired after a programmatical resize
			if ((xsize != SLM_getXres()) || (ysize != SLM_getYres()))
			{
			
				// manually check for a maximize event, which sets the y size of the panel to 1061
				// so we use that value to detect a maximization (NOTE: This code is highly specific to 
				// the UCP lab computer and/or the Windows version running on that)
				if (ysize == 1061)
				{
					// yes, apparently we tried to maximize the panel
				
					// however, 1061 is not what we want, so we
					// set the size manually again to the desired SLM resolution
					SetPanelSize (panel, 1080, 1920);
				
					// set the upper left corner to the upper left corner of the screen,
					// and hope we have banned the titlebar
					SetPanelPos(panel, 0, 1920);
				}
			
				// adjust the canvas size accordingly
				SetCtrlAttribute(panel, SLMpixels_SLMcanvas, ATTR_WIDTH,  xsize);
				SetCtrlAttribute(panel, SLMpixels_SLMcanvas, ATTR_HEIGHT, ysize);
			
				// get the size of the simulation canvas
				int SimX, SimY;
				GetCtrlAttribute(pnlSimPanel, SimPanel_CANVAS, ATTR_WIDTH,  &SimX);
				GetCtrlAttribute(pnlSimPanel, SimPanel_CANVAS, ATTR_HEIGHT, &SimY);
				
				// get the subsampling factor
				int subsample;
				GetCtrlVal(TabPage_0, TABPANEL_SubSample, &subsample);

				// all data structures of the SLM need to be resized to acommodate the new 
				// number of pixels, so we just reintialise the SLM in its entirety			
				SLM_initialise(xsize, ysize, SimX, SimY, subsample);
			
				// update the SLM panel and the simulation Panel (if toggled)
				SLM_update(pnlSLMpixels, SLMpixels_SLMcanvas, pnlSimPanel, SimPanel_CANVAS, 1);
			
				// update the displayed information about the SLM 
				UpdateSLMinfo();
			}
				
			break;
		}
	}
	return 0;
}
Exemplo n.º 11
0
//callback associated with the controls on a panel that is loaded at run-time
int CVICALLBACK RuntimeCtrlCB (int panelHandle, int control, int event, void *callbackdata, int eventData1, int eventData2)
{
	char childWindowMenu[MAX_STRING_SIZE];
	int isChildPanel;
	int numCtrls;
	int menuBarHandle;
	int menuID;
	int ctrlType;
	char ctrlString[MAX_STRING_SIZE];
	char menuString[MAX_STRING_SIZE];
	CTRLSTRUCT* ctrlArray = callbackdata;
	int releaseID =0;

	switch(event)
	{
		case EVENT_RIGHT_CLICK:
			if(ctrlArray == NULL)
				return 0;

			menuBarHandle = NewMenuBar (0);
			menuID = NewMenu(menuBarHandle,"",-1);

			GetCtrlAttribute(panelHandle,control,ATTR_CTRL_STYLE,&ctrlType);

			GetStyleNameForCtrl(ctrlType, ctrlString);
			sprintf(menuString,"Control Type: %s",ctrlString);

			NewMenuItem(menuBarHandle,menuID,menuString,-1,0,NULL,NULL);

			GetPanelAttribute(panelHandle,ATTR_NUM_CTRLS,&numCtrls);

			strcpy(ctrlString, FindCtrlCBName(ctrlArray,control,numCtrls));

			sprintf(menuString,"Ctrl Callback: %s",strlen(ctrlString)==0?"<null>":ctrlString);

			NewMenuItem(menuBarHandle,menuID,menuString,-1,0,NULL,NULL);

			InsertSeparator(menuBarHandle, menuID, -1);
			GetPanelAttribute (panelHandle, ATTR_PANEL_PARENT, &isChildPanel);

			if(!isChildPanel)
			   sprintf(childWindowMenu,"Confine Window");
			else
			   sprintf(childWindowMenu,"Release Window");

			releaseID = NewMenuItem (menuBarHandle, menuID, childWindowMenu, -1, 0, 0, 0);

			if(releaseID == RunPopupMenu(menuBarHandle,menuID,panelHandle,eventData1,eventData2,0,0,0,0))
			{
			   SetPanelParenthood(panelHandle,isChildPanel);
			}

			DiscardMenu(menuBarHandle,menuID);
			DiscardMenuBar(menuBarHandle);

			//indicate to the panel that this is a control callback
			gbCtrlCB = 1;
 		break;
	}

	return 0;
}
/// HIFN callback function called by the ScanController when it sets new variable values
void ScanController_Callback(void)
{
    // check if the SLM pixel panel is in fullscreen mode,
    // otherwise send an error message to ScanController
    int xsize, ysize;
    GetPanelAttribute(pnlSLMpixels, ATTR_WIDTH,  &xsize);
    GetPanelAttribute(pnlSLMpixels, ATTR_HEIGHT, &ysize);
    if ( (xsize != 1920) || (ysize != 1080) )
    {
        // signal the server that the SLM is not working properly, and abort
        ScanController_Client_ClientError();
        return;
    }

    // variable to indicate whether the current pattern needs to be re-calculated
    int recalc_pattern = 0;

    // loop over all the Client Controls
    for (int n = 0; n < gNumClientControls; n++)
    {
        // check if the associated variable value was updated
        if (gClientControl_Updated[n])
        {
            // yes, update the control value
            switch (gClientControl_DataType[n])
            {
            case VAL_INTEGER:
                SetCtrlVal(gClientControl_Panel[n], gClientControl_Control[n], *((int*) gClientControl_Values[n]));
                break;
            case VAL_DOUBLE:
                SetCtrlVal(gClientControl_Panel[n], gClientControl_Control[n], *((double*) gClientControl_Values[n]));
                break;
            default:
                break;
            }

            // check if the pattern needs to be updated
            recalc_pattern |= gClientControl_RequiresPatternCalculation[n];
        }
    }

    // do we need to recalculate the SLM base phase pattern?
    if (recalc_pattern)
    {
        switch (SLM_getCurrentPattern())
        {
        case SLM_BEAMSHAPE_STD:

            // call the standard beamshaping callback
            //BeamShape_Callback (int panel, int control, EVENT_COMMIT, NULL, SLM_NO_UPDATE, 0);

            break;

        case SLM_BEAMSHAPE_ARB:

            // call the beamshaping callback
            //LoadFile_Callback (int panel, int control, EVENT_COMMIT, NULL, SLM_NO_UPDATE, 0);

            break;

        case SLM_BEAMSPLIT_PROJECT:

            // call the spot pattern 'callback'
            setSpotPatternFromParameters();

            break;

        case SLM_BEAMSPLIT_IFTA:

            // call the beamsplitting callback
            //PhaseRetrieval_Callback (int panel, int control, EVENT_COMMIT, NULL, SLM_NO_UPDATE, 0);

            break;

        case SLM_BEAMSPLIT_PHASEGRATING:

            // set the phase grating
            setPhaseGratingFromParameters();

            break;

        case SLM_SHACKHARTMANN:

            ShackHartmann_Callback (TabPage_7, 0, EVENT_COMMIT, NULL, SLM_NO_UPDATE, 0);

            break;

        case SLM_BEAMSHAPE_CHAR:

            CharacterGo_Callback(TabPage_2_1, TABPANEL_8_CharacterGo, EVENT_COMMIT, NULL, SLM_NO_UPDATE, 0);

            break;

        default:

            // not supported

            break;
        }
    }

    // update the SLM settings from the control panel values
    //setDefaultValuesFromPanel();
    Lens_Callback			(TabPage_0, TABPANEL_LensXphase,	  EVENT_VAL_CHANGED, NULL, SLM_NO_UPDATE, 0);
    Lens_Callback			(TabPage_0, TABPANEL_LensYphase,	  EVENT_VAL_CHANGED, NULL, SLM_NO_UPDATE, 0);
    HorizTrans_Callback		(TabPage_0, TABPANEL_HorizTrans, 	  EVENT_VAL_CHANGED, NULL, SLM_NO_UPDATE, 0);
    VertTrans_Callback		(TabPage_0, TABPANEL_VertTrans, 	  EVENT_VAL_CHANGED, NULL, SLM_NO_UPDATE, 0);

    // update the SLM
    SLM_update(pnlSLMpixels, SLMpixels_SLMcanvas, pnlSimPanel, SimPanel_CANVAS, recalc_pattern);

    // wait a short while for the image to stabilise (?)
    Delay(0.2);

    // tell the ScanController that we are finished
    ScanController_Client_ClientReady();
}