/* ----------------------------------------------------------------------------- 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 ctrlxoffset ctrlyoffset ctrlscale ctrlfsize ctrlmaxwidth ctrlfcolor ctrlbcolor ctrlhalign ctrltext ctrlpcolor ctrlclick ctrlpoint ctrlvisibility ctrlautoscale ctrlmaxautoscaledist ctrlontop ctrlinit] in let getEdCtrlTextLineValue ctrlobjname -> objname in let getEdCtrlFloatValue ctrlxoffset -> xoffset in let getEdCtrlFloatValue ctrlyoffset -> yoffset in let getEdCtrlFloatValue ctrlscale -> scale in let ftoi (getEdCtrlFloatValue ctrlfsize) -> fsize in let ftoi (getEdCtrlFloatValue ctrlmaxwidth) -> maxwidth in let getEdCtrlColorButtonColor ctrlfcolor -> fcolor in let getEdCtrlColorButtonColor ctrlbcolor -> bcolor in let getSelectedEdCtrlSelectPos ctrlhalign -> halign in let getEdCtrlEditTextValue ctrltext -> text in let getEdCtrlColorButtonColor ctrlpcolor -> pcolor in let getSelectedEdCtrlSelectPos ctrlclick -> click in let getEdCtrlCheckState ctrlpoint -> point in let getEdCtrlFloatValue ctrlvisibility -> visibility in let getEdCtrlCheckState ctrlautoscale -> autoscale in let getEdCtrlFloatValue ctrlmaxautoscaledist -> maxautoscaledist in let getEdCtrlCheckState ctrlontop -> showontop in let getEdCtrlCheckState ctrlinit -> init in ["object" objname]:: ["xoffset" ftoa xoffset]:: ["yoffset" ftoa yoffset]:: ["scale" ftoa scale]:: ["fontsize" itoa fsize]:: ["maxwidth" itoa maxwidth]:: ["fontcolor" itoa fcolor]:: ["backgroundcolor" itoa bcolor]:: ["horalign" itoa halign]:: ["text" text]:: ["pointcolor" itoa pcolor]:: ["pointclick" itoa click]:: ["point" itoa point]:: ["visibility" ftoa visibility]:: ["autoscale" itoa autoscale]:: ["maxautoscaledist" ftoa maxautoscaledist]:: ["showontop" itoa showontop]:: ["init" itoa init]:: 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|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 cbAutoscale(ctrlstr, state, ctrlmaxautoscaledist)= setEdCtrlFloatEnable ctrlmaxautoscaledist state; 0;; fun dynamicedit(ewinstr, inst, viewstr, applybtn)= let [420 595] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize ewinstr iw ih; let (getPluginInstanceParam inst "object") -> objname in let atof (getPluginInstanceParam inst "xoffset") -> xoffset in let if xoffset == nil then 0.5 else xoffset -> xoffset in let atof (getPluginInstanceParam inst "yoffset") -> yoffset in let if yoffset == nil then 0.5 else yoffset -> yoffset in let atof (getPluginInstanceParam inst "scale") -> scale in let if scale == nil then 1.0 else scale -> scale in let atoi (getPluginInstanceParam inst "fontsize") -> fsize in let if fsize == nil then 12 else fsize -> fsize in let atoi (getPluginInstanceParam inst "fonttype") -> ftype in let if ftype == nil then 1 else ftype -> ftype in let atoi (getPluginInstanceParam inst "maxwidth") -> maxwidth in let if maxwidth == nil then 0 else maxwidth -> maxwidth in let atoi (getPluginInstanceParam inst "fontcolor") -> fcolor in let if fcolor == nil then 0xffffff else fcolor -> fcolor in let atoi (getPluginInstanceParam inst "backgroundcolor") -> bcolor in let if bcolor == nil then 80 else bcolor -> bcolor in let atoi (getPluginInstanceParam inst "horalign") -> halign in let if halign == nil then 1 else halign -> halign in let getPluginInstanceParam inst "text" -> text in let if text == nil then "" else text -> text in let atoi (getPluginInstanceParam inst "pointcolor") -> pcolor in let if pcolor == nil then 80 else pcolor -> pcolor in let atoi (getPluginInstanceParam inst "pointclick") -> click in let if click == nil then 0 else click -> click in let atoi (getPluginInstanceParam inst "point") -> point in let if point == nil then 0 else point -> point in let atof (getPluginInstanceParam inst "visibility") -> visibility in let if visibility == nil then 0.0 else visibility -> visibility in let atoi (getPluginInstanceParam inst "autoscale") -> autoscale in let if autoscale == nil then 1 else autoscale -> autoscale in let atof (getPluginInstanceParam inst "maxautoscaledist") -> maxautoscaledist in let if maxautoscaledist == nil then 5.0 else maxautoscaledist -> maxautoscaledist in let atoi (getPluginInstanceParam inst "showontop") -> showontop in let if showontop == nil then 1 else showontop -> showontop in let atoi (getPluginInstanceParam inst "init") -> init in let if init == nil then 1 else init -> init in ( if !point then nil else set ih = ih + 85; setEdWindowSize ewinstr iw ih; let crEdFrameWindow _channel ewinstr 0 0 iw 130 EDWIN_RESIZE_MW nil (loc "OS3DLABEL_0011") (loc "OS3DLABEL_0013") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 110 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3DLABEL_0001") 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) 90 20 (loc "OS3DLABEL_0009") nil -> labelxo in let crEdCtrlFloat winstr 180 ypos 80 20 xoffset (-.10000.0) 10000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlxoffset in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 90 20 (loc "OS3DLABEL_0010") nil -> labelyo in let crEdCtrlFloat winstr 180 ypos 80 20 yoffset (-.10000.0) 10000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlyoffset in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 90 20 (loc "OS3DLABEL_0027") nil -> labelscale in let crEdCtrlFloat winstr 180 ypos 80 20 scale 0.001 10000.0 0.1 3 nil EDWIN_RESIZE_MW -> ctrlscale in let crEdFrameWindow _channel ewinstr 0 0 iw 290 EDWIN_RESIZE_MW nil (loc "OS3DLABEL_0012") (loc "OS3DLABEL_0013") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 270 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3DLABEL_0007") nil -> labelfsize in let crEdCtrlFloat winstr 180 ypos 60 20 (itof fsize) 1.0 1024.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlfsize in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DLABEL_0003") nil -> labelmaxwidth in let crEdCtrlFloat winstr 180 ypos 60 20 (itof maxwidth) 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlmaxwidth in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DLABEL_0004") nil -> labelfcolor in let crEdCtrlColorButton winstr 180 ypos 100 20 fcolor 0 EDWIN_RESIZE_MW nil -> ctrlfcolor in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DLABEL_0008") nil -> labelbcolor in let crEdCtrlColorButton winstr 180 ypos 100 20 bcolor 1 EDWIN_RESIZE_MW nil -> ctrlbcolor in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DLABEL_0014") nil -> labelhalign in let crEdCtrlSelect winstr 180 ypos 100 120 EDWIN_RESIZE_MW -> ctrlhalign in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 30) + 2) 170 20 (loc "OS3DLABEL_0002") nil -> labeltext in let crEdCtrlEditText winstr 10 (set ypos = ypos + 25) iw-20 100 text nil EDWIN_RESIZE_MW -> ctrltext in let crEdFrameWindowEx _channel ewinstr 0 0 iw 105 EDWIN_RESIZE_MW nil (loc "OS3DLABEL_0028") (loc "OS3DLABEL_0013") !point -> winfrm in let crEdWindow _channel winfrm 0 18 iw 85 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3DLABEL_0006") nil -> labelpcolor in let crEdCtrlColorButton winstr 180 ypos 100 20 pcolor 1 EDWIN_RESIZE_MW nil -> ctrlpcolor in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DLABEL_0029") nil -> labelclick in let crEdCtrlSelect winstr 180 ypos 100 120 EDWIN_RESIZE_MW -> ctrlclick in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DLABEL_0023") EDWIN_RESIZE_MW -> ctrlpoint in let crEdFrameWindow _channel ewinstr 0 0 iw 155 EDWIN_RESIZE_MW nil (loc "OS3DLABEL_0022") (loc "OS3DLABEL_0013") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 135 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3DLABEL_0034") nil -> labelvisibility in let crEdCtrlFloat winstr 180 ypos 60 20 visibility 0.0 1000000.0 0.1 2 nil EDWIN_RESIZE_MW -> ctrlvisibility in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DLABEL_0026") EDWIN_RESIZE_MW -> ctrlautoscale in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DLABEL_0024") nil -> labelmaxautoscaledist in let crEdCtrlFloat winstr 180 ypos 60 20 maxautoscaledist 0.0 1000000.0 0.1 2 nil EDWIN_RESIZE_MW -> ctrlmaxautoscaledist in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DLABEL_0025") EDWIN_RESIZE_MW -> ctrlontop in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DLABEL_0005") EDWIN_RESIZE_MW -> ctrlinit in ( setEdCtrlTextLineEnable ctrlobjname 0; setEdCtrlButtonCb pickbtn mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlobjname objname]; setEdCtrlButtonCb refreshobjname mkfun2 @cbRefreshBtn [ctrlobjname]; fillEdCtrlSelect ctrlhalign (loc "OS3DLABEL_0016")::(loc "OS3DLABEL_0017")::(loc "OS3DLABEL_0018")::nil; selectEdCtrlSelectByPos ctrlhalign halign; setEdCtrlEditTextEnable ctrltext 1; setEdCtrlCheckState ctrlpoint point; fillEdCtrlSelect ctrlclick (loc "OS3DLABEL_0030")::(loc "OS3DLABEL_0031")::(loc "OS3DLABEL_0032")::(loc "OS3DLABEL_0033")::nil; selectEdCtrlSelectByPos ctrlclick click; setEdCtrlCheckState ctrlautoscale autoscale; setEdCtrlCheckCbState ctrlautoscale mkfun3 @cbAutoscale ctrlmaxautoscaledist; setEdCtrlFloatEnable ctrlmaxautoscaledist autoscale; setEdCtrlCheckState ctrlontop showontop; setEdCtrlCheckState ctrlinit init; [mkfun1 @cbCloseEdit [ctrlobjname ctrlxoffset ctrlyoffset ctrlscale ctrlfsize ctrlmaxwidth ctrlfcolor ctrlbcolor ctrlhalign ctrltext ctrlpcolor ctrlclick ctrlpoint ctrlvisibility ctrlautoscale ctrlmaxautoscaledist ctrlontop ctrlinit] nil]; ); ); );;