/* ----------------------------------------------------------------------------- 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 -> [ctrlpath ctrlinit] in let getEdCtrlTextLineValue ctrlpath -> path in let getEdCtrlCheckState ctrlinit -> init in ["path" path]:: ["init" itoa init]:: nil;; 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 "OS3DOPENFILE_0002") (loc "OS3DOPENFILE_0003") 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 winImportScene nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih "" ["All" "*.*"::nil]::["Bitmap" "bmp"::"jpg"::"png"::nil]::["OpenSpace3D scene" "xos"::"pkos"::"pak"::nil]::nil EDFILE_DIALOG_LIST_FOLDERS|EDFILE_DIALOG_SHOW_TOOLBAR nil sLastDirectory -> dlgfstr in ( setEdWindowIcon dlgfstr.EDFD_dialog sWinDlgIcon; setEdOpenFileDialogCb dlgfstr mkfun2 @cbDlgGetPath [inst ctrlbtn winstr ctrlpath]; 0; ); ); 0;; fun cbRefreshBtn(pickbtn, p)= let p -> [ctrlobjname] in setEdCtrlTextLineValue ctrlobjname ""; 0;; fun dynamicedit(winstr, inst, viewstr, applybtn)= let [455 90] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize winstr iw ih; let (getPluginInstanceParam inst "path") -> path in let if path == nil then "" else path -> path in let atoi (getPluginInstanceParam inst "init") -> init in let if init == nil then 0 else init -> init in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 150 20 (loc "OS3DGETPATH_0001") nil -> labelpath in let crEdCtrlTextLine winstr 160 10 (iw - 160 - 105) 20 path nil EDWIN_RESIZE_MW -> ctrlpath in let crEdCtrlButton winstr (iw - 100) 10 55 20 "..." nil -> pickfilebtn in let crEdCtrlButton winstr (iw - 40) 10 35 20 "X" nil -> refreshpath in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DGETPATH_0002") EDWIN_RESIZE_MW -> ctrlinit in ( setEdCtrlTextLineEnable ctrlpath 0; setEdCtrlButtonCb pickfilebtn mkfun2 @cbBtnPickFile [inst winstr ctrlpath]; setEdCtrlButtonCb refreshpath mkfun2 @cbRefreshBtn [ctrlpath]; setEdCtrlCheckState ctrlinit init; [mkfun1 @cbCloseEdit [ctrlpath ctrlinit] nil]; ); );;