Esempio n. 1
0
static void AnchorD_ClearCorrections(AnchorDlg *a) {
    unichar_t ubuf[2];

    ubuf[0] = '0'; ubuf[1] = '\0';
    free(a->xadjust.corrections); memset(&a->xadjust,0,sizeof(DeviceTable));
    free(a->yadjust.corrections); memset(&a->yadjust,0,sizeof(DeviceTable));
    GGadgetSetTitle(GWidgetGetControl(a->gw,CID_XCor),ubuf);
    GGadgetSetTitle(GWidgetGetControl(a->gw,CID_YCor),ubuf);
}
Esempio n. 2
0
static void RH_SetupHint(ReviewHintData *hd) {
    char buffer[20]; unichar_t ubuf[20];
    static unichar_t nullstr[] = {'\0'};
    StemInfo *h;
    int pos,cnt;

    if ( hd->lastactive!=NULL )
	hd->lastactive->active = false;

    pos = cnt = 0;
    for ( h=hd->ishstem ? hd->cv->b.sc->hstem : hd->cv->b.sc->vstem; h!=NULL; h=h->next ) {
	++cnt;
	if ( h==hd->active ) pos=cnt;
    }
    sprintf( buffer,"%d/%d", pos, cnt );
    if ( cnt==3 ) {
	StemInfo *h2, *h3;
	h = hd->ishstem ? hd->cv->b.sc->hstem : hd->cv->b.sc->vstem;
	h2 = h->next; h3 = h2->next;
	if ( h->width == h2->width && h2->width==h3->width &&
		h2->start-h->start == h3->start-h2->start )
	    strcat( buffer, hd->ishstem ? " hstem3" : " vstem3" );
    }
    uc_strcpy(ubuf,buffer);
    GGadgetSetTitle(GWidgetGetControl(hd->gw,CID_Count),ubuf);
    
    if ( hd->active==NULL ) {
	GGadgetSetTitle(GWidgetGetControl(hd->gw,CID_Base),nullstr);
	GGadgetSetTitle(GWidgetGetControl(hd->gw,CID_Width),nullstr);
	GGadgetSetVisible(GWidgetGetControl(hd->gw,CID_Overlap),false);
    } else {
	hd->active->active = true;
	sprintf( buffer,"%g", (double) (!hd->active->ghost ? hd->active->start : hd->active->start+hd->active->width) );
	uc_strcpy(ubuf,buffer);
	GGadgetSetTitle(GWidgetGetControl(hd->gw,CID_Base),ubuf);
	GTextFieldShow(GWidgetGetControl(hd->gw,CID_Base),0);
	sprintf( buffer,"%g", (double) (!hd->active->ghost ? hd->active->width : -hd->active->width) );
	uc_strcpy(ubuf,buffer);
	GGadgetSetTitle(GWidgetGetControl(hd->gw,CID_Width),ubuf);
	GTextFieldShow(GWidgetGetControl(hd->gw,CID_Width),0);
	GGadgetSetVisible(GWidgetGetControl(hd->gw,CID_Overlap),hd->active->hasconflicts);
    }
    if ( hd->lastactive!=hd->active ) {
	hd->lastactive = hd->active;
	SCOutOfDateBackground(hd->cv->b.sc);
	SCUpdateAll(hd->cv->b.sc);	/* Changing the active Hint means we should redraw everything */
    }
    RH_SetNextPrev(hd);
}
Esempio n. 3
0
static int Trans_TypeChange(GGadget *g, GEvent *e) {
    if ( e->type==et_controlevent && e->u.control.subtype == et_listselected ) {
	GWindow bw = GGadgetGetWindow(g);
	int offset = GGadgetGetCid(g)-CID_Type;
	int index = GGadgetGetFirstListSelectedItem(g);
	int mask = (intpt) transformtypes[index].userdata;
	int i;

	if ( mask & 0x400 ) {
	    real xoff = last_ruler_offset[0].x, yoff = last_ruler_offset[0].y;
	    char buf[24]; unichar_t ubuf[24];
	    if ( mask & 0x20 )
		index -= 4;	/* skew */
	    else
		index -= 7;	/* move or rotate */
	    GGadgetSelectOneListItem( g,index );
	    mask &= ~0x400;
	    if ( mask&1 ) {		/* Move */
		sprintf( buf, "%.1f", (double) xoff );
		uc_strcpy(ubuf,buf);
		GGadgetSetTitle(GWidgetGetControl(bw,CID_XMove+offset), ubuf );
		sprintf( buf, "%.1f", (double) yoff );
		uc_strcpy(ubuf,buf);
		GGadgetSetTitle(GWidgetGetControl(bw,CID_YMove+offset), ubuf );
	    } else {
		sprintf( buf, "%.0f", atan2(yoff,xoff)*180/3.1415926535897932 );
		uc_strcpy(ubuf,buf);
		GGadgetSetTitle(GWidgetGetControl(bw,((mask&0x2)?CID_Angle:CID_SkewAng)+offset), ubuf );
		GGadgetSetChecked(GWidgetGetControl(bw,CID_Clockwise+offset), false );
		GGadgetSetChecked(GWidgetGetControl(bw,CID_CounterClockwise+offset), true );
	    }
	}

	for ( i=CID_First; i<=CID_Last; ++i ) {
	    GGadget *sg;
	    sg = GWidgetGetControl(bw,i+offset);
	    GGadgetSetVisible(sg, ( ((intpt) GGadgetGetUserData(sg))&mask )?1:0);
	}
	if ( selcid[index]!=0 ) {
	    GGadget *tf = GWidgetGetControl(bw,selcid[index]+offset);
	    GWidgetIndicateFocusGadget(tf);
	    GTextFieldSelect(tf,0,-1);
	}
	GWidgetToDesiredSize(bw);
	GDrawRequestExpose(bw,NULL,false);
    }
return( true );
}
Esempio n. 4
0
static void AnchorD_SetDevTabs(AnchorDlg *a) {
    char buffer[20];
    unichar_t ubuf[20];
    int min, max;

    GGadgetClearList(GWidgetGetControl(a->gw,CID_DisplaySize));
    min = 1; max = 0;
    if ( a->xadjust.corrections!=NULL ) {
	min = a->xadjust.first_pixel_size;
	max = a->xadjust.last_pixel_size;
    }
    if ( a->yadjust.corrections!=NULL ) {
	if ( a->yadjust.first_pixel_size<min ) min = a->yadjust.first_pixel_size;
	if ( a->yadjust.last_pixel_size>max ) max = a->yadjust.last_pixel_size;
    }
    if ( max>min ) {
	int i;
	int len = max-min+1;
	char buffer[20];
	GTextInfo **ti = malloc((len+1)*sizeof(GTextInfo *));
	for ( i=0; i<len; ++i ) {
	    ti[i] = calloc(1,sizeof(GTextInfo));
	    sprintf( buffer, "%d", i+min );
	    ti[i]->text = uc_copy(buffer);
	    ti[i]->fg = ti[i]->bg = COLOR_DEFAULT;
	}
	ti[i] = calloc(1,sizeof(GTextInfo));
	GGadgetSetList(GWidgetGetControl(a->gw,CID_DisplaySize),ti,false);
    }
    ubuf[0] = '0'; ubuf[1] = '\0';
    if ( a->xadjust.corrections!=NULL &&
	    a->pixelsize>=a->xadjust.first_pixel_size &&
	    a->pixelsize<=a->xadjust.last_pixel_size ) {
	sprintf( buffer, "%d", a->xadjust.corrections[
		a->pixelsize-a->xadjust.first_pixel_size]);
	uc_strcpy(ubuf,buffer);
    }
    GGadgetSetTitle(GWidgetGetControl(a->gw,CID_XCor),ubuf);
    ubuf[0] = '0'; ubuf[1] = '\0';
    if ( a->yadjust.corrections!=NULL &&
	    a->pixelsize>=a->yadjust.first_pixel_size &&
	    a->pixelsize<=a->yadjust.last_pixel_size ) {
	sprintf( buffer, "%d", a->yadjust.corrections[
		a->pixelsize-a->yadjust.first_pixel_size]);
	uc_strcpy(ubuf,buffer);
    }
    GGadgetSetTitle(GWidgetGetControl(a->gw,CID_YCor),ubuf);
}
Esempio n. 5
0
static int GFD_Ok(GGadget *g, GEvent *e) {
    if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
	struct gfc_data *d = GDrawGetUserData(GGadgetGetWindow(g));
	GGadget *tf;
	GFileChooserGetChildren(d->gfc,NULL,NULL,&tf);
	if ( *_GGadgetGetTitle(tf)!='\0' ) {
	    extern int allow_utf8_glyphnames;
	    GTextInfo *ti = GGadgetGetListItemSelected(d->rename);
	    char *nlname = u2utf8_copy(ti->text);
	    force_names_when_opening = NameListByName(nlname);
	    free(nlname);
	    if ( force_names_when_opening!=NULL && force_names_when_opening->uses_unicode &&
		    !allow_utf8_glyphnames) {
		ff_post_error(_("Namelist contains non-ASCII names"),_("Glyph names should be limited to characters in the ASCII character set, but there are names in this namelist which use characters outside that range."));
return(true);
	    }
	    d->done = true;
	    d->ret = GGadgetGetTitle(d->gfc);

	    // Trim trailing '/' if its there and put that string back as
	    // the d->gfc string.
	    int tmplen = u_strlen( d->ret );
	    if( tmplen > 0 ) {
		if( d->ret[ tmplen-1 ] == '/' ) {
		    unichar_t* tmp = u_copy( d->ret );
		    tmp[ tmplen-1 ] = '\0';
		    GGadgetSetTitle(d->gfc, tmp);
		    free(tmp);
		    d->ret = GGadgetGetTitle(d->gfc);
		}
	    }
	}
    }
