Beispiel #1
0
/*************************************************************************
 *
 *N  draw_text_row
 *
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   Purpose:
 *P
 *     This function draws annotation for a given row in the text
 *     pseudo-primitive table.
 *E
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   Parameters:
 *A
 *     row         <input>==(row_type) row of the text table.
 *     table       <input>==(vpf_table_type) text primitive table.
 *     return     <output>==(int) 0 if the user escapes, 1 upon successful
 *                          completion.
 *E
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   History:
 *H
 *    Barry Michaels   August 1991                        DOS Turbo C
 *E
 *************************************************************************/
int draw_text_row( row_type row, vpf_table_type table )
{
   int xscr,yscr, shape_pos, text_pos;
   ossim_int32 n, nshape;
   coordinate_type *shape_line;
   char *text;
   struct viewporttype vp;

   shape_pos = table_pos("SHAPE_LINE",table);
/**** MUST CHECK FOR 'Z', 'B', AND 'Y' TYPES - SEE VPFPRIM.C ****/
   shape_line = (coordinate_type *)get_table_element(shape_pos,row,table,
						     NULL,&nshape);
   text_pos = table_pos("STRING",table);
   text = (char *)get_table_element(text_pos,row,table,NULL,&n);

   screenxy(shape_line[0].x,shape_line[0].y,&xscr,&yscr);

   getviewsettings(&vp);
   if ((gpgetfont() != DEFAULT_FONT) || (yscr > gptextheight(text))) {
      hidemousecursor();
      gptext(xscr,yscr,text);
      showmousecursor();
   }

   free(shape_line);
   free(text);

   while (kbhit()) {
      if (getch()==27) {
	 return 0;
      }
   }

   return 1;
}
Beispiel #2
0
void button_draw(Widget *w, int posneg)
{
  char *label = w->d;
  int fg, bg;
  if (posneg) { 
    fg = 1; bg = 0; 
  } else { 
    fg = 0; bg = 1;  
  }
  mvact(w->id);
  gpcolor(fg);
  gpbox(0., 1., 0., 1.);
  gpcolor(bg);
  gptext(.2, .2, label, NULL); 
  mvframe();
  gpflush();
}