1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
|
function browsehelp(path,key)
// when %browsehelp is [] a menu proposes to select a browser
global LANGUAGE INDEX %helps
global %browsehelp
browsehelp_configure()
// set of possible browsers
if argn(2)==0 then
path=INDEX
key="index"
end
if or(sciargs()=="-nw") then // the no window case
if with_gtk ()| ..
(with_tk()& or(%browsehelp==['Scilab Browser','Old Scilab Browser'])) | ..
or(%browsehelp==['nautilus','mozilla/netscape (gnome-moz-remote)','opera','quanta (kde)']) then
run_help(path,key);
else
write(%io(2),mgetl(path))
end
else
run_help(path,key)
end
endfunction
function browsehelp_configure(job)
global %browsehelp
if argn(2)<1 then job='check',end
oldbrowsehelp=[];
if ~MSDOS then
if job=='set' then oldbrowsehelp=%browsehelp;%browsehelp=[],end
browse_modes=['nautilus';
'mozilla/netscape (gnome-moz-remote)';
'opera'
'quanta (kde)'];
if with_tk() then
browse_modes=[browse_modes;
'Scilab Browser'
'Old Scilab Browser'];
end
if with_gtk() then
browse_modes=['help widget';browse_modes];
end
if %browsehelp<>[] then //help mode already selected
if and(browse_modes<>%browsehelp) then
warning('Unhandled help browser '+%browsehelp)
%browsehelp=oldbrowsehelp; // If user select cancel
%browsehelp= help_ask(browse_modes);
end
else // ask for an help mode
%browsehelp=oldbrowsehelp; // If user select cancel
%browsehelp= help_ask(browse_modes);
end
else //for windows
if job=='set' then oldbrowsehelp=%browsehelp;%browsehelp=[],end
browse_modes=['Default Windows Browser';];
if with_tk() then
browse_modes=[browse_modes;
'Scilab Browser'
'Old Scilab Browser'];
end
if %browsehelp<>[] then //help mode already selected
if and(browse_modes<>%browsehelp) then
warning('Unhandled help browser '+%browsehelp)
%browsehelp=oldbrowsehelp; // If user select cancel
%browsehelp= help_ask(browse_modes);
end
else // ask for an help mode
%browsehelp=oldbrowsehelp; // If user select cancel
%browsehelp= help_ask(browse_modes);
end
//%browsehelp = 'tcltk'
end
endfunction
function run_help(path,key)
// the help browser
// browse_modes=['help widget';'nautilus';'tcltk'];
[lhs,rhs]=argn(0);
global LANGUAGE INDEX
global %browsehelp
key1=strsubst(key,' ','_') //for temp file and widget name
select %browsehelp
case 'help widget' then
help_gtk(SCI+"/man/",LANGUAGE,path);
case 'nautilus' then
unix_s("nautilus --no-desktop "+path+ '&');
case 'mozilla/netscape (gnome-moz-remote)' then
unix_s("gnome-moz-remote --raise file://"+path+ '&');
case 'opera' then
unix_s(%browsehelp + " file://" +path+ '&');
case 'quanta' then
unix_s(%browsehelp + " --unique file://" +path+ '&');
case 'Default Windows Browser' then
winopen(path);
case 'Scilab Browser' then
sciGUIhelp(key);
case 'Old Scilab Browser' then
if MSDOS then
tcltk_help(path,key);
else
unix(SCI+'/tcl/browsehelpexe '+path+' '+INDEX+' '+LANGUAGE+ '&');
end
else
write(%io(2),mgetl(path))
end
endfunction
function md=help_ask(modes)
global %browsehelp
n=0
n=x_choose(modes,['Choose the help browser';'you want to use']);
if n==0 then // if user cancels then old browser is kept
md=%browsehelp;
else
md=modes(n)
end
savedefaultbrowser(md);
endfunction
function tcltk_help(path,key,key1)
// the tck tk help browser
global LANGUAGE INDEX
// We must have / in paths, even for Windows
path=strsubst(path,"\","/")
INDEX=strsubst(INDEX,"\","/")
if argn(2)<3 then key1=key,end //for temp file and widget name
K=[' ','(',')','[',']','{','}','""','/','\','.','<','>']
for k=K,key1=strsubst(key1,k,'_'),end
if MSDOS then
TCL_EvalStr('set isbrowsehelpinterp [interp exists browsehelp]');
if TCL_GetVar("isbrowsehelpinterp")=='0' then
TCL_EvalStr("interp create browsehelp")
TCL_EvalStr("load {"+SCI+"/bin/tk84.dll} Tk browsehelp")
TCL_EvalStr("browsehelp eval {wm withdraw .}")
end
TCL_EvalStr("browsehelp eval {set lang "+LANGUAGE+"}")
TCL_EvalStr("browsehelp eval {set SciPath """+SCI+"""}")
TCL_EvalStr("browsehelp eval {set Home """+INDEX+"""}")
TCL_EvalStr("browsehelp eval {set sciw .scihelp-"+key1+"}")
TCL_EvalStr("browsehelp eval {set manpath """+path+"""}")
TCL_EvalStr("browsehelp eval {source ""'+SCI+'/tcl/browsehelp.tcl""}")
else
TCL_SetVar("lang",LANGUAGE)
TCL_SetVar("Home",INDEX)
TCL_SetVar("sciw",".scihelp-"+key1+"}")
TCL_SetVar("manpath",path)
TCL_EvalFile(SCI+"/tcl/browsehelp.tcl")
end
endfunction
function tcltk_apropos(path)
// calling the tck tk help browser
// for apropos
global LANGUAGE INDEX
// We must have / in paths, even for Windows
path=strsubst(path,"\","/")
INDEX=strsubst(INDEX,"\","/")
if MSDOS then
TCL_EvalStr("browsehelp eval {set lang "+LANGUAGE+"}")
TCL_EvalStr("browsehelp eval {set SciPath """+SCI+"""}")
TCL_EvalStr("browsehelp eval {set Home """+INDEX+"""}")
TCL_EvalStr("browsehelp eval {set sciw .sciapropos}")
TCL_EvalStr("browsehelp eval {set manpath """+path+"""}")
TCL_EvalStr("browsehelp eval {source $SciPath/tcl/browsehelp.tcl}")
else
TCL_SetVar("lang",LANGUAGE)
TCL_SetVar("Home",INDEX)
TCL_SetVar("sciw",".sciapropos")
TCL_SetVar("manpath",path)
TCL_EvalFile(SCI+"/tcl/browsehelp.tcl")
end
endfunction
|