/* 系统辅助-在Log信息台打印Log信息 */ void addLog(char *msg, int whichBox, int pHdl){ char msgTemp[256]; Fmt(msgTemp,"[%s] -%c ", TimeStr(), 62); strcat(msgTemp, msg); strcat(msgTemp, "\n"); if(0 == whichBox){ //Show Log on Main Panel's Log Box InsertTextBoxLine(panelHdl, MainPanel_MainLogBox, 0, msgTemp); }else{ int i = getGraphIndex(pHdl, 1); InsertTextBoxLine(PopPanels[i], PopupPanel_PopLogBox, 0, msgTemp); } }
/// HIFN callback function when the phase retrieval settings have been changed int CVICALLBACK PhaseRetrieval_Callback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_VAL_CHANGED: // one of the control parameters was changed, update the preview break; case EVENT_COMMIT: { // read out all the control parameters int spotxoffset, spotyoffset, sigxoffset, sigyoffset; int spotxspacing, spotyspacing, numxspots, numyspots; int phaseconstraint; double phasestep; GetCtrlVal(panel, TABPANEL_5_SpotYSpacing, &spotyspacing); GetCtrlVal(panel, TABPANEL_5_SpotXSpacing, &spotxspacing); GetCtrlVal(panel, TABPANEL_5_NumYSpots, &numyspots); GetCtrlVal(panel, TABPANEL_5_NumXSpots, &numxspots); GetCtrlVal(panel, TABPANEL_5_SpotXOffset, &spotxoffset); GetCtrlVal(panel, TABPANEL_5_SpotYOffset, &spotyoffset); GetCtrlVal(panel, TABPANEL_5_SigYOffset, &sigyoffset); GetCtrlVal(panel, TABPANEL_5_SigXOffset, &sigxoffset); GetCtrlVal(panel, TABPANEL_5_PhaseConstraint, &phaseconstraint); GetCtrlVal(panel, TABPANEL_5_PhaseStep, &phasestep); // check if it was the GO-button that was pressed if (control == TABPANEL_5_PhaseRetrievalGo) { // yes, we have to start phase retrieval with the current parameters // check if the asked spotpattern fits the SLM if ((sigxoffset + spotxoffset + numxspots * (spotxspacing+1)) >= gXsize) { char msg[1024]; sprintf(msg, "The spotpattern exceeds the SLM size in the x-dimension. Adjust X spots or X spacing."); InsertTextBoxLine (panel, TABPANEL_5_Output, -1, msg); } else if ((sigyoffset + spotyoffset + numyspots * (spotyspacing +1)) >= gYsize) { char msg[1024]; sprintf(msg, "The spotpattern exceeds the SLM size in the y-dimension. Adjust Y spots or Y spacing."); InsertTextBoxLine (panel, TABPANEL_5_Output, -1, msg); } else { SLM_generateSpotArray(pnlSLMpixels, SLMpixels_SLMcanvas, pnlSimPanel, SimPanel_CANVAS, panel, TABPANEL_5_Output, numxspots, numyspots, spotxspacing, spotyspacing, sigxoffset, sigyoffset, spotxoffset, spotyoffset, phaseconstraint, phasestep * PI); // check if we need to update if (eventData1 != SLM_NO_UPDATE) { // update the SLM panel and the simulation Panel (if toggled) SLM_update(pnlSLMpixels, SLMpixels_SLMcanvas, pnlSimPanel, SimPanel_CANVAS, 1); } } } break; } } return 0; }