File: CKViewerButtonsImpl.mesa
Last Edited by:
Pier, August 9, 1983 10:56 am
Wyatt, September 13, 1983 12:17 pm
DIRECTORY
Buttons,
Commander USING [CommandProc, Register],
Process,
CKViewerButtons;
CKViewerButtonsImpl: PROGRAM IMPORTS CKViewerButtons, Buttons, Process, Commander
EXPORTS CKViewerButtons = BEGIN
CKViewer: TYPE = CKViewerButtons.CKViewer;
CKViewerData: TYPE = CKViewerButtons.CKViewerData;
Quit: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.quit ← TRUE;
};
Bpp24: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.bpp ← 24;
ResetBPPButtons[ckv];
Buttons.SetDisplayStyle[ckv.buttons.twentyfourButton, $WhiteOnBlack];
};
Bpp8: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.bpp ← 8;
ResetBPPButtons[ckv];
Buttons.SetDisplayStyle[ckv.buttons.eightButton, $WhiteOnBlack];
};
Bpp4: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.bpp ← 4;
ResetBPPButtons[ckv];
Buttons.SetDisplayStyle[ckv.buttons.fourButton, $WhiteOnBlack];
};
Bpp2: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.bpp ← 2;
ResetBPPButtons[ckv];
Buttons.SetDisplayStyle[ckv.buttons.twoButton, $WhiteOnBlack];
};
Bpp1: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.bpp ← 1;
ResetBPPButtons[ckv];
Buttons.SetDisplayStyle[ckv.buttons.oneButton, $WhiteOnBlack];
};
AChan: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.aToggle ← TRUE;
};
BChan: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.bToggle ← TRUE;
};
Slow: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.slow ← NOT ckv.state.slow;
Buttons.SetDisplayStyle[ckv.buttons.slowButton, IF ckv.state.slow THEN $WhiteOnBlack ELSE $BlackOnWhite];
};
Freeze: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.freeze ← NOT ckv.state.freeze;
Buttons.SetDisplayStyle[ckv.buttons.freezeButton, IF ckv.state.freeze THEN $WhiteOnBlack ELSE $BlackOnWhite];
IF NOT ckv.state.freeze THEN { --NOT freeze RESETS Scramble and Roll
Buttons.SetDisplayStyle[ckv.buttons.scrambleButton, $BlackOnWhite];
Buttons.SetDisplayStyle[ckv.buttons.rollButton, $BlackOnWhite];
};
};
Scramble: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.freeze ← TRUE;
ckv.state.scramble ← TRUE;
Buttons.SetDisplayStyle[ckv.buttons.freezeButton, $WhiteOnBlack];
Buttons.SetDisplayStyle[ckv.buttons.scrambleButton, $WhiteOnBlack];
};
Roll: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.freeze ← TRUE;
ckv.state.roll ← TRUE;
Buttons.SetDisplayStyle[ckv.buttons.freezeButton, $WhiteOnBlack];
Buttons.SetDisplayStyle[ckv.buttons.rollButton, $WhiteOnBlack];
};
CKRandom: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.random ← TRUE;
SetStaticButtons[ckv, ckv.buttons.randomButton];
};
Symmetric: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.symmetric ← TRUE;
SetStaticButtons[ckv, ckv.buttons.symmetricButton];
};
Diag: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.diag ← TRUE;
SetStaticButtons[ckv, ckv.buttons.diagButton];
};
TestPattern: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.testPattern ← TRUE;
SetStaticButtons[ckv, ckv.buttons.testButton];
};
CBars: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.cbars ← TRUE;
SetStaticButtons[ckv, ckv.buttons.cBarsButton];
};
Converge: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.converge ← TRUE;
SetStaticButtons[ckv, ckv.buttons.convergeButton];
};
BigRed: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.bigRed ← TRUE;
SetStaticButtons[ckv, ckv.buttons.bigRedButton];
};
BigGreen: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.bigGreen ← TRUE;
SetStaticButtons[ckv, ckv.buttons.bigGreenButton];
};
BigBlue: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.bigBlue ← TRUE;
SetStaticButtons[ckv, ckv.buttons.bigBlueButton];
};
SmallRed: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.smallRed ← TRUE;
SetStaticButtons[ckv, ckv.buttons.smallRedButton];
};
SmallGreen: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.smallGreen ← TRUE;
SetStaticButtons[ckv, ckv.buttons.smallGreenButton];
};
SmallBlue: PUBLIC Buttons.ButtonProc = TRUSTED {
ckv: CKViewer ← NARROW[clientData];
ckv.state.smallBlue ← TRUE;
SetStaticButtons[ckv, ckv.buttons.smallBlueButton];
};
ResetBPPButtons: PROC [ckv: CKViewer] = TRUSTED {
Buttons.SetDisplayStyle[button: ckv.buttons.twentyfourButton, style: $BlackOnWhite];
Buttons.SetDisplayStyle[button: ckv.buttons.eightButton, style: $BlackOnWhite];
Buttons.SetDisplayStyle[button: ckv.buttons.fourButton, style: $BlackOnWhite];
Buttons.SetDisplayStyle[button: ckv.buttons.twoButton, style: $BlackOnWhite];
Buttons.SetDisplayStyle[button: ckv.buttons.oneButton, style: $BlackOnWhite];
};
SetStaticButtons: PUBLIC PROC [ckv: CKViewer, button: Buttons.Button] = TRUSTED {
Buttons.SetDisplayStyle[button: ckv.buttons.randomButton, style: $BlackOnWhite];
Buttons.SetDisplayStyle[button: ckv.buttons.symmetricButton, style: $BlackOnWhite];
Buttons.SetDisplayStyle[button: ckv.buttons.diagButton, style: $BlackOnWhite];
Buttons.SetDisplayStyle[button: ckv.buttons.testButton, style: $BlackOnWhite];
Buttons.SetDisplayStyle[button: ckv.buttons.cBarsButton, style: $BlackOnWhite];
Buttons.SetDisplayStyle[button: ckv.buttons.convergeButton, style: $BlackOnWhite];
Buttons.SetDisplayStyle[button: ckv.buttons.bigRedButton, style: $BlackOnWhite];
Buttons.SetDisplayStyle[button: ckv.buttons.bigGreenButton, style: $BlackOnWhite];
Buttons.SetDisplayStyle[button: ckv.buttons.bigBlueButton, style: $BlackOnWhite];
Buttons.SetDisplayStyle[button: ckv.buttons.smallRedButton, style: $BlackOnWhite];
Buttons.SetDisplayStyle[button: ckv.buttons.smallGreenButton, style: $BlackOnWhite];
Buttons.SetDisplayStyle[button: ckv.buttons.smallBlueButton, style: $BlackOnWhite];
Buttons.SetDisplayStyle[button: button, style: $WhiteOnBlack];
};
ForkInit: Commander.CommandProc = TRUSTED {
ckViewer: CKViewer;
ckViewer ← CKViewerButtons.CreateCKViewer[];
Process.Detach[FORK CKViewerButtons.Go[ckViewer]];
};
Commander.Register[key: "CKViewer", proc: ForkInit, doc: "ColorKinetic with viewer control panel"];
END.