/* ----------------------------------------------------------------------------- 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 -> [ctrltoreplace ctrlreplacement ctrlcase ctrlreplaceone ctrlnb ctrlorder] in let getEdCtrlTextLineValue ctrltoreplace -> toreplace in let getEdCtrlTextLineValue ctrlreplacement -> replacement in let getEdCtrlCheckState ctrlcase -> case in let getEdCtrlRadioState ctrlreplaceone -> mode in let ftoi getEdCtrlFloatValue ctrlnb -> number in let getSelectedEdCtrlSelectPos ctrlorder -> order in ["toreplace" toreplace]:: ["replacement" replacement]:: ["case" itoa case]:: ["mode" itoa mode]:: ["number" itoa number]:: ["order" itoa order]:: nil;; fun cbRadioMode(ctrlradio, state, p)= if (!state) then nil else let p -> [id ctrlradio2 labelnb ctrlnb labelorder ctrlorder] in ( setEdCtrlLabelEnable labelnb id; setEdCtrlFloatEnable ctrlnb id; setEdCtrlLabelEnable labelorder id; setEdCtrlSelectEnable ctrlorder id; ); 0;; fun dynamicedit(winstr, inst, viewstr, applybtn)= let [400 185] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize winstr iw ih; let (getPluginInstanceParam inst "toreplace") -> toreplace in let if (toreplace == nil) then "" else toreplace -> toreplace in let (getPluginInstanceParam inst "replacement") -> replacement in let if (replacement == nil) then "" else replacement -> replacement in let atoi (getPluginInstanceParam inst "case") -> case in let if (case == nil) then 0 else case -> case in let atoi (getPluginInstanceParam inst "mode") -> mode in let if (mode == nil) then 0 else mode -> mode in let atoi (getPluginInstanceParam inst "number") -> number in let if (number == nil) then 1 else number -> number in let atoi (getPluginInstanceParam inst "order") -> order in let if (order == nil) then 0 else order -> order in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 200 20 (loc "OS3DSTRINGREPLACE_0001") nil -> labeltoreplace in let crEdCtrlTextLine winstr 220 ypos (iw - 220 - 10) 20 toreplace nil nil -> ctrltoreplace in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 200 20 (loc "OS3DSTRINGREPLACE_0002") nil -> labelreplacement in let crEdCtrlTextLine winstr 220 ypos (iw - 220 - 10) 20 replacement nil nil -> ctrlreplacement in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3DSTRINGREPLACE_0003") EDWIN_RESIZE_MW -> ctrlcase in let crEdCtrlRadio winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DSTRINGREPLACE_0004") EDWIN_RESIZE_MW -> ctrlreplaceall in let crEdCtrlRadio winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DSTRINGREPLACE_0005") EDWIN_RESIZE_MW -> ctrlreplaceone in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 200 20 (loc "OS3DSTRINGREPLACE_0006") nil -> labelnb in let crEdCtrlFloat winstr 220 ypos 100 20 (itof number) 1.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlnb in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 200 20 (loc "OS3DSTRINGREPLACE_0007") nil -> labelorder in let crEdCtrlSelect winstr 220 ypos 100 120 EDWIN_RESIZE_MW -> ctrlorder in ( setEdCtrlRadioCbState ctrlreplaceall mkfun3 @cbRadioMode [0 ctrlreplaceone labelnb ctrlnb labelorder ctrlorder]; setEdCtrlRadioCbState ctrlreplaceone mkfun3 @cbRadioMode [1 ctrlreplaceall labelnb ctrlnb labelorder ctrlorder]; if (mode == 0) then ( setEdCtrlRadioState ctrlreplaceall 1; cbRadioMode ctrlreplaceall 1 [0 ctrlreplaceone labelnb ctrlnb labelorder ctrlorder]; ) else ( setEdCtrlRadioState ctrlreplaceone (mode == 1); cbRadioMode ctrlreplaceone 1 [1 ctrlreplaceall labelnb ctrlnb labelorder ctrlorder]; ); setEdCtrlCheckState ctrlcase case; fillEdCtrlSelect ctrlorder (loc "OS3DSTRINGREPLACE_0008")::(loc "OS3DSTRINGREPLACE_0009")::nil; selectEdCtrlSelectByPos ctrlorder order; [mkfun1 @cbCloseEdit [ctrltoreplace ctrlreplacement ctrlcase ctrlreplaceone ctrlnb ctrlorder] nil]; ); );;