DIRECTORY
Buttons USING [ Button],
BasicTime USING [ GMT],
Calendar USING [ ZoomLevel, Date, Years, Months, Days, Weekdays],
CalStorage USING [ Mode],
Hickory USING [ EventList, RepetitionType],
Icons USING [ IconFlavor],
Menus USING [ Menu, MenuProc],
Rope USING [ ROPE],
ViewerClasses USING [ Viewer]
;
Operations
M2I:
PROCEDURE [ m: Calendar.Months]
RETURNS [ i:
INTEGER] =
INLINE
BEGIN
SELECT m
FROM
January => RETURN[ 0];
February => RETURN[ 1];
March => RETURN[ 2];
April => RETURN [ 3];
May => RETURN[ 4];
June => RETURN[ 5];
July => RETURN[ 6];
August => RETURN[ 7];
September => RETURN[ 8];
October => RETURN[ 9];
November => RETURN[ 10];
December => RETURN[ 11];
ENDCASE;
END; -- M2I
I2M:
PROCEDURE [ i:
INT]
RETURNS [ m: Calendar.Months] =
INLINE
BEGIN
SELECT i
FROM
0 => RETURN[ January];
1 => RETURN[ February];
2 => RETURN[ March];
3 => RETURN [ April];
4 => RETURN[ May];
5 => RETURN[ June];
6 => RETURN[ July];
7 => RETURN[ August];
8 => RETURN[ September];
9 => RETURN[ October];
10 => RETURN[ November];
11 => RETURN[ December];
ENDCASE;
END; -- I2M
I2R:
PROCEDURE [ i:
INT]
RETURNS [ m: Hickory.RepetitionType] =
INLINE
BEGIN
SELECT i
FROM
0 => RETURN[ None];
1 => RETURN[ Hourly];
2 => RETURN[ Daily];
3 => RETURN[ Weekdays];
4 => RETURN[ Weekly];
5 => RETURN[ Monthly];
6 => RETURN[ Yearly];
7 => RETURN[ Complicated];
ENDCASE;
END; -- I2R
R2I:
PROCEDURE [ r: Hickory.RepetitionType]
RETURNS [ i:
INT] =
INLINE
BEGIN
SELECT r
FROM
None => RETURN[ 0];
Hourly => RETURN[ 1];
Daily => RETURN[ 2];
Weekdays => RETURN[ 3];
Weekly => RETURN[ 4];
Monthly => RETURN[ 5];
Yearly => RETURN[ 6];
Complicated => RETURN[ 7];
ENDCASE;
END; -- R2I
GetRowCol:
PRIVATE
-- EXTERNAL --
PROCEDURE [ day: Calendar.Days, firstDay: Calendar.Weekdays]
RETURNS [ row, col:
INTEGER] =
INLINE
BEGIN
in a 5 * 7 grid what are the coordinates of the day, given that the first day of the month
is firstDay?
offset: INTEGER;
SELECT firstDay
FROM
Monday => offset ← 1;
Tuesday => offset ← 2;
Wednesday => offset ← 3;
Thursday => offset ← 4;
Friday => offset ← 5;
Saturday => offset ← 6;
Sunday => offset ← 0;
ENDCASE;
row ← ( day-1 + offset) / 7; -- Remember col, row indices start at 0...
col ← ( day-1 + offset) MOD 7;
RETURN[ row, col];
END; -- GetRowCol
CreateButton: PRIVATE --EXTERNAL-- PROCEDURE [ title: Rope.ROPE, myParent: ViewerClasses.Viewer, hi, wi: CARDINAL, xOff, yOff: CARDINAL ← 0, proc: Menus.MenuProc, clientData: REF ANY, displayStyle: ATOM] RETURNS [ button: Buttons.Button];
ClearButton:
PUBLIC
--EXTERNAL--
PROCEDURE [ but: Buttons.Button];
to set display style to $BlackOnWhite
SetButton:
PUBLIC
--EXTERNAL--
PROCEDURE [ but: Buttons.Button];
to set display style to $BlackOnGrey
CreateTextViewer: PRIVATE --EXTERNAL-- PROCEDURE [ myParent: ViewerClasses.Viewer, width, height: CARDINAL, cont: Rope.ROPE ← NIL, scrolling: BOOLEAN ← FALSE, edit: BOOLEAN ← TRUE] RETURNS [ txtViewer: ViewerClasses.Viewer];
CreateCalViewer: PRIVATE --INTERNAL-- PROCEDURE;
ExtractDate: PRIVATE -- EXTERNAL-- PROCEDURE [ time: BasicTime.GMT] RETURNS [ date: Calendar.Date];
MakeMenu:
PRIVATE
-- EXTERNAL--
PROCEDURE [ menuItems:
LIST
OF Rope.
ROPE, menuProcs:
LIST
OF Menus.MenuProc, procArgs:
LIST
OF
REF
ANY]
RETURNS [ menu: Menus.Menu];
builds up a menu via repetitive calls to Menus.CreateEntry.
DisplayMsg:
PRIVATE
-- EXTERNAL--
PROCEDURE [ msg: Rope.
ROPE, blink: BOOLEAN ← TRUE];
displays the msg in the message window and blinks if blink!
PreviousDay: PRIVATE --EXTERNAL-- PROCEDURE [ date: Date] RETURNS [ newDate: Date];
NextDay: PRIVATE --EXTERNAL-- PROCEDURE [ date: Date] RETURNS [ newDate: Date];
GetMonthInfo: PRIVATE --EXTERNAL-- PROCEDURE [ mo: Months, yr: Years] RETURNS [ nbrOfDays: Days, firstDay: Weekdays];
GetMonthName:
PUBLIC
PROCEDURE [ mo: Months]
RETURNS [ name: Rope.
ROPE];
to get the month's alphanumeric name
GetDayName:
PUBLIC
PROCEDURE [ date: Date]
RETURNS [ name: Rope.
ROPE];
to get the date's day alphanumeric name
GetTimeInterval: PRIVATE --EXTERNAL-- PROCEDURE [ date: Date, level: ZoomLevel] RETURNS [ from, to: BasicTime.GMT];
GetNbrOfEvents: PRIVATE --EXTERNAL-- PROCEDURE [ zoom: ZoomLevel, evl: EventList ← NIL] RETURNS [ nbr: INTEGER];
GetIconFlavor:
PRIVATE
--EXTERNAL--
PROCEDURE [ mode: CalStorage.Mode, zoom: ZoomLevel ← unspecified, day: Days ← 1]
RETURNS [ icon: Icons.IconFlavor];
-- returns the appropriate Icon for the configuration of the calendar.
END.