home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Exec 3 / CD_Magazyn_EXEC_nr_3.iso / Internet / Strony_WWW / Opus4.x / DOpus414JRsrc.lha / DirectoryOpus4 / Program / data.c < prev    next >
C/C++ Source or Header  |  2000-03-30  |  13KB  |  286 lines

  1. /*
  2.  
  3. Directory Opus 4
  4. Original GPL release version 4.12
  5. Copyright 1993-2000 Jonathan Potter
  6.  
  7. This program is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU General Public License
  9. as published by the Free Software Foundation; either version 2
  10. of the License, or (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. All users of Directory Opus 4 (including versions distributed
  22. under the GPL) are entitled to upgrade to the latest version of
  23. Directory Opus version 5 at a reduced price. Please see
  24. http://www.gpsoft.com.au for more information.
  25.  
  26. The release of Directory Opus 4 under the GPL in NO WAY affects
  27. the existing commercial status of Directory Opus 5.
  28.  
  29. */
  30.  
  31. #include "dopus.h"
  32. #include <libraries/screennotify.h>
  33. #include <libraries/pm.h>
  34.  
  35. /* SAS Detach information */
  36.  
  37. unsigned long __stack=16384;               /* Stack size needed */
  38. long __priority=0;                         /* Default task priority */
  39. long __BackGroundIO=0;                     /* IO off for non-beta */
  40. char *__procname="dopus_task";             /* Task name */
  41.  
  42. /* Library bases */
  43.  
  44. struct DOpusBase *DOpusBase = NULL;         /* dopus.library */
  45. struct IntuitionBase *IntuitionBase = NULL; /* intuition.library */
  46. struct GfxBase *GfxBase = NULL;             /* graphics.library */
  47. struct Library *IconBase = NULL;            /* icon.library */
  48. struct Library *DiskfontBase = NULL;        /* diskfont.library */
  49. struct PPBase *PPBase = NULL;               /* powerpacker.library */
  50. struct Library *LayersBase = NULL;          /* layers.library */
  51. struct Library *WorkbenchBase = NULL;       /* workbench.library */
  52. struct MusicBase *MUSICBase = NULL;         /* music.library */
  53. struct Library *CxBase = NULL;              /* commodities.library */
  54. struct RxsLib *RexxSysBase = NULL;          /* rexxsyslib.library */
  55. struct Library *AccountsBase = NULL;        /* accounts.library */
  56. struct UtilityBase *UtilityBase = NULL;     /* utility.library */
  57. struct Library *ScreenNotifyBase = NULL;    /* screennotify.library */
  58. struct Library *CyberGfxBase = NULL;        /* cybergraphics.library */
  59. struct PopupMenuBase *PopupMenuBase = NULL; /* popupmenu.library */
  60.  
  61. /* Intuition objects */
  62.  
  63. struct IntuiMessage *IMsg=NULL;           /* Main IntuiMessage pointer */
  64. struct Screen *MainScreen=NULL;           /* Main screen */
  65. struct Screen *iffscreen=NULL;            /* IFF display screen */
  66. struct Screen *fontscreen=NULL;           /* Font display screen */
  67. struct Screen *blankscreen=NULL;          /* Blank screen for IFF viewer */
  68. struct Window *Window=NULL;               /* Main window */
  69. struct Window *fontwindow=NULL;           /* Window for font display */
  70. struct Window *ansiread_window=NULL;      /* Window for rendering ANSI text */
  71. struct Window *reqoverride=NULL;          /* Pointer for SimpleRequest window */
  72. struct PopupMenu *sortmenu=NULL;          /* Sort pop-up menu */
  73.  
  74. /* Graphics objects */
  75.  
  76. struct ViewPort *main_vp=NULL;            /* Main screen ViewPort */
  77.  
  78. struct RastPort *main_rp=NULL;            /* Main window RastPort */
  79. struct RastPort *font_rp=NULL;            /* Font window RastPort */
  80. struct RastPort dir_rp[2]={0};            /* Directory window RastPorts */
  81.  
  82. struct TextFont *scr_font[NUMFONTS]={0};  /* Fonts used in screen display */
  83.  
  84. /* Exec objects */
  85.  
  86. struct Process *main_proc=NULL;           /* Main Process */
  87. struct Task *hotkey_task=NULL;            /* HotKey Task */
  88. struct Task *clock_task=NULL;             /* Clock Task */
  89.  
  90. struct MsgPort *count_port=NULL;          /* Port to establish run count */
  91. struct MsgPort *general_port=NULL;        /* General Message Port */
  92. struct MsgPort *audio_port[2]={0};        /* 8SVX Sound player Ports */
  93. struct MsgPort *appmsg_port=NULL;         /* AppObject Message Port */
  94. struct MsgPort *arexx_port=NULL;          /* ARexx Port */
  95. struct MsgPort *snm_port=NULL;            /* ScreenNotify Port */
  96.  
  97. struct MsgPort *hotkeymsg_port=NULL;      /* Messages to the hotkey task */
  98. struct MsgPort *clockmsg_port=NULL;       /* Messages to the clock task */
  99.  
  100. struct IOStdReq *keyboard_req=NULL;       /* Keyboard IO Request block */
  101. struct IOStdReq *input_req=NULL;          /* Input IO Request block */
  102. struct IOAudio *audio_req1[2]={0};        /* Audio IO Request block #1 */
  103. struct IOAudio *audio_req2[2]={0};        /* Audio IO Request block #2 */
  104.  
  105. /* DOS objects */
  106.  
  107. BPTR ramdisk_lock=0;                      /* Lock on RAM: */
  108. APTR windowptr_save=NULL;                 /* Saved Window Pointer */
  109. LONG nil_file_handle=0;                   /* Handle on the NIL: device */
  110.  
  111. BPTR old_pr_cis=0;                        /* Old pr_CIS pointer */
  112. BPTR old_pr_cos=0;                        /* Old pr_COS pointer */
  113. void *old_pr_consoletask=NULL;            /* Old pr_ConsoleTask pointer */
  114.  
  115. /* General objects */
  116.  
  117. struct DOpusRemember *general_key=NULL;   /* General memory key */
  118. struct DOpusRemember *help_key=NULL;      /* Memory key for help files */
  119. struct DOpusRemember *filetype_key=NULL;  /* Memory key for filetype list */
  120. struct DOpusRemember *audio_key=NULL;     /* Memory key for 8SVX player */
  121. struct DOpusRemember *menu_key=NULL;      /* Memory key for menus */
  122.  
  123. USHORT *nullpalette=NULL;                 /* Pointer to a black palette */
  124. UBYTE *audiodata=NULL;                    /* Audio data to play */
  125. ULONG audio_size=0;                       /* Size of audio data */
  126.  
  127. struct UserInfo *user_info=NULL;          /* UserInfo for envoy */
  128. struct GroupInfo *group_info=NULL;        /* GroupInfo for envoy */
  129.  
  130. struct ScreenNotifyMessage *snm=NULL;
  131.  
  132. /* Directory Opus Internal objects */
  133.  
  134. struct Directory
  135.     *last_selected_entry=NULL;              /* The last entry selected */
  136. struct Help *dopus_firsthelp=NULL;        /* The first help message */
  137. struct dopusfiletype
  138.     *dopus_firsttype=NULL;                  /* The first filetype */
  139. struct dopusgadgetbanks
  140.     *dopus_firstgadbank=NULL;               /* The first gadget bank */
  141. struct dopusgadgetbanks
  142.     *dopus_curgadbank=NULL;                 /* The current gadget bank */
  143. struct dopushotkey
  144.     *dopus_firsthotkey=NULL;                /* The first hotkey */
  145. struct dopushotkey
  146.     *dopus_globalhotkey=NULL;               /* The last hotkey function */
  147.  
  148. struct DirectoryWindow *dopus_curwin[2]={0};  /* Currently displayed buffer */
  149. struct DirectoryWindow
  150.     *dopus_firstwin[2]={0};                 /* First buffer in each window */
  151. struct DirectoryWindow
  152.     *dopus_specialwin[2]={0};               /* Special buffer for each window */
  153. struct DirectoryWindow *dopus_oldwin[2]={0};  /* Last buffer displayed */
  154.  
  155. void *dir_memory_pool=NULL;               /* Memory pool for allocations */
  156.  
  157.  
  158. /* String data */
  159.  
  160. char str_config_basename[256]={0};        /* Configuration base name */
  161. char str_config_file[256]={0};            /* Configuration file */
  162. char str_dopusrt_path[256]={0};           /* DOpusRT path name */
  163.  
  164. char str_select_info[80]={0};             /* Status bar text for selection info */
  165. char *str_select_pattern[3]={0};          /* Three different Select patterns */
  166. char *str_arexx_command=NULL;             /* Entered ARexx command string */
  167. char *str_space_string=NULL;              /* 255 spaces in a string */
  168. char str_hunt_name[80]={0};               /* File name to hunt for */
  169. char str_hunt_name_parsed[164]={0};       /* Hunt file parsed */
  170. char str_search_string[80]={0};           /* String to search for */
  171. char str_filter[40]={0};                  /* File filter for recursive ops */
  172. char str_filter_parsed[84]={0};           /* File filter parsed */
  173.  
  174. char str_version_string[30]={0};          /* Current version string */
  175. char str_arexx_portname[30]={0};          /* ARexx Port name */
  176.  
  177. UBYTE var_key_matrix[13]={0};             /* Keyboard matrix data area */
  178. char *str_last_statustext=NULL;           /* Last status text displayed */
  179.  
  180. char str_last_rexx_result[256]={0};       /* Last ARexx result */
  181.  
  182. /* Various data */
  183.  
  184. BYTE status_iconified=0;                  /* Current iconified status */
  185. BYTE status_configuring=-1;               /* Configuring status */
  186. BYTE status_justabort=0;                  /* Have we just aborted? */
  187. BYTE status_haveaborted=0;                /* The abort sequence has been hit */
  188. BYTE status_rexxabort=0;                  /* Abort flag for ARexx scripts */
  189. BYTE status_previousabort=0;              /* Did we abort a while ago ? */
  190. BYTE status_publicscreen=0;               /* Are we on a public screen? */
  191. ULONG status_flags=0;                     /* Various status bits */
  192.  
  193. BYTE data_active_window=0;                /* Active directory window */
  194. UBYTE data_buffer_count[2]={0};           /* Number of buffers in each window */
  195. BYTE data_gadgetrow_offset=0;             /* Gadget row offset */
  196. SHORT data_drive_offset=0;                /* Current drive offset */
  197. ULONG data_colorclock=0;                  /* Color clock value for this system */
  198.  
  199. ULONG time_current_sec=0;                 /* Current Second (from Intuition) */
  200. ULONG time_current_micro=0;               /* Current Micro (from Intuition) */
  201. ULONG time_previous_sec=0;                /* Previous Second (from Intuition) */
  202. ULONG time_previous_micro=0;              /* Previous Micro (from Intuition) */
  203.  
  204. UBYTE system_version2=0;                  /* OS version 2 or greater */
  205. int system_dopus_runcount=0;              /* Run count of this copy */
  206.  
  207. ULONG data_window_refresh=0;              /* Windows that need refreshing */
  208.  
  209. USHORT scr_gadget_rows=0;                 /* Number of button rows */
  210. USHORT scr_gadget_bank_count=0;           /* Number of button banks */
  211.  
  212. USHORT scr_min_width=0;                   /* Minimum window width */
  213. USHORT scr_min_height=0;                  /* Minimum window height */
  214.  
  215. APTR snm_handle=NULL;                     /* ScreenNotify handle */
  216.  
  217. /* Configuration data */
  218.  
  219. struct Config *config=NULL;               /* Configuration structure */
  220. BPTR configopus_segment=NULL;             /* Segment pointer for ConfigOpus */
  221. BPTR external_mod_segment[3]={0};         /* External module segments */
  222. BYTE config_changed=0;                    /* Configuration has been changed */
  223.  
  224. /* Disk and DOS operations data */
  225.  
  226. UBYTE disk_change_state=0;                /* Lower bits indicate change state */
  227.  
  228. ULONG dos_global_bytecount=0;             /* Global byte count from recursive op */
  229. ULONG dos_global_copiedbytes=0;           /* Bytes copied in a recursive op */
  230. ULONG dos_global_deletedbytes=0;          /* Bytes copied in a recursive op */
  231. ULONG dos_global_blocksneeded=0;          /* Number of blocks needed to copy */
  232.  
  233. struct DateStamp dos_copy_date={0};       /* DateStamp of file last copied */
  234. ULONG dos_copy_protection=0;              /* Protection of file last copied */
  235. char dos_copy_comment[80]={0};            /* Comment of file last copied */
  236.  
  237. BOOL glob_unprotect_all=0;                /* Unprotect all files */
  238.  
  239. BOOL global_swap_window=FALSE;            /* Active window changed */
  240.  
  241. struct Directory dos_global_entry={0};    /* Global single file entry */
  242.  
  243. struct NotifyRequest *dos_notify_req[2]={0};  /* Notify requests for both windows */
  244. char dos_notify_names[2][256]={0};            /* Notify requests name buffers */
  245.  
  246. struct recpath *rec_firstpath=NULL;       /* Directory path list pointer */
  247. struct DOpusRemember *rec_pathkey=NULL;   /* Memory key for dir list */
  248.  
  249. struct Requester dopus_busy_requester={0};    /* Busy requester */
  250.  
  251. char *icon_type_names[]={                 /* Names of different icon types */
  252.     "Disk",
  253.     "Drawer",
  254.     "Tool",
  255.     "Project",
  256.     "Trash",
  257.     "Device",
  258.     "Kick",
  259.     "AppIcon"};
  260.  
  261. struct DOpusRemember *recurse_dir_key=NULL;    /* Memory key for RecursiveDirectory's */
  262. struct RecursiveDirectory *first_recurse=NULL; /* First recursive directory pointer */
  263. int recurse_max_depth=0   ;                    /* Maximum depth reached */
  264. struct RecursiveDirectory
  265.     **recurse_parent_array=NULL;                  /* Array of parent directories */
  266.  
  267. struct path_complete completion[2]={0};       /* Path-name completion data */
  268.  
  269. /* DateTime stuff */
  270.  
  271. char *date_months[12]={0};                    /* Months */
  272. char *date_shortmonths[12]={0};               /* Short months */
  273. char *date_weekdays[7]={0};                   /* Weekdays */
  274. char *date_shortweekdays[7]={0};              /* Short weekdays */
  275. char *date_special[4]={0};                    /* Special days */
  276.  
  277. struct StringData stringdata={            /* String data */
  278.     NULL,
  279.     0,
  280.     NULL,
  281.     NULL,0,
  282.     0};
  283.  
  284. extern UWORD __chip appicon_data[];
  285. struct Image appicon_image = { 0,0,80,40,2,appicon_data,3,0,0};
  286.