[comp.sources.amiga] v90i163: NewsView 2.32 - amiga usenet news reader, Part02/06

Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator) (05/07/90)

Submitted-by: Richard Frost <rfrost@spam.ua.OZ.AU>
Posting-number: Volume 90, Issue 163
Archive-name: applications/nv-2.32/part02

#!/bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 2 (of 6)."
# Contents:  CreateFileList.h Gadgets.c Globals.h Main.c
#   Requester/Requester.pw.uu ShutDown.c ViewGads.h WBench.c
# Wrapped by tadguy@xanth on Sun May  6 18:08:37 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'CreateFileList.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'CreateFileList.h'\"
else
echo shar: Extracting \"'CreateFileList.h'\" \(1964 characters\)
sed "s/^X//" >'CreateFileList.h' <<'END_OF_FILE'
X/* ======================================================================= */
X/*                                                                         */
X/* PROGRAM:                         News View                              */
X/*                                                                         */
X/* VERSION:      2.3a                                                      */
X/*                                                                         */
X/*                                                                         */
X/* FILENAME:     CreateFileList.h                                          */
X/*                                                                         */
X/* DESCRIPTION:  Major routine that finds the news items in the directory  */
X/*               specified by argv[1] and loads them into the News Item    */
X/*               List structures.                                          */
X/*                                                                         */
X/* AUTHORS:      Robert Wozniak  Copyright 1990                                    */
X/*               Richard Frost   => Message Window Stuff                   */
X/*                               => Very minor bug fixes                   */
X/*                                                                         */
X/*                                                                         */
X/* DATE:         25th March 1990                                           */
X/*                                                                         */
X/* ======================================================================= */
X
Xextern int  CreateFileList();
Xextern BOOL ExternalReadItem();
X
Xextern FILE   *fopen();
Xextern void   CloseRUN();
Xextern int    did_cd;
Xextern int    Items; 
X
Xextern ITEM   firsti;
X
Xextern struct FileLock 	    *dirlock,*old_cd,*CurrentDir();
Xextern struct FileInfoBlock *my_fib;
Xextern struct FileHandle    *my_fhand;
END_OF_FILE
if test 1964 -ne `wc -c <'CreateFileList.h'`; then
    echo shar: \"'CreateFileList.h'\" unpacked with wrong size!
