1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
|
/***********************************(GPL)********************************
* wxHexEditor is a hex edit tool for editing massive files in Linux *
* Copyright (C) 2010 Erdem U. Altinyurt *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; *
* if not, write to the Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
* *
* home : www.wxhexeditor.org *
* email : spamjunkeater@gmail.com *
*************************************************************************/
#ifndef __HexEditorDialogs__
#define __HexEditorDialogs__
#include "HexEditor.h"
#include "FAL.h"
#include "HexEditorCtrl/HexEditorCtrl.h"
#include "HexEditorGui.h"
#include <vector>
#ifdef WX_GCH
#include <wx_pch.h>
#else
#include <wx/wx.h>
#endif
bool HexVerifyAndPrepare(wxString& hexval, wxString Value_Name, wxWindow* parent=NULL);
//ComboBox Filler from stored Registry values
void ComboBoxFill( wxString SearchFormat, wxComboBox* CurrentBox, bool AddString);
class GotoDialog : public GotoDialogGui{
public:
GotoDialog( wxWindow* parent, uint64_t& offset, uint64_t cursor_offset, uint64_t filesize, unsigned BlockSize );
void OnChar( wxKeyEvent& event );
void OnInput( wxCommandEvent& event );
void OnGo( wxCommandEvent& event );
void OnConvert( wxCommandEvent& event );
void EventHandler( wxCommandEvent& event );
wxString Filter( wxString text );
void OnPreviousSector( wxCommandEvent& event );
void OnNextSector( wxCommandEvent& event );
protected:
enum {OPT_OFFSET_MODE=0x1,OPT_DEC_INPUT=0x2,OPT_BRANCH_NORMAL=0x4,OPT_BRANCH_END=0x8};
uint64_t *offset;
uint64_t cursor_offset;
uint64_t filesize;
unsigned BlockSize;
bool is_olddec;
class HexEditor* parent;
wxArrayString hex_letters;//=wxT("abcdefABCDEFxX");
wxArrayString dec_letters;//=wxT("1234567890abcdefABCDEFxX");
};
class FindDialog : public FindDialogGui{
public:
FindDialog( wxWindow* parent, FAL *find_file, wxString title=_("Find") );
bool OnFind( bool intenal=false );
void OnFindPrev( wxCommandEvent& event );
void OnFindAll( bool internal=false );
void OnChar( wxKeyEvent& event );
virtual void EventHandler( wxCommandEvent& event );
bool OnFindEvents( wxCommandEvent& event );
char UTF8SpeedHackChrs[2];
protected:
enum search_options{ SEARCH_HEX=0x1, SEARCH_TEXT=0x2, SEARCH_UTF8=0x4, SEARCH_UTF16=0x8,
SEARCH_MATCHCASE=0x10, SEARCH_BACKWARDS=0x20, SEARCH_WRAPAROUND=0x40, SEARCH_FINDALL=0x80} searchtype;
bool FindBinaryUnitTest( void );
uint64_t FindBinary( wxMemoryBuffer target, uint64_t start_from, unsigned oper=SEARCH_HEX );
uint64_t FindBinaryForward( wxMemoryBuffer target, uint64_t start_from, uint64_t end_to, unsigned oper,
wxProgressDialog* progress_gauge,
wxString& gauge_msg,
uint64_t& totalread);
uint64_t FindBinaryBackward( wxMemoryBuffer target, uint64_t start_from, uint64_t end_to, unsigned oper,
wxProgressDialog* progress_gauge,
wxString& gauge_msg,
uint64_t& totalread);
uint64_t FindText( wxString target, uint64_t start_from, unsigned oper=SEARCH_TEXT);
int SearchAtBuffer( char *bfr, int bfr_size, char* search, int search_size, unsigned oper, std::vector<int> *ret_ptr=NULL );
int MultiThreadMultiSearchAtBuffer( char *bfr, int bfr_size, char* search, int search_size, unsigned oper, std::vector<int> *ret_ptr );
bool SearchAtBufferUnitTest();
void FindSomeBytes( void );
class HexEditor* parent;
FAL *findfile;
void PrepareComboBox( bool AddString );
bool SkipRAM( uint64_t& current_offset, unsigned search_size, unsigned& search_step, bool backward=false );
};
class ReplaceDialog : public FindDialog{
public:
ReplaceDialog( wxWindow* parent, FAL *find_file, wxString title=_("Find & Replace") );
void EventHandler( wxCommandEvent& event );
int OnReplace( bool internal = false );
void OnReplaceAll( void );
void PrepareComboBox( bool AddString );
};
class CopyAsDialog : public CopyAsDialogGui{
public:
CopyAsDialog( wxWindow* parent, FAL* copy_file, Select* select, ArrayOfTAG* MainTagArray);
private:
class HexEditor* parent;
class Select* select;
FAL * copy_file;
ArrayOfTAG* MainTagArray;
void EventHandler( wxCommandEvent& event );
void Copy( void );
void PrepareOptions( int SelectedFunction );
void PrepareFullText( wxString& , wxMemoryBuffer& );
void PrepareFullTextWithTAGs( wxString& , wxMemoryBuffer& , wxString startup, wxString ending, wxString blank);
wxString GetDigitFormat( void );
};
class CompareDialog : public CompareDialogGui{
public:
//CompareDialog( wxWindow* parent );
CompareDialog( wxWindow* parent, wxString file1=wxEmptyString, wxString file2=wxEmptyString );
~CompareDialog();
private:
enum{OPT_CMP_SEARCH_DIFF=0x01,OPT_CMP_STOP_AFTER=0x02, OPT_CMP_MERGE_SECTION=0x04, OPT_CMP_SAVE=0x8, OPT_CMP_CONNECT=0x10};
class HexEditorFrame* parent;
bool Compare( wxFileName f1, wxFileName f2, bool SearchForDiff, int StopAfterNMatch, wxFileName fsave);
void EventHandler( wxCommandEvent& event );
void EventHandler2( wxDropFilesEvent& event );
void OnFileChange( wxFileDirPickerEvent& event );
};
class ChecksumDialog : public ChecksumDialogGui{
public:
ChecksumDialog( wxWindow* parent );
ChecksumDialog( wxWindow* parent, FAL *find_file );
private:
class HexEditorFrame* parent;
wxString CalculateChecksum( FAL& fl, int options );
void EventHandler( wxCommandEvent& event );
void OnFileChange( wxFileDirPickerEvent& event );
};
class XORViewDialog : public XORViewDialogGui{
public:
XORViewDialog( wxWindow* parent, wxMemoryBuffer *XORKey );
void EventHandler( wxCommandEvent& event );
private:
wxMemoryBuffer *XORKey;
};
class PreferencesDialog : public PreferencesDialogGui{
public:
PreferencesDialog( wxWindow* parent );
void EventHandler( wxCommandEvent& event );
void SpinEventHandler( wxSpinEvent& event );
void GetInstalledLanguages(wxArrayString & names, wxArrayLong & identifiers);
void OnSave(wxCommandEvent& event);
void OnResetColours(wxCommandEvent& event);
void SaveRegistry( void );
wxArrayString LangNames;
wxArrayLong LangIds;
wxArrayString ExperimentalEncodingsList;
wxArrayString AvailableEncodings;
};
class DeviceBackupDialog : public DeviceBackupDialogGui{
public:
DeviceBackupDialog( wxWindow* parent );
void OnBackup( wxCommandEvent& event );
};
class DeviceRestoreDialog : public DeviceRestoreDialogGui{
public:
DeviceRestoreDialog( wxWindow* parent );
void OnRestore( wxCommandEvent& event );
};
class DeviceEraseDialog : public DeviceEraseDialogGui{
public:
DeviceEraseDialog( wxWindow* parent );
void OnErase( wxCommandEvent& event );
};
class OSXMessageDialog : public OSXMessageDialogGui{
public:
OSXMessageDialog( wxWindow* parent, wxString message, wxString Caption );
};
void OSXwxMessageBox( wxString message, wxString Caption, int x, wxWindow* parent );
#endif //__HexEditorDialogs__
|