/* edit instance window (instance editing interface) - Mar 99 - by Sylvain HUET */ /* Oct 99 - by Christophe LOREK */ /* instance editing structure */ struct IEd= [ chIEd : Chn, winIEd : ObjWin, okIEd : ObjButton, nameIEd : ObjText, classIEd : ObjBox, anchorIEd : ObjBox, paramIEd : ObjText, editIEd : ObjWin, endIEd : fun[[S S S S]] I, classesIEd : [Plug r1] ] mkIEd;; fun addcombo (n, combo) = _ADDcombo combo 1000 n;; fun iniChoice (b, choice) = apply_on_list choice @addcombo b.anchorIEd;; fun addcomboPlug (p, combo) = _ADDcombo combo 1000 PLUG_Print p;; fun iniClasses (b, classes) = apply_on_list classes @addcomboPlug b.classIEd;; fun selname(l,b,i)= if l==nil then nil else let l->[a n] in if !strcmp a b then i else selname n b i+1;; fun selnamec(l,b,i)= if l==nil then nil else let l->[[a _ _ _ _] n] in if !strcmp a b then i else selnamec n b i+1;; fun RunPlugEdit (b, p, param) = let _GETwindowPositionSize b.editIEd -> [x y w h] in ( _DSwindow b.editIEd; set b.editIEd = _CRwindow b.chIEd b.winIEd 5 85 500 285 WN_CHILDINSIDE|WN_NOCAPTION|WN_NOBORDER ""; ); _ENbutton b.okIEd if p.cbproPlug == nil then 1 else (exec p.cbproPlug with []); if PLUG_HaveEditor p then ( _SHOWtext b.paramIEd WINDOW_HIDDEN; if p.cbopeneditParamPlug != nil then exec p.cbopeneditParamPlug with [b.editIEd param PLUG_GetParam p] else exec p.cbopeneditPlug with [b.editIEd param]; param ) else ( _SHOWwindow b.editIEd WINDOW_HIDDEN; _SHOWtext b.paramIEd WINDOW_UNHIDDEN; _SETtext b.paramIEd param; param ) ;; fun putold (b, z, choice) = let z -> [name class anchor param] in let posf_in_list b.classesIEd @plugbyclass class -> pos in ( _SETtext b.nameIEd name; _SELcombo b.classIEd pos; _SELcombo b.anchorIEd selname choice anchor 0; RunPlugEdit b (nth_list b.classesIEd pos) param ) ;; fun _resizeT(a,t,x,y)=_SIZEtext t x-2 y-2 1 1;; fun _help(x,b)= let _GETcombo b.classIEd->[i _] in let nth_list b.classesIEd i-> p in let PLUG_GetHelp p -> h in /* aide html si extension htm ou html */ let file_extension h -> ext in if (!strcmpi ext "htm") || (!strcmpi ext "html") then ( _helphtml substr h 0 (strlen h)-(strlen ext) ext; nil ) else let _CRwindow _channel b.winIEd 150 150 500 300 WN_MENU+WN_MINBOX+WN_SIZEBOX strcatn (PLUG_GetName p)::"- "::(loc "PLUGIN_HELP")::nil -> win in _CBwinSize win @_resizeT (_CRtext _channel win 1 1 498 298 ET_VSCROLL+ET_HSCROLL _getpack _checkpack h) ;; fun _ok (x, b)= let _GETtext b.nameIEd -> name in let _GETcombo b.classIEd -> [i _] in let nth_list b.classesIEd i -> p in let _GETcombo b.anchorIEd -> [_ anchor] in let if PLUG_HaveEditor p then if p.cbcloseeditParamPlug != nil then exec p.cbcloseeditParamPlug with [PLUG_GetParam p] else exec p.cbcloseeditPlug with [] else _GETtext b.paramIEd -> param in ( _DSwindow b.winIEd; exec b.endIEd with if (IsEmptyString name) || (p == nil) then nil else [[name (PLUG_GetName p) anchor param]] ) ;; fun _cancel(x,b)= _DSwindow b.winIEd; exec b.endIEd with [nil] ;; fun _destroyE(x,b)= exec b.endIEd with [nil];; fun _selclass(a, z, pos, classname)= let z -> [b [_ class _ param]] in let nth_list b.classesIEd pos -> p in RunPlugEdit b p param ;; fun iniIEd (ch, father, x, y, title, end, choice, classes, old)= let _CRwindow ch father x y 510 400 WN_MENU+WN_MINBOX title -> win in ( _CRtext ch win 5 5 160 20 ET_BORDER strcat loc "NAME" " :"; _CRtext ch win 175 5 160 20 ET_BORDER strcat loc "CLASS" " :"; _CRtext ch win 345 5 160 20 ET_BORDER strcat loc "ANCHOR" " :"; _CRtext ch win 5 60 500 20 ET_BORDER strcat loc "PARAMETERS" " :"; let _CReditLine ch win 5 30 160 20 ET_DOWN+ET_AHSCROLL "" -> namet in let _CRcombo ch win 175 30 160 256 CB_NOEDIT "" -> classl in let _CRcombo ch win 345 30 160 256 CB_NOEDIT "" -> anchorl in let _CReditText ch win 5 85 500 285 ET_DOWN+ET_HSCROLL+ET_VSCROLL+ET_HIDDEN ""-> paramtext in let _CRwindow ch win 5 85 500 285 WN_CHILDINSIDE|WN_NOBORDER ""-> paramwin in let _CRbutton ch win 5 375 70 20 0 loc "OK"-> ok in let _CRbutton ch win 80 375 100 20 0 loc "CANCEL"-> cancel in let _CRbutton ch win 405 375 100 20 0 loc "PLUGIN_HELP"-> help in let mkIEd [ch win ok namet classl anchorl paramtext paramwin end classes]-> b in ( _CBwinDestroy win @_destroyE b; _CBbutton ok @_ok b; _CBbutton cancel @_cancel b; _CBbutton help @_help b; iniChoice b choice; iniClasses b classes; _CBcombo classl @_selclass [b old]; putold b old choice; b ) ) ;; /* plugin editing structure */ struct PEd= [ chPEd : Chn, winPEd : ObjWin, lplugPEd : ObjList, endPEd : fun[S] I, classesPEd : [Plug r1] ] mkPEd;; fun addplug(p,l) = _ADDlist l 1000 PLUG_Print p;; fun iniPlugs (b, classes) = apply_on_list classes @addplug b.lplugPEd;; fun _resizeTP (a, t, x, y) = _SIZEtext t x-2 y-2 1 1;; fun _helpP (x, b) = let _GETlist b.lplugPEd -> [i _] in let nth_list b.classesPEd i -> p in let PLUG_GetHelp p -> h in /* aide html si extension htm ou html */ let file_extension h -> ext in if (!strcmpi ext "htm") || (!strcmpi ext "html") then ( _helphtml substr h 0 (strlen h)-(strlen ext) ext; nil ) else let _CRwindow _channel b.winPEd 150 150 500 300 WN_MENU+WN_MINBOX+WN_SIZEBOX strcatn (PLUG_GetName p)::"- "::(loc "PLUGIN_HELP")::nil -> win in _CBwinSize win @_resizeTP (_CRtext _channel win 1 1 498 298 ET_VSCROLL+ET_HSCROLL _getpack _checkpack h) ;; fun _okP(x,b)= let _GETlist b.lplugPEd ->[i _] in let nth_list b.classesPEd i -> plug1 in ( _DSwindow b.winPEd; exec b.endPEd with [if (exec plug1.cbproPlug with []) then PLUG_GetName plug1 else nil] ) ;; fun _cancelP(x,b)= _DSwindow b.winPEd; exec b.endPEd with [nil] ;; fun _destroyEP(x,b)= exec b.endPEd with [nil];; fun iniPEd (ch, father, x, y, title, end, classes)= let _CRwindow ch father x y 350 190 WN_MENU+WN_MINBOX title -> win in ( _CRtext ch win 5 5 340 20 ET_BORDER loc "PLUGIN_SUPP"; let _CRlist ch win 5 30 340 130 LB_VSCROLL+LB_DOWN -> lplug in let _CRbutton ch win 5 165 70 20 0 loc "OK"-> ok in let _CRbutton ch win 80 165 70 20 0 loc "CANCEL"-> cancel in let _CRbutton ch win 180 165 120 20 0 loc "PLUGIN_HELP"-> help in let mkPEd [ch win lplug end classes]-> b in ( _CBwinDestroy win @_destroyEP b; _CBbutton ok @_okP b; _CBbutton cancel @_cancelP b; _CBbutton help @_helpP b; iniPlugs b classes; b ) ) ;;