fi
# end of 'CreateFileList.h'
fi
if test -f 'Gadgets.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Gadgets.c'\"
else
echo shar: Extracting \"'Gadgets.c'\" \(9132 characters\)
sed "s/^X//" >'Gadgets.c' <<'END_OF_FILE'
X/* ======================================================================= */
X/*                                                                         */
X/* PROGRAM:                         News View                              */
X/*                                                                         */
X/* VERSION:      2.00                                                      */
X/*                                                                         */
X/*                                                                         */
X/* FILENAME:     Gadgets.c                                                 */
X/*                                                                         */
X/* DESCRIPTION:  This module is a collection of routines that deal with    */
X/*               all the gadgets that are in the window.                   */
X/*									   */
X/* AUTHOR:       Copyright 1990   Richard Frost                                    */
X/*                                                                         */
X/* DATE:         20th March 1990                                           */
X/*                                                                         */
X/* ======================================================================= */
X
X#include "Defs.h"
X#include "Globals.h"
X#include "Display.h"
X#include "Select.h"
X#include "WindData.h"
X
X
X
X#define UPDATESLIDER 1
X#define DONT_UPDATESLIDER 0
X
X
X/* ======================================================================= */
X/*                                 SetKnobPos                              */
X/* ======================================================================= */
X
X/* Set the position of the knob to reflect the position in 
X   the news viewer's item list.
X*/
X
XPUBLIC VOID SetKnobPos()
X{
X  USHORT Vpot,Vbody;
X
X  if (NumItems <= Wind_Rows)
X    Vpot = 0;
X  else
X    Vpot = ((float) 0xFFFF) * ((float)Wind_FirstItem)/((float)MaxFirstItem);
X
X  Vbody= VertSliderSInfo.VertBody;
X  NewModifyProp(&VertSlider,NV_Window,NULL,VertSliderSInfo.Flags,0,Vpot,0,Vbody,1);
X}
X
X/* ======================================================================= */
X/*                                SetKnobSize                              */
X/* ======================================================================= */
X
X/* Set the variable VertBody of the vertical slider gadget, thus adjusting
X   the Size of the knob of the proportional gadget. */
X
XPUBLIC VOID SetKnobSize()
X{
X  USHORT vbody,vpot;
X
X
X  /* calculate the VertBody variable .. */
X
X  /* CALCULATION: The VertBody variable is the fraction of the total
X                  text VISIBLE.
X
X                  ie    ffff * ItemsDisplayed/NumItems
X  */
X
X  /* Calculate number of visible items */
X
X  if (NumItems == ItemsDisplayed)       /* we can see ALL ITEMS  */
X    {
X      vbody = 0xFFFF;
X#ifdef DEBUG_ON
X      printf("\nSetKnobSize: ALL ITEMS ARE SHOWING !\n");
X#endif
X      NewModifyProp(&VertSlider,NV_Window,NULL,VertSliderSInfo.Flags,0,0,0,vbody,1);
X    }
X  else
X    {
X#ifdef DEBUG_ON
X      printf("\nSetKnobSize: INIT SLIDER \n");
X      printf("SetKnobSize:NumItems = %d\n",NumItems);
X      printf("SetKnobSize:ItemsDisplayed =%d\n",ItemsDisplayed);
X#endif
X      vbody = ((float) 0xffff) * ( ((float) Wind_Rows)/((float) NumItems) );
X
X      vpot = VertSliderSInfo.VertPot;
X
X#ifdef DEBUG_ON
X      printf("SetKnobSize:vpot  = %4x\n",vpot);
X      printf("SetKnobSize:vbody = %4x\n",vbody);
X#endif
X
X      /* calculate the pot & body variable */
X
X      NewModifyProp(&VertSlider,NV_Window,NULL,VertSliderSInfo.Flags,0,vpot,0,vbody,1);
X   }
X
X}
X
X/* ======================================================================= */
X/*                                  MoveSlider                             */
X/* ======================================================================= */
X
XPUBLIC VOID MoveSlider()
X{
X USHORT Vpot;
X register SHORT pos,dist;
X register SHORT i;
X
X static SHORT PrevWFI=0;    /* The previous "Wind_FirstItem" value */
X			    /* This is the max number of single line scrolls
X			       in succession that will occur. */
X#define SCROLL_TOLERANCE 15 
X
X#ifdef DEBUG_ON
Xprintf("\nPrevWFI = %d\n",PrevWFI);
Xprintf("MoveSlider: NumItems = %d\n",NumItems);
Xprintf("MoveSlider: ItemsDisplayed = %d\n",ItemsDisplayed);
X#endif
X
X if ( NumItems > ItemsDisplayed)   /* if there are items NOT SHOWING .. */
X   {
X
X#ifdef DEBUG_ON
Xprintf("MoveSlider: Wind_FirstItem BEFORE = %d\n",Wind_FirstItem);
X#endif
X     
X     /* Don't alter the current VertPot setting !! */
X     Vpot = VertSliderSInfo.VertPot;
X
X#ifdef DEBUG_ON
Xprintf("MoveSlider: POT VALUE  %4x\n",Vpot); 
X#endif
X
X     /* CONVERT the current position of the slider gadget into a news item
X        offset value..
X      */
X     pos = ((float) Vpot / (float) 0xffff) * ((float) (MaxFirstItem));
X
X
X#ifdef DEBUG_ON
Xprintf("MoveSlider: Wind_FirstItem AFTER =%d\n",Wind_FirstItem);
X#endif
X
X     /* DISPLAY SCROLLER OPTIMIZER!! */
X     if (pos != PrevWFI) 
X       {
X
X         if (pos > PrevWFI)
X           {
X/*
Xprintf("DOWN: Distance = %d\n",pos-PrevWFI);
X*/
X              if ((dist = pos-PrevWFI) < SCROLL_TOLERANCE)
X	        for (i=0; i < dist; i++)
X		   ScrollDown(DONT_UPDATESLIDER);
X	      else
X	        {
X		   Wind_FirstItem = pos;
X	           RedrawWindow();
X 	        }
X
X              PrevWFI = Wind_FirstItem;
X/*
Xprintf("AFTER THE SCROLL DOWN: Distance = %d\n",Wind_FirstItem-PrevWFI);
X*/
X           }
X         else
X           {
X/*
Xprintf("UP: Distance = %d\n",PrevWFI-pos);
X*/
X
X              if ((dist = PrevWFI-pos) < SCROLL_TOLERANCE)
X	        for (i=0; i < dist; i++)
X		   ScrollUp(DONT_UPDATESLIDER);
X	      else
X	      {
X		 Wind_FirstItem = pos;
X	         RedrawWindow();
X 	      } 
X
X              PrevWFI = Wind_FirstItem;
X/* 
Xprintf("AFTER THE SCROLL UP: Distance = %d\n",Wind_FirstItem-PrevWFI);
X*/
X
X           }
X       }
X   }
X}
X
X/* ======================================================================= */
X/*                               StartSelectGadget                         */
X/* ======================================================================= */
X
XPUBLIC VOID StartSelectGadget(gad)
Xstruct Gadget *gad;
X{
X extern struct Message *GetMsg();
X struct IntuiMessage *m;
X
X  switch(gad->GadgetID)
X    {
X       case VERT_SLIDER:
X	   /* Start receiving mouse move events */			     
X           ReportMouse(TRUE,NV_Window);
X	   break;
X
X       case UP_BUTTON:
X	   while (!(m = (struct IntuiMessage *) GetMsg(NV_Window->UserPort)))
X            { 
X	      ScrollUp(UPDATESLIDER);
X	    }
X	   ReplyMsg(m);
X  	   SetCurrentItem(Wind_FirstItem+CurrentRow);
X	   break;
X
X       case DOWN_BUTTON:
X	   while (!(m = (struct IntuiMessage *) GetMsg(NV_Window->UserPort)))
X            { 
X	      ScrollDown(UPDATESLIDER);
X	    }
X	   ReplyMsg(m);
X  	   SetCurrentItem(Wind_FirstItem+CurrentRow);
X	   break;
X     }
X}
X
X
X/* ======================================================================= */
X/*                               EndSelectGadget                           */
X/* ======================================================================= */
X
XPUBLIC VOID EndSelectGadget(gad)
Xstruct Gadget *gad;
X{
X  struct StringInfo *siptr;
X  register SHORT item;
X
X  switch (gad->GadgetID)        /* Find out what gadget got hit ... */
X    {
X       case First_Item:  
X			 /* NOTE: EraseArrow MUST be ALWAYS done B4 we 
X			    alter Wind First Item!! */
X			 EraseArrow(); 
X                         Wind_FirstItem = 0;
X                         RedrawWindow();
X                         SetKnobPos();
X			 SetCurrentItem(0);
X			 DrawArrow();
X                         break;
X
X       case Last_Item:   
X			 EraseArrow();
X                         Wind_FirstItem = MaxFirstItem;
X                         RedrawWindow();
X                         SetKnobPos();
X			 SetCurrentItem(NumItems-1);
X			 DrawArrow();
X                         break;
X
X       case Next_Item:   item = GetNextItem();
X			 EraseArrow();
X			 CentreOnItem(item);
X			 DrawArrow();
X			 GoReadItem(item);
X                         break;
X
X       case Prev_Item:   item = GetPrevItem();
X			 EraseArrow();
X			 CentreOnItem(item);
X			 DrawArrow();
X			 GoReadItem(item);
X                         break;
X
X       case Next_Reply:  item = GetNextReply();
X			 if (item != CurrentItem)
X			   {
X			     EraseArrow();
X			     CentreOnItem(item);
X			     DrawArrow();
X			     GoReadItem(item);
X			   }
X			 else
X			   DisplayBeep(NULL);
X                         break;
X
X       case String_Gad:
X#ifdef ABC 
X printf("SelectGadget: String Gad\n");
X siptr = (struct StringInfo *) gad->SpecialInfo;
X printf("SelectGadget: buffer is [%s]\n",siptr->Buffer);
X#endif
X			 RefreshWindowFrame(NV_Window);
X                         break;
X
X       case DOWN_BUTTON: ScrollDown(UPDATESLIDER);
X                         break;
X
X       case UP_BUTTON:   ScrollUp(UPDATESLIDER);
X                         break;
X
X       case VERT_SLIDER: /* STOP receiving mouse move events */	
X			 ReportMouse(FALSE,NV_Window);
X		         MoveSlider();
X			 SetCurrentItem(Wind_FirstItem+CurrentRow);
X                         break;
X
X       default: printf("Errr!!, what happenned?? ID = %d\n",gad->GadgetID);
X                break;
X    }
X}
END_OF_FILE
if test 9132 -ne `wc -c <'Gadgets.c'`; then
    echo shar: \"'Gadgets.c'\" unpacked with wrong size!
fi
# end of 'Gadgets.c'
fi
if test -f 'Globals.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Globals.h'\"
else
echo shar: Extracting \"'Globals.h'\" \(3424 characters\)
sed "s/^X//" >'Globals.h' <<'END_OF_FILE'
X/* ======================================================================= */
X/*                                                                         */
X/* PROGRAM:                         News Viewer                            */
X/*                                                                         */
X/* VERSION:      2.3a                                                      */
X/*                                                                         */
X/*                                                                         */
X/* FILENAME:     Globals.h                                                 */
X/*                                                                         */
X/* DESCRIPTION:  This header file declares all the globals which are used  */
X/*               by all modules in the program.                            */
X/*                                                                         */
X/* AUTHOR:       Richard Frost & Robert Wozniak Copyright 1990                     */
X/*                                                                         */
X/* DATE:         31st March 1990                                           */
X/*                                                                         */
X/* ======================================================================= */
X
X
X                /*  --------------   G l o b a l s   --------------  */
X#ifdef MAIN
X#  define EXTERN 
X#else
X#  define EXTERN extern
X#endif
X
X
X                             /* THE NEWS ITEM STRUCTURE */
X
Xtypedef struct item 
X  {
X      struct item *next; 	
X      char        *Filename;	 	/* ACTUAL Filename of that newsitem */
X      char        *PrintedFilename;	/* Filename that is DISPLAYED on the window */
X      char        *Subject;		/* String for the "subject:" title */
X      char        *Filesize;		/* The Size of the news item in BYTES */
X      ULONG        FileBytes;           /* NewsItem's size in bytes. */
X
X      UBYTE        compact;             /* "Subject:" compaction offset (0=none) */
X
X      UBYTE        Status;		/* Can be either READ or UNREAD */
X
X      UBYTE        fname_len;
X      UBYTE        fsize_len;
X      UBYTE        fsubj_len;
X
X      UBYTE        Pad;			/* Padding for alignment */
X  } ITEM;
X
X
X
X#ifdef MAIN
X
X/*FILE   *fp               = NULL;*/
X
XSHORT  NumItems          = 0;           /* # of items in the NewsItem array */
XSHORT  ClickSelect       = 2;		/* # of mouse clicks reqd. to select an item */
X
XBOOL   ShowNames         = TRUE;
XBOOL   ShowSizes         = TRUE;
XBOOL   CaseSensitive     = TRUE;
X
Xstruct Window *NV_Window = NULL;
X
XITEM          **ItemList = NULL;
X
X#else
X
XEXTERN FILE   *fp;
XEXTERN SHORT  NumItems;
XEXTERN SHORT  ClickSelect;
XEXTERN BOOL   ShowNames;
XEXTERN BOOL   ShowSizes;
XEXTERN BOOL   UseFileComms;
XEXTERN BOOL   CaseSensitive;
XEXTERN ITEM   **ItemList;     /* Array of pointers to ITEM structures */
XEXTERN struct Window *NV_Window;
X
X#endif
X
X
X#ifdef MAIN
Xstruct Library *IntuitionBase=NULL;
Xstruct Library *GfxBase=NULL;
Xstruct Library *DosBase=NULL;
X/*struct Library *IconBase=NULL;*/
X#else
XEXTERN struct Library *IntuitionBase;
XEXTERN struct Library *GfxBase;
XEXTERN struct DosBase *DosBase;
XEXTERN struct Library *IconBase;
X        
X#endif
X
X#define READ 1
X#define UNREAD 0
X
X
X             /* GLOBAL SWITCH TO ACTIVATE ROBERT'S CODE */
X
X#define ROBERTS_CODE
X      /*  --------------   E n d   G l o b a l s   --------------  */
END_OF_FILE
if test 3424 -ne `wc -c <'Globals.h'`; then
    echo shar: \"'Globals.h'\" unpacked with wrong size!
