/* ----------------------------------------------------------------------------- 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 -> [ctrllightname ctrlenable] in let getEdCtrlTextLineValue ctrllightname -> lightname in let getEdCtrlCheckState ctrlenable -> enable in ["light" lightname]:: ["enable" itoa enable]:: nil;; fun cbSelectObj(val, type, p)= let p -> [inst winstr viewstr ctrllightname] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> light in if light == nil then nil else ( setEdCtrlTextLineValue ctrllightname val; ); 0;; fun cbCloseRes(ctrlbtn)= setEdCtrlButtonEnable ctrlbtn 1; 0;; fun cbBtnPickObj(ctrlbtn, p)= let p -> [inst winstr viewstr ctrllightname lightname] in ( setEdCtrlButtonEnable ctrlbtn 0; dlgSelectPluginInstanceResource inst winstr iTypeLight lightname mkfun3 @cbSelectObj [inst winstr viewstr ctrllightname] mkfun1 @cbCloseRes ctrlbtn 0; ); 0;; fun cbRefreshBtn(pickbtn, p)= let p -> [ctrlobjname] in setEdCtrlTextLineValue ctrlobjname ""; 0;; fun dynamicedit(winstr, inst, viewstr, applybtn)= let [420 90] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize winstr iw ih; let (getPluginInstanceParam inst "light") -> lightname in let atoi (getPluginInstanceParam inst "enable") -> enable in let if enable == nil then 1 else enable -> enable in let crEdCtrlLabel winstr 10 (ypos + 2) 160 20 (loc "OS3DLIGHT_0002") nil -> labelobj in let crEdCtrlTextLine winstr 180 ypos 140 20 lightname nil EDWIN_RESIZE_MW -> ctrllightname in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickbtn in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshlightname in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DLIGHT_0001") EDWIN_RESIZE_MW -> ctrlenable in ( setEdCtrlButtonCb pickbtn mkfun2 @cbBtnPickObj [inst winstr viewstr ctrllightname lightname]; setEdCtrlTextLineEnable ctrllightname 0; setEdCtrlCheckState ctrlenable enable; setEdCtrlButtonCb refreshlightname mkfun2 @cbRefreshBtn [ctrllightname]; [mkfun1 @cbCloseEdit [ctrllightname ctrlenable] nil]; ); );;