/* ----------------------------------------------------------------------------- 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 getListSave(ctrltree, litems, suffix)= let nil -> save in if litems == nil then nil else ( let if suffix == nil then "" else suffix -> suffix in let sizelist litems -> size in let 0 -> i in while (litems != nil) do ( let hd litems -> item in let (strcatn suffix::"_"::(itoa i)::nil) -> newsuffix in let getListSave ctrltree revertlist (getEdCtrlTreeSonsItem ctrltree item) newsuffix -> childrensave in ( if childrensave == nil then nil else set save = lcat childrensave save; let getEdCtrlTreeValueByItem ctrltree item -> [value type] in set save = [(strcat "label" newsuffix) (getEdCtrlTreeLabelByItem ctrltree item)]::[(strcat "value" newsuffix) value]::save; ); set litems = tl litems; set i = i + 1; ); save; );; fun cbCloseEdit(p)= let p -> [ctrltitle ctrlokbtn ctrltree ctrlroot ctrlxoffset ctrlyoffset ctrlunfold theltselector ctrlvalign ctrlhalign ctrlopacity ctrlfadespeed /*ctrlmultiselect*/ ctrlshow] in let getEdCtrlTextLineValue ctrltitle -> title in let getEdCtrlCheckState ctrlokbtn -> okbtn in let getListSave ctrltree revertlist(getEdCtrlTreeSonsItem ctrltree ctrlroot) nil -> listsave in let ftoi getEdCtrlFloatValue ctrlxoffset -> levelxoffset in let ftoi getEdCtrlFloatValue ctrlyoffset -> levelyoffset in let getEdCtrlCheckState ctrlunfold -> unfold in let getThemeEltSelectorSave theltselector -> thdefsave in let getSelectedEdCtrlSelectPos ctrlvalign -> valign in let getSelectedEdCtrlSelectPos ctrlhalign -> halign in let ftoi getEdCtrlFloatValue ctrlopacity -> opacity in let ftoi getEdCtrlFloatValue ctrlfadespeed -> fadespeed in //let getEdCtrlCheckState ctrlmultiselect -> multiselect in let getEdCtrlCheckState ctrlshow -> show in ["title" title]:: ["okbtn" itoa okbtn]:: ["levelxoffset" itoa levelxoffset]:: ["levelyoffset" itoa levelyoffset]:: ["unfold" itoa unfold]:: ["valign" itoa valign]:: ["halign" itoa halign]:: ["opacity" itoa opacity]:: ["fadespeed" itoa fadespeed]:: //["multiselect" itoa multiselect]:: ["show" itoa show]:: (lcat listsave thdefsave);; fun cbTreeSelect(ctrlstr, itemfather, selected, value, type, p)= let p -> [ctrltree ctrlroot ctrllabel ctrlvalue addmenubtn editmenubtn delmenubtn] in ( if (type == 0) then ( setEdCtrlButtonEnable editmenubtn 0; setEdCtrlButtonEnable delmenubtn 0; setEdCtrlTextLineEnable ctrllabel 0; setEdCtrlTextLineValue ctrllabel "List"; setEdCtrlTextLineEnable ctrlvalue 0; setEdCtrlTextLineValue ctrlvalue ""; ) else ( setEdCtrlButtonEnable editmenubtn 1; setEdCtrlButtonEnable delmenubtn 1; setEdCtrlTextLineEnable ctrllabel 1; setEdCtrlTextLineValue ctrllabel (getEdCtrlTreeLabelByItem ctrltree selected); setEdCtrlTextLineEnable ctrlvalue 1; let getEdCtrlTreeValueByItem ctrltree selected -> [value type] in setEdCtrlTextLineValue ctrlvalue value; ); ); 0;; fun cbAddList(ctrlstr, p)= let p -> [ctrltree ctrlroot ctrlnew] in let getEdCtrlTreeSelectedItem ctrltree -> selected in let if selected == nil then ctrlroot else selected -> selected in let strtrim getEdCtrlTextLineValue ctrlnew -> label in let getEdCtrlTreeValueByItem ctrltree selected -> [value type] in let (type + 1) -> depth in if (label == nil) || ((strcmpi label "") == 0) then nil else ( let addEdCtrlTreeItem ctrltree selected label label depth strcat APPBASEDIR "os3deditor/res/tree_menu.png" -> new in selEdCtrlTreeItem ctrltree new; setEdCtrlTextLineValue ctrlnew ""; ); 0;; fun cbAdd(ctrlstr, value, p)= cbAddList nil p; 0;; fun cbEditList(ctrlstr, p)= let p -> [ctrltree ctrlroot ctrllabel ctrlvalue ewinstr] in let getEdCtrlTreeSelectedItem ctrltree -> selected in let strtrim getEdCtrlTextLineValue ctrllabel -> label in let strtrim getEdCtrlTextLineValue ctrlvalue -> value in if (label == nil) || ((strcmpi label "") == 0) then ( _DLGMessageBox _channel ewinstr.EDW_win (loc "OS3DMENU_0035") (loc "OS3DMENU_0036") 0; 0; ) else ( setEdCtrlTreeLabel ctrltree selected label; setEdCtrlTreeValue ctrltree selected value; 0; ); 0;; fun cbEdit(ctrlstr, value, p)= cbEditList nil p; 0;; fun cbDelList(ctrlstr, ctrltree)= let getEdCtrlTreeSelectedItem ctrltree -> selected in delEdCtrlTreeItem ctrltree selected; 0;; fun fillTree(inst, ctrltree, ctrlparent, suffix)= let if suffix == nil then "" else suffix -> suffix in let getEdCtrlTreeValueByItem ctrltree ctrlparent -> [value type] in let nil -> litems in let 0 -> i in let 0 -> end in while end != 1 do ( let (strcatn suffix::"_"::(itoa i)::nil) -> newsuffix in let getPluginInstanceParam inst strcat "label" newsuffix -> label in let getPluginInstanceParam inst strcat "value" newsuffix -> value in if label == nil then set end = 1 else ( let addEdCtrlTreeItem ctrltree ctrlparent label value (type + 1) (strcat APPBASEDIR "os3deditor/res/tree_menu.png") -> newitem in fillTree inst ctrltree newitem newsuffix; 0; ); set i = i + 1; ); 0;; fun dynamicedit(ewinstr, inst, viewstr, applybtn)= let [455 540] -> [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 atoi (getPluginInstanceParam inst "okbtn") -> okbtn in let if (okbtn == nil) then 1 else okbtn -> okbtn in let atoi (getPluginInstanceParam inst "levelxoffset") -> levelxoffset in let if (levelxoffset == nil) then 10 else levelxoffset -> levelxoffset in let atoi (getPluginInstanceParam inst "levelyoffset") -> levelyoffset in let if (levelyoffset == nil) then 0 else levelyoffset -> levelyoffset in let atoi (getPluginInstanceParam inst "unfold") -> unfold in let if (unfold == nil) then 0 else unfold -> unfold 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 "multiselect") -> multiselect in //let if (multiselect == nil) then 0 else multiselect -> multiselect 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 85 EDWIN_RESIZE_MW nil (loc "OS3DDLIST_0004") (loc "OS3DDLIST_0002") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 60 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3DDLIST_0005") nil -> labeltitle in let crEdCtrlTextLine winstr 180 ypos 170 20 title nil EDWIN_RESIZE_MW -> ctrltitle in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DDLIST_0015") EDWIN_RESIZE_MW -> ctrlokbtn in let crEdFrameWindow _channel ewinstr 0 0 iw 295 EDWIN_RESIZE_MW nil (loc "OS3DDLIST_0006") (loc "OS3DDLIST_0002") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 270 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlTree winstr 10 (set ypos = 10) 200 250 EDWIN_RESIZE_MW -> ctrltree in let addEdCtrlTreeItem ctrltree nil "list" "list" 0 strcat APPBASEDIR "os3deditor/res/tree_menu.png" -> ctrlroot in let crEdCtrlLabel winstr 220 ((set ypos = 10) + 2) 120 20 (loc "OS3DDLIST_0007") nil -> labeloffset in let crEdCtrlFloat winstr 350 ypos 50 20 (itof levelxoffset) 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlxoffset in let crEdCtrlFloat winstr 405 ypos 50 20 (itof levelyoffset) 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlyoffset in let crEdCtrlCheck winstr 220 (set ypos = ypos + 25) 235 20 (loc "OS3DDLIST_0016") EDWIN_RESIZE_MW -> ctrlunfold in let crEdCtrlLabel winstr 220 ((set ypos = ypos + 50) + 2) 45 20 (loc "OS3DDLIST_0008") nil -> labellabel in let crEdCtrlTextLine winstr 275 ypos 180 20 "" nil EDWIN_RESIZE_MW -> ctrllabel in let crEdCtrlLabel winstr 220 ((set ypos = ypos + 25) + 2) 45 20 (loc "OS3DDLIST_0017") nil -> labelvalue in let crEdCtrlTextLine winstr 275 ypos 180 20 "" nil EDWIN_RESIZE_MW -> ctrlvalue in let crEdCtrlButton winstr 300 (set ypos = ypos + 25) 75 20 (loc "OS3DDLIST_0009") nil -> editmenubtn in let crEdCtrlButton winstr 380 ypos 75 20 (loc "OS3DDLIST_0010") nil -> delmenubtn in let crEdCtrlLabel winstr 220 ((set ypos = ypos + 30) + 2) 200 20 (loc "OS3DDLIST_0011") nil -> labelnew in let crEdCtrlTextLine winstr 220 (set ypos = ypos + 25) 155 20 "" nil EDWIN_RESIZE_MW -> ctrlnew in let crEdCtrlButton winstr 380 ypos 75 20 (loc "OS3DDLIST_0012") nil -> addmenubtn in let crThemeEltSelector inst ewinstr nil "dialogBox"::"list"::nil iw ih -> theltselector in let crEdFrameWindow _channel ewinstr 0 0 iw 160 EDWIN_RESIZE_MW nil (loc "OS3DDLIST_0003") (loc "OS3DDLIST_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 "OS3DDLIST_0023") 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 "OS3DDLIST_0024") 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 "OS3DDLIST_0013") 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 "OS3DDLIST_0025") 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 "OS3DDLIST_0014") EDWIN_RESIZE_MW -> ctrlmultiselect in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DDLIST_0001") EDWIN_RESIZE_MW -> ctrlshow in ( setEdCtrlCheckState ctrlokbtn okbtn; fillTree inst ctrltree ctrlroot nil; setEdCtrlTreeExpandAll ctrltree 1; setEdCtrlTreeCbSelect ctrltree mkfun6 @cbTreeSelect [ctrltree ctrlroot ctrllabel ctrlvalue addmenubtn editmenubtn delmenubtn]; selEdCtrlTreeItem ctrltree ctrlroot; setEdCtrlButtonCb addmenubtn mkfun2 @cbAddList [ctrltree ctrlroot ctrlnew]; setEdCtrlButtonCb editmenubtn mkfun2 @cbEditList [ctrltree ctrlroot ctrllabel ctrlvalue ewinstr]; setEdCtrlButtonCb delmenubtn mkfun2 @cbDelList ctrltree; setEdCtrlCheckState ctrlunfold unfold; setEdCtrlTextLineCbValidate ctrllabel mkfun3 @cbEdit [ctrltree ctrlroot ctrllabel ctrlvalue ewinstr]; setEdCtrlTextLineCbValidate ctrlvalue mkfun3 @cbEdit [ctrltree ctrlroot ctrllabel ctrlvalue ewinstr]; setEdCtrlTextLineCbValidate ctrlnew mkfun3 @cbAdd [ctrltree ctrlroot ctrlnew]; fillEdCtrlSelect ctrlvalign (loc "OS3DDLIST_0021")::(loc "OS3DDLIST_0019")::(loc "OS3DDLIST_0022")::nil; selectEdCtrlSelectByPos ctrlvalign valign; fillEdCtrlSelect ctrlhalign (loc "OS3DDLIST_0018")::(loc "OS3DDLIST_0019")::(loc "OS3DDLIST_0020")::nil; selectEdCtrlSelectByPos ctrlhalign halign; //setEdCtrlCheckState ctrlmultiselect multiselect; setEdCtrlCheckState ctrlshow show; [mkfun1 @cbCloseEdit [ctrltitle ctrlokbtn ctrltree ctrlroot ctrlxoffset ctrlyoffset ctrlunfold theltselector ctrlvalign ctrlhalign ctrlopacity ctrlfadespeed /*ctrlmultiselect*/ ctrlshow] nil]; ); );;