return( true );
}
Esempio n. 6
0
static void PoV_DoVanish(struct nldlg *d) {
    double x,y,dv,tilt,dir;
    double t;
    int err = false;
    double vp;
    char buf[80];
    unichar_t ubuf[80];
extern char *coord_sep;

    x = GetQuietReal(d->gw,CID_XValue,&err);
    y = GetQuietReal(d->gw,CID_YValue,&err);
    /*z = GetQuietReal(d->gw,CID_ZValue,&err);*/
    dv = GetQuietReal(d->gw,CID_DValue,&err);
    tilt = GetQuietReal(d->gw,CID_Tilt,&err)*3.1415926535897932/180;
    dir = GetQuietReal(d->gw,CID_GazeDirection,&err)*3.1415926535897932/180;
    if ( err )
return;
    if ( GGadgetGetFirstListSelectedItem( GWidgetGetControl(d->gw,CID_XType))!=3 )
	x = 0;
    if ( GGadgetGetFirstListSelectedItem( GWidgetGetControl(d->gw,CID_YType))!=3 )
	y = 0;
    t = tan(tilt);
    if ( t<.000001 && t>-.000001 )
	sprintf(buf,"inf%sinf", coord_sep);
    else {
	vp = dv/t;
	x -= sin(dir)*vp;
	y += cos(dir)*vp;
	sprintf(buf,"%g%s%g", x, coord_sep, y );
    }
    uc_strcpy(ubuf,buf);
    GGadgetSetTitle( GWidgetGetControl(d->gw,CID_Vanish), ubuf );
}
Esempio n. 7
0
static void AnchorD_DrawPos(AnchorDlg *a) {
    GRect r;
    char buffer[20];
    unichar_t ubuf[20];

    sprintf( buffer, "%g", (double) a->apos.x );
    uc_strcpy(ubuf,buffer);
    GGadgetSetTitle(GWidgetGetControl(a->gw,CID_X),ubuf);
    sprintf( buffer, "%g", (double) a->apos.y );
    uc_strcpy(ubuf,buffer);
    GGadgetSetTitle(GWidgetGetControl(a->gw,CID_Y),ubuf);

    r.x = a->ctl_len;
    r.y = 0;
    r.width = a->char_size*a->magfactor;
    r.height = a->full_height;
    GDrawRequestExpose(a->gw,&r,false);
}
Esempio n. 8
0
static int FtPpem_PtYChanged(GGadget *g, GEvent *e) {
    if ( e->type==et_controlevent && e->u.control.subtype == et_textchanged ) {
	FtSizeData *fsd = GDrawGetUserData(GGadgetGetWindow(g));
	if ( GGadgetIsChecked(GWidgetGetControl(fsd->gw,CID_SameAs))) {
	    const unichar_t *y = _GGadgetGetTitle(g);
	    GGadgetSetTitle(GWidgetGetControl(fsd->gw,CID_PointSizeX),y);
	}
    }
return( true );
}
Esempio n. 9
0
static int FtPpem_SameAsChanged(GGadget *g, GEvent *e) {
    if ( e->type==et_controlevent && e->u.control.subtype == et_radiochanged ) {
	FtSizeData *fsd = GDrawGetUserData(GGadgetGetWindow(g));
	if ( GGadgetIsChecked(g)) {
	    const uint32_t *y = _GGadgetGetTitle(GWidgetGetControl(fsd->gw,CID_PointSize));
	    GGadgetSetTitle(GWidgetGetControl(fsd->gw,CID_PointSizeX),y);
	    GGadgetSetEnabled(GWidgetGetControl(fsd->gw,CID_PointSizeX),false);
	} else {
	    GGadgetSetEnabled(GWidgetGetControl(fsd->gw,CID_PointSizeX),true);
	}
    }
return( true );
}
Esempio n. 10
0
static int AnchorD_DisplaySizeChanged(GGadget *g, GEvent *e) {
    AnchorDlg *a = GDrawGetUserData(GGadgetGetWindow(g));
    if ( e->type==et_controlevent && e->u.control.subtype == et_textchanged ) {
	const unichar_t *ret = _GGadgetGetTitle(GWidgetGetControl(a->gw,CID_DisplaySize));
	unichar_t *end;
	int pixelsize = u_strtol(ret,&end,10);

	while ( *end==' ' ) ++end;
	if ( pixelsize>4 && pixelsize<400 && *end=='\0' ) {
	    unichar_t ubuf[20]; char buffer[20];
	    ubuf[0] = '0'; ubuf[1] = '\0';
	    if ( a->xadjust.corrections!=NULL &&
		    pixelsize>=a->xadjust.first_pixel_size &&
		    pixelsize<=a->xadjust.last_pixel_size ) {
		sprintf( buffer, "%d", a->xadjust.corrections[
			pixelsize-a->xadjust.first_pixel_size]);
		uc_strcpy(ubuf,buffer);
	    }
	    GGadgetSetTitle(GWidgetGetControl(a->gw,CID_XCor),ubuf);
	    ubuf[0] = '0'; ubuf[1] = '\0';
	    if ( a->yadjust.corrections!=NULL &&
		    pixelsize>=a->yadjust.first_pixel_size &&
		    pixelsize<=a->yadjust.last_pixel_size ) {
		sprintf( buffer, "%d", a->yadjust.corrections[
			pixelsize-a->yadjust.first_pixel_size]);
		uc_strcpy(ubuf,buffer);
	    }
	    GGadgetSetTitle(GWidgetGetControl(a->gw,CID_YCor),ubuf);
	    a->xoff = pixelsize*a->xoff/a->pixelsize;
	    a->pixelsize = aa_pixelsize = pixelsize;
	    AnchorD_ChangeSize(a);
	    GDrawRequestExpose(a->gw,NULL,false);
	}
    }
return( true );
}
Esempio n. 11
0
static uint32_t *
GWidgetOpenFileWPath (const uint32_t *title, const uint32_t *defaultfile,
                      const uint32_t *initial_filter, char **mimetypes,
                      GFileChooserFilterType filter, char **path)
{
  GRect pos;
  GWindow gw;
  GWindowAttrs wattrs;
  GGadgetCreateData gcd[7], boxes[3], *varray[5], *harray[8];
  GTextInfo label[4];
  struct gfc_data d;
  int bs = GIntGetResource (_NUM_Buttonsize), bsbigger, totwid;

  GProgressPauseTimer ();
  memset (&wattrs, 0, sizeof (wattrs));
  wattrs.mask =
    wam_events | wam_cursor | wam_wtitle | wam_undercursor | wam_restrict |
    wam_isdlg;
  wattrs.event_masks = ~(1 << et_charup);
  wattrs.restrict_input_to_me = 1;
  wattrs.undercursor = 1;
  wattrs.is_dlg = 1;
  wattrs.cursor = ct_pointer;
  wattrs.window_title = (uint32_t *) title;
  pos.x = pos.y = 0;
  totwid = GGadgetScale (223);
  bsbigger = 3 * bs + 4 * 14 > totwid;
  totwid = bsbigger ? 3 * bs + 4 * 12 : totwid;
  pos.width = GDrawPointsToPixels (NULL, totwid);
  pos.height = GDrawPointsToPixels (NULL, 223);
  gw = GDrawCreateTopWindow (NULL, &pos, e_h, &d, &wattrs);

  memset (&label, 0, sizeof (label));
  memset (&gcd, 0, sizeof (gcd));
  memset (&boxes, 0, sizeof (boxes));
  gcd[0].gd.pos.x = 12;
  gcd[0].gd.pos.y = 6;
  gcd[0].gd.pos.width = 223 - 24;
  gcd[0].gd.pos.height = 180;
  gcd[0].gd.flags = gg_visible | gg_enabled;
  gcd[0].creator = GFileChooserCreate;
  varray[0] = &gcd[0];
  varray[1] = NULL;

  gcd[1].gd.pos.x = 12;
  gcd[1].gd.pos.y = 192 - 3;
  gcd[1].gd.pos.width = -1;
  gcd[1].gd.flags = gg_visible | gg_enabled | gg_but_default;
  label[1].text = (uint32_t *) _("_OK");
  label[1].text_is_1byte = true;
  label[1].text_has_mnemonic = true;
  gcd[1].gd.label = &label[1];
  gcd[1].gd.handle_controlevent = GFD_Ok;
  gcd[1].creator = GButtonCreate;
  harray[0] = GCD_Glue;
  harray[1] = &gcd[1];

  gcd[2].gd.pos.x =
    (totwid - bs) * 100 / GIntGetResource (_NUM_ScaleFactor) / 2;
  gcd[2].gd.pos.y = gcd[1].gd.pos.y + 3;
  gcd[2].gd.pos.width = -1;
  gcd[2].gd.flags = gg_visible | gg_enabled;
  label[2].text = (uint32_t *) _("_Filter");
  label[2].text_is_1byte = true;
  label[2].text_has_mnemonic = true;
  gcd[2].gd.label = &label[2];
  gcd[2].gd.handle_controlevent = GFileChooserFilterEh;
  gcd[2].creator = GButtonCreate;
  harray[2] = GCD_Glue;
  harray[3] = &gcd[2];

  gcd[3].gd.pos.x = -gcd[1].gd.pos.x;
  gcd[3].gd.pos.y = gcd[2].gd.pos.y;
  gcd[3].gd.pos.width = -1;
  gcd[3].gd.flags = gg_visible | gg_enabled | gg_but_cancel;
  label[3].text = (uint32_t *) _("_Cancel");
  label[3].text_is_1byte = true;
  label[3].text_has_mnemonic = true;
  gcd[3].gd.label = &label[3];
  gcd[3].gd.handle_controlevent = GFD_Cancel;
  gcd[3].creator = GButtonCreate;
  harray[4] = GCD_Glue;
  harray[5] = &gcd[3];
  harray[6] = GCD_Glue;
  harray[7] = NULL;

  boxes[2].gd.flags = gg_visible | gg_enabled;
  boxes[2].gd.u.boxelements = harray;
  boxes[2].creator = GHBoxCreate;
  varray[2] = &boxes[2];
  varray[3] = NULL;
  varray[4] = NULL;

  boxes[0].gd.pos.x = boxes[0].gd.pos.y = 2;
  boxes[0].gd.flags = gg_visible | gg_enabled;
  boxes[0].gd.u.boxelements = varray;
  boxes[0].creator = GHVGroupCreate;

  gcd[4].gd.pos.x = 2;
  gcd[4].gd.pos.y = 2;
  gcd[4].gd.pos.width = pos.width - 4;
  gcd[4].gd.pos.height = pos.height - 4;
  gcd[4].gd.flags = gg_enabled | gg_visible | gg_pos_in_pixels;
  gcd[4].creator = GGroupCreate;

  GGadgetsCreate (gw, boxes);
  GGadgetSetUserData (gcd[2].ret, gcd[0].ret);
  GHVBoxSetExpandableRow (boxes[0].ret, 0);
  GHVBoxSetExpandableCol (boxes[2].ret, gb_expandgluesame);
  GHVBoxFitWindow (boxes[0].ret);

  GFileChooserConnectButtons (gcd[0].ret, gcd[1].ret, gcd[2].ret);
  GFileChooserSetFilterText (gcd[0].ret, initial_filter);
  GFileChooserSetFilterFunc (gcd[0].ret, filter);
  GFileChooserSetMimetypes (gcd[0].ret, mimetypes);
  GFileChooserSetPaths (gcd[0].ret, path);
  GGadgetSetTitle (gcd[0].ret, defaultfile);

  memset (&d, '\0', sizeof (d));
  d.gfc = gcd[0].ret;

  GDrawSetVisible (gw, true);
  while (!d.done)
    GDrawProcessOneEvent (NULL);
  GDrawDestroyWindow (gw);
  GDrawProcessPendingEvents (NULL);     /* Give the window a chance to vanish... */
  GDrawSync (NULL);
  GDrawProcessPendingEvents (NULL);     /* Give the window a chance to vanish... */
  GProgressResumeTimer ();
  return (d.ret);
}
Esempio n. 12
0
void TransformDlgCreate(void *data,void (*transfunc)(void *,real *,int,BVTFunc *,enum fvtrans_flags),
	int (*getorigin)(void *,BasePoint *,int), enum transdlg_flags flags,
	enum cvtools cvt) {
    GRect pos;
    GWindow gw;
    GWindowAttrs wattrs;
    GGadgetCreateData gcd[12+TCnt*25], boxes[4], *subarray[TCnt*27], *array[2*(TCnt+8)+4], *buttons[13], *origarray[4];
    GTextInfo label[9+TCnt*24];
    static TransData td;
    int i, y, gci, subai, ai;
    int32 len;
    GGadget *orig;
    BasePoint junk;
    GTextInfo **ti;
    static int done = false;

    if ( !done ) {
	int i;
	for ( i=0; transformtypes[i].text!=NULL; ++i )
	    transformtypes[i].text = (unichar_t *) _((char *) transformtypes[i].text);
	for ( i=0; origin[i].text!=NULL; ++i )
	    origin[i].text = (unichar_t *) _((char *) origin[i].text);
	done = true;
    }

    td.userdata = data;
    td.transfunc = transfunc;
    td.getorigin = getorigin;
    td.done = false;

    if ( td.gw==NULL ) {
	memset(&wattrs,0,sizeof(wattrs));
	wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict;
	wattrs.event_masks = ~(1<<et_charup);
	wattrs.restrict_input_to_me = 1;
	wattrs.undercursor = 1;
	wattrs.cursor = ct_pointer;
	wattrs.utf8_window_title = _("Transform");
	wattrs.is_dlg = true;
	pos.x = pos.y = 0;
	pos.width = GGadgetScale(GDrawPointsToPixels(NULL,TBlock_Width));
	pos.height = GDrawPointsToPixels(NULL,TBlock_Top+TCnt*TBlock_Height+110);
	td.gw = gw = GDrawCreateTopWindow(NULL,&pos,trans_e_h,&td,&wattrs);

	memset(&label,0,sizeof(label));
	memset(&gcd,0,sizeof(gcd));
	memset(&boxes,0,sizeof(boxes));

	label[0].text = (unichar_t *) _("Origin:");
	label[0].text_is_1byte = true;
	label[0].text_in_resource = true;
	gcd[0].gd.label = &label[0];
	gcd[0].gd.pos.x = 5; gcd[0].gd.pos.y = 4;
	gcd[0].gd.flags = (getorigin==NULL) ? gg_visible : (gg_visible | gg_enabled);
	gcd[0].creator = GLabelCreate;

	gcd[1].gd.pos.x = 5; gcd[1].gd.pos.y = 4;
	gcd[1].gd.flags = (getorigin==NULL) ? gg_visible : (gg_visible | gg_enabled);
	gcd[1].gd.label = &origin[1];
	gcd[1].gd.u.list = origin;
	gcd[1].gd.cid = CID_Origin;
	gcd[1].creator = GListButtonCreate;
	origin[1].selected = true;

	origarray[0] = &gcd[0]; origarray[1] = &gcd[1]; origarray[2] = GCD_Glue; origarray[3] = NULL;

	boxes[3].gd.flags = gg_enabled|gg_visible;
	boxes[3].gd.u.boxelements = origarray;
	boxes[3].creator = GHBoxCreate;

	array[0] = &boxes[3]; array[1] = NULL;

	gci = 2; subai = 0; ai = 2;
	for ( i=0; i<TCnt; ++i ) {
	    array[ai++] = MakeTransBlock(&td,i,gcd+gci,label+gci,subarray+subai);
	    array[ai++] = NULL;
	    gci += 23; subai += 27;
	}

	y = TBlock_Top+TCnt*TBlock_Height+4;

	    gcd[gci].gd.pos.x = 10; gcd[gci].gd.pos.y = y;
	    gcd[gci].gd.flags = (flags&tdf_enableback) ? (gg_visible | gg_enabled) : gg_visible;
	    label[gci].text = (unichar_t *) _("Transform _All Layers");
	    label[gci].text_is_1byte = true;
	    label[gci].text_in_resource = true;
	    gcd[gci].gd.label = &label[gci];
	    gcd[gci].gd.cid = CID_AllLayers;
	    gcd[gci++].creator = GCheckBoxCreate;
	    array[ai++] = &gcd[gci-1]; array[ai++] = NULL;
	    y += 16;

	    gcd[gci].gd.pos.x = 10; gcd[gci].gd.pos.y = y;
	    gcd[gci].gd.flags = (flags&tdf_enableback) ? (gg_visible | gg_enabled) : gg_visible;
	    label[gci].text = (unichar_t *) _("Transform _Guide Layer Too");
	    label[gci].text_is_1byte = true;
	    label[gci].text_in_resource = true;
	    gcd[gci].gd.label = &label[gci];
	    gcd[gci].gd.cid = CID_DoGrid;
	    gcd[gci++].creator = GCheckBoxCreate;
	    array[ai++] = &gcd[gci-1]; array[ai++] = NULL;
	    y += 16;

	    gcd[gci].gd.pos.x = 10; gcd[gci].gd.pos.y = y;
	    gcd[gci].gd.flags = (flags&tdf_enableback) ? (gg_visible | gg_enabled | gg_cb_on) : gg_visible;
	    label[gci].text = (unichar_t *) _("Transform _Width Too");
	    label[gci].text_is_1byte = true;
	    label[gci].text_in_resource = true;
	    gcd[gci].gd.label = &label[gci];
	    gcd[gci].gd.cid = CID_DoWidth;
	    gcd[gci++].creator = GCheckBoxCreate;
	    array[ai++] = &gcd[gci-1]; array[ai++] = NULL;
	    y += 16;

	    gcd[gci].gd.pos.x = 10; gcd[gci].gd.pos.y = y;
	    gcd[gci].gd.flags = gg_visible | (flags&tdf_enablekerns ? gg_enabled : 0) |
		    (flags&tdf_defaultkerns ? gg_cb_on : 0);
	    label[gci].text = (unichar_t *) _("Transform kerning _classes too");
	    label[gci].text_is_1byte = true;
	    label[gci].text_in_resource = true;
	    gcd[gci].gd.label = &label[gci];
	    gcd[gci].gd.cid = CID_DoKerns;
	    gcd[gci++].creator = GCheckBoxCreate;
	    array[ai++] = &gcd[gci-1]; array[ai++] = NULL;
	    y += 16;

	    gcd[gci].gd.pos.x = 10; gcd[gci].gd.pos.y = y;
	    gcd[gci].gd.flags = gg_visible |
		    (flags&tdf_enableback ? gg_enabled : 0) |
		    (flags&tdf_enablekerns ? gg_cb_on : 0);
	    label[gci].text = (unichar_t *) _("Transform simple positioning features & _kern pairs");
	    label[gci].text_is_1byte = true;
	    label[gci].text_in_resource = true;
	    gcd[gci].gd.label = &label[gci];
	    gcd[gci].gd.cid = CID_DoSimplePos;
	    gcd[gci++].creator = GCheckBoxCreate;
	    array[ai++] = &gcd[gci-1]; array[ai++] = NULL;
	    y += 16;

	    gcd[gci].gd.pos.x = 10; gcd[gci].gd.pos.y = y;
	    gcd[gci].gd.flags = gg_visible | gg_enabled;
	    label[gci].text = (unichar_t *) _("Round To _Int");
	    label[gci].text_is_1byte = true;
	    label[gci].text_in_resource = true;
	    gcd[gci].gd.label = &label[gci];
	    gcd[gci].gd.cid = CID_Round2Int;
	    gcd[gci++].creator = GCheckBoxCreate;
	    array[ai++] = &gcd[gci-1]; array[ai++] = NULL;
	    y += 24;

	array[ai++] = GCD_Glue; array[ai++] = NULL;

	gcd[gci].gd.pos.x = 30-3; gcd[gci].gd.pos.y = y;
	gcd[gci].gd.flags = gg_visible | gg_enabled | gg_but_default;
	label[gci].text = (unichar_t *) _("_OK");
	label[gci].text_is_1byte = true;
	label[gci].text_in_resource = true;
	gcd[gci].gd.mnemonic = 'O';
	gcd[gci].gd.label = &label[gci];
	gcd[gci].gd.handle_controlevent = Trans_OK;
	gcd[gci++].creator = GButtonCreate;
	buttons[0] = GCD_Glue; buttons[1] = &gcd[gci-1]; buttons[2] = GCD_Glue; buttons[3] = GCD_Glue;

	gcd[gci].gd.flags = gg_visible | gg_enabled;
	label[gci].text = (unichar_t *) _("_Apply");
	label[gci].text_is_1byte = true;
	label[gci].text_in_resource = true;
	gcd[gci].gd.label = &label[gci];
	gcd[gci].gd.handle_controlevent = Trans_OK;
	gcd[gci].gd.cid = CID_Apply;
	gcd[gci++].creator = GButtonCreate;
	buttons[4] = GCD_Glue; buttons[5] = &gcd[gci-1]; buttons[6] = GCD_Glue; buttons[7] = GCD_Glue;

	gcd[gci].gd.pos.x = -30; gcd[gci].gd.pos.y = gcd[gci-1].gd.pos.y+3;
	gcd[gci].gd.flags = gg_visible | gg_enabled | gg_but_cancel;
	label[gci].text = (unichar_t *) _("_Cancel");
	label[gci].text_is_1byte = true;
	label[gci].text_in_resource = true;
	gcd[gci].gd.label = &label[gci];
	gcd[gci].gd.mnemonic = 'C';
	gcd[gci].gd.handle_controlevent = Trans_Cancel;
	gcd[gci++].creator = GButtonCreate;
	buttons[8] = GCD_Glue; buttons[9] = &gcd[gci-1]; buttons[10] = GCD_Glue;
	buttons[11] = NULL;

	boxes[2].gd.flags = gg_enabled|gg_visible;
	boxes[2].gd.u.boxelements = buttons;
	boxes[2].creator = GHBoxCreate;

	array[ai++] = &boxes[2]; array[ai++] = NULL; array[ai++] = NULL;

	boxes[0].gd.pos.x = boxes[0].gd.pos.y = 2;
	boxes[0].gd.flags = gg_enabled|gg_visible;
	boxes[0].gd.u.boxelements = array;
	boxes[0].creator = GHVGroupCreate;

	GGadgetsCreate(gw,boxes);
	GHVBoxSetExpandableRow(boxes[0].ret,gb_expandglue);
	GHVBoxSetExpandableCol(boxes[2].ret,gb_expandgluesame);
	GHVBoxSetExpandableCol(boxes[3].ret,gb_expandglue);
	for ( i=0; i<TCnt; ++i ) {
	    GHVBoxSetPadding( GWidgetGetControl(gw,CID_ClockBox+i*TBlock_CIDOffset),0,0);
	    GHVBoxSetPadding( GWidgetGetControl(gw,CID_HVBox+i*TBlock_CIDOffset),0,0);
	    GHVBoxSetExpandableCol( GWidgetGetControl(gw,CID_HBox+i*TBlock_CIDOffset),gb_expandglue);
	}
	GGadgetSelectOneListItem( GWidgetGetControl(gw,CID_Type), 1);
	GWidgetToDesiredSize(gw);
    } else
	GDrawSetTransientFor(td.gw,(GWindow) -1);
    gw = td.gw;

    GGadgetSetEnabled( GWidgetGetControl(gw,CID_AllLayers), flags&tdf_enableback);
    GGadgetSetEnabled( GWidgetGetControl(gw,CID_DoGrid), flags&tdf_enableback);
    GGadgetSetEnabled( GWidgetGetControl(gw,CID_DoSimplePos), flags&tdf_enableback);
    GGadgetSetEnabled( GWidgetGetControl(gw,CID_DoKerns), flags&tdf_enablekerns);
    GGadgetSetVisible( GWidgetGetControl(gw,CID_Apply), flags&tdf_addapply);
    if ( !(flags&tdf_enableback) ) {
	GGadgetSetChecked( GWidgetGetControl(gw,CID_AllLayers), false );
	GGadgetSetChecked( GWidgetGetControl(gw,CID_DoGrid), false );
    }
    GGadgetSetChecked( GWidgetGetControl(gw,CID_DoKerns),
	    !(flags&tdf_enablekerns)?false:(flags&tdf_defaultkerns)?true:false );
    /* Yes, this is set differently from the previous, that's intended */
    GGadgetSetChecked( GWidgetGetControl(gw,CID_DoSimplePos),
	    !(flags&tdf_enableback)?false:(flags&tdf_enablekerns)?true:false );
    orig = GWidgetGetControl(gw,CID_Origin);
    GGadgetSetEnabled( orig, getorigin!=NULL );
    ti = GGadgetGetList(orig,&len);
    for ( i=0; i<len; ++i ) {
	ti[i]->disabled = !getorigin(data,&junk,i);
	if ( ti[i]->disabled && ti[i]->selected ) {
	    ti[i]->selected = false;
	    ti[0]->selected = true;
	    GGadgetSetTitle(orig,ti[0]->text);
	}
    }

    if ( cvt!=cvt_none ) {
	int index = cvt == cvt_scale  ? 4 :
		    cvt == cvt_flip   ? 5 :
		    cvt == cvt_rotate ? 2 :
		    cvt == cvt_skew   ? 6 :
			   /* 3d rot*/  7 ;
	GGadget *firstoption = GWidgetGetControl(td.gw,CID_Type);
	GEvent dummy;
	GGadgetSelectOneListItem( firstoption, index );
	memset(&dummy,0,sizeof(dummy));
	dummy.type = et_controlevent; dummy.u.control.subtype = et_listselected;
	Trans_TypeChange( firstoption, &dummy );
    }

    for ( i=0; i<TCnt; ++i ) {
	int index = GGadgetGetFirstListSelectedItem(GWidgetGetControl(td.gw,CID_Type+i*TBlock_CIDOffset));
	if ( selcid[index]!=0 ) {
	    GGadget *tf = GWidgetGetControl(td.gw,selcid[index]+i*TBlock_CIDOffset);
	    GWidgetIndicateFocusGadget(tf);
	    GTextFieldSelect(tf,0,-1);
    break;
	}
    }

    GWidgetHidePalettes();
    GDrawSetVisible(gw,true);
    while ( !td.done )
	GDrawProcessOneEvent(NULL);
    GDrawSetVisible(gw,false);
}
Esempio n. 13
0
static void FVCreateWidth( void *_fv,SplineChar* _sc,void (*doit)(CreateWidthData *),
			   enum widthtype wtype, char *def) {
    GRect pos;
    GWindowAttrs wattrs;
    GGadgetCreateData gcd[11], boxes[2], topbox[2], *hvs[17], *varray[8], *buttons[6];
    GTextInfo label[11];
    static CreateWidthDlg cwd;
    static GWindow winds[5];
    static char *title[] = { N_("Set Width..."), N_("Set LBearing..."), N_("Set RBearing..."), N_("Set Both Side Bearings..."), N_("Set Vertical Advance...") };

    cwd.wd.done = false;
    cwd.wd._fv = _fv;
    cwd.wd._sc = _sc;
    cwd.wd.wtype = wtype;
    cwd.wd.doit = doit;
    cwd.gw = winds[wtype];

    if ( cwd.gw==NULL ) {
	memset(&wattrs,0,sizeof(wattrs));
	wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict;
	wattrs.event_masks = ~(1<<et_charup);
	wattrs.restrict_input_to_me = 1;
	wattrs.undercursor = 1;
	wattrs.cursor = ct_pointer;
	wattrs.utf8_window_title = _(title[wtype]);
	wattrs.is_dlg = true;
	pos.x = pos.y = 0;
	pos.width = GGadgetScale(GDrawPointsToPixels(NULL,180));
	pos.height = GDrawPointsToPixels(NULL,100);
	cwd.gw = winds[wtype] = GDrawCreateTopWindow(NULL,&pos,cwd_e_h,&cwd,&wattrs);

	memset(&label,0,sizeof(label));
	memset(&gcd,0,sizeof(gcd));

	label[0].text = (unichar_t *) _(rb1[wtype]);
	label[0].text_is_1byte = true;
	gcd[0].gd.label = &label[0];
	gcd[0].gd.flags = gg_enabled|gg_visible|gg_cb_on;
	gcd[0].gd.cid = CID_Set;
	gcd[0].gd.handle_controlevent = CW_RadioChange;
	gcd[0].data = (void *) CID_SetVal;
	gcd[0].creator = GRadioCreate;

	label[1].text = (unichar_t *) _(rb2[wtype]);
	label[1].text_is_1byte = true;
	gcd[1].gd.label = &label[1];
	gcd[1].gd.flags = gg_enabled|gg_visible|gg_rad_continueold ;
	gcd[1].gd.cid = CID_Incr;
	gcd[1].gd.handle_controlevent = CW_RadioChange;
	gcd[1].data = (void *) CID_IncrVal;
	gcd[1].creator = GRadioCreate;

	label[2].text = (unichar_t *) _(rb3[wtype]);
	label[2].text_is_1byte = true;
	gcd[2].gd.label = &label[2];
	gcd[2].gd.flags = gg_enabled|gg_visible|gg_rad_continueold ;
	gcd[2].gd.cid = CID_Scale;
	gcd[2].gd.handle_controlevent = CW_RadioChange;
	gcd[2].data = (void *) CID_ScaleVal;
	gcd[2].creator = GRadioCreate;

	label[3].text = (unichar_t *) def;
	label[3].text_is_1byte = true;
	gcd[3].gd.label = &label[3];
	gcd[3].gd.pos.width = 60;
	gcd[3].gd.flags = gg_enabled|gg_visible;
	gcd[3].gd.cid = CID_SetVal;
	gcd[3].gd.handle_controlevent = CW_FocusChange;
	gcd[3].data = (void *) CID_Set;
	gcd[3].creator = GTextFieldCreate;

	label[4].text = (unichar_t *) "0";
	label[4].text_is_1byte = true;
	gcd[4].gd.label = &label[4];
	gcd[4].gd.pos.width = 60;
	gcd[4].gd.flags = gg_enabled|gg_visible;
	gcd[4].gd.cid = CID_IncrVal;
	gcd[4].gd.handle_controlevent = CW_FocusChange;
	gcd[4].data = (void *) CID_Incr;
	gcd[4].creator = GTextFieldCreate;

	label[5].text = (unichar_t *) "100";
	label[5].text_is_1byte = true;
	gcd[5].gd.label = &label[5];
	gcd[5].gd.pos.width = 60;
	gcd[5].gd.flags = gg_enabled|gg_visible;
	gcd[5].gd.cid = CID_ScaleVal;
	gcd[5].gd.handle_controlevent = CW_FocusChange;
	gcd[5].data = (void *) CID_Scale;
	gcd[5].creator = GTextFieldCreate;

	gcd[6].gd.flags = gg_visible | gg_enabled | gg_but_default;
	label[6].text = (unichar_t *) _("_OK");
	label[6].text_is_1byte = true;
	label[6].text_in_resource = true;
	gcd[6].gd.mnemonic = 'O';
	gcd[6].gd.label = &label[6];
	gcd[6].gd.handle_controlevent = CW_OK;
	gcd[6].creator = GButtonCreate;

	gcd[7].gd.flags = gg_visible | gg_enabled | gg_but_cancel;
	label[7].text = (unichar_t *) _("_Cancel");
	label[7].text_is_1byte = true;
	label[7].text_in_resource = true;
	gcd[7].gd.label = &label[7];
	gcd[7].gd.mnemonic = 'C';
	gcd[7].gd.handle_controlevent = CW_Cancel;
	gcd[7].creator = GButtonCreate;

	label[8].text = (unichar_t *) S_(info[wtype]);
	label[8].text_is_1byte = true;
	gcd[8].gd.label = &label[8];
	gcd[8].gd.pos.x = 5; gcd[8].gd.pos.y = 59; 
	gcd[8].gd.flags = gg_enabled|gg_visible ;
	gcd[8].creator = GLabelCreate;

	label[9].text = (unichar_t *) "%";
	label[9].text_is_1byte = true;
	gcd[9].gd.label = &label[9];
	gcd[9].gd.flags = gg_enabled|gg_visible;
	gcd[9].creator = GLabelCreate;

	hvs[0] = &gcd[0]; hvs[1] = &gcd[3]; hvs[2] = GCD_Glue; hvs[3] = NULL;
	hvs[4] = &gcd[1]; hvs[5] = &gcd[4]; hvs[6] = GCD_Glue; hvs[7] = NULL;
	hvs[8] = &gcd[2]; hvs[9] = &gcd[5]; hvs[10] = &gcd[9]; hvs[11] = NULL;
	hvs[12] = &gcd[8]; hvs[13] = GCD_ColSpan; hvs[14] = GCD_Glue; hvs[15] = NULL;
	hvs[16] = NULL;

	buttons[0] = buttons[2] = buttons[4] = GCD_Glue; buttons[5] = NULL;
	buttons[1] = &gcd[6]; buttons[3] = &gcd[7];

	varray[0] = &boxes[1]; varray[1] = NULL;
	varray[2] = GCD_Glue; varray[3] = NULL;
	varray[4] = &boxes[0]; varray[5] = NULL;
	varray[6] = NULL;

	memset(boxes,0,sizeof(boxes));
	boxes[0].gd.flags = gg_enabled|gg_visible;
	boxes[0].gd.u.boxelements = buttons;
	boxes[0].creator = GHBoxCreate;

	boxes[1].gd.flags = gg_enabled|gg_visible;
	boxes[1].gd.u.boxelements = hvs;
	boxes[1].creator = GHVBoxCreate;

	memset(topbox,0,sizeof(topbox));
	topbox[0].gd.pos.x = topbox[0].gd.pos.y = 2;
	topbox[0].gd.pos.width = pos.width-4; topbox[0].gd.pos.height = pos.height-4;
	topbox[0].gd.flags = gg_enabled|gg_visible;
	topbox[0].gd.u.boxelements = varray;
	topbox[0].creator = GHVGroupCreate;

	GGadgetsCreate(cwd.gw,topbox);
	GHVBoxSetExpandableRow(topbox[0].ret,1);
	GHVBoxSetExpandableCol(boxes[0].ret,gb_expandgluesame);
	GHVBoxSetExpandableCol(boxes[1].ret,1);
	GWidgetIndicateFocusGadget(GWidgetGetControl(cwd.gw,CID_SetVal));
	GTextFieldSelect(GWidgetGetControl(cwd.gw,CID_SetVal),0,-1);
	GHVBoxFitWindow(topbox[0].ret);
    } else {
	unichar_t *temp = uc_copy(def);
	GGadgetSetTitle(GWidgetGetControl(cwd.gw,CID_SetVal),temp);
    }

    GWidgetHidePalettes();
    GDrawSetVisible(cwd.gw,true);
    while ( !cwd.wd.done )
	GDrawProcessOneEvent(NULL);
    GDrawSetVisible(cwd.gw,false);
}
Esempio n. 14
0
void CVCreateHint(CharView *cv,int ishstem,int preservehints) {
    GRect pos;
    GWindow gw;
    GWindowAttrs wattrs;
    GGadgetCreateData gcd[9], *harray1[4], *harray2[9], *barray[7], *varray[5][2], boxes[5];
    GTextInfo label[9];
    static CreateHintData chd;
    char buffer[20]; unichar_t ubuf[20];

    chd.done = false;
    chd.ishstem = ishstem;
    chd.preservehints = preservehints;
    chd.cv = cv;

    if ( chd.gw==NULL ) {
	memset(&wattrs,0,sizeof(wattrs));
	wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict;
	wattrs.event_masks = ~(1<<et_charup);
	wattrs.restrict_input_to_me = 1;
	wattrs.undercursor = 1;
	wattrs.cursor = ct_pointer;
	wattrs.utf8_window_title = _("Create Hint");
	wattrs.is_dlg = true;
	pos.x = pos.y = 0;
	pos.width = GGadgetScale(GDrawPointsToPixels(NULL,170));
	pos.height = GDrawPointsToPixels(NULL,90);
	chd.gw = gw = GDrawCreateTopWindow(NULL,&pos,chd_e_h,&chd,&wattrs);

	memset(&label,0,sizeof(label));
	memset(&gcd,0,sizeof(gcd));
	memset(&boxes,0,sizeof(boxes));

	label[0].text = (unichar_t *) _("_Base:");
	label[0].text_is_1byte = true;
	label[0].text_in_resource = true;
	gcd[0].gd.label = &label[0];
	gcd[0].gd.pos.x = 5; gcd[0].gd.pos.y = 17+5+6; 
	gcd[0].gd.flags = gg_enabled|gg_visible;
	gcd[0].creator = GLabelCreate;
	harray2[0] = GCD_Glue; harray2[1] = &gcd[0];

	sprintf( buffer, "%g", (double) (ishstem ? cv->p.cy : cv->p.cx) );
	label[1].text = (unichar_t *) buffer;
	label[1].text_is_1byte = true;
	gcd[1].gd.label = &label[1];
	gcd[1].gd.pos.x = 37; gcd[1].gd.pos.y = 17+5;  gcd[1].gd.pos.width = 40;
	gcd[1].gd.flags = gg_enabled|gg_visible;
	gcd[1].gd.cid = CID_Base;
	gcd[1].creator = GTextFieldCreate;
	harray2[2] = &gcd[1];

	label[2].text = (unichar_t *) _("_Size:");
	label[2].text_is_1byte = true;
	label[2].text_in_resource = true;
	gcd[2].gd.label = &label[2];
	gcd[2].gd.pos.x = 90; gcd[2].gd.pos.y = 17+5+6; 
	gcd[2].gd.flags = gg_enabled|gg_visible;
	gcd[2].creator = GLabelCreate;
	harray2[3] = GCD_Glue; harray2[4] = &gcd[2];

	label[3].text = (unichar_t *) "60";
	label[3].text_is_1byte = true;
	gcd[3].gd.label = &label[3];
	gcd[3].gd.pos.x = 120; gcd[3].gd.pos.y = 17+5;  gcd[3].gd.pos.width = 40;
	gcd[3].gd.flags = gg_enabled|gg_visible;
	gcd[3].gd.cid = CID_Width;
	gcd[3].creator = GTextFieldCreate;
	harray2[5] = &gcd[3]; harray2[6] = GCD_Glue; harray2[7] = NULL;

	gcd[4].gd.pos.x = 20-3; gcd[4].gd.pos.y = 17+37;
	gcd[4].gd.pos.width = -1; gcd[4].gd.pos.height = 0;
	gcd[4].gd.flags = gg_visible | gg_enabled | gg_but_default;
	label[4].text = (unichar_t *) _("_OK");
	label[4].text_is_1byte = true;
	label[4].text_in_resource = true;
	gcd[4].gd.mnemonic = 'O';
	gcd[4].gd.label = &label[4];
	gcd[4].gd.handle_controlevent = CH_OK;
	gcd[4].creator = GButtonCreate;
	barray[0] = GCD_Glue; barray[1] = &gcd[4]; barray[2] = GCD_Glue;

	gcd[5].gd.pos.x = -20; gcd[5].gd.pos.y = 17+37+3;
	gcd[5].gd.pos.width = -1; gcd[5].gd.pos.height = 0;
	gcd[5].gd.flags = gg_visible | gg_enabled | gg_but_cancel;
	label[5].text = (unichar_t *) _("_Cancel");
	label[5].text_is_1byte = true;
	label[5].text_in_resource = true;
	gcd[5].gd.label = &label[5];
	gcd[5].gd.mnemonic = 'C';
	gcd[5].gd.handle_controlevent = CH_Cancel;
	gcd[5].creator = GButtonCreate;
	barray[3] = GCD_Glue; barray[4] = &gcd[5]; barray[5] = GCD_Glue; barray[6] = NULL;

	label[6].text = (unichar_t *) _("Create Horizontal Stem Hint");	/* Initialize to bigger size */
	label[6].text_is_1byte = true;
	gcd[6].gd.label = &label[6];
	gcd[6].gd.pos.x = 17; gcd[6].gd.pos.y = 5; 
	gcd[6].gd.flags = gg_enabled|gg_visible;
	gcd[6].gd.cid = CID_Label;
	gcd[6].creator = GLabelCreate;
	harray1[0] = GCD_Glue; harray1[1] = &gcd[6]; harray1[2] = GCD_Glue; harray1[3] = NULL;

	gcd[7].gd.pos.x = 5; gcd[7].gd.pos.y = 17+31;
	gcd[7].gd.pos.width = 170-10;
	gcd[7].gd.flags = gg_enabled|gg_visible;
	gcd[7].creator = GLineCreate;

	boxes[2].gd.flags = gg_enabled|gg_visible;
	boxes[2].gd.u.boxelements = harray1;
	boxes[2].creator = GHBoxCreate;

	boxes[3].gd.flags = gg_enabled|gg_visible;
	boxes[3].gd.u.boxelements = harray2;
	boxes[3].creator = GHBoxCreate;

	boxes[4].gd.flags = gg_enabled|gg_visible;
	boxes[4].gd.u.boxelements = barray;
	boxes[4].creator = GHBoxCreate;

	varray[0][0] = &boxes[2]; varray[0][1] = NULL;
	varray[1][0] = &boxes[3]; varray[1][1] = NULL;
	varray[2][0] = &gcd[7];   varray[2][1] = NULL;
	varray[3][0] = &boxes[4]; varray[3][1] = NULL;
	varray[4][0] = NULL;

	boxes[0].gd.pos.x = boxes[0].gd.pos.y = 2;
	boxes[0].gd.flags = gg_enabled|gg_visible;
	boxes[0].gd.u.boxelements = varray[0];
	boxes[0].creator = GHVGroupCreate;
	

	GGadgetsCreate(gw,boxes);
	GHVBoxSetExpandableCol(boxes[2].ret,gb_expandglue);
	GHVBoxSetExpandableCol(boxes[3].ret,gb_expandglue);
	GHVBoxSetExpandableCol(boxes[4].ret,gb_expandgluesame);
	GHVBoxFitWindow(boxes[0].ret);
    } else {
	gw = chd.gw;
	sprintf( buffer, "%g", (double) (ishstem ? cv->p.cy : cv->p.cx) );
	uc_strcpy(ubuf,buffer);
	GGadgetSetTitle(GWidgetGetControl(gw,CID_Base),ubuf);
	GDrawSetTransientFor(gw,(GWindow) -1);
    }
    GGadgetSetTitle8(GWidgetGetControl(gw,CID_Label),
	    ishstem ? _("Create Horizontal Stem Hint") :
		    _("Create Vertical Stem Hint"));
    GWidgetIndicateFocusGadget(GWidgetGetControl(gw,CID_Base));
    GTextFieldSelect(GWidgetGetControl(gw,CID_Base),0,-1);

    GWidgetHidePalettes();
    GDrawSetVisible(gw,true);
    while ( !chd.done )
	GDrawProcessOneEvent(NULL);
    GDrawSetVisible(gw,false);
}