home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d502 / cells.lha / CELLS / CELLSSource.lzh / cReqNP.c < prev    next >
C/C++ Source or Header  |  1991-04-20  |  2KB  |  80 lines

  1. /*
  2.  *  CELLS       An Implementation of the WireWorld cellular automata
  3.  *              as described in Scientific American, Jan 1990.
  4.  *
  5.  *              Copyright 1990 by Davide P. Cervone.
  6.  *  You may use this code, provided this copyright notice is kept intact.
  7.  *  See the CELLS.HELP file for complete information on distribution conditions.
  8.  */
  9.  
  10. /*
  11.  *  File:  cReqNP.c             Data structures for the New Part Requester.
  12.  */
  13.  
  14.  
  15. #include "Cells.h"
  16. #include "cRequest.h"
  17. #include "cReqNP.h"
  18. #include "cBoxes.h"
  19.  
  20. static short PanelBox[]  = FBOX(NP_PANELW,NP_PANELH);
  21. static short FrameBox[]  = FBOX(NP_FRAMEW,NP_FRAMEH);
  22. static short NameBox[]   = FBOX(NP_BOXW,NP_BOXH);
  23. static short ButtonBox[] = HBOX(NP_BUTTONW,NP_BUTTONH);
  24.  
  25. static struct Border NPBorder[] =
  26. {
  27.       #define NEXTBORDER(n)     &NPBorder[n+2]
  28.       #define BORDERNAME        NPBorder
  29.    OUTBRDR(NPB_PANEL, 0,0, PanelBox),
  30.    INBRDR (NPB_FRAME, NP_FRAMEX,NP_FRAMEY, FrameBox),
  31.       #undef  NEXTBORDER
  32.       #define NEXTBORDER(n)     NULL
  33.    INBRDR (NPB_BOX,   NP_BOXX,NP_BOXY, NameBox),
  34.    OUTBRDR(NPB_BUTTON, 0,0, ButtonBox)
  35. };
  36.  
  37. static struct Image NameImage =
  38.    IMAGE(-1,-1,NP_BOXW-2,NP_BOXH-2,BACKGROUND);
  39.  
  40. static struct IntuiText NPText[] =
  41. {
  42.    ITEXT("Cancel", 5,3),
  43.    ITEXT("OK",    16,3),
  44.    ITEXT("Name for Part:", 9,2),
  45. };
  46.  
  47. char NPNameBuf[MAXPNAME+1];
  48. char UndoBuffer[MAXBUFFER];
  49.  
  50. static struct StringInfo NPNameInfo =
  51.    {&NPNameBuf[0], &UndoBuffer[0], 0,MAXPNAME+1, 0, 0,0,0, 0,0, NULL, 0, NULL};
  52.  
  53. #define BUTTON(n,t)\
  54. {\
  55.    &NPGadget[n+1], NP_BUTTONX+NP_BUTTONW*n,NP_BUTTONY,\
  56.    NP_BUTTONW,NP_BUTTONH, GADGHCOMP, RELVERIFY, BOOLGADGET| REQGADGET,\
  57.    (APTR)&NPBorder[NPB_BUTTON],NULL, &NPText[t], 0, NULL, n, NULL\
  58. }
  59.  
  60. #define NAME(n)\
  61. {\
  62.    NULL, NP_BOXX+2,NP_BOXY+2,NP_BOXW-4,NP_BOXH-4, GADGHCOMP| GADGIMAGE,\
  63.    RELVERIFY, STRGADGET| REQGADGET, (APTR)&NameImage, NULL, NULL, 0,\
  64.    (APTR)&NPNameInfo, n, NULL\
  65. }
  66.  
  67. static struct Gadget NPGadget[] =
  68. {
  69.    BUTTON(NP_CANCEL,NPT_CANCEL),
  70.    BUTTON(NP_OK,NPT_OK),
  71.    NAME(NP_NAME),
  72. };
  73.  
  74. struct ExtRequest NPRequest =
  75. {
  76.    {NULL, 0,0, NP_PANELW,NP_PANELH, 0,0, &NPGadget[0], &NPBorder[NPB_PANEL],
  77.     &NPText[NPT_TITLE], 0, FOREGROUND, NULL, NULL, NULL},
  78.    NULL,NULL,NULL, &NPGadget[NP_NAME],
  79. };
  80.