/* ----------------------------------------------------------------------------- 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 -> [ctrlfriction ctrlmindist ctrlmaxdist ctrlspring ctrlspstrength ctrlspdamping ctrlmouse ctrldist ctrlmass ctrlangle ctrlinit] in let getEdCtrlFloatValue ctrlfriction -> friction in let getEdCtrlFloatValue ctrlmindist -> mindist in let getEdCtrlFloatValue ctrlmaxdist -> maxdist in let getEdCtrlFloatValue ctrlspstrength -> strength in let getEdCtrlFloatValue ctrlspdamping -> damping in let getEdCtrlCheckState ctrlspring -> usespring in let getSelectedEdCtrlSelectPos ctrlmouse -> mousebtn in let getEdCtrlFloatValue ctrldist -> dist in let getEdCtrlFloatValue ctrlmass -> mass in let getEdCtrlCheckState ctrlangle -> limitangle in let getEdCtrlCheckState ctrlinit -> init in ["friction" ftoa friction]:: ["mindist" ftoa mindist]:: ["maxdist" ftoa maxdist]:: ["strength" ftoa strength]:: ["damping" ftoa damping]:: ["usespring" itoa usespring]:: ["mousebtn" itoa mousebtn]:: ["dist" ftoa dist]:: ["mass" ftoa mass]:: ["limitangle" itoa limitangle]:: ["init" itoa init]:: nil;; fun dynamicedit(ewinstr, inst, viewstr, applybtn)= let [420 320] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize ewinstr iw ih; let atof (getPluginInstanceParam inst "friction") -> friction in let if (friction == nil) then 0.0 else friction -> friction in let atof (getPluginInstanceParam inst "mindist") -> mindist in let if (mindist == nil) then 0.0 else mindist -> mindist in let atof (getPluginInstanceParam inst "maxdist") -> maxdist in let if (maxdist == nil) then 0.0 else maxdist -> maxdist in let atof (getPluginInstanceParam inst "strength") -> strength in let if (strength == nil) then 50.0 else strength -> strength in let atof (getPluginInstanceParam inst "damping") -> damping in let if (damping == nil) then 1.0 else damping -> damping in let atoi (getPluginInstanceParam inst "usespring") -> usespring in let if (usespring == nil) then 0 else usespring -> usespring in let atoi (getPluginInstanceParam inst "mousebtn") -> mousebtn in let if (mousebtn == nil) then 0 else mousebtn -> mousebtn in let atof (getPluginInstanceParam inst "dist") -> dist in let if (dist == nil) then 0.0 else dist -> dist in let atof (getPluginInstanceParam inst "mass") -> mass in let if (mass == nil) then 0.0 else mass -> mass in let atoi (getPluginInstanceParam inst "limitangle") -> limitangle in let if (limitangle == nil) then 0 else limitangle -> limitangle in let atoi (getPluginInstanceParam inst "init") -> init in let if (init == nil) then 1 else init -> init in ( if !usespring then nil else set ih = ih + 90; setEdWindowSize ewinstr iw ih; let crEdFrameWindow _channel ewinstr 0 0 iw 55 EDWIN_RESIZE_MW nil (loc "OS3DPHYSICMOUSE_0003") (loc "OS3DPHYSICMOUSE_0010") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 35 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3DPHYSICMOUSE_0002") nil -> labelfriction in let crEdCtrlFloat winstr 180 ypos 100 20 friction 0.0 1000000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlfriction in let crEdFrameWindow _channel ewinstr 0 0 iw 85 EDWIN_RESIZE_MW nil (loc "OS3DPHYSICMOUSE_0004") (loc "OS3DPHYSICMOUSE_0010") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 65 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3DPHYSICMOUSE_0009") nil -> labelmindist in let crEdCtrlFloat winstr 180 ypos 100 20 mindist (-.1000000.0) 1000000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlmindist in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DPHYSICMOUSE_0008") nil -> labelmaxdist in let crEdCtrlFloat winstr 180 ypos 100 20 maxdist (-.1000000.0) 1000000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlmaxdist in let crEdFrameWindowEx _channel ewinstr 0 0 iw 110 EDWIN_RESIZE_MW nil (loc "OS3DPHYSICMOUSE_0006") (loc "OS3DPHYSICMOUSE_0010") !usespring -> winfrm in let crEdWindow _channel winfrm 0 18 iw 90 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlCheck winstr 10 (set ypos = 10) 280 20 (loc "OS3DPHYSICMOUSE_0015") EDWIN_RESIZE_MW -> ctrlspring in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DPHYSICMOUSE_0014") nil -> labelspstrength in let crEdCtrlFloat winstr 180 ypos 100 20 strength 0.0 1000000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlspstrength in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DPHYSICMOUSE_0013") nil -> labelspdamping in let crEdCtrlFloat winstr 180 ypos 100 20 damping 0.0 1000000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlspdamping in let crEdFrameWindow _channel ewinstr 0 0 iw 160 EDWIN_RESIZE_MW nil (loc "OS3DPHYSICMOUSE_0011") (loc "OS3DPHYSICMOUSE_0010") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 140 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3DPHYSICMOUSE_0012") nil -> labelbtn in let crEdCtrlSelect winstr 180 ypos 200 120 EDWIN_RESIZE_MW -> ctrlmouse in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DPHYSICMOUSE_0005") nil -> labelmass in let crEdCtrlFloat winstr 180 ypos 100 20 mass 0.0 1000000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlmass in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DPHYSICMOUSE_0007") nil -> labelmaxdist in let crEdCtrlFloat winstr 180 ypos 100 20 dist 0.0 1000000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrldist in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DPHYSICMOUSE_0016") EDWIN_RESIZE_MW -> ctrlangle in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DPHYSICMOUSE_0001") EDWIN_RESIZE_MW -> ctrlinit in ( setEdCtrlCheckState ctrlspring usespring; setEdCtrlCheckState ctrlangle limitangle; setEdCtrlCheckState ctrlinit init; fillEdCtrlSelect ctrlmouse "Left"::"Right"::"Middle"::nil; selectEdCtrlSelectByPos ctrlmouse mousebtn; [mkfun1 @cbCloseEdit [ctrlfriction ctrlmindist ctrlmaxdist ctrlspring ctrlspstrength ctrlspdamping ctrlmouse ctrldist ctrlmass ctrlangle ctrlinit] nil]; ); ); );;