/* ----------------------------------------------------------------------------- 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 ctrluserpath ctrlpath] in let getEdCtrlTextLineValue ctrlobjname -> objname in let getEdCtrlCheckState ctrlsons -> sons in let getEdCtrlTextLineValue ctrluserpath -> userpath in let getEdCtrlTextLineValue ctrlpath -> path in ["object" objname]:: ["sons" itoa sons]:: ["path" path]:: ["userpath" userpath]:: 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 "OS3DINSTUSER_0002") (loc "OS3DINSTUSER_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 185] -> [iw ih] in ( setEdWindowSize winstr iw ih; let (getPluginInstanceParam inst "userpath") -> userpath in 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 10 -> ypos in let crEdCtrlLabel winstr 10 (ypos + 2) (iw - 20) 20 (loc "OS3DINSTUSER_0001") nil -> labelobj in let crEdCtrlTextLine winstr 10 (set ypos = ypos + 25) (iw-110) 20 userpath nil EDWIN_RESIZE_MW -> ctrluserpath in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickbtn in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshpath in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) (iw - 20) 20 (loc "OS3DINSTUSER_0002") nil -> labelobj in let crEdCtrlTextLine winstr 10 (set ypos = ypos + 25) (iw-110) 20 path nil EDWIN_RESIZE_MW -> ctrlpath in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickbtn2 in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshpath2 in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) (iw - 20) 20 (loc "OS3DINSTUSER_0003") nil -> labelobj in let crEdCtrlTextLine winstr 10 (set ypos = ypos + 25) (iw-110) 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 "OS3DINSTUSER_0004") EDWIN_RESIZE_MW -> ctrlsons in ( setEdCtrlButtonCb pickbtn mkfun2 @cbBtnPickFile [inst winstr ctrluserpath]; setEdCtrlButtonCb pickbtn2 mkfun2 @cbBtnPickFile [inst winstr ctrlpath]; setEdCtrlTextLineEnable ctrluserpath 0; setEdCtrlTextLineEnable ctrlpath 0; setEdCtrlButtonCb refreshpath mkfun2 @cbRefreshBtn [ctrluserpath]; setEdCtrlButtonCb refreshpath2 mkfun2 @cbRefreshBtn [ctrlpath]; setEdCtrlCheckState ctrlsons sons; setEdCtrlButtonCb pickobjbtn mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlobjname objname]; setEdCtrlTextLineEnable ctrlobjname 0; setEdCtrlButtonCb refreshobjname mkfun2 @cbRefreshBtn [ctrlobjname]; [mkfun1 @cbCloseEdit [ctrlobjname ctrlsons ctrluserpath ctrlpath] nil]; ); );;