home *** CD-ROM | disk | FTP | other *** search
/ Network PC / Network PC.iso / amiga utilities / communication / bbs / termv4.6 / extras / source / term-source.lha / About.c next >
Encoding:
C/C++ Source or Header  |  1996-03-18  |  17.0 KB  |  824 lines

  1. /*
  2. **    About.c
  3. **
  4. **    Support routines for the `About' window.
  5. **
  6. **    Copyright © 1990-1996 by Olaf `Olsen' Barthel
  7. **        All Rights Reserved
  8. **
  9. **    :ts=4
  10. */
  11.  
  12. #ifndef _GLOBAL_H
  13. #include "Global.h"
  14. #endif
  15.  
  16. #define HEADING 4
  17.  
  18. enum    {    GAD_FRAME=1000,GAD_SCROLL,GAD_BUTTON };
  19.  
  20.     /* LocalDeleteBitMap(struct BitMap *BitMap,LONG Width,LONG Height):
  21.      *
  22.      *    Delete yet another screen bitmap.
  23.      */
  24.  
  25. STATIC VOID
  26. LocalDeleteBitMap(struct BitMap *BitMap,LONG Width,LONG Height)
  27. {
  28.     if(BitMap)
  29.     {
  30.         LONG i;
  31.  
  32.         WaitBlit();
  33.  
  34.         for(i = 0 ; i < BitMap->Depth ; i++)
  35.         {
  36.             if(BitMap->Planes[i])
  37.                 FreeRaster(BitMap->Planes[i],Width,Height);
  38.         }
  39.  
  40.         FreeVecPooled(BitMap);
  41.     }
  42. }
  43.  
  44.     /* LocalCreateBitMap(LONG Depth,LONG Width,LONG Height):
  45.      *
  46.      *    Create yet another screen bitmap.
  47.      */
  48.  
  49. STATIC struct BitMap *
  50. LocalCreateBitMap(LONG Depth,LONG Width,LONG Height)
  51. {
  52.     struct BitMap *BitMap;
  53.  
  54.     if(BitMap = (struct BitMap *)AllocVecPooled(sizeof(struct BitMap),MEMF_ANY))
  55.     {
  56.         BOOL    Success = TRUE;
  57.         LONG    i;
  58.  
  59.         InitBitMap(BitMap,Depth,Width,Height);
  60.  
  61.         for(i = 0 ; Success && i < Depth ; i++)
  62.         {
  63.             if(!(BitMap->Planes[i] = AllocRaster(Width,Height)))
  64.                 Success = FALSE;
  65.         }
  66.  
  67.         if(Success)
  68.             return(BitMap);
  69.  
  70.         LocalDeleteBitMap(BitMap,Width,Height);
  71.     }
  72.  
  73.     return(NULL);
  74. }
  75.  
  76.     /* CreateBitMapFromImage(struct Image *Image,struct BitMap *BitMap):
  77.      *
  78.      *    Turn an Intuition Image into a Gfx BitMap.
  79.      */
  80.  
  81. STATIC VOID
  82. CreateBitMapFromImage(struct Image *Image,struct BitMap *BitMap)
  83. {
  84.     PLANEPTR    Data    = (PLANEPTR)Image->ImageData;
  85.     ULONG        Modulo    = ((((ULONG)Image->Width) + 15) >> 3) & ~1;
  86.     LONG        i;
  87.  
  88.     InitBitMap(BitMap,Image->Depth,Image->Width,Image->Height);
  89.  
  90.     for(i = 0 ; i < Image->Depth ; i++, Data += Modulo * Image->Height)
  91.         BitMap->Planes[i] = Data;
  92. }
  93.  
  94.     /* RecolourBitMap():
  95.      *
  96.      *    Remap a BitMap to use a different colour selection.
  97.      */
  98.  
  99. STATIC struct BitMap *
  100. RecolourBitMap (struct BitMap *Src, UBYTE * Mapping, UBYTE DestDepth, LONG Width, LONG Height)
  101. {
  102.     struct BitMap *Dst;
  103.  
  104.         /* Create the bitmap to hold the remapped data. */
  105.  
  106.     if(Dst = LocalCreateBitMap(DestDepth,Width,Height))
  107.     {
  108.         struct BitMap *SingleMap;
  109.  
  110.             /* Create a single bitplane bitmap. */
  111.  
  112.         if(SingleMap = LocalCreateBitMap(1,Width,Height))
  113.         {
  114.             struct BitMap *FullMap;
  115.  
  116.                 /* Create a dummy bitmap. */
  117.  
  118.             if(FullMap = (struct BitMap *)AllocVecPooled(sizeof(struct BitMap),MEMF_ANY))
  119.             {
  120.                 LONG i,Mask = (1L << Src->Depth) - 1;
  121.  
  122.                     /* Make the dummy bitmap use the
  123.                      * single bitmap in all planes.
  124.                      */
  125.  
  126.                 InitBitMap(FullMap,DestDepth,Width,Height);
  127.  
  128.                 for(i = 0 ; i < DestDepth ; i++)
  129.                     FullMap->Planes[i] = SingleMap->Planes[0];
  130.  
  131.                     /* Clear the destination bitmap. */
  132.  
  133.                 BltBitMap(Dst,0,0,Dst,0,0,Width,Height,MINTERM_ZERO,0xFF,NULL);
  134.  
  135.                     /* Is colour zero to be mapped to a non-zero colour? */
  136.  
  137.                 if(Mapping[0])
  138.                 {
  139.                         /* Clear the single plane bitmap. */
  140.  
  141.                     BltBitMap(SingleMap,0,0,SingleMap,0,0,Width,Height,MINTERM_ZERO,1,NULL);
  142.  
  143.                         /* Merge all source bitplane data. */
  144.  
  145.                     BltBitMap(Src,0,0,FullMap,0,0,Width,Height,MINTERM_B_OR_C,Mask,NULL);
  146.  
  147.                         /* Invert the single plane bitmap, to give us
  148.                          * the zero colour bitmap we can work with.
  149.                          */
  150.  
  151.                     BltBitMap(SingleMap,0,0,SingleMap,0,0,Width,Height,MINTERM_NOT_C,1,NULL);
  152.  
  153.                         /* Now set all the bits for colour zero. */
  154.  
  155.                     BltBitMap(FullMap,0,0,Dst,0,0,Width,Height,MINTERM_B_OR_C,Mapping[0],NULL);
  156.                 }
  157.  
  158.                     /* Run down the colours. */
  159.  
  160.                 for(i = 1 ; i <= Mask ; i++)
  161.                 {
  162.                         /* Set the single plane bitmap to all 1's. */
  163.  
  164.                     BltBitMap(SingleMap,0,0,SingleMap,0,0,Width,Height,MINTERM_ONE,1,NULL);
  165.  
  166.                         /* Isolate the pixels to match the colour
  167.                          * specified in `i'.
  168.                          */
  169.  
  170.                     BltBitMap(Src,0,0,FullMap,0,0,Width,Height,MINTERM_B_AND_C,i,NULL);
  171.  
  172.                     if(Mask ^ i)
  173.                         BltBitMap(Src,0,0,FullMap,0,0,Width,Height,MINTERM_NOT_B_AND_C,Mask ^ i,NULL);
  174.  
  175.                         /* Set the pixels in the destination bitmap,
  176.                          * use the designated colour.
  177.                          */
  178.  
  179.                     BltBitMap(FullMap,0,0,Dst,0,0,Width,Height,MINTERM_B_OR_C,Mapping[i],NULL);
  180.                 }
  181.  
  182.                     /* Free the temporary bitmap. */
  183.  
  184.                 FreeVecPooled(FullMap);
  185.  
  186.                     /* Free the single plane bitmap. */
  187.  
  188.                 LocalDeleteBitMap(SingleMap,Width,Height);
  189.  
  190.                     /* Return the result. */
  191.  
  192.                 return(Dst);
  193.             }
  194.  
  195.             LocalDeleteBitMap(SingleMap,Width,Height);
  196.         }
  197.  
  198.         LocalDeleteBitMap(Dst,Width,Height);
  199.     }
  200.  
  201.     return(NULL);
  202. }
  203.  
  204. STATIC STRPTR Table[] =
  205. {
  206.     "\bBeta testing:",
  207.     "",
  208.     "Göran Åberg   Peter L. Banville Jr.",
  209.     "Stefan Becker   Abdelkader Benbachir",
  210.     "Martin Berndt   Gregory A. Chance",
  211.     "Keith Christopher   Mark Constable",
  212.     "Steve Corder   Sebastian Delmont",
  213.     "Marcel Döring   Klaus Dürr",
  214.     "Frank Dürring   Bernd Ernesti",
  215.     "Kenneth Fribert   Kay Gehrke",
  216.     "Jay Grizzard   Stefan Gybas",
  217.     "Christoph Gülicher   Chris Hanson",
  218.     "Peer Hasselmeyer   Christian Hechelmann",
  219.     "Holger Heinrich   Rodney Hester",
  220.     "Florian Hinzmann   Hung-Tung Hsu",
  221.     "Stefan Hudson   Kai Iske",
  222.     "Piotr Kaminski   Andreas M. Kirchwitz",
  223.     "Tony Kirkland   Stellan Klebom",
  224.     "Russell John LeBar   Jason C. Leach",
  225.     "Holger Lubitz   Daniel M. Makovec",
  226.     "Bob Maple   Julian Matthew",
  227.     "Chris Mattingly   Matthias Merkel",
  228.     "Dabe Murphy   William Michael Mushkin",
  229.     "Christopher G. Newby   Dean S. Pemberton",
  230.     "Yves Perrenoud   Olaf Peters",
  231.     "Sven Reger   Robert Reiswig",
  232.     "Matti Rintala   Alfredo Rojas",
  233.     "Karsten Rother   Ottmar Röhrig",
  234.     "Matthias Scheler   Markus Schmall",
  235.     "Robert L. Shady   Leon D. Shaner",
  236.     "Eric W. Sommer   Jason Soukeras",
  237.     "Gary B. Standen   Keith A. Stewart",
  238.     "Joel E. Swan   Jonathan Tew",
  239.     "Bodo Thevissen   Jürgen Zeschky",
  240.     "Michael Zielesny",
  241.     "",
  242.     "\bForeign language translations:",
  243.     "",
  244.     "Olaf Barthel (Deutsch)",
  245.     "Phillippe Brand (Français)",
  246.     "Thomas Egrelius (Svenska)",
  247.     "Flemming Lindeblad (Dansk)",
  248.     "Andrea Suatoni (Italiano)",
  249.     "Edmund Vermeulen (Nederlands)",
  250.     "«Sorry, I lost your name» (Español)",
  251.     "",
  252.     "\bDocumentation:",
  253.     "",
  254.     "Olaf Barthel   Garry Glendown",
  255.     "Henning Hucke   Mike Safer",
  256.     "Mark Schröer",
  257.     "",
  258.     "\bXPR Libraries by:",
  259.     "",
  260.     "Marc Boucher (xmodem)",
  261.     "Terence Finney (bplus)",
  262.     "Rick Huebner & William M. Perkins (zmodem)",
  263.     "Ueli Kaufmann (ascii, ymodem, vms)",
  264.     "Marco Papa & Stephen Walton (kermit)",
  265.     "Jack Rouse (quickb)",
  266.     "",
  267.     "\bXEM Libraries by:",
  268.     "",
  269.     "Ueli Kaufmann (amiga, ascii, bbs, vt340)",
  270.     "Stef Rave (rip)",
  271.     "",
  272.     "\bPeople who will deny that",
  273.     "\bthey were ever involved:",
  274.     "",
  275.     "John Burton   Peter Fischer",
  276.     "David Göhler   Michael-Wolfgang Hohmann",
  277.     "David Jones   Marko Küchmann",
  278.     "Bernd Lambracht   Roby Leeman & AUGS",
  279.     "Frank Mariak   Germar Morgenthaler",
  280.     "Jürgen Otte   Till `Dill-Prince' Prinzler",
  281.     "Nicola Salmoria   Ralph Schmidt",
  282.     "Veith Schörgenhummer   Thorsten Seidel",
  283.     "Markus Stoll   Martin Taillefer",
  284.     "Christoph Teuber   Ralf Thanner",
  285.     "Volker Ulle & the Aquila Sysop Team   Michael Vaeth",
  286.     "Oliver Wagner   Christopher Wichura",
  287.     "Udo Wolt   Matthias Zepf",
  288.     "",
  289.     "\aDon't switch off, it's almost over!",
  290.     "",
  291.     NULL
  292. };
  293.  
  294. STATIC VOID
  295. PrintThisLine(struct RastPort *RPort,struct Rectangle *Clip,LONG Top,STRPTR Line)
  296. {
  297.     LONG Len,Width;
  298.  
  299.     Len = strlen(Line);
  300.  
  301.     if(*Line == '\b' || *Line == '\a')
  302.     {
  303.         ULONG Style;
  304.  
  305.         if(*Line == '\b')
  306.             Style = FSF_BOLD;
  307.         else
  308.             Style = FSF_ITALIC;
  309.  
  310.         SetSoftStyle(RPort,Style,FSF_BOLD | FSF_ITALIC);
  311.         Line++;
  312.         Len--;
  313.     }
  314.     else
  315.         SetSoftStyle(RPort,0,FSF_BOLD | FSF_ITALIC);
  316.  
  317.     if(Len > 0)
  318.     {
  319.         Width = TextLength(RPort,Line,Len);
  320.  
  321.         PlaceText(RPort,Clip->MinX + (Clip->MaxX - Clip->MinX + 1 - Width) / 2,Top,Line,Len);
  322.     }
  323. }
  324.  
  325.  
  326.     /* ShowAbout():
  327.      *
  328.      *    Open a window, draw the `term' logo, show some text
  329.      *    and wait for user reaction.
  330.      */
  331.  
  332. BOOL
  333. ShowAbout(LONG Ticks)
  334. {
  335.     struct BitMap        *ImageBitMap = NULL;
  336.     LONG                 ImageWidth,
  337.                          ImageHeight;
  338.     struct LayoutHandle    *Handle;
  339.     BOOL                 GotRexxMessage = FALSE;
  340.  
  341.     if(IconBase)
  342.     {
  343.         struct DiskObject *Icon;
  344.  
  345.         if(Icon = GetProgramIcon())
  346.         {
  347.             STATIC UWORD DefaultColours[4] =
  348.             {
  349.                 0xAAA,
  350.                 0x000,
  351.                 0xFFF,
  352.                 0x68B
  353.             };
  354.  
  355.             UBYTE    Mapping[4];
  356.             LONG    Colour1,Colour2;
  357.             LONG    ChannelDistance;
  358.             LONG    Distance,BestDistance,BestIndex,Depth,Count,i,j;
  359.             BOOL    Duplicates = FALSE;
  360.  
  361.             Depth = GetBitMapDepth(Window->RPort->BitMap);
  362.             Count = Window->WScreen->ViewPort.ColorMap->Count;
  363.  
  364.             if(Depth > 8)
  365.                 Depth = 8;
  366.  
  367.             if(Count > (1L << Depth))
  368.                 Count = 1L << Depth;
  369.  
  370.             if(Count > 256)
  371.                 Count = 256;
  372.  
  373.             if(Count >= 4)
  374.             {
  375.                 for(i = 0 ; i < 4 ; i++)
  376.                 {
  377.                     Colour2 = DefaultColours[i];
  378.  
  379.                     BestDistance    = 3 * 15 * 15;
  380.                     BestIndex        = 0;
  381.  
  382.                     for(j = 0 ; j < Count ; j++)
  383.                     {
  384.                         Colour1 = GetRGB4(Window->WScreen->ViewPort.ColorMap,j);
  385.  
  386.                         ChannelDistance = ((LONG)((Colour1 >> 8) & 0xF)) - ((LONG)((Colour2 >> 8) & 0xF));
  387.  
  388.                         Distance = ChannelDistance * ChannelDistance;
  389.  
  390.                         ChannelDistance = ((LONG)((Colour1 >> 4) & 0xF)) - ((LONG)((Colour2 >> 4) & 0xF));
  391.  
  392.                         Distance += ChannelDistance * ChannelDistance;
  393.  
  394.                         ChannelDistance = ((LONG)(Colour1 & 0xF)) - ((LONG)(Colour2 & 0xF));
  395.  
  396.                         Distance += ChannelDistance * ChannelDistance;
  397.  
  398.                         if(Distance < BestDistance)
  399.                         {
  400.                             BestDistance    = Distance;
  401.                             BestIndex        = j;
  402.                         }
  403.                     }
  404.  
  405.                     Mapping[i] = BestIndex;
  406.                 }
  407.  
  408.                 for(i = 0 ; !Duplicates && i < 4 ; i++)
  409.                 {
  410.                     for(j = i + 1 ; !Duplicates && j < 4 ; j++)
  411.                         Duplicates = (Mapping[i] == Mapping[j]);
  412.                 }
  413.  
  414.                 if(!Duplicates)
  415.                 {
  416.                     struct BitMap     LocalBitMap;
  417.                     struct Image    *Image;
  418.  
  419.                     Image = Icon->do_Gadget.GadgetRender;
  420.  
  421.                     if(Image->Depth == 2)
  422.                     {
  423.                         CreateBitMapFromImage(Image,&LocalBitMap);
  424.  
  425.                         if(ImageBitMap = RecolourBitMap(&LocalBitMap,Mapping,Depth,Image->Width,Image->Height))
  426.                         {
  427.                             ImageWidth    = Image->Width;
  428.                             ImageHeight    = Image->Height;
  429.                         }
  430.                     }
  431.                 }
  432.             }
  433.  
  434.             FreeDiskObject(Icon);
  435.         }
  436.     }
  437.  
  438.     if(Handle = LT_CreateHandleTags(Window->WScreen,
  439.         LH_LocaleHook,    &LocaleHook,
  440.         LH_ExactClone,    TRUE,
  441.     TAG_DONE))
  442.     {
  443.         struct Window        *PanelWindow;
  444.         struct Region        *Clip = NULL,*Old;
  445.         struct Rectangle     ClipRect;
  446.         LONG                 ClipWidth,
  447.                              ClipHeight;
  448.  
  449.         if(!Ticks)
  450.         {
  451.             struct RastPort    This;
  452.             ULONG            Width,MaxWidth,Len,i;
  453.             STRPTR            String;
  454.  
  455.             InitRastPort(&This);
  456.             SetFont(&This,UserTextFont);
  457.  
  458.             for(i = MaxWidth = 0 ; Table[i] ; i++)
  459.             {
  460.                 Len = strlen(String = Table[i]);
  461.  
  462.                 if(*String == '\b' || *String == '\a')
  463.                 {
  464.                     ULONG Style;
  465.  
  466.                     if(*String == '\b')
  467.                         Style = FSF_BOLD;
  468.                     else
  469.                         Style = FSF_ITALIC;
  470.  
  471.                     SetSoftStyle(&This,Style,FSF_BOLD | FSF_ITALIC);
  472.                     String++;
  473.                     Len--;
  474.                 }
  475.                 else
  476.                     SetSoftStyle(&This,0,FSF_BOLD | FSF_ITALIC);
  477.  
  478.                 if(Len > 0)
  479.                 {
  480.                     Width = TextLength(&This,String,Len);
  481.  
  482.                     if(Width > MaxWidth)
  483.                         MaxWidth = Width;
  484.                 }
  485.             }
  486.  
  487.             ClipWidth    = MaxWidth;
  488.             ClipHeight    = HEADING * This.TxHeight;
  489.  
  490.             Clip = NewRegion();
  491.         }
  492.  
  493.         LT_New(Handle,
  494.             LA_Type,VERTICAL_KIND,
  495.         TAG_DONE);
  496.         {
  497.             LT_New(Handle,
  498.                 LA_Type,        VERTICAL_KIND,
  499.                 LA_LabelText,    TermName,
  500.             TAG_DONE);
  501.             {
  502.                 if(ImageBitMap)
  503.                 {
  504.                     LT_New(Handle,
  505.                         LA_Type,VERTICAL_KIND,
  506.                     TAG_DONE);
  507.                     {
  508.                         LT_New(Handle,
  509.                             LA_Type,            FRAME_KIND,
  510.                             LAFR_InnerWidth,    ImageWidth,
  511.                             LAFR_InnerHeight,    ImageHeight,
  512.                             LA_DrawBox,            FALSE,
  513.                             LA_ID,                GAD_FRAME,
  514.                         TAG_DONE);
  515.  
  516.                         LT_EndGroup(Handle);
  517.                     }
  518.                 }
  519.  
  520.                 LT_New(Handle,
  521.                     LA_Type,VERTICAL_KIND,
  522.                 TAG_DONE);
  523.                 {
  524.                     LT_New(Handle,
  525.                         LA_Type,        BOX_KIND,
  526.                         LABX_FirstLine,    MSG_TERMINFO_INFOTEXT1_TXT,
  527.                         LABX_LastLine,    MSG_TERMINFO_INFOTEXT2_TXT,
  528.                         LABX_AlignText,    ALIGNTEXT_CENTERED,
  529.                         LABX_DrawBox,    FALSE,
  530.                     TAG_DONE);
  531.  
  532.                     LT_EndGroup(Handle);
  533.                 }
  534.  
  535.                 if(!Ticks && Clip)
  536.                 {
  537.                     LT_New(Handle,
  538.                         LA_Type,VERTICAL_KIND,
  539.                     TAG_DONE);
  540.                     {
  541.                         LT_New(Handle,
  542.                             LA_Type,XBAR_KIND,
  543.                         TAG_DONE);
  544.  
  545.                         LT_New(Handle,
  546.                             LA_Type,            FRAME_KIND,
  547.                             LAFR_InnerWidth,    ClipWidth + 4,
  548.                             LAFR_InnerHeight,    ClipHeight + 2,
  549.                             LA_DrawBox,            FALSE,
  550.                             LA_ID,                GAD_SCROLL,
  551.                         TAG_DONE);
  552.  
  553.                         LT_EndGroup(Handle);
  554.                     }
  555.                 }
  556.  
  557.                 LT_EndGroup(Handle);
  558.             }
  559.  
  560.             LT_New(Handle,
  561.                 LA_Type,    VERTICAL_KIND,
  562.                 LA_LabelID,    MSG_V36_1030,
  563.             TAG_DONE);
  564.             {
  565.                 LT_New(Handle,
  566.                     LA_Type,VERTICAL_KIND,
  567.                 TAG_DONE);
  568.                 {
  569.                     LT_New(Handle,
  570.                         LA_Type,        BOX_KIND,
  571.                         LABX_FirstLine,    MSG_TERMINFO_INFOTEXT4_TXT,
  572.                         LABX_LastLine,    MSG_TERMINFO_INFOTEXT6_TXT,
  573.                         LABX_AlignText,    ALIGNTEXT_CENTERED,
  574.                         LABX_DrawBox,    FALSE,
  575.                     TAG_DONE);
  576.  
  577.                     LT_EndGroup(Handle);
  578.                 }
  579.  
  580.                 LT_New(Handle,
  581.                     LA_Type,    VERTICAL_KIND,
  582.                     LA_LabelID,    MSG_V36_1031,
  583.                 TAG_DONE);
  584.                 {
  585.                     LT_New(Handle,
  586.                         LA_Type,        BOX_KIND,
  587.                         LABX_FirstLine,    MSG_TERMINFO_INFOTEXT10_TXT,
  588.                         LABX_LastLine,    MSG_TERMINFO_INFOTEXT12_TXT,
  589.                         LABX_AlignText,    ALIGNTEXT_CENTERED,
  590.                         LABX_DrawBox,    FALSE,
  591.                     TAG_DONE);
  592.  
  593.                     LT_EndGroup(Handle);
  594.                 }
  595.  
  596.                 LT_New(Handle,
  597.                     LA_Type,    VERTICAL_KIND,
  598.                     LA_LabelID,    MSG_V36_1032,
  599.                 TAG_DONE);
  600.                 {
  601.                     LT_New(Handle,
  602.                         LA_Type,        BOX_KIND,
  603.                         LABX_FirstLine,    MSG_TERMINFO_INFOTEXT16_TXT,
  604.                         LABX_LastLine,    MSG_TERMINFO_INFOTEXT16_TXT,
  605.                         LABX_AlignText,    ALIGNTEXT_CENTERED,
  606.                         LABX_DrawBox,    FALSE,
  607.                     TAG_DONE);
  608.  
  609.                     LT_EndGroup(Handle);
  610.                 }
  611.  
  612.                 LT_EndGroup(Handle);
  613.             }
  614.  
  615.             if(!Ticks)
  616.             {
  617.                 LT_New(Handle,
  618.                     LA_Type,VERTICAL_KIND,
  619.                 TAG_DONE);
  620.                 {
  621.                     LT_New(Handle,
  622.                         LA_Type,        XBAR_KIND,
  623.                         LAXB_FullSize,    TRUE,
  624.                     TAG_DONE);
  625.  
  626.                     LT_New(Handle,
  627.                         LA_Type,        BUTTON_KIND,
  628.                         LA_LabelID,        MSG_V36_1033,
  629.                         LA_ID,            GAD_BUTTON,
  630.                         LABT_ReturnKey,    TRUE,
  631.                         LABT_ExtraFat,    TRUE,
  632.                     TAG_DONE);
  633.  
  634.                     LT_EndGroup(Handle);
  635.                 }
  636.             }
  637.  
  638.             LT_EndGroup(Handle);
  639.         }
  640.  
  641.         if(PanelWindow = LT_Build(Handle,
  642.             LAWN_IDCMP,        Ticks ? (IDCMP_RAWKEY | IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_INTUITICKS) : (IDCMP_CLOSEWINDOW | IDCMP_INTUITICKS),
  643.  
  644.             LAWN_HelpHook,    &GuideHook,
  645.             LAWN_MaxPen,    -1,
  646.             LAWN_Parent,    Window,
  647.             WA_RMBTrap,        TRUE,
  648.             WA_Activate,    TRUE,
  649.             WA_ReportMouse,    TRUE,
  650.  
  651.             Ticks ? TAG_DONE : TAG_IGNORE,0,
  652.  
  653.             WA_DepthGadget,    TRUE,
  654.             WA_CloseGadget,    TRUE,
  655.             WA_DragBar,        TRUE,
  656.             LAWN_TitleID,    MSG_V36_1034,
  657.         TAG_DONE))
  658.         {
  659.             struct IntuiMessage    *Message;
  660.             BOOL                 Done = FALSE;
  661.             ULONG                 MsgClass,
  662.                                  MsgQualifier;
  663.             UWORD                 MsgCode;
  664.             struct Gadget        *MsgGadget;
  665.             ULONG                 Signals;
  666.             LONG                 TickCount = 0;
  667.             LONG                 Top,Total,LastLine,IntroTicks = 15;
  668.             struct RastPort        *RPort = PanelWindow->RPort;
  669.  
  670.             if(ImageBitMap)
  671.             {
  672.                 LONG Left,Top;
  673.  
  674.                 LT_GetAttributes(Handle,GAD_FRAME,
  675.                     LA_Left,    &Left,
  676.                     LA_Top,        &Top,
  677.                 TAG_DONE);
  678.  
  679.                 BltBitMapRastPort(ImageBitMap,0,0,RPort,Left,Top,ImageWidth,ImageHeight,MINTERM_COPY);
  680.             }
  681.  
  682.             if(!Ticks)
  683.             {
  684.                 LONG LeftEdge,TopEdge;
  685.  
  686.                 LT_GetAttributes(Handle,GAD_SCROLL,
  687.                     LA_Left,    &LeftEdge,
  688.                     LA_Top,        &TopEdge,
  689.                 TAG_DONE);
  690.  
  691.                 ClipRect.MinX = LeftEdge + 2;
  692.                 ClipRect.MinY = TopEdge + 2;
  693.                 ClipRect.MaxX = LeftEdge + 2 + ClipWidth - 1;
  694.                 ClipRect.MaxY = TopEdge + 2 + ClipHeight - 1;
  695.  
  696.                 SetFont(RPort,UserTextFont);
  697.                 SetPens(RPort,Pens[TEXTPEN],Pens[BACKGROUNDPEN],JAM2);
  698.  
  699.                 if(OrRectRegion(Clip,&ClipRect))
  700.                 {
  701.                     LONG i;
  702.  
  703.                     Old = InstallClipRegion(PanelWindow->WLayer,Clip);
  704.  
  705.                     Top = ClipRect.MinY;
  706.  
  707.                     for(i = 0 ; i < HEADING ; i++)
  708.                     {
  709.                         PrintThisLine(RPort,&ClipRect,Top,Table[i]);
  710.  
  711.                         Top += RPort->TxHeight;
  712.                     }
  713.  
  714.                     LastLine = i;
  715.  
  716.                     Total = 0;
  717.                 }
  718.                 else
  719.                 {
  720.                     DisposeRegion(Clip);
  721.                     Clip = NULL;
  722.                 }
  723.             }
  724.  
  725.             while(Message = GT_GetIMsg(PanelWindow->UserPort))
  726.                 GT_ReplyIMsg(Message);
  727.  
  728.             if(!Ticks)
  729.                 PushWindow(PanelWindow);
  730.             else
  731.                 Say(LocaleString(MSG_TERMINFO_WELCOME_TO_TERM_TXT));
  732.  
  733.             do
  734.             {
  735.                 Signals = Wait(PORTMASK(PanelWindow->UserPort) | SIG_BREAK | SIG_REXX);
  736.  
  737.                 if(Signals & SIG_BREAK)
  738.                     break;
  739.  
  740.                 if(Ticks)
  741.                 {
  742.                     if(Signals & SIG_REXX)
  743.                     {
  744.                         GotRexxMessage = TRUE;
  745.  
  746.                         break;
  747.                     }
  748.                 }
  749.  
  750.                 while(Message = (struct IntuiMessage *)GT_GetIMsg(PanelWindow->UserPort))
  751.                 {
  752.                     MsgClass        = Message->Class;
  753.                     MsgQualifier    = Message->Qualifier;
  754.                     MsgCode            = Message->Code;
  755.                     MsgGadget        = (struct Gadget *)Message->IAddress;
  756.  
  757.                     GT_ReplyIMsg(Message);
  758.  
  759.                     if(Ticks)
  760.                     {
  761.                         if(MsgClass == IDCMP_INTUITICKS && TickCount++ >= 50)
  762.                             Done = TRUE;
  763.  
  764.                         if((MsgClass == IDCMP_RAWKEY || MsgClass == IDCMP_MOUSEBUTTONS) && !(MsgCode & IECODE_UP_PREFIX))
  765.                             Done = TRUE;
  766.  
  767.                         if(MsgClass == IDCMP_MOUSEMOVE)
  768.                             Done = TRUE;
  769.                     }
  770.                     else
  771.                     {
  772.                         LT_HandleInput(Handle,MsgQualifier,&MsgClass,&MsgCode,&MsgGadget);
  773.  
  774.                         if(MsgClass == IDCMP_CLOSEWINDOW || MsgClass == IDCMP_GADGETUP)
  775.                             Done = TRUE;
  776.  
  777.                         if(MsgClass == IDCMP_INTUITICKS && Clip)
  778.                         {
  779.                             if(IntroTicks > 0)
  780.                                 IntroTicks--;
  781.                             else
  782.                             {
  783.                                 ScrollRaster(RPort,0,1,ClipRect.MinX,ClipRect.MinY,ClipRect.MaxX,ClipRect.MaxY);
  784.  
  785.                                 Total++;
  786.  
  787.                                 PrintThisLine(RPort,&ClipRect,Top - Total,Table[LastLine]);
  788.  
  789.                                 if(Total == RPort->TxHeight)
  790.                                 {
  791.                                     Total = 0;
  792.  
  793.                                     LastLine++;
  794.  
  795.                                     if(!Table[LastLine])
  796.                                         LastLine = 0;
  797.                                 }
  798.                             }
  799.                         }
  800.                     }
  801.                 }
  802.             }
  803.             while(!Done);
  804.  
  805.             if(Clip)
  806.             {
  807.                 InstallClipRegion(PanelWindow->WLayer,Old);
  808.  
  809.                 DisposeRegion(Clip);
  810.             }
  811.  
  812.             if(!Ticks)
  813.                 PopWindow();
  814.         }
  815.  
  816.         LT_DeleteHandle(Handle);
  817.     }
  818.  
  819.     if(ImageBitMap)
  820.         LocalDeleteBitMap(ImageBitMap,ImageWidth,ImageHeight);
  821.  
  822.     return(GotRexxMessage);
  823. }
  824.