-- LoomDefs.mesa  edited by Sweet  June 13, 1979  9:58 AM

DIRECTORY
  DisplayDefs: FROM "displaydefs" USING [GrayArray],
  ParameterDefs: FROM "ParameterDefs" USING [ParameterItemDescriptor, ParameterItemHandle],
  StreamDefs: FROM "streamdefs" USING [StreamHandle],
  WindowDefs: FROM "WindowDefs" USING [RefreshSequencer, SubwindowHandle, WindowBox, WindowHandle];

LoomDefs: DEFINITIONS =
  BEGIN OPEN ParameterDefs, WindowDefs;

  -- types and constants
  Pedal: TYPE = [0..8);
  Harness: TYPE = [0..8);

  ColorName: TYPE = CHARACTER ['A..'Q];
  ColorChunk: TYPE = RECORD [color: ColorName, count: CARDINAL];
  ColorDesc: TYPE = RECORD [repeat: CARDINAL, d: DESCRIPTOR FOR ARRAY OF ColorChunk];
  OverlapRec: TYPE = RECORD [next: POINTER TO OverlapRec, under, show: ColorName];

  PaintAction: TYPE = {pause, run, stop};

  -- shared variables from LoomDisplay

  GrayData: ARRAY ColorName OF DisplayDefs.GrayArray;
  woBase, poBase: POINTER;
  woString, poString: STRING;
  warpSizeString, weftSizeString: STRING;
  warpSize, weftSize: CARDINAL;
  warpColorString, weftColorString: STRING;
  overlapString: STRING;
  weaveWindow: WindowHandle;
  tieup: ARRAY Pedal OF STRING;

  -- shared variables from LoomControl

  titleString, input, output: STRING;
  nParams, poParmNum: CARDINAL;
  parameterSW, msgSW: SubwindowHandle;
  controlWindow: WindowHandle;
  autoRepaint: BOOLEAN;

  -- shared variables from LoomSetup

  parameterItems: DESCRIPTOR FOR ARRAY OF ParameterItemHandle;

  -- procedures from LoomDisplay

  LoomDisplay: PROGRAM;
  RepaintAllWeave: PUBLIC PROCEDURE;
  RepaintPart: PROCEDURE [x1, x2, y1, y2: CARDINAL];
  ReadFile: PROCEDURE [in: StreamDefs.StreamHandle];
  WriteFile: PROCEDURE [out: StreamDefs.StreamHandle];
  PausePainting: PROCEDURE [
    sw: SubwindowHandle, items: ParameterItemDescriptor ← NULL,
    index: CARDINAL ← NULL];
  ResumePainting: PROCEDURE [
    sw: SubwindowHandle, items: ParameterItemDescriptor ← NULL,
    index: CARDINAL ← NULL];
  CancelPainting: PROCEDURE [
    sw: SubwindowHandle, items: ParameterItemDescriptor ← NULL,
    index: CARDINAL ← NULL];

  -- procedures from LoomControl

  LoomControl: PROGRAM;
  PostLine: PROCEDURE [s: STRING];
  Repaint: PUBLIC PROCEDURE [
    sw: SubwindowHandle, items: ParameterItemDescriptor ← NULL,
    index: CARDINAL ← NULL];
  DisplayWeaveWindowContents: PROCEDURE [
    window: WindowHandle,
    wBox: WindowBox,
    refreshSequencer: RefreshSequencer]
    RETURNS [WindowBox];
  Load: PROCEDURE [
    sw: SubwindowHandle, items: ParameterItemDescriptor ← NULL,
    index: CARDINAL ← NULL];
  Dump: PROCEDURE [
    sw: SubwindowHandle, items: ParameterItemDescriptor ← NULL,
    index: CARDINAL ← NULL];
  Press: PROCEDURE [
    sw: SubwindowHandle, items: ParameterItemDescriptor ← NULL,
    index: CARDINAL ← NULL];
  StdPedal: PROCEDURE [
    sw: SubwindowHandle, items: ParameterItemDescriptor ← NULL,
    index: CARDINAL ← NULL];
  UpDown: PROCEDURE [
    sw: SubwindowHandle, items: ParameterItemDescriptor ← NULL,
    index: CARDINAL ← NULL];
  MakeToolInactive: PUBLIC PROCEDURE;
    
  -- procedures from LoomSetup

  LoomSetup: PROGRAM;
  DestroyThisTool: PROCEDURE;
  MakeMyMenu: PROCEDURE;
  FreeMyMenu: PROCEDURE;
  PaintCommands: PROCEDURE [action: PaintAction];
  MakeMeAParameterSubwindow: PROCEDURE;

  END.