/* menta-client - 1st draft - august 97 - by Sylvain Huet login interface */ /* login structure : login window */ struct MCl= [ chMCl:Chn, winMCl:ObjWin, winbMCl:ObjWin, transMCl:ObjCheck, textMCl:ObjText, bufMCl:ObjBitmap, endMCl : fun[S I] I, bmpMCl : S ] mkMCl;; var PHOTO_CHILD=4;; fun _paintE(x,b)= _BLTbitmap b.winbMCl b.bufMCl 0 0;; fun _OpenFile (d,b,p)= if p==nil then nil else let _PtoScol p -> s in if s==nil then ( _SETtext b.textMCl _loc this "PARTITION_WARNING" nil; 0 ) else if (_fileSize p)>16384 then ( _SETtext b.textMCl _loc this "FILE_WARNING" nil; 0 ) else let _LDbitmap b.chMCl p -> imagebmp in let if imagebmp==nil then _LDjpeg b.chMCl p else imagebmp -> image in if image==nil then ( _SETtext b.textMCl _loc this "OPEN_WARNING" nil; 0 ) else let _GETbitmapSize image -> [w h] in ( set b.bmpMCl=s; _SCPbitmap b.bufMCl 0 0 63 63 image 0 0 w-1 h-1 nil; _DSbitmap image; 0 ); _paintE nil b;; fun _choosebitmap(x,b)= _DLGrflopen (_DLGOpenFile b.chMCl b.winMCl nil nil "bitmap (*.bmp,*.jpg)\0*.BMP;*.JPG;*.JPEG\0\0") @_OpenFile b ;; fun _ok(x,b)= let _GETcheck b.transMCl -> f in exec b.endMCl with [b.bmpMCl f];; fun _cancel(x,b)= exec b.endMCl with [nil nil];; fun _destroyE(x,b)= _DSbitmap b.bufMCl; exec b.endMCl with [nil nil];; fun iniMCl(ch,father,x,y,w,h,mess,end,flag,image,f)= let _CRwindow ch father x y w h if flag&PHOTO_CHILD then WN_CHILDINSIDE|WN_NOCAPTION|WN_NOBORDER else WN_MENU+WN_MINBOX+WN_SIZEBOX mess -> win in let _CRtext ch win 5 5 310 20 ET_BORDER mess -> text in let _CRwindow ch win 32 32 64 64 WN_CHILDINSIDE|WN_NOCAPTION|WN_DOWN "" -> winb in let _CRcheck ch win 128 54 100 20 0 _loc this "TRANSPARENCY_CHECK" nil-> trans in let _CRbutton ch win 5 103 60 20 0 _loc this "CHANGE_BUTTON" nil -> chg in let _CRbutton ch win 146 103 60 20 0 _loc this "OK_BUTTON" nil -> ok in let _CRbutton ch win 221 103 60 20 0 _loc this "CANCEL_BUTTON" nil -> cancel in let _FILLbitmap _CRbitmap ch 64 64 0 -> buf in let mkMCl [ch win winb trans text buf end nil]-> b in ( _CBwinDestroy win @_destroyE b; _CBwinPaint winb @_paintE b; _CBbutton chg @_choosebitmap b; _CBbutton ok @_ok b; _CBbutton cancel @_cancel b; _SETcheck trans f; _SETcheck trans f; set image=if image!=nil then image else "logo.bmp"; _OpenFile nil b _checkpack image; _paintE winb b; b ) ;; fun delMCl(b)= _DSbitmap b.bufMCl; _DSwindow b.winMCl;;