fi
# end of 'Globals.h'
fi
if test -f 'Main.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Main.c'\"
else
echo shar: Extracting \"'Main.c'\" \(8782 characters\)
sed "s/^X//" >'Main.c' <<'END_OF_FILE'
X/* ======================================================================= */
X/*                                                                         */
X/* PROGRAM:                         News Viewer                            */
X/*                                                                         */
X/* VERSION:      2.3                                                       */
X/*                                                                         */
X/*                                                                         */
X/* FILENAME:     Main.c                                                    */
X/*                                                                         */
X/* DESCRIPTION:  Major routine that gets everything started and handles    */
X/*               input events from Intuition and the shutdown of the       */
X/*               program.                                                  */
X/*                                                                         */
X/* AUTHOR:       Richard Frost (C) 1990                                    */
X/*                                                                         */
X/* DATE:         3rd April 1990                                            */
X/*                                                                         */
X/* ======================================================================= */
X
X#define MAIN
X#include "Defs.h"
X#include "Globals.h"
X#include "Display.h"
X#include "Gadgets.h"
X#include "Select.h"
X#include "Request.h"
X#include "CreateFileList.h"
X#include "WBench.h"
X
X			/* DBUG macros... */
X#define DBUG_OFF
X
X#ifdef DBUG_ON
X# define PRinit dbout = fopen("CON:210/12/200/200/DBUG OUTPUT->MAIN","w")
X# define PR(c)  if (dbout) { fprintf(dbout,(c)); fprintf(dbout,"..."); }
X# define PRret  if (dbout) fprintf(dbout,"Done.\n")
X# define PRend  if (dbout) fclose(dbout)
XFILE*  dbout;
X#else
X# define PRinit
X# define PR(c) 
X# define PRret 
X# define PRend 
X#endif
X
Xextern struct Library *OpenLibrary();
Xextern struct Message *GetMsg();
X
X
X
X/* ======================================================================= */
X/*                                  OpenLibs                               */
X/* ======================================================================= */
X
XVOID OpenLibs()
X{
X  
X  IntuitionBase = OpenLibrary("intuition.library",0L);
X  if (IntuitionBase == NULL)
X    ShutDown("Could not open Intuition Library!",FALSE);
X        
X  GfxBase = OpenLibrary("graphics.library",0L);
X  if (GfxBase == NULL)
X    ShutDown("Could not open Graphics Library!",FALSE);
X}
X
X/* ======================================================================= */
X/*                                  HandleMenu                             */
X/* ======================================================================= */
X
X/* Sort out all menu events */
X
XVOID HandleMenu(menu, item, subitem)
XUSHORT menu, item, subitem;
X{
X
X#define Toggle(v) ((v==TRUE) ?(v=FALSE) :(v=TRUE ))
X
X  switch(menu)
X   {
X     case PROJECT_MENU :
X         if (item == QUIT_ITEM)
X	   ShutDown("Thats all folks!",TRUE);
X         break;
X
X     case SETTINGS_MENU : 
X         {  
X          switch(item)
X            {
X              case CLICK_ITEM:
X		  if (subitem == SINGLE_SITEM)
X		    ClickSelect = 1;
X		  else
X		    ClickSelect = 2;
X                  break;
X
X	      case SUBJCOL_ITEM:
X	          SubjColour = subitem;
X		  ClearWindow();
X		  RedrawWindow();
X		  break;
X
X	      case SIZECOL_ITEM:
X	          SizeColour = subitem;
X		  ClearWindow();
X		  RedrawWindow();
X		  break;
X
X	      case BGNDCOL_ITEM:
X		  BgndColour = subitem;
X		  ClearWindow();
X		  RedrawWindow();
X		  break;
X
X	      case STRSRCH_ITEM:
X		  if (subitem == SENS_SITEM)
X 	            CaseSensitive = TRUE;
X	          else
X 	            CaseSensitive = FALSE;
X	          break;
X	    }
X	 }
X	 break;
X
X     case NEWSITEM_MENU : 
X         { 
X	   switch(item)
X	    { 
X               case SHOW_ITEM:
X		   if (subitem == NAME_SITEM)
X             	     Toggle(ShowNames);
X		   else
X		     Toggle(ShowSizes);
X   	           RedrawWindow();
X                   break;
X
X	      case SEARCH_ITEM:
X		   ErrorMsg("Sorry!! Not Implemented .. yet!");
X		   break;
X
X              case UNREAD_ITEM:
X		   if (UserChoice("Really UNREAD ALL news items?") == TRUE)
X		     UnreadAll();
X		   break;
X
X            }
X         }break;
X
X     case HISTORY_MENU : 
X         if (item == UPDATE_ITEM)
X 	   ErrorMsg("Not Implemented! Delete \".nv\" file.");
X         break;
X
X     case ABOUT_MENU : 
X	 AboutRequester();
X         break;
X
X   } /* end switch */
X  
X}
X
X/* ======================================================================== */
X/*                                    M a i n                               */
X/* ======================================================================== */
X
Xmain (argc,argv)
Xint argc;
Xchar *argv[];
X{
X BOOL   MouseMoved = FALSE,
X        EndProgram = FALSE;
X SHORT  x,selrow;
X USHORT qualif;             /* Message class from Intuition */
X LONG   secs,mics;
X ULONG  class,code;         /* Menu code from Intuition */
X
X struct IntuiMessage *message;
X struct Gadget *gadptr;
X
X extern int Enable_Abort;   /* Aztec's CONTROL-C DISABLE variable */
X
X
X
X
X /* DISABLE CONTROL-C INTERRUPTS */
X Enable_Abort = 0;
X
X OpenLibs();
X 
X PRinit;
X
X PR("CreateFileList..\n");
X
X NumItems = CreateFileList(argc,argv);   /* Call Rob's code to set up lists etc. */
X 
X PR("CloseMsgWindow...");
X CloseMsgWindow();	/* Delete the Initial Requester IF its still up! */
X PR("CMW Alldone\n");
X
X PR("MakeWindow");
X MakeWindow(); PRret;
X 
X PR("SetGlobalVars");
X SetGlobalVars(); PRret;
X
X PR("SetWindowVars");
X SetWindowVars(); PRret;
X
X PR("ClearWindow");
X ClearWindow(); PRret;
X
X PR("RedrawWindow");
X RedrawWindow(); PRret;
X
X PR("SetKnobPos");
X SetKnobPos();  PRret;
X
X PR("SetKnobSize");
X SetKnobSize(); PRret;
X
X PR("DrawArrow");
X DrawArrow();   PRret;
X
X 
X /* Initialize the DEFAULT VIEWER window size! */
X
X InitDV(NV_Window->TopEdge,NV_Window->LeftEdge,
X	NV_Window->Width,NV_Window->Height);
X
X 
X
X                     /*   MAIN PROGRAM MAJOR EVENT LOOP!    */
X
X
X for (;;)   /* INFINITE LOOP!! */
X {
X    /* Wait until a signal occurs... */
X    Wait(1L << NV_Window->UserPort->mp_SigBit);  
X
X    MouseMoved= FALSE;
X
X    while( message = (struct IntuiMessage *) GetMsg(NV_Window->UserPort) )
X      {
X
X           /* If a message was recieved .... */
X
X           class  = message->Class;         /* Store the message class! */
X           code   = message->Code;          /* Store the code */
X           qualif = message->Qualifier;     /* Store the qualifier */
X           secs   = message->Seconds;
X           mics   = message->Micros;
X                                            /* Store away the Gadget address */                        
X           gadptr = (struct Gadget *) message->IAddress;
X
X           ReplyMsg(message);
X
X
X
X          /* Here is the 'case' statement which SORTS OUT all incoming MESSAGES */
X
X           switch (class)
X            {
X
X#ifdef KEYS
X             case  RAWKEY: HandleKey(code,qualif);
X                           break;
X#endif
X
X             case  INACTIVEWINDOW:   /* The user just unselected my window!!! */
X                           break;
X
X             case  NEWSIZE:
X			   SetWindowVars();
X			   /* There is NO EraseArrow() as it is
X			      not needed due to ClearWindow() &&
X			      EraseArrow() can write on the gadgets for some
X			      window re-sizes!
X			   */			
X			   ClearWindow();
X			   SyncDisplay();
X			   DrawArrow();
X			   SetKnobPos();
X                           SetKnobSize();
X                           break;        	
X
X	     case  GADGETDOWN:
X			   StartSelectGadget(gadptr);
X			   break;
X
X             case  GADGETUP:			   
X 			   EndSelectGadget(gadptr);
X                           break;
X
X             case  MOUSEMOVE :
X			   MouseMoved = TRUE;
X                           break;
X
X             case  MOUSEBUTTONS:
X			   switch (code)
X                             {
X
X                               case SELECTDOWN:
X				   if (TouchedItem(&selrow) == TRUE)
X				     SelectMouse(selrow,secs,mics);
X                                   break;
X
X                               case SELECTUP:
X                                   break;
X                             }
X                           break;
X
X	     case  MENUPICK:
X			   if (MENUNUM(code) != MENUNULL)
X                             HandleMenu(MENUNUM(code),ITEMNUM(code),SUBNUM(code));
X                           break;
X                         
X			   
X             case  CLOSEWINDOW:
X			   EndProgram = TRUE;
X                           break;
X
X            }/* end Switch */
X
X
X      } /*end While Loop */
X
X    if (MouseMoved)
X	MoveSlider();    /* A slider has moved */
X
X    if (EndProgram) break;
X
X }/* end infinite FOR LOOP */
X
X ShutDown("Thats all folks!",TRUE);
X}
END_OF_FILE
if test 8782 -ne `wc -c <'Main.c'`; then
    echo shar: \"'Main.c'\" unpacked with wrong size!
