/******************************************************************************* Plugin Image Editor part Version: 1.0 Authors: Jeremy GIAIME & Laurent PLUMAT Last update: 09/05/2001 Image Plugin *******************************************************************************/ typeof plugin =S;; typeof class =S;; typeof LBrate =ObjText;; typeof ELrate =ObjText;; typeof LBtype =ObjText;; typeof CKUrl =ObjCheck;; typeof CKFile =ObjCheck;; typeof CKContents =ObjCheck;; typeof CKNone =ObjCheck;; typeof LBcontent =ObjText;; typeof ELcontent =ObjText;; proto cbSave=fun [ [Inst r1] ] [[S r1] [S r1] [[S r1]r1] [[S r1]r1]];; /*************************************************************** callback for close editor ****************************************************************/ fun closeedit()= let _GETtext ELcontent -> URL in ( if _GETcheck CKUrl then if strfind "http://" URL 0 == nil then set URL = strcat "http://" _GETtext ELcontent else nil else nil; let if _GETcheck CKUrl then "url" else if _GETcheck CKFile then "file" else if _GETcheck CKContents then "contents" else "none" -> type in let _GETtext ELrate -> rate in strbuild ("type"::type::nil):: ("value"::URL::nil):: ("rate"::rate::nil):: nil ) ;; /*************************************************************** call back when checking url ****************************************************************/ fun cbUrl( check, param, value) = _ENtext ELrate 1; _ENtext ELcontent 1 ;; /*************************************************************** call back when checking file ****************************************************************/ fun cbFile( check, param, value) = _ENtext ELrate 1; _ENtext ELcontent 1 ;; /*************************************************************** call back when checking contents ****************************************************************/ fun cbContents( check, param, value) = _ENtext ELrate 0; _ENtext ELcontent 1 ;; /*************************************************************** call back when checking none ****************************************************************/ fun cbNone( check, param, value) = _ENtext ELrate 0; _ENtext ELcontent 0 ;; /*************************************************************** callback for the editor opening win -> Objwin : editor window param - S : parameters ****************************************************************/ fun openedit(win,param)= let strextr param -> l in ( set LBtype = _CRtext _channel win 20 25 130 16 ET_ALIGN_LEFT "type :"; set CKUrl = _CBcheck _CRcheck _channel win 200 25 50 18 CH_RADIO "Url" @cbUrl nil; set CKFile = _CBcheck _CRcheck _channel win 250 25 50 18 CH_RADIO "File" @cbFile nil; set CKContents = _CBcheck _CRcheck _channel win 300 25 100 18 CH_RADIO "Contents" @cbContents nil; set CKNone = _CBcheck _CRcheck _channel win 150 25 50 18 CH_RADIO "None" @cbNone nil; set LBcontent = _CRtext _channel win 102 45 48 16 ET_ALIGN_LEFT "Content : "; set ELcontent = _CReditLine _channel win 150 45 300 18 ET_DOWN | ET_AHSCROLL let getInfo l "value" -> content in if (nil == content) then "" else content; set LBrate = _CRtext _channel win 20 75 180 16 ET_ALIGN_LEFT "Get bitmap from server every (ms) : "; set ELrate = _CReditLine _channel win 150 95 50 18 ET_DOWN | ET_AHSCROLL let getInfo l "rate" -> rate in if (nil == rate) then "500" else rate; let getInfo l "type" -> type in if (nil == type) || (!strcmpi "none" type) then (cbNone nil nil nil;_SETcheck CKNone 1) else if !strcmpi "file" type then _SETcheck CKFile 1 else if !strcmpi "contents" type then (cbContents nil nil nil; _SETcheck CKContents 1) else _SETcheck CKUrl 1; 0) ;; fun typesuppdmi(l)= if l==nil then nil /* supplemental Dmi */ else let l->[a n] in ("action"::(strcat a.nameInst ".showImageALL")::nil):: ("actionC"::(strcat a.nameInst ".showImage")::nil):: ("eventC"::(strcat a.nameInst ".imageShowed")::nil):: ("actionC"::(strcat class ".showImage")::nil)::("eventC"::(strcat class ".imageShowed")::nil)::("eventC"::(strcat class ".click")::nil):: typesuppdmi n ;; /******************************************************************************* save modifications <- [[S r1] r1] : the dmi contents *******************************************************************************/ fun cbSave(l)= if l==nil then [nil nil nil nil] else [ nil /* registerF */ nil /* register */ ("plugin"::plugin::nil)::nil /* supplemental Dat */ typesuppdmi l /* supplemental Dmi */ ] ;; /******************************************************************************* Plugin initialisation, the PlugRegister function has to be called at the end file -> S : '*.plug' file name <- I : not used *******************************************************************************/ fun IniPlug(file)= set plugin=file; set class=getInfo strextr _getpack _checkpack file "name"; PlugRegister class @cbSave nil @openedit @closeedit ;;