Esempio n. 1
0
/******************************************************************

  DrawToggleButton() -- This function draws the specified toggle 
		button gadget.

******************************************************************/
GS_errorType
DrawToggleButton(GSgadgetStruct *bg)
{
   if (bg->gadget_type == GSTOGBUTTON) {

      switch(bg->togbutton->shape)
      {
         case GSTOGSQUARE:
            if (bg->togbutton->state == FALSE)
            {
               /*  draw background of button 
                */
               SRGP_setColor(bg->gadget_bgd_color);
               SRGP_fillRectangle(bg->togbutton->square);

               /*  draw outline of button
                */
               SRGP_setColor(bg->gadget_bor_color);
               SRGP_rectangle(bg->togbutton->square);
            }
            else
            {
               /*  draw background of button 
                */
               SRGP_setColor(bg->gadget_bor_color);
               SRGP_fillRectangle(bg->togbutton->square);

               /*  draw outline of button
                */
               SRGP_setColor(bg->gadget_bgd_color);
               SRGP_rectangle(bg->togbutton->square);
            }
            break;
         case GSTOGDIAMOND:
            break;
         case GSTOGCIRCLE:
            break;
         default:
            break;
      }

      /*  draw label of button
       */
      SRGP_setColor(bg->gadget_fgd_color);
      SRGP_text(bg->togbutton->label_pos, bg->togbutton->label);
   }
   else
      return(GSNOTBUTTONERR);

   return(GSNOERROR);
} /* end of DrawToggleButton() */
Esempio n. 2
0
void paint_julia_prev(infoptr pic, point mouse_pos)
{
  struct picture_info prev_pic;
  dpoint p, tmp;
  int n = 0;

  prev_pic.area = get_prev_rect(pic);
  init_coords(&prev_pic);    /* Asetetaan sopiva skaalaus */
  /* Julia-vakio hiiren koordinaateista */  
  prev_pic.julia_c = to_dpoint(mouse_pos, pic); 
  SRGP_setClipRectangle(prev_pic.area);
  SRGP_setColor(SRGP_BLACK);  /* Peitetään vanha kuva */
  SRGP_fillRectangleCoord(prev_pic.area.bottom_left.x + 1,
			  prev_pic.area.bottom_left.y + 1,
			  prev_pic.area.top_right.x - 1,
			  prev_pic.area.top_right.y - 1); 
  SRGP_setColor(SRGP_WHITE);  /* Valkea reunus */
  SRGP_rectangle(prev_pic.area);
  p.x = 0;   /* Inverse functionin */
  p.y = 0;   /* alkupiste          */

  while(n < JULIA_LIMIT)
  {   /*  z[n+1] = sqrt(z[n] - c)  */
    tmp.x = p.x - prev_pic.julia_c.x;
    tmp.y = p.y - prev_pic.julia_c.y;
    p = c_sqrt(tmp);
    SRGP_point(to_point(p, &prev_pic));
    n++;
  }
  SRGP_setClipRectangle(pic->area);
}
Esempio n. 3
0
/******************************************************************

  DrawDrawingArea() -- This function draws the specified drawing area.

******************************************************************/
GS_errorType
DrawDrawingArea(GSgadgetStruct *area)
{

   if (area->gadget_type == GSDRAWAREA) {

      /*  draw background of drawing area
       */
      SRGP_setColor(area->gadget_bgd_color);
      SRGP_fillRectangle(area->gadget_extent);

      /*  draw outline of drawing area
       */
      SRGP_setColor(area->gadget_bor_color);
      SRGP_rectangle(area->gadget_extent);

      /*  reset drawing color back to foreground color
       */
      SRGP_setColor(area->gadget_fgd_color);
   }
   else
      return(GSNOTDRAWAREA);

   return(GSNOERROR);
} /* end of DrawDrawingArea()*/
Esempio n. 4
0
/******************************************************************

  DrawSubMenu() -- This function draws the specified submenu gadget.

******************************************************************/
GS_errorType
DrawSubMenu(GSgadgetStruct *sm)
{
   int 	i;
   char *item_label;

   GS_errorType ExtractItemLabel();


   if (sm->gadget_type == GSSUBMENU) {

      /*  draw background of sub menu
       */
      SRGP_setColor(sm->gadget_bgd_color);
      SRGP_fillRectangle(sm->gadget_extent);

      /*  draw outline of sub menu
       */
      SRGP_setColor(sm->gadget_bor_color);
      SRGP_rectangle(sm->gadget_extent);

      /*  draw menu labels of sub menu
       */
      SRGP_setColor(sm->gadget_fgd_color);

      for (i = 0; i < sm->submenu->item_count; i++) {
         ExtractItemLabel(i, sm->submenu->item_list, item_label);
         SRGP_text(sm->submenu->item_pos[i], item_label);
      }
   }
   else
      return(GSNOTSUBMENUERR);

   return(GSNOERROR);
} /* end of DrawSubMenu()*/
Esempio n. 5
0
/******************************************************************

  DrawMenuBar() -- This function draws the specified menu bar gadget.

******************************************************************/
GS_errorType
DrawMenuBar(GSgadgetStruct *mb)
{
   int 	i;
   char *item_label;

   GS_errorType ExtractItemLabel();


   if (mb->gadget_type == GSMENUBAR) {

      /*  draw background of menu bar 
       */
      SRGP_setColor(mb->gadget_bgd_color);
      SRGP_fillRectangle(mb->gadget_extent);

      /*  draw outline of menu bar
       */
      SRGP_setColor(mb->gadget_bor_color);
      SRGP_rectangle(mb->gadget_extent);

      /*  draw menu labels of menu bar
       */
      SRGP_setColor(mb->gadget_fgd_color);

      for (i = 0; i < mb->menubar->item_count; i++) {
         ExtractItemLabel(i, mb->menubar->item_list, item_label);
         SRGP_text(mb->menubar->item_pos[i], item_label);
      }
   }
   else
      return(GSNOTMENUBARERR);

   return(GSNOERROR);
} /* end of DrawMenuBar()*/
Esempio n. 6
0
/******************************************************************

  DrawPushButton() -- This function draws the specified push 
		button gadget.

******************************************************************/
GS_errorType
DrawPushButton(GSgadgetStruct *bg)
{
   if (bg->gadget_type == GSPUSHBUTTON) {

      /*  draw background of button 
       */
      SRGP_setColor(bg->gadget_bgd_color);
      SRGP_fillRectangle(bg->gadget_extent);

      /*  draw outline of button
       */
      SRGP_setColor(bg->gadget_bor_color);
      SRGP_rectangle(bg->gadget_extent);

      /*  draw label of button
       */
      SRGP_setColor(bg->gadget_fgd_color);
      SRGP_text(bg->button->label_pos, bg->button->label);
   }
   else
      return(GSNOTBUTTONERR);

   return(GSNOERROR);
} /* end of DrawPushButton() */
Esempio n. 7
0
void si_animateScreenBorderToObject(SUIT_object o, long currentTime, long totalTime)

{
    
    static	rectangle oldR;		/* original, old rectangle */
    static	rectangle newR;		/* new, final rectangle */
    static	rectangle prevR;

    double	fract;
    rectangle	r;

    if ( currentTime == 0 )	/* first time through */
    {		
	oldR = SUIT_getScreenViewport();
	newR = OBJECT_VIEWPORT(o);
	prevR = oldR;
	SRGP_rectangle(prevR);	
	SRGP_refresh();
	return;
    }

    fract = ( (double) currentTime) / totalTime;
    r.bottom_left.x = MY_BLEND(newR.bottom_left.x,oldR.bottom_left.x,fract);
    r.bottom_left.y = MY_BLEND(newR.bottom_left.y,oldR.bottom_left.y,fract);
    r.top_right.x = MY_BLEND(newR.top_right.x,oldR.top_right.x,fract);
    r.top_right.y = MY_BLEND(newR.top_right.y,oldR.top_right.y,fract);
    
    if ( !SUIT_viewportsEqual(prevR,r) )
    {
	SRGP_rectangle(prevR);	
	SRGP_rectangle(r);	
	SRGP_refresh();
	prevR = r;
    }

}