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

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

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

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

#include <wx/file.h>
#include <windows.h>
#include <mmsystem.h> 

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

struct pkrfile
{
    char name[32];
    unsigned int size;
    unsigned char* data; 
};

class PKRRepackFrm : public wxFrame
{
	public:
		PKRRepackFrm(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("PKRRepack"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = PKRRepackFrm_STYLE);
		virtual ~PKRRepackFrm();
		void BTNExtractFileClick(wxCommandEvent& event);
		void BTNReplaceClick(wxCommandEvent& event);
		void LSTFilesSelected(wxCommandEvent& event);
		void BTNSaveAllClick(wxCommandEvent& event);
		void BTNPlayWavClick(wxCommandEvent& event);
		void LSTFilesDoubleClicked(wxCommandEvent& event);
	private:
        wxFile* Outpkr;
        wxFile* Allpkr;
        pkrfile files[3771];
        unsigned char dirinfo[856];
        unsigned int aux;
        unsigned int offset;
		////GUI Control Declaration Start
		wxTextCtrl *TextViewer;
		wxHtmlWindow *FileViewer;
		wxButton *BTNPlayWav;
		wxFileDialog *DLGExtract;
		wxFileDialog *DLGReplace;
		wxButton *BTNSaveAll;
		wxButton *BTNReplace;
		wxButton *BTNExtractFile;
		wxTextCtrl *EDTConsole;
		wxListBox *LSTFiles;
		////GUI Control Declaration End
        DECLARE_EVENT_TABLE();
		enum
		{
			////GUI Enum Control ID Start
			ID_TEXTVIEWER = 1013,
			ID_FILEVIEWER = 1012,
			ID_BTNPLAYWAV = 1011,
			ID_BTNSAVEALL = 1010,
			ID_BTNREPLACE = 1007,
			ID_BTNEXTRACTFILE = 1006,
			ID_EDTCONSOLE = 1005,
			ID_LSTFILES = 1004,
			////GUI Enum Control ID End
		};
		void OnClose(wxCloseEvent& event);
		void CreateGUIControls();
};

#endif

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