fi
# end of 'Main.c'
fi
if test -f 'Requester/Requester.pw.uu' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Requester/Requester.pw.uu'\"
else
echo shar: Extracting \"'Requester/Requester.pw.uu'\" \(3839 characters\)
sed "s/^X//" >'Requester/Requester.pw.uu' <<'END_OF_FILE'
Xbegin 666 Requester.pw
XM4&]W97)7:6YD;W=S('8R+C4@+"`@:6UP;W)T960@8GD@455!4E1%6"!C<F%C1
XM:RUT96-H;F]L;V=I97,@,3DX."`@("`@("`@("`@```#_0````D@`8#_````?
XM`0`````!``````YR86TZ4F5Q1V%D<RYH```````````!``,0```"$&@`!0`%?
XM_____P`````````````````````````````````$`/@3F``!`````0`!`P"8!
XM`!X!:`!Z``4`!?____\````!```C<8``#/_L`$H`#P`.``,``0#X:B``^__@:
XM````````````````````(K.H_____P,```4`(W$T````````````2P```$L`?
XM$````!````````````!*``\``@`!Q+@#``````````$L`````````````#__F
XM_________0`___________H`/__Q^/___Y_]`#__F.#___^/^@`__QQN/\8QC
XMC_T`/_X^<QS.,8_Z`#_^/GP9QG&/_0`__QYFFN:QG_H`/_^,8PQ#,9_]`#__$
XM\.,<9S./^@`__\'____A#_T`/_______@Y_Z`#555555555550``````````N
XM````____________P,```````````\#/___________`S_\/Q____O__P,_^L
XMYY____Q__\#/_?.1^#G.?__`S_GYC/<QSG__P,_Y^8/F.8[__\#/_/N991E/G
XM___`S_YWG/.\SO__P,__#____\Q__\#/______X>___`S___________P-__'
XM_________\#____________```````!*``\``@`"WL`#``````````$L````;
XM`````````````````````0`%5555555555<`"JJ@J*JJJHJO``55$$!5554%1
XM5P`*J@@J*H(@BJ\`!504411$$057``JJ*B@(@B"*KP`%511$$$01%5<`"JJ(M
XM(@@"((JO``554$$411$%5P`*JH"JJJJ@"J\`!5555555`157`!__________T
XM_P``````````````____________P/___________L#___________C`__]?Y
XMU______XP/_^[[____[_^,#__??5_7W??_C`__O[KO^[[O_XP/_]_=?W?=__E
XM^,#__ON[[[OO__C`__]WW??]W__XP/__K____^[_^,#_______]?__C`____S
XM_______XP.```````````,#____________`````"``(``<`^&E0`/AQ8`#X3
XM<<@`^'*@`"!9:``@6[`````(3VMA>4=A9``````!``````$`````"4]+05E?5
XM1T%$``````$``````0``(W'8_ZK_[`!*``\`'@`#``$`(9F0`"+)Z```````F
XM`````````````"+-H/____\#```%`"-QO````````````$L```!+`!`````09
XM````````````2@`/``(``M_X`P`````````!+``````````````_________=
XM__T`/__________Z`#___'____^?_0`__^8_____C_H`/__''XS'XX_]`#__-
XMCXS=9A&/^@`__X^8SF/!C_T`/__'F,QF,9_Z`#__XQ\/A^&?_0`___P\'`\#K
XMC_H`/__P?_Q__P_]`#_____\?_^?^@`U55555555554``````````````/__F
XM_________\#```````````/`S___________P,__P_____[__\#/_[G____\-
XM?__`S_]\^',\'G__P,_^?G<BF>Y__\#/_GYG,9X^___`S_\^YW.[S___P,__M
XMG?#P?![__\#/_\/_\__\?__`S_____/__O__P,___________\#?________K
XM___`____________P```````2@`/``(``N$P`P`````````!+```````````3
XM``````````````$`!55555555557``JJJ"JJJJJ*KP`%54055555!5<`"JJ"Q
XM"HB"HHJO``55!0151!$%5P`*JHJ(BB*`BJ\`!55%$$1$$157``JJH@H*@J"*-
XMKP`%5504%`4!!5<`"JJ@*J@JJ@JO``55555455455P`?__________\`````?
XM`````````/___________\#___________[`___________XP/__U_______M
XM^,#__[O____^__C`__]]_7=]7W_XP/_^_O^JN^[_^,#__W]W==]___C`__^^C
XM[_N[[__XP/__W?7U?5__^,#__^O_^__^__C`______?____XP/__________:
XM^,#@``````````#`____________P`````@`&``'`"!Q@``@?0``('W(`"!^G
XMD``A2+@`(4GH````"$]O<'-'860``````0`````!``````E/3U!37T=!1```O
XM```!``````$``"-RV``-`!T!3`!!`````P`!`"-R!```````````````````$
XM``#__P`C#-#_____`@,!!0`C<A0```````````%-```!30!"````0@``````-
XM````````"P````$`(9$H`"&18``BL`@`(R7P`",I^``C<C`````'0F]R9&5RX
XM``````$``````0`````!``````$``````0```````'<`!P""`!``!P`#``$`@
XM(W)``````````````````````/__`"-R8/____\#```%`"-S%```````````V
XM`(,```"#`!$````1````````````@@`0``(``N)H`P`````````"0/______(
XM_________/_____``/\_S________\_S\______``/_/\_________/Y^?__(
XM___``/^?Y________^?S_______``/^?Y________^?S_______``/\_S___Q
XM_____^?/_______``/\[[^?Y__\__^?/S_/\___``/YS_Y[YYYSG_^?_S\]\4
XM\\_``/YS_SSY_YSG_^?_SYY\_\_``/SS_GSS__G__\__GSYY___``/SY_G_YD
XM__S__^?_GS_\___``/GY_/_S__\__\__/G_Y___``/GY_/_SY_.?_\__/G_YQ
XM\__``//Y_//SS^<__\_^?GGYY__``,_\_G_SS^?__\_\_S_YY__``/______I
XM_______________``/_______________\_____``/_^?Y_________/SY__&
XM___``/__/G________^?/Y_____``/_W//________\^?______``/_W//__!
XM______\^?______``/_G.?________\Y_______``/_GF?^?Y[G^?_\Y_G_/^
XM\]S``/_/D_F?GF><__\G_/S/SS/``/_/D_//GF><__\G_/GGSS/``/^?I^>?I
XM),_G__Y/^?//DF?``/^?Y_^?II_S__^?^?_/TT_``/\_S\__S3_S__\_\^?_K
XMYI_``/\_S\__GSYS__\_\^?_SY_``/Y_G\Y_//SG__S_Y^<_GG_``/^?G_S_8
XM//_/__S_\_Y_GG_``/_____________________``````"@``P`!`"-S,``C6
XM<T``(W-0`"-S8``C<W``(W.`````"$Y65&ET;&4``````0`````!``````$`<
X*`````0`````!```CE
X``
Xend
Xsize 2710
END_OF_FILE
if test 3839 -ne `wc -c <'Requester/Requester.pw.uu'`; then
    echo shar: \"'Requester/Requester.pw.uu'\" unpacked with wrong size!
fi
# end of 'Requester/Requester.pw.uu'
fi
if test -f 'ShutDown.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'ShutDown.c'\"
else
echo shar: Extracting \"'ShutDown.c'\" \(4337 characters\)
sed "s/^X//" >'ShutDown.c' <<'END_OF_FILE'
X/* ======================================================================= */
X/*                                                                         */
X/* PROGRAM:                         News Viewer                            */
X/*                                                                         */
X/* VERSION:      2.3                                                       */
X/*                                                                         */
X/*                                                                         */
X/* FILENAME:     ShutDown.c                                                */
X/*                                                                         */
X/* DESCRIPTION:  Major routine that deallocates EVERYTHING, closes all     */
X/*               libraries and unlocks the directory.                      */
X/*                                                                         */
X/* AUTHORS:      Robert Wozniak & Richard Frost (C) 1990                   */
X/*                                                                         */
X/* DATE:         1st April  1990                                           */
X/*                                                                         */
X/* ======================================================================= */
X
X#include <stdio.h>
X#include <libraries/dos.h>
X#include <libraries/dosextens.h>
X
X#include "Globals.h"
X#include "Request.h"
X#include "WBench.h"
X#include "CreateFileList.h"
X#include "WindData.h"
X
X
X
X
Xvoid WalkList();
Xvoid SaveNVfile();
X
X/* ------------------------ Subroutine to close everything and end ---------------*/
XVOID ShutDown(mess,state)
XUBYTE *mess;
XBOOL state;
X{
X
X  int t;
X  ITEM *old,*new;
X
X
X   if (mess != NULL  && state == FALSE)
X     ErrorRequester(mess);       /* Print error (if any)   */
X
X   SaveReadHistory(); 
X
X   if (dirlock && WBlock != TRUE) UnLock(dirlock);
X      
X   if (did_cd == TRUE) CurrentDir(old_cd);
X
X
X   if (my_fhand) Close(my_fhand);
X
X
X   /* Clear the menu strip BEFORE closing the window!! ... WANNA GURU???? :-) */
X
X   ClearMenuStrip(NV_Window,&Menu1);
X
X   if (NV_Window != NULL)   CloseWindow(NV_Window);
X
X
X   WalkList();
X
X   CloseMsgWindow();
X
X   if (DosBase)  CloseLibrary(DosBase);       
X   if (IconBase) CloseLibrary(IconBase);
X
X   if (my_fib)   FreeMem( my_fib, sizeof(struct FileInfoBlock));        
X   if (ItemList) FreeMem( ItemList, Items * sizeof(ITEM *));       
X   
X		      /* Close the Libaries safely! */
X
X  if (IntuitionBase != NULL)  CloseLibrary(IntuitionBase);
X  if (GfxBase != NULL)        CloseLibrary(GfxBase);
X
X  exit(state);
X}
X
Xvoid WalkList()
X{
X/***************** Walk the Item list, freeing as we go *****************
X
X             (note we can't use the pointer array as it may not have been 
X             built before the half finished list aborted )             */     
X                                                                       
Xregister ITEM *old,*new;
X
X  for( new=old = firsti.next; new; ) 
X  {
X  /* Have to grab next pointer before current ("old") struct dissapears! */           
X        /* printf("Walk %d: %d\n",t,old); */
X        new = old -> next;
X
X        FreeMem( old->Filename,strlen( old->Filename) +1 );
X        FreeMem( old->PrintedFilename,strlen(old->PrintedFilename)+1);
X        FreeMem( old->Filesize,strlen( old->Filesize) +1 );
X        
X        if (old->compact == 0)   /* It has an Alloc'ed string, not a just pointer */
X	  FreeMem( old->Subject ,strlen( old->Subject)  +1 );
X
X        FreeMem( old,sizeof(ITEM));
X        old = new;
X  }
X}
X
X
X
X/* -------------------------------------------------------------------------*/
X                              SaveReadHistory()
X/* -------------------------------------------------------------------------*/
X
X{
X register int t;
X register FILE *fpunr;
X
X  if (Items >0)			/* SAVE ONLY IF THERE ARE ITEMS!!!!!!! */
X    {
X       if ( (fpunr = fopen(".unr","w")) == 0 ) {
X            ErrorRequester("Couldn't open .unread to save"); 
X            return 0;
X       }
X
X  
X       StatMsg("Updating .unread file ...");
X
X       for(t=0; t<Items; t++)
X        {
X           fprintf(fpunr,"%s %d\n",ItemList[t]-> Filename, ItemList[t]-> Status );
X        }
X
X       fclose(fpunr);
X       StatMsg(".unread file saved");
X
X       SaveInfoFile(".unr");
X       return 1;
X   }
X  
X  return 0;
X}
X
END_OF_FILE
if test 4337 -ne `wc -c <'ShutDown.c'`; then
    echo shar: \"'ShutDown.c'\" unpacked with wrong size!
fi
# end of 'ShutDown.c'
fi
if test -f 'ViewGads.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'ViewGads.h'\"
else
echo shar: Extracting \"'ViewGads.h'\" \(5160 characters\)
sed "s/^X//" >'ViewGads.h' <<'END_OF_FILE'
X
Xstatic USHORT DVImageData1[] = {
X	0xFFFF,0xFF3F,0xFF3F,0xFFF3,0xFFE7,0xFFCF,0xFF9F,0xFF3F,
X	0xFF7F,0xFFFF,0xC003,0xFFFF,0xF9FF,0xF9FF,0x9FFF,0xCFFF,
X	0xE7FF,0xF3FF,0xF9FF,0xFCFF,0xFFFF,0xFFFF
X};
X
Xstatic struct Image DVImage1 = {
X	0,0,	/* XY origin relative to container TopLeft */
X	16,11,	/* Image width and height in pixels */
X	2,	/* number of bitplanes in Image */
X	DVImageData1,	/* pointer to ImageData */
X	0x0003,0x0000,	/* PlanePick and PlaneOnOff */
X	NULL	/* next Image structure */
X};
X
Xstatic USHORT DVImageData2[] = {
X	0xFFFF,0xF9FF,0xF9FF,0x8AAF,0xC55F,0xE2BF,0xF17F,0xF8FF,
X	0xFDFF,0xFFFF,0xC003,0xFFFF,0xFF3F,0xFF3F,0xFFF3,0xFFE7,
X	0xFFCF,0xFF9F,0xFF3F,0xFE7F,0xFFFF,0xFFFF
X};
X
Xstatic struct Image DVImage2 = {
X	0,0,	/* XY origin relative to container TopLeft */
X	16,11,	/* Image width and height in pixels */
X	2,	/* number of bitplanes in Image */
X	DVImageData2,	/* pointer to ImageData */
X	0x0003,0x0000,	/* PlanePick and PlaneOnOff */
X	NULL	/* next Image structure */
X};
X
Xstatic struct Gadget DVDownButton = {
X	NULL,	/* next gadget */
X	-15,-19,	/* origin XY of hit box relative to window TopLeft */
X	16,11,	/* hit box width and height */
X	GADGHIMAGE+GADGIMAGE+GRELBOTTOM+GRELRIGHT,	/* gadget flags */
X	RELVERIFY+GADGIMMEDIATE+RIGHTBORDER,	/* activation flags */
X	BOOLGADGET,	/* gadget type flags */
X	(APTR)&DVImage1,	/* gadget border or image to be rendered */
X	(APTR)&DVImage2,	/* alternate imagery for selection */
X	NULL,	/* first IntuiText structure */
X	NULL,	/* gadget mutual-exclude long word */
X	NULL,	/* SpecialInfo structure */
X	DOWNBUTTON,	/* user-definable data */
X	NULL	/* pointer to user-definable data */
X};
X
Xstatic USHORT DVImageData3[] = {
X	0xFFFF,0xFF7F,0xFF3F,0xFF9F,0xFFCF,0xFFE7,0xFFF3,0xFF3F,
X	0xFF3F,0xFFFF,0xC003,0xFFFF,0xFCFF,0xF9FF,0xF3FF,0xE7FF,
X	0xCFFF,0x9FFF,0xF9FF,0xF9FF,0xFFFF,0xFFFF
X};
X
Xstatic struct Image DVImage3 = {
X	0,0,	/* XY origin relative to container TopLeft */
X	16,11,	/* Image width and height in pixels */
X	2,	/* number of bitplanes in Image */
X	DVImageData3,	/* pointer to ImageData */
X	0x0003,0x0000,	/* PlanePick and PlaneOnOff */
X	NULL	/* next Image structure */
X};
X
Xstatic USHORT DVImageData4[] = {
X	0xFFFF,0xFDFF,0xF8FF,0xF17F,0xE2BF,0xC55F,0x8AAF,0xF9FF,
X	0xF9FF,0xFFFF,0xC003,0xFFFF,0xFE7F,0xFF3F,0xFF9F,0xFFCF,
X	0xFFE7,0xFFF3,0xFF3F,0xFF3F,0xFFFF,0xFFFF
X};
X
Xstatic struct Image DVImage4 = {
X	0,0,	/* XY origin relative to container TopLeft */
X	16,11,	/* Image width and height in pixels */
X	2,	/* number of bitplanes in Image */
X	DVImageData4,	/* pointer to ImageData */
X	0x0003,0x0000,	/* PlanePick and PlaneOnOff */
X	NULL	/* next Image structure */
X};
X
Xstatic struct Gadget DVUpButton = {
X	&DVDownButton,	/* next gadget */
X	-15,-30,	/* origin XY of hit box relative to window TopLeft */
X	16,11,	/* hit box width and height */
X	GADGHIMAGE+GADGIMAGE+GRELBOTTOM+GRELRIGHT,	/* gadget flags */
X	RELVERIFY+GADGIMMEDIATE+RIGHTBORDER,	/* activation flags */
X	BOOLGADGET,	/* gadget type flags */
X	(APTR)&DVImage3,	/* gadget border or image to be rendered */
X	(APTR)&DVImage4,	/* alternate imagery for selection */
X	NULL,	/* first IntuiText structure */
X	NULL,	/* gadget mutual-exclude long word */
X	NULL,	/* SpecialInfo structure */
X	UPBUTTON,	/* user-definable data */
X	NULL	/* pointer to user-definable data */
X};
X
Xstatic struct PropInfo DVDVSliderSInfo = {
X	AUTOKNOB+FREEVERT,	/* PropInfo flags */
X	-1,-1,	/* horizontal and vertical pot values */
X	-1,-1,	/* horizontal and vertical body values */
X};
X
Xstatic struct Image DVImage5 = {
X	0,0,	/* XY origin relative to container TopLeft */
X	8,52,	/* Image width and height in pixels */
X	0,	/* number of bitplanes in Image */
X	NULL,	/* pointer to ImageData */
X	0x0000,0x0000,	/* PlanePick and PlaneOnOff */
X	NULL	/* next Image structure */
X};
X
Xstatic struct Gadget DVSlider = {
X	&DVUpButton,	/* next gadget */
X	-15,10,	/* origin XY of hit box relative to window TopLeft */
X	16,-41,	/* hit box width and height */
X	GRELRIGHT+GRELHEIGHT,	/* gadget flags */
X	RELVERIFY+GADGIMMEDIATE+FOLLOWMOUSE+RIGHTBORDER,	/* activation flags */
X	PROPGADGET,	/* gadget type flags */
X	(APTR)&DVImage5,	/* gadget border or image to be rendered */
X	NULL,	/* alternate imagery for selection */
X	NULL,	/* first IntuiText structure */
X	NULL,	/* gadget mutual-exclude long word */
X	(APTR)&DVDVSliderSInfo,	/* SpecialInfo structure */
X	SLIDER,	/* user-definable data */
X	NULL	/* pointer to user-definable data */
X};
X
X#define DVGadgetList1 DVSlider
X
Xstatic struct NewWindow DVNewWindowStructure1 = {
X	37,36,	/* window XY origin relative to TopLeft of screen */
X	513,97,	/* window width and height */
X	1,3,	/* detail and block pens */
X	NEWSIZE+MOUSEBUTTONS+MOUSEMOVE+GADGETDOWN+GADGETUP+CLOSEWINDOW,	/* IDCMP flags */
X	WINDOWSIZING+WINDOWDRAG+WINDOWDEPTH+WINDOWCLOSE+SIZEBRIGHT+ACTIVATE+RMBTRAP+NOCAREREFRESH,	/* other window flags */
X	&DVSlider,	/* first gadget in gadget list */
X	NULL,	/* custom CHECKMARK imagery */
X	NULL,	/* window title */
X	NULL,	/* custom screen pointer */
X	NULL,	/* custom bitmap */
X	100,54,	/* minimum width and height */
X	-1,-1,	/* maximum width and height */
X	WBENCHSCREEN	/* destination screen type */
X};
X
X
X/* end of PowerWindows source generation */
END_OF_FILE
if test 5160 -ne `wc -c <'ViewGads.h'`; then
    echo shar: \"'ViewGads.h'\" unpacked with wrong size!
fi
# end of 'ViewGads.h'
fi
if test -f 'WBench.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'WBench.c'\"
else
echo shar: Extracting \"'WBench.c'\" \(8885 characters\)
sed "s/^X//" >'WBench.c' <<'END_OF_FILE'
X/* ======================================================================= */
X/*                                                                         */
X/* PROGRAM:                         News Viewer                            */
X/*                                                                         */
X/* VERSION:      2.3a                                                      */
X/*                                                                         */
X/*                                                                         */
X/* FILENAME:     WBench.c                                                  */
X/*                                                                         */
X/* DESCRIPTION:  This module contains routines that involve the WorkBench  */
X/*		 such as obtaining the Lock to the directory which contains*/
X/* 		 the icon hit & Loading and Saving .info files to obtain   */
X/*		 user settings etc.					   */
X/*                                                                         */
X/* AUTHOR:       Richard Frost (C) 1990                                    */
X/*                                                                         */
X/* DATE:         23rd March 1990                                           */
X/*                                                                         */
X/* ======================================================================= */
X
X#include "Defs.h"
X#include "Globals.h"
X#include "Request.h"
X#include "CreateFileList.h"
X
X
Xstatic USHORT ImageData1[] = {
X	0xFFFF,0xFFFF,0xE000,0xABF1,0x0A7F,0xE000,0xFFF5,0x20FF,
X	0xE000,0xFFFF,0xFFFF,0xE000,0x5555,0x5555,0x4000,0xFFFF,
X	0xFFFF,0xE000,0xD558,0x0600,0x6000,0xEAB8,0x57FF,0xE000,
X	0xC019,0xE6AA,0xE000,0xFFF8,0x87FF,0xE000,0xC018,0x0600,
X	0x6000,0xFFFF,0xFE4D,0x6000,0xC018,0x0600,0x6000,0xFFFF,
X	0xFFFF,0xE000,0xC01A,0xD66A,0xE000,0xFFFF,0xFFE0,0xE000,
X	0xD5B8,0x07FF,0xE000,0xFFFF,0xFEA6,0xE000,0xC438,0x075D,
X	0xE000,0xFFFF,0xFEFF,0xE000,0xC038,0x0700,0xE000,0xFFFF,
X	0xFFFF,0xE000,0x0000,0x0000,0x0000,0x540E,0xF580,0x0000,
X	0x000A,0xDF00,0x0000,0x0000,0x0000,0x0000,0xAAAA,0xAAAA,
X	0xA000,0x0000,0x0000,0x0000,0x2AA7,0xF9FF,0x8000,0x1547,
X	0xA800,0x0000,0x3FE6,0x1955,0x0000,0x0007,0x7800,0x0000,
X	0x3FE7,0xF9FF,0x8000,0x0000,0x01B2,0x8000,0x3FE7,0xF9FF,
X	0x8000,0x0000,0x0000,0x0000,0x3FE5,0x2995,0x0000,0x0000,
X	0x001F,0x0000,0x2A47,0xF800,0x0000,0x0000,0x0159,0x0000,
X	0x3BC7,0xF8A2,0x0000,0x0000,0x0100,0x0000,0x3FC7,0xF8FF,
X	0x0000,0x0000,0x0000,0x0000
X};
X
Xstatic struct Image Image1 = {
X	0,0,	/* XY origin relative to container TopLeft */
X	35,22,	/* Image width and height in pixels */
X	2,	/* number of bitplanes in Image */
X	ImageData1,	/* pointer to ImageData */
X	0x0003,0x0000,	/* PlanePick and PlaneOnOff */
X	NULL	/* next Image structure */
X};
X
Xstatic USHORT ImageData2[] = {
X	0xFFF9,0xFFFF,0xE000,0xABF0,0x4180,0x6000,0xFFF9,0x1FFF,
X	0xE000,0xFFF1,0xC180,0x6000,0x5559,0xF1FF,0xE000,0xFFF1,
X	0xFCA9,0x6000,0xD559,0xFF1F,0xE000,0xEAB1,0xFFC0,0x6000,
X	0xC019,0xFFF1,0xE000,0xFFF1,0xFFFC,0x6000,0xC019,0xFFFF,
X	0x2000,0xFFF0,0x0000,0x0000,0xC019,0x56AA,0xE000,0xFFFF,
X	0xFFFF,0xE000,0xC01A,0xD66A,0xE000,0xFFFF,0xFFE0,0xE000,
X	0xD5B8,0x07FF,0xE000,0xFFFF,0xFEA6,0xE000,0xC438,0x075D,
X	0xE000,0xFFFF,0xFEFF,0xE000,0xC038,0x0700,0xE000,0xFFFF,
X	0xFFFF,0xE000,0x0006,0x0000,0x0000,0x540F,0xBE7F,0x8000,
X	0x0006,0xE000,0x0000,0x000E,0x3E7F,0x8000,0xAAA6,0x0E00,
X	0x0000,0x000E,0x0356,0x8000,0x2AA6,0x00E0,0x0000,0x154E,
X	0x003F,0x8000,0x3FE6,0x000E,0x0000,0x000E,0x0003,0x8000,
X	0x3FE6,0x0000,0xC000,0x000F,0xFFFF,0xE000,0x3FE6,0xA955,
X	0x0000,0x0000,0x0000,0x0000,0x3FE5,0x2995,0x0000,0x0000,
X	0x001F,0x0000,0x2A47,0xF800,0x0000,0x0000,0x0159,0x0000,
X	0x3BC7,0xF8A2,0x0000,0x0000,0x0100,0x0000,0x3FC7,0xF8FF,
X	0x0000,0x0000,0x0000,0x0000
X};
X
Xstatic struct Image Image2 = {
X	0,0,	/* XY origin relative to container TopLeft */
X	35,22,	/* Image width and height in pixels */
X	2,	/* number of bitplanes in Image */
X	ImageData2,	/* pointer to ImageData */
X	0x0003,0x0000,	/* PlanePick and PlaneOnOff */
X	NULL	/* next Image structure */
X};
X
Xstatic struct Gadget Gadget1 = {
X	NULL,	/* next gadget */
X	33,21,	/* origin XY of hit box relative to window TopLeft */
X	35,23,	/* hit box width and height */
X	GADGHIMAGE+GADGIMAGE,	/* gadget flags */
X	RELVERIFY+GADGIMMEDIATE,	/* activation flags */
X	BOOLGADGET,	/* gadget type flags */
X	(APTR)&Image1,	/* gadget border or image to be rendered */
X	(APTR)&Image2,	/* alternate imagery for selection */
X	NULL,	/* first IntuiText structure */
X	NULL,	/* gadget mutual-exclude long word */
X	NULL,	/* SpecialInfo structure */
X	NULL,	/* user-definable data */
X	NULL	/* pointer to user-definable data */
X};
X
X/* PATCHES to PWindows output:
X
X	1) Added Gadget Activation flag: GADGIMMEDIATE
X	2) Increased the HITBOX HEIGHT of the Gadget to be 1 pixel higher than
X	   than height of the Image data.
X	3) Added STATIC infront of each struct
X*/
X
X#define DEBUG
X#ifdef DEBUG
Xchar *ToolTypes[] = { "WINDOW=CON:0/12/200/30/NewsView Vr2.3a Output","" };
X#endif
X
Xstruct DiskObject NV_Icon;
X
XBOOL WBlock=FALSE; 
X
Xextern struct WBStartup *WBenchMsg;
X
X
X
X/* Return the Name of News Directory */
X
XPUBLIC struct FileLock *GetNewsDir()
X{
X  struct FileLock *tlock1,*tlock2,*DupLock(),*Lock(),*UnLock(),*ParentDir();
X  struct WBArg *arg;
X
X#define OLD
X
X#ifdef OLD
X  WBlock = TRUE;
X#else
X  WBlock = FALSE;
X#endif
X  
X  switch (WBenchMsg->sm_NumArgs)
X   {
X     case 1: 
X#ifdef OLD
X	     arg = &WBenchMsg->sm_ArgList[0];      /* CLICKED NV icon ONLY */
X	     return (struct FileLock *) arg->wa_Lock;
X#else
X	     return (struct FileLock *) Lock("",ACCESS_READ);
X#endif
X
X     case 2 :
X     default:
X#ifdef OLD
X	     arg = &WBenchMsg->sm_ArgList[1];      /* Clicked .nv file? */
X     	     return (struct FileLock *) arg->wa_Lock;
X#else
X             arg   = &WBenchMsg->sm_ArgList[1];      /* Clicked .nv file? */
X
X	     printf("Locking onto file: [%s]\n",arg->wa_Name);
X
X	     if ((tlock1 = Lock(arg->wa_Name,ACCESS_READ)) == NULL)
X	       {
X		  printf("Failed initial lock to icon file: %s",arg->wa_Name);
X	          return NULL;
X	       }
X
X  	     if (Examine(tlock1,my_fib))
X	       {
X                 if ( my_fib->fib_EntryType < 0 )      /* A file argument! */
X		   {
X		      printf("A FILE ICON ARGUMENT!!\n");
X		      /* Obtain the lock to the parent dir of that file */
X
X		      tlock2 = ParentDir(tlock1);
X		      UnLock(tlock1);
X		      printf("GOT A LOCK TO ITS PARENT DIR = %8x!!\n",tlock2);
X		      return DupLock(tlock2);
X		   }
X	 	 else				   /* A Directory! */
X		   {
X		     printf("DIRECTORY ARGUMENT!!\n");
X		     UnLock(tlock1);
X	             return Lock(arg->wa_Name,ACCESS_READ);
X		   }
X	       }
X	     else
X	       {
X	         printf("Error in examining ICON file %s\n",arg->wa_Name);
X		 UnLock(tlock1);
X		 return NULL;
X	       }
X#endif
X
X   }
X
X /* AT THIS POINT COULD READ THE .info FILE! */
X /* simply ReadInfoFile(arg->wa_name,DiskObj) */
X}
X
X/* Make the icon to save  .. */
X
XPRIVATE VOID ConstructIcon(diskobj)
Xstruct DiskObject *diskobj;
X{
X  /* Init all the disk object fields .. */
X
X  diskobj->do_Magic		= WB_DISKMAGIC;
X  diskobj->do_Version 		= WB_DISKVERSION;
X  diskobj->do_Gadget 		= Gadget1; 	/* <= STRUCTURE COPY */
X  diskobj->do_Type		= WBPROJECT;
X  diskobj->do_DefaultTool	= ":NV";
X
X#ifdef DEBUG
X  diskobj->do_ToolTypes		= ToolTypes;
X#else
X  diskobj->do_ToolTypes		= NULL;
X#endif
X
X  diskobj->do_CurrentX		= NO_ICON_POSITION;
X  diskobj->do_CurrentY		= NO_ICON_POSITION;
X  diskobj->do_DrawerData	= NULL;		/* The icon does not open a window */
X  diskobj->do_ToolWindow	= NULL;
X  diskobj->do_StackSize		= NULL;
X}
X
X/* TEST to see if a file exists ... */
X
XPUBLIC BOOL FileExists(file)
Xchar *file;
X{
X  struct FileLock *checklock,*Lock(),*UnLock();
X
X  if ( (checklock = Lock(file,ACCESS_READ))  ==  NULL)
X    return FALSE;
X  else
X    {
X      UnLock(checklock);
X      return TRUE;
X    }
X}
X
X
X/* NOTE: I assume we are already in the directory that contains the icon */
X
XPUBLIC long SaveInfoFile(filename)
Xchar *filename;
X{
X  char FileName[50];		/* 45 char filename .. BIG ENOUGH ??? */
X  char err[40];
X  struct FileLock   *checklock,*Lock(),*UnLock();
X  long status=NULL;
X
X
X
X  if (IconBase == NULL) return 0;	/* No Icon Library! */
X
X  strcpy(FileName,filename);
X  strcat(FileName,".info");	/* Get the REAL filename .info added */
X
X  /* Does the icon exist already ??? see if we can Lock() it */
X  /* If it does, then DONT save the icon */
X  /* MAY change this later so SetUPs can be placed in the ToolTypes
X     of the icon.
X   */
X 
X  if ( (checklock = Lock(FileName,ACCESS_READ))  ==  NULL )
X    {
X
X      /* Aha, we have not saved an icon before! .. */
X
X      ConstructIcon(&NV_Icon);
X
X      status = PutDiskObject(filename,&NV_Icon);
X
X      if (status == 0)
X	{
X	  status = IoErr();
X	  sprintf(err,"PutDiskObject: Error code %2d\n",status);
X	  ErrorMsg(err);
X	}
X
X      return status;
X    }
X  else
X    UnLock(checklock);
X}
X
END_OF_FILE
if test 8885 -ne `wc -c <'WBench.c'`; then
    echo shar: \"'WBench.c'\" unpacked with wrong size!
fi
# end of 'WBench.c'
fi
echo shar: End of archive 2 \(of 6\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 3 4 5 6 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 6 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
-- 
Mail submissions (sources or binaries) to <amiga@cs.odu.edu>.
Mail comments to the moderator at <amiga-request@cs.odu.edu>.
Post requests for sources, and general discussion to comp.sys.amiga.