This file is indexed.

/usr/share/mozart/doc/wp/node36.html is in mozart-doc 1.4.0-8ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

1
2
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>6.4 Example: An Animated Time Waster</TITLE><LINK href="ozdoc.css" rel="stylesheet" type="text/css"></HEAD><BODY><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node35.html#section.canvas.tags">&lt;&lt; Prev</A></TD><TD><A href="node32.html">- Up -</A></TD></TR></TABLE><DIV id="section.canvas.animated"><H2><A name="section.canvas.animated">6.4 Example: An Animated Time Waster</A></H2><P> In this section we want to program a procedure that signals to the user that a particular computation is still running and entertains the user by some animation. </P><P> <A href="node36.html#figure.canvas.animclass">Figure&nbsp;6.4</A> shows a subclass of <CODE>Tk<SPAN class="keyword">.</SPAN>canvasTag</CODE> that creates a bitmap item showing a magnifying glass and starts a thread to move that bitmap randomly. The random movement can be stopped by binding the variable <CODE>D</CODE> given as value for the feature <CODE>done</CODE>. If the animation has stopped indeed, the variable <CODE>S</CODE> gets bound, as you can see in method <CODE>move</CODE>. </P><P> </P><DIV id="figure.canvas.animclass"><HR><P><A name="figure.canvas.animclass"></A></P><DL class="anonymous"><DD class="code"><CODE><SPAN class="keyword">local</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">RandCoord</SPAN>}&nbsp;{OS<SPAN class="keyword">.</SPAN>rand}&nbsp;<SPAN class="keyword">mod</SPAN>&nbsp;20&nbsp;<SPAN class="keyword">+</SPAN>&nbsp;15&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR><SPAN class="keyword">in</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">class</SPAN>&nbsp;<SPAN class="type">RandMag</SPAN>&nbsp;<SPAN class="keyword">from</SPAN><SPAN class="type">&nbsp;Tk.canvasTag</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">meth</SPAN>&nbsp;<SPAN class="functionname">init</SPAN>(parent:P&nbsp;done:D&nbsp;stopped:S)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<SPAN class="keyword">self</SPAN>&nbsp;tkInit(parent:P)}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{P&nbsp;tk(create&nbsp;bitmap&nbsp;0&nbsp;0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bitmap:<SPAN class="string">'@'</SPAN><SPAN class="keyword">#</SPAN><SPAN class="string">'/usr/share/mozart/doc/wp/magnifier.xbm'</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tags:<SPAN class="keyword">self</SPAN>&nbsp;foreground:blue)}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">thread</SPAN>&nbsp;{<SPAN class="keyword">self</SPAN>&nbsp;move(D&nbsp;S)}&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">meth</SPAN>&nbsp;<SPAN class="functionname">move</SPAN>(D&nbsp;S)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{WaitOr&nbsp;{Alarm&nbsp;400}&nbsp;D}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">if</SPAN>&nbsp;{IsDet&nbsp;D}&nbsp;<SPAN class="keyword">then</SPAN>&nbsp;S=<SPAN class="keyword">unit</SPAN>&nbsp;<SPAN class="keyword">else</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<SPAN class="keyword">self</SPAN>&nbsp;tk(coords&nbsp;{RandCoord}&nbsp;{RandCoord})}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<SPAN class="keyword">self</SPAN>&nbsp;move(D&nbsp;S)}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR><SPAN class="keyword">end</SPAN></CODE></DD></DL><P class="caption"><STRONG>Figure&nbsp;6.4:</STRONG> An animated time waster class.</P><HR></DIV><P> </P><P> The procedure <CODE>WaitDone</CODE> shown in <A href="node36.html#figure.canvas.waitdone">Figure&nbsp;6.5</A> takes a variable <CODE>Done</CODE> which is used for signalling when the computation we are waiting for is finished. It creates a randomly moving magnifier item and as soon as the magnifier signals that it has been stopped (by <CODE>Stopped</CODE>) the toplevel windows is closed. </P><P> </P><DIV id="figure.canvas.waitdone"><HR><P><A name="figure.canvas.waitdone"></A></P><P> </P><DIV align="center"><IMG alt="" src="waitdone.gif"></DIV><P> </P><DL class="anonymous"><DD class="code"><CODE><SPAN class="keyword">proc</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">WaitDone</SPAN>&nbsp;Done}<BR>&nbsp;&nbsp;&nbsp;W={New&nbsp;Tk<SPAN class="keyword">.</SPAN>toplevel&nbsp;tkInit(withdraw:<SPAN class="keyword">true</SPAN>)}<BR>&nbsp;&nbsp;&nbsp;L={New&nbsp;Tk<SPAN class="keyword">.</SPAN>label&nbsp;&nbsp;&nbsp;&nbsp;tkInit(parent:W&nbsp;text:<SPAN class="string">'Computing...'</SPAN>)}<BR>&nbsp;&nbsp;&nbsp;C={New&nbsp;Tk<SPAN class="keyword">.</SPAN>canvas&nbsp;&nbsp;&nbsp;tkInit(parent:W&nbsp;width:50&nbsp;height:50)}<BR>&nbsp;&nbsp;&nbsp;Stopped<BR><SPAN class="keyword">in</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;{Tk<SPAN class="keyword">.</SPAN>batch&nbsp;[wm(overrideredirect&nbsp;W&nbsp;<SPAN class="keyword">true</SPAN>)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pack(L&nbsp;C&nbsp;side:left&nbsp;pady:2<SPAN class="keyword">#</SPAN>m&nbsp;padx:2<SPAN class="keyword">#</SPAN>m)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wm(deiconify&nbsp;W)]}<BR>&nbsp;&nbsp;&nbsp;_={New&nbsp;RandMag&nbsp;init(parent:C&nbsp;done:Done&nbsp;stopped:Stopped)}<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">thread</SPAN>&nbsp;{Wait&nbsp;Stopped}&nbsp;{W&nbsp;tkClose}&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR><SPAN class="keyword">end</SPAN></CODE></DD></DL><P> </P><P class="caption"><STRONG>Figure&nbsp;6.5:</STRONG> A procedure for creating wait dialogs.</P><HR></DIV><P> </P><P> For example, </P><DL class="anonymous"><DD class="code"><CODE><SPAN class="keyword">declare</SPAN>&nbsp;Done<BR>{WaitDone&nbsp;Done}</CODE></DD></DL><P> creates a waiting dialog which disappears by binding <CODE>Done</CODE> </P><DL class="anonymous"><DD class="code"><CODE>Done=<SPAN class="keyword">unit</SPAN></CODE></DD></DL><P> </P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node35.html#section.canvas.tags">&lt;&lt; Prev</A></TD><TD><A href="node32.html">- Up -</A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~schulte/">Christian&nbsp;Schulte</A><BR><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>