home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d540 / browser.lha / Browser / BrowserII_Src.LZH / Global.h < prev    next >
C/C++ Source or Header  |  1991-06-19  |  9KB  |  242 lines

  1. /*
  2.  *    Global.h - Copyright © 1991 by S.R. & P.C.
  3.  *
  4.  *    Created:    16 Feb 1991  11:00:11
  5.  *    Modified:    19 Jun 1991  18:15:36
  6.  */
  7.  
  8.  
  9. #ifdef TRACKER
  10.  
  11. #define AllocMem(size,type)    alloctrack(size,type,__FILE__,__FUNC__,__LINE__)
  12. #define FreeMem(addr,size)    freetrack(addr,size,__FILE__,__FUNC__,__LINE__)
  13. #define CopyStr(str)        copystrtrack(str,__FILE__,__FUNC__,__LINE__)
  14. #define FreeStr(str)        freestrtrack(str,__FILE__,__FUNC__,__LINE__)
  15. #define ParentDir(lock)        trackedparentdir(lock,__FILE__,__FUNC__,__LINE__)
  16. #define CreateDir(str)        trackedcreatedir(str,__FILE__,__FUNC__,__LINE__)
  17. #define Lock(str, mode)        trackedlock(str, mode,__FILE__,__FUNC__,__LINE__)
  18. #define DupLock(lock)        trackedduplock(lock,__FILE__,__FUNC__,__LINE__)
  19. #define UnLock(lock)        trackedunlock(lock,__FILE__,__FUNC__,__LINE__)
  20.  
  21. void *alloctrack(long size, long type, char *file, char *func, long line);
  22. void freetrack(void *addr, long size, char *file, char *func, long line);
  23. char *copystrtrack(char *str, char *file, char *func, long line);
  24. void freestrtrack(char *str, char *file, char *func, long line);
  25. BPTR trackedparentdir(BPTR lock, char *file, char *func, long line);
  26. BPTR trackedcreatedir(char *str, char *file, char *func, long line);
  27. BPTR trackedlock(char *str, long mode, char *file, char *func, long line);
  28. BPTR trackedduplock(BPTR lock, char *file, char *func, long line);
  29. void trackedunlock(BPTR lock, char *file, char *func, long line);
  30. void freeall(void);
  31. BOOL inittrack(void);
  32.  
  33. #endif
  34.  
  35.  
  36. #define CONFIG_FILE                "Devs:BrowserII.cfg"
  37. #define CONFIG_FILE_ERROR_MSG    "'%s' is not a\nBrowserII V1.00 config file!"
  38. #define BROWSERII_MENU_FILE        "s:BrowserII.menu"
  39.  
  40. #define BROWSER_IDENT_STRING "BrowserII1.00cfg"
  41. #define BROWSER_IDENT_STRING_LEN 17
  42.  
  43. #define MAX(x,y)    (x) > (y) ? (x) : (y)
  44. #define MIN(x,y)    (x) < (y) ? (x) : (y)
  45.  
  46.  
  47. #define PATTERN_BUF_SIZE 32
  48.  
  49. struct SelectInfo {
  50.     BYTE   si_Pattern[PATTERN_BUF_SIZE];/* Pattern                        */
  51.     BYTE   si_PatTok[PATTERN_BUF_SIZE];    /* PreParsed pattern            */
  52.     LONG   si_MinSize;                    /* Show files bigger than that    */
  53.     LONG   si_MaxSize;                    /*   and smaller than that        */
  54.     struct DateStamp si_SinceDate;        /* Show files newer than that    */
  55.     struct DateStamp si_BeforeDate;        /*   and older than that        */
  56.     LONG   si_SinceSecs;                /* date in seconds                */
  57.     LONG   si_BeforeSecs;                /* date in seconds                */
  58.     SHORT  si_PosProtect;                /* Show files that have these bits set   */
  59.     SHORT  si_NegProtect;                /* Show files that have these bits clear */
  60.     SHORT  si_Flags;                    /* Flags. See below                */
  61. };
  62.  
  63. /* SelectInfo flags */
  64.  
  65. #define SI_ALL_FILES        0x0001
  66. #define SI_MATCH_FILES        0x0002
  67. #define SI_ALL_DIRS            0x0004
  68. #define SI_MATCH_DIRS        0x0008
  69. #define SI_AFFECT_SUBDIRS    0x0010
  70. #define SI_NAME                0x0020
  71. #define SI_SIZE                0x0040
  72. #define SI_SINCEDATE        0x0080
  73. #define SI_BEFOREDATE        0x0100
  74. #define SI_POSPROTECTION    0x0200
  75. #define SI_NEGPROTECTION    0x0400
  76. #define SI_INVERT            0x0800        /* Invert filters */
  77.  
  78.  
  79. /* Modes */
  80.  
  81. #define PROTECT_REQ        0
  82. #define FILTERS_REQ        1
  83. #define SELECT_REQ        2
  84.  
  85.  
  86. struct Config {
  87.     BYTE  IdentString[BROWSER_IDENT_STRING_LEN];
  88.     UBYTE Screen;                        /* See below */
  89.     UBYTE CmdMode;                        /* 0 -> Simple / != 0 -> Shell */
  90.     UBYTE RunMode;                        /* See below */
  91.     UBYTE CopyMode;                        /* See below */
  92.     UBYTE CopyFlags;                    /* See below */
  93.     UBYTE Display;                        /* DLF_mumble */
  94.     UBYTE Options;                        /* See below */
  95.     UBYTE EntryInfoFlags;                /* DISPLAY_mumble */
  96.     UBYTE Sort;                            /* See below */
  97.     struct SelectInfo DefaultFilters;    /* Default filters data */
  98.     struct SelectInfo Select;            /* Sel Match data */
  99. };
  100.  
  101.  
  102. #define BROWSER_WORKBENCH    0x00
  103. #define BROWSER_CUSTOM        0x01
  104.  
  105. #define RM_RUNBACK            0x01
  106. #define RM_SHELL            0x02
  107. #define RM_REQUEST            0x04
  108.  
  109. #define CM_CONTEXT            0x01
  110. #define CM_ALLWAYS_COPY        0x02
  111. #define CM_ALLWAYS_MOVE        0x04
  112. #define CM_UPDATE            0x08
  113. #define CM_DONT_OVERWRITE    0x10
  114. #define CM_ASK_OVERWRITE    0x20
  115. #define CM_COPY_EMPTYDIRS    0x40
  116. #define CM_COPY_HIERARCHY    0x80
  117.  
  118. #define CF_CLONE            0x01
  119. #define CF_DATE                0x02
  120. #define CF_PROTECT            0x04
  121. #define CF_COMMENT            0x08
  122.  
  123. #define OPT_KEEPSELECTED    0x01
  124. #define OPT_TOGGLESELECT    0x02
  125. #define OPT_MOVEINTOSUB        0x04
  126. #define OPT_ASKBEFOREMOVE    0x08
  127. #define OPT_ASYNCHRONOUS    0x10
  128.  
  129.  
  130. struct FileInfo {
  131.     BYTE   fi_Name[32];            /* Filename            */
  132.     SHORT  fi_Type;                /* DLX_mumble        */
  133.     SHORT  fi_Protection;        /* Protection bits    */
  134.     LONG   fi_Size;                /* Size in bytes    */
  135.     LONG   fi_NumBlocks;        /* Size in blocks    */
  136.     LONG   fi_DiskKey;            /* Root block        */
  137.     struct DateStamp fi_Date;    /* DateStamp        */
  138.     ULONG  fi_Secs;                /* date in seconds    */
  139.     BYTE   *fi_Comment;            /* File Comment        */
  140. };
  141.  
  142.  
  143. struct ScrollEntry {
  144.     struct MinNode se_Node;            /* Link node */
  145.     struct FileInfo se_FileInfo;    /* Info on entry */
  146.     char   *se_Print;                /* String shown to user */
  147.     SHORT  se_Pen;                    /* Display color for this entry */
  148.     SHORT  se_State;                /* State of entry. STATE_SELECTED,... */
  149. };
  150.  
  151.  
  152. /* ScrollEntry States */
  153.  
  154. #define STATE_SELECTED    0x01
  155. #define STATE_GHOSTED    0x02
  156. #define STATE_DELETED    0x04
  157.  
  158.  
  159. struct BrowserWindow {
  160.     struct MinNode bw_Node;                /* Link Node */
  161.     struct Window *bw_Window;            /* Intuition window pointer */
  162.     UBYTE  bw_Type;                        /* Is it main window or a dir */
  163.     UBYTE  bw_Flags;                    /* Update flags. See below */
  164.     SHORT  bw_MaxFilenameLen;            /* You don't understand ?! */
  165.     SHORT  bw_PrintStringLen;            /* Length of Print strings */
  166.     SHORT  bw_PrintLen;                    /* Len of entry given to Text(). May be smaller than bw_PrintStringLen */
  167.     SHORT  bw_NumEntries;                /* Number of entries in directory */
  168.     SHORT  bw_ShownEntries;                /* Number of shown entries in window */
  169.     SHORT  bw_NumDirs;                    /* Number of directories in directory */
  170.     SHORT  bw_ShownDirs;                /* Number of directories shown */
  171.     SHORT  bw_NumFiles;                    /* Number of files in directory */
  172.     SHORT  bw_ShownFiles;                /* Number of files shown */
  173.     LONG   bw_NumBytes;                    /* Total size in bytes of directory */
  174.     LONG   bw_ShownBytes;                /* Total selected bytes */
  175.     LONG   bw_NumBlocks;                /* Total size in blocks of directory */
  176.     LONG   bw_ShownBlocks;                /* Total selected blocks */
  177.     LONG   bw_SelectBytes;                /* Number of bytes selected */
  178.     LONG   bw_SelectBlocks;                /* Number of blocks selected */
  179.     SHORT  bw_SelectNum;                /* Number of selected entries */
  180.     SHORT  bw_NumCol;                    /* Number of columns in window */
  181.     SHORT  bw_ColWidth;                    /* Width in char of a column */
  182.     BPTR   bw_DirLock;                    /* Lock on dir. Not used in main window */
  183.     BPTR   bw_RootLock;                    /* Lock on root dir of volume. Not used in main window */
  184.     BYTE   bw_BottomText[120];            /* Buffer for info displayed in bottom border of window */
  185.     SHORT  bw_BottomLen;                /* Maximum len that can be displayed without trashing sizing gadget */
  186.     UBYTE  bw_Sort;                        /* Sort function for entries (see below). idem */
  187.     UBYTE  bw_EntryInfoFlags;            /* Info displayed for each entry */
  188.     struct SelectInfo bw_FiltersInfo;    /* Filter for entries displayed */
  189.     struct MinList bw_EntryList;        /* Linked list of entries */
  190.     struct ScrollEntry **bw_EntryArray;    /* Array[bw_NumEntries] of pointers on entries */
  191.     struct ScrollStruct bw_ScrollStruct;/* For RealTimeScroll() */
  192.     struct PropBlock bw_Prop;            /* Window prop gadget */
  193.     struct MinList bw_NewEntryList;        /* List of entries to be added after an action */
  194.     SHORT  bw_NumNewEntries;            /* Number of entries in NewEnties list */
  195.     SHORT  bw_NumDeleted;                /* Number of entries deleted (marked by STATE_DELETED flag) */
  196.     SHORT  bw_NewMaxFilenameLen;        /* While adding entries in a dir, this */
  197.     BYTE   bw_Fmt[10];                    /* Format string used to build filename sub-string of printstring */
  198. };
  199.  
  200.  
  201. /* BrowserWindow Types */
  202.  
  203. #define BW_DIR        0
  204. #define BW_MAIN        1
  205.  
  206.  
  207. /* BrowserWindow Flags */
  208.  
  209. #define BWF_REBUILD_STRINGS    0x01    /* Tell if PrintStrings must be rebuilt after an action */
  210. #define BWF_REBUILD_ARRAY    0x02    /* Entries were added or deleted while an action, so array has to be rebuilt */
  211. #define BWF_SORT            0x04    /* After a rename, entries have to be resorted */
  212. #define BWF_CHECK_MAXLEN    0x08    /* An entry with a long filename was deleted or renamed, so check new MaxFilenameLen */
  213.  
  214.  
  215. /* BrowserWindow EntryInfo display flags */
  216.  
  217. #define DISPLAY_FILENAME    0x00    /* Allways displayed */
  218. #define DISPLAY_SIZE        0x01
  219. #define DISPLAY_BLOCK        0x02
  220. #define DISPLAY_PROTECT        0x04
  221. #define DISPLAY_DATE        0x08
  222. #define DISPLAY_KEY            0x10
  223.  
  224.  
  225. /* Sort functions */
  226.  
  227. #define    NAME_SORT        0x00
  228. #define DATE_SORT        0x01
  229. #define SIZE_SORT        0x02
  230. #define KEY_SORT        0x03
  231. #define TYPE_SORT        0x10    /* Type sort may be added to the first four */
  232.  
  233.  
  234. /* defined in intuitionbase.h but only if INTUITIONPRIVATE is also defined */
  235.  
  236. struct Point {
  237.     short X;
  238.     short Y;
  239. };
  240.  
  241.  
  242.