コード例 #1
0
ファイル: K213.c プロジェクト: 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);
}
コード例 #2
0
ファイル: util.c プロジェクト: 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...");
}
コード例 #3
0
ファイル: acquire.c プロジェクト: homer362s/DAAS_2015
void AcqInfoCallback(int menubar, int menuItem, void *callbackData, int panel)
{
    if (!acqinfoP) {
        acqinfoP = LoadPanel (utilG.p, "acquireu.uir", ACQINFO);
        if (acqinfoP < 0) acqinfoP = 0;
        else {
            SetPanelPos (acqinfoP, VAL_AUTO_CENTER, VAL_AUTO_CENTER);
            
            DisplayPanel (acqinfoP);
        }
    }
}
コード例 #4
0
ファイル: chanfnc.c プロジェクト: gaorlov/DAAS
void InitDecimateCallback(int menubar, int menuItem, void *callbackData, int panel)
{
    int i;
    channelPtr chan;

    chanfunc.p = LoadPanel (0, "chanfncu.uir", DECIMATE);
    
    util_InitClose (chanfunc.p, DECIMATE_CLOSE, FALSE);
    SetPanelPos (chanfunc.p, 100, 100);

    channellist_Copy (chanfunc.p, DECIMATE_CHANNELS);

    InstallPopup (chanfunc.p);
}
コード例 #5
0
ファイル: chanfnc.c プロジェクト: gaorlov/DAAS
void InitExponentCallback(int menubar, int menuItem, void *callbackData, int panel)
{
    int i;
    channelPtr chan;

    chanfunc.p = LoadPanel (0, "chanfncu.uir", EXPONENT);
    
    util_InitClose (chanfunc.p, EXPONENT_CLOSE, FALSE);
    SetPanelPos (chanfunc.p, 100, 100);

    channellist_Copy (chanfunc.p, EXPONENT_CHANNELS);

    InstallPopup (chanfunc.p);
}
コード例 #6
0
ファイル: K236.c プロジェクト: gaorlov/DAAS
static void OperateK236 (int menubar, int menuItem, void *callbackData, int panel)
{
    int p, m;
    gpibioPtr dev = callbackData;
    k236Ptr smu = dev->device;
    char label[256];

    SetMenuBarAttribute (menubar, menuItem, ATTR_DIMMED, TRUE);

    p = dev->iPanel? dev->iPanel:LoadPanel (utilG.p, "k236u.uir", K236);
	dev->iPanel = p;
    
    SetPanelPos (p, VAL_AUTO_CENTER, VAL_AUTO_CENTER);

    Fmt (label, "Keithley 236 Source Measure Unit: %s", dev->label);
    SetPanelAttribute (p, ATTR_TITLE, label);

    m = LoadMenuBar (p, "k236u.uir", K236MENUS);
    
    SetPanelMenuBar (p, m);

    SetMenuBarAttribute (m, K236MENUS_FILE_SAVE, ATTR_CALLBACK_DATA, dev);
    SetMenuBarAttribute (m, K236MENUS_FILE_LOAD, ATTR_CALLBACK_DATA, dev);
    SetMenuBarAttribute (m, K236MENUS_FILE_GPIB, ATTR_CALLBACK_DATA, dev);
    SetMenuBarAttribute (m, K236MENUS_SOURCE, ATTR_CALLBACK_DATA, smu->source);
    SetMenuBarAttribute (m, K236MENUS_MEASURE, ATTR_CALLBACK_DATA, smu->measure);

    SetPanelAttribute (p, ATTR_CALLBACK_DATA, dev);

    SetCtrlAttribute (p, K236_SOURCE, ATTR_CALLBACK_DATA, smu->source);

    SetCtrlAttribute (p, K236_SOURCE_I_RANGE, ATTR_CALLBACK_DATA, dev);
    SetCtrlAttribute (p, K236_SOURCE_V_RANGE, ATTR_CALLBACK_DATA, dev);
    SetCtrlAttribute (p, K236_DELAY, ATTR_CALLBACK_DATA, dev);
    SetCtrlAttribute (p, K236_IDENTIFY, ATTR_CALLBACK_DATA, dev);
    SetCtrlAttribute (p, K236_OPERATE, ATTR_CALLBACK_DATA, dev);
    SetCtrlAttribute (p, K236_SELECT, ATTR_CALLBACK_DATA, dev);
    SetCtrlAttribute (p, K236_SENSE, ATTR_CALLBACK_DATA, dev);
    SetCtrlAttribute (p, K236_MEAS_I_RANGE, ATTR_CALLBACK_DATA, dev);
    SetCtrlAttribute (p, K236_MEAS_V_RANGE, ATTR_CALLBACK_DATA, dev);
    SetCtrlAttribute (p, K236_LEVEL, ATTR_CALLBACK_DATA, dev);
    SetCtrlAttribute (p, K236_FILTER, ATTR_CALLBACK_DATA, dev);
    SetCtrlAttribute (p, K236_INTTIME, ATTR_CALLBACK_DATA, dev);
    SetCtrlAttribute (p, K236_SUPPRESS, ATTR_CALLBACK_DATA, dev);

    k236_UpdateControls (p, dev);

    devPanel_Add (p, dev, k236_UpdateReadings);
    DisplayPanel (p);
}
コード例 #7
0
ファイル: chanfnc.c プロジェクト: gaorlov/DAAS
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");
}
コード例 #8
0
ファイル: util.c プロジェクト: gaorlov/DAAS
int util_OpenFile(char *path, int action, int ascii)
{
    int handle;
    unsigned int  nBytes, pos, width;
    long size;
    char info[256];

    if (action == FILE_WRITE) {
        handle = OpenFile (path, FILE_WRITE, 0, ascii);
        if (!ascii) FmtFile (handle, "BINARY\n");
    }
    else {
        handle = OpenFile (path, action, 0, 0);
        nBytes = ReadLine (handle, info, 255);
        if (CompareBytes (info, 0, "BINARY", 0, 6, 0) != 0) {
            CloseFile (handle);
            handle = OpenFile (path, action, 0, 1);
            ascii = TRUE;
        }
    }
	if(handle)
    {
		fileP = LoadPanel (0, "utilu.uir", FILESTAT);

    	

    	if (action == FILE_WRITE) {
        	Fmt (info, "Saving file: %s", path);
        	if (ascii) Fmt (info, "%s[a]< (ASCII file...go for coffee!)");
    	} else {
        	GetFileSize (path, &size);
        	Fmt (info, "Loading file: %s (%i kB)", path, size/1000);
        	if (ascii) Fmt (info, "%s[a]< (ASCII file...take a nap!)");
    	}

    	SetCtrlVal (fileP, FILESTAT_TEXT, info);
    	GetCtrlAttribute (fileP, FILESTAT_TEXT, ATTR_WIDTH, &width);
    	SetPanelAttribute (fileP, ATTR_WIDTH, width+12);
    	SetCtrlAttribute (fileP, FILESTAT_TEXT, ATTR_LEFT, 6);

    	SetPanelPos (fileP, VAL_AUTO_CENTER, VAL_AUTO_CENTER);
    	InstallPopup (fileP);
	}
	else
		handle = 0;
	return handle;
}
コード例 #9
0
ファイル: chanops.c プロジェクト: gaorlov/DAAS
void InitAddChannelsCallback(int menubar, int menuItem, void *callbackData, int panel)
{
    int i;
    channelPtr chan;

    chanops.p = LoadPanel (0, "chanopsu.uir", CHANOPS_1);
    
    util_InitClose (chanops.p, CHANOPS_1_CANCEL, TRUE);
    SetPanelPos (chanops.p, 100, 100);

    InstallCtrlCallback (chanops.p, CHANOPS_1_GO,
                         DoChannelAdditionCallback, 0);
    SetPanelAttribute (chanops.p, ATTR_TITLE, "Channel Addition");
    channellist_Copy (chanops.p, CHANOPS_1_CHANNELS);

    InstallPopup (chanops.p);
}
コード例 #10
0
ファイル: chanfnc.c プロジェクト: gaorlov/DAAS
void InitStatisticsCallback(int menubar, int menuItem, void *callbackData, int panel)
{
    int i;
    channelPtr chan;

    chanfunc.p = LoadPanel (0, "chanfncu.uir", STATISTICS);
    
    util_InitClose (chanfunc.p, STATISTICS_CLOSE, FALSE);
    SetPanelPos (chanfunc.p, 100, 100);

    channellist_Copy (chanfunc.p, STATISTICS_CHANNELS);

    chan = channellist_GetSelection();
    chanfunc_CalcStatistics (chan);
    SetInputMode (chanfunc.p, STATISTICS_SAVE,
            ((StringLength (chan->note) + StringLength(chanfunc.note)) < 255));

    InstallPopup (chanfunc.p);
}
コード例 #11
0
ファイル: Sr844.c プロジェクト: gaorlov/DAAS
int  OperateReferenceCallback844(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
    int p;
    gpibioPtr dev = callbackData;
    if (event == EVENT_COMMIT) {
        p = LoadPanel (0, "sr844u.uir", SR844_REF);
        
        SetPanelPos (p, VAL_AUTO_CENTER, VAL_AUTO_CENTER);

        util_InitClose (p, SR844_REF_CLOSE, FALSE);
		
        SetCtrlVal (p, SR844_REF_FREQ, sr844_GetDoubleVal(dev, "FREQ?"));
		sr844_CheckClear(dev);
        SetCtrlVal (p, SR844_REF_PHASE, sr844_GetDoubleVal(dev, "PHAS?"));

        SetCtrlAttribute (p, SR844_REF_FREQ, ATTR_CALLBACK_DATA, dev);
        SetCtrlAttribute (p, SR844_REF_PHASE, ATTR_CALLBACK_DATA, dev);
        InstallPopup (p);
    }
    return 0;
}
コード例 #12
0
ファイル: Sr844.c プロジェクト: gaorlov/DAAS
void OperateSR844 (int menubar, int menuItem, void *callbackData, int panel)
{
    int p, m;
    gpibioPtr dev = callbackData;
    sr844Ptr lia = dev->device;
    char label[256];

    SetMenuBarAttribute (menubar, menuItem, ATTR_DIMMED, TRUE);

	p = dev->iPanel? dev->iPanel: LoadPanel (utilG.p, "sr844u.uir", SR844_CTRL);
    dev->iPanel = p;

	SetPanelPos (p, VAL_AUTO_CENTER, VAL_AUTO_CENTER);

    Fmt (label, "stanford research systems sr844 dsp lock-in amplifier: %s", dev->label);
    SetPanelAttribute (p, ATTR_TITLE, label);
	
	m = LoadMenuBar (p, "sr844u.uir", SR844MENU);
    SetPanelMenuBar (p, m);

    SetMenuBarAttribute (m, SR844MENU_SOURCES_DAC1, ATTR_CALLBACK_DATA, lia->sources[0]);
    SetMenuBarAttribute (m, SR844MENU_SOURCES_DAC2, ATTR_CALLBACK_DATA, lia->sources[1]);
    SetMenuBarAttribute (m, SR844MENU_SOURCES_FREQ, ATTR_CALLBACK_DATA, lia->sources[2]);
    SetMenuBarAttribute (m, SR844MENU_MEASURE_LIA, ATTR_CALLBACK_DATA, lia);
    SetMenuBarAttribute (m, SR844MENU_MEASURE_ADCS, ATTR_CALLBACK_DATA, dev);

	SetPanelAttribute (p, ATTR_CALLBACK_DATA, dev);

    SetCtrlAttribute (p, SR844_CTRL_REF, ATTR_CALLBACK_DATA, dev);
    SetCtrlAttribute (p, SR844_CTRL_TC, ATTR_CALLBACK_DATA, dev);
    SetCtrlAttribute (p, SR844_CTRL_SENS, ATTR_CALLBACK_DATA, dev);
    SetCtrlAttribute (p, SR844_CTRL_AUTOSENSE, ATTR_CALLBACK_DATA, dev);
    SetCtrlAttribute (p, SR844_CTRL_FILTSLOPE, ATTR_CALLBACK_DATA, dev);
	SetCtrlAttribute (p, SR844_CTRL_1MO50O, ATTR_CALLBACK_DATA, dev);
	SetCtrlVal(p, SR844_CTRL_GPIBADDR, dev->paddr);
    sr844_UpdateControls (p, dev);		   ///*/

    devPanel_Add (p, dev, sr844_UpdateReadings);//*/
    DisplayPanel (p);
}
コード例 #13
0
ファイル: K2400.c プロジェクト: homer362s/DAAS_2015
void K2400MeasureSetupCallback(int menubar, int menuItem, void *callbackData, int panel)
{
    int p;
    acqchanPtr measure = callbackData;

    p = LoadPanel (0, "k2400u.uir", K2400_MEAS);
    SetPanelPos (p, VAL_AUTO_CENTER, VAL_AUTO_CENTER);
    util_InitClose (p, K2400_MEAS_CLOSE, FALSE);

    SetCtrlVal (p, K2400_MEAS_LABEL, measure->channel->label);
    SetCtrlVal (p, K2400_MEAS_COEFF, measure->coeff);
    SetCtrlVal (p, K2400_MEAS_ACQ, measure->acquire);
    SetCtrlVal (p, K2400_MEAS_NOTE, measure->note);

    SetCtrlAttribute(p, K2400_MEAS_LABEL, ATTR_CALLBACK_DATA, measure);
    SetCtrlAttribute(p, K2400_MEAS_COEFF, ATTR_CALLBACK_DATA, measure);
    SetCtrlAttribute(p, K2400_MEAS_ACQ, ATTR_CALLBACK_DATA, measure);
    SetCtrlAttribute(p, K2400_MEAS_NOTE, ATTR_CALLBACK_DATA, measure);

    SetInputMode (p, K2400_MEAS_ACQ, !util_TakingData());

    devPanel_Add (p, measure, k2400_Meas_UpdateReadings);
    InstallPopup (p);
}
コード例 #14
0
ファイル: Sr844.c プロジェクト: gaorlov/DAAS
void CVICALLBACK sr844_MenuCallback (int menuBar, int menuItem, void *callbackData,
		int panel)
{
	switch(menuItem)
	{
		case SR844MENU_MEASURE_LIA:
			{
				int p, busy;
    			sr844Ptr lia;

    			p = LoadPanel (utilG.p, "sr844u.uir", SR844_XYMP);
    			SetPanelPos (p, VAL_AUTO_CENTER, VAL_AUTO_CENTER);
    			lia = callbackData;
				
				SetCtrlVal (p, SR844_XYMP_XLABEL, lia->channels[X]->channel->label);
			    SetCtrlVal (p, SR844_XYMP_XCOEFF, lia->channels[X]->coeff);
			    SetCtrlVal (p, SR844_XYMP_XACQ,   lia->channels[X]->acquire);
			    SetCtrlVal (p, SR844_XYMP_NOTE_1, lia->channels[X]->note);
								  
				SetCtrlVal (p, SR844_XYMP_YLABEL, lia->channels[Y]->channel->label);
			    SetCtrlVal (p, SR844_XYMP_YCOEFF, lia->channels[Y]->coeff);
			    SetCtrlVal (p, SR844_XYMP_YACQ,   lia->channels[Y]->acquire);
			    SetCtrlVal (p, SR844_XYMP_NOTE_2, lia->channels[Y]->note);

			    SetCtrlVal (p, SR844_XYMP_RLABEL, lia->channels[R]->channel->label);
			    SetCtrlVal (p, SR844_XYMP_RCOEFF, lia->channels[R]->coeff);
			    SetCtrlVal (p, SR844_XYMP_RACQ,   lia->channels[R]->acquire);
			    SetCtrlVal (p, SR844_XYMP_NOTE_3, lia->channels[R]->note);

			    SetCtrlVal (p, SR844_XYMP_PLABEL, lia->channels[T]->channel->label);
			    SetCtrlVal (p, SR844_XYMP_PCOEFF, lia->channels[T]->coeff);
			    SetCtrlVal (p, SR844_XYMP_PACQ,   lia->channels[T]->acquire);
			    SetCtrlVal (p, SR844_XYMP_NOTE_4, lia->channels[T]->note);
	
			    SetCtrlAttribute(p, SR844_XYMP_CLOSE, ATTR_CALLBACK_DATA, lia);
		
			    SetCtrlAttribute(p, SR844_XYMP_XLABEL, ATTR_CALLBACK_DATA, lia->channels[X]);
			    SetCtrlAttribute(p, SR844_XYMP_XCOEFF, ATTR_CALLBACK_DATA, lia->channels[X]);
			    SetCtrlAttribute(p, SR844_XYMP_XACQ,   ATTR_CALLBACK_DATA, lia->channels[X]);
			    SetCtrlAttribute(p, SR844_XYMP_NOTE_1, ATTR_CALLBACK_DATA, lia->channels[X]);
	
			    SetCtrlAttribute(p, SR844_XYMP_YLABEL, ATTR_CALLBACK_DATA, lia->channels[Y]);
			    SetCtrlAttribute(p, SR844_XYMP_YCOEFF, ATTR_CALLBACK_DATA, lia->channels[Y]);
			    SetCtrlAttribute(p, SR844_XYMP_YACQ,   ATTR_CALLBACK_DATA, lia->channels[Y]);
			    SetCtrlAttribute(p, SR844_XYMP_NOTE_2, ATTR_CALLBACK_DATA, lia->channels[Y]);
		
			    SetCtrlAttribute(p, SR844_XYMP_RLABEL, ATTR_CALLBACK_DATA, lia->channels[R]);
			    SetCtrlAttribute(p, SR844_XYMP_RCOEFF, ATTR_CALLBACK_DATA, lia->channels[R]);
			    SetCtrlAttribute(p, SR844_XYMP_RACQ,   ATTR_CALLBACK_DATA, lia->channels[R]);
			    SetCtrlAttribute(p, SR844_XYMP_NOTE_3, ATTR_CALLBACK_DATA, lia->channels[R]);
	
			    SetCtrlAttribute(p, SR844_XYMP_PLABEL, ATTR_CALLBACK_DATA, lia->channels[T]);
			    SetCtrlAttribute(p, SR844_XYMP_PCOEFF, ATTR_CALLBACK_DATA, lia->channels[T]);
			    SetCtrlAttribute(p, SR844_XYMP_PACQ,   ATTR_CALLBACK_DATA, lia->channels[T]);
			    SetCtrlAttribute(p, SR844_XYMP_NOTE_4, ATTR_CALLBACK_DATA, lia->channels[T]);

		    	devPanel_Add (p, lia, sr844_XYRP_UpdateReadings);
    			DisplayPanel (p);
			}
			break;
		case SR844MENU_MEASURE_ADCS:
			{
				int p;
			    gpibioPtr dev = callbackData;
			    sr844Ptr lia = dev->device;
		
			    p = LoadPanel (utilG.p, "sr844u.uir", SR844_ADC);
			    SetPanelPos (p, VAL_AUTO_CENTER, VAL_AUTO_CENTER);
			    	
			    SetCtrlVal (p, SR844_ADC_LABEL_1, lia->channels[ADC1]->channel->label);
			    SetCtrlVal (p, SR844_ADC_COEFF_1, lia->channels[ADC1]->coeff);
			    SetCtrlVal (p, SR844_ADC_CONVERSION_1, lia->channels[ADC1]->conversion);
			    SetCtrlVal (p, SR844_ADC_ACQ_1, lia->channels[ADC1]->acquire);
			    SetCtrlVal (p, SR844_ADC_NOTE_1, lia->channels[ADC1]->note);
		
			    SetCtrlVal (p, SR844_ADC_LABEL_2, lia->channels[ADC2]->channel->label);
			    SetCtrlVal (p, SR844_ADC_COEFF_2, lia->channels[ADC2]->coeff);
			    SetCtrlVal (p, SR844_ADC_CONVERSION_2, lia->channels[ADC2]->conversion);
			    SetCtrlVal (p, SR844_ADC_ACQ_2, lia->channels[ADC2]->acquire);
			    SetCtrlVal (p, SR844_ADC_NOTE_2, lia->channels[ADC2]->note);
	
			    SetCtrlAttribute(p, SR844_ADC_CLOSE, ATTR_CALLBACK_DATA, lia);
	
			    SetCtrlAttribute(p, SR844_ADC_LABEL_1, ATTR_CALLBACK_DATA, lia->channels[ADC1]);
			    SetCtrlAttribute(p, SR844_ADC_COEFF_1, ATTR_CALLBACK_DATA, lia->channels[ADC1]);
			    SetCtrlAttribute(p, SR844_ADC_CONVERSION_1, ATTR_CALLBACK_DATA, lia->channels[ADC1]);
			    SetCtrlAttribute(p, SR844_ADC_ACQ_1, ATTR_CALLBACK_DATA, lia->channels[ADC1]);
				SetCtrlAttribute(p, SR844_ADC_NOTE_1, ATTR_CALLBACK_DATA, lia->channels[ADC1]);

		    	SetCtrlAttribute(p, SR844_ADC_LABEL_2, ATTR_CALLBACK_DATA, lia->channels[ADC2]);
			    SetCtrlAttribute(p, SR844_ADC_COEFF_2, ATTR_CALLBACK_DATA, lia->channels[ADC2]);
				SetCtrlAttribute(p, SR844_ADC_CONVERSION_2, ATTR_CALLBACK_DATA, lia->channels[ADC2]);
				SetCtrlAttribute(p, SR844_ADC_ACQ_2, ATTR_CALLBACK_DATA, lia->channels[ADC2]);
				SetCtrlAttribute(p, SR844_ADC_NOTE_2, ATTR_CALLBACK_DATA, lia->channels[ADC2]);
	
		    	devPanel_Add (p, dev, sr844_ADC_UpdateReadings);
    			DisplayPanel (p);
			}
			break;
		case SR844MENU_SOURCES_DAC1:
		case SR844MENU_SOURCES_DAC2:
		{
			sourcePtr src;

    		src = callbackData;
			src->min = -10.5;
    		src->max = 10.5;
			switch (utilG.exp) {
        		case EXP_SOURCE: source_InitPanel (src); break;
        		case EXP_FLOAT: gensrc_InitPanel (src); break;
    		}
		}
		break;
		case SR844MENU_SOURCES_FREQ:
		{
			sourcePtr src;

    		src = callbackData;
			src->min = 2.5E4;
    		src->max = 2.0E8;
			switch (utilG.exp) {
        		case EXP_SOURCE: source_InitPanel (src); break;
        		case EXP_FLOAT: gensrc_InitPanel (src); break;
    		}
		}
		break; 
	}
}
コード例 #15
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;
}