/***************************************************************************
    1/89

        DIRK v2.0 -- Tune workbench colors to system performance

        Copyright (C) 1989 by Daniel Elbaum

        This software is freely redistributable provided that:
        the four files which comprise it (dirk, dirk.doc, dirk.h,
        adjust.c, main.c, sys, window.c) remain intact; all
        copyright notices contained in any of the aforementioned
        files remain intact; and no fee beyond reasonable remuneration
        for collation and distribution be charged for use and/or
        distribution.

***************************************************************************/


#include <exec/types.h>
#include <exec/exec.h>
#include <exec/execbase.h>
#include <intuition/intuition.h>
#include <graphics/gfxbase.h>

#define INAM    ("intuition.library")
#define GNAM    ("graphics.library")
#define IREV    (1)
#define GREV    (1)
#define CMAX    (15)    /* max val for color component (hardware)   */

#define WINNAME ("Dirk")
#define WINTOP  (0)
#define WINWD   (116)
#define WINHT1  (10)
#define WINHT2  (115)
#define WINFLAGS (WINDOWCLOSE|WINDOWDRAG|WINDOWDEPTH|RMBTRAP)
#define WINIFLAGS (CLOSEWINDOW|ACTIVEWINDOW|INACTIVEWINDOW|\
REFRESHWINDOW|MOUSEBUTTONS)
#define W_OPEN      (0)
#define W_CLOSED    (1)

/*
    seems odd, but really makes sense, since background
    has 2 color components, and detail has 3.
    These limits are to ensure enough contrast for readability.
*/

struct g_flags {
    int gran;   /* granularity of mapping from #tasks to pen brightness */
    int bsmax;  /* constant total saturation of background (red+blue)   */
    int dsmax;  /* maximum detail brightness (if high, text glares)     */
    int dsmin;  /* darkest gray for detail pen                          */
    int dstog;  /* set to activate task watch                           */
    int bstog;  /* set to activate memory watch                         */
    int intvl;  /* number of ticks between updates                      */
    int bd_r;   /* base detail pen red component                        */
    int bd_g;   /* base detail pen green component                      */
    int bd_b;   /* base detail pen blue component                       */
    int lb_r;   /* low background pen red component                     */
    int lb_g;   /* low background pen green component                   */
    int lb_b;   /* low background pen blue component                    */
    int hb_r;   /* high background pen red component                    */
    int hb_g;   /* high background pen green component                  */
    int hb_b;   /* high background pen blue component                   */

/* the following three are used internally only */
    int db_r;   /* difference in red from low to high memory usage      */
    int db_g;   /* difference in green from low to high memory usage    */
    int db_b;   /* difference in blue from low to high memory usage     */
};


typedef struct IntuitionBase t_ib;
typedef struct GfxBase t_gb;
typedef struct g_flags t_gf;

extern struct ExecBase *SysBase;

struct IntuiMessage *GetMsg();
void *OpenLibrary();
ULONG AvailMem();

#ifdef MAIN

t_ib *IntuitionBase;
t_gb *GfxBase;

#else

extern t_ib *IntuitionBase;
extern t_gb *GfxBase;

#endif


