/******************************************************************************
 * program:     wp2latex                                                      *
 * function:    Dialog for displaying conversion logs.                        *
 * modul:       Frm_Copyright.cpp                                             *
 * dependency:  C++ Builder                                                   *
 * licency:     Shareware                                                     *
 ******************************************************************************/
#ifndef FRM_ErrLogH
#define FRM_ErrLogH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <stdio.h>
#include <syncobjs.hpp>

#include <htmlhelp.h>
#include "CMSDNHelp.h"
#include "lists.h"


//---------------------------------------------------------------------------
class TErrLog: public TForm //, public TCriticalSection
{
__published:	// IDE-managed Components
	TMemo *Memo1;
	TTimer *Timer1;
	void __fastcall Timer1Timer(TObject *Sender);
	void __fastcall FormCreate(TObject *Sender);
        void __fastcall FormDestroy(TObject *Sender);
        void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
	void __fastcall FormKeyDown(TObject *Sender, WORD &Key,
          TShiftState Shift);
        void __fastcall FormMouseWheel(TObject *Sender, TShiftState Shift,
          int WheelDelta, TPoint &MousePos, bool &Handled);
private:	// User declarations
protected:
        static void ThreadMain(void *arg);
public:		// User declarations
	__fastcall TErrLog(TComponent* Owner);
        __fastcall ~TErrLog();
        static __fastcall void TErrLog::TerminateWorker(int Timeout=1);

	list LogErr;		///< Aggregate messages from thread to the form.
	TCriticalSection *Lock;
	TCMSDNHelp *HELP;

        static int PipeHandles[2];
        static volatile int MsgFormState;
        static volatile int thread_id;
};

//---------------------------------------------------------------------------
extern PACKAGE TErrLog *ErrLog;
extern FILE *FileIn, *FileOut;

//---------------------------------------------------------------------------

#endif
