/*ChangeTexture Plugin - DMS2 - Aug 99 - by Sébastien DENEUX*/ typeof plugin=S;; typeof class=S;; typeof ed = PluginEditor;; typeof texturesList = ObjList;; typeof loop = ObjCheck;; typeof keepDynamicChanges = ObjCheck;; typeof iniPos = ObjText;; typeof maxtexturefileSize = ObjText;; typeof wSize = ObjText;; typeof hSize = ObjText;; typeof decoupage = ObjText;; typeof nbblock = ObjText;; typeof transitionTime = ObjText;; typeof notransition = ObjCheck;; typeof alpha = ObjCheck;; typeof random = ObjCheck;; typeof colimasson = ObjCheck;; typeof zigzag = ObjCheck;; typeof zigzag2 = ObjCheck;; typeof zigzag3 = ObjCheck;; typeof zigzag4 = ObjCheck;; typeof zigzag5 = ObjCheck;; typeof zigzag6 = ObjCheck;; typeof zigzag7 = ObjCheck;; fun InstName(UI)=UI.nameInst;; fun InstParam(UI)=UI.paramInst;; proto save=fun [ [Inst r1] ] [[S r1] [S r1] [[S r1]r1] [[S r1]r1]];; /*********************************************************************************/ /* fonction pour mettre les textures dans la liste box */ /* color -> S : Couleur a ajouter */ /* param -> */ /*********************************************************************************/ fun cbAddTexture(box, param, file) = _ADDlist texturesList 0 _PtoScol file ;; /***************************************************************************** Affichage de la fenetre de choix de texture *****************************************************************************/ fun cbshowOpenFile(button, ed)= _DLGrflopen _DLGOpenFile _channel ed.PluginEditorEditWin nil nil "bitmap (*.bmp,*.jpg)\0*.BMP;*.JPG;*.JPEG\0\0" @cbAddTexture nil ;; /*******************************************************************************/ /* suppression d'une textire dans la liste */ /* button -> Button : boutton de suppression */ /* param -> */ /*******************************************************************************/ fun cbdeleteTexture(button, param)= let _GETlist texturesList -> [pos _] in if pos == nil then nil else _DELlist texturesList pos ;; /******************************************************************************/ /* deplacement d'une texture dans la liste */ /* button -> Button : boutton d'appel */ /* move -> S : sens de déplacement */ /******************************************************************************/ fun cbTextureMove(button, move)= let _GETlist texturesList -> [pos texture] in if pos == nil then nil else ( _DELlist texturesList pos; if !strcmp move "up" then ( if pos!=0 then ( _ADDlist texturesList (pos-1) texture; _SELlist texturesList (pos-1) ) else ( _ADDlist texturesList (pos) texture; _SELlist texturesList (pos) ) ) else ( _ADDlist texturesList (pos+1) texture; _SELlist texturesList (pos+1) ) ) ;; /*********************************************************************************/ /* fonction pour mettre les textures dans la liste box */ /* color -> S : Couleur a ajouter */ /* param -> */ /*********************************************************************************/ fun allTexture(texture, param) = _ADDlist texturesList 0 texture ;; /*********************************************************************************/ /* recuperatione de la liste des textures */ /* l -> */ /*********************************************************************************/ fun getTexturesList(l)= if l == nil then nil else let l -> [[param [value _]] nl] in if !strcmp param "texturesList" then let lineextr value -> lcolor in ( apply_on_list lcolor @allTexture nil; 0 ) else ( getTexturesList nl; 0 ) ;; /***************************************************************************** Verificaiton sur les valeus de w h et nb obtexte -> Objtext : texte à verifier param -> I : verification à effecturer *****************************************************************************/ fun cbverification (obtexte, param, texte)= _SETtext nbblock (itoa (atoi (_GETtext nbblock)) - (mod (atoi (_GETtext nbblock)) 2)); _SETtext transitionTime (itoa (atoi (_GETtext transitionTime)) - (mod (atoi (_GETtext transitionTime)) (ftoi (pow (atof (_GETtext nbblock)) (itof 2))))); _SETtext wSize (itoa (atoi (_GETtext wSize)) - (mod (atoi (_GETtext wSize)) (atoi (_GETtext nbblock)))); _SETtext hSize (itoa (atoi (_GETtext hSize)) - (mod (atoi (_GETtext hSize)) (atoi (_GETtext nbblock)))) ;; /*****************************************************************************/ /* creation de la fenetre d'edition du plug in */ /* win -> Objwin : fenètre mère de la fenetre d'edition */ /* param -> */ /*****************************************************************************/ fun openedit(win,param)= let strextr param -> l in let _GETwindowSizePosition win -> [w h x y] in ( set ed = startPluginEditor _channel win 0 0 w h WN_CHILDINSIDE|WN_NOBORDER class; /*creation de la liste des textures*/ _CRtext _channel ed.PluginEditorEditWin 5 5 80 20 ET_ALIGN_RIGHT "texture list :"; set texturesList = _CRlist _channel ed.PluginEditorEditWin 85 5 w-90 100 LB_DOWN; getTexturesList(l); _CBbutton _CRbutton _channel ed.PluginEditorEditWin 10 25 60 20 nil "..." @cbshowOpenFile ed; _CBbutton _CRbutton _channel ed.PluginEditorEditWin 10 45 60 20 nil "Delete" @cbdeleteTexture nil; _CBbutton _CRbutton _channel ed.PluginEditorEditWin 10 65 60 20 nil "Up" @cbTextureMove "up"; _CBbutton _CRbutton _channel ed.PluginEditorEditWin 10 85 60 20 nil "Down" @cbTextureMove "down"; /*parametre de position et de taille*/ set loop = _SETcheck _CRcheck _channel ed.PluginEditorEditWin 10 120 100 20 0 "loop" if !strcmpi getInfo l "loop" "1" then 1 else 0; set keepDynamicChanges = _SETcheck _CRcheck _channel ed.PluginEditorEditWin 10 150 140 20 0 "keep Dynamic Changes" if !strcmpi getInfo l "keepDynamicChanges" "1" then 1 else 0; _CRtext _channel ed.PluginEditorEditWin 150 120 110 20 ET_ALIGN_RIGHT "init position :"; set iniPos = _CReditLine _channel ed.PluginEditorEditWin 270 120 60 20 ET_ALIGN_LEFT|ET_DOWN let getInfo l "iniPos" -> string in if (nil == string) then "0" else string; _CRtext _channel ed.PluginEditorEditWin 150 150 110 20 ET_ALIGN_RIGHT "max texture file Size :"; set maxtexturefileSize = _CReditLine _channel ed.PluginEditorEditWin 270 150 60 20 ET_ALIGN_LEFT|ET_DOWN let getInfo l "maxtexturefileSize" -> string in if (nil == string) then "20480" else string; _CRtext _channel ed.PluginEditorEditWin 330 120 100 20 ET_ALIGN_RIGHT "wSize :"; _CBlineOk set wSize = _CReditLine _channel ed.PluginEditorEditWin 440 120 40 20 ET_ALIGN_LEFT|ET_DOWN let getInfo l "wSize" -> string in if (nil == string) then "64" else string @cbverification nil; _CRtext _channel ed.PluginEditorEditWin 330 150 100 20 ET_ALIGN_RIGHT "hSize :"; _CBlineOk set hSize = _CReditLine _channel ed.PluginEditorEditWin 440 150 40 20 ET_ALIGN_LEFT|ET_DOWN let getInfo l "hSize" -> string in if (nil == string) then "64" else string @cbverification nil; _CRtext _channel ed.PluginEditorEditWin 10 180 100 20 ET_ALIGN_RIGHT "decoupage :"; set decoupage = _CReditLine _channel ed.PluginEditorEditWin 110 180 40 20 ET_ALIGN_LEFT|ET_DOWN let getInfo l "decoupage" -> string in if (nil == string) then "1" else string; _CRtext _channel ed.PluginEditorEditWin 150 180 100 20 ET_ALIGN_RIGHT "NB block :"; _CBlineOk set nbblock = _CReditLine _channel ed.PluginEditorEditWin 270 180 60 20 ET_ALIGN_LEFT|ET_DOWN let getInfo l "NbBlock" -> string in if (nil == string) then "8" else string @cbverification 1; _CRtext _channel ed.PluginEditorEditWin 330 180 100 20 ET_ALIGN_RIGHT "transition time :"; _CBlineOk set transitionTime = _CReditLine _channel ed.PluginEditorEditWin 440 180 40 20 ET_ALIGN_LEFT|ET_DOWN let getInfo l "transitionTime" -> string in if (nil == string) then "2000" else string @cbverification 2; /*parametre de transition*/ _CRtext _channel ed.PluginEditorEditWin 100 220 200 20 ET_ALIGN_RIGHT "Choose a transition mode :"; let getInfo l "transitionType" -> transitionType in ( set notransition = _SETcheck _CRcheck _channel ed.PluginEditorEditWin 10 250 100 20 CH_RADIO "none" if (!strcmpi transitionType "none") || transitionType == nil then 1 else 0; set alpha = _SETcheck _CRcheck _channel ed.PluginEditorEditWin 110 250 100 20 CH_RADIO "alpha" if !strcmpi transitionType "alpha" then 1 else 0; set random = _SETcheck _CRcheck _channel ed.PluginEditorEditWin 210 250 100 20 CH_RADIO "random" if !strcmpi transitionType "random" then 1 else 0; set zigzag = _SETcheck _CRcheck _channel ed.PluginEditorEditWin 310 250 100 20 CH_RADIO "zigzag" if !strcmpi transitionType "zigzag" then 1 else 0; set colimasson = _SETcheck _CRcheck _channel ed.PluginEditorEditWin 410 250 100 20 CH_RADIO "colimasson" if !strcmpi transitionType "colimasson" then 1 else 0; set zigzag2 = _SETcheck _CRcheck _channel ed.PluginEditorEditWin 10 270 80 20 CH_RADIO "zizag2" if !strcmpi transitionType "zizag2" then 1 else 0; set zigzag3 = _SETcheck _CRcheck _channel ed.PluginEditorEditWin 90 270 80 20 CH_RADIO "zigzag3" if !strcmpi transitionType "zigzag3" then 1 else 0; set zigzag4 = _SETcheck _CRcheck _channel ed.PluginEditorEditWin 170 270 80 20 CH_RADIO "zigzag4" if !strcmpi transitionType "zigzag4" then 1 else 0; set zigzag5 = _SETcheck _CRcheck _channel ed.PluginEditorEditWin 250 270 80 20 CH_RADIO "zigzag5" if !strcmpi transitionType "zigzag5" then 1 else 0; set zigzag6 = _SETcheck _CRcheck _channel ed.PluginEditorEditWin 330 270 80 20 CH_RADIO "zigzag6" if !strcmpi transitionType "zigzag6" then 1 else 0; set zigzag7 = _SETcheck _CRcheck _channel ed.PluginEditorEditWin 410 270 80 20 CH_RADIO "zigzag7" if !strcmpi transitionType "zigzag7" then 1 else 0 ); 0 ) ;; /********************************************************************************/ /* fonction permettant de retourner le contenu de la listbox sous form de liste */ /* i -> I : value de la position */ /* list -> [S r1] : liste de retour il arrive a nil */ /********************************************************************************/ fun returnValueList(i, list)= if i < _GETlistCount texturesList then ( _SELlist texturesList i; let _GETlist texturesList -> [_ element] in returnValueList (i+1) (element::list) ) else list ;; /********************************************************************************* return the choose transition **********************************************************************************/ fun getTransition()= if _GETcheck alpha then "alpha" else if _GETcheck random then "random" else if _GETcheck zigzag then "zigzag" else if _GETcheck colimasson then "colimasson" else if _GETcheck zigzag2 then "zigzag2" else if _GETcheck zigzag3 then "zigzag3" else if _GETcheck zigzag4 then "zigzag4" else if _GETcheck zigzag5 then "zigzag5" else if _GETcheck zigzag6 then "zigzag6" else if _GETcheck zigzag7 then "zigzag7" else "none" ;; /********************************************************************/ /* enregistrement des parametres lors de la fermeture de l'editeur */ /********************************************************************/ fun closeedit()= strbuild ("texturesList"::(linebuild (returnValueList 0 nil))::nil):: ("loop"::(itoa _GETcheck loop)::nil):: ("keepDynamicChanges"::(itoa _GETcheck keepDynamicChanges)::nil):: ("iniPos"::(_GETtext iniPos)::nil):: ("maxtexturefileSize"::(_GETtext maxtexturefileSize)::nil):: ("wSize"::(_GETtext wSize)::nil):: ("hSize"::(_GETtext hSize)::nil):: ("transitionType"::(getTransition)::nil):: ("decoupage"::(_GETtext decoupage)::nil):: ("NbBlock"::(_GETtext nbblock)::nil):: ("transitionTime"::(_GETtext transitionTime)::nil):: nil ;; /***************************************/ /* action suplémentaire ajouté au C3D3 */ /***************************************/ fun suppactions(l)= if l == nil then nil else let l -> [UI nl] in let (InstName UI) -> name in ("action"::(strcatn name::".setRandomALL"::nil)::nil):: ("action"::(strcatn name::".nextTextureALL"::nil)::nil):: ("action"::(strcatn name::".previousTextureALL"::nil)::nil):: ("action"::(strcatn name::".setTexturePosInTexturesListALL"::nil)::nil):: ("action"::(strcatn name::".showChgTextureInterface"::nil)::nil):: ("event"::(strcatn name::".endListALL"::nil)::nil):: ("event"::(strcatn name::".beginListALL"::nil)::nil):: ("actionC"::(strcatn name::".setRandom"::nil)::nil):: ("actionC"::(strcatn name::".nextTexture"::nil)::nil):: ("actionC"::(strcatn name::".previousTexture"::nil)::nil):: ("actionC"::(strcatn name::".setTexturePosInTexturesList"::nil)::nil):: ("eventC"::(strcatn name::".endList"::nil)::nil):: ("eventC"::(strcatn name::".beginList"::nil)::nil):: (suppactions nl);; /*----------------*/ fun save(l)= if l==nil then [nil nil nil nil] else [ nil /* registerF */ nil /* register */ ("plugin"::plugin::nil)::nil /* supplemental Dat */ suppactions 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 @save nil @openedit @closeedit;;