/* ----------------------------------------------------------------------------- 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 ----------------------------------------------------------------------------- */ /*----------------------- Callbacks ------------------------*/ /* On close plugIT window */ fun cbCloseEdit(p)= let p -> [ctrlPath ctrlShowInterface] in let getEdCtrlTextLineValue ctrlPath -> path in let getEdCtrlCheckState ctrlShowInterface -> showInterface in ["path" path]:: ["showInterface" itoa showInterface]:: nil;; /* Get selected file path */ fun cbDlgGetPath(dlg, p, pfile)= 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 "OS3DGLOVE_0009") (loc "OS3DGLOVE_0012") 0; 0; ) else ( setEdCtrlTextLineValue ctrlPath file; 0; ); setEdCtrlButtonEnable ctrlBtn 1; ); 0;; /* On click button */ fun cbBtnBrowseFile(ctrlBtn, p)= let p -> [inst winstr ctrlPath] in let getEdCtrlTextLineValue ctrlPath -> path in let getPathFile path "" -> [fpath fname] in ( setEdCtrlButtonEnable ctrlBtn 1; _DLGrflopen _DLGOpenFile _channel winstr.EDW_win fpath fname "Flash\0*.swf\0All\0*.*\0\0" @cbDlgGetPath [inst ctrlBtn winstr ctrlPath]; ); 0;; fun cbRefreshBtn(pickbtn, p)= let p -> [ctrlobjname] in setEdCtrlTextLineValue ctrlobjname ""; 0;; /*---------------- Create plugIT interface -----------------*/ fun dynamicedit(winstr, inst, viewstr, applybtn)= let [420 100] -> [iw ih] in ( // Define window size setEdWindowSize winstr iw ih; //Load param from memory // Add file selector for calibration interface (SWF file) let (getPluginInstanceParam inst "path") -> path in let if path == nil then strcat (getPluginDirectory (getInstancePlugin inst)) "/res/calibration.swf" else path -> path in // Show Calibration Interface proposition let atoi(getPluginInstanceParam inst "showInterface") -> showInterface in let if showInterface == nil then 0 else showInterface -> showInterface in let crEdCtrlLabel winstr 10 40 160 20 (loc "OS3DGLOVE_0005") nil -> labelFlash in let crEdCtrlTextLine winstr 180 40 170 20 path nil EDWIN_RESIZE_MW -> ctrlPath in let crEdCtrlButton winstr 360 40 30 20 "..." nil -> browseFileBtn in let crEdCtrlButton winstr 385 40 35 20 "X" nil -> refreshPath in // Check box to show/hide calibration interface let crEdCtrlLabel winstr 10 70 160 20 (loc "OS3DGLOVE_0011") nil -> labelCalibInterface in let crEdCtrlCheck winstr 180 70 30 20 nil EDWIN_RESIZE_MW -> ctrlShowInterface in ( setEdCtrlTextLineEnable ctrlPath 0; setEdCtrlButtonCb browseFileBtn mkfun2 @cbBtnBrowseFile [inst winstr ctrlPath]; setEdCtrlCheckState ctrlShowInterface showInterface; setEdCtrlButtonCb refreshPath mkfun2 @cbRefreshBtn [ctrlPath]; // Define callback when plugIT window is closed //@cbCloseEdit; [mkfun1 @cbCloseEdit [ctrlPath ctrlShowInterface] nil]; ) );;