/* ----------------------------------------------------------------------------- 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 cbDestroyEdit()= 0;; fun getList(ctrllist)= let getEdCtrlListElems ctrllist -> list in let nil -> paramlist in let getEdCtrlListNbElems ctrllist -> nbElems in let 0 -> i in ( while (i < nbElems) do ( let nth_list list i -> mat in let [(strcat "elem_" (itoa i)) mat] -> matparam in set paramlist = matparam::paramlist; set i = i + 1; ); paramlist; );; fun cbCloseEdit(p)= let p -> [ctrltype ctrllist] in let getSelectedEdCtrlSelect ctrltype -> type in ["type" type]:: (getList ctrllist);; fun cbAddList(ctrlstr, p)= let p -> [ctrllist ctrlvalue] in let getEdCtrlTextLineValue ctrlvalue -> value in if (value == nil) || (!strcmp "" strtrim value) then nil else ( addEdCtrlList ctrllist value nil nil; setEdCtrlTextLineValue ctrlvalue ""; ); 0;; fun cbDelList(ctrlstr, p)= let p -> [ctrllist ctrlvalue] in let getSelectedEdCtrlList ctrllist -> [name _ _] in delEdCtrlList ctrllist name; 0;; fun loadList(inst)= let 0 -> i in let nil -> list in let getPluginInstanceParam inst (strcat "elem_" (itoa i)) -> elem in ( while (elem != nil) do ( set i = i + 1; set list = elem::list; set elem = getPluginInstanceParam inst (strcat "elem_" (itoa i)); ); revertlist list; );; fun dynamicedit(ewinstr, inst, viewstr, applybtn)= let [420 230] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize ewinstr iw ih; let (getPluginInstanceParam inst "type") -> type in let if type == nil then "String" else type -> type in let crEdFrameWindow _channel ewinstr 0 0 iw 55 EDWIN_RESIZE_MW nil (loc "OS3DLIST_0002") (loc "OS3DLIST_0001") -> 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 "OS3DLIST_0003") nil -> labeltype in let crEdCtrlSelect winstr 180 ypos 200 120 EDWIN_RESIZE_MW -> ctrltype in let crEdFrameWindow _channel ewinstr 0 0 iw 175 EDWIN_RESIZE_MW nil (loc "OS3DLIST_0004") (loc "OS3DLIST_0001") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 155 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 170 20 (loc "OS3DLIST_0005") nil -> labelmat in let crEdCtrlList winstr 10 (set ypos = ypos + 25) (iw - 20) 90 LB_BORDER|LB_VSCROLL|ET_TABFOCUS EDWIN_RESIZE_MW|EDWIN_RESIZE_MH -> ctrllist in let crEdCtrlTextLine winstr 10 (set ypos = ypos + 95) (iw-10-60) 20 "" nil EDWIN_RESIZE_MW -> ctrlvalue 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 ( fillEdCtrlSelect ctrltype "String"::"Hexa"::"Int"::"Float"::nil; selectEdCtrlSelect ctrltype type; fillEdCtrlList ctrllist (loadList inst); setEdCtrlButtonCb ctrlbtnadd mkfun2 @cbAddList [ctrllist ctrlvalue]; setEdCtrlButtonCb ctrlbtndel mkfun2 @cbDelList [ctrllist ctrlvalue]; [(mkfun1 @cbCloseEdit [ctrltype ctrllist]) @cbDestroyEdit]; ); );;