/* Log Window - Aug.97 - by Sylvain Huet */ struct LogWin= [chLogW:Chn,winLogW:ObjWin, nameLogW:ObjText,startLogW:ObjText,connexLogW:ObjText,hitsLogW:ObjText, textLogW:ObjText,editLogW:ObjText, endLogW:fun [LogWin] I,comLogW:fun [LogWin S] I]mkLogW;; fun _destroyE(x,b)= exec b.endLogW with [b];; fun _resizeE(a,b,w,h)= if (h<100) then nil else (_SIZEtext b.textLogW w-10 h-85 5 55; _SIZEtext b.editLogW w-10 20 5 h-25) ;; fun _textE(x,b)= if (_GETlineCount b.editLogW) >= 2 then let _GETline b.editLogW 0 -> ligne in (_DELline b.editLogW 0; exec b.comLogW with [b ligne]) else nil;; fun iniLogW(ch,father,x,y,w,h,title,end,com,flag)= let _CRwindow ch father x y w h (if flag&1 then WN_CHILDINSIDE|WN_NOCAPTION|WN_NOBORDER else WN_MENU+WN_MINBOX+WN_SIZEBOX)|if flag&2 then WN_HIDDEN else 0 title -> win in let _CRtext ch win 80 /*60*/ 5 140 20 ET_DOWN ""-> name in let _CRtext ch win 80 /*60*/ 30 140 20 ET_DOWN ctime time -> start in let _CRtext ch win 295 /*275*/ 5 65 /*45*/ 20 ET_DOWN ""-> connex in let _CRtext ch win 295 /*275*/ 30 65 /*45*/ 20 ET_DOWN ""-> hits in let _CRtext ch win 5 55 w-10 h-85 ET_VSCROLL|ET_AVSCROLL|ET_DOWN ""-> text in let _CReditText ch win 5 h-25 w-10 20 ET_AHSCROLL|ET_AVSCROLL|ET_DOWN ""-> edit in let mkLogW [ch win name start connex hits text edit end com] -> b in (_CBwinDestroy win @_destroyE b; _CBwinSize win @_resizeE b; _CRtext ch win 5 5 70 /*50*/ 20 ET_AHSCROLL|ET_BORDER (_loc this "LOG_WORLD" nil); _CRtext ch win 5 30 70 /*50*/ 20 ET_AHSCROLL|ET_BORDER (_loc this "LOG_START" nil); _CRtext ch win 225 /*205*/ 5 65 20 ET_AHSCROLL|ET_BORDER (_loc this "LOG_CON" nil); _CRtext ch win 225 /*205*/ 30 65 20 ET_AHSCROLL|ET_BORDER (_loc this "LOG_HITS" nil); _CBtext edit @_textE b; b );; fun _echoLogW (b,mess)= let b.textLogW -> text in { _ADDtext text mess ; let ( _GETlineCount text ) -> size in { while ( size > 60 ) do { _DELline text 0 ; set size = size - 1 } ; _SCROLLtext text 0 size }; mess };; fun _setLogW(b,name,connex,hits)= _SETtext b.nameLogW name; _SETtext b.connexLogW itoa connex; _SETtext b.hitsLogW itoa hits;; /* test */ /*fun _destroyevent(a,s)=_fooS s;_closemachine;; fun _comevent(b,s)=_echoLogW b strcat s "\n";0;; fun main()= iniLogW _channel nil 350 250 "LogWindow" @_destroyevent @_comevent;; */