DIRECTORY ViewerPrivate USING [Screen], ViewerSpecs USING [iconHeight, iconWidth]; ViewerSpecsImpl: CEDAR PROGRAM EXPORTS ViewerPrivate, ViewerSpecs ~ BEGIN OPEN ViewerSpecs; Screen: TYPE ~ ViewerPrivate.Screen; nColumns: PUBLIC NAT ¬ 4; -- Several scattered data structures depend on this, so don't change it dynamically. bwScreenWidth: PUBLIC NAT ¬ 0; requestedBWScreenWidth: NAT ¬ 0; bwScreenHeight: PUBLIC NAT ¬ 0; requestedBWScreenHeight: NAT ¬ 0; colorScreenWidth: PUBLIC NAT ¬ 0; colorScreenHeight: PUBLIC NAT ¬ 0; windowBorderSize: PUBLIC NAT ¬ 0; captionHeight: PUBLIC NAT ¬ 0; menuHeight: PUBLIC NAT ¬ 0; requestedMenuHeight: NAT ¬ 0; menuBarHeight: PUBLIC NAT ¬ 0; scrollBarW: PUBLIC NAT ¬ 0; messageWindowHeight: PUBLIC NAT ¬ 0; openLeftLeftX: PUBLIC NAT ¬ 0; openLeftWidth: PUBLIC NAT ¬ 0; requestedOpenLeftWidth: NAT ¬ 0; openRightLeftX: PUBLIC NAT ¬ 0; openRightWidth: PUBLIC NAT ¬ 0; openTopY: PUBLIC NAT ¬ 0; openBottomY: PUBLIC NAT ¬ 0; requestedOpenBottomY: NAT ¬ 0; iconLeftX: PUBLIC NAT ¬ 0; iconAreaWidth: NAT ¬ 0; iconRightX: PUBLIC NAT ¬ 0; iconBottomY: PUBLIC NAT ¬ 0; iconAreaHeight: NAT ¬ 0; iconTopY: PUBLIC NAT ¬ 0; iconSpacing: PUBLIC NAT ¬ 0; iconRowHeight: PUBLIC NAT ¬ 0; iconRows: PUBLIC NAT ¬ 0; iconColumnWidth: PUBLIC NAT ¬ 0; iconColumns: PUBLIC NAT ¬ 0; SetDefaults: PROC ~ { requestedBWScreenWidth ¬ bwScreenWidth ¬ 1024; requestedBWScreenHeight ¬ bwScreenHeight ¬ 808; windowBorderSize ¬ 1; requestedMenuHeight ¬ menuHeight ¬ 12; menuBarHeight ¬ 1; scrollBarW ¬ 12; messageWindowHeight ¬ 16; openLeftLeftX ¬ 0; requestedOpenLeftWidth ¬ openLeftWidth ¬ 600; requestedOpenBottomY ¬ openBottomY ¬ iconHeight+4; iconSpacing ¬ 4; -- should be multiple of 4 for grey background alignment iconLeftX ¬ <<4>> 0; -- should be multiple of 4 for grey background alignment iconBottomY ¬ 0; }; ComputeDependencies: PROC ~ { ComputeVerticalDependencies[]; ComputeIconDemands[]; ComputeHorizontalDependencies[]; ComputeIconDependencies[]; }; ComputeVerticalDependencies: PROC ~ { captionHeight ¬ menuHeight; iconRowHeight ¬ iconHeight+iconSpacing; IF requestedBWScreenHeight >= requestedOpenBottomY + messageWindowHeight THEN bwScreenHeight ¬ requestedBWScreenHeight ELSE bwScreenHeight ¬ requestedOpenBottomY + messageWindowHeight; IF bwScreenHeight < iconBottomY + iconRowHeight + messageWindowHeight THEN bwScreenHeight ¬ iconBottomY + iconRowHeight + messageWindowHeight; openBottomY ¬ requestedOpenBottomY; openTopY ¬ bwScreenHeight-messageWindowHeight; }; ComputeIconDemands: PROC ~ { iconRows ¬ (openTopY-iconBottomY)/iconRowHeight; iconAreaHeight ¬ iconRows*iconRowHeight; iconTopY ¬ iconBottomY+iconAreaHeight; iconColumnWidth ¬ iconWidth+iconSpacing; }; ComputeHorizontalDependencies: PROC ~ { IF requestedBWScreenWidth >= iconColumnWidth + iconLeftX THEN bwScreenWidth ¬ requestedBWScreenWidth ELSE bwScreenWidth ¬ iconColumnWidth + iconLeftX; IF bwScreenWidth >= requestedOpenLeftWidth + openLeftLeftX THEN openLeftWidth ¬ requestedOpenLeftWidth ELSE { IF bwScreenWidth < openLeftLeftX THEN bwScreenWidth ¬ openLeftLeftX; openLeftWidth ¬ (bwScreenWidth-openLeftLeftX)/2; }; openRightLeftX ¬ openLeftLeftX+openLeftWidth; openRightWidth ¬ bwScreenWidth-openRightLeftX; }; ComputeIconDependencies: PROC ~ { iconColumns ¬ (bwScreenWidth-iconLeftX+iconSpacing)/iconColumnWidth; iconAreaWidth ¬ iconColumns*iconColumnWidth-iconSpacing; iconRightX ¬ iconLeftX+iconAreaWidth; }; SetOpenLeftWidth: PUBLIC PROC [leftColumnWidth: NAT, screen: Screen ¬ main] ~ { requestedOpenLeftWidth ¬ openLeftWidth ¬ MIN[leftColumnWidth, bwScreenWidth]; ComputeDependencies[]; }; SetOpenBottomY: PUBLIC PROC [bottomY: NAT, screen: Screen ¬ main] ~ { requestedOpenBottomY ¬ openBottomY ¬ MIN[bottomY, openTopY]; ComputeDependencies[]; }; SetMenuHeight: PUBLIC PROC [height: NAT, screen: Screen ¬ main] ~ { requestedMenuHeight ¬ menuHeight ¬ MIN[height, 200]; ComputeDependencies[]; }; SetScrollBarWidth: PUBLIC PROC [width: NAT, screen: Screen ¬ main] ~ { scrollBarW ¬ MIN[width, 200]; }; SetWindowBorderSize: PUBLIC PROC [border: NAT, screen: Screen ¬ main] ~ { windowBorderSize ¬ MIN[border, 200]; }; SetBWScreenSize: PUBLIC PROC [w, h: NAT] ~ { requestedBWScreenWidth ¬ bwScreenWidth ¬ w; requestedBWScreenHeight ¬ bwScreenHeight ¬ h; ComputeDependencies[]; }; SetColorScreenSize: PUBLIC PROC [w, h: NAT] ~ { colorScreenWidth ¬ w; colorScreenHeight ¬ h; ComputeDependencies[]; }; SetScreenSize: PUBLIC PROC [w, h: NAT, screen: Screen ¬ main] ~ { requestedBWScreenWidth ¬ bwScreenWidth ¬ w; requestedBWScreenHeight ¬ bwScreenHeight ¬ h; ComputeDependencies[]; }; SetDefaults[]; ComputeDependencies[]; END. < ViewerSpecsImpl.mesa Copyright Σ 1985, 1986, 1989, 1991 by Xerox Corporation. All rights reserved. Edited by McGregor on June 9, 1982 4:55 pm Last Edited by: Maxwell, December 17, 1982 9:58 am Michael Plass, December 2, 1991 5:14 pm PST Bier, January 29, 1989 2:44:36 pm PST Doug Wyatt, April 15, 1985 0:29:55 am PST Willie-s, October 9, 1991 5:56 pm PDT Inputs: menuHeight, messageWindowHeight, requestedBWScreenHeight, requestedOpenBottomY, iconHeight, iconSpacing, iconBottomY Outputs: iconRowHeight, captionHeight, bwScreenHeight, openTopY, openBottomY, iconTopY Invariants: captionHeight = menuHeight; iconRowHeight = iconHeight+iconSpacing; openTopY >= openBottomY openTopY - iconBottomY >= iconRowHeight; -- allow for at least one row of icons bwScreenHeight = openTopY + messageWindowHeight; Preferences: openBottomY = requestedOpenBottomY bwScreenHeight = requestedBWScreenHeight Preferences are satisfiable if: requestedBWScreenHeight >= requestedOpenBottomY + messageWindowHeight, and requestedBWScreenHeight-messageWindowHeight >= iconBottomY + iconRowHeight Otherwise: relax the constraint on bwScreenHeight Inputs: openTopY, iconBottomY, iconRowHeight, iconWidth, iconSpacing Outputs: iconRows, iconAreaHeight, iconTopY, iconColumnWidth Invariants: iconRows >= 1 Inputs: openLeftLeftX, requestedOpenLeftWidth, requestedBWScreenWidth, iconColumnWidth, iconLeftX Outputs: openLeftWidth, bwScreenWidth, openRightLeftX, openRightWidth Invariants: openLeftWidth >= 0; openRightWidth >= 0; openLeftLeftX >= 0; openRightLeftX = openLeftLeftX+openLeftWidth; bwScreenWidth = openLeftLeftX + openLeftWidth+ openRightWidth; bwScreenWidth >= iconColumnWidth + iconLeftX Preferences: bwScreenWidth = requestedBWScreenWidth openLeftWidth = requestedOpenLeftWidth Preferences are satisfiable if: requestedBWScreenWidth >= iconColumnWidth + iconLeftX requestedBWScreenWidth >= requestedOpenLeftWidth + openLeftLeftX, and Otherwise: relax the constraint on requestedBWScreenWidth to satisfy the icon constraint, then, if there is still a problem, relax the constraint on requestedOpenLeftWidth, letting openLeftWidth = (requestedBWScreenWidth-openLeftLeftX)/2; Inputs: iconLeftX, bwScreenWidth, iconColumnWidth, iconSpacing Outputs: iconColumns, iconAreaWidth, iconRightX Invariants: iconColumns >= 1 ComputeDependencies[]; ComputeDependencies[]; ΚΓ•NewlineDelimiter –(cedarcode) style™codešΟc™Kšœ ΟeœC™NKš*™*Kšœ2™2K™+K™%K™)K™%K™—šΟk ˜ KšœŸœ ˜Kšœ Ÿœ˜*—K˜KšΠblœŸœŸ˜KšŸœ˜"KšœŸœŸœ ˜K˜KšœŸœ˜$K˜šœ ŸœŸœT˜nK˜—KšœŸœŸœ˜KšœŸœ˜ KšœŸœŸœ˜KšœŸœ˜!K˜KšœŸœŸœ˜!KšœŸœŸœ˜"K˜KšœŸœŸœ˜!KšœŸœŸœ˜Kšœ ŸœŸœ˜KšœŸœ˜KšœŸœŸœ˜Kšœ ŸœŸœ˜K˜KšœŸœŸœ˜$K˜KšœŸœŸœ˜KšœŸœŸœ˜KšœŸœ˜ K˜KšœŸœŸœ˜KšœŸœŸœ˜K˜Kšœ ŸœŸœ˜Kšœ ŸœŸœ˜KšœŸœ˜K˜Kšœ ŸœŸœ˜KšœŸœ˜Kšœ ŸœŸœ˜Kšœ ŸœŸœ˜KšœŸœ˜Kšœ ŸœŸœ˜K˜Kšœ ŸœŸœ˜KšœŸœŸœ˜Kšœ ŸœŸœ˜KšœŸœŸœ˜ Kšœ ŸœŸœ˜K˜šΟn œŸœ˜Kšœ.˜.Kšœ/˜/Kšœ˜Kšœ&˜&Kšœ˜Kšœ˜Kšœ˜Kšœ˜Kšœ-˜-Kšœ2˜2Kšœ8˜IKšœ8˜MKšœ˜Kšœ˜K˜—š‘œŸœ˜K˜K˜Kšœ ˜ Kšœ˜K˜K˜—š‘œŸœ˜%™KšΟb œ’œ’S™t—™KšœM™M—™ Kšœ’ œ™Kšœ’ œ’ œ™'Kšœ™Kšœ ’ œ9™OKšœ’œ™0—™ Kšœ"™"Kšœ(™(—™KšœJ™JKšœ’œ’ œ™J—™ Kšœ&™&—K˜Kšœ’ œ˜Kšœ’ œ’ œ˜'šŸœGŸ˜MKšœ(˜(—šŸ˜Kšœ<˜<—šŸœC˜EKšŸœE˜I—Kšœ#˜#Kšœ.˜.K˜K˜—š‘œŸœ˜™Kš’œ’ œ’%™<—™Kšœ3™3—™ Kšœ ™ —K™Kšœ ’œ’ œ’ œ˜0Kšœ’ œ˜(Kšœ&˜&Kšœ’ œ’ œ˜(K˜K˜—š‘œŸœ˜'™Kš’%œ’2™Y—™Kšœ<™<—™ Kšœ+’ œ™>Kšœ’ œ™-Kšœ>™>Kšœ,™,—™ Kšœ&™&Kšœ&™&—™Kšœ5™5KšœE™E—™ KšœN™NKšœ”™”K˜—šŸœ7Ÿ˜=Kšœ’˜&KšŸœ-˜1—šŸœ8˜:KšŸœ’˜+šŸœ˜KšŸœŸœ’ œ˜DKšœ’ œ˜0K˜——Kšœ’ œ˜-Kšœ.˜.K˜K˜—š‘œŸœ˜!™Kš’6™6—™Kšœ&™&—™ Kšœ™—Kšœ’ œ’ ’ œ’œ˜DK˜8Kšœ ’ œ˜%K˜K˜—š‘œŸœŸœŸœ˜OKšœ)Ÿœ!˜MKšœ˜K˜K™—š‘œŸœŸœ Ÿœ˜EKšœ%Ÿœ˜