/* ----------------------------------------------------------------------------- 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 getEvents(mode)= let nil -> ndata in let 0 -> i in ( if (mode == 0) || (mode == 1) then ( set ndata = ["EVENT" "IR pos"]::ndata; set ndata = ["EVENT" "Wiimote orientation"]::ndata; set ndata = ["EVENT" "Wiimote accel"]::ndata; set ndata = ["EVENT" "Minus unpressed"]::ndata; set ndata = ["EVENT" "Minus"]::ndata; set ndata = ["EVENT" "Plus unpressed"]::ndata; set ndata = ["EVENT" "Plus"]::ndata; set ndata = ["EVENT" "B unpressed"]::ndata; set ndata = ["EVENT" "B"]::ndata; set ndata = ["EVENT" "A unpressed"]::ndata; set ndata = ["EVENT" "A"]::ndata; set ndata = ["EVENT" "Two unpressed"]::ndata; set ndata = ["EVENT" "Two"]::ndata; set ndata = ["EVENT" "One unpressed"]::ndata; set ndata = ["EVENT" "One"]::ndata; set ndata = ["EVENT" "Home unpressed"]::ndata; set ndata = ["EVENT" "Home"]::ndata; set ndata = ["EVENT" "Down unpressed"]::ndata; set ndata = ["EVENT" "Down"]::ndata; set ndata = ["EVENT" "Up unpressed"]::ndata; set ndata = ["EVENT" "Up"]::ndata; set ndata = ["EVENT" "Right unpressed"]::ndata; set ndata = ["EVENT" "Right"]::ndata; set ndata = ["EVENT" "Left unpressed"]::ndata; set ndata = ["EVENT" "Left"]::ndata; ) else nil; if (mode == 1) then ( set ndata = ["EVENT" "Extension disconnected"]::ndata; set ndata = ["EVENT" "Nunchuk connected"]::ndata; set ndata = ["EVENT" "Nunchuk orientation"]::ndata; set ndata = ["EVENT" "Nunchuk accel"]::ndata; set ndata = ["EVENT" "Nunchuk stick"]::ndata; set ndata = ["EVENT" "Z unpressed"]::ndata; set ndata = ["EVENT" "Z"]::ndata; set ndata = ["EVENT" "C unpressed"]::ndata; set ndata = ["EVENT" "C"]::ndata; ) else nil; if (mode == 4) then ( set ndata = ["EVENT" "BalanceBoard"]::ndata; set ndata = ["EVENT" "BalanceBoard center"]::ndata; ) else nil; ndata; );; fun getActions(mode)= let nil -> ndata in ( if (mode == 0) || (mode == 1) then ( set ndata = ["ACTION" "Start rumble"]::ndata; set ndata = ["ACTION" "Stop rumble"]::ndata; set ndata = ["ACTION" "Set leds"]::ndata; ) else nil; ndata; );; fun cbCloseEdit(p)= let p -> [ctrlmodeName ctrlir ctrlinit] in let getSelectedEdCtrlSelectPos ctrlmodeName -> modeName in let getEdCtrlCheckState ctrlir -> irmode in let getEdCtrlCheckState ctrlinit -> init in let getEvents modeName -> levents in let getActions modeName -> lactions in ["mode" itoa modeName]:: ["ir" itoa irmode]:: ["init" itoa init]:: (lcat levents lactions);; fun dynamicedit(winstr, inst, viewstr, applybtn)= // let _GETscreenSize -> [sw sh] in let [450 150] -> [iw ih] in ( setEdWindowSize winstr iw ih; /*implémenter les valeur enregistrés dans les differents composants*/ let atoi(getPluginInstanceParam inst "mode") -> mode in let if mode == nil then 0 else mode -> mode in let atoi(getPluginInstanceParam inst "ir") -> irmode in let if irmode == nil then 0 else irmode -> irmode in let atoi(getPluginInstanceParam inst "init") -> init in let if init == nil then 1 else init -> init in /*Création les différents composants*/ let crEdCtrlLabel winstr 10 12 160 20 (loc "OS3DWIIMOTE_0005") nil -> labelMode in let crEdCtrlSelect winstr 180 10 (iw - 190) 120 CB_AHSCROLL -> ctrlmodeName in let crEdCtrlCheck winstr 10 35 280 20 (loc "OS3DWIIMOTE_0004") EDWIN_RESIZE_MW -> ctrlir in let crEdCtrlCheck winstr 10 60 280 20 (loc "OS3DWIIMOTE_0001") EDWIN_RESIZE_MW -> ctrlinit in let inst.INST_plugin.PLUG_sDir -> path in ( fillEdCtrlSelect ctrlmodeName "Wiimote"::"Wiimote + Nunchuck"::"Motion plus (not available)"::"Motion plus + Nunchuck (not available)"::"Wii balance board"::nil; selectEdCtrlSelectByPos ctrlmodeName mode; setEdCtrlCheckState ctrlir irmode; setEdCtrlCheckState ctrlinit init; [mkfun1 @cbCloseEdit [ctrlmodeName ctrlir ctrlinit] nil]; ); );;