/* Hide & Show - DMS - July 98 - by Patrick MARTY */ /* Hide & Show - DMS2 - Jun 99 - by Christophe LOREK */ /* rev. September 99 - by Sebastien DENEUX */ typeof class = S;; /*-------------*/ fun hide(HSObj,blurp)= let HSObj -> [H3d_Obj _ _] in M3unLink session H3d_Obj; mutate HSObj <- [_ _ 0]; 0;; /*-------------*/ fun show(HSObj,blurp)= let HSObj -> [H3d_Obj H3d_father _] in M3link session H3d_Obj H3d_father; mutate HSObj <- [_ _ 1]; 0;; /*-------------*/ fun hideOrShow(HSObj,blurp)= let HSObj -> [H3d_Obj H3d_father flag] in if flag then ( M3unLink session H3d_Obj; mutate HSObj <- [_ _ 0]; 0 ) else ( M3link session H3d_Obj H3d_father; mutate HSObj <- [_ _ 1]; 0 );; /*-------------*/ fun activate(o,from,action,param,reply,l)= if !strcmp action (strcat (ObName o) ".Hide") then (apply_on_list l @hide 0; 0) else if !strcmp action (strcat (ObName o) ".Show") then (apply_on_list l @show 0; 0) else if !strcmp action (strcat (ObName o) ".HideOrShow") then (apply_on_list l @hideOrShow 0; 0) else nil;; /*-------------*/ fun cbcomm(ui,action,param,l)= if !strcmp action "Hide" then (apply_on_list l @hide 0; 0) else if !strcmp action "Show" then (apply_on_list l @show 0; 0) else nil;; /*-------------*/ fun HSObjList(l)= if l==nil then nil else let l->[a nl] in ( match a with (objAnchor [H3d_Obj _ _ _] -> [[H3d_Obj (M3getFather session H3d_Obj) 1] (HSObjList nl)]) |( _ -> (HSObjList nl)) );; /*-------------*/ fun newOb(o)= let (HSObjList ObAnchor o) -> l in ( UcbComm this ObUi o mkfun4 @cbcomm l; UsendSrv this ObUi o "state?" nil; /*ask for current hide-Show state*/ ObRegisterAction o (strcatn (ObName o)::".Hide"::nil) mkfun6 @activate l; ObRegisterAction o (strcatn (ObName o)::".Show"::nil) mkfun6 @activate l; ObRegisterAction o (strcatn (ObName o)::".HideOrShow"::nil) mkfun6 @activate l; 0 );; /*-------------*/ fun IniPlug(file)= set class=getInfo strextr _getpack _checkpack file "name"; PlugRegister class @newOb nil; 0;;