DIRECTORY CBitmapReader, Commander, CommanderOps, ImagerSample, IO, PFS, Rope, Xl, XlBitmap, XTkWidgets, XTkBitmapScroller; XShowPixmap: CEDAR PROGRAM IMPORTS CBitmapReader, Commander, CommanderOps, ImagerSample, IO, PFS, Rope, XlBitmap, XTkWidgets, XTkBitmapScroller ~ BEGIN XShowPixmapComm: Commander.CommandProc ~ { GetStream: PROC [fileName: Rope.ROPE] RETURNS [s: IO.STREAM ¬ NIL] = { ENABLE PFS.Error => CommanderOps.Failed[error.explanation]; IF Rope.Length[fileName]=0 THEN CommanderOps.Failed["please specify a filename"]; s ¬ PFS.StreamOpen[fileName: PFS.PathFromRope[fileName], accessOptions: read]; }; sz: Xl.Size; bm: XlBitmap.Bitmap; bmw: XTkWidgets.Widget; shell: XTkWidgets.Widget; sm: ImagerSample.RasterSampleMap; fileName: Rope.ROPE ¬ CommanderOps.NextArgument[cmd]; s: IO.STREAM ¬ GetStream[fileName]; IF s=NIL THEN CommanderOps.Failed["file access problem"]; sm ¬ CBitmapReader.FromStream[s ! CBitmapReader.Error => { IO.Close[s ! IO.Error => GOTO oops]; WITH explanation SELECT FROM r: Rope.ROPE => CommanderOps.Failed[r]; ENDCASE => CommanderOps.Failed["bitmap format"]; } ].sm; IO.Close[s]; bm ¬ XlBitmap.CreateFromSM[sm]; sz.width ¬ MIN[ImagerSample.GetSize[sm].f, 400]; sz.height ¬ MIN[ImagerSample.GetSize[sm].s, 400]; bmw ¬ XTkBitmapScroller.CreateBitmapScroller[insideSize: sz]; XTkBitmapScroller.SetBitmap[bmw, bm]; shell ¬ XTkWidgets.CreateShell[child: bmw, windowHeader: fileName]; XTkWidgets.RealizeShell[shell]; EXITS oops => {}; }; Commander.Register["XShowPixmap", XShowPixmapComm, "Display a pixmap"]; END. ¦XShowPixmap.mesa Copyright Σ 1992 by Xerox Corporation. All rights reserved. Christian Jacobi, July 1, 1992 3:36 pm PDT Display an .xbm file in an x window ΚΖ–(cedarcode) style•NewlineDelimiter ˜code™Kšœ Οeœ1™