Example #1
0
/******************************************************************

  ComputeMaxTextWHD() -- This function computes the maximum text width,
		height and descent of a list of text labels.

******************************************************************/
GS_errorType
ComputeMaxTextWHD(short int count, char *item_list, int *mxtw, int *mxth, int *mxtd)
{
   int i, tw, th, td, max_tw=0, max_th=0, max_td=0;
   char *current_item;

 
   for (i = 0; i < count; i++) {

      ExtractItemLabel(i, item_list, current_item);

      SRGP_inquireTextExtent(current_item, &tw, &th, &td);

      if (tw > max_tw) max_tw = tw;

      if (th > max_th) max_th = th;
  
      if (td > max_td) max_td = td;

   }

   *mxtw = max_tw;
   *mxth = max_th;
   *mxtd = max_td;

   return(GSNOERROR);
} /* end of ComputeMaxTextWHD() */
Example #2
0
PRIVATE void MakeStandardSize (SUIT_object o)
{
    int width, ascent, descent;
    int margin = SUIT_getInteger (o, MARGIN);
    char *label = SUIT_getText (o, LABEL);
    
    SUIT_setBoolean (o, SHRINK_TO_FIT, FALSE);
    GP_setFont (SUIT_getFont (o, FONT));
    SRGP_inquireTextExtent (longest, &width, &ascent, &descent);
    if (SUIT_stringsMatch(label, "OK"))
	SUIT_changeObjectSize (o, width+2*margin, ascent+descent+margin);
    else
	SUIT_changeObjectSize (o, width+4*margin, ascent+descent+margin);
}
Example #3
0
static void
EVUdetermineTextInfo (void)
{
   int w, h, d;
   int wd, ht;

   SRGP_inquireTextExtent ("hello", &w, &h, &d);
   ydelta = h+d;
#ifndef THINK_C
   ydelta++;
#endif
   SRGP_inquireCanvasSize (0, &wd, &ht);
   frame_announcement_y = ht-h-1;
   code_reset_y = ycoord = ht-ydelta-ydelta;
}
Example #4
0
/* returns NULL if users CANCELs out */
PRIVATE Pointer PutUpTypeSpecificWidget (SUIT_object o, char *type)
{
    SUIT_viewport vp;
    int width, height;
    Pointer retval = NULL;
    
    vp = SUIT_mapViewportToScreen(o, OBJECT_VIEWPORT(o));
    width = vp.top_right.x - vp.bottom_left.x;
    height = vp.top_right.y - vp.bottom_left.y;
    ASSERT ((o != NULL), (mes, "PutUpTypeSpecificWidget recieved a NULL object.\n"));
    peGlobal.activeWidget = SUIT_createOKCancelDialogBox ("property editor gizmo", o, NULL);
    SUIT_setText (o, "property type", type);
    SUIT_forceOnScreen(o);
    MakeStandardColors (peGlobal.activeWidget);
    MakeVisibleWithin (peGlobal.activeWidget, TRUE);
    
    if (width == SUIT_deluxeGetInteger (NULL, DEFAULT_OBJECT_WIDTH, GLOBAL) &&
	height == SUIT_deluxeGetInteger (NULL, DEFAULT_OBJECT_HEIGHT, GLOBAL)) {
	int w, a, d;
	GP_setFont (SUIT_getFont (peGlobal.activeWidget, SUIT_SYSTEM_FONT));
	SRGP_inquireTextExtent ("Cancel", &w, &a, &d);
	SUIT_changeObjectSize (peGlobal.activeWidget, 10 * w, 10 * (a + d));	/* guess at a good size */
    }
    
    if (SUIT_stringsMatch (type, "SUIT_textList") || SUIT_stringsMatch (type, "text"))
	SUIT_setBoolean (peGlobal.activeWidget, GRAB_RETURN_KEY, FALSE);

    SUIT_setText (o, CHAINED_TO_OBJECT, OBJECT_NAME(peGlobal.objectBeingEdited));

    if (SUIT_activateDialogBox (peGlobal.activeWidget) == REPLY_OK) {
	boolean error;
	if (SUIT_stringsMatch(type, "SUIT_textList"))
	    retval = si_readTextList (SUIT_getText (o, CURRENT_VALUE), &error);
	else if (SUIT_stringsMatch(type, "SUIT_functionPointer"))
	    retval = si_readFunctionPtr (SUIT_getText (o, CURRENT_VALUE), &error);
	else
	    retval = si_getType (type)->copy (SUIT_getProperty (o, CURRENT_VALUE, type));
    }
    SUIT_destroyObject (peGlobal.activeWidget);
    peGlobal.activeWidget = NULL;
    peGlobal.propertyBeingEdited = NULL;
    return retval;
}