File: CKViewerImpl.mesa
Last Edited by Pier on August 11, 1983 6:27 pm
DIRECTORY
Buttons,
Containers,
CKViewerButtons,
CKViewerPanel,
Icons,
ViewerOps, ViewerClasses;
CKViewerImpl: PROGRAM
IMPORTS Containers, Buttons, CKViewerPanel, CKViewerButtons, ViewerOps, Icons
EXPORTS CKViewerButtons = BEGIN
CKViewer: TYPE = CKViewerButtons.CKViewer;
CKViewerData: TYPE = CKViewerButtons.CKViewerData;
entryHeight: CARDINAL = 14; -- height of a line of items
entryVSpace: CARDINAL = 6; -- vertical leading between lines
entryHSpace: CARDINAL = 10; -- horizontal space between items on a line
openHeight: CARDINAL = 200; -- ideal height of viewer when opened
firstTab: CARDINAL = 110; --viewer column first tab
secondTab: CARDINAL = 217;--viewer column second tab
BuildButtons: PUBLIC PROC [ckViewer: CKViewer] = {
quitButton, twentyfourButton, eightButton, fourButton, twoButton, oneButton: Buttons.Button;
aChanButtton, bChanButton, slowButton: Buttons.Button;
freezeButton, scrambleButton, rollButton: Buttons.Button;
randomButton, symmetricButton, diagButton: Buttons.Button;
testButton, cBarsButton, convergeButton: Buttons.Button;
ckViewer.height ← entryVSpace;
quitButton ← Buttons.Create[
info: [name: "QUIT", wx: entryHSpace, wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.Quit,
clientData: ckViewer
];
twentyfourButton ← Buttons.Create[
info: [name: "24 BPP",
wx: quitButton.wx + quitButton.ww + 2*entryHSpace,
wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.Bpp24,
clientData: ckViewer
];
eightButton ← Buttons.Create[
info: [name: "8 BPP",
wx: twentyfourButton.wx + twentyfourButton.ww + entryHSpace,
wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.Bpp8,
clientData: ckViewer
];
fourButton ← Buttons.Create[
info: [name: "4 BPP",
wx: eightButton.wx + eightButton.ww + entryHSpace,
wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.Bpp4,
clientData: ckViewer
];
twoButton ← Buttons.Create[
info: [name: "2 BPP",
wx: fourButton.wx + fourButton.ww + entryHSpace,
wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.Bpp2,
clientData: ckViewer
];
oneButton ← Buttons.Create[
info: [name: "1 BPP",
wx: twoButton.wx + twoButton.ww + entryHSpace,
wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.Bpp1,
clientData: ckViewer
];
ckViewer.height ← ckViewer.height + 2*entryVSpace + entryHeight;
aChanButtton ← Buttons.Create[
info: [name: "A ON/OFF", wx: entryHSpace, wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.AChan,
clientData: ckViewer
];
bChanButton ← Buttons.Create[
info: [name: "B ON/OFF",
wx: firstTab,
wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.BChan,
clientData: ckViewer
];
slowButton ← Buttons.Create[
info: [name: "SLOW",
wx: secondTab,
wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.Slow,
clientData: ckViewer
];
ckViewer.height ← ckViewer.height + entryVSpace + entryHeight;
freezeButton ← Buttons.Create[
info: [name: "FREEZE", wx: entryHSpace, wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.Freeze,
clientData: ckViewer
];
scrambleButton ← Buttons.Create[
info: [name: "SCRAMBLE",
wx: firstTab,
wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.Scramble,
clientData: ckViewer
];
rollButton ← Buttons.Create[
info: [name: "ROLL",
wx: secondTab,
wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.Roll,
clientData: ckViewer
];
ckViewer.height ← ckViewer.height + entryVSpace + entryHeight;
randomButton ← Buttons.Create[
info: [name: "RANDOM",
wx: entryHSpace, wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.CKRandom,
clientData: ckViewer
];
symmetricButton ← Buttons.Create[
info: [name: "SYMMETRIC",
wx: firstTab,
wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.Symmetric,
clientData: ckViewer
];
diagButton ← Buttons.Create[
info: [name: "DIAG",
wx: secondTab,
wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.Diag,
clientData: ckViewer
];
ckViewer.height ← ckViewer.height + entryVSpace + entryHeight;
testButton ← Buttons.Create[
info: [name: "TEST PAT",
wx: entryHSpace, wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.TestPattern,
clientData: ckViewer
];
cBarsButton ← Buttons.Create[
info: [name: "COLORBARS",
wx: firstTab,
wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.CBars,
clientData: ckViewer
];
convergeButton ← Buttons.Create[
info: [name: "CONVERGE",
wx: secondTab,
wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.Converge,
clientData: ckViewer
];
ckViewer.height ← ckViewer.height + entryVSpace + entryHeight;
ckViewer.buttons ← [quitButton, twentyfourButton, eightButton, fourButton, twoButton, oneButton, aChanButtton, bChanButton, slowButton, freezeButton, scrambleButton, rollButton, randomButton, symmetricButton, diagButton, testButton, cBarsButton, convergeButton];
BuildScreenButtons[ckViewer]; --hack to get small enough to compile
};
BuildScreenButtons: PROCEDURE [ckViewer: CKViewer] = {
bigRedButton, bigGreenButton, bigBlueButton: Buttons.Button;
smallRedButton, smallGreenButton, smallBlueButton: Buttons.Button;
bigRedButton ← Buttons.Create[
info: [name: "BIG RED",
wx: entryHSpace, wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.BigRed,
clientData: ckViewer
];
bigGreenButton ← Buttons.Create[
info: [name: "BIG GREEN",
wx: firstTab,
wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.BigGreen,
clientData: ckViewer
];
bigBlueButton ← Buttons.Create[
info: [name: "BIG BLUE",
wx: secondTab,
wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.BigBlue,
clientData: ckViewer
];
ckViewer.height ← ckViewer.height + entryVSpace + entryHeight;
smallRedButton ← Buttons.Create[
info: [name: "SMALL RED",
wx: entryHSpace, wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.SmallRed,
clientData: ckViewer
];
smallGreenButton ← Buttons.Create[
info: [name: "SMALL GREEN",
wx: firstTab,
wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.SmallGreen,
clientData: ckViewer
];
smallBlueButton ← Buttons.Create[
info: [name: "SMALL BLUE",
wx: secondTab,
wy: ckViewer.height, wh: entryHeight,
parent: ckViewer.container, border: TRUE],
proc: CKViewerButtons.SmallBlue,
clientData: ckViewer
];
ckViewer.buttons.bigRedButton ← bigRedButton;
ckViewer.buttons.bigGreenButton ← bigGreenButton;
ckViewer.buttons.bigBlueButton ← bigBlueButton;
ckViewer.buttons.smallRedButton ← smallRedButton;
ckViewer.buttons.smallGreenButton ← smallGreenButton;
ckViewer.buttons.smallBlueButton ← smallBlueButton;
};
CreateCKViewer: PUBLIC PROC RETURNS [ckViewer: CKViewer] = {
ckViewer ← NEW[CKViewerData];
ckViewer.height ← 0;
ckViewer.container ← Containers.Create[[
name: "CKControl",
iconic: TRUE,
icon: Icons.NewIconFromFile[file: "CK.Icons", n: 0],
scrollable: FALSE,
column: left]];
BuildButtons[ckViewer]; --fills in ckviewer.buttons
CKViewerPanel.BuildPanel[ckViewer]; --build and fill in ckviewer.panel
Initialize CKViewer state
RestartCKViewer[ckViewer];--fills in ckviewer.state
ViewerOps.PaintViewer[viewer: ckViewer.panel.script, hint: all];
};
RestartCKViewer: PUBLIC PROC [ckViewer: CKViewer] = {
ckViewer.state ← [quit: FALSE, aToggle: FALSE, bToggle: FALSE, slow: FALSE,
freeze: FALSE, scramble: FALSE, roll: FALSE,
random: TRUE, symmetric: FALSE, diag: FALSE,
testPattern: FALSE, cbars: FALSE, converge: FALSE,
bigRed: FALSE, bigGreen: FALSE, bigBlue: FALSE,
smallRed: FALSE, smallGreen: FALSE, smallBlue: FALSE, testingPanel: FALSE, bpp: 8];
Buttons.SetDisplayStyle[ckViewer.buttons.eightButton, $WhiteOnBlack];
Buttons.SetDisplayStyle[ckViewer.buttons.aChanButtton, $WhiteOnBlack];
Buttons.SetDisplayStyle[ckViewer.buttons.bChanButton, $WhiteOnBlack];
};
END.