/* ----------------------------------------------------------------------------- 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 ctrlax ctrlay ctrlaz ctrlflipx ctrlmx ctrlmy] in let getEdCtrlTextLineValue ctrlobjname -> objname in let getEdCtrlFloatValue ctrlax -> ax in let getEdCtrlFloatValue ctrlay -> ay in let getEdCtrlFloatValue ctrlaz -> az in let getEdCtrlCheckState ctrlflipx -> flipx in let getEdCtrlFloatValue ctrlmx -> mx in let getEdCtrlFloatValue ctrlmy -> my in ["scaleX" ftoa ax]:: ["scaleY" ftoa ay]:: ["scaleZ" ftoa az]:: ["object" objname]:: ["flipX" itoa flipx]:: ["handXmargin" ftoa mx]:: ["handYmargin" ftoa my]:: nil;; 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 iTypeEntity 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 [420 240] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize ewinstr iw ih; let (getPluginInstanceParam inst "object") -> objname in let atof (getPluginInstanceParam inst "scaleX") -> ax in let atof (getPluginInstanceParam inst "scaleY") -> ay in let atof (getPluginInstanceParam inst "scaleZ") -> az in let if ax == nil then 1.0 else ax -> ax in let if ay == nil then 1.0 else ay -> ay in let if az == nil then 1.0 else az -> az in let atoi (getPluginInstanceParam inst "flipX") -> flipx in let if flipx == nil then 0 else flipx -> flipx in let atof (getPluginInstanceParam inst "handXmargin") -> handxmargin in let if handxmargin == nil then 0.0 else handxmargin -> handxmargin in let atof (getPluginInstanceParam inst "handYmargin") -> handymargin in let if handymargin == nil then 0.0 else handymargin -> handymargin in let crEdFrameWindow _channel ewinstr 0 0 iw 135 EDWIN_RESIZE_MW nil (loc "OS3DKINECTUSER_0017") (loc "OS3DKINECTUSER_0014") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 105 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr ypos 12 160 20 (loc "OS3DKINECTUSER_0016") 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 -> pickbtn in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshobjname in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25)+2 160 20 (loc "OS3DKINECTUSER_0021") nil -> labelax in let crEdCtrlFloat winstr 180 ypos 130 20 ax (-.100000.0) 100000.0 0.01 5 nil EDWIN_RESIZE_MW -> ctrlax in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25)+2 160 20 (loc "OS3DKINECTUSER_0022") nil -> labelay in let crEdCtrlFloat winstr 180 ypos 130 20 ay (-.100000.0) 100000.0 0.01 5 nil EDWIN_RESIZE_MW -> ctrlay in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25)+2 160 20 (loc "OS3DKINECTUSER_0023") nil -> labelaz in let crEdCtrlFloat winstr 180 ypos 130 20 az (-.100000.0) 100000.0 0.01 5 nil EDWIN_RESIZE_MW -> ctrlaz in let crEdFrameWindow _channel ewinstr 0 0 iw 125 EDWIN_RESIZE_MW nil (loc "OS3DKINECTUSER_0015") (loc "OS3DKINECTUSER_0014") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 95 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlCheck winstr 10 (set ypos = 10) 280 20 (loc "OS3DKINECTUSER_0008") EDWIN_RESIZE_MW -> ctrlflipx in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25)+2 160 20 (loc "OS3DKINECTUSER_0018") nil -> labelmx in let crEdCtrlFloat winstr 180 ypos 130 20 handxmargin (-.100000.0) 100000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlmx in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25)+2 160 20 (loc "OS3DKINECTUSER_0019") nil -> labelmy in let crEdCtrlFloat winstr 180 ypos 130 20 handymargin (-.100000.0) 100000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlmy in ( setEdCtrlButtonCb pickbtn mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlobjname objname]; setEdCtrlTextLineEnable ctrlobjname 0; setEdCtrlButtonCb refreshobjname mkfun2 @cbRefreshBtn [ctrlobjname]; setEdCtrlCheckState ctrlflipx flipx; [mkfun1 @cbCloseEdit [ctrlobjname ctrlax ctrlay ctrlaz ctrlflipx ctrlmx ctrlmy] nil]; ); );;