/* ----------------------------------------------------------------------------- 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 ----------------------------------------------------------------------------- */ fun cbCloseEdit(p)= let p -> [ctrlobjname ctrlsons ctrlpath ctrlenv ctrlhide ctrlinit] in let getEdCtrlTextLineValue ctrlobjname -> objname in let getEdCtrlCheckState ctrlsons -> sons in let getEdCtrlTextLineValue ctrlpath -> path in let itoa (getEdCtrlCheckState ctrlenv) -> env in let getEdCtrlCheckState ctrlhide -> hide in let getEdCtrlCheckState ctrlinit -> init in ["object" objname]:: ["sons" itoa sons]:: ["path" path]:: ["env" env]:: ["hide" itoa hide]:: ["init" itoa init]:: nil;; fun cbSelectObj(val, type, p)= let p -> [inst winstr viewstr ctrlobjname] in let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetObjectByName sessionstr val -> obj in if obj == nil then nil else ( setEdCtrlTextLineValue ctrlobjname val; ); 0;; fun cbCloseRes(ctrlbtn)= setEdCtrlButtonEnable ctrlbtn 1; 0;; fun cbBtnPickObj(ctrlbtn, p)= let p -> [inst winstr viewstr ctrlobjname objname] in ( setEdCtrlButtonEnable ctrlbtn 0; dlgSelectPluginInstanceResource inst winstr iTypeGroup|iTypeEntity|iTypeNode|iTypeLight|iTypeBone|iTypeCamera|iTypeParticle|iTypeCubeMap objname mkfun3 @cbSelectObj [inst winstr viewstr ctrlobjname] mkfun1 @cbCloseRes ctrlbtn 0; ); 0;; fun cbRefreshBtn(pickbtn, p)= let p -> [ctrlobjname] in setEdCtrlTextLineValue ctrlobjname ""; 0;; fun cbDlgGetFile(pfile, p)= let p -> [inst ctrlbtn winstr ctrlpath] in ( if pfile == nil then nil else let _PtoScol pfile -> file in if file == nil then ( _DLGMessageBox _channel winstr.EDW_win (loc "OS3DINSTANTIATE_0002") (loc "OS3DINSTANTIATE_0008") 0; 0; ) else ( setEdCtrlTextLineValue ctrlpath file; 0; ); setEdCtrlButtonEnable ctrlbtn 1; ); 0;; fun cbBtnPickFile(ctrlbtn, p)= let p -> [inst winstr ctrlpath] in let getEdCtrlTextLineValue ctrlpath -> path in let getPathFile path "" -> [fpath fname] in ( setEdCtrlButtonEnable ctrlbtn 0; 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 "" ["OpenSpace3D Project" "xos"::nil]::["All" "*.*"::nil]::nil EDFILE_DIALOG_LIST_FOLDERS|EDFILE_DIALOG_SHOW_TOOLBAR|EDFILE_DIALOG_SHOW_INFOS nil path -> dlgfstr in ( setEdWindowIcon dlgfstr.EDFD_dialog sWinDlgIcon; setEdOpenFileDialogInfoCb dlgfstr @cbGetOS3dProjectInfos; setEdOpenFileDialogCb dlgfstr mkfun2 @cbDlgGetFile [inst ctrlbtn winstr ctrlpath]; 0; ); ); 0;; fun dynamicedit(winstr, inst, viewstr, applybtn)= let [420 170] -> [iw ih] in ( setEdWindowSize winstr iw ih; let (getPluginInstanceParam inst "path") -> path in let atoi (getPluginInstanceParam inst "env") -> env in let if env == nil then 0 else env -> env in let (getPluginInstanceParam inst "object") -> objname in let atoi (getPluginInstanceParam inst "sons") -> sons in let if sons == nil then 0 else sons -> sons in let atoi (getPluginInstanceParam inst "hide") -> hide in let if hide == nil then 0 else hide -> hide in let atoi (getPluginInstanceParam inst "init") -> init in let if init == nil then 0 else init -> init in let 10 -> ypos in let crEdCtrlLabel winstr 10 (ypos + 2) 160 20 (loc "OS3DINSTANTIATE_0006") nil -> labelobj in let crEdCtrlTextLine winstr 180 ypos 140 20 path nil EDWIN_RESIZE_MW -> ctrlpath in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickbtn in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshpath in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DINSTANTIATE_0007") EDWIN_RESIZE_MW -> ctrlenv in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 35) + 2) 160 20 (loc "OS3DINSTANTIATE_0005") nil -> labelobj in let crEdCtrlTextLine winstr 180 ypos 140 20 objname nil EDWIN_RESIZE_MW -> ctrlobjname in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickobjbtn in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshobjname in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DINSTANTIATE_0001") EDWIN_RESIZE_MW -> ctrlsons in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DINSTANTIATE_0003") EDWIN_RESIZE_MW -> ctrlhide in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DINSTANTIATE_0004") EDWIN_RESIZE_MW -> ctrlinit in ( setEdCtrlButtonCb pickbtn mkfun2 @cbBtnPickFile [inst winstr ctrlpath]; setEdCtrlTextLineEnable ctrlpath 0; setEdCtrlCheckState ctrlenv env; setEdCtrlButtonCb refreshpath mkfun2 @cbRefreshBtn [ctrlpath]; setEdCtrlCheckState ctrlsons sons; setEdCtrlCheckState ctrlhide hide; setEdCtrlCheckState ctrlinit init; setEdCtrlButtonCb pickobjbtn mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlobjname objname]; setEdCtrlTextLineEnable ctrlobjname 0; setEdCtrlButtonCb refreshobjname mkfun2 @cbRefreshBtn [ctrlobjname]; [mkfun1 @cbCloseEdit [ctrlobjname ctrlsons ctrlpath ctrlenv ctrlhide ctrlinit] nil]; ); );;