/* ----------------------------------------------------------------------------- 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 sizelist l -> size in let nil -> ndata in let 0 -> i in ( while i < size do ( let nth_list l i -> elem in if (!strcmpi elem "__") then nil else set ndata = ["EVENT" elem]::ndata; set i = i + 1; ); ndata; );; fun getMenu(l)= let sizelist l -> size in let nil -> ndata in let 0 -> i in ( while i < size do ( let nth_list l i -> elem in set ndata = strcatn ndata::elem::"\n"::nil; set i = i + 1; ); ndata; );; fun cbCloseEdit(p)= let p -> [ctrlpath ctrltitle ctrlevent ctrlballoon ctrlminimize ctrlinit] in let getEdCtrlTextLineValue ctrlpath -> path in let getEdCtrlEditTextValue ctrltitle -> title in let getEdCtrlListElems ctrlevent -> levent in let ftoi getEdCtrlFloatValue ctrlballoon -> balloonTimeout in let getEdCtrlCheckState ctrlminimize -> minimize in let getEdCtrlCheckState ctrlinit -> init in ["path" path]:: ["title" title]:: ["balloonTimeout" itoa balloonTimeout]:: ["minimize" itoa minimize]:: ["init" itoa init]:: ["menu" getMenu levent]:: (getEvents levent);; fun cbDlgGetFile(pfile, p)= let p -> [inst ctrlbtn winstr ctrlpath] in ( if pfile == nil then nil else let _PtoScol pfile -> file in if file == nil then ( _DLGMessageBox _channel winstr.EDW_win (loc "OS3DTASKICON_0003") (loc "OS3DTASKICON_0012") 0; 0; ) else ( setEdCtrlTextLineValue ctrlpath file; ); setEdCtrlButtonEnable ctrlbtn 1; ); 0;; fun cbBtnPickFile(ctrlbtn, p)= let p -> [inst winstr ctrlpath] in let getEdCtrlTextLineValue ctrlpath -> path in let getPathFile path "" -> [fpath fname] in ( setEdCtrlButtonEnable ctrlbtn 0; let _GETdesktopSize -> [sw sh] in let getEdWindowPos mainInterf.MINT_winMain -> [nx ny] in let getEdWindowSize mainInterf.MINT_winMain -> [nmw nmh] in let [750 450] -> [iw ih] in let crEdOpenFileBitmapDialog _channel winstr nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih "" ["Bitmaps" "bmp"::"jpg"::"png"::"tga"::nil]::["Bitmap" "bmp"::nil]::["Jpeg" "jpg"::nil]::["PNG" "png"::nil]::["Targa" "tga"::nil]::nil EDFILE_DIALOG_LIST_FOLDERS|EDFILE_DIALOG_SHOW_TOOLBAR nil path -> dlgfstr in ( setEdWindowIcon dlgfstr.EDFD_dialog sWinDlgIcon; setEdOpenFileDialogCb dlgfstr mkfun2 @cbDlgGetFile [inst ctrlbtn winstr ctrlpath]; ); ); 0;; fun cbRefreshBtn(pickbtn, ctrlpath)= setEdCtrlTextLineValue ctrlpath ""; 0;; fun cbAddActEvnt(ctrlstr, value, p)= let p -> [liststr ctrladdevent] in if (value == nil) || (!strcmp "" strtrim value) then nil else let getEdCtrlListElems liststr -> lelem in if (isStringInList lelem value) && (strcmp value "__") then nil else ( addEdCtrlList liststr value nil nil; setEdCtrlTextLineValue ctrlstr nil; ); 0;; fun cbAddList(ctrlstr, p)= let p -> [liststr ctrladdevent] in let getEdCtrlTextLineValue ctrladdevent -> value in if (value == nil) || (!strcmp "" strtrim value) then nil else let getEdCtrlListElems liststr -> lelem in if (isStringInList lelem value) && (strcmp value "__") then nil else ( addEdCtrlList liststr value nil nil; setEdCtrlTextLineValue ctrladdevent nil; ); 0;; fun cbDelList(ctrlstr, p)= let p -> [liststr ctrladdevent] in let getSelectedEdCtrlList liststr -> [name _ _] in delEdCtrlList liststr name; 0;; fun cbAddSep(ctrlstr, liststr)= addEdCtrlList liststr "__" nil nil; 0;; fun loadMenu(menu)= let strextr menu -> l in let sizelist l -> size in let nil -> ndata in let 0 -> i in ( while i < size do ( let nth_list l i -> elem in set ndata = lcat ndata (strcatnSep elem " ")::nil; set i = i + 1; ); ndata; );; fun dynamicedit(ewinstr, inst, viewstr, applybtn)= let [420 355] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize ewinstr iw ih; let (getPluginInstanceParam inst "path") -> path in let (getPluginInstanceParam inst "title") -> title in let (getPluginInstanceParam inst "menu") -> menu in let atoi (getPluginInstanceParam inst "minimize") -> minimize in let if minimize == nil then 1 else minimize -> minimize in let atof (getPluginInstanceParam inst "balloonTimeout") -> balloonTimeout in let if balloonTimeout == nil then 5.0 else balloonTimeout -> balloonTimeout in let atoi (getPluginInstanceParam inst "init") -> init in let if init == nil then 1 else init -> init in let crEdFrameWindow _channel ewinstr 0 0 iw 120 EDWIN_RESIZE_MW nil (loc "OS3DTASKICON_0004") (loc "OS3DTASKICON_0006") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 100 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 110 20 (loc "OS3DTASKICON_0002") nil -> labelobj in let crEdCtrlTextLine winstr 130 ypos 190 20 path nil EDWIN_RESIZE_MW -> ctrlpath in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> filebtn in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshpath in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) 110 20 (loc "OS3DTASKICON_0011") nil -> labelbubble in let crEdCtrlEditText winstr 130 ypos (iw - 130) 50 title ET_AVSCROLL|ET_VSCROLL|ET_ALIGN_LEFT|ET_BORDER EDWIN_RESIZE_MW -> ctrltitle in let crEdFrameWindow _channel ewinstr 0 0 iw 120 EDWIN_RESIZE_MW nil (loc "OS3DTASKICON_0005") (loc "OS3DTASKICON_0006") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 100 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlList winstr 10 (set ypos = 10) (iw - 20) 60 LB_BORDER|LB_VSCROLL|ET_TABFOCUS EDWIN_RESIZE_MW|EDWIN_RESIZE_MH -> ctrlevent in let crEdCtrlTextLine winstr 10 (set ypos = ypos + 65) (iw - 100) 20 nil nil EDWIN_RESIZE_MW -> ctrladdevent in let crEdCtrlButton winstr (iw - 85) ypos 20 20 "+" EDWIN_RESIZE_MW -> ctrlbtnadd1 in let crEdCtrlButton winstr (iw - 60) ypos 20 20 "-" EDWIN_RESIZE_MW -> ctrlbtndel1 in let crEdCtrlButton winstr (iw - 35) ypos 25 20 (loc "OS3DTASKICON_0009") EDWIN_RESIZE_MW -> ctrlbtnsep in let crEdFrameWindow _channel ewinstr 0 0 iw 115 EDWIN_RESIZE_MW nil (loc "OS3DTASKICON_0008") (loc "OS3DTASKICON_0006") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 85 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 (set ypos = 10) 170 20 (loc "OS3DTASKICON_0001") nil -> labelballoon in let crEdCtrlFloat winstr 190 ypos 100 20 balloonTimeout 0.0 100000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlballoon in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DTASKICON_0007") EDWIN_RESIZE_MW -> ctrlminimize in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DTASKICON_0010") EDWIN_RESIZE_MW -> ctrlinit in ( setEdCtrlCheckState ctrlinit init; setEdCtrlCheckState ctrlminimize minimize; setEdCtrlButtonCb filebtn mkfun2 @cbBtnPickFile [inst winstr ctrlpath]; setEdCtrlTextLineEnable ctrlpath 0; setEdCtrlButtonCb refreshpath mkfun2 @cbRefreshBtn ctrlpath; setEdCtrlButtonCb ctrlbtnadd1 mkfun2 @cbAddList [ctrlevent ctrladdevent]; setEdCtrlButtonCb ctrlbtndel1 mkfun2 @cbDelList [ctrlevent ctrladdevent]; setEdCtrlButtonCb ctrlbtnsep mkfun2 @cbAddSep ctrlevent; setEdCtrlTextLineCbValidate ctrladdevent mkfun3 @cbAddActEvnt [ctrlevent ctrladdevent]; fillEdCtrlList ctrlevent loadMenu menu; [mkfun1 @cbCloseEdit [ctrlpath ctrltitle ctrlevent ctrlballoon ctrlminimize ctrlinit] nil]; ); );;