home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / disks / disk373.lzh / Multiplot / source / mplot_src / src.zoo / texted.c < prev    next >
C/C++ Source or Header  |  1990-08-02  |  2KB  |  95 lines

  1. #include <stdio.h>
  2. #include <exec/types.h>
  3. #include "struct.h"
  4. #include "plot.h"
  5.  
  6. #include "Texted.h"
  7.  
  8. extern struct Window *FrontWindow;
  9. extern struct Screen *screen;
  10.  
  11. extern struct NewWindow NewFrontWindow;
  12. extern struct RastPort *p;
  13. extern struct ViewPort *vp;
  14. extern struct Pict *Pict;
  15.  
  16.  
  17. #define GO 1
  18. #define STOP 0
  19. #define ON TRUE
  20. int QuitTextFlag=GO;
  21.  
  22. EditText(text)
  23. char *text;
  24. {
  25. struct IntuiMessage  *a_message;         /* pointer to message */
  26. void ProcTextMes();
  27.  
  28.  
  29.   NewFrontWindow.Screen = screen;
  30.   NewFrontWindow.Title ="                       Edit Text                      ";
  31.   stccpy(TextSIBuff,text,79);
  32.  
  33.   NewFrontWindow.FirstGadget = &TextContinue;
  34.  
  35.   if (!(FrontWindow = (struct Window *)OpenWindow(&NewFrontWindow)))
  36.     {
  37.        ErrorAlert(0);
  38.        CloseScreen(screen);
  39.        sexit(FALSE);
  40.     }
  41.   ActivateGadget(&TextEd,FrontWindow,NULL);
  42.   p = FrontWindow->RPort;
  43.   QuitTextFlag=GO;     /*** RESET FLAG IN CASE NOT FIRST TIME ***/
  44.  
  45.   while (QuitTextFlag !=STOP)
  46.    {
  47.      Wait(1l<<FrontWindow->UserPort->mp_SigBit);        /* wait for a message */
  48.      while (a_message = (struct IntuiMessage *)GetMsg(FrontWindow->UserPort))
  49.        ProcTextMes(a_message);
  50.    }
  51.   CloseWindow(FrontWindow);
  52.  
  53.   stccpy(text,TextSIBuff,79);
  54.   return(0);
  55. }
  56.  
  57.  
  58. void ProcTextMes(p_message)
  59. struct IntuiMessage *p_message;
  60. {
  61. ULONG MesClass;        /*     Fields for storing      */
  62. USHORT MesCode;        /*     intuimessage data       */
  63. APTR Pointer;          /*                             */
  64. int HandleTextEvent();
  65.  
  66.    MesClass = p_message->Class;             /* Store values */
  67.    MesCode = p_message->Code;
  68.    Pointer = p_message->IAddress;
  69.    ReplyMsg(p_message);                     /* Reply to message */
  70.    HandleTextEvent(MesClass,MesCode,Pointer);
  71. }
  72.  
  73. int HandleTextEvent(MesClass,MesCode,Pointer)
  74. ULONG MesClass;        /*     Fields for storing      */
  75. USHORT MesCode;        /*     intuimessage data       */
  76. APTR Pointer;          /*                             */
  77. {
  78.  
  79.   if ( MesClass == GADGETDOWN)
  80.     {
  81.       if (Pointer == (APTR)&TextContinue)
  82.         {
  83.            QuitTextFlag=STOP;
  84.         }
  85.      }
  86.   if ( MesClass == RAWKEY)
  87.     {
  88.       if (MesCode ==196)  /* RETURN key RELEASED */
  89.          {
  90.             QuitTextFlag = STOP;
  91.          }
  92.      }
  93.   return(0);
  94. }
  95.