/* Banner window Editor - DMS - mar 98 - by Sylvain HUET */ /* Rev 0101 - Aug. '98 - by Marc Barilley */ /* Rev. - October 99 - by Sébastien DENEUX */ struct BannerW=[ chBW : Chn, winBW : ObjWin, btBW : ObjText, btcBW : ObjText, bbcBW : ObjText, bspeed : ObjText, bsize : ObjText, bbold : ObjText, bunderline : ObjText, bitalic : ObjText, bstate : ObjText, beventparam : ObjText, txtsBW : [[ObjText I ObjWin I ObjWin ObjText ObjText ObjCheck ObjCheck ObjCheck ObjCheck ObjText] r1], endBW : fun[S] I ]mkBW;; fun _paint(a)= let a->[_ i w j ww _ _ _ _ _ _ _] in (_PAINTrectangle w 0 0 200 200 DRAW_SOLID 1 i DRAW_SOLID i; _PAINTrectangle ww 0 0 200 200 DRAW_SOLID 1 j DRAW_SOLID j);; fun _paintC(x,z)=let z->[b i] in _paint nth_list b.txtsBW i;0;; fun setbw(b,l,q,i)= if l==nil then 0 else let l->[a n] in let a->[txt _ win _ ww bspeed bsize bbold bunderline bitalic bstate beventparam] in let hd q -> [cS[cfS[txtS[bspeedS[bsizeS[bboldS[bunderlineS[bitalicS[bstateS[beventparamS _]]]]]]]]]] in ( if !strcmp txtS "@nil@" then nil else _SETtext txt txtS; if bspeedS==nil then _SETtext bspeed "10" else _SETtext bspeed bspeedS;/*tests for backward compatibility*/ if bsizeS==nil then _SETtext bsize "14" else _SETtext bsize bsizeS; if bstateS==nil && txtS!=nil then _SETcheck bstate 1 else _SETcheck bstate atoi bstateS; _SETcheck bbold atoi bboldS; _SETcheck bunderline atoi bunderlineS; _SETcheck bitalic atoi bitalicS; if !strcmp beventparamS "@nil@" then nil else _SETtext beventparam beventparamS; let atoi cS -> c in let atoi cfS -> cf in mutate a<-[_ if c==nil then 0 else c _ if cf==nil then 0 else cf _ _ _ _ _ _ _ _]; _paintC nil [b i]; setbw b n tl q i+1);; fun setBW(b,b0)= setbw b b.txtsBW strextr b0 0;; fun getbw(l)= if l==nil then nil else let l->[[t i _ j _ bspeed bsize bbold bunderline bitalic bstate beventparam] n] in ((itoa i)::(itoa j)::(let _GETtext t -> tmp in if !strcmp tmp "" then "@nil@" else tmp)::(let atoi _GETtext bspeed -> tmp in if tmp>=1 && tmp<=200 then itoa tmp else "10")::(let _GETtext bsize -> tmp in if !strcmp tmp "" then "14" else tmp)::(itoa _GETcheck bbold)::(itoa _GETcheck bunderline)::(itoa _GETcheck bitalic)::(itoa _GETcheck bstate)::(let _GETtext beventparam -> tmp in if !strcmp tmp "" then "@nil@" else tmp)::nil)::getbw n;; fun getBW(b)= strbuild getbw b.txtsBW;; fun endc(c,z)= let z->[b i] in (if c==nil then nil else mutate nth_list b.txtsBW i <-[_ c _ _ _ _ _ _ _ _ _ _]; _paintC nil z);; fun _clickC(a,z,x,y,c)= let z->[b i] in let nth_list b.txtsBW i ->[_ c0 _ _ _ _ _ _ _ _ _ _] in /* loc( _CRcolorMap b.chBW b.winBW 50 50 "Color" mknode @endc z c0;; ) */ _CRcolorMap b.chBW b.winBW 50 50 (_loc this "660-BANNER-color" nil) mknode @endc z c0;; fun endc2(c,z)= let z->[b i] in (if c==nil then nil else mutate nth_list b.txtsBW i <-[_ _ _ c _ _ _ _ _ _ _ _]; _paintC nil z);; fun _clickC2(a,z,x,y,c)= let z->[b i] in let nth_list b.txtsBW i ->[_ _ _ c0 _ _ _ _ _ _ _ _] in /* loc( _CRcolorMap b.chBW b.winBW 50 50 "Color" mknode @endc2 z c0;; ) */ _CRcolorMap b.chBW b.winBW 50 50 (_loc this "660-BANNER-color" nil) mknode @endc2 z c0;; fun oneban(i,b)= [_CReditLine b.chBW b.winBW 5 30+i*20 240 20 ET_DOWN+ET_AHSCROLL "" 0 let _CRwindow b.chBW b.winBW 250 30+i*20 30 20 WN_CHILDINSIDE|WN_NOCAPTION|WN_DOWN "" -> w in (_CBwinPaint w @_paintC [b i]; _CBwinClick w @_clickC [b i]; w) 0 let _CRwindow b.chBW b.winBW 280 30+i*20 30 20 WN_CHILDINSIDE|WN_NOCAPTION|WN_DOWN "" -> w in (_CBwinPaint w @_paintC [b i]; _CBwinClick w @_clickC2 [b i]; w) _CReditLine b.chBW b.winBW 325 30+i*20 30 20 ET_DOWN+ET_AHSCROLL+ET_NUMBER "" _CReditLine b.chBW b.winBW 365 30+i*20 30 20 ET_DOWN+ET_AHSCROLL+ET_NUMBER "" _CRcheck b.chBW b.winBW 410 30+i*20 30 20 0 "" _CRcheck b.chBW b.winBW 450 30+i*20 30 20 0 "" _CRcheck b.chBW b.winBW 490 30+i*20 30 20 0 "" _CRcheck b.chBW b.winBW 530 30+i*20 30 20 0 "" _CReditText b.chBW b.winBW 570 30+i*20 200 20 ET_DOWN+ET_AHSCROLL+ET_AVSCROLL "" ];; fun _destroyE(a,b)= exec b.endBW with [nil];; fun _ok(a,b)= let getBW b -> s in (_DSwindow b.winBW; exec b.endBW with [s]);; fun _cancel(a,b)= _DSwindow b.winBW; exec b.endBW with [nil];; /* fun onesize (l, w, h, i)= if l==nil then 0 else let hd l -> [line _ twin _ bwin _ _ _ _ _] in { _SIZEtext line w-180 20 5 30+i*20; _SIZEwindow twin 30 20 w-70 30+i*20; _SIZEwindow bwin 30 20 w-35 30+i*20; onesize tl l w h i+1; };;*/ /* fun rflSizeBW (wn, bw, w, h)= _SIZEtext bw.btBW w-80 20 5 10; _SIZEtext bw.btcBW 30 30 w-70 0; _SIZEtext bw.bbcBW 30 30 w-35 0; onesize bw.txtsBW w h 0; 0;;*/ /*fun sizeBW (bw, w, h, x, y)= _SIZEwindow bw.winBW w h x y;;*/ fun iniBW(ch,father,x,y,w,h,mess,end,b0,flag)= let _CRwindow ch father x y w h if flag then WN_CHILDINSIDE|WN_NOCAPTION|WN_NOBORDER else WN_MENU+WN_MINBOX mess -> win in ( let _CRtext ch win 5 10 240 20 ET_ALIGN_CENTER (_loc this "1430-BANNER-text" nil) -> bt in let _CRtext ch win 245 0 40 30 ET_ALIGN_CENTER (_loc this "1440-BANNER-textcolor" nil) -> btc in let _CRtext ch win 280 0 40 30 ET_ALIGN_CENTER (_loc this "1450-BANNER-backcolor" nil) -> bbc in let _CRtext ch win 315 0 50 30 ET_ALIGN_CENTER (_loc this "1480-BANNER-scroll.spe" nil) -> bspeed in let _CRtext ch win 360 0 40 30 ET_ALIGN_CENTER (_loc this "1500-BANNER-fontsize" nil) -> bsize in let _CRtext ch win 400 0 35 30 ET_ALIGN_CENTER (_loc this "1520-BANNER-fontbold" nil) -> bbold in let _CRtext ch win 430 0 55 30 ET_ALIGN_CENTER (_loc this "1530-BANNER-fontunderl" nil) -> bunderline in let _CRtext ch win 480 0 50 30 ET_ALIGN_CENTER (_loc this "1540-BANNER-fontitalic" nil) -> bitalic in let _CRtext ch win 520 0 50 30 ET_ALIGN_CENTER (_loc this "1560-BANNER-textenable" nil) -> bstate in let _CRtext ch win 630 0 100 30 ET_ALIGN_CENTER (_loc this "1580-BANNER-eventparam" nil) -> beventparam in let mkBW [ch win bt btc bbc bspeed bsize bbold bunderline bitalic bstate beventparam nil end]-> b in (set b.txtsBW=tabtolist create_tab 16 @oneban b; _CBwinDestroy win @_destroyE b; /*_CBwinSize win @rflSizeBW b;*/ if flag then nil else { /* loc( _CBbutton _CRbutton ch win 5 355 60 20 0 "Ok" @_ok b; ) */ _CBbutton _CRbutton ch win 5 355 60 20 0 (_loc this "1700-BANNER-ok" nil) @_ok b; /* loc( _CBbutton _CRbutton ch win 70 355 60 20 0 "Cancel" @_cancel b; ) */ _CBbutton _CRbutton ch win 70 355 60 20 0 (_loc this "1710-BANNER-cancel" nil) @_cancel b; }; setBW b b0; b) ) ;; fun delBW(b)=_DSwindow b.winBW;;