Ejemplo n.º 1
0
int
Color_Change( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )

	{
	int i, previous;
	PtWidget_t* thisWindow;
	
	/* eliminate 'unreferenced' warnings */
	widget = widget, apinfo = apinfo, cbinfo = cbinfo;

	thisWindow = ApGetInstance( widget );
	
	if(ApName(widget) == ABN_ButtonRed)
	{
		PtSetResource(ApGetWidgetPtr(thisWindow, ABN_ColorRect), Pt_ARG_FILL_COLOR, Pg_RED, 0);
	}
	else if(ApName(widget) == ABN_ButtonGreen)
	{
		PtSetResource(ApGetWidgetPtr(thisWindow, ABN_ColorRect), Pt_ARG_FILL_COLOR, Pg_GREEN, 0);
	}
	else if(ApName(widget) == ABN_ButtonBlue)
	{
		PtSetResource(ApGetWidgetPtr(thisWindow, ABN_ColorRect), Pt_ARG_FILL_COLOR, Pg_BLUE, 0);
	}
	else if(ApName(widget) == ABN_ButtonPrevious)
	{
		previous = -1;
		for(i = 0; i < WindowCounter; i++)
		{
			if(Windows[i] == thisWindow)
			{
				previous = i - 1;
				break;
			}
		}
		
		if(previous != -1 && Windows[previous])
		{
			base_Color++;
			if(base_Color >= 5)
			{
				base_Color = 0;
			}
			
			//PtSetResource(Windows[previous], Pt_ARG_FILL_COLOR, Colors[base_Color], 0);
			PtSetResource(ApGetWidgetPtr(Windows[previous], ABN_ColorRect), Pt_ARG_FILL_COLOR, Colors[base_Color], 0);
		}	
	}	

	return( Pt_CONTINUE );

	}
