#ifndef MONITOR_H
#define MONITOR_H

/*
**  Monitoring implementation
**  © 2002 Kakace Productions
**
*/


#ifndef  INTUITION_INTUITION_H
#include <intuition/intuition.h>
#endif

#ifndef  DEVICES_TIMER_H
#include <devices/timer.h>
#endif

#ifndef  LIBRARIES_PICASSO96_H
#include <libraries/picasso96.h>
#endif

#ifndef  CYBERGRAPHX_CYBERGRAPHICS_H
#include <libraries/cybergraphics.h>
#endif

#ifndef  LIBRARIES_CGXVIDEO_H
#include <libraries/cgxvideo.h>
#endif


/*------------------------------------------------------------------------------------------------*/

struct VLabMonitor {
    /*
    ** The function pointers below implement some kind of polymorphism which is
    ** necessary because of the differences between standard windows and PiP
    ** windows.
    */
    void (*pfCloseMonitor)(struct VLabMonitor *monitor);
    ULONG (*pfUpdateMonitor)(struct VLabMonitor *monitor);

    struct VLabMonitor *(*pfResizeMonitor)(struct VLabMonitor *monitor, ULONG width, ULONG height);


    struct Window *window;  /* Pointer to the monitoring window */
    UBYTE   *defaultName;   /* Monitor window's name */
    UBYTE   *fpsName;
    UBYTE   *outBuff;       /* Output buffer (RGB monitoring only) */

    struct EClockVal timer;

    ULONG   xpos;           /* Clipping infos. The monitoring system scans LoRes */
    ULONG   ypos;           /* images from the current input.                    */
    ULONG   width;
    ULONG   height;

    UBYTE   flags;
    UBYTE   ratio;
};


/*
** Accessors for external modules
*/

#define MonitoringWindow(x) (x)->window


/*------------------------------------------------------------------------------------------------*/

#define MONITOR_SIZES    3              /* 3 resolutions per video standard */


/*------------------------------------------------------------------------------------------------*/

int IsMonitoringAvailable(const char *screenName);

void InitMonitoring(void);
void CleanupMonitoring(void);

struct VLabMonitor *OpenMonitorWindow(const char *pubscreen, ULONG left, ULONG top, ULONG resolution, ULONG flags);
struct VLabMonitor *ResizeMonitor(struct VLabMonitor *monitor, const char *screenName, ULONG resolution);

void  UpdateMonitorWindow(struct VLabMonitor *monitor);
void  MonitorChangeMode(struct VLabMonitor *monitor, BOOL color);
void  CloseMonitorWindow(struct VLabMonitor *monitor);


#endif  /* MONITOR_H */

