/usr/share/mozart/doc/demo/node14.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: Graphics.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="node13.html#code.college.scheduler"><< Prev</A></TD><TD><A href="college.html">- Up -</A></TD><TD><A href="node15.html#code.college.latex">Next >></A></TD></TR></TABLE><DIV class="unnumbered" id="code.college.graphics"><H3><A name="code.college.graphics">Graphical interface: <CODE>Graphics.oz</CODE></A></H3><P class="margin"><A href="College/Graphics.oz">Source File</A></P><P> </P><BLOCKQUOTE><PRE><SPAN class="keyword">functor</SPAN> <BR> <BR><SPAN class="keyword">export</SPAN> <BR> <BR> DrawSchedule<BR> <BR><SPAN class="keyword">import</SPAN> <BR> <BR> Common(monday: Monday<BR> tuesday: Tuesday<BR> wednesday: Wednesday<BR> thursday: Thursday<BR> friday: Friday<BR> quartersPerDay: QuartersPerDay)<BR> <BR> Scheduler(timeTable: TimeTable)<BR> <BR> Tk<BR> <BR><SPAN class="keyword">define</SPAN> <BR> <BR> Colors = <SPAN class="keyword">if</SPAN> Tk<SPAN class="keyword">.</SPAN>isColor <SPAN class="keyword">then</SPAN> <BR> colors(<SPAN class="string">'2'</SPAN>: lightyellow1<BR> <SPAN class="string">'4'</SPAN>: lightsalmon2<BR> <SPAN class="string">'6'</SPAN>: cyan3<BR> <SPAN class="string">'8'</SPAN>: lightgoldenrod1<BR> <SPAN class="string">'M'</SPAN>: mistyrose3<BR> <SPAN class="string">'F'</SPAN>: tomato)<BR> <SPAN class="keyword">else</SPAN> <BR> colors(<SPAN class="string">'2'</SPAN>: white<BR> <SPAN class="string">'4'</SPAN>: white<BR> <SPAN class="string">'6'</SPAN>: white<BR> <SPAN class="string">'8'</SPAN>: white<BR> <SPAN class="string">'M'</SPAN>: white<BR> <SPAN class="string">'F'</SPAN>: white)<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> RoomLimit = 10<BR> HeightLecture = 15<BR> DayHeight = (RoomLimit <SPAN class="keyword">+</SPAN> 1) <SPAN class="keyword">*</SPAN> HeightLecture<BR> YOff = 6<BR> XOff = 10<BR> CanvasWidth = 720<BR> Roff = 2<BR> CanvasHeight = 5 <SPAN class="keyword">*</SPAN> DayHeight<BR> Quarter = 20 <BR> WeekDaysWidth = 90<BR> TimeLineY = 30<BR> RoomMarkOffset = <SPAN class="keyword">~</SPAN>3<BR> Font = <SPAN class="string">'lucidasanstypewriter-12'</SPAN> <BR> <BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">GetEarliest</SPAN> Until Ind Lecture Canvas Day NewUntil}<BR> <SPAN class="keyword">if</SPAN> Ind <SPAN class="keyword">></SPAN> RoomLimit <SPAN class="keyword">then</SPAN> <BR> <SPAN class="keyword">fail</SPAN> <BR> <SPAN class="keyword">elseif</SPAN> Until<SPAN class="keyword">.</SPAN>Ind <SPAN class="keyword">=<</SPAN> Lecture<SPAN class="keyword">.</SPAN>start <SPAN class="keyword">then</SPAN> <BR> {Canvas<BR> tk(crea rectangle<BR> ((Lecture<SPAN class="keyword">.</SPAN>start<SPAN class="keyword">-</SPAN>1) <SPAN class="keyword">mod</SPAN> 36)<SPAN class="keyword">*</SPAN>Quarter<SPAN class="keyword">+</SPAN>Roff<BR> (Day<SPAN class="keyword">-</SPAN>1)<SPAN class="keyword">*</SPAN>DayHeight<SPAN class="keyword">+</SPAN>HeightLecture<SPAN class="keyword">*</SPAN>(Ind<SPAN class="keyword">-</SPAN>1)<SPAN class="keyword">+</SPAN>TimeLineY<BR> (((Lecture<SPAN class="keyword">.</SPAN>start<SPAN class="keyword">-</SPAN>1) <SPAN class="keyword">mod</SPAN> 36)<SPAN class="keyword">+</SPAN>(Lecture<SPAN class="keyword">.</SPAN>dur))<SPAN class="keyword">*</SPAN>Quarter<SPAN class="keyword">+</SPAN>Roff<BR> (Day<SPAN class="keyword">-</SPAN>1)<SPAN class="keyword">*</SPAN>DayHeight<SPAN class="keyword">+</SPAN>HeightLecture<SPAN class="keyword">*</SPAN>(Ind)<SPAN class="keyword">+</SPAN>TimeLineY<BR> fill:Colors<SPAN class="keyword">.</SPAN>{String<SPAN class="keyword">.</SPAN>toAtom<BR> [{Atom<SPAN class="keyword">.</SPAN>toString Lecture<SPAN class="keyword">.</SPAN>name}<SPAN class="keyword">.</SPAN>1]})}<BR> <SPAN class="keyword">case</SPAN> Lecture<SPAN class="keyword">.</SPAN>size <SPAN class="keyword">of</SPAN> big<BR> <SPAN class="keyword">then</SPAN> {Canvas tk(crea line<BR> (((Lecture<SPAN class="keyword">.</SPAN>start<SPAN class="keyword">-</SPAN>1) <SPAN class="keyword">mod</SPAN> 36)<SPAN class="keyword">+</SPAN> <BR> (Lecture<SPAN class="keyword">.</SPAN>dur))<SPAN class="keyword">*</SPAN>Quarter<SPAN class="keyword">+</SPAN>RoomMarkOffset<SPAN class="keyword">*</SPAN>2<SPAN class="keyword">+</SPAN>Roff<BR> (Day<SPAN class="keyword">-</SPAN>1)<SPAN class="keyword">*</SPAN>DayHeight<SPAN class="keyword">+</SPAN>HeightLecture<SPAN class="keyword">*</SPAN>(Ind<SPAN class="keyword">-</SPAN>1)<SPAN class="keyword">+</SPAN> <BR> TimeLineY<BR> (((Lecture<SPAN class="keyword">.</SPAN>start<SPAN class="keyword">-</SPAN>1) <SPAN class="keyword">mod</SPAN> 36)<SPAN class="keyword">+</SPAN> <BR> (Lecture<SPAN class="keyword">.</SPAN>dur))<SPAN class="keyword">*</SPAN>Quarter<SPAN class="keyword">+</SPAN>RoomMarkOffset<SPAN class="keyword">*</SPAN>2<SPAN class="keyword">+</SPAN>Roff<BR> (Day<SPAN class="keyword">-</SPAN>1)<SPAN class="keyword">*</SPAN>DayHeight<SPAN class="keyword">+</SPAN>HeightLecture<SPAN class="keyword">*</SPAN>(Ind)<SPAN class="keyword">+</SPAN> <BR> TimeLineY)}<BR> <SPAN class="keyword">else</SPAN> <SPAN class="keyword">skip</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">if</SPAN> Lecture<SPAN class="keyword">.</SPAN>size<SPAN class="keyword">==</SPAN>big <SPAN class="keyword">orelse</SPAN> Lecture<SPAN class="keyword">.</SPAN>size<SPAN class="keyword">==</SPAN>small <SPAN class="keyword">then</SPAN> <BR> {Canvas tk(crea line<BR> (((Lecture<SPAN class="keyword">.</SPAN>start<SPAN class="keyword">-</SPAN>1) <SPAN class="keyword">mod</SPAN> 36)<SPAN class="keyword">+</SPAN> <BR> (Lecture<SPAN class="keyword">.</SPAN>dur))<SPAN class="keyword">*</SPAN>Quarter<SPAN class="keyword">+</SPAN>RoomMarkOffset<SPAN class="keyword">+</SPAN>Roff<BR> (Day<SPAN class="keyword">-</SPAN>1)<SPAN class="keyword">*</SPAN>DayHeight<SPAN class="keyword">+</SPAN>HeightLecture<SPAN class="keyword">*</SPAN>(Ind<SPAN class="keyword">-</SPAN>1)<SPAN class="keyword">+</SPAN> <BR> TimeLineY<BR> (((Lecture<SPAN class="keyword">.</SPAN>start<SPAN class="keyword">-</SPAN>1) <SPAN class="keyword">mod</SPAN> 36)<SPAN class="keyword">+</SPAN> <BR> (Lecture<SPAN class="keyword">.</SPAN>dur))<SPAN class="keyword">*</SPAN>Quarter<SPAN class="keyword">+</SPAN>RoomMarkOffset<SPAN class="keyword">+</SPAN>Roff<BR> (Day<SPAN class="keyword">-</SPAN>1)<SPAN class="keyword">*</SPAN>DayHeight<SPAN class="keyword">+</SPAN>HeightLecture<SPAN class="keyword">*</SPAN>(Ind)<SPAN class="keyword">+</SPAN> <BR> TimeLineY) }<BR> <SPAN class="keyword">else</SPAN> <SPAN class="keyword">skip</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> {Canvas<BR> tk(crea text<BR> ((Lecture<SPAN class="keyword">.</SPAN>start<SPAN class="keyword">-</SPAN>1) <SPAN class="keyword">mod</SPAN> 36)<SPAN class="keyword">*</SPAN>Quarter<SPAN class="keyword">+</SPAN>XOff<SPAN class="keyword">+</SPAN>Roff<BR> (Day<SPAN class="keyword">-</SPAN>1)<SPAN class="keyword">*</SPAN>DayHeight<SPAN class="keyword">+</SPAN>HeightLecture<SPAN class="keyword">*</SPAN>(Ind<SPAN class="keyword">-</SPAN>1)<SPAN class="keyword">+</SPAN>YOff<SPAN class="keyword">+</SPAN>TimeLineY<BR> text : Lecture<SPAN class="keyword">.</SPAN>name<BR> anchor:w<BR> font:Font)}<BR> NewUntil = {AdjoinAt Until Ind Lecture<SPAN class="keyword">.</SPAN>start<SPAN class="keyword">+</SPAN>Lecture<SPAN class="keyword">.</SPAN>dur}<BR> <SPAN class="keyword">else</SPAN> {GetEarliest Until Ind<SPAN class="keyword">+</SPAN>1 Lecture Canvas Day NewUntil}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">DoDisplay</SPAN> SortedLectures Day Canvas Until}<BR> <SPAN class="keyword">case</SPAN> SortedLectures <SPAN class="keyword">of</SPAN> nil <SPAN class="keyword">then</SPAN> <SPAN class="keyword">skip</SPAN> <BR> <SPAN class="keyword">[]</SPAN> L<SPAN class="keyword">|</SPAN>Lr <SPAN class="keyword">then</SPAN> <BR> NewUntil = {GetEarliest Until 1 L Canvas Day} <SPAN class="keyword">in</SPAN> <BR> {DoDisplay Lr Day Canvas NewUntil}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">DrawSchedule</SPAN> FlatSols Parent}<BR> W<BR> CanvasColor = <SPAN class="keyword">if</SPAN> Tk<SPAN class="keyword">.</SPAN>isColor <SPAN class="keyword">then</SPAN> mediumturquoise <SPAN class="keyword">else</SPAN> white <SPAN class="keyword">end</SPAN> <BR> Canvas WeekDays<BR> <SPAN class="keyword">in</SPAN> <BR> {TimeTable save(<SPAN class="string">"CurrentOut.ozt"</SPAN>)}<BR> <BR> W = {New Tk<SPAN class="keyword">.</SPAN>toplevel tkInit(parent:Parent background:CanvasColor)} <BR> {Tk<SPAN class="keyword">.</SPAN>send wm(title W<BR> <SPAN class="string">" Katholische Hochschule fuer Soziale Arbeit -- Wintersemester 1995/96 "</SPAN>)}<BR> Canvas = {New Tk<SPAN class="keyword">.</SPAN>canvas tkInit(parent: W <BR> width: CanvasWidth<BR> height: CanvasHeight)}<BR> WeekDays = {New Tk<SPAN class="keyword">.</SPAN>canvas tkInit(parent: W<BR> width: WeekDaysWidth<BR> height: CanvasHeight)}<BR> <BR> {List<SPAN class="keyword">.</SPAN>forAllInd [<SPAN class="string">'Monday'</SPAN> <SPAN class="string">'Tuesday'</SPAN> <SPAN class="string">'Wednesday'</SPAN> <SPAN class="string">'Thursday'</SPAN> <SPAN class="string">'Friday'</SPAN>]<BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> Ind Day}<BR> {WeekDays tk(crea text 5 Ind<SPAN class="keyword">*</SPAN>DayHeight<SPAN class="keyword">-</SPAN>(DayHeight <SPAN class="keyword">div</SPAN> 2)<SPAN class="keyword">+</SPAN>18<BR> text:Day anchor:w)}<BR> <SPAN class="keyword">end</SPAN>}<BR> <BR> {Tk<SPAN class="keyword">.</SPAN>send pack(WeekDays Canvas side:left)}<BR> <BR> {For 3 QuartersPerDay 4<BR> <SPAN class="keyword">proc</SPAN>{<SPAN class="functionname">$</SPAN> I} <BR> Text={Int<SPAN class="keyword">.</SPAN>toString 8 <SPAN class="keyword">+</SPAN> (I<SPAN class="keyword">+</SPAN>1)<SPAN class="keyword">div</SPAN> 4}<BR> <SPAN class="keyword">in</SPAN> <BR> {Canvas tk(crea line I<SPAN class="keyword">*</SPAN>Quarter 0 I<SPAN class="keyword">*</SPAN>Quarter 10)}<BR> {Canvas tk(crea text I<SPAN class="keyword">*</SPAN>Quarter 2<SPAN class="keyword">*</SPAN>10 text: Text)} <BR> <SPAN class="keyword">end</SPAN>}<BR> <BR> {List<SPAN class="keyword">.</SPAN>forAllInd [Monday Tuesday Wednesday Thursday Friday]<BR> <SPAN class="keyword">proc</SPAN>{<SPAN class="functionname">$</SPAN> Ind Day}<BR> LecturesOnThatDay = {List<SPAN class="keyword">.</SPAN>filter FlatSols<BR> <SPAN class="keyword">fun</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> L}<BR> %% <SPAN class="comment">We know that start time is fixed!<BR></SPAN> <SPAN class="keyword">thread</SPAN> <BR> <SPAN class="keyword">cond</SPAN> L<SPAN class="keyword">.</SPAN>start<SPAN class="keyword">::</SPAN>Day <SPAN class="keyword">then</SPAN> <SPAN class="keyword">true</SPAN> <SPAN class="keyword">else</SPAN> <SPAN class="keyword">false</SPAN> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN>}<BR> SortedLectures = {Sort LecturesOnThatDay<BR> <SPAN class="keyword">fun</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> L1 L2} L1<SPAN class="keyword">.</SPAN>start<SPAN class="keyword"><</SPAN>L2<SPAN class="keyword">.</SPAN>start <SPAN class="keyword">end</SPAN>}<BR> TupleUntil = {MakeTuple until RoomLimit} <BR> <SPAN class="keyword">in</SPAN> <BR> {Record<SPAN class="keyword">.</SPAN>forAll TupleUntil <SPAN class="keyword">fun</SPAN>{<SPAN class="functionname">$</SPAN>} 0 <SPAN class="keyword">end</SPAN>} <BR> {DoDisplay SortedLectures Ind Canvas TupleUntil}<BR> <SPAN class="keyword">if</SPAN> Ind <SPAN class="keyword"><</SPAN> 5 <SPAN class="keyword">then</SPAN> <BR> {Canvas tk(crea line 0 Ind<SPAN class="keyword">*</SPAN>DayHeight<SPAN class="keyword">+</SPAN>3<SPAN class="keyword">*</SPAN>HeightLecture <SPAN class="keyword">div</SPAN> 2<BR> CanvasWidth Ind<SPAN class="keyword">*</SPAN>DayHeight<SPAN class="keyword">+</SPAN>3<SPAN class="keyword">*</SPAN>HeightLecture <SPAN class="keyword">div</SPAN> 2)}<BR> <SPAN class="keyword">else</SPAN> <SPAN class="keyword">skip</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN>}<BR> <SPAN class="keyword">end</SPAN> <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="node13.html#code.college.scheduler"><< Prev</A></TD><TD><A href="college.html">- Up -</A></TD><TD><A href="node15.html#code.college.latex">Next >></A></TD></TR></TABLE><HR><ADDRESS><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>
|