/* ----------------------------------------------------------------------------- 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 ----------------------------------------------------------------------------- */ /************************************************** OpenSpace 3D Editor Logs Author: Bastien BOURINEAU / I-maginer Last update: 11.16.2010 **************************************************/ /* ********************************************************************************************* / Log manager / ********************************************************************************************* */ typeof mInfoTimer = Timer;; var mInfoDuration = 5000;; typeof mCbCatchLog = fun [S] I;; fun setCbCatchLog(cbfun)= set mCbCatchLog = cbfun; 0;; fun cbInfoTimer(trm, p)= let mainInterf.MINT_winLogs -> [_ [tbstr _ cmptxt] ctrltext] in ( setEdToolBarText tbstr cmptxt "" 0xffffff; _deltimer mInfoTimer; set mInfoTimer = nil; ); 0;; fun clearLogsMessages()= let mainInterf.MINT_winLogs -> [_ [tbstr _ cmptxt] ctrltext] in ( setEdToolBarText tbstr cmptxt "" 0xffffff; setEdCtrlTextValue ctrltext ""; ); 0;; fun setInfoMessage(message)= let mainInterf.MINT_winLogs -> [_ [tbstr _ cmptxt] ctrltext] in ( if (mInfoTimer == nil) then nil else ( _deltimer mInfoTimer; set mInfoTimer = nil; ); setEdToolBarText tbstr cmptxt strTruncate (strcat (strcat (loc "OS3D_0206") " ") hd lineextr message) 64 "[...]" 0xffffff; set mInfoTimer = _rfltimer _starttimer _channel mInfoDuration @cbInfoTimer nil; ); 0;; fun setInfoMessageLong(message)= let mainInterf.MINT_winLogs -> [_ [tbstr _ cmptxt] ctrltext] in ( if (mInfoTimer == nil) then nil else ( _deltimer mInfoTimer; set mInfoTimer = nil; ); setEdToolBarText tbstr cmptxt strTruncate (strcat (strcat (loc "OS3D_0206") " ") hd lineextr message) 256 "[...]" 0xffffff; set mInfoTimer = _rfltimer _starttimer _channel mInfoDuration @cbInfoTimer nil; ); 0;; fun addLogMessage(message)= let mainInterf.MINT_winLogs -> [_ [tbstr _ cmptxt] ctrltext] in ( if (mInfoTimer == nil) then nil else ( _deltimer mInfoTimer; set mInfoTimer = nil; ); setEdToolBarText tbstr cmptxt strTruncate (strcat (strcat (loc "OS3D_0233") " ") hd lineextr message) 64 "[...]" 0xffffff; if ((getEdCtrlTextLineCount ctrltext) < 100) then nil else removeEdCtrlTextLine ctrltext 0; let strcat "> " message -> fmesg in ( _appendpack strcat fmesg "\n" _getmodifypack strcat APPBASEDIR sLogFile; addEdCtrlTextValue ctrltext fmesg; scrollEdCtrlText ctrltext 0 (getEdCtrlTextLineCount ctrltext); _fooS strcat (strcat (loc "OS3D_0016") " ") message; ); set mInfoTimer = _rfltimer _starttimer _channel mInfoDuration @cbInfoTimer nil; if (mCbCatchLog == nil) then nil else execch _channel mCbCatchLog [message]; message; );; fun addLogMessageMulti(message, l)= let mainInterf.MINT_winLogs -> [_ _ ctrltext] in let sizelist l -> size in let 0 -> i in while i < size do ( let nth_list l i -> elt in ( if ((getEdCtrlTextLineCount ctrltext) < 100) then nil else removeEdCtrlTextLine ctrltext 0; let strcatn "> "::message::" "::elt::nil -> fmesg in ( _appendpack (strcat fmesg "\n") _getmodifypack strcat APPBASEDIR sLogFile; addEdCtrlTextValue ctrltext fmesg; scrollEdCtrlText ctrltext 0 (getEdCtrlTextLineCount ctrltext); ); ); set i = i + 1; ); 0;; fun addLogMessageMultiOnline(message, l)= let mainInterf.MINT_winLogs -> [_ _ ctrltext] in let sizelist l -> size in let 0 -> i in while i < size do ( let nth_list l i -> [line elt] in ( if ((getEdCtrlTextLineCount ctrltext) < 100) then nil else removeEdCtrlTextLine ctrltext 0; _appendpack strcatn "> "::message::" "::elt::" "::(strcat (loc "OS3D_0009") " ")::(itoa line)::"."::"\n"::nil _getmodifypack strcat APPBASEDIR sLogFile; addEdCtrlTextValue ctrltext strcatn "> "::message::" "::elt::" "::(strcat (loc "OS3D_0009") " ")::(itoa line)::"."::nil; scrollEdCtrlText ctrltext 0 (getEdCtrlTextLineCount ctrltext); ); set i = i + 1; ); 0;; fun addLogMessageVector3F(message, vec)= let vec -> [x y z] in addLogMessage strcatnSep message::(ftoa x)::(ftoa y)::(ftoa z)::nil " ";; fun addLogMessageVector4F(message, vec)= let vec -> [x y z w] in addLogMessage strcatnSep message::(ftoa x)::(ftoa y)::(ftoa z)::(ftoa w)::nil " ";; fun cbOgreLogs(message, p)= addLogMessage message; 0;; fun cbDmsLogs(message)= addLogMessage message; 0;;