/* ----------------------------------------------------------------------------- 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 getEvents(l)= let nil -> ndata in let 0 -> i in ( while (l != nil) do ( let hd l -> elt in ( set ndata = ["EVENT" capitalizeFirstLetter elt]::ndata; set ndata = ["ACTION" strcat "Switch " elt]::ndata; ); set l = tl l; ); ndata; );; fun cbCloseEdit(p)= let p -> [ctrlpos ctrllstate ctrlrstate ctrlinput] in let getEdCtrlTextLineValue ctrllstate -> lstate in let if (!strcmp (strtrim lstate) "") then "left" else lstate -> lstate in let getEdCtrlTextLineValue ctrlrstate -> rstate in let if (!strcmp (strtrim rstate) "") then "right" else rstate -> rstate in let getSelectedEdCtrlSelectPos ctrlpos -> pos in let getEdCtrlCheckState ctrlinput -> inputonchange in let getEvents lstate::rstate::nil -> levents in ["lstate" lstate]:: ["rstate" rstate]:: ["pos" (itoa pos)]:: ["inputonchange" itoa inputonchange]:: levents;; fun dynamicedit(winstr, inst, viewstr, applybtn)= let [400 105] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize winstr iw ih; let (getPluginInstanceParam inst "lstate") -> lstate in let if (lstate == nil) then "left" else lstate -> lstate in let (getPluginInstanceParam inst "rstate") -> rstate in let if (rstate == nil) then "right" else rstate -> rstate in let (getPluginInstanceParam inst "pos") -> spos in let if (spos == nil) then 0 else if !strcmpi spos "Left" then 0 else if !strcmpi spos "Right" then 1 else atoi spos -> pos in let atoi (getPluginInstanceParam inst "inputonchange") -> inputonchange in let if inputonchange == nil then 0 else inputonchange -> inputonchange in let crEdCtrlLabel winstr 10 (ypos + 2) 190 20 (loc "OS3DSWITCH_0003") nil -> labellstate in let crEdCtrlTextLine winstr 200 ypos iw-210 20 lstate nil EDWIN_RESIZE_MW -> ctrllstate in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 190 20 (loc "OS3DSWITCH_0004") nil -> labelrstate in let crEdCtrlTextLine winstr 200 ypos iw-210 20 rstate nil EDWIN_RESIZE_MW -> ctrlrstate in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 190 20 (loc "OS3DSWITCH_0001") EDWIN_RESIZE_MW -> labelpos in let crEdCtrlSelect winstr 200 ypos iw-210 120 EDWIN_RESIZE_MW -> ctrlpos in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3DSWITCH_0002") EDWIN_RESIZE_MW -> ctrlinput in ( fillEdCtrlSelect ctrlpos (loc "OS3DSWITCH_0005")::(loc "OS3DSWITCH_0006")::nil; selectEdCtrlSelectByPos ctrlpos pos; setEdCtrlCheckState ctrlinput inputonchange; [mkfun1 @cbCloseEdit [ctrlpos ctrllstate ctrlrstate ctrlinput] nil]; ); );;