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

#ifndef __THPS2_PRE_FILE_EDITORFRM_H__
#define __THPS2_PRE_FILE_EDITORFRM_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/filedlg.h>
#include <wx/button.h>
#include <wx/listbox.h>
#include <wx/textctrl.h>
#include <wx/html/htmlwin.h>
////Header Include End

#include <wx/file.h>

using namespace std;

#include <cstdlib>
#include <cstring>

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

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

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

struct prefile
{
    char name[32];
    unsigned int bytesize;
    unsigned int realsize;
    unsigned char namesize;
    unsigned char* rawdata;
};

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

class THPS2_PRE_File_EditorFrm : public wxFrame
{
	public:
		THPS2_PRE_File_EditorFrm(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("THPS2 PRE File Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = THPS2_PRE_File_EditorFrm_STYLE);
		void LSTFilesDoubleClicked(wxCommandEvent& event);
		virtual ~THPS2_PRE_File_EditorFrm();
		void BTNImportClick(wxCommandEvent& event);
		void BTNExportClick(wxCommandEvent& event);
		void BTNOpenClick(wxCommandEvent& event);
		void BTNSaveClick(wxCommandEvent& event);
		void Print(const char*);
		void Print(unsigned int);
		void LoadBMP(const char*);
		void ClearBMP();
	private:
		DECLARE_EVENT_TABLE();
		unsigned int presize;
		prefile* pre;
		wxFile FHandler;
		////GUI Control Declaration Start
		wxFileDialog *DLGExport;
		wxFileDialog *DLGSavePre;
		wxFileDialog *DLGImport;
		wxFileDialog *DLGOpenPre;
		wxButton *BTNExport;
		wxButton *BTNImport;
		wxButton *BTNSave;
		wxButton *BTNOpen;
		wxListBox *LSTFiles;
		wxTextCtrl *EDTConsole;
		wxHtmlWindow *HTMLBmp;
		////GUI Control Declaration End
		
		enum
		{
			////GUI Enum Control ID Start
			ID_BTNEXPORT = 1007,
			ID_BTNIMPORT = 1006,
			ID_BTNSAVE = 1005,
			ID_BTNOPEN = 1004,
			ID_LSTFILES = 1003,
			ID_EDTCONSOLE = 1002,
			ID_HTMLBMP = 1001,
			////GUI Enum Control ID End
			ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
		};
		void OnClose(wxCloseEvent& event);
		void CreateGUIControls();
};

#endif

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