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

#ifndef __THPS1HEDWADEDITOR_H__
#define __THPS1HEDWADEDITOR_H__

#ifdef __BORLANDC__
	#pragma hdrstop
#endif

#ifndef WX_PRECOMP
	#include <wx/wx.h>
	#include <wx/frame.h>
#else
	#include <wx/wxprec.h>
#endif

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

////Header Include Start
#include <wx/msgdlg.h>
#include <wx/textdlg.h>
#include <wx/dirdlg.h>
#include <wx/filedlg.h>
#include <wx/html/htmlwin.h>
#include <wx/button.h>
#include <wx/textctrl.h>
#include <wx/listbox.h>
////Header Include End

#include <wx/file.h>

using namespace std;

#include <cstdlib>
#include <cstring>

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

////Dialog Style Start
#undef Thps1HedWadEditor_STYLE
#define Thps1HedWadEditor_STYLE wxCAPTION | wxSYSTEM_MENU | wxMINIMIZE_BOX | wxCLOSE_BOX
////Dialog Style End

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

struct FileStruct
{
    char name[32];
    unsigned int offset;
    unsigned int size;
    unsigned char* rawdata;
};

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

class Thps1HedWadEditor : public wxFrame
{
	public:
		Thps1HedWadEditor(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Thps1 Hed Wad Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = Thps1HedWadEditor_STYLE);
		virtual ~Thps1HedWadEditor();
		void BTNOpenClick(wxCommandEvent& event);
		void BTNSaveClick(wxCommandEvent& event);
		void BTNAddClick(wxCommandEvent& event);
		void BTNDeleteClick(wxCommandEvent& event);
		void BTNImportClick(wxCommandEvent& event);
		void BTNExportClick(wxCommandEvent& event);
		void LSTFilesDoubleClicked(wxCommandEvent& event);
		void Print(const char*);
		void Print(unsigned int);
		void ShowBMP(const char*);
		void ClearBMP();
		void BTNExportAllClick(wxCommandEvent& event);
	private:
		DECLARE_EVENT_TABLE();
		FileStruct FileAr[4096];
		FileStruct FileEx[4096];
		unsigned short FileSize;
		wxFile FHandler;
		////GUI Control Declaration Start
		wxMessageDialog *DLGMsg;
		wxFileDialog *DLGOpenWad;
		wxFileDialog *DLGSaveWad;
		wxFileDialog *DLGSaveHed;
		wxFileDialog *DLGOpenHed;
		wxTextEntryDialog *DLGName;
		wxDirDialog *DLGExportAll;
		wxFileDialog *DLGImport;
		wxFileDialog *DLGExport;
		wxButton *BTNExportAll;
		wxHtmlWindow *HTMLBmp;
		wxButton *BTNSave;
		wxButton *BTNOpen;
		wxButton *BTNExport;
		wxButton *BTNImport;
		wxButton *BTNDelete;
		wxButton *BTNAdd;
		wxTextCtrl *EDTConsole;
		wxListBox *LSTFiles;
		////GUI Control Declaration End
		enum
		{
			////GUI Enum Control ID Start
			ID_BTNEXPORTALL = 1011,
			ID_HTMLBMP = 1010,
			ID_BTNSAVE = 1009,
			ID_BTNOPEN = 1008,
			ID_BTNEXPORT = 1007,
			ID_BTNIMPORT = 1006,
			ID_BTNDELETE = 1005,
			ID_BTNADD = 1004,
			ID_EDTCONSOLE = 1003,
			ID_LSTFILES = 1002,
			////GUI Enum Control ID End
		};
		void OnClose(wxCloseEvent& event);
		void CreateGUIControls();
};

#endif

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