Ejemplo n.º 2
0
int daMenuOverRide( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	PtArg_t arg;
	int daNum;

	/* eliminate 'unreferenced' warnings */
	widget = widget, apinfo = apinfo, cbinfo = cbinfo;

	/* get the da number from the widget */
	PtSetArg(&arg, Pt_ARG_USER_DATA, 0, 0);
	PtGetResources(widget, 1, &arg);
	daNum = *(int *)arg.value;

	/* determin which of the override buttons initiated this callback */
	if(ApName(widget) == ABN_daSourceNumOvrRide) {
		if(cbinfo->reason == Pt_CB_ARM) {
			daMenuOvrRides[daNum][0] = 1;
			da[daNum].m_da_src_num = daSourceNumbs[daNum];
		}
		else if(cbinfo->reason == Pt_CB_DISARM) {
			daMenuOvrRides[daNum][0] = 0;
			da[daNum].m_da_src_num = NULLI;
		}
		da_cntrl_1(daNum, NULLI, NULLI);
	}
	else if(ApName(widget) == ABN_daOutputOvrRide) {
		if(cbinfo->reason == Pt_CB_ARM) {
			daMenuOvrRides[daNum][1] = 1;
			da[daNum].m_da_val = daOutputs[daNum];
		}
		else if(cbinfo->reason == Pt_CB_DISARM) {
			daMenuOvrRides[daNum][1] = 0;
			da[daNum].m_da_val = NULLI;
		}
		da_set_1(daNum, NULLI);
	}
	else if(ApName(widget) == ABN_daOffsetOvrRide) {
		if(cbinfo->reason == Pt_CB_ARM) {
			daMenuOvrRides[daNum][2] = 1;
			da[daNum].m_da_offset = daOffsets[daNum];
		}
		else if(cbinfo->reason == Pt_CB_DISARM) {
			daMenuOvrRides[daNum][2] = 0;
			da[daNum].m_da_offset = NULLI;
		}
		da_offset(daNum, NULLI);
	}

	return( Pt_CONTINUE );
}
Ejemplo n.º 3
0
int unitChoice( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	
	/* eliminate 'unreferenced' warnings */
	widget = widget, apinfo = apinfo, cbinfo = cbinfo;

	/* figure out which toggle was selected */
	if(ApName(widget) == ABN_latchToggle) unit = LATCH_UNIT;
	if(ApName(widget) == ABN_mexwexToggle) unit = MEXWEX_UNIT;
	if(ApName(widget) == ABN_plexonToggle) unit = PLEXON_UNIT;
	if(ApName(widget) == ABN_fakeToggle) unit = FAKE_UNIT;

	return( Pt_CONTINUE );
}
Ejemplo n.º 4
0
int setDASource( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	PtWidget_t *parent;
	PtArg_t arg;
	int daNum;
	int source;
	int i;

	/* eliminate 'unreferenced' warnings */
	widget = widget, apinfo = apinfo, cbinfo = cbinfo;

	/* get the widget's group */
	parent = PtWidgetParent(widget);

	/* get the da number from the group */
	PtSetArg(&arg, Pt_ARG_USER_DATA, 0, 0);
	PtGetResources(parent, 1, &arg);
	daNum = *(int *)arg.value;

	/* figure out which source was chosen */
	for(i = 0; i < 9; i++) {
		if(ApName(widget) == daSourceToggles[i]) source = i;
	}

	if(cbinfo->reason == Pt_CB_ARM) {
		da[daNum].m_da_source = source;
	}
	else if(cbinfo->reason == Pt_CB_DISARM) {
		da[daNum].m_da_source = NULLI;
	}

	da_cntrl_1(daNum, NULLI, NULLI);

	return( Pt_CONTINUE );
}
Ejemplo n.º 5
0
int rowColProc(PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo)
{
	PtArg_t args[1];
	PtWidget_t *thisModule;
	RASTER *rasters;
	PAGE *thisPage;
	CELL *thisCell;
	int *value;
	int rowIndxChange;
	int i;

	/* eliminate 'unreferenced' warnings */
	widget = widget, apinfo = apinfo, cbinfo = cbinfo;

	/* get a pointer to the rasters structure */
	rasters = getRasters();

	/* get pointer to the window module that contains this widget */
	thisModule = ApGetInstance(widget);

	/* figure out this raster page */
	thisPage = getRasterPage(rasters->curPageIndx);
	
	/* get the widget's value and assign it to the appropriate variable */
	PtSetArg(&args[0], Pt_ARG_NUMERIC_VALUE, &value, 0);
	PtGetResources(widget, 1, args);
	if(ApName(widget) == ABN_pageRows) {
		/* if the user is redefining the number of rows in a raster,
		 * the row numbers of the cells has to be changed
		 */
		if(*value != thisPage->nRows) {
			rowIndxChange = *value - thisPage->nRows;
			for(i = 0; i < thisPage->nDefCells; i++) {
				thisCell = getRasterCell(thisPage->cellsInfo, i);
				thisCell->rowN += rowIndxChange;
			}
		}
		thisPage->nRows = *value;
	}
	else if(ApName(widget) == ABN_pageCols) thisPage->nCols = *value;

	initCellButtons(thisModule, thisPage, rasters->newRasters);

	return( Pt_CONTINUE );
}
Ejemplo n.º 6
0
int setDAParameters( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	PtArg_t args[2];
	int daNum;
	int value;

	/* eliminate 'unreferenced' warnings */
	widget = widget, apinfo = apinfo, cbinfo = cbinfo;

	/* get the da number and value from the widget */
	PtSetArg(&args[0], Pt_ARG_USER_DATA, 0, 0);
	PtSetArg(&args[1], Pt_ARG_NUMERIC_VALUE, 0, 0);
	PtGetResources(widget, 2, args);
	daNum = *(int *)args[0].value;
	value = (int)args[1].value;

	/* figure out which parameter to change */
	if(ApName(widget) == ABN_daSourceNum) {
		daSourceNumbs[daNum] = value;
		if(daMenuOvrRides[daNum][0]) {
			da[daNum].m_da_src_num = daSourceNumbs[daNum];
			da_cntrl_1(daNum, NULLI, NULLI);
		}
	}
	else if(ApName(widget) == ABN_daOutput) {
		daOutputs[daNum] = value;
		if(daMenuOvrRides[daNum][1]) {
			da[daNum].m_da_val = daOutputs[daNum];
			da_set_1(daNum, NULLI);
		}
	}
	else if(ApName(widget) == ABN_daOffset) {
		daOffsets[daNum] = value;
		if(daMenuOvrRides[daNum][2]) {
			da[daNum].m_da_offset = daOffsets[daNum];
			da_offset(daNum, NULLI);
		}
	}

	return( Pt_CONTINUE );
}
/*
 * Function - txt_pin_focus_callback()
 *
 * Callback function for the pin text field
 */
