/* ----------------------------------------------------------------------------- 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 getLabelList(ctrllist)= let getEdCtrlListElems ctrllist -> llist in let nil -> lparamlist in let getEdCtrlListNbElems ctrllist -> nbLabels in let 0 -> i in ( while (i < nbLabels) do ( let nth_list llist i -> label in set lparamlist = [(strcat "label_" (itoa i)) label]::lparamlist; set i = i + 1; ); lparamlist; );; fun cbCloseEdit(p)= let p -> [ctrltitle ctrlvalue ctrlminvalue ctrlmaxvalue ctrlstep ctrldec ctrllist theltselector ctrlvalign ctrlhalign ctrlopacity ctrlfadespeed ctrlshow] in let getEdCtrlTextLineValue ctrltitle -> title in let ftoa getEdCtrlFloatValue ctrlvalue -> value in let ftoa getEdCtrlFloatValue ctrlminvalue -> minvalue in let ftoa getEdCtrlFloatValue ctrlmaxvalue -> maxvalue in let ftoa getEdCtrlFloatValue ctrlstep -> step in let ftoa getEdCtrlFloatValue ctrldec -> dec in let getLabelList ctrllist -> labellist in let getThemeEltSelectorSave theltselector -> thdefsave in let itoa getSelectedEdCtrlSelectPos ctrlvalign -> valign in let itoa getSelectedEdCtrlSelectPos ctrlhalign -> halign in let ftoi getEdCtrlFloatValue ctrlopacity -> opacity in let ftoi getEdCtrlFloatValue ctrlfadespeed -> fadespeed in let getEdCtrlCheckState ctrlshow -> show in ["title" title]:: ["value" value]:: ["minvalue" minvalue]:: ["maxvalue" maxvalue]:: ["step" step]:: ["dec" dec]:: ["valign" valign]:: ["halign" halign]:: ["opacity" itoa opacity]:: ["fadespeed" itoa fadespeed]:: ["show" itoa show]:: (lcat labellist thdefsave);; fun loadLabelsList(inst)= let 0 -> i in let nil -> llist in let nil -> label in ( while ((set label = getPluginInstanceParam inst (strcat "label_" (itoa i))) != nil) do ( set i = i + 1; set llist = label::llist; ); revertlist llist; );; fun cbAddActEvnt(ctrlstr, value, liststr)= if (value == nil) || (!strcmp "" strtrim value) then nil else let getEdCtrlListElems liststr -> lelem in if (isStringInListi lelem value) then nil else ( addEdCtrlList liststr value nil nil; setEdCtrlTextLineValue ctrlstr nil; ); 0;; fun cbAddList(ctrlstr, p)= let p -> [liststr textstr] in let getEdCtrlTextLineValue textstr -> value in if (value == nil) || (!strcmp "" strtrim value) then nil else let getEdCtrlListElems liststr -> lelem in if (isStringInListi lelem value) then nil else ( addEdCtrlList liststr value nil nil; setEdCtrlTextLineValue textstr nil; ); 0;; fun cbDelList(ctrlstr, p)= let p -> [liststr textstr] in let getSelectedEdCtrlList liststr -> [name _ _] in delEdCtrlList liststr name; 0;; fun dynamicedit(ewinstr, inst, viewstr, applybtn)= let [455 510] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize ewinstr iw ih; let getPluginInstanceParam inst "title" -> title in let if title == nil then "" else title -> title in let atof getPluginInstanceParam inst "value" -> value in let if value == nil then 0.0 else value -> value in let atof getPluginInstanceParam inst "minvalue" -> minvalue in let if minvalue == nil then 0.0 else minvalue -> minvalue in let atof getPluginInstanceParam inst "maxvalue" -> maxvalue in let if maxvalue == nil then 100.0 else maxvalue -> maxvalue in let atof getPluginInstanceParam inst "step" -> step in let if step == nil then 1.0 else step -> step in let atof getPluginInstanceParam inst "dec" -> dec in let if dec == nil then 2.0 else dec -> dec in let atoi (getPluginInstanceParam inst "valign") -> valign in let if valign == nil then 1 else valign -> valign in let atoi (getPluginInstanceParam inst "halign") -> halign in let if halign == nil then 1 else halign -> halign in let atoi (getPluginInstanceParam inst "opacity") -> opacity in let if (opacity == nil) then 100 else opacity -> opacity in let atoi (getPluginInstanceParam inst "fadespeed") -> fadespeed in let if (fadespeed == nil) then 0 else fadespeed -> fadespeed in let atoi (getPluginInstanceParam inst "show") -> show in let if (show == nil) then 1 else show -> show in let crEdFrameWindow _channel ewinstr 0 0 iw 60 EDWIN_RESIZE_MW nil (loc "OS3DDNUMBER_0004") (loc "OS3DDNUMBER_0002") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 40 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3DDNUMBER_0005") nil -> labeltitle in let crEdCtrlTextLine winstr 180 ypos 170 20 title nil EDWIN_RESIZE_MW -> ctrltitle in let crEdFrameWindow _channel ewinstr 0 0 iw 160 EDWIN_RESIZE_MW nil (loc "OS3DDNUMBER_0006") (loc "OS3DDNUMBER_0002") -> 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 "OS3DDNUMBER_0007") nil -> labelval in let crEdCtrlFloat winstr 180 ypos 100 20 value (-.100000.0) 100000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlvalue in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DDNUMBER_0008") nil -> labelmin in let crEdCtrlFloat winstr 180 ypos 100 20 minvalue (-.100000.0) 100000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlminvalue in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DDNUMBER_0009") nil -> labelmax in let crEdCtrlFloat winstr 180 ypos 100 20 maxvalue (-.100000.0) 100000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlmaxvalue in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DDNUMBER_0010") nil -> labelstep in let crEdCtrlFloat winstr 180 ypos 100 20 step 0.0 100000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlstep in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DDNUMBER_0011") nil -> labeldec in let crEdCtrlFloat winstr 180 ypos 100 20 dec 0.0 5.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrldec in let crEdFrameWindow _channel ewinstr 0 0 iw 135 EDWIN_RESIZE_MW nil (loc "OS3DDNUMBER_0013") (loc "OS3DDNUMBER_0002") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 115 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlList winstr 10 (set ypos = 10) (iw - 20) 65 LB_BORDER|LB_VSCROLL|ET_TABFOCUS EDWIN_RESIZE_MW|EDWIN_RESIZE_MH -> ctrllist in let crEdCtrlTextLine winstr 10 (set ypos = ypos + 75) (iw - 70) 20 nil nil EDWIN_RESIZE_MW -> ctrladdlabel in let crEdCtrlButton winstr (iw - 55) ypos 20 20 "+" EDWIN_RESIZE_MW -> ctrlbtnadd in let crEdCtrlButton winstr (iw - 30) ypos 20 20 "-" EDWIN_RESIZE_MW -> ctrlbtndel in let crThemeEltSelector inst ewinstr nil "dialogBox"::"float"::nil iw ih -> theltselector in let crEdFrameWindow _channel ewinstr 0 0 iw 155 EDWIN_RESIZE_MW nil (loc "OS3DDNUMBER_0003") (loc "OS3DDNUMBER_0002") -> 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) 170 20 (loc "OS3DDNUMBER_0019") nil -> labelvalign in let crEdCtrlSelect winstr 180 ypos 100 120 EDWIN_RESIZE_MW -> ctrlvalign in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 170 20 (loc "OS3DDNUMBER_0020") nil -> labelhalign in let crEdCtrlSelect winstr 180 ypos 100 120 EDWIN_RESIZE_MW -> ctrlhalign in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DDNUMBER_0012") nil -> labelo in let crEdCtrlFloat winstr 180 ypos 100 20 itof opacity 0.0 100.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlopacity in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DDNUMBER_0021") nil -> labelf in let crEdCtrlFloat winstr 180 ypos 100 20 itof fadespeed 0.0 1000.0 10.0 0 nil EDWIN_RESIZE_MW -> ctrlfadespeed in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DDNUMBER_0001") EDWIN_RESIZE_MW -> ctrlshow in ( setEdCtrlButtonCb ctrlbtnadd mkfun2 @cbAddList [ctrllist ctrladdlabel]; setEdCtrlButtonCb ctrlbtndel mkfun2 @cbDelList [ctrllist ctrladdlabel]; setEdCtrlTextLineCbValidate ctrladdlabel mkfun3 @cbAddActEvnt ctrllist; fillEdCtrlList ctrllist loadLabelsList inst; fillEdCtrlSelect ctrlvalign (loc "OS3DDNUMBER_0017")::(loc "OS3DDNUMBER_0015")::(loc "OS3DDNUMBER_0018")::nil; selectEdCtrlSelectByPos ctrlvalign valign; fillEdCtrlSelect ctrlhalign (loc "OS3DDNUMBER_0014")::(loc "OS3DDNUMBER_0015")::(loc "OS3DDNUMBER_0016")::nil; selectEdCtrlSelectByPos ctrlhalign halign; setEdCtrlCheckState ctrlshow show; [mkfun1 @cbCloseEdit [ctrltitle ctrlvalue ctrlminvalue ctrlmaxvalue ctrlstep ctrldec ctrllist theltselector ctrlvalign ctrlhalign ctrlopacity ctrlfadespeed ctrlshow] nil]; ); );;