X11ViewersSpecialCommandsImpl.mesa
Copyright Ó 1993 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, February 12, 1993 6:07:02 pm PST
Christian Jacobi, October 22, 1993 5:07 pm PDT
Rarely used commands, for debugging X11Viewers.
DIRECTORY
Commander, CommanderOps, ImagerDither, IO, Xl, XlColorAccess, XlDetails, XTk, X11Viewers, X11ViewersInstance;
X11ViewersSpecialCommandsImpl:
CEDAR
MONITOR
IMPORTS Commander, CommanderOps, IO, Xl, XlColorAccess, XlDetails, X11ViewersInstance
SHARES X11Viewers =
BEGIN
SSDataOrFail:
PROC []
RETURNS [X11Viewers.ScreenServerData] = {
ssd: X11Viewers.ScreenServerData ~ X11ViewersInstance.Last[];
IF ssd=NIL THEN CommanderOps.Failed["world has not yet been started"];
RETURN [ssd]
};
BMWidgetOrFail:
PROC []
RETURNS [bm: XTk.Widget] = {
ssd: X11Viewers.ScreenServerData ~ SSDataOrFail[];
IF (bm ¬ ssd.bitmap) = NIL THEN CommanderOps.Failed["world not active"];
};
ColorMapInfoCommand: Commander.CommandProc = {
bmw: XTk.Widget ¬ BMWidgetOrFail[];
cd: XlColorAccess.ColorData ¬ XlColorAccess.Access[bmw.screenDepth.screen, 8, Xl.VisualClass.pseudoColor];
IF cd=NIL OR ~cd.hasColors THEN CommanderOps.Failed["no colors"];
IF cd.hasPrivateColormap
THEN IO.PutRope[cmd.out, "has private color map\n"]
ELSE IO.PutRope[cmd.out, "uses default color map\n"];
IO.PutF[cmd.out, "black: %g, white: %g \n", IO.card[cd.pseudoBlackPixel], IO.card[cd.pseudoWhitePixel]];
IO.PutF1[cmd.out, "XlColorAccess colormap: 0x%x\n", IO.card[Xl.ColorMapId[cd.colormap]]];
IO.PutF1[cmd.out, "widget colormap: 0x%x\n", IO.card[Xl.ColorMapId[bmw.attributes.colorMap]]];
WITH cd.entries
SELECT
FROM
entries: ImagerDither.MapEntries => {
FOR l: ImagerDither.MapEntries ¬ entries, l.rest
WHILE l#
NIL
DO
IO.PutF1[cmd.out, "idx: %4g ", IO.int[l.first.mapIndex]];
IO.PutF[cmd.out, "rgb: %4g %4g %4g \n", IO.int[l.first.red], IO.int[l.first.green], IO.int[l.first.blue]];
ENDLOOP;
};
ENDCASE => CommanderOps.Failed["no colors"];
};
ForceInvertColors: Commander.CommandProc = {
bmw: XTk.Widget ¬ BMWidgetOrFail[];
cd: XlColorAccess.ColorData ¬ XlColorAccess.Access[bmw.screenDepth.screen, 8, Xl.VisualClass.pseudoColor];
i1, i2: Xl.ColorItem;
IF cd=NIL OR ~cd.hasColors THEN CommanderOps.Failed["no colors"];
i1.pixel ¬ 255-cd.pseudoBlackPixel; i1.rgb ¬ [65535, 65535, 65535]; --white
i2.pixel ¬ 255-cd.pseudoWhitePixel; i2.rgb ¬ [0, 0, 0]; --black
Xl.StoreColors[bmw.connection, cd.colormap, LIST[i1, i2], XlDetails.ignoreErrors];
};
ForceBWColors: Commander.CommandProc = {
bmw: XTk.Widget ¬ BMWidgetOrFail[];
cd: XlColorAccess.ColorData ¬ XlColorAccess.Access[bmw.screenDepth.screen, 8, Xl.VisualClass.pseudoColor];
i1, i2: Xl.ColorItem;
IF cd=NIL OR ~cd.hasColors THEN CommanderOps.Failed["no colors"];
i1.pixel ¬ cd.pseudoBlackPixel; i1.rgb ¬ [0, 0, 0]; --black
i2.pixel ¬ cd.pseudoWhitePixel; i2.rgb ¬ [65535, 65535, 65535]; --white
Xl.StoreColors[bmw.connection, cd.colormap, LIST[i1, i2], XlDetails.ignoreErrors];
};
Commander.Register["X11ViewersPrintColorMapInfo", ColorMapInfoCommand, "For debugging X11Viewers"];
Commander.Register["X11ViewersForceInvertColors", ForceInvertColors, "For debugging X11Viewers"];
Commander.Register["X11ViewersForceBWColors", ForceBWColors, "For debugging X11Viewers"];
END.