#ifndef INCLUDE_EXTERN_H
#define INCLUDE_EXTERN_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/muimaster.h>
#include <proto/iffparse.h>
#include <proto/graphics.h>
#include <proto/intuition.h>
#include <proto/asl.h>
#include <proto/gadtools.h>
#include <proto/utility.h>

#ifdef __GCC__
#include <proto/alib.h>
#endif

#include <libraries/mui.h>
#include <exec/exec.h>

#include "common/Subtask.h"
#include "common/Debug.h"
#include "common/CompilerSpecific.h"
#include "common/urlnode.h"
#include "common/pool.h"
#include "common/inlines.h"

#ifndef MAKE_ID
#define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
#endif

//#define STRING(a, b)    b
#include "locale.h"

#ifndef __DEMO__
#define __VER__ "1.0"
#else
#define __VER__ "1.0 DEMO"
#endif

#define set_flag(a, b) (a |= b)
#define test_flag(a, b) (a & b)
#define toggle_flag(a, b) (a &= ~b)


struct EditNode
  {
    struct MinNode gn_node;
    APTR gn_win;
    APTR gn_inuse;
    APTR gn_listview;
    struct List gn_list;

    STRPTR gn_title;
    STRPTR gn_dir;
  };

struct ObjApp
  {
    APTR App;

    APTR main_win;
    APTR edit_win;
    APTR about_win;
    APTR prefs_win;

    //APTR grab_win;
    APTR proj_stimg[7];

    APTR menu;
    APTR menu_recent;
    APTR menus_recent[6];
    APTR menu_inuse;
    APTR menus[10];

    APTR lv_menu;
  };

struct GlobalData
  {
    APTR gd_pool;               // Memory pool
    APTR gd_app;                // Application ptr

    struct EditNode *gd_cnd;    // Node in use
    struct SubTask *gd_subtask; // Decoding subtask

    STRPTR keyfilename;
    STRPTR username;
    STRPTR sernum;
  };

struct http_prefs
  {
    LONG recdelay;
    LONG numretries;
    LONG recbuf;

    long timeout;

    char *downdir;

    char *languages;
    char *charsets;

    char *proxy;
    int proxyport;
    char *proxyauth;

  };

struct ftp_prefs
  {
    char *proxy;
    int proxyport;
    char *proxyauth;

  };

struct preferences
  {
    struct SignalSemaphore sema;        /* data item protection      */

    // Interface
    STRPTR recents[6];
    LONG req_top, req_left, req_width, req_height;
    BOOL closereq;

    // Net part
    STRPTR  email;
    BOOL    use_email;

    struct http_prefs httpprefs;
    struct ftp_prefs ftppprefs;
  };

struct proj_prefs
  {
    struct SignalSemaphore sema;        /* data item protection      */

    struct URLNode  defnd;

    ULONG   socknum;
    STRPTR  strdowndir;
    STRPTR  indexname;
  };




#ifndef MAIN_C
extern struct GlobalData gd;
extern struct ObjApp *oa;
extern struct preferences *prefs;
#endif



#endif //end
