home *** CD-ROM | disk | FTP | other *** search
/ AMIGA-CD 2 / Amiga-CD - Volume 2.iso / ungepackte_daten / 1993 / 5 / 04b / funktionsplotter / fplotter.ampk / Renderer / TXT / FunctionPlotterPart.mod < prev    next >
Encoding:
Text File  |  1995-06-01  |  4.1 KB  |  165 lines

  1. |##########|
  2. |#MAGIC   #|BOPDOMKJ
  3. |#PROJECT #|"FunctionPlotter"
  4. |#PATHS   #|"EGSProject"
  5. |#FLAGS   #|-x---x-xxx----x-----------------
  6. |#USERSW  #|--------------------------------
  7. |#USERMASK#|--------------------------------
  8. |#SWITCHES#|xx---xxxxx-xx---
  9. |##########|
  10. MODULE FunctionPlotterPart;
  11.  
  12. FROM EGSIntui   AS I   IMPORT WindowGrp,MenuGrp,MessageGrp;
  13. FROM EGSGadBox  AS GB  IMPORT GadBoxPtr,GadContext;
  14. FROM EGSGfx     AS G   IMPORT EFontPtr;
  15. FROM Dos               IMPORT Delay;
  16. FROM EGS               IMPORT CLUEntry,BitMapGrp;
  17. FROM Intuition         IMPORT okCancel;
  18.  
  19. IMPORT GBMenuSelect AS GM;
  20. IMPORT GBRadio      AS GR;
  21. IMPORT GBScrollBox  AS GS;
  22. IMPORT GBColorPot   AS GC;
  23.  
  24.  
  25. CONST
  26.   GID_FuncStr     = $10000;
  27.   GID_MinX        = $20000; GID_MaxX        = $20001;
  28.   GID_MinY        = $20002; GID_MaxY        = $20003;
  29.   GID_MinZ        = $20004; GID_MaxZ        = $20005;
  30.   GID_Resolution  = $30000;
  31.   GID_FuncColor   = $40000;
  32.   GID_BackColor   = $40001;
  33.   GID_Light       = $50000;
  34.   GID_StdFuncs    = $60000;
  35.   GID_DrawMode    = $70000;
  36.   GID_OutLines    = $80000;
  37.   GID_Mirror      = $80001; GID_Specular    = $80002;
  38.   GID_Shadows     = $80003;
  39.   GID_Pitch       = $A0000; GID_Bearing     = $A0001;
  40.   GID_Render      = $B0000; GID_Stop        = $B0001;
  41.  
  42. EXCEPTION
  43.   NoGadSolution  : "Could not create gadgets";
  44.  
  45. VAR
  46.   Win         : WindowPtr;
  47.   DrawArea    : GB.ResBox;
  48.   GCon        : GadContext;
  49.   WFont       : EFontPtr;
  50.  
  51.  
  52. PROCEDURE CreateGadgets;
  53.  
  54. VAR
  55.   root : GadBoxPtr;
  56.  
  57.  
  58.   PROCEDURE CreatePictureBox():GadBoxPtr;
  59.   BEGIN
  60.     RETURN GB.CreateGroupBorder(GCon, | erzeugt Umrandung mit Titel
  61.          GB.CreateVertiTableL(GCon,
  62.            GB.CreateHorizBoxL(GCon,
  63.          GB.CreateBackBorder(GCon, | Erzeugt den Rahmen
  64.                        | um die Zeichenfläche
  65.            | Erzeugt die Zeichenfläche
  66.            GB.CreateResponseBox(GCon,DrawArea,200,
  67.                     GB.max,100,GB.max),{}),
  68.          GB.CreateHorizFill(GCon,FALSE,0),
  69.          | Erzeugt vertikale Proportionalgadget mit Pfeilgadgets
  70.          GB.NewPri(GB.CreateSuperVertiProp(GCon,95,5,0,
  71.                            GID_Pitch,
  72.                            {GB.aDecBR,
  73.                             GB.aIncBR}),-1)
  74.            ),
  75.            GB.CreateVertiFill(GCon,FALSE,0),
  76.            GB.NewPri(
  77.          GB.CreateHorizBoxL(GCon,
  78.            GB.CreateSuperHorizProp(GCon,185,5,90,GID_Bearing,
  79.                        {GB.aDecBR,GB.aIncBR}),
  80.            GB.CreateHorizFill(GCon,FALSE,0),
  81.            GB.CreateFillBox(GCon,-1)
  82.          ),-1
  83.            )
  84.          ),{}," Picture "
  85.        );
  86.   END CreatePictureBox;
  87.  
  88.   PROCEDURE CreateAction():GadBoxPtr;
  89.   BEGIN
  90.     RETURN GB.CreateVertiBoxL(GCon,
  91.          GB.CreateTextAction(GCon,"_Render",GID_Render,{}),
  92.          GB.CreateVertiFill(GCon,FALSE,0),
  93.          GB.CreateTextAction(GCon,"_Stop",GID_Stop,{})
  94.        );
  95.   END CreateAction;
  96.  
  97. BEGIN
  98.   GCon:=GB.CreateGadContext(NIL,NIL,-1,-1);
  99.   root:=GB.CreateMasterWindow(GCon,Win,
  100.       GB.CreateVertiBoxL(GCon,
  101.         GB.NewPri(
  102.           GB.CreateHorizBoxL(GCon,
  103.  
  104.         GB.NewPri(CreatePictureBox(),1)
  105.  
  106.           ),1
  107.         ),
  108.         GB.CreateVertiFill(GCon,FALSE,0),
  109.         GB.CreateNameStringGadget(GCon,"f(x,y)",40,200,
  110.                       I.justifyLeft,GID_FuncStr),
  111.         GB.CreateVertiFill(GCon,FALSE,0),
  112.         GB.CreateHorizBoxL(GCon,
  113.           GS.CreateLateScrollBox(GCon,40,200,4,8,FALSE,GID_StdFuncs),
  114.           GB.CreateHorizFill(GCon,FALSE,0),
  115.  
  116.           CreateAction()
  117.  
  118.         )
  119.       )
  120.     );
  121.   ASSERT(GB.ProcessGadBoxes(GCon,root),NoGadSolution);
  122. END CreateGadgets;
  123.  
  124.  
  125. VAR
  126.   Msg    : EIntuiMsgPtr;
  127.   done   : BOOLEAN;
  128.   tmpRas : EBitMapPtr;
  129.  
  130. BEGIN
  131.   CreateGadgets;
  132.   WITH GCon.newWin AS w DO
  133.     UNI(w.flags,WindowFlagSet:{WindowSizeBottom,WindowActive});
  134.     UNI(w.sysGadgets,SysGadgetSet:{windowClose,windowSize,windowFlip});
  135.     UNI(w.idcmpFlags,EIDCMPFlagSet:{iWindowClose,iGadget,iMenu,iWindowSize,
  136.                     iDrop,iSizeVerify});
  137.     w.name:="Functionplotter";
  138.   END;
  139.   Win:=OpenWindow(GCon.newWin^);
  140.   IF Win#NIL THEN
  141.     REPEAT
  142.       FORGET WaitPort(Win.port);
  143.       Msg:= GetMsg(Win.port);
  144.       WHILE Msg # NIL DO
  145.     IF KEY Msg.class
  146.       OF {iWindowClose} THEN
  147.         done:=TRUE
  148.       END;
  149.     END;
  150.     ReplyMsg(Msg);
  151.     Msg:=GetMsg(Win.port);
  152.       END
  153.     UNTIL done;
  154.   END;
  155. CLOSE
  156.   IF Win # NIL THEN
  157.     CloseWindow(Win);
  158.     Win:=NIL;
  159.   END;
  160.   IF GCon # NIL THEN
  161.     GB.DeleteGadContext(GCon);
  162.     GCon:=NIL;
  163.   END;
  164. END FunctionPlotterPart.
  165.