-- /ivy/binding/calendar/calFormImplC.mesa
-- initially building the calendar form on screen and registering the different button procedures
-- Last edited by: Binding, August 21, 1984 11:37:32 am PDT
DIRECTORY
BasicTime USING [ Unpack, GMT, Unpacked, Update, nullGMT],
Buttons USING [ Button],
Calendar USING [ Date, Years, Months, Days, Weekdays],
CalForm USING [ RepetitionDescriptor, ColWidth, CharWidth, RowHeight, FormWidth, FormHeight, YearTable, MonthTable, DayTable, Row1, Row234, Row5, Row6, Row7, MenuTable, CalForm, CurSelection, YearSelection, MonthSelection, DaySelection, ChangeRepetitionSelection, ChangeGroupSelection, ScrollGroupMenu, calForm, curSelection],
CalStorage USING [ protData],
CalSupport USING [ GetMonthInfo, GetMonthName, CreateTextViewer, CreateButton, M2I, I2R, I2M, GetRowCol],
Containers USING [ Container, Create],
Hickory USING [ RepetitionType, ListGroups, GroupSet, EventTuple, ProtectionType],
IO USING [ PutFR, int],
Labels USING [ Set, Label],
Menus USING [ MenuProc, MouseButton],
Rope USING [ ROPE, Concat],
RopeSets USING [ RopeSetEl, IsSetEmpty, IsValueInSet],
Tempus USING [ MakeRope],
ViewerClasses USING [ Viewer, ViewerRec],
ViewerOps USING [ PaintViewer],
ViewerTools USING [ SetSelection],
VTables USING [ VTable, Create, SetTableEntry, Install, Border, GetTableEntry]
;
CalFormImplC: CEDAR MONITOR
LOCKS CalStorage.protData
IMPORTS BasicTime, CalStorage, CalSupport, Containers, Hickory, IO, Rope, ViewerOps, VTables, CalForm, RopeSets, Tempus, ViewerTools, Labels
EXPORTS CalForm
SHARES CalSupport, CalForm
= BEGIN OPEN CalStorage.protData, Calendar, CalForm;
Menu Procedures
YearSelect: Menus.MenuProc -- [parent: REF ANY, clientData: REF ANY ← NIL, mouseButton: MouseButton ← red, shift, control: BOOL ← FALSE] -- = BEGIN
year: REF Years = NARROW[ clientData];
YearSelection[ year^, mouseButton];
END; -- YearSelection
MonthSelect: Menus.MenuProc -- [parent: REF ANY, clientData: REF ANY ← NIL, mouseButton: MouseButton ← red, shift, control: BOOL ← FALSE] -- = BEGIN
mi: REF INT = NARROW[ clientData];
month: Months ← CalSupport.I2M[ mi^];
MonthSelection[ month, mouseButton];
END; -- MonthSelection
DaySelect: Menus.MenuProc -- [parent: REF ANY, clientData: REF ANY ← NIL, mouseButton: MouseButton ← red, shift, control: BOOL ← FALSE] -- = BEGIN
day: REF INT = NARROW[ clientData];
DaySelection[ day^, mouseButton];
END; -- DaySelection
SelectRepetition: Menus.MenuProc -- [parent: REF ANY, clientData: REF ANY ← NIL, mouseButton: MouseButton ← red, shift, control: BOOL ← FALSE] -- = BEGIN
repInt: REF INT = NARROW[ clientData];
repType: Hickory.RepetitionType ← CalSupport.I2R[ repInt^];
ChangeRepetitionSelection[ repType];
END; -- SelectRepetition
SelectGroup: PUBLIC Menus.MenuProc -- [parent: REF ANY, clientData: REF ANY ← NIL, mouseButton: MouseButton ← red, shift, control: BOOL ← FALSE] -- = BEGIN
IF mouseButton = yellow THEN BEGIN
group: REF INT = NARROW[ clientData];
ChangeGroupSelection[ group^];
END
blue = Right mouse button, red = Left mouse button
but we inverse that because of RopeSets.MoveRover semantics....
ELSE IF mouseButton = blue THEN ScrollGroupMenu[ Left]
ELSE ScrollGroupMenu[ Right];
END; -- SelectGroup
RowButtProc: Menus.MenuProc -- [parent: REF ANY, clientData: REF ANY ← NIL, mouseButton: MouseButton ← red, shift, control: BOOL ← FALSE] -- = BEGIN
rowIndex: REF INTNARROW[ clientData];
RowButtClick[ rowIndex^, mouseButton];
END; -- Row234ButtProc
RowButtClick: ENTRY PROCEDURE [ index: INT, but: Menus.MouseButton] = BEGIN
IF but = red THEN
SELECT index FROM
2 => ViewerTools.SetSelection[ calForm.row2.txtViewer];
3 => ViewerTools.SetSelection[ calForm.row3.txtViewer];
4 => ViewerTools.SetSelection[ calForm.row4.txtViewer];
5 => ViewerTools.SetSelection[ calForm.row5.txtViewer];
6 => ViewerTools.SetSelection[ calForm.row6.txtViewer];
71 => ViewerTools.SetSelection[ calForm.row7.txtViewers[ 1]];
72 => ViewerTools.SetSelection[ calForm.row7.txtViewers[ 2]];
81 => BEGIN
label: Labels.Label ← VTables.GetTableEntry[ table: calForm.row8.table, row: 0, column: 1];
IF curSelection.protection = Private THEN BEGIN
curSelection.protection ← Public;
Labels.Set[ label, " Public"];
END
ELSE BEGIN
curSelection.protection ← Private;
Labels.Set[ label, " Private"];
END;
END; -- 81
82 => BEGIN
label: Labels.Label ← VTables.GetTableEntry[ table: calForm.row8.table, row: 0, column: 3];
IF curSelection.reminder THEN BEGIN
curSelection.reminder ← FALSE;
Labels.Set[ label, " No"];
END
ELSE BEGIN
curSelection.reminder ← TRUE;
Labels.Set[ label, " Yes"];
END;
END; -- 82
ENDCASE;
END; -- Row234ButtClick
Utilities
TimeFormat: Rope.ROPE = "%2g:%02g"; -- the way we want to print times...( hours: minutes)
ExtractTimeSpec: PUBLIC PROCEDURE [ time: BasicTime.GMT, duration: CARDINAL] RETURNS [ rope: Rope.ROPE] = BEGIN
to translate the time into a printable format "hour:minute - hour:minute" that
specifies start and duration of an event.
auxTime: BasicTime.Unpacked ← BasicTime.Unpack[ time];
rope ← IO.PutFR[ TimeFormat, IO.int[ auxTime.hour], IO.int[ auxTime.minute]];
IF duration # 0 THEN BEGIN
time ← BasicTime.Update[ time, 60*duration];
auxTime ← BasicTime.Unpack[ time];
rope ← Rope.Concat[ rope, " — "];
rope ← Rope.Concat[ rope, IO.PutFR[ TimeFormat, IO.int[ auxTime.hour], IO.int[ auxTime.minute]]];
END;
RETURN[ rope];
END; -- ExtractTimeSpec
Creating the calendar form on the screen
CreateCalFormCont: PUBLIC INTERNAL PROCEDURE [ myParent: ViewerClasses.Viewer, ev: REF Hickory.EventTuple] = BEGIN
here we build the contents of the calViewer, while in Enter or Query mode. This is
rather lengthy...
view: ViewerClasses.ViewerRec;
BEGIN OPEN view;
ww ← FormWidth;
wh ← FormHeight;
scrollable ← FALSE;
iconic ← FALSE;
border ← TRUE;
parent ← myParent; -- calViewer...
END; -- OPEN
calForm.container ← Containers.Create[ view, FALSE];
CreateRow1[ curSelection.date];
CreateRow2[ ev];
CreateRow3[ ev];
CreateRow4[ ev];
CreateRow5[ curSelection.repetition];
CreateRow6[ curSelection.groups];
CreateRow7[ ev];
CreateRow8[ curSelection.protection, curSelection.reminder];
ViewerOps.PaintViewer[ calViewer, all];
END; -- CreateCalFormCont
CreateRow1: INTERNAL PROCEDURE [ date: Date] = BEGIN
create the three tables in first row
CreateYearTable[ date.Year];
CreateMonthTable[ date.Month];
CreateDayTable[ date];
END; -- CreateRow1
CreateYearTable: INTERNAL PROCEDURE [ y: Years] = BEGIN
OPEN calForm.row1.yearTable;
table ← VTables.Create[ rows: rows, columns: cols, h: height, w: width, x: xOff, y: yOff, parent: calForm.container];
VTables.SetTableEntry[ table: table, row: 0, column: 0, flavor: $Label, name: " Year ", useMaxSize: TRUE];
VTables.Install[ table, FALSE];
FOR i: INT IN [ 1..rows) DO
yy: Years ← y - ( rows-1)/2 + i;
yr: Rope.ROPEIO.PutFR[ " %4g ", IO.int[ yy]];
buttons[ i] ← CalSupport.CreateButton[ title: yr, myParent: table, hi: height/rows-2, wi: width/cols-2, proc: YearSelect, clientData: NEW[ Years ← yy], displayStyle: IF yy = y THEN $BlackOnGrey ELSE $BlackOnWhite];
VTables.SetTableEntry[ table: table, row: i, column: 0, flavor: $Viewer, clientData: buttons[ i]];
VTables.Install[ table, FALSE];
ENDLOOP;
END; -- CreateYearTable
CreateMonthTable: INTERNAL PROCEDURE [ m: Months] = BEGIN
OPEN calForm.row1.monthTable;
table ← VTables.Create[ rows: rows, columns: cols, h: height, w: width, x: xOff, y: yOff, parent: calForm.container];
VTables.SetTableEntry[ table: table, row: 0, column: 0, flavor: $Label, name: " Month", w: table.cw/rows];
VTables.Install[ table, FALSE];
FOR i: Months IN [ January..December] DO
row: INT ← CalSupport.M2I[ i] + 1; -- 1..12
mr: Rope.ROPE ← CalSupport.GetMonthName[ i];
mr ← Rope.Concat[ " ", mr];
buttons[ row] ← CalSupport.CreateButton[ title: mr, myParent: table, hi: height/rows-2, wi: width/cols-2, proc: MonthSelect, clientData: NEW[ INT ← row-1], displayStyle: IF i = m THEN $BlackOnGrey ELSE $BlackOnWhite];
VTables.SetTableEntry[ table: table, row: row, column: 0, flavor: $Viewer, clientData: buttons[ row]];
VTables.Install[ table, FALSE];
ENDLOOP;
END; -- CreateMonthTable
CreateDayTable: INTERNAL PROCEDURE [ date: Date] = BEGIN
OPEN calForm.row1.dayTable;
table ← VTables.Create[ rows: rows, columns: cols, h: height, w: width, x: xOff, y: yOff, parent: calForm.container];
TitleDayTable[ table];
FillDayTable[ table, date];
VTables.Install[ table, FALSE];
END; -- CreateDayTable
TitleDayTable: INTERNAL PROCEDURE [ table: VTables.VTable] = BEGIN
fill row 0 with labels..
OPEN calForm.row1.dayTable;
FOR d: Weekdays IN [ Monday..Sunday] DO
dr: Rope.ROPE; col: INT;
SELECT d FROM
Sunday => { dr ← " Sun"; col ← 0;};
Monday => { dr ← " Mon"; col ← 1;};
Tuesday => { dr ← " Tue"; col ← 2;};
Wednesday => { dr ← " Wed"; col ← 3;};
Thursday => { dr ← " Thu"; col ← 4;};
Friday => { dr ← " Fri"; col ← 5;};
Saturday => { dr ← " Sat"; col ← 6;};
ENDCASE;
VTables.SetTableEntry[ table: table, row: 0, column: col, name: dr, flavor: $Label, useMaxSize: TRUE];
VTables.Install[ table, FALSE];
ENDLOOP;
END; -- TitleDayTable
FillDayTable: PUBLIC INTERNAL PROCEDURE [ table: VTables.VTable, date: Date] = BEGIN
to fill the rest of day table i.e. rows 1..6, is funct. of year, month..
OPEN calForm.row1.dayTable;
row, col: CARDINAL;
firstDay: Weekdays;
nbrOfDays: Days;
[ nbrOfDays, firstDay] ← CalSupport.GetMonthInfo[ date.Month, date.Year];
erase first and last rows in day table
FOR c: INT IN [ 0..cols) DO
VTables.SetTableEntry[ table: table, row: 1, column: c, useMaxSize: TRUE, name: "", flavor: $Label];
VTables.SetTableEntry[ table: table, row: rows-1, column: c, useMaxSize: TRUE, name: "", flavor: $Label];
VTables.SetTableEntry[ table: table, row: rows-2, column: c, useMaxSize: TRUE, name: "", flavor: $Label];
ENDLOOP;
VTables.Install[ table, FALSE];
FOR d: Days IN [1..nbrOfDays] DO
i: INT ← d;
dispStyle: ATOM;
IF d = date.Day THEN dispStyle ← $BlackOnGrey
ELSE dispStyle ← $BlackOnWhite;
[ row, col] ← CalSupport.GetRowCol[ d, firstDay];
buttons[ row] [col] ← CalSupport.CreateButton[ title: IO.PutFR[ " %02g", IO.int[ i]], myParent: table, wi: width/cols-2, hi: height/rows-2, displayStyle: dispStyle, clientData: NEW[ INT ← i], proc: DaySelect];
VTables.SetTableEntry[ table: table, row: row+1, column: col, flavor: $Viewer, clientData: buttons[ row][ col]];
VTables.Install[ table, FALSE];
ENDLOOP;
END; -- FillDayTable
CreateRow2: INTERNAL PROCEDURE [ ev: REF Hickory.EventTuple] = BEGIN
second row: event start and end times specification
OPEN calForm.row2;
table ← VTables.Create[ columns: cols, rows: rows, w: width, h: height, parent: calForm.container, x: xOff, y: yOff];
IF ev = NIL THEN txtViewer ← FillRow234Tables[ 2, " Times", 7, table]
ELSE txtViewer ← FillRow234Tables[ 2, " Times", 7, table, ExtractTimeSpec[ ev.EventTime, ev.Duration]];
END; -- CreateRow2
CreateRow3: INTERNAL PROCEDURE [ ev: REF Hickory.EventTuple] = BEGIN
third row: event reminder text
OPEN calForm.row3;
table ← VTables.Create[ columns: cols, rows: rows, w: width, h: height, parent: calForm.container, x: xOff, y: yOff];
IF ev = NIL THEN txtViewer ← FillRow234Tables[ 3, " Text", 6, table]
ELSE txtViewer ← FillRow234Tables[ 3, " Text", 6, table, ev.Text];
END; -- CreateRow3
CreateRow4: INTERNAL PROCEDURE [ ev: REF Hickory.EventTuple] = BEGIN
fourth row: event place
OPEN calForm.row4;
table ← VTables.Create[ columns: cols, rows: rows, w: width, h: height, parent: calForm.container, x: xOff, y: yOff];
IF ev = NIL THEN txtViewer ← FillRow234Tables[ 4, " Place", 7, table]
ELSE txtViewer ← FillRow234Tables[ 4, " Place", 7, table, ev.Place];
END; -- CreateRow4
FillRow234Tables: INTERNAL PROCEDURE [ index: [2..4], label: Rope.ROPE, nbrOfChar: INT, parentTable: VTables.VTable, txtCont: Rope.ROPE ← NIL] RETURNS [ txtViewer: ViewerClasses.Viewer] = BEGIN
fill the rows 2, 3, 4 with a label and a text viewer, return the latter
VTables.SetTableEntry[ table: parentTable, row: 0, column: 0, name: label, flavor: $Button, w: nbrOfChar*CharWidth, border: [ TRUE, TRUE, FALSE, FALSE], proc: RowButtProc, clientData: NEW[ INT ← index]];
VTables.Install[ parentTable, FALSE];
txtViewer ← CalSupport.CreateTextViewer[ parentTable, parentTable.cw-nbrOfChar*CharWidth, parentTable.ch, txtCont];
VTables.SetTableEntry[ table: parentTable, row: 0, column: 1, name: NIL, flavor: $Viewer, clientData: txtViewer, border: [ TRUE, TRUE, FALSE, TRUE]];
VTables.Install[ parentTable, FALSE];
RETURN[ txtViewer];
END; -- FillRow234Tables
CreateRow5: INTERNAL PROCEDURE [ rep: RepetitionDescriptor] = BEGIN
fifth row: repetition specification
OPEN calForm.row5;
table ← VTables.Create[ columns: cols, rows: rows, x: xOff, y: yOff, w: width, h: height, parent: calForm.container];
VTables.SetTableEntry[ table: table, row: 0, column: 0, name: " Repetition", flavor: $Button, useMaxSize: TRUE, border: [ TRUE, FALSE, FALSE, TRUE], proc: RowButtProc, clientData: NEW[ INT ← 5]];
VTables.Install[ table, FALSE];
menuTable ← CreateRepeatMenu[ myParent: table, menu: menuTable, wi: table.cw - 11*CharWidth, xOff: 11*CharWidth, rt: rep.RepeatType];
txtViewer ← CalSupport.CreateTextViewer[ table, table.cw-11*CharWidth, RowHeight, rep.RepeatTime];
VTables.SetTableEntry[ table: table, row: 0, column: 1, flavor: $Viewer, clientData: menuTable.table, w: menuTable.width, h: menuTable.height];
VTables.Install[ table, FALSE];
VTables.SetTableEntry[ table: table, row: 1, column: 1, flavor: $Viewer, clientData: txtViewer, w: txtViewer.ww, h: txtViewer.wh];
VTables.Install[ table, FALSE];
END; -- CreateRow5
GetBorder: INTERNAL PROCEDURE [ index, cols: INT] RETURNS [ border: VTables.Border] = INLINE BEGIN
noRightBorder: VTables.Border ← [ FALSE, FALSE, TRUE, FALSE];
noLeftBorder: VTables.Border ← [ FALSE, FALSE, FALSE, TRUE];
IF index = 0 THEN RETURN[ noLeftBorder]
ELSE IF index = cols-1 THEN RETURN[ noRightBorder]
ELSE RETURN[ [ FALSE, FALSE, TRUE, TRUE]];
END; -- GetBorder
CreateRepeatMenu: INTERNAL PROCEDURE [ myParent: VTables.VTable, menu: MenuTable, wi, xOff: CARDINAL, rt: Hickory.RepetitionType] RETURNS [ updateMenu: MenuTable] = BEGIN
to create menu table for repetition types
OPEN menu;
dispStyle: ATOM;
width ← wi;
table ← VTables.Create[ columns: cols, rows: rows, parent: myParent, w: width, h: height, y: 0, x: xOff];
FOR r: Hickory.RepetitionType IN [ Hourly..Yearly] DO
rr: Rope.ROPE; col: INT;
SELECT r FROM
Hourly => { rr ← " Hourly"; col ← 0};
Daily => { rr ← " Daily"; col ← 1};
Weekdays => { rr ← " Weekdays"; col ← 2};
Weekly => { rr ← " Weekly"; col ← 3};
Monthly => { rr ← " Monthly"; col ← 4};
Yearly => { rr ← " Yearly"; col ← 5};
ENDCASE;
IF r = rt THEN dispStyle ← $BlackOnGrey ELSE dispStyle ← $BlackOnWhite;
buttons[ col] ← CalSupport.CreateButton[ myParent: table, title: rr, hi: height/rows-2, wi: width/cols-2, proc: SelectRepetition, clientData: NEW[ INT ← col+1], displayStyle: dispStyle];
VTables.SetTableEntry[ table: table, row: 0, column: col, flavor: $Viewer, clientData: buttons[ col], border: GetBorder[ col, cols]];
VTables.Install[ table, FALSE];
ENDLOOP;
RETURN[ menu];
END; -- CreateRepeatMenu
CreateRow6: INTERNAL PROCEDURE [ groups: Hickory.GroupSet] = BEGIN
sixth row: group specification
OPEN calForm.row6;
table ← VTables.Create[ columns: cols, rows: rows, x: xOff, y: yOff, w: width, h: height, parent: calForm.container];
VTables.SetTableEntry[ table: table, row: 0, column: 0, name: " Groups", flavor: $Button, w: 7*CharWidth, useMaxSize: TRUE, border: [ TRUE, FALSE, FALSE, TRUE], proc: RowButtProc, clientData: NEW[ INT ← 6]];
VTables.Install[ table, FALSE];
menuTable ← CreateGroupMenu[ table, menuTable, table.cw-7*CharWidth, 7*CharWidth, groups];
txtViewer ← CalSupport.CreateTextViewer[ table, table.cw-ColWidth, RowHeight];
VTables.SetTableEntry[ table: table, row: 0, column: 1, flavor: $Viewer, clientData: menuTable.table, w: menuTable.width, h: menuTable.height];
VTables.Install[ table, FALSE];
VTables.SetTableEntry[ table: table, row: 1, column: 1, flavor: $Viewer, clientData: txtViewer, w: txtViewer.ww, h: txtViewer.wh];
VTables.Install[ table, FALSE];
END; -- CreateRow6
CreateGroupMenu: INTERNAL PROCEDURE [ myParent: VTables.VTable, menu: MenuTable, wi, xOff: CARDINAL, evGroups: Hickory.GroupSet ← [ NIL, NIL]] RETURNS [ updatedMenu: MenuTable] = BEGIN
to create the group menu in row 6. evGroups: groups in which the inital event participates
OPEN menu;
groups: Hickory.GroupSet ← [ NIL, NIL];
cur: REF RopeSets.RopeSetEl ← NIL;
dispStyle: ATOM;
groups ← GetHickoryGroups[]; -- all the groups of hickory
cur ← groups.Head;
width ← wi;
table ← VTables.Create[ columns: cols, rows: rows, parent: myParent, w: width, h: height, y: 0, x: xOff];
FOR i: INT IN [ 0..cols) DO
IF cur # NIL THEN BEGIN
IF RopeSets.IsValueInSet[ cur.Value, evGroups] THEN dispStyle ← $BlackOnGrey
ELSE dispStyle ← $BlackOnWhite;
buttons[ i] ← CalSupport.CreateButton[ myParent: table, title: cur.Value, hi: height/rows-2, wi: width/cols-2, proc: SelectGroup, clientData: NEW[ INT ← i], displayStyle: dispStyle];
cur ← cur.Next
END
ELSE
buttons[ i] ← CalSupport.CreateButton[ myParent: table, title: " ", hi: height/rows-2, wi: width/cols-2, proc: SelectGroup, clientData: NEW[ INT ← i], displayStyle: $BlackOnWhite];
VTables.SetTableEntry[ table: table, row: 0, column: i, flavor: $Viewer, clientData: buttons[ i], border: GetBorder[ i, cols]];
VTables.Install[ table, FALSE];
ENDLOOP;
RETURN[ menu];
END; -- CreateGroupMenu
GetHickoryGroups: INTERNAL PROCEDURE RETURNS [ groupSet: Hickory.GroupSet] = BEGIN
to get a list of groups from hickory if necessary and register those in row6!
OPEN calForm.row6;
IF RopeSets.IsSetEmpty[ groups] THEN BEGIN
groups ← Hickory.ListGroups[];
groupHead ← groups.Head;
END;
RETURN[ groups];
END; -- GetHickoryGroups
CreateRow7: INTERNAL PROCEDURE [ ev: REF Hickory.EventTuple] = BEGIN
seventh row: repeat until and keep until specs...
OPEN calForm.row7;
txtViewer: ViewerClasses.Viewer;
table ← VTables.Create[ columns: cols, rows: rows, x: xOff, y: yOff, parent: calForm.container];
VTables.SetTableEntry[ table: table, row: 0, column: 0, name: " RepeatUntil", flavor: $Button, border: [ TRUE, TRUE, FALSE, FALSE], proc: RowButtProc, clientData: NEW[ INT ← 71]];
VTables.Install[ table, FALSE];
IF ev = NIL THEN txtViewer ← CalSupport.CreateTextViewer[ table, 2*ColWidth, height]
ELSE IF ev.RepeatUntil # BasicTime.nullGMT THEN
txtViewer ← CalSupport.CreateTextViewer[ table, 2*ColWidth, height, Tempus.MakeRope[ ev.RepeatUntil]]
ELSE txtViewer ← CalSupport.CreateTextViewer[ table, 2*ColWidth, height];
txtViewers[ 1] ← txtViewer;
VTables.SetTableEntry[ table: table, row: 0, column: 1, flavor: $Viewer, clientData: txtViewer, border: [ TRUE, TRUE, FALSE, TRUE]];
VTables.Install[ table, FALSE];
VTables.SetTableEntry[ table: table, row: 0, column: 2, name: " KeepUntil", flavor: $Button, border: [ TRUE, TRUE, FALSE, FALSE], proc: RowButtProc, clientData: NEW[ INT ← 72]];
VTables.Install[ table, FALSE];
IF ev = NIL THEN txtViewer ← CalSupport.CreateTextViewer[ table, 2*ColWidth, height]
ELSE IF ev.KeepUntil # BasicTime.nullGMT THEN
txtViewer ← CalSupport.CreateTextViewer[ table, 2*ColWidth, height, Tempus.MakeRope[ ev.KeepUntil]]
ELSE txtViewer ← CalSupport.CreateTextViewer[ table, 2*ColWidth, height];
txtViewers[ 2] ← txtViewer;
VTables.SetTableEntry[ table: table, row: 0, column: 3, flavor: $Viewer, clientData: txtViewer, border: [ TRUE, TRUE, FALSE, TRUE]];
VTables.Install[ table, FALSE];
END; -- CreateRow7
CreateRow8: INTERNAL PROCEDURE [ prot: Hickory.ProtectionType, rem: BOOLEAN] = BEGIN
eigth row: set of button for Protection, Reminder
OPEN calForm.row8;
table ← VTables.Create[ columns: cols, rows: rows, x: xOff, y: yOff, parent: calForm.container, w: width, h: height];
VTables.SetTableEntry[ table: table, row: 0, column: 0, name: " Protection", flavor: $Button, border: [ TRUE, TRUE, TRUE, FALSE], proc: RowButtProc, clientData: NEW[ INT ← 81]];
VTables.Install[ table, FALSE];
IF prot = Private THEN
VTables.SetTableEntry[ table: table, row: 0, column: 1, name: " Private", flavor: $Label, border: [ TRUE, TRUE, FALSE, TRUE]]
ELSE VTables.SetTableEntry[ table: table, row: 0, column: 1, name: " Public", flavor: $Label, border: [ TRUE, TRUE, FALSE, FALSE]];
VTables.Install[ table, FALSE];
VTables.SetTableEntry[ table: table, row: 0, column: 2, name: " Reminder", flavor: $Button, border: [ TRUE, TRUE, TRUE, FALSE], proc: RowButtProc, clientData: NEW[ INT ← 82]];
VTables.Install[ table, FALSE];
IF rem THEN
VTables.SetTableEntry[ table: table, row: 0, column: 3, name: " Yes", flavor: $Label, border: [ TRUE, TRUE, FALSE, TRUE]]
ELSE VTables.SetTableEntry[ table: table, row: 0, column: 3, name: " No", flavor: $Label, border: [ TRUE, TRUE, FALSE, TRUE]];
VTables.Install[ table, FALSE];
END; -- CreateRow8
Initially
BEGIN OPEN calForm;
BEGIN OPEN row1;
height ← 13*RowHeight; width ← FormWidth;
yOff ← 0; xOff ← 0;
BEGIN OPEN yearTable;
rows ← 7; cols ← 1;
height ← rows*RowHeight; width ← 6*CharWidth;
xOff ← 20;
yOff ← 20;
END; -- yearTable
BEGIN OPEN monthTable;
rows ← 13; cols ← 1;
height ← rows*RowHeight; width ← 9*CharWidth;
xOff ← 20 + 6*CharWidth + 20; yOff ← 2;
END; -- monthTable
BEGIN OPEN dayTable;
rows ← 7; cols ← 7;
height ← rows*RowHeight; width ← 35*CharWidth;
xOff ← 20 + 6*CharWidth + 20 + 9*CharWidth + 20;
yOff ← 20;
END; -- dayTable
END; -- row1
BEGIN OPEN row2;
rows ← 1; cols ← 2;
height ← rows*RowHeight; width ← FormWidth;
xOff ← 0; yOff ← row1.height + row1.yOff;
END; -- row2
BEGIN OPEN row3;
rows ← 1; cols ← 2;
height ← rows*RowHeight; width ← FormWidth;
xOff ← 0; yOff ← row2.height + row2.yOff;
END; -- row3
BEGIN OPEN row4;
rows ← 1; cols ← 2;
height ← rows*RowHeight; width ← FormWidth;
xOff ← 0; yOff ← row3.height + row3.yOff;
END; -- row4
BEGIN OPEN row5;
rows ← 2; cols ← 2;
height ← rows*RowHeight; width ← FormWidth;
xOff ← 0; yOff ← row4.height + row4.yOff;
BEGIN OPEN menuTable;
rows ← 1; cols ← 6;
height ← rows*RowHeight; width ← 0; -- set dynamically
END; -- menuTable
END; -- row5
BEGIN OPEN row6;
groupHead ← NIL; groups.Head ← NIL; groups.Tail ← NIL;
rows ← 2; cols ← 2;
height ← rows*RowHeight; width ← FormWidth;
xOff ← 0; yOff ← row5.height + row5.yOff;
BEGIN OPEN menuTable;
rows ← 1; cols ← 6;
height ← rows*RowHeight; width ← 0; -- set dynamically
END; -- menuTable
END; -- row6
BEGIN OPEN row7;
rows ← 1; cols ← 4;
height ← rows*RowHeight; width ← FormWidth;
xOff ← 0; yOff ← row6.height + row6.yOff;
END; -- row7
BEGIN OPEN row8;
rows ← 1; cols ← 4;
height ← rows*RowHeight; width ← cols*(FormWidth/8);
xOff ← 20 + 6*CharWidth + 20 + 9*CharWidth + 20;
yOff ← row1.dayTable.height + row1.dayTable.yOff + 20;
END; -- row8
END; -- OPEN calForm
END.