<<>> <> <> <> <> <> <> <> <> <<>> 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 ~ { <> <> <> <> <> <> <> <= openBottomY>> <= iconRowHeight; -- allow for at least one row of icons>> <> <> <> <> <> <= requestedOpenBottomY + messageWindowHeight, and>> <= iconBottomY + iconRowHeight>> <> <> 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 ~ { <> <> <> <> <> <= 1>> <<>> iconRows ¬ (openTopY-iconBottomY)/iconRowHeight; iconAreaHeight ¬ iconRows*iconRowHeight; iconTopY ¬ iconBottomY+iconAreaHeight; iconColumnWidth ¬ iconWidth+iconSpacing; }; ComputeHorizontalDependencies: PROC ~ { <> <> <> <> <> <= 0; openRightWidth >= 0; openLeftLeftX >= 0;>> <> <> <= iconColumnWidth + iconLeftX>> <> <> <> <> <= iconColumnWidth + iconLeftX>> <= requestedOpenLeftWidth + openLeftLeftX, and>> <> <> <> 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 ~ { <> <> <> <> <> <= 1>> 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.