home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d6xx / d632 / printfiles.lha / PrintFiles / Source / prf_list.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-07  |  1.5 KB  |  70 lines

  1. /* prf_list.c */
  2. /* V1.1 9-3-92 */
  3.  
  4. #include "prf.h"
  5.  
  6. void InsertName(struct prf_info *info)
  7. {
  8.  struct FileNameNode *fnn;
  9.  long                 insert = FALSE;
  10.  long                *cmd;
  11.  UBYTE               *string;
  12.  string = (UBYTE *)info->Special1;
  13.  cmd    = (long  *)info->Special2;
  14.  if(*string)
  15.  {
  16.   if(!(fnn = (struct FileNameNode *)FindName(&info->FileList,string)))
  17.   {
  18.    insert = TRUE;
  19.   }
  20.  }
  21.  if(insert)
  22.  {
  23.   if(fnn = calloc(1,sizeof(struct FileNameNode)))
  24.   {
  25.    strcpy(fnn->fnn_Name,string);
  26.    fnn->fnn_Node.ln_Name = fnn->fnn_Name;
  27.    DetachList(info);
  28.    if(*cmd == CMD_INSERTTAIL) AddTail(&info->FileList,(struct Node *)fnn);
  29.     else AddHead(&info->FileList,(struct Node *)fnn);
  30.    AttachList(info);
  31.   }
  32.  }
  33.  
  34. }
  35.  
  36. void RemoveName(struct prf_info *info)
  37. {
  38.  struct FileNameNode *fnn;
  39.  UBYTE               *string;
  40.  string = (UBYTE *)info->Special1;
  41.  if(*(string) > ' ')
  42.  {
  43.   if(fnn = (struct FileNameNode *)FindName(&info->FileList,string))
  44.   {
  45.    DetachList(info);
  46.    Remove((struct Node *)fnn);
  47.    free(fnn);
  48.    AttachList(info);
  49.   }
  50.  }
  51.  else
  52.  {
  53.   DetachList(info);
  54.   fnn = (struct FileNameNode *)RemTail(&info->FileList);
  55.   free(fnn);
  56.   AttachList(info);
  57.  }
  58. }
  59.  
  60. void DetachList(struct prf_info *info)
  61. {
  62.  if(info->Swd)GT_SetGadgetAttrs(info->SGadgets[GD_List],info->Swd,NULL,GTLV_Labels,-1,TAG_DONE);
  63. }
  64.  
  65. void AttachList(struct prf_info *info)
  66. {
  67.  if(info->Swd) GT_SetGadgetAttrs(info->SGadgets[GD_List],info->Swd,NULL,GTLV_Labels,&info->FileList,GTLV_ShowSelected,info->SGadgets[11], TAG_DONE);
  68. }
  69.  
  70.