cube/derived/CubeBundle.m3


MODULE CubeBundle;
Generated by m3bundle; see its manpage.

IMPORT Bundle, BundleRep, Text;
IMPORT Thread, Wr, TextWr;

TYPE T = Bundle.T OBJECT OVERRIDES
           get      := LookUp;
           getNames := GetNames;
         END;

TYPE Texts = REF ARRAY OF TEXT;

VAR
  bundle: T     := NIL;
  names : Texts := NIL;

PROCEDURE Get(): Bundle.T =
  BEGIN
    IF (bundle = NIL) THEN bundle := NEW (T) END;
    RETURN bundle;
  END Get;

PROCEDURE GetNames (<*UNUSED*> self: T): Texts =
  BEGIN
    IF names = NIL THEN
      names := NEW (Texts, NUMBER (Names));
      names^ := Names;
    END;
    RETURN names;
  END GetNames;

PROCEDURE LookUp (<*UNUSED*> self: T;  element: TEXT): TEXT =
  BEGIN
    FOR i := 0 TO LAST (Names)-1 DO
      IF Text.Equal (Names[i], element) THEN
        IF Elements[i] = NIL THEN Elements[i] := GetElt (i) END;
        RETURN Elements[i];
      END;
    END;
    RETURN NIL;
  END LookUp;

CONST Names = ARRAY [0..1] OF TEXT {
  "cube.fv",
  NIL
};

VAR Elements := ARRAY [0..1] OF TEXT {
  NIL (* E0 .. E0_0 *),
  NIL
};

PROCEDURE GetElt (n: INTEGER): TEXT =
  <*FATAL Thread.Alerted, Wr.Failure *>
  VAR wr := TextWr.New ();
  BEGIN
    CASE n OF
    | 0 =>
        Wr.PutText (wr, E0);
        Wr.PutText (wr, E0_0);
    ELSE (*skip*)
    END;
    RETURN TextWr.ToText (wr);
  END GetElt;

CONST E0 =
   "(Rim\n  #| (Font \"*-Courier-Bold-R-*-120-*-ISO8859-1\") |#\n  #| (Labe"
 & "lFont \"*-Helvetica-Bold-R-*-120-*-ISO8859-1\") |#\n  (Pen 10)\n  (VBox"
 & "\n    (Rim\n      (Pen 10)\n      (Border\n        (BgColor \"White\")\n"
 & "        (Shape (Width 100 + Infinity) (Height 275 + Infinity) (Generic "
 & "%cube))))\n    (Shape\n      (Height + 0)\n      (VBox\n        (HBox\n"
 & "          (VBox\n            (HBox (TrillButton %spin (Shape (Width 45)"
 & " (Height 25) \"Spin\")))\n            Fill)\n          (Glue 8)\n      "
 & "    (HBox\n            (Shape (Width 50) (Text LeftAlign \"Rotate:\"))\n"
 & "            (VBox Fill (Numeric %rotate =4) Fill))\n          (Glue 8)\n"
 & "          (VBox\n            (Shape\n              (Width + 0)\n       "
 & "       (HBox\n                (Text LeftAlign \"Style:\")\n            "
 & "    (Radio\n                  (VBox\n                    (Choice %wiref"
 & "rame =TRUE \"Wireframe\")\n                    (Choice %solid \"Solid\""
 & "))))))\n          Fill)\n        (Glue 20)\n        (VBox\n          (T"
 & "ext LeftAlign \"Viewing position:\")\n          (HBox\n            (Glu"
 & "e 20)\n            (VBox\n              (HBox\n                (Shape ("
 & "Width 50) (Text RightAlign \"Mu:  \"))\n                (Numeric %mu (M"
 & "in -1000) (Max 1000) =10)\n                Fill)\n              (HBox\n"
 & "                (Shape (Width 50) (Text RightAlign \"Theta:  \"))\n    "
 & "            (Numeric %theta (Min -1000) (Max 1000) =-30)\n             "
 & "   Fill)\n              (HBox\n                (Shape (Width 50) (Text "
 & "RightAlign \"Phi:  \"))\n                (Numeric %phi (Min -1000) (Max"
 & " 1000) =30)\n                Fill)))\n          (Glue 8)\n          (HB"
 & "ox (Boolean %buffer =TRUE \"Double Buffer\") Fill)\n          (Glue 8))"
 & "\n        (Glue 20)\n        (VBox\n          (Text LeftAlign \"Project"
 & "ion:\")\n          (HBox\n            (Glue 20)\n            (Radio\n  "
 & "            (VBox\n                (HBox\n                  (Text LeftA"
 & "lign \"ScreenR:\")\n                  (Border (Shape (Width + Inf) (Typ"
 & "eIn %screen =\"4.0\"))))\n                (HBox\n                  (Cho"
 & "ice %ortho =TRUE (Text LeftAlign \"";

CONST E0_0 =
   "Orthographic\"))\n                  Fill)\n                (HBox (Choic"
 & "e %persp (Text LeftAlign \"Perspective\")) Fill)\n                (HBox"
 & "\n                  (Shape (Width 40) (Text RightAlign \"d:\"))\n      "
 & "            (Border (Shape (Width + Inf) (TypeIn %d =\"5.0\")))))))))))"
 & ")\n";

BEGIN
END CubeBundle.