/* ----------------------------------------------------------------------------- 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 cbDestroyEdit()= 0;; fun cbCloseEdit(p)= let p -> [ctrlobjname ctrlposx ctrlxpercent ctrlxoffset ctrlxalign ctrlposy ctrlypercent ctrlyoffset ctrlyalign ctrldist ctrldisttype ctrltarget ctrlinit] in let getEdCtrlTextLineValue ctrlobjname -> objname in let getEdCtrlFloatValue ctrlposx -> posx in let getEdCtrlCheckState ctrlxpercent -> xpercent in let getEdCtrlFloatValue ctrlxoffset -> xoffset in let getSelectedEdCtrlSelectPos ctrlxalign -> xalign in let getEdCtrlFloatValue ctrlposy -> posy in let getEdCtrlCheckState ctrlypercent -> ypercent in let getEdCtrlFloatValue ctrlyoffset -> yoffset in let getSelectedEdCtrlSelectPos ctrlyalign -> yalign in let getEdCtrlFloatValue ctrldist -> dist in let getSelectedEdCtrlSelectPos ctrldisttype -> disttype in let getEdCtrlCheckState ctrltarget -> target in let getEdCtrlCheckState ctrlinit -> init in ["object" objname]:: ["posx" ftoa posx]:: ["xpercent" itoa xpercent]:: ["xoffset" ftoa xoffset]:: ["xalign" itoa xalign]:: ["posy" ftoa posy]:: ["ypercent" itoa ypercent]:: ["yoffset" ftoa yoffset]:: ["yalign" itoa yalign]:: ["dist" ftoa dist]:: ["disttype" itoa disttype]:: ["target" itoa target]:: ["init" itoa init]:: nil;; fun cbPercentCheck(ctrlstr, state, p)= let p -> [ctrlcoord ctrloffset] in ( setEdCtrlFloatNbDecimals ctrlcoord (if state then 2 else 0); setEdCtrlFloatEnable ctrloffset state; ); 0;; fun cbSelectObj(val, type, p)= let p -> [inst winstr viewstr ctrlobjname] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in if (obj != nil) || (!strcmpi "Current camera" val) || (!strcmpi "Current camera shell" val) then ( setEdCtrlTextLineValue ctrlobjname val; ) else nil; 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|iTypeCamera|iTypeParticle|iTypeBone|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 dynamicedit(ewinstr, inst, viewstr, applybtn)= let [455 205] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize ewinstr iw ih; let (getPluginInstanceParam inst "object") -> objname in //for compatibility let if (atoi (getPluginInstanceParam inst "iscamera")) == 1 then "Current camera" else objname -> objname in let atof (getPluginInstanceParam inst "posx") -> posx in let if posx == nil then 0.0 else posx -> posx in let atoi (getPluginInstanceParam inst "xpercent") -> xpercent in let if xpercent == nil then 0 else xpercent -> xpercent in let atoi (getPluginInstanceParam inst "xoffset") -> xoffset in let if xoffset == nil then 0 else xoffset -> xoffset in let atoi (getPluginInstanceParam inst "xalign") -> xalign in let if xalign == nil then 0 else xalign -> xalign in let atof (getPluginInstanceParam inst "posy") -> posy in let if posy == nil then 0.0 else posy -> posy in let atoi (getPluginInstanceParam inst "ypercent") -> ypercent in let if ypercent == nil then 0 else ypercent -> ypercent in let atoi (getPluginInstanceParam inst "yoffset") -> yoffset in let if yoffset == nil then 0 else yoffset -> yoffset in let atoi (getPluginInstanceParam inst "yalign") -> yalign in let if yalign == nil then 0 else yalign -> yalign in let atof (getPluginInstanceParam inst "dist") -> dist in let if dist == nil then 5.0 else dist -> dist in let atoi (getPluginInstanceParam inst "disttype") -> disttype in let if disttype == nil then 0 else disttype -> disttype in let atoi (getPluginInstanceParam inst "target") -> target in let if (target == nil) then 0 else target -> target in let atoi (getPluginInstanceParam inst "init") -> init in let if (init == nil) then 1 else init -> init in let crEdFrameWindow _channel ewinstr 0 0 iw 205 EDWIN_RESIZE_MW nil (loc "OS3DOBJECT2DPOSITION_0005") (loc "OS3DOBJECT2DPOSITION_0006") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 185 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3DOBJECT2DPOSITION_0007") nil -> labelobj in let crEdCtrlTextLine winstr 180 ypos 165 20 objname nil EDWIN_RESIZE_MW -> ctrlobjname in let crEdCtrlButton winstr 350 ypos 55 20 "..." nil -> pickbtn in let crEdCtrlButton winstr 410 ypos 35 20 "X" nil -> refreshobjname in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 90 20 (loc "OS3DOBJECT2DPOSITION_0001") nil -> labelx in let crEdCtrlFloat winstr 110 ypos 60 20 posx (-.10000.0) 10000.0 1.0 (if xpercent then 2 else 0) nil EDWIN_RESIZE_MW -> ctrlposx in let crEdCtrlCheck winstr 180 ypos 40 20 "(%)" EDWIN_RESIZE_MW -> ctrlxpercent in let crEdCtrlLabel winstr 220 (ypos + 2) 60 20 (loc "OS3DOBJECT2DPOSITION_0004") nil -> labelxo in let crEdCtrlFloat winstr 285 ypos 60 20 itof xoffset (-.10000.0) 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlxoffset in let crEdCtrlSelect winstr 355 ypos 100 120 EDWIN_RESIZE_MW -> ctrlxalign in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 90 20 (loc "OS3DOBJECT2DPOSITION_0002") nil -> labely in let crEdCtrlFloat winstr 110 ypos 60 20 posy (-.10000.0) 10000.0 1.0 (if ypercent then 2 else 0) nil EDWIN_RESIZE_MW -> ctrlposy in let crEdCtrlCheck winstr 180 ypos 40 20 "(%)" EDWIN_RESIZE_MW -> ctrlypercent in let crEdCtrlLabel winstr 220 (ypos + 2) 60 20 (loc "OS3DOBJECT2DPOSITION_0004") nil -> labelyo in let crEdCtrlFloat winstr 285 ypos 60 20 itof yoffset (-.10000.0) 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlyoffset in let crEdCtrlSelect winstr 355 ypos 100 120 EDWIN_RESIZE_MW -> ctrlyalign in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DOBJECT2DPOSITION_0003") nil -> labeldist in let crEdCtrlFloat winstr 180 ypos 100 20 dist (-.100000.0) 100000.0 0.1 5 nil EDWIN_RESIZE_MW -> ctrldist in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DOBJECT2DPOSITION_0010") nil -> labeldisttype in let crEdCtrlSelect winstr 180 ypos (iw - 190) 120 EDWIN_RESIZE_MW -> ctrldisttype in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3DOBJECT2DPOSITION_0013") EDWIN_RESIZE_MW -> ctrltarget in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3DOBJECT2DPOSITION_0009") EDWIN_RESIZE_MW -> ctrlinit in ( setEdCtrlButtonCb pickbtn mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlobjname objname]; setEdCtrlTextLineEnable ctrlobjname 0; setEdCtrlButtonCb refreshobjname mkfun2 @cbRefreshBtn [ctrlobjname]; setEdCtrlCheckState ctrlxpercent xpercent; setEdCtrlCheckState ctrlypercent ypercent; setEdCtrlCheckCbState ctrlxpercent mkfun3 @cbPercentCheck [ctrlposx ctrlxoffset]; setEdCtrlCheckCbState ctrlypercent mkfun3 @cbPercentCheck [ctrlposy ctrlyoffset]; fillEdCtrlSelect ctrlxalign (loc "OS3D_0650")::(loc "OS3D_0654")::(loc "OS3D_0651")::nil; fillEdCtrlSelect ctrlyalign (loc "OS3D_0652")::(loc "OS3D_0654")::(loc "OS3D_0653")::nil; selectEdCtrlSelectByPos ctrlxalign xalign; selectEdCtrlSelectByPos ctrlyalign yalign; fillEdCtrlSelect ctrldisttype (loc "OS3DOBJECT2DPOSITION_0011")::(loc "OS3DOBJECT2DPOSITION_0012")::nil; selectEdCtrlSelectByPos ctrldisttype disttype; setEdCtrlCheckState ctrltarget target; setEdCtrlCheckState ctrlinit init; [(mkfun1 @cbCloseEdit [ctrlobjname ctrlposx ctrlxpercent ctrlxoffset ctrlxalign ctrlposy ctrlypercent ctrlyoffset ctrlyalign ctrldist ctrldisttype ctrltarget ctrlinit]) @cbDestroyEdit]; ); );;