sint32_t txt_pin_focus_callback(PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo)
{
   // Eliminate 'unreferenced' warnings
   widget = widget, apinfo = apinfo, cbinfo = cbinfo;

   if(Pt_CB_GOT_FOCUS == cbinfo->reason)
   {
      wgt_settext(ApName(widget), "");
      txt_widget = widget;
      pin[0] = 0;
   }

   return (Pt_CONTINUE);
}
Ejemplo n.º 8
0
int messageChoice( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	PtArg_t arg;
	long *flags;

	/* eliminate 'unreferenced' warnings */
	widget = widget, apinfo = apinfo, cbinfo = cbinfo;

	/* get the state of the widget */
	PtSetArg(&arg, Pt_ARG_FLAGS, &flags, 0);
	PtGetResources(widget, 1, &arg);

	/* figure out which toggle was selected */
	if(ApName(widget) == ABN_pcmessageToggle) {
		if(*flags & Pt_SET) pcmessageSwitch = YES;
		else pcmessageSwitch = NO;
	}
	else if(ApName(widget) == ABN_pcs_socketToggle) {
		if(*flags & Pt_SET) socketSwitch = YES;
		else socketSwitch = NO;
	}

	return( Pt_CONTINUE );
}
Ejemplo n.º 9
0
int pageLabelPositionProc(PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo)
{
	PtArg_t args[1];
	RASTER *rasters;
	PAGE *thisPage;
	double *value;

	/* eliminate 'unreferenced' warnings */
	widget = widget, apinfo = apinfo, cbinfo = cbinfo;

	/* get a pointer to the rasters structure */
	rasters = getRasters();

	/* figure out this raster page */
	thisPage = getRasterPage(rasters->curPageIndx);
	
	/* get the widget's value and assign it to the appropriate variable */
	PtSetArg(&args[0], Pt_ARG_NUMERIC_VALUE, &value, 0);
	PtGetResources(widget, 1, args);
	if(ApName(widget) == ABN_pageLabelLeft) thisPage->pageLabel.x = *value;
	else if(ApName(widget) == ABN_pageLabelBottom) thisPage->pageLabel.y = *value;

	return( Pt_CONTINUE );
}
Ejemplo n.º 10
0
/*
 * Function - combo_syringe_callback()
 *
 * Callback function for the syringe combo box
 */
sint32_t combo_syringe_callback(PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo)
{
   char temp[20];

   // Eliminate 'unreferenced' warnings
   widget = widget, apinfo = apinfo, cbinfo = cbinfo;

   if(Pt_LIST_SELECTION_FINAL == cbinfo->reason_subtype)
   {
      // Get the selected syringe data
      wgt_gettext(ApName(widget), temp, sizeof(temp));
      wgt_selectsyringe(PtListItemPos(widget, temp) - 2);
   }

   return (Pt_CONTINUE);
}
Ejemplo n.º 11
0
int setDAMode( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	PtWidget_t *parent;
	PtArg_t arg;
	long *flags;
	int daNum;

	/* eliminate 'unreferenced' warnings */
	widget = widget, apinfo = apinfo, cbinfo = cbinfo;

	/* get the widget's group */
	parent = PtWidgetParent(widget);

	/* get the da number from the group */
	PtSetArg(&arg, Pt_ARG_USER_DATA, 0, 0);
	PtGetResources(parent, 1, &arg);
	daNum = *(int *)arg.value;

	/* get the state of this buttons flags */
	PtSetArg(&arg, Pt_ARG_FLAGS, &flags, 0);
	PtGetResources(widget, 1, &arg);

	/* get the name of the toggle button that was pressed */
	if(ApName(widget) == ABN_daDirectToggle) {
		if(*flags & Pt_SET) {
			da[daNum].m_da_mode = DA_DIRECT;

			PtSetArg(&arg, Pt_ARG_FLAGS, Pt_FALSE, Pt_SET);
			PtSetResources(ABW_daOffConToggle, 1, &arg);
			PtSetResources(ABW_daOffStbyToggle, 1, &arg);
		}
		else {
			da[daNum].m_da_mode = NULLI;
		}
	}
	else if(ApName(widget) == ABN_daOffConToggle) {
		if(*flags & Pt_SET) {
			if(da[daNum].m_da_mode == NULLI) da[daNum].m_da_mode = DA_OFFSET_CONN;
			else da[daNum].m_da_mode |= DA_OFFSET_CONN;

			PtSetArg(&arg, Pt_ARG_FLAGS, Pt_FALSE, Pt_SET);
			PtSetResources(ABW_daDirectToggle, 1, &arg);
		}
		else {
			if(da[daNum].m_da_mode == DA_OFFSET_CONN) da[daNum].m_da_mode = NULLI;
			else da[daNum].m_da_mode &= ~DA_OFFSET_CONN;
		}
	}
	else if(ApName(widget) == ABN_daOffStbyToggle) {
		if(*flags & Pt_SET) {
			if(da[daNum].m_da_mode == NULLI) da[daNum].m_da_mode = DA_OFFSET_STBY;
			else da[daNum].m_da_mode |= DA_OFFSET_STBY;

			PtSetArg(&arg, Pt_ARG_FLAGS, Pt_FALSE, Pt_SET);
			PtSetResources(ABW_daDirectToggle, 1, &arg);
		}
		else {
			if(da[daNum].m_da_mode == DA_OFFSET_STBY) da[daNum].m_da_mode = NULLI;
			else da[daNum].m_da_mode &= ~DA_OFFSET_STBY;
		}
	}

	da_mode(daNum, NULLI);

	return( Pt_CONTINUE );
}
Ejemplo n.º 12
0
int pageLabelFontProc(PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo)
{
	PtWidget_t *thisModule;
	PtWidget_t *off1;
	PtWidget_t *off2;
	PtArg_t args[1];
	RASTER *rasters;
	PAGE *thisPage;
	void *userData;
	long *flags;
	int font;

	/* eliminate 'unreferenced' warnings */
	widget = widget, apinfo = apinfo, cbinfo = cbinfo;

	off1 = (PtWidget_t *)NULL;
	off2 = (PtWidget_t *)NULL;
	
	/* get a pointer to the rasters structure */
	rasters = getRasters();

	/* get pointer to the window module that contains this widget */
	thisModule = ApGetInstance(widget);

	/* figure out this raster page */
	thisPage = getRasterPage(rasters->curPageIndx);
	
	/* get the flag variable for this widget */
	PtSetArg(&args[0], Pt_ARG_FLAGS, &flags, 0);
	PtGetResources(widget, 1, args);

	/* if this widget's button was pressed,
	 * make sure that the other two widgets' buttons are unpressed
	 */
	if(*flags & Pt_SET) {
		/* get the font */
		PtSetArg(&args[0], Pt_ARG_USER_DATA, &userData, 0);
		PtGetResources(widget, 1, args);
		sscanf(userData, "%d", &font);
		
		/* figure out which button was pressd
		 * so the other two can be unset
		 */
		if(ApName(widget) == ABN_pageLabelDuplex) {
			off1 = ApGetWidgetPtr(thisModule, ABN_pageLabelComplex);
			off2 = ApGetWidgetPtr(thisModule, ABN_pageLabelItalic);
		}
		else if(ApName(widget) == ABN_pageLabelComplex) {
			off1 = ApGetWidgetPtr(thisModule, ABN_pageLabelDuplex);
			off2 = ApGetWidgetPtr(thisModule, ABN_pageLabelItalic);
		}
		else if(ApName(widget) == ABN_pageLabelItalic) {
			off1 = ApGetWidgetPtr(thisModule, ABN_pageLabelDuplex);
			off2 = ApGetWidgetPtr(thisModule, ABN_pageLabelComplex);
		}
		PtSetArg(&args[0], Pt_ARG_FLAGS, Pt_FALSE, Pt_SET);
		PtSetResources(off1, 1, args);
		PtSetResources(off2, 1, args);
	}

	/* if this widget's button was unpressed,
	 * set the default widget's button
	 */
	 else {
		off1 = ApGetWidgetPtr(thisModule, ABN_pageLabelDuplex);
		PtSetArg(&args[0], Pt_ARG_FLAGS, Pt_TRUE, Pt_SET);
		PtSetResources(off1, 1, args);

		PtSetArg(&args[0], Pt_ARG_USER_DATA, &userData, 0);
		PtGetResources(off1, 1, args);
		sscanf(userData, "%d", &font);
	 }
	thisPage->pageLabel.font = font;

	return( Pt_CONTINUE );
}
Ejemplo n.º 13
0
/*
 * Function     - wgt_clearlog()
 *
 * Arguments    - None
 *
 * Return Value - None
 */
void wgt_clearlog(void)
{
   wgt_settext(ApName(ABW_multi_txt_diag), "");
}