/* ----------------------------------------------------------------------------- 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 cbCloseEdit(p)= let p -> [ctrltype ctrltext ctrlpath] in let getEdCtrlTextLineValue ctrltype -> type in let getEdCtrlEditTextValue ctrltext -> text in let getEdCtrlTextLineValue ctrlpath -> path in ["type" type]:: ["text" text]:: ["path" path]:: nil;; fun cbRefreshBtn(pickbtn, p)= let p -> [inst winstr ctrlobjname] in setEdCtrlTextLineValue ctrlobjname ""; 0;; 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 "OS3DPICTURE_0005") (loc "OS3DPICTURE_0030") 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 "" ["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 dynamicedit(ewinstr, inst, viewstr, applybtn)= let [400 185] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize ewinstr iw ih; let (getPluginInstanceParam inst "type") -> type in let if (type == nil) then "*/*" else type -> type in let (getPluginInstanceParam inst "text") -> text in let if (text == nil) then "" else text -> text in let (getPluginInstanceParam inst "path") -> path in let if (path == nil) then "" else path -> path in let if (((strcmp type "") != 0) && ((strcmp type "*/*") != 0)) then 1 else 0 -> havespecialtype in ( if !havespecialtype then nil else set ih = ih + 35; let crEdFrameWindowEx _channel ewinstr 0 0 iw 55 EDWIN_RESIZE_MW nil (loc "OS3DSHARE_0001") (loc "OS3DSHARE_0002") !havespecialtype -> 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 "OS3DSHARE_0003") nil -> labeltype in let crEdCtrlTextLine winstr 180 ypos (iw - 200) 20 type nil EDWIN_RESIZE_MW -> ctrltype in let crEdFrameWindow _channel ewinstr 0 0 iw 165 EDWIN_RESIZE_MW nil (loc "OS3DSHARE_0004") (loc "OS3DSHARE_0002") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 145 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3DSHARE_0005") nil -> labeltext in let crEdCtrlEditText winstr 10 (set ypos = ypos + 25) iw-20 80 text nil EDWIN_RESIZE_MW -> ctrltext in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 85) + 2) 120 20 (loc "OS3DSHARE_0006") nil -> labelpath in let crEdCtrlTextLine winstr 140 ypos (iw - 140 - 110) 20 path nil EDWIN_RESIZE_MW -> ctrlpath in let crEdCtrlButton winstr (iw - 105) ypos 55 20 "..." nil -> pickfilebtn in let crEdCtrlButton winstr (iw - 45) ypos 35 20 "X" nil -> refreshpath in ( setEdCtrlTextLineEnable ctrlpath 0; setEdCtrlButtonCb pickfilebtn mkfun2 @cbBtnPickFile [inst winstr ctrlpath]; setEdCtrlButtonCb refreshpath mkfun2 @cbRefreshBtn [inst winstr ctrlpath]; [mkfun1 @cbCloseEdit [ctrltype ctrltext ctrlpath] nil]; ); ); );;