static int CW_FocusChange(GGadget *g, GEvent *e) { if ( e->type==et_controlevent && e->u.control.subtype == et_textfocuschanged ) { CreateWidthDlg *wd = GDrawGetUserData(GGadgetGetWindow(g)); int cid = (intpt) GGadgetGetUserData(g); GGadgetSetChecked(GWidgetGetControl(wd->gw,cid),true); } return( true ); }
static int CW_RadioChange(GGadget *g, GEvent *e) { if ( e->type==et_controlevent && e->u.control.subtype == et_radiochanged ) { CreateWidthDlg *wd = GDrawGetUserData(GGadgetGetWindow(g)); int cid = (intpt) GGadgetGetUserData(g); GWidgetIndicateFocusGadget(GWidgetGetControl(wd->gw,cid)); GTextFieldSelect(GWidgetGetControl(wd->gw,cid),0,-1); } return( true ); }
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 ); }