/* colorbox - sept 97 - by Sylvain Huet color selection interface */ /* login structure : colorbox window */ struct ColorB= [chCBox:Chn,winCBox:ObjWin,rCBox:WSN,gCBox:WSN,bCBox:WSN, colCBox:I,endCBox:fun[I] I] mkColorB;; typeof Font=ObjFont;; fun _calccolor(b)= set b.colCBox= let 255& WSNgetValue b.rCBox -> r in let 255& WSNgetValue b.gCBox -> g in let 255& WSNgetValue b.bCBox -> b in (b<<16)+(g<<8)+r;; fun _paintE(x,b)= _calccolor b; _TXTout b.winCBox Font 45 5 TD_TOP+TD_RIGHT 0 "red :"; _TXTout b.winCBox Font 45 30 TD_TOP+TD_RIGHT 0 "green :"; _TXTout b.winCBox Font 45 55 TD_TOP+TD_RIGHT 0 "blue :"; _PAINTrectangle b.winCBox 155 5 90 70 DRAW_INVISIBLE 0 0 DRAW_SOLID b.colCBox;; fun _ok(x,b)= _DSwindow b.winCBox; exec b.endCBox with [b.colCBox] ;; fun _cancel(x,b)= _DSwindow b.winCBox; exec b.endCBox with [nil] ;; fun _destroyE(x,b)= exec b.endCBox with [nil];; fun _change(w,i,b)= _calccolor b ; _PAINTwindow b.winCBox ; i ;; fun iniColorB(ch,father,x,y,title,end,color)= set Font= if Font!=nil then Font else _CRfont ch 14 0 0 "arial"; let if color==nil then [0 0 0] else [(color>>16)&255 (color>>8)&255 color&255] ->[b g r] in let _CRwindow ch father x y 250 105 WN_MENU+WN_MINBOX title -> win in let mkColorB [ ch win nil nil nil b<<16+g<<8+r end]-> bibi in let (mkfun3 @_change bibi)->ret in let (WSNInit ch win 50 5 100 20 10 255 r 0xFFFF 0x007F00 0 ret 0xFFFF Font)->red in let (WSNInit ch win 50 30 100 20 10 255 g 0xFFFF 0x007F00 0 ret 0xFFFF Font)->green in let (WSNInit ch win 50 55 100 20 10 255 b 0xFFFF 0x007F00 0 ret 0xFFFF Font)->blue in let _CRbutton ch win 5 80 80 20 0 "Ok"-> ok in let _CRbutton ch win 90 80 80 20 0 "Cancel"-> cancel in (_CBwinDestroy win @_destroyE bibi; _CBwinPaint win @_paintE bibi; set bibi.rCBox = red ; set bibi.gCBox = green ; set bibi.bCBox = blue ; _AFFfontButton _CBbutton ok @_ok bibi Font; _AFFfontButton _CBbutton cancel @_cancel bibi Font; _paintE nil bibi; bibi) ;; fun mydest(i)=_fooI i;_closemachine;; fun main()= iniColorB _channel nil nil nil "color editor" @mydest 0x2040 ;;