/* rename window - sept 97 - by Sylvain Huet renaming interface */ /* add localisation (must define "loc" function) - may 2001 - by macfly */ /* renaming structure */ struct Rename= [chRename:Chn,winRename:ObjWin,txtRename:ObjText,endRename:fun[S] I] mkRename;; typeof Font=ObjFont;; fun _paintE(x,b)= _TXTout b.winRename Font 60 5 TD_TOP+TD_RIGHT 0 strcat loc "OLD_VALUE" " :"; _TXTout b.winRename Font 60 30 TD_TOP+TD_RIGHT 0 strcat loc "NEW_VALUE" " :";; fun _ok(x,b)= let _GETtext b.txtRename -> s in (_DSwindow b.winRename; exec b.endRename with [s]) ;; fun lineok(a,b,c)=_ok nil b;; fun _cancel(x,b)= _DSwindow b.winRename; exec b.endRename with [nil] ;; fun _destroyE(x,b)= exec b.endRename with [nil];; fun iniRename(ch,father,x,y,title,end,old)= set Font= if Font!=nil then Font else _CRfont ch 14 0 0 "arial"; let _CRwindow ch father x y 300 80 WN_MENU+WN_MINBOX title -> win in let _CRtext ch win 60 5 235 20 ET_BORDER old -> oldtext in let _CReditLine ch win 60 30 235 20 ET_DOWN+ET_AHSCROLL old -> text in let _CRbutton ch win 5 55 70 20 0 loc "OK"-> ok in let _CRbutton ch win 80 55 70 20 0 loc "CANCEL"-> cancel in let mkRename [ch win text end]-> b in (_CBwinDestroy win @_destroyE b; _CBwinPaint win @_paintE b; _CBlineOk text @lineok b; _AFFfontButton _CBbutton ok @_ok b Font; _AFFfontButton _CBbutton cancel @_cancel b Font; _AFFfontText oldtext Font; _AFFfontText text Font; _SETtextFocus text; _paintE nil b; b) ;; fun mydest(i)=_fooS i;_closemachine;; fun main()= iniRename _channel nil 150 200 loc "RENAME_EDITOR" @mydest "abc" ;;