/usr/share/mozart/doc/demo/node18.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>Graphical interface for editing: Edit.oz</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="node17.html#code.cutting.script"><< Prev</A></TD><TD><A href="cutting.html">- Up -</A></TD><TD><A href="node19.html#code.cutting.compute">Next >></A></TD></TR></TABLE><DIV class="unnumbered" id="code.cutting.edit"><H3><A name="code.cutting.edit">Graphical interface for editing: <CODE>Edit.oz</CODE></A></H3><P class="margin"><A href="Cutting/Edit.oz">Source File</A></P><P> </P><BLOCKQUOTE><PRE><SPAN class="keyword">functor</SPAN> <BR> <BR><SPAN class="keyword">import</SPAN> <BR> Tk<BR> TkTools<BR> <BR> Configure(colors: Colors<BR> fonts: Fonts)<BR> <BR> <BR><SPAN class="keyword">export</SPAN> <BR> page: EditPage<BR> <BR><SPAN class="keyword">prepare</SPAN> <BR> <BR> NoPlates = 5<BR> Quantity = 60<BR> PlateWidth = 5<BR> Pad = 3<BR> <BR><SPAN class="keyword">define</SPAN> <BR> <BR> EntryColor = Colors<SPAN class="keyword">.</SPAN>entry<BR> <BR> BadColor = Colors<SPAN class="keyword">.</SPAN>bad<BR> GoodColor = Colors<SPAN class="keyword">.</SPAN>good<BR> NeutralColor = Colors<SPAN class="keyword">.</SPAN>neutral<BR> <BR> GlassColor = Colors<SPAN class="keyword">.</SPAN>glass<BR> <BR> <SPAN class="keyword">class</SPAN> <SPAN class="type">PlateBar</SPAN> <BR> <SPAN class="keyword">from</SPAN><SPAN class="type"> Tk.canvas</SPAN> <BR> <SPAN class="keyword">prop</SPAN> locking<BR> <BR> <SPAN class="keyword">feat</SPAN> d<BR> <SPAN class="keyword">attr</SPAN> Pos:0<BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">init</SPAN>(parent:P size:S)<BR> <SPAN class="keyword">lock</SPAN> <BR> D = S <SPAN class="keyword">*</SPAN> PlateWidth<BR> N = Quantity <SPAN class="keyword">div</SPAN> (S <SPAN class="keyword">+</SPAN> 1)<BR> XH = <SPAN class="keyword">~</SPAN> Quantity <SPAN class="keyword">*</SPAN> PlateWidth<BR> <SPAN class="keyword">in</SPAN> <BR> Tk<SPAN class="keyword">.</SPAN>canvas<SPAN class="keyword">,</SPAN>tkInit(parent: P<BR> width: (Quantity <SPAN class="keyword">-</SPAN> 1) <SPAN class="keyword">*</SPAN> PlateWidth<BR> height: D<BR> bg: ivory)<BR> {For 0 N<SPAN class="keyword">-</SPAN>1 1<BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> I}<BR> X0 = XH <SPAN class="keyword">+</SPAN> I<SPAN class="keyword">*</SPAN>(D<SPAN class="keyword">+</SPAN>PlateWidth) <SPAN class="keyword">+</SPAN> 1<BR> X1 = X0 <SPAN class="keyword">+</SPAN> D <SPAN class="keyword">-</SPAN> 1 <BR> Y0 = 1<BR> Y1 = Y0 <SPAN class="keyword">+</SPAN> D <SPAN class="keyword">-</SPAN> 1<BR> <SPAN class="keyword">in</SPAN> <BR> {<SPAN class="keyword">self</SPAN> tk(create rectangle X0 Y0 X1 Y1<BR> fill: GlassColor<BR> outline: black)}<BR> <SPAN class="keyword">end</SPAN>}<BR> <SPAN class="keyword">self.</SPAN>d = D<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">set</SPAN>(N)<BR> <SPAN class="keyword">lock</SPAN> <BR> M = N <SPAN class="keyword">-</SPAN> <SPAN class="keyword">@</SPAN>Pos<BR> <SPAN class="keyword">in</SPAN> <BR> Pos <SPAN class="keyword"><-</SPAN> N<BR> Tk<SPAN class="keyword">.</SPAN>canvas<SPAN class="keyword">,</SPAN>tk(move all M<SPAN class="keyword">*</SPAN>(<SPAN class="keyword">self.</SPAN>d <SPAN class="keyword">+</SPAN> PlateWidth) 0)<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">class</SPAN> <SPAN class="type">EditPage</SPAN> <BR> <SPAN class="keyword">from</SPAN><SPAN class="type"> TkTools.note</SPAN> <BR> <SPAN class="keyword">feat</SPAN> <BR> squares<BR> plateBars<BR> status<BR> compute<BR> <SPAN class="keyword">attr</SPAN> <BR> x:10 y:10<BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">init</SPAN>(parent:P compute:C)<BR> TkTools<SPAN class="keyword">.</SPAN>note<SPAN class="keyword">,</SPAN>tkInit(parent:P text:<SPAN class="string">'Edit'</SPAN>)<BR> PlateFrame = {New TkTools<SPAN class="keyword">.</SPAN>textframe<BR> tkInit(parent: <SPAN class="keyword">self</SPAN> <BR> font: Fonts<SPAN class="keyword">.</SPAN>normal<BR> text: <SPAN class="string">'Glass Plates'</SPAN>)}<BR> <SPAN class="keyword">self.</SPAN>squares = {Dictionary<SPAN class="keyword">.</SPAN>new}<BR> <SPAN class="keyword">self.</SPAN>plateBars = {MakeTuple bars NoPlates}<BR> <BR> TicklePackPlates =<BR> {ForThread 1 NoPlates 1<BR> <SPAN class="keyword">fun</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> Tcls D}<BR> L = {New Tk<SPAN class="keyword">.</SPAN>label<BR> tkInit(parent: PlateFrame<SPAN class="keyword">.</SPAN>inner<BR> font: Fonts<SPAN class="keyword">.</SPAN>normal<BR> text: D<SPAN class="keyword">#</SPAN><SPAN class="string">'x'</SPAN><SPAN class="keyword">#</SPAN>D)}<BR> E = {New TkTools<SPAN class="keyword">.</SPAN>numberentry<BR> tkInit(parent: PlateFrame<SPAN class="keyword">.</SPAN>inner<BR> font: Fonts<SPAN class="keyword">.</SPAN>bold<BR> min: 0<BR> max: Quantity <SPAN class="keyword">div</SPAN> (D <SPAN class="keyword">+</SPAN> 1)<BR> width: 2<BR> action: <SPAN class="keyword">self</SPAN> <SPAN class="keyword">#</SPAN> plate(D))}<BR> {E<SPAN class="keyword">.</SPAN>entry tk(configure bg:EntryColor)}<BR> G = {New PlateBar init(parent:PlateFrame<SPAN class="keyword">.</SPAN>inner size:D)}<BR> <SPAN class="keyword">in</SPAN> <BR> <SPAN class="keyword">self.</SPAN>plateBars<SPAN class="keyword">.</SPAN>D = G<BR> (grid(row:D column:1 L padx:Pad pady:Pad sticky:n) <SPAN class="keyword">|</SPAN> <BR> grid(row:D column:2 E padx:Pad pady:Pad sticky:n) <SPAN class="keyword">|</SPAN> <BR> grid(row:D column:3 G padx:Pad pady:Pad sticky:n) <SPAN class="keyword">|</SPAN> Tcls)<BR> <SPAN class="keyword">end</SPAN> nil}<BR> <BR> TargetFrame = {New TkTools<SPAN class="keyword">.</SPAN>textframe<BR> tkInit(parent: <SPAN class="keyword">self</SPAN> <BR> font: Fonts<SPAN class="keyword">.</SPAN>normal<BR> text: <SPAN class="string">'Target Plate'</SPAN>)}<BR> <BR> XL = {New Tk<SPAN class="keyword">.</SPAN>label<BR> tkInit(parent: TargetFrame<SPAN class="keyword">.</SPAN>inner<BR> font: Fonts<SPAN class="keyword">.</SPAN>normal<BR> text: <SPAN class="string">'X'</SPAN>)}<BR> XE = {New TkTools<SPAN class="keyword">.</SPAN>numberentry<BR> tkInit(parent: TargetFrame<SPAN class="keyword">.</SPAN>inner<BR> min: 1<BR> val: 10<BR> max: 50<BR> width: 2<BR> font: Fonts<SPAN class="keyword">.</SPAN>bold<BR> action: <SPAN class="keyword">self</SPAN> <SPAN class="keyword">#</SPAN> set(x))}<BR> {XE<SPAN class="keyword">.</SPAN>entry tk(configure bg:EntryColor)}<BR> YL = {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent: TargetFrame<SPAN class="keyword">.</SPAN>inner<BR> font: Fonts<SPAN class="keyword">.</SPAN>normal<BR> text: <SPAN class="string">'Y'</SPAN>)}<BR> YE = {New TkTools<SPAN class="keyword">.</SPAN>numberentry<BR> tkInit(parent: TargetFrame<SPAN class="keyword">.</SPAN>inner<BR> min: 1<BR> val: 10<BR> max: 50<BR> width: 2<BR> font: Fonts<SPAN class="keyword">.</SPAN>bold<BR> action: <SPAN class="keyword">self</SPAN> <SPAN class="keyword">#</SPAN> set(y))}<BR> {YE<SPAN class="keyword">.</SPAN>entry tk(configure bg:EntryColor)}<BR> CL = {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent: TargetFrame<SPAN class="keyword">.</SPAN>inner<BR> font: Fonts<SPAN class="keyword">.</SPAN>normal<BR> text: <SPAN class="string">''</SPAN> <BR> width: 26<BR> bg: NeutralColor<BR> relief: sunken<BR> bd: 1)}<BR> <SPAN class="keyword">in</SPAN> <BR> <SPAN class="keyword">self.</SPAN>status = CL<BR> <SPAN class="keyword">self.</SPAN>compute = C<BR> {Tk<SPAN class="keyword">.</SPAN>batch {Append TicklePackPlates<BR> [grid(row:1 column:1 XL padx:Pad pady:Pad sticky:n)<BR> grid(row:1 column:2 XE padx:Pad pady:Pad sticky:n)<BR> grid(row:1 column:3 {New Tk<SPAN class="keyword">.</SPAN>canvas<BR> tkInit(parent:TargetFrame<SPAN class="keyword">.</SPAN>inner<BR> width:10<BR> height:1)} sticky:w)<BR> grid(row:1 column:4 YL padx:Pad pady:Pad sticky:w)<BR> grid(row:1 column:5 YE padx:Pad pady:Pad sticky:w)<BR> grid(row:1 column:6 {New Tk<SPAN class="keyword">.</SPAN>canvas<BR> tkInit(parent:TargetFrame<SPAN class="keyword">.</SPAN>inner<BR> width:10<BR> height:1)} sticky:w)<BR> grid(row:1 column:7 CL padx:Pad pady:Pad sticky:w)<BR> grid(row:1 column:1 padx:Pad pady:Pad PlateFrame)<BR> grid(row:2 column:1 padx:Pad pady:Pad TargetFrame<BR> sticky:ew)]}}<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">UpdateStatus</SPAN> <BR> Cap = <SPAN class="keyword">@</SPAN>x <SPAN class="keyword">*</SPAN> <SPAN class="keyword">@</SPAN>y<BR> Use = {FoldL {Dictionary<SPAN class="keyword">.</SPAN>entries <SPAN class="keyword">self.</SPAN>squares}<BR> <SPAN class="keyword">fun</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> Use D<SPAN class="keyword">#</SPAN>N}<BR> D<SPAN class="keyword">*</SPAN>D<SPAN class="keyword">*</SPAN>N <SPAN class="keyword">+</SPAN> Use<BR> <SPAN class="keyword">end</SPAN> 0}<BR> Col<SPAN class="keyword">#</SPAN>Txt = <SPAN class="keyword">if</SPAN> Cap <SPAN class="keyword"><</SPAN> Use <SPAN class="keyword">then</SPAN> <BR> BadColor <SPAN class="keyword">#</SPAN> <SPAN class="string">'Plate too small.'</SPAN> <BR> <SPAN class="keyword">else</SPAN> <BR> GoodColor <SPAN class="keyword">#</SPAN> <SPAN class="string">'Plate possibly large enough.'</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">in</SPAN> <BR> {<SPAN class="keyword">self.</SPAN>status tk(configure<BR> text: Txt<BR> bg: Col)}<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">plate</SPAN>(D N)<BR> {<SPAN class="keyword">self.</SPAN>plateBars<SPAN class="keyword">.</SPAN>D set(N)}<BR> {Dictionary<SPAN class="keyword">.</SPAN>put <SPAN class="keyword">self.</SPAN>squares D N}<BR> EditPage<SPAN class="keyword">,</SPAN>UpdateStatus<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">set</SPAN>(Attr X)<BR> Attr <SPAN class="keyword"><-</SPAN> X<BR> EditPage<SPAN class="keyword">,</SPAN>UpdateStatus<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">getSpec</SPAN>($)<BR> spec(x:<SPAN class="keyword">@</SPAN>x y:<SPAN class="keyword">@</SPAN>y squares:{Dictionary<SPAN class="keyword">.</SPAN>toRecord spec <SPAN class="keyword">self.</SPAN>squares})<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR><SPAN class="keyword">end</SPAN> <BR></PRE></BLOCKQUOTE><P></P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node17.html#code.cutting.script"><< Prev</A></TD><TD><A href="cutting.html">- Up -</A></TD><TD><A href="node19.html#code.cutting.compute">Next >></A></TD></TR></TABLE><HR><ADDRESS><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>
|