/* ----------------------------------------------------------------------------- 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 getXmlLabels(lmarkstr, chain, utf8, ret)= let chain -> cchain in if (lmarkstr == nil) then ret else ( let hd lmarkstr -> markstr in ( set chain = strcatn chain::(if (chain == nil) then "" else ".")::markstr.XMLvalue::nil; let 0 -> sp in let (strlen markstr.XMLdata) - 1 -> ep in let substr markstr.XMLdata sp 1 -> fc in let substr markstr.XMLdata ep 1 -> ec in if ((strcmp "{" fc) || (strcmp "}" ec)) then nil else ( let substr markstr.XMLdata 1 (ep - 1) -> label in let if (utf8) then utf8tostr label else label -> label in ( set ret = ["EVENT" chain]::ret; //addLogMessage strcatn "Label : "::chain::" : "::label::nil; ); ); set ret = getXmlLabels markstr.XMLsons chain utf8 ret; ); set ret = getXmlLabels tl lmarkstr cchain utf8 ret; );; fun cbDestroyEdit()= 0;; fun cbCloseEdit(p)= let p -> [ctrlref ctrlpath ctrlinit] in let getEdCtrlTextLineValue ctrlref -> refpath in let getEdCtrlTextLineValue ctrlpath -> path in let getEdCtrlCheckState ctrlinit -> init in let XMLloadManual refpath -> xmlstr in let getXmlLabels xmlstr.XMLmarks nil (if (strfindi "utf-8" xmlstr.XMLtype 0) != nil then 1 else 0) nil -> events in ["refpath" refpath]:: ["path" path]:: ["init" itoa init]:: events;; fun cbDlgGetPath(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 "OS3D_0452") (loc "OS3D_0472") 0; 0; ) else ( setEdCtrlTextLineValue ctrlpath file; 0; ); 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 1; 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 crEdOpenFileDialog _channel winstr nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih "" ["XML" "xml"::nil]::["All" "*.*"::nil]::nil EDFILE_DIALOG_LIST_FOLDERS|EDFILE_DIALOG_SHOW_TOOLBAR nil path -> dlgfstr in ( setEdWindowIcon dlgfstr.EDFD_dialog sWinDlgIcon; setEdOpenFileDialogCb dlgfstr mkfun2 @cbDlgGetPath [inst ctrlbtn winstr ctrlpath]; 0; ); ); 0;; fun cbRefreshBtn(pickbtn, p)= let p -> [ctrlobjname defscriptpath] in setEdCtrlTextLineValue ctrlobjname defscriptpath; 0;; fun dynamicedit(ewinstr, inst, viewstr, applybtn)= let [420 130] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize ewinstr iw ih; let (getPluginInstanceParam inst "refpath") -> refpath in let (getPluginInstanceParam inst "path") -> path 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 80 EDWIN_RESIZE_MW nil (loc "OS3DXMLREADER_0002") (loc "OS3DXMLREADER_0001") -> 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 "OS3DXMLREADER_0003") nil -> labelref in let crEdCtrlTextLine winstr 180 ypos 140 20 refpath nil EDWIN_RESIZE_MW -> ctrlref in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickbtn1 in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshpath1 in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DXMLREADER_0004") nil -> labelpath in let crEdCtrlTextLine winstr 180 ypos 140 20 path nil EDWIN_RESIZE_MW -> ctrlpath in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickbtn2 in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshpath2 in let crEdFrameWindow _channel ewinstr 0 0 iw 60 EDWIN_RESIZE_MW nil (loc "OS3DXMLREADER_0005") (loc "OS3DXMLREADER_0001") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 35 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlCheck winstr 10 (set ypos = 10) 280 20 (loc "OS3DXMLREADER_0006") EDWIN_RESIZE_MW -> ctrlinit in ( setEdCtrlButtonCb pickbtn1 mkfun2 @cbBtnPickFile [inst winstr ctrlref]; setEdCtrlTextLineEnable ctrlref 0; setEdCtrlButtonCb refreshpath1 mkfun2 @cbRefreshBtn [ctrlref ""]; setEdCtrlButtonCb pickbtn2 mkfun2 @cbBtnPickFile [inst winstr ctrlpath]; setEdCtrlTextLineEnable ctrlpath 0; setEdCtrlButtonCb refreshpath2 mkfun2 @cbRefreshBtn [ctrlpath ""]; setEdCtrlCheckState ctrlinit init; [(mkfun1 @cbCloseEdit [ctrlref ctrlpath ctrlinit]) @cbDestroyEdit]; ); );;