/* This plugin allows you to run any code written in Scol to OpenSpace3D Copyright (C) 2011, Stephane Bisaro, aka iri OpenSpace3d is a software made by I-maginer. This library 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.1 of the License, or (at your option) any later version. This library 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 library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /*! \brief Callback on plugIT instance editor closed * * called on Apply / Ok button, this callback return the parameters to save in the XOS project * * Prototype: fun [] [[S S] r1] * * \return [[S S] r1] : parameters to save in the instance XML data **/ fun cbCloseEdit(u)= let u -> [ctrlcode ctrlmain] in let getEdCtrlEditTextValue ctrlcode -> code in let getEdCtrlTextLineValue ctrlmain -> main in ["code" code] :: ["function" main] :: nil;; /*! \brief Callback on plugIT instance editor destroyed * * called when the editor window is destroyed, this is useful to destroy added objects or resources * * Prototype: fun [] I * * \return I : 0 **/ fun cbDestroyEdit()= 0;; /*! \brief Callback on plugIT instance editor opened * * called when a user the plugIT Editor * * Prototype: fun [EdWindow PInstance V3Dview] I * * \param EdWindow : editor window structure * \param PInstance : plugIT instance * \param V3Dview : default 3D view structure * * \return @fun [] [[S S] r1] : Callback to call on close **/ fun dynamicedit(winstr, inst, viewstr, applybtn)= // initiale size of the window let [400 590] -> [iw ih] in ( // resize the editor window setEdWindowSize winstr iw ih; // retrieve the current params values let getPluginInstanceParam inst "code" -> code in let getPluginInstanceParam inst "function" -> main in // create graphicals components let crEdCtrlEditText winstr 10 35 iw-20 ih-85 code ET_AHSCROLL|ET_AVSCROLL|ET_DOWN EDWIN_RESIZE_MW -> ctrlcode in let crEdCtrlTextLine winstr 10 ih-25 iw-20 20 main ET_AHSCROLL|ET_DOWN EDWIN_RESIZE_MW -> ctrlmain in ( crEdCtrlText winstr 10 10 iw-20 20 (loc "OS3DADDSOURCECODE_0007") nil EDWIN_RESIZE_MW; crEdCtrlText winstr 10 ih-50 iw-20 20 (loc "OS3DADDSOURCECODE_0004") nil EDWIN_RESIZE_MW; [(mkfun1 @cbCloseEdit [ctrlcode ctrlmain]) @cbDestroyEdit]; ) );;