/* ----------------------------------------------------------------------------- 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 ----------------------------------------------------------------------------- */ /* Version : 1.0 First version : 05/08/2010 Author : Bourineau Bastien */ /*! \brief Callback on plugIT instance editor closed * * Prototype: fun [] [[S S] r1] * * \return [[S S] r1] : parameters to save in the instance XML data **/ fun cbCloseEdit(p)= let p -> [ctrlauto ctrlport ctrlspeed ctrlendchar ctrlinit] in ["auto" itoa (getEdCtrlCheckState ctrlauto)]:: ["port" (getSelectedEdCtrlSelect ctrlport)]:: ["speed" (getSelectedEdCtrlSelect ctrlspeed)]:: ["lastchar" itoa (getSelectedEdCtrlSelectPos ctrlendchar)]:: ["init" itoa (getEdCtrlCheckState ctrlinit)]:: nil;; /*! \brief Callback on plugIT instance editor opened * * 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)= let [400 130] -> [iw ih] in ( setEdWindowSize winstr iw ih; let atoi (getPluginInstanceParam inst "auto") -> auto in let if auto == nil then 1 else auto -> auto in let (getPluginInstanceParam inst "port") -> sport in let if sport == nil then "0" else sport -> sport in let (getPluginInstanceParam inst "speed") -> speed in let if speed == nil then "115200" else speed -> speed in let atoi (getPluginInstanceParam inst "lastchar") -> lastchar in let if lastchar == nil then 2 else lastchar -> lastchar in let atoi (getPluginInstanceParam inst "init") -> init in let if init == nil then 1 else init -> init in let 10 -> ypos in let crEdCtrlCheck winstr 10 (ypos + 2) (iw - 20) 20 (loc "OS3DMBIT_0001") EDWIN_RESIZE_MW -> ctrlauto in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DMBIT_0002") nil -> labeltitle in let crEdCtrlSelect winstr 180 ypos 200 120 EDWIN_RESIZE_MW -> ctrlport in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DMBIT_0004") nil -> labelspeed in let crEdCtrlSelect winstr 180 ypos 200 120 EDWIN_RESIZE_MW -> ctrlspeed in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DMBIT_0003") nil -> labelendchar in let crEdCtrlSelect winstr 180 ypos 200 120 EDWIN_RESIZE_MW -> ctrlendchar in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DMBIT_0010") EDWIN_RESIZE_MW -> ctrlinit in ( setEdCtrlCheckState ctrlauto auto; let 0 -> i in while i < 256 do ( addEdCtrlSelect ctrlport itoa i; set i = i + 1; ); selectEdCtrlSelect ctrlport sport; fillEdCtrlSelect ctrlspeed "110"::"300"::"600"::"1200"::"2400"::"4800"::"9600"::"14400"::"19200"::"38400"::"56000"::"57600"::"115200"::"128000"::"256000"::nil; selectEdCtrlSelect ctrlspeed speed; fillEdCtrlSelect ctrlendchar "NONE"::"CR (/13)"::"CRLF (/13/10)"::nil; selectEdCtrlSelectByPos ctrlendchar lastchar; setEdCtrlCheckState ctrlinit init; [mkfun1 @cbCloseEdit [ctrlauto ctrlport ctrlspeed ctrlendchar ctrlinit] nil]; ); );;