/** 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 */ // Lang Setup interface structure struct GENSETUPstr = [ GENSETUP_WIN : ObjWin, GENSETUP_INFO : ObjText, GENSETUP_LABEL_LANG : ObjText, GENSETUP_COMBO_LANG : ObjBox, GENSETUP_LABEL_NICKNAME : ObjText, GENSETUP_NICKNAME : ObjText ] mkGENSETUPstr;; typeof SETUP_GEN = GENSETUPstr;; /* ********************************************************************************************* / Setup General Interface / ********************************************************************************************* */ fun saveSetupGen()= let _GETtext SETUP_GEN.GENSETUP_NICKNAME -> nickname in if (nickname == nil) || (!strcmp nickname "") then nil else chgress "DefaultName" nickname; 0;; /*----------*/ fun clearbylang(l,s)= if l==nil then nil else let l->[[x y] nxt] in if !strcmpi x s then y else clearbylang nxt s;; /*----------*/ fun langbyclear(l,s)= if l==nil then nil else let l->[[x y] nxt] in if !strcmpi y s then x else langbyclear nxt s;; /*change language*/ // rebuild all fun SetLanguage(ns)= if strcmp ns _getress "DefaultLanguage" then ( chgress "DefaultLanguage" ns; reinitloc; /*createmenus;*/ /*menus taskicon*/ if strSetup == nil then nil else ( dsSetup 1; showSetup 0; ); ) else nil; 0;; /*callback on change*/ fun cbComboLanguageClick(combo, p, pos, name)= let langbyclear languages name -> ns in SetLanguage ns; 0;; fun addcomboLang(a,b)= let a->[_ lg] in _ADDcombo b 100 lg; 0;; fun cbSetupCrGen(strSetup)= set SETUP_GEN = mkGENSETUPstr [nil nil nil nil nil nil]; set SETUP_GEN.GENSETUP_WIN = _CRwindow _channel strSetup.SETUP_WIN 210 10 iSetupChildW iSetupChildH WN_CHILDINSIDE|WN_NOCAPTION ""; set SETUP_GEN.GENSETUP_INFO = _CRtext _channel SETUP_GEN.GENSETUP_WIN 10 10 (iSetupChildW - 20) 50 ET_ALIGN_LEFT loc "CONFGENMESS"; set SETUP_GEN.GENSETUP_LABEL_LANG = _CRtext _channel SETUP_GEN.GENSETUP_WIN 10 70 (iSetupChildW - 20) 20 ET_ALIGN_LEFT|ET_BORDER loc "CONFLANGLABEL"; set SETUP_GEN.GENSETUP_COMBO_LANG = _CBcombo _CRcombo _channel SETUP_GEN.GENSETUP_WIN 10 95 200 120 CB_NOEDIT "" @cbComboLanguageClick nil; set SETUP_GEN.GENSETUP_LABEL_NICKNAME = _CRtext _channel SETUP_GEN.GENSETUP_WIN 10 125 (iSetupChildW - 20) 20 ET_ALIGN_LEFT|ET_BORDER loc "CONFNICKLABEL"; set SETUP_GEN.GENSETUP_NICKNAME = _CReditLine _channel SETUP_GEN.GENSETUP_WIN 10 150 120 20 ET_ALIGN_LEFT|ET_BORDER|ET_AHSCROLL _getress "DefaultName"; apply_on_list languages @addcomboLang SETUP_GEN.GENSETUP_COMBO_LANG; let clearbylang languages _getress "DefaultLanguage" -> ns in let _POScombo SETUP_GEN.GENSETUP_COMBO_LANG if ns==nil then (chgress "DefaultLanguage" "english";"english") else ns -> i in _SELcombo SETUP_GEN.GENSETUP_COMBO_LANG i; 0;; fun dsSetupGen()= saveSetupGen; _DSwindow SETUP_GEN.GENSETUP_WIN; set SETUP_GEN = nil; 0;; fun loadSetupGen(strSetup)= addSetupMenu loc "CONFGEN" (mkfun1 @cbSetupCrGen strSetup) @dsSetupGen; 0;;