/** Package for the Scol settings This is a part of the 'Scol voyager' ================================= License : 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 Author : Bastien Bourineau Update : - November 29, 2012 - Stephane Bisaro - Add the help button - Add the libraries check'up in support options - Fix the console setting in the support options */ // Setup interface structure struct SETUPstr = [ SETUP_WIN : ObjWin, SETUP_MENU : ObjList, SETUP_CLOSEBTN : ObjButton, SETUP_HELPBTN : ObjButton, SETUP_MENUELTS : [[I [fun[] I fun[] I]] r1] // open / close callback ] mkSETUPstr;; typeof strSetup = SETUPstr;; var bPkgExtensionsLoaded = 0;; var iSetupW = 700;; var iSetupH = 480;; var sScolIconPath = "locked/voyager/img/tree.scol.bmp";; var sFolderIconPath = "locked/voyager/img/tree.folder.bmp";; typeof iSetupChildW = I;; typeof iSetupChildH = I;; // settings interfaces pre declaration proto loadSetupGen = fun [SETUPstr] I;; proto loadSetupNetwork = fun [SETUPstr] I;; proto loadSetupSupport = fun [SETUPstr] I;; proto loadSetupOg3D = fun [SETUPstr] I;; proto loadSetup3D = fun [SETUPstr] I;; proto loadSetupVideo = fun [SETUPstr] I;; /* ********************************************************************************************* / Setup Destroy / ********************************************************************************************* */ fun closeSetupChild()= //call destroy on settings list let sizelist strSetup.SETUP_MENUELTS -> size in let 0 -> i in while (i < size) do ( let nth_list strSetup.SETUP_MENUELTS i -> [pos [_ cbclose]] in exec cbclose with []; set i = i + 1; ); 0;; fun dsSetup(mode)= closeSetupChild; _DSwindow strSetup.SETUP_WIN; set strSetup = nil; if mode then nil else ( set iSetup = 0; let search_in_list running @runbychan _channel -> r in ( _killchannel r.canalRun; _killed 0; ); ); 0;; /* ********************************************************************************************* / Setup Interface / ********************************************************************************************* */ fun cbSetupWinDestory(win, p)= dsSetup 0; 0;; fun cbSetupCloseBtn(btn, p)= dsSetup 0; 0;; fun cbSetupHelpBtn(btn, p)= //_openbrowserhttp strcatn sVOY_HELPURL::"&lang="::()::nil; _openbrowserhttp "http://redmine.scolring.org/projects/scol/wiki/How_to_use_Scol"; 0;; fun cbSetupMenuClick(list, p, pos, name)= closeSetupChild; let switch strSetup.SETUP_MENUELTS pos -> [cbfun _] in exec cbfun with []; 0;; fun addSetupMenu(name, cbopenfun, cbclosefun)= let _GETlistCount strSetup.SETUP_MENU -> pos in ( _ADDlist strSetup.SETUP_MENU pos name; set strSetup.SETUP_MENUELTS = listcat strSetup.SETUP_MENUELTS [pos [cbopenfun cbclosefun]]::nil; ); 0;; //load setting interfaces fun loadPkgExtensions()= // general if (bPkgExtensionsLoaded) then nil else _load "locked/voyager/general_settings.pkg"; loadSetupGen strSetup; // SO3Engine if !(_test_exist "SO3SceneCreate") then nil else ( if (bPkgExtensionsLoaded) then nil else ( _load "locked/voyager/so3dlib.pkg"; _load "locked/voyager/so3Engine_settings.pkg"; ); loadSetupOg3D strSetup; ); // ZooEngine if !(_test_exist "MX3createSession") then nil else ( if (bPkgExtensionsLoaded) then nil else ( _load "locked/voyager/v3dlib.pkg"; _load "locked/voyager/zooEngine_settings.pkg"; ); loadSetup3D strSetup; ); // Video / BitmapToolkit if !(_test_exist "_CRcapture") then nil else ( if (bPkgExtensionsLoaded) then nil else _load "locked/voyager/bitmapToolkit_settings.pkg"; loadSetupVideo strSetup; ); // network if (bPkgExtensionsLoaded) then nil else _load "locked/voyager/network_settings.pkg"; loadSetupNetwork strSetup; // support if (bPkgExtensionsLoaded) then nil else _load "locked/voyager/support_settings.pkg"; loadSetupSupport strSetup; set bPkgExtensionsLoaded = 1; 0;; fun showSetup(defmode)= let if defmode == nil then 0 else defmode -> mode in if strSetup != nil then // Focus ( closeSetupChild; let switch strSetup.SETUP_MENUELTS mode -> [cbfun _] in exec cbfun with []; _SETfocus strSetup.SETUP_WIN; 0; ) else // Create ( set strSetup = mkSETUPstr[nil nil nil nil nil]; set iSetupChildW = (iSetupW - 222); set iSetupChildH = (iSetupH - 42); let _GETscreenSize -> [sw sh] in set strSetup.SETUP_WIN = _CRwindow _channel nil ((sw / 2) - (iSetupW / 2)) ((sh / 2) - (iSetupH / 2)) iSetupW iSetupH WN_MINBOX|WN_MENU loc "CONFTITLE"; _CBwinDestroy strSetup.SETUP_WIN @cbSetupWinDestory nil; set strSetup.SETUP_MENU = _CBlistClick _CRlist _channel strSetup.SETUP_WIN 10 10 190 (iSetupH - 40) LB_BORDER @cbSetupMenuClick nil; set strSetup.SETUP_CLOSEBTN = _CBbutton _CRbutton _channel strSetup.SETUP_WIN (iSetupW - 100) (iSetupH - 25) 90 20 PB_DEFAULT loc "CLOSE" @cbSetupCloseBtn nil; set strSetup.SETUP_HELPBTN = _CBbutton _CRbutton _channel strSetup.SETUP_WIN 10 (iSetupH - 25) 90 20 PB_DEFAULT loc "HELP" @cbSetupHelpBtn nil; // load the settings extensions loadPkgExtensions; _SELlist strSetup.SETUP_MENU mode; closeSetupChild; let switch strSetup.SETUP_MENUELTS mode -> [cbfun _] in exec cbfun with []; 0; ); set iSetup = 1; 0;; fun __showSetupDist()= showSetup 0; 0;;