/*
 *    MSClock.h        © by Martin Steppler
 *
 *    last change: 18.07.91
 */

// includes

#include <stdio.h>
#include <dos/stdio.h>
#include <dos/dos.h>
#include <dos/dosextens.h>
#include <devices/inputevent.h>
#include <devices/conunit.h>
#include <devices/printer.h>
#include <devices/timer.h>
#include <devices/input.h>
#include <graphics/gfx.h>
#include <graphics/gfxbase.h>
#include <graphics/gfxmacros.h>
#include <intuition/intuition.h>
#include <intuition/intuitionbase.h>
#include <exec/exec.h>
#include <hardware/cia.h>
#include <functions.h>

// defines

#define SIG_CHANGE   SIGBREAKF_CTRL_C
#define SIG_CLOSE    SIGBREAKF_CTRL_D
#define CHILD_READY  SIGBREAKF_CTRL_D
#define SIG_NEWMODE  SIGBREAKF_CTRL_E
#define SIG_COUNTER  SIGBREAKF_CTRL_F
#define SIG_DISPLAY  (1 << DisplaySig)
#define SIG_JUMP     (1 << JumpSig)

#define EOS 0
#define PORTNAME "MSClock-Port"

#define TIME_WIDTH         10
#define SHORT_TIME_WIDTH   7
#define DATE_WIDTH         14
#define ONLINE_WIDTH       23
#define MEM_WIDTH          22
#define LONG_MEM_WIDTH     20
#define FRONTBACKGAD_WIDTH 62
#define FBGAD_WIDTH_NEW_OS 32

#define TIME_FLAG             1
#define DATE_FLAG             2
#define MEMORY_FLAG           4
#define ENGLISH_FLAG          8
#define REVERSE_FLAG          16
#define ONLINE_FLAG           32
#define HOLIDAY_FLAG          64
#define START_STOP_FLAG       128
#define NO_LOGFILE_FLAG       256
#define NO_SECONDS_FLAG       512
#define AUTO_JUMP_FLAG        1024
#define SUM_FLAG              2047

#define DISPLAY_ALL            0
#define DISPLAY_DATE_AND_TIME  1
#define DISPLAY_MEMORY         2
#define DISPLAY_ONLINE_TIME    3

// globals

struct TheClock
{
   struct MsgPort    Port;          // Global messageport.
   BPTR              Segment;       // Pointer to handler segment.
   LONG              SegSize;       // Size of TheClock structure.
   struct Task      *Father;        // Calling process.
   struct Task      *Child;         // Waiting process
   ULONG             LastSecs;      // for timer control during an interrupt
   SHORT             OverScan;      // WB Overscan
   SHORT             Width;         // Width of our window
   BYTE              Online;        // online-flag
   LONG              Flags;         // display-flags
   LONG              FlagsBackup;   // backup of the display-flags
   BYTE              Status;        // status-flag
   SHORT             Unit;          // currency unit spent in one interval
   SHORT             Interval;      // in seconds
   SHORT             CInterval;     // in seconds (low charges interval)
                                    // qualifier and code for
                                    // change display and start/stop counter
   UWORD             HotKeyCode, HotKeyQualif;
   UWORD             StartStopCode, StartStopQualif;
   UWORD             JumpCode, JumpQualif;  // jump to next screen hotkeys
      // start/end of the interval during which telephone charges are low
   SHORT             LowChargesStart, LowChargesEnd;
   SHORT             Viewmodes;     // full / partial display
   SHORT             ModesBackup;   // backup of Viewmodes
   BYTE              FBGadWidth;    // 32: for OS>=2.0 62: for KS<=1.3
   struct TextFont  *Font;          // font to be used
   char              Logfile[100];  // name of logfile
};
