/* ----------------------------------------------------------------------------- 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 -> [ctrlhost ctrlport ctrlgenerateid ctrlappid ctrlroom ctrlautostart ctrlautoreco ctrlretry] in let getEdCtrlTextLineValue ctrlhost -> host in let ftoi (getEdCtrlFloatValue ctrlport) -> port in let getEdCtrlCheckState ctrlgenerateid -> generateid in let getEdCtrlTextLineValue ctrlappid -> appid in let getEdCtrlTextLineValue ctrlroom -> room in let getEdCtrlCheckState ctrlautoreco -> autoreco in let ftoi getEdCtrlFloatValue ctrlretry -> retry in let getEdCtrlCheckState ctrlautostart -> autostart in ( if (!generateid && (!strcmp (strtrim appid) "")) then ( setEdCtrlCheckState ctrlgenerateid 1; setEdCtrlTextLineEnable ctrlappid 0; set generateid = 1; ) else nil; if (!strcmp (strtrim room ) "") then ( setEdCtrlTextLineValue ctrlroom "myroom"; set room = "myroom"; ) else nil; ["host" host]:: ["port" itoa port]:: ["generateid" itoa generateid]:: ["appid" appid]:: ["room" room]:: ["autoreco" itoa autoreco]:: ["retry" itoa retry]:: ["autostart" itoa autostart]:: nil; );; fun cbGenerateId(ctrlstr, state, ctrlappid)= setEdCtrlTextLineEnable ctrlappid !state; 0;; fun cbCheckRetry(ctrlstr, state, ctrlretry)= setEdCtrlFloatEnable ctrlretry state; 0;; fun dynamicedit(winstr, inst, viewstr, applybtn)= let [400 210] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize winstr iw ih; let getPluginInstanceParam inst "host" -> host in let atof (getPluginInstanceParam inst "port") -> port in let (getPluginInstanceParam inst "appid") -> appid in let atoi (getPluginInstanceParam inst "generateid") -> generateid in let getPluginInstanceParam inst "room" -> room in let atoi (getPluginInstanceParam inst "autostart") -> autostart in let atoi (getPluginInstanceParam inst "autoreco") -> autoreco in let if (autoreco == nil) then 0 else autoreco -> autoreco in let atoi (getPluginInstanceParam inst "retry") -> retry in let if (retry == nil) then 30.0 else itof retry -> retry in let if host == nil then "127.0.0.1" else host -> host in let if port == nil then 8080.0 else port -> port in let if generateid == nil then 1 else generateid -> generateid in let if room == nil then "myroom" else room -> room in let crEdCtrlLabel winstr 10 ypos + 2 170 20 (loc "OS3DCONNECT_0013") nil -> labelhost in let crEdCtrlTextLine winstr 190 ypos 140 20 host nil EDWIN_RESIZE_MW -> ctrlhost in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 170 20 "port" nil -> labelport in let crEdCtrlFloat winstr 190 ypos 100 20 port 1.0 65535.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlport in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DCONNECT_0003") EDWIN_RESIZE_MW -> ctrlgenerateid in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 170 20 (loc "OS3DCONNECT_0002") nil -> labelhost in let crEdCtrlTextLine winstr 190 ypos 140 20 appid nil EDWIN_RESIZE_MW -> ctrlappid in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 170 20 (loc "OS3DCONNECT_0012") nil -> labelroom in let crEdCtrlTextLine winstr 190 ypos 140 20 room nil EDWIN_RESIZE_MW -> ctrlroom in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DCONNECT_0004") EDWIN_RESIZE_MW -> ctrlautoreco in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 170 20 (loc "OS3DCONNECT_0014") nil -> labelretry in let crEdCtrlFloat winstr 190 ypos 100 20 retry 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlretry in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DCONNECT_0006") EDWIN_RESIZE_MW -> ctrlautostart in ( setEdCtrlCheckState ctrlautoreco autoreco; setEdCtrlCheckState ctrlautostart autostart; setEdCtrlCheckState ctrlgenerateid generateid; setEdCtrlFloatEnable ctrlretry autoreco; setEdCtrlCheckCbState ctrlautoreco mkfun3 @cbCheckRetry ctrlretry; setEdCtrlCheckCbState ctrlgenerateid mkfun3 @cbGenerateId ctrlappid; if (!generateid) then nil else setEdCtrlTextLineEnable ctrlappid 0; [mkfun1 @cbCloseEdit [ctrlhost ctrlport ctrlgenerateid ctrlappid ctrlroom ctrlautostart ctrlautoreco ctrlretry] nil]; ); );;