Esempio n. 1
0
int daConvDialogSet( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	PtArg_t args[2];
	int *pDaNum;
	int *value;
	int daNum;

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

	/* get the status of the on-off switch */
	PtSetArg(&args[0], Pt_ARG_ONOFF_STATE, &value, 0);
	PtSetArg(&args[1], Pt_ARG_USER_DATA, &pDaNum, 0);
	PtGetResources(widget, 2, args);
	daNum = *pDaNum;

	if(*value) {
		PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "Dialog Enabled", 0);
		da[daNum].m_da_menu = 1;
	}
	else {
		PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "Dialog Disabled", 0);
		da[daNum].m_da_menu = 0;
	}
	PtSetResources(widget, 1, args);

	daDialogItemEnable(daNum);

	da_cntrl_1(daNum, NULLI, NULLI);
	da_mode(daNum, NULLI);
	da_offset(daNum, NULLI);

	return( Pt_CONTINUE );
}
Esempio n. 2
0
int initStateDebugDialog( PtWidget_t *link_instance, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	PtWidget_t *widget;
	PtArg_t arg;
	int stateIndex;

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

	/* get the widget that initiated the link callback */
	widget = ApWidget(cbinfo);

	/* make sure that the dialog has not been destroyed */
	if(PtWidgetFlags(widget) & Pt_DESTROYED) {
		return( Pt_CONTINUE );
	}

	/* get the state index from the buttons user data */
	PtSetArg(&arg, Pt_ARG_USER_DATA, 0, 0);
	PtGetResources(widget, 1, &arg);
	stateIndex = *(int *)arg.value;

	/* set the text of the title widget */
	PtSetArg(&arg, Pt_ARG_WINDOW_TITLE, snames[stateIndex]->statename, 0);
	PtSetResources(ABW_stateDebugDialog, 1, &arg);

	/* initialize the widgets in the state dialog */
	stateDebugDialogSetUser(stateIndex);

	return( Pt_CONTINUE );
}
Esempio n. 3
0
void daDialogItemEnable(int daNum)
{
	PtArg_t args[2];

	/* enable dialog items if menu is enabled */
	if(da[daNum].m_da_menu) {
		PtSetArg(&args[0], Pt_ARG_FLAGS, Pt_FALSE, Pt_GHOST);
		PtSetArg(&args[1], Pt_ARG_FLAGS, Pt_TRUE, Pt_SELECTABLE);
	}
	else {
		PtSetArg(&args[0], Pt_ARG_FLAGS, Pt_TRUE, Pt_GHOST);
		PtSetArg(&args[1], Pt_ARG_FLAGS, Pt_FALSE, Pt_SELECTABLE);
	}
	PtSetResources(ABW_daStandbyToggle, 2, args);
	PtSetResources(ABW_daRampXToggle, 2, args);
	PtSetResources(ABW_daRampYToggle, 2, args);
	PtSetResources(ABW_daJoyXToggle, 2, args);
	PtSetResources(ABW_daJoyYToggle, 2, args);
	PtSetResources(ABW_daSignalToggle, 2, args);
	PtSetResources(ABW_daWinXToggle, 2, args);
	PtSetResources(ABW_daWinYToggle, 2, args);
	PtSetResources(ABW_daMemToggle, 2, args);

	PtSetResources(ABW_daDirectToggle, 2, args);
	PtSetResources(ABW_daOffConToggle, 2, args);
	PtSetResources(ABW_daOffStbyToggle, 2, args);

	PtSetResources(ABW_daSourceNumOvrRide, 2, args);
	PtSetResources(ABW_daOutputOvrRide, 2, args);
	PtSetResources(ABW_daOffsetOvrRide, 2, args);

	return;
}
Esempio n. 4
0
int setDir( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	PtArg_t args[1];
	char *string;

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

	/* get the directory */
	PtSetArg(&args[0], Pt_ARG_TEXT_STRING, &string, 0);
	PtGetResources(widget, 1, args);

	/* set the directory part of the file name */
	PtSetArg(&args[0], Pt_ARG_TEXT_STRING, string, 0);
	PtSetResources(ABW_fileSelFileName, 1, args);

	/* set the root directory of the file selection widget */
	PtSetArg(&args[0], Pt_ARG_FS_ROOT_DIR, string, 0);
	PtSetResources(ABW_fileSelFileList, 1, args);

	/* save the new directory */
	strcpy(rootDir, string);

	return( Pt_CONTINUE );
}
Esempio n. 5
0
int initRootRead( PtWidget_t *link_instance, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	PtArg_t args[2];
	int fileFlag;
	char wd[PATH_MAX + 2];

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

	/* get the current working directory */
	getcwd(wd, PATH_MAX+1);

	if(!strlen(rootDir)) {
		strcpy(rootDir, wd);
		strcat(rootDir, "/rt");
	}
	PtSetArg(&args[0], Pt_ARG_FS_ROOT_DIR, rootDir, 0);
	PtSetResources(ABW_fileSelFileList, 1, args);

	PtSetArg(&args[0], Pt_ARG_TEXT_STRING, rootDir, 0);
	PtSetResources(ABW_fileSelDirText, 1, args);
	PtSetResources(ABW_fileSelFileName, 1, args);

	/* set the user data to indicate a root file read */
	fileFlag = ROOT_FILE_READ;
	PtSetArg(&args[0], Pt_ARG_USER_DATA, &fileFlag, sizeof(int));
	PtSetResources(ABW_fileSelFileName, 1, args);
	PtSetArg(&args[1], Pt_ARG_TEXT_STRING, "Open File", 0);
	PtSetResources(ABW_fileSelOpenBtn, 2, args);

	return( Pt_CONTINUE );
}
Esempio n. 6
0
void initCellButtons(PtWidget_t *thisModule, PAGE *thisPage, int newRasters)
{
	PtWidget_t *cellButton;
	PtArg_t args[2];
	CELL *thisCell;
	PLOT *thisPlot;
	int cellIndex;
	int cellButtonName;
	int i, j;
	char string[16];

	/* set the values on the cell buttons */
	/* first, disable all of the cell buttons
	 * and set the labels to ---
	 */
	strcpy(string, "------");
	PtSetArg(&args[0], Pt_ARG_FLAGS, Pt_TRUE, Pt_GHOST | Pt_BLOCKED);
	PtSetArg(&args[1], Pt_ARG_TEXT_STRING, &string, 0);
	for(i = 0; i < 64; i++) {
		cellButtonName = getCellButtonName(i);
		cellButton = ApGetWidgetPtr(thisModule, cellButtonName);
		if(!cellButton) continue; /* skip bad widgets */

		PtSetResources(cellButton, 2, args);
	}

	/* now enable only the buttons for the number of rows and columns
	 * that the user selected
	 */
	PtSetArg(&args[0], Pt_ARG_FLAGS, Pt_FALSE, Pt_GHOST | Pt_BLOCKED);
	for(i = 0; i < thisPage->nRows; i++) {
		for(j = 0; j < thisPage->nCols; j++) {
			cellIndex = (i * 8) + j;
			cellButtonName = getCellButtonName(cellIndex);
			cellButton = ApGetWidgetPtr(thisModule, cellButtonName);
			if(!cellButton) continue; /* skip bad widgets */

			PtSetResources(cellButton, 1, args);
		}
	}

	/* if the raster definition has been read from a root
	 * label the button with the set and ecode
	 */
	if(!newRasters) {
		for(i = 0; i < thisPage->nDefCells; i++) {
			thisCell = getRasterCell(thisPage->cellsInfo, i);
			thisPlot = &thisCell->plotInfo;
			cellButtonName = getCellButtonName(thisCell->RCindex);
			cellButton = ApGetWidgetPtr(thisModule, cellButtonName);
			if(!cellButton) continue;	/* skip bad widgets */

			sprintf(string, "%d:%d", thisPlot->setNum, thisPlot->cCode);
			PtSetArg(&args[0], Pt_ARG_TEXT_STRING, &string, 0);
			PtSetResources(cellButton, 1, args);
		}
	}
	
	return;
}
Esempio n. 7
0
int initRasterSave( PtWidget_t *link_instance, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	PtArg_t args[2];
	int fileFlag;
	char dir[80];

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

	strcpy(dir, "/");
	PtSetArg(&args[0], Pt_ARG_FS_ROOT_DIR, dir, 0);
	PtSetResources(ABW_fileSelFileList, 1, args);

	PtSetArg(&args[0], Pt_ARG_TEXT_STRING, dir, 0);
	PtSetResources(ABW_fileSelDirText, 1, args);
	PtSetResources(ABW_fileSelFileName, 1, args);

	/* set the user data to indicate a root file write */
	fileFlag = RASTER_FILE_SAVE;
	PtSetArg(&args[0], Pt_ARG_USER_DATA, &fileFlag, sizeof(int));
	PtSetResources(ABW_fileSelFileName, 1, args);
	PtSetArg(&args[1], Pt_ARG_TEXT_STRING, "Save Raster", 0);
	PtSetResources(ABW_fileSelOpenBtn, 2, args);

	return( Pt_CONTINUE );
}
NS_IMETHODIMP
EmbedWindow::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords,
			   const PRUnichar *aTipText)
{
  nsAutoString tipText ( aTipText );
  const char* tipString = ToNewCString(tipText), *font = "TextFont08";
  PtArg_t args[10];
  PhRect_t extent;
  PhDim_t dim;
  PhPoint_t pos = {0, 0};
  int n = 0, w, h;

  if (sTipWindow)
    PtDestroyWidget(sTipWindow);
  
  // get the root origin for this content window
  nsCOMPtr<nsIWidget> mainWidget;
  mBaseWindow->GetMainWidget(getter_AddRefs(mainWidget));
  PtWidget_t *window;
  window = static_cast<PtWidget_t *>(mainWidget->GetNativeData(NS_NATIVE_WINDOW));

  PgExtentText(&extent, &pos, font, tipString, 0);
  w = extent.lr.x - extent.ul.x + 1;
  h = extent.lr.y - extent.ul.y + 1;

  n = 0;
  pos.x = aXCoords;
  pos.y = aYCoords + 10; /* we add 10 so that we don't position it right under the mouse */
	dim.w = w + 6; dim.h = h + 6;
  PtSetArg(&args[n++], Pt_ARG_POS, &pos, 0);
  PtSetArg(&args[n++], Pt_ARG_DIM, &dim, 0);
	PtSetArg( &args[n++], Pt_ARG_REGION_OPAQUE,   Ph_EV_EXPOSE, Ph_EV_EXPOSE);
  sTipWindow = PtCreateWidget(PtRegion, Pt_NO_PARENT, n, args);

  n = 0;
  pos.x = pos.y = 0;
	dim.w = w; dim.h = h;
  PtSetArg(&args[n++], Pt_ARG_POS, &pos, 0);
  PtSetArg(&args[n++], Pt_ARG_DIM, &dim, 0);
  PtSetArg(&args[n++], Pt_ARG_FLAGS, Pt_HIGHLIGHTED, -1 );
  PtSetArg(&args[n++], Pt_ARG_FILL_COLOR, 0xfeffb1, 0);
  PtSetArg(&args[n++], Pt_ARG_TEXT_FONT, font, 0);
  PtSetArg(&args[n++], Pt_ARG_TEXT_STRING, tipString, 0);
  PtSetArg(&args[n++], Pt_ARG_BASIC_FLAGS, Pt_STATIC_GRADIENT | Pt_TOP_OUTLINE | Pt_LEFT_OUTLINE |
      Pt_RIGHT_OUTLINE | Pt_BOTTOM_OUTLINE, -1 );
  PtCreateWidget(PtLabel, sTipWindow, n, args);

  // realize the widget
  PtRealizeWidget(sTipWindow);

  nsMemory::Free( (void*)tipString );

  return NS_OK;
}
int initUserRtVarsDialog( PtWidget_t *link_instance, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	ApDBase_t *userRtVarsdbase;
	PhPoint_t loc;
	PtArg_t args[2];
	int y;
	int i;

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

	/* get the absolute position of the base widget,
	 * place the dialog 100 pixels below the base widget
	 * set the name of the dialog
	 */
	PtGetAbsPosition(ABW_base, &loc.x, &loc.y);
	loc.y += 100;
	PtSetArg(&args[0], Pt_ARG_POS, &loc, 0);
	PtSetArg(&args[1], Pt_ARG_WINDOW_TITLE, cbinfo->cbdata, 0);
	PtSetResources(link_instance, 2, args);

	/* initialize the base timer */
	baseTime = i_b->i_time;

	/* open the user real-time variables data base */
	userRtVarsdbase = ApOpenDBase(ABM_userRtVarsPictures);

	/* set the parent for the widgets */
	PtSetParentWidget(ABW_userRtVarsScrollArea);

	/* create the widget sets for the user real-time variables */
	y = 0;
	i = 0;
	while(strlen(rtvars[i].rt_name)) {
		/* create the label widget for this variable */
		PtSetArg(&args[0], Pt_ARG_TEXT_STRING, rtvars[i].rt_name, 0);
		ApCreateWidget(userRtVarsdbase, "userRtVarLabel", 5, y, 1, &args[0]);

		/* create the value widget for this variable */
		rtVarList[i] = ApCreateWidget(userRtVarsdbase, "userRtVarsInt", 200, y, 0, NULL);

		y += 30;
		i++;
	}

	/* set the maximum range of the scroll widget */
	PtSetArg(&args[0], Pt_ARG_SCROLL_AREA_MAX_Y, y, 0);
	PtSetResources(ABW_userRtVarsScrollArea, 1, &args[0]);

	/* close the widget data base */
	ApCloseDBase(userRtVarsdbase);

	return( Pt_CONTINUE );
}
Esempio n. 10
0
int initDASummary( PtWidget_t *link_instance, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	ApDBase_t *daSumdbase;
	PtArg_t args[2];
	int y;
	int i;
	int j;
	char label[4];

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

	/* open the d to a converter summary data base */
	daSumdbase = ApOpenDBase(ABM_daSumPictures);

	/* set the parent for the widgets */
	PtSetParentWidget(ABW_daSumScrollArea);

	/* create 16 sets of widgets for the da summary */
	y = 0;
	for(i = 0; i < 16; i++) {

		/* create the label widget for this da converter */
		sprintf(label, "%d", i);
		PtSetArg(&args[0], Pt_ARG_TEXT_STRING, label, 0);
		ApCreateWidget(daSumdbase, "daSumDAlabel", 10, y, 2, args);

		/* create the source name text widget for this da converter */
		j = da[i].da_source;
		PtSetArg(&args[0], Pt_ARG_TEXT_STRING, daSourceNames[j], 0);
		ApCreateWidget(daSumdbase, "daSumDAname", 50, y, 2, args);

		/* create the source number widget for this da converter */
		PtSetArg(&args[0], Pt_ARG_NUMERIC_VALUE, da[i].da_src_num, 0);
		ApCreateWidget(daSumdbase, "daSumDAnumber", 138, y, 2, args);

		/* create the mode widget for this da converter */
		PtSetArg(&args[0], Pt_ARG_NUMERIC_VALUE, da[i].da_mode, 0);
		ApCreateWidget(daSumdbase, "daSumDAmode", 216, y, 2, args);

		/* create the offset widget for this da converter */
		PtSetArg(&args[0], Pt_ARG_NUMERIC_VALUE, da[i].da_offset, 0);
		ApCreateWidget(daSumdbase, "daSumDAoffset", 271, y, 2, args);

		/* crement the y value for widget placement */
		y += 30;
	}

	/* close the widget data base */
	ApCloseDBase(daSumdbase);
	return( Pt_CONTINUE );
}
Esempio n. 11
0
int ph_ShowWMCursor(_THIS, WMcursor* cursor)
{
    PtArg_t args[3];
    int nargs = 0;

    /* Don't do anything if the display is gone */
    if (window == NULL)
    {
        return (0);
    }

    /* looks like photon can't draw mouse cursor in direct mode */
    if ((this->screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN)
    {
         /* disable the fake mouse in the fullscreen OpenGL mode */
         if ((this->screen->flags & SDL_OPENGL) == SDL_OPENGL)
         {
             cursor=NULL;
         }
         else
         {
             return (0);
         }
    }

    /* Set the photon cursor, or blank if cursor is NULL */
    if (cursor!=NULL)
    {
        PtSetArg(&args[0], Pt_ARG_CURSOR_TYPE, Ph_CURSOR_BITMAP, 0);
        /* Could set next to any PgColor_t value */
        PtSetArg(&args[1], Pt_ARG_CURSOR_COLOR, Ph_CURSOR_DEFAULT_COLOR , 0);
        PtSetArg(&args[2], Pt_ARG_BITMAP_CURSOR, cursor->ph_cursor, (cursor->ph_cursor->hdr.len + sizeof(PhRegionDataHdr_t)));
        nargs = 3;
    }
    else /* Ph_CURSOR_NONE */
    {
        PtSetArg(&args[0], Pt_ARG_CURSOR_TYPE, Ph_CURSOR_NONE, 0);
        nargs = 1;
    }

    SDL_Lock_EventThread();

    if (PtSetResources(window, nargs, args) < 0 )
    {
        return (0);
    }	

    SDL_Unlock_EventThread();

    return (1);
}
Esempio n. 12
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 );
}
Esempio n. 13
0
int pageLabelTextProc(PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo)
{
	PtArg_t args[1];
	RASTER *rasters;
	PAGE *thisPage;
	char *string;

	/* 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);
	
	/* the widget's value and assign it to the page label text variable */
	PtSetArg(&args[0], Pt_ARG_TEXT_STRING, &string, 0);
	PtGetResources(widget, 1, args);
	if((strlen(string) > 0) && (strlen(string) < 128)) {
		thisPage->labelFlag = 1;
		strcpy(thisPage->pageLabel.label, string);
		thisPage->pageLabel.label[127] = 0;	/* force NULL terminator */
	}
	else {
		thisPage->labelFlag = 0;
		strcpy(thisPage->pageLabel.label, "");
	}

	return( Pt_CONTINUE );
}
Esempio n. 14
0
int showRasterPage( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	PtArg_t args[1];
	PtScrollbarCallback_t *scroll = cbinfo->cbdata;
	RASTER *rasters;
	PAGE *thisPage;
	char string[64];

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

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

	/* get the current page index from the scroll bar */
	rasters->curPageIndx = scroll->position;
	
	/* get pointer to the current raster page */
	thisPage = getRasterPage(rasters->curPageIndx);

	/* create a window label */
	sprintf(string, "Raster Page %d", rasters->curPageIndx + 1);
	PtSetArg(&args[0], Pt_ARG_WINDOW_TITLE, string, 0);
	PtSetResources(ABW_rastersPage, 1, args);

	/* unset the newRasters flag */
	rasters->newRasters = 0;

	/* set the widget values on the page being shown */
	initPageWidgets(ABW_rastersPage, thisPage, rasters->newRasters);

	return( Pt_CONTINUE );
}
Esempio n. 15
0
int
timer_activate( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
  PtArg_t args[1];
  float diffsum;
  clock_t diff_time;
  
  isd_poll_all(isdx, &yaw, &pitch, &roll);
  
  iyaw = floor(yaw);
  ipitch = floor(pitch);
  iroll = floor(roll);
  
  PtSetArg(&args[0], Pt_ARG_GAUGE_VALUE, iyaw, 0);
  PtSetResources(ABW_yaw_meter, 1, args);
  PtSetArg(&args[0], Pt_ARG_GAUGE_VALUE, ipitch, 0);
  PtSetResources(ABW_pitch_meter, 1, args);
  PtSetArg(&args[0], Pt_ARG_GAUGE_VALUE, iroll, 0);
  PtSetResources(ABW_roll_meter, 1, args);
  
  sprintf(yaw_label, "%7.2f", yaw);
  sprintf(pitch_label, "%7.2f", pitch);
  sprintf(roll_label, "%7.2f", roll);
  
  PtSetArg(&args[0], Pt_ARG_TEXT_STRING, &yaw_label, 1);
  PtSetResources(ABW_yaw_label, 1, args);
  
  PtSetArg(&args[0], Pt_ARG_TEXT_STRING, &pitch_label, 1);
  PtSetResources(ABW_pitch_label, 1, args);

  PtSetArg(&args[0], Pt_ARG_TEXT_STRING, &roll_label, 1);
  PtSetResources(ABW_roll_label, 1, args);
	   
  diffsum = abs(yaw - lastyaw);
  diffsum += abs(pitch - lastpitch);
  diffsum += abs(roll - lastroll);
  
  if (diffsum >= REDRAW_THRESHOLD)
    {
      lastyaw = yaw;
      lastpitch = pitch;
      lastroll = roll;
      PtDamageWidget(ABW_rawcube);
      PtFlush();
    }
  
  last_time = this_time;
  this_time = clock();
  
  diff_time = this_time - last_time;
  sprintf(timestring, "%d Hz", CLOCKS_PER_SEC/diff_time);
  PtSetArg(&args[0], Pt_ARG_TEXT_STRING, &timestring, 1);
  PtSetResources(ABW_rate_label, 1, args);
  
  /* eliminate 'unreferenced' warnings */
  widget = widget, apinfo = apinfo, cbinfo = cbinfo;

  return( Pt_CONTINUE );
  
}
Esempio n. 16
0
int tblSetDim(PtWidget_t *scrollCon, PhPoint_t pos, PhDim_t dim)
{
  int c = 0;
  PtArg_t argsScrCon[2];
  tblWidget_t *tbl = NULL;

  if (PtGetResource(scrollCon, Pt_ARG_POINTER, &tbl, 0) != 0)
    return 0;

  tbl->geom = pos;
  tbl->dim = dim;

  PtSetArg(&argsScrCon[c++], Pt_ARG_POS, &pos, 0);
  PtSetArg(&argsScrCon[c++], Pt_ARG_DIM, &dim, 0);
  PtSetResources(scrollCon, c, argsScrCon);

  return 1;
}
Esempio n. 17
0
int newPage(PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo)
{
	PtArg_t args[2];
	RASTER *rasters;
	PAGE *thisPage;
	PAGE *lastPage;
	char string[64];

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

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

	/* increment the current page index */
	rasters->curPageIndx++;
	
	/* create a window label */
	sprintf(string, "Raster Page %d", rasters->curPageIndx + 1);
	PtSetArg(&args[0], Pt_ARG_WINDOW_TITLE, string, 0);
	PtSetResources(ABW_rastersPage, 1, args);

	/* allocate space for a new page */
	rasters->nPages++;
	rasters->pages = addRasterPage(rasters->pages, rasters->nPages);

	/* set the newRasters flag because a new page has been added */
	rasters->newRasters = 1;
	
	/* initialize the new page with the values from the previous page */
	thisPage = getRasterPage(rasters->curPageIndx);
	lastPage = getRasterPage(rasters->curPageIndx - 1);
	initSubsequentPage(thisPage, lastPage);

	/* set the widget values on the new page */
	initPageWidgets(ABW_rastersPage, thisPage, rasters->newRasters);
	
	/* set the maximum value on the page scroll bar */
	PtSetArg(&args[0], Pt_ARG_MAXIMUM, rasters->nPages - 1, 0);
	PtSetArg(&args[1], Pt_ARG_SCROLL_POSITION, rasters->nPages - 1, 0);
	PtSetResources(ABW_pageScrollBar, 2, args);
	
	return( Pt_CONTINUE );
}
Esempio n. 18
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 );
}
Esempio n. 19
0
int
file_change_filter( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
  char *newfilter;
  PtArg_t args[2];
  PtFileSelItem_t *rootitem;
  
  /* eliminate 'unreferenced' warnings */
  widget = widget, apinfo = apinfo, cbinfo = cbinfo;

  newfilter = read_text_from_widget(ABW_filter_input);
  // printf("new filter <%s>\n", newfilter);

  rootitem = PtFSRootItem(ABW_file_tree);

  PtSetArg(&args[0], Pt_ARG_FS_FILE_SPEC, newfilter, 0);
  PtSetArg(&args[1], Pt_ARG_FS_REFRESH, rootitem, 0);
  PtSetResources(ABW_file_tree, 2, args);
  
  return( Pt_CONTINUE );
  
}
Esempio n. 20
0
int switchDebug( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	PtArg_t args[2];
	int *value;

	extern int errprt;

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

	/* get the value of the widget */
	PtSetArg(&args[0], Pt_ARG_ONOFF_STATE, &value, 0);
	PtGetResources(widget, 1, &args[0]);

	/* change the text of the widget to reflect current state */
	if(*value) {
		PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "Debug\nOn", 0);
		PtSetArg(&args[1], Pt_ARG_FILL_COLOR, Pg_GREEN, 0);
		PtSetResources(widget, 2, args);
		errprt = 1;

		/* create a stateDebugWindow if switch is on */
		if(!debugWindow) {
			debugWindow = ApCreateModule(ABM_stateDebugWindow, widget, cbinfo);
		}

		/* enable the debugging timer */
		PtSetArg(&args[0], Pt_ARG_TIMER_INITIAL, 15, 0);
		PtSetResources(ABW_stateDebugTimer, 1, &args[0]);
	}
	else {
		PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "Debug\nOff", 0);
		PtSetArg(&args[1], Pt_ARG_FILL_COLOR, Pg_RED, 0);
		PtSetResources(widget, 2, args);
		errprt = 0;
		
		/* destroy the stateDebugWindow if it is displayed */
		if(debugWindow) {
			PtDestroyWidget(debugWindow);
			debugWindow = (PtWidget_t *)NULL;
		}
		if(debugDialog) {
			PtDestroyWidget(debugDialog);
			debugDialog = (PtWidget_t *)NULL;
		}

		/* disable the debugging timer */
		PtSetArg(&args[0], Pt_ARG_TIMER_INITIAL, 0, 0);
		PtSetResources(ABW_stateDebugTimer, 1, &args[0]);
	}

	return( Pt_CONTINUE );
}
Esempio n. 21
0
int closeDebugWindow( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	PhWindowEvent_t *winEvent;
	PtArg_t args[2];
	int i, j;

	extern int errprt;

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

	/* get pointer to the window event structure */
	winEvent = (PhWindowEvent_t *)cbinfo->cbdata;

	/* check to see which type event evoked this callback */
	if(winEvent->event_f == Ph_WM_CLOSE) {
		/* zero out the chainStates array */
		for(i = 0; i < MAXCHAIN; i++) {
			for(j = 0; j < 64; j++) {
				chainStates[i][j].stateButton = (PtWidget_t *)NULL;
				chainStates[i][j].stateIndex = -1;
			}
		}

		/* set the debug button to off */
		PtSetArg(&args[0], Pt_ARG_ONOFF_STATE, 0, 0);
		PtSetArg(&args[1], Pt_ARG_TEXT_STRING, "Debug\nOff", 0);
		PtSetResources(ABW_debugOnOffButton, 2, args);
		errprt = 0;
		debugWindow = (PtWidget_t *)NULL;
		
		if(debugDialog) {
			PtDestroyWidget(debugDialog);
			debugDialog = (PtWidget_t *)NULL;
		}
	}
	return( Pt_CONTINUE );
}
Esempio n. 22
0
int resetVars( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	PtArg_t arg;
	int i;

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

	baseTime = i_b->i_time;

	/* set the timer widgets */
	PtSetArg(&arg, Pt_ARG_NUMERIC_VALUE, 0, 0);
	PtSetResources(ABW_userRtVarsMin, 1, &arg);
	PtSetArg(&arg, Pt_ARG_NUMERIC_VALUE, 0, 0);
	PtSetResources(ABW_userRtVarsSec, 1, &arg);

	i = 0;
	while(rtvars[i].rt_var) {
		*rtvars[i].rt_var = 0;
		i++;
	}
	return( Pt_CONTINUE );
}
Esempio n. 23
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 );
}
Esempio n. 24
0
int openFile( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	PtArg_t args[1];
	int *fileFlag;
	char *fileName;

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

	/* get the type of file to open */
	PtSetArg(&args[0], Pt_ARG_USER_DATA, &fileFlag, sizeof(int));
	PtGetResources(widget, 1, args);

	/* get the file name from the text widget */
	PtSetArg(&args[0], Pt_ARG_TEXT_STRING, &fileName, 0);
	PtGetResources(ABW_fileSelFileName, 1, args);

	switch(*fileFlag) {
	case ROOT_FILE_READ:
		readRoot(fileName);

		/* save the name of the root file in the proc table for rex session */
		strncpy(myptp->p_root, fileName, P_LROOTNAME);
		break;
	case ROOT_FILE_WRITE:
		writeRoot(fileName);

		/* save the name of the root file in the proc table for rex session */
		strncpy(myptp->p_root, fileName, P_LROOTNAME);
		break;
	case RASTER_FILE_SAVE:
		saveRaster(fileName);
	default:
		break;
	}
	return( Pt_CONTINUE );
}
Esempio n. 25
0
int updateVars( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	PtArg_t arg;
	long msecTime;
	int mins;
	int secs;
	int i;

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

	/* increment the timer */
	msecTime = i_b->i_time - baseTime;

	/* convert to seconds */
	secs = msecTime / 1000;

	/* get minutes */
	mins = secs / 60;

	/* get seconds */
	secs = secs % 60;

	/* set the widgets */
	PtSetArg(&arg, Pt_ARG_NUMERIC_VALUE, mins, 0);
	PtSetResources(ABW_userRtVarsMin, 1, &arg);
	PtSetArg(&arg, Pt_ARG_NUMERIC_VALUE, secs, 0);
	PtSetResources(ABW_userRtVarsSec, 1, &arg);
	
	i = 0;
	while(rtVarList[i]) {
		PtSetArg(&arg, Pt_ARG_NUMERIC_VALUE, *rtvars[i].rt_var, 0);
		PtSetResources(rtVarList[i], 1, &arg);
		i++;
	}
	return( Pt_CONTINUE );
}
Esempio n. 26
0
int swapColors( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	PtArg_t args[2];
	PtWidget_t *thisButton;
	long thisTime;
	int thisIndx;
	int i, j;
	char thisColor;
	char buttonLabel[128];
	char timeStamp[32];

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

	for(i = 0; i < MAXCHAIN; i++) {
		for(j = 0; j < 64; j++) {
			thisButton = chainStates[i][j].stateButton;
			thisIndx = chainStates[i][j].stateIndex;
			thisTime = stateDebug[thisIndx].time;
			thisColor = stateDebug[thisIndx].color;
			if(thisButton) {
				if(snames[thisIndx]->preset) strcpy(buttonLabel, "T");
				else strcpy(buttonLabel, "-");
				if(snames[thisIndx]->random) strcat(buttonLabel, "R");
				else strcat(buttonLabel, "-");
				strcat(buttonLabel, snames[thisIndx]->statename);
				sprintf(timeStamp, "        %ld", stateDebug[thisIndx].time);
				strcat(buttonLabel, timeStamp);
				PtSetArg(&args[0], Pt_ARG_TEXT_STRING, buttonLabel, 0);
				PtSetArg(&args[1], Pt_ARG_FILL_COLOR, stateButtonColors[thisColor], 0);
				PtSetResources(thisButton, 2, args);
			}
		}
	}
	return( Pt_CONTINUE );
}
Esempio n. 27
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 );
}
Esempio n. 28
0
/*
 * Function     - wgt_gettext()
 *
 * Arguments    - <widget_name> Name of the widget
 *              - <str> Destination string pointer
 *              - <length> Length of the destination buffer
 *
 * Return Value - -1 if length of the destination buffer is not large enough
 */
