/* ----------------------------------------------------------------------------- This source file is part of OpenSpace3D For the latest info, see http://www.openspace3d.com Copyright (c) 2012 I-maginer This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to http://www.gnu.org/copyleft/lesser.txt ----------------------------------------------------------------------------- */ /************************************************** OpenSpace 3D Editor / plugIT part Version: 0.1a Author: Bastien BOURINEAU / I-maginer Last update: 02.04.2009 **************************************************/ proto removeInstance = fun [EdControl EdModuleBox] I;; proto cbSelectLinkInList = fun [EdControl I S [S r1] I [EdControl EdControl EdControl EdControl EdControl EdControl EdModuleRoundLink V3Dview]] I;; proto addResourceFile = fun [V3Dview XMLmark S fun [S] I] I;; proto getConfigParamDef = fun [S S S] S;; proto importDynamicTpl = fun [] I;; proto fillOs3dDynTemplateMenu = fun [ObjMenu S] I;; proto fillOs3dPlugTemplateMenu = fun [ObjMenu S fun [ObjMenuItem S] I] I;; proto resetTemplateMenus = fun [] I;; var bClonePlugITs = 0;; fun getString2Link(s)= if (s == nil) || (!strcmp s "") then "_" else s;; fun getLink2string(s)= if !strcmp s "_" then nil else s;; fun getGroupByName(name)= let sizelist lGroups -> size in let nil -> group in let 0 -> i in ( while i < size do ( let nth_list lGroups i -> elem in let elem -> [_ groupstr] in if strcmp name groupstr.GRP_sName then nil else set group = groupstr; set i = i + 1; ); group; );; fun cbClosePluginsTab(tabstr, groupstr)= set groupstr.GRP_tabPlugins = nil; set groupstr.GRP_mePlugins = nil; let sizelist groupstr.GRP_lLinks -> size in let 0 -> i in while i < size do ( let nth_list groupstr.GRP_lLinks i -> linkstr in set linkstr.GRPL_strLink = nil; set i = i + 1; ); 0;; fun cbGroupModuleMove(ctrlstr, mboxstr, px, py)= let getGroupByName mboxstr.EDB_sName -> groupstr in ( XMLsetParam groupstr.GRP_xmlMark "px" (itoa px); XMLsetParam groupstr.GRP_xmlMark "py" (itoa py); ); 0;; fun cbGroupInstanceMove(ctrlstr, mboxstr, px, py, groupstr)= let XMLgetMarkByValueFromMarkSons groupstr.GRP_xmlMark "plugins" -> plugsmark in let XMLgetMarkByValueAndParamValueFromMark plugsmark "instance" "name" mboxstr.EDB_sName -> instmark in ( XMLsetParam instmark "px" (itoa px); XMLsetParam instmark "py" (itoa py); ); 0;; fun cbGroupModuleMenu(ctrlstr, mboxstr, infos, previnfos, grp)= let nth_list infos if !grp then 0 else 1 -> elem in let nth_list infos if !grp then 1 else 2 -> grpname in let nth_list infos if !grp then 2 else 3 -> plugname in let nth_list infos if !grp then 3 else 4 -> instname in let nth_list infos if !grp then 4 else 5 -> atc in let nth_list previnfos if !grp then 0 else 1 -> prvelem in let nth_list previnfos if !grp then 1 else 2 -> prvgrpname in let nth_list previnfos if !grp then 2 else 3 -> prvplugname in let nth_list previnfos if !grp then 3 else 4 -> prvinstname in let nth_list previnfos if !grp then 4 else 5 -> prvatc in let getGroupByName grpname -> groupstr in let getEdCtrlModuleEditorLinkMode ctrlstr -> mode in let atoi (getConfigParamDef "OS3Duser" "plugits_user_level" "1") -> userlevel in ( if !mode then nil else ( // add link if !(setModLink (getDMI strcatn prvgrpname::"."::prvinstname::nil) (getDMI strcatn grpname::"."::instname::nil) nil strbuild ((strcatn prvgrpname::"."::prvinstname::"."::prvatc::nil)::(strcatn grpname::"."::instname::"."::atc::nil)::"_"::"_"::"_"::nil)::nil) then ( _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") (loc "OS3D_0125") 0; 0; ) else ( // add link to source group xml let getGroupByName prvgrpname -> srcgroupstr in let XMLgetMarkByValueFromMarkSons srcgroupstr.GRP_xmlMark "plugins" -> plugsmark in let XMLgetMarkByValueAndParamValueFromMark plugsmark "plugin" "name" prvplugname -> pluginmark in let XMLgetMarkByValueAndParamValueFromMark pluginmark "instance" "name" prvinstname -> instmark in let XMLaddMark xmlEditSceneFile "link" instmark ["event" prvatc]::["group" grpname]::["instance" instname]::["action" atc]::nil nil -> linkmark in let srcgroupstr.GRP_mePlugins -> mectrlstr in let mainInterf.MINT_meGroups -> megctrlstr in let mkGroupLink [linkmark nil prvgrpname grpname prvgrpname grpname prvinstname instname] -> glinkstr in let mkGroupLink [linkmark nil prvinstname instname prvgrpname grpname prvinstname instname] -> linkstr in ( set mainInterf.MINT_lLinks = glinkstr::mainInterf.MINT_lLinks; set srcgroupstr.GRP_lLinks = linkstr::srcgroupstr.GRP_lLinks; let getEdCtrlModuleEditorBoxByName mectrlstr linkstr.GRPL_sSrcEdBox -> srcmbox in let getEdCtrlModuleEditorBoxByName mectrlstr linkstr.GRPL_sDstEdBox -> dstmbox in if (srcmbox == nil || dstmbox == nil) || !(!strcmp prvgrpname grpname) then nil else set linkstr.GRPL_strLink = crEdCtrlModuleEditorLink mectrlstr srcmbox dstmbox prvgrpname::prvinstname::prvatc::grpname::instname::atc::nil nil; let getEdCtrlModuleEditorBoxByName megctrlstr glinkstr.GRPL_sSrcEdBox -> srcmbox in let getEdCtrlModuleEditorBoxByName megctrlstr glinkstr.GRPL_sDstEdBox -> dstmbox in if ((srcmbox == nil) || (dstmbox == nil)) || ((userlevel == 0) && (srcmbox == dstmbox)) then nil else set glinkstr.GRPL_strLink = crEdCtrlModuleEditorLink megctrlstr srcmbox dstmbox prvgrpname::prvinstname::prvatc::grpname::instname::atc::nil nil; ); paintEdCtrlModuleEditor groupstr.GRP_mePlugins; paintEdCtrlModuleEditor mainInterf.MINT_meGroups; 0; ); ); setEdCtrlModuleEditorLinkMode ctrlstr !mode; ); 0;; fun getGroupLinkFromLink(l, linkstr)= let sizelist l -> size in let nil -> ndata in let 0 -> i in ( while i < size && ndata == nil do ( let nth_list l i -> elem in if elem.GRPL_strLink != linkstr then nil else set ndata = elem; set i = i + 1; ); ndata; );; fun getLinkByLinkParams(ctrlstr, lp)= let sizelist ctrlstr.EDC_modulesEditor.EDM_lLinks -> size in let nil -> ndata in let 0 -> i in ( while i < size && ndata == nil do ( let nth_list ctrlstr.EDC_modulesEditor.EDM_lLinks i -> linkstr in if strcmp (strcat (getString2Link(linkstr.EDL_sParams)) (strcatn linkstr.EDL_lParams)) (strcatn lp) then nil else set ndata = linkstr; set i = i + 1; ); ndata; );; fun getGroupLinkFromListByMark(l, mark)= let sizelist l -> size in let nil -> ndata in let 0 -> i in ( while i < size && ndata == nil do ( let nth_list l i -> glinkstr in if glinkstr.GRPL_xmlMark != mark then nil else set ndata = glinkstr; set i = i + 1; ); ndata; );; fun getGroupLinkFromGroupListByMark(mark)= let sizelist lGroups -> size in let nil -> ndata in let 0 -> i in ( while i < size && ndata == nil do ( let nth_list lGroups i -> [_ groupstr] in let getGroupLinkFromListByMark groupstr.GRP_lLinks mark -> grplinkstr in if grplinkstr == nil then nil else set ndata = grplinkstr; set i = i + 1; ); ndata; );; fun getGroupLinkByMark(mark)= let sizelist mainInterf.MINT_lLinks -> size in let nil -> ndata in let 0 -> i in ( while i < size && ndata == nil do ( let nth_list mainInterf.MINT_lLinks i -> grplinkstr in if grplinkstr.GRPL_xmlMark != mark then nil else set ndata = grplinkstr; set i = i + 1; ); ndata; );; fun getGroupLinkFromByDestInstanceName(destgroupname, desinstname)= let sizelist mainInterf.MINT_lLinks -> size in let nil -> ndata in let 0 -> i in ( while i < size do ( let nth_list mainInterf.MINT_lLinks i -> glinkstr in if (!strcmpi glinkstr.GRPL_sDstGroup destgroupname) && (!strcmpi glinkstr.GRPL_sDstInst desinstname) then set ndata = glinkstr::ndata else nil; set i = i + 1; ); ndata; );; fun removeLinksByGIA(groupname, instmark, act)= let XMLgetParam instmark "name" -> instname in // Delete links with instname in destinstance let getGroupLinkFromByDestInstanceName groupname instname -> ldestlinks in ( let sizelist ldestlinks -> size in let 0 -> i in while i < size do ( let nth_list ldestlinks i -> linkstr in let XMLgetParam linkstr.GRPL_xmlMark "event" -> event in let XMLgetParam linkstr.GRPL_xmlMark "group" -> destgroup in let XMLgetParam linkstr.GRPL_xmlMark "instance" -> destinst in let XMLgetParam linkstr.GRPL_xmlMark "action" -> action in let getString2Link (XMLgetData linkstr.GRPL_xmlMark) -> value in if (!strcmpi action act) then ( delModLink (getDMI strcatn linkstr.GRPL_sSrcGroup::"."::linkstr.GRPL_sSrcInst::nil) strbuild ((strcatn linkstr.GRPL_sSrcGroup::"."::linkstr.GRPL_sSrcInst::"."::event::nil)::(strcatn destgroup::"."::destinst::"."::action::nil)::value::"_"::"_"::nil)::nil; dsEdCtrlModuleEditorLink mainInterf.MINT_meGroups linkstr.GRPL_strLink 1; set mainInterf.MINT_lLinks = remove_from_list mainInterf.MINT_lLinks linkstr; let getGroupByName linkstr.GRPL_sSrcGroup -> grpstr in let getGroupLinkFromListByMark grpstr.GRP_lLinks linkstr.GRPL_xmlMark -> grplinkstr in ( dsEdCtrlModuleEditorLink grpstr.GRP_mePlugins grplinkstr.GRPL_strLink 1; set grpstr.GRP_lLinks = remove_from_list grpstr.GRP_lLinks grplinkstr; ); XMLdelMark xmlEditSceneFile linkstr.GRPL_xmlMark; ) else nil; set i = i + 1; ); ); 0;; fun removeLinksByGIE(instmark, evnt)= // Delete links in groups str let XMLgetMarksByValueFromMarkSons instmark "link" -> llinkmarks in let sizelist llinkmarks -> size in let 0 -> i in while i < size do ( let nth_list llinkmarks i -> linkmark in ( let getGroupLinkByMark linkmark -> linkstr in let XMLgetParam linkmark "event" -> event in let XMLgetParam linkmark "group" -> destgroup in let XMLgetParam linkmark "instance" -> destinst in let XMLgetParam linkmark "action" -> action in let getString2Link (XMLgetData linkmark) -> value in if (!strcmpi event evnt) then ( delModLink (getDMI strcatn linkstr.GRPL_sSrcGroup::"."::linkstr.GRPL_sSrcInst::nil) strbuild ((strcatn linkstr.GRPL_sSrcGroup::"."::linkstr.GRPL_sSrcInst::"."::event::nil)::(strcatn destgroup::"."::destinst::"."::action::nil)::value::"_"::"_"::nil)::nil; dsEdCtrlModuleEditorLink mainInterf.MINT_meGroups linkstr.GRPL_strLink 1; set mainInterf.MINT_lLinks = remove_from_list mainInterf.MINT_lLinks linkstr; let getGroupByName linkstr.GRPL_sSrcGroup -> grpstr in let getGroupLinkFromListByMark grpstr.GRP_lLinks linkstr.GRPL_xmlMark -> grplinkstr in ( dsEdCtrlModuleEditorLink grpstr.GRP_mePlugins grplinkstr.GRPL_strLink 1; set grpstr.GRP_lLinks = remove_from_list grpstr.GRP_lLinks grplinkstr; ); XMLdelMark xmlEditSceneFile linkmark; ) else nil; ); set i = i + 1; ); 0;; fun updateGroupLink(mestr, linkstr, userlevel)= if linkstr.GRPL_strLink != nil then ( if ((mainInterf.MINT_meGroups == mestr) && ((userlevel != nil) && (userlevel == 0) && (linkstr.GRPL_strLink.EDL_srcModuleBox == linkstr.GRPL_strLink.EDL_dstModuleBox))) then ( dsEdCtrlModuleEditorLink mestr linkstr.GRPL_strLink 0; set linkstr.GRPL_strLink = nil; 0; ) else nil; ) else ( let getString2Link (XMLgetParam linkstr.GRPL_xmlMark "group") -> groupdest in if ((mainInterf.MINT_meGroups == mestr) || ((mainInterf.MINT_meGroups != mestr) && (!strcmp linkstr.GRPL_sSrcGroup groupdest))) then ( let getEdCtrlModuleEditorBoxByName mestr linkstr.GRPL_sSrcEdBox -> srcmbox in let getEdCtrlModuleEditorBoxByName mestr linkstr.GRPL_sDstEdBox -> dstmbox in if ((srcmbox == nil) || (dstmbox == nil)) || ((userlevel != nil) && (userlevel == 0) && (srcmbox == dstmbox)) then nil else let getString2Link (XMLgetParam linkstr.GRPL_xmlMark "event") -> event in let getString2Link (XMLgetParam linkstr.GRPL_xmlMark "instance") -> destinst in let getString2Link (XMLgetParam linkstr.GRPL_xmlMark "action") -> action in let (XMLgetParam linkstr.GRPL_xmlMark.XMLfather "name") -> instname in let XMLgetData linkstr.GRPL_xmlMark -> param in set linkstr.GRPL_strLink = crEdCtrlModuleEditorLink mestr srcmbox dstmbox linkstr.GRPL_sSrcGroup::instname::event::groupdest::destinst::action::nil param; 0; ) else nil; ); 0;; fun refreshLinks(mestr, l, userlevel)= if (l == nil) then nil else ( updateGroupLink mestr hd l userlevel; refreshLinks mestr tl l userlevel; ); 0;; fun refreshAllInterfLinks(paint)= let atoi (getConfigParamDef "OS3Duser" "plugits_user_level" "1") -> userlevel in refreshLinks mainInterf.MINT_meGroups mainInterf.MINT_lLinks userlevel; if (!paint) then nil else paintEdCtrlModuleEditor mainInterf.MINT_meGroups; 0;; fun loadOsInstanceMark(groupstr, pluginmark, instancemark)= let getEdCtrlModuleEditorBoxByName mainInterf.MINT_meGroups groupstr.GRP_sName -> mboxstr in let XMLgetParam pluginmark "name" -> plugname in let XMLgetParam pluginmark "source" -> plugsource in let strcatn sPLUGINSPATH::"/"::plugsource::nil -> pluginfile in let XMLload pluginfile -> pluginxmldef in let XMLgetMarkByValue pluginxmldef "PLUGIN" -> plugindefmark in let XMLgetMarkByValueFromMarkSons plugindefmark "CLIENT" -> clientdefmark in let revertlist XMLgetMarksByValueFromMarkSons clientdefmark "ACTION" -> actionmarks in let revertlist XMLgetMarksByValueFromMarkSons clientdefmark "EVENT" -> eventmarks in let revertlist XMLgetMarksByValueFromMarkSons clientdefmark "DEFACTION" -> actiondefmarks in let revertlist XMLgetMarksByValueFromMarkSons clientdefmark "DEFEVENT" -> eventdefmarks in // add action and events from instance let if (XMLgetParam instancemark "showInGroup") == nil then 1 else XMLgetBoolParam instancemark "showInGroup" -> showingroup in let revertlist XMLgetMarksByValueFromMarkSons instancemark "ACTION" -> actioninstmarks in let revertlist XMLgetMarksByValueFromMarkSons instancemark "EVENT" -> eventinstmarks in let XMLgetParam instancemark "name" -> instname in ( if (getPluginByFile pluginfile) != nil then nil else ( delEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups mboxstr 0 instname nil; delEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups mboxstr 1 instname nil; 0; ); if (!showingroup) then nil else ( // add plugIT actions to box menu let sizelist actionmarks -> actsize in let 0 -> iact in while iact < actsize do ( let nth_list actionmarks iact -> actionmark in let XMLgetParam actionmark "name" -> actname in let XMLgetParam actionmark "group" -> actgrp in addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups mboxstr 1 actgrp instname::actname::groupstr.GRP_sName::plugname::instname::actname::nil; set iact = iact + 1; ); // add plugIT events to box menu let sizelist eventmarks -> evtsize in let 0 -> ievt in while ievt < evtsize do ( let nth_list eventmarks ievt -> eventmark in let XMLgetParam eventmark "name" -> evtname in let XMLgetParam eventmark "group" -> evtgrp in addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups mboxstr 0 evtgrp instname::evtname::groupstr.GRP_sName::plugname::instname::evtname::nil; set ievt = ievt + 1; ); // add instance actions to box menu let sizelist actioninstmarks -> actsize in let 0 -> iact in while iact < actsize do ( let nth_list actioninstmarks iact -> actiondefmark in let XMLgetParam actiondefmark "name" -> actname in let XMLgetParam actiondefmark "group" -> actgrp in addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups mboxstr 1 actgrp instname::actname::groupstr.GRP_sName::plugname::instname::actname::nil; set iact = iact + 1; ); // add instance events to box menu let sizelist eventinstmarks -> evtsize in let 0 -> ievt in while ievt < evtsize do ( let nth_list eventinstmarks ievt -> eventdefmark in let XMLgetParam eventdefmark "name" -> evtname in let XMLgetParam eventdefmark "group" -> evtgrp in addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups mboxstr 0 evtgrp instname::evtname::groupstr.GRP_sName::plugname::instname::evtname::nil; set ievt = ievt + 1; ); if (actioninstmarks != nil) || (eventinstmarks != nil) then nil else ( // add plugIT def actions to box menu let sizelist actiondefmarks -> actsize in let 0 -> iact in while iact < actsize do ( let nth_list actiondefmarks iact -> actiondefmark in let XMLgetParam actiondefmark "name" -> actname in let XMLgetParam actiondefmark "group" -> actgrp in ( if (actgrp == nil) then XMLaddMark xmlEditSceneFile "ACTION" instancemark ["name" actname]::nil nil else XMLaddMark xmlEditSceneFile "ACTION" instancemark ["name" actname]::["group" actgrp]::nil nil; addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups mboxstr 1 actgrp instname::actname::groupstr.GRP_sName::plugname::instname::actname::nil; ); set iact = iact + 1; ); // add plugIT def events to box menu let sizelist eventdefmarks -> evtsize in let 0 -> ievt in while ievt < evtsize do ( let nth_list eventdefmarks ievt -> eventdefmark in let XMLgetParam eventdefmark "name" -> evtname in let XMLgetParam eventdefmark "group" -> evtgrp in ( if (evtgrp == nil) then XMLaddMark xmlEditSceneFile "EVENT" instancemark ["name" evtname]::nil nil else XMLaddMark xmlEditSceneFile "EVENT" instancemark ["name" evtname]::["group" evtgrp]::nil nil; addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups mboxstr 0 evtgrp instname::evtname::groupstr.GRP_sName::plugname::instname::evtname::nil; ); set ievt = ievt + 1; ); ); ); let XMLgetMarksByValueFromMarkSons instancemark "LINK" -> llinkmarks in let nil -> nlinks in let nil -> nlinksstr in ( let sizelist llinkmarks -> size3 in let 0 -> i3 in while i3 < size3 do ( let nth_list llinkmarks i3 -> linkmark in let XMLgetParam linkmark "group" -> groupdest in let XMLgetParam linkmark "instance" -> destinst in let mkGroupLink [linkmark nil groupstr.GRP_sName groupdest groupstr.GRP_sName groupdest instname destinst] -> grouplinkstr in ( // test if we are in the same group if (strcmp groupstr.GRP_sName groupdest) then nil else let mkGroupLink [linkmark nil instname destinst groupstr.GRP_sName groupdest instname destinst] -> linkstr in set nlinks = linkstr::nlinks; set nlinksstr = grouplinkstr::nlinksstr; ); set i3 = i3 + 1; ); set groupstr.GRP_lLinks = lcat groupstr.GRP_lLinks (revertlist nlinks); if (!showingroup) then nil else set mainInterf.MINT_lLinks = lcat mainInterf.MINT_lLinks (revertlist nlinksstr); ); XMLclose pluginxmldef; ); 0;; fun loadOsGroupInstanceMark(groupstr, pluginmark, instancemark)= let getEdCtrlModuleEditorBoxByName mainInterf.MINT_meGroups groupstr.GRP_sName -> grpboxstr in let XMLgetParam pluginmark "source" -> plugsource in let XMLgetParam pluginmark "name" -> plugname in let strcatn sPLUGINSPATH::"/"::plugsource::nil -> pluginfile in let XMLload pluginfile -> pluginxmldef in let XMLgetMarkByValue pluginxmldef "PLUGIN" -> plugindefmark in let XMLgetMarkByValueFromMarkSons plugindefmark "CLIENT" -> clientdefmark in let revertlist XMLgetMarksByValueFromMarkSons clientdefmark "ACTION" -> actionmarks in let revertlist XMLgetMarksByValueFromMarkSons clientdefmark "EVENT" -> eventmarks in let revertlist XMLgetMarksByValueFromMarkSons clientdefmark "DEFACTION" -> actiondefmarks in let revertlist XMLgetMarksByValueFromMarkSons clientdefmark "DEFEVENT" -> eventdefmarks in let revertlist XMLgetMarksByValueFromMarkSons instancemark "ACTION" -> actioninstmarks in let revertlist XMLgetMarksByValueFromMarkSons instancemark "EVENT" -> eventinstmarks in let XMLgetParam instancemark "name" -> instname in let XMLgetParam instancemark "comment" -> instcomment in let XMLgetParam instancemark "colorOff" -> coloroff in let XMLgetParam instancemark "colorOn" -> coloron in let atoi (XMLgetParam instancemark "px") -> px in let atoi (XMLgetParam instancemark "py") -> py in let max 0 px -> px in let max 0 py -> py in let getEdCtrlModuleEditorBoxByName groupstr.GRP_mePlugins instname -> mboxstr in let if mboxstr != nil then mboxstr else crEdCtrlModuleEditorBox groupstr.GRP_mePlugins instname instname instcomment groupstr.GRP_sName::plugname::pluginfile::instname::nil px py nil bClonePlugITs -> mboxstr in ( let getPluginByFile pluginfile -> plugstr in ( // manage no found plugIT if plugstr != nil && (plugindefmark != nil) && !plugstr.PLUG_bHasError then ( if (mboxstr.EDB_bEnable) then nil else setEdCtrlModuleEditorBoxEnable groupstr.GRP_mePlugins mboxstr 1; 0; ) else ( // change the box color if not found setEdCtrlModuleEditorBoxEnable groupstr.GRP_mePlugins mboxstr 0; 0; ); let if ((coloroff != nil) || (coloron != nil)) then [(htoi coloron) (htoi coloroff)] else if (plugstr.PLUG_tColors == nil) then switchstri lPlugColors plugstr.PLUG_sType else plugstr.PLUG_tColors -> [oncolor offcolor] in setEdCtrlModuleEditorBoxColors groupstr.GRP_mePlugins mboxstr oncolor offcolor; ); resetEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr; setEdCtrlModuleEditorBoxTooltip groupstr.GRP_mePlugins mboxstr (if (instcomment != nil) && (strcmp instcomment "") then strcatn plugname::"\n"::instcomment::nil else plugname); // add instance default actions to box menu let sizelist actionmarks -> actsize in let 0 -> iact in while iact < actsize do ( let nth_list actionmarks iact -> actionmark in let XMLgetParam actionmark "name" -> actname in let XMLgetParam actionmark "group" -> actgrp in addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 1 actgrp actname::groupstr.GRP_sName::plugname::instname::actname::nil; set iact = iact + 1; ); // add instance default events to box menu let sizelist eventmarks -> evtsize in let 0 -> ievt in while ievt < evtsize do ( let nth_list eventmarks ievt -> eventmark in let XMLgetParam eventmark "name" -> evtname in let XMLgetParam eventmark "group" -> evtgrp in addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 0 evtgrp evtname::groupstr.GRP_sName::plugname::instname::evtname::nil; set ievt = ievt + 1; ); // add instance actions to box menu let sizelist actioninstmarks -> actsize in let 0 -> iact in while iact < actsize do ( let nth_list actioninstmarks iact -> actioninstmarks in let XMLgetParam actioninstmarks "name" -> actname in let XMLgetParam actioninstmarks "group" -> actgrp in addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 1 actgrp actname::groupstr.GRP_sName::plugname::instname::actname::nil; set iact = iact + 1; ); // add instance events to box menu let sizelist eventinstmarks -> evtsize in let 0 -> ievt in while ievt < evtsize do ( let nth_list eventinstmarks ievt -> eventinstmark in let XMLgetParam eventinstmark "name" -> evtname in let XMLgetParam eventinstmark "group" -> evtgrp in addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 0 evtgrp evtname::groupstr.GRP_sName::plugname::instname::evtname::nil; set ievt = ievt + 1; ); if ((actioninstmarks != nil) || (eventinstmarks != nil)) then nil else ( // add instance default actions to box menu let sizelist actiondefmarks -> actsize in let 0 -> iact in while iact < actsize do ( let nth_list actiondefmarks iact -> actiondefmark in let XMLgetParam actiondefmark "name" -> actname in let XMLgetParam actiondefmark "group" -> actgrp in ( if (actgrp == nil) then XMLaddMark xmlEditSceneFile "ACTION" instancemark ["name" actname]::nil nil else XMLaddMark xmlEditSceneFile "ACTION" instancemark ["name" actname]::["group" actgrp]::nil nil; addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 1 actgrp actname::groupstr.GRP_sName::plugname::instname::actname::nil; ); set iact = iact + 1; ); // add instance default events to box menu let sizelist eventdefmarks -> evtsize in let 0 -> ievt in while ievt < evtsize do ( let nth_list eventdefmarks ievt -> eventdefmark in let XMLgetParam eventdefmark "name" -> evtname in let XMLgetParam eventdefmark "group" -> evtgrp in ( if (evtgrp == nil) then XMLaddMark xmlEditSceneFile "EVENT" instancemark ["name" evtname]::nil nil else XMLaddMark xmlEditSceneFile "EVENT" instancemark ["name" evtname]::["group" evtgrp]::nil nil; addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 0 evtgrp evtname::groupstr.GRP_sName::plugname::instname::evtname::nil; ); set ievt = ievt + 1; ); ); sortEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr; XMLclose pluginxmldef; ); 0;; fun updateOsGroupInstanceMark(groupstr, pluginmark, instancemark)= let getEdCtrlModuleEditorBoxByName mainInterf.MINT_meGroups groupstr.GRP_sName -> grpboxstr in let XMLgetParam pluginmark "source" -> plugsource in let XMLgetParam pluginmark "name" -> plugname in let strcatn sPLUGINSPATH::"/"::plugsource::nil -> pluginfile in let XMLload pluginfile -> pluginxmldef in let XMLgetMarkByValue pluginxmldef "PLUGIN" -> plugindefmark in let XMLgetMarkByValueFromMarkSons plugindefmark "CLIENT" -> clientdefmark in let revertlist XMLgetMarksByValueFromMarkSons clientdefmark "ACTION" -> actionmarks in let revertlist XMLgetMarksByValueFromMarkSons clientdefmark "EVENT" -> eventmarks in let revertlist XMLgetMarksByValueFromMarkSons clientdefmark "DEFACTION" -> actiondefmarks in let revertlist XMLgetMarksByValueFromMarkSons clientdefmark "DEFEVENT" -> eventdefmarks in let revertlist XMLgetMarksByValueFromMarkSons instancemark "ACTION" -> actioninstmarks in let revertlist XMLgetMarksByValueFromMarkSons instancemark "EVENT" -> eventinstmarks in let XMLgetParam instancemark "name" -> instname in let XMLgetParam instancemark "comment" -> instcomment in let XMLgetParam instancemark "colorOff" -> coloroff in let XMLgetParam instancemark "colorOn" -> coloron in let if (XMLgetParam instancemark "showInGroup") == nil then 1 else XMLgetBoolParam instancemark "showInGroup" -> showingroup in let atoi (XMLgetParam instancemark "px") -> px in let atoi (XMLgetParam instancemark "py") -> py in let max 0 px -> px in let max 0 py -> py in let getEdCtrlModuleEditorBoxByName groupstr.GRP_mePlugins instname -> mboxstr in let if mboxstr != nil then mboxstr else crEdCtrlModuleEditorBox groupstr.GRP_mePlugins instname instname instcomment groupstr.GRP_sName::plugname::pluginfile::instname::nil px py nil bClonePlugITs -> mboxstr in /* if (getPluginByFile pluginfile) == nil then ( dsEdCtrlModuleEditorBox groupstr.GRP_mePlugins mboxstr; delEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 0 instname nil; delEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 1 instname nil; // delete unavailable links let XMLgetMarksByValueFromMarkSons instancemark "LINK" -> llinkmarks in let sizelist llinkmarks -> size3 in let 0 -> i3 in while i3 < size3 do ( let nth_list llinkmarks i3 -> linkmark in let XMLgetParam linkmark "group" -> groupdest in let XMLgetParam linkmark "instance" -> destinst in let XMLgetParam linkmark "event" -> event in let XMLgetParam linkmark "action" -> action in let getString2Link (XMLgetData linkmark) -> value in let mkGroupLink [linkmark nil groupstr.GRP_sName groupdest groupstr.GRP_sName groupdest instname destinst] -> grouplinkstr in ( let getGroupLinkFromListByMark mainInterf.MINT_lLinks linkmark -> oldlinkstr in ( delModLink this strbuild ((strcatn groupstr.GRP_sName::"."::instname::"."::event::nil)::(strcatn groupdest::"."::destinst::"."::action::nil)::value::"_"::"_"::nil)::nil; dsEdCtrlModuleEditorLink mainInterf.MINT_meGroups oldlinkstr.GRPL_strLink 0; set mainInterf.MINT_lLinks = remove_from_list mainInterf.MINT_lLinks oldlinkstr; ); let getGroupLinkFromListByMark groupstr.GRP_lLinks linkmark -> oldlinkstr in ( dsEdCtrlModuleEditorLink groupstr.GRP_mePlugins oldlinkstr.GRPL_strLink 0; set groupstr.GRP_lLinks = remove_from_list groupstr.GRP_lLinks oldlinkstr; ); ); set i3 = i3 + 1; ); 0; ) else*/ ( let getPluginByFile pluginfile -> plugstr in ( if plugstr != nil && !plugstr.PLUG_bHasError then if (mboxstr.EDB_bEnable) then nil else setEdCtrlModuleEditorBoxEnable groupstr.GRP_mePlugins mboxstr 1 else setEdCtrlModuleEditorBoxEnable groupstr.GRP_mePlugins mboxstr 0; let if ((coloroff != nil) || (coloron != nil)) then [(htoi coloron) (htoi coloroff)] else if (plugstr.PLUG_tColors == nil) then switchstri lPlugColors plugstr.PLUG_sType else plugstr.PLUG_tColors -> [oncolor offcolor] in setEdCtrlModuleEditorBoxColors groupstr.GRP_mePlugins mboxstr oncolor offcolor; ); resetEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr; delEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 0 instname nil; delEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 1 instname nil; setEdCtrlModuleEditorBoxTooltip groupstr.GRP_mePlugins mboxstr (if (instcomment != nil) && (strcmp instcomment "") then strcatn plugname::"\n"::instcomment::nil else plugname); // add instance default actions to box menu let sizelist actionmarks -> actsize in let 0 -> iact in while iact < actsize do ( let nth_list actionmarks iact -> actionmark in let XMLgetParam actionmark "name" -> actname in let XMLgetParam actionmark "group" -> actgrp in ( addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 1 actgrp actname::groupstr.GRP_sName::plugname::instname::actname::nil; if (!showingroup) then nil else addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 1 actgrp instname::actname::groupstr.GRP_sName::plugname::instname::actname::nil; ); set iact = iact + 1; ); // add instance default events to box menu let sizelist eventmarks -> evtsize in let 0 -> ievt in while ievt < evtsize do ( let nth_list eventmarks ievt -> eventmark in let XMLgetParam eventmark "name" -> evtname in let XMLgetParam eventmark "group" -> evtgrp in ( addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 0 evtgrp evtname::groupstr.GRP_sName::plugname::instname::evtname::nil; if (!showingroup) then nil else addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 0 evtgrp instname::evtname::groupstr.GRP_sName::plugname::instname::evtname::nil; ); set ievt = ievt + 1; ); // add instance actions to box menu let sizelist actioninstmarks -> actsize in let 0 -> iact in while iact < actsize do ( let nth_list actioninstmarks iact -> actioninstmarks in let XMLgetParam actioninstmarks "name" -> actname in let XMLgetParam actioninstmarks "group" -> actgrp in ( addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 1 actgrp actname::groupstr.GRP_sName::plugname::instname::actname::nil; if (!showingroup) then nil else addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 1 actgrp instname::actname::groupstr.GRP_sName::plugname::instname::actname::nil; ); set iact = iact + 1; ); // add instance events to box menu let sizelist eventinstmarks -> evtsize in let 0 -> ievt in while ievt < evtsize do ( let nth_list eventinstmarks ievt -> eventinstmark in let XMLgetParam eventinstmark "name" -> evtname in let XMLgetParam eventinstmark "group" -> evtgrp in ( addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 0 evtgrp evtname::groupstr.GRP_sName::plugname::instname::evtname::nil; if (!showingroup) then nil else addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 0 evtgrp instname::evtname::groupstr.GRP_sName::plugname::instname::evtname::nil; ); set ievt = ievt + 1; ); if ((actioninstmarks != nil) || (eventinstmarks != nil)) then nil else ( // add plugIT default actions to box menu let sizelist actiondefmarks -> actsize in let 0 -> iact in while iact < actsize do ( let nth_list actiondefmarks iact -> actiondefmark in let XMLgetParam actiondefmark "name" -> actname in let XMLgetParam actiondefmark "group" -> actgrp in ( if (actgrp == nil) then XMLaddMark xmlEditSceneFile "ACTION" instancemark ["name" actname]::nil nil else XMLaddMark xmlEditSceneFile "ACTION" instancemark ["name" actname]::["group" actgrp]::nil nil; addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 1 actgrp actname::groupstr.GRP_sName::plugname::instname::actname::nil; if (!showingroup) then nil else addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 1 actgrp instname::actname::groupstr.GRP_sName::plugname::instname::actname::nil; ); set iact = iact + 1; ); // add plugIT default events to box menu let sizelist eventdefmarks -> evtsize in let 0 -> ievt in while ievt < evtsize do ( let nth_list eventdefmarks ievt -> eventdefmark in let XMLgetParam eventdefmark "name" -> evtname in let XMLgetParam eventdefmark "group" -> evtgrp in ( if (evtgrp == nil) then XMLaddMark xmlEditSceneFile "EVENT" instancemark ["name" evtname]::nil nil else XMLaddMark xmlEditSceneFile "EVENT" instancemark ["name" evtname]::["group" evtgrp]::nil nil; addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 0 evtgrp evtname::groupstr.GRP_sName::plugname::instname::evtname::nil; if (!showingroup) then nil else addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 0 evtgrp instname::evtname::groupstr.GRP_sName::plugname::instname::evtname::nil; ); set ievt = ievt + 1; ); ); sortEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr; sortEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr; let XMLgetMarksByValueFromMarkSons instancemark "LINK" -> llinkmarks in let nil -> nlinks in let nil -> nlinkstr in ( let sizelist llinkmarks -> size3 in let 0 -> i3 in while i3 < size3 do ( let nth_list llinkmarks i3 -> linkmark in let XMLgetParam linkmark "group" -> groupdest in let XMLgetParam linkmark "instance" -> destinst in let XMLgetParam linkmark "event" -> event in let XMLgetParam linkmark "action" -> action in let getString2Link (XMLgetData linkmark) -> value in let mkGroupLink [linkmark nil groupstr.GRP_sName groupdest groupstr.GRP_sName groupdest instname destinst] -> grouplinkstr in ( let getGroupLinkFromListByMark mainInterf.MINT_lLinks linkmark -> oldlinkstr in ( //delModLink this strbuild ((strcatn groupstr.GRP_sName::"."::instname::"."::event::nil)::(strcatn groupdest::"."::destinst::"."::action::nil)::value::"_"::"_"::nil)::nil; dsEdCtrlModuleEditorLink mainInterf.MINT_meGroups oldlinkstr.GRPL_strLink 0; set mainInterf.MINT_lLinks = remove_from_list mainInterf.MINT_lLinks oldlinkstr; ); let getGroupLinkFromListByMark groupstr.GRP_lLinks linkmark -> oldlinkstr in ( dsEdCtrlModuleEditorLink groupstr.GRP_mePlugins oldlinkstr.GRPL_strLink 0; set groupstr.GRP_lLinks = remove_from_list groupstr.GRP_lLinks oldlinkstr; ); // test if we are in the same group if (strcmp groupstr.GRP_sName groupdest) then nil else let mkGroupLink [linkmark nil instname destinst groupstr.GRP_sName groupdest instname destinst] -> linkstr in set nlinks = linkstr::nlinks; set nlinkstr = grouplinkstr::nlinkstr; ); set i3 = i3 + 1; ); set groupstr.GRP_lLinks = lcat groupstr.GRP_lLinks (revertlist nlinks); if (!showingroup) then nil else set mainInterf.MINT_lLinks = lcat mainInterf.MINT_lLinks (revertlist nlinkstr); ); XMLclose pluginxmldef; ); 0;; fun cbBtnInstanceCancel(btnstr, mboxstr)= let switch mainInterf.MINT_lInstanceConfig mboxstr -> winstr in dsEdWindow winstr; set mainInterf.MINT_lInstanceConfig = G2DremoveEdIdxFromList mainInterf.MINT_lInstanceConfig mboxstr; 0;; fun cbBtnInstanceCancelAndDel(btnstr, p)= let p -> [ctrlstr mboxstr] in let switch mainInterf.MINT_lInstanceConfig mboxstr -> winstr in ( dsEdWindow winstr; set mainInterf.MINT_lInstanceConfig = G2DremoveEdIdxFromList mainInterf.MINT_lInstanceConfig mboxstr; removeInstance ctrlstr mboxstr; paintEdCtrlModuleEditor ctrlstr; ); 0;; fun cbBtnApplyInstance(ctrlbtn, p, winstr, cancelbtn)= let p -> [mboxstr instname plugstr inststr cbclose ctrlinstname ctrlcomment ctrloffcolor] in let strtrim (getEdCtrlTextLineValue ctrlinstname) -> ninstname in let getEdCtrlEditTextValue ctrlcomment -> ninstcomment in let getEdCtrlColorButtonColor ctrloffcolor -> ncoloroff in let inststr.INST_groupstr -> groupstr in let XMLgetMarkByValueFromMarkSons groupstr.GRP_xmlMark "plugins" -> plugsmark in let XMLgetMarkByValueAndParamValueFromMark plugsmark "plugin" "source" (substr plugstr.PLUG_sFile ((strlen sPLUGINSPATH) + 1) 1024) -> pluginmark in let XMLgetMarkByValueAndParamValueFromMark pluginmark "instance" "name" instname -> instmark in let XMLgetMarkByValueAndParamValueFromMark plugsmark "instance" "name" ninstname -> existmark in if (ninstname == nil) || (!strcmp "" strtrim ninstname) then ( _DLGMessageBox _channel winstr.EDW_win (loc "OS3D_0155") strcatn (loc "OS3D_0214")::nil 0; 0; ) else if (existmark != nil) && (existmark != instmark) then ( _DLGMessageBox _channel winstr.EDW_win (loc "OS3D_0155") strcatn (strcat (loc "OS3D_0212") " ")::ninstname::" "::(loc "OS3D_0003")::nil 0; 0; ) else ( let getEdCtrlModuleEditorBoxByName mainInterf.MINT_meGroups groupstr.GRP_sName -> grpboxstr in let exec cbclose with [] -> lp in let nil -> lpgroupact in let nil -> lpgroupevt in let revertlist XMLgetMarksByValueFromMarkSons instmark "ACTION" -> actioninstmarks in let revertlist XMLgetMarksByValueFromMarkSons instmark "EVENT" -> eventinstmarks in let revertlist XMLgetMarksByValueFromMarkSons instmark "param" -> paraminstmarks in let nil -> laction in let nil -> levent in let nil -> instparams in ( // remove param marks let sizelist paraminstmarks -> size in let 0 -> i in while i < size do ( let nth_list paraminstmarks i -> elem in XMLdelMark xmlEditSceneFile elem; set i = i + 1; ); // set instances params in xml let sizelist lp -> size in let 0 -> i in let nil -> lastgrp in while i < size do ( let nth_list lp i -> [pname pval] in if (!strcmpi pname "GROUP") then ( set lastgrp = if (!strcmp pval "") then nil else pval; 0; ) else if ((!strcmpi pname "EVENT") || (!strcmpi pname "ACTION")) then ( if (!strcmpi pname "ACTION") then ( if (lastgrp == nil) then nil else set lpgroupact = [pval lastgrp]::lpgroupact; set laction = pval::laction; ) else if (!strcmpi pname "EVENT") then ( if (lastgrp == nil) then nil else set lpgroupevt = [pval lastgrp]::lpgroupevt; set levent = pval::levent; ) else nil; 0; ) else ( set instparams = [pname pval]::instparams; let XMLaddMark xmlEditSceneFile "param" instmark ["name" pname]::nil nil -> pmark in XMLsetData pmark pval; 0; ); set i = i + 1; ); // remove events marks let sizelist eventinstmarks -> size in let 0 -> i in while i < size do ( let nth_list eventinstmarks i -> elem in let XMLgetParam elem "name" -> name in if (isStringInListi levent name) then ( if (inststr.INST_bShowInGroup) then nil else delEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 0 instname name; 0; ) else ( removeLinksByGIE instmark name; delEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 0 name nil; delEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 0 instname name; XMLdelMark xmlEditSceneFile elem; 0; ); set i = i + 1; ); // remove actions marks let sizelist actioninstmarks -> size in let 0 -> i in while i < size do ( let nth_list actioninstmarks i -> elem in let XMLgetParam elem "name" -> name in if (isStringInListi laction name) then ( if (inststr.INST_bShowInGroup) then nil else delEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 1 instname name; 0; ) else ( removeLinksByGIA groupstr.GRP_sName instmark name; delEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 1 name nil; delEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 1 instname name; XMLdelMark xmlEditSceneFile elem; ); set i = i + 1; ); // add new instance actions let sizelist laction -> size in let 0 -> i in while i < size do ( let nth_list laction i -> elem in let XMLgetMarkByValueAndParamValueFromMarkSons instmark "ACTION" "name" elem -> actstr in let switchstr lpgroupact elem -> actgrp in if (actstr != nil) then ( let XMLgetParam actstr "group" -> ogroup in if (((ogroup == nil) && (actstr == nil)) || (!strcmp actgrp ogroup)) then nil else let XMLgetParam actstr "name" -> name in ( delEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 1 name nil; delEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 1 instname name; XMLdelMark xmlEditSceneFile actstr; if (actgrp == nil) then XMLaddMark xmlEditSceneFile "ACTION" instmark ["name" elem]::nil nil else XMLaddMark xmlEditSceneFile "ACTION" instmark ["name" elem]::["group" actgrp]::nil nil; addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 1 actgrp elem::groupstr.GRP_sName::plugstr.PLUG_sName::instname::elem::nil; if (!inststr.INST_bShowInGroup) then nil else addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 1 actgrp instname::elem::groupstr.GRP_sName::plugstr.PLUG_sName::instname::elem::nil; ); ) else ( if (actgrp == nil) then XMLaddMark xmlEditSceneFile "ACTION" instmark ["name" elem]::nil nil else XMLaddMark xmlEditSceneFile "ACTION" instmark ["name" elem]::["group" actgrp]::nil nil; addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 1 actgrp elem::groupstr.GRP_sName::plugstr.PLUG_sName::instname::elem::nil; if (!inststr.INST_bShowInGroup) then nil else addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 1 actgrp instname::elem::groupstr.GRP_sName::plugstr.PLUG_sName::instname::elem::nil; ); set i = i + 1; ); // add new instance events let sizelist levent -> size in let 0 -> i in while i < size do ( let nth_list levent i -> elem in let XMLgetMarkByValueAndParamValueFromMarkSons instmark "EVENT" "name" elem -> evntstr in let switchstr lpgroupevt elem -> evtgrp in if evntstr != nil then ( let XMLgetParam evntstr "group" -> ogroup in if (((ogroup == nil) && (evtgrp == nil)) || (!strcmp evtgrp ogroup)) then nil else let XMLgetParam evntstr "name" -> name in ( delEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 0 name nil; delEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 0 instname name; XMLdelMark xmlEditSceneFile evntstr; if (evtgrp == nil) then XMLaddMark xmlEditSceneFile "EVENT" instmark ["name" elem]::nil nil else XMLaddMark xmlEditSceneFile "EVENT" instmark ["name" elem]::["group" evtgrp]::nil nil; addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 0 evtgrp elem::groupstr.GRP_sName::plugstr.PLUG_sName::instname::elem::nil; if (!inststr.INST_bShowInGroup) then nil else addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 0 evtgrp instname::elem::groupstr.GRP_sName::plugstr.PLUG_sName::instname::elem::nil; ); ) else ( if (evtgrp == nil) then XMLaddMark xmlEditSceneFile "EVENT" instmark ["name" elem]::nil nil else XMLaddMark xmlEditSceneFile "EVENT" instmark ["name" elem]::["group" evtgrp]::nil nil; addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 0 evtgrp elem::groupstr.GRP_sName::plugstr.PLUG_sName::instname::elem::nil; if (!inststr.INST_bShowInGroup) then nil else addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 0 evtgrp instname::elem::groupstr.GRP_sName::plugstr.PLUG_sName::instname::elem::nil; ); set i = i + 1; ); sortEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr; sortEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr; // Apply params if (!strcmp (strtrim ninstname) instname) then ( // reset instance and re set the newinstance params createPluginInstance groupstr plugstr inststr.INST_sName instparams laction levent inststr.INST_bShowHelper inststr.INST_bShowInGroup bAppPlay; XMLsetParam instmark "comment" ninstcomment; XMLsetParam instmark "colorOff" itoh ncoloroff; setEdCtrlModuleEditorBoxColors groupstr.GRP_mePlugins mboxstr nil ncoloroff; setEdCtrlModuleEditorBoxTooltip groupstr.GRP_mePlugins mboxstr (if (ninstcomment != nil) && (strcmp ninstcomment "") then strcatn plugstr.PLUG_sName::"\n"::ninstcomment::nil else plugstr.PLUG_sName); setEdCtrlModuleEditorBoxDesc groupstr.GRP_mePlugins mboxstr ninstcomment; 0; ) // Destroy and create with new name else ( deletePluginInstance plugstr strcatn groupstr.GRP_sName::"."::instname::nil 1; //rename dmi // remove instance event and actions from menu let getEdCtrlModuleEditorBoxByName mainInterf.MINT_meGroups groupstr.GRP_sName -> grpboxstr in ( delEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 0 instname nil; delEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 1 instname nil; ); // Delete links with instname in destinstance let getGroupLinkFromByDestInstanceName groupstr.GRP_sName instname -> ldestlinks in ( let sizelist ldestlinks -> size in let 0 -> i in while i < size do ( let nth_list ldestlinks i -> linkstr in let getGroupByName linkstr.GRPL_sSrcGroup -> grpstr in let XMLgetParam linkstr.GRPL_xmlMark "event" -> event in let XMLgetParam linkstr.GRPL_xmlMark "group" -> destgroup in let XMLgetParam linkstr.GRPL_xmlMark "instance" -> destinst in let XMLgetParam linkstr.GRPL_xmlMark "action" -> action in let getString2Link (XMLgetData linkstr.GRPL_xmlMark) -> value in ( setModLink (createDMI strcatn linkstr.GRPL_sSrcGroup::"."::linkstr.GRPL_sSrcInst::nil) (createDMI strcatn destgroup::"."::ninstname::nil) strbuild ((strcatn linkstr.GRPL_sSrcGroup::"."::linkstr.GRPL_sSrcInst::"."::event::nil)::(strcatn destgroup::"."::destinst::"."::action::nil)::value::"_"::"_"::nil)::nil strbuild ((strcatn linkstr.GRPL_sSrcGroup::"."::linkstr.GRPL_sSrcInst::"."::event::nil)::(strcatn destgroup::"."::ninstname::"."::action::nil)::value::"_"::"_"::nil)::nil; dsEdCtrlModuleEditorLink mainInterf.MINT_meGroups linkstr.GRPL_strLink 0; set linkstr.GRPL_strLink = nil; set linkstr.GRPL_sDstInst = ninstname; XMLsetParam linkstr.GRPL_xmlMark "instance" ninstname; let getGroupLinkFromListByMark grpstr.GRP_lLinks linkstr.GRPL_xmlMark -> grplinkstr in ( dsEdCtrlModuleEditorLink grpstr.GRP_mePlugins grplinkstr.GRPL_strLink 0; set grplinkstr.GRPL_strLink = nil; set grplinkstr.GRPL_sDstInst = ninstname; set grplinkstr.GRPL_sDstEdBox = ninstname; ); ); set i = i + 1; ); ); // Delete links in groups str let XMLgetMarksByValueFromMarkSons instmark "link" -> llinkmarks in let sizelist llinkmarks -> size in let 0 -> i in while i < size do ( let nth_list llinkmarks i -> linkmark in ( let getGroupLinkFromGroupListByMark linkmark -> grplinkstr in let getGroupByName grplinkstr.GRPL_sSrcGroup -> grpstr in ( set grpstr.GRP_lLinks = remove_from_list grpstr.GRP_lLinks grplinkstr; let XMLgetParam linkmark "event" -> event in let XMLgetParam linkmark "group" -> destgroup in let XMLgetParam linkmark "instance" -> destinst in let XMLgetParam linkmark "action" -> action in let getString2Link (XMLgetData linkmark) -> value in setModLink (createDMI strcatn grplinkstr.GRPL_sSrcGroup::"."::ninstname::nil) (createDMI strcatn destgroup::"."::destinst::nil) strbuild ((strcatn grplinkstr.GRPL_sSrcGroup::"."::grplinkstr.GRPL_sSrcInst::"."::event::nil)::(strcatn destgroup::"."::destinst::"."::action::nil)::value::"_"::"_"::nil)::nil strbuild ((strcatn grplinkstr.GRPL_sSrcGroup::"."::ninstname::"."::event::nil)::(strcatn destgroup::"."::destinst::"."::action::nil)::value::"_"::"_"::nil)::nil; ); let getGroupLinkFromListByMark mainInterf.MINT_lLinks linkmark -> grplinkstr in ( dsEdCtrlModuleEditorLink mainInterf.MINT_meGroups grplinkstr.GRPL_strLink 0; set mainInterf.MINT_lLinks = remove_from_list mainInterf.MINT_lLinks grplinkstr; ); ); set i = i + 1; ); XMLsetParam instmark "name" ninstname; XMLsetParam instmark "comment" ninstcomment; XMLsetParam instmark "colorOff" itoh ncoloroff; XMLsetParam instmark "showHelper" (itoa inststr.INST_bShowHelper); XMLsetParam instmark "showInGroup" (itoa inststr.INST_bShowInGroup); setEdCtrlModuleEditorBoxColors groupstr.GRP_mePlugins mboxstr nil ncoloroff; setEdCtrlModuleEditorBoxTooltip groupstr.GRP_mePlugins mboxstr (if (ninstcomment != nil) && (strcmp ninstcomment "") then strcatn plugstr.PLUG_sName::"\n"::ninstcomment::nil else plugstr.PLUG_sName); setEdCtrlModuleEditorBoxDesc groupstr.GRP_mePlugins mboxstr ninstcomment; let createPluginInstance groupstr plugstr (strcatn groupstr.GRP_sName::"."::ninstname::nil) instparams laction levent inststr.INST_bShowHelper inststr.INST_bShowInGroup bAppPlay -> ninststr in ( dsEdCtrlModuleEditorBox groupstr.GRP_mePlugins mboxstr; // reload instance loadOsInstanceMark groupstr pluginmark instmark; loadOsGroupInstanceMark groupstr pluginmark instmark; // sort group box menu let getEdCtrlModuleEditorBoxByName mainInterf.MINT_meGroups groupstr.GRP_sName -> grpboxstr in sortEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr; // refresh main tab links refreshAllInterfLinks 0; // refresh current group tab links refreshLinks groupstr.GRP_mePlugins groupstr.GRP_lLinks nil; let getEdCtrlModuleEditorBoxByName groupstr.GRP_mePlugins ninstname -> nmboxstr in mutate p <- [nmboxstr ninstname plugstr ninststr cbclose ctrlinstname ctrlcomment ctrloffcolor]; ); 0; ); if winstr == nil then nil else ( dsEdWindow winstr; set mainInterf.MINT_lInstanceConfig = G2DremoveEdIdxFromList mainInterf.MINT_lInstanceConfig mboxstr; ); ); setEdCtrlButtonCb cancelbtn mkfun2 @cbBtnInstanceCancel mboxstr; paintEdCtrlModuleEditor groupstr.GRP_mePlugins; paintEdCtrlModuleEditor mainInterf.MINT_meGroups; 0; ); 0;; fun cbBtnDestroyWinInstance(winstr, mboxstr, cbDestroy)= exec cbDestroy with []; set mainInterf.MINT_lInstanceConfig = G2DremoveEdIdxFromList mainInterf.MINT_lInstanceConfig mboxstr; 0;; fun cbIntanceKeyUp(winstr, key, dstwinstr)= if key != 1 then nil else dsEdWindow dstwinstr; 0;; fun cbOnlinePlugitDocumentation(testurl, plugstr, rc) = let getPathFile plugstr.PLUG_sHelp "" -> [_ filename] in if (rc == 1) then // Active Internet Connection detected ( let loc "LANGCODE" -> lg in let if !strcmpi "fr" lg then lg else "en" -> lg in let strcatn sOSD3Url::"/lang/"::lg::"/plugits/"::plugstr.PLUG_sType::"/"::filename::nil -> url in _openbrowserhttp plugstr.PLUG_sHelp; 0; ) // No Active Internet Connection detected else ( _openbrowserhttp strcatn "http://127.0.0.1:"::(itoa MainDocServer.DOCSRV_port)::"/plugits/"::plugstr.PLUG_sType::"/"::filename::nil; 0; );; fun cbTbBtnPluginHelp(tbstr, check, btn, mask, plugstr)= if (_keybdstate & 1) then ( let getPathFile plugstr.PLUG_sHelp "" -> [_ filename] in _openbrowserhttp strcatn "http://127.0.0.1:"::(itoa MainDocServer.DOCSRV_port)::"/plugits/"::plugstr.PLUG_sType::"/"::filename::nil; 0; ) else ( checkInternetConnection nil @cbOnlinePlugitDocumentation plugstr; 0; ); 0;; fun cbTbBtnPluginHelperCheck(tbstr, check, btn, mask, state, p)= let p -> [inststr instmark] in ( XMLsetParam instmark "showHelper" (itoa state); setPluginInstanceShowHelper inststr state; ); 0;; fun cbTbBtnPluginShowInGroupCheck(tbstr, check, btn, mask, state, p)= let p -> [inststr groupstr pluginmark instancemark] in if ((getPluginInstanceShowInGroup inststr) == state) then nil else ( XMLsetParam instancemark "showInGroup" (itoa state); setPluginInstanceShowInGroup inststr state; updateOsGroupInstanceMark groupstr pluginmark instancemark; refreshAllInterfLinks 0; paintEdCtrlModuleEditor mainInterf.MINT_meGroups; refreshLinks groupstr.GRP_mePlugins groupstr.GRP_lLinks nil; paintEdCtrlModuleEditor groupstr.GRP_mePlugins; ); 0;; fun cbAddPluginInstance(mitem, p)= let p -> [ctrlstr groupstr plugstr viewstr x y] in let XMLgetMarkByValueFromMarkSons groupstr.GRP_xmlMark "plugins" -> plugsmark in let XMLgetMarkByValueAndParamValueFromMark plugsmark "plugin" "source" (substr plugstr.PLUG_sFile ((strlen sPLUGINSPATH) + 1) 1024) -> pluginmark in let if (plugstr.PLUG_tColors == nil) then switchstri lPlugColors plugstr.PLUG_sType else plugstr.PLUG_tColors -> [oncolor offcolor] in let strcat plugstr.PLUG_sName " inst" -> instname in ( let 1 -> i in while (XMLgetMarkByValueAndParamValueFromMark plugsmark "instance" "name" instname) != nil do ( set instname = strcatn plugstr.PLUG_sName::" inst("::(itoa i)::")"::nil; set i = i + 1; ); let substr plugstr.PLUG_sFile ((strlen sPLUGINSPATH) + 1) 1024 -> plugfile in let if pluginmark != nil then pluginmark else (XMLaddMark xmlEditSceneFile "plugin" plugsmark ["source" plugfile]::["name" plugstr.PLUG_sName]::nil nil) -> pluginmark in let XMLaddMark xmlEditSceneFile "instance" pluginmark ["name" instname]::["px" "0"]::["py" "0"]::nil nil -> instancemark in ( let strcatn sPLUGINSPATH::"/"::plugfile::nil -> pluginfile in let XMLload pluginfile -> pluginxmldef in let XMLgetMarkByValue pluginxmldef "PLUGIN" -> plugindefmark in let XMLgetMarkByValueFromMarkSons plugindefmark "CLIENT" -> clientdefmark in let revertlist XMLgetMarksByValueFromMarkSons clientdefmark "ACTION" -> actionmarks in let revertlist XMLgetMarksByValueFromMarkSons clientdefmark "EVENT" -> eventmarks in let revertlist XMLgetMarksByValueFromMarkSons clientdefmark "DEFACTION" -> actiondefmarks in let revertlist XMLgetMarksByValueFromMarkSons clientdefmark "DEFEVENT" -> eventdefmarks in let crEdCtrlModuleEditorBox groupstr.GRP_mePlugins instname instname nil groupstr.GRP_sName::plugstr.PLUG_sName::plugstr.PLUG_sFile::instname::nil (x / groupstr.GRP_mePlugins.EDC_modulesEditor.EDM_iSnap) (y / groupstr.GRP_mePlugins.EDC_modulesEditor.EDM_iSnap) nil bClonePlugITs -> mboxstr in let getEdCtrlModuleEditorBoxByName mainInterf.MINT_meGroups groupstr.GRP_sName -> grpboxstr in ( setEdCtrlModuleEditorBoxColors groupstr.GRP_mePlugins mboxstr oncolor offcolor; setEdCtrlModuleEditorBoxTooltip groupstr.GRP_mePlugins mboxstr plugstr.PLUG_sName; createPluginInstance groupstr plugstr (strcatn groupstr.GRP_sName::"."::instname::nil) nil nil nil plugstr.PLUG_bUseHelpers 1 bAppPlay; if plugstr != nil && !plugstr.PLUG_bHasError then if (mboxstr.EDB_bEnable) then nil else setEdCtrlModuleEditorBoxEnable groupstr.GRP_mePlugins mboxstr 1 else setEdCtrlModuleEditorBoxEnable groupstr.GRP_mePlugins mboxstr 0; // add instance actions to box menu let sizelist actionmarks -> actsize in let 0 -> iact in while iact < actsize do ( let nth_list actionmarks iact -> actionmark in let XMLgetParam actionmark "name" -> actname in let XMLgetParam actionmark "group" -> actgrp in ( addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 1 actgrp actname::groupstr.GRP_sName::plugstr.PLUG_sName::instname::actname::nil; addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 1 actgrp instname::actname::groupstr.GRP_sName::plugstr.PLUG_sName::instname::actname::nil; ); set iact = iact + 1; ); // add instance events to box menu let sizelist eventmarks -> evtsize in let 0 -> ievt in while ievt < evtsize do ( let nth_list eventmarks ievt -> eventmark in let XMLgetParam eventmark "name" -> evtname in let XMLgetParam eventmark "group" -> evtgrp in ( addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 0 evtgrp evtname::groupstr.GRP_sName::plugstr.PLUG_sName::instname::evtname::nil; addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 0 evtgrp instname::evtname::groupstr.GRP_sName::plugstr.PLUG_sName::instname::evtname::nil; ); set ievt = ievt + 1; ); // add default PlugIT actions to box menu let sizelist actiondefmarks -> actsize in let 0 -> iact in while iact < actsize do ( let nth_list actiondefmarks iact -> actiondefmark in let XMLgetParam actiondefmark "name" -> actname in let XMLgetParam actiondefmark "group" -> actgrp in ( if (actgrp == nil) then XMLaddMark xmlEditSceneFile "ACTION" instancemark ["name" actname]::nil nil else XMLaddMark xmlEditSceneFile "ACTION" instancemark ["name" actname]::["group" actgrp]::nil nil; addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 1 actgrp actname::groupstr.GRP_sName::plugstr.PLUG_sName::instname::actname::nil; addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 1 actgrp instname::actname::groupstr.GRP_sName::plugstr.PLUG_sName::instname::actname::nil; ); set iact = iact + 1; ); // add default PlugIT events to box menu let sizelist eventdefmarks -> evtsize in let 0 -> ievt in while ievt < evtsize do ( let nth_list eventdefmarks ievt -> eventdefmark in let XMLgetParam eventdefmark "name" -> evtname in let XMLgetParam eventdefmark "group" -> evtgrp in ( if (evtgrp == nil) then XMLaddMark xmlEditSceneFile "EVENT" instancemark ["name" evtname]::nil nil else XMLaddMark xmlEditSceneFile "EVENT" instancemark ["name" evtname]::["group" evtgrp]::nil nil; addEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr 0 evtgrp evtname::groupstr.GRP_sName::plugstr.PLUG_sName::instname::evtname::nil; addEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 0 evtgrp instname::evtname::groupstr.GRP_sName::plugstr.PLUG_sName::instname::evtname::nil; ); set ievt = ievt + 1; ); sortEdCtrlModuleEditorBoxMenu groupstr.GRP_mePlugins mboxstr; sortEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr; // edit instance let _GETWorkingAreaSize -> [sw _] in let _GETdesktopSize -> [_ sh] in let _GETscreenPos -> [mx my] in let [mx + 10 my - 10] -> [mx my] in let [300 325] -> [iw ih] in let 40 -> hmargin in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih + hmargin) > sh) then max 0 ((sh - ih) - hmargin) else my)] -> [x y] in let (hd mboxstr.EDB_lParams) -> groupname in let (hd tl mboxstr.EDB_lParams) -> plugname in let (hd tl tl mboxstr.EDB_lParams) -> plugfile in let (hd tl tl tl mboxstr.EDB_lParams) -> instname in let strcatn groupname::"."::mboxstr.EDB_sName::nil -> fullinstname in let getPluginByFile plugfile -> plugstr in let getPluginInstanceByName plugstr fullinstname -> inststr in let setEdWindowIcon (crEdWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU|WN_SIZEBOX nil nil strcatn "Edit "::plugname::" : "::instname::" "::(loc "OS3D_0007")::nil) sWinDlgIcon -> plugwinstr in let crEdWindowToolBar plugwinstr 0 0 iw 28 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> tbstr in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_pgroup.png" -> ashowg in let crEdToolBarCheck tbstr ashowg ETB_ALIGN_LEFT (loc "OS3D_0828") mkfun6 @cbTbBtnPluginShowInGroupCheck [inststr groupstr pluginmark instancemark] -> chkshowingroup in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_helpers.png" -> ahelpers in let crEdToolBarCheck tbstr ahelpers ETB_ALIGN_LEFT (loc "OS3D_0391") mkfun6 @cbTbBtnPluginHelperCheck [inststr instancemark] -> chkhelpers in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_help.png" -> ahelp in let crEdToolBarButton tbstr ahelp ETB_ALIGN_RIGHT (loc "OS3D_0186") mkfun5 @cbTbBtnPluginHelp plugstr -> tbhelp in let crEdScrollWindow _channel plugwinstr 0 210 iw ih-250 WN_CHILDINSIDE|WN_VSCROLL EDWIN_RESIZE_MW|EDWIN_RESIZE_MH nil nil -> scrlwinstr in let crEdWindow _channel scrlwinstr 0 0 iw ih-250 WN_CHILDINSIDE|WN_NOBORDER nil EDWIN_GROUP nil -> winstr in let crEdCtrlLabel plugwinstr 10 35 160 20 (loc "OS3D_0305") EDWIN_RESIZE_NONE -> labelobj in let crEdCtrlTextLine plugwinstr 180 35 (iw - 190) 20 instname nil EDWIN_RESIZE_MW -> ctrlinstname in let crEdCtrlText plugwinstr 10 60 (iw-9) 40 plugstr.PLUG_sDesc ET_AVSCROLL|ET_VSCROLL|ET_ALIGN_LEFT EDWIN_RESIZE_MW -> ctrldesc in let crEdCtrlLabel plugwinstr 10 105 160 20 (loc "OS3D_0813") EDWIN_RESIZE_NONE -> labelcolor in let crEdCtrlColorButton plugwinstr 180 105 100 20 offcolor 0 nil nil -> ctrloffcolor in let crEdCtrlLabel plugwinstr 10 130 160 20 (loc "OS3D_0095") EDWIN_RESIZE_NONE -> labelobj in let crEdCtrlEditText plugwinstr 10 150 (iw-9) 50 "" ET_AVSCROLL|ET_VSCROLL|ET_ALIGN_LEFT|ET_BORDER EDWIN_RESIZE_MW -> ctrlcomment in let crEdCtrlButton plugwinstr 10 (ih - 30) 90 20 (loc "OS3D_0282") EDWIN_RESIZE_LH|EDWIN_RESIZE_RW -> okbtn in let crEdCtrlButton plugwinstr ((iw /2) - 45) (ih - 30) 90 20 (loc "OS3D_0051") EDWIN_RESIZE_LH|EDWIN_RESIZE_RW|EDWIN_RESIZE_LW -> applybtn in let crEdCtrlButton plugwinstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0084") EDWIN_RESIZE_LH|EDWIN_RESIZE_LW -> cancelbtn in let exec plugstr.PLUG_openEditor with [winstr inststr viewstr applybtn] -> [cbclose cbDestroy] in let [mboxstr instname plugstr inststr cbclose ctrlinstname ctrlcomment ctrloffcolor] -> cbparam in let getEdWindowExPosSize plugwinstr -> [_ _ mw mh] in let mh - 325 -> bordersize in ( if (strIsUrl plugstr.PLUG_sHelp) then nil else ( if (plugstr.PLUG_sHelp == nil) then ( setEdToolBarButtonToolTip tbstr tbhelp (loc "OS3D_0271"); ) else ( setEdToolBarButtonToolTip tbstr tbhelp plugstr.PLUG_sHelp; ); setEdToolBarButtonEnable tbstr tbhelp 0; ); if (plugstr.PLUG_bUseHelpers) then ( setEdToolBarCheckState tbstr chkhelpers inststr.INST_bShowHelper; 0; ) else ( setEdToolBarCheckEnable tbstr chkhelpers 0; 0; ); setEdToolBarCheckState tbstr chkshowingroup inststr.INST_bShowInGroup; setEdwindowCbKeyUp plugwinstr mkfun3 @cbIntanceKeyUp plugwinstr; setEdwindowCbKeyUp scrlwinstr mkfun3 @cbIntanceKeyUp plugwinstr; setEdwindowCbKeyUp winstr mkfun3 @cbIntanceKeyUp plugwinstr; setEdCtrlButtonCb okbtn mkfun2 mkfun3 mkfun4 @cbBtnApplyInstance nil plugwinstr cbparam; setEdCtrlButtonCb applybtn mkfun2 mkfun3 mkfun4 @cbBtnApplyInstance cancelbtn nil cbparam; setEdCtrlButtonCb cancelbtn mkfun2 @cbBtnInstanceCancelAndDel [ctrlstr mboxstr]; setEdwindowCbDestroy plugwinstr mkfun2 mkfun3 @cbBtnDestroyWinInstance cbDestroy mboxstr; set mainInterf.MINT_lInstanceConfig = [mboxstr plugwinstr]::mainInterf.MINT_lInstanceConfig; let getEdWindowSize winstr -> [nw nh] in let if nw + 22 >= sw then sw else nw + 22 -> nw in let if nh + 270 + bordersize >= sh then sh - bordersize else nh + 275 -> nh in let [(if ((x + nw) > sw) then (sw - nw) else x) (if ((y + nh + bordersize) > sh) then (sh - nh - bordersize) else y)] -> [x y] in ( setEdWindowPosSize plugwinstr x y nw nh; setEdWindowMinimumSize plugwinstr nw 250; setEdWindowMaximumSize plugwinstr nw sh - 40; ); // on pluIT error we disable apply button and show an warning message if (mboxstr.EDB_bEnable) then nil else ( crEdCtrlLabelEx winstr 10 10 (mw - 20) 60 (loc "OS3D_0306") ET_AHSCROLL|ET_ALIGN_CENTER EDWIN_RESIZE_NONE; setEdCtrlButtonEnable okbtn 0; setEdCtrlButtonEnable applybtn 0; ); ); XMLclose pluginxmldef; ); ); paintEdCtrlModuleEditor groupstr.GRP_mePlugins; paintEdCtrlModuleEditor mainInterf.MINT_meGroups; 0; ); 0;; fun cbUpdatePluginsSearchList(ctrltxt, val, p)= let atoi (getConfigParamDef "OS3Duser" "plugits_user_level" "1") -> userlevel in let p -> [resultlist ctrladd trm] in ( if (trm == nil) then nil else ( _deltimer trm; mutate p <- [_ _ nil]; ); let lPlugins -> lp in let nil -> result in ( if (!strcmp (strtrim val) "") then nil else while (lp != nil) do ( let hd lp -> [name plug] in if (plug.PLUG_bHasError || plug.PLUG_bIsDeprecated || (plug.PLUG_iUserLevel > userlevel)) || (((strfindi val name 0) == nil) && ((strfindi val plug.PLUG_sType 0) == nil) && ((strfindi val plug.PLUG_sDesc 0) == nil) && ((strfindi val plug.PLUG_sKeywords 0) == nil)) then nil else set result = name::result; set lp = tl lp; ); set result = quicksort result @suppDoublon; fillEdCtrlList resultlist result; selectEdCtrlListByPos resultlist 0; setEdCtrlButtonEnable ctrladd if (result != nil) then 1 else 0; ); ); 0;; fun cbUpdatePluginsSearchListTrm(trm, p)= let p -> [ctrltxt np] in let getEdCtrlTextLineValue ctrltxt -> val in cbUpdatePluginsSearchList nil val np; 0;; fun cbUpdatePluginsSearchListAsync(ctrltxt, val, p)= let p -> [resultlist ctrladd trm] in ( if (trm == nil) then nil else _deltimer trm; mutate p <- [_ _ (_rfltimer _starttimer _channel 200 @cbUpdatePluginsSearchListTrm [ctrltxt p])]; ); 0;; fun cbSelectPluginsSearchAdd(ctrlist, pos, elem, lval, type, p)= let p -> [ctrladd [ctrlstr groupstr viewstr cx cy]] in ( if (elem == nil) then nil else cbAddPluginInstance nil [ctrlstr groupstr (getPluginByName elem) viewstr cx cy]; setEdCtrlButtonEnable ctrladd if (elem != nil) then 1 else 0; ); 0;; fun cbSelectPluginsSearch(ctrlist, pos, elem, lval, type, ctrladd)= setEdCtrlButtonEnable ctrladd if (elem != nil) then 1 else 0; 0;; fun cbPluginsSearchAdd(ctrlbtn, p)= let p -> [resultlist [ctrlstr groupstr viewstr cx cy]] in let getSelectedEdCtrlList resultlist -> [elem _ _] in if (elem == nil) then nil else cbAddPluginInstance nil [ctrlstr groupstr (getPluginByName elem) viewstr cx cy]; 0;; fun cbSearchPlugIts(mitem, p)= let [400 325] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let 10 -> ypos in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let setEdWindowIcon (crEdModalDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU|WN_SIZEBOX nil (loc "OS3D_0802")) sWinDlgIcon -> winstr in let crEdCtrlLabel winstr 10 ypos + 2 120 20 (loc "OS3D_0803") nil -> labeltype in let crEdCtrlTextLine winstr 140 ypos (iw - 150) 20 "" nil EDWIN_RESIZE_MW -> ctrlsearch in let crEdCtrlList winstr 10 (set ypos = ypos + 25) (iw - 20) (ih - 70) nil EDWIN_RESIZE_MW|EDWIN_RESIZE_MH -> resultlist in let crEdCtrlButton winstr (iw - 130) (ih - 30) 120 20 (loc "OS3D_0804") EDWIN_RESIZE_LW|EDWIN_RESIZE_LH -> ctrladd in let [resultlist ctrladd nil] -> asp in ( setEdWindowMinimumSize winstr 250 150; setEdCtrlTextLineCbValidate ctrlsearch mkfun3 @cbUpdatePluginsSearchList asp; setEdCtrlTextLineCbChange ctrlsearch mkfun3 @cbUpdatePluginsSearchListAsync asp; setEdCtrlListCbDbClick resultlist mkfun6 @cbSelectPluginsSearchAdd [ctrladd p]; setEdCtrlListCbClick resultlist mkfun6 @cbSelectPluginsSearch ctrladd; setEdCtrlButtonCb ctrladd mkfun2 @cbPluginsSearchAdd [resultlist p]; setEdctrlTextLineFocus ctrlsearch; setEdCtrlButtonEnable ctrladd 0; ); 0;; fun loadOsPlugins(groupstr)= let XMLgetMarkByValueFromMarkSons groupstr.GRP_xmlMark "PLUGINS" -> pluginsmark in if pluginsmark == nil then nil else ( let XMLgetMarksByValueFromMarkSons pluginsmark "PLUGIN" -> lpluginmarks in let sizelist lpluginmarks -> size1 in let 0 -> i1 in while i1 < size1 do ( let nth_list lpluginmarks i1 -> pluginmark in let XMLgetParam pluginmark "name" -> plugname in let XMLgetParam pluginmark "source" -> plugsource in let strcatn sPLUGINSPATH::"/"::plugsource::nil -> pluginfile in let getPluginByFile pluginfile -> plugstr in ( if plugstr != nil && !plugstr.PLUG_bHasError then nil else ( //XMLdelMark xmlEditSceneFile pluginmark; addLogMessage strcatn (strcat (loc "OS3D_0143") " ")::plugname::" : "::plugsource::" "::(loc "OS3D_0005")::nil; 0; ); let XMLgetMarksByValueFromMarkSons pluginmark "INSTANCE" -> linstancemarks in let sizelist linstancemarks -> size2 in let 0 -> i2 in while i2 < size2 do ( let nth_list linstancemarks i2 -> instancemark in loadOsInstanceMark groupstr pluginmark instancemark; set i2 = i2 + 1; ); ); set i1 = i1 + 1; ); // sort group box menu let getEdCtrlModuleEditorBoxByName mainInterf.MINT_meGroups groupstr.GRP_sName -> grpboxstr in sortEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr; loadPluginInstances groupstr bAppPlay; refreshAllInterfLinks 0; ); 0;; fun loadOsInstances(groupstr)= let XMLgetMarkByValueFromMarkSons groupstr.GRP_xmlMark "PLUGINS" -> pluginsmark in if pluginsmark == nil then nil else ( let XMLgetMarksByValueFromMarkSons pluginsmark "PLUGIN" -> lpluginmarks in let sizelist lpluginmarks -> size1 in let 0 -> i1 in while i1 < size1 do ( let nth_list lpluginmarks i1 -> pluginmark in let XMLgetParam pluginmark "name" -> plugname in let XMLgetParam pluginmark "source" -> plugsource in let strcatn sPLUGINSPATH::"/"::plugsource::nil -> pluginfile in let getPluginByFile pluginfile -> plugstr in ( if plugstr != nil && !plugstr.PLUG_bHasError then nil else addLogMessage strcatn (strcat (loc "OS3D_0143") " ")::plugname::" : "::plugsource::" "::(loc "OS3D_0005")::nil; let XMLgetMarksByValueFromMarkSons pluginmark "INSTANCE" -> linstancemarks in let sizelist linstancemarks -> size2 in let 0 -> i2 in while i2 < size2 do ( let nth_list linstancemarks i2 -> instancemark in loadOsGroupInstanceMark groupstr pluginmark instancemark; set i2 = i2 + 1; ); ); set i1 = i1 + 1; ); refreshLinks groupstr.GRP_mePlugins groupstr.GRP_lLinks nil; // repaint paintEdCtrlModuleEditor groupstr.GRP_mePlugins; ); 0;; fun updateOsGroupsInstances(groupstr)= let XMLgetMarkByValueFromMarkSons groupstr.GRP_xmlMark "PLUGINS" -> pluginsmark in if pluginsmark == nil then nil else ( let XMLgetMarksByValueFromMarkSons pluginsmark "PLUGIN" -> lpluginmarks in let sizelist lpluginmarks -> size1 in let 0 -> i1 in while i1 < size1 do ( let nth_list lpluginmarks i1 -> pluginmark in let XMLgetParam pluginmark "name" -> plugname in let XMLgetParam pluginmark "source" -> plugsource in let strcatn sPLUGINSPATH::"/"::plugsource::nil -> pluginfile in let getPluginByFile pluginfile -> plugstr in ( if plugstr != nil && !plugstr.PLUG_bHasError then nil else addLogMessage strcatn (strcat (loc "OS3D_0143") " ")::plugname::" : "::plugsource::" "::(loc "OS3D_0005")::nil; let XMLgetMarksByValueFromMarkSons pluginmark "INSTANCE" -> linstancemarks in let sizelist linstancemarks -> size2 in let 0 -> i2 in while i2 < size2 do ( let nth_list linstancemarks i2 -> instancemark in updateOsGroupInstanceMark groupstr pluginmark instancemark; set i2 = i2 + 1; ); ); set i1 = i1 + 1; ); ); 0;; fun cbRefreshSelectedPlugits(mitem, ctrlstr)= addLogMessage (loc "OS3D_0328"); resetTemplateMenus; let getEdCtrlModuleEditorSelectedBox ctrlstr -> lmboxstr in let nil -> lplugins in ( let mainInterf.MINT_lInstanceConfig -> leditorwin in while (leditorwin != nil) do ( let hd leditorwin -> [_ winstr] in dsEdWindow winstr; set leditorwin = tl leditorwin; ); while (lmboxstr != nil) do ( let hd lmboxstr -> mboxstr in let (hd tl mboxstr.EDB_lParams) -> plugname in let (hd tl tl mboxstr.EDB_lParams) -> plugfile in let getPluginByFile plugfile -> plugstr in set lplugins = [plugname plugstr]::lplugins; set lmboxstr = tl lmboxstr; ); destroyAllPluginInstances; set currentProject.PRJ_bPluginsLoaded = 0; unloadPluginsRec lplugins; loadPluginsRec lplugins; let sizelist lGroups -> size in let 0 -> i in while i < size do ( let nth_list lGroups i -> [_ groupstr] in ( loadPluginInstances groupstr 0; updateOsGroupsInstances groupstr; ); set i = i + 1; ); refreshAllInterfLinks 0; paintEdCtrlModuleEditor mainInterf.MINT_meGroups; let sizelist lGroups -> size in let 0 -> i in while i < size do ( let nth_list lGroups i -> [_ groupstr] in ( refreshLinks groupstr.GRP_mePlugins groupstr.GRP_lLinks nil; // repaint links paintEdCtrlModuleEditor groupstr.GRP_mePlugins; ); set i = i + 1; ); paintEdCtrlModuleEditor ctrlstr; if !bAppPlay then nil else startAllPluginInstances currentProject; ); addLogMessage (loc "OS3D_0042"); 0;; fun cbRefreshPlugits(mitem, ctrlstr)= addLogMessage (loc "OS3D_0328"); resetTemplateMenus; let mainInterf.MINT_lInstanceConfig -> leditorwin in while (leditorwin != nil) do ( let hd leditorwin -> [_ winstr] in dsEdWindow winstr; set leditorwin = tl leditorwin; ); reloadPluginsFromDir sPLUGINSPATH; set currentProject.PRJ_bPluginsLoaded = 0; let sizelist lGroups -> size in let 0 -> i in while i < size do ( let nth_list lGroups i -> [_ groupstr] in ( loadPluginInstances groupstr 0; updateOsGroupsInstances groupstr; ); set i = i + 1; ); refreshAllInterfLinks 0; paintEdCtrlModuleEditor mainInterf.MINT_meGroups; let sizelist lGroups -> size in let 0 -> i in while i < size do ( let nth_list lGroups i -> [_ groupstr] in ( refreshLinks groupstr.GRP_mePlugins groupstr.GRP_lLinks nil; // repaint links paintEdCtrlModuleEditor groupstr.GRP_mePlugins; ); set i = i + 1; ); paintEdCtrlModuleEditor ctrlstr; if !bAppPlay then nil else startAllPluginInstances currentProject; addLogMessage (loc "OS3D_0042"); 0;; fun deleteOsInstances(groupstr)= removeAllPluginInstanceFromGroup groupstr; /* let XMLgetMarkByValueFromMarkSons groupstr.GRP_xmlMark "PLUGINS" -> pluginsmark in if pluginsmark == nil then nil else ( let XMLgetMarksByValueFromMarkSons pluginsmark "PLUGIN" -> lpluginmarks in let sizelist lpluginmarks -> size1 in let 0 -> i1 in while i1 < size1 do ( let nth_list lpluginmarks i1 -> pluginmark in let XMLgetParam pluginmark "name" -> plugname in let XMLgetParam pluginmark "source" -> plugsource in let strcatn sPLUGINSPATH::"/"::plugsource::nil -> pluginfile in let getPluginByFile pluginfile -> plugstr in if plugstr == nil then nil else ( let XMLgetMarksByValueFromMark pluginmark "INSTANCE" -> linstancemarks in let sizelist linstancemarks -> size2 in let 0 -> i2 in while i2 < size2 do ( let nth_list linstancemarks i2 -> instancemark in let XMLgetParam instancemark "name" -> instname in deletePluginInstance plugstr strcatn groupstr.GRP_sName::"."::instname::nil; set i2 = i2 + 1; ); ); set i1 = i1 + 1; ); ); */ 0;; fun cbRenameOldLinksResource(elt, p)= let p -> [event action] in let elt -> [oldname newname] in mutate p <- [strreplace event oldname newname strreplace action oldname newname]; 0;; fun updatePluginInstancesOnImport(groupstr)= let XMLgetMarkByValueFromMarkSons groupstr.GRP_xmlMark "PLUGINS" -> pluginsmark in let XMLgetMarksByValueFromMarkSons pluginsmark "PLUGIN" -> lpluginmarks in let sizelist lpluginmarks -> size in let 0 -> i in while i < size do ( let nth_list lpluginmarks i -> pluginmark in let XMLgetParam pluginmark "name" -> plugname in let XMLgetParam pluginmark "source" -> plugsource in let strcatn sPLUGINSPATH::"/"::plugsource::nil -> pluginfile in let getPluginByFile pluginfile -> plugstr in let XMLgetMarksByValueFromMarkSons pluginmark "instance" -> linstmarks in let sizelist linstmarks -> size2 in let 0 -> i2 in while i2 < size2 do ( let nth_list linstmarks i2 -> instmark in ( let XMLgetMarksByValueFromMark instmark "param" -> lnodemark in while lnodemark != nil do ( let hd lnodemark -> paramark in let getPluginParam plugstr (XMLgetParam paramark "name") -> type in if !(type & iTypeNode || type & iTypeEntity || type & iTypeGroup || type & iTypeCamera || type & iTypeLight || type & iTypeAnim || type & iTypeParticle || type & iTypeBone) then nil else let XMLgetData paramark -> oldname in let switchstri lTmpFunctionsImport oldname -> newname in //let addLogMessage strcatn "Import "::oldname::" to "::newname::nil -> _ in if (oldname == nil) || (newname == nil) then nil else XMLsetData paramark newname; set lnodemark = tl lnodemark; ); // update group links let XMLgetMarksByValueFromMarkSons instmark "link" -> llinkmarks in let sizelist llinkmarks -> size3 in let 0 -> i3 in while i3 < size3 do ( let nth_list llinkmarks i3 -> linkmark in let XMLgetParam linkmark "group" -> oldname in let switchstri lTmpLinksImport oldname -> newname in let XMLgetParam linkmark "event" -> event in let XMLgetParam linkmark "action" -> action in let [event action] -> np in ( apply_on_list lTmpFunctionsImport @cbRenameOldLinksResource np; if newname == nil then nil else XMLsetParam linkmark "group" newname; let np -> [event action] in ( XMLsetParam linkmark "event" event; XMLsetParam linkmark "action" action; ); ); set i3 = i3 + 1; ); ); set i2 = i2 + 1; ); set i = i + 1; ); 0;; fun removeInstanceLinks(ctrlstr, lrlinkstr)= if (lrlinkstr == nil) then nil else let lrlinkstr -> [rlinkstr next] in ( let rlinkstr.EDRL_lLinks -> l in let sizelist l -> size in let 0 -> i in let nil -> refreshgrp in ( while i < size do ( let nth_list l i -> linkstr in let getGroupByName (hd linkstr.EDL_lParams) -> groupstr in let getLinkByLinkParams mainInterf.MINT_meGroups (getString2Link(linkstr.EDL_sParams))::linkstr.EDL_lParams -> glinkstr in let getGroupLinkFromLink mainInterf.MINT_lLinks glinkstr -> grpglinkstr in let getLinkByLinkParams groupstr.GRP_mePlugins (getString2Link(linkstr.EDL_sParams))::linkstr.EDL_lParams -> clinkstr in let getGroupLinkFromListByMark groupstr.GRP_lLinks grpglinkstr.GRPL_xmlMark -> grplinkstr in let (hd tl linkstr.EDL_lParams) -> instname in let XMLgetParam grpglinkstr.GRPL_xmlMark "event" -> event in let XMLgetParam grpglinkstr.GRPL_xmlMark "group" -> destgroup in let XMLgetParam grpglinkstr.GRPL_xmlMark "instance" -> destinst in let XMLgetParam grpglinkstr.GRPL_xmlMark "action" -> action in let getString2Link (XMLgetData grpglinkstr.GRPL_xmlMark) -> value in ( //set refreshgrp = quicksort groupstr::refreshgrp @suppDoublon2; set refreshgrp = groupstr::refreshgrp; // remove link from group tab set mainInterf.MINT_lLinks = remove_from_list mainInterf.MINT_lLinks grpglinkstr; dsEdCtrlModuleEditorLink mainInterf.MINT_meGroups glinkstr 1; dsEdCtrlModuleEditorLink groupstr.GRP_mePlugins clinkstr 1; delModLink (getDMI strcatn groupstr.GRP_sName::"."::instname::nil) strbuild ((strcatn groupstr.GRP_sName::"."::instname::"."::event::nil)::(strcatn destgroup::"."::destinst::"."::action::nil)::value::"_"::"_"::nil)::nil; XMLdelMark xmlEditSceneFile grpglinkstr.GRPL_xmlMark; set groupstr.GRP_lLinks = remove_from_list groupstr.GRP_lLinks grplinkstr; ); set i = i + 1; ); //restore previous plugits selection while (ctrlstr.EDC_modulesEditor.EDM_lastSelectedBox != nil) do ( let hd ctrlstr.EDC_modulesEditor.EDM_lastSelectedBox -> mboxstr in chkCtrlModuleEditorBox ctrlstr mboxstr 1 0; set ctrlstr.EDC_modulesEditor.EDM_lastSelectedBox = tl ctrlstr.EDC_modulesEditor.EDM_lastSelectedBox; ); while refreshgrp != nil do ( let hd refreshgrp -> pgroupstr in paintEdCtrlModuleEditor pgroupstr.GRP_mePlugins; set refreshgrp = tl refreshgrp; ); ); removeInstanceLinks ctrlstr next; ); paintEdCtrlModuleEditor mainInterf.MINT_meGroups; 0;; fun removeInstance(ctrlstr, mboxstr)= let (hd mboxstr.EDB_lParams) -> groupname in let (hd tl mboxstr.EDB_lParams) -> plugname in let (hd tl tl mboxstr.EDB_lParams) -> plugfile in let mboxstr.EDB_sName -> instname in let getPluginByFile plugfile -> plugstr in let getGroupByName groupname -> groupstr in let XMLgetMarkByValueFromMarkSons groupstr.GRP_xmlMark "plugins" -> plugsmark in let XMLgetMarkByValueAndParamValueFromMark plugsmark "plugin" "source" (substr plugfile ((strlen sPLUGINSPATH) + 1) 1024) -> pluginmark in let XMLgetMarkByValueAndParamValueFromMark pluginmark "instance" "name" instname -> instmark in ( let switch mainInterf.MINT_lInstanceConfig mboxstr -> winstr in ( dsEdWindow winstr; set mainInterf.MINT_lInstanceConfig = G2DremoveEdIdxFromList mainInterf.MINT_lInstanceConfig mboxstr; ); // remove instance event and actions from menu let getEdCtrlModuleEditorBoxByName mainInterf.MINT_meGroups groupname -> grpboxstr in ( delEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 0 instname nil; delEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr 1 instname nil; ); // Delete links with instname in destinstance let getGroupLinkFromByDestInstanceName groupname instname -> ldestlinks in ( let sizelist ldestlinks -> size in let 0 -> i in while i < size do ( let nth_list ldestlinks i -> linkstr in let getGroupByName linkstr.GRPL_sSrcGroup -> grpstr in let XMLgetParam linkstr.GRPL_xmlMark "event" -> event in let XMLgetParam linkstr.GRPL_xmlMark "group" -> destgroup in let XMLgetParam linkstr.GRPL_xmlMark "instance" -> destinst in let XMLgetParam linkstr.GRPL_xmlMark "action" -> action in let getString2Link (XMLgetData linkstr.GRPL_xmlMark) -> value in ( delModLink (getDMI strcatn linkstr.GRPL_sSrcGroup::"."::linkstr.GRPL_sSrcInst::nil) strbuild ((strcatn linkstr.GRPL_sSrcGroup::"."::linkstr.GRPL_sSrcInst::"."::event::nil)::(strcatn destgroup::"."::destinst::"."::action::nil)::value::"_"::"_"::nil)::nil; dsEdCtrlModuleEditorLink mainInterf.MINT_meGroups linkstr.GRPL_strLink 0; set mainInterf.MINT_lLinks = remove_from_list mainInterf.MINT_lLinks linkstr; let getGroupLinkFromListByMark grpstr.GRP_lLinks linkstr.GRPL_xmlMark -> grplinkstr in ( dsEdCtrlModuleEditorLink grpstr.GRP_mePlugins grplinkstr.GRPL_strLink 0; set grpstr.GRP_lLinks = remove_from_list grpstr.GRP_lLinks grplinkstr; ); XMLdelMark xmlEditSceneFile linkstr.GRPL_xmlMark; ); set i = i + 1; ); ); // Delete links in groups str let XMLgetMarksByValueFromMarkSons instmark "link" -> llinkmarks in let sizelist llinkmarks -> size in let 0 -> i in while i < size do ( let nth_list llinkmarks i -> linkmark in ( let getGroupLinkFromGroupListByMark linkmark -> grplinkstr in let getGroupByName grplinkstr.GRPL_sSrcGroup -> grpstr in ( set grpstr.GRP_lLinks = remove_from_list grpstr.GRP_lLinks grplinkstr; let XMLgetParam linkmark "event" -> event in let XMLgetParam linkmark "group" -> destgroup in let XMLgetParam linkmark "instance" -> destinst in let XMLgetParam linkmark "action" -> action in let getString2Link (XMLgetData linkmark) -> value in delModLink (getDMI strcatn grplinkstr.GRPL_sSrcGroup::"."::grplinkstr.GRPL_sSrcInst::nil) strbuild ((strcatn grplinkstr.GRPL_sSrcGroup::"."::grplinkstr.GRPL_sSrcInst::"."::event::nil)::(strcatn destgroup::"."::destinst::"."::action::nil)::value::"_"::"_"::nil)::nil; ); let getGroupLinkFromListByMark mainInterf.MINT_lLinks linkmark -> grplinkstr in ( dsEdCtrlModuleEditorLink mainInterf.MINT_meGroups grplinkstr.GRPL_strLink 0; set mainInterf.MINT_lLinks = remove_from_list mainInterf.MINT_lLinks grplinkstr; ); ); set i = i + 1; ); deletePluginInstance plugstr strcatn groupname::"."::instname::nil 1; XMLdelMark xmlEditSceneFile instmark; // if no more plugin instance then we remove the plugin mark if (XMLgetMarksByValueFromMarkSons pluginmark "instance") != nil then nil else XMLdelMark xmlEditSceneFile pluginmark; dsEdCtrlModuleEditorBox ctrlstr mboxstr; ); 0;; fun cbDlgInstanceLinksRemove(dlg, p, ret)= if !ret then nil else let p -> [ctrlstr lrlinkstr] in removeInstanceLinks ctrlstr lrlinkstr; 0;; fun cbDlgInstanceRemove(dlg, p, ret)= let p -> [ctrlstr lmboxstr] in if !ret then nil else ( let sizelist lmboxstr -> size in let 0 -> i in while i < size do ( let nth_list lmboxstr i -> mboxstr in removeInstance ctrlstr mboxstr; set i = i + 1; ); let getEdCtrlModuleEditorSelectedRoundLink ctrlstr -> lrlinkstr in removeInstanceLinks ctrlstr lrlinkstr; paintEdCtrlModuleEditor ctrlstr; paintEdCtrlModuleEditor mainInterf.MINT_meGroups; ); 0;; fun refreshWinLinks(ctrllist, ctrltext, rlinkstr)= resetEdCtrlList ctrllist; setEdCtrlEditTextEnable ctrltext 0; setEdCtrlEditTextEnable ctrltext 0; setEdCtrlEditTextCbChange ctrltext nil; setEdCtrlEditTextValue ctrltext nil; let sizelist rlinkstr.EDRL_lLinks -> size in let 0 -> i in while i < size do ( let nth_list rlinkstr.EDRL_lLinks i -> linkstr in let nth_list linkstr.EDL_lParams 0 -> grpsrcname in let nth_list linkstr.EDL_lParams 1 -> instsrcname in let nth_list linkstr.EDL_lParams 2 -> actsrcname in let nth_list linkstr.EDL_lParams 3 -> grpdstname in let nth_list linkstr.EDL_lParams 4 -> instdstname in let nth_list linkstr.EDL_lParams 5 -> actdstname in ( addEdCtrlList ctrllist strcatn grpsrcname::"."::instsrcname::"."::actsrcname::" -> "::grpdstname::"."::instdstname::"."::actdstname::nil (getString2Link(linkstr.EDL_sParams))::grpsrcname::instsrcname::actsrcname::grpdstname::instdstname::actdstname::nil nil; ); set i = i + 1; ); 0;; fun cbBtnDestroyWinLinks(winstr, rlinkstr)= set mainInterf.MINT_lLinksConfig = G2DremoveEdIdxFromList mainInterf.MINT_lLinksConfig rlinkstr; 0;; fun cbGroupModuleLinksDestroy(ctrlstr, rlinkstr)= let switch mainInterf.MINT_lLinksConfig rlinkstr -> [winstr _ _] in dsEdWindow winstr; set mainInterf.MINT_lLinksConfig = G2DremoveEdIdxFromList mainInterf.MINT_lLinksConfig rlinkstr; 0;; fun cbGroupModuleLinksUpdate(ctrlstr, rlinkstr)= let nil -> bubble in ( let sizelist rlinkstr.EDRL_lLinks -> size in let 0 -> i in while i < size && i < 10 do ( let nth_list rlinkstr.EDRL_lLinks i -> linkstr in let nth_list linkstr.EDL_lParams 0 -> grpsrcname in let nth_list linkstr.EDL_lParams 1 -> instsrcname in let nth_list linkstr.EDL_lParams 2 -> actsrcname in let nth_list linkstr.EDL_lParams 3 -> grpdstname in let nth_list linkstr.EDL_lParams 4 -> instdstname in let nth_list linkstr.EDL_lParams 5 -> actdstname in ( if bubble == nil then set bubble = strcatnSep (strcatn grpsrcname::"."::instsrcname::"."::actsrcname::" -> "::grpdstname::"."::instdstname::"."::actdstname::nil)::nil "\n" else if i == 9 && size > 10 then set bubble = strcatnSep bubble::(strcatn grpsrcname::"."::instsrcname::"."::actsrcname::" -> "::grpdstname::"."::instdstname::"."::actdstname::nil)::"[...]"::nil "\n" else set bubble = strcatnSep bubble::(strcatn grpsrcname::"."::instsrcname::"."::actsrcname::" -> "::grpdstname::"."::instdstname::"."::actdstname::nil)::nil "\n"; ); set i = i + 1; ); setEdCtrlModuleEditorRoundLinkTooltip ctrlstr rlinkstr bubble; ); let switch mainInterf.MINT_lLinksConfig rlinkstr -> [winstr ctrllist ctrltext] in refreshWinLinks ctrllist ctrltext rlinkstr; 0;; fun cbLinkChangeParam(ctrlstr, value, applybtn)= setEdCtrlButtonEnable applybtn 1; 0;; fun cbApplyLinkParam(btnstr, p)= let p -> [ctrllist ctrlselectvalues ctrltext applybtn deletebtn rlinkstr linkstr viewstr] in let getEdCtrlEditTextValue ctrltext -> value in let nth_list linkstr.EDL_lParams 0 -> grpsrcname in let nth_list linkstr.EDL_lParams 1 -> instsrcname in let nth_list linkstr.EDL_lParams 2 -> actsrcname in let nth_list linkstr.EDL_lParams 3 -> grpdstname in let nth_list linkstr.EDL_lParams 4 -> instdstname in let nth_list linkstr.EDL_lParams 5 -> actdstname in let getGroupByName grpsrcname -> groupstr in let getLinkByLinkParams mainInterf.MINT_meGroups (getString2Link(linkstr.EDL_sParams))::linkstr.EDL_lParams -> glinkstr in let getGroupLinkFromLink mainInterf.MINT_lLinks glinkstr -> grpglinkstr in let getLinkByLinkParams groupstr.GRP_mePlugins (getString2Link(linkstr.EDL_sParams))::linkstr.EDL_lParams -> clinkstr in let getGroupLinkFromListByMark groupstr.GRP_lLinks grpglinkstr.GRPL_xmlMark -> grplinkstr in let strbuild ((strcatn grpsrcname::"."::instsrcname::"."::actsrcname::nil)::(strcatn grpdstname::"."::instdstname::"."::actdstname::nil)::(getString2Link linkstr.EDL_sParams)::"_"::"_"::nil)::nil -> oldlink in let strbuild ((strcatn grpsrcname::"."::instsrcname::"."::actsrcname::nil)::(strcatn grpdstname::"."::instdstname::"."::actdstname::nil)::(getString2Link value)::"_"::"_"::nil)::nil -> newlink in // set link if !(setModLink (getDMI strcatn grpsrcname::"."::instsrcname::nil) (getDMI strcatn grpdstname::"."::instdstname::nil) oldlink newlink) then ( _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") (loc "OS3D_0124") 0; 0; ) else ( set glinkstr.EDL_sParams = value; set clinkstr.EDL_sParams = value; XMLsetData grpglinkstr.GRPL_xmlMark value; //add resource if ((_checkpack strtrim value) == nil) then nil else let getGroupByName grpdstname -> groupstr in ( addResourceFile viewstr groupstr.GRP_xmlMark (strtrim value) nil; ); refreshWinLinks ctrllist ctrltext rlinkstr; selectEdCtrlListByParams ctrllist (getString2Link(linkstr.EDL_sParams))::grpsrcname::instsrcname::actsrcname::grpdstname::instdstname::actdstname::nil; setEdCtrlButtonEnable deletebtn 1; setEdCtrlButtonEnable applybtn 0; setEdCtrlEditTextValue ctrltext linkstr.EDL_sParams; setEdCtrlEditTextCbChange ctrltext mkfun3 @cbLinkChangeParam applybtn; setEdCtrlEditTextEnable ctrltext 1; 0; ); 0;; fun cbDeleteLink(btnstr, p)= let p -> [mectrlstr ctrllist ctrlselectvalues ctrltext applybtn deletebtn rlinkstr viewstr linkstr pos] in let nth_list linkstr.EDL_lParams 0 -> grpsrcname in let nth_list linkstr.EDL_lParams 1 -> instsrcname in let nth_list linkstr.EDL_lParams 2 -> actsrcname in let nth_list linkstr.EDL_lParams 3 -> grpdstname in let nth_list linkstr.EDL_lParams 4 -> instdstname in let nth_list linkstr.EDL_lParams 5 -> actdstname in let getGroupByName grpsrcname -> groupstr in let getLinkByLinkParams mainInterf.MINT_meGroups (getString2Link(linkstr.EDL_sParams))::linkstr.EDL_lParams -> glinkstr in let getGroupLinkFromLink mainInterf.MINT_lLinks glinkstr -> grpglinkstr in let getLinkByLinkParams groupstr.GRP_mePlugins (getString2Link(linkstr.EDL_sParams))::linkstr.EDL_lParams -> clinkstr in let getGroupLinkFromListByMark groupstr.GRP_lLinks grpglinkstr.GRPL_xmlMark -> grplinkstr in ( // remove link from group tab set mainInterf.MINT_lLinks = remove_from_list mainInterf.MINT_lLinks grpglinkstr; dsEdCtrlModuleEditorLink mainInterf.MINT_meGroups glinkstr 1; dsEdCtrlModuleEditorLink groupstr.GRP_mePlugins clinkstr 1; delModLink (getDMI strcatn grpsrcname::"."::instsrcname::nil) strbuild ((strcatn grpsrcname::"."::instsrcname::"."::actsrcname::nil)::(strcatn grpdstname::"."::instdstname::"."::actdstname::nil)::(getString2Link linkstr.EDL_sParams)::"_"::"_"::nil)::nil; XMLdelMark xmlEditSceneFile grpglinkstr.GRPL_xmlMark; set groupstr.GRP_lLinks = remove_from_list groupstr.GRP_lLinks grplinkstr; //refreshWinLinks ctrllist ctrltext rlinkstr; setEdCtrlButtonEnable deletebtn 0; fillEdCtrlSelect ctrlselectvalues nil; setEdCtrlSelectEnable ctrlselectvalues 0; setEdCtrlButtonEnable applybtn 0; //select next link selectEdCtrlListByPos ctrllist pos - 1; let getSelectedEdCtrlList2 ctrllist -> [npos nname nlval ntype] in cbSelectLinkInList ctrllist npos nname nlval ntype [mectrlstr ctrllist ctrlselectvalues ctrltext applybtn deletebtn rlinkstr viewstr]; paintEdCtrlModuleEditor groupstr.GRP_mePlugins; paintEdCtrlModuleEditor mainInterf.MINT_meGroups; ); 0;; fun cbSelectLinkInList(ctrlstr, pos, elem, lval, type, p)= let p -> [mectrlstr ctrllist ctrlselectvalues ctrltext applybtn deletebtn rlinkstr viewstr] in let getLinkByLinkParams mectrlstr lval -> linkstr in if linkstr == nil then ( setEdCtrlButtonEnable applybtn 0; setEdCtrlButtonEnable deletebtn 0; setEdCtrlEditTextEnable ctrltext 0; 0; ) else ( let nth_list linkstr.EDL_lParams 3 -> grpdstname in let nth_list linkstr.EDL_lParams 4 -> instdstname in let nth_list linkstr.EDL_lParams 5 -> actdstname in let getInstancePlugin (getInstanceByName strcatn grpdstname::"."::instdstname::nil) -> plugstr in let XMLload plugstr.PLUG_sFile -> pluginxmldef in let XMLgetMarkByValue pluginxmldef "PLUGIN" -> plugindefmark in let XMLgetMarkByValueFromMarkSons plugindefmark "CLIENT" -> clientdefmark in let XMLgetMarkByValueAndParamValueFromMarkSons clientdefmark "ACTION" "name" actdstname -> actiondefmark in let XMLgetMarksByValueFromMarkSons actiondefmark "ENUM" -> lenummarks in let (loc "OS3D_0448")::nil -> lenum in ( let sizelist lenummarks -> size in let 0 -> i in while i < size do ( let nth_list lenummarks i -> enummark in let XMLgetParam enummark "value" -> enum in let XMLgetParam enummark "type" -> stype in // Add enum types here let if (!strcmpi stype "SCHEMELIST") then (lcat lenum (getAllMaterialScheme viewstr)) else if (!strcmpi stype "FILE") then (lcat lenum (loc "OS3D_0587")::nil) else (lcat lenum enum::nil) -> nlist in set lenum = nlist; set i = i + 1; ); if lenummarks == nil then ( fillEdCtrlSelect ctrlselectvalues nil; setEdCtrlSelectEnable ctrlselectvalues 0; ) else ( fillEdCtrlSelect ctrlselectvalues lenum; setEdCtrlSelectEnable ctrlselectvalues 1; ); XMLclose pluginxmldef; ); setEdCtrlButtonEnable deletebtn 1; setEdCtrlButtonCb applybtn mkfun2 @cbApplyLinkParam [ctrllist ctrlselectvalues ctrltext applybtn deletebtn rlinkstr linkstr viewstr]; setEdCtrlButtonCb deletebtn mkfun2 @cbDeleteLink [mectrlstr ctrllist ctrlselectvalues ctrltext applybtn deletebtn rlinkstr viewstr linkstr pos]; setEdCtrlEditTextValue ctrltext linkstr.EDL_sParams; setEdCtrlEditTextCbChange ctrltext mkfun3 @cbLinkChangeParam applybtn; setEdCtrlEditTextEnable ctrltext 1; 0; ); 0;; fun cbSelectLinkKeyUp(ctrlstr, pos, name, lval, type, key, p)= if key != 339 then nil else //Suppr ( let p -> [mectrlstr ctrllist ctrlselectvalues ctrltext applybtn deletebtn rlinkstr viewstr] in let getLinkByLinkParams mectrlstr lval -> linkstr in cbDeleteLink nil [mectrlstr ctrllist ctrlselectvalues ctrltext applybtn deletebtn rlinkstr viewstr linkstr pos] ); 0;; fun cbDlgGetLinkParamPath(pfile, p)= let p -> [ctrltext applybtn] in ( if (pfile == nil) then nil else let _PtoScol pfile -> file in if (file == nil) then ( _DLGMessageBox _channel ctrltext.EDC_father.EDW_win (loc "OS3D_0572") (loc "OS3D_0472") 0; 0; ) else ( setEdCtrlEditTextValue ctrltext file; setEdCtrlButtonEnable applybtn 1; 0; ); ); 0;; fun cbSelectPlugItActionEnum(ctrlstr, pos, elem, p)= if !strcmp elem (loc "OS3D_0448") then nil else let p -> [winstr ctrltext applybtn] in ( if (!strcmp (loc "OS3D_0587") elem) then ( let _GETdesktopSize -> [sw sh] in let getEdWindowPos mainInterf.MINT_winMain -> [nx ny] in let getEdWindowSize mainInterf.MINT_winMain -> [nmw nmh] in let [750 450] -> [iw ih] in let crEdOpenFileDialog _channel winstr nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih "" ["All" "*.*"::nil]::["Bitmap" "bmp"::"jpg"::"png"::nil]::["OpenSpace3D scene" "xos"::"pkos"::"pak"::nil]::nil EDFILE_DIALOG_LIST_FOLDERS|EDFILE_DIALOG_SHOW_TOOLBAR nil sLastDirectory -> dlgfstr in ( setEdWindowIcon dlgfstr.EDFD_dialog sWinDlgIcon; setEdOpenFileDialogCb dlgfstr mkfun2 @cbDlgGetLinkParamPath [ctrltext applybtn]; 0; ); 0; ) else ( setEdCtrlEditTextValue ctrltext elem; setEdCtrlButtonEnable applybtn 1; 0; ); ); 0;; fun cbGroupModuleLinksDbClick(ctrlstr, rlinkstr, btn, mask, viewstr)= let (switch mainInterf.MINT_lLinksConfig rlinkstr) -> [winstr _ _] in if winstr != nil then ( setEdWindowFocus winstr; 0; ) else ( let _GETWorkingAreaSize -> [sw _] in let _GETdesktopSize -> [_ sh] in let _GETscreenPos -> [mx my] in let [mx + 10 my - 10] -> [mx my] in let [400 400] -> [iw ih] in let 40 -> hmargin in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih + hmargin) > sh) then max 0 ((sh - ih) - hmargin) else my)] -> [x y] in let setEdWindowIcon (crEdWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU|WN_SIZEBOX nil nil (loc "OS3D_0128")) sWinDlgIcon -> winstr in let crEdCtrlList winstr 10 10 (iw - 20) 180 nil EDWIN_RESIZE_MW|EDWIN_RESIZE_MH -> ctrllist in let crEdCtrlLabel winstr 10 197 90 20 (loc "OS3D_0449") EDWIN_RESIZE_LH -> labelvalue in let crEdCtrlSelect winstr 105 195 (iw - 115) 120 EDWIN_RESIZE_MW|EDWIN_RESIZE_LH -> ctrlselectvalues in let crEdCtrlEditText winstr 10 225 (iw - 20) 120 nil ET_BORDER|ET_AVSCROLL|ET_AHSCROLL|ET_VSCROLL|ET_HSCROLL|ET_TABFOCUS EDWIN_RESIZE_MW|EDWIN_RESIZE_LH -> ctrltext in let crEdCtrlButton winstr 10 (ih - 30) 90 20 (loc "OS3D_0051") EDWIN_RESIZE_LH|EDWIN_RESIZE_RW -> applybtn in let crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0115") EDWIN_RESIZE_LH|EDWIN_RESIZE_LW -> deletebtn in ( setEdwindowCbKeyUp winstr mkfun3 @cbIntanceKeyUp winstr; setEdCtrlButtonEnable applybtn 0; setEdCtrlButtonEnable deletebtn 0; setEdCtrlSelectEnable ctrlselectvalues 0; setEdCtrlEditTextEnable ctrltext 0; setEdwindowCbDestroy winstr mkfun2 @cbBtnDestroyWinLinks rlinkstr; refreshWinLinks ctrllist ctrltext rlinkstr; setEdCtrlListCbClick ctrllist mkfun6 @cbSelectLinkInList [ctrlstr ctrllist ctrlselectvalues ctrltext applybtn deletebtn rlinkstr viewstr]; setEdCtrlListCbKeyUp ctrllist mkfun7 @cbSelectLinkKeyUp [ctrlstr ctrllist ctrlselectvalues ctrltext applybtn deletebtn rlinkstr viewstr]; setEdCtrlSelectCb ctrlselectvalues mkfun4 @cbSelectPlugItActionEnum [winstr ctrltext applybtn]; set mainInterf.MINT_lLinksConfig = [rlinkstr [winstr ctrllist ctrltext]]::mainInterf.MINT_lLinksConfig; ); 0; ); 0;; fun copySelectedInstances(ctrlstr)= let XMLcreate nil nil -> instanceClipBoard in ( let XMLaddMark instanceClipBoard "plugins" nil nil nil -> nplugsmark in let getEdCtrlModuleEditorSelectedBox ctrlstr -> lmboxstr in let sizelist lmboxstr -> size in let 0 -> i in while (i < size) do ( let nth_list lmboxstr i -> mboxstr in let (hd mboxstr.EDB_lParams) -> groupname in let (hd tl mboxstr.EDB_lParams) -> plugname in let (hd tl tl mboxstr.EDB_lParams) -> plugfile in let mboxstr.EDB_sName -> instname in let getGroupByName groupname -> groupstr in let XMLgetMarkByValueFromMarkSons groupstr.GRP_xmlMark "plugins" -> plugsmark in let XMLgetMarkByValueAndParamValueFromMark plugsmark "plugin" "source" (substr plugfile ((strlen sPLUGINSPATH) + 1) 1024) -> pluginmark in let XMLgetParam pluginmark "source" -> plugfile in let XMLgetMarkByValueAndParamValueFromMark pluginmark "instance" "name" instname -> instmark in let XMLgetMarkByValueAndParamValueFromMark nplugsmark "PLUGIN" "name" plugname -> nplugmark in let if nplugmark != nil then nplugmark else (XMLaddMark instanceClipBoard "plugin" nplugsmark ["source" plugfile]::["name" plugname]::nil nil) -> nplugmark in let XMLcopyMark instanceClipBoard instmark nplugmark -> ninstmark in XMLdelMarksFromMarkByValue instanceClipBoard ninstmark "link"; set i = i + 1; ); let XMLaddMark instanceClipBoard "links" nil nil nil -> nlinksmark in let getEdCtrlModuleEditorSelectedRoundLink ctrlstr -> lrlinkstr in let sizelist lrlinkstr -> size in let 0 -> i in while (i < size) do ( let nth_list lrlinkstr i -> rlinkstr in let rlinkstr.EDRL_lLinks -> llinks in let sizelist llinks -> lsize in let 0 -> j in while (j < lsize) do ( let nth_list llinks j -> linkstr in let nth_list linkstr.EDL_lParams 0 -> grpsrcname in let nth_list linkstr.EDL_lParams 1 -> instsrcname in let nth_list linkstr.EDL_lParams 2 -> actsrcname in let nth_list linkstr.EDL_lParams 3 -> grpdstname in let nth_list linkstr.EDL_lParams 4 -> instdstname in let nth_list linkstr.EDL_lParams 5 -> actdstname in let linkstr.EDL_sParams -> param in XMLaddMark instanceClipBoard "fulllink" nlinksmark ["srcinst" instsrcname]::["srcevent" actsrcname]::["srcgroup" grpsrcname]::["dstinst" instdstname]::["dstaction" actdstname]::["dstgroup" grpdstname]::nil param; set j = j + 1; ); set i = i + 1; ); _SETclipBoardData XMLserialize instanceClipBoard; ); 0;; fun cutSelectedInstances(ctrlstr)= copySelectedInstances ctrlstr; // delete selected instances let getEdCtrlModuleEditorSelectedBox ctrlstr -> lmboxstr in if lmboxstr == nil then nil else ( let sizelist lmboxstr -> size in let 0 -> i in while i < size do ( let nth_list lmboxstr i -> mboxstr in removeInstance ctrlstr mboxstr; set i = i + 1; ); ); let getEdCtrlModuleEditorSelectedRoundLink ctrlstr -> lrlinkstr in if lrlinkstr == nil then nil else removeInstanceLinks ctrlstr lrlinkstr; paintEdCtrlModuleEditor ctrlstr; paintEdCtrlModuleEditor mainInterf.MINT_meGroups; 0;; fun getValidClipBoard()= let XMLloadString _GETclipBoardData -> xmlclip in if xmlclip == nil then nil else if ((XMLgetMarkByValue xmlclip "plugins") == nil) then nil else xmlclip;; fun getClipLinksFromInstance(linksmark, from)= let XMLgetMarksByValueFromMarkSons linksmark "fulllink" -> llinkmark in let nil -> llinks in ( while (llinkmark != nil) do ( let hd llinkmark -> linkmark in let XMLgetParam linkmark "srcinst" -> srcinst in if (strcmp from srcinst) then nil else set llinks = linkmark::llinks; set llinkmark = tl llinkmark; ); revertlist llinks; );; fun loadFromGroup(ctrlstr, groupstr, xmlstr, frompos, linkmode)= let if (frompos == nil) then [0 0] else let frompos -> [x y] in [(x / groupstr.GRP_mePlugins.EDC_modulesEditor.EDM_iSnap) (y / groupstr.GRP_mePlugins.EDC_modulesEditor.EDM_iSnap)] -> [xoff yoff] in let if (frompos == nil) then [0 0] else [10000000 10000000] -> [xbase ybase] in let XMLgetMarkByValue xmlstr "plugins" -> plugsmark in let XMLgetMarkByValue xmlstr "links" -> linksmark in let groupstr.GRP_xmlMark -> groupmark in let XMLgetMarkByValueFromMark groupmark "plugins" -> gplugsmarks in let atoi (getConfigParamDef "OS3Duser" "plugits_user_level" "1") -> userlevel in let nil -> ltocopy in if (plugsmark == nil) then nil else ( //reset selection chkCtrlModuleEditorBox ctrlstr nil 0 0; chkCtrlModuleEditorRoundLink ctrlstr nil 0 0; //get the minimum instance pos if (frompos == nil) then nil else let XMLgetMarksByValueFromMarkSons plugsmark "plugin" -> lplugmarks in while (lplugmarks != nil) do ( let hd lplugmarks -> plugmark in ( let XMLgetMarksByValueFromMarkSons plugmark "instance" -> linstmarks in while (linstmarks != nil) do ( let hd linstmarks -> instmark in ( set xbase = min (atoi (XMLgetParam instmark "px")) xbase; set ybase = min (atoi (XMLgetParam instmark "py")) ybase; ); set linstmarks = tl linstmarks; ); ); set lplugmarks = tl lplugmarks; ); //TODO SKIP / COPY / MERGE // Get instances to copy with new name let XMLgetMarksByValueFromMarkSons plugsmark "plugin" -> lplugmarks in while (lplugmarks != nil) do ( let hd lplugmarks -> plugmark in let XMLgetParam plugmark "name" -> plugname in let XMLgetParam plugmark "source" -> plugfile in let XMLgetMarksByValueFromMarkSons plugmark "instance" -> linstmarks in let XMLgetMarkByValueAndParamValueFromMarkSons gplugsmarks "plugin" "name" plugname -> gplugmark in let if (gplugmark != nil) then gplugmark else (XMLaddMark xmlEditSceneFile "plugin" gplugsmarks ["source" plugfile]::["name" plugname]::nil nil) -> gplugmark in while (linstmarks != nil) do ( let hd linstmarks -> instmark in let XMLgetParam instmark "name" -> instname in let instname -> instnamecopy in ( let 1 -> i in while (XMLgetMarkByValueAndParamValueFromMark gplugsmarks "instance" "name" instname) != nil do ( set instname = strcatn instnamecopy::" ("::(itoa i)::")"::nil; set i = i + 1; ); XMLsetParam instmark "px" itoa ((atoi (XMLgetParam instmark "px")) + xoff - xbase); XMLsetParam instmark "py" itoa ((atoi (XMLgetParam instmark "py")) + yoff - ybase); set ltocopy = [instnamecopy [instname gplugmark instmark]]::ltocopy; ); set linstmarks = tl linstmarks; ); set lplugmarks = tl lplugmarks; ); // Copy and enable instances in scene let sizelist ltocopy -> size in let 0 -> i in let nil -> lnewinst in while i < size do ( let nth_list ltocopy i -> [instnamecopy [instname gplugmark instmark]] in ( let XMLcopyMark xmlEditSceneFile instmark gplugmark -> ninstmark in ( XMLsetParam ninstmark "name" instname; if (!linkmode) then ( // Get instances links and change link destination if the plugIT instance is in clipboard let getClipLinksFromInstance linksmark instnamecopy -> llinkmarks in let sizelist llinkmarks -> size in let 0 -> u in while (u < size) do ( let nth_list llinkmarks u -> linkmark in ( let XMLgetParam linkmark "dstinst" -> dstinst in let switchstr ltocopy dstinst -> pcopy in if pcopy != nil then ( let pcopy -> [ninstname gplugmark instmark] in ( XMLsetParam linkmark "dstinst" ninstname; XMLsetParam linkmark "dstgroup" groupstr.GRP_sName; ); 0; ) else if ((getInstanceByName strcatn groupstr.GRP_sName::"."::dstinst::nil) != nil) then ( XMLsetParam linkmark "dstgroup" groupstr.GRP_sName; 0; ) else ( //addLogMessage strcat "> Del link to : " dstinst; XMLsetParam linkmark "dstinst" ""; 0; ); let XMLgetParam linkmark "dstinst" -> dstinst in if (!strcmp dstinst "") then nil else ( let XMLgetParam linkmark "dstgroup" -> dstgroup in let XMLgetParam linkmark "srcevent" -> srcevent in let XMLgetParam linkmark "dstaction" -> dstaction in let XMLgetData linkmark -> data in XMLaddMark xmlEditSceneFile "link" ninstmark ["event" srcevent]::["group" dstgroup]::["instance" dstinst]::["action" dstaction]::nil data; ); XMLdelMark xmlstr linkmark; ); set u = u + 1; ); ) else ( // Get instances links and change link destination if the plugIT instance is in clipboard let XMLgetMarksByValueFromMark ninstmark "LINK" -> llinkmarks in let sizelist llinkmarks -> size in let 0 -> u in while (u < size) do ( let nth_list llinkmarks u -> linkmark in let XMLgetParam linkmark "instance" -> dstinst in let switchstr ltocopy dstinst -> pcopy in if pcopy != nil then ( let pcopy -> [ninstname gplugmark instmark] in ( XMLsetParam linkmark "instance" ninstname; XMLsetParam linkmark "group" groupstr.GRP_sName; ); 0; ) else if ((getInstanceByName strcatn groupstr.GRP_sName::"."::dstinst::nil) == nil) then ( //addLogMessage strcat "> Del link to : " dstinst; XMLdelMark xmlEditSceneFile linkmark; 0; ) else nil; set u = u + 1; ); ); // reload instance loadOsInstanceMark groupstr gplugmark ninstmark; loadOsGroupInstanceMark groupstr gplugmark ninstmark; let getEdCtrlModuleEditorBoxByName groupstr.GRP_mePlugins instname -> nmboxstr in chkCtrlModuleEditorBox ctrlstr nmboxstr 1 0; loadPluginInstance groupstr ninstmark bAppPlay; ); ); set i = i + 1; ); //search for instances from link src let XMLgetMarksByValueFromMarkSons linksmark "fulllink" -> llinks in while (llinks != nil) do ( let hd llinks -> linkmark in ( let XMLgetParam linkmark "srcinst" -> srcinst in let switchstr ltocopy srcinst -> pcopy in if pcopy != nil then ( let pcopy -> [ninstname gplugmark instmark] in ( XMLsetParam linkmark "srcinst" ninstname; XMLsetParam linkmark "srcgroup" groupstr.GRP_sName; ); 0; ) else if ((getInstanceByName strcatn groupstr.GRP_sName::"."::srcinst::nil) != nil) then ( XMLsetParam linkmark "srcgroup" groupstr.GRP_sName; 0; ) else ( //addLogMessage strcat "> Del full link to : " srcinst; XMLsetParam linkmark "srcinst" ""; 0; ); let XMLgetParam linkmark "dstinst" -> dstinst in let switchstr ltocopy dstinst -> pcopy in if pcopy != nil then ( let pcopy -> [ninstname gplugmark instmark] in ( XMLsetParam linkmark "dstinst" ninstname; XMLsetParam linkmark "dstgroup" groupstr.GRP_sName; ); 0; ) else if ((getInstanceByName strcatn groupstr.GRP_sName::"."::dstinst::nil) != nil) then ( XMLsetParam linkmark "dstgroup" groupstr.GRP_sName; 0; ) else ( //addLogMessage strcat "> Del full link to : " dstinst; XMLsetParam linkmark "dstinst" ""; 0; ); let XMLgetParam linkmark "srcinst" -> srcinst in let XMLgetParam linkmark "dstinst" -> dstinst in if (!strcmp srcinst "") || (!strcmp dstinst "") then nil else ( let XMLgetParam linkmark "srcgroup" -> srcgroup in let XMLgetParam linkmark "srcevent" -> srcevent in let XMLgetParam linkmark "dstgroup" -> dstgroup in let XMLgetParam linkmark "dstaction" -> dstaction in let XMLgetData linkmark -> data in // update links // add link if !(setModLink (getDMI strcatn srcgroup::"."::srcinst::nil) (getDMI strcatn dstgroup::"."::dstinst::nil) nil strbuild ((strcatn srcgroup::"."::srcinst::"."::srcevent::nil)::(strcatn dstgroup::"."::dstinst::"."::dstaction::nil)::data::"_"::"_"::nil)::nil) then nil else let getGroupByName srcgroup -> sgroupstr in let XMLgetMarkByValueFromMarkSons sgroupstr.GRP_xmlMark "plugins" -> plugsmark in let XMLgetMarkByValueAndParamValueFromMark plugsmark "instance" "name" srcinst -> instmark in ( // add link to source group xml let XMLaddMark xmlEditSceneFile "link" instmark ["event" srcevent]::["group" dstgroup]::["instance" dstinst]::["action" dstaction]::nil data -> nlinkmark in //update interface let sgroupstr.GRP_mePlugins -> mectrlstr in let mainInterf.MINT_meGroups -> megctrlstr in let mkGroupLink [nlinkmark nil srcgroup dstgroup srcgroup dstgroup srcinst dstinst] -> glinkstr in let mkGroupLink [nlinkmark nil srcinst dstinst srcgroup dstgroup srcinst dstinst] -> linkstr in ( set mainInterf.MINT_lLinks = glinkstr::mainInterf.MINT_lLinks; set sgroupstr.GRP_lLinks = linkstr::sgroupstr.GRP_lLinks; let getEdCtrlModuleEditorBoxByName mectrlstr linkstr.GRPL_sSrcEdBox -> srcmbox in let getEdCtrlModuleEditorBoxByName mectrlstr linkstr.GRPL_sDstEdBox -> dstmbox in if (srcmbox == nil || dstmbox == nil) || !(!strcmp srcgroup dstgroup) then nil else set linkstr.GRPL_strLink = crEdCtrlModuleEditorLink mectrlstr srcmbox dstmbox srcgroup::srcinst::srcevent::dstgroup::dstinst::dstaction::nil data; let getEdCtrlModuleEditorBoxByName megctrlstr glinkstr.GRPL_sSrcEdBox -> srcmbox in let getEdCtrlModuleEditorBoxByName megctrlstr glinkstr.GRPL_sDstEdBox -> dstmbox in if ((srcmbox == nil) || (dstmbox == nil)) || ((userlevel == 0) && (srcmbox == dstmbox)) then nil else set glinkstr.GRPL_strLink = crEdCtrlModuleEditorLink megctrlstr srcmbox dstmbox srcgroup::srcinst::srcevent::dstgroup::dstinst::dstaction::nil data; ); ); ); ); set llinks = tl llinks; ); // sort group box menu let getEdCtrlModuleEditorBoxByName mainInterf.MINT_meGroups groupstr.GRP_sName -> grpboxstr in sortEdCtrlModuleEditorBoxMenu mainInterf.MINT_meGroups grpboxstr; // refresh main tab links refreshAllInterfLinks 0; // refresh current group tab links refreshLinks groupstr.GRP_mePlugins groupstr.GRP_lLinks nil; // select new links let getEdCtrlModuleEditorSelectedBox groupstr.GRP_mePlugins -> lselbox in while (lselbox != nil) do ( let getEdCtrlModuleEditorRoundLinksByBox groupstr.GRP_mePlugins (hd lselbox) -> lrlinkstr in while (lrlinkstr != nil) do ( let (hd lrlinkstr) -> rlinkstr in ( //force unchecked first set rlinkstr.EDRL_bState = 0; chkCtrlModuleEditorRoundLink groupstr.GRP_mePlugins rlinkstr 1 0; ); set lrlinkstr = tl lrlinkstr; ); set lselbox = tl lselbox; ); // repaint interface only paintEdCtrlModuleEditor groupstr.GRP_mePlugins; paintEdCtrlModuleEditor mainInterf.MINT_meGroups; XMLclose xmlstr; ); 0;; fun pasteSelectedInstances(ctrlstr, groupstr, pos)= let getValidClipBoard -> xmlclip in loadFromGroup ctrlstr groupstr xmlclip pos 0; 0;; fun importInstancesFromFile(ctrlstr, groupstr, file, pos)= let XMLload file -> xmlstr in loadFromGroup ctrlstr groupstr xmlstr pos 1; 0;; fun cbCopyInstances(mitem, p)= let p -> [groupstr ctrlstr] in copySelectedInstances ctrlstr; 0;; fun cbCutInstances(mitem, p)= let p -> [groupstr ctrlstr] in cutSelectedInstances ctrlstr; 0;; fun cbPasteInstances(mitem, p)= let p -> [groupstr ctrlstr pos] in pasteSelectedInstances ctrlstr groupstr pos; 0;; fun cbLoadPlugitTemplate(mitem, file, p)= let p -> [groupstr ctrlstr pos] in importInstancesFromFile ctrlstr groupstr file pos; 0;; fun cbGroupSelectedInstancesMoving(ctrlstr, px, py, mask, groupstr)= if (mask != MK_LBUTTON|MK_SHIFT) || bClonePlugITs then nil else ( set bClonePlugITs = 1; copySelectedInstances ctrlstr; pasteSelectedInstances ctrlstr groupstr nil; ); 0;; fun cbGroupPluginsUnClick(ctrlstr, x, y, btn, mask)= set bClonePlugITs = 0; 0;; fun cbChangeLinksFilter(mitem, ctrlstr, groupstr)= setEdCtrlModuleEditorLinkFilter ctrlstr !(getEdCtrlModuleEditorLinkFilter ctrlstr); if (groupstr == nil) then ( setProjectSetting "filterLinks" XMLgetBoolString (getEdCtrlModuleEditorLinkFilter ctrlstr); 0; ) else ( let XMLgetMarkByValueFromMarkSons groupstr.GRP_xmlMark "plugins" -> plugsmark in XMLsetParam plugsmark "filterLinks" XMLgetBoolString (getEdCtrlModuleEditorLinkFilter ctrlstr); 0; ); 0;; fun cbChangeLinksStyle(mitem, ctrlstr, groupstr)= setEdCtrlModuleEditorLinkStyle ctrlstr !(getEdCtrlModuleEditorLinkStyle ctrlstr); if (groupstr == nil) then ( setProjectSetting "curvedLinks" XMLgetBoolString (getEdCtrlModuleEditorLinkStyle ctrlstr); 0; ) else ( let XMLgetMarkByValueFromMarkSons groupstr.GRP_xmlMark "plugins" -> plugsmark in XMLsetParam plugsmark "curvedLinks" XMLgetBoolString (getEdCtrlModuleEditorLinkStyle ctrlstr); 0; ); 0;; fun cbChangeSortMenus(mitem, ctrlstr, groupstr)= setEdCtrlModuleEditorSortMenus ctrlstr !(getEdCtrlModuleEditorSortMenus ctrlstr); if (groupstr == nil) then ( setProjectSetting "sortMenus" XMLgetBoolString (getEdCtrlModuleEditorSortMenus ctrlstr); 0; ) else ( let XMLgetMarkByValueFromMarkSons groupstr.GRP_xmlMark "plugins" -> plugsmark in XMLsetParam plugsmark "sortMenus" XMLgetBoolString (getEdCtrlModuleEditorSortMenus ctrlstr); 0; ); 0;; fun cbZoomIn(mitem, ctrlstr)= let (getEdCtrlModuleEditorZoomLevel ctrlstr) + 10 -> level in setEdCtrlModuleEditorZoomLevel ctrlstr level; 0;; fun cbZoomOut(mitem, ctrlstr)= let (getEdCtrlModuleEditorZoomLevel ctrlstr) - 10 -> level in setEdCtrlModuleEditorZoomLevel ctrlstr level; 0;; fun cbImportDynamicTemplate(mitem, ctrlstr)= importDynamicTpl; 0;; fun addQuickSearchMenu(mnu, keyword, p)= let p -> [ctrlstr groupstr viewstr x y] in let _APPpopup _channel mnu keyword -> qsearch in let lPlugins -> lp in let nil -> result in ( if (!strcmp (strtrim keyword) "") then nil else while (lp != nil) do ( let hd lp -> [name plug] in if ((strfindi keyword name 0) == nil) && ((strfindi keyword plug.PLUG_sType 0) == nil) && ((strfindi keyword plug.PLUG_sDesc 0) == nil) && ((strfindi keyword plug.PLUG_sKeywords 0) == nil) then nil else set result = name::result; set lp = tl lp; ); set result = quicksort result @suppDoublon; while (result != nil) do ( let hd result -> name in _CBmenu _APPitem _channel qsearch ME_ENABLED name @cbAddPluginInstance [ctrlstr groupstr (getPluginByName name) viewstr x y]; set result = tl result; ); ); 0;; fun cbShowPluginDescription(mitem, p)= let p -> [ctrlstr groupstr plugstr viewstr x y] in ( setInfoMessageLong strcatn plugstr.PLUG_sName::" - "::plugstr.PLUG_sDesc::nil; ); 0;; fun cbGroupPluginsClick(ctrlstr, x, y, btn, mask, p)= let p -> [groupstr viewstr] in if btn != 2 then nil else ( let nil -> ltypes in let nil -> ltmptypes in let nil -> ltmpplug in let _GETscreenPos -> [sx sy] in let _CRpopupMenu _channel -> mnu in ( _APPitem _channel mnu ME_DISABLED "plugITs"; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu _APPitem _channel mnu ME_ENABLED (loc "OS3D_0327") @cbRefreshPlugits ctrlstr; _CBmenu (_APPitem _channel mnu (if (!getEdCtrlModuleEditorLinkFilter ctrlstr) then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0393")) mkfun3 @cbChangeLinksFilter groupstr ctrlstr; _CBmenu (_APPitem _channel mnu (if (getEdCtrlModuleEditorLinkStyle ctrlstr) then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0394")) mkfun3 @cbChangeLinksStyle groupstr ctrlstr; _CBmenu (_APPitem _channel mnu (if (getEdCtrlModuleEditorSortMenus ctrlstr) then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0581")) mkfun3 @cbChangeSortMenus groupstr ctrlstr; _APPitem _channel mnu ME_SEPARATOR ""; let (getEdCtrlModuleEditorZoomLevel ctrlstr) -> zoom in let if zoom >= 100 then ME_DISABLED else ME_ENABLED -> zinstate in let if zoom <= 30 then ME_DISABLED else ME_ENABLED -> zoutstate in ( _CBmenu _APPitem _channel mnu zinstate (loc "OS3D_0473") @cbZoomIn ctrlstr; _CBmenu _APPitem _channel mnu zoutstate (loc "OS3D_0474") @cbZoomOut ctrlstr; ); _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu _APPitem _channel mnu (if ((sizelist (getEdCtrlModuleEditorSelectedBox ctrlstr)) > 0) then ME_ENABLED else ME_DISABLED) (loc "OS3D_0102") @cbCopyInstances [groupstr ctrlstr]; _CBmenu _APPitem _channel mnu (if ((sizelist (getEdCtrlModuleEditorSelectedBox ctrlstr)) > 0) then ME_ENABLED else ME_DISABLED) (loc "OS3D_0108") @cbCutInstances [groupstr ctrlstr]; _CBmenu _APPitem _channel mnu (if (getValidClipBoard != nil) then ME_ENABLED else ME_DISABLED) (loc "OS3D_0293") @cbPasteInstances [groupstr ctrlstr [x y]]; _APPitem _channel mnu ME_SEPARATOR ""; fillOs3dPlugTemplateMenu _APPpopup _channel mnu (loc "OS3D_0840") "assets/templates" mkfun3 @cbLoadPlugitTemplate [groupstr ctrlstr [x y]]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu _APPitem _channel mnu ME_ENABLED (loc "OS3D_0802") @cbSearchPlugIts [ctrlstr groupstr viewstr x y]; //_APPitem _channel mnu ME_SEPARATOR ""; //addQuickSearchMenu mnu "Pedagogic" [ctrlstr groupstr viewstr x y]; //addQuickSearchMenu mnu "Scene" [ctrlstr groupstr viewstr x y]; //_APPitem _channel mnu ME_SEPARATOR ""; let atoi (getConfigParamDef "OS3Duser" "plugits_user_level" "1") -> userlevel in let sizelist lPlugins -> size in let 0 -> i in while i < size do ( let nth_list lPlugins i -> [plugname plug] in let getPluginTypeName plug -> typename in if ((plug.PLUG_bHasError) || (plug.PLUG_bIsDeprecated) || (plug.PLUG_iUserLevel > userlevel)) then nil else ( set ltmptypes = quicksort typename::ltmptypes @suppDoublon; set ltmpplug = quicksort3 [plugname plug]::ltmpplug @suppDoublon; ); set i = i + 1; ); let sizelist ltmptypes -> size in let 0 -> i in while i < size do ( let nth_list ltmptypes i -> typename in let _APPpopup _channel mnu (locDef typename (capitalizeFirstLetter typename)) -> newtypename in set ltypes = [typename newtypename]::ltypes; set i = i + 1; ); let sizelist ltmpplug -> size in let 0 -> i in while i < size do ( let nth_list ltmpplug i -> [name plug] in let switchstr ltypes (getPluginTypeName plug) -> fathertype in _CBmenuHighlight _CBmenu _APPitem _channel fathertype ME_ENABLED (capitalizeFirstLetter name) @cbAddPluginInstance [ctrlstr groupstr plug viewstr x y] @cbShowPluginDescription [ctrlstr groupstr plug viewstr x y]; set i = i + 1; ); _DRAWmenu nil mnu sx sy PM_SCREEN|PM_LEFT_ALIGN|PM_TOP_ALIGN; ); ); 0;; fun cbGroupModuleClick(ctrlstr, x, y, btn, mask)= if btn != 2 then nil else ( let _GETscreenPos -> [sx sy] in let _CRpopupMenu _channel -> mnu in ( _CBmenu _APPitem _channel mnu ME_ENABLED (loc "OS3D_0329") @cbRefreshPlugits ctrlstr; _CBmenu (_APPitem _channel mnu (if (!getEdCtrlModuleEditorLinkFilter ctrlstr) then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0393")) mkfun3 @cbChangeLinksFilter nil ctrlstr; _CBmenu (_APPitem _channel mnu (if (getEdCtrlModuleEditorLinkStyle ctrlstr) then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0394")) mkfun3 @cbChangeLinksStyle nil ctrlstr; _CBmenu (_APPitem _channel mnu (if (getEdCtrlModuleEditorSortMenus ctrlstr) then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0581")) mkfun3 @cbChangeSortMenus nil ctrlstr; _APPitem _channel mnu ME_SEPARATOR ""; fillOs3dDynTemplateMenu _APPpopup _channel mnu (loc "OS3D_0839") "assets/templates"; //_CBmenu _APPitem _channel mnu ME_ENABLED (loc "OS3D_0839") @cbImportDynamicTemplate ctrlstr; _APPitem _channel mnu ME_SEPARATOR ""; let (getEdCtrlModuleEditorZoomLevel ctrlstr) -> zoom in let if zoom >= 100 then ME_DISABLED else ME_ENABLED -> zinstate in let if zoom <= 30 then ME_DISABLED else ME_ENABLED -> zoutstate in ( _CBmenu _APPitem _channel mnu zinstate (loc "OS3D_0473") @cbZoomIn ctrlstr; _CBmenu _APPitem _channel mnu zoutstate (loc "OS3D_0474") @cbZoomOut ctrlstr; ); _DRAWmenu nil mnu sx sy PM_SCREEN|PM_LEFT_ALIGN|PM_TOP_ALIGN; ); ); 0;; fun cbGroupModuleInstanceKeyDown(ctrlstr, key, code, p)= let p -> [viewstr groupstr] in if code == 0 then nil else // ignore shift or control event let if (!strcmpi KEYBgetCurrentKeyboardType "azerty") then "A" else "Q" -> akey in if (key == 31) && (_keybdstate == 2) then // Ctrl + S ( saveSceneFile nil; ) else if (key == 46) && (_keybdstate == 2) && (groupstr != nil) then // Ctrl + C ( copySelectedInstances ctrlstr; ) else if (key == 45) && (_keybdstate == 2) && (groupstr != nil) then // Ctrl + X ( cutSelectedInstances ctrlstr; ) else if (key == 47) && (_keybdstate == 2) && (groupstr != nil) then // Ctrl + V ( pasteSelectedInstances ctrlstr groupstr ctrlstr.EDC_modulesEditor.EDM_tLastClickPos; ) else if (key == (KEYBgetKeyNumber akey)) && (_keybdstate == 2) then // Ctrl + A ( selectEdCtrlModuleEditorBoxes ctrlstr; ) else if (key == 63) then // F5 ( if (_keybdstate == 2) then cbRefreshSelectedPlugits nil ctrlstr else cbRefreshPlugits nil ctrlstr; ) else if key == 88 then // F12 launch app in viewer ( launchPlayer viewstr; 0; ) else nil; 0;; fun cbGroupModuleInstanceKeyUp(ctrlstr, key)= if key == 1 then // ESC ( // stop link creation setEdCtrlModuleEditorLinkMode ctrlstr 0; ) else if key == 339 then // suppr ( // delete instance let getEdCtrlModuleEditorSelectedBox ctrlstr -> lmboxstr in let getEdCtrlModuleEditorSelectedRoundLink ctrlstr -> lrlinkstr in if lmboxstr != nil then _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0452") (loc "OS3D_0053") 1 @cbDlgInstanceRemove [ctrlstr lmboxstr] else if lrlinkstr != nil then _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0452") (loc "OS3D_0054") 1 @cbDlgInstanceLinksRemove [ctrlstr lrlinkstr] else nil; 0; ) else nil; 0;; fun cbGroupModuleKeyUp(ctrlstr, key)= if key == 1 then ( // stop link creation setEdCtrlModuleEditorLinkMode ctrlstr 0; ) else if key == 339 then // suppr ( let getEdCtrlModuleEditorSelectedRoundLink ctrlstr -> lrlinkstr in if lrlinkstr == nil then nil else _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0452") (loc "OS3D_0054") 1 @cbDlgInstanceLinksRemove [ctrlstr lrlinkstr]; 0; ) else nil; 0;; fun cbGroupModuleInstanceDbClick(ctrlstr, mboxstr, btn, mask, p)= let p -> [viewstr groupstr] in let (switch mainInterf.MINT_lInstanceConfig mboxstr) -> winstr in if winstr != nil then ( setEdWindowFocus winstr; 0; ) else ( // edit instance let _GETWorkingAreaSize -> [sw _] in let _GETdesktopSize -> [_ sh] in let _GETscreenPos -> [mx my] in let [mx + 10 my - 10] -> [mx my] in let [300 325] -> [iw ih] in let 40 -> hmargin in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih + hmargin) > sh) then max 0 ((sh - ih) - hmargin) else my)] -> [x y] in let (hd mboxstr.EDB_lParams) -> groupname in let (hd tl mboxstr.EDB_lParams) -> plugname in let (hd tl tl mboxstr.EDB_lParams) -> plugfile in let (hd tl tl tl mboxstr.EDB_lParams) -> instname in let strcatn groupname::"."::mboxstr.EDB_sName::nil -> fullinstname in let getPluginByFile plugfile -> plugstr in let getPluginInstanceByName plugstr fullinstname -> inststr in let XMLgetMarkByValueFromMarkSons inststr.INST_groupstr.GRP_xmlMark "plugins" -> plugsmark in let XMLgetMarkByValueAndParamValueFromMark plugsmark "plugin" "source" (substr plugstr.PLUG_sFile ((strlen sPLUGINSPATH) + 1) 1024) -> pluginmark in let XMLgetMarkByValueAndParamValueFromMark pluginmark "instance" "name" instname -> instmark in let XMLgetParam instmark "comment" -> instcomment in let XMLgetParam instmark "colorOff" -> coloroff in let XMLgetParam instmark "colorOn" -> coloron in let if ((coloroff != nil) || (coloron != nil)) then [(htoi coloron) (htoi coloroff)] else if (plugstr.PLUG_tColors == nil) then switchstri lPlugColors plugstr.PLUG_sType else plugstr.PLUG_tColors -> [oncolor offcolor] in let setEdWindowIcon (crEdWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU|WN_SIZEBOX nil nil strcatn "Edit "::plugname::" : "::instname::" "::(loc "OS3D_0007")::nil) sWinDlgIcon -> plugwinstr in let crEdWindowToolBar plugwinstr 0 0 iw 28 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> tbstr in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_pgroup.png" -> ashowg in let crEdToolBarCheck tbstr ashowg ETB_ALIGN_LEFT (loc "OS3D_0828") mkfun6 @cbTbBtnPluginShowInGroupCheck [inststr groupstr pluginmark instmark] -> chkshowingroup in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_helpers.png" -> ahelpers in let crEdToolBarCheck tbstr ahelpers ETB_ALIGN_LEFT (loc "OS3D_0391") mkfun6 @cbTbBtnPluginHelperCheck [inststr instmark] -> chkhelpers in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_help.png" -> apng in let crEdToolBarButton tbstr apng ETB_ALIGN_RIGHT (loc "OS3D_0186") mkfun5 @cbTbBtnPluginHelp plugstr -> tbhelp in let crEdScrollWindow _channel plugwinstr 0 210 iw ih-250 WN_CHILDINSIDE|WN_VSCROLL EDWIN_RESIZE_MW|EDWIN_RESIZE_MH nil nil -> scrlwinstr in let crEdWindow _channel scrlwinstr 0 0 iw ih-250 WN_CHILDINSIDE|WN_NOBORDER nil EDWIN_GROUP nil -> winstr in let crEdCtrlLabel plugwinstr 10 35 160 20 (loc "OS3D_0305") EDWIN_RESIZE_NONE -> labelobj in let crEdCtrlTextLine plugwinstr 180 35 (iw - 190) 20 instname nil EDWIN_RESIZE_MW -> ctrlinstname in let crEdCtrlText plugwinstr 10 60 (iw-9) 40 plugstr.PLUG_sDesc ET_AVSCROLL|ET_VSCROLL|ET_ALIGN_LEFT EDWIN_RESIZE_MW -> ctrldesc in let crEdCtrlLabel plugwinstr 10 105 160 20 (loc "OS3D_0813") EDWIN_RESIZE_NONE -> labelcolor in let crEdCtrlColorButton plugwinstr 180 105 100 20 offcolor 0 nil nil -> ctrloffcolor in let crEdCtrlLabel plugwinstr 10 130 160 20 (loc "OS3D_0095") EDWIN_RESIZE_NONE -> labelobj in let crEdCtrlEditText plugwinstr 10 150 (iw-9) 50 instcomment ET_AVSCROLL|ET_VSCROLL|ET_ALIGN_LEFT|ET_BORDER EDWIN_RESIZE_MW -> ctrlcomment in let crEdCtrlButton plugwinstr 10 (ih - 30) 90 20 (loc "OS3D_0282") EDWIN_RESIZE_LH|EDWIN_RESIZE_RW -> okbtn in let crEdCtrlButton plugwinstr ((iw /2) - 45) (ih - 30) 90 20 (loc "OS3D_0051") EDWIN_RESIZE_LH|EDWIN_RESIZE_RW|EDWIN_RESIZE_LW -> applybtn in let crEdCtrlButton plugwinstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0084") EDWIN_RESIZE_LH|EDWIN_RESIZE_LW -> cancelbtn in let exec plugstr.PLUG_openEditor with [winstr inststr viewstr applybtn] -> [cbclose cbDestroy] in let [mboxstr instname plugstr inststr cbclose ctrlinstname ctrlcomment ctrloffcolor] -> cbparam in let getEdWindowExPosSize plugwinstr -> [_ _ mw mh] in let mh - 325 -> bordersize in ( if (strIsUrl plugstr.PLUG_sHelp) then nil else ( if (plugstr.PLUG_sHelp == nil) then ( setEdToolBarButtonToolTip tbstr tbhelp (loc "OS3D_0271"); ) else ( setEdToolBarButtonToolTip tbstr tbhelp plugstr.PLUG_sHelp; ); setEdToolBarButtonEnable tbstr tbhelp 0; ); if (plugstr.PLUG_bUseHelpers) then ( setEdToolBarCheckState tbstr chkhelpers inststr.INST_bShowHelper; 0; ) else ( setEdToolBarCheckEnable tbstr chkhelpers 0; 0; ); setEdToolBarCheckState tbstr chkshowingroup inststr.INST_bShowInGroup; // on pluIT error we disable apply button and show an warning message if (mboxstr.EDB_bEnable) then nil else ( crEdCtrlLabelEx winstr 10 10 (mw - 20) 60 (loc "OS3D_0306") ET_AHSCROLL|ET_ALIGN_CENTER EDWIN_RESIZE_NONE; setEdCtrlButtonEnable okbtn 0; setEdCtrlButtonEnable applybtn 0; ); setEdwindowCbKeyUp plugwinstr mkfun3 @cbIntanceKeyUp plugwinstr; setEdwindowCbKeyUp scrlwinstr mkfun3 @cbIntanceKeyUp plugwinstr; setEdwindowCbKeyUp winstr mkfun3 @cbIntanceKeyUp plugwinstr; setEdCtrlButtonCb okbtn mkfun2 mkfun3 mkfun4 @cbBtnApplyInstance nil plugwinstr cbparam; setEdCtrlButtonCb applybtn mkfun2 mkfun3 mkfun4 @cbBtnApplyInstance nil nil cbparam; setEdCtrlButtonCb cancelbtn mkfun2 @cbBtnInstanceCancel mboxstr; setEdwindowCbDestroy plugwinstr mkfun2 mkfun3 @cbBtnDestroyWinInstance cbDestroy mboxstr; set mainInterf.MINT_lInstanceConfig = [mboxstr plugwinstr]::mainInterf.MINT_lInstanceConfig; let getEdWindowSize winstr -> [nw nh] in let if nw + 22 >= sw then sw else nw + 22 -> nw in let if nh + 270 + bordersize >= sh then sh - bordersize else nh + 275 -> nh in let [(if ((x + nw) > sw) then (sw - nw) else x) (if ((y + nh + bordersize) > sh) then (sh - nh - bordersize) else y)] -> [x y] in ( setEdWindowPosSize plugwinstr x y nw nh; setEdWindowMinimumSize plugwinstr nw 250; setEdWindowMaximumSize plugwinstr nw sh - 40; ); ); 0; ); 0;; fun cbGroupModuleDbClick(ctrlstr, mboxstr, btn, mask, viewstr)= if btn != 1 then nil else let mainInterf.MINT_winPlugins -> [plugswinstr [tbstr tabbarstr minmaxchk1]] in let getGroupByName mboxstr.EDB_sName -> groupstr in if groupstr.GRP_tabPlugins != nil then ( focusEdTab tabbarstr groupstr.GRP_tabPlugins; 0; ) else ( let mainInterf.MINT_winPlugins -> [plugswinstr [tbstr tabbarstr minmaxchk1]] in let crEdTab tabbarstr mboxstr.EDB_sLabel ETAB_CLOSEBTN 1 -> tabstr in let getEdTabWindow tabstr -> winstr in let XMLgetMarkByValueFromMarkSons groupstr.GRP_xmlMark "plugins" -> pluginsmark in let XMLgetBoolValue (if ((XMLgetParam pluginsmark "filterLinks") == nil) then (getProjectSetting "filterLinks") else (XMLgetParam pluginsmark "filterLinks")) 0 -> filterlinks in let XMLgetBoolValue (if ((XMLgetParam pluginsmark "curvedLinks") == nil) then (getProjectSetting "curvedLinks") else (XMLgetParam pluginsmark "curvedLinks")) 1 -> curvedlinks in let XMLgetBoolValue (if ((XMLgetParam pluginsmark "sortMenus") == nil) then (getProjectSetting "sortMenus") else (XMLgetParam pluginsmark "sortMenus")) 1 -> sortmenus in let crEdCtrlModuleEditor winstr iModuleEditorSurfaceW iModuleEditorSurfaceH 20 0 filterlinks nil -> mestr in ( set groupstr.GRP_tabPlugins = tabstr; set groupstr.GRP_mePlugins = mestr; setEdTabCbClose tabstr mkfun2 @cbClosePluginsTab groupstr; setEdCtrlModuleEditorCbBoxMove mestr mkfun5 @cbGroupInstanceMove groupstr; setEdCtrlModuleEditorCbBoxMenu mestr mkfun5 @cbGroupModuleMenu 0; setEdCtrlModuleEditorCbKeyUp mestr @cbGroupModuleInstanceKeyUp; setEdCtrlModuleEditorCbKeyDown mestr mkfun4 @cbGroupModuleInstanceKeyDown [viewstr groupstr]; setEdCtrlModuleEditorCbSeletedBoxMoving mestr mkfun5 @cbGroupSelectedInstancesMoving groupstr; setEdCtrlModuleEditorCbBoxDbClick mestr mkfun5 @cbGroupModuleInstanceDbClick [viewstr groupstr]; setEdCtrlModuleEditorRoundLinkCbDbClick mestr mkfun5 @cbGroupModuleLinksDbClick viewstr; setEdCtrlModuleEditorRoundLinkCbDestroy mestr @cbGroupModuleLinksDestroy; setEdCtrlModuleEditorRoundLinkCbUpdate mestr @cbGroupModuleLinksUpdate; setEdCtrlModuleEditorCbClick mestr mkfun6 @cbGroupPluginsClick [groupstr viewstr]; setEdCtrlModuleEditorCbUnClick mestr @cbGroupPluginsUnClick; setEdCtrlModuleEditorLinkStyle mestr curvedlinks; setEdCtrlModuleEditorSortMenus mestr sortmenus; // add instances on board loadOsInstances groupstr; ); 0; ); 0;; fun makeGroupPluginsTab(winstr, tabbarstr, name, viewstr)= let crEdTab tabbarstr name nil 1 -> tabstr1 in let getEdTabWindow tabstr1 -> winstr1 in let XMLgetBoolValue getProjectSetting "filterLinks" 0 -> filterlinks in let XMLgetBoolValue getProjectSetting "curvedLinks" 1 -> curvedlinks in let XMLgetBoolValue getProjectSetting "sortMenus" 1 -> sortmenus in let crEdCtrlModuleEditor winstr1 iModuleEditorSurfaceW iModuleEditorSurfaceH 20 1 filterlinks nil -> mestr in ( setEdCtrlModuleEditorCbBoxDbClick mestr mkfun5 @cbGroupModuleDbClick viewstr; setEdCtrlModuleEditorCbBoxMove mestr @cbGroupModuleMove; setEdCtrlModuleEditorCbBoxMenu mestr mkfun5 @cbGroupModuleMenu 1; setEdCtrlModuleEditorCbKeyUp mestr @cbGroupModuleKeyUp; setEdCtrlModuleEditorCbKeyDown mestr mkfun4 @cbGroupModuleInstanceKeyDown nil; setEdCtrlModuleEditorRoundLinkCbDbClick mestr mkfun5 @cbGroupModuleLinksDbClick viewstr; setEdCtrlModuleEditorRoundLinkCbDestroy mestr @cbGroupModuleLinksDestroy; setEdCtrlModuleEditorRoundLinkCbUpdate mestr @cbGroupModuleLinksUpdate; setEdCtrlModuleEditorCbClick mestr @cbGroupModuleClick; setEdCtrlModuleEditorLinkStyle mestr curvedlinks; setEdCtrlModuleEditorSortMenus mestr sortmenus; set mainInterf.MINT_meGroups = mestr; 0; ); 0;;