/ivy/binding/calendar/calForm.mesa
defining the form of a calendar "page" for entries and queries
Last edited by: Binding, August 16, 1984 3:31:05 pm PDT
DIRECTORY
Buttons USING [ Button],
BasicTime USING [ GMT, nullGMT],
Calendar USING [ Date, Years, Months, Days],
CalStorage USING [ Mode],
Containers USING [ Container],
Hickory USING [ RepetitionType, ProtectionType, GroupSet, EventTuple, EventList, Reason],
Menus USING [ MouseButton],
Rope USING [ ROPE],
RopeSets USING [ RopeSetEl, Direction, RopeSet],
ViewerClasses USING [ Viewer],
ViewerSpecs USING [ messageWindowHeight],
VTables USING [ VTable]
;
CalForm: CEDAR DEFINITIONS
= BEGIN
Constants
ColWidth: CARDINAL = 100; -- ViewerSpecs.openLeftWidth/6;
CharWidth: CARDINAL = 9; -- width allocated for one char
RowHeight: CARDINAL = ViewerSpecs.messageWindowHeight+2;
FormWidth: CARDINAL = 600; -- ViewerSpecs.openLeftWidth;
FormHeight: CARDINAL = 25*RowHeight;
Delta: CARDINAL = 10000; -- to move container around
Error used for parsing
SyntaxError: ERROR;
Types
YearTable: TYPE = RECORD [
table: VTables.VTable,
rows, cols, height, width, xOff, yOff: CARDINAL,
buttons: ARRAY [ 1..6] OF Buttons.Button
];
MonthTable: TYPE = RECORD [
table: VTables.VTable,
rows, cols, height, width, xOff, yOff: CARDINAL,
buttons: ARRAY [ 1..12] OF Buttons.Button
];
DayTable: TYPE = RECORD [
table: VTables.VTable,
rows, cols, height, width, xOff, yOff: CARDINAL,
buttons: ARRAY [ 0..6) OF ARRAY [ 0..7) OF Buttons.Button
];
Row1: TYPE = RECORD [
height, width, xOff, yOff: CARDINAL,
yearTable: YearTable,
monthTable: MonthTable,
dayTable: DayTable
];
MenuTable: TYPE = RECORD [
rows, cols, width, height: CARDINAL,
table: VTables.VTable,
buttons: ARRAY [ 0..6) OF Buttons.Button
];
Row234: TYPE = RECORD [
table: VTables.VTable,
rows, cols, height, width, xOff, yOff: CARDINAL,
txtViewer: ViewerClasses.Viewer -- row: 0, col: 1
];
Row5: TYPE = RECORD [
table: VTables.VTable,
rows, cols, height, width, xOff, yOff: CARDINAL,
menuTable: MenuTable,
txtViewer: ViewerClasses.Viewer
];
Row6: TYPE = RECORD [
table: VTables.VTable,
rows, cols, height, width, xOff, yOff: CARDINAL,
menuTable: MenuTable,
txtViewer: ViewerClasses.Viewer,
groups: Hickory.GroupSet, -- all the groups currently known to Hickory
groupHead: REF RopeSets.RopeSetEl ← NIL -- pointing to first el. of "groups" that is visible
];
Row7: TYPE = RECORD [
table: VTables.VTable,
rows, cols, height, width, xOff, yOff: CARDINAL,
txtViewers: ARRAY [ 1..2] OF ViewerClasses.Viewer -- TextViewers in col 1, 3
];
Row8: TYPE = RECORD [
table: VTables.VTable,
rows, cols, height, width, xOff, yOff: CARDINAL
];
CalForm: TYPE = RECORD [
container: Containers.Container ← NIL,
width: CARDINAL ← FormWidth,
height: CARDINAL ← FormHeight,
row1: Row1,
row2, row3, row4: Row234,
row5: Row5,
row6: Row6,
row7: Row7,
row8: Row8
];
CurSelection: TYPE = RECORD [
date: Calendar.Date,
groups: Hickory.GroupSet,
repetition: RepetitionDescriptor,
protection: Hickory.ProtectionType ← Private,
reminder: BOOLEAN ← TRUE
];
RepetitionDescriptor: TYPE = RECORD [
RepeatType: Hickory.RepetitionType,
RepeatTime: Rope.ROPE,
RepeatUntil: BasicTime.GMT
];
EventDescriptor: TYPE = RECORD [
EventTime: BasicTime.GMT ← BasicTime.nullGMT,
Duration: LONG CARDINAL ← 0
];
Global variables
calForm: PRIVATE CalForm;
curSelection: PRIVATE CurSelection;
editedEv: PRIVATE REF Hickory.EventTuple;
ExtractTimeSpec: PRIVATE PROCEDURE [ time: BasicTime.GMT, duration: CARDINAL] RETURNS [ rope: Rope.ROPE];
gets hour:minutes from time
CreateCalForm: PRIVATE --INTERNAL-- PROCEDURE [ mode: CalStorage.Mode, ev: REF Hickory.EventTuple ← NIL];
to bring up the calendar form on the screen. If ev non NIL, then the form is initialized
appropriately.
CreateCalFormCont: PRIVATE --INTERNAL-- PROCEDURE [ myParent: ViewerClasses.Viewer, ev: REF Hickory.EventTuple];
to build the form container from scratch.
DestroyViewer: PRIVATE --INTERNAL-- PROCEDURE ;
to destroy the calForm container.
FillDayTable: PRIVATE --INTERNAL-- PROCEDURE [ table: VTables.VTable, date: Calendar.Date];
-- to redraw the day table of the calendar form when year, month selection change
ScrollGroupMenu: PRIVATE --ENTRY-- PROCEDURE [ dir: RopeSets.Direction];
-- to scroll the group menu within form left/right
YearSelection: PRIVATE --ENTRY-- PROCEDURE [ y: Calendar.Years, mouseBut: Menus.MouseButton];
-- to change the selected year
MonthSelection: PRIVATE --ENTRY-- PROCEDURE [ m: Calendar.Months, mouseBut: Menus.MouseButton];
-- to change selected month
DaySelection: PRIVATE --ENTRY-- PROCEDURE [ d: Calendar.Days, mouseBut: Menus.MouseButton];
-- to change selected day
ChangeRepetitionSelection: PRIVATE --ENTRY-- PROCEDURE [ repType: Hickory.RepetitionType];
-- to change the selected repetion type
ChangeGroupSelection: PRIVATE --ENTRY-- PROCEDURE [ groupIndex: INT];
-- to change the selected group
TranslateSelection: PRIVATE --INTERNAL-- PROCEDURE [ editedEv: REF Hickory.EventTuple ← NIL] RETURNS [ evList: Hickory.EventList, groups: Hickory.GroupSet];
-- to look at the form as it is on screen and all the current selections and build up the
-- a suitable list of events. 'Groups' reflects all the groups into which the event should
-- be inserted. If the selection can not be translated, ERROR SyntaxError is raised.
-- If editedEv non NIL, we use its Key field to signal hickory that only some attributes
-- of an existing event were edited.
HickoryChange: PRIVATE --INTERNAL-- PROCEDURE [ reason: Hickory.Reason, ev: Hickory.EventTuple, data: RopeSets.RopeSet];
having updated calStorage, we now update the viewers of the form...
evl is the list of all events that have somehow changed.
END.