sint32_t wgt_gettext(const sint32_t widget_name, char * str, uint32_t length)
{
   PtArg_t arg;
   char * buff;

   // Get the string from the widget
   PtSetArg(&arg, Pt_ARG_TEXT_STRING, 0, 0);
   PtGetResources(AbGetABW(widget_name), 1, &arg);
   buff = (char *)arg.value;

   // Copy the string
   if(length < strlen(buff))
      return (-1);
   else
      strcpy(str, buff);

   return (0);
}
Esempio n. 29
0
int
axis_change( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
  PtArg_t args[1];
  unsigned short *newaxis;
  
  // index is Pt_ARG_CBOX_SEL_ITEM
  /* eliminate 'unreferenced' warnings */
  widget = widget, apinfo = apinfo, cbinfo = cbinfo;
  
  PtSetArg( &args[0], Pt_ARG_CBOX_SEL_ITEM, &newaxis, 0 ); 
  PtGetResources(ABW_axis_selector, 1, args);
  current_axis = *newaxis - 1;
  // fprintf(stderr, "New AXIS : %d\n", current_axis);

  draw_gains();
  return( Pt_CONTINUE );
  
}
Esempio n. 30
0
int
change_trend_min( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
  PtArg_t args[1];
  short int tmin;
  PtNumericIntegerCallback_t *cb;
  
  /* eliminate 'unreferenced' warnings */
  widget = widget, apinfo = apinfo, cbinfo = cbinfo;

  cb = cbinfo->cbdata;
  tmin = cb->numeric_value;

  // printf("min set to %d\n", tmin);

  PtSetArg(&args[0], Rt_ARG_TREND_MIN, tmin, 1);
  PtSetResources(ABW_position_trend, 1, args);

  return( Pt_CONTINUE );
}