/* ----------------------------------------------------------------------------- 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 -> [ctrlpath ctrlwidth ctrlheight ctrlposx ctrlposy ctrlxpercent ctrlypercent ctrlwpercent ctrlhpercent ctrlxoffset ctrlyoffset ctrlwoffset ctrlhoffset ctrlxalign ctrlyalign ctrlshow] in let getEdCtrlTextLineValue ctrlpath -> path in let ftoi getEdCtrlFloatValue ctrlposx -> posx in let ftoi getEdCtrlFloatValue ctrlposy -> posy in let ftoi getEdCtrlFloatValue ctrlwidth -> width in let ftoi getEdCtrlFloatValue ctrlheight -> height in let getEdCtrlCheckState ctrlxpercent -> xpercent in let getEdCtrlCheckState ctrlypercent -> ypercent in let getEdCtrlCheckState ctrlwpercent -> wpercent in let getEdCtrlCheckState ctrlhpercent -> hpercent in let ftoi getEdCtrlFloatValue ctrlxoffset -> xoffset in let ftoi getEdCtrlFloatValue ctrlyoffset -> yoffset in let ftoi getEdCtrlFloatValue ctrlwoffset -> woffset in let ftoi getEdCtrlFloatValue ctrlhoffset -> hoffset in let getSelectedEdCtrlSelectPos ctrlxalign -> xalign in let getSelectedEdCtrlSelectPos ctrlyalign -> yalign in let getEdCtrlCheckState ctrlshow -> show in ["path" path]:: ["posx" itoa posx]:: ["posy" itoa posy]:: ["width" itoa width]:: ["height" itoa height]:: ["xpercent" itoa xpercent]:: ["ypercent" itoa ypercent]:: ["wpercent" itoa wpercent]:: ["hpercent" itoa hpercent]:: ["xoffset" itoa xoffset]:: ["yoffset" itoa yoffset]:: ["woffset" itoa woffset]:: ["hoffset" itoa hoffset]:: ["xalign" itoa xalign]:: ["yalign" itoa yalign]:: ["show" itoa show]:: nil;; 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 "OS3DPDFVIEW_0005") (loc "OS3DPDFVIEW_0023") 0; 0; ) else ( setEdCtrlTextLineValue ctrlpath file; 0; ); setEdCtrlButtonEnable ctrlbtn 1; ); 0;; fun cbBtnPickFile(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 "PDF\0*.pdf;\0All\0*.*\0\0" @cbDlgGetPath [inst ctrlbtn winstr ctrlpath]; ); 0;; fun cbRefreshBtn(pickbtn, p)= let p -> [inst winstr ctrlobjname] in setEdCtrlTextLineValue ctrlobjname ""; 0;; fun cbPercentCheck(ctrlstr, state, ctrlfloat)= setEdCtrlFloatEnable ctrlfloat state; 0;; fun dynamicedit(ewinstr, inst, viewstr, applybtn)= let [455 240] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize ewinstr iw ih; let (getPluginInstanceParam inst "path") -> path in let atoi (getPluginInstanceParam inst "xpercent") -> xpercent in let if xpercent == nil then 0 else xpercent -> xpercent in let atoi (getPluginInstanceParam inst "xalign") -> xalign in let if xalign == nil then 0 else xalign -> xalign in let atoi (getPluginInstanceParam inst "posx") -> posx in let if posx == nil then 0 else posx -> posx in let atoi (getPluginInstanceParam inst "ypercent") -> ypercent in let if ypercent == nil then 0 else ypercent -> ypercent in let atoi (getPluginInstanceParam inst "yalign") -> yalign in let if yalign == nil then 0 else yalign -> yalign in let atoi (getPluginInstanceParam inst "posy") -> posy in let if posy == nil then 0 else posy -> posy in let atoi (getPluginInstanceParam inst "wpercent") -> wpercent in let if wpercent == nil then 1 else wpercent -> wpercent in let atoi (getPluginInstanceParam inst "width") -> width in let if width == nil then 100 else width -> width in let atoi (getPluginInstanceParam inst "hpercent") -> hpercent in let if hpercent == nil then 1 else hpercent -> hpercent in let atoi (getPluginInstanceParam inst "height") -> height in let if height == nil then 100 else height -> height in let atoi (getPluginInstanceParam inst "xoffset") -> xoffset in let if xoffset == nil then 0 else xoffset -> xoffset in let atoi (getPluginInstanceParam inst "yoffset") -> yoffset in let if yoffset == nil then 0 else yoffset -> yoffset in let atoi (getPluginInstanceParam inst "woffset") -> woffset in let if woffset == nil then 0 else woffset -> woffset in let atoi (getPluginInstanceParam inst "hoffset") -> hoffset in let if hoffset == nil then 0 else hoffset -> hoffset in let atoi (getPluginInstanceParam inst "show") -> show in let if (show == nil) then 1 else show -> show in let crEdFrameWindow _channel ewinstr 0 0 iw 55 EDWIN_RESIZE_MW nil (loc "OS3DPDFVIEW_0006") (loc "OS3DPDFVIEW_0011") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 35 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3DPDFVIEW_0014") nil -> labelobj in let crEdCtrlTextLine winstr 180 ypos 170 20 path nil EDWIN_RESIZE_MW -> ctrlpath in let crEdCtrlButton winstr 360 ypos 55 20 "..." nil -> pickfilebtn in let crEdCtrlButton winstr 420 ypos 35 20 "X" nil -> refreshpath in let crEdFrameWindow _channel ewinstr 0 0 iw 130 EDWIN_RESIZE_MW nil (loc "OS3DPDFVIEW_0017") (loc "OS3DPDFVIEW_0011") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 110 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 90 20 (loc "OS3DPDFVIEW_0015") nil -> labelx in let crEdCtrlFloat winstr 110 ypos 60 20 itof posx (-.10000.0) 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlposx in let crEdCtrlCheck winstr 180 ypos 40 20 "(%)" EDWIN_RESIZE_MW -> ctrlxpercent in let crEdCtrlLabel winstr 220 (ypos + 2) 60 20 (loc "OS3DPDFVIEW_0013") nil -> labelxo in let crEdCtrlFloat winstr 285 ypos 60 20 itof xoffset (-.10000.0) 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlxoffset in let crEdCtrlSelect winstr 355 ypos 100 120 EDWIN_RESIZE_MW -> ctrlxalign in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 90 20 (loc "OS3DPDFVIEW_0016") nil -> labely in let crEdCtrlFloat winstr 110 ypos 60 20 itof posy (-.10000.0) 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlposy in let crEdCtrlCheck winstr 180 ypos 40 20 "(%)" EDWIN_RESIZE_MW -> ctrlypercent in let crEdCtrlLabel winstr 220 (ypos + 2) 60 20 (loc "OS3DPDFVIEW_0013") nil -> labelyo in let crEdCtrlFloat winstr 285 ypos 60 20 itof yoffset (-.10000.0) 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlyoffset in let crEdCtrlSelect winstr 355 ypos 100 120 EDWIN_RESIZE_MW -> ctrlyalign in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 90 20 (loc "OS3DPDFVIEW_0022") nil -> labelw in let crEdCtrlFloat winstr 110 ypos 60 20 itof width 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlwidth in let crEdCtrlCheck winstr 180 ypos 40 20 "(%)" EDWIN_RESIZE_MW -> ctrlwpercent in let crEdCtrlLabel winstr 220 (ypos + 2) 60 20 (loc "OS3DPDFVIEW_0013") nil -> labelwo in let crEdCtrlFloat winstr 285 ypos 60 20 itof woffset (-.10000.0) 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlwoffset in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 90 20 (loc "OS3DPDFVIEW_0007") nil -> labelh in let crEdCtrlFloat winstr 110 ypos 60 20 itof height 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlheight in let crEdCtrlCheck winstr 180 ypos 40 20 "(%)" EDWIN_RESIZE_MW -> ctrlhpercent in let crEdCtrlLabel winstr 220 (ypos + 2) 60 20 (loc "OS3DPDFVIEW_0013") nil -> labelho in let crEdCtrlFloat winstr 285 ypos 60 20 itof hoffset (-.10000.0) 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlhoffset in let crEdFrameWindow _channel ewinstr 0 0 iw 55 EDWIN_RESIZE_MW nil (loc "OS3DPDFVIEW_0012") (loc "OS3DPDFVIEW_0011") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 35 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlCheck winstr 10 (set ypos = 10) 280 20 (loc "OS3DPDFVIEW_0019") EDWIN_RESIZE_MW -> ctrlshow in ( setEdCtrlCheckState ctrlshow show; fillEdCtrlSelect ctrlxalign (loc "OS3DPDFVIEW_0009")::(loc "OS3DPDFVIEW_0004")::(loc "OS3DPDFVIEW_0018")::nil; fillEdCtrlSelect ctrlyalign (loc "OS3DPDFVIEW_0020")::(loc "OS3DPDFVIEW_0004")::(loc "OS3DPDFVIEW_0003")::nil; selectEdCtrlSelectByPos ctrlxalign xalign; selectEdCtrlSelectByPos ctrlyalign yalign; setEdCtrlCheckState ctrlxpercent xpercent; setEdCtrlCheckState ctrlypercent ypercent; setEdCtrlCheckState ctrlwpercent wpercent; setEdCtrlCheckState ctrlhpercent hpercent; setEdCtrlCheckCbState ctrlxpercent mkfun3 @cbPercentCheck ctrlxoffset; setEdCtrlCheckCbState ctrlypercent mkfun3 @cbPercentCheck ctrlyoffset; setEdCtrlCheckCbState ctrlwpercent mkfun3 @cbPercentCheck ctrlwoffset; setEdCtrlCheckCbState ctrlhpercent mkfun3 @cbPercentCheck ctrlhoffset; setEdCtrlFloatEnable ctrlxoffset (getEdCtrlCheckState ctrlxpercent); setEdCtrlFloatEnable ctrlyoffset (getEdCtrlCheckState ctrlypercent); setEdCtrlFloatEnable ctrlwoffset (getEdCtrlCheckState ctrlwpercent); setEdCtrlFloatEnable ctrlhoffset (getEdCtrlCheckState ctrlhpercent); setEdCtrlButtonCb pickfilebtn mkfun2 @cbBtnPickFile [inst winstr ctrlpath]; setEdCtrlTextLineEnable ctrlpath 0; setEdCtrlButtonCb refreshpath mkfun2 @cbRefreshBtn [inst winstr ctrlpath]; [mkfun1 @cbCloseEdit [ctrlpath ctrlwidth ctrlheight ctrlposx ctrlposy ctrlxpercent ctrlypercent ctrlwpercent ctrlhpercent ctrlxoffset ctrlyoffset ctrlwoffset ctrlhoffset ctrlxalign ctrlyalign ctrlshow] nil]; ); );;