home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD2.bin / bbs / dev / oberon-a-1.4ß.lha / Oberon-A / source / FPE / FPETpl.mod < prev    next >
Text File  |  1994-08-08  |  9KB  |  351 lines

  1. (***************************************************************************
  2.  
  3.      $RCSfile: FPETpl.mod $
  4.   Description: Defines and implements the IntuiSup template for the main
  5.                FPE window.
  6.  
  7.    Created by: fjc (Frank Copeland)
  8.     $Revision: 1.7 $
  9.       $Author: fjc $
  10.         $Date: 1994/08/08 16:14:33 $
  11.  
  12.   Copyright © 1993-1994, Frank Copeland.
  13.   This file is part of FPE.
  14.   See FPE.doc for conditions of use and distribution.
  15.  
  16.   Log entries are at the end of the file.
  17.  
  18. ***************************************************************************)
  19.  
  20. MODULE FPETpl;
  21.  
  22. (*
  23. ** $C= CaseChk       $I= IndexChk  $L= LongAdr   $N- NilChk
  24. ** $P= PortableCode  $R= RangeChk  $S= StackChk  $T= TypeChk
  25. ** $V= OvflChk       $Z= ZeroVars
  26. **
  27. ** Compiler NIL checking is replaced by ASSERTs at the appropriate places.
  28. *)
  29.  
  30. IMPORT
  31.   E := Exec, G := Graphics, I := Intuition, ISup := IntuiSup, Data,
  32.   SYS := SYSTEM;
  33.  
  34. (*------------------------------------*)
  35. (* Project Information *)
  36.  
  37. CONST
  38.  
  39.   LeftEdge * = 0;
  40.   TopEdge *  = 0;
  41.   Width *    = 414;
  42.  
  43. VAR
  44.   Height *   : INTEGER;
  45.  
  46. CONST
  47.   RenderInfoFlags * = {};
  48.   OpenWindowFlags * = {ISup.owCenterScreen};
  49.   WindowFlags * =
  50.     I.wflgSmartRefresh +
  51.     (*I.wflgSimpleRefresh +*)
  52.     { I.wflgDragBar .. I.wflgCloseGadget,
  53.       I.wflgActivate, I.wflgNoCareRefresh };
  54.   GadgetIDCMPFlags * = ISup.giButton + ISup.giCheck + ISup.giListview;
  55.  
  56. (*------------------------------------*)
  57. (* Gadget data *)
  58.  
  59. CONST
  60.  
  61.   NumGadgetDatas * = 17;
  62.  
  63. TYPE
  64.  
  65.   GadgetDataPtr * = POINTER TO GadgetData;
  66.  
  67.   GadgetData * = RECORD
  68.     g0 *  : ISup.ListViewData;
  69.     g1 *  : ARRAY Data.NumFiles OF ISup.CheckData;
  70.     g2 *  : ARRAY Data.NumTools OF ISup.ButtonData;
  71.     dataEnd : LONGINT;
  72.   END; (* GadgetData *)
  73.  
  74. (*------------------------------------*)
  75. (* Text data *)
  76.  
  77. CONST
  78.  
  79.   NumTextDatas * = 4;
  80.  
  81. (*------------------------------------*)
  82. (* Border data *)
  83.  
  84. CONST
  85.  
  86.   NumBorderDatas * = 1;
  87.  
  88. (*------------------------------------*)
  89. (* Template data structure *)
  90.  
  91. TYPE
  92.  
  93.   Template * = RECORD
  94.     GadgetData * : GadgetDataPtr;
  95.     TextData *   : ISup.TextDataListPtr;
  96.     BorderData * : ISup.BorderDataListPtr;
  97.   END; (* Template *)
  98.  
  99. (*------------------------------------*)
  100. PROCEDURE TextHeight () : INTEGER;
  101.  
  102.   VAR scr : I.Screen;
  103.  
  104. BEGIN (* TextHeight *)
  105.   IF I.base.GetScreenData (scr, SIZE (I.Screen), {I.wbenchScreen}, NIL) THEN
  106.     RETURN scr.font.ySize
  107.   ELSE
  108.     RETURN 9
  109.   END
  110. END TextHeight;
  111.  
  112. (*------------------------------------*)
  113. (* Gadget data *)
  114.  
  115. (*------------------------------------*)
  116. PROCEDURE InitGadgetData (gd : GadgetDataPtr);
  117.  
  118.   VAR textHeight : INTEGER;
  119.  
  120. BEGIN (* InitGadgetData *)
  121.   ASSERT (gd # NIL, 137);
  122.   textHeight := TextHeight();
  123.  
  124.   gd.g0.type := ISup.listView;
  125.   gd.g0.flags := {ISup.gdTextAbove, ISup.gdListviewShowSelected};
  126.   gd.g0.leftEdge := 13;
  127.   gd.g0.topEdge := (3 * textHeight) + 19;
  128.   gd.g0.width := 143;
  129.   gd.g0.height := (5 * textHeight) + 4;
  130.   gd.g0.text := SYS.ADR("Modules");
  131.  
  132.   gd.g1[0].type := ISup.check;
  133.   gd.g1[0].flags := {ISup.gdTextRight};
  134.   gd.g1[0].leftEdge := 13;
  135.   gd.g1[0].topEdge := (9 * textHeight) + 32;
  136.   gd.g1[0].width := 27;
  137.   gd.g1[0].height := textHeight + 3;
  138.  
  139.   gd.g1[1].type := ISup.check;
  140.   gd.g1[1].flags := {ISup.gdTextRight};
  141.   gd.g1[1].leftEdge := 88;
  142.   gd.g1[1].topEdge := (9 * textHeight) + 32;
  143.   gd.g1[1].width := 27;
  144.   gd.g1[1].height := textHeight + 3;
  145.  
  146.   gd.g1[2].type := ISup.check;
  147.   gd.g1[2].flags := {ISup.gdTextRight};
  148.   gd.g1[2].leftEdge := 13;
  149.   gd.g1[2].topEdge := (10 * textHeight) + 40;
  150.   gd.g1[2].width := 27;
  151.   gd.g1[2].height := textHeight + 3;
  152.  
  153.   gd.g1[3].type := ISup.check;
  154.   gd.g1[3].flags := {ISup.gdTextRight};
  155.   gd.g1[3].leftEdge := 88;
  156.   gd.g1[3].topEdge := (10 * textHeight) + 40;
  157.   gd.g1[3].width := 27;
  158.   gd.g1[3].height := textHeight + 3;
  159.  
  160.   gd.g2[0].type := ISup.button;
  161.   gd.g2[0].leftEdge := 165;
  162.   gd.g2[0].topEdge := (3 * textHeight) + 19;
  163.   gd.g2[0].width := 113;
  164.   gd.g2[0].height := textHeight + 6;
  165.  
  166.   gd.g2[1].type := ISup.button;
  167.   gd.g2[1].leftEdge := 288;
  168.   gd.g2[1].topEdge := (3 * textHeight) + 19;
  169.   gd.g2[1].width := 113;
  170.   gd.g2[1].height := textHeight + 6;
  171.  
  172.   gd.g2[2].type := ISup.button;
  173.   gd.g2[2].leftEdge := 165;
  174.   gd.g2[2].topEdge := (4 * textHeight) + 26;
  175.   gd.g2[2].width := 113;
  176.   gd.g2[2].height := textHeight + 6;
  177.  
  178.   gd.g2[3].type := ISup.button;
  179.   gd.g2[3].leftEdge := 288;
  180.   gd.g2[3].topEdge := (4 * textHeight) + 26;
  181.   gd.g2[3].width := 113;
  182.   gd.g2[3].height := textHeight + 6;
  183.  
  184.   gd.g2[4].type := ISup.button;
  185.   gd.g2[4].leftEdge := 165;
  186.   gd.g2[4].topEdge := (5 * textHeight) + 33;
  187.   gd.g2[4].width := 113;
  188.   gd.g2[4].height := textHeight + 6;
  189.  
  190.   gd.g2[5].type := ISup.button;
  191.   gd.g2[5].leftEdge := 288;
  192.   gd.g2[5].topEdge := (5 * textHeight) + 33;
  193.   gd.g2[5].width := 113;
  194.   gd.g2[5].height := textHeight + 6;
  195.  
  196.   gd.g2[6].type := ISup.button;
  197.   gd.g2[6].leftEdge := 165;
  198.   gd.g2[6].topEdge := (6 * textHeight) + 40;
  199.   gd.g2[6].width := 113;
  200.   gd.g2[6].height := textHeight + 6;
  201.  
  202.   gd.g2[7].type := ISup.button;
  203.   gd.g2[7].leftEdge := 288;
  204.   gd.g2[7].topEdge := (6 * textHeight) + 40;
  205.   gd.g2[7].width := 113;
  206.   gd.g2[7].height := textHeight + 6;
  207.  
  208.   gd.g2[8].type := ISup.button;
  209.   gd.g2[8].leftEdge := 165;
  210.   gd.g2[8].topEdge := (7 * textHeight) + 47;
  211.   gd.g2[8].width := 113;
  212.   gd.g2[8].height := textHeight + 6;
  213.  
  214.   gd.g2[9].type := ISup.button;
  215.   gd.g2[9].leftEdge := 288;
  216.   gd.g2[9].topEdge := (7 * textHeight) + 47;
  217.   gd.g2[9].width := 113;
  218.   gd.g2[9].height := textHeight + 6;
  219.  
  220.   gd.g2[10].type := ISup.button;
  221.   gd.g2[10].leftEdge := 165;
  222.   gd.g2[10].topEdge := (8 * textHeight) + 54;
  223.   gd.g2[10].width := 113;
  224.   gd.g2[10].height := textHeight + 6;
  225.  
  226.   gd.g2[11].type := ISup.button;
  227.   gd.g2[11].leftEdge := 288;
  228.   gd.g2[11].topEdge := (8 * textHeight) + 54;
  229.   gd.g2[11].width := 113;
  230.   gd.g2[11].height := textHeight + 6;
  231.  
  232.   gd.dataEnd := ISup.dataEnd;
  233. END InitGadgetData;
  234.  
  235. (*------------------------------------*)
  236. (* Text data *)
  237.  
  238. (*------------------------------------*)
  239. PROCEDURE InitTextData (td : ISup.TextDataListPtr);
  240.  
  241.   VAR textHeight : INTEGER;
  242.  
  243. (*$I-*)
  244. BEGIN (* InitTextData *)
  245.   ASSERT (td # NIL, 137);
  246.   textHeight := TextHeight();
  247.  
  248.   td[0].type := ISup.text;
  249.   td[0].leftEdge := 13;
  250.   td[0].topEdge := textHeight + 9;
  251.   td[0].text := SYS.ADR("Project");
  252.  
  253.   td[1].type := ISup.text;
  254.   td[1].flags := {ISup.tdBackFill};
  255.   td[1].leftEdge := 95;
  256.   td[1].topEdge := textHeight + 9;
  257.  
  258.   td[2].type := ISup.text;
  259.   td[2].leftEdge := 255;
  260.   td[2].topEdge := (2 * textHeight) + 15;
  261.   td[2].text := SYS.ADR("Tools");
  262.  
  263.   td[3].type := ISup.text;
  264.   td[3].leftEdge := 59;
  265.   td[3].topEdge := (8 * textHeight) + 28;
  266.   td[3].text := SYS.ADR("Files");
  267.  
  268.   td[4].type := ISup.dataEnd;
  269. END InitTextData;
  270. (*$I=*)
  271.  
  272. (*------------------------------------*)
  273. (* Border data *)
  274.  
  275. (*------------------------------------*)
  276. PROCEDURE InitBorderData (bd : ISup.BorderDataListPtr);
  277.  
  278.   VAR textHeight : INTEGER;
  279.  
  280. (*$I-*)
  281. BEGIN (* InitBorderData *)
  282.   ASSERT (bd # NIL, 137);
  283.   textHeight := TextHeight();
  284.  
  285.   bd[0].type := ISup.box1In;
  286.   bd[0].leftEdge := 90;
  287.   bd[0].topEdge := textHeight + 7;
  288.   bd[0].width := 310;
  289.   bd[0].height := textHeight + 4;
  290.  
  291.   bd[1].type := ISup.dataEnd;
  292. END InitBorderData;
  293. (*$I=*)
  294.  
  295. (*------------------------------------*)
  296. PROCEDURE Init * (VAR template : Template);
  297.  
  298. BEGIN (* Init *)
  299.   Height := (11 * TextHeight()) + 50;
  300.   NEW (template.GadgetData);
  301.   InitGadgetData (template.GadgetData);
  302.   SYS.NEW
  303.     ( template.TextData,
  304.       SIZE (ISup.TextData) * NumTextDatas + 4,
  305.       {E.memClear} );
  306.   InitTextData (template.TextData);
  307.   SYS.NEW
  308.     ( template.BorderData,
  309.       SIZE (ISup.BorderData) * NumBorderDatas + 4,
  310.       {E.memClear} );
  311.   InitBorderData (template.BorderData)
  312. END Init;
  313.  
  314. (*------------------------------------*)
  315. PROCEDURE Cleanup * (VAR template : Template);
  316.  
  317. BEGIN (* Cleanup *)
  318.   SYS.DISPOSE (template.GadgetData);
  319.   SYS.DISPOSE (template.TextData);
  320.   SYS.DISPOSE (template.BorderData);
  321. END Cleanup;
  322.  
  323. END FPETpl.
  324.  
  325. (***************************************************************************
  326.  
  327.   $Log: FPETpl.mod $
  328.   Revision 1.7  1994/08/08  16:14:33  fjc
  329.   Release 1.4
  330.  
  331.   Revision 1.6  1994/06/17  17:26:27  fjc
  332.   - Updated for release
  333.  
  334.   Revision 1.5  1994/06/09  13:38:52  fjc
  335.   - Incor