// C++ code Copyright (C) David R. Evans G4AMJ/NQ0I

// class for batch mode of WMIDAS

#ifndef SMWBATCHMODEH
#define SMWBATCHMODEH

#include <sm_batch_mode.h>
#include <surf_win.h>

#include <owl\applicat.h>
#include <owl\framewin.h>

// The idiotic OWL system requires that a TApplication object exist
// before we can use OWL.

class batch_application : public TApplication
{ friend class windows_batch_mode;

  TFrameWindow* tfwp;                            // the main window

  TStatic * busy_display, * echo_display, * message_display,
          * status_display;

public:
  batch_application(LPSTR AName, windows_batch_mode*) :
    TApplication(AName)
    { }
  ~batch_application(void);
  
  virtual void InitMainWindow(void);
};

// strict compilers do not permit casts from pointers to member functions
// to void pointers. Consequently, we cannot place an address of a
// member function on to a generic list. This is a pain, and requires
// the following workaround quick and dirty class

class windows_batch_mode;

class windows_batch_mode : public batch_mode
{
protected:
  batch_application* app;

  popup* winp;
  windows_printer* win_printer_pointer;

  virtual void _generate_command_list(void);
  virtual void _initialise(void);
  
  int _set(DREstring&, DREstring&);
  int _wait(DREstring&, DREstring&);

  void _show_pra_modes(void);
  void _show_range(void);
  void _show_sc_mode(void);
  void _show_sc_modes(void);

public:
  windows_batch_mode(const char* filename, const float rev_nr);
  ~windows_batch_mode(void);

  virtual void display_status(DREstring&);
  void busy(DREstring&);
  void execute(void);
  void unbusy(void);

  void echo_command(DREstring&);
  void display_message(DREstring&);
};

extern windows_batch_mode* winbmode